@streamsy/projection 0.16.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/dist/{checkpoint-store-9roy8DEy.js → checkpoint-store-8FaC7V5x.js} +302 -104
- package/dist/{checkpoint-store-BQviDBDA.d.ts → checkpoint-store-C_Nipiyw.d.ts} +138 -9
- package/dist/checkpoint.d.ts +1 -1
- package/dist/checkpoint.js +1 -1
- package/dist/index.d.ts +209 -146
- package/dist/index.js +607 -555
- package/package.json +12 -12
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import { OwnerRecords } from "@streamsy/core/internal";
|
|
2
|
+
import { DecodeFault, EncodeFault, InvalidStreamParams, OwnerId, StorageFault, StorageOwner, StreamAddress, StreamBusy, Streamsy, TransportFault } from "@streamsy/core";
|
|
4
3
|
/** Declaration order of the map is the read and item order of every pass. */
|
|
5
4
|
type InputMap = Record<string, Streamsy.Address<unknown, unknown>>;
|
|
6
5
|
type ItemOf<Address> = Address extends StreamAddress.StreamAddress<infer A> ? A : never;
|
|
@@ -43,16 +42,140 @@ declare const InvalidBinding_base: Schema.Class<InvalidBinding, Schema.TaggedStr
|
|
|
43
42
|
}>, import("effect/Cause").YieldableError>;
|
|
44
43
|
/** Encoded params do not round-trip through the attached declaration's codecs. */
|
|
45
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;
|
|
46
165
|
declare const ProjectionFault_base: Schema.Class<ProjectionFault, Schema.TaggedStruct<"ProjectionFault", {
|
|
47
166
|
readonly phase: Schema.Literals<readonly ["load", "read", "pin", "process", "checkpoint"]>;
|
|
48
|
-
readonly reason: Schema.Literals<readonly ["history-unavailable", "identity-mismatch", "invalid-record", "invalid-source", "invalid-options", "invalid-output", "token-conflict", "output-busy", "range-unreproducible", "stale-epoch", "retired-generation", "storage-failure", "unsupported-composition"]>;
|
|
49
167
|
readonly input: Schema.optionalKey<Schema.String>;
|
|
50
|
-
readonly
|
|
51
|
-
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
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]>;
|
|
52
169
|
}>, import("effect/Cause").YieldableError>;
|
|
53
|
-
/**
|
|
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
|
+
*/
|
|
54
174
|
declare class ProjectionFault extends ProjectionFault_base {
|
|
55
|
-
|
|
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;
|
|
56
179
|
}
|
|
57
180
|
declare const Range: Schema.Struct<{
|
|
58
181
|
readonly closed: Schema.optionalKey<Schema.Boolean>;
|
|
@@ -155,6 +278,12 @@ interface CheckpointStoreApi {
|
|
|
155
278
|
readonly remove: (key: ProjectionKey) => Effect.Effect<void, ProjectionFault>;
|
|
156
279
|
/** Replaces a live, absent or undecodable record with a tombstone. */
|
|
157
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;
|
|
158
287
|
}
|
|
159
288
|
type EncodedEntries = ReadonlyArray<readonly [key: string, encoded: string]>;
|
|
160
289
|
declare const CheckpointStore_base: Context.ServiceClass<CheckpointStore, "@streamsy/projection/CheckpointStore", CheckpointStoreApi>;
|
|
@@ -164,7 +293,7 @@ declare class CheckpointStore extends CheckpointStore_base {
|
|
|
164
293
|
* Checkpoints on the storage owner, in its transaction. Works over every Streamsy
|
|
165
294
|
* storage host, so checkpoints and streams always share one owner.
|
|
166
295
|
*/
|
|
167
|
-
static readonly layer: Layer.Layer<CheckpointStore, never,
|
|
296
|
+
static readonly layer: Layer.Layer<CheckpointStore, never, StorageOwner>;
|
|
168
297
|
/** An independent store for rebuilt values and tests. It shares no owner with streams. */
|
|
169
298
|
static readonly layerMemory: Layer.Layer<CheckpointStore, never, never>;
|
|
170
299
|
}
|
|
@@ -185,4 +314,4 @@ interface Identity {
|
|
|
185
314
|
readonly params: Record<string, string>;
|
|
186
315
|
readonly inputs: InputMap;
|
|
187
316
|
}
|
|
188
|
-
export {
|
|
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";
|