ParkedEvents
Events a view model gave up on, so the rest of the log could move past them.
A view model with the ViewModel.park failure policy records an event here
once it has failed often enough, skips it from then on, and handles it again
when ViewModels.retryParked asks it to.
Classes
Section titled “Classes”ParkedEvents
Section titled “ParkedEvents”Defined in: src/ParkedEvents.ts:30
Extends
Section titled “Extends”Shape<"effect-cqrs/ParkedEvents", {list(viewModel?):Effect<readonlyobject[],EventStoreError>;park(event):Effect<void,EventStoreError>;remove(viewModel,position):Effect<void,EventStoreError>; },this>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ParkedEvents(
_):ParkedEvents
Defined in: node_modules/.pnpm/effect@4.0.6/node_modules/effect/dist/Context.d.ts:121
Parameters
Section titled “Parameters”never
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Context.Service<ParkedEvents, { /** Records an event, replacing an earlier record of the same one. */ park(event: ParkedEvent): Effect.Effect<void, EventStoreError> /** The parked events of one view model, or of all of them, by view model and position. */ list(viewModel?: string): Effect.Effect<ReadonlyArray<ParkedEvent>, EventStoreError> /** Forgets an event, once it has been handled. */ remove(viewModel: string, position: number): Effect.Effect<void, EventStoreError> }>()("effect-cqrs/ParkedEvents").constructor
Interfaces
Section titled “Interfaces”SqlOptions
Section titled “SqlOptions”Defined in: src/ParkedEvents.ts:61
Properties
Section titled “Properties”migrate?
Section titled “migrate?”
readonlyoptionalmigrate?:boolean
Defined in: src/ParkedEvents.ts:68
Creates the table on startup when it is missing. Defaults to true. Turn it
off where the schema is managed elsewhere, from migrations.
table?
Section titled “table?”
readonlyoptionaltable?:string
Defined in: src/ParkedEvents.ts:63
Defaults to cqrs_parked_events.
Type Aliases
Section titled “Type Aliases”ParkedEvent
Section titled “ParkedEvent”ParkedEvent = typeof
ParkedEvent.Type
Defined in: src/ParkedEvents.ts:15
Variables
Section titled “Variables”layerMemory
Section titled “layerMemory”
constlayerMemory:Layer.Layer<ParkedEvents>
Defined in: src/ParkedEvents.ts:59
makeMemory
Section titled “makeMemory”
constmakeMemory:Effect.Effect<ParkedEvents["Service"]>
Defined in: src/ParkedEvents.ts:45
Parked events in process memory. They do not survive a restart.
makeSql
Section titled “makeSql”
constmakeSql: (…args) =>Effect<{list(viewModel?):Effect<readonlyobject[],EventStoreError>;park(event):Effect<void,EventStoreError>;remove(viewModel,position):Effect<void,EventStoreError>; },EventStoreError,SqlClient>
Defined in: src/ParkedEvents.ts:97
Parked events in a SQL table, on SQLite or PostgreSQL.
Parameters
Section titled “Parameters”…[options?: SqlOptions]
Returns
Section titled “Returns”Effect<{ list(viewModel?): Effect<readonly object[], EventStoreError>; park(event): Effect<void, EventStoreError>; remove(viewModel, position): Effect<void, EventStoreError>; }, EventStoreError, SqlClient>
ParkedEvent
Section titled “ParkedEvent”
constParkedEvent:Struct<{attempts:Int;error:String;eventId:String;parkedAt:DateTimeUtcFromMillis;position:Int;viewModel:String; }>
Defined in: src/ParkedEvents.ts:15
Functions
Section titled “Functions”layerSql()
Section titled “layerSql()”layerSql(
options?):Layer<ParkedEvents,EventStoreError,SqlClient>
Defined in: src/ParkedEvents.ts:152
Parked events in a SQL table, see makeSql. Give it the client of the
read models, and a retried event leaves the table in the same transaction as
its handler’s writes when the view model has a transaction.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Layer<ParkedEvents, EventStoreError, SqlClient>
migrations()
Section titled “migrations()”migrations(
options?): readonlyMigration[]
Defined in: src/ParkedEvents.ts:77
The migrations of the table, the same on SQLite and PostgreSQL. They are what
layerSql runs unless migrate is false, and are safe to run again.
Parameters
Section titled “Parameters”options?
Section titled “options?”Pick<SqlOptions, "table">
Returns
Section titled “Returns”readonly Migration[]