@streamsy/projection 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,16 +60,17 @@ await Effect.runPromise(program.pipe(Effect.provide(host)));
60
60
 
61
61
  ## Commits
62
62
 
63
- | Commit | Fits | Guarantee | Services |
64
- | ------------- | ----------------------------------- | -------------------------------- | -------------------------------- |
65
- | `checkpoint` | `fold` | Exactly once for the saved value | `CheckpointStore` |
66
- | `transaction` | All constructors | Exactly once within SQL | `CheckpointStore`, `Transaction` |
67
- | `producer` | `emit`, `mapAccum`, `mapAccumBatch` | Effectively once for outputs | `CheckpointStore`, output routes |
68
- | `atLeastOnce` | `process` | At least once | `CheckpointStore` |
69
-
70
- `Commit.transaction` provides `SqlClient`. Its SQL, same-owner stream appends,
71
- and checkpoint commit together. External calls are at least once. Memory hosts
72
- provide no `Transaction`.
63
+ | Commit | Fits | Guarantee | Services |
64
+ | ------------- | ----------------------------------- | ----------------------------------------- | -------------------------------- |
65
+ | `checkpoint` | `fold` | Exactly once for the saved value | `CheckpointStore` |
66
+ | `transaction` | All constructors | Exactly once within the owner transaction | `CheckpointStore`, `Transaction` |
67
+ | `producer` | `emit`, `mapAccum`, `mapAccumBatch` | Effectively once for outputs | `CheckpointStore`, output routes |
68
+ | `atLeastOnce` | `process` | At least once | `CheckpointStore` |
69
+
70
+ `Commit.transaction` commits the unit and checkpoint together on a memory or
71
+ SQL storage host. Checkpoints and stream writes must share the transaction owner.
72
+ A SQL handler reads the storage owner’s `SqlClient` from context to join the
73
+ transaction. External calls are at least once.
73
74
 
74
75
  `Commit.producer` pins ranges and producer sequences. Retries append with the
75
76
  same positions; handlers must be deterministic. A missing output on the
@@ -78,16 +79,17 @@ must already exist: its owner creates it at start. There is no atomicity
78
79
  across producer outputs. Chain projections for sinks with different guarantees.
79
80
 
80
81
  `Commit.atLeastOnce` pins before processing, so retries keep `unit.key`.
81
- `Projection.process` with `Commit.transaction` can use `prepare(batch, unit)`
82
- outside the transaction. It runs at least once and passes its result to
82
+ `Projection.process` with `Commit.transaction` can
83
+ use `prepare(batch, unit)` outside the transaction. It runs at least once and passes its result to
83
84
  `process`. A retry can read new input and change `unit.key`.
84
85
 
85
- `Commit.transactionWithCleanup((key, sql) => cleanup)` passes the binding's
86
- checkpoint key and transaction SQL client to the cleanup Effect.
87
- `Projection.forget` runs cleanup after deleting any live checkpoint.
86
+ `Commit.transactionWithCleanup((key) => cleanup)` passes the binding’s
87
+ checkpoint key to the cleanup Effect. The Effect reads its services from context.
88
+ `Projection.forget` runs cleanup after removing the checkpoint and marking any
89
+ route records forgotten. Pass the bound declaration for a routed binding.
88
90
  `Projection.retire` runs it after the tombstone write and owned output cleanup.
89
91
  The callback also runs on a repeated retirement. A cleanup failure rolls back
90
- changes in the same transaction, including SQL run with the supplied client.
92
+ changes in the same transaction, including SQL run with the storage owner’s client.
91
93
 
92
94
  `Commit.withCompensation(f)` calls `f(result, cause, unit)` after successful
93
95
  processing if the commit fails. It is also available as a `.pipe` combinator.
@@ -141,12 +143,13 @@ collection. Two outputs cannot name the same stream or an input.
141
143
  a declaration and a bound table are `StateTable.Declaration` and
142
144
  `StateTable.Bound`.
143
145
 
144
- `FoldByKey.process(table, spec)` builds a `Projection.process` handler, under
145
- `Commit.transaction` with the State stream in `outputs`, that folds records into
146
- one collection. It reads each key's previous row from the table. `sync` and the
147
- fold handler fail with `ProjectionFault` for every wire, SQL and schema failure,
148
- and the handler adds `FoldByKeyError` for a row with the wrong key. A fold's `id`,
149
- `version` and `generation` are its identity, so a rename is a fold fix. See
146
+ `FoldByKey.process(table, spec)` builds a `Projection.process` handler on a SQL
147
+ host. Put the State stream in `outputs` to fold records into one collection. Use
148
+ `Commit.transaction` and provide the storage owner’s `SqlClient` to the runner.
149
+ The fold reads each key’s previous row from the table. `sync` and the fold handler
150
+ fail with `ProjectionFault` for every wire, SQL and schema failure,
151
+ and the handler adds `FoldByKeyError` for a row with the wrong key. A fold's
152
+ identity includes its `id`, `generation` and binding params. See
150
153
  [State tables](https://streamsy.dev/docs/projections/state-table).
151
154
 
152
155
  ## Wake streams
@@ -206,21 +209,21 @@ available to the normal retry policy.
206
209
  A pending unit replays its pinned input ranges. If the input is removed
207
210
  between the pin and the settle, the replay fails with `range-unreproducible`
208
211
  and the pin stays. The final gone unit does not run for that binding. Keep
209
- source history until pending units settle, or call `Projection.forget` on the
210
- binding after you clean up its outputs.
212
+ source history until pending units settle, or call `Projection.forget(bound)`
213
+ to discard its progress.
211
214
 
212
215
  ## Hosts
213
216
 
214
217
  | Layer | Provides | Requires |
215
218
  | ----------------------------- | ---------------------------- | ------------------------------- |
216
219
  | `CheckpointStore.layer` | `CheckpointStore` | `CommitBoundary`, owner records |
217
- | `Transaction.layer` | `Transaction` | `CommitBoundary`, `SqlClient` |
220
+ | `Transaction.layer` | `Transaction` | `CommitBoundary` |
218
221
  | `CheckpointStore.layerMemory` | Standalone `CheckpointStore` | Nothing |
219
222
 
220
223
  `CheckpointStore.layer` keeps checkpoints on the owner of the streams. It works
221
224
  over every Streamsy storage host: `MemoryStorage.layer`, `BunStorage.layer`, and
222
- `DurableObjectStorage.layer`. Add `Transaction.layer` on a SQL host for
223
- `Commit.transaction`. Compose the projection Layers over storage with
225
+ `DurableObjectStorage.layer`. Add `Transaction.layer` over the same storage host for `Commit.transaction`.
226
+ Compose the projection Layers over storage with
224
227
  `Layer.provideMerge` and retain one Layer graph for the host lifetime:
225
228
 
226
229
  ```ts
@@ -320,8 +323,8 @@ units within that binding run in order.
320
323
 
321
324
  Keep `concurrency` below the pool size: each `Commit.transaction` unit holds one
322
325
  pooled connection for its whole handler. Both server drivers default to 10 connections;
323
- leave a connection for reads, appends and runner storage operations. Inside the handler, run all SQL on the
324
- provided `SqlClient` in the handler's fiber. `sql.reserve` or a fiber without the
326
+ leave a connection for reads, appends and runner storage operations. Inside the handler, run all SQL on the storage
327
+ owner’s `SqlClient` in the handler's fiber. `sql.reserve` or a fiber without the
325
328
  handler's transaction context waits forever on SQLite, and on a pool once every
326
329
  connection holds a transaction. Appending to a shared output last keeps its row
327
330
  lock short: units serialize from that append until commit. Units that lock streams
@@ -363,7 +366,7 @@ processing finishes. `registry.retry(target)` makes failed work due now.
363
366
 
364
367
  After a fold fix, `registry.rescan(projectionOrId, WakeClassOrStreamId)` resets one
365
368
  trigger cursor to `ZERO_OFFSET`, clears its stop and wakes the runner. It does not
366
- reset binding checkpoints; use the appropriate version or generation for the fix.
369
+ reset binding checkpoints. Raise `generation` to replay those bindings.
367
370
  A row that still fails to decode stops that stream again. The cursor is stored in
368
371
  both durability modes and survives restart; ingested marks survive only in durable
369
372
  mode. An unknown projection fails with `NotAttached`; an unknown trigger dies with
@@ -441,11 +444,31 @@ projections are follow-only; wait on their output to see a command.
441
444
  backoff from 200 ms, capped at 30 s. `run` does not retry. Handler errors retain
442
445
  their types; `ProjectionFault` carries `phase`, `reason`, and `cause`.
443
446
 
444
- Records are keyed by `id`, `version`, `generation`, and canonical parameters.
445
- Use a new generation for changed input identity or state schema. Retain input
446
- history after the checkpoint, including pinned ranges. Stop the follower first, or use a new generation before
447
- `Projection.forget(bound)`, which calls the Commit's `remove`. For producer
448
- outputs, delete output streams first or use a new generation.
447
+ Records are keyed by `id`, `generation` and canonical parameters.
448
+ Raise `generation` to start over, including after a change to input identity or
449
+ state schema. A new generation replays into fresh `perGeneration` streams.
450
+ Unwrapped outputs with `Commit.producer` or `Commit.transaction` receive the
451
+ replay after their existing items. To start with an empty output, choose a fresh
452
+ address or remove the stream before you start the upgraded process. Attach can
453
+ start replay at startup. [Checkpoints and generations](https://streamsy.dev/docs/projections/checkpoints#generations)
454
+
455
+ Delete an explicit `version: 1`. If a binding used a different `version`, stop
456
+ the old runners and keep the full input history for the new generation. The
457
+ migration guide covers reader cutover and retirement. [Migrate a declaration that set `version`](https://streamsy.dev/docs/projections/checkpoints#migrate-a-declaration-that-set-version)
458
+
459
+ Stop and drain the binding's runners before calling `Projection.forget(bound)`
460
+ to discard progress. Forget keeps the streams. For a routed binding, pass the
461
+ value returned by `declaration.at(params)` so `forget` marks its route records.
462
+ Passing a bare key leaves them live and allows a replay to append to old data.
463
+ Use a store that supports owner-record listing for routed forget on an existing
464
+ checkpoint, including automatic forget after a gone input.
465
+ With a transaction Commit, forgetting an absent checkpoint fails with a retryable
466
+ `token-conflict` if another host commits the binding's first unit meanwhile.
467
+
468
+ `Projection.retire` writes a tombstone even if the checkpoint cannot be decoded.
469
+ It can remove or close owned streams after a forget when you pass the declaration
470
+ with the original routed outputs. The result has `record` and a flat `streams`
471
+ array. [Retire a generation](https://streamsy.dev/docs/projections/checkpoints#retire-a-generation)
449
472
 
450
473
  Without a follower, each `current` replays from the last checkpoint or from
451
474
  the start. A continuously growing input can delay it. Fold handlers must be
@@ -103,9 +103,8 @@ const canonicalRanges = (ranges) => JSON.stringify(Record.fromEntries(Array.map(
103
103
  }];
104
104
  })));
105
105
  /** The key is stable across producer retries; transaction retries may read a longer tail. */
106
- const unitOf = (projectionId, version, generation, params, ranges, due) => ({
106
+ const unitOf = (projectionId, generation, params, ranges, due) => ({
107
107
  projectionId,
108
- version,
109
108
  generation,
110
109
  params,
111
110
  ranges,
@@ -154,6 +153,7 @@ const Tombstone = Schema.Struct({
154
153
  const TombstoneJson = Schema.fromJsonString(Tombstone);
155
154
  const StoredJson = Schema.fromJsonString(Schema.Union([Envelope, Tombstone]));
156
155
  const CHECKPOINT_NAMESPACE = "streamsy.projection.v1";
156
+ const STORED_VERSION_SLOT = "1";
157
157
  const CheckpointKeyJson = Schema.fromJsonString(Schema.Tuple([
158
158
  Schema.Literal(CHECKPOINT_NAMESPACE),
159
159
  Schema.String,
@@ -161,13 +161,19 @@ const CheckpointKeyJson = Schema.fromJsonString(Schema.Tuple([
161
161
  Schema.FiniteFromString,
162
162
  Schema.fromJsonString(Schema.Record(Schema.String, Schema.String))
163
163
  ]));
164
- const recordKey = (key) => encodeKey([
165
- CHECKPOINT_NAMESPACE,
166
- key.id,
167
- String(key.version),
168
- String(key.generation),
169
- canonicalParams(key.params)
170
- ]);
164
+ const assertCheckpointKeyVersion = (key) => {
165
+ if ("version" in key && key.version !== void 0 && key.version !== 1) throw new RangeError(`Projection ${key.id}: version was removed from checkpoint keys.`);
166
+ };
167
+ const keyParts = (key) => {
168
+ assertCheckpointKeyVersion(key);
169
+ return [
170
+ key.id,
171
+ STORED_VERSION_SLOT,
172
+ String(key.generation),
173
+ canonicalParams(key.params)
174
+ ];
175
+ };
176
+ const recordKey = (key) => encodeKey([CHECKPOINT_NAMESPACE, ...keyParts(key)]);
171
177
  /** Token "0" means no record is stored yet. */
172
178
  const ABSENT_TOKEN = "0";
173
179
  const storageFailure = (phase, message) => (cause) => new ProjectionFault({
@@ -181,6 +187,10 @@ const storageFailure = (phase, message) => (cause) => new ProjectionFault({
181
187
  * absent and a concurrent save created it first. That save won the compare-and-set.
182
188
  */
183
189
  const OWNER_RECORD_CONFLICT = "records.conflict";
190
+ /** The load that `loadLatest` uses for a store, keyed by its `load` like the owner metadata. */
191
+ const latestLoads = /* @__PURE__ */ new WeakMap();
192
+ /** Load the latest committed record in a transaction whose snapshot can be older. */
193
+ const loadLatest = (store, key) => (latestLoads.get(store.load) ?? store.load)(key);
184
194
  /** Stores each projection's offsets and encoded state in one compare-and-set record. */
185
195
  var CheckpointStore = class extends Context.Service()("@streamsy/projection/CheckpointStore") {
186
196
  /**
@@ -238,13 +248,7 @@ const decodeStored = (id, encoded) => Schema.decodeEffect(StoredJson)(encoded).p
238
248
  message: `Invalid stored record for ${id}`
239
249
  })));
240
250
  const ROUTED_NAMESPACE = "streamsy.projection.routed.v1";
241
- const routeKeyParts = (key) => [
242
- ROUTED_NAMESPACE,
243
- key.id,
244
- String(key.version),
245
- String(key.generation),
246
- canonicalParams(key.params)
247
- ];
251
+ const routeKeyParts = (key) => [ROUTED_NAMESPACE, ...keyParts(key)];
248
252
  const RouteKeyJson = Schema.fromJsonString(Schema.Tuple([
249
253
  Schema.Literal(ROUTED_NAMESPACE),
250
254
  Schema.String,
@@ -254,23 +258,34 @@ const RouteKeyJson = Schema.fromJsonString(Schema.Tuple([
254
258
  Schema.String,
255
259
  Schema.String
256
260
  ]));
261
+ const RouteValueJson = Schema.fromJsonString(Schema.Struct({ forgotten: Schema.optionalKey(Schema.Literal(true)) }));
262
+ const routeSlot = (key, output, streamId) => encodeKey([
263
+ ...routeKeyParts(key),
264
+ output,
265
+ streamId
266
+ ]);
257
267
  const routeRecords = (store) => {
258
- const entries = (key) => store.list === void 0 ? Effect.fail(new ProjectionFault({
259
- phase: "checkpoint",
260
- reason: "unsupported-composition",
261
- message: "This CheckpointStore does not support listing routed outputs"
262
- })) : store.list(`${encodeKey(routeKeyParts(key)).slice(0, -1)},`);
268
+ const entries = (key) => {
269
+ const prefix = `${encodeKey(routeKeyParts(key)).slice(0, -1)},`;
270
+ return store.list === void 0 ? Effect.fail(new ProjectionFault({
271
+ phase: "checkpoint",
272
+ reason: "unsupported-composition",
273
+ message: "This CheckpointStore does not support listing routed outputs"
274
+ })) : store.list(prefix);
275
+ };
263
276
  return {
264
- has: (key, output, streamId) => store.read(encodeKey([
265
- ...routeKeyParts(key),
266
- output,
267
- streamId
268
- ])).pipe(Effect.map(Option.isSome)),
269
- add: (key, output, streamId) => store.write(encodeKey([
270
- ...routeKeyParts(key),
271
- output,
272
- streamId
273
- ]), "{}"),
277
+ has: (key, output, streamId) => store.read(routeSlot(key, output, streamId)).pipe(Effect.map(Option.isSome)),
278
+ state: (key, output, streamId) => Effect.gen(function* () {
279
+ const encoded = yield* store.read(routeSlot(key, output, streamId));
280
+ if (Option.isNone(encoded)) return "absent";
281
+ return (yield* Schema.decodeEffect(RouteValueJson, { onExcessProperty: "error" })(encoded.value).pipe(Effect.mapError((cause) => new ProjectionFault({
282
+ phase: "process",
283
+ reason: "invalid-record",
284
+ message: `Invalid routed output record for ${key.id}: ${output} at ${streamId}`,
285
+ cause
286
+ })))).forgotten === true ? "forgotten" : "live";
287
+ }),
288
+ add: (key, output, streamId) => store.write(routeSlot(key, output, streamId), "{}"),
274
289
  list: (key) => Effect.flatMap(entries(key), (rows) => Effect.forEach(rows, ([slot]) => Schema.decodeEffect(RouteKeyJson)(slot).pipe(Effect.map(([, , , , , output, streamId]) => ({
275
290
  output,
276
291
  streamId
@@ -280,9 +295,37 @@ const routeRecords = (store) => {
280
295
  message: `Invalid routed output record for ${key.id}`,
281
296
  cause
282
297
  }))))),
298
+ forget: (key, options) => {
299
+ const listed = entries(key);
300
+ const available = options?.ignoreUnsupportedList ? listed.pipe(Effect.catchIf((fault) => fault.reason === "unsupported-composition", () => Effect.succeed([]))) : listed;
301
+ return Effect.flatMap(available, (rows) => Effect.forEach(rows, ([slot]) => store.write(slot, "{\"forgotten\":true}"), { discard: true }));
302
+ },
283
303
  clear: (key) => Effect.flatMap(entries(key), (rows) => Effect.forEach(rows, ([slot]) => store.remove(slot), { discard: true }))
284
304
  };
285
305
  };
306
+ /**
307
+ * In a MySQL transaction a listing is a locking read, so it sees a record committed since
308
+ * the transaction's REPEATABLE READ snapshot. A plain read of an absent key does not.
309
+ * A range that cannot be listed, because of a legacy hashed key, counts as empty.
310
+ */
311
+ const readListed = (store, key) => store.list === void 0 ? Effect.succeedNone : store.list(key).pipe(Effect.map((entries) => Array.findFirst(entries, ([stored]) => stored === key).pipe(Option.map(([, encoded]) => encoded))), Effect.catchIf((fault) => fault.reason === "unsupported-composition", () => Effect.succeedNone));
312
+ const loadRecord = (read) => Effect.fn("Projection.CheckpointStore.load")(function* (key) {
313
+ const encoded = yield* read(recordKey(key));
314
+ if (Option.isNone(encoded)) return {
315
+ record: Option.none(),
316
+ token: ABSENT_TOKEN
317
+ };
318
+ const envelope = yield* decodeStored(key.id, encoded.value);
319
+ if ("retired" in envelope) return yield* new ProjectionFault({
320
+ phase: "load",
321
+ reason: "retired-generation",
322
+ message: `Generation ${key.generation} of ${key.id} is retired. Raise generation to run it again.`
323
+ });
324
+ return {
325
+ record: Option.some(envelope.record),
326
+ token: String(envelope.version)
327
+ };
328
+ });
286
329
  const fromStore = (store) => {
287
330
  const list = Effect.fn("Projection.CheckpointStore.list")(function* (id) {
288
331
  if (store.list === void 0) return yield* unsupportedBindingList();
@@ -305,23 +348,8 @@ const fromStore = (store) => {
305
348
  }
306
349
  return Array.fromIterable(byKey.values());
307
350
  });
308
- const load = Effect.fn("Projection.CheckpointStore.load")(function* (key) {
309
- const encoded = yield* store.read(recordKey(key));
310
- if (Option.isNone(encoded)) return {
311
- record: Option.none(),
312
- token: ABSENT_TOKEN
313
- };
314
- const envelope = yield* decodeStored(key.id, encoded.value);
315
- if ("retired" in envelope) return yield* new ProjectionFault({
316
- phase: "load",
317
- reason: "retired-generation",
318
- message: `Generation ${key.generation} of ${key.id} is retired. Raise generation to run it again.`
319
- });
320
- return {
321
- record: Option.some(envelope.record),
322
- token: String(envelope.version)
323
- };
324
- });
351
+ const load = loadRecord(store.read);
352
+ latestLoads.set(load, loadRecord((key) => store.read(key).pipe(Effect.filterOrElse(Option.isSome, () => readListed(store, key)))));
325
353
  const compareAndSet = Effect.fn("Projection.CheckpointStore.compareAndSet")(function* (key, ifToken, record) {
326
354
  return yield* store.withTransaction(Effect.gen(function* () {
327
355
  const current = yield* load(key);
@@ -364,12 +392,9 @@ const fromStore = (store) => {
364
392
  retire: (key) => store.withTransaction(Effect.gen(function* () {
365
393
  const slot = recordKey(key);
366
394
  const existing = yield* store.read(slot);
367
- let version = 1;
368
- if (Option.isSome(existing)) {
369
- const current = yield* decodeStored(key.id, existing.value);
370
- if ("retired" in current) return "already-retired";
371
- version = current.version + 1;
372
- }
395
+ const current = Option.flatMap(existing, Schema.decodeOption(StoredJson));
396
+ if (Option.isSome(current) && "retired" in current.value) return "already-retired";
397
+ const version = Option.isNone(current) ? 1 : current.value.version + 1;
373
398
  const encoded = yield* Schema.encodeEffect(TombstoneJson)({
374
399
  version,
375
400
  retired: {}
@@ -431,4 +456,4 @@ const rangesOf = (slices) => Record.fromEntries(Array.map(Array.filter(Record.to
431
456
  nextOffset: slice.nextOffset,
432
457
  ...terminalOf(slice)
433
458
  }]));
434
- export { ProjectionFault as _, rangesOf as a, unsupportedBindingList as c, terminalOf as d, unitOf as f, NotAttached as g, NonRetryable as h, fromStore as i, canonicalParams as l, InvalidBinding as m, CheckpointStore as n, recordKey as o, withParams as p, advance as r, restore as s, CheckpointRecord as t, encodeKey as u };
459
+ export { NonRetryable as _, fromStore as a, recordKey as c, canonicalParams as d, encodeKey as f, InvalidBinding as g, withParams as h, assertCheckpointKeyVersion as i, restore as l, unitOf as m, CheckpointStore as n, loadLatest as o, terminalOf as p, advance as r, rangesOf as s, CheckpointRecord as t, unsupportedBindingList as u, NotAttached as v, ProjectionFault as y };
@@ -64,8 +64,6 @@ interface Range extends Schema.Schema.Type<typeof Range> {}
64
64
  /** `params` holds the decoded values the declaration was bound with. Keys use the encoded strings. */
65
65
  interface Unit<P = Record<string, string>> {
66
66
  readonly projectionId: string;
67
- /** The declared version; defaults to 1. */
68
- readonly version: number;
69
67
  readonly generation: number;
70
68
  readonly params: P;
71
69
  /** The inputs that contributed items or a terminal outcome; retries reproduce these. */
@@ -110,7 +108,6 @@ interface CheckpointRecord extends Schema.Schema.Type<typeof CheckpointRecord> {
110
108
  type RetirementStatus = "retired" | "already-retired";
111
109
  interface ProjectionKey {
112
110
  readonly id: string;
113
- readonly version: number;
114
111
  readonly generation: number;
115
112
  readonly params: Record<string, string>;
116
113
  }
@@ -130,16 +127,24 @@ interface RoutedStreamRecord {
130
127
  }
131
128
  /** Access the route inventory in the checkpoint owner's transaction. */
132
129
  interface RouteRecords {
130
+ /** Whether this output owns the stream, including after a forget. */
133
131
  readonly has: (key: ProjectionKey, output: string, streamId: string) => Effect.Effect<boolean, ProjectionFault>;
132
+ readonly state: (key: ProjectionKey, output: string, streamId: string) => Effect.Effect<"absent" | "live" | "forgotten", ProjectionFault>;
134
133
  readonly add: (key: ProjectionKey, output: string, streamId: string) => Effect.Effect<void, ProjectionFault>;
134
+ /** Lists every route record for the key in unspecified order. */
135
135
  readonly list: (key: ProjectionKey) => Effect.Effect<ReadonlyArray<RoutedStreamRecord>, ProjectionFault>;
136
+ /** Mark every route record for the key as forgotten. An absent checkpoint can tolerate unsupported listing. */
137
+ readonly forget: (key: ProjectionKey, options?: {
138
+ readonly ignoreUnsupportedList?: boolean;
139
+ }) => Effect.Effect<void, ProjectionFault>;
136
140
  readonly clear: (key: ProjectionKey) => Effect.Effect<void, ProjectionFault>;
137
141
  }
138
142
  interface CheckpointStoreApi {
139
143
  readonly load: (key: ProjectionKey) => Effect.Effect<Loaded, ProjectionFault>;
140
144
  /**
141
- * Lists each generation and encoded params with a live checkpoint for an id, across
142
- * checkpoint versions. Each pair appears once, in unspecified order.
145
+ * Lists each generation and encoded params with a live checkpoint for an id.
146
+ * Reads every stored version slot, including legacy slots. Each pair appears once,
147
+ * in unspecified order.
143
148
  */
144
149
  readonly list?: (id: string) => Effect.Effect<ReadonlyArray<ListedBinding>, ProjectionFault>;
145
150
  /** Generation-owned streams opened lazily by routed outputs. */
@@ -148,7 +153,7 @@ interface CheckpointStoreApi {
148
153
  readonly compareAndSet: (key: ProjectionKey, ifToken: string, record: CheckpointRecord) => Effect.Effect<string, ProjectionFault>;
149
154
  /** Deletes a live record. Absent keys and tombstones are ignored. */
150
155
  readonly remove: (key: ProjectionKey) => Effect.Effect<void, ProjectionFault>;
151
- /** Replaces the live or absent record with a tombstone. */
156
+ /** Replaces a live, absent or undecodable record with a tombstone. */
152
157
  readonly retire?: (key: ProjectionKey) => Effect.Effect<RetirementStatus, ProjectionFault>;
153
158
  }
154
159
  type EncodedEntries = ReadonlyArray<readonly [key: string, encoded: string]>;
@@ -176,7 +181,6 @@ declare const fromStore: (store: EncodedStore) => CheckpointStoreApi;
176
181
  /** What the kernel needs to locate a record; every projection value satisfies it. */
177
182
  interface Identity {
178
183
  readonly id: string;
179
- readonly version: number;
180
184
  readonly generation: number;
181
185
  readonly params: Record<string, string>;
182
186
  readonly inputs: InputMap;
@@ -1,2 +1,2 @@
1
- import { c as ProjectionKey, d as RoutedStreamRecord, f as fromStore, i as EncodedStore, n as CheckpointStore, o as ListedBinding, p as recordKey, r as CheckpointStoreApi, s as Loaded, t as CheckpointRecord, u as RouteRecords } from "./checkpoint-store-B1199nDD.js";
1
+ import { c as ProjectionKey, d as RoutedStreamRecord, f as fromStore, i as EncodedStore, n as CheckpointStore, o as ListedBinding, p as recordKey, r as CheckpointStoreApi, s as Loaded, t as CheckpointRecord, u as RouteRecords } from "./checkpoint-store-Cy5myzCL.js";
2
2
  export { CheckpointRecord, CheckpointStore, type CheckpointStoreApi, type EncodedStore, type ListedBinding, type Loaded, type ProjectionKey, type RouteRecords, type RoutedStreamRecord, fromStore, recordKey };
@@ -1 +1 @@
1
- export { t as CheckpointRecord, n as CheckpointStore, i as fromStore, o as recordKey } from "./checkpoint-store-ViVETLzZ.js";
1
+ export { t as CheckpointRecord, n as CheckpointStore, a as fromStore, c as recordKey } from "./checkpoint-store-BE0zelau.js";