Skip to content

Packages  ›  trotsky  ›  StepStarterPacksEntry

StepStarterPacksEntry class

Represents an individual entry step within a StepStarterPacks list. Provides context for each starter pack in the iteration.

Signature:

typescript
export declare class StepStarterPacksEntry<P = StepStarterPacks, C = StepStarterPacksOutput[number], O = unknown> extends StepBuilderListEntry<P, C, O>

Extends: StepBuilderListEntry<P, C, O>

Example 1

Iterate through starter packs and log details:

ts
await Trotsky.init(agent)
  .starterPacks([uri1, uri2])
  .each()
  .tap((step) => {
    console.log(`Creator: @${step.context.creator.handle}`)
    console.log(`Members: ${step.context.listItemCount}`)
  })
  .run()

Example 2

Filter starter packs by join count:

ts
await Trotsky.init(agent)
  .starterPacks(packUris)
  .each()
  .when((step) => (step.context.joinedAllTimeCount || 0) > 100)
  .tap((step) => {
    console.log(`Popular pack: ${step.context.uri}`)
  })
  .run()

Methods

Method

Modifiers

Description

apply()

Applies the step's logic but does nothing by default. This method is usually overridden by child classes but will not throw an error if not.