@abloatai/ablo 0.29.3 → 0.30.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/CHANGELOG.md +21 -0
- package/README.md +3 -2
- package/dist/BaseSyncedStore.js +3 -1
- package/dist/Database.js +29 -2
- package/dist/SyncClient.d.ts +5 -3
- package/dist/SyncClient.js +8 -4
- package/dist/ai-sdk/coordinatedTool.d.ts +0 -1
- package/dist/ai-sdk/coordinatedTool.js +0 -1
- package/dist/ai-sdk/coordinationContext.js +1 -5
- package/dist/cli.cjs +377 -84
- package/dist/client/Ablo.d.ts +1 -1
- package/dist/client/Ablo.js +24 -36
- package/dist/client/auth.d.ts +8 -18
- package/dist/client/auth.js +16 -96
- package/dist/client/createModelProxy.d.ts +16 -11
- package/dist/client/createModelProxy.js +162 -20
- package/dist/client/httpClient.d.ts +1 -1
- package/dist/client/httpTransport.js +263 -89
- package/dist/client/options.d.ts +0 -15
- package/dist/client/resourceTypes.d.ts +13 -26
- package/dist/client/schemaConfig.js +5 -0
- package/dist/client/writeOptionsSchema.d.ts +1 -0
- package/dist/client/writeOptionsSchema.js +11 -2
- package/dist/client/wsMutationExecutor.d.ts +3 -5
- package/dist/coordination/schema.d.ts +17 -13
- package/dist/coordination/schema.js +36 -10
- package/dist/errorCodes.d.ts +9 -4
- package/dist/errorCodes.js +10 -5
- package/dist/errors.js +4 -9
- package/dist/index.d.ts +4 -0
- package/dist/interfaces/index.d.ts +31 -19
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +4 -1
- package/dist/schema/schema.d.ts +13 -0
- package/dist/schema/select.js +7 -0
- package/dist/schema/syncDeltaRow.d.ts +31 -13
- package/dist/schema/syncDeltaRow.js +33 -15
- package/dist/schema/tenancy.d.ts +52 -16
- package/dist/schema/tenancy.js +86 -25
- package/dist/server/commit.d.ts +8 -24
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/readConfig.d.ts +10 -0
- package/dist/source/adapter.d.ts +26 -15
- package/dist/source/adapter.js +5 -3
- package/dist/source/adapters/drizzle.js +35 -9
- package/dist/source/adapters/kysely.d.ts +33 -61
- package/dist/source/adapters/kysely.js +170 -177
- package/dist/source/adapters/kyselyMutationCore.d.ts +76 -0
- package/dist/source/adapters/kyselyMutationCore.js +125 -0
- package/dist/source/adapters/memory.d.ts +1 -1
- package/dist/source/adapters/memory.js +24 -10
- package/dist/source/adapters/prisma.js +35 -8
- package/dist/source/conformance.d.ts +26 -28
- package/dist/source/conformance.js +142 -69
- package/dist/source/contract.d.ts +46 -4
- package/dist/source/contract.js +66 -5
- package/dist/source/factory.d.ts +3 -3
- package/dist/source/factory.js +24 -3
- package/dist/source/idempotency.d.ts +46 -0
- package/dist/source/idempotency.js +129 -0
- package/dist/source/index.d.ts +6 -4
- package/dist/source/index.js +5 -3
- package/dist/source/migrations.d.ts +9 -5
- package/dist/source/migrations.js +39 -6
- package/dist/source/types.d.ts +88 -14
- package/dist/source/types.js +16 -0
- package/dist/surface.d.ts +1 -1
- package/dist/surface.js +0 -1
- package/dist/sync/BootstrapFetcher.js +7 -0
- package/dist/sync/SyncWebSocket.d.ts +5 -27
- package/dist/sync/awaitClaimGrant.d.ts +6 -0
- package/dist/sync/awaitClaimGrant.js +12 -2
- package/dist/sync/commitFrames.d.ts +2 -4
- package/dist/sync/commitFrames.js +1 -0
- package/dist/sync/createClaimStream.d.ts +1 -1
- package/dist/sync/createClaimStream.js +13 -15
- package/dist/sync/deltaPipeline.d.ts +1 -1
- package/dist/sync/deltaPipeline.js +1 -1
- package/dist/sync/participants.d.ts +2 -3
- package/dist/sync/participants.js +2 -2
- package/dist/sync/wsFrameHandlers.js +35 -15
- package/dist/testing/mocks/MockMutationExecutor.d.ts +21 -0
- package/dist/testing/mocks/MockMutationExecutor.js +53 -1
- package/dist/transactions/TransactionQueue.d.ts +61 -9
- package/dist/transactions/TransactionQueue.js +502 -114
- package/dist/transactions/commitEnvelope.d.ts +4 -0
- package/dist/transactions/commitEnvelope.js +25 -0
- package/dist/transactions/commitPayload.d.ts +23 -5
- package/dist/transactions/commitPayload.js +3 -0
- package/dist/transactions/deltaConfirmation.d.ts +2 -1
- package/dist/transactions/deltaConfirmation.js +22 -4
- package/dist/transactions/durableWriteStore.d.ts +8 -1
- package/dist/transactions/httpCommitEnvelope.d.ts +3 -1
- package/dist/transactions/httpCommitEnvelope.js +30 -0
- package/dist/transactions/replayValidation.d.ts +4 -0
- package/dist/transactions/replayValidation.js +6 -0
- package/dist/types/streams.d.ts +29 -17
- package/dist/wire/commit.d.ts +671 -0
- package/dist/wire/commit.js +300 -0
- package/dist/wire/delta.d.ts +4 -0
- package/dist/wire/delta.js +9 -0
- package/dist/wire/frames.d.ts +17 -45
- package/dist/wire/index.d.ts +2 -0
- package/dist/wire/index.js +4 -0
- package/docs/agent-messaging.md +4 -5
- package/docs/agents.md +1 -2
- package/docs/api-keys.md +1 -2
- package/docs/client-behavior.md +4 -6
- package/docs/coordination.md +64 -9
- package/docs/data-sources.md +4 -7
- package/docs/integration-guide.md +6 -8
- package/docs/migration.md +0 -3
- package/docs/quickstart.md +7 -8
- package/docs/schema-contract.md +7 -8
- package/package.json +4 -4
- package/dist/client/registerDataSource.d.ts +0 -19
- package/dist/client/registerDataSource.js +0 -66
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical runtime contracts for commit settlement.
|
|
3
|
+
*
|
|
4
|
+
* A commit crosses several boundaries during its lifetime: the server's
|
|
5
|
+
* execution cache, the HTTP/WS receipt, and the client's acknowledgement
|
|
6
|
+
* tracker. Those boundaries intentionally have different envelopes, but they
|
|
7
|
+
* all compose the same settlement vocabulary from this module:
|
|
8
|
+
*
|
|
9
|
+
* - `confirmed` — the authoritative change is visible at a sync watermark.
|
|
10
|
+
* - `queued` — a connected source durably accepted the write and only its
|
|
11
|
+
* correlated authoritative source delta (WAL for direct, endpoint event
|
|
12
|
+
* for endpoint-only), identified by `correlationId`, may promote it.
|
|
13
|
+
*
|
|
14
|
+
* Keeping the variants discriminated here makes an impossible receipt (most
|
|
15
|
+
* importantly, `queued` without a correlation) unrepresentable at every
|
|
16
|
+
* untrusted boundary without collapsing the distinct lifecycle envelopes into
|
|
17
|
+
* one giant object.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import type { ErrorCode } from '../errorCodes.js';
|
|
21
|
+
import type { RequiredCapability } from '../errors.js';
|
|
22
|
+
/** Matches the permanent source/idempotency-key ceiling. */
|
|
23
|
+
export declare const COMMIT_CORRELATION_ID_MAX_LENGTH = 255;
|
|
24
|
+
/** Opaque server-authored identity shared by a queued receipt and its authoritative source delta. */
|
|
25
|
+
export declare const correlationIdSchema: z.ZodString;
|
|
26
|
+
export type CorrelationId = z.infer<typeof correlationIdSchema>;
|
|
27
|
+
export declare const commitStatusSchema: z.ZodEnum<{
|
|
28
|
+
queued: "queued";
|
|
29
|
+
confirmed: "confirmed";
|
|
30
|
+
}>;
|
|
31
|
+
export type CommitStatus = z.infer<typeof commitStatusSchema>;
|
|
32
|
+
/** The one settlement discriminant shared by every commit boundary. */
|
|
33
|
+
export declare const commitSettlementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
status: z.ZodLiteral<"queued">;
|
|
35
|
+
correlationId: z.ZodString;
|
|
36
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
37
|
+
status: z.ZodLiteral<"confirmed">;
|
|
38
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>], "status">;
|
|
40
|
+
export type CommitSettlement = z.infer<typeof commitSettlementSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* Successful HTTP/WS receipt. This schema is deliberately strict about the
|
|
43
|
+
* settlement discriminant. Zod's default object behavior strips additive
|
|
44
|
+
* fields, which is forward compatible without allowing server-internal
|
|
45
|
+
* recovery evidence to leak through a parsed wire receipt.
|
|
46
|
+
*/
|
|
47
|
+
export declare const commitReceiptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
48
|
+
status: z.ZodLiteral<"queued">;
|
|
49
|
+
correlationId: z.ZodString;
|
|
50
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
51
|
+
id: z.ZodOptional<z.ZodString>;
|
|
52
|
+
clientTxId: z.ZodString;
|
|
53
|
+
serverTxId: z.ZodString;
|
|
54
|
+
success: z.ZodLiteral<true>;
|
|
55
|
+
lastSyncId: z.ZodNumber;
|
|
56
|
+
ops: z.ZodNumber;
|
|
57
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
59
|
+
model: z.ZodString;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
readAt: z.ZodNumber;
|
|
62
|
+
observedSyncId: z.ZodNumber;
|
|
63
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
64
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
65
|
+
writtenBy: z.ZodObject<{
|
|
66
|
+
kind: z.ZodEnum<{
|
|
67
|
+
user: "user";
|
|
68
|
+
agent: "agent";
|
|
69
|
+
system: "system";
|
|
70
|
+
}>;
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
group: z.ZodOptional<z.ZodString>;
|
|
74
|
+
}, z.core.$strip>>>;
|
|
75
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
status: z.ZodLiteral<"confirmed">;
|
|
78
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
79
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
80
|
+
id: z.ZodOptional<z.ZodString>;
|
|
81
|
+
clientTxId: z.ZodString;
|
|
82
|
+
serverTxId: z.ZodString;
|
|
83
|
+
success: z.ZodLiteral<true>;
|
|
84
|
+
lastSyncId: z.ZodNumber;
|
|
85
|
+
ops: z.ZodNumber;
|
|
86
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
88
|
+
model: z.ZodString;
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
readAt: z.ZodNumber;
|
|
91
|
+
observedSyncId: z.ZodNumber;
|
|
92
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
93
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
94
|
+
writtenBy: z.ZodObject<{
|
|
95
|
+
kind: z.ZodEnum<{
|
|
96
|
+
user: "user";
|
|
97
|
+
agent: "agent";
|
|
98
|
+
system: "system";
|
|
99
|
+
}>;
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
group: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>>>;
|
|
104
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
+
}, z.core.$strip>], "status">;
|
|
106
|
+
export type CommitReceiptWire = z.infer<typeof commitReceiptSchema>;
|
|
107
|
+
/**
|
|
108
|
+
* Compatibility decoder for pre-contract WebSocket acknowledgements. It
|
|
109
|
+
* supplies fields old servers omitted and normalizes their string sync ids,
|
|
110
|
+
* then hands the result to the exact same canonical receipt schema. It never
|
|
111
|
+
* invents a source correlation: an old/malformed queued receipt still fails
|
|
112
|
+
* closed.
|
|
113
|
+
*/
|
|
114
|
+
export declare const legacyCompatibleCommitReceiptSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
115
|
+
status: z.ZodLiteral<"queued">;
|
|
116
|
+
correlationId: z.ZodString;
|
|
117
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
118
|
+
id: z.ZodOptional<z.ZodString>;
|
|
119
|
+
clientTxId: z.ZodString;
|
|
120
|
+
serverTxId: z.ZodString;
|
|
121
|
+
success: z.ZodLiteral<true>;
|
|
122
|
+
lastSyncId: z.ZodNumber;
|
|
123
|
+
ops: z.ZodNumber;
|
|
124
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
125
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
126
|
+
model: z.ZodString;
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
readAt: z.ZodNumber;
|
|
129
|
+
observedSyncId: z.ZodNumber;
|
|
130
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
131
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
132
|
+
writtenBy: z.ZodObject<{
|
|
133
|
+
kind: z.ZodEnum<{
|
|
134
|
+
user: "user";
|
|
135
|
+
agent: "agent";
|
|
136
|
+
system: "system";
|
|
137
|
+
}>;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
group: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, z.core.$strip>>>;
|
|
142
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
143
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
144
|
+
status: z.ZodLiteral<"confirmed">;
|
|
145
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
146
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
147
|
+
id: z.ZodOptional<z.ZodString>;
|
|
148
|
+
clientTxId: z.ZodString;
|
|
149
|
+
serverTxId: z.ZodString;
|
|
150
|
+
success: z.ZodLiteral<true>;
|
|
151
|
+
lastSyncId: z.ZodNumber;
|
|
152
|
+
ops: z.ZodNumber;
|
|
153
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
154
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
155
|
+
model: z.ZodString;
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
readAt: z.ZodNumber;
|
|
158
|
+
observedSyncId: z.ZodNumber;
|
|
159
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
160
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
161
|
+
writtenBy: z.ZodObject<{
|
|
162
|
+
kind: z.ZodEnum<{
|
|
163
|
+
user: "user";
|
|
164
|
+
agent: "agent";
|
|
165
|
+
system: "system";
|
|
166
|
+
}>;
|
|
167
|
+
id: z.ZodString;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
group: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>>>;
|
|
171
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
|
+
}, z.core.$strip>], "status">>;
|
|
173
|
+
/** The failure arm is separate: queued/confirmed always imply `success:true`. */
|
|
174
|
+
export declare const rejectedCommitReceiptSchema: z.ZodObject<{
|
|
175
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
176
|
+
clientTxId: z.ZodString;
|
|
177
|
+
serverTxId: z.ZodString;
|
|
178
|
+
success: z.ZodLiteral<false>;
|
|
179
|
+
status: z.ZodLiteral<"rejected">;
|
|
180
|
+
lastSyncId: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
ops: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
error: z.ZodObject<{
|
|
183
|
+
code: z.ZodCustom<ErrorCode, ErrorCode>;
|
|
184
|
+
message: z.ZodString;
|
|
185
|
+
field: z.ZodOptional<z.ZodString>;
|
|
186
|
+
requiredCapability: z.ZodOptional<z.ZodCustom<RequiredCapability, RequiredCapability>>;
|
|
187
|
+
}, z.core.$strip>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
export type RejectedCommitReceiptWire = z.infer<typeof rejectedCommitReceiptSchema>;
|
|
190
|
+
export declare const mutationResultPayloadSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
191
|
+
status: z.ZodLiteral<"queued">;
|
|
192
|
+
correlationId: z.ZodString;
|
|
193
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
194
|
+
id: z.ZodOptional<z.ZodString>;
|
|
195
|
+
clientTxId: z.ZodString;
|
|
196
|
+
serverTxId: z.ZodString;
|
|
197
|
+
success: z.ZodLiteral<true>;
|
|
198
|
+
lastSyncId: z.ZodNumber;
|
|
199
|
+
ops: z.ZodNumber;
|
|
200
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
201
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
202
|
+
model: z.ZodString;
|
|
203
|
+
id: z.ZodString;
|
|
204
|
+
readAt: z.ZodNumber;
|
|
205
|
+
observedSyncId: z.ZodNumber;
|
|
206
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
207
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
208
|
+
writtenBy: z.ZodObject<{
|
|
209
|
+
kind: z.ZodEnum<{
|
|
210
|
+
user: "user";
|
|
211
|
+
agent: "agent";
|
|
212
|
+
system: "system";
|
|
213
|
+
}>;
|
|
214
|
+
id: z.ZodString;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
group: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.core.$strip>>>;
|
|
218
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
status: z.ZodLiteral<"confirmed">;
|
|
221
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
222
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
223
|
+
id: z.ZodOptional<z.ZodString>;
|
|
224
|
+
clientTxId: z.ZodString;
|
|
225
|
+
serverTxId: z.ZodString;
|
|
226
|
+
success: z.ZodLiteral<true>;
|
|
227
|
+
lastSyncId: z.ZodNumber;
|
|
228
|
+
ops: z.ZodNumber;
|
|
229
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
231
|
+
model: z.ZodString;
|
|
232
|
+
id: z.ZodString;
|
|
233
|
+
readAt: z.ZodNumber;
|
|
234
|
+
observedSyncId: z.ZodNumber;
|
|
235
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
236
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
237
|
+
writtenBy: z.ZodObject<{
|
|
238
|
+
kind: z.ZodEnum<{
|
|
239
|
+
user: "user";
|
|
240
|
+
agent: "agent";
|
|
241
|
+
system: "system";
|
|
242
|
+
}>;
|
|
243
|
+
id: z.ZodString;
|
|
244
|
+
}, z.core.$strip>;
|
|
245
|
+
group: z.ZodOptional<z.ZodString>;
|
|
246
|
+
}, z.core.$strip>>>;
|
|
247
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
248
|
+
}, z.core.$strip>], "status">, z.ZodObject<{
|
|
249
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
250
|
+
clientTxId: z.ZodString;
|
|
251
|
+
serverTxId: z.ZodString;
|
|
252
|
+
success: z.ZodLiteral<false>;
|
|
253
|
+
status: z.ZodLiteral<"rejected">;
|
|
254
|
+
lastSyncId: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
ops: z.ZodOptional<z.ZodNumber>;
|
|
256
|
+
error: z.ZodObject<{
|
|
257
|
+
code: z.ZodCustom<ErrorCode, ErrorCode>;
|
|
258
|
+
message: z.ZodString;
|
|
259
|
+
field: z.ZodOptional<z.ZodString>;
|
|
260
|
+
requiredCapability: z.ZodOptional<z.ZodCustom<RequiredCapability, RequiredCapability>>;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
}, z.core.$strip>]>;
|
|
263
|
+
export type MutationResultPayload = z.infer<typeof mutationResultPayloadSchema>;
|
|
264
|
+
export declare const mutationResultMessageSchema: z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"mutation_result">;
|
|
266
|
+
payload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
267
|
+
status: z.ZodLiteral<"queued">;
|
|
268
|
+
correlationId: z.ZodString;
|
|
269
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
270
|
+
id: z.ZodOptional<z.ZodString>;
|
|
271
|
+
clientTxId: z.ZodString;
|
|
272
|
+
serverTxId: z.ZodString;
|
|
273
|
+
success: z.ZodLiteral<true>;
|
|
274
|
+
lastSyncId: z.ZodNumber;
|
|
275
|
+
ops: z.ZodNumber;
|
|
276
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
277
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
278
|
+
model: z.ZodString;
|
|
279
|
+
id: z.ZodString;
|
|
280
|
+
readAt: z.ZodNumber;
|
|
281
|
+
observedSyncId: z.ZodNumber;
|
|
282
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
283
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
284
|
+
writtenBy: z.ZodObject<{
|
|
285
|
+
kind: z.ZodEnum<{
|
|
286
|
+
user: "user";
|
|
287
|
+
agent: "agent";
|
|
288
|
+
system: "system";
|
|
289
|
+
}>;
|
|
290
|
+
id: z.ZodString;
|
|
291
|
+
}, z.core.$strip>;
|
|
292
|
+
group: z.ZodOptional<z.ZodString>;
|
|
293
|
+
}, z.core.$strip>>>;
|
|
294
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
295
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
296
|
+
status: z.ZodLiteral<"confirmed">;
|
|
297
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
298
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
299
|
+
id: z.ZodOptional<z.ZodString>;
|
|
300
|
+
clientTxId: z.ZodString;
|
|
301
|
+
serverTxId: z.ZodString;
|
|
302
|
+
success: z.ZodLiteral<true>;
|
|
303
|
+
lastSyncId: z.ZodNumber;
|
|
304
|
+
ops: z.ZodNumber;
|
|
305
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
306
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
307
|
+
model: z.ZodString;
|
|
308
|
+
id: z.ZodString;
|
|
309
|
+
readAt: z.ZodNumber;
|
|
310
|
+
observedSyncId: z.ZodNumber;
|
|
311
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
312
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
313
|
+
writtenBy: z.ZodObject<{
|
|
314
|
+
kind: z.ZodEnum<{
|
|
315
|
+
user: "user";
|
|
316
|
+
agent: "agent";
|
|
317
|
+
system: "system";
|
|
318
|
+
}>;
|
|
319
|
+
id: z.ZodString;
|
|
320
|
+
}, z.core.$strip>;
|
|
321
|
+
group: z.ZodOptional<z.ZodString>;
|
|
322
|
+
}, z.core.$strip>>>;
|
|
323
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
324
|
+
}, z.core.$strip>], "status">, z.ZodObject<{
|
|
325
|
+
object: z.ZodLiteral<"commit_receipt">;
|
|
326
|
+
clientTxId: z.ZodString;
|
|
327
|
+
serverTxId: z.ZodString;
|
|
328
|
+
success: z.ZodLiteral<false>;
|
|
329
|
+
status: z.ZodLiteral<"rejected">;
|
|
330
|
+
lastSyncId: z.ZodOptional<z.ZodNumber>;
|
|
331
|
+
ops: z.ZodOptional<z.ZodNumber>;
|
|
332
|
+
error: z.ZodObject<{
|
|
333
|
+
code: z.ZodCustom<ErrorCode, ErrorCode>;
|
|
334
|
+
message: z.ZodString;
|
|
335
|
+
field: z.ZodOptional<z.ZodString>;
|
|
336
|
+
requiredCapability: z.ZodOptional<z.ZodCustom<RequiredCapability, RequiredCapability>>;
|
|
337
|
+
}, z.core.$strip>;
|
|
338
|
+
}, z.core.$strip>]>;
|
|
339
|
+
}, z.core.$strip>;
|
|
340
|
+
export type MutationResultMessageWire = z.infer<typeof mutationResultMessageSchema>;
|
|
341
|
+
export declare const commitExecutionResultSchema: z.ZodPipe<z.ZodObject<{
|
|
342
|
+
lastSyncId: z.ZodNumber;
|
|
343
|
+
firstSyncId: z.ZodNumber;
|
|
344
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
345
|
+
queued: "queued";
|
|
346
|
+
confirmed: "confirmed";
|
|
347
|
+
}>>;
|
|
348
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
349
|
+
confirmationTransactionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
350
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
351
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
352
|
+
model: z.ZodString;
|
|
353
|
+
id: z.ZodString;
|
|
354
|
+
readAt: z.ZodNumber;
|
|
355
|
+
observedSyncId: z.ZodNumber;
|
|
356
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
357
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
358
|
+
writtenBy: z.ZodObject<{
|
|
359
|
+
kind: z.ZodEnum<{
|
|
360
|
+
user: "user";
|
|
361
|
+
agent: "agent";
|
|
362
|
+
system: "system";
|
|
363
|
+
}>;
|
|
364
|
+
id: z.ZodString;
|
|
365
|
+
}, z.core.$strip>;
|
|
366
|
+
group: z.ZodOptional<z.ZodString>;
|
|
367
|
+
}, z.core.$strip>>>;
|
|
368
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
369
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
370
|
+
status: "queued" | "confirmed";
|
|
371
|
+
lastSyncId: number;
|
|
372
|
+
firstSyncId: number;
|
|
373
|
+
correlationId?: string | undefined;
|
|
374
|
+
confirmationTransactionIds?: string[] | undefined;
|
|
375
|
+
notifications?: {
|
|
376
|
+
model: string;
|
|
377
|
+
id: string;
|
|
378
|
+
readAt: number;
|
|
379
|
+
observedSyncId: number;
|
|
380
|
+
conflictingFields: string[];
|
|
381
|
+
currentValues: Record<string, unknown>;
|
|
382
|
+
writtenBy: {
|
|
383
|
+
kind: "user" | "agent" | "system";
|
|
384
|
+
id: string;
|
|
385
|
+
};
|
|
386
|
+
object?: "stale_notification" | undefined;
|
|
387
|
+
group?: string | undefined;
|
|
388
|
+
}[] | undefined;
|
|
389
|
+
missingIds?: string[] | undefined;
|
|
390
|
+
}, {
|
|
391
|
+
lastSyncId: number;
|
|
392
|
+
firstSyncId: number;
|
|
393
|
+
status?: "queued" | "confirmed" | undefined;
|
|
394
|
+
correlationId?: string | undefined;
|
|
395
|
+
confirmationTransactionIds?: string[] | undefined;
|
|
396
|
+
notifications?: {
|
|
397
|
+
model: string;
|
|
398
|
+
id: string;
|
|
399
|
+
readAt: number;
|
|
400
|
+
observedSyncId: number;
|
|
401
|
+
conflictingFields: string[];
|
|
402
|
+
currentValues: Record<string, unknown>;
|
|
403
|
+
writtenBy: {
|
|
404
|
+
kind: "user" | "agent" | "system";
|
|
405
|
+
id: string;
|
|
406
|
+
};
|
|
407
|
+
object?: "stale_notification" | undefined;
|
|
408
|
+
group?: string | undefined;
|
|
409
|
+
}[] | undefined;
|
|
410
|
+
missingIds?: string[] | undefined;
|
|
411
|
+
}>>;
|
|
412
|
+
export type CommitExecutionResultInput = z.input<typeof commitExecutionResultSchema>;
|
|
413
|
+
export type CommitExecutionResult = z.infer<typeof commitExecutionResultSchema>;
|
|
414
|
+
/** Normalized acknowledgement handed from a mutation transport to the queue. */
|
|
415
|
+
export declare const commitAckSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
416
|
+
status: z.ZodLiteral<"queued">;
|
|
417
|
+
correlationId: z.ZodString;
|
|
418
|
+
lastSyncId: z.ZodNumber;
|
|
419
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
420
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
421
|
+
model: z.ZodString;
|
|
422
|
+
id: z.ZodString;
|
|
423
|
+
readAt: z.ZodNumber;
|
|
424
|
+
observedSyncId: z.ZodNumber;
|
|
425
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
426
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
427
|
+
writtenBy: z.ZodObject<{
|
|
428
|
+
kind: z.ZodEnum<{
|
|
429
|
+
user: "user";
|
|
430
|
+
agent: "agent";
|
|
431
|
+
system: "system";
|
|
432
|
+
}>;
|
|
433
|
+
id: z.ZodString;
|
|
434
|
+
}, z.core.$strip>;
|
|
435
|
+
group: z.ZodOptional<z.ZodString>;
|
|
436
|
+
}, z.core.$strip>>>;
|
|
437
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
438
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
439
|
+
status: z.ZodLiteral<"confirmed">;
|
|
440
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
441
|
+
lastSyncId: z.ZodNumber;
|
|
442
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
443
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
444
|
+
model: z.ZodString;
|
|
445
|
+
id: z.ZodString;
|
|
446
|
+
readAt: z.ZodNumber;
|
|
447
|
+
observedSyncId: z.ZodNumber;
|
|
448
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
449
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
450
|
+
writtenBy: z.ZodObject<{
|
|
451
|
+
kind: z.ZodEnum<{
|
|
452
|
+
user: "user";
|
|
453
|
+
agent: "agent";
|
|
454
|
+
system: "system";
|
|
455
|
+
}>;
|
|
456
|
+
id: z.ZodString;
|
|
457
|
+
}, z.core.$strip>;
|
|
458
|
+
group: z.ZodOptional<z.ZodString>;
|
|
459
|
+
}, z.core.$strip>>>;
|
|
460
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
461
|
+
}, z.core.$strict>], "status">;
|
|
462
|
+
export type CommitAck = z.infer<typeof commitAckSchema>;
|
|
463
|
+
/**
|
|
464
|
+
* Compatibility boundary for injected/older mutation executors. New
|
|
465
|
+
* transports return `commitAckSchema`; a legacy `{lastSyncId}` is normalized
|
|
466
|
+
* to explicit confirmed settlement before queue code branches on it.
|
|
467
|
+
*/
|
|
468
|
+
export declare const mutationCommitResultSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
469
|
+
status: z.ZodLiteral<"queued">;
|
|
470
|
+
correlationId: z.ZodString;
|
|
471
|
+
lastSyncId: z.ZodNumber;
|
|
472
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
473
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
474
|
+
model: z.ZodString;
|
|
475
|
+
id: z.ZodString;
|
|
476
|
+
readAt: z.ZodNumber;
|
|
477
|
+
observedSyncId: z.ZodNumber;
|
|
478
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
479
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
480
|
+
writtenBy: z.ZodObject<{
|
|
481
|
+
kind: z.ZodEnum<{
|
|
482
|
+
user: "user";
|
|
483
|
+
agent: "agent";
|
|
484
|
+
system: "system";
|
|
485
|
+
}>;
|
|
486
|
+
id: z.ZodString;
|
|
487
|
+
}, z.core.$strip>;
|
|
488
|
+
group: z.ZodOptional<z.ZodString>;
|
|
489
|
+
}, z.core.$strip>>>;
|
|
490
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
491
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
492
|
+
status: z.ZodLiteral<"confirmed">;
|
|
493
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
494
|
+
lastSyncId: z.ZodNumber;
|
|
495
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
496
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
497
|
+
model: z.ZodString;
|
|
498
|
+
id: z.ZodString;
|
|
499
|
+
readAt: z.ZodNumber;
|
|
500
|
+
observedSyncId: z.ZodNumber;
|
|
501
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
502
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
503
|
+
writtenBy: z.ZodObject<{
|
|
504
|
+
kind: z.ZodEnum<{
|
|
505
|
+
user: "user";
|
|
506
|
+
agent: "agent";
|
|
507
|
+
system: "system";
|
|
508
|
+
}>;
|
|
509
|
+
id: z.ZodString;
|
|
510
|
+
}, z.core.$strip>;
|
|
511
|
+
group: z.ZodOptional<z.ZodString>;
|
|
512
|
+
}, z.core.$strip>>>;
|
|
513
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
514
|
+
}, z.core.$strict>], "status">, z.ZodObject<{
|
|
515
|
+
status: z.ZodOptional<z.ZodUndefined>;
|
|
516
|
+
correlationId: z.ZodOptional<z.ZodUndefined>;
|
|
517
|
+
lastSyncId: z.ZodNumber;
|
|
518
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
519
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
520
|
+
model: z.ZodString;
|
|
521
|
+
id: z.ZodString;
|
|
522
|
+
readAt: z.ZodNumber;
|
|
523
|
+
observedSyncId: z.ZodNumber;
|
|
524
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
525
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
526
|
+
writtenBy: z.ZodObject<{
|
|
527
|
+
kind: z.ZodEnum<{
|
|
528
|
+
user: "user";
|
|
529
|
+
agent: "agent";
|
|
530
|
+
system: "system";
|
|
531
|
+
}>;
|
|
532
|
+
id: z.ZodString;
|
|
533
|
+
}, z.core.$strip>;
|
|
534
|
+
group: z.ZodOptional<z.ZodString>;
|
|
535
|
+
}, z.core.$strip>>>;
|
|
536
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
537
|
+
}, z.core.$strict>]>, z.ZodTransform<{
|
|
538
|
+
status: "queued";
|
|
539
|
+
correlationId: string;
|
|
540
|
+
lastSyncId: number;
|
|
541
|
+
notifications?: {
|
|
542
|
+
model: string;
|
|
543
|
+
id: string;
|
|
544
|
+
readAt: number;
|
|
545
|
+
observedSyncId: number;
|
|
546
|
+
conflictingFields: string[];
|
|
547
|
+
currentValues: Record<string, unknown>;
|
|
548
|
+
writtenBy: {
|
|
549
|
+
kind: "user" | "agent" | "system";
|
|
550
|
+
id: string;
|
|
551
|
+
};
|
|
552
|
+
object?: "stale_notification" | undefined;
|
|
553
|
+
group?: string | undefined;
|
|
554
|
+
}[] | undefined;
|
|
555
|
+
missingIds?: string[] | undefined;
|
|
556
|
+
} | {
|
|
557
|
+
status: "confirmed";
|
|
558
|
+
lastSyncId: number;
|
|
559
|
+
correlationId?: string | undefined;
|
|
560
|
+
notifications?: {
|
|
561
|
+
model: string;
|
|
562
|
+
id: string;
|
|
563
|
+
readAt: number;
|
|
564
|
+
observedSyncId: number;
|
|
565
|
+
conflictingFields: string[];
|
|
566
|
+
currentValues: Record<string, unknown>;
|
|
567
|
+
writtenBy: {
|
|
568
|
+
kind: "user" | "agent" | "system";
|
|
569
|
+
id: string;
|
|
570
|
+
};
|
|
571
|
+
object?: "stale_notification" | undefined;
|
|
572
|
+
group?: string | undefined;
|
|
573
|
+
}[] | undefined;
|
|
574
|
+
missingIds?: string[] | undefined;
|
|
575
|
+
}, {
|
|
576
|
+
status: "queued";
|
|
577
|
+
correlationId: string;
|
|
578
|
+
lastSyncId: number;
|
|
579
|
+
notifications?: {
|
|
580
|
+
model: string;
|
|
581
|
+
id: string;
|
|
582
|
+
readAt: number;
|
|
583
|
+
observedSyncId: number;
|
|
584
|
+
conflictingFields: string[];
|
|
585
|
+
currentValues: Record<string, unknown>;
|
|
586
|
+
writtenBy: {
|
|
587
|
+
kind: "user" | "agent" | "system";
|
|
588
|
+
id: string;
|
|
589
|
+
};
|
|
590
|
+
object?: "stale_notification" | undefined;
|
|
591
|
+
group?: string | undefined;
|
|
592
|
+
}[] | undefined;
|
|
593
|
+
missingIds?: string[] | undefined;
|
|
594
|
+
} | {
|
|
595
|
+
status: "confirmed";
|
|
596
|
+
lastSyncId: number;
|
|
597
|
+
correlationId?: string | undefined;
|
|
598
|
+
notifications?: {
|
|
599
|
+
model: string;
|
|
600
|
+
id: string;
|
|
601
|
+
readAt: number;
|
|
602
|
+
observedSyncId: number;
|
|
603
|
+
conflictingFields: string[];
|
|
604
|
+
currentValues: Record<string, unknown>;
|
|
605
|
+
writtenBy: {
|
|
606
|
+
kind: "user" | "agent" | "system";
|
|
607
|
+
id: string;
|
|
608
|
+
};
|
|
609
|
+
object?: "stale_notification" | undefined;
|
|
610
|
+
group?: string | undefined;
|
|
611
|
+
}[] | undefined;
|
|
612
|
+
missingIds?: string[] | undefined;
|
|
613
|
+
} | {
|
|
614
|
+
lastSyncId: number;
|
|
615
|
+
status?: undefined;
|
|
616
|
+
correlationId?: undefined;
|
|
617
|
+
notifications?: {
|
|
618
|
+
model: string;
|
|
619
|
+
id: string;
|
|
620
|
+
readAt: number;
|
|
621
|
+
observedSyncId: number;
|
|
622
|
+
conflictingFields: string[];
|
|
623
|
+
currentValues: Record<string, unknown>;
|
|
624
|
+
writtenBy: {
|
|
625
|
+
kind: "user" | "agent" | "system";
|
|
626
|
+
id: string;
|
|
627
|
+
};
|
|
628
|
+
object?: "stale_notification" | undefined;
|
|
629
|
+
group?: string | undefined;
|
|
630
|
+
}[] | undefined;
|
|
631
|
+
missingIds?: string[] | undefined;
|
|
632
|
+
}>>;
|
|
633
|
+
export type MutationCommitResultInput = z.input<typeof mutationCommitResultSchema>;
|
|
634
|
+
export type MutationCommitResult = z.infer<typeof mutationCommitResultSchema>;
|
|
635
|
+
/**
|
|
636
|
+
* Public SDK projection returned by `ablo.commits` and model mutations.
|
|
637
|
+
*
|
|
638
|
+
* This intentionally does not compose `commitSettlementSchema`: on the WS
|
|
639
|
+
* facade, `wait:'queued'` currently means locally sealed/enqueued, before a
|
|
640
|
+
* server has necessarily accepted the write. Renaming that public state to
|
|
641
|
+
* `enqueued` is a separate protocol change; the authoritative settlement
|
|
642
|
+
* union above is reserved for server acknowledgements.
|
|
643
|
+
*/
|
|
644
|
+
export declare const clientCommitReceiptSchema: z.ZodObject<{
|
|
645
|
+
id: z.ZodString;
|
|
646
|
+
status: z.ZodEnum<{
|
|
647
|
+
queued: "queued";
|
|
648
|
+
confirmed: "confirmed";
|
|
649
|
+
}>;
|
|
650
|
+
lastSyncId: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
652
|
+
object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
|
|
653
|
+
model: z.ZodString;
|
|
654
|
+
id: z.ZodString;
|
|
655
|
+
readAt: z.ZodNumber;
|
|
656
|
+
observedSyncId: z.ZodNumber;
|
|
657
|
+
conflictingFields: z.ZodArray<z.ZodString>;
|
|
658
|
+
currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
659
|
+
writtenBy: z.ZodObject<{
|
|
660
|
+
kind: z.ZodEnum<{
|
|
661
|
+
user: "user";
|
|
662
|
+
agent: "agent";
|
|
663
|
+
system: "system";
|
|
664
|
+
}>;
|
|
665
|
+
id: z.ZodString;
|
|
666
|
+
}, z.core.$strip>;
|
|
667
|
+
group: z.ZodOptional<z.ZodString>;
|
|
668
|
+
}, z.core.$strip>>>;
|
|
669
|
+
missingIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
670
|
+
}, z.core.$strict>;
|
|
671
|
+
export type ClientCommitReceipt = z.infer<typeof clientCommitReceiptSchema>;
|