@abloatai/transaction 0.51.0 → 0.52.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/ablo.d.ts +1 -1
- package/dist/ablo.js +1 -1
- package/dist/ai-sdk/updateTool.d.ts +1 -1
- package/dist/ai-sdk/updateTool.js +1 -1
- package/dist/auth/capability.d.ts +2 -2
- package/dist/auth/capability.js +1 -1
- package/dist/auth/index.d.ts +6 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +25 -20
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/schemas.d.ts +24 -1
- package/dist/auth/schemas.d.ts.map +1 -1
- package/dist/auth/schemas.js +8 -2
- package/dist/auth/schemas.js.map +1 -1
- package/dist/auth/sessionIssuanceProtocol.d.ts +41 -0
- package/dist/auth/sessionIssuanceProtocol.d.ts.map +1 -0
- package/dist/auth/sessionIssuanceProtocol.js +48 -0
- package/dist/auth/sessionIssuanceProtocol.js.map +1 -0
- package/dist/auth/sessionMint.js +2 -2
- package/dist/branches.d.ts +4 -4
- package/dist/coordination/schema.d.ts +3 -2
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +7 -2
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +3 -2
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +4 -3
- package/dist/errorCodes.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/resources/httpResources.d.ts +3 -2
- package/dist/resources/httpResources.d.ts.map +1 -1
- package/dist/resources/modelOperations.d.ts +6 -6
- package/dist/schema/ddl.d.ts.map +1 -1
- package/dist/schema/ddl.js +9 -12
- package/dist/schema/ddl.js.map +1 -1
- package/dist/schema/field.d.ts +3 -3
- package/dist/schema/field.js +2 -2
- package/dist/schema/fieldRef.d.ts +1 -1
- package/dist/schema/generate.d.ts +2 -3
- package/dist/schema/generate.d.ts.map +1 -1
- package/dist/schema/generate.js +2 -8
- package/dist/schema/generate.js.map +1 -1
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +3 -3
- package/dist/schema/model.d.ts +7 -7
- package/dist/schema/model.js +2 -2
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +4 -7
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/queries.d.ts +1 -1
- package/dist/schema/queries.js +1 -1
- package/dist/schema/relation.d.ts +8 -8
- package/dist/schema/relation.js +5 -5
- package/dist/schema/schema.d.ts +24 -37
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +15 -28
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/sugar.d.ts +7 -7
- package/dist/schema/sugar.js +5 -5
- package/dist/server/commit.d.ts +5 -1
- package/dist/server/commit.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.js +5 -0
- package/dist/source/adapters/drizzle.js.map +1 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +33 -8
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +58 -20
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
- package/dist/source/adapters/memory.d.ts.map +1 -1
- package/dist/source/adapters/memory.js +5 -0
- package/dist/source/adapters/memory.js.map +1 -1
- package/dist/source/adapters/prisma.d.ts.map +1 -1
- package/dist/source/adapters/prisma.js +6 -1
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/conformance.js +21 -21
- package/dist/source/contract.d.ts +17 -0
- package/dist/source/contract.d.ts.map +1 -1
- package/dist/source/contract.js +31 -0
- package/dist/source/contract.js.map +1 -1
- package/dist/source/index.d.ts +1 -1
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +1 -1
- package/dist/source/index.js.map +1 -1
- package/dist/source/types.d.ts +1 -0
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js.map +1 -1
- package/dist/transactionLayer.d.ts +3 -3
- package/dist/transactionLayer.js +3 -3
- package/dist/transport/httpClient.d.ts +6 -2
- package/dist/transport/httpClient.d.ts.map +1 -1
- package/dist/transport/httpClient.js.map +1 -1
- package/dist/transport/httpTransport.d.ts +1 -0
- package/dist/transport/httpTransport.d.ts.map +1 -1
- package/dist/transport/httpTransport.js +50 -4
- package/dist/transport/httpTransport.js.map +1 -1
- package/dist/transport/wsFrameHandlers.d.ts.map +1 -1
- package/dist/transport/wsFrameHandlers.js +3 -0
- package/dist/transport/wsFrameHandlers.js.map +1 -1
- package/dist/types/streams.d.ts +2 -2
- package/dist/wire/accountResponses.js +2 -2
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/commit.d.ts +144 -0
- package/dist/wire/commit.d.ts.map +1 -1
- package/dist/wire/commit.js +22 -1
- package/dist/wire/commit.js.map +1 -1
- package/dist/wire/frames.d.ts +4 -0
- package/dist/wire/frames.d.ts.map +1 -1
- package/dist/wire/inboundFrames.d.ts +22 -0
- package/dist/wire/inboundFrames.d.ts.map +1 -1
- package/dist/wire/index.d.ts +2 -2
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +1 -1
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/protocol.d.ts +1 -1
- package/dist/wire/protocol.js +1 -1
- package/package.json +1 -1
- package/src/ablo.ts +1 -1
- package/src/ai-sdk/updateTool.ts +1 -1
- package/src/auth/capability.ts +3 -3
- package/src/auth/index.ts +51 -20
- package/src/auth/schemas.ts +16 -2
- package/src/auth/sessionIssuanceProtocol.ts +57 -0
- package/src/auth/sessionMint.ts +2 -2
- package/src/coordination/schema.ts +7 -2
- package/src/errorCodes.ts +10 -4
- package/src/errors.ts +1 -1
- package/src/resources/httpResources.ts +3 -2
- package/src/resources/modelOperations.ts +6 -6
- package/src/schema/ddl.ts +9 -13
- package/src/schema/field.ts +3 -3
- package/src/schema/fieldRef.ts +1 -1
- package/src/schema/generate.ts +2 -8
- package/src/schema/index.ts +3 -3
- package/src/schema/model.ts +7 -7
- package/src/schema/openapi.ts +4 -7
- package/src/schema/queries.ts +1 -1
- package/src/schema/relation.ts +8 -8
- package/src/schema/residency.ts +0 -1
- package/src/schema/schema.ts +33 -58
- package/src/schema/sugar.ts +7 -7
- package/src/server/commit.ts +5 -1
- package/src/source/adapters/drizzle.ts +5 -0
- package/src/source/adapters/kysely.ts +48 -10
- package/src/source/adapters/kyselyMutationCore.ts +69 -22
- package/src/source/adapters/memory.ts +5 -0
- package/src/source/adapters/prisma.ts +6 -1
- package/src/source/conformance.ts +21 -21
- package/src/source/contract.ts +34 -0
- package/src/source/index.ts +2 -0
- package/src/source/types.ts +1 -0
- package/src/transactionLayer.ts +3 -3
- package/src/transport/httpClient.ts +6 -2
- package/src/transport/httpTransport.ts +59 -4
- package/src/transport/wsFrameHandlers.ts +3 -0
- package/src/types/global.ts +1 -1
- package/src/types/streams.ts +2 -2
- package/src/wire/accountResponses.ts +2 -2
- package/src/wire/commit.ts +31 -1
- package/src/wire/index.ts +3 -0
- package/src/wire/protocol.ts +1 -1
package/src/wire/commit.ts
CHANGED
|
@@ -102,6 +102,31 @@ export type CommitWait = z.infer<typeof commitWaitSchema>;
|
|
|
102
102
|
const missingIdsSchema = z.array(z.string().min(1));
|
|
103
103
|
const notificationsSchema = z.array(staleNotificationSchema);
|
|
104
104
|
|
|
105
|
+
export const commitOperationOutcomeSchema = z.enum([
|
|
106
|
+
'created',
|
|
107
|
+
'updated',
|
|
108
|
+
'deleted',
|
|
109
|
+
'archived',
|
|
110
|
+
'unarchived',
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
export const commitOperationResultSchema = z.strictObject({
|
|
114
|
+
transactionId: z.string().min(1),
|
|
115
|
+
outcome: commitOperationOutcomeSchema,
|
|
116
|
+
row: z.record(z.string(), z.unknown()),
|
|
117
|
+
});
|
|
118
|
+
export type CommitOperationResult<
|
|
119
|
+
Row extends Record<string, unknown> = Record<string, unknown>,
|
|
120
|
+
> = Omit<z.infer<typeof commitOperationResultSchema>, 'row'> & { readonly row: Row };
|
|
121
|
+
|
|
122
|
+
const operationResultsSchema = z
|
|
123
|
+
.array(commitOperationResultSchema)
|
|
124
|
+
.min(1)
|
|
125
|
+
.refine(
|
|
126
|
+
(results) => new Set(results.map((result) => result.transactionId)).size === results.length,
|
|
127
|
+
'operation result transactionIds must be unique',
|
|
128
|
+
);
|
|
129
|
+
|
|
105
130
|
export const commitActorSchema = z.strictObject({
|
|
106
131
|
kind: participantKindSchema,
|
|
107
132
|
id: z.string().min(1),
|
|
@@ -155,6 +180,8 @@ const successfulReceiptCommonShape = {
|
|
|
155
180
|
authority: effectiveAuthoritySchema,
|
|
156
181
|
notifications: notificationsSchema.optional(),
|
|
157
182
|
missingIds: missingIdsSchema.optional(),
|
|
183
|
+
/** Exact rows returned by the writing transaction; absent on durable replay. */
|
|
184
|
+
operationResults: operationResultsSchema.optional(),
|
|
158
185
|
} as const;
|
|
159
186
|
|
|
160
187
|
const queuedCommitReceiptSchema = queuedCommitStatusSchema.safeExtend(
|
|
@@ -316,6 +343,7 @@ export type CommitExecutionResult = z.infer<typeof commitExecutionResultSchema>;
|
|
|
316
343
|
const ackCommonShape = {
|
|
317
344
|
notifications: notificationsSchema.optional(),
|
|
318
345
|
missingIds: missingIdsSchema.optional(),
|
|
346
|
+
operationResults: operationResultsSchema.optional(),
|
|
319
347
|
} as const;
|
|
320
348
|
|
|
321
349
|
/** Normalized acknowledgement handed from a mutation transport to the queue. */
|
|
@@ -350,6 +378,7 @@ export const clientCommitReceiptSchema = z.strictObject({
|
|
|
350
378
|
lastSyncId: readSetWatermarkSchema.optional(),
|
|
351
379
|
notifications: notificationsSchema.optional(),
|
|
352
380
|
missingIds: missingIdsSchema.optional(),
|
|
381
|
+
operationResults: operationResultsSchema.optional(),
|
|
353
382
|
});
|
|
354
383
|
export type ClientCommitReceipt = z.infer<typeof clientCommitReceiptSchema>;
|
|
355
384
|
|
|
@@ -382,13 +411,14 @@ export const commitOperationBodySchema = z.object({
|
|
|
382
411
|
action: z.string(),
|
|
383
412
|
model: z.string(),
|
|
384
413
|
data: z.record(z.string(), z.unknown()).nullish(),
|
|
414
|
+
where: z.record(z.string().min(1), z.unknown()).nullish(),
|
|
385
415
|
});
|
|
386
416
|
export type CommitOperationBody = z.infer<typeof commitOperationBodySchema>;
|
|
387
417
|
|
|
388
418
|
/** Commit records retain intent metadata but never copy customer mutation data. */
|
|
389
419
|
export const COMMIT_OPERATION_DATA_RETENTION = 'redacted' as const;
|
|
390
420
|
export const commitRecordOperationSchema = commitOperationBodySchema
|
|
391
|
-
.omit({ data: true })
|
|
421
|
+
.omit({ data: true, where: true })
|
|
392
422
|
.safeExtend({ data: z.strictObject({ retention: z.literal(COMMIT_OPERATION_DATA_RETENTION) }) });
|
|
393
423
|
export type CommitRecordOperation = z.infer<typeof commitRecordOperationSchema>;
|
|
394
424
|
|
package/src/wire/index.ts
CHANGED
|
@@ -99,6 +99,8 @@ export {
|
|
|
99
99
|
commitStatusSchema,
|
|
100
100
|
commitWaitSchema,
|
|
101
101
|
commitReceiptSchema,
|
|
102
|
+
commitOperationOutcomeSchema,
|
|
103
|
+
commitOperationResultSchema,
|
|
102
104
|
rejectedCommitReceiptSchema,
|
|
103
105
|
mutationResultPayloadSchema,
|
|
104
106
|
mutationResultMessageSchema,
|
|
@@ -121,6 +123,7 @@ export {
|
|
|
121
123
|
} from './commit.js';
|
|
122
124
|
export type {
|
|
123
125
|
CommitOperationBody,
|
|
126
|
+
CommitOperationResult,
|
|
124
127
|
CommitActor,
|
|
125
128
|
CommitAttempt,
|
|
126
129
|
CommitClaimReference,
|
package/src/wire/protocol.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* The lease is three ping intervals long and is renewed on every ping, so a
|
|
17
17
|
* live holder always has at least two intervals of runway and a silent one
|
|
18
18
|
* lapses about two missed pings after it stops renewing. The window measures
|
|
19
|
-
* liveness, not how long a
|
|
19
|
+
* liveness, not how long a item may run: widening the lease without also
|
|
20
20
|
* widening the ping makes holders flap, and neither value should be redefined
|
|
21
21
|
* anywhere else.
|
|
22
22
|
*/
|