Skip to content

Packages  ›  trotsky  ›  StepStarterPacks

StepStarterPacks class

Abstract class representing a list of starter packs to process.

Signature:

typescript
export declare class StepStarterPacks<P = StepBuilder, C = null, O extends StepStarterPacksOutput = StepStarterPacksOutput> extends StepBuilderList<P, C, O>

Extends: StepBuilderList<P, C, O>

Example 1

Get multiple starter packs by their URIs:

ts
const packUris = [
  "at://did:plc:example1/app.bsky.graph.starterpack/pack1",
  "at://did:plc:example2/app.bsky.graph.starterpack/pack2"
]

await Trotsky.init(agent)
  .starterPacks(packUris)
  .tap((step) => {
    step.context.forEach(pack => {
      console.log(`${pack.creator.handle}: ${pack.listItemCount} members`)
    })
  })
  .run()

Example 2

Iterate through multiple starter packs:

ts
await Trotsky.init(agent)
  .starterPacks([uri1, uri2, uri3])
  .each()
  .tap((step) => {
    const pack = step.context
    console.log(`Pack by @${pack.creator.handle}`)
    console.log(`Joined: ${pack.joinedAllTimeCount || 0}`)
  })
  .run()

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent, uris)

Initializes the StepStarterPacks instance with the given agent, parent, and URIs.

Properties

Property

Modifiers

Type

Description

_steps

StepStarterPacksEntry<this>[]

Holds the list of steps to be executed for each starter pack entry.

_uris

Resolvable<StepStarterPacksUris>

The URIs of the starter packs to retrieve, which can be resolved dynamically at runtime.

Methods

Method

Modifiers

Description

applyPagination()

Applies the step by resolving the URIs parameter and fetching the starter packs. Sets the starter packs data as the output of this step.

clone(rest)

Clones the current step and returns a new instance with the same parameters.

each(iterator)

Appends a new starter pack entry step to the current list and returns it.