@abloatai/transaction 0.56.0 → 0.58.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/CONVENTIONS.md +54 -10
- package/README.md +3 -1
- package/dist/ai-sdk/modelTools.d.ts +3 -3
- package/dist/ai-sdk/modelTools.d.ts.map +1 -1
- package/dist/ai-sdk/modelTools.js +1 -1
- package/dist/ai-sdk/modelTools.js.map +1 -1
- package/dist/ai-sdk/updateTool.d.ts +5 -7
- package/dist/ai-sdk/updateTool.d.ts.map +1 -1
- package/dist/ai-sdk/updateTool.js +3 -5
- package/dist/ai-sdk/updateTool.js.map +1 -1
- package/dist/auth/capability.d.ts +5 -0
- package/dist/auth/capability.d.ts.map +1 -1
- package/dist/auth/capability.js +5 -0
- package/dist/auth/capability.js.map +1 -1
- package/dist/auth/capabilityLifecycle.d.ts +1 -1
- package/dist/auth/capabilityLifecycle.d.ts.map +1 -1
- package/dist/auth/credentialPolicy.d.ts +1 -1
- package/dist/auth/credentialPolicy.d.ts.map +1 -1
- package/dist/auth/identity.d.ts +3 -3
- package/dist/auth/identity.d.ts.map +1 -1
- package/dist/auth/identity.js +5 -5
- package/dist/auth/identity.js.map +1 -1
- package/dist/auth/index.d.ts +4 -208
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +4 -330
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +218 -0
- package/dist/auth/runtime.d.ts.map +1 -0
- package/dist/auth/runtime.js +336 -0
- package/dist/auth/runtime.js.map +1 -0
- package/dist/auth/sessionMint.d.ts +1 -1
- package/dist/auth/sessionMint.d.ts.map +1 -1
- package/dist/auth/sessionMint.js +2 -1
- package/dist/auth/sessionMint.js.map +1 -1
- package/dist/branches.d.ts +25 -21
- package/dist/branches.d.ts.map +1 -1
- package/dist/branches.js +3 -0
- package/dist/branches.js.map +1 -1
- package/dist/{coordination/awaitClaimGrant.d.ts → claims/awaitGrant.d.ts} +1 -1
- package/dist/claims/awaitGrant.d.ts.map +1 -0
- package/dist/{coordination/awaitClaimGrant.js → claims/awaitGrant.js} +4 -4
- package/dist/claims/awaitGrant.js.map +1 -0
- package/dist/{wire/claims.d.ts → claims/contract.d.ts} +1 -1
- package/dist/claims/contract.d.ts.map +1 -0
- package/dist/{wire/claims.js → claims/contract.js} +2 -2
- package/dist/claims/contract.js.map +1 -0
- package/dist/{wire/claimEvent.d.ts → claims/eventContract.d.ts} +1 -1
- package/dist/claims/eventContract.d.ts.map +1 -0
- package/dist/{wire/claimEvent.js → claims/eventContract.js} +1 -1
- package/dist/claims/eventContract.js.map +1 -0
- package/dist/{coordination → claims}/events.d.ts +7 -11
- package/dist/claims/events.d.ts.map +1 -0
- package/dist/claims/events.js +8 -0
- package/dist/claims/events.js.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.d.ts → claims/heartbeat.d.ts} +1 -1
- package/dist/claims/heartbeat.d.ts.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.js → claims/heartbeat.js} +1 -1
- package/dist/claims/heartbeat.js.map +1 -0
- package/dist/claims/index.d.ts +17 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +16 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/lifetime.d.ts +26 -0
- package/dist/claims/lifetime.d.ts.map +1 -0
- package/dist/claims/lifetime.js +62 -0
- package/dist/claims/lifetime.js.map +1 -0
- package/dist/{coordination → claims}/locator.d.ts +1 -1
- package/dist/claims/locator.d.ts.map +1 -0
- package/dist/{coordination → claims}/locator.js +2 -2
- package/dist/claims/locator.js.map +1 -0
- package/dist/{coordination/claimMeta.d.ts → claims/meta.d.ts} +1 -1
- package/dist/claims/meta.d.ts.map +1 -0
- package/dist/{coordination/claimMeta.js → claims/meta.js} +1 -1
- package/dist/claims/meta.js.map +1 -0
- package/dist/claims/routes.d.ts +59 -0
- package/dist/claims/routes.d.ts.map +1 -0
- package/dist/claims/routes.js +69 -0
- package/dist/claims/routes.js.map +1 -0
- package/dist/claims/targetConflict.d.ts.map +1 -0
- package/dist/claims/targetConflict.js.map +1 -0
- package/dist/{coordination → claims}/trace.d.ts +2 -2
- package/dist/claims/trace.d.ts.map +1 -0
- package/dist/{coordination → claims}/trace.js +5 -5
- package/dist/claims/trace.js.map +1 -0
- package/dist/{ablo.d.ts → client/ablo.d.ts} +6 -15
- package/dist/client/ablo.d.ts.map +1 -0
- package/dist/{ablo.js → client/ablo.js} +2 -2
- package/dist/client/ablo.js.map +1 -0
- package/dist/{transactionLayer.d.ts → client/contract.d.ts} +12 -14
- package/dist/client/contract.d.ts.map +1 -0
- package/dist/{transactionLayer.js → client/contract.js} +4 -5
- package/dist/client/contract.js.map +1 -0
- package/dist/{headlessClient.d.ts → client/headless.d.ts} +4 -4
- package/dist/client/headless.d.ts.map +1 -0
- package/dist/{headlessClient.js → client/headless.js} +8 -10
- package/dist/{headlessClient.js.map → client/headless.js.map} +1 -1
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.d.ts +4 -4
- package/dist/client/resources/functionalUpdate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.js +3 -3
- package/dist/client/resources/functionalUpdate.js.map +1 -0
- package/dist/{resources → client/resources}/httpResources.d.ts +92 -77
- package/dist/client/resources/httpResources.d.ts.map +1 -0
- package/dist/client/resources/httpResources.js +94 -0
- package/dist/client/resources/httpResources.js.map +1 -0
- package/dist/client/resources/modelCreate.d.ts +21 -0
- package/dist/client/resources/modelCreate.d.ts.map +1 -0
- package/dist/client/resources/modelCreate.js +49 -0
- package/dist/client/resources/modelCreate.js.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.d.ts +57 -51
- package/dist/client/resources/modelOperations.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.js +1 -1
- package/dist/client/resources/modelOperations.js.map +1 -0
- package/dist/{resources → client/resources}/mutationOptions.d.ts +4 -17
- package/dist/client/resources/mutationOptions.d.ts.map +1 -0
- package/dist/client/resources/mutationOptions.js.map +1 -0
- package/dist/client/resources/where.d.ts.map +1 -0
- package/dist/{resources → client/resources}/where.js +1 -1
- package/dist/client/resources/where.js.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.d.ts +16 -35
- package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.js +25 -18
- package/dist/client/resources/writeOptionsSchema.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
- package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
- package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
- package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
- package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
- package/dist/commit/confirmation/pendingWrite.js.map +1 -0
- package/dist/commit/contract.d.ts +1404 -0
- package/dist/commit/contract.d.ts.map +1 -0
- package/dist/{wire/commit.js → commit/contract.js} +26 -21
- package/dist/commit/contract.js.map +1 -0
- package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
- package/dist/commit/durableWrites.d.ts.map +1 -0
- package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
- package/dist/commit/durableWrites.js.map +1 -0
- package/dist/commit/httpRequest.d.ts +45 -0
- package/dist/commit/httpRequest.d.ts.map +1 -0
- package/dist/commit/httpRequest.js +66 -0
- package/dist/commit/httpRequest.js.map +1 -0
- package/dist/commit/index.d.ts +17 -0
- package/dist/commit/index.d.ts.map +1 -0
- package/dist/commit/index.js +17 -0
- package/dist/commit/index.js.map +1 -0
- package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
- package/dist/commit/readSetContext.d.ts.map +1 -0
- package/dist/{readSetContext.js → commit/readSetContext.js} +18 -28
- package/dist/commit/readSetContext.js.map +1 -0
- package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
- package/dist/commit/recordRuntime.d.ts.map +1 -0
- package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
- package/dist/commit/recordRuntime.js.map +1 -0
- package/dist/coordination/index.d.ts +6 -8
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +3 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/schema.d.ts +11 -466
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +13 -265
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +16 -9
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +14 -6
- package/dist/errorCodes.js.map +1 -1
- package/dist/errorObservation.d.ts +2 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -11
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/read-set.d.ts +3 -3
- package/dist/internal/read-set.d.ts.map +1 -1
- package/dist/internal/read-set.js +2 -2
- package/dist/internal/read-set.js.map +1 -1
- package/dist/observability.d.ts +4 -4
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +2 -2
- package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
- package/dist/observation/contract.d.ts.map +1 -0
- package/dist/{wire/delta.js → observation/contract.js} +3 -3
- package/dist/observation/contract.js.map +1 -0
- package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
- package/dist/observation/cursor.d.ts.map +1 -0
- package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
- package/dist/observation/cursor.js.map +1 -0
- package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
- package/dist/observation/deliveryContract.d.ts.map +1 -0
- package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
- package/dist/observation/deliveryContract.js.map +1 -0
- package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
- package/dist/observation/feedContract.d.ts.map +1 -0
- package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
- package/dist/observation/feedContract.js.map +1 -0
- package/dist/observation/httpFeed.d.ts +4 -0
- package/dist/observation/httpFeed.d.ts.map +1 -0
- package/dist/{transport → observation}/httpFeed.js +1 -1
- package/dist/{transport → observation}/httpFeed.js.map +1 -1
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
- package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
- package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
- package/dist/pricing.d.ts +20 -12
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +46 -26
- package/dist/pricing.js.map +1 -1
- package/dist/schema/audit.d.ts +15 -0
- package/dist/schema/audit.d.ts.map +1 -0
- package/dist/schema/audit.js +90 -0
- package/dist/schema/audit.js.map +1 -0
- package/dist/schema/ddl.d.ts.map +1 -1
- package/dist/schema/ddl.js +68 -1
- package/dist/schema/ddl.js.map +1 -1
- package/dist/schema/index.d.ts +7 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +6 -7
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +14 -27
- package/dist/schema/model.d.ts.map +1 -1
- package/dist/schema/model.js +2 -2
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +149 -8
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/roles.d.ts +27 -0
- package/dist/schema/roles.d.ts.map +1 -1
- package/dist/schema/roles.js +40 -0
- package/dist/schema/roles.js.map +1 -1
- package/dist/schema/schema.d.ts +34 -7
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +39 -3
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/serialize.d.ts +5 -5
- package/dist/schema/serialize.d.ts.map +1 -1
- package/dist/schema/serialize.js +5 -5
- package/dist/schema/serialize.js.map +1 -1
- package/dist/schema/subject.d.ts +18 -0
- package/dist/schema/subject.d.ts.map +1 -0
- package/dist/schema/subject.js +27 -0
- package/dist/schema/subject.js.map +1 -0
- package/dist/schema/tenancy.d.ts +1 -1
- package/dist/server/adapter.d.ts +3 -1
- package/dist/server/adapter.d.ts.map +1 -1
- package/dist/server/commit.d.ts +6 -14
- package/dist/server/commit.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/readConfig.d.ts +3 -0
- package/dist/server/readConfig.d.ts.map +1 -1
- package/dist/server/readConfig.js +0 -21
- package/dist/server/readConfig.js.map +1 -1
- package/dist/server/storageMode.d.ts +1 -1
- package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
- package/dist/source/adapters/adapter.d.ts.map +1 -0
- package/dist/source/adapters/adapter.js.map +1 -0
- package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
- package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
- package/dist/source/adapters/adapterFactory.js.map +1 -0
- package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
- package/dist/source/adapters/adapterProfile.js.map +1 -0
- package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
- package/dist/source/adapters/conformance.d.ts.map +1 -0
- package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
- package/dist/source/adapters/conformance.js.map +1 -0
- package/dist/source/{contract.d.ts → adapters/contract.d.ts} +20 -75
- package/dist/source/adapters/contract.d.ts.map +1 -0
- package/dist/source/{contract.js → adapters/contract.js} +20 -55
- package/dist/source/adapters/contract.js.map +1 -0
- package/dist/source/adapters/drizzle.d.ts +1 -1
- package/dist/source/adapters/drizzle.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.js +54 -25
- package/dist/source/adapters/drizzle.js.map +1 -1
- package/dist/source/adapters/idempotency.d.ts.map +1 -0
- package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
- package/dist/source/adapters/idempotency.js.map +1 -0
- package/dist/source/adapters/index.d.ts +21 -0
- package/dist/source/adapters/index.d.ts.map +1 -0
- package/dist/source/adapters/index.js +21 -0
- package/dist/source/adapters/index.js.map +1 -0
- package/dist/source/adapters/kysely.d.ts +3 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +49 -23
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +6 -3
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +17 -8
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
- package/dist/source/adapters/memory.d.ts +3 -3
- package/dist/source/adapters/memory.d.ts.map +1 -1
- package/dist/source/adapters/memory.js +20 -7
- package/dist/source/adapters/memory.js.map +1 -1
- package/dist/source/adapters/migration.d.ts +8 -0
- package/dist/source/adapters/migration.d.ts.map +1 -0
- package/dist/source/adapters/migration.js +9 -0
- package/dist/source/adapters/migration.js.map +1 -0
- package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
- package/dist/source/adapters/migrations.d.ts.map +1 -0
- package/dist/source/{migrations.js → adapters/migrations.js} +4 -31
- package/dist/source/adapters/migrations.js.map +1 -0
- package/dist/source/adapters/prisma.d.ts +1 -1
- package/dist/source/adapters/prisma.d.ts.map +1 -1
- package/dist/source/adapters/prisma.js +75 -30
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/adapters/subjectAuthorization.d.ts +16 -0
- package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
- package/dist/source/adapters/subjectAuthorization.js +126 -0
- package/dist/source/adapters/subjectAuthorization.js.map +1 -0
- package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
- package/dist/source/connector/client.d.ts.map +1 -0
- package/dist/source/{connector.js → connector/client.js} +28 -11
- package/dist/source/connector/client.js.map +1 -0
- package/dist/source/connector/index.d.ts +4 -0
- package/dist/source/connector/index.d.ts.map +1 -0
- package/dist/source/connector/index.js +4 -0
- package/dist/source/connector/index.js.map +1 -0
- package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
- package/dist/source/connector/protocol.d.ts.map +1 -0
- package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
- package/dist/source/connector/protocol.js.map +1 -0
- package/dist/source/delivery/index.d.ts +3 -0
- package/dist/source/delivery/index.d.ts.map +1 -0
- package/dist/source/delivery/index.js +3 -0
- package/dist/source/delivery/index.js.map +1 -0
- package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
- package/dist/source/delivery/pushQueue.d.ts.map +1 -0
- package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
- package/dist/source/delivery/pushQueue.js.map +1 -0
- package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +9 -3
- package/dist/source/endpoint/factory.d.ts.map +1 -0
- package/dist/source/{factory.js → endpoint/factory.js} +122 -6
- package/dist/source/endpoint/factory.js.map +1 -0
- package/dist/source/endpoint/index.d.ts +5 -0
- package/dist/source/endpoint/index.d.ts.map +1 -0
- package/dist/source/endpoint/index.js +5 -0
- package/dist/source/endpoint/index.js.map +1 -0
- package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
- package/dist/source/endpoint/next.d.ts.map +1 -0
- package/dist/source/{next.js → endpoint/next.js} +1 -1
- package/dist/source/endpoint/next.js.map +1 -0
- package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
- package/dist/source/endpoint/signing.d.ts.map +1 -0
- package/dist/source/{signing.js → endpoint/signing.js} +1 -1
- package/dist/source/endpoint/signing.js.map +1 -0
- package/dist/source/index.d.ts +15 -12
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +13 -10
- package/dist/source/index.js.map +1 -1
- package/dist/source/outbox/contract.d.ts +50 -0
- package/dist/source/outbox/contract.d.ts.map +1 -0
- package/dist/source/outbox/contract.js +50 -0
- package/dist/source/outbox/contract.js.map +1 -0
- package/dist/source/outbox/envelope.d.ts +9 -0
- package/dist/source/outbox/envelope.d.ts.map +1 -0
- package/dist/source/outbox/envelope.js +36 -0
- package/dist/source/outbox/envelope.js.map +1 -0
- package/dist/source/outbox/index.d.ts +11 -0
- package/dist/source/outbox/index.d.ts.map +1 -0
- package/dist/source/outbox/index.js +11 -0
- package/dist/source/outbox/index.js.map +1 -0
- package/dist/source/outbox/migrations.d.ts +4 -0
- package/dist/source/outbox/migrations.d.ts.map +1 -0
- package/dist/source/outbox/migrations.js +67 -0
- package/dist/source/outbox/migrations.js.map +1 -0
- package/dist/source/outbox/retention.d.ts +3 -0
- package/dist/source/outbox/retention.d.ts.map +1 -0
- package/dist/source/outbox/retention.js +3 -0
- package/dist/source/outbox/retention.js.map +1 -0
- package/dist/source/types.d.ts +59 -10
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js +2 -0
- package/dist/source/types.js.map +1 -1
- package/dist/syncLog/contract.d.ts +19 -8
- package/dist/syncLog/contract.d.ts.map +1 -1
- package/dist/syncLog/contract.js +19 -6
- package/dist/syncLog/contract.js.map +1 -1
- package/dist/testing/fixtures/httpResponses.d.ts +6 -0
- package/dist/testing/fixtures/httpResponses.d.ts.map +1 -1
- package/dist/testing/fixtures/httpResponses.js +1 -0
- package/dist/testing/fixtures/httpResponses.js.map +1 -1
- package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
- package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
- package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
- package/dist/transport/connection/credentialLifecycle.js.map +1 -0
- package/dist/transport/connection/index.d.ts +5 -0
- package/dist/transport/connection/index.d.ts.map +1 -0
- package/dist/transport/connection/index.js +5 -0
- package/dist/transport/connection/index.js.map +1 -0
- package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
- package/dist/transport/connection/manager.d.ts.map +1 -0
- package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
- package/dist/transport/connection/manager.js.map +1 -0
- package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
- package/dist/transport/connection/networkProbe.d.ts.map +1 -0
- package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
- package/dist/transport/connection/networkProbe.js.map +1 -0
- package/dist/transport/{httpClient.d.ts → http/client.d.ts} +32 -44
- package/dist/transport/http/client.d.ts.map +1 -0
- package/dist/transport/{httpClient.js → http/client.js} +96 -105
- package/dist/transport/http/client.js.map +1 -0
- package/dist/transport/http/helpers.d.ts +10 -0
- package/dist/transport/http/helpers.d.ts.map +1 -0
- package/dist/transport/http/helpers.js +46 -0
- package/dist/transport/http/helpers.js.map +1 -0
- package/dist/transport/http/index.d.ts +6 -0
- package/dist/transport/http/index.d.ts.map +1 -0
- package/dist/transport/http/index.js +6 -0
- package/dist/transport/http/index.js.map +1 -0
- package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
- package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
- package/dist/transport/{httpOptions.js → http/options.js} +1 -1
- package/dist/transport/http/options.js.map +1 -0
- package/dist/transport/http/subscription.d.ts +16 -0
- package/dist/transport/http/subscription.d.ts.map +1 -0
- package/dist/transport/http/subscription.js +146 -0
- package/dist/transport/http/subscription.js.map +1 -0
- package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
- package/dist/transport/http/transport.d.ts.map +1 -0
- package/dist/transport/{httpTransport.js → http/transport.js} +153 -188
- package/dist/transport/http/transport.js.map +1 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
- package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
- package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
- package/dist/transport/websocket/commitFrames.js.map +1 -0
- package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
- package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
- package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
- package/dist/transport/websocket/frameHandlers.js.map +1 -0
- package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
- package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
- package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
- package/dist/transport/websocket/heartbeat.js.map +1 -0
- package/dist/transport/websocket/index.d.ts +6 -0
- package/dist/transport/websocket/index.d.ts.map +1 -0
- package/dist/transport/websocket/index.js +6 -0
- package/dist/transport/websocket/index.js.map +1 -0
- package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
- package/dist/transport/websocket/transport.d.ts.map +1 -0
- package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
- package/dist/transport/websocket/transport.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/streams.d.ts +8 -48
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +2 -2
- package/dist/wire/accountResponses.d.ts +4 -72
- package/dist/wire/accountResponses.d.ts.map +1 -1
- package/dist/wire/accountResponses.js +2 -10
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/apiLifecycle.d.ts +63 -0
- package/dist/wire/apiLifecycle.d.ts.map +1 -0
- package/dist/wire/apiLifecycle.js +89 -0
- package/dist/wire/apiLifecycle.js.map +1 -0
- package/dist/wire/frames.d.ts +6 -83
- package/dist/wire/frames.d.ts.map +1 -1
- package/dist/wire/frames.js +4 -11
- package/dist/wire/frames.js.map +1 -1
- package/dist/wire/inboundFrames.d.ts +6 -131
- package/dist/wire/inboundFrames.d.ts.map +1 -1
- package/dist/wire/inboundFrames.js +3 -3
- package/dist/wire/inboundFrames.js.map +1 -1
- package/dist/wire/index.d.ts +20 -15
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +22 -8
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/modelMutations.d.ts +1 -32
- package/dist/wire/modelMutations.d.ts.map +1 -1
- package/dist/wire/modelMutations.js +1 -8
- package/dist/wire/modelMutations.js.map +1 -1
- package/dist/wire/rateLimit.d.ts +82 -0
- package/dist/wire/rateLimit.d.ts.map +1 -0
- package/dist/wire/rateLimit.js +142 -0
- package/dist/wire/rateLimit.js.map +1 -0
- package/package.json +130 -10
- package/src/ai-sdk/modelTools.ts +5 -5
- package/src/ai-sdk/updateTool.ts +5 -7
- package/src/auth/capability.ts +5 -0
- package/src/auth/capabilityLifecycle.ts +1 -1
- package/src/auth/credentialPolicy.ts +1 -1
- package/src/auth/identity.ts +7 -7
- package/src/auth/index.ts +4 -663
- package/src/auth/runtime.ts +669 -0
- package/src/auth/sessionMint.ts +3 -2
- package/src/branches.ts +3 -0
- package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
- package/src/{wire/claims.ts → claims/contract.ts} +1 -1
- package/src/{coordination → claims}/events.ts +7 -11
- package/src/claims/index.ts +21 -0
- package/src/claims/lifetime.ts +78 -0
- package/src/{coordination → claims}/locator.ts +3 -3
- package/src/claims/routes.ts +81 -0
- package/src/{coordination → claims}/trace.ts +5 -5
- package/src/{ablo.ts → client/ablo.ts} +8 -20
- package/src/{transactionLayer.ts → client/contract.ts} +11 -13
- package/src/{headlessClient.ts → client/headless.ts} +13 -15
- package/src/client/index.ts +10 -0
- package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
- package/src/{resources → client/resources}/httpResources.ts +163 -92
- package/src/client/resources/modelCreate.ts +73 -0
- package/src/{resources → client/resources}/modelOperations.ts +73 -55
- package/src/{resources → client/resources}/mutationOptions.ts +4 -17
- package/src/{resources → client/resources}/where.ts +1 -1
- package/src/{resources → client/resources}/writeOptionsSchema.ts +35 -27
- package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
- package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
- package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
- package/src/{wire/commit.ts → commit/contract.ts} +27 -26
- package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
- package/src/commit/httpRequest.ts +103 -0
- package/src/commit/index.ts +16 -0
- package/src/{readSetContext.ts → commit/readSetContext.ts} +24 -43
- package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
- package/src/coordination/index.ts +4 -54
- package/src/coordination/schema.ts +15 -309
- package/src/errorCodes.ts +62 -10
- package/src/errors.ts +32 -10
- package/src/index.ts +8 -8
- package/src/internal/read-set.ts +3 -6
- package/src/observability.ts +4 -4
- package/src/{wire/delta.ts → observation/contract.ts} +2 -2
- package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
- package/src/{transport → observation}/httpFeed.ts +3 -3
- package/src/observation/index.ts +12 -0
- package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
- package/src/pricing.ts +46 -25
- package/src/schema/audit.ts +121 -0
- package/src/schema/ddl.ts +71 -1
- package/src/schema/index.ts +20 -20
- package/src/schema/model.ts +17 -33
- package/src/schema/openapi.ts +170 -9
- package/src/schema/roles.ts +53 -0
- package/src/schema/schema.ts +91 -6
- package/src/schema/serialize.ts +8 -9
- package/src/schema/subject.ts +43 -0
- package/src/server/adapter.ts +3 -1
- package/src/server/commit.ts +6 -14
- package/src/server/index.ts +1 -1
- package/src/server/readConfig.ts +4 -0
- package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
- package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
- package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
- package/src/source/{contract.ts → adapters/contract.ts} +24 -61
- package/src/source/adapters/drizzle.ts +75 -29
- package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
- package/src/source/adapters/index.ts +20 -0
- package/src/source/adapters/kysely.ts +77 -27
- package/src/source/adapters/kyselyMutationCore.ts +23 -11
- package/src/source/adapters/memory.ts +26 -9
- package/src/source/adapters/migration.ts +11 -0
- package/src/source/{migrations.ts → adapters/migrations.ts} +6 -33
- package/src/source/adapters/prisma.ts +98 -34
- package/src/source/adapters/subjectAuthorization.ts +182 -0
- package/src/source/{connector.ts → connector/client.ts} +35 -12
- package/src/source/connector/index.ts +3 -0
- package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
- package/src/source/delivery/index.ts +2 -0
- package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
- package/src/source/{factory.ts → endpoint/factory.ts} +150 -9
- package/src/source/endpoint/index.ts +4 -0
- package/src/source/{next.ts → endpoint/next.ts} +2 -2
- package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
- package/src/source/index.ts +27 -18
- package/src/source/outbox/contract.ts +56 -0
- package/src/source/outbox/envelope.ts +47 -0
- package/src/source/outbox/index.ts +15 -0
- package/src/source/outbox/migrations.ts +71 -0
- package/src/source/outbox/retention.ts +2 -0
- package/src/source/types.ts +64 -10
- package/src/syncLog/contract.ts +19 -9
- package/src/testing/fixtures/httpResponses.ts +7 -0
- package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
- package/src/transport/connection/index.ts +4 -0
- package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
- package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
- package/src/transport/{httpClient.ts → http/client.ts} +165 -184
- package/src/transport/http/helpers.ts +63 -0
- package/src/transport/http/index.ts +5 -0
- package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
- package/src/transport/http/subscription.ts +174 -0
- package/src/transport/{httpTransport.ts → http/transport.ts} +210 -246
- package/src/transport/index.ts +7 -0
- package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
- package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
- package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
- package/src/transport/websocket/index.ts +5 -0
- package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
- package/src/types/index.ts +2 -6
- package/src/types/streams.ts +7 -61
- package/src/webhooks/events.ts +1 -1
- package/src/wire/accountResponses.ts +3 -12
- package/src/wire/apiLifecycle.ts +94 -0
- package/src/wire/frames.ts +5 -15
- package/src/wire/inboundFrames.ts +3 -3
- package/src/wire/index.ts +50 -15
- package/src/wire/modelMutations.ts +1 -14
- package/src/wire/rateLimit.ts +155 -0
- package/dist/ablo.d.ts.map +0 -1
- package/dist/ablo.js.map +0 -1
- package/dist/commitRecordRuntime.d.ts.map +0 -1
- package/dist/commitRecordRuntime.js.map +0 -1
- package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
- package/dist/coordination/awaitClaimGrant.js.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
- package/dist/coordination/claimMeta.d.ts.map +0 -1
- package/dist/coordination/claimMeta.js.map +0 -1
- package/dist/coordination/events.d.ts.map +0 -1
- package/dist/coordination/events.js +0 -8
- package/dist/coordination/events.js.map +0 -1
- package/dist/coordination/locator.d.ts.map +0 -1
- package/dist/coordination/locator.js.map +0 -1
- package/dist/coordination/targetConflict.d.ts.map +0 -1
- package/dist/coordination/targetConflict.js.map +0 -1
- package/dist/coordination/trace.d.ts.map +0 -1
- package/dist/coordination/trace.js.map +0 -1
- package/dist/durableWrites.d.ts.map +0 -1
- package/dist/durableWrites.js.map +0 -1
- package/dist/headlessClient.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.js.map +0 -1
- package/dist/policy/types.d.ts +0 -226
- package/dist/policy/types.d.ts.map +0 -1
- package/dist/policy/types.js +0 -127
- package/dist/policy/types.js.map +0 -1
- package/dist/readSetContext.d.ts.map +0 -1
- package/dist/readSetContext.js.map +0 -1
- package/dist/resources/functionalUpdate.d.ts.map +0 -1
- package/dist/resources/functionalUpdate.js.map +0 -1
- package/dist/resources/httpResources.d.ts.map +0 -1
- package/dist/resources/httpResources.js +0 -17
- package/dist/resources/httpResources.js.map +0 -1
- package/dist/resources/modelOperations.d.ts.map +0 -1
- package/dist/resources/modelOperations.js.map +0 -1
- package/dist/resources/mutationOptions.d.ts.map +0 -1
- package/dist/resources/mutationOptions.js.map +0 -1
- package/dist/resources/where.d.ts.map +0 -1
- package/dist/resources/where.js.map +0 -1
- package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
- package/dist/resources/writeOptionsSchema.js.map +0 -1
- package/dist/schema/coordination.d.ts +0 -113
- package/dist/schema/coordination.d.ts.map +0 -1
- package/dist/schema/coordination.js +0 -134
- package/dist/schema/coordination.js.map +0 -1
- package/dist/source/adapter.d.ts.map +0 -1
- package/dist/source/adapter.js.map +0 -1
- package/dist/source/adapterFactory.d.ts.map +0 -1
- package/dist/source/adapterFactory.js.map +0 -1
- package/dist/source/adapterProfile.d.ts.map +0 -1
- package/dist/source/adapterProfile.js.map +0 -1
- package/dist/source/conformance.d.ts.map +0 -1
- package/dist/source/conformance.js.map +0 -1
- package/dist/source/connector.d.ts.map +0 -1
- package/dist/source/connector.js.map +0 -1
- package/dist/source/connectorProtocol.d.ts.map +0 -1
- package/dist/source/connectorProtocol.js.map +0 -1
- package/dist/source/contract.d.ts.map +0 -1
- package/dist/source/contract.js.map +0 -1
- package/dist/source/drizzle.d.ts +0 -2
- package/dist/source/drizzle.d.ts.map +0 -1
- package/dist/source/drizzle.js +0 -2
- package/dist/source/drizzle.js.map +0 -1
- package/dist/source/factory.d.ts.map +0 -1
- package/dist/source/factory.js.map +0 -1
- package/dist/source/idempotency.d.ts.map +0 -1
- package/dist/source/idempotency.js.map +0 -1
- package/dist/source/kysely.d.ts +0 -3
- package/dist/source/kysely.d.ts.map +0 -1
- package/dist/source/kysely.js +0 -3
- package/dist/source/kysely.js.map +0 -1
- package/dist/source/migrations.d.ts.map +0 -1
- package/dist/source/migrations.js.map +0 -1
- package/dist/source/next.d.ts.map +0 -1
- package/dist/source/next.js.map +0 -1
- package/dist/source/pushQueue.d.ts.map +0 -1
- package/dist/source/pushQueue.js.map +0 -1
- package/dist/source/signing.d.ts.map +0 -1
- package/dist/source/signing.js.map +0 -1
- package/dist/transactionLayer.d.ts.map +0 -1
- package/dist/transactionLayer.js.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
- package/dist/transport/commitFrames.d.ts.map +0 -1
- package/dist/transport/commitFrames.js.map +0 -1
- package/dist/transport/connectionManager.d.ts.map +0 -1
- package/dist/transport/connectionManager.js.map +0 -1
- package/dist/transport/credentialLifecycle.d.ts.map +0 -1
- package/dist/transport/credentialLifecycle.js.map +0 -1
- package/dist/transport/heartbeat.d.ts.map +0 -1
- package/dist/transport/heartbeat.js.map +0 -1
- package/dist/transport/httpClient.d.ts.map +0 -1
- package/dist/transport/httpClient.js.map +0 -1
- package/dist/transport/httpFeed.d.ts +0 -4
- package/dist/transport/httpFeed.d.ts.map +0 -1
- package/dist/transport/httpOptions.js.map +0 -1
- package/dist/transport/httpTransport.d.ts.map +0 -1
- package/dist/transport/httpTransport.js.map +0 -1
- package/dist/transport/networkProbe.d.ts.map +0 -1
- package/dist/transport/networkProbe.js.map +0 -1
- package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
- package/dist/transport/wsFrameHandlers.js.map +0 -1
- package/dist/transport/wsTransport.d.ts.map +0 -1
- package/dist/transport/wsTransport.js.map +0 -1
- package/dist/wire/claimEvent.d.ts.map +0 -1
- package/dist/wire/claimEvent.js.map +0 -1
- package/dist/wire/claims.d.ts.map +0 -1
- package/dist/wire/claims.js.map +0 -1
- package/dist/wire/commit.d.ts +0 -2801
- package/dist/wire/commit.d.ts.map +0 -1
- package/dist/wire/commit.js.map +0 -1
- package/dist/wire/delta.d.ts.map +0 -1
- package/dist/wire/delta.js.map +0 -1
- package/dist/wire/deltaDelivery.d.ts.map +0 -1
- package/dist/wire/deltaDelivery.js.map +0 -1
- package/dist/wire/feedCursor.d.ts.map +0 -1
- package/dist/wire/feedCursor.js.map +0 -1
- package/dist/wire/feedEvent.d.ts.map +0 -1
- package/dist/wire/feedEvent.js.map +0 -1
- package/src/policy/types.ts +0 -300
- package/src/schema/coordination.ts +0 -161
- package/src/source/drizzle.ts +0 -1
- package/src/source/kysely.ts +0 -2
- /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
- /package/dist/{coordination → claims}/targetConflict.js +0 -0
- /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
- /package/dist/{resources → client/resources}/where.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
- /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
- /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
- /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
- /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
- /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
- /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
- /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
- /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
- /package/src/{coordination → claims}/targetConflict.ts +0 -0
- /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
- /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
- /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
- /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
|
@@ -18,8 +18,8 @@ import type { AssertExact } from '../types/assertExact.js';
|
|
|
18
18
|
* 1. Presence (observation): who is working where. It reports, never blocks.
|
|
19
19
|
* 2. Claims (pessimistic leases): `claim_begin` / `claim_abandon` grant one
|
|
20
20
|
* participant exclusive intent on a target while others wait.
|
|
21
|
-
* 3. Stale-context (optimistic): a `readAt` watermark
|
|
22
|
-
*
|
|
21
|
+
* 3. Stale-context (optimistic): a `readAt` watermark that rejects a lost
|
|
22
|
+
* update when the row moved after you read it.
|
|
23
23
|
*
|
|
24
24
|
* These Zod schemas are the single definition of each shape. Both the client
|
|
25
25
|
* SDK and the server derive their TypeScript types from them with `z.infer`
|
|
@@ -225,7 +225,7 @@ export type TargetRef = z.infer<typeof targetRefSchema>;
|
|
|
225
225
|
*
|
|
226
226
|
* Declared beside {@link targetRefSchema} because the two are the same shape in
|
|
227
227
|
* two spellings, and a member added to one belongs in the other. Both are read
|
|
228
|
-
* by
|
|
228
|
+
* by the claim family below, so this has to
|
|
229
229
|
* precede them.
|
|
230
230
|
*/
|
|
231
231
|
export const modelTargetSchema = z
|
|
@@ -255,62 +255,18 @@ const streamTargetSchema = targetRefSchema
|
|
|
255
255
|
// Layer 3 — optimistic stale-context (the write guard)
|
|
256
256
|
// ─────────────────────────────────────────────────────────────────────────
|
|
257
257
|
|
|
258
|
-
/**
|
|
259
|
-
* How the server treats a write whose snapshot watermark (`readAt`) is older
|
|
260
|
-
* than the target row's latest change. There are three dispositions:
|
|
261
|
-
* • `notify` — hold the write and return a {@link StaleNotification}
|
|
262
|
-
* carrying the current value, so the actor (agent or human)
|
|
263
|
-
* can resolve it.
|
|
264
|
-
* • `reject` — throw `AbloStaleContextError`, the default when `readAt`
|
|
265
|
-
* is present.
|
|
266
|
-
* • `overwrite` — apply the write blindly, last write wins, with no signal.
|
|
267
|
-
*/
|
|
268
|
-
export const onStaleModeSchema = z.enum(['reject', 'overwrite', 'notify']);
|
|
269
|
-
export type OnStaleMode = z.infer<typeof onStaleModeSchema>;
|
|
270
|
-
|
|
271
|
-
/** @deprecated A ReadSet entry retains a {@link logPositionSchema} like every
|
|
272
|
-
* other position; the reader is the owner, and the owner belongs in the field
|
|
273
|
-
* name rather than in a second type. Removed in 0.57.0. */
|
|
274
|
-
export const readSetWatermarkSchema = logPositionSchema;
|
|
275
|
-
/** @deprecated Use {@link LogPosition}. Removed in 0.57.0. */
|
|
276
|
-
export type ReadSetWatermark = LogPosition;
|
|
277
|
-
|
|
278
258
|
/** Maximum decision-input entries one logical commit may ask the server to scan. */
|
|
279
259
|
export const MAX_READ_SET_ENTRIES = 500;
|
|
280
260
|
|
|
281
|
-
/** A persisted entry cannot overwrite: it observes future writes, not its own. */
|
|
282
|
-
export const trackOnStaleSchema = onStaleModeSchema.exclude(['overwrite']);
|
|
283
|
-
export type TrackOnStale = z.infer<typeof trackOnStaleSchema>;
|
|
284
|
-
|
|
285
261
|
/**
|
|
286
262
|
* The optimistic guard carried on a commit operation. `readAt` is the
|
|
287
|
-
* snapshot watermark
|
|
288
|
-
* `bypass` is the explicit, recorded override of a *foreign* pessimistic
|
|
289
|
-
* claim — see the claim layer below.
|
|
263
|
+
* snapshot watermark captured by `read` (null/absent ⇒ unguarded write).
|
|
290
264
|
*/
|
|
291
265
|
export const writeGuardSchema = z.object({
|
|
292
266
|
readAt: logPositionSchema.nullish(),
|
|
293
|
-
onStale: onStaleModeSchema.nullish(),
|
|
294
|
-
bypass: z.boolean().optional(),
|
|
295
267
|
});
|
|
296
268
|
export type WriteGuard = z.infer<typeof writeGuardSchema>;
|
|
297
269
|
|
|
298
|
-
/**
|
|
299
|
-
* The advisory returned to a committer whose write hit a stale-context
|
|
300
|
-
* conflict under `onStale: 'notify'` — it reports that the value the committer
|
|
301
|
-
* reasoned against changed while they were away. Rather than throwing, the
|
|
302
|
-
* server hands back the conflicting field's current value as data so the
|
|
303
|
-
* actor — an agent or a human — can reconcile and re-commit. A claim is the
|
|
304
|
-
* prospective form of the same idea (coordinate before acting); this
|
|
305
|
-
* notification is the in-flight form (here is what changed, you resolve). It
|
|
306
|
-
* rides on the commit acknowledgement alongside `lastSyncId`; an empty or
|
|
307
|
-
* absent array means nothing the committer depended on moved.
|
|
308
|
-
*
|
|
309
|
-
* Only `onStale: 'notify'` produces this. The conflicting operation was held,
|
|
310
|
-
* not written, and the actor reconciles against `currentValues` and
|
|
311
|
-
* re-commits. `reject` throws instead, and `overwrite` proceeds silently —
|
|
312
|
-
* neither notifies.
|
|
313
|
-
*/
|
|
314
270
|
/**
|
|
315
271
|
* A log position, as the server reports one.
|
|
316
272
|
*
|
|
@@ -336,203 +292,18 @@ const syncIdSchema = z.number().int().nonnegative();
|
|
|
336
292
|
* • `parent` — it sits one declared containment edge below the root.
|
|
337
293
|
* • `transitive` — the root is ≥2 hops up (`comment → item → project`).
|
|
338
294
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
via: z.enum(['self', 'parent', 'transitive']),
|
|
342
|
-
/**
|
|
343
|
-
* The intermediate models walked from the moved row up to the scope root,
|
|
344
|
-
* nearest hop first — the part of the route a reader cannot see from the
|
|
345
|
-
* two endpoints. Empty on `self` and `parent`, which have no intermediate.
|
|
346
|
-
*
|
|
347
|
-
* Model names, not rows: naming the intermediate ROWS would cost a join per
|
|
348
|
-
* notification, and the route is what explains the reach. `target` already
|
|
349
|
-
* identifies the row that moved and `group` the premise it broke.
|
|
350
|
-
*/
|
|
351
|
-
through: z.array(z.string()).readonly(),
|
|
352
|
-
})
|
|
353
|
-
.readonly();
|
|
354
|
-
export type StalePropagation = z.infer<typeof stalePropagationSchema>;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* What both notification scopes carry. The arms below derive from it rather
|
|
358
|
-
* than restate it, the same way {@link claimStateSchema} projects the claim
|
|
359
|
-
* record.
|
|
360
|
-
*/
|
|
361
|
-
const staleNotificationBaseSchema = z.object({
|
|
362
|
-
/** Names this object's type; every returned object carries such a tag. */
|
|
363
|
-
object: z.literal('stale_notification'),
|
|
364
|
-
/**
|
|
365
|
-
* The row that moved, and which part of it — `fields` holds the columns whose
|
|
366
|
-
* concurrent change collided (empty ⇒ a whole-entity CREATE/DELETE).
|
|
367
|
-
*
|
|
368
|
-
* The same shape a claim names its subject with, so one reader handles "who
|
|
369
|
-
* holds this row" and "this row moved under you" without learning two
|
|
370
|
-
* vocabularies. In BOTH scopes this is the row that actually changed: a group
|
|
371
|
-
* notification names the moved row here and the fired premise in `group`.
|
|
372
|
-
*/
|
|
373
|
-
target: modelTargetSchema,
|
|
374
|
-
/** The watermark the committer reasoned against (its `readAt`). */
|
|
375
|
-
readAt: syncIdSchema,
|
|
376
|
-
/**
|
|
377
|
-
* Newest delta id on the premise — the committer's new watermark. Re-capture
|
|
378
|
-
* context at/after this id to reconcile.
|
|
379
|
-
*/
|
|
380
|
-
observedSyncId: syncIdSchema,
|
|
381
|
-
/** Who wrote the conflicting delta. */
|
|
382
|
-
writtenBy: z.object({
|
|
383
|
-
kind: participantKindSchema,
|
|
384
|
-
id: z.string(),
|
|
385
|
-
}),
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
/** A premise on one row: that row moved. */
|
|
389
|
-
export const rowStaleNotificationSchema = staleNotificationBaseSchema.extend({
|
|
390
|
-
scope: z.literal('row'),
|
|
391
|
-
/**
|
|
392
|
-
* The live values of `target.fields` after the conflict — the piece a plain
|
|
393
|
-
* stale error omits. It lets the actor reconcile without a follow-up read.
|
|
394
|
-
*
|
|
395
|
-
* Row scope only. Reading live values is cheap for one known row and is what
|
|
396
|
-
* a group breach cannot promise, so the group arm omits the field rather than
|
|
397
|
-
* carrying an empty one that reads as "nothing changed".
|
|
398
|
-
*/
|
|
399
|
-
currentValues: z.record(z.string(), z.unknown()),
|
|
400
|
-
});
|
|
401
|
-
export type RowStaleNotification = z.infer<typeof rowStaleNotificationSchema>;
|
|
402
|
-
|
|
403
|
-
/** A premise on a whole sync group: something in it moved. */
|
|
404
|
-
export const groupStaleNotificationSchema = staleNotificationBaseSchema.extend({
|
|
405
|
-
scope: z.literal('group'),
|
|
406
|
-
/**
|
|
407
|
-
* The group premise that fired (`report:abc`, `section:s1`).
|
|
408
|
-
*
|
|
409
|
-
* Same format schema the premise declares, so the value a caller writes into
|
|
410
|
-
* `reads[].group` and the value it gets back name a group identically. The
|
|
411
|
-
* BRANDED view is for values Ablo mints; a notification only echoes the
|
|
412
|
-
* premise it was handed, and re-parsing it to acquire a brand would be a
|
|
413
|
-
* second validation of data the commit boundary already checked.
|
|
414
|
-
*/
|
|
415
|
-
group: syncGroupRefSchema,
|
|
416
|
-
/**
|
|
417
|
-
* How `target` reached `group`. Absent when the schema's record-group spec is
|
|
418
|
-
* unavailable to the commit path, which is the only case where the server
|
|
419
|
-
* knows a group moved without knowing the route.
|
|
420
|
-
*/
|
|
421
|
-
propagation: stalePropagationSchema.optional(),
|
|
422
|
-
/**
|
|
423
|
-
* How much of the group moved — the decision "re-read these rows" versus
|
|
424
|
-
* "give up and take the whole group" needs a size, and a premise that only
|
|
425
|
-
* says *something* changed forces the expensive branch every time.
|
|
426
|
-
*
|
|
427
|
-
* Counts DISTINCT ROWS, not deltas: two writes to one row is one row's worth
|
|
428
|
-
* of re-reading. `sample` names the most recently changed of them and is
|
|
429
|
-
* capped, so `truncated` says whether it tells the whole story.
|
|
430
|
-
*
|
|
431
|
-
* Absent when the commit path did not measure it (a durable `track` fires per
|
|
432
|
-
* commit and does not pay for the extra statement).
|
|
433
|
-
*/
|
|
434
|
-
changed: z
|
|
435
|
-
.object({
|
|
436
|
-
count: z.number().int().nonnegative(),
|
|
437
|
-
sample: z.array(modelTargetSchema).readonly(),
|
|
438
|
-
truncated: z.boolean(),
|
|
439
|
-
})
|
|
440
|
-
.optional(),
|
|
441
|
-
});
|
|
442
|
-
export type GroupStaleNotification = z.infer<
|
|
443
|
-
typeof groupStaleNotificationSchema
|
|
444
|
-
>;
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* One advisory, two scopes, told apart by `scope`.
|
|
448
|
-
*
|
|
449
|
-
* A real discriminated union rather than a flat object with an optional
|
|
450
|
-
* `group`, which is what {@link readDependencySchema} already does for the
|
|
451
|
-
* premise side. While it was flat, the two scopes disagreed about what their
|
|
452
|
-
* fields meant — `model`/`id` held a row in one and the group key in the other,
|
|
453
|
-
* and `conflictingFields`/`currentValues` were empty by construction in the
|
|
454
|
-
* group case — so every consumer had to re-derive the scope from `group`'s
|
|
455
|
-
* presence and read the prose to know which fields were load-bearing.
|
|
456
|
-
*/
|
|
457
|
-
export const staleNotificationSchema = z.discriminatedUnion('scope', [
|
|
458
|
-
rowStaleNotificationSchema,
|
|
459
|
-
groupStaleNotificationSchema,
|
|
460
|
-
]);
|
|
461
|
-
export type StaleNotification = z.infer<typeof staleNotificationSchema>;
|
|
462
|
-
|
|
463
|
-
/** One row named by a commit-lifetime ReadSet entry. */
|
|
464
|
-
export const readSetRowTargetSchema = z.object({
|
|
465
|
-
scope: z.literal('row'),
|
|
295
|
+
/** One compact row read carried into a later commit. */
|
|
296
|
+
const readRowDependencySchema = z.object({
|
|
466
297
|
model: z.string(),
|
|
467
298
|
id: z.string(),
|
|
468
299
|
fields: z.array(z.string()).readonly().optional(),
|
|
300
|
+
readAt: logPositionSchema,
|
|
469
301
|
});
|
|
470
|
-
export type ReadSetRowTarget = z.infer<typeof readSetRowTargetSchema>;
|
|
471
302
|
|
|
472
|
-
/** One
|
|
473
|
-
|
|
474
|
-
scope: z.literal('group'),
|
|
303
|
+
/** One compact group read carried into a later commit. */
|
|
304
|
+
const readGroupDependencySchema = z.object({
|
|
475
305
|
group: syncGroupRefSchema,
|
|
476
|
-
|
|
477
|
-
export type ReadSetGroupTarget = z.infer<typeof readSetGroupTargetSchema>;
|
|
478
|
-
|
|
479
|
-
export const commitReadSetTargetSchema = z.discriminatedUnion('scope', [
|
|
480
|
-
readSetRowTargetSchema,
|
|
481
|
-
readSetGroupTargetSchema,
|
|
482
|
-
]);
|
|
483
|
-
export type CommitReadSetTarget = z.infer<typeof commitReadSetTargetSchema>;
|
|
484
|
-
|
|
485
|
-
/** Persisted row tracking is row-grained; it has no field storage axis. */
|
|
486
|
-
export const persistedReadSetRowTargetSchema = readSetRowTargetSchema.omit({ fields: true });
|
|
487
|
-
export const persistedReadSetTargetSchema = z.discriminatedUnion('scope', [
|
|
488
|
-
persistedReadSetRowTargetSchema,
|
|
489
|
-
readSetGroupTargetSchema,
|
|
490
|
-
]);
|
|
491
|
-
export type PersistedReadSetTarget = z.infer<typeof persistedReadSetTargetSchema>;
|
|
492
|
-
|
|
493
|
-
/** One exact input to the decision made by this commit. */
|
|
494
|
-
export const commitReadSetEntrySchema = z.object({
|
|
495
|
-
target: commitReadSetTargetSchema,
|
|
496
|
-
watermark: logPositionSchema,
|
|
497
|
-
lifetime: z.literal('commit'),
|
|
498
|
-
onStale: onStaleModeSchema,
|
|
499
|
-
});
|
|
500
|
-
export type CommitReadSetEntry = z.infer<typeof commitReadSetEntrySchema>;
|
|
501
|
-
|
|
502
|
-
/** One exact input retained after the declaring commit settles. */
|
|
503
|
-
export const persistedReadSetEntrySchema = z.object({
|
|
504
|
-
target: persistedReadSetTargetSchema,
|
|
505
|
-
watermark: logPositionSchema,
|
|
506
|
-
lifetime: z.literal('persisted'),
|
|
507
|
-
onStale: trackOnStaleSchema,
|
|
508
|
-
});
|
|
509
|
-
export type PersistedReadSetEntry = z.infer<typeof persistedReadSetEntrySchema>;
|
|
510
|
-
|
|
511
|
-
export const readSetEntrySchema = z.discriminatedUnion('lifetime', [
|
|
512
|
-
commitReadSetEntrySchema,
|
|
513
|
-
persistedReadSetEntrySchema,
|
|
514
|
-
]);
|
|
515
|
-
export type ReadSetEntry = z.infer<typeof readSetEntrySchema>;
|
|
516
|
-
|
|
517
|
-
export const readSetSchema = z
|
|
518
|
-
.array(readSetEntrySchema)
|
|
519
|
-
.max(MAX_READ_SET_ENTRIES)
|
|
520
|
-
.readonly();
|
|
521
|
-
export type ReadSet = z.infer<typeof readSetSchema>;
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Wire projection of a commit-lifetime ReadSet entry. The public field names
|
|
525
|
-
* stay compatible (`readAt`, flat row/group target); every member is selected
|
|
526
|
-
* from the canonical entry rather than restated beside it.
|
|
527
|
-
*/
|
|
528
|
-
const readRowDependencySchema = readSetRowTargetSchema.omit({ scope: true }).extend({
|
|
529
|
-
readAt: commitReadSetEntrySchema.shape.watermark,
|
|
530
|
-
onStale: commitReadSetEntrySchema.shape.onStale.optional(),
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
const readGroupDependencySchema = readSetGroupTargetSchema.omit({ scope: true }).extend({
|
|
534
|
-
readAt: commitReadSetEntrySchema.shape.watermark,
|
|
535
|
-
onStale: commitReadSetEntrySchema.shape.onStale.optional(),
|
|
306
|
+
readAt: logPositionSchema,
|
|
536
307
|
});
|
|
537
308
|
|
|
538
309
|
export const readDependencySchema = z.union([
|
|
@@ -541,73 +312,10 @@ export const readDependencySchema = z.union([
|
|
|
541
312
|
]);
|
|
542
313
|
export type ReadDependency = z.infer<typeof readDependencySchema>;
|
|
543
314
|
|
|
544
|
-
/**
|
|
545
|
-
* A durable ReadSet entry — what a participant is watching so that a later
|
|
546
|
-
* change to it opens a {@link StaleNotification}. Where a {@link ReadDependency}
|
|
547
|
-
* is checked once at commit and discarded, a `TrackDependency` is kept and
|
|
548
|
-
* re-checked against every future delta. The row form watches one object; the
|
|
549
|
-
* group form watches a whole sync group ("anything in `report:abc`"). See
|
|
550
|
-
* `packages/ablo/docs/groups.md` for how it drives change propagation.
|
|
551
|
-
*
|
|
552
|
-
* It is a projection of the canonical persisted entry, not a second declaration of the
|
|
553
|
-
* same reference: a track names its target exactly as a read does, and the
|
|
554
|
-
* three ways it differs are stated here as omissions the compiler holds.
|
|
555
|
-
*
|
|
556
|
-
* • `onStale` NARROWED, not dropped — `notify` (the default) reports the
|
|
557
|
-
* change on the tracker's next receipt and lets the commit through;
|
|
558
|
-
* `reject` refuses that commit while the belief is stale, so an agent
|
|
559
|
-
* cannot write on something it has been shown to be out of date about.
|
|
560
|
-
* `overwrite` is excluded because it means "apply my write anyway" and a
|
|
561
|
-
* track guards no write of its own to apply;
|
|
562
|
-
* • no `fields` — a track fires at row grain, because the server keeps one
|
|
563
|
-
* row per tracked target and reports that the target moved, not which
|
|
564
|
-
* column did (`track_dependencies` has no field axis to store one in);
|
|
565
|
-
* • `readAt` optional — it defaults to the watermark of the commit that
|
|
566
|
-
* registered the track, so a caller with nothing to say about when it last
|
|
567
|
-
* looked gets "from here on".
|
|
568
|
-
*
|
|
569
|
-
* A field added to the ReadSet target reaches both halves; a field the durable half
|
|
570
|
-
* genuinely cannot carry has to be omitted here on purpose, in one line, rather
|
|
571
|
-
* than by being quietly left out of a copy.
|
|
572
|
-
*/
|
|
573
|
-
/**
|
|
574
|
-
* What a track does when the caller says nothing — reporting, the behavior every
|
|
575
|
-
* track had before the disposition existed, so an existing registration is
|
|
576
|
-
* unchanged.
|
|
577
|
-
*
|
|
578
|
-
* Declared here because the value has to agree in three places that cannot
|
|
579
|
-
* import each other: this schema, the column DEFAULT, and the server's insert.
|
|
580
|
-
* The two SQL copies are pinned to this one by a test
|
|
581
|
-
* (`trackOnStaleDomain.test.ts`) rather than by anyone remembering.
|
|
582
|
-
*/
|
|
583
|
-
export const DEFAULT_TRACK_ON_STALE: TrackOnStale = 'notify';
|
|
584
|
-
|
|
585
|
-
const trackBaseSchema = {
|
|
586
|
-
readAt: persistedReadSetEntrySchema.shape.watermark.optional(),
|
|
587
|
-
onStale: persistedReadSetEntrySchema.shape.onStale.optional(),
|
|
588
|
-
} as const;
|
|
589
|
-
|
|
590
|
-
export const trackDependencySchema = z.union([
|
|
591
|
-
persistedReadSetRowTargetSchema.omit({ scope: true }).extend(trackBaseSchema),
|
|
592
|
-
readSetGroupTargetSchema.omit({ scope: true }).extend(trackBaseSchema),
|
|
593
|
-
]);
|
|
594
|
-
export type TrackDependency = z.infer<typeof trackDependencySchema>;
|
|
595
|
-
|
|
596
|
-
/** Bounded wire projections of the two ReadSet lifetimes. */
|
|
315
|
+
/** Bounded wire projection of one commit's reads. */
|
|
597
316
|
export const readDependencyListSchema = z
|
|
598
317
|
.array(readDependencySchema)
|
|
599
318
|
.max(MAX_READ_SET_ENTRIES);
|
|
600
|
-
export const trackDependencyListSchema = z
|
|
601
|
-
.array(trackDependencySchema)
|
|
602
|
-
.max(MAX_READ_SET_ENTRIES);
|
|
603
|
-
|
|
604
|
-
/** Shared combined-cardinality rule for envelopes carrying both projections. */
|
|
605
|
-
export function readSetProjectionEntryCount(value: {
|
|
606
|
-
readonly reads?: readonly unknown[] | null;
|
|
607
|
-
readonly track?: readonly unknown[] | null;
|
|
608
|
-
}): number {
|
|
609
|
-
return (value.reads?.length ?? 0) + (value.track?.length ?? 0);
|
|
610
|
-
}
|
|
611
319
|
|
|
612
320
|
// ─────────────────────────────────────────────────────────────────────────
|
|
613
321
|
// Layer 2 — pessimistic claims and leases
|
|
@@ -743,8 +451,6 @@ export const claimErrorSchema = z.object({
|
|
|
743
451
|
heldByExpiresAt: z.number().optional(),
|
|
744
452
|
/** Rich holder context for conflict rejections. Additive: older frames omit it. */
|
|
745
453
|
heldByClaim: wireClaimSummarySchema.optional(),
|
|
746
|
-
/** Optional conflict-policy explanation. Additive: older frames omit it. */
|
|
747
|
-
policyReason: z.string().optional(),
|
|
748
454
|
});
|
|
749
455
|
export type ClaimError = z.infer<typeof claimErrorSchema>;
|
|
750
456
|
|
|
@@ -800,7 +506,7 @@ export const claimRejectionSchema = z.object({
|
|
|
800
506
|
* there, so this reads the way {@link wireParticipantKindSchema} reads its
|
|
801
507
|
* dialect: a value that parses becomes the typed reason, and one that does
|
|
802
508
|
* not is absent rather than smuggled through as prose. Prose has its own
|
|
803
|
-
* field — `
|
|
509
|
+
* field — `message` below — which is why nothing is lost by refusing to
|
|
804
510
|
* carry it here.
|
|
805
511
|
*
|
|
806
512
|
* The registry code a caller finally sees on `AbloClaimedError`
|
|
@@ -825,7 +531,7 @@ export const claimRejectionSchema = z.object({
|
|
|
825
531
|
heldByClaimId: z.string().optional(),
|
|
826
532
|
heldByExpiresAt: z.number().optional(),
|
|
827
533
|
heldByClaim: wireClaimSummarySchema.optional(),
|
|
828
|
-
|
|
534
|
+
message: z.string().optional(),
|
|
829
535
|
});
|
|
830
536
|
export type ClaimRejection = z.infer<typeof claimRejectionSchema>;
|
|
831
537
|
|
|
@@ -970,7 +676,7 @@ export type HeldClaimStatus = z.infer<typeof heldClaimStatusSchema>;
|
|
|
970
676
|
*
|
|
971
677
|
* Every caller-facing surface that answers a question about a claim is a
|
|
972
678
|
* PROJECTION of this record, never a second object: {@link modelClaimSchema} is
|
|
973
|
-
* what a peer may see, and `claimStateSchema` (`
|
|
679
|
+
* what a peer may see, and `claimStateSchema` (`claims/contract.ts`) is what a
|
|
974
680
|
* caller polls about a claim of its own. Each is pinned to this record, so a
|
|
975
681
|
* field added here either reaches the people it was declared for or fails to
|
|
976
682
|
* compile.
|
|
@@ -1412,7 +1118,7 @@ export type CommitOperationType = z.infer<typeof commitOperationTypeSchema>;
|
|
|
1412
1118
|
|
|
1413
1119
|
/**
|
|
1414
1120
|
* A single mutation in a commit batch, as it arrives on the wire. Extends the
|
|
1415
|
-
* optimistic `writeGuard` (`readAt
|
|
1121
|
+
* optimistic `writeGuard` (`readAt`) — the structural link
|
|
1416
1122
|
* that makes "every write is stale-guarded" legible in the type, not just in
|
|
1417
1123
|
* prose.
|
|
1418
1124
|
*/
|
package/src/errorCodes.ts
CHANGED
|
@@ -620,7 +620,7 @@ export const ERROR_CODES = {
|
|
|
620
620
|
// ── validation (400 / 422) ─────────────────────────────────────────
|
|
621
621
|
write_options_invalid: client(
|
|
622
622
|
'validation',
|
|
623
|
-
'The write options (`idempotencyKey` / `label` / `wait` / `readAt` / `
|
|
623
|
+
'The write options (`idempotencyKey` / `label` / `wait` / `readAt` / `claim`) failed validation against the write-options schema.'
|
|
624
624
|
),
|
|
625
625
|
write_payload_invalid: client(
|
|
626
626
|
'validation',
|
|
@@ -846,6 +846,12 @@ export const ERROR_CODES = {
|
|
|
846
846
|
false,
|
|
847
847
|
'The database rejected the write on a foreign-key constraint: a referenced row does not exist, or the row being deleted is still referenced by others. The error details name the constraint.'
|
|
848
848
|
),
|
|
849
|
+
entity_already_exists: wire(
|
|
850
|
+
'conflict',
|
|
851
|
+
409,
|
|
852
|
+
false,
|
|
853
|
+
'A row already exists with this id. CREATE is strict; use UPDATE for an existing row.'
|
|
854
|
+
),
|
|
849
855
|
unique_violation: wire(
|
|
850
856
|
'conflict',
|
|
851
857
|
409,
|
|
@@ -1088,6 +1094,54 @@ export const ERROR_CODES = {
|
|
|
1088
1094
|
true,
|
|
1089
1095
|
'The signed Data Source returned a failure without a more specific code. Inspect the `ablo dev --local` process or deployed endpoint logs, then retry with the same idempotency key.'
|
|
1090
1096
|
),
|
|
1097
|
+
source_id_missing: wire(
|
|
1098
|
+
'auth',
|
|
1099
|
+
401,
|
|
1100
|
+
false,
|
|
1101
|
+
'The signed Data Source request did not include its webhook id. Check that the request reaches the handler without an intermediary removing Standard Webhooks headers.'
|
|
1102
|
+
),
|
|
1103
|
+
source_api_key_missing: wire(
|
|
1104
|
+
'auth',
|
|
1105
|
+
401,
|
|
1106
|
+
false,
|
|
1107
|
+
'The Data Source handler has no signing key configured. Configure it with the signing key from the current Data Source registration.'
|
|
1108
|
+
),
|
|
1109
|
+
source_timestamp_missing: wire(
|
|
1110
|
+
'auth',
|
|
1111
|
+
401,
|
|
1112
|
+
false,
|
|
1113
|
+
'The signed Data Source request did not include its webhook timestamp. Check that the request reaches the handler without an intermediary removing Standard Webhooks headers.'
|
|
1114
|
+
),
|
|
1115
|
+
source_timestamp_invalid: wire(
|
|
1116
|
+
'auth',
|
|
1117
|
+
401,
|
|
1118
|
+
false,
|
|
1119
|
+
'The signed Data Source request carried an invalid webhook timestamp.'
|
|
1120
|
+
),
|
|
1121
|
+
source_timestamp_expired: wire(
|
|
1122
|
+
'auth',
|
|
1123
|
+
401,
|
|
1124
|
+
false,
|
|
1125
|
+
'The signed Data Source request fell outside the allowed clock-skew window. Synchronize the endpoint host clock, then retry.'
|
|
1126
|
+
),
|
|
1127
|
+
source_signature_missing: wire(
|
|
1128
|
+
'auth',
|
|
1129
|
+
401,
|
|
1130
|
+
false,
|
|
1131
|
+
'The signed Data Source request did not include its webhook signature. Check that the request reaches the handler without an intermediary removing Standard Webhooks headers.'
|
|
1132
|
+
),
|
|
1133
|
+
source_signature_invalid: wire(
|
|
1134
|
+
'auth',
|
|
1135
|
+
401,
|
|
1136
|
+
false,
|
|
1137
|
+
'The Data Source rejected Ablo\'s signature. Configure the endpoint or localhost connector with the signing key from the current Data Source registration.'
|
|
1138
|
+
),
|
|
1139
|
+
source_forbidden: wire(
|
|
1140
|
+
'permission',
|
|
1141
|
+
403,
|
|
1142
|
+
false,
|
|
1143
|
+
'The Data Source key is not allowed to perform this operation.'
|
|
1144
|
+
),
|
|
1091
1145
|
source_connector_not_attached: wire(
|
|
1092
1146
|
'transport',
|
|
1093
1147
|
503,
|
|
@@ -1768,14 +1822,13 @@ export const ERROR_CODES = {
|
|
|
1768
1822
|
} as const satisfies Record<string, ErrorCodeSpec>;
|
|
1769
1823
|
|
|
1770
1824
|
/**
|
|
1771
|
-
* The type of a valid error code: any key registered in {@link ERROR_CODES}
|
|
1772
|
-
*
|
|
1773
|
-
* names its reason inline. The {@link AbloError} constructor accepts only this
|
|
1825
|
+
* The type of a valid error code: any key registered in {@link ERROR_CODES}.
|
|
1826
|
+
* The {@link AbloError} constructor accepts only this
|
|
1774
1827
|
* type, so a typo or an unregistered code is a compile-time error. Only the
|
|
1775
1828
|
* boundary that parses an incoming response casts an arbitrary string to this
|
|
1776
1829
|
* type, which preserves forward compatibility with a newer server.
|
|
1777
1830
|
*/
|
|
1778
|
-
export type ErrorCode = keyof typeof ERROR_CODES
|
|
1831
|
+
export type ErrorCode = keyof typeof ERROR_CODES;
|
|
1779
1832
|
|
|
1780
1833
|
/** The subset of {@link ErrorCode} values that cross the network — the codes
|
|
1781
1834
|
* that make up the API contract, from which the HTTP and tool-calling
|
|
@@ -1784,14 +1837,13 @@ export type WireErrorCode = {
|
|
|
1784
1837
|
[K in keyof typeof ERROR_CODES]: (typeof ERROR_CODES)[K]['surface'] extends 'wire' ? K : never;
|
|
1785
1838
|
}[keyof typeof ERROR_CODES];
|
|
1786
1839
|
|
|
1787
|
-
/** Looks up the {@link ErrorCodeSpec} for a code. Returns `undefined` for
|
|
1788
|
-
*
|
|
1789
|
-
* recognize. */
|
|
1840
|
+
/** Looks up the {@link ErrorCodeSpec} for a code. Returns `undefined` for a
|
|
1841
|
+
* newer code this client does not yet recognize. */
|
|
1790
1842
|
export function errorCodeSpec(code: string): ErrorCodeSpec | undefined {
|
|
1791
1843
|
return (ERROR_CODES as Record<string, ErrorCodeSpec>)[code];
|
|
1792
1844
|
}
|
|
1793
1845
|
|
|
1794
|
-
/** Reports whether a code is marked retryable. Unknown
|
|
1846
|
+
/** Reports whether a code is marked retryable. Unknown codes
|
|
1795
1847
|
* default to non-retryable, so an unrecognized failure is never retried
|
|
1796
1848
|
* automatically. */
|
|
1797
1849
|
export function isRetryableCode(code: string): boolean {
|
|
@@ -1810,7 +1862,7 @@ export function isRetryableCode(code: string): boolean {
|
|
|
1810
1862
|
* - remaining `auth` category → `auth_blocked` (the credential-type 401s)
|
|
1811
1863
|
* - anything else, or unknown → `none`
|
|
1812
1864
|
*
|
|
1813
|
-
* An unknown code
|
|
1865
|
+
* An unknown code or a code this client predates
|
|
1814
1866
|
* (no spec) defaults to `none`, the same safe default as {@link isRetryableCode}:
|
|
1815
1867
|
* an unrecognized code is never treated as a credential expiry or a sign-out.
|
|
1816
1868
|
*/
|
package/src/errors.ts
CHANGED
|
@@ -271,11 +271,35 @@ export class AbloStaleContextError extends AbloError {
|
|
|
271
271
|
readonly id: string;
|
|
272
272
|
readonly observedSyncId: number;
|
|
273
273
|
}[];
|
|
274
|
+
details?: Readonly<Record<string, unknown>>;
|
|
274
275
|
},
|
|
275
276
|
) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
const detailedReadAt = options?.details?.readAt;
|
|
278
|
+
const detailedConflicts = options?.details?.conflicts;
|
|
279
|
+
const readAt =
|
|
280
|
+
options?.readAt ?? (typeof detailedReadAt === 'number' ? detailedReadAt : undefined);
|
|
281
|
+
const conflicts =
|
|
282
|
+
options?.conflicts ??
|
|
283
|
+
(Array.isArray(detailedConflicts)
|
|
284
|
+
? detailedConflicts.filter(
|
|
285
|
+
(item): item is { model: string; id: string; observedSyncId: number } =>
|
|
286
|
+
typeof item === 'object' &&
|
|
287
|
+
item !== null &&
|
|
288
|
+
typeof (item as { model?: unknown }).model === 'string' &&
|
|
289
|
+
typeof (item as { id?: unknown }).id === 'string' &&
|
|
290
|
+
typeof (item as { observedSyncId?: unknown }).observedSyncId === 'number',
|
|
291
|
+
)
|
|
292
|
+
: undefined);
|
|
293
|
+
super(message, {
|
|
294
|
+
...options,
|
|
295
|
+
details: {
|
|
296
|
+
...(options?.details ?? {}),
|
|
297
|
+
...(readAt !== undefined ? { readAt } : {}),
|
|
298
|
+
...(conflicts !== undefined ? { conflicts } : {}),
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
if (readAt !== undefined) this.readAt = readAt;
|
|
302
|
+
if (conflicts !== undefined) this.conflicts = conflicts;
|
|
279
303
|
}
|
|
280
304
|
}
|
|
281
305
|
|
|
@@ -378,7 +402,7 @@ export function formatClaimedErrorMessage(args: {
|
|
|
378
402
|
readonly targetLabel: string;
|
|
379
403
|
readonly heldBy?: string;
|
|
380
404
|
readonly claim?: ClaimErrorClaim;
|
|
381
|
-
readonly
|
|
405
|
+
readonly detail?: string;
|
|
382
406
|
readonly fallback?: string;
|
|
383
407
|
}): string {
|
|
384
408
|
const holder = claimActor(args.claim, args.heldBy);
|
|
@@ -393,10 +417,10 @@ export function formatClaimedErrorMessage(args: {
|
|
|
393
417
|
const descriptionPart = description ? `: ${description}` : '';
|
|
394
418
|
const expiresPart =
|
|
395
419
|
expiresIn !== undefined ? ` - expires in ${expiresIn}s` : '';
|
|
396
|
-
const
|
|
397
|
-
? `
|
|
420
|
+
const detailPart = args.detail
|
|
421
|
+
? ` ${args.detail}.`
|
|
398
422
|
: '';
|
|
399
|
-
return `Claimed by ${actor}${descriptionPart}${expiresPart} on ${args.targetLabel}.${
|
|
423
|
+
return `Claimed by ${actor}${descriptionPart}${expiresPart} on ${args.targetLabel}.${detailPart}`;
|
|
400
424
|
}
|
|
401
425
|
|
|
402
426
|
/**
|
|
@@ -629,7 +653,7 @@ const OptionalWireStringSchema = z.preprocess(
|
|
|
629
653
|
/**
|
|
630
654
|
* The one definition of the {@link RequiredCapability} wire shape. Every
|
|
631
655
|
* boundary that carries a denial's capability detail — the error body parsed
|
|
632
|
-
* here, and the rejected commit receipt in `
|
|
656
|
+
* here, and the rejected commit receipt in `commit/contract.ts` — composes this
|
|
633
657
|
* schema rather than restating the fields, so a new member cannot reach one
|
|
634
658
|
* boundary and miss the other.
|
|
635
659
|
*
|
|
@@ -657,7 +681,6 @@ const NestedErrorShapeSchema = z
|
|
|
657
681
|
field: OptionalWireStringSchema,
|
|
658
682
|
requiredCapability: requiredCapabilityWireSchema.optional().catch(undefined),
|
|
659
683
|
heldBy: OptionalWireStringSchema,
|
|
660
|
-
policyReason: OptionalWireStringSchema,
|
|
661
684
|
heldByClaim: wireClaimSummarySchema.optional().catch(undefined),
|
|
662
685
|
claims: z.array(wireClaimSummarySchema).optional().catch(undefined),
|
|
663
686
|
})
|
|
@@ -683,7 +706,6 @@ const ErrorBodyShapeSchema = z
|
|
|
683
706
|
message: OptionalWireStringSchema,
|
|
684
707
|
requiredCapability: requiredCapabilityWireSchema.optional().catch(undefined),
|
|
685
708
|
heldBy: OptionalWireStringSchema,
|
|
686
|
-
policyReason: OptionalWireStringSchema,
|
|
687
709
|
heldByClaim: wireClaimSummarySchema.optional().catch(undefined),
|
|
688
710
|
claims: z.array(wireClaimSummarySchema).optional().catch(undefined),
|
|
689
711
|
})
|
package/src/index.ts
CHANGED
|
@@ -17,31 +17,31 @@ export type {
|
|
|
17
17
|
ObserveOptions,
|
|
18
18
|
ObserveCursorStore,
|
|
19
19
|
ObservedDelta,
|
|
20
|
-
} from './
|
|
21
|
-
export { createTransactionClient } from './
|
|
20
|
+
} from './client/contract.js';
|
|
21
|
+
export { createTransactionClient } from './client/headless.js';
|
|
22
22
|
export type {
|
|
23
23
|
TransactionClient,
|
|
24
24
|
TransactionClientOptions,
|
|
25
|
-
} from './
|
|
25
|
+
} from './client/headless.js';
|
|
26
26
|
|
|
27
27
|
// The client entry point (ADR 0016). The bare import constructs the
|
|
28
28
|
// coordination layer over request/response transport; the reactive
|
|
29
29
|
// materialiser is the consumer package's entry point, layered above it.
|
|
30
|
-
export { Ablo } from './ablo.js';
|
|
30
|
+
export { Ablo } from './client/ablo.js';
|
|
31
31
|
export type {
|
|
32
32
|
AbloHttpClient,
|
|
33
33
|
AbloHttpClientOptions,
|
|
34
34
|
CapturedRow,
|
|
35
35
|
HttpModelClient,
|
|
36
36
|
HttpModelMutationParams,
|
|
37
|
-
} from './transport/
|
|
37
|
+
} from './transport/http/client.js';
|
|
38
38
|
/** What `ablo.<model>.list()` resolves to: the rows, and where the page ends. */
|
|
39
|
-
export type { ModelList } from './resources/httpResources.js';
|
|
39
|
+
export type { ModelList } from './client/resources/httpResources.js';
|
|
40
40
|
export type {
|
|
41
41
|
FunctionalUpdateOptions,
|
|
42
42
|
/** @deprecated Use `FunctionalUpdateOptions`. */
|
|
43
43
|
ContentionOptions,
|
|
44
|
-
} from './resources/functionalUpdate.js';
|
|
44
|
+
} from './client/resources/functionalUpdate.js';
|
|
45
45
|
|
|
46
46
|
// The types the seam's signatures reference.
|
|
47
47
|
export type {
|
|
@@ -60,7 +60,7 @@ export * from './errors.js';
|
|
|
60
60
|
// published pricing page and the runtime caps both derive from.
|
|
61
61
|
export * from './pricing.js';
|
|
62
62
|
|
|
63
|
-
//
|
|
63
|
+
// Deliberate root-level leaf surfaces.
|
|
64
64
|
export * from './errorCodes.js';
|
|
65
65
|
export * from './environment.js';
|
|
66
66
|
export * from './branches.js';
|