@abloatai/transaction 0.57.0 → 0.59.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} +8 -18
- 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/client/surface.d.ts +15 -0
- package/dist/client/surface.d.ts.map +1 -0
- package/dist/client/surface.js +29 -0
- package/dist/client/surface.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 +26 -12
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +61 -27
- package/dist/pricing.js.map +1 -1
- package/dist/schema/ddl.d.ts.map +1 -1
- package/dist/schema/ddl.js +1 -1
- package/dist/schema/ddl.js.map +1 -1
- package/dist/schema/deployment/backfill.d.ts +44 -0
- package/dist/schema/deployment/backfill.d.ts.map +1 -0
- package/dist/schema/deployment/backfill.js +57 -0
- package/dist/schema/deployment/backfill.js.map +1 -0
- package/dist/schema/deployment/contracts.d.ts +526 -0
- package/dist/schema/deployment/contracts.d.ts.map +1 -0
- package/dist/schema/deployment/contracts.js +77 -0
- package/dist/schema/deployment/contracts.js.map +1 -0
- package/dist/schema/deployment/fingerprint.d.ts +3 -0
- package/dist/schema/deployment/fingerprint.d.ts.map +1 -0
- package/dist/schema/deployment/fingerprint.js +18 -0
- package/dist/schema/deployment/fingerprint.js.map +1 -0
- package/dist/schema/deployment/index.d.ts +18 -0
- package/dist/schema/deployment/index.d.ts.map +1 -0
- package/dist/schema/deployment/index.js +71 -0
- package/dist/schema/deployment/index.js.map +1 -0
- package/dist/schema/deployment/postgresCatalog.d.ts +39 -0
- package/dist/schema/deployment/postgresCatalog.d.ts.map +1 -0
- package/dist/schema/deployment/postgresCatalog.js +86 -0
- package/dist/schema/deployment/postgresCatalog.js.map +1 -0
- package/dist/schema/deployment/reconcile.d.ts +20 -0
- package/dist/schema/deployment/reconcile.d.ts.map +1 -0
- package/dist/schema/deployment/reconcile.js +226 -0
- package/dist/schema/deployment/reconcile.js.map +1 -0
- package/dist/schema/deployment/sequence.d.ts +4 -0
- package/dist/schema/deployment/sequence.d.ts.map +1 -0
- package/dist/schema/deployment/sequence.js +71 -0
- package/dist/schema/deployment/sequence.js.map +1 -0
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +8 -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} +10 -22
- 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/client/surface.ts +50 -0
- 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 +61 -26
- package/src/schema/ddl.ts +3 -1
- package/src/schema/deployment/backfill.ts +88 -0
- package/src/schema/deployment/contracts.ts +119 -0
- package/src/schema/deployment/fingerprint.ts +13 -0
- package/src/schema/deployment/index.ts +81 -0
- package/src/schema/deployment/postgresCatalog.ts +131 -0
- package/src/schema/deployment/reconcile.ts +219 -0
- package/src/schema/deployment/sequence.ts +85 -0
- package/src/schema/index.ts +9 -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
package/src/schema/openapi.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type { FieldMeta } from './field.js';
|
|
|
25
25
|
// Pulled from the endpoints module to keep this schema file free of the client's
|
|
26
26
|
// error-handling and credential dependencies.
|
|
27
27
|
import { ABLO_HOSTED_HTTP_BASE_URL } from '../auth/hostedEndpoints.js';
|
|
28
|
+
import { docUrlForCode } from '../errors.js';
|
|
28
29
|
// The commit body is DERIVED from the schema the server validates against —
|
|
29
30
|
// one definition site, so the documented surface cannot drift from the
|
|
30
31
|
// enforced one.
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
commitRecordSchema,
|
|
36
37
|
commitRecordListSchema,
|
|
37
38
|
commitRecordWhereSchema,
|
|
38
|
-
} from '../
|
|
39
|
+
} from '../commit/contract.js';
|
|
39
40
|
import { CURSOR_PARAM, CURSOR_PARAM_ALIAS } from '../wire/listEnvelope.js';
|
|
40
41
|
import {
|
|
41
42
|
claimRequestSchema,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
claimReorderRequestSchema,
|
|
52
53
|
claimReorderReplySchema,
|
|
53
54
|
claimReleaseReplySchema,
|
|
54
|
-
} from '../
|
|
55
|
+
} from '../claims/contract.js';
|
|
55
56
|
import { errorEnvelopeSchema } from '../wire/errorEnvelope.js';
|
|
56
57
|
// The lifecycle promise and the rate-limit fields are contract, not prose about
|
|
57
58
|
// contract: the document renders the same constants the server emits, so the
|
|
@@ -69,8 +70,8 @@ import {
|
|
|
69
70
|
} from '../wire/rateLimit.js';
|
|
70
71
|
import { modelReadResponseSchema, modelListResponseSchema } from '../wire/modelResponses.js';
|
|
71
72
|
import { modelMutationRequestSchema } from '../wire/modelMutations.js';
|
|
72
|
-
import { logListResponseSchema, logQuerySchema } from '../
|
|
73
|
-
import { logDeliveryResponseSchema } from '../
|
|
73
|
+
import { logListResponseSchema, logQuerySchema } from '../observation/feedContract.js';
|
|
74
|
+
import { logDeliveryResponseSchema } from '../observation/deliveryContract.js';
|
|
74
75
|
import { schemaReadResponseSchema } from '../wire/accountResponses.js';
|
|
75
76
|
import {
|
|
76
77
|
ephemeralKeyRequestSchema,
|
|
@@ -530,6 +531,11 @@ function envelope(options: SchemaToOpenApiOptions, description: string, paths: J
|
|
|
530
531
|
name: 'Apache License 2.0',
|
|
531
532
|
identifier: 'Apache-2.0',
|
|
532
533
|
},
|
|
534
|
+
contact: {
|
|
535
|
+
name: 'Ablo Support',
|
|
536
|
+
url: 'https://github.com/Abloatai/ablo/issues',
|
|
537
|
+
email: 'support@abloatai.com',
|
|
538
|
+
},
|
|
533
539
|
},
|
|
534
540
|
servers: [{ url: options.serverUrl ?? `${ABLO_HOSTED_HTTP_BASE_URL}/api` }],
|
|
535
541
|
security: [{ bearerAuth: [] }],
|
|
@@ -555,6 +561,41 @@ const ERROR_RESPONSES: Readonly<Record<string, string>> = {
|
|
|
555
561
|
'503': 'A required service is temporarily unavailable.',
|
|
556
562
|
};
|
|
557
563
|
|
|
564
|
+
/**
|
|
565
|
+
* One real instance of the error shape every operation shares.
|
|
566
|
+
*
|
|
567
|
+
* This lives beside the canonical error responses rather than on the schema:
|
|
568
|
+
* OpenAPI consumers select examples from an operation's media type, and an
|
|
569
|
+
* example buried on a component does not tell them which response carries it.
|
|
570
|
+
* Stamping the same representative validation failure on every operation also
|
|
571
|
+
* means a newly added route cannot regress the published example coverage.
|
|
572
|
+
*/
|
|
573
|
+
const ERROR_RESPONSE_EXAMPLE: Readonly<Json> = {
|
|
574
|
+
type: 'AbloValidationError',
|
|
575
|
+
code: 'invalid_request',
|
|
576
|
+
param: 'body',
|
|
577
|
+
message: 'The request did not satisfy the published contract.',
|
|
578
|
+
doc_url: docUrlForCode('invalid_request'),
|
|
579
|
+
request_id: 'req_52bb7f46-17bc-4f2d-9988-89d1398d2990',
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
function canonicalErrorResp(description: string): Json {
|
|
583
|
+
return {
|
|
584
|
+
description,
|
|
585
|
+
content: {
|
|
586
|
+
'application/json': {
|
|
587
|
+
schema: schemaRef('ErrorEnvelope'),
|
|
588
|
+
examples: {
|
|
589
|
+
validation: {
|
|
590
|
+
summary: 'Typed validation failure',
|
|
591
|
+
value: ERROR_RESPONSE_EXAMPLE,
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
558
599
|
/**
|
|
559
600
|
* Every route passes failures through the same server error funnel. Publish
|
|
560
601
|
* that fact on every operation so generated transports decode all HTTP errors
|
|
@@ -569,11 +610,10 @@ function attachCanonicalErrors(paths: Json): void {
|
|
|
569
610
|
const operation = rawOperation as Json;
|
|
570
611
|
const responses = { ...(operation.responses as Json | undefined) };
|
|
571
612
|
for (const [status, description] of Object.entries(ERROR_RESPONSES)) {
|
|
572
|
-
responses[status] =
|
|
613
|
+
responses[status] = canonicalErrorResp(description);
|
|
573
614
|
}
|
|
574
|
-
responses.default =
|
|
615
|
+
responses.default = canonicalErrorResp(
|
|
575
616
|
'An HTTP error not otherwise listed; decoded through the canonical envelope.',
|
|
576
|
-
'ErrorEnvelope',
|
|
577
617
|
);
|
|
578
618
|
operation.responses = responses;
|
|
579
619
|
}
|
package/src/schema/schema.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* status: z.enum(['todo', 'doing', 'done']).default('todo'),
|
|
14
14
|
* workspaceId: z.string().optional(),
|
|
15
15
|
* }, {
|
|
16
|
-
* workspace: relation.belongsTo('workspaces', 'workspaceId'),
|
|
16
|
+
* relations: { workspace: relation.belongsTo('workspaces', 'workspaceId') },
|
|
17
17
|
* }),
|
|
18
18
|
* });
|
|
19
19
|
*
|
|
20
|
-
* type Item =
|
|
20
|
+
* type Item = Model<typeof schema, 'items'>;
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { z } from 'zod';
|
|
@@ -231,6 +231,13 @@ export const baseFieldsSchema = z.object({
|
|
|
231
231
|
/**
|
|
232
232
|
* The universal model field names. Audit and application metadata is declared
|
|
233
233
|
* by the application or carried by the commit record, never injected here.
|
|
234
|
+
*
|
|
235
|
+
* This is the runtime spelling of {@link baseFieldsSchema}, and the one every
|
|
236
|
+
* consumer outside this package derives from: the CLI's adopt rule, the MCP
|
|
237
|
+
* schema linter, and the docs that tell an author which names not to declare.
|
|
238
|
+
* It is exported from `@abloatai/transaction/schema` for exactly that reason —
|
|
239
|
+
* when this list last moved (0.52.0, five names down to one) three hand-written
|
|
240
|
+
* copies stayed behind and went on rejecting correct schemas for five releases.
|
|
234
241
|
*/
|
|
235
242
|
export const BASE_FIELDS = [
|
|
236
243
|
'id',
|
|
@@ -239,6 +246,18 @@ export const BASE_FIELDS = [
|
|
|
239
246
|
/** The base fields type — pure data columns. */
|
|
240
247
|
export type BaseModelFields = z.infer<typeof baseFieldsSchema>;
|
|
241
248
|
|
|
249
|
+
// Invariant equality (no runtime, no casts): true only when both are mutually
|
|
250
|
+
// assignable. `ExpectTrue`'s constraint is what turns a mismatch into an error
|
|
251
|
+
// at THIS declaration, so the tuple and the schema cannot move apart — in
|
|
252
|
+
// either direction, a name in one and not the other fails to compile.
|
|
253
|
+
type BaseFieldsEqual<A, B> =
|
|
254
|
+
(<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
|
|
255
|
+
type ExpectTrue<T extends true> = T;
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
257
|
+
type _BaseFieldsExact = ExpectTrue<
|
|
258
|
+
BaseFieldsEqual<(typeof BASE_FIELDS)[number], keyof BaseModelFields & string>
|
|
259
|
+
>;
|
|
260
|
+
|
|
242
261
|
/**
|
|
243
262
|
* Methods every model instance carries. These are intersected into
|
|
244
263
|
* {@link InferModel}, the read-side type, but not into the create or update
|
|
@@ -332,7 +351,8 @@ export interface Schema<S extends SchemaRecord = SchemaRecord> {
|
|
|
332
351
|
|
|
333
352
|
/**
|
|
334
353
|
* Infer the full model type from a schema.
|
|
335
|
-
* Includes base fields
|
|
354
|
+
* Includes the base fields, which today means `id` alone: audit timestamps are
|
|
355
|
+
* ordinary declared fields and appear here only when the model declares them.
|
|
336
356
|
*
|
|
337
357
|
* ```ts
|
|
338
358
|
* type Item = InferModel<typeof schema, 'items'>;
|
package/src/schema/serialize.ts
CHANGED
|
@@ -41,7 +41,6 @@ import type {
|
|
|
41
41
|
LoadStrategy,
|
|
42
42
|
PersistOptions,
|
|
43
43
|
AutoFillRule,
|
|
44
|
-
ConflictAxis,
|
|
45
44
|
} from './model.js';
|
|
46
45
|
import {
|
|
47
46
|
relation,
|
|
@@ -90,9 +89,6 @@ export interface ModelJSON {
|
|
|
90
89
|
readonly grants?: GrantsRef;
|
|
91
90
|
readonly entityRoles?: readonly EntityRole[];
|
|
92
91
|
readonly routingOnly?: true;
|
|
93
|
-
/** The declared write-conflict disposition per committer kind. When absent,
|
|
94
|
-
* the engine falls back to its default. */
|
|
95
|
-
readonly conflict?: ConflictAxis;
|
|
96
92
|
readonly bootstrapLimit?: number;
|
|
97
93
|
readonly bootstrapOrderBy?: string;
|
|
98
94
|
readonly mutable?: boolean;
|
|
@@ -145,7 +141,6 @@ function modelToJSON(def: ModelDef): ModelJSON {
|
|
|
145
141
|
grants: def.grants,
|
|
146
142
|
entityRoles: def.entityRoles,
|
|
147
143
|
routingOnly: def.routingOnly,
|
|
148
|
-
conflict: def.conflict,
|
|
149
144
|
bootstrapLimit: def.bootstrapLimit,
|
|
150
145
|
bootstrapOrderBy: def.bootstrapOrderBy,
|
|
151
146
|
mutable: def.mutable,
|
|
@@ -285,9 +280,6 @@ function modelFromJSON(json: ModelJSON): ModelDef {
|
|
|
285
280
|
grants: json.grants,
|
|
286
281
|
entityRoles: json.entityRoles,
|
|
287
282
|
routingOnly: json.routingOnly,
|
|
288
|
-
// Absent in older artifacts → undefined, so the commit path falls through to
|
|
289
|
-
// the function registry or the engine default.
|
|
290
|
-
conflict: json.conflict,
|
|
291
283
|
mutable: json.mutable,
|
|
292
284
|
lazyObservable: json.lazyObservable,
|
|
293
285
|
// computed getters are closures and intentionally not serialized; a
|
package/src/server/adapter.ts
CHANGED
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
SourceOperation,
|
|
22
22
|
SourceRequestContext,
|
|
23
23
|
} from '../source/index.js';
|
|
24
|
-
import type { ServerSyncDelta } from '../
|
|
24
|
+
import type { ServerSyncDelta } from '../observation/contract.js';
|
|
25
25
|
import type { BootstrapModel } from './readConfig.js';
|
|
26
26
|
import type { CommitContext, CommitExecutionResult } from './commit.js';
|
|
27
27
|
import type { StorageMode } from './storageMode.js';
|
package/src/server/commit.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* commit time and the shape of a stored or broadcast delta share one definition
|
|
14
14
|
* rather than being kept in step by hand.
|
|
15
15
|
*/
|
|
16
|
-
import type { ParticipantKind, ConfirmationState } from '../
|
|
17
|
-
import type { ParticipantRef } from '../
|
|
18
|
-
import type { CommitExecutionResultInput } from '../
|
|
19
|
-
import type { CommitOperationResult } from '../
|
|
20
|
-
import type { ReadDependency
|
|
16
|
+
import type { ParticipantKind, ConfirmationState } from '../observation/persistence/syncDeltaRow.js';
|
|
17
|
+
import type { ParticipantRef } from '../observation/contract.js';
|
|
18
|
+
import type { CommitExecutionResultInput } from '../commit/contract.js';
|
|
19
|
+
import type { CommitOperationResult } from '../commit/contract.js';
|
|
20
|
+
import type { ReadDependency } from '../coordination/schema.js';
|
|
21
21
|
import type { EffectiveAuthority } from '../auth/capability.js';
|
|
22
22
|
|
|
23
23
|
export interface CommitContext {
|
|
@@ -81,18 +81,10 @@ export interface CommitContext {
|
|
|
81
81
|
/**
|
|
82
82
|
* The premise for the whole batch. The committer declares the rows or groups
|
|
83
83
|
* it read to form this batch; the engine checks that none of them changed since
|
|
84
|
-
* each entry's `readAt` timestamp and
|
|
85
|
-
* across the batch. This differs from the per-operation `readAt` guard, which
|
|
84
|
+
* each entry's `readAt` timestamp and rejects the batch if one moved. This differs from the per-operation `readAt` guard, which
|
|
86
85
|
* validates only the rows being written. Omit it to check the write targets alone.
|
|
87
86
|
*/
|
|
88
87
|
reads?: ReadDependency[] | null;
|
|
89
|
-
/**
|
|
90
|
-
* Durable premises to persist for this commit's participant. Each entry is
|
|
91
|
-
* kept in `track_dependencies` and re-checked against every future delta; a
|
|
92
|
-
* later match opens a `StaleNotification` delivered out of band. Distinct
|
|
93
|
-
* from `reads`, which is checked once here and discarded.
|
|
94
|
-
*/
|
|
95
|
-
track?: TrackDependency[] | null;
|
|
96
88
|
}
|
|
97
89
|
|
|
98
90
|
/**
|
package/src/server/index.ts
CHANGED
|
@@ -26,7 +26,7 @@ export {
|
|
|
26
26
|
commitExecutionResultSchema,
|
|
27
27
|
commitRecordSchema,
|
|
28
28
|
type CommitRecord,
|
|
29
|
-
} from '../
|
|
29
|
+
} from '../commit/contract.js';
|
|
30
30
|
export { storageModeSchema, type StorageMode } from './storageMode.js';
|
|
31
31
|
export type {
|
|
32
32
|
ColumnOverride,
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
* you want to override one of those while the adapter serves the rest.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import type { SourceListQuery, SourceRequestContext } from '
|
|
27
|
+
import type { SourceListQuery, SourceRequestContext } from '../types.js';
|
|
28
28
|
import type {
|
|
29
29
|
AdapterCapabilities,
|
|
30
30
|
ChangeSet,
|
|
31
|
-
EventsPage,
|
|
32
|
-
Migration,
|
|
33
31
|
} from './contract.js';
|
|
32
|
+
import type { Migration } from './migration.js';
|
|
33
|
+
import type { EventsPage } from '../outbox/index.js';
|
|
34
34
|
import type { DatabaseAdapterProfile } from './adapterProfile.js';
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -83,8 +83,12 @@ export interface MutationAdapter {
|
|
|
83
83
|
*/
|
|
84
84
|
export interface DataSourceAdapter extends MutationAdapter {
|
|
85
85
|
readonly capabilities: AdapterCapabilities & { readonly outboxEvents: true };
|
|
86
|
-
/**
|
|
86
|
+
/** Pure read of events after `cursor`; `null` starts at the beginning. */
|
|
87
87
|
events(cursor: string | null, limit: number): Promise<EventsPage>;
|
|
88
|
+
/** Bounded cleanup through a consumer position Ablo has durably committed. */
|
|
89
|
+
acknowledgeEvents(acknowledgedThrough: string): Promise<void>;
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
export type { AdapterCapabilities, ChangeSet
|
|
92
|
+
export type { AdapterCapabilities, ChangeSet } from './contract.js';
|
|
93
|
+
export type { Migration } from './migration.js';
|
|
94
|
+
export type { EventsPage, OutboxEvent } from '../outbox/index.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* binding, observation, and advertised guarantees.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { AbloValidationError } from '
|
|
9
|
+
import { AbloValidationError } from '../../errors.js';
|
|
10
10
|
import type { MutationAdapter } from './adapter.js';
|
|
11
11
|
import { databaseAdapterProfileSchema } from './adapterProfile.js';
|
|
12
12
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* failing deep inside a transaction, and each TypeScript type is inferred from the
|
|
6
6
|
* one schema that validates it.
|
|
7
7
|
*
|
|
8
|
-
* These schemas describe the adapter's
|
|
9
|
-
*
|
|
8
|
+
* These schemas describe the adapter's mutation contract: the change set it
|
|
9
|
+
* commits and the capabilities it advertises. The operation
|
|
10
10
|
* vocabulary is not restated here — `operationSchema` is projected from the
|
|
11
11
|
* core's `commitOperationSchema`, so an action or field added to the commit
|
|
12
12
|
* contract reaches a data source by construction. The assertion at the end of
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
-
import { correlationIdSchema } from '
|
|
19
|
+
import { correlationIdSchema } from '../../commit/contract.js';
|
|
20
20
|
import {
|
|
21
21
|
commitOperationSchema,
|
|
22
22
|
commitOperationTypeSchema,
|
|
23
|
-
} from '
|
|
23
|
+
} from '../../coordination/schema.js';
|
|
24
24
|
import {
|
|
25
25
|
ABLO_SOURCE_CLIENT_TX_ID_MAX_LENGTH,
|
|
26
26
|
ABLO_SOURCE_ECHO_MAX_OPERATIONS,
|
|
@@ -28,8 +28,8 @@ import {
|
|
|
28
28
|
type SourceCommitEcho,
|
|
29
29
|
type SourceCommitEchoMarker,
|
|
30
30
|
type SourceOperation,
|
|
31
|
-
} from '
|
|
32
|
-
import type { SourceRequestContext } from '
|
|
31
|
+
} from '../types.js';
|
|
32
|
+
import type { SourceRequestContext } from '../types.js';
|
|
33
33
|
|
|
34
34
|
const jsonObject = z.record(z.string(), z.unknown());
|
|
35
35
|
|
|
@@ -45,15 +45,15 @@ export type OperationType = z.infer<typeof operationTypeSchema>;
|
|
|
45
45
|
* A single operation within a change set, and the runtime validator for it.
|
|
46
46
|
*
|
|
47
47
|
* The field set is projected from `commitOperationSchema` — an operation
|
|
48
|
-
* reaching a data source is a commit operation minus the
|
|
49
|
-
* settles internally
|
|
48
|
+
* reaching a data source is a commit operation minus the fencing field the
|
|
49
|
+
* core settles internally. The two `min(1)` overrides are
|
|
50
50
|
* deliberate and local: this is a customer-implemented boundary, so an empty
|
|
51
51
|
* model name or row id is rejected here rather than forwarded. Stating them as
|
|
52
52
|
* an extension keeps the tightening visible as a choice instead of hiding it
|
|
53
53
|
* inside a second copy of the shape.
|
|
54
54
|
*/
|
|
55
55
|
export const operationSchema = commitOperationSchema
|
|
56
|
-
.omit({
|
|
56
|
+
.omit({ fenceToken: true })
|
|
57
57
|
.extend({
|
|
58
58
|
model: z.string().min(1),
|
|
59
59
|
id: z.string().min(1).nullish(),
|
|
@@ -161,61 +161,6 @@ export const changeSetSchema = z.object({
|
|
|
161
161
|
});
|
|
162
162
|
export type ChangeSet = z.infer<typeof changeSetSchema>;
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* A row in the adapter's `ablo_outbox` table. The adapter writes it in the same
|
|
166
|
-
* transaction as the underlying row change — the transactional-outbox pattern — so
|
|
167
|
-
* a change and its event commit together or not at all. The `events()` feed later
|
|
168
|
-
* reads these rows back and hands them to Ablo, and `cursor` is the monotonic
|
|
169
|
-
* ordering key Ablo round-trips to resume where it left off.
|
|
170
|
-
*/
|
|
171
|
-
export const outboxEventSchema = z.object({
|
|
172
|
-
/** Stable, globally-unique id — Ablo's replay-protection key. */
|
|
173
|
-
id: z.string().min(1),
|
|
174
|
-
model: z.string().min(1),
|
|
175
|
-
entityId: z.string().min(1),
|
|
176
|
-
type: operationTypeSchema,
|
|
177
|
-
/** The changed row, in the key shape `SourceEvent.data` defines: the model's
|
|
178
|
-
* declared schema fields, never the table's physical column names. */
|
|
179
|
-
data: jsonObject.nullish(),
|
|
180
|
-
/** Exact record routes captured in the same transaction as the row change. */
|
|
181
|
-
syncGroups: z.array(z.string().min(1)).readonly(),
|
|
182
|
-
organizationId: z.string().nullish(),
|
|
183
|
-
/** Legacy source transaction id. Never use this field to settle a queued commit. */
|
|
184
|
-
clientTxId: z.string().nullish(),
|
|
185
|
-
/** Scoped server-authored identity that correlates this event to a queued commit. */
|
|
186
|
-
correlationId: correlationIdSchema.nullish(),
|
|
187
|
-
/** Stable identity of this operation within the correlated source commit. */
|
|
188
|
-
transactionId: z
|
|
189
|
-
.string()
|
|
190
|
-
.min(1)
|
|
191
|
-
.max(ABLO_SOURCE_CLIENT_TX_ID_MAX_LENGTH)
|
|
192
|
-
.nullish(),
|
|
193
|
-
occurredAt: z.number().nullish(),
|
|
194
|
-
/** Monotonic ordering key (bigint as string). `events()` pages by `cursor > ?`. */
|
|
195
|
-
cursor: z.string().min(1),
|
|
196
|
-
});
|
|
197
|
-
export type OutboxEvent = z.infer<typeof outboxEventSchema>;
|
|
198
|
-
|
|
199
|
-
/** A page of outbox events returned by `events()`. */
|
|
200
|
-
export const eventsPageSchema = z.object({
|
|
201
|
-
events: z.array(outboxEventSchema),
|
|
202
|
-
nextCursor: z.string().nullable(),
|
|
203
|
-
});
|
|
204
|
-
export type EventsPage = z.infer<typeof eventsPageSchema>;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* A table-creation migration an adapter ships, so you never hand-write the
|
|
208
|
-
* `ablo_idempotency` and `ablo_outbox` tables yourself. An adapter returns these
|
|
209
|
-
* from its `migrations()` method.
|
|
210
|
-
*/
|
|
211
|
-
export const migrationSchema = z.object({
|
|
212
|
-
/** Stable name, used as the migration filename + applied-ledger key. */
|
|
213
|
-
name: z.string().min(1),
|
|
214
|
-
/** The forward SQL. */
|
|
215
|
-
up: z.string().min(1),
|
|
216
|
-
});
|
|
217
|
-
export type Migration = z.infer<typeof migrationSchema>;
|
|
218
|
-
|
|
219
164
|
/** Describes what an adapter's backend supports, so callers check a capability rather than infer it from behavior. */
|
|
220
165
|
export const adapterCapabilitiesSchema = z.object({
|
|
221
166
|
/** `commit` is atomic across all operations in the change set. */
|
|
@@ -255,6 +200,13 @@ const _echoContractInSync: [_AssertEchoMatchesWire, _AssertWireMatchesEcho] = [
|
|
|
255
200
|
];
|
|
256
201
|
void _echoContractInSync;
|
|
257
202
|
|
|
203
|
+
// Compatibility façade. New implementation code follows the owned subsystem
|
|
204
|
+
// downward from `outbox/index.ts` and imports migrations from `migration.ts`.
|
|
205
|
+
export { eventsPageSchema, outboxEventSchema } from '../outbox/contract.js';
|
|
206
|
+
export type { EventsPage, OutboxEvent } from '../outbox/contract.js';
|
|
207
|
+
export { migrationSchema } from './migration.js';
|
|
208
|
+
export type { Migration } from './migration.js';
|
|
209
|
+
|
|
258
210
|
type _AssertEchoMarkerMatchesWire = SourceCommitEchoMarkerWire extends SourceCommitEchoMarker
|
|
259
211
|
? true
|
|
260
212
|
: never;
|
|
@@ -41,18 +41,18 @@ import type {
|
|
|
41
41
|
AdapterReadRequest,
|
|
42
42
|
DataSourceAdapter,
|
|
43
43
|
Row,
|
|
44
|
-
} from '
|
|
45
|
-
import { defineDatabaseAdapter } from '
|
|
46
|
-
import { postgresAdapterProfile } from '
|
|
47
|
-
import type { ChangeSet,
|
|
48
|
-
import {
|
|
49
|
-
import { adapterTableMigrations } from '
|
|
44
|
+
} from './adapter.js';
|
|
45
|
+
import { defineDatabaseAdapter } from './adapterFactory.js';
|
|
46
|
+
import { postgresAdapterProfile } from './adapterProfile.js';
|
|
47
|
+
import type { ChangeSet, Operation } from './contract.js';
|
|
48
|
+
import type { Migration } from './migration.js';
|
|
49
|
+
import { adapterTableMigrations } from './migrations.js';
|
|
50
50
|
import {
|
|
51
51
|
assertSourceIdempotencyIntent,
|
|
52
52
|
assertSourceIdempotencyRetention,
|
|
53
53
|
SOURCE_IDEMPOTENCY_RETENTION,
|
|
54
54
|
sourceChangeIntentHash,
|
|
55
|
-
} from '
|
|
55
|
+
} from './idempotency.js';
|
|
56
56
|
import type { Schema, SchemaRecord } from '../../schema/schema.js';
|
|
57
57
|
import { toSchemaJSON } from '../../schema/serialize.js';
|
|
58
58
|
import { camelToSnake, snakeToCamel } from '../../schema/ddl.js';
|
|
@@ -66,7 +66,12 @@ import {
|
|
|
66
66
|
sourceSyncGroups,
|
|
67
67
|
sourceSubjectRule,
|
|
68
68
|
sourceSubjectValues,
|
|
69
|
-
} from '
|
|
69
|
+
} from './subjectAuthorization.js';
|
|
70
|
+
import {
|
|
71
|
+
decodeDatabaseOutboxEvent,
|
|
72
|
+
ENDPOINT_OUTBOX_PRUNE_BATCH_SIZE,
|
|
73
|
+
type EventsPage,
|
|
74
|
+
} from '../outbox/index.js';
|
|
70
75
|
|
|
71
76
|
/** The subset of a Drizzle database/transaction handle the adapter calls. */
|
|
72
77
|
export interface DrizzleLike {
|
|
@@ -287,12 +292,12 @@ export function drizzleDataSource<S extends SchemaRecord>(
|
|
|
287
292
|
)}]::text[]`;
|
|
288
293
|
await tx.execute(sql`
|
|
289
294
|
INSERT INTO ablo_outbox (
|
|
290
|
-
id, model, entity_id, type, data, sync_groups,
|
|
295
|
+
id, model, entity_id, type, data, event_version, sync_groups,
|
|
291
296
|
correlation_id, transaction_id, occurred_at
|
|
292
297
|
)
|
|
293
298
|
VALUES (
|
|
294
299
|
${`${change.correlationId}:${index}`}, ${op.model}, ${entityId}, ${op.type},
|
|
295
|
-
${op.type === 'DELETE' ? null : JSON.stringify(row)}::jsonb,
|
|
300
|
+
${op.type === 'DELETE' ? null : JSON.stringify(row)}::jsonb, 2,
|
|
296
301
|
${syncGroupsSql},
|
|
297
302
|
${change.correlationId}, ${op.transactionId ?? null}, ${Date.now()}
|
|
298
303
|
)`);
|
|
@@ -313,30 +318,27 @@ export function drizzleDataSource<S extends SchemaRecord>(
|
|
|
313
318
|
});
|
|
314
319
|
},
|
|
315
320
|
|
|
321
|
+
async acknowledgeEvents(acknowledgedThrough: string): Promise<void> {
|
|
322
|
+
await db.transaction(async (tx) => {
|
|
323
|
+
await tx.execute(sql`
|
|
324
|
+
DELETE FROM ablo_outbox
|
|
325
|
+
WHERE cursor IN (
|
|
326
|
+
SELECT cursor FROM ablo_outbox
|
|
327
|
+
WHERE cursor <= ${acknowledgedThrough}
|
|
328
|
+
ORDER BY cursor ASC LIMIT ${ENDPOINT_OUTBOX_PRUNE_BATCH_SIZE}
|
|
329
|
+
)`);
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
|
|
316
333
|
async events(cursor: string | null, limit: number): Promise<EventsPage> {
|
|
317
334
|
const after = cursor ?? '0';
|
|
318
335
|
const rows = rowsOf(
|
|
319
336
|
await db.execute(sql`
|
|
320
|
-
SELECT cursor, id, model, entity_id, type, data, sync_groups, organization_id,
|
|
337
|
+
SELECT cursor, id, model, entity_id, type, data, event_version, sync_groups, organization_id,
|
|
321
338
|
client_tx_id, correlation_id, transaction_id, occurred_at
|
|
322
339
|
FROM ablo_outbox WHERE cursor > ${after} ORDER BY cursor ASC LIMIT ${limit}`),
|
|
323
340
|
);
|
|
324
|
-
const events = rows.map(
|
|
325
|
-
outboxEventSchema.parse({
|
|
326
|
-
id: r.id,
|
|
327
|
-
model: r.model,
|
|
328
|
-
entityId: r.entity_id,
|
|
329
|
-
type: r.type,
|
|
330
|
-
data: r.data ?? null,
|
|
331
|
-
syncGroups: r.sync_groups ?? [],
|
|
332
|
-
organizationId: r.organization_id ?? null,
|
|
333
|
-
clientTxId: r.client_tx_id ?? null,
|
|
334
|
-
correlationId: r.correlation_id ?? null,
|
|
335
|
-
transactionId: r.transaction_id ?? null,
|
|
336
|
-
occurredAt: r.occurred_at != null ? Number(r.occurred_at) : null,
|
|
337
|
-
cursor: String(r.cursor),
|
|
338
|
-
}),
|
|
339
|
-
);
|
|
341
|
+
const events = rows.map(decodeDatabaseOutboxEvent);
|
|
340
342
|
return { events, nextCursor: events.at(-1)?.cursor ?? null };
|
|
341
343
|
},
|
|
342
344
|
});
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
import { createHash } from 'node:crypto';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { AbloValidationError } from '
|
|
15
|
+
import { AbloValidationError } from '../../errors.js';
|
|
16
16
|
import {
|
|
17
17
|
COMMIT_CORRELATION_ID_MAX_LENGTH,
|
|
18
18
|
correlationIdSchema,
|
|
19
|
-
} from '
|
|
19
|
+
} from '../../commit/contract.js';
|
|
20
20
|
import type { ChangeSet, Operation } from './contract.js';
|
|
21
21
|
|
|
22
22
|
const SOURCE_ECHO_TRANSACTION_ID_PREFIX = 'ablo_echo_tx_v1:';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer-database adapter subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Start here and descend through the behavioral adapter port, mutation
|
|
5
|
+
* contract, profiles, migrations, idempotency, authorization, conformance,
|
|
6
|
+
* and concrete ORM bindings.
|
|
7
|
+
*/
|
|
8
|
+
export * from './adapter.js';
|
|
9
|
+
export * from './adapterFactory.js';
|
|
10
|
+
export * from './adapterProfile.js';
|
|
11
|
+
export * from './contract.js';
|
|
12
|
+
export * from './migration.js';
|
|
13
|
+
export * from './migrations.js';
|
|
14
|
+
export * from './idempotency.js';
|
|
15
|
+
export * from './subjectAuthorization.js';
|
|
16
|
+
export * from './conformance.js';
|
|
17
|
+
export * from './memory.js';
|
|
18
|
+
export * from './prisma.js';
|
|
19
|
+
export * from './drizzle.js';
|
|
20
|
+
export * from './kysely.js';
|