@party-stack/ontology-backend 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +148 -2
- package/lib/actions.d.ts +47 -0
- package/lib/actions.d.ts.map +1 -0
- package/lib/actions.js +306 -0
- package/lib/actions.js.map +1 -0
- package/lib/clients.d.ts +236 -0
- package/lib/clients.d.ts.map +1 -0
- package/lib/clients.js +211 -0
- package/lib/clients.js.map +1 -0
- package/lib/delivery.d.ts +746 -0
- package/lib/delivery.d.ts.map +1 -0
- package/lib/delivery.js +863 -0
- package/lib/delivery.js.map +1 -0
- package/lib/description.d.ts +29 -0
- package/lib/description.d.ts.map +1 -0
- package/lib/description.js +28 -0
- package/lib/description.js.map +1 -0
- package/lib/encrypted.d.ts +41 -0
- package/lib/encrypted.d.ts.map +1 -0
- package/lib/encrypted.js +111 -0
- package/lib/encrypted.js.map +1 -0
- package/lib/errors.d.ts +106 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +275 -0
- package/lib/errors.js.map +1 -0
- package/lib/fulfillment.d.ts +25 -0
- package/lib/fulfillment.d.ts.map +1 -0
- package/lib/fulfillment.js +99 -0
- package/lib/fulfillment.js.map +1 -0
- package/lib/index.d.ts +297 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +91 -0
- package/lib/index.js.map +1 -0
- package/lib/maintenance.d.ts +11 -0
- package/lib/maintenance.d.ts.map +1 -0
- package/lib/maintenance.js +24 -0
- package/lib/maintenance.js.map +1 -0
- package/lib/meta.d.ts +26 -0
- package/lib/meta.d.ts.map +1 -0
- package/lib/meta.js +213 -0
- package/lib/meta.js.map +1 -0
- package/lib/owned.d.ts +74 -0
- package/lib/owned.d.ts.map +1 -0
- package/lib/owned.js +593 -0
- package/lib/owned.js.map +1 -0
- package/lib/policy/indexes.d.ts +12 -0
- package/lib/policy/indexes.d.ts.map +1 -0
- package/lib/policy/indexes.js +113 -0
- package/lib/policy/indexes.js.map +1 -0
- package/lib/policy/planner.d.ts +10 -0
- package/lib/policy/planner.d.ts.map +1 -0
- package/lib/policy/planner.js +118 -0
- package/lib/policy/planner.js.map +1 -0
- package/lib/policy/view.d.ts +31 -0
- package/lib/policy/view.d.ts.map +1 -0
- package/lib/policy/view.js +173 -0
- package/lib/policy/view.js.map +1 -0
- package/lib/policy.d.ts +47 -0
- package/lib/policy.d.ts.map +1 -0
- package/lib/policy.js +100 -0
- package/lib/policy.js.map +1 -0
- package/lib/protocol.d.ts +570 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +144 -0
- package/lib/protocol.js.map +1 -0
- package/lib/query.d.ts +33 -0
- package/lib/query.d.ts.map +1 -0
- package/lib/query.js +51 -0
- package/lib/query.js.map +1 -0
- package/lib/references.d.ts +8 -0
- package/lib/references.d.ts.map +1 -0
- package/lib/references.js +41 -0
- package/lib/references.js.map +1 -0
- package/lib/storage.d.ts +55 -0
- package/lib/storage.d.ts.map +1 -0
- package/lib/storage.js +168 -0
- package/lib/storage.js.map +1 -0
- package/lib/subset.d.ts +19 -0
- package/lib/subset.d.ts.map +1 -0
- package/lib/subset.js +150 -0
- package/lib/subset.js.map +1 -0
- package/lib/subsetSchema.d.ts +10 -0
- package/lib/subsetSchema.d.ts.map +1 -0
- package/lib/subsetSchema.js +20 -0
- package/lib/subsetSchema.js.map +1 -0
- package/package.json +72 -3
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
import { BackendError, ValidationIssue } from "./errors.js";
|
|
2
|
+
import { DeliveryPolicy, DeliveryPosition, DeliverySubscription } from "./delivery.js";
|
|
3
|
+
import { ActionReceipt, ActionRequest } from "./index.js";
|
|
4
|
+
import { CompiledSubset } from "./subset.js";
|
|
5
|
+
import { ClientLease, ClientSession, ClientToken } from "./clients.js";
|
|
6
|
+
import { Row } from "@party-stack/ontology-storage";
|
|
7
|
+
import { Effect, Schema, Scope, Stream } from "effect";
|
|
8
|
+
import { Override } from "@party-stack/ontology-storage/overlay";
|
|
9
|
+
//#region src/protocol.d.ts
|
|
10
|
+
/** Logical action state shared by owned sources, intermediate replicas and clients. */
|
|
11
|
+
export interface PendingAction {
|
|
12
|
+
readonly invocation: ActionRequest;
|
|
13
|
+
readonly requestIdentity: string;
|
|
14
|
+
readonly createdAt: number;
|
|
15
|
+
readonly sequence: number;
|
|
16
|
+
readonly state: "queued" | "sending" | "acknowledged" | "blocked";
|
|
17
|
+
readonly optimistic: boolean;
|
|
18
|
+
readonly attempts: number;
|
|
19
|
+
/** Total attempts at the last explicit retry; automatic retry budgets start here. */
|
|
20
|
+
readonly retryFromAttempt?: number;
|
|
21
|
+
readonly nextAttemptAt?: number;
|
|
22
|
+
readonly failureMessage?: string;
|
|
23
|
+
readonly failureIssues?: readonly ValidationIssue[];
|
|
24
|
+
readonly completedAt?: number;
|
|
25
|
+
/** The upstream cannot safely deduplicate another attempt; caller acknowledgment is required. */
|
|
26
|
+
readonly retryRequiresAcknowledgement?: boolean;
|
|
27
|
+
readonly failureOutcome?: "not-committed" | "unknown";
|
|
28
|
+
readonly failureRetryable?: boolean;
|
|
29
|
+
readonly receipt?: ActionReceipt;
|
|
30
|
+
readonly failure?: BackendError["kind"];
|
|
31
|
+
readonly touchedTypes: readonly string[];
|
|
32
|
+
readonly submission?: {
|
|
33
|
+
readonly clientId: string;
|
|
34
|
+
readonly sequence: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Consistent logical state. Selected views limit membership, while authorization
|
|
38
|
+
* and property/action projection remain the server's responsibility.
|
|
39
|
+
*/
|
|
40
|
+
export interface ReplicaStateSnapshot {
|
|
41
|
+
readonly sourceId: string;
|
|
42
|
+
readonly revision: number;
|
|
43
|
+
readonly definition: string;
|
|
44
|
+
readonly view?: {
|
|
45
|
+
readonly generation: number;
|
|
46
|
+
};
|
|
47
|
+
readonly objects: readonly {
|
|
48
|
+
readonly objectType: string;
|
|
49
|
+
readonly base: readonly Row<Record<string, unknown>>[];
|
|
50
|
+
readonly overrides: readonly Row<Override<Record<string, unknown>>>[];
|
|
51
|
+
}[];
|
|
52
|
+
readonly pending: readonly PendingAction[];
|
|
53
|
+
readonly completed: readonly PendingAction[];
|
|
54
|
+
}
|
|
55
|
+
/** Membership is evaluated against the source's composed visible state. Action
|
|
56
|
+
* inspection is privileged and must be authorized independently of row access.
|
|
57
|
+
*/
|
|
58
|
+
export interface StateSelection {
|
|
59
|
+
readonly subsets: readonly CompiledSubset[];
|
|
60
|
+
readonly actionIds: readonly string[];
|
|
61
|
+
/** Include the pending queue. Outcomes are selected by actionIds, including
|
|
62
|
+
* pending actions already observed by the child, not the parent's full history. */
|
|
63
|
+
readonly inspectActions?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface ClientView {
|
|
66
|
+
readonly generation: number;
|
|
67
|
+
readonly selection: StateSelection;
|
|
68
|
+
}
|
|
69
|
+
export interface ClientState {
|
|
70
|
+
readonly coverage?: readonly {
|
|
71
|
+
readonly subset: CompiledSubset;
|
|
72
|
+
readonly complete: boolean;
|
|
73
|
+
/** Previously confirmed resident coverage; it may need background refresh. */
|
|
74
|
+
readonly cached?: boolean;
|
|
75
|
+
}[];
|
|
76
|
+
readonly state: ReplicaStateSnapshot;
|
|
77
|
+
readonly client: ClientLease;
|
|
78
|
+
}
|
|
79
|
+
export interface ClientSubmission {
|
|
80
|
+
readonly session: ClientSession;
|
|
81
|
+
readonly sequence: number;
|
|
82
|
+
readonly invocation: ActionRequest;
|
|
83
|
+
readonly optimistic: boolean;
|
|
84
|
+
/** Newly staged child copies required before first acceptance; duplicates need no transfer. */
|
|
85
|
+
readonly stagedAttachments?: readonly string[];
|
|
86
|
+
readonly view?: ClientView;
|
|
87
|
+
}
|
|
88
|
+
/** A protocol source need not contain a Replica or an upstream outbox. Ordered
|
|
89
|
+
* submission idempotency is scoped to a valid resumable client lease. A transport
|
|
90
|
+
* must bind authorization and decode data before exposing this interface.
|
|
91
|
+
*/
|
|
92
|
+
export interface OntologySource {
|
|
93
|
+
readonly sourceId: string;
|
|
94
|
+
readonly outbox?: {
|
|
95
|
+
readonly remove: (id: string, options?: {
|
|
96
|
+
readonly allowUnknownOutcome?: boolean;
|
|
97
|
+
}) => Effect.Effect<void, BackendError>;
|
|
98
|
+
readonly retry: (id: string, options?: {
|
|
99
|
+
readonly allowUnknownOutcome?: boolean;
|
|
100
|
+
}) => Effect.Effect<void, BackendError>;
|
|
101
|
+
readonly edit: (id: string, request: ActionRequest) => Effect.Effect<void, BackendError>;
|
|
102
|
+
};
|
|
103
|
+
readonly supportsIdempotency: boolean;
|
|
104
|
+
readonly openClient: (resume?: ClientToken) => Effect.Effect<ClientLease, BackendError>;
|
|
105
|
+
readonly read: (session: ClientSession, view?: ClientView) => Effect.Effect<ClientState, BackendError>;
|
|
106
|
+
readonly subscribe?: (session: ClientSession, view: ClientView, policy?: DeliveryPolicy, resume?: DeliveryPosition) => Effect.Effect<DeliverySubscription, BackendError, Scope.Scope>;
|
|
107
|
+
readonly acknowledgeDelivery?: (position: DeliveryPosition) => Effect.Effect<void, BackendError>;
|
|
108
|
+
/** Acceptance only; selected delivery carries the resulting state. */
|
|
109
|
+
readonly accept?: (request: ClientSubmission) => Effect.Effect<void, BackendError>;
|
|
110
|
+
/** Snapshot-mode interest lease. The first element confirms acquisition;
|
|
111
|
+
* failures/EOF remain observable, and closing the stream releases interest.
|
|
112
|
+
* Replica supervision owns retries, not the transport.
|
|
113
|
+
*/
|
|
114
|
+
readonly demand: (subset: CompiledSubset) => Stream.Stream<void, BackendError>;
|
|
115
|
+
readonly subscribeChanges: Effect.Effect<Stream.Stream<void, BackendError>, BackendError, Scope.Scope>;
|
|
116
|
+
readonly submit: (request: ClientSubmission) => Effect.Effect<ClientState, BackendError>;
|
|
117
|
+
readonly acknowledge: (session: ClientSession, revision: number, through: number, viewGeneration?: number) => Effect.Effect<void, BackendError>;
|
|
118
|
+
}
|
|
119
|
+
/** Row/action arrays represent keyed records, not their transport ordering. */
|
|
120
|
+
export declare const stateIdentity: (snapshot: ReplicaStateSnapshot) => string;
|
|
121
|
+
export declare const ActionRequestSchema: Schema.Struct<{
|
|
122
|
+
readonly id: Schema.NonEmptyString;
|
|
123
|
+
readonly name: Schema.NonEmptyString;
|
|
124
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
125
|
+
readonly replay: Schema.optional<Schema.Struct<{
|
|
126
|
+
readonly now: Schema.String;
|
|
127
|
+
readonly seed: Schema.NonEmptyString;
|
|
128
|
+
}>>;
|
|
129
|
+
}>;
|
|
130
|
+
export declare const PendingActionSchema: Schema.Struct<{
|
|
131
|
+
readonly invocation: Schema.Struct<{
|
|
132
|
+
readonly id: Schema.NonEmptyString;
|
|
133
|
+
readonly name: Schema.NonEmptyString;
|
|
134
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
135
|
+
readonly replay: Schema.optional<Schema.Struct<{
|
|
136
|
+
readonly now: Schema.String;
|
|
137
|
+
readonly seed: Schema.NonEmptyString;
|
|
138
|
+
}>>;
|
|
139
|
+
}>;
|
|
140
|
+
readonly requestIdentity: Schema.String;
|
|
141
|
+
readonly createdAt: Schema.Finite;
|
|
142
|
+
readonly sequence: Schema.Int;
|
|
143
|
+
readonly state: Schema.Literals<readonly ["queued", "sending", "acknowledged", "blocked"]>;
|
|
144
|
+
readonly optimistic: Schema.Boolean;
|
|
145
|
+
readonly attempts: Schema.Int;
|
|
146
|
+
readonly retryFromAttempt: Schema.optional<Schema.Int>;
|
|
147
|
+
readonly nextAttemptAt: Schema.optional<Schema.Finite>;
|
|
148
|
+
readonly failureMessage: Schema.optional<Schema.String>;
|
|
149
|
+
readonly failureIssues: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
150
|
+
readonly message: Schema.String;
|
|
151
|
+
readonly path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
|
|
152
|
+
readonly code: Schema.optional<Schema.String>;
|
|
153
|
+
readonly category: Schema.optional<Schema.Literals<readonly ["input", "reference", "custom"]>>;
|
|
154
|
+
readonly source: Schema.optional<Schema.Literals<readonly ["parameter", "submission", "user-facing"]>>;
|
|
155
|
+
readonly messageSource: Schema.optional<Schema.Literals<readonly ["standard", "configured"]>>;
|
|
156
|
+
}>>>;
|
|
157
|
+
readonly completedAt: Schema.optional<Schema.Finite>;
|
|
158
|
+
readonly retryRequiresAcknowledgement: Schema.optional<Schema.Boolean>;
|
|
159
|
+
readonly failureOutcome: Schema.optional<Schema.Literals<readonly ["not-committed", "unknown"]>>;
|
|
160
|
+
readonly failureRetryable: Schema.optional<Schema.Boolean>;
|
|
161
|
+
readonly receipt: Schema.optional<Schema.Struct<{
|
|
162
|
+
readonly operationId: Schema.String;
|
|
163
|
+
readonly outcome: Schema.Literal<"committed">;
|
|
164
|
+
readonly result: Schema.optional<Schema.Unknown>;
|
|
165
|
+
readonly cursor: Schema.optional<Schema.String>;
|
|
166
|
+
readonly providerOperationId: Schema.optional<Schema.String>;
|
|
167
|
+
readonly affected: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
168
|
+
readonly objectType: Schema.String;
|
|
169
|
+
readonly keys: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite]>>>;
|
|
170
|
+
}>>>;
|
|
171
|
+
readonly affectedComplete: Schema.optional<Schema.Boolean>;
|
|
172
|
+
readonly attachmentIdMappings: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
173
|
+
readonly localId: Schema.String;
|
|
174
|
+
readonly remoteId: Schema.String;
|
|
175
|
+
}>>>;
|
|
176
|
+
}>>;
|
|
177
|
+
readonly failure: Schema.optional<Schema.Literals<readonly ["Unauthenticated", "Forbidden", "NotFound", "ValidationFailed", "InvalidRequest", "InvalidResponse", "InvalidConfiguration", "Conflict", "NotImplemented", "RateLimited", "Unavailable", "Internal", "HistoryExpired", "SessionExpired", "SessionReplaced", "ViewReplaced", "ResultExpired", "SourceMismatch", "SchemaMismatch"]>>;
|
|
178
|
+
readonly touchedTypes: Schema.$Array<Schema.String>;
|
|
179
|
+
readonly submission: Schema.optional<Schema.Struct<{
|
|
180
|
+
readonly clientId: Schema.NonEmptyString;
|
|
181
|
+
readonly sequence: Schema.Int;
|
|
182
|
+
}>>;
|
|
183
|
+
}>;
|
|
184
|
+
export declare const CompiledSubsetSchema: Schema.Struct<{
|
|
185
|
+
readonly objectType: Schema.NonEmptyString;
|
|
186
|
+
readonly query: Schema.optional<Schema.declare<import("@party-stack/ontology-storage").Query, import("@party-stack/ontology-storage").Query>>;
|
|
187
|
+
}>;
|
|
188
|
+
export declare const StateSelectionSchema: Schema.Struct<{
|
|
189
|
+
readonly subsets: Schema.$Array<Schema.Struct<{
|
|
190
|
+
readonly objectType: Schema.NonEmptyString;
|
|
191
|
+
readonly query: Schema.optional<Schema.declare<import("@party-stack/ontology-storage").Query, import("@party-stack/ontology-storage").Query>>;
|
|
192
|
+
}>>;
|
|
193
|
+
readonly actionIds: Schema.$Array<Schema.NonEmptyString>;
|
|
194
|
+
readonly inspectActions: Schema.optional<Schema.Boolean>;
|
|
195
|
+
}>;
|
|
196
|
+
export declare const ClientViewSchema: Schema.Struct<{
|
|
197
|
+
readonly generation: Schema.Int;
|
|
198
|
+
readonly selection: Schema.Struct<{
|
|
199
|
+
readonly subsets: Schema.$Array<Schema.Struct<{
|
|
200
|
+
readonly objectType: Schema.NonEmptyString;
|
|
201
|
+
readonly query: Schema.optional<Schema.declare<import("@party-stack/ontology-storage").Query, import("@party-stack/ontology-storage").Query>>;
|
|
202
|
+
}>>;
|
|
203
|
+
readonly actionIds: Schema.$Array<Schema.NonEmptyString>;
|
|
204
|
+
readonly inspectActions: Schema.optional<Schema.Boolean>;
|
|
205
|
+
}>;
|
|
206
|
+
}>;
|
|
207
|
+
export declare const ReplicaStateSnapshotSchema: Schema.Struct<{
|
|
208
|
+
readonly sourceId: Schema.NonEmptyString;
|
|
209
|
+
readonly revision: Schema.Int;
|
|
210
|
+
readonly definition: Schema.NonEmptyString;
|
|
211
|
+
readonly view: Schema.optional<Schema.Struct<{
|
|
212
|
+
readonly generation: Schema.Int;
|
|
213
|
+
}>>;
|
|
214
|
+
readonly objects: Schema.$Array<Schema.Struct<{
|
|
215
|
+
readonly objectType: Schema.NonEmptyString;
|
|
216
|
+
readonly base: Schema.$Array<Schema.Struct<{
|
|
217
|
+
readonly key: Schema.Union<readonly [Schema.String, Schema.Finite]>;
|
|
218
|
+
readonly value: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
219
|
+
}>>;
|
|
220
|
+
readonly overrides: Schema.$Array<Schema.Struct<{
|
|
221
|
+
readonly key: Schema.Union<readonly [Schema.String, Schema.Finite]>;
|
|
222
|
+
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
223
|
+
readonly deleted: Schema.Literal<true>;
|
|
224
|
+
}>, Schema.Struct<{
|
|
225
|
+
readonly deleted: Schema.Literal<false>;
|
|
226
|
+
readonly value: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
227
|
+
}>]>;
|
|
228
|
+
}>>;
|
|
229
|
+
}>>;
|
|
230
|
+
readonly pending: Schema.$Array<Schema.Struct<{
|
|
231
|
+
readonly invocation: Schema.Struct<{
|
|
232
|
+
readonly id: Schema.NonEmptyString;
|
|
233
|
+
readonly name: Schema.NonEmptyString;
|
|
234
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
235
|
+
readonly replay: Schema.optional<Schema.Struct<{
|
|
236
|
+
readonly now: Schema.String;
|
|
237
|
+
readonly seed: Schema.NonEmptyString;
|
|
238
|
+
}>>;
|
|
239
|
+
}>;
|
|
240
|
+
readonly requestIdentity: Schema.String;
|
|
241
|
+
readonly createdAt: Schema.Finite;
|
|
242
|
+
readonly sequence: Schema.Int;
|
|
243
|
+
readonly state: Schema.Literals<readonly ["queued", "sending", "acknowledged", "blocked"]>;
|
|
244
|
+
readonly optimistic: Schema.Boolean;
|
|
245
|
+
readonly attempts: Schema.Int;
|
|
246
|
+
readonly retryFromAttempt: Schema.optional<Schema.Int>;
|
|
247
|
+
readonly nextAttemptAt: Schema.optional<Schema.Finite>;
|
|
248
|
+
readonly failureMessage: Schema.optional<Schema.String>;
|
|
249
|
+
readonly failureIssues: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
250
|
+
readonly message: Schema.String;
|
|
251
|
+
readonly path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
|
|
252
|
+
readonly code: Schema.optional<Schema.String>;
|
|
253
|
+
readonly category: Schema.optional<Schema.Literals<readonly ["input", "reference", "custom"]>>;
|
|
254
|
+
readonly source: Schema.optional<Schema.Literals<readonly ["parameter", "submission", "user-facing"]>>;
|
|
255
|
+
readonly messageSource: Schema.optional<Schema.Literals<readonly ["standard", "configured"]>>;
|
|
256
|
+
}>>>;
|
|
257
|
+
readonly completedAt: Schema.optional<Schema.Finite>;
|
|
258
|
+
readonly retryRequiresAcknowledgement: Schema.optional<Schema.Boolean>;
|
|
259
|
+
readonly failureOutcome: Schema.optional<Schema.Literals<readonly ["not-committed", "unknown"]>>;
|
|
260
|
+
readonly failureRetryable: Schema.optional<Schema.Boolean>;
|
|
261
|
+
readonly receipt: Schema.optional<Schema.Struct<{
|
|
262
|
+
readonly operationId: Schema.String;
|
|
263
|
+
readonly outcome: Schema.Literal<"committed">;
|
|
264
|
+
readonly result: Schema.optional<Schema.Unknown>;
|
|
265
|
+
readonly cursor: Schema.optional<Schema.String>;
|
|
266
|
+
readonly providerOperationId: Schema.optional<Schema.String>;
|
|
267
|
+
readonly affected: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
268
|
+
readonly objectType: Schema.String;
|
|
269
|
+
readonly keys: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite]>>>;
|
|
270
|
+
}>>>;
|
|
271
|
+
readonly affectedComplete: Schema.optional<Schema.Boolean>;
|
|
272
|
+
readonly attachmentIdMappings: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
273
|
+
readonly localId: Schema.String;
|
|
274
|
+
readonly remoteId: Schema.String;
|
|
275
|
+
}>>>;
|
|
276
|
+
}>>;
|
|
277
|
+
readonly failure: Schema.optional<Schema.Literals<readonly ["Unauthenticated", "Forbidden", "NotFound", "ValidationFailed", "InvalidRequest", "InvalidResponse", "InvalidConfiguration", "Conflict", "NotImplemented", "RateLimited", "Unavailable", "Internal", "HistoryExpired", "SessionExpired", "SessionReplaced", "ViewReplaced", "ResultExpired", "SourceMismatch", "SchemaMismatch"]>>;
|
|
278
|
+
readonly touchedTypes: Schema.$Array<Schema.String>;
|
|
279
|
+
readonly submission: Schema.optional<Schema.Struct<{
|
|
280
|
+
readonly clientId: Schema.NonEmptyString;
|
|
281
|
+
readonly sequence: Schema.Int;
|
|
282
|
+
}>>;
|
|
283
|
+
}>>;
|
|
284
|
+
readonly completed: Schema.$Array<Schema.Struct<{
|
|
285
|
+
readonly invocation: Schema.Struct<{
|
|
286
|
+
readonly id: Schema.NonEmptyString;
|
|
287
|
+
readonly name: Schema.NonEmptyString;
|
|
288
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
289
|
+
readonly replay: Schema.optional<Schema.Struct<{
|
|
290
|
+
readonly now: Schema.String;
|
|
291
|
+
readonly seed: Schema.NonEmptyString;
|
|
292
|
+
}>>;
|
|
293
|
+
}>;
|
|
294
|
+
readonly requestIdentity: Schema.String;
|
|
295
|
+
readonly createdAt: Schema.Finite;
|
|
296
|
+
readonly sequence: Schema.Int;
|
|
297
|
+
readonly state: Schema.Literals<readonly ["queued", "sending", "acknowledged", "blocked"]>;
|
|
298
|
+
readonly optimistic: Schema.Boolean;
|
|
299
|
+
readonly attempts: Schema.Int;
|
|
300
|
+
readonly retryFromAttempt: Schema.optional<Schema.Int>;
|
|
301
|
+
readonly nextAttemptAt: Schema.optional<Schema.Finite>;
|
|
302
|
+
readonly failureMessage: Schema.optional<Schema.String>;
|
|
303
|
+
readonly failureIssues: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
304
|
+
readonly message: Schema.String;
|
|
305
|
+
readonly path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
|
|
306
|
+
readonly code: Schema.optional<Schema.String>;
|
|
307
|
+
readonly category: Schema.optional<Schema.Literals<readonly ["input", "reference", "custom"]>>;
|
|
308
|
+
readonly source: Schema.optional<Schema.Literals<readonly ["parameter", "submission", "user-facing"]>>;
|
|
309
|
+
readonly messageSource: Schema.optional<Schema.Literals<readonly ["standard", "configured"]>>;
|
|
310
|
+
}>>>;
|
|
311
|
+
readonly completedAt: Schema.optional<Schema.Finite>;
|
|
312
|
+
readonly retryRequiresAcknowledgement: Schema.optional<Schema.Boolean>;
|
|
313
|
+
readonly failureOutcome: Schema.optional<Schema.Literals<readonly ["not-committed", "unknown"]>>;
|
|
314
|
+
readonly failureRetryable: Schema.optional<Schema.Boolean>;
|
|
315
|
+
readonly receipt: Schema.optional<Schema.Struct<{
|
|
316
|
+
readonly operationId: Schema.String;
|
|
317
|
+
readonly outcome: Schema.Literal<"committed">;
|
|
318
|
+
readonly result: Schema.optional<Schema.Unknown>;
|
|
319
|
+
readonly cursor: Schema.optional<Schema.String>;
|
|
320
|
+
readonly providerOperationId: Schema.optional<Schema.String>;
|
|
321
|
+
readonly affected: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
322
|
+
readonly objectType: Schema.String;
|
|
323
|
+
readonly keys: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite]>>>;
|
|
324
|
+
}>>>;
|
|
325
|
+
readonly affectedComplete: Schema.optional<Schema.Boolean>;
|
|
326
|
+
readonly attachmentIdMappings: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
327
|
+
readonly localId: Schema.String;
|
|
328
|
+
readonly remoteId: Schema.String;
|
|
329
|
+
}>>>;
|
|
330
|
+
}>>;
|
|
331
|
+
readonly failure: Schema.optional<Schema.Literals<readonly ["Unauthenticated", "Forbidden", "NotFound", "ValidationFailed", "InvalidRequest", "InvalidResponse", "InvalidConfiguration", "Conflict", "NotImplemented", "RateLimited", "Unavailable", "Internal", "HistoryExpired", "SessionExpired", "SessionReplaced", "ViewReplaced", "ResultExpired", "SourceMismatch", "SchemaMismatch"]>>;
|
|
332
|
+
readonly touchedTypes: Schema.$Array<Schema.String>;
|
|
333
|
+
readonly submission: Schema.optional<Schema.Struct<{
|
|
334
|
+
readonly clientId: Schema.NonEmptyString;
|
|
335
|
+
readonly sequence: Schema.Int;
|
|
336
|
+
}>>;
|
|
337
|
+
}>>;
|
|
338
|
+
}>;
|
|
339
|
+
export declare const protocolValueCodec: <A>(schema: Schema.Codec<A>) => Schema.Codec<A, string>;
|
|
340
|
+
export declare const ClientStateCodec: Schema.Codec<{
|
|
341
|
+
readonly state: {
|
|
342
|
+
readonly sourceId: string;
|
|
343
|
+
readonly revision: number;
|
|
344
|
+
readonly definition: string;
|
|
345
|
+
readonly view?: {
|
|
346
|
+
readonly generation: number;
|
|
347
|
+
} | undefined;
|
|
348
|
+
readonly objects: readonly {
|
|
349
|
+
readonly objectType: string;
|
|
350
|
+
readonly base: readonly {
|
|
351
|
+
readonly key: string | number;
|
|
352
|
+
readonly value: {
|
|
353
|
+
readonly [x: string]: unknown;
|
|
354
|
+
};
|
|
355
|
+
}[];
|
|
356
|
+
readonly overrides: readonly {
|
|
357
|
+
readonly key: string | number;
|
|
358
|
+
readonly value: {
|
|
359
|
+
readonly deleted: true;
|
|
360
|
+
} | {
|
|
361
|
+
readonly deleted: false;
|
|
362
|
+
readonly value: {
|
|
363
|
+
readonly [x: string]: unknown;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
}[];
|
|
367
|
+
}[];
|
|
368
|
+
readonly pending: readonly {
|
|
369
|
+
readonly invocation: {
|
|
370
|
+
readonly id: string;
|
|
371
|
+
readonly name: string;
|
|
372
|
+
readonly parameters: {
|
|
373
|
+
readonly [x: string]: unknown;
|
|
374
|
+
};
|
|
375
|
+
readonly replay?: {
|
|
376
|
+
readonly now: string;
|
|
377
|
+
readonly seed: string;
|
|
378
|
+
} | undefined;
|
|
379
|
+
};
|
|
380
|
+
readonly requestIdentity: string;
|
|
381
|
+
readonly createdAt: number;
|
|
382
|
+
readonly sequence: number;
|
|
383
|
+
readonly state: "acknowledged" | "blocked" | "queued" | "sending";
|
|
384
|
+
readonly optimistic: boolean;
|
|
385
|
+
readonly attempts: number;
|
|
386
|
+
readonly retryFromAttempt?: number | undefined;
|
|
387
|
+
readonly nextAttemptAt?: number | undefined;
|
|
388
|
+
readonly failureMessage?: string | undefined;
|
|
389
|
+
readonly failureIssues?: readonly {
|
|
390
|
+
readonly message: string;
|
|
391
|
+
readonly path?: readonly (string | number)[] | undefined;
|
|
392
|
+
readonly code?: string | undefined;
|
|
393
|
+
readonly category?: "custom" | "input" | "reference" | undefined;
|
|
394
|
+
readonly source?: "parameter" | "submission" | "user-facing" | undefined;
|
|
395
|
+
readonly messageSource?: "configured" | "standard" | undefined;
|
|
396
|
+
}[] | undefined;
|
|
397
|
+
readonly completedAt?: number | undefined;
|
|
398
|
+
readonly retryRequiresAcknowledgement?: boolean | undefined;
|
|
399
|
+
readonly failureOutcome?: "not-committed" | "unknown" | undefined;
|
|
400
|
+
readonly failureRetryable?: boolean | undefined;
|
|
401
|
+
readonly receipt?: {
|
|
402
|
+
readonly operationId: string;
|
|
403
|
+
readonly outcome: "committed";
|
|
404
|
+
readonly result?: unknown;
|
|
405
|
+
readonly cursor?: string | undefined;
|
|
406
|
+
readonly providerOperationId?: string | undefined;
|
|
407
|
+
readonly affected?: readonly {
|
|
408
|
+
readonly objectType: string;
|
|
409
|
+
readonly keys?: readonly (string | number)[] | undefined;
|
|
410
|
+
}[] | undefined;
|
|
411
|
+
readonly affectedComplete?: boolean | undefined;
|
|
412
|
+
readonly attachmentIdMappings?: readonly {
|
|
413
|
+
readonly localId: string;
|
|
414
|
+
readonly remoteId: string;
|
|
415
|
+
}[] | undefined;
|
|
416
|
+
} | undefined;
|
|
417
|
+
readonly failure?: "Conflict" | "Forbidden" | "HistoryExpired" | "Internal" | "InvalidConfiguration" | "InvalidRequest" | "InvalidResponse" | "NotFound" | "NotImplemented" | "RateLimited" | "ResultExpired" | "SchemaMismatch" | "SessionExpired" | "SessionReplaced" | "SourceMismatch" | "Unauthenticated" | "Unavailable" | "ValidationFailed" | "ViewReplaced" | undefined;
|
|
418
|
+
readonly touchedTypes: readonly string[];
|
|
419
|
+
readonly submission?: {
|
|
420
|
+
readonly clientId: string;
|
|
421
|
+
readonly sequence: number;
|
|
422
|
+
} | undefined;
|
|
423
|
+
}[];
|
|
424
|
+
readonly completed: readonly {
|
|
425
|
+
readonly invocation: {
|
|
426
|
+
readonly id: string;
|
|
427
|
+
readonly name: string;
|
|
428
|
+
readonly parameters: {
|
|
429
|
+
readonly [x: string]: unknown;
|
|
430
|
+
};
|
|
431
|
+
readonly replay?: {
|
|
432
|
+
readonly now: string;
|
|
433
|
+
readonly seed: string;
|
|
434
|
+
} | undefined;
|
|
435
|
+
};
|
|
436
|
+
readonly requestIdentity: string;
|
|
437
|
+
readonly createdAt: number;
|
|
438
|
+
readonly sequence: number;
|
|
439
|
+
readonly state: "acknowledged" | "blocked" | "queued" | "sending";
|
|
440
|
+
readonly optimistic: boolean;
|
|
441
|
+
readonly attempts: number;
|
|
442
|
+
readonly retryFromAttempt?: number | undefined;
|
|
443
|
+
readonly nextAttemptAt?: number | undefined;
|
|
444
|
+
readonly failureMessage?: string | undefined;
|
|
445
|
+
readonly failureIssues?: readonly {
|
|
446
|
+
readonly message: string;
|
|
447
|
+
readonly path?: readonly (string | number)[] | undefined;
|
|
448
|
+
readonly code?: string | undefined;
|
|
449
|
+
readonly category?: "custom" | "input" | "reference" | undefined;
|
|
450
|
+
readonly source?: "parameter" | "submission" | "user-facing" | undefined;
|
|
451
|
+
readonly messageSource?: "configured" | "standard" | undefined;
|
|
452
|
+
}[] | undefined;
|
|
453
|
+
readonly completedAt?: number | undefined;
|
|
454
|
+
readonly retryRequiresAcknowledgement?: boolean | undefined;
|
|
455
|
+
readonly failureOutcome?: "not-committed" | "unknown" | undefined;
|
|
456
|
+
readonly failureRetryable?: boolean | undefined;
|
|
457
|
+
readonly receipt?: {
|
|
458
|
+
readonly operationId: string;
|
|
459
|
+
readonly outcome: "committed";
|
|
460
|
+
readonly result?: unknown;
|
|
461
|
+
readonly cursor?: string | undefined;
|
|
462
|
+
readonly providerOperationId?: string | undefined;
|
|
463
|
+
readonly affected?: readonly {
|
|
464
|
+
readonly objectType: string;
|
|
465
|
+
readonly keys?: readonly (string | number)[] | undefined;
|
|
466
|
+
}[] | undefined;
|
|
467
|
+
readonly affectedComplete?: boolean | undefined;
|
|
468
|
+
readonly attachmentIdMappings?: readonly {
|
|
469
|
+
readonly localId: string;
|
|
470
|
+
readonly remoteId: string;
|
|
471
|
+
}[] | undefined;
|
|
472
|
+
} | undefined;
|
|
473
|
+
readonly failure?: "Conflict" | "Forbidden" | "HistoryExpired" | "Internal" | "InvalidConfiguration" | "InvalidRequest" | "InvalidResponse" | "NotFound" | "NotImplemented" | "RateLimited" | "ResultExpired" | "SchemaMismatch" | "SessionExpired" | "SessionReplaced" | "SourceMismatch" | "Unauthenticated" | "Unavailable" | "ValidationFailed" | "ViewReplaced" | undefined;
|
|
474
|
+
readonly touchedTypes: readonly string[];
|
|
475
|
+
readonly submission?: {
|
|
476
|
+
readonly clientId: string;
|
|
477
|
+
readonly sequence: number;
|
|
478
|
+
} | undefined;
|
|
479
|
+
}[];
|
|
480
|
+
};
|
|
481
|
+
readonly client: {
|
|
482
|
+
readonly client: {
|
|
483
|
+
readonly sourceId: string;
|
|
484
|
+
readonly clientId: string;
|
|
485
|
+
readonly resumeKey: string;
|
|
486
|
+
};
|
|
487
|
+
readonly connectionId: string;
|
|
488
|
+
readonly expiresAt: number;
|
|
489
|
+
readonly acceptedThrough: number;
|
|
490
|
+
readonly acknowledgedThrough: number;
|
|
491
|
+
readonly deliveredThrough: number;
|
|
492
|
+
readonly deliveredRevision: number;
|
|
493
|
+
readonly appliedRevision: number;
|
|
494
|
+
readonly viewGeneration?: number | undefined;
|
|
495
|
+
readonly viewIdentity?: string | undefined;
|
|
496
|
+
readonly deliveredViewGeneration?: number | undefined;
|
|
497
|
+
};
|
|
498
|
+
readonly coverage?: readonly {
|
|
499
|
+
readonly subset: {
|
|
500
|
+
readonly objectType: string;
|
|
501
|
+
readonly query?: import("@party-stack/ontology-storage").Query | undefined;
|
|
502
|
+
};
|
|
503
|
+
readonly complete: boolean;
|
|
504
|
+
readonly cached?: boolean | undefined;
|
|
505
|
+
}[] | undefined;
|
|
506
|
+
}, string, never, never>;
|
|
507
|
+
export declare const ClientSubmissionCodec: Schema.Codec<{
|
|
508
|
+
readonly session: {
|
|
509
|
+
readonly client: {
|
|
510
|
+
readonly sourceId: string;
|
|
511
|
+
readonly clientId: string;
|
|
512
|
+
readonly resumeKey: string;
|
|
513
|
+
};
|
|
514
|
+
readonly connectionId: string;
|
|
515
|
+
};
|
|
516
|
+
readonly sequence: number;
|
|
517
|
+
readonly invocation: {
|
|
518
|
+
readonly id: string;
|
|
519
|
+
readonly name: string;
|
|
520
|
+
readonly parameters: {
|
|
521
|
+
readonly [x: string]: unknown;
|
|
522
|
+
};
|
|
523
|
+
readonly replay?: {
|
|
524
|
+
readonly now: string;
|
|
525
|
+
readonly seed: string;
|
|
526
|
+
} | undefined;
|
|
527
|
+
};
|
|
528
|
+
readonly optimistic: boolean;
|
|
529
|
+
readonly stagedAttachments?: readonly string[] | undefined;
|
|
530
|
+
readonly view?: {
|
|
531
|
+
readonly generation: number;
|
|
532
|
+
readonly selection: {
|
|
533
|
+
readonly subsets: readonly {
|
|
534
|
+
readonly objectType: string;
|
|
535
|
+
readonly query?: import("@party-stack/ontology-storage").Query | undefined;
|
|
536
|
+
}[];
|
|
537
|
+
readonly actionIds: readonly string[];
|
|
538
|
+
readonly inspectActions?: boolean | undefined;
|
|
539
|
+
};
|
|
540
|
+
} | undefined;
|
|
541
|
+
}, string, never, never>;
|
|
542
|
+
export declare const ClientViewCodec: Schema.Codec<{
|
|
543
|
+
readonly generation: number;
|
|
544
|
+
readonly selection: {
|
|
545
|
+
readonly subsets: readonly {
|
|
546
|
+
readonly objectType: string;
|
|
547
|
+
readonly query?: import("@party-stack/ontology-storage").Query | undefined;
|
|
548
|
+
}[];
|
|
549
|
+
readonly actionIds: readonly string[];
|
|
550
|
+
readonly inspectActions?: boolean | undefined;
|
|
551
|
+
};
|
|
552
|
+
}, string, never, never>;
|
|
553
|
+
export declare const CompiledSubsetCodec: Schema.Codec<{
|
|
554
|
+
readonly objectType: string;
|
|
555
|
+
readonly query?: import("@party-stack/ontology-storage").Query | undefined;
|
|
556
|
+
}, string, never, never>;
|
|
557
|
+
export declare const StateSelectionCodec: Schema.Codec<{
|
|
558
|
+
readonly subsets: readonly {
|
|
559
|
+
readonly objectType: string;
|
|
560
|
+
readonly query?: import("@party-stack/ontology-storage").Query | undefined;
|
|
561
|
+
}[];
|
|
562
|
+
readonly actionIds: readonly string[];
|
|
563
|
+
readonly inspectActions?: boolean | undefined;
|
|
564
|
+
}, string, never, never>;
|
|
565
|
+
export declare const ObjectSubsetCodec: Schema.Codec<import("@party-stack/ontology-spec/query").ObjectSubset, string, never, never>;
|
|
566
|
+
export declare const ObjectSelectionCodec: Schema.Codec<{
|
|
567
|
+
readonly subsets: readonly import("@party-stack/ontology-spec/query").ObjectSubset[];
|
|
568
|
+
}, string, never, never>;
|
|
569
|
+
//#endregion
|
|
570
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","names":["_$__errors_js0.ValidationIssue","_$__delivery_js0.DeliveryPolicy","_$__delivery_js0.DeliveryPosition","_$__delivery_js0.DeliverySubscription"],"sources":["../src/protocol.ts"],"mappings":";;;;;;;;;;iBAciB;WACJ,YAAY;WACZ;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA,yBAXYA;WAYZ;;WAEA;WACA;WACA;WACA,UAAU;WACV,UAAU;WACV;WACA;aAAwB;aAA2B;;;;;;iBAM/C;WACJ;WACA;WACA;WACA;aAAkB;;WAClB;aACI;aACA,eAAe,IAAI;aACnB,oBAAoB,IAAI,SAAS;;WAErC,kBAAkB;WAClB,oBAAoB;;;;;iBAMhB;WACJ,kBAAkB;WAClB;;;WAGA;;iBAEI;WACJ;WACA,WAAW;;iBAGP;WACJ;aACI,QAAQ;aACR;;aAEA;;WAEJ,OAAO;WACP,QAAQ;;iBAEJ;WACJ,SAAS;WACT;WACA,YAAY;WACZ;;WAEA;WACA,OAAO;;;;;;iBAOH;WACJ;WACA;aACI,SACL,YACA;eAAqB;UACpB,OAAO,aAAa;aAChB,QACL,YACA;eAAqB;UACpB,OAAO,aAAa;aAChB,OAAO,YAAY,SAAS,kBAAkB,OAAO,aAAa;;WAEtE;WACA,aAAa,SAAS,gBAAgB,OAAO,OAAO,aAAa;WACjE,OAAO,SAAS,eAAe,OAAO,eAAe,OAAO,OAAO,aAAa;WAChF,aACL,SAAS,eACT,MAAM,YACN,SADMC,gBAEN,SADiCC,qBAEhC,OAAO,OADyBC,sBAC4B,cAAc,MAAM;WAC5E,uBACL,UAFQD,qBAGP,OAAO,aAAa;;WAEhB,UAAU,SAAS,qBAAqB,OAAO,aAAa;;;;;WAK5D,SAAS,QAAQ,mBAAmB,OAAO,aAAa;WACxD,kBAAkB,OAAO,OAAO,OAAO,aAAa,eAAe,cAAc,MAAM;WACvF,SAAS,SAAS,qBAAqB,OAAO,OAAO,aAAa;WAClE,cACL,SAAS,eACT,kBACA,iBACA,4BACC,OAAO,aAAa;;;qBAIhB,gBAAa,UAAc;qBAwB3B,qBAAmB,OAAA;;;;;;;;;qBAMnB,qBAAmB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuBnB,sBAAoB,OAAA;;;;qBAIpB,sBAAoB,OAAA;;;;;;;;qBAKpB,kBAAgB,OAAA;;;;;;;;;;;qBAIhB,4BAA0B,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgD1B,qBAAsB,GAAC,QAAU,OAAO,MAAM,OAAK,OAAO,MAAM;qBAoBhE,kBAAgB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAChB,uBAAqB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBACrB,iBAAe,OAAA;;;;;;;;;;;qBACf,qBAAmB,OAAA;;;;qBAEnB,qBAAmB,OAAA;;;;;;;;qBAEnB,mBAAiB,OAAA,iDAAA;qBACjB,sBAAoB,OAAA"}
|