@abloatai/transaction 0.57.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 +51 -41
- 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 +51 -57
- package/dist/client/resources/httpResources.d.ts.map +1 -0
- package/dist/{resources → client/resources}/httpResources.js +1 -1
- package/dist/client/resources/httpResources.js.map +1 -0
- package/dist/{resources → client/resources}/modelCreate.d.ts +1 -1
- package/dist/client/resources/modelCreate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelCreate.js +1 -1
- package/dist/client/resources/modelCreate.js.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.d.ts +35 -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 +2 -35
- package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.js +5 -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} +13 -20
- 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/{transport/httpCommitRequest.d.ts → commit/httpRequest.d.ts} +6 -6
- package/dist/commit/httpRequest.d.ts.map +1 -0
- package/dist/{transport/httpCommitRequest.js → commit/httpRequest.js} +2 -3
- 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} +10 -25
- 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 -459
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +13 -261
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +15 -9
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +13 -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/index.d.ts +5 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -7
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +0 -27
- package/dist/schema/model.d.ts.map +1 -1
- package/dist/schema/model.js +0 -2
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +45 -6
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/schema.d.ts +11 -3
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +9 -2
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/serialize.d.ts +1 -4
- package/dist/schema/serialize.d.ts.map +1 -1
- package/dist/schema/serialize.js +0 -4
- package/dist/schema/serialize.js.map +1 -1
- package/dist/schema/tenancy.d.ts +1 -1
- package/dist/server/adapter.d.ts +1 -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/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} +8 -77
- package/dist/source/adapters/contract.d.ts.map +1 -0
- package/dist/source/{contract.js → adapters/contract.js} +12 -57
- 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 +21 -23
- 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 +1 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +18 -20
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +2 -2
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +1 -1
- 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 +19 -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 -52
- 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 +21 -28
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/{subjectAuthorization.d.ts → adapters/subjectAuthorization.d.ts} +1 -1
- package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
- package/dist/source/{subjectAuthorization.js → adapters/subjectAuthorization.js} +2 -2
- 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} +3 -3
- package/dist/source/endpoint/factory.d.ts.map +1 -0
- package/dist/source/{factory.js → endpoint/factory.js} +9 -4
- 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 +14 -12
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +13 -11
- 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 +16 -17
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js +1 -0
- package/dist/source/types.js.map +1 -1
- package/dist/syncLog/contract.d.ts +19 -2
- package/dist/syncLog/contract.d.ts.map +1 -1
- package/dist/syncLog/contract.js +19 -2
- package/dist/syncLog/contract.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} +26 -45
- package/dist/transport/http/client.d.ts.map +1 -0
- package/dist/transport/{httpClient.js → http/client.js} +84 -124
- package/dist/transport/http/client.js.map +1 -0
- package/dist/transport/{httpTransportHelpers.d.ts → http/helpers.d.ts} +5 -5
- package/dist/transport/http/helpers.d.ts.map +1 -0
- package/dist/transport/{httpTransportHelpers.js → http/helpers.js} +5 -5
- 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} +95 -93
- 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/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 +17 -15
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +11 -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/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 +48 -68
- package/src/{resources → client/resources}/modelCreate.ts +2 -2
- package/src/{resources → client/resources}/modelOperations.ts +46 -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 +7 -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} +11 -25
- package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
- package/src/{transport/httpCommitRequest.ts → commit/httpRequest.ts} +6 -7
- package/src/commit/index.ts +16 -0
- package/src/{readSetContext.ts → commit/readSetContext.ts} +16 -41
- package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
- package/src/coordination/index.ts +4 -52
- package/src/coordination/schema.ts +15 -302
- package/src/errorCodes.ts +56 -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/index.ts +4 -20
- package/src/schema/model.ts +0 -33
- package/src/schema/openapi.ts +47 -7
- package/src/schema/schema.ts +23 -3
- package/src/schema/serialize.ts +0 -8
- package/src/server/adapter.ts +1 -1
- package/src/server/commit.ts +6 -14
- package/src/server/index.ts +1 -1
- 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} +16 -64
- package/src/source/adapters/drizzle.ts +29 -27
- package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
- package/src/source/adapters/index.ts +20 -0
- package/src/source/adapters/kysely.ts +32 -25
- package/src/source/adapters/kyselyMutationCore.ts +3 -3
- package/src/source/adapters/memory.ts +25 -9
- package/src/source/adapters/migration.ts +11 -0
- package/src/source/{migrations.ts → adapters/migrations.ts} +6 -54
- package/src/source/adapters/prisma.ts +33 -32
- package/src/source/{subjectAuthorization.ts → adapters/subjectAuthorization.ts} +2 -2
- 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} +13 -8
- 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 +22 -19
- 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 +17 -17
- package/src/syncLog/contract.ts +19 -2
- 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} +128 -209
- package/src/transport/{httpTransportHelpers.ts → http/helpers.ts} +7 -7
- 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} +127 -113
- 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/frames.ts +5 -15
- package/src/wire/inboundFrames.ts +3 -3
- package/src/wire/index.ts +19 -15
- package/src/wire/modelMutations.ts +1 -14
- 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.map +0 -1
- package/dist/resources/modelCreate.d.ts.map +0 -1
- package/dist/resources/modelCreate.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/source/subjectAuthorization.d.ts.map +0 -1
- package/dist/source/subjectAuthorization.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/httpCommitRequest.d.ts.map +0 -1
- package/dist/transport/httpCommitRequest.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/httpTransportHelpers.d.ts.map +0 -1
- package/dist/transport/httpTransportHelpers.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 -2866
- 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
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import type {
|
|
9
9
|
ClaimHeartbeatAckPayload,
|
|
10
|
-
OnStaleMode,
|
|
11
10
|
ReadDependency,
|
|
12
|
-
|
|
13
|
-
} from '
|
|
14
|
-
import type { ClaimHeartbeatReply, ClaimState } from '../wire/claims.js';
|
|
11
|
+
} from '../../coordination/schema.js';
|
|
12
|
+
import type { ClaimHeartbeatReply, ClaimState } from '../../claims/contract.js';
|
|
15
13
|
import type {
|
|
16
14
|
ClientCommitReceipt,
|
|
17
15
|
CommitWait,
|
|
@@ -21,11 +19,11 @@ import type {
|
|
|
21
19
|
CommitRecordWhere,
|
|
22
20
|
CommitOperationBody,
|
|
23
21
|
ModelOperationAction,
|
|
24
|
-
} from '
|
|
25
|
-
import type { LogListResponse, LogQuery } from '
|
|
26
|
-
import type { ModelListEvidence } from '
|
|
27
|
-
import { AbloValidationError } from '
|
|
28
|
-
// Re-exported, not redeclared. `
|
|
22
|
+
} from '../../commit/contract.js';
|
|
23
|
+
import type { LogListResponse, LogQuery } from '../../observation/feedContract.js';
|
|
24
|
+
import type { ModelListEvidence } from '../../wire/modelResponses.js';
|
|
25
|
+
import { AbloValidationError } from '../../errors.js';
|
|
26
|
+
// Re-exported, not redeclared. `commit/contract.ts` owns the commit-status vocabulary
|
|
29
27
|
// and derives the waitable subset from it; this module serves that name to SDK
|
|
30
28
|
// consumers. Restating the subset here as its own union produced a type that
|
|
31
29
|
// matched the canonical one only by both happening to list the same two
|
|
@@ -36,36 +34,33 @@ export type { CommitWait };
|
|
|
36
34
|
// claim view) are defined in `../coordination/schema`, derived from a single
|
|
37
35
|
// schema so the client, the HTTP client, and the server share one definition.
|
|
38
36
|
// They are re-exported here so the resource types live behind one import.
|
|
39
|
-
import type { ModelTarget, ModelClaim } from '
|
|
37
|
+
import type { ModelTarget, ModelClaim } from '../../coordination/schema.js';
|
|
40
38
|
export type { ModelTarget, ModelClaim };
|
|
41
|
-
import type { ResolveClaimMeta } from '
|
|
42
|
-
import type { ParticipantKind } from '
|
|
43
|
-
import type { SchemaRecord } from '
|
|
44
|
-
import type { SyncGroupInput } from '
|
|
39
|
+
import type { ResolveClaimMeta } from '../../types/global.js';
|
|
40
|
+
import type { ParticipantKind } from '../../types/participant.js';
|
|
41
|
+
import type { SchemaRecord } from '../../schema/schema.js';
|
|
42
|
+
import type { SyncGroupInput } from '../../schema/roles.js';
|
|
45
43
|
// The capability vocabulary — `auth/capability.ts` owns what a grant is on both
|
|
46
44
|
// axes, and these params are the surface a developer declares it through.
|
|
47
45
|
import type {
|
|
48
46
|
CapabilityCan,
|
|
49
47
|
CapabilityOperation,
|
|
50
48
|
EffectiveAuthority,
|
|
51
|
-
} from '
|
|
49
|
+
} from '../../auth/capability.js';
|
|
52
50
|
import type {
|
|
53
51
|
Claim,
|
|
54
52
|
ClaimStream,
|
|
55
53
|
ClaimWaitOptions,
|
|
56
54
|
Duration,
|
|
57
55
|
HeldClaim,
|
|
58
|
-
} from '
|
|
56
|
+
} from '../../types/streams.js';
|
|
59
57
|
import type { ModelUpdater, FunctionalUpdateOptions } from './functionalUpdate.js';
|
|
60
58
|
import type {
|
|
61
59
|
ClaimOptions,
|
|
62
60
|
ClaimAttemptEvent,
|
|
63
|
-
|
|
64
|
-
ClaimSkipParams,
|
|
61
|
+
ClaimCall,
|
|
65
62
|
ClaimReadApi,
|
|
66
63
|
AwaitedClaimMethod,
|
|
67
|
-
ModelTrackParams,
|
|
68
|
-
ModelTrackResult,
|
|
69
64
|
ModelCreateManyParams,
|
|
70
65
|
ServerReadOptions,
|
|
71
66
|
} from './modelOperations.js';
|
|
@@ -74,7 +69,8 @@ import type {
|
|
|
74
69
|
|
|
75
70
|
/**
|
|
76
71
|
* The operations available on each model in the sync engine:
|
|
77
|
-
* `get({ id })` — an async single-row server read
|
|
72
|
+
* `get({ id })` — an observational async single-row server read
|
|
73
|
+
* `read({ id })` — an async single-row server read that may guard a write
|
|
78
74
|
* `list({ where })` — an async collection server read
|
|
79
75
|
* `local.get(id)` / `local.list(...)` / `local.count(...)` — synchronous local reads
|
|
80
76
|
* `create({ data })` / `update({ id, data })` / `delete({ id })` — writes
|
|
@@ -256,7 +252,7 @@ export interface ClaimedOptions {
|
|
|
256
252
|
readonly ifClaimed?: IfClaimedPolicy;
|
|
257
253
|
}
|
|
258
254
|
|
|
259
|
-
export type { ClaimWaitOptions } from '
|
|
255
|
+
export type { ClaimWaitOptions } from '../../types/streams.js';
|
|
260
256
|
|
|
261
257
|
export interface ModelReadOptions extends ClaimedOptions {}
|
|
262
258
|
|
|
@@ -307,19 +303,19 @@ export interface ClaimCreateOptions {
|
|
|
307
303
|
/** Public commit operation inferred from the canonical request-body schema. */
|
|
308
304
|
export type CommitOperationInput = CommitOperationBody;
|
|
309
305
|
|
|
310
|
-
export
|
|
306
|
+
export type CommitClaim = Omit<Claim<unknown>, 'data'>;
|
|
307
|
+
|
|
308
|
+
export interface CommitCreateOptions<Read = ReadDependency> {
|
|
311
309
|
readonly idempotencyKey?: string | null;
|
|
312
310
|
readonly readAt?: number | null;
|
|
313
|
-
readonly onStale?: OnStaleMode | null;
|
|
314
311
|
/**
|
|
315
312
|
* A claim handle from `ablo.<model>.claim({ id })` (or the HTTP claim
|
|
316
313
|
* surface). Same vocabulary as the per-model writes: the handle's
|
|
317
|
-
* snapshot watermark becomes the batch `readAt` default
|
|
318
|
-
* defaults to `'reject'`, so a commit that follows a claim is guarded
|
|
314
|
+
* snapshot watermark becomes the batch `readAt` default, so a commit that follows a claim is guarded
|
|
319
315
|
* against concurrent edits without re-stating the watermark by hand.
|
|
320
|
-
*
|
|
316
|
+
* An explicit `readAt` on the options wins.
|
|
321
317
|
*/
|
|
322
|
-
readonly claim?:
|
|
318
|
+
readonly claim?: CommitClaim | null;
|
|
323
319
|
/** One atomic batch. Use a one-element array for a single operation. */
|
|
324
320
|
readonly operations: readonly CommitOperationInput[];
|
|
325
321
|
readonly wait?: CommitWait;
|
|
@@ -327,27 +323,17 @@ export interface CommitCreateOptions {
|
|
|
327
323
|
* The batch premise — the "did anything I looked at change?" guard.
|
|
328
324
|
* Declare the rows (`{ model, id, readAt, fields? }`) or sync groups
|
|
329
325
|
* (`{ group, readAt }`, for example `report:abc`) this batch was premised on; the
|
|
330
|
-
* server
|
|
331
|
-
* over the batch. This is distinct from the write-target `readAt`: it guards what
|
|
326
|
+
* server rejects the batch if any moved since `readAt`. This is distinct from the write-target `readAt`: it guards what
|
|
332
327
|
* you read, not what you write.
|
|
333
328
|
*/
|
|
334
|
-
readonly reads?: readonly
|
|
335
|
-
/**
|
|
336
|
-
* Durable premises to register as part of this batch — the persisted
|
|
337
|
-
* sibling of `reads`. Where `reads` guards only this commit, a `track` entry
|
|
338
|
-
* (`{ model, id, readAt? }` for a row or `{ group, readAt? }` for a sync group)
|
|
339
|
-
* lives on past it: a later matching change rides back on a future receipt's
|
|
340
|
-
* `notifications`. A track-only batch (just `track`, an empty `operations`) is
|
|
341
|
-
* the batch form of `ablo.<model>.track()`.
|
|
342
|
-
*/
|
|
343
|
-
readonly track?: readonly TrackDependency[] | null;
|
|
329
|
+
readonly reads?: readonly Read[] | null;
|
|
344
330
|
}
|
|
345
331
|
|
|
346
332
|
/** Public projection inferred from the canonical runtime schema. */
|
|
347
333
|
export type CommitReceipt = ClientCommitReceipt;
|
|
348
334
|
|
|
349
|
-
export interface CommitResource {
|
|
350
|
-
create(options: CommitCreateOptions): Promise<CommitReceipt>;
|
|
335
|
+
export interface CommitResource<Read = ReadDependency> {
|
|
336
|
+
create(options: CommitCreateOptions<Read>): Promise<CommitReceipt>;
|
|
351
337
|
get(options: { readonly id: string }): Promise<CommitRecord | null>;
|
|
352
338
|
list(options?: CommitRecordListOptions): Promise<CommitRecordList>;
|
|
353
339
|
}
|
|
@@ -415,15 +401,16 @@ export interface HttpClaimsResource {
|
|
|
415
401
|
}
|
|
416
402
|
|
|
417
403
|
export interface ModelMutationOptions extends ClaimedOptions {
|
|
418
|
-
readonly claimRef?: string | { readonly id: string } | null;
|
|
419
404
|
readonly idempotencyKey?: string | null;
|
|
420
|
-
readonly readAt?: number | null;
|
|
421
|
-
readonly onStale?: OnStaleMode | null;
|
|
422
405
|
/** Commit-lifetime read dependencies checked before this mutation lands. */
|
|
423
406
|
readonly reads?: readonly ReadDependency[] | null;
|
|
424
|
-
/** Persisted read dependencies registered by this mutation. */
|
|
425
|
-
readonly track?: readonly TrackDependency[] | null;
|
|
426
407
|
readonly claim?: Claim | ClaimOptions | null;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** Internal fields derived from a claim or functional update, never authored on a model write. */
|
|
411
|
+
export interface InternalModelMutationOptions extends ModelMutationOptions {
|
|
412
|
+
readonly claimRef?: string | { readonly id: string } | null;
|
|
413
|
+
readonly readAt?: number | null;
|
|
427
414
|
/** Fencing token (Option B) from the claim; server-validated at commit. */
|
|
428
415
|
readonly fenceToken?: number | null;
|
|
429
416
|
}
|
|
@@ -434,7 +421,7 @@ export interface ModelMutationOptions extends ClaimedOptions {
|
|
|
434
421
|
* namespace for multi-step handles and coordination screens.
|
|
435
422
|
*
|
|
436
423
|
* It is the same surface as the reactive claim API, but because every read is a
|
|
437
|
-
* server round-trip, `state`, `queue`, and `reorder` are awaited here. The
|
|
424
|
+
* server round-trip, `state`, `list`, `queue`, and `reorder` are awaited here. The
|
|
438
425
|
* WebSocket client resolves those synchronously from its local cache, which is what
|
|
439
426
|
* lets it read a claim's state inside a React render; a stateless client has no
|
|
440
427
|
* cache to read, so the promise is unavoidable.
|
|
@@ -442,19 +429,14 @@ export interface ModelMutationOptions extends ClaimedOptions {
|
|
|
442
429
|
* It is derived from `ClaimReadApi` through {@link AwaitedClaimMethod} so the two
|
|
443
430
|
* transports cannot drift: the only difference is the promise wrapper that
|
|
444
431
|
* statelessness forces. `claim({ id })` is identical on both (already async);
|
|
445
|
-
* `state`, `queue`, `reorder`, and `release` are the awaited form.
|
|
432
|
+
* `state`, `list`, `queue`, `reorder`, and `release` are the awaited form.
|
|
446
433
|
*/
|
|
447
434
|
export type HttpClaimApi<
|
|
448
435
|
T = Record<string, unknown>,
|
|
449
436
|
Fields = T,
|
|
450
|
-
> =
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
// resolves a held claim or rejects with a queue error.
|
|
454
|
-
((params: ClaimSkipParams<Fields>) => Promise<HeldClaim<T> | null>) &
|
|
455
|
-
((params: ClaimParams<Fields>) => Promise<HeldClaim<T>>) & {
|
|
456
|
-
[K in keyof ClaimReadApi<T>]: AwaitedClaimMethod<ClaimReadApi<T>[K]>;
|
|
457
|
-
};
|
|
437
|
+
> = ClaimCall<T, Fields> & {
|
|
438
|
+
[K in keyof ClaimReadApi<T>]: AwaitedClaimMethod<ClaimReadApi<T>[K]>;
|
|
439
|
+
};
|
|
458
440
|
|
|
459
441
|
/** @internal String-keyed model routing owned by the private HTTP transport. */
|
|
460
442
|
export interface HttpTransportModel<
|
|
@@ -470,10 +452,7 @@ export interface HttpTransportModel<
|
|
|
470
452
|
*
|
|
471
453
|
* Public callers never see this shape; `createAbloHttpClient` unwraps it.
|
|
472
454
|
*/
|
|
473
|
-
|
|
474
|
-
get(params: ModelReadOptions & { readonly id: string }): Promise<HttpTransportRead<T>>;
|
|
475
|
-
/** @deprecated Use `get({ id })`; retained for the private transport compatibility seam. */
|
|
476
|
-
retrieve(params: ModelReadOptions & { readonly id: string }): Promise<HttpTransportRead<T>>;
|
|
455
|
+
read(params: ModelReadOptions & { readonly id: string }): Promise<HttpTransportRead<T>>;
|
|
477
456
|
/**
|
|
478
457
|
* Collection read over HTTP (server round-trip). Equality `where`, `orderBy`,
|
|
479
458
|
* and `limit`. The typed public client always exposes `ablo.<model>.list`;
|
|
@@ -516,13 +495,6 @@ export interface HttpTransportModel<
|
|
|
516
495
|
* schema-agnostic shape stays inside the HTTP transport.
|
|
517
496
|
*/
|
|
518
497
|
claim: HttpClaimApi<T, Fields>;
|
|
519
|
-
/**
|
|
520
|
-
* Registers a durable premise on a row — request/response, no socket. A track
|
|
521
|
-
* declares what a caller is watching; it keeps no local copy of the row, so it
|
|
522
|
-
* belongs to every transport rather than to the reactive client (ADR 0013 §4).
|
|
523
|
-
* The typed public clients expose it as `ablo.<model>.track`.
|
|
524
|
-
*/
|
|
525
|
-
track(params: ModelTrackParams): Promise<ModelTrackResult>;
|
|
526
498
|
}
|
|
527
499
|
|
|
528
500
|
/** A single data operation a scoped **agent** session may perform on a model.
|
|
@@ -571,6 +543,11 @@ export interface CreateUserSessionParams<S extends SchemaRecord> {
|
|
|
571
543
|
export interface CreateAgentSessionParams<S extends SchemaRecord> {
|
|
572
544
|
/** Your agent. `id` becomes the token's `participantId`. */
|
|
573
545
|
agent: { id: string };
|
|
546
|
+
/** The authenticated person who started this agent run. The backend holding
|
|
547
|
+
* the secret key attests this identity, and every resulting delta records
|
|
548
|
+
* the agent as actor plus this user as `onBehalfOf`. Persist the user id on
|
|
549
|
+
* durable work before enqueueing it so a later worker can supply it here. */
|
|
550
|
+
onBehalfOf?: { readonly user: { readonly id: string } };
|
|
574
551
|
/** Per-model operation allowlist, typed against the schema's model names. */
|
|
575
552
|
can: CapabilityCan<S>;
|
|
576
553
|
/** Sync groups this session may subscribe to — typed (`'default'` or
|
|
@@ -603,6 +580,9 @@ export interface CreateAgentClientParams<S extends SchemaRecord> {
|
|
|
603
580
|
* Pass a stable string only when one logical agent must re-attach to its own
|
|
604
581
|
* held claims across reconnects or restarts. */
|
|
605
582
|
id?: string;
|
|
583
|
+
/** The authenticated person who started this run. Preserving it on durable
|
|
584
|
+
* work and supplying it here gives every write dual-principal attribution. */
|
|
585
|
+
onBehalfOf?: { readonly user: { readonly id: string } };
|
|
606
586
|
/** A human-readable label for logs and attribution (carried in `userMeta.name`).
|
|
607
587
|
* It is independent of `id`: two agents that share a `name` still receive
|
|
608
588
|
* distinct ids and coordinate as separate participants — `name` never derives or
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Canonical create identity and result correlation shared by every client. */
|
|
2
2
|
|
|
3
3
|
import { v5 as uuidv5 } from 'uuid';
|
|
4
|
-
import { AbloConnectionError } from '
|
|
5
|
-
import type { CommitOperationResult } from '
|
|
4
|
+
import { AbloConnectionError } from '../../errors.js';
|
|
5
|
+
import type { CommitOperationResult } from '../../commit/contract.js';
|
|
6
6
|
|
|
7
7
|
/** Resolve the two supported single-create id spellings. The sibling wins. */
|
|
8
8
|
export function resolveCreateId(
|
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
* These types describe the *change or the query being requested*, never a local
|
|
6
6
|
* copy of the rows it touches, so they sit in the commit core and are shared
|
|
7
7
|
* by every transport and every caller (ADR 0013 §4, ADR 0016). The factory that
|
|
8
|
-
* binds them to reactive model instances — `
|
|
8
|
+
* binds them to reactive model instances — `createModelOperations` — stays with the
|
|
9
9
|
* reactive consumer, along with `ModelOperations` and `ModelCollaboration`,
|
|
10
10
|
* which reference the live participant handle.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { ModelScope } from '
|
|
14
|
-
import type { ResolveClaimMeta } from '
|
|
15
|
-
import type { AbloError } from '
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type { Duration } from '../utils/duration.js';
|
|
13
|
+
import type { ModelScope } from '../../types/index.js';
|
|
14
|
+
import type { ResolveClaimMeta } from '../../types/global.js';
|
|
15
|
+
import type { AbloError } from '../../errors.js';
|
|
16
|
+
import type { FieldRef, FieldSelector } from '../../schema/fieldRef.js';
|
|
17
|
+
import type { BaseModelFields, Clearable } from '../../schema/schema.js';
|
|
18
|
+
import type { ClaimHeartbeatPlan } from '../../claims/heartbeat.js';
|
|
19
|
+
import type { Duration } from '../../utils/duration.js';
|
|
21
20
|
import type {
|
|
22
21
|
Claim,
|
|
23
22
|
ClaimHeartbeat,
|
|
@@ -25,7 +24,7 @@ import type {
|
|
|
25
24
|
HeldClaim,
|
|
26
25
|
HeldLease,
|
|
27
26
|
Peer,
|
|
28
|
-
} from '
|
|
27
|
+
} from '../../types/streams.js';
|
|
29
28
|
import type { MutationOptions } from './mutationOptions.js';
|
|
30
29
|
import type { LoadWhere } from './where.js';
|
|
31
30
|
|
|
@@ -142,34 +141,6 @@ export function claimAttemptFailure(
|
|
|
142
141
|
*/
|
|
143
142
|
export type ModelListScope = ModelScope | `${ModelScope}`;
|
|
144
143
|
|
|
145
|
-
/**
|
|
146
|
-
* Options for `track({ id })` — register a durable premise on a row.
|
|
147
|
-
*
|
|
148
|
-
* Derived from the wire's row-form {@link TrackDependency} rather than restated
|
|
149
|
-
* beside it: the caller names the row and, optionally, the watermark it is
|
|
150
|
-
* premised on, while `model` comes from the proxy the call was made on. Adding
|
|
151
|
-
* a field to the dependency therefore reaches this surface automatically, and
|
|
152
|
-
* removing one stops the callers compiling.
|
|
153
|
-
*
|
|
154
|
-
* On `readAt`: omit it to baseline at the current head — "tell me about
|
|
155
|
-
* anything from here on". Pass a known watermark (the one you read the row at)
|
|
156
|
-
* to also catch a change that landed between that read and this call.
|
|
157
|
-
*/
|
|
158
|
-
export type ModelTrackParams = Omit<
|
|
159
|
-
Extract<TrackDependency, { model: string }>,
|
|
160
|
-
'model'
|
|
161
|
-
>;
|
|
162
|
-
|
|
163
|
-
/** The result of `track({ id })`. */
|
|
164
|
-
export interface ModelTrackResult {
|
|
165
|
-
/**
|
|
166
|
-
* Tracks that had ALREADY fired at registration time — a change matching an
|
|
167
|
-
* open track that landed before this call. Present only when something was
|
|
168
|
-
* already stale; the ongoing signal arrives on the receipts of later commits.
|
|
169
|
-
*/
|
|
170
|
-
notifications?: StaleNotification[];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
144
|
/** Options for the synchronous local-graph reads `local.list` and `onChange` —
|
|
174
145
|
* a JavaScript `filter`, an equality `where`, and a lifecycle `state`. This is
|
|
175
146
|
* the local, reactive axis; contrast {@link ServerReadOptions}, the
|
|
@@ -191,7 +162,7 @@ export type LocalCountOptions<T> = Pick<
|
|
|
191
162
|
'where' | 'filter' | 'state'
|
|
192
163
|
>;
|
|
193
164
|
|
|
194
|
-
/** Options for the asynchronous server reads `
|
|
165
|
+
/** Options for the asynchronous server reads `read` and `list` — the
|
|
195
166
|
* operator `where` filter, `type`, and `expand`. This is the server axis;
|
|
196
167
|
* contrast {@link LocalReadOptions}, the local, reactive axis. */
|
|
197
168
|
export interface ServerReadOptions<T> {
|
|
@@ -240,11 +211,9 @@ export interface ListAllOptions<T> extends Omit<ServerReadOptions<T>, 'cursor'>
|
|
|
240
211
|
signal?: AbortSignal;
|
|
241
212
|
}
|
|
242
213
|
|
|
243
|
-
/** Options for the single-row async server read
|
|
214
|
+
/** Options for the single-row async server `read({ id })`. A subset of
|
|
244
215
|
* {@link ServerReadOptions} — `where`/`limit`/`orderBy` are fixed by the id. */
|
|
245
|
-
export type
|
|
246
|
-
/** Canonical point-lookup options; retained separately for compatibility naming. */
|
|
247
|
-
export type ServerGetOptions = ServerRetrieveOptions;
|
|
216
|
+
export type ServerPointReadOptions = Pick<ServerReadOptions<unknown>, 'type' | 'expand'>;
|
|
248
217
|
/**
|
|
249
218
|
* A claimable part of a row is a field declared by that model's Zod shape.
|
|
250
219
|
*
|
|
@@ -535,15 +504,26 @@ export interface ClaimReadApi<T = Record<string, unknown>> {
|
|
|
535
504
|
* stateless HTTP claim surface from the reactive {@link ClaimReadApi}.
|
|
536
505
|
*/
|
|
537
506
|
export type AwaitedClaimMethod<F> = F extends (...args: infer A) => infer R
|
|
538
|
-
|
|
507
|
+
// `[R]` keeps the check non-distributive. `state` returns `Claim | null`, and
|
|
508
|
+
// a bare `R extends …` split that into two function types, one per union
|
|
509
|
+
// member, so the HTTP `state` was typed as a union of functions rather than
|
|
510
|
+
// one function returning the union. The cast that hid it is gone.
|
|
511
|
+
? [R] extends [Promise<unknown>]
|
|
539
512
|
? (...args: A) => R
|
|
540
513
|
: (...args: A) => Promise<R>
|
|
541
514
|
: F;
|
|
542
515
|
|
|
543
|
-
|
|
516
|
+
/**
|
|
517
|
+
* The four ways to take a claim. Already async on every transport, so this is
|
|
518
|
+
* the ONE definition of the callable half of a claim namespace: the reactive
|
|
519
|
+
* {@link ClaimApi} and the stateless {@link HttpClaimApi} both extend it, and an
|
|
520
|
+
* overload added here reaches both. (The two used to restate these by hand, and
|
|
521
|
+
* the row-free pair below existed on one surface and not the other.)
|
|
522
|
+
*/
|
|
523
|
+
export interface ClaimCall<
|
|
544
524
|
T,
|
|
545
525
|
Fields = T,
|
|
546
|
-
>
|
|
526
|
+
> {
|
|
547
527
|
/**
|
|
548
528
|
* The try-claim: `contention: { mode: 'skip' }` (or `queue: false`)
|
|
549
529
|
* treats a held target as an expected outcome, not an error — it resolves
|
|
@@ -558,23 +538,31 @@ export interface ClaimApi<
|
|
|
558
538
|
* Takes a claim and returns an explicit held-work handle — a {@link HeldClaim}.
|
|
559
539
|
* `data`, `release`, `revoke`, and the async disposer are always present (this
|
|
560
540
|
* call re-reads the row under the lease), so callers can use `handle.data`
|
|
561
|
-
* directly and `await using` works without a guard.
|
|
541
|
+
* directly and `await using` works without a guard. A row that does not
|
|
542
|
+
* exist rejects with `AbloNotFoundError` after the lease is given back; to
|
|
543
|
+
* hold a key before its row exists, use the id-only form below.
|
|
562
544
|
*/
|
|
563
545
|
(params: ClaimParams<Fields>): Promise<HeldClaim<T>>;
|
|
564
546
|
/** The row-free try-claim — `null` when the key is already held. */
|
|
565
547
|
(id: string, opts: ClaimSkipOptions<Fields>): Promise<HeldLease | null>;
|
|
566
548
|
/**
|
|
567
549
|
* Takes a claim by id alone, for a row that lives only in the customer's own
|
|
568
|
-
* database
|
|
569
|
-
* {@link HeldLease}: the same lease controls
|
|
570
|
-
* (`release`, `revoke`, `heartbeat`, `await using`) but
|
|
571
|
-
* key you know by id is exactly this — serialize
|
|
572
|
-
* syncing the row into Ablo
|
|
550
|
+
* database or does not exist yet — Ablo has nothing to re-read, so no read is
|
|
551
|
+
* made after the grant. Returns a {@link HeldLease}: the same lease controls
|
|
552
|
+
* as {@link HeldClaim} (`release`, `revoke`, `heartbeat`, `await using`) but
|
|
553
|
+
* no `.data`. Locking a key you know by id is exactly this — serialize
|
|
554
|
+
* writers without first syncing the row into Ablo, or claim an id before
|
|
555
|
+
* creating its row so two actors cannot both create it.
|
|
573
556
|
*/
|
|
574
557
|
(id: string, opts?: ClaimOptions<Fields>): Promise<HeldLease>;
|
|
575
558
|
}
|
|
576
559
|
|
|
577
|
-
export interface
|
|
560
|
+
export interface ClaimApi<
|
|
561
|
+
T,
|
|
562
|
+
Fields = T,
|
|
563
|
+
> extends ClaimReadApi<T>, ClaimCall<T, Fields> {}
|
|
564
|
+
|
|
565
|
+
export interface ModelReadParams extends ServerPointReadOptions {
|
|
578
566
|
readonly id: string;
|
|
579
567
|
}
|
|
580
568
|
|
|
@@ -587,7 +575,10 @@ export interface ModelRetrieveParams extends ServerRetrieveOptions {
|
|
|
587
575
|
* confirmation. Callers that need an earlier queued receipt use the lower-level
|
|
588
576
|
* `commits.create` resource instead.
|
|
589
577
|
*/
|
|
590
|
-
export type ModelWriteOptions = Omit<
|
|
578
|
+
export type ModelWriteOptions = Omit<
|
|
579
|
+
MutationOptions,
|
|
580
|
+
'wait' | 'readAt' | 'fenceToken' | 'claimRef'
|
|
581
|
+
>;
|
|
591
582
|
|
|
592
583
|
export interface ModelCreateParams<T, CreateInput>
|
|
593
584
|
extends ModelWriteOptions {
|
|
@@ -606,7 +597,7 @@ export interface ModelCreateParams<T, CreateInput>
|
|
|
606
597
|
*/
|
|
607
598
|
export type ModelCreateManyParams<CreateInput> = Pick<
|
|
608
599
|
ModelWriteOptions,
|
|
609
|
-
'idempotencyKey' | 'reads'
|
|
600
|
+
'idempotencyKey' | 'reads'
|
|
610
601
|
> & {
|
|
611
602
|
readonly data: readonly CreateInput[];
|
|
612
603
|
};
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* core rather than the reactive consumer (ADR 0013 §4, ADR 0016).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { CommitWait } from '
|
|
11
|
-
import type {
|
|
10
|
+
import type { CommitWait } from '../../commit/contract.js';
|
|
11
|
+
import type { ReadDependency } from '../../coordination/schema.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Per-call options accepted by any mutation, passed as the last argument.
|
|
@@ -27,7 +27,6 @@ export interface MutationOptions {
|
|
|
27
27
|
label?: string;
|
|
28
28
|
wait?: CommitWait;
|
|
29
29
|
readAt?: number | null;
|
|
30
|
-
onStale?: OnStaleMode | null;
|
|
31
30
|
/**
|
|
32
31
|
* The fencing token (Option B) of the held claim this write belongs to. The
|
|
33
32
|
* server validates it against the entity's persisted high-water and rejects a
|
|
@@ -43,24 +42,12 @@ export interface MutationOptions {
|
|
|
43
42
|
* The batch premise — the answer to "did anything I looked at change?" Each
|
|
44
43
|
* entry is a row (`{ model, id, readAt, fields? }`) or a sync group
|
|
45
44
|
* (`{ group, readAt }`) that this write was premised on. The server checks
|
|
46
|
-
* that none of them moved since their `readAt
|
|
47
|
-
*
|
|
45
|
+
* that none of them moved since their `readAt`; a stale dependency rejects the
|
|
46
|
+
* whole batch. This is distinct from the per-operation
|
|
48
47
|
* `readAt`, which guards only the row being written.
|
|
49
48
|
*
|
|
50
49
|
* See `packages/ablo/docs/concurrency-convention.md` (§3 the two
|
|
51
50
|
* premises, §4 the batch premise) for the governing convention.
|
|
52
51
|
*/
|
|
53
52
|
reads?: ReadDependency[] | null;
|
|
54
|
-
/**
|
|
55
|
-
* Durable premises — what this write (or the record it produces) should
|
|
56
|
-
* keep watching. Unlike `reads`, which is checked once at commit and discarded,
|
|
57
|
-
* each `track` entry is persisted and re-checked against every future delta; a
|
|
58
|
-
* later matching change opens a `StaleNotification` for the tracking participant,
|
|
59
|
-
* delivered at their next commit or live to a held claim. Each entry is a row
|
|
60
|
-
* (`{ model, id }`) or a sync group (`{ group }`), optionally pinned to a `readAt`
|
|
61
|
-
* baseline (defaults to this commit's watermark).
|
|
62
|
-
*
|
|
63
|
-
* See `packages/ablo/docs/groups.md` for how `track` drives propagation.
|
|
64
|
-
*/
|
|
65
|
-
track?: TrackDependency[] | null;
|
|
66
53
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The Zod schema for write options — the settings accepted by every write
|
|
3
3
|
* entry point, including `ablo.<model>.create/update/delete`, `commits.create`,
|
|
4
4
|
* and the HTTP write routes. Each of those boundaries validates against this
|
|
5
|
-
* one schema, so a caller who passes
|
|
5
|
+
* one schema, so a caller who passes a malformed option fails right away
|
|
6
6
|
* with a typed {@link AbloValidationError} at the call site instead of silently
|
|
7
7
|
* or with a 400 from the server.
|
|
8
8
|
*
|
|
@@ -17,25 +17,12 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { z } from 'zod';
|
|
20
|
-
import { logPositionSchema } from '
|
|
21
|
-
import type { MutationOptions } from '
|
|
22
|
-
import { AbloValidationError } from '
|
|
23
|
-
import { commitWaitSchema } from '
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
MAX_READ_SET_ENTRIES,
|
|
27
|
-
readDependencyListSchema,
|
|
28
|
-
readSetProjectionEntryCount,
|
|
29
|
-
trackDependencyListSchema,
|
|
30
|
-
} from '../coordination/schema.js';
|
|
31
|
-
import type { AssertExact } from '../types/assertExact.js';
|
|
32
|
-
|
|
33
|
-
// Re-exported, not redeclared. `coordination/schema.ts` owns this enum — it is
|
|
34
|
-
// what the wire schemas and the server validate against — while the published
|
|
35
|
-
// SDK barrel exports the name from this module. Declaring it twice put a second
|
|
36
|
-
// object behind the public export that agreed with the canonical one only by
|
|
37
|
-
// both happening to list the same three strings.
|
|
38
|
-
export { onStaleModeSchema };
|
|
20
|
+
import { logPositionSchema } from '../../syncLog/contract.js';
|
|
21
|
+
import type { MutationOptions } from './mutationOptions.js';
|
|
22
|
+
import { AbloValidationError } from '../../errors.js';
|
|
23
|
+
import { commitWaitSchema } from '../../commit/contract.js';
|
|
24
|
+
import { readDependencyListSchema } from '../../coordination/schema.js';
|
|
25
|
+
import type { AssertExact } from '../../types/assertExact.js';
|
|
39
26
|
|
|
40
27
|
export const writeOptionsSchema = z.object({
|
|
41
28
|
/** Idempotency key the server records in `mutation_log` to make retries
|
|
@@ -47,8 +34,6 @@ export const writeOptionsSchema = z.object({
|
|
|
47
34
|
wait: commitWaitSchema.optional(),
|
|
48
35
|
/** Stale guard: the sync watermark the caller's reasoning was based on. */
|
|
49
36
|
readAt: logPositionSchema.nullish(),
|
|
50
|
-
/** What the server does when the target moved past `readAt`. */
|
|
51
|
-
onStale: onStaleModeSchema.nullish(),
|
|
52
37
|
/** The held claim's fencing token (Option B), sourced from the claim handle
|
|
53
38
|
* rather than set by hand; the server validates it against the entity's
|
|
54
39
|
* high-water. Kept in the schema so it stays aligned with `MutationOptions`
|
|
@@ -61,11 +46,6 @@ export const writeOptionsSchema = z.object({
|
|
|
61
46
|
claimRef: z.union([z.string(), z.object({ id: z.string() })]).nullish(),
|
|
62
47
|
/** Commit-lifetime entries in the write's ReadSet. */
|
|
63
48
|
reads: readDependencyListSchema.nullish(),
|
|
64
|
-
/** Persisted entries projected from the write's ReadSet. */
|
|
65
|
-
track: trackDependencyListSchema.nullish(),
|
|
66
|
-
}).refine((value) => readSetProjectionEntryCount(value) <= MAX_READ_SET_ENTRIES, {
|
|
67
|
-
path: ['reads'],
|
|
68
|
-
message: `reads and track may contain at most ${MAX_READ_SET_ENTRIES} entries combined`,
|
|
69
49
|
});
|
|
70
50
|
|
|
71
51
|
export type WriteOptionsInput = z.infer<typeof writeOptionsSchema>;
|
|
@@ -8,14 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
-
import {
|
|
12
|
-
MAX_READ_SET_ENTRIES,
|
|
13
|
-
readDependencyListSchema,
|
|
14
|
-
readSetProjectionEntryCount,
|
|
15
|
-
trackDependencyListSchema,
|
|
16
|
-
} from '../../coordination/schema.js';
|
|
11
|
+
import { readDependencyListSchema } from '../../coordination/schema.js';
|
|
17
12
|
import { wireCommitOperationSchema } from '../../wire/frames.js';
|
|
18
|
-
import { correlationIdSchema } from '
|
|
13
|
+
import { correlationIdSchema } from '../contract.js';
|
|
19
14
|
import { idempotencyKeySchema } from './idempotencyKey.js';
|
|
20
15
|
import { snapshotJsonValue } from '../../utils/json.js';
|
|
21
16
|
|
|
@@ -48,7 +43,6 @@ export const durableCommitOperationSchema = wireCommitOperationSchema
|
|
|
48
43
|
transactionId: true,
|
|
49
44
|
claimId: true,
|
|
50
45
|
readAt: true,
|
|
51
|
-
onStale: true,
|
|
52
46
|
fenceToken: true,
|
|
53
47
|
})
|
|
54
48
|
.extend({
|
|
@@ -70,10 +64,6 @@ export type DurableCommitOperationInput = z.input<typeof durableCommitOperationS
|
|
|
70
64
|
|
|
71
65
|
const durableCommitOptionsSchema = z.strictObject({
|
|
72
66
|
reads: readDependencyListSchema.nullable().optional(),
|
|
73
|
-
track: trackDependencyListSchema.nullable().optional(),
|
|
74
|
-
}).refine((value) => readSetProjectionEntryCount(value) <= MAX_READ_SET_ENTRIES, {
|
|
75
|
-
path: ['reads'],
|
|
76
|
-
message: `reads and track may contain at most ${MAX_READ_SET_ENTRIES} entries combined`,
|
|
77
67
|
});
|
|
78
68
|
|
|
79
69
|
export const commitOutboxScopeSchema = z.strictObject({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { v5 as uuidv5 } from 'uuid';
|
|
5
5
|
import { snapshotJsonValue, stableStringify } from '../../utils/json.js';
|
|
6
|
-
import { correlationIdSchema } from '
|
|
6
|
+
import { correlationIdSchema } from '../contract.js';
|
|
7
7
|
import { PROTOCOL_VERSION } from '../../wire/protocolVersion.js';
|
|
8
8
|
import { idempotencyKeySchema } from './idempotencyKey.js';
|
|
9
9
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* this module only unions them.
|
|
9
9
|
*
|
|
10
10
|
* The port that persists these records is a behavior contract, not a persisted
|
|
11
|
-
* shape, so it lives outside this directory in `src/durableWrites.ts`.
|
|
11
|
+
* shape, so it lives outside this directory in `src/commit/durableWrites.ts`.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { z } from 'zod';
|