@abloatai/transaction 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONVENTIONS.md +54 -10
- package/README.md +3 -1
- package/dist/ai-sdk/modelTools.d.ts +3 -3
- package/dist/ai-sdk/modelTools.d.ts.map +1 -1
- package/dist/ai-sdk/modelTools.js +1 -1
- package/dist/ai-sdk/modelTools.js.map +1 -1
- package/dist/ai-sdk/updateTool.d.ts +5 -7
- package/dist/ai-sdk/updateTool.d.ts.map +1 -1
- package/dist/ai-sdk/updateTool.js +3 -5
- package/dist/ai-sdk/updateTool.js.map +1 -1
- package/dist/auth/capability.d.ts +5 -0
- package/dist/auth/capability.d.ts.map +1 -1
- package/dist/auth/capability.js +5 -0
- package/dist/auth/capability.js.map +1 -1
- package/dist/auth/capabilityLifecycle.d.ts +1 -1
- package/dist/auth/capabilityLifecycle.d.ts.map +1 -1
- package/dist/auth/credentialPolicy.d.ts +1 -1
- package/dist/auth/credentialPolicy.d.ts.map +1 -1
- package/dist/auth/identity.d.ts +3 -3
- package/dist/auth/identity.d.ts.map +1 -1
- package/dist/auth/identity.js +5 -5
- package/dist/auth/identity.js.map +1 -1
- package/dist/auth/index.d.ts +4 -208
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +4 -330
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +218 -0
- package/dist/auth/runtime.d.ts.map +1 -0
- package/dist/auth/runtime.js +336 -0
- package/dist/auth/runtime.js.map +1 -0
- package/dist/auth/sessionMint.d.ts +1 -1
- package/dist/auth/sessionMint.d.ts.map +1 -1
- package/dist/auth/sessionMint.js +2 -1
- package/dist/auth/sessionMint.js.map +1 -1
- package/dist/branches.d.ts +25 -21
- package/dist/branches.d.ts.map +1 -1
- package/dist/branches.js +3 -0
- package/dist/branches.js.map +1 -1
- package/dist/{coordination/awaitClaimGrant.d.ts → claims/awaitGrant.d.ts} +1 -1
- package/dist/claims/awaitGrant.d.ts.map +1 -0
- package/dist/{coordination/awaitClaimGrant.js → claims/awaitGrant.js} +4 -4
- package/dist/claims/awaitGrant.js.map +1 -0
- package/dist/{wire/claims.d.ts → claims/contract.d.ts} +1 -1
- package/dist/claims/contract.d.ts.map +1 -0
- package/dist/{wire/claims.js → claims/contract.js} +2 -2
- package/dist/claims/contract.js.map +1 -0
- package/dist/{wire/claimEvent.d.ts → claims/eventContract.d.ts} +1 -1
- package/dist/claims/eventContract.d.ts.map +1 -0
- package/dist/{wire/claimEvent.js → claims/eventContract.js} +1 -1
- package/dist/claims/eventContract.js.map +1 -0
- package/dist/{coordination → claims}/events.d.ts +7 -11
- package/dist/claims/events.d.ts.map +1 -0
- package/dist/claims/events.js +8 -0
- package/dist/claims/events.js.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.d.ts → claims/heartbeat.d.ts} +1 -1
- package/dist/claims/heartbeat.d.ts.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.js → claims/heartbeat.js} +1 -1
- package/dist/claims/heartbeat.js.map +1 -0
- package/dist/claims/index.d.ts +17 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +16 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/lifetime.d.ts +26 -0
- package/dist/claims/lifetime.d.ts.map +1 -0
- package/dist/claims/lifetime.js +62 -0
- package/dist/claims/lifetime.js.map +1 -0
- package/dist/{coordination → claims}/locator.d.ts +1 -1
- package/dist/claims/locator.d.ts.map +1 -0
- package/dist/{coordination → claims}/locator.js +2 -2
- package/dist/claims/locator.js.map +1 -0
- package/dist/{coordination/claimMeta.d.ts → claims/meta.d.ts} +1 -1
- package/dist/claims/meta.d.ts.map +1 -0
- package/dist/{coordination/claimMeta.js → claims/meta.js} +1 -1
- package/dist/claims/meta.js.map +1 -0
- package/dist/claims/routes.d.ts +59 -0
- package/dist/claims/routes.d.ts.map +1 -0
- package/dist/claims/routes.js +69 -0
- package/dist/claims/routes.js.map +1 -0
- package/dist/claims/targetConflict.d.ts.map +1 -0
- package/dist/claims/targetConflict.js.map +1 -0
- package/dist/{coordination → claims}/trace.d.ts +2 -2
- package/dist/claims/trace.d.ts.map +1 -0
- package/dist/{coordination → claims}/trace.js +5 -5
- package/dist/claims/trace.js.map +1 -0
- package/dist/{ablo.d.ts → client/ablo.d.ts} +6 -15
- package/dist/client/ablo.d.ts.map +1 -0
- package/dist/{ablo.js → client/ablo.js} +2 -2
- package/dist/client/ablo.js.map +1 -0
- package/dist/{transactionLayer.d.ts → client/contract.d.ts} +12 -14
- package/dist/client/contract.d.ts.map +1 -0
- package/dist/{transactionLayer.js → client/contract.js} +4 -5
- package/dist/client/contract.js.map +1 -0
- package/dist/{headlessClient.d.ts → client/headless.d.ts} +4 -4
- package/dist/client/headless.d.ts.map +1 -0
- package/dist/{headlessClient.js → client/headless.js} +8 -10
- package/dist/{headlessClient.js.map → client/headless.js.map} +1 -1
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.d.ts +4 -4
- package/dist/client/resources/functionalUpdate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.js +3 -3
- package/dist/client/resources/functionalUpdate.js.map +1 -0
- package/dist/{resources → client/resources}/httpResources.d.ts +92 -77
- package/dist/client/resources/httpResources.d.ts.map +1 -0
- package/dist/client/resources/httpResources.js +94 -0
- package/dist/client/resources/httpResources.js.map +1 -0
- package/dist/client/resources/modelCreate.d.ts +21 -0
- package/dist/client/resources/modelCreate.d.ts.map +1 -0
- package/dist/client/resources/modelCreate.js +49 -0
- package/dist/client/resources/modelCreate.js.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.d.ts +57 -51
- package/dist/client/resources/modelOperations.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.js +1 -1
- package/dist/client/resources/modelOperations.js.map +1 -0
- package/dist/{resources → client/resources}/mutationOptions.d.ts +4 -17
- package/dist/client/resources/mutationOptions.d.ts.map +1 -0
- package/dist/client/resources/mutationOptions.js.map +1 -0
- package/dist/client/resources/where.d.ts.map +1 -0
- package/dist/{resources → client/resources}/where.js +1 -1
- package/dist/client/resources/where.js.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.d.ts +16 -35
- package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.js +25 -18
- package/dist/client/resources/writeOptionsSchema.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
- package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
- package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
- package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
- package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
- package/dist/commit/confirmation/pendingWrite.js.map +1 -0
- package/dist/commit/contract.d.ts +1404 -0
- package/dist/commit/contract.d.ts.map +1 -0
- package/dist/{wire/commit.js → commit/contract.js} +26 -21
- package/dist/commit/contract.js.map +1 -0
- package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
- package/dist/commit/durableWrites.d.ts.map +1 -0
- package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
- package/dist/commit/durableWrites.js.map +1 -0
- package/dist/commit/httpRequest.d.ts +45 -0
- package/dist/commit/httpRequest.d.ts.map +1 -0
- package/dist/commit/httpRequest.js +66 -0
- package/dist/commit/httpRequest.js.map +1 -0
- package/dist/commit/index.d.ts +17 -0
- package/dist/commit/index.d.ts.map +1 -0
- package/dist/commit/index.js +17 -0
- package/dist/commit/index.js.map +1 -0
- package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
- package/dist/commit/readSetContext.d.ts.map +1 -0
- package/dist/{readSetContext.js → commit/readSetContext.js} +18 -28
- package/dist/commit/readSetContext.js.map +1 -0
- package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
- package/dist/commit/recordRuntime.d.ts.map +1 -0
- package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
- package/dist/commit/recordRuntime.js.map +1 -0
- package/dist/coordination/index.d.ts +6 -8
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +3 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/schema.d.ts +11 -466
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +13 -265
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +16 -9
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +14 -6
- package/dist/errorCodes.js.map +1 -1
- package/dist/errorObservation.d.ts +2 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -11
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/read-set.d.ts +3 -3
- package/dist/internal/read-set.d.ts.map +1 -1
- package/dist/internal/read-set.js +2 -2
- package/dist/internal/read-set.js.map +1 -1
- package/dist/observability.d.ts +4 -4
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +2 -2
- package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
- package/dist/observation/contract.d.ts.map +1 -0
- package/dist/{wire/delta.js → observation/contract.js} +3 -3
- package/dist/observation/contract.js.map +1 -0
- package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
- package/dist/observation/cursor.d.ts.map +1 -0
- package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
- package/dist/observation/cursor.js.map +1 -0
- package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
- package/dist/observation/deliveryContract.d.ts.map +1 -0
- package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
- package/dist/observation/deliveryContract.js.map +1 -0
- package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
- package/dist/observation/feedContract.d.ts.map +1 -0
- package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
- package/dist/observation/feedContract.js.map +1 -0
- package/dist/observation/httpFeed.d.ts +4 -0
- package/dist/observation/httpFeed.d.ts.map +1 -0
- package/dist/{transport → observation}/httpFeed.js +1 -1
- package/dist/{transport → observation}/httpFeed.js.map +1 -1
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
- package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
- package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
- package/dist/pricing.d.ts +20 -12
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +46 -26
- package/dist/pricing.js.map +1 -1
- package/dist/schema/audit.d.ts +15 -0
- package/dist/schema/audit.d.ts.map +1 -0
- package/dist/schema/audit.js +90 -0
- package/dist/schema/audit.js.map +1 -0
- package/dist/schema/ddl.d.ts.map +1 -1
- package/dist/schema/ddl.js +68 -1
- package/dist/schema/ddl.js.map +1 -1
- package/dist/schema/index.d.ts +7 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +6 -7
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +14 -27
- package/dist/schema/model.d.ts.map +1 -1
- package/dist/schema/model.js +2 -2
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +149 -8
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/roles.d.ts +27 -0
- package/dist/schema/roles.d.ts.map +1 -1
- package/dist/schema/roles.js +40 -0
- package/dist/schema/roles.js.map +1 -1
- package/dist/schema/schema.d.ts +34 -7
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +39 -3
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/serialize.d.ts +5 -5
- package/dist/schema/serialize.d.ts.map +1 -1
- package/dist/schema/serialize.js +5 -5
- package/dist/schema/serialize.js.map +1 -1
- package/dist/schema/subject.d.ts +18 -0
- package/dist/schema/subject.d.ts.map +1 -0
- package/dist/schema/subject.js +27 -0
- package/dist/schema/subject.js.map +1 -0
- package/dist/schema/tenancy.d.ts +1 -1
- package/dist/server/adapter.d.ts +3 -1
- package/dist/server/adapter.d.ts.map +1 -1
- package/dist/server/commit.d.ts +6 -14
- package/dist/server/commit.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/readConfig.d.ts +3 -0
- package/dist/server/readConfig.d.ts.map +1 -1
- package/dist/server/readConfig.js +0 -21
- package/dist/server/readConfig.js.map +1 -1
- package/dist/server/storageMode.d.ts +1 -1
- package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
- package/dist/source/adapters/adapter.d.ts.map +1 -0
- package/dist/source/adapters/adapter.js.map +1 -0
- package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
- package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
- package/dist/source/adapters/adapterFactory.js.map +1 -0
- package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
- package/dist/source/adapters/adapterProfile.js.map +1 -0
- package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
- package/dist/source/adapters/conformance.d.ts.map +1 -0
- package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
- package/dist/source/adapters/conformance.js.map +1 -0
- package/dist/source/{contract.d.ts → adapters/contract.d.ts} +20 -75
- package/dist/source/adapters/contract.d.ts.map +1 -0
- package/dist/source/{contract.js → adapters/contract.js} +20 -55
- package/dist/source/adapters/contract.js.map +1 -0
- package/dist/source/adapters/drizzle.d.ts +1 -1
- package/dist/source/adapters/drizzle.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.js +54 -25
- package/dist/source/adapters/drizzle.js.map +1 -1
- package/dist/source/adapters/idempotency.d.ts.map +1 -0
- package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
- package/dist/source/adapters/idempotency.js.map +1 -0
- package/dist/source/adapters/index.d.ts +21 -0
- package/dist/source/adapters/index.d.ts.map +1 -0
- package/dist/source/adapters/index.js +21 -0
- package/dist/source/adapters/index.js.map +1 -0
- package/dist/source/adapters/kysely.d.ts +3 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +49 -23
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +6 -3
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +17 -8
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
- package/dist/source/adapters/memory.d.ts +3 -3
- package/dist/source/adapters/memory.d.ts.map +1 -1
- package/dist/source/adapters/memory.js +20 -7
- package/dist/source/adapters/memory.js.map +1 -1
- package/dist/source/adapters/migration.d.ts +8 -0
- package/dist/source/adapters/migration.d.ts.map +1 -0
- package/dist/source/adapters/migration.js +9 -0
- package/dist/source/adapters/migration.js.map +1 -0
- package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
- package/dist/source/adapters/migrations.d.ts.map +1 -0
- package/dist/source/{migrations.js → adapters/migrations.js} +4 -31
- package/dist/source/adapters/migrations.js.map +1 -0
- package/dist/source/adapters/prisma.d.ts +1 -1
- package/dist/source/adapters/prisma.d.ts.map +1 -1
- package/dist/source/adapters/prisma.js +75 -30
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/adapters/subjectAuthorization.d.ts +16 -0
- package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
- package/dist/source/adapters/subjectAuthorization.js +126 -0
- package/dist/source/adapters/subjectAuthorization.js.map +1 -0
- package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
- package/dist/source/connector/client.d.ts.map +1 -0
- package/dist/source/{connector.js → connector/client.js} +28 -11
- package/dist/source/connector/client.js.map +1 -0
- package/dist/source/connector/index.d.ts +4 -0
- package/dist/source/connector/index.d.ts.map +1 -0
- package/dist/source/connector/index.js +4 -0
- package/dist/source/connector/index.js.map +1 -0
- package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
- package/dist/source/connector/protocol.d.ts.map +1 -0
- package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
- package/dist/source/connector/protocol.js.map +1 -0
- package/dist/source/delivery/index.d.ts +3 -0
- package/dist/source/delivery/index.d.ts.map +1 -0
- package/dist/source/delivery/index.js +3 -0
- package/dist/source/delivery/index.js.map +1 -0
- package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
- package/dist/source/delivery/pushQueue.d.ts.map +1 -0
- package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
- package/dist/source/delivery/pushQueue.js.map +1 -0
- package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +9 -3
- package/dist/source/endpoint/factory.d.ts.map +1 -0
- package/dist/source/{factory.js → endpoint/factory.js} +122 -6
- package/dist/source/endpoint/factory.js.map +1 -0
- package/dist/source/endpoint/index.d.ts +5 -0
- package/dist/source/endpoint/index.d.ts.map +1 -0
- package/dist/source/endpoint/index.js +5 -0
- package/dist/source/endpoint/index.js.map +1 -0
- package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
- package/dist/source/endpoint/next.d.ts.map +1 -0
- package/dist/source/{next.js → endpoint/next.js} +1 -1
- package/dist/source/endpoint/next.js.map +1 -0
- package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
- package/dist/source/endpoint/signing.d.ts.map +1 -0
- package/dist/source/{signing.js → endpoint/signing.js} +1 -1
- package/dist/source/endpoint/signing.js.map +1 -0
- package/dist/source/index.d.ts +15 -12
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +13 -10
- package/dist/source/index.js.map +1 -1
- package/dist/source/outbox/contract.d.ts +50 -0
- package/dist/source/outbox/contract.d.ts.map +1 -0
- package/dist/source/outbox/contract.js +50 -0
- package/dist/source/outbox/contract.js.map +1 -0
- package/dist/source/outbox/envelope.d.ts +9 -0
- package/dist/source/outbox/envelope.d.ts.map +1 -0
- package/dist/source/outbox/envelope.js +36 -0
- package/dist/source/outbox/envelope.js.map +1 -0
- package/dist/source/outbox/index.d.ts +11 -0
- package/dist/source/outbox/index.d.ts.map +1 -0
- package/dist/source/outbox/index.js +11 -0
- package/dist/source/outbox/index.js.map +1 -0
- package/dist/source/outbox/migrations.d.ts +4 -0
- package/dist/source/outbox/migrations.d.ts.map +1 -0
- package/dist/source/outbox/migrations.js +67 -0
- package/dist/source/outbox/migrations.js.map +1 -0
- package/dist/source/outbox/retention.d.ts +3 -0
- package/dist/source/outbox/retention.d.ts.map +1 -0
- package/dist/source/outbox/retention.js +3 -0
- package/dist/source/outbox/retention.js.map +1 -0
- package/dist/source/types.d.ts +59 -10
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js +2 -0
- package/dist/source/types.js.map +1 -1
- package/dist/syncLog/contract.d.ts +19 -8
- package/dist/syncLog/contract.d.ts.map +1 -1
- package/dist/syncLog/contract.js +19 -6
- package/dist/syncLog/contract.js.map +1 -1
- package/dist/testing/fixtures/httpResponses.d.ts +6 -0
- package/dist/testing/fixtures/httpResponses.d.ts.map +1 -1
- package/dist/testing/fixtures/httpResponses.js +1 -0
- package/dist/testing/fixtures/httpResponses.js.map +1 -1
- package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
- package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
- package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
- package/dist/transport/connection/credentialLifecycle.js.map +1 -0
- package/dist/transport/connection/index.d.ts +5 -0
- package/dist/transport/connection/index.d.ts.map +1 -0
- package/dist/transport/connection/index.js +5 -0
- package/dist/transport/connection/index.js.map +1 -0
- package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
- package/dist/transport/connection/manager.d.ts.map +1 -0
- package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
- package/dist/transport/connection/manager.js.map +1 -0
- package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
- package/dist/transport/connection/networkProbe.d.ts.map +1 -0
- package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
- package/dist/transport/connection/networkProbe.js.map +1 -0
- package/dist/transport/{httpClient.d.ts → http/client.d.ts} +32 -44
- package/dist/transport/http/client.d.ts.map +1 -0
- package/dist/transport/{httpClient.js → http/client.js} +96 -105
- package/dist/transport/http/client.js.map +1 -0
- package/dist/transport/http/helpers.d.ts +10 -0
- package/dist/transport/http/helpers.d.ts.map +1 -0
- package/dist/transport/http/helpers.js +46 -0
- package/dist/transport/http/helpers.js.map +1 -0
- package/dist/transport/http/index.d.ts +6 -0
- package/dist/transport/http/index.d.ts.map +1 -0
- package/dist/transport/http/index.js +6 -0
- package/dist/transport/http/index.js.map +1 -0
- package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
- package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
- package/dist/transport/{httpOptions.js → http/options.js} +1 -1
- package/dist/transport/http/options.js.map +1 -0
- package/dist/transport/http/subscription.d.ts +16 -0
- package/dist/transport/http/subscription.d.ts.map +1 -0
- package/dist/transport/http/subscription.js +146 -0
- package/dist/transport/http/subscription.js.map +1 -0
- package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
- package/dist/transport/http/transport.d.ts.map +1 -0
- package/dist/transport/{httpTransport.js → http/transport.js} +153 -188
- package/dist/transport/http/transport.js.map +1 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
- package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
- package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
- package/dist/transport/websocket/commitFrames.js.map +1 -0
- package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
- package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
- package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
- package/dist/transport/websocket/frameHandlers.js.map +1 -0
- package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
- package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
- package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
- package/dist/transport/websocket/heartbeat.js.map +1 -0
- package/dist/transport/websocket/index.d.ts +6 -0
- package/dist/transport/websocket/index.d.ts.map +1 -0
- package/dist/transport/websocket/index.js +6 -0
- package/dist/transport/websocket/index.js.map +1 -0
- package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
- package/dist/transport/websocket/transport.d.ts.map +1 -0
- package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
- package/dist/transport/websocket/transport.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/streams.d.ts +8 -48
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +2 -2
- package/dist/wire/accountResponses.d.ts +4 -72
- package/dist/wire/accountResponses.d.ts.map +1 -1
- package/dist/wire/accountResponses.js +2 -10
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/apiLifecycle.d.ts +63 -0
- package/dist/wire/apiLifecycle.d.ts.map +1 -0
- package/dist/wire/apiLifecycle.js +89 -0
- package/dist/wire/apiLifecycle.js.map +1 -0
- package/dist/wire/frames.d.ts +6 -83
- package/dist/wire/frames.d.ts.map +1 -1
- package/dist/wire/frames.js +4 -11
- package/dist/wire/frames.js.map +1 -1
- package/dist/wire/inboundFrames.d.ts +6 -131
- package/dist/wire/inboundFrames.d.ts.map +1 -1
- package/dist/wire/inboundFrames.js +3 -3
- package/dist/wire/inboundFrames.js.map +1 -1
- package/dist/wire/index.d.ts +20 -15
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +22 -8
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/modelMutations.d.ts +1 -32
- package/dist/wire/modelMutations.d.ts.map +1 -1
- package/dist/wire/modelMutations.js +1 -8
- package/dist/wire/modelMutations.js.map +1 -1
- package/dist/wire/rateLimit.d.ts +82 -0
- package/dist/wire/rateLimit.d.ts.map +1 -0
- package/dist/wire/rateLimit.js +142 -0
- package/dist/wire/rateLimit.js.map +1 -0
- package/package.json +130 -10
- package/src/ai-sdk/modelTools.ts +5 -5
- package/src/ai-sdk/updateTool.ts +5 -7
- package/src/auth/capability.ts +5 -0
- package/src/auth/capabilityLifecycle.ts +1 -1
- package/src/auth/credentialPolicy.ts +1 -1
- package/src/auth/identity.ts +7 -7
- package/src/auth/index.ts +4 -663
- package/src/auth/runtime.ts +669 -0
- package/src/auth/sessionMint.ts +3 -2
- package/src/branches.ts +3 -0
- package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
- package/src/{wire/claims.ts → claims/contract.ts} +1 -1
- package/src/{coordination → claims}/events.ts +7 -11
- package/src/claims/index.ts +21 -0
- package/src/claims/lifetime.ts +78 -0
- package/src/{coordination → claims}/locator.ts +3 -3
- package/src/claims/routes.ts +81 -0
- package/src/{coordination → claims}/trace.ts +5 -5
- package/src/{ablo.ts → client/ablo.ts} +8 -20
- package/src/{transactionLayer.ts → client/contract.ts} +11 -13
- package/src/{headlessClient.ts → client/headless.ts} +13 -15
- package/src/client/index.ts +10 -0
- package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
- package/src/{resources → client/resources}/httpResources.ts +163 -92
- package/src/client/resources/modelCreate.ts +73 -0
- package/src/{resources → client/resources}/modelOperations.ts +73 -55
- package/src/{resources → client/resources}/mutationOptions.ts +4 -17
- package/src/{resources → client/resources}/where.ts +1 -1
- package/src/{resources → client/resources}/writeOptionsSchema.ts +35 -27
- package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
- package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
- package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
- package/src/{wire/commit.ts → commit/contract.ts} +27 -26
- package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
- package/src/commit/httpRequest.ts +103 -0
- package/src/commit/index.ts +16 -0
- package/src/{readSetContext.ts → commit/readSetContext.ts} +24 -43
- package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
- package/src/coordination/index.ts +4 -54
- package/src/coordination/schema.ts +15 -309
- package/src/errorCodes.ts +62 -10
- package/src/errors.ts +32 -10
- package/src/index.ts +8 -8
- package/src/internal/read-set.ts +3 -6
- package/src/observability.ts +4 -4
- package/src/{wire/delta.ts → observation/contract.ts} +2 -2
- package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
- package/src/{transport → observation}/httpFeed.ts +3 -3
- package/src/observation/index.ts +12 -0
- package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
- package/src/pricing.ts +46 -25
- package/src/schema/audit.ts +121 -0
- package/src/schema/ddl.ts +71 -1
- package/src/schema/index.ts +20 -20
- package/src/schema/model.ts +17 -33
- package/src/schema/openapi.ts +170 -9
- package/src/schema/roles.ts +53 -0
- package/src/schema/schema.ts +91 -6
- package/src/schema/serialize.ts +8 -9
- package/src/schema/subject.ts +43 -0
- package/src/server/adapter.ts +3 -1
- package/src/server/commit.ts +6 -14
- package/src/server/index.ts +1 -1
- package/src/server/readConfig.ts +4 -0
- package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
- package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
- package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
- package/src/source/{contract.ts → adapters/contract.ts} +24 -61
- package/src/source/adapters/drizzle.ts +75 -29
- package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
- package/src/source/adapters/index.ts +20 -0
- package/src/source/adapters/kysely.ts +77 -27
- package/src/source/adapters/kyselyMutationCore.ts +23 -11
- package/src/source/adapters/memory.ts +26 -9
- package/src/source/adapters/migration.ts +11 -0
- package/src/source/{migrations.ts → adapters/migrations.ts} +6 -33
- package/src/source/adapters/prisma.ts +98 -34
- package/src/source/adapters/subjectAuthorization.ts +182 -0
- package/src/source/{connector.ts → connector/client.ts} +35 -12
- package/src/source/connector/index.ts +3 -0
- package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
- package/src/source/delivery/index.ts +2 -0
- package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
- package/src/source/{factory.ts → endpoint/factory.ts} +150 -9
- package/src/source/endpoint/index.ts +4 -0
- package/src/source/{next.ts → endpoint/next.ts} +2 -2
- package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
- package/src/source/index.ts +27 -18
- package/src/source/outbox/contract.ts +56 -0
- package/src/source/outbox/envelope.ts +47 -0
- package/src/source/outbox/index.ts +15 -0
- package/src/source/outbox/migrations.ts +71 -0
- package/src/source/outbox/retention.ts +2 -0
- package/src/source/types.ts +64 -10
- package/src/syncLog/contract.ts +19 -9
- package/src/testing/fixtures/httpResponses.ts +7 -0
- package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
- package/src/transport/connection/index.ts +4 -0
- package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
- package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
- package/src/transport/{httpClient.ts → http/client.ts} +165 -184
- package/src/transport/http/helpers.ts +63 -0
- package/src/transport/http/index.ts +5 -0
- package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
- package/src/transport/http/subscription.ts +174 -0
- package/src/transport/{httpTransport.ts → http/transport.ts} +210 -246
- package/src/transport/index.ts +7 -0
- package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
- package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
- package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
- package/src/transport/websocket/index.ts +5 -0
- package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
- package/src/types/index.ts +2 -6
- package/src/types/streams.ts +7 -61
- package/src/webhooks/events.ts +1 -1
- package/src/wire/accountResponses.ts +3 -12
- package/src/wire/apiLifecycle.ts +94 -0
- package/src/wire/frames.ts +5 -15
- package/src/wire/inboundFrames.ts +3 -3
- package/src/wire/index.ts +50 -15
- package/src/wire/modelMutations.ts +1 -14
- package/src/wire/rateLimit.ts +155 -0
- package/dist/ablo.d.ts.map +0 -1
- package/dist/ablo.js.map +0 -1
- package/dist/commitRecordRuntime.d.ts.map +0 -1
- package/dist/commitRecordRuntime.js.map +0 -1
- package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
- package/dist/coordination/awaitClaimGrant.js.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
- package/dist/coordination/claimMeta.d.ts.map +0 -1
- package/dist/coordination/claimMeta.js.map +0 -1
- package/dist/coordination/events.d.ts.map +0 -1
- package/dist/coordination/events.js +0 -8
- package/dist/coordination/events.js.map +0 -1
- package/dist/coordination/locator.d.ts.map +0 -1
- package/dist/coordination/locator.js.map +0 -1
- package/dist/coordination/targetConflict.d.ts.map +0 -1
- package/dist/coordination/targetConflict.js.map +0 -1
- package/dist/coordination/trace.d.ts.map +0 -1
- package/dist/coordination/trace.js.map +0 -1
- package/dist/durableWrites.d.ts.map +0 -1
- package/dist/durableWrites.js.map +0 -1
- package/dist/headlessClient.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.js.map +0 -1
- package/dist/policy/types.d.ts +0 -226
- package/dist/policy/types.d.ts.map +0 -1
- package/dist/policy/types.js +0 -127
- package/dist/policy/types.js.map +0 -1
- package/dist/readSetContext.d.ts.map +0 -1
- package/dist/readSetContext.js.map +0 -1
- package/dist/resources/functionalUpdate.d.ts.map +0 -1
- package/dist/resources/functionalUpdate.js.map +0 -1
- package/dist/resources/httpResources.d.ts.map +0 -1
- package/dist/resources/httpResources.js +0 -17
- package/dist/resources/httpResources.js.map +0 -1
- package/dist/resources/modelOperations.d.ts.map +0 -1
- package/dist/resources/modelOperations.js.map +0 -1
- package/dist/resources/mutationOptions.d.ts.map +0 -1
- package/dist/resources/mutationOptions.js.map +0 -1
- package/dist/resources/where.d.ts.map +0 -1
- package/dist/resources/where.js.map +0 -1
- package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
- package/dist/resources/writeOptionsSchema.js.map +0 -1
- package/dist/schema/coordination.d.ts +0 -113
- package/dist/schema/coordination.d.ts.map +0 -1
- package/dist/schema/coordination.js +0 -134
- package/dist/schema/coordination.js.map +0 -1
- package/dist/source/adapter.d.ts.map +0 -1
- package/dist/source/adapter.js.map +0 -1
- package/dist/source/adapterFactory.d.ts.map +0 -1
- package/dist/source/adapterFactory.js.map +0 -1
- package/dist/source/adapterProfile.d.ts.map +0 -1
- package/dist/source/adapterProfile.js.map +0 -1
- package/dist/source/conformance.d.ts.map +0 -1
- package/dist/source/conformance.js.map +0 -1
- package/dist/source/connector.d.ts.map +0 -1
- package/dist/source/connector.js.map +0 -1
- package/dist/source/connectorProtocol.d.ts.map +0 -1
- package/dist/source/connectorProtocol.js.map +0 -1
- package/dist/source/contract.d.ts.map +0 -1
- package/dist/source/contract.js.map +0 -1
- package/dist/source/drizzle.d.ts +0 -2
- package/dist/source/drizzle.d.ts.map +0 -1
- package/dist/source/drizzle.js +0 -2
- package/dist/source/drizzle.js.map +0 -1
- package/dist/source/factory.d.ts.map +0 -1
- package/dist/source/factory.js.map +0 -1
- package/dist/source/idempotency.d.ts.map +0 -1
- package/dist/source/idempotency.js.map +0 -1
- package/dist/source/kysely.d.ts +0 -3
- package/dist/source/kysely.d.ts.map +0 -1
- package/dist/source/kysely.js +0 -3
- package/dist/source/kysely.js.map +0 -1
- package/dist/source/migrations.d.ts.map +0 -1
- package/dist/source/migrations.js.map +0 -1
- package/dist/source/next.d.ts.map +0 -1
- package/dist/source/next.js.map +0 -1
- package/dist/source/pushQueue.d.ts.map +0 -1
- package/dist/source/pushQueue.js.map +0 -1
- package/dist/source/signing.d.ts.map +0 -1
- package/dist/source/signing.js.map +0 -1
- package/dist/transactionLayer.d.ts.map +0 -1
- package/dist/transactionLayer.js.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
- package/dist/transport/commitFrames.d.ts.map +0 -1
- package/dist/transport/commitFrames.js.map +0 -1
- package/dist/transport/connectionManager.d.ts.map +0 -1
- package/dist/transport/connectionManager.js.map +0 -1
- package/dist/transport/credentialLifecycle.d.ts.map +0 -1
- package/dist/transport/credentialLifecycle.js.map +0 -1
- package/dist/transport/heartbeat.d.ts.map +0 -1
- package/dist/transport/heartbeat.js.map +0 -1
- package/dist/transport/httpClient.d.ts.map +0 -1
- package/dist/transport/httpClient.js.map +0 -1
- package/dist/transport/httpFeed.d.ts +0 -4
- package/dist/transport/httpFeed.d.ts.map +0 -1
- package/dist/transport/httpOptions.js.map +0 -1
- package/dist/transport/httpTransport.d.ts.map +0 -1
- package/dist/transport/httpTransport.js.map +0 -1
- package/dist/transport/networkProbe.d.ts.map +0 -1
- package/dist/transport/networkProbe.js.map +0 -1
- package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
- package/dist/transport/wsFrameHandlers.js.map +0 -1
- package/dist/transport/wsTransport.d.ts.map +0 -1
- package/dist/transport/wsTransport.js.map +0 -1
- package/dist/wire/claimEvent.d.ts.map +0 -1
- package/dist/wire/claimEvent.js.map +0 -1
- package/dist/wire/claims.d.ts.map +0 -1
- package/dist/wire/claims.js.map +0 -1
- package/dist/wire/commit.d.ts +0 -2801
- package/dist/wire/commit.d.ts.map +0 -1
- package/dist/wire/commit.js.map +0 -1
- package/dist/wire/delta.d.ts.map +0 -1
- package/dist/wire/delta.js.map +0 -1
- package/dist/wire/deltaDelivery.d.ts.map +0 -1
- package/dist/wire/deltaDelivery.js.map +0 -1
- package/dist/wire/feedCursor.d.ts.map +0 -1
- package/dist/wire/feedCursor.js.map +0 -1
- package/dist/wire/feedEvent.d.ts.map +0 -1
- package/dist/wire/feedEvent.js.map +0 -1
- package/src/policy/types.ts +0 -300
- package/src/schema/coordination.ts +0 -161
- package/src/source/drizzle.ts +0 -1
- package/src/source/kysely.ts +0 -2
- /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
- /package/dist/{coordination → claims}/targetConflict.js +0 -0
- /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
- /package/dist/{resources → client/resources}/where.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
- /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
- /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
- /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
- /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
- /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
- /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
- /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
- /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
- /package/src/{coordination → claims}/targetConflict.ts +0 -0
- /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
- /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
- /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
- /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
package/src/source/index.ts
CHANGED
|
@@ -37,6 +37,8 @@ export {
|
|
|
37
37
|
type SourceHandlerContext,
|
|
38
38
|
type SourceModelHandlers,
|
|
39
39
|
type SourceCommitHandler,
|
|
40
|
+
type SourceSubjectTransactionBoundary,
|
|
41
|
+
type SourceSubjectTransactionHandler,
|
|
40
42
|
type SourceApiKey,
|
|
41
43
|
type SourceLoadRequest,
|
|
42
44
|
type SourceListRequest,
|
|
@@ -54,12 +56,16 @@ export {
|
|
|
54
56
|
type SourceSignatureOptions,
|
|
55
57
|
type SourceSignatureVerificationOptions,
|
|
56
58
|
type SourceSignatureVerificationResult,
|
|
57
|
-
} from './signing.js';
|
|
59
|
+
} from './endpoint/signing.js';
|
|
58
60
|
|
|
59
61
|
export {
|
|
60
62
|
dataSource,
|
|
61
63
|
type DataSourceOptions,
|
|
62
|
-
} from './factory.js';
|
|
64
|
+
} from './endpoint/factory.js';
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
sourceSubjectCreateLockKey,
|
|
68
|
+
} from './adapters/subjectAuthorization.js';
|
|
63
69
|
|
|
64
70
|
export {
|
|
65
71
|
createPushQueue,
|
|
@@ -69,7 +75,7 @@ export {
|
|
|
69
75
|
type PushQueueItem,
|
|
70
76
|
type PushQueueOptions,
|
|
71
77
|
type PushQueueStorage,
|
|
72
|
-
} from './pushQueue.js';
|
|
78
|
+
} from './delivery/pushQueue.js';
|
|
73
79
|
|
|
74
80
|
// The reverse-channel connector — an outbound transport for the load, list, and
|
|
75
81
|
// commit leg, and the dial-out counterpart to `createPushQueue`. It lets you serve
|
|
@@ -78,14 +84,16 @@ export {
|
|
|
78
84
|
export {
|
|
79
85
|
createSourceConnector,
|
|
80
86
|
DEFAULT_RECONNECT_SCHEDULE,
|
|
87
|
+
SourceConnectorSupersededError,
|
|
81
88
|
type SourceConnector,
|
|
82
89
|
type SourceConnectorOptions,
|
|
83
90
|
type ConnectorWebSocket,
|
|
84
91
|
type ConnectorWebSocketFactory,
|
|
85
92
|
type ConnectorStatus,
|
|
86
|
-
} from './connector.js';
|
|
93
|
+
} from './connector/client.js';
|
|
87
94
|
export {
|
|
88
95
|
SOURCE_CONNECTOR_PROTOCOL_VERSION,
|
|
96
|
+
SOURCE_CONNECTOR_SUPERSEDED_CLOSE_CODE,
|
|
89
97
|
SOURCE_CONNECTOR_WS_PATH,
|
|
90
98
|
WS_SOURCE_SUBPROTOCOL,
|
|
91
99
|
sourceConnectorSubprotocols,
|
|
@@ -99,7 +107,7 @@ export {
|
|
|
99
107
|
type RequestFrame,
|
|
100
108
|
type ResponseFrame,
|
|
101
109
|
type ErrorFrame,
|
|
102
|
-
} from './
|
|
110
|
+
} from './connector/protocol.js';
|
|
103
111
|
|
|
104
112
|
// The Data Source adapter interface and its Zod contract, with per-ORM implementations.
|
|
105
113
|
export {
|
|
@@ -108,7 +116,7 @@ export {
|
|
|
108
116
|
type AdapterReadRequest,
|
|
109
117
|
type AdapterCommitResult,
|
|
110
118
|
type Row as AdapterRow,
|
|
111
|
-
} from './adapter.js';
|
|
119
|
+
} from './adapters/adapter.js';
|
|
112
120
|
export {
|
|
113
121
|
adapterBindingSchema,
|
|
114
122
|
databaseAdapterProfileSchema,
|
|
@@ -121,8 +129,8 @@ export {
|
|
|
121
129
|
type DatabaseKind,
|
|
122
130
|
type ObservationProfile,
|
|
123
131
|
type PostgresBinding,
|
|
124
|
-
} from './adapterProfile.js';
|
|
125
|
-
export { defineDatabaseAdapter } from './adapterFactory.js';
|
|
132
|
+
} from './adapters/adapterProfile.js';
|
|
133
|
+
export { defineDatabaseAdapter } from './adapters/adapterFactory.js';
|
|
126
134
|
export {
|
|
127
135
|
operationSchema,
|
|
128
136
|
operationTypeSchema,
|
|
@@ -131,25 +139,26 @@ export {
|
|
|
131
139
|
sourceCommitEchoMarkerSchema,
|
|
132
140
|
sourceCommitEchoIntentSchema,
|
|
133
141
|
changeSetSchema,
|
|
134
|
-
outboxEventSchema,
|
|
135
|
-
eventsPageSchema,
|
|
136
|
-
migrationSchema,
|
|
137
142
|
adapterCapabilitiesSchema,
|
|
138
143
|
type Operation,
|
|
139
144
|
type ChangeSet,
|
|
140
|
-
type OutboxEvent,
|
|
141
|
-
type EventsPage,
|
|
142
|
-
type Migration,
|
|
143
145
|
type AdapterCapabilities,
|
|
144
146
|
type SourceCommitEchoMarkerWire,
|
|
145
147
|
type SourceCommitEchoIntent,
|
|
146
|
-
} from './contract.js';
|
|
148
|
+
} from './adapters/contract.js';
|
|
149
|
+
export { migrationSchema, type Migration } from './adapters/migration.js';
|
|
150
|
+
export {
|
|
151
|
+
endpointOutboxMigrations,
|
|
152
|
+
eventsPageSchema,
|
|
153
|
+
outboxEventSchema,
|
|
154
|
+
type EventsPage,
|
|
155
|
+
type OutboxEvent,
|
|
156
|
+
} from './outbox/index.js';
|
|
147
157
|
export { prismaDataSource, type PrismaLike, type PrismaDataSourceOptions } from './adapters/prisma.js';
|
|
148
158
|
export {
|
|
149
159
|
adapterTableMigrations,
|
|
150
|
-
endpointOutboxMigrations,
|
|
151
160
|
idempotencyLedgerMigrations,
|
|
152
|
-
} from './migrations.js';
|
|
161
|
+
} from './adapters/migrations.js';
|
|
153
162
|
export {
|
|
154
163
|
createKyselyMutationAdapter,
|
|
155
164
|
createKyselyMutationCore,
|
|
@@ -177,7 +186,7 @@ export {
|
|
|
177
186
|
encodeSourceEchoTransactionId,
|
|
178
187
|
decodeSourceEchoTransactionId,
|
|
179
188
|
type SourceEchoTransactionId,
|
|
180
|
-
} from './idempotency.js';
|
|
189
|
+
} from './adapters/idempotency.js';
|
|
181
190
|
// What Ablo leaves inside a customer's database, declared once — read by the
|
|
182
191
|
// setup SQL, the replication runtime, and the audit that reports it back.
|
|
183
192
|
export {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { commitOperationTypeSchema } from '../../coordination/schema.js';
|
|
3
|
+
import { correlationIdSchema } from '../../commit/contract.js';
|
|
4
|
+
import { ABLO_SOURCE_CLIENT_TX_ID_MAX_LENGTH } from '../types.js';
|
|
5
|
+
|
|
6
|
+
const jsonObject = z.record(z.string(), z.unknown());
|
|
7
|
+
|
|
8
|
+
/** The immutable, versioned event envelope stored in `ablo_outbox`. */
|
|
9
|
+
export const outboxEventSchema = z.object({
|
|
10
|
+
/** Version 1 predates durable routes; version 2 captures them atomically. */
|
|
11
|
+
version: z.union([z.literal(1), z.literal(2)]),
|
|
12
|
+
/** Stable, globally unique replay-protection identity. */
|
|
13
|
+
id: z.string().min(1),
|
|
14
|
+
model: z.string().min(1),
|
|
15
|
+
entityId: z.string().min(1),
|
|
16
|
+
type: commitOperationTypeSchema,
|
|
17
|
+
/** Declared schema-field names, never physical database column names. */
|
|
18
|
+
data: jsonObject.nullish(),
|
|
19
|
+
/** Exact routes captured in the writing transaction; version 2 requires them. */
|
|
20
|
+
syncGroups: z.array(z.string().min(1)).readonly().optional(),
|
|
21
|
+
organizationId: z.string().nullish(),
|
|
22
|
+
clientTxId: z.string().nullish(),
|
|
23
|
+
correlationId: correlationIdSchema.nullish(),
|
|
24
|
+
transactionId: z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(ABLO_SOURCE_CLIENT_TX_ID_MAX_LENGTH)
|
|
28
|
+
.nullish(),
|
|
29
|
+
occurredAt: z.number().nullish(),
|
|
30
|
+
/** Monotonic database position, represented as a string to preserve bigint. */
|
|
31
|
+
cursor: z.string().min(1),
|
|
32
|
+
}).superRefine((event, ctx) => {
|
|
33
|
+
if (event.version === 1 && event.syncGroups !== undefined) {
|
|
34
|
+
ctx.addIssue({
|
|
35
|
+
code: 'custom',
|
|
36
|
+
path: ['syncGroups'],
|
|
37
|
+
message: 'Outbox event version 1 cannot carry syncGroups',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (event.version === 2 && event.syncGroups === undefined) {
|
|
41
|
+
ctx.addIssue({
|
|
42
|
+
code: 'custom',
|
|
43
|
+
path: ['syncGroups'],
|
|
44
|
+
message: 'Outbox event version 2 requires durable syncGroups',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export type OutboxEvent = z.infer<typeof outboxEventSchema>;
|
|
50
|
+
|
|
51
|
+
export const eventsPageSchema = z.object({
|
|
52
|
+
events: z.array(outboxEventSchema),
|
|
53
|
+
nextCursor: z.string().nullable(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export type EventsPage = z.infer<typeof eventsPageSchema>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AbloValidationError } from '../../errors.js';
|
|
2
|
+
import { outboxEventSchema, type OutboxEvent } from './contract.js';
|
|
3
|
+
|
|
4
|
+
/** Decode the versioned routing envelope without turning absence into `[]`. */
|
|
5
|
+
export function decodeOutboxEventEnvelope(
|
|
6
|
+
eventVersion: unknown,
|
|
7
|
+
syncGroups: unknown,
|
|
8
|
+
cursor: unknown,
|
|
9
|
+
): { readonly version: 1 | 2; readonly syncGroups?: readonly string[] } {
|
|
10
|
+
const version = eventVersion == null
|
|
11
|
+
? (Array.isArray(syncGroups) ? 2 : 1)
|
|
12
|
+
: Number(eventVersion);
|
|
13
|
+
if (version !== 1 && version !== 2) {
|
|
14
|
+
throw new AbloValidationError(
|
|
15
|
+
`Endpoint outbox event at cursor ${String(cursor)} has unsupported event version ${String(eventVersion)}.`,
|
|
16
|
+
{ code: 'source_event_invalid' },
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
if (version === 2 && !Array.isArray(syncGroups)) {
|
|
20
|
+
throw new AbloValidationError(
|
|
21
|
+
`Endpoint outbox event at cursor ${String(cursor)} is version 2 but has no durable sync_groups.`,
|
|
22
|
+
{ code: 'source_event_invalid' },
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return version === 2
|
|
26
|
+
? { version, syncGroups: syncGroups as readonly string[] }
|
|
27
|
+
: { version };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Canonical snake_case database row → versioned source event decoder. */
|
|
31
|
+
export function decodeDatabaseOutboxEvent(row: Readonly<Record<string, unknown>>): OutboxEvent {
|
|
32
|
+
const envelope = decodeOutboxEventEnvelope(row.event_version, row.sync_groups, row.cursor);
|
|
33
|
+
return outboxEventSchema.parse({
|
|
34
|
+
...envelope,
|
|
35
|
+
id: row.id,
|
|
36
|
+
model: row.model,
|
|
37
|
+
entityId: row.entity_id,
|
|
38
|
+
type: row.type,
|
|
39
|
+
data: typeof row.data === 'string' ? JSON.parse(row.data) : row.data ?? null,
|
|
40
|
+
organizationId: row.organization_id ?? null,
|
|
41
|
+
clientTxId: row.client_tx_id ?? null,
|
|
42
|
+
correlationId: row.correlation_id ?? null,
|
|
43
|
+
transactionId: row.transaction_id ?? null,
|
|
44
|
+
occurredAt: row.occurred_at != null ? Number(row.occurred_at) : null,
|
|
45
|
+
cursor: String(row.cursor),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Endpoint transactional-outbox subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Start here, then descend into contract, envelope, migrations, or retention.
|
|
5
|
+
* ORM adapters depend on this boundary; the subsystem never depends on them.
|
|
6
|
+
*/
|
|
7
|
+
export {
|
|
8
|
+
outboxEventSchema,
|
|
9
|
+
eventsPageSchema,
|
|
10
|
+
type OutboxEvent,
|
|
11
|
+
type EventsPage,
|
|
12
|
+
} from './contract.js';
|
|
13
|
+
export { decodeDatabaseOutboxEvent, decodeOutboxEventEnvelope } from './envelope.js';
|
|
14
|
+
export { endpointOutboxMigrations } from './migrations.js';
|
|
15
|
+
export { ENDPOINT_OUTBOX_PRUNE_BATCH_SIZE } from './retention.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Migration } from '../adapters/migration.js';
|
|
2
|
+
|
|
3
|
+
function quoteIdent(value: string): string {
|
|
4
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function quoteLiteral(value: string): string {
|
|
8
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function qualified(schema: string, relation: string): string {
|
|
12
|
+
return `${quoteIdent(schema)}.${quoteIdent(relation)}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Schema for the endpoint-only, versioned transactional outbox. */
|
|
16
|
+
export function endpointOutboxMigrations(schema = 'public'): readonly Migration[] {
|
|
17
|
+
const outbox = qualified(schema, 'ablo_outbox');
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
name: 'ablo_outbox',
|
|
21
|
+
up: `CREATE TABLE IF NOT EXISTS ${outbox} (
|
|
22
|
+
cursor BIGSERIAL PRIMARY KEY,
|
|
23
|
+
id TEXT NOT NULL UNIQUE,
|
|
24
|
+
model TEXT NOT NULL,
|
|
25
|
+
entity_id TEXT NOT NULL,
|
|
26
|
+
type TEXT NOT NULL,
|
|
27
|
+
data JSONB,
|
|
28
|
+
event_version SMALLINT NOT NULL DEFAULT 1,
|
|
29
|
+
sync_groups TEXT[],
|
|
30
|
+
organization_id TEXT,
|
|
31
|
+
client_tx_id TEXT,
|
|
32
|
+
correlation_id TEXT,
|
|
33
|
+
transaction_id TEXT,
|
|
34
|
+
occurred_at BIGINT,
|
|
35
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
36
|
+
CONSTRAINT ablo_outbox_event_envelope_valid CHECK (
|
|
37
|
+
(event_version = 1 AND sync_groups IS NULL) OR
|
|
38
|
+
(event_version = 2 AND sync_groups IS NOT NULL)
|
|
39
|
+
)
|
|
40
|
+
);`,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'ablo_outbox_add_correlation',
|
|
44
|
+
up: `ALTER TABLE ${outbox}
|
|
45
|
+
ADD COLUMN IF NOT EXISTS correlation_id TEXT;
|
|
46
|
+
ALTER TABLE ${outbox}
|
|
47
|
+
ADD COLUMN IF NOT EXISTS transaction_id TEXT;`,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'ablo_outbox_add_event_version_and_sync_groups',
|
|
51
|
+
up: `ALTER TABLE ${outbox}
|
|
52
|
+
ADD COLUMN IF NOT EXISTS event_version SMALLINT NOT NULL DEFAULT 1;
|
|
53
|
+
ALTER TABLE ${outbox}
|
|
54
|
+
ADD COLUMN IF NOT EXISTS sync_groups TEXT[];
|
|
55
|
+
DO $$
|
|
56
|
+
BEGIN
|
|
57
|
+
IF NOT EXISTS (
|
|
58
|
+
SELECT 1 FROM pg_constraint
|
|
59
|
+
WHERE conrelid = to_regclass(${quoteLiteral(outbox)})
|
|
60
|
+
AND conname = 'ablo_outbox_event_envelope_valid'
|
|
61
|
+
) THEN
|
|
62
|
+
ALTER TABLE ${outbox}
|
|
63
|
+
ADD CONSTRAINT ablo_outbox_event_envelope_valid CHECK (
|
|
64
|
+
(event_version = 1 AND sync_groups IS NULL) OR
|
|
65
|
+
(event_version = 2 AND sync_groups IS NOT NULL)
|
|
66
|
+
) NOT VALID;
|
|
67
|
+
END IF;
|
|
68
|
+
END $$;`,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
}
|
package/src/source/types.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { AbloValidationError } from '../errors.js';
|
|
14
|
-
import type { CommitOperationType
|
|
14
|
+
import type { CommitOperationType } from '../coordination/schema.js';
|
|
15
15
|
import type { ParticipantKind } from '../types/participant.js';
|
|
16
16
|
|
|
17
17
|
/** A scalar value that can appear in a source filter. */
|
|
@@ -80,8 +80,9 @@ export type SourceListResult<Row> =
|
|
|
80
80
|
* see. Ablo attaches this so your `authorize` and model handlers can reject
|
|
81
81
|
* calls that fall outside the participant's permitted sync groups.
|
|
82
82
|
*
|
|
83
|
-
*
|
|
84
|
-
* handlers
|
|
83
|
+
* The ORM adapters enforce schema-declared subject rules from this trusted
|
|
84
|
+
* scope. Custom handlers receive the same signed facts; Ablo also checks their
|
|
85
|
+
* returned rows and preflights writes before forwarding the customer transaction.
|
|
85
86
|
*/
|
|
86
87
|
export interface SourceRequestContext {
|
|
87
88
|
readonly participantId?: string;
|
|
@@ -91,14 +92,14 @@ export interface SourceRequestContext {
|
|
|
91
92
|
readonly branchId?: string;
|
|
92
93
|
/** Trusted project selected by the authenticating credential. */
|
|
93
94
|
readonly projectId?: string;
|
|
94
|
-
readonly
|
|
95
|
+
readonly syncGroups?: readonly string[];
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
99
|
* A single change Ablo asks your source to apply — a create, update, delete,
|
|
99
100
|
* archive, or unarchive of one row of `model`. Operations arrive in your
|
|
100
|
-
* `commit` handler through {@link SourceCommitParams}. `
|
|
101
|
-
*
|
|
101
|
+
* `commit` handler through {@link SourceCommitParams}. A `readAt` makes the
|
|
102
|
+
* operation conditional and a stale value rejects it.
|
|
102
103
|
*/
|
|
103
104
|
export interface SourceOperation {
|
|
104
105
|
readonly type: CommitOperationType;
|
|
@@ -108,7 +109,6 @@ export interface SourceOperation {
|
|
|
108
109
|
readonly where?: Record<string, unknown> | null;
|
|
109
110
|
readonly transactionId?: string | null;
|
|
110
111
|
readonly readAt?: number | null;
|
|
111
|
-
readonly onStale?: OnStaleMode | null;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
@@ -122,6 +122,8 @@ export interface SourceDelta {
|
|
|
122
122
|
readonly type: SourceOperation['type'];
|
|
123
123
|
/** The changed row, in the key shape {@link SourceEvent.data} defines. */
|
|
124
124
|
readonly data?: Record<string, unknown> | null;
|
|
125
|
+
/** Exact record routes derived inside the write transaction. */
|
|
126
|
+
readonly syncGroups?: readonly string[];
|
|
125
127
|
readonly transactionId?: string | null;
|
|
126
128
|
}
|
|
127
129
|
|
|
@@ -137,6 +139,8 @@ export interface SourceDelta {
|
|
|
137
139
|
* the event is durably appended. External writes omit them.
|
|
138
140
|
*/
|
|
139
141
|
export interface SourceEvent {
|
|
142
|
+
/** Event envelope version. When omitted, syncGroups implies v2; their absence implies v1. */
|
|
143
|
+
readonly version?: 1 | 2;
|
|
140
144
|
/**
|
|
141
145
|
* A globally unique event id from your outbox. Ablo uses it for replay
|
|
142
146
|
* protection, so re-delivering the same id is a no-op.
|
|
@@ -162,6 +166,8 @@ export interface SourceEvent {
|
|
|
162
166
|
* a tenant boundary.
|
|
163
167
|
*/
|
|
164
168
|
readonly data?: Record<string, unknown> | null;
|
|
169
|
+
/** Exact record routes captured while the changed row was transactionally visible. Required in version 2. */
|
|
170
|
+
readonly syncGroups?: readonly string[];
|
|
165
171
|
/**
|
|
166
172
|
* The tenant this event belongs to. Populate it from the row's organization
|
|
167
173
|
* column for multi-tenant data; a single-tenant source may omit it and let
|
|
@@ -206,6 +212,8 @@ export interface SourceEventForOperationOptions {
|
|
|
206
212
|
* valid but leaves less for clients to hydrate from in realtime.
|
|
207
213
|
*/
|
|
208
214
|
readonly data?: Record<string, unknown> | null;
|
|
215
|
+
/** Exact record routes derived inside the write transaction. */
|
|
216
|
+
readonly syncGroups: readonly string[];
|
|
209
217
|
/**
|
|
210
218
|
* @deprecated Legacy echo identity. Prefer the explicit correlation fields.
|
|
211
219
|
*/
|
|
@@ -238,11 +246,13 @@ export function sourceEventForOperation(
|
|
|
238
246
|
const occurredAt = normalizeEventOccurredAt(options.occurredAt);
|
|
239
247
|
const transactionId = options.transactionId ?? options.operation.transactionId ?? undefined;
|
|
240
248
|
return {
|
|
249
|
+
version: 2,
|
|
241
250
|
id: options.eventId,
|
|
242
251
|
model: options.operation.model,
|
|
243
252
|
entityId,
|
|
244
253
|
type: options.operation.type,
|
|
245
254
|
...(options.data !== undefined ? { data: options.data } : {}),
|
|
255
|
+
syncGroups: options.syncGroups,
|
|
246
256
|
...(options.organizationId ? { organizationId: options.organizationId } : {}),
|
|
247
257
|
...(options.clientTxId ? { clientTxId: options.clientTxId } : {}),
|
|
248
258
|
...(options.correlationId ? { correlationId: options.correlationId } : {}),
|
|
@@ -365,11 +375,14 @@ export interface SourceEventsResult {
|
|
|
365
375
|
*/
|
|
366
376
|
export type SourceEventsHandler<TAuth = unknown> = (params: {
|
|
367
377
|
/**
|
|
368
|
-
* The
|
|
369
|
-
* a newly connected source.
|
|
370
|
-
*
|
|
378
|
+
* The consumer position Ablo has durably committed, or undefined on the first
|
|
379
|
+
* poll of a newly connected source. It acknowledges every event through that
|
|
380
|
+
* position, so a handler may prune them before returning the next page. You
|
|
381
|
+
* decide what it encodes — a last event id, timestamp, or log sequence number.
|
|
371
382
|
*/
|
|
372
383
|
readonly cursor?: string;
|
|
384
|
+
/** Explicit durable acknowledgement. Safe to use for bounded retention cleanup. */
|
|
385
|
+
readonly acknowledgedThrough?: string;
|
|
373
386
|
/**
|
|
374
387
|
* A suggested upper bound on how many events to return. You may return fewer;
|
|
375
388
|
* returning many more risks tripping Ablo's per-poll cap.
|
|
@@ -423,6 +436,18 @@ export interface SourceModelHandlers<Row, CreateInput, TAuth = unknown> {
|
|
|
423
436
|
| Promise<SourceListResult<Row>>
|
|
424
437
|
| SourceListResult<Row>;
|
|
425
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Subject-aware list boundary. The handler MUST apply `subject.values` in
|
|
441
|
+
* its database predicate before ordering, cursoring, or limiting. A model
|
|
442
|
+
* declaring `subject` is served only through this hook; plain `list()` is
|
|
443
|
+
* deliberately not accepted because post-page filtering is incomplete.
|
|
444
|
+
*/
|
|
445
|
+
subjectList?(params: {
|
|
446
|
+
readonly query: SourceListQuery;
|
|
447
|
+
readonly subject: { readonly field: string; readonly values: readonly string[] };
|
|
448
|
+
readonly context: SourceHandlerContext<TAuth>;
|
|
449
|
+
}): Promise<SourceListResult<Row>> | SourceListResult<Row>;
|
|
450
|
+
|
|
426
451
|
/**
|
|
427
452
|
* Apply one or more operations for this model within your own database
|
|
428
453
|
* transaction. Your handler must be idempotent on the scoped server
|
|
@@ -446,6 +471,32 @@ export type SourceCommitHandler<TAuth = unknown> = (
|
|
|
446
471
|
params: SourceCommitParams<TAuth>,
|
|
447
472
|
) => Promise<SourceCommitResult> | SourceCommitResult;
|
|
448
473
|
|
|
474
|
+
export interface SourceSubjectTransactionBoundary {
|
|
475
|
+
/**
|
|
476
|
+
* Serialize a caller-selected CREATE id even when no row exists yet. This
|
|
477
|
+
* must be an absent-key-capable transaction lock (for example a Postgres
|
|
478
|
+
* transaction advisory lock), acquired on the SAME transaction as load and
|
|
479
|
+
* commit. It coordinates framework writers; `commit` must still reject a
|
|
480
|
+
* database uniqueness conflict as `entity_already_exists`, because external
|
|
481
|
+
* writers do not participate in advisory locking.
|
|
482
|
+
*/
|
|
483
|
+
readonly lockCreate: (operation: SourceOperation) => Promise<void>;
|
|
484
|
+
/** Lock and return the current row on the SAME transaction used by commit. */
|
|
485
|
+
readonly load: (operation: SourceOperation) => Promise<Record<string, unknown> | null>;
|
|
486
|
+
/** Apply the complete batch on that transaction after authorization succeeds. */
|
|
487
|
+
readonly commit: () => Promise<SourceCommitResult>;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Transaction owner for hand-written subject-scoped commits. Open one database
|
|
492
|
+
* transaction, then call `run` with load/commit functions bound to it. `run`
|
|
493
|
+
* performs authorization first and invokes commit only after it succeeds.
|
|
494
|
+
*/
|
|
495
|
+
export type SourceSubjectTransactionHandler<TAuth = unknown> = (
|
|
496
|
+
params: SourceCommitParams<TAuth>,
|
|
497
|
+
run: (boundary: SourceSubjectTransactionBoundary) => Promise<SourceCommitResult>,
|
|
498
|
+
) => Promise<SourceCommitResult>;
|
|
499
|
+
|
|
449
500
|
export type SourceApiKey =
|
|
450
501
|
| string
|
|
451
502
|
| ((context: SourceAuthorizeContext) => Promise<string> | string);
|
|
@@ -485,7 +536,10 @@ export interface SourceCommitRequest {
|
|
|
485
536
|
|
|
486
537
|
export interface SourceEventsRequest {
|
|
487
538
|
readonly type: 'events';
|
|
539
|
+
/** Exclusive read position. */
|
|
488
540
|
readonly cursor?: string;
|
|
541
|
+
/** Durable consumer acknowledgement, independent of the read position. */
|
|
542
|
+
readonly acknowledgedThrough?: string;
|
|
489
543
|
readonly limit?: number;
|
|
490
544
|
readonly scope?: SourceRequestContext;
|
|
491
545
|
}
|
package/src/syncLog/contract.ts
CHANGED
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
* | `current_settled_sync_id()` | nothing at or below is still in flight |
|
|
16
16
|
* | `getCommittedSyncId` | committed, without waiting for the barrier|
|
|
17
17
|
* | `sync_broadcast_cursors.published_through` | the fan-out published through |
|
|
18
|
-
* | `
|
|
19
|
-
*
|
|
18
|
+
* | `log_subscriptions.position` | this participant was served through, in
|
|
19
|
+
* the area the same row names |
|
|
20
|
+
* | `Client.lastSentSyncId` | this socket was offered through |
|
|
21
|
+
* | `Client.lastAckedSyncId` | this socket confirmed through |
|
|
20
22
|
* | `LogPosition.applied` | the client processed on arrival through |
|
|
21
23
|
* | `LogPosition.persisted` | the client durably holds through, in
|
|
22
24
|
* DELIVERED order, not numeric order |
|
|
@@ -36,6 +38,21 @@
|
|
|
36
38
|
* own head, re-taking the plane lock on every catch-up poll
|
|
37
39
|
* (docs/plans/delivery-verify-at-read.md). Before comparing two positions, say
|
|
38
40
|
* out loud which owner each belongs to.
|
|
41
|
+
*
|
|
42
|
+
* ## The owner is a relation, not just a name
|
|
43
|
+
*
|
|
44
|
+
* This doc did its job on the NUMBER and could not do it for the relation that
|
|
45
|
+
* holds one. `log_subscriptions.position` is the durable answer to "where is
|
|
46
|
+
* this participant, in this area" (ADR 0036) — one record per
|
|
47
|
+
* `(participant, area)`, with no connection axis, from which delivery and
|
|
48
|
+
* liveness are projected. The two `Client` fields above are deliberately NOT
|
|
49
|
+
* folded into it: they are an in-flight socket's frame accounting, which is why
|
|
50
|
+
* they name a socket rather than a participant.
|
|
51
|
+
*
|
|
52
|
+
* The rest of the table is ENGINE-owned and stays separate on purpose. The
|
|
53
|
+
* fan-out's progress, the compaction checkpoint and the settled head answer a
|
|
54
|
+
* different question from "where is this participant", and collapsing them
|
|
55
|
+
* would recreate the exact comparison this doc warns about.
|
|
39
56
|
*/
|
|
40
57
|
|
|
41
58
|
import { z } from 'zod';
|
|
@@ -47,13 +64,6 @@ import { z } from 'zod';
|
|
|
47
64
|
export const logPositionSchema = z.number().int().nonnegative();
|
|
48
65
|
export type LogPosition = z.infer<typeof logPositionSchema>;
|
|
49
66
|
|
|
50
|
-
/** @deprecated One position type, one name: use {@link logPositionSchema}.
|
|
51
|
-
* This spelling is removed in 0.57.0. It resolves to the definition above, so
|
|
52
|
-
* the two cannot drift while both are exported. */
|
|
53
|
-
export const deltaPositionSchema = logPositionSchema;
|
|
54
|
-
/** @deprecated One position type, one name: use {@link LogPosition}. Removed in 0.57.0. */
|
|
55
|
-
export type DeltaPosition = LogPosition;
|
|
56
|
-
|
|
57
67
|
export const clientMutationIdSchema = z.string().min(1).max(255);
|
|
58
68
|
export type ClientMutationId = z.infer<typeof clientMutationIdSchema>;
|
|
59
69
|
|
|
@@ -53,6 +53,12 @@ export function confirmedCommitReceiptResponse(args: {
|
|
|
53
53
|
lastSyncId?: number;
|
|
54
54
|
serverTxId?: string;
|
|
55
55
|
ops?: number;
|
|
56
|
+
/** The exact rows the writing transaction returned, one per operation. */
|
|
57
|
+
operationResults?: {
|
|
58
|
+
transactionId: string;
|
|
59
|
+
outcome: 'created' | 'updated' | 'deleted' | 'archived' | 'unarchived';
|
|
60
|
+
row: Record<string, unknown>;
|
|
61
|
+
}[];
|
|
56
62
|
}): CommitReceiptWire {
|
|
57
63
|
const lastSyncId = args.lastSyncId ?? 0;
|
|
58
64
|
return {
|
|
@@ -65,6 +71,7 @@ export function confirmedCommitReceiptResponse(args: {
|
|
|
65
71
|
status: 'confirmed',
|
|
66
72
|
lastSyncId,
|
|
67
73
|
ops: args.ops ?? 1,
|
|
74
|
+
...(args.operationResults ? { operationResults: args.operationResults } : {}),
|
|
68
75
|
} satisfies CommitReceiptWire;
|
|
69
76
|
}
|
|
70
77
|
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* so the two can reference each other without an import cycle.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { RecoveryClass } from '
|
|
11
|
-
import { noopLogger, type Logger } from '
|
|
10
|
+
import type { RecoveryClass } from '../../errorCodes.js';
|
|
11
|
+
import { noopLogger, type Logger } from '../../logger.js';
|
|
12
12
|
import {
|
|
13
13
|
credentialExpiry,
|
|
14
14
|
credentialToken,
|
|
15
15
|
type CredentialProvider,
|
|
16
16
|
type CredentialProviderResult,
|
|
17
|
-
} from '
|
|
17
|
+
} from '../../auth/credentialResult.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Tri-state outcome of a credential re-mint, mirroring the `getToken`
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
import { probeNetwork, type ProbeResult } from './networkProbe.js';
|
|
44
|
-
import type { AuthTokenGetter } from '
|
|
44
|
+
import type { AuthTokenGetter } from '../../auth/credentialSource.js';
|
|
45
45
|
import type { CredentialRefreshOutcome } from './credentialLifecycle.js';
|
|
46
|
-
import { noopLogger, type Logger } from '
|
|
46
|
+
import { noopLogger, type Logger } from '../../logger.js';
|
|
47
47
|
import {
|
|
48
48
|
noopSocketObservability,
|
|
49
49
|
type TransportObservability,
|
|
50
|
-
} from '
|
|
50
|
+
} from '../../observability.js';
|
|
51
51
|
|
|
52
52
|
// ─── State ────────────────────────────────────────────────────────────────
|
|
53
53
|
|
|
@@ -134,6 +134,13 @@ export interface ConnectionManagerOptions {
|
|
|
134
134
|
getAuthToken?: AuthTokenGetter;
|
|
135
135
|
/** Override retry ceilings / jitter. Production should leave defaults. */
|
|
136
136
|
backoff?: Partial<typeof DEFAULT_BACKOFF>;
|
|
137
|
+
/**
|
|
138
|
+
* Connectivity probe. Defaults to {@link probeNetwork}. Declared so a caller
|
|
139
|
+
* can drive recovery from a deterministic outcome: `probeNetwork` is a
|
|
140
|
+
* sibling inside this module, so a test cannot reach it through the
|
|
141
|
+
* package's `transport/connection` boundary to substitute one.
|
|
142
|
+
*/
|
|
143
|
+
probe?: typeof probeNetwork;
|
|
137
144
|
/** Where transitions are logged. Defaults to silent. */
|
|
138
145
|
logger?: Logger;
|
|
139
146
|
/** Where dead-end states are reported. Defaults to silent. */
|
|
@@ -179,6 +186,7 @@ export class ConnectionManager {
|
|
|
179
186
|
private readonly baseUrl?: string;
|
|
180
187
|
private readonly getAuthToken?: AuthTokenGetter;
|
|
181
188
|
private readonly backoff: typeof DEFAULT_BACKOFF;
|
|
189
|
+
private readonly probe: typeof probeNetwork;
|
|
182
190
|
private readonly logger: Logger;
|
|
183
191
|
private readonly observability: TransportObservability;
|
|
184
192
|
|
|
@@ -190,6 +198,7 @@ export class ConnectionManager {
|
|
|
190
198
|
this.baseUrl = options.baseUrl;
|
|
191
199
|
this.getAuthToken = options.getAuthToken;
|
|
192
200
|
this.backoff = { ...DEFAULT_BACKOFF, ...(options.backoff ?? {}) };
|
|
201
|
+
this.probe = options.probe ?? probeNetwork;
|
|
193
202
|
this.logger = options.logger ?? noopLogger;
|
|
194
203
|
this.observability = options.observability ?? noopSocketObservability;
|
|
195
204
|
}
|
|
@@ -539,7 +548,7 @@ export class ConnectionManager {
|
|
|
539
548
|
|
|
540
549
|
private async runProbe(): Promise<void> {
|
|
541
550
|
try {
|
|
542
|
-
const result = await
|
|
551
|
+
const result = await this.probe({
|
|
543
552
|
baseUrl: this.baseUrl,
|
|
544
553
|
getAuthToken: this.getAuthToken,
|
|
545
554
|
logger: this.logger,
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { z } from 'zod';
|
|
26
|
-
import { classifyRecovery } from '
|
|
27
|
-
import { withAuthHeaders, type AuthTokenGetter } from '
|
|
28
|
-
import { ABLO_DEFAULT_BASE_URL } from '
|
|
29
|
-
import { noopLogger, type Logger } from '
|
|
26
|
+
import { classifyRecovery } from '../../errors.js';
|
|
27
|
+
import { withAuthHeaders, type AuthTokenGetter } from '../../auth/credentialSource.js';
|
|
28
|
+
import { ABLO_DEFAULT_BASE_URL } from '../../auth/hostedEndpoints.js';
|
|
29
|
+
import { noopLogger, type Logger } from '../../logger.js';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* The complete set of probe outcomes. Each value carries both reachability and
|