@abloatai/transaction 0.57.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONVENTIONS.md +51 -41
- package/README.md +3 -1
- package/dist/ai-sdk/modelTools.d.ts +3 -3
- package/dist/ai-sdk/modelTools.d.ts.map +1 -1
- package/dist/ai-sdk/modelTools.js +1 -1
- package/dist/ai-sdk/modelTools.js.map +1 -1
- package/dist/ai-sdk/updateTool.d.ts +5 -7
- package/dist/ai-sdk/updateTool.d.ts.map +1 -1
- package/dist/ai-sdk/updateTool.js +3 -5
- package/dist/ai-sdk/updateTool.js.map +1 -1
- package/dist/auth/capability.d.ts +5 -0
- package/dist/auth/capability.d.ts.map +1 -1
- package/dist/auth/capability.js +5 -0
- package/dist/auth/capability.js.map +1 -1
- package/dist/auth/capabilityLifecycle.d.ts +1 -1
- package/dist/auth/capabilityLifecycle.d.ts.map +1 -1
- package/dist/auth/credentialPolicy.d.ts +1 -1
- package/dist/auth/credentialPolicy.d.ts.map +1 -1
- package/dist/auth/identity.d.ts +3 -3
- package/dist/auth/identity.d.ts.map +1 -1
- package/dist/auth/identity.js +5 -5
- package/dist/auth/identity.js.map +1 -1
- package/dist/auth/index.d.ts +4 -208
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +4 -330
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +218 -0
- package/dist/auth/runtime.d.ts.map +1 -0
- package/dist/auth/runtime.js +336 -0
- package/dist/auth/runtime.js.map +1 -0
- package/dist/auth/sessionMint.d.ts +1 -1
- package/dist/auth/sessionMint.d.ts.map +1 -1
- package/dist/auth/sessionMint.js +2 -1
- package/dist/auth/sessionMint.js.map +1 -1
- package/dist/branches.d.ts +25 -21
- package/dist/branches.d.ts.map +1 -1
- package/dist/branches.js +3 -0
- package/dist/branches.js.map +1 -1
- package/dist/{coordination/awaitClaimGrant.d.ts → claims/awaitGrant.d.ts} +1 -1
- package/dist/claims/awaitGrant.d.ts.map +1 -0
- package/dist/{coordination/awaitClaimGrant.js → claims/awaitGrant.js} +4 -4
- package/dist/claims/awaitGrant.js.map +1 -0
- package/dist/{wire/claims.d.ts → claims/contract.d.ts} +1 -1
- package/dist/claims/contract.d.ts.map +1 -0
- package/dist/{wire/claims.js → claims/contract.js} +2 -2
- package/dist/claims/contract.js.map +1 -0
- package/dist/{wire/claimEvent.d.ts → claims/eventContract.d.ts} +1 -1
- package/dist/claims/eventContract.d.ts.map +1 -0
- package/dist/{wire/claimEvent.js → claims/eventContract.js} +1 -1
- package/dist/claims/eventContract.js.map +1 -0
- package/dist/{coordination → claims}/events.d.ts +7 -11
- package/dist/claims/events.d.ts.map +1 -0
- package/dist/claims/events.js +8 -0
- package/dist/claims/events.js.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.d.ts → claims/heartbeat.d.ts} +1 -1
- package/dist/claims/heartbeat.d.ts.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.js → claims/heartbeat.js} +1 -1
- package/dist/claims/heartbeat.js.map +1 -0
- package/dist/claims/index.d.ts +17 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +16 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/lifetime.d.ts +26 -0
- package/dist/claims/lifetime.d.ts.map +1 -0
- package/dist/claims/lifetime.js +62 -0
- package/dist/claims/lifetime.js.map +1 -0
- package/dist/{coordination → claims}/locator.d.ts +1 -1
- package/dist/claims/locator.d.ts.map +1 -0
- package/dist/{coordination → claims}/locator.js +2 -2
- package/dist/claims/locator.js.map +1 -0
- package/dist/{coordination/claimMeta.d.ts → claims/meta.d.ts} +1 -1
- package/dist/claims/meta.d.ts.map +1 -0
- package/dist/{coordination/claimMeta.js → claims/meta.js} +1 -1
- package/dist/claims/meta.js.map +1 -0
- package/dist/claims/routes.d.ts +59 -0
- package/dist/claims/routes.d.ts.map +1 -0
- package/dist/claims/routes.js +69 -0
- package/dist/claims/routes.js.map +1 -0
- package/dist/claims/targetConflict.d.ts.map +1 -0
- package/dist/claims/targetConflict.js.map +1 -0
- package/dist/{coordination → claims}/trace.d.ts +2 -2
- package/dist/claims/trace.d.ts.map +1 -0
- package/dist/{coordination → claims}/trace.js +5 -5
- package/dist/claims/trace.js.map +1 -0
- package/dist/{ablo.d.ts → client/ablo.d.ts} +6 -15
- package/dist/client/ablo.d.ts.map +1 -0
- package/dist/{ablo.js → client/ablo.js} +2 -2
- package/dist/client/ablo.js.map +1 -0
- package/dist/{transactionLayer.d.ts → client/contract.d.ts} +12 -14
- package/dist/client/contract.d.ts.map +1 -0
- package/dist/{transactionLayer.js → client/contract.js} +4 -5
- package/dist/client/contract.js.map +1 -0
- package/dist/{headlessClient.d.ts → client/headless.d.ts} +4 -4
- package/dist/client/headless.d.ts.map +1 -0
- package/dist/{headlessClient.js → client/headless.js} +8 -10
- package/dist/{headlessClient.js.map → client/headless.js.map} +1 -1
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.d.ts +4 -4
- package/dist/client/resources/functionalUpdate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.js +3 -3
- package/dist/client/resources/functionalUpdate.js.map +1 -0
- package/dist/{resources → client/resources}/httpResources.d.ts +51 -57
- package/dist/client/resources/httpResources.d.ts.map +1 -0
- package/dist/{resources → client/resources}/httpResources.js +1 -1
- package/dist/client/resources/httpResources.js.map +1 -0
- package/dist/{resources → client/resources}/modelCreate.d.ts +1 -1
- package/dist/client/resources/modelCreate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelCreate.js +1 -1
- package/dist/client/resources/modelCreate.js.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.d.ts +35 -51
- package/dist/client/resources/modelOperations.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.js +1 -1
- package/dist/client/resources/modelOperations.js.map +1 -0
- package/dist/{resources → client/resources}/mutationOptions.d.ts +4 -17
- package/dist/client/resources/mutationOptions.d.ts.map +1 -0
- package/dist/client/resources/mutationOptions.js.map +1 -0
- package/dist/client/resources/where.d.ts.map +1 -0
- package/dist/{resources → client/resources}/where.js +1 -1
- package/dist/client/resources/where.js.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.d.ts +2 -35
- package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.js +5 -18
- package/dist/client/resources/writeOptionsSchema.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
- package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
- package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
- package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
- package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
- package/dist/commit/confirmation/pendingWrite.js.map +1 -0
- package/dist/commit/contract.d.ts +1404 -0
- package/dist/commit/contract.d.ts.map +1 -0
- package/dist/{wire/commit.js → commit/contract.js} +13 -20
- package/dist/commit/contract.js.map +1 -0
- package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
- package/dist/commit/durableWrites.d.ts.map +1 -0
- package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
- package/dist/commit/durableWrites.js.map +1 -0
- package/dist/{transport/httpCommitRequest.d.ts → commit/httpRequest.d.ts} +6 -6
- package/dist/commit/httpRequest.d.ts.map +1 -0
- package/dist/{transport/httpCommitRequest.js → commit/httpRequest.js} +2 -3
- package/dist/commit/httpRequest.js.map +1 -0
- package/dist/commit/index.d.ts +17 -0
- package/dist/commit/index.d.ts.map +1 -0
- package/dist/commit/index.js +17 -0
- package/dist/commit/index.js.map +1 -0
- package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
- package/dist/commit/readSetContext.d.ts.map +1 -0
- package/dist/{readSetContext.js → commit/readSetContext.js} +10 -25
- package/dist/commit/readSetContext.js.map +1 -0
- package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
- package/dist/commit/recordRuntime.d.ts.map +1 -0
- package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
- package/dist/commit/recordRuntime.js.map +1 -0
- package/dist/coordination/index.d.ts +6 -8
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +3 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/schema.d.ts +11 -459
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +13 -261
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +15 -9
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +13 -6
- package/dist/errorCodes.js.map +1 -1
- package/dist/errorObservation.d.ts +2 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -11
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/read-set.d.ts +3 -3
- package/dist/internal/read-set.d.ts.map +1 -1
- package/dist/internal/read-set.js +2 -2
- package/dist/internal/read-set.js.map +1 -1
- package/dist/observability.d.ts +4 -4
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +2 -2
- package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
- package/dist/observation/contract.d.ts.map +1 -0
- package/dist/{wire/delta.js → observation/contract.js} +3 -3
- package/dist/observation/contract.js.map +1 -0
- package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
- package/dist/observation/cursor.d.ts.map +1 -0
- package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
- package/dist/observation/cursor.js.map +1 -0
- package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
- package/dist/observation/deliveryContract.d.ts.map +1 -0
- package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
- package/dist/observation/deliveryContract.js.map +1 -0
- package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
- package/dist/observation/feedContract.d.ts.map +1 -0
- package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
- package/dist/observation/feedContract.js.map +1 -0
- package/dist/observation/httpFeed.d.ts +4 -0
- package/dist/observation/httpFeed.d.ts.map +1 -0
- package/dist/{transport → observation}/httpFeed.js +1 -1
- package/dist/{transport → observation}/httpFeed.js.map +1 -1
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
- package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
- package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
- package/dist/pricing.d.ts +20 -12
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +46 -26
- package/dist/pricing.js.map +1 -1
- package/dist/schema/index.d.ts +5 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -7
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +0 -27
- package/dist/schema/model.d.ts.map +1 -1
- package/dist/schema/model.js +0 -2
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +45 -6
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/schema.d.ts +11 -3
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +9 -2
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/serialize.d.ts +1 -4
- package/dist/schema/serialize.d.ts.map +1 -1
- package/dist/schema/serialize.js +0 -4
- package/dist/schema/serialize.js.map +1 -1
- package/dist/schema/tenancy.d.ts +1 -1
- package/dist/server/adapter.d.ts +1 -1
- package/dist/server/adapter.d.ts.map +1 -1
- package/dist/server/commit.d.ts +6 -14
- package/dist/server/commit.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/storageMode.d.ts +1 -1
- package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
- package/dist/source/adapters/adapter.d.ts.map +1 -0
- package/dist/source/adapters/adapter.js.map +1 -0
- package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
- package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
- package/dist/source/adapters/adapterFactory.js.map +1 -0
- package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
- package/dist/source/adapters/adapterProfile.js.map +1 -0
- package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
- package/dist/source/adapters/conformance.d.ts.map +1 -0
- package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
- package/dist/source/adapters/conformance.js.map +1 -0
- package/dist/source/{contract.d.ts → adapters/contract.d.ts} +8 -77
- package/dist/source/adapters/contract.d.ts.map +1 -0
- package/dist/source/{contract.js → adapters/contract.js} +12 -57
- package/dist/source/adapters/contract.js.map +1 -0
- package/dist/source/adapters/drizzle.d.ts +1 -1
- package/dist/source/adapters/drizzle.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.js +21 -23
- package/dist/source/adapters/drizzle.js.map +1 -1
- package/dist/source/adapters/idempotency.d.ts.map +1 -0
- package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
- package/dist/source/adapters/idempotency.js.map +1 -0
- package/dist/source/adapters/index.d.ts +21 -0
- package/dist/source/adapters/index.d.ts.map +1 -0
- package/dist/source/adapters/index.js +21 -0
- package/dist/source/adapters/index.js.map +1 -0
- package/dist/source/adapters/kysely.d.ts +1 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +18 -20
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +2 -2
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +1 -1
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
- package/dist/source/adapters/memory.d.ts +3 -3
- package/dist/source/adapters/memory.d.ts.map +1 -1
- package/dist/source/adapters/memory.js +19 -7
- package/dist/source/adapters/memory.js.map +1 -1
- package/dist/source/adapters/migration.d.ts +8 -0
- package/dist/source/adapters/migration.d.ts.map +1 -0
- package/dist/source/adapters/migration.js +9 -0
- package/dist/source/adapters/migration.js.map +1 -0
- package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
- package/dist/source/adapters/migrations.d.ts.map +1 -0
- package/dist/source/{migrations.js → adapters/migrations.js} +4 -52
- package/dist/source/adapters/migrations.js.map +1 -0
- package/dist/source/adapters/prisma.d.ts +1 -1
- package/dist/source/adapters/prisma.d.ts.map +1 -1
- package/dist/source/adapters/prisma.js +21 -28
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/{subjectAuthorization.d.ts → adapters/subjectAuthorization.d.ts} +1 -1
- package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
- package/dist/source/{subjectAuthorization.js → adapters/subjectAuthorization.js} +2 -2
- package/dist/source/adapters/subjectAuthorization.js.map +1 -0
- package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
- package/dist/source/connector/client.d.ts.map +1 -0
- package/dist/source/{connector.js → connector/client.js} +28 -11
- package/dist/source/connector/client.js.map +1 -0
- package/dist/source/connector/index.d.ts +4 -0
- package/dist/source/connector/index.d.ts.map +1 -0
- package/dist/source/connector/index.js +4 -0
- package/dist/source/connector/index.js.map +1 -0
- package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
- package/dist/source/connector/protocol.d.ts.map +1 -0
- package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
- package/dist/source/connector/protocol.js.map +1 -0
- package/dist/source/delivery/index.d.ts +3 -0
- package/dist/source/delivery/index.d.ts.map +1 -0
- package/dist/source/delivery/index.js +3 -0
- package/dist/source/delivery/index.js.map +1 -0
- package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
- package/dist/source/delivery/pushQueue.d.ts.map +1 -0
- package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
- package/dist/source/delivery/pushQueue.js.map +1 -0
- package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +3 -3
- package/dist/source/endpoint/factory.d.ts.map +1 -0
- package/dist/source/{factory.js → endpoint/factory.js} +9 -4
- package/dist/source/endpoint/factory.js.map +1 -0
- package/dist/source/endpoint/index.d.ts +5 -0
- package/dist/source/endpoint/index.d.ts.map +1 -0
- package/dist/source/endpoint/index.js +5 -0
- package/dist/source/endpoint/index.js.map +1 -0
- package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
- package/dist/source/endpoint/next.d.ts.map +1 -0
- package/dist/source/{next.js → endpoint/next.js} +1 -1
- package/dist/source/endpoint/next.js.map +1 -0
- package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
- package/dist/source/endpoint/signing.d.ts.map +1 -0
- package/dist/source/{signing.js → endpoint/signing.js} +1 -1
- package/dist/source/endpoint/signing.js.map +1 -0
- package/dist/source/index.d.ts +14 -12
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +13 -11
- package/dist/source/index.js.map +1 -1
- package/dist/source/outbox/contract.d.ts +50 -0
- package/dist/source/outbox/contract.d.ts.map +1 -0
- package/dist/source/outbox/contract.js +50 -0
- package/dist/source/outbox/contract.js.map +1 -0
- package/dist/source/outbox/envelope.d.ts +9 -0
- package/dist/source/outbox/envelope.d.ts.map +1 -0
- package/dist/source/outbox/envelope.js +36 -0
- package/dist/source/outbox/envelope.js.map +1 -0
- package/dist/source/outbox/index.d.ts +11 -0
- package/dist/source/outbox/index.d.ts.map +1 -0
- package/dist/source/outbox/index.js +11 -0
- package/dist/source/outbox/index.js.map +1 -0
- package/dist/source/outbox/migrations.d.ts +4 -0
- package/dist/source/outbox/migrations.d.ts.map +1 -0
- package/dist/source/outbox/migrations.js +67 -0
- package/dist/source/outbox/migrations.js.map +1 -0
- package/dist/source/outbox/retention.d.ts +3 -0
- package/dist/source/outbox/retention.d.ts.map +1 -0
- package/dist/source/outbox/retention.js +3 -0
- package/dist/source/outbox/retention.js.map +1 -0
- package/dist/source/types.d.ts +16 -17
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js +1 -0
- package/dist/source/types.js.map +1 -1
- package/dist/syncLog/contract.d.ts +19 -2
- package/dist/syncLog/contract.d.ts.map +1 -1
- package/dist/syncLog/contract.js +19 -2
- package/dist/syncLog/contract.js.map +1 -1
- package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
- package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
- package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
- package/dist/transport/connection/credentialLifecycle.js.map +1 -0
- package/dist/transport/connection/index.d.ts +5 -0
- package/dist/transport/connection/index.d.ts.map +1 -0
- package/dist/transport/connection/index.js +5 -0
- package/dist/transport/connection/index.js.map +1 -0
- package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
- package/dist/transport/connection/manager.d.ts.map +1 -0
- package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
- package/dist/transport/connection/manager.js.map +1 -0
- package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
- package/dist/transport/connection/networkProbe.d.ts.map +1 -0
- package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
- package/dist/transport/connection/networkProbe.js.map +1 -0
- package/dist/transport/{httpClient.d.ts → http/client.d.ts} +26 -45
- package/dist/transport/http/client.d.ts.map +1 -0
- package/dist/transport/{httpClient.js → http/client.js} +84 -124
- package/dist/transport/http/client.js.map +1 -0
- package/dist/transport/{httpTransportHelpers.d.ts → http/helpers.d.ts} +5 -5
- package/dist/transport/http/helpers.d.ts.map +1 -0
- package/dist/transport/{httpTransportHelpers.js → http/helpers.js} +5 -5
- package/dist/transport/http/helpers.js.map +1 -0
- package/dist/transport/http/index.d.ts +6 -0
- package/dist/transport/http/index.d.ts.map +1 -0
- package/dist/transport/http/index.js +6 -0
- package/dist/transport/http/index.js.map +1 -0
- package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
- package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
- package/dist/transport/{httpOptions.js → http/options.js} +1 -1
- package/dist/transport/http/options.js.map +1 -0
- package/dist/transport/http/subscription.d.ts +16 -0
- package/dist/transport/http/subscription.d.ts.map +1 -0
- package/dist/transport/http/subscription.js +146 -0
- package/dist/transport/http/subscription.js.map +1 -0
- package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
- package/dist/transport/http/transport.d.ts.map +1 -0
- package/dist/transport/{httpTransport.js → http/transport.js} +95 -93
- package/dist/transport/http/transport.js.map +1 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
- package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
- package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
- package/dist/transport/websocket/commitFrames.js.map +1 -0
- package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
- package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
- package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
- package/dist/transport/websocket/frameHandlers.js.map +1 -0
- package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
- package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
- package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
- package/dist/transport/websocket/heartbeat.js.map +1 -0
- package/dist/transport/websocket/index.d.ts +6 -0
- package/dist/transport/websocket/index.d.ts.map +1 -0
- package/dist/transport/websocket/index.js +6 -0
- package/dist/transport/websocket/index.js.map +1 -0
- package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
- package/dist/transport/websocket/transport.d.ts.map +1 -0
- package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
- package/dist/transport/websocket/transport.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/streams.d.ts +8 -48
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +2 -2
- package/dist/wire/accountResponses.d.ts +4 -72
- package/dist/wire/accountResponses.d.ts.map +1 -1
- package/dist/wire/accountResponses.js +2 -10
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/frames.d.ts +6 -83
- package/dist/wire/frames.d.ts.map +1 -1
- package/dist/wire/frames.js +4 -11
- package/dist/wire/frames.js.map +1 -1
- package/dist/wire/inboundFrames.d.ts +6 -131
- package/dist/wire/inboundFrames.d.ts.map +1 -1
- package/dist/wire/inboundFrames.js +3 -3
- package/dist/wire/inboundFrames.js.map +1 -1
- package/dist/wire/index.d.ts +17 -15
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +11 -8
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/modelMutations.d.ts +1 -32
- package/dist/wire/modelMutations.d.ts.map +1 -1
- package/dist/wire/modelMutations.js +1 -8
- package/dist/wire/modelMutations.js.map +1 -1
- package/package.json +130 -10
- package/src/ai-sdk/modelTools.ts +5 -5
- package/src/ai-sdk/updateTool.ts +5 -7
- package/src/auth/capability.ts +5 -0
- package/src/auth/capabilityLifecycle.ts +1 -1
- package/src/auth/credentialPolicy.ts +1 -1
- package/src/auth/identity.ts +7 -7
- package/src/auth/index.ts +4 -663
- package/src/auth/runtime.ts +669 -0
- package/src/auth/sessionMint.ts +3 -2
- package/src/branches.ts +3 -0
- package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
- package/src/{wire/claims.ts → claims/contract.ts} +1 -1
- package/src/{coordination → claims}/events.ts +7 -11
- package/src/claims/index.ts +21 -0
- package/src/claims/lifetime.ts +78 -0
- package/src/{coordination → claims}/locator.ts +3 -3
- package/src/claims/routes.ts +81 -0
- package/src/{coordination → claims}/trace.ts +5 -5
- package/src/{ablo.ts → client/ablo.ts} +8 -20
- package/src/{transactionLayer.ts → client/contract.ts} +11 -13
- package/src/{headlessClient.ts → client/headless.ts} +13 -15
- package/src/client/index.ts +10 -0
- package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
- package/src/{resources → client/resources}/httpResources.ts +48 -68
- package/src/{resources → client/resources}/modelCreate.ts +2 -2
- package/src/{resources → client/resources}/modelOperations.ts +46 -55
- package/src/{resources → client/resources}/mutationOptions.ts +4 -17
- package/src/{resources → client/resources}/where.ts +1 -1
- package/src/{resources → client/resources}/writeOptionsSchema.ts +7 -27
- package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
- package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
- package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
- package/src/{wire/commit.ts → commit/contract.ts} +11 -25
- package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
- package/src/{transport/httpCommitRequest.ts → commit/httpRequest.ts} +6 -7
- package/src/commit/index.ts +16 -0
- package/src/{readSetContext.ts → commit/readSetContext.ts} +16 -41
- package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
- package/src/coordination/index.ts +4 -52
- package/src/coordination/schema.ts +15 -302
- package/src/errorCodes.ts +56 -10
- package/src/errors.ts +32 -10
- package/src/index.ts +8 -8
- package/src/internal/read-set.ts +3 -6
- package/src/observability.ts +4 -4
- package/src/{wire/delta.ts → observation/contract.ts} +2 -2
- package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
- package/src/{transport → observation}/httpFeed.ts +3 -3
- package/src/observation/index.ts +12 -0
- package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
- package/src/pricing.ts +46 -25
- package/src/schema/index.ts +4 -20
- package/src/schema/model.ts +0 -33
- package/src/schema/openapi.ts +47 -7
- package/src/schema/schema.ts +23 -3
- package/src/schema/serialize.ts +0 -8
- package/src/server/adapter.ts +1 -1
- package/src/server/commit.ts +6 -14
- package/src/server/index.ts +1 -1
- package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
- package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
- package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
- package/src/source/{contract.ts → adapters/contract.ts} +16 -64
- package/src/source/adapters/drizzle.ts +29 -27
- package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
- package/src/source/adapters/index.ts +20 -0
- package/src/source/adapters/kysely.ts +32 -25
- package/src/source/adapters/kyselyMutationCore.ts +3 -3
- package/src/source/adapters/memory.ts +25 -9
- package/src/source/adapters/migration.ts +11 -0
- package/src/source/{migrations.ts → adapters/migrations.ts} +6 -54
- package/src/source/adapters/prisma.ts +33 -32
- package/src/source/{subjectAuthorization.ts → adapters/subjectAuthorization.ts} +2 -2
- package/src/source/{connector.ts → connector/client.ts} +35 -12
- package/src/source/connector/index.ts +3 -0
- package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
- package/src/source/delivery/index.ts +2 -0
- package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
- package/src/source/{factory.ts → endpoint/factory.ts} +13 -8
- package/src/source/endpoint/index.ts +4 -0
- package/src/source/{next.ts → endpoint/next.ts} +2 -2
- package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
- package/src/source/index.ts +22 -19
- package/src/source/outbox/contract.ts +56 -0
- package/src/source/outbox/envelope.ts +47 -0
- package/src/source/outbox/index.ts +15 -0
- package/src/source/outbox/migrations.ts +71 -0
- package/src/source/outbox/retention.ts +2 -0
- package/src/source/types.ts +17 -17
- package/src/syncLog/contract.ts +19 -2
- package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
- package/src/transport/connection/index.ts +4 -0
- package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
- package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
- package/src/transport/{httpClient.ts → http/client.ts} +128 -209
- package/src/transport/{httpTransportHelpers.ts → http/helpers.ts} +7 -7
- package/src/transport/http/index.ts +5 -0
- package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
- package/src/transport/http/subscription.ts +174 -0
- package/src/transport/{httpTransport.ts → http/transport.ts} +127 -113
- package/src/transport/index.ts +7 -0
- package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
- package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
- package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
- package/src/transport/websocket/index.ts +5 -0
- package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
- package/src/types/index.ts +2 -6
- package/src/types/streams.ts +7 -61
- package/src/webhooks/events.ts +1 -1
- package/src/wire/accountResponses.ts +3 -12
- package/src/wire/frames.ts +5 -15
- package/src/wire/inboundFrames.ts +3 -3
- package/src/wire/index.ts +19 -15
- package/src/wire/modelMutations.ts +1 -14
- package/dist/ablo.d.ts.map +0 -1
- package/dist/ablo.js.map +0 -1
- package/dist/commitRecordRuntime.d.ts.map +0 -1
- package/dist/commitRecordRuntime.js.map +0 -1
- package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
- package/dist/coordination/awaitClaimGrant.js.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
- package/dist/coordination/claimMeta.d.ts.map +0 -1
- package/dist/coordination/claimMeta.js.map +0 -1
- package/dist/coordination/events.d.ts.map +0 -1
- package/dist/coordination/events.js +0 -8
- package/dist/coordination/events.js.map +0 -1
- package/dist/coordination/locator.d.ts.map +0 -1
- package/dist/coordination/locator.js.map +0 -1
- package/dist/coordination/targetConflict.d.ts.map +0 -1
- package/dist/coordination/targetConflict.js.map +0 -1
- package/dist/coordination/trace.d.ts.map +0 -1
- package/dist/coordination/trace.js.map +0 -1
- package/dist/durableWrites.d.ts.map +0 -1
- package/dist/durableWrites.js.map +0 -1
- package/dist/headlessClient.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.js.map +0 -1
- package/dist/policy/types.d.ts +0 -226
- package/dist/policy/types.d.ts.map +0 -1
- package/dist/policy/types.js +0 -127
- package/dist/policy/types.js.map +0 -1
- package/dist/readSetContext.d.ts.map +0 -1
- package/dist/readSetContext.js.map +0 -1
- package/dist/resources/functionalUpdate.d.ts.map +0 -1
- package/dist/resources/functionalUpdate.js.map +0 -1
- package/dist/resources/httpResources.d.ts.map +0 -1
- package/dist/resources/httpResources.js.map +0 -1
- package/dist/resources/modelCreate.d.ts.map +0 -1
- package/dist/resources/modelCreate.js.map +0 -1
- package/dist/resources/modelOperations.d.ts.map +0 -1
- package/dist/resources/modelOperations.js.map +0 -1
- package/dist/resources/mutationOptions.d.ts.map +0 -1
- package/dist/resources/mutationOptions.js.map +0 -1
- package/dist/resources/where.d.ts.map +0 -1
- package/dist/resources/where.js.map +0 -1
- package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
- package/dist/resources/writeOptionsSchema.js.map +0 -1
- package/dist/schema/coordination.d.ts +0 -113
- package/dist/schema/coordination.d.ts.map +0 -1
- package/dist/schema/coordination.js +0 -134
- package/dist/schema/coordination.js.map +0 -1
- package/dist/source/adapter.d.ts.map +0 -1
- package/dist/source/adapter.js.map +0 -1
- package/dist/source/adapterFactory.d.ts.map +0 -1
- package/dist/source/adapterFactory.js.map +0 -1
- package/dist/source/adapterProfile.d.ts.map +0 -1
- package/dist/source/adapterProfile.js.map +0 -1
- package/dist/source/conformance.d.ts.map +0 -1
- package/dist/source/conformance.js.map +0 -1
- package/dist/source/connector.d.ts.map +0 -1
- package/dist/source/connector.js.map +0 -1
- package/dist/source/connectorProtocol.d.ts.map +0 -1
- package/dist/source/connectorProtocol.js.map +0 -1
- package/dist/source/contract.d.ts.map +0 -1
- package/dist/source/contract.js.map +0 -1
- package/dist/source/drizzle.d.ts +0 -2
- package/dist/source/drizzle.d.ts.map +0 -1
- package/dist/source/drizzle.js +0 -2
- package/dist/source/drizzle.js.map +0 -1
- package/dist/source/factory.d.ts.map +0 -1
- package/dist/source/factory.js.map +0 -1
- package/dist/source/idempotency.d.ts.map +0 -1
- package/dist/source/idempotency.js.map +0 -1
- package/dist/source/kysely.d.ts +0 -3
- package/dist/source/kysely.d.ts.map +0 -1
- package/dist/source/kysely.js +0 -3
- package/dist/source/kysely.js.map +0 -1
- package/dist/source/migrations.d.ts.map +0 -1
- package/dist/source/migrations.js.map +0 -1
- package/dist/source/next.d.ts.map +0 -1
- package/dist/source/next.js.map +0 -1
- package/dist/source/pushQueue.d.ts.map +0 -1
- package/dist/source/pushQueue.js.map +0 -1
- package/dist/source/signing.d.ts.map +0 -1
- package/dist/source/signing.js.map +0 -1
- package/dist/source/subjectAuthorization.d.ts.map +0 -1
- package/dist/source/subjectAuthorization.js.map +0 -1
- package/dist/transactionLayer.d.ts.map +0 -1
- package/dist/transactionLayer.js.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
- package/dist/transport/commitFrames.d.ts.map +0 -1
- package/dist/transport/commitFrames.js.map +0 -1
- package/dist/transport/connectionManager.d.ts.map +0 -1
- package/dist/transport/connectionManager.js.map +0 -1
- package/dist/transport/credentialLifecycle.d.ts.map +0 -1
- package/dist/transport/credentialLifecycle.js.map +0 -1
- package/dist/transport/heartbeat.d.ts.map +0 -1
- package/dist/transport/heartbeat.js.map +0 -1
- package/dist/transport/httpClient.d.ts.map +0 -1
- package/dist/transport/httpClient.js.map +0 -1
- package/dist/transport/httpCommitRequest.d.ts.map +0 -1
- package/dist/transport/httpCommitRequest.js.map +0 -1
- package/dist/transport/httpFeed.d.ts +0 -4
- package/dist/transport/httpFeed.d.ts.map +0 -1
- package/dist/transport/httpOptions.js.map +0 -1
- package/dist/transport/httpTransport.d.ts.map +0 -1
- package/dist/transport/httpTransport.js.map +0 -1
- package/dist/transport/httpTransportHelpers.d.ts.map +0 -1
- package/dist/transport/httpTransportHelpers.js.map +0 -1
- package/dist/transport/networkProbe.d.ts.map +0 -1
- package/dist/transport/networkProbe.js.map +0 -1
- package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
- package/dist/transport/wsFrameHandlers.js.map +0 -1
- package/dist/transport/wsTransport.d.ts.map +0 -1
- package/dist/transport/wsTransport.js.map +0 -1
- package/dist/wire/claimEvent.d.ts.map +0 -1
- package/dist/wire/claimEvent.js.map +0 -1
- package/dist/wire/claims.d.ts.map +0 -1
- package/dist/wire/claims.js.map +0 -1
- package/dist/wire/commit.d.ts +0 -2866
- package/dist/wire/commit.d.ts.map +0 -1
- package/dist/wire/commit.js.map +0 -1
- package/dist/wire/delta.d.ts.map +0 -1
- package/dist/wire/delta.js.map +0 -1
- package/dist/wire/deltaDelivery.d.ts.map +0 -1
- package/dist/wire/deltaDelivery.js.map +0 -1
- package/dist/wire/feedCursor.d.ts.map +0 -1
- package/dist/wire/feedCursor.js.map +0 -1
- package/dist/wire/feedEvent.d.ts.map +0 -1
- package/dist/wire/feedEvent.js.map +0 -1
- package/src/policy/types.ts +0 -300
- package/src/schema/coordination.ts +0 -161
- package/src/source/drizzle.ts +0 -1
- package/src/source/kysely.ts +0 -2
- /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
- /package/dist/{coordination → claims}/targetConflict.js +0 -0
- /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
- /package/dist/{resources → client/resources}/where.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
- /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
- /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
- /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
- /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
- /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
- /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
- /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
- /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
- /package/src/{coordination → claims}/targetConflict.ts +0 -0
- /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
- /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
- /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
- /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { AbloStaleContextError, translateHttpError, } from '../../errors.js';
|
|
2
|
+
const INITIAL_RECONNECT_CAP_MS = 5_000;
|
|
3
|
+
const MAX_RECONNECT_DELAY_MS = 30_000;
|
|
4
|
+
/** POST the existing reads and consume one `stale_context` SSE event. */
|
|
5
|
+
export function createHttpReadOnChange(deps) {
|
|
6
|
+
return (reads, listener) => {
|
|
7
|
+
if (reads.length === 0)
|
|
8
|
+
return () => undefined;
|
|
9
|
+
const controller = new AbortController();
|
|
10
|
+
deps.register(controller);
|
|
11
|
+
let stopped = false;
|
|
12
|
+
const stop = () => {
|
|
13
|
+
if (stopped)
|
|
14
|
+
return;
|
|
15
|
+
stopped = true;
|
|
16
|
+
controller.abort();
|
|
17
|
+
deps.unregister(controller);
|
|
18
|
+
};
|
|
19
|
+
void (async () => {
|
|
20
|
+
let failures = 0;
|
|
21
|
+
while (!stopped) {
|
|
22
|
+
try {
|
|
23
|
+
await deps.prepare();
|
|
24
|
+
const response = await deps.fetch(deps.endpoint(), {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
...(await deps.authHeaders()),
|
|
28
|
+
Accept: 'text/event-stream',
|
|
29
|
+
'Cache-Control': 'no-cache',
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify({ reads }),
|
|
33
|
+
signal: controller.signal,
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
const body = await parseResponseBody(response);
|
|
37
|
+
throw translateHttpError(response.status, body, response.headers.get('x-request-id') ?? undefined);
|
|
38
|
+
}
|
|
39
|
+
failures = 0;
|
|
40
|
+
const stale = await readStaleContextEvent(response);
|
|
41
|
+
if (stale) {
|
|
42
|
+
stop();
|
|
43
|
+
listener(stale);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (stopped || controller.signal.aborted)
|
|
49
|
+
return;
|
|
50
|
+
void error;
|
|
51
|
+
}
|
|
52
|
+
failures += 1;
|
|
53
|
+
await abortableDelay(reconnectDelayMs(failures), controller.signal);
|
|
54
|
+
}
|
|
55
|
+
})().finally(() => deps.unregister(controller));
|
|
56
|
+
return stop;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Full-jitter reconnect delay; exported only for transport unit tests. */
|
|
60
|
+
export function reconnectDelayMs(failures, random = Math.random) {
|
|
61
|
+
const cap = Math.min(MAX_RECONNECT_DELAY_MS, INITIAL_RECONNECT_CAP_MS * 2 ** Math.max(0, failures - 1));
|
|
62
|
+
return random() * cap;
|
|
63
|
+
}
|
|
64
|
+
async function parseResponseBody(response) {
|
|
65
|
+
const text = await response.text();
|
|
66
|
+
if (text === '')
|
|
67
|
+
return null;
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(text);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function readStaleContextEvent(response) {
|
|
76
|
+
if (!response.body)
|
|
77
|
+
return undefined;
|
|
78
|
+
const reader = response.body.getReader();
|
|
79
|
+
const decoder = new TextDecoder();
|
|
80
|
+
let buffer = '';
|
|
81
|
+
while (true) {
|
|
82
|
+
const { value, done } = await reader.read();
|
|
83
|
+
buffer += decoder.decode(value, { stream: !done });
|
|
84
|
+
let boundary = eventBoundary(buffer);
|
|
85
|
+
while (boundary) {
|
|
86
|
+
const block = buffer.slice(0, boundary.index);
|
|
87
|
+
buffer = buffer.slice(boundary.index + boundary.length);
|
|
88
|
+
const parsed = parseEventBlock(block);
|
|
89
|
+
if (parsed?.event === 'stale_context') {
|
|
90
|
+
let body;
|
|
91
|
+
try {
|
|
92
|
+
body = JSON.parse(parsed.data);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
body = parsed.data;
|
|
96
|
+
}
|
|
97
|
+
const error = translateHttpError(409, body);
|
|
98
|
+
return error instanceof AbloStaleContextError
|
|
99
|
+
? error
|
|
100
|
+
: new AbloStaleContextError(error.message, {
|
|
101
|
+
code: 'stale_context',
|
|
102
|
+
cause: error,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
boundary = eventBoundary(buffer);
|
|
106
|
+
}
|
|
107
|
+
if (done)
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function eventBoundary(value) {
|
|
112
|
+
const match = /\r?\n\r?\n/.exec(value);
|
|
113
|
+
return match ? { index: match.index, length: match[0].length } : undefined;
|
|
114
|
+
}
|
|
115
|
+
function parseEventBlock(block) {
|
|
116
|
+
let event = 'message';
|
|
117
|
+
const data = [];
|
|
118
|
+
for (const line of block.split(/\r?\n/)) {
|
|
119
|
+
if (line.startsWith(':'))
|
|
120
|
+
continue;
|
|
121
|
+
const separator = line.indexOf(':');
|
|
122
|
+
const field = separator < 0 ? line : line.slice(0, separator);
|
|
123
|
+
let value = separator < 0 ? '' : line.slice(separator + 1);
|
|
124
|
+
if (value.startsWith(' '))
|
|
125
|
+
value = value.slice(1);
|
|
126
|
+
if (field === 'event')
|
|
127
|
+
event = value;
|
|
128
|
+
if (field === 'data')
|
|
129
|
+
data.push(value);
|
|
130
|
+
}
|
|
131
|
+
return data.length > 0 ? { event, data: data.join('\n') } : undefined;
|
|
132
|
+
}
|
|
133
|
+
async function abortableDelay(ms, signal) {
|
|
134
|
+
if (signal.aborted)
|
|
135
|
+
return;
|
|
136
|
+
await new Promise((resolve) => {
|
|
137
|
+
const timer = setTimeout(done, ms);
|
|
138
|
+
signal.addEventListener('abort', done, { once: true });
|
|
139
|
+
function done() {
|
|
140
|
+
clearTimeout(timer);
|
|
141
|
+
signal.removeEventListener('abort', done);
|
|
142
|
+
resolve();
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=subscription.js.map
|
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
* facade in `httpClient.ts` is the application boundary; this module owns
|
|
6
6
|
* transport envelopes, watermarks, replay, and route details.
|
|
7
7
|
*/
|
|
8
|
-
import type { HttpClientConfig } from './
|
|
9
|
-
import type { CommitResource, HttpClaimsResource, HttpTransportModel, HttpLogsResource, SessionResource } from '
|
|
10
|
-
import type { EffectiveAuthority } from '
|
|
11
|
-
import type { SchemaRecord } from '
|
|
12
|
-
import type { CoordinationObservability } from '
|
|
8
|
+
import type { HttpClientConfig } from './options.js';
|
|
9
|
+
import type { CommitResource, HttpClaimsResource, HttpTransportModel, HttpLogsResource, SessionResource } from '../../client/resources/httpResources.js';
|
|
10
|
+
import type { EffectiveAuthority } from '../../auth/capability.js';
|
|
11
|
+
import type { SchemaRecord } from '../../schema/schema.js';
|
|
12
|
+
import type { CoordinationObservability } from '../../observability.js';
|
|
13
|
+
import { type HttpReadOnChange } from './subscription.js';
|
|
13
14
|
/** @internal Private options for the schema-agnostic HTTP protocol transport. */
|
|
14
15
|
export type HttpTransportOptions = Omit<HttpClientConfig, 'schema'> & {
|
|
15
16
|
readonly bootstrapBaseUrl?: string | undefined;
|
|
@@ -41,6 +42,8 @@ export interface HttpTransport {
|
|
|
41
42
|
/** Drains scheduled commits and active requests. */
|
|
42
43
|
dispose(): Promise<void>;
|
|
43
44
|
purge(): Promise<void>;
|
|
45
|
+
/** @internal Live check used only by `context().onChange`. */
|
|
46
|
+
readonly onChange: HttpReadOnChange;
|
|
44
47
|
readonly commits: CommitResource;
|
|
45
48
|
/**
|
|
46
49
|
* Claim-ticket operations keyed by `claimId` — the id a queued acquire
|
|
@@ -69,4 +72,4 @@ export interface HttpTransport {
|
|
|
69
72
|
}
|
|
70
73
|
/** @internal Constructed only by the typed HTTP facade. */
|
|
71
74
|
export declare function createHttpTransport(options: HttpTransportOptions): HttpTransport;
|
|
72
|
-
//# sourceMappingURL=
|
|
75
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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vB,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC7C,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,EAC3C,IAAI,EAAE,MAAM,GACX,kBAAkB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;OAMG;IACH,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;CAClD;AAID,2DAA2D;AAC3D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA83DhF"}
|
|
@@ -5,38 +5,34 @@
|
|
|
5
5
|
* facade in `httpClient.ts` is the application boundary; this module owns
|
|
6
6
|
* transport envelopes, watermarks, replay, and route details.
|
|
7
7
|
*/
|
|
8
|
-
import { AbloClaimedError, AbloError, AbloAuthenticationError, AbloConnectionError, AbloIdempotencyError, AbloValidationError, AbloNotFoundError, claimedError, translateHttpError, } from '
|
|
9
|
-
import { reconcileFunctionalUpdate, } from '
|
|
10
|
-
import { assertBrowserSafety, readProcessEnv, resolveApiKey, resolveApiKeyValue, resolveAuthToken, resolveBaseURL, resolveBootstrapBaseUrl, rejectRemovedDatabaseUrlOption, warnIfCliKeyMismatch, } from '
|
|
11
|
-
import { PROTOCOL_VERSION, PROTOCOL_VERSION_HEADER } from '
|
|
12
|
-
import { commitRecordSchema, commitRecordListSchema, commitRecordListOptionsSchema, commitRecordWhereSchema, } from '
|
|
13
|
-
import { logListResponseSchema } from '
|
|
14
|
-
import { claimAcquireResponseSchema, claimHeartbeatBatchReplySchema, claimHeartbeatReplySchema, claimListResponseSchema, claimStateSchema, } from '
|
|
15
|
-
import { modelListResponseSchema, modelReadResponseSchema, } from '
|
|
16
|
-
import { toMs } from '
|
|
17
|
-
import { heartbeatCadenceMs, resolveHeartbeatOptions, resolveHeartbeatPlan, startClaimHeartbeatLoop, } from '
|
|
18
|
-
import { mintSession } from '
|
|
19
|
-
import { revokeCapability, rotateCapability, } from '
|
|
20
|
-
import { parseIdentityResolveResponse } from '
|
|
21
|
-
import { claimFromModelClaim, heldHeartbeatReply, parseSuccessfulCommitResponse, } from './
|
|
22
|
-
import { claimAttemptFailure, claimQueueView, emitClaimStatus, resolveClaimContentionOptions, } from '
|
|
23
|
-
import { claimDescription } from '
|
|
24
|
-
import { subTarget, streamTarget, batchFence, } from '
|
|
25
|
-
import { declaredMeta, wireMeta } from '
|
|
26
|
-
import { assertWriteOptions, assertWriteTarget, } from '
|
|
27
|
-
import { createModelId, resolveCreatedRows, resolveCreateId, } from '
|
|
28
|
-
import { normalizeWhere } from '
|
|
29
|
-
import { createDurableHttpCommitEnvelope, canonicalHttpCommitBody, durableHttpCommitEnvelopeSchema, httpCommitEnvelopeRecordId, isHttpCommitReplayExpired, } from '
|
|
30
|
-
import { createClientTxId, normalizeCommitOperations, replicationLagTimeout, } from '
|
|
31
|
-
import { resolveDurableWrites } from '
|
|
8
|
+
import { AbloClaimedError, AbloError, AbloAuthenticationError, AbloConnectionError, AbloIdempotencyError, AbloValidationError, AbloNotFoundError, claimedError, translateHttpError, } from '../../errors.js';
|
|
9
|
+
import { reconcileFunctionalUpdate, } from '../../client/resources/functionalUpdate.js';
|
|
10
|
+
import { assertBrowserSafety, readProcessEnv, resolveApiKey, resolveApiKeyValue, resolveAuthToken, resolveBaseURL, resolveBootstrapBaseUrl, rejectRemovedDatabaseUrlOption, warnIfCliKeyMismatch, } from '../../auth/apiKey.js';
|
|
11
|
+
import { PROTOCOL_VERSION, PROTOCOL_VERSION_HEADER } from '../../wire/protocolVersion.js';
|
|
12
|
+
import { commitRecordSchema, commitRecordListSchema, commitRecordListOptionsSchema, commitRecordWhereSchema, } from '../../commit/contract.js';
|
|
13
|
+
import { logListResponseSchema } from '../../observation/feedContract.js';
|
|
14
|
+
import { claimAcquireResponseSchema, claimHeartbeatBatchReplySchema, claimHeartbeatReplySchema, claimListResponseSchema, claimStateSchema, DEFAULT_CLAIM_TTL_MS, } from '../../claims/contract.js';
|
|
15
|
+
import { modelListResponseSchema, modelReadResponseSchema, } from '../../wire/modelResponses.js';
|
|
16
|
+
import { toMs } from '../../utils/duration.js';
|
|
17
|
+
import { heartbeatCadenceMs, resolveHeartbeatOptions, resolveHeartbeatPlan, startClaimHeartbeatLoop, } from '../../claims/heartbeat.js';
|
|
18
|
+
import { mintSession } from '../../auth/sessionMint.js';
|
|
19
|
+
import { revokeCapability, rotateCapability, } from '../../auth/capabilityLifecycle.js';
|
|
20
|
+
import { parseIdentityResolveResponse } from '../../auth/schemas.js';
|
|
21
|
+
import { claimFromModelClaim, heldHeartbeatReply, parseSuccessfulCommitResponse, } from './helpers.js';
|
|
22
|
+
import { claimAttemptFailure, claimQueueView, emitClaimStatus, resolveClaimContentionOptions, } from '../../client/resources/modelOperations.js';
|
|
23
|
+
import { claimDescription } from '../../coordination/schema.js';
|
|
24
|
+
import { subTarget, streamTarget, batchFence, } from '../../claims/locator.js';
|
|
25
|
+
import { declaredMeta, wireMeta } from '../../claims/meta.js';
|
|
26
|
+
import { assertWriteOptions, assertWriteTarget, } from '../../client/resources/writeOptionsSchema.js';
|
|
27
|
+
import { createModelId, resolveCreatedRows, resolveCreateId, } from '../../client/resources/modelCreate.js';
|
|
28
|
+
import { normalizeWhere } from '../../client/resources/where.js';
|
|
29
|
+
import { createDurableHttpCommitEnvelope, canonicalHttpCommitBody, durableHttpCommitEnvelopeSchema, httpCommitEnvelopeRecordId, isHttpCommitReplayExpired, } from '../../commit/confirmation/httpCommitEnvelope.js';
|
|
30
|
+
import { createClientTxId, normalizeCommitOperations, replicationLagTimeout, } from '../../commit/httpRequest.js';
|
|
31
|
+
import { resolveDurableWrites } from '../../commit/durableWrites.js';
|
|
32
|
+
import { createHttpReadOnChange } from './subscription.js';
|
|
32
33
|
/** @internal Default per-request deadline for the private HTTP transport. */
|
|
33
34
|
export const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
34
35
|
const HTTP_CONFIRMATION_POLL_INTERVAL_MS = 250;
|
|
35
|
-
/**
|
|
36
|
-
* The server's acquire window, mirrored here as the client-side default for a
|
|
37
|
-
* claim that names no `ttl` — it sets the auto-heartbeat cadence.
|
|
38
|
-
*/
|
|
39
|
-
const DEFAULT_CLAIM_TTL_MS = 60_000;
|
|
40
36
|
/** @internal Constructed only by the typed HTTP facade. */
|
|
41
37
|
export function createHttpTransport(options) {
|
|
42
38
|
const env = readProcessEnv();
|
|
@@ -71,8 +67,7 @@ export function createHttpTransport(options) {
|
|
|
71
67
|
const code = errorRecord?.code;
|
|
72
68
|
const isConflict = code === 'stale_context' ||
|
|
73
69
|
code === 'claim_conflict' ||
|
|
74
|
-
code === 'entity_claimed'
|
|
75
|
-
(typeof code === 'string' && code.startsWith('policy:'));
|
|
70
|
+
code === 'entity_claimed';
|
|
76
71
|
if (!isConflict)
|
|
77
72
|
return;
|
|
78
73
|
const rawConflicts = errorRecord?.conflicts;
|
|
@@ -112,6 +107,7 @@ export function createHttpTransport(options) {
|
|
|
112
107
|
let activeRequests = 0;
|
|
113
108
|
let requestIdleWaiters = [];
|
|
114
109
|
let disposePromise = null;
|
|
110
|
+
const readChangeControllers = new Set();
|
|
115
111
|
function requestStarted() {
|
|
116
112
|
activeRequests += 1;
|
|
117
113
|
}
|
|
@@ -219,7 +215,23 @@ export function createHttpTransport(options) {
|
|
|
219
215
|
}
|
|
220
216
|
return target.toString();
|
|
221
217
|
}
|
|
218
|
+
function subscriptionEndpoint() {
|
|
219
|
+
const target = new URL(endpoint('/v1/subscriptions'));
|
|
220
|
+
const partition = effectiveAuthority?.deliveryPartition;
|
|
221
|
+
if (partition) {
|
|
222
|
+
target.searchParams.set('deliveryPartition', `${partition.index}-${partition.count}`);
|
|
223
|
+
}
|
|
224
|
+
return target.toString();
|
|
225
|
+
}
|
|
222
226
|
const requestTimeoutMs = options.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
227
|
+
const onChange = createHttpReadOnChange({
|
|
228
|
+
fetch: fetchImpl,
|
|
229
|
+
endpoint: subscriptionEndpoint,
|
|
230
|
+
authHeaders,
|
|
231
|
+
prepare: ready,
|
|
232
|
+
register: (controller) => readChangeControllers.add(controller),
|
|
233
|
+
unregister: (controller) => readChangeControllers.delete(controller),
|
|
234
|
+
});
|
|
223
235
|
/**
|
|
224
236
|
* Issues one request and returns its decoded body without a contract.
|
|
225
237
|
*
|
|
@@ -838,11 +850,9 @@ export function createHttpTransport(options) {
|
|
|
838
850
|
assertWriteOptions({
|
|
839
851
|
idempotencyKey: commitOptions.idempotencyKey,
|
|
840
852
|
readAt: commitOptions.readAt,
|
|
841
|
-
onStale: commitOptions.onStale,
|
|
842
853
|
wait: commitOptions.wait,
|
|
843
854
|
claim: commitOptions.claim,
|
|
844
855
|
reads: commitOptions.reads,
|
|
845
|
-
track: commitOptions.track,
|
|
846
856
|
}, 'commits.create');
|
|
847
857
|
const clientTxId = createClientTxId(commitOptions.idempotencyKey);
|
|
848
858
|
// Same claim vocabulary as the WS client's `commits.create`: a handle
|
|
@@ -851,12 +861,10 @@ export function createHttpTransport(options) {
|
|
|
851
861
|
const operations = normalizeCommitOperations({
|
|
852
862
|
...commitOptions,
|
|
853
863
|
readAt: commitOptions.readAt ?? claim?.readAt ?? null,
|
|
854
|
-
onStale: commitOptions.onStale ?? (claim?.readAt !== undefined ? 'reject' : null),
|
|
855
864
|
}, batchFence(claim?.target, claim?.fenceToken));
|
|
856
865
|
const requestBody = {
|
|
857
866
|
operations,
|
|
858
867
|
reads: commitOptions.reads,
|
|
859
|
-
track: commitOptions.track,
|
|
860
868
|
};
|
|
861
869
|
const wait = commitOptions.wait ?? 'confirmed';
|
|
862
870
|
let body;
|
|
@@ -888,9 +896,6 @@ export function createHttpTransport(options) {
|
|
|
888
896
|
id: body.id ?? body.clientTxId,
|
|
889
897
|
status: body.status,
|
|
890
898
|
lastSyncId: body.lastSyncId,
|
|
891
|
-
...(body.notifications && body.notifications.length > 0
|
|
892
|
-
? { notifications: body.notifications }
|
|
893
|
-
: {}),
|
|
894
899
|
...(body.missingIds && body.missingIds.length > 0 ? { missingIds: body.missingIds } : {}),
|
|
895
900
|
...(body.operationResults && body.operationResults.length > 0
|
|
896
901
|
? { operationResults: body.operationResults }
|
|
@@ -995,11 +1000,11 @@ export function createHttpTransport(options) {
|
|
|
995
1000
|
...(res.evidence ? { evidence: res.evidence } : {}),
|
|
996
1001
|
};
|
|
997
1002
|
}
|
|
998
|
-
async function
|
|
1003
|
+
async function readModel(modelName, params) {
|
|
999
1004
|
await applyClaimedPolicy({ model: modelName, id: params.id }, params);
|
|
1000
1005
|
const query = await requestJson(`/v1/models/${encodeURIComponent(modelName)}/${encodeURIComponent(params.id)}`, { method: 'GET' }, modelReadResponseSchema);
|
|
1001
1006
|
// A miss is `data: undefined`, not a thrown error. The WebSocket client's
|
|
1002
|
-
// `
|
|
1007
|
+
// `read` returns `T | undefined` for a missing row; throwing only here
|
|
1003
1008
|
// made the obvious read ("does this row exist?") a hard edge that an agent
|
|
1004
1009
|
// had to wrap in try/catch. Both transports agree: an absent row means absent
|
|
1005
1010
|
// data. Callers branch on `.data` (the documented `.data?.x` usage).
|
|
@@ -1025,12 +1030,10 @@ export function createHttpTransport(options) {
|
|
|
1025
1030
|
assertWriteOptions(options && {
|
|
1026
1031
|
idempotencyKey: options.idempotencyKey,
|
|
1027
1032
|
readAt: options.readAt,
|
|
1028
|
-
onStale: options.onStale,
|
|
1029
1033
|
claim: options.claim,
|
|
1030
1034
|
claimRef: options.claimRef,
|
|
1031
1035
|
fenceToken: options.fenceToken,
|
|
1032
1036
|
reads: options.reads,
|
|
1033
|
-
track: options.track,
|
|
1034
1037
|
}, `${modelName} ${action}`);
|
|
1035
1038
|
if (action !== 'create')
|
|
1036
1039
|
assertWriteTarget(action, modelName, id);
|
|
@@ -1052,10 +1055,8 @@ export function createHttpTransport(options) {
|
|
|
1052
1055
|
const readAt = options?.readAt ?? claimHandle?.readAt;
|
|
1053
1056
|
const requestBody = {
|
|
1054
1057
|
claim: normalizeClaimId(options?.claimRef) ?? claimHandle?.id,
|
|
1055
|
-
onStale: options?.onStale ?? (claimHandle?.readAt !== undefined ? 'reject' : undefined),
|
|
1056
1058
|
readAt,
|
|
1057
1059
|
reads: options?.reads,
|
|
1058
|
-
track: options?.track,
|
|
1059
1060
|
// The claim's fencing token (Option B), so the per-model HTTP write door
|
|
1060
1061
|
// fences the same as the WS proxy and `commits.create`.
|
|
1061
1062
|
fenceToken: options?.fenceToken ?? claimHandle?.fenceToken,
|
|
@@ -1184,7 +1185,15 @@ export function createHttpTransport(options) {
|
|
|
1184
1185
|
}, claimHeartbeatReplySchema);
|
|
1185
1186
|
return heldHeartbeatReply(reply, `claim ${claimId} on ${name}/${id}`);
|
|
1186
1187
|
};
|
|
1187
|
-
async function claimImpl(
|
|
1188
|
+
async function claimImpl(idOrParams, opts) {
|
|
1189
|
+
// The row-free form names a key by id alone. Ablo has never held that
|
|
1190
|
+
// row, so there is no snapshot to take after the grant and no `data` on
|
|
1191
|
+
// the handle: the lease is the whole answer. The object form re-reads
|
|
1192
|
+
// the row under the lease and hands back a `HeldClaim`.
|
|
1193
|
+
const rowFree = typeof idOrParams === 'string';
|
|
1194
|
+
const params = rowFree
|
|
1195
|
+
? { ...(opts ?? {}), id: idOrParams }
|
|
1196
|
+
: idOrParams;
|
|
1188
1197
|
let acquired;
|
|
1189
1198
|
try {
|
|
1190
1199
|
acquired = await acquireClaim(params);
|
|
@@ -1210,13 +1219,6 @@ export function createHttpTransport(options) {
|
|
|
1210
1219
|
id: params.id,
|
|
1211
1220
|
description: claimDescription(params),
|
|
1212
1221
|
});
|
|
1213
|
-
const { data, stamp } = await retrieveModel(name, { id: params.id });
|
|
1214
|
-
// A held claim hands back a snapshot; the typed `HeldClaim.data` is `T`.
|
|
1215
|
-
// `retrieve` now reports a miss as `undefined` rather than throwing, but a
|
|
1216
|
-
// claim on a row that doesn't exist has nothing to hold — surface it.
|
|
1217
|
-
if (data === undefined) {
|
|
1218
|
-
throw new AbloNotFoundError(`Cannot claim ${name}/${params.id}: it does not exist (or is outside this credential's scope).`, [params.id]);
|
|
1219
|
-
}
|
|
1220
1222
|
// One reading of the heartbeat options — cadence and callbacks from
|
|
1221
1223
|
// whichever spelling the caller used (plan object, shorthand, or the
|
|
1222
1224
|
// deprecated flat callbacks).
|
|
@@ -1249,10 +1251,9 @@ export function createHttpTransport(options) {
|
|
|
1249
1251
|
// way. `subTarget` is wire-shaped by contract, including here, where the
|
|
1250
1252
|
// value happens to have started out declared.
|
|
1251
1253
|
const { meta, ...narrowed } = subTarget(params, name);
|
|
1252
|
-
|
|
1254
|
+
const lease = {
|
|
1253
1255
|
object: 'claim',
|
|
1254
1256
|
id: claimId,
|
|
1255
|
-
readAt: stamp,
|
|
1256
1257
|
...(fenceToken !== undefined ? { fenceToken } : {}),
|
|
1257
1258
|
target: {
|
|
1258
1259
|
...streamTarget({ model: name, id: params.id }),
|
|
@@ -1260,7 +1261,6 @@ export function createHttpTransport(options) {
|
|
|
1260
1261
|
...(meta !== undefined ? { meta: declaredMeta(meta) } : {}),
|
|
1261
1262
|
},
|
|
1262
1263
|
description: claimDescription(params),
|
|
1263
|
-
data,
|
|
1264
1264
|
release,
|
|
1265
1265
|
revoke: () => {
|
|
1266
1266
|
void release().catch(() => { });
|
|
@@ -1268,6 +1268,21 @@ export function createHttpTransport(options) {
|
|
|
1268
1268
|
heartbeat,
|
|
1269
1269
|
[Symbol.asyncDispose]: release,
|
|
1270
1270
|
};
|
|
1271
|
+
if (rowFree)
|
|
1272
|
+
return lease;
|
|
1273
|
+
const { data, stamp } = await readModel(name, { id: params.id });
|
|
1274
|
+
// A held claim hands back a snapshot; the typed `HeldClaim.data` is `T`.
|
|
1275
|
+
// `retrieve` reports a miss as `undefined`, and a claim on a row that does
|
|
1276
|
+
// not exist has nothing to hold. The grant came BEFORE this read, so the
|
|
1277
|
+
// miss must give the lease back first: otherwise the key stays held under
|
|
1278
|
+
// this credential until the TTL lapses, behind no handle anyone can
|
|
1279
|
+
// release, and every other participant is refused for the duration.
|
|
1280
|
+
if (data === undefined) {
|
|
1281
|
+
await release().catch(() => undefined);
|
|
1282
|
+
throw new AbloNotFoundError(`Cannot claim ${name}/${params.id}: it does not exist (or is outside this credential's scope). ` +
|
|
1283
|
+
`To hold a key before its row exists, claim it by id alone: claim('${params.id}') returns a lease without a snapshot.`, [params.id]);
|
|
1284
|
+
}
|
|
1285
|
+
return { ...lease, readAt: stamp, data };
|
|
1271
1286
|
}
|
|
1272
1287
|
const claimsForEntity = (params) => requestJson(`/v1/claims?model=${encodeURIComponent(name)}&id=${encodeURIComponent(params.id)}${''}`, { method: 'GET' }, claimListResponseSchema);
|
|
1273
1288
|
const claim = Object.assign(claimImpl, {
|
|
@@ -1278,6 +1293,19 @@ export function createHttpTransport(options) {
|
|
|
1278
1293
|
const first = res.data.find((row) => row.status !== 'queued');
|
|
1279
1294
|
return first ? claimFromModelClaim(first) : null;
|
|
1280
1295
|
},
|
|
1296
|
+
// Every holder, from the same one read `state` takes its first entry
|
|
1297
|
+
// from: the server lists holders before waiters, and the caller's own
|
|
1298
|
+
// lease before its peers'. (This member was missing for as long as the
|
|
1299
|
+
// namespace was cast to its type instead of typed as it.)
|
|
1300
|
+
list: async (params) => {
|
|
1301
|
+
const res = await claimsForEntity(params);
|
|
1302
|
+
return {
|
|
1303
|
+
object: 'list',
|
|
1304
|
+
data: res.data
|
|
1305
|
+
.filter((row) => row.status !== 'queued')
|
|
1306
|
+
.map(claimFromModelClaim),
|
|
1307
|
+
};
|
|
1308
|
+
},
|
|
1281
1309
|
queue: async (params) => {
|
|
1282
1310
|
const res = await claimsForEntity(params);
|
|
1283
1311
|
return claimQueueView(res.data
|
|
@@ -1307,7 +1335,7 @@ export function createHttpTransport(options) {
|
|
|
1307
1335
|
// handle. The result was mutual exclusion without lost-update
|
|
1308
1336
|
// detection, on the transport agents run, under code that reads as
|
|
1309
1337
|
// though it had both. The reactive client binds the same three values
|
|
1310
|
-
// from the claim it holds; a caller's own `readAt
|
|
1338
|
+
// from the claim it holds; a caller's own `readAt` wins.
|
|
1311
1339
|
return run({
|
|
1312
1340
|
...input,
|
|
1313
1341
|
claimRef: { id: claimInput.id },
|
|
@@ -1317,9 +1345,6 @@ export function createHttpTransport(options) {
|
|
|
1317
1345
|
...(input?.readAt === undefined && claimInput.readAt !== undefined
|
|
1318
1346
|
? { readAt: claimInput.readAt }
|
|
1319
1347
|
: {}),
|
|
1320
|
-
...(input?.onStale === undefined && claimInput.readAt !== undefined
|
|
1321
|
-
? { onStale: 'reject' }
|
|
1322
|
-
: {}),
|
|
1323
1348
|
claim: undefined,
|
|
1324
1349
|
});
|
|
1325
1350
|
}
|
|
@@ -1345,7 +1370,7 @@ export function createHttpTransport(options) {
|
|
|
1345
1370
|
function updateModel(arg, updater, contention) {
|
|
1346
1371
|
// Functional form: update(id, current => next). The SDK owns the
|
|
1347
1372
|
// read-fresh → compute → compare-and-swap → reconcile loop; correctness
|
|
1348
|
-
// rides on the row's watermark (readAt
|
|
1373
|
+
// rides on the row's watermark (`readAt`), so no claim
|
|
1349
1374
|
// or per-participant identity is needed and contention never clobbers.
|
|
1350
1375
|
if (typeof arg === 'string') {
|
|
1351
1376
|
const id = arg;
|
|
@@ -1357,12 +1382,11 @@ export function createHttpTransport(options) {
|
|
|
1357
1382
|
model: name,
|
|
1358
1383
|
id,
|
|
1359
1384
|
readFresh: async () => {
|
|
1360
|
-
const read = await
|
|
1385
|
+
const read = await readModel(name, { id });
|
|
1361
1386
|
return { data: read.data, stamp: read.stamp };
|
|
1362
1387
|
},
|
|
1363
1388
|
writeNext: (patch, readAt) => mutateModel('update', name, id, patch, {
|
|
1364
1389
|
readAt,
|
|
1365
|
-
onStale: 'reject',
|
|
1366
1390
|
}),
|
|
1367
1391
|
});
|
|
1368
1392
|
}
|
|
@@ -1374,11 +1398,8 @@ export function createHttpTransport(options) {
|
|
|
1374
1398
|
}
|
|
1375
1399
|
return {
|
|
1376
1400
|
claim,
|
|
1377
|
-
|
|
1378
|
-
return
|
|
1379
|
-
},
|
|
1380
|
-
retrieve(params) {
|
|
1381
|
-
return retrieveModel(name, params);
|
|
1401
|
+
read(params) {
|
|
1402
|
+
return readModel(name, params);
|
|
1382
1403
|
},
|
|
1383
1404
|
list(options) {
|
|
1384
1405
|
return listModel(name, options);
|
|
@@ -1394,7 +1415,7 @@ export function createHttpTransport(options) {
|
|
|
1394
1415
|
// an existing id, the existing row rather than the caller's input.
|
|
1395
1416
|
let created;
|
|
1396
1417
|
await mutateModel('create', name, id, params.data, options, async () => {
|
|
1397
|
-
const read = await
|
|
1418
|
+
const read = await readModel(name, { id });
|
|
1398
1419
|
if (read.data === undefined) {
|
|
1399
1420
|
throw new AbloNotFoundError(`create ${name}/${id} did not yield a readable row (the write did not confirm).`, [id]);
|
|
1400
1421
|
}
|
|
@@ -1448,7 +1469,7 @@ export function createHttpTransport(options) {
|
|
|
1448
1469
|
ids,
|
|
1449
1470
|
operationResults: receipt.operationResults,
|
|
1450
1471
|
readRow: async (id) => {
|
|
1451
|
-
const read = await
|
|
1472
|
+
const read = await readModel(name, { id });
|
|
1452
1473
|
return read.data;
|
|
1453
1474
|
},
|
|
1454
1475
|
});
|
|
@@ -1460,29 +1481,6 @@ export function createHttpTransport(options) {
|
|
|
1460
1481
|
return mutateModel('delete', name, params.id, undefined, options);
|
|
1461
1482
|
});
|
|
1462
1483
|
},
|
|
1463
|
-
async track(params) {
|
|
1464
|
-
const dependency = {
|
|
1465
|
-
model: name.toLowerCase(),
|
|
1466
|
-
id: params.id,
|
|
1467
|
-
...(params.readAt !== undefined ? { readAt: params.readAt } : {}),
|
|
1468
|
-
};
|
|
1469
|
-
// A track carries no write, so it rides the commit lane as a
|
|
1470
|
-
// zero-operation body — the shape `/v1/commits` accepts for registering
|
|
1471
|
-
// a premise without one. Going through the same durable lane as every
|
|
1472
|
-
// other commit means a disconnect replays the registration rather than
|
|
1473
|
-
// dropping it, and a notification that had already fired is not lost to
|
|
1474
|
-
// a retry.
|
|
1475
|
-
const body = await dispatchHttpCommit({
|
|
1476
|
-
path: '/v1/commits',
|
|
1477
|
-
method: 'POST',
|
|
1478
|
-
idempotencyKey: createClientTxId(),
|
|
1479
|
-
body: { track: [dependency] },
|
|
1480
|
-
wait: 'confirmed',
|
|
1481
|
-
});
|
|
1482
|
-
return body.notifications && body.notifications.length > 0
|
|
1483
|
-
? { notifications: body.notifications }
|
|
1484
|
-
: {};
|
|
1485
|
-
},
|
|
1486
1484
|
};
|
|
1487
1485
|
}
|
|
1488
1486
|
return {
|
|
@@ -1495,6 +1493,9 @@ export function createHttpTransport(options) {
|
|
|
1495
1493
|
}),
|
|
1496
1494
|
dispose() {
|
|
1497
1495
|
if (!disposePromise) {
|
|
1496
|
+
for (const controller of readChangeControllers)
|
|
1497
|
+
controller.abort();
|
|
1498
|
+
readChangeControllers.clear();
|
|
1498
1499
|
const scheduledCommits = httpCommitLane;
|
|
1499
1500
|
disposePromise = (async () => {
|
|
1500
1501
|
await scheduledCommits;
|
|
@@ -1504,6 +1505,7 @@ export function createHttpTransport(options) {
|
|
|
1504
1505
|
return disposePromise;
|
|
1505
1506
|
},
|
|
1506
1507
|
async purge() { },
|
|
1508
|
+
onChange,
|
|
1507
1509
|
commits,
|
|
1508
1510
|
claims,
|
|
1509
1511
|
logs,
|
|
@@ -1577,4 +1579,4 @@ function parseBody(bodyText) {
|
|
|
1577
1579
|
return bodyText;
|
|
1578
1580
|
}
|
|
1579
1581
|
}
|
|
1580
|
-
//# sourceMappingURL=
|
|
1582
|
+
//# sourceMappingURL=transport.js.map
|