@streamsy/projection 0.15.0 → 0.17.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 +7 -471
- package/dist/{checkpoint-store-BE0zelau.js → checkpoint-store-8FaC7V5x.js} +304 -106
- package/dist/checkpoint-store-C_Nipiyw.d.ts +317 -0
- package/dist/checkpoint.d.ts +1 -1
- package/dist/checkpoint.js +1 -1
- package/dist/index.d.ts +356 -212
- package/dist/index.js +1349 -721
- package/package.json +12 -12
- package/dist/checkpoint-store-Cy5myzCL.d.ts +0 -188
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
2
|
+
import { DecodeFault, EncodeFault, InvalidStreamParams, OwnerId, StorageFault, StorageOwner, StreamAddress, StreamBusy, Streamsy, TransportFault } from "@streamsy/core";
|
|
3
|
+
/** Declaration order of the map is the read and item order of every pass. */
|
|
4
|
+
type InputMap = Record<string, Streamsy.Address<unknown, unknown>>;
|
|
5
|
+
type ItemOf<Address> = Address extends StreamAddress.StreamAddress<infer A> ? A : never;
|
|
6
|
+
interface Slice<A> {
|
|
7
|
+
/** Cursor the read started after. A page with only skipped State changes can still advance. */
|
|
8
|
+
readonly from: string;
|
|
9
|
+
readonly items: ReadonlyArray<A>;
|
|
10
|
+
/**
|
|
11
|
+
* One storage offset per item, also the read cursor just after that item.
|
|
12
|
+
* A skipped State change has no entry here, so the last item can precede
|
|
13
|
+
* nextOffset. Undefined when the reader does not provide storage offsets.
|
|
14
|
+
*/
|
|
15
|
+
readonly offsets?: ReadonlyArray<string>;
|
|
16
|
+
readonly nextOffset: string;
|
|
17
|
+
readonly upToDate: boolean;
|
|
18
|
+
readonly closed: boolean;
|
|
19
|
+
/** The input is gone. This final unit is followed by forgetting the binding. */
|
|
20
|
+
readonly gone?: boolean;
|
|
21
|
+
}
|
|
22
|
+
type Slices<Inputs extends InputMap> = { readonly [K in keyof Inputs]: Slice<ItemOf<Inputs[K]>>; };
|
|
23
|
+
/** One item tagged with its input; `index` is its position in the whole unit. */
|
|
24
|
+
type Entry<Inputs extends InputMap> = { readonly [K in keyof Inputs]: {
|
|
25
|
+
readonly input: K;
|
|
26
|
+
readonly item: ItemOf<Inputs[K]>;
|
|
27
|
+
readonly index: number;
|
|
28
|
+
/** Storage offset of this item; reading from it resumes after the item. Absent over HTTP. */
|
|
29
|
+
readonly offset?: string;
|
|
30
|
+
}; }[keyof Inputs];
|
|
31
|
+
type InputServices<Inputs extends InputMap> = Inputs[keyof Inputs]["stream"]["Identifier"];
|
|
32
|
+
/** A typed handler failure bearing this marker stops its binding without retry. */
|
|
33
|
+
declare const NonRetryable: unique symbol;
|
|
34
|
+
declare const NotAttached_base: Schema.Class<NotAttached, Schema.TaggedStruct<"NotAttached", {
|
|
35
|
+
readonly projection: Schema.String;
|
|
36
|
+
}>, import("effect/Cause").YieldableError>;
|
|
37
|
+
/** No live runner for this declaration exists in the selected registry. */
|
|
38
|
+
declare class NotAttached extends NotAttached_base {}
|
|
39
|
+
declare const InvalidBinding_base: Schema.Class<InvalidBinding, Schema.TaggedStruct<"InvalidBinding", {
|
|
40
|
+
readonly projection: Schema.String;
|
|
41
|
+
readonly params: Schema.$Record<Schema.String, Schema.String>;
|
|
42
|
+
}>, import("effect/Cause").YieldableError>;
|
|
43
|
+
/** Encoded params do not round-trip through the attached declaration's codecs. */
|
|
44
|
+
declare class InvalidBinding extends InvalidBinding_base {}
|
|
45
|
+
declare const TokenConflict_base: Schema.Class<TokenConflict, Schema.TaggedStruct<"TokenConflict", {
|
|
46
|
+
message: Schema.String;
|
|
47
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
48
|
+
}>, import("effect/Cause").YieldableError>;
|
|
49
|
+
/** Another writer saved the record or claimed the output first. A retry reloads the token. */
|
|
50
|
+
declare class TokenConflict extends TokenConflict_base {
|
|
51
|
+
get isRetryable(): boolean;
|
|
52
|
+
}
|
|
53
|
+
declare const HistoryUnavailable_base: Schema.Class<HistoryUnavailable, Schema.TaggedStruct<"HistoryUnavailable", {
|
|
54
|
+
readonly message: Schema.String;
|
|
55
|
+
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
56
|
+
readonly stream: Schema.optionalKey<Schema.String>;
|
|
57
|
+
}>, import("effect/Cause").YieldableError>;
|
|
58
|
+
/** An input does not have the history after its checkpoint offset, or the binding ended after losing one. */
|
|
59
|
+
declare class HistoryUnavailable extends HistoryUnavailable_base {
|
|
60
|
+
get isRetryable(): boolean;
|
|
61
|
+
}
|
|
62
|
+
declare const InputNotFound_base: Schema.Class<InputNotFound, Schema.TaggedStruct<"InputNotFound", {
|
|
63
|
+
readonly message: Schema.String;
|
|
64
|
+
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
65
|
+
readonly stream: Schema.String;
|
|
66
|
+
}>, import("effect/Cause").YieldableError>;
|
|
67
|
+
/**
|
|
68
|
+
* An input stream does not exist: the store has no record of it, because it was never created or
|
|
69
|
+
* was removed. Create the stream before the first run. A soft-deleted stream, or history missing
|
|
70
|
+
* after the checkpoint offset, is `HistoryUnavailable`. Not retryable: no retry creates the stream.
|
|
71
|
+
*/
|
|
72
|
+
declare class InputNotFound extends InputNotFound_base {
|
|
73
|
+
get isRetryable(): boolean;
|
|
74
|
+
}
|
|
75
|
+
declare const RetiredGeneration_base: Schema.Class<RetiredGeneration, Schema.TaggedStruct<"RetiredGeneration", {
|
|
76
|
+
message: Schema.String;
|
|
77
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
78
|
+
}>, import("effect/Cause").YieldableError>;
|
|
79
|
+
/** The generation was retired. A newer generation owns the projection. */
|
|
80
|
+
declare class RetiredGeneration extends RetiredGeneration_base {
|
|
81
|
+
get isRetryable(): boolean;
|
|
82
|
+
}
|
|
83
|
+
declare const RangeUnreproducible_base: Schema.Class<RangeUnreproducible, Schema.TaggedStruct<"RangeUnreproducible", {
|
|
84
|
+
message: Schema.String;
|
|
85
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
86
|
+
}>, import("effect/Cause").YieldableError>;
|
|
87
|
+
/** A pinned range can no longer be read the same way. A new generation fixes it. */
|
|
88
|
+
declare class RangeUnreproducible extends RangeUnreproducible_base {
|
|
89
|
+
get isRetryable(): boolean;
|
|
90
|
+
}
|
|
91
|
+
declare const IdentityMismatch_base: Schema.Class<IdentityMismatch, Schema.TaggedStruct<"IdentityMismatch", {
|
|
92
|
+
message: Schema.String;
|
|
93
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
94
|
+
}>, import("effect/Cause").YieldableError>;
|
|
95
|
+
/** The stored identity does not match the deployed declaration. */
|
|
96
|
+
declare class IdentityMismatch extends IdentityMismatch_base {
|
|
97
|
+
get isRetryable(): boolean;
|
|
98
|
+
}
|
|
99
|
+
declare const GenerationMismatch_base: Schema.Class<GenerationMismatch, Schema.TaggedStruct<"GenerationMismatch", {
|
|
100
|
+
message: Schema.String;
|
|
101
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
102
|
+
}>, import("effect/Cause").YieldableError>;
|
|
103
|
+
/** A wait names a generation other than the attached one. */
|
|
104
|
+
declare class GenerationMismatch extends GenerationMismatch_base {
|
|
105
|
+
get isRetryable(): boolean;
|
|
106
|
+
}
|
|
107
|
+
declare const SupersededGeneration_base: Schema.Class<SupersededGeneration, Schema.TaggedStruct<"SupersededGeneration", {
|
|
108
|
+
message: Schema.String;
|
|
109
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
110
|
+
}>, import("effect/Cause").YieldableError>;
|
|
111
|
+
/** A newer generation has written. This runner must stop. */
|
|
112
|
+
declare class SupersededGeneration extends SupersededGeneration_base {
|
|
113
|
+
get isRetryable(): boolean;
|
|
114
|
+
}
|
|
115
|
+
declare const InvalidRecord_base: Schema.Class<InvalidRecord, Schema.TaggedStruct<"InvalidRecord", {
|
|
116
|
+
message: Schema.String;
|
|
117
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
118
|
+
}>, import("effect/Cause").YieldableError>;
|
|
119
|
+
/** Stored projection data does not decode, including a record from a newer release. */
|
|
120
|
+
declare class InvalidRecord extends InvalidRecord_base {
|
|
121
|
+
get isRetryable(): boolean;
|
|
122
|
+
}
|
|
123
|
+
declare const InvalidSource_base: Schema.Class<InvalidSource, Schema.TaggedStruct<"InvalidSource", {
|
|
124
|
+
message: Schema.String;
|
|
125
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
126
|
+
}>, import("effect/Cause").YieldableError>;
|
|
127
|
+
/** An input answered with an invalid offset, or a read that does not advance. */
|
|
128
|
+
declare class InvalidSource extends InvalidSource_base {
|
|
129
|
+
get isRetryable(): boolean;
|
|
130
|
+
}
|
|
131
|
+
declare const OutputRejected_base: Schema.Class<OutputRejected, Schema.TaggedStruct<"OutputRejected", {
|
|
132
|
+
message: Schema.String;
|
|
133
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
134
|
+
}>, import("effect/Cause").YieldableError>;
|
|
135
|
+
/** An output is closed, is not empty, or refused the append. */
|
|
136
|
+
declare class OutputRejected extends OutputRejected_base {
|
|
137
|
+
get isRetryable(): boolean;
|
|
138
|
+
}
|
|
139
|
+
declare const UnsupportedComposition_base: Schema.Class<UnsupportedComposition, Schema.TaggedStruct<"UnsupportedComposition", {
|
|
140
|
+
message: Schema.String;
|
|
141
|
+
cause: Schema.optionalKey<Schema.Defect>;
|
|
142
|
+
}>, import("effect/Cause").YieldableError>;
|
|
143
|
+
/** The layers, stores or commit do not compose for this operation. */
|
|
144
|
+
declare class UnsupportedComposition extends UnsupportedComposition_base {
|
|
145
|
+
get isRetryable(): boolean;
|
|
146
|
+
}
|
|
147
|
+
declare const InvalidWakeTime_base: Schema.Class<InvalidWakeTime, Schema.TaggedStruct<"InvalidWakeTime", {
|
|
148
|
+
readonly message: Schema.String;
|
|
149
|
+
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
150
|
+
readonly wakeAt: Schema.Number;
|
|
151
|
+
}>, import("effect/Cause").YieldableError>;
|
|
152
|
+
/**
|
|
153
|
+
* A process handler returned `wakeAt` with a time that is not a non-negative safe integer in epoch
|
|
154
|
+
* milliseconds. `wakeAt` holds the value. Not retryable: the same data gives the same time again.
|
|
155
|
+
*/
|
|
156
|
+
declare class InvalidWakeTime extends InvalidWakeTime_base {
|
|
157
|
+
get isRetryable(): boolean;
|
|
158
|
+
}
|
|
159
|
+
/** Why a projection pass failed. Core errors are used directly where they say it. */
|
|
160
|
+
declare const ProjectionFaultReason: Schema.Union<readonly [typeof TokenConflict, typeof HistoryUnavailable, typeof InputNotFound, typeof RetiredGeneration, typeof RangeUnreproducible, typeof IdentityMismatch, typeof GenerationMismatch, typeof SupersededGeneration, typeof InvalidRecord, typeof InvalidSource, typeof OutputRejected, typeof UnsupportedComposition, typeof InvalidWakeTime, typeof StorageFault, typeof TransportFault, typeof StreamBusy, typeof DecodeFault, typeof EncodeFault, typeof InvalidStreamParams]>;
|
|
161
|
+
type ProjectionFaultReason = typeof ProjectionFaultReason.Type;
|
|
162
|
+
/** The `_tag` of a projection fault reason. `RunnerFailure.reason` holds one. */
|
|
163
|
+
declare const ProjectionFaultReasonTag: Schema.Literals<readonly ["TokenConflict", "HistoryUnavailable", "InputNotFound", "RetiredGeneration", "RangeUnreproducible", "IdentityMismatch", "GenerationMismatch", "SupersededGeneration", "InvalidRecord", "InvalidSource", "OutputRejected", "UnsupportedComposition", "InvalidWakeTime", "StorageFault", "TransportFault", "StreamBusy", "DecodeFault", "EncodeFault", "InvalidStreamParams"]>;
|
|
164
|
+
type ProjectionFaultReasonTag = typeof ProjectionFaultReasonTag.Type;
|
|
165
|
+
declare const ProjectionFault_base: Schema.Class<ProjectionFault, Schema.TaggedStruct<"ProjectionFault", {
|
|
166
|
+
readonly phase: Schema.Literals<readonly ["load", "read", "pin", "process", "checkpoint"]>;
|
|
167
|
+
readonly input: Schema.optionalKey<Schema.String>;
|
|
168
|
+
readonly reason: Schema.Union<readonly [typeof TokenConflict, typeof HistoryUnavailable, typeof InputNotFound, typeof RetiredGeneration, typeof RangeUnreproducible, typeof IdentityMismatch, typeof GenerationMismatch, typeof SupersededGeneration, typeof InvalidRecord, typeof InvalidSource, typeof OutputRejected, typeof UnsupportedComposition, typeof InvalidWakeTime, typeof StorageFault, typeof TransportFault, typeof StreamBusy, typeof DecodeFault, typeof EncodeFault, typeof InvalidStreamParams]>;
|
|
169
|
+
}>, import("effect/Cause").YieldableError>;
|
|
170
|
+
/**
|
|
171
|
+
* Phase says where the run stopped; a `checkpoint` failure means processing already completed.
|
|
172
|
+
* `reason` is a tagged error: narrow it with `Effect.catchReason("ProjectionFault", tag, ...)`.
|
|
173
|
+
*/
|
|
174
|
+
declare class ProjectionFault extends ProjectionFault_base {
|
|
175
|
+
/** The reason, as the JavaScript error cause. */
|
|
176
|
+
readonly cause: DecodeFault | EncodeFault | GenerationMismatch | HistoryUnavailable | IdentityMismatch | InputNotFound | InvalidRecord | InvalidSource | InvalidStreamParams | InvalidWakeTime | OutputRejected | RangeUnreproducible | RetiredGeneration | StorageFault | StreamBusy | SupersededGeneration | TokenConflict | TransportFault | UnsupportedComposition;
|
|
177
|
+
get message(): string;
|
|
178
|
+
get isRetryable(): boolean;
|
|
179
|
+
}
|
|
180
|
+
declare const Range: Schema.Struct<{
|
|
181
|
+
readonly closed: Schema.optionalKey<Schema.Boolean>;
|
|
182
|
+
readonly gone: Schema.optionalKey<Schema.Literal<true>>;
|
|
183
|
+
readonly from: Schema.String;
|
|
184
|
+
readonly nextOffset: Schema.String;
|
|
185
|
+
}>;
|
|
186
|
+
interface Range extends Schema.Schema.Type<typeof Range> {}
|
|
187
|
+
/** `params` holds the decoded values the declaration was bound with. Keys use the encoded strings. */
|
|
188
|
+
interface Unit<P = Record<string, string>> {
|
|
189
|
+
readonly projectionId: string;
|
|
190
|
+
readonly generation: number;
|
|
191
|
+
readonly params: P;
|
|
192
|
+
/** The inputs that contributed items or a terminal outcome; retries reproduce these. */
|
|
193
|
+
readonly ranges: Record<string, Range>;
|
|
194
|
+
/** Recorded wake time, rather than the clock time when this unit runs. */
|
|
195
|
+
readonly due: Option.Option<number>;
|
|
196
|
+
readonly key: string;
|
|
197
|
+
}
|
|
198
|
+
declare const CheckpointRecord: Schema.Struct<{
|
|
199
|
+
readonly identity: Schema.Struct<{
|
|
200
|
+
readonly inputs: Schema.$Record<Schema.String, Schema.String>;
|
|
201
|
+
}>;
|
|
202
|
+
/** Input key to accepted offset; the next pass reads after these. */
|
|
203
|
+
readonly inputs: Schema.$Record<Schema.String, Schema.String>;
|
|
204
|
+
readonly pending: Schema.optionalKey<Schema.Struct<{
|
|
205
|
+
readonly ranges: Schema.$Record<Schema.String, Schema.Struct<{
|
|
206
|
+
readonly closed: Schema.optionalKey<Schema.Boolean>;
|
|
207
|
+
readonly gone: Schema.optionalKey<Schema.Literal<true>>;
|
|
208
|
+
readonly from: Schema.String;
|
|
209
|
+
readonly nextOffset: Schema.String;
|
|
210
|
+
readonly count: Schema.Finite;
|
|
211
|
+
readonly upToDate: Schema.optionalKey<Schema.Boolean>;
|
|
212
|
+
}>>;
|
|
213
|
+
readonly due: Schema.optionalKey<Schema.Finite>;
|
|
214
|
+
readonly seqs: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Finite>>;
|
|
215
|
+
}>>;
|
|
216
|
+
/** Next process wake, in epoch milliseconds. Absent means no timer. */
|
|
217
|
+
readonly wakeAt: Schema.optionalKey<Schema.Finite>;
|
|
218
|
+
/** Inputs whose terminal close has already been processed. */
|
|
219
|
+
readonly closed: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Boolean>>;
|
|
220
|
+
/** The final gone unit committed; only forgetting remains. */
|
|
221
|
+
readonly ended: Schema.optionalKey<Schema.Literal<true>>;
|
|
222
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
223
|
+
readonly adapters: Schema.Struct<{
|
|
224
|
+
readonly outputs: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
225
|
+
readonly epoch: Schema.Finite;
|
|
226
|
+
readonly nextSeq: Schema.Finite;
|
|
227
|
+
}>>>;
|
|
228
|
+
}>;
|
|
229
|
+
}>;
|
|
230
|
+
interface CheckpointRecord extends Schema.Schema.Type<typeof CheckpointRecord> {}
|
|
231
|
+
type RetirementStatus = "retired" | "already-retired";
|
|
232
|
+
interface ProjectionKey {
|
|
233
|
+
readonly id: string;
|
|
234
|
+
readonly generation: number;
|
|
235
|
+
readonly params: Record<string, string>;
|
|
236
|
+
}
|
|
237
|
+
declare const recordKey: (key: ProjectionKey) => string;
|
|
238
|
+
interface Loaded {
|
|
239
|
+
readonly record: Option.Option<CheckpointRecord>;
|
|
240
|
+
readonly token: string;
|
|
241
|
+
}
|
|
242
|
+
/** A binding found by `CheckpointStoreApi.list`. */
|
|
243
|
+
interface ListedBinding {
|
|
244
|
+
readonly generation: number;
|
|
245
|
+
readonly params: Record<string, string>;
|
|
246
|
+
}
|
|
247
|
+
interface RoutedStreamRecord {
|
|
248
|
+
readonly output: string;
|
|
249
|
+
readonly streamId: string;
|
|
250
|
+
}
|
|
251
|
+
/** Access the route inventory in the checkpoint owner's transaction. */
|
|
252
|
+
interface RouteRecords {
|
|
253
|
+
/** Whether this output owns the stream, including after a forget. */
|
|
254
|
+
readonly has: (key: ProjectionKey, output: string, streamId: string) => Effect.Effect<boolean, ProjectionFault>;
|
|
255
|
+
readonly state: (key: ProjectionKey, output: string, streamId: string) => Effect.Effect<"absent" | "live" | "forgotten", ProjectionFault>;
|
|
256
|
+
readonly add: (key: ProjectionKey, output: string, streamId: string) => Effect.Effect<void, ProjectionFault>;
|
|
257
|
+
/** Lists every route record for the key in unspecified order. */
|
|
258
|
+
readonly list: (key: ProjectionKey) => Effect.Effect<ReadonlyArray<RoutedStreamRecord>, ProjectionFault>;
|
|
259
|
+
/** Mark every route record for the key as forgotten. An absent checkpoint can tolerate unsupported listing. */
|
|
260
|
+
readonly forget: (key: ProjectionKey, options?: {
|
|
261
|
+
readonly ignoreUnsupportedList?: boolean;
|
|
262
|
+
}) => Effect.Effect<void, ProjectionFault>;
|
|
263
|
+
readonly clear: (key: ProjectionKey) => Effect.Effect<void, ProjectionFault>;
|
|
264
|
+
}
|
|
265
|
+
interface CheckpointStoreApi {
|
|
266
|
+
readonly load: (key: ProjectionKey) => Effect.Effect<Loaded, ProjectionFault>;
|
|
267
|
+
/**
|
|
268
|
+
* Lists each generation and encoded params with a live checkpoint for an id.
|
|
269
|
+
* Reads every stored version slot, including legacy slots. Each pair appears once,
|
|
270
|
+
* in unspecified order.
|
|
271
|
+
*/
|
|
272
|
+
readonly list?: (id: string) => Effect.Effect<ReadonlyArray<ListedBinding>, ProjectionFault>;
|
|
273
|
+
/** Generation-owned streams opened lazily by routed outputs. */
|
|
274
|
+
readonly routes?: RouteRecords;
|
|
275
|
+
/** Compare-and-set inside the owner transaction; returns the new token. */
|
|
276
|
+
readonly compareAndSet: (key: ProjectionKey, ifToken: string, record: CheckpointRecord) => Effect.Effect<string, ProjectionFault>;
|
|
277
|
+
/** Deletes a live record. Absent keys and tombstones are ignored. */
|
|
278
|
+
readonly remove: (key: ProjectionKey) => Effect.Effect<void, ProjectionFault>;
|
|
279
|
+
/** Replaces a live, absent or undecodable record with a tombstone. */
|
|
280
|
+
readonly retire?: (key: ProjectionKey) => Effect.Effect<RetirementStatus, ProjectionFault>;
|
|
281
|
+
/**
|
|
282
|
+
* The storage owner whose records hold the checkpoints, if the store is on one.
|
|
283
|
+
* `Commit.producer` creates a missing output only on this owner. A wrapper built by
|
|
284
|
+
* spread keeps it.
|
|
285
|
+
*/
|
|
286
|
+
readonly owner?: OwnerId;
|
|
287
|
+
}
|
|
288
|
+
type EncodedEntries = ReadonlyArray<readonly [key: string, encoded: string]>;
|
|
289
|
+
declare const CheckpointStore_base: Context.ServiceClass<CheckpointStore, "@streamsy/projection/CheckpointStore", CheckpointStoreApi>;
|
|
290
|
+
/** Stores each projection's offsets and encoded state in one compare-and-set record. */
|
|
291
|
+
declare class CheckpointStore extends CheckpointStore_base {
|
|
292
|
+
/**
|
|
293
|
+
* Checkpoints on the storage owner, in its transaction. Works over every Streamsy
|
|
294
|
+
* storage host, so checkpoints and streams always share one owner.
|
|
295
|
+
*/
|
|
296
|
+
static readonly layer: Layer.Layer<CheckpointStore, never, StorageOwner>;
|
|
297
|
+
/** An independent store for rebuilt values and tests. It shares no owner with streams. */
|
|
298
|
+
static readonly layerMemory: Layer.Layer<CheckpointStore, never, never>;
|
|
299
|
+
}
|
|
300
|
+
/** The encoded seam a checkpoint Layer builds on; both shipped Layers use it. */
|
|
301
|
+
interface EncodedStore {
|
|
302
|
+
/** A snapshot of the stored entries whose keys start with the exact prefix. */
|
|
303
|
+
readonly list?: (prefix: string) => Effect.Effect<EncodedEntries, ProjectionFault>;
|
|
304
|
+
readonly read: (key: string) => Effect.Effect<Option.Option<string>, ProjectionFault>;
|
|
305
|
+
readonly write: (key: string, value: string) => Effect.Effect<void, ProjectionFault>;
|
|
306
|
+
readonly remove: (key: string) => Effect.Effect<void, ProjectionFault>;
|
|
307
|
+
readonly withTransaction: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E | ProjectionFault, R>;
|
|
308
|
+
}
|
|
309
|
+
declare const fromStore: (store: EncodedStore) => CheckpointStoreApi;
|
|
310
|
+
/** What the kernel needs to locate a record; every projection value satisfies it. */
|
|
311
|
+
interface Identity {
|
|
312
|
+
readonly id: string;
|
|
313
|
+
readonly generation: number;
|
|
314
|
+
readonly params: Record<string, string>;
|
|
315
|
+
readonly inputs: InputMap;
|
|
316
|
+
}
|
|
317
|
+
export { RangeUnreproducible as A, Slices as B, InvalidWakeTime as C, ProjectionFault as D, OutputRejected as E, Entry as F, InputMap as I, InputServices as L, SupersededGeneration as M, TokenConflict as N, ProjectionFaultReason as O, UnsupportedComposition as P, ItemOf as R, InvalidSource as S, NotAttached as T, HistoryUnavailable as _, Identity as a, InvalidBinding as b, ProjectionKey as c, RoutedStreamRecord as d, fromStore as f, GenerationMismatch as g, Unit as h, EncodedStore as i, RetiredGeneration as j, ProjectionFaultReasonTag as k, RetirementStatus as l, Range as m, CheckpointStore as n, ListedBinding as o, recordKey as p, CheckpointStoreApi as r, Loaded as s, CheckpointRecord as t, RouteRecords as u, IdentityMismatch as v, NonRetryable as w, InvalidRecord as x, InputNotFound as y, Slice as z };
|
package/dist/checkpoint.d.ts
CHANGED
|
@@ -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-
|
|
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-C_Nipiyw.js";
|
|
2
2
|
export { CheckpointRecord, CheckpointStore, type CheckpointStoreApi, type EncodedStore, type ListedBinding, type Loaded, type ProjectionKey, type RouteRecords, type RoutedStreamRecord, fromStore, recordKey };
|
package/dist/checkpoint.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CheckpointRecord, n as CheckpointStore, a as fromStore,
|
|
1
|
+
export { t as CheckpointRecord, n as CheckpointStore, a as fromStore, l as recordKey } from "./checkpoint-store-8FaC7V5x.js";
|