Skip to content

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.

Defined in: src/ParkedEvents.ts:30

new ParkedEvents(_): ParkedEvents

Defined in: node_modules/.pnpm/effect@4.0.6/node_modules/effect/dist/Context.d.ts:121

never

ParkedEvents

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

Defined in: src/ParkedEvents.ts:61

readonly optional migrate?: 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.

readonly optional table?: string

Defined in: src/ParkedEvents.ts:63

Defaults to cqrs_parked_events.

ParkedEvent = typeof ParkedEvent.Type

Defined in: src/ParkedEvents.ts:15

const layerMemory: Layer.Layer<ParkedEvents>

Defined in: src/ParkedEvents.ts:59


const makeMemory: Effect.Effect<ParkedEvents["Service"]>

Defined in: src/ParkedEvents.ts:45

Parked events in process memory. They do not survive a restart.


const makeSql: (…args) => Effect<{ list(viewModel?): Effect<readonly object[], 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.

…[options?: SqlOptions]

Effect<{ list(viewModel?): Effect<readonly object[], EventStoreError>; park(event): Effect<void, EventStoreError>; remove(viewModel, position): Effect<void, EventStoreError>; }, EventStoreError, SqlClient>


const ParkedEvent: Struct<{ attempts: Int; error: String; eventId: String; parkedAt: DateTimeUtcFromMillis; position: Int; viewModel: String; }>

Defined in: src/ParkedEvents.ts:15

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.

SqlOptions

Layer<ParkedEvents, EventStoreError, SqlClient>


migrations(options?): readonly Migration[]

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.

Pick<SqlOptions, "table">

readonly Migration[]