@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
|
@@ -5,11 +5,12 @@
|
|
|
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 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,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/transport/http/transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAKV,cAAc,EAGd,kBAAkB,EAClB,kBAAkB,EAMlB,gBAAgB,EAIhB,eAAe,EAChB,MAAM,yCAAyC,CAAC;AAOjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAOnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAqC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AA4BxE,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAElF,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACpE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,iFAAiF;IACjF,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACvE;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,yBAAyB,CAAC;IACnD;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAMjD,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,oDAAoD;IACpD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,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,87 +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 {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...(reply.queueDepth !== undefined ? { queueDepth: reply.queueDepth } : {}),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
throw new AbloClaimedError(`The lease behind ${label} is no longer held — it expired or was granted onward. Re-acquire the claim and retry; a write attempted under the old lease is rejected by its \`readAt\` guard.`, { code: 'claim_lost' });
|
|
37
|
-
}
|
|
38
|
-
import { claimAttemptFailure, claimQueueView, emitClaimStatus, resolveClaimContentionOptions, } from '../resources/modelOperations.js';
|
|
39
|
-
import { claimDescription } from '../coordination/schema.js';
|
|
40
|
-
import { subTarget, streamTarget, batchFence, claimIdFor, fenceTokenFor, } from '../coordination/locator.js';
|
|
41
|
-
import { declaredMeta, wireMeta } from '../coordination/claimMeta.js';
|
|
42
|
-
import { assertWriteOptions } from '../resources/writeOptionsSchema.js';
|
|
43
|
-
import { normalizeWhere } from '../resources/where.js';
|
|
44
|
-
import { createDurableHttpCommitEnvelope, canonicalHttpCommitBody, durableHttpCommitEnvelopeSchema, httpCommitEnvelopeRecordId, isHttpCommitReplayExpired, } from '../transactions/confirmation/httpCommitEnvelope.js';
|
|
45
|
-
import { resolveDurableWrites } from '../durableWrites.js';
|
|
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';
|
|
46
33
|
/** @internal Default per-request deadline for the private HTTP transport. */
|
|
47
34
|
export const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
48
35
|
const HTTP_CONFIRMATION_POLL_INTERVAL_MS = 250;
|
|
49
|
-
/**
|
|
50
|
-
* The server's acquire window, mirrored here as the client-side default for a
|
|
51
|
-
* claim that names no `ttl` — it sets the auto-heartbeat cadence.
|
|
52
|
-
*/
|
|
53
|
-
const DEFAULT_CLAIM_TTL_MS = 60_000;
|
|
54
|
-
function parseSuccessfulCommitResponse(value, idempotencyKey) {
|
|
55
|
-
const parsed = commitReceiptSchema.safeParse(value);
|
|
56
|
-
if (!parsed.success || parsed.data.clientTxId !== idempotencyKey) {
|
|
57
|
-
throw new AbloConnectionError('The commit endpoint returned an invalid success receipt; its outcome remains pending and is safe to retry.', {
|
|
58
|
-
code: 'commit_no_result',
|
|
59
|
-
cause: parsed.success
|
|
60
|
-
? new Error('Commit receipt clientTxId did not match its idempotency key')
|
|
61
|
-
: parsed.error,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return parsed.data;
|
|
65
|
-
}
|
|
66
|
-
/** Decode the HTTP claim DTO into the one public Claim shape. */
|
|
67
|
-
function claimFromModelClaim(claim) {
|
|
68
|
-
// The handle a caller reads back is a public claim, so its `meta` is the
|
|
69
|
-
// declared shape; the rest of the sub-entity locator crosses whole rather
|
|
70
|
-
// than member by member, which is how `fields` used to die on this hop.
|
|
71
|
-
const { meta, ...details } = subTarget(claim.target);
|
|
72
|
-
return {
|
|
73
|
-
object: 'claim',
|
|
74
|
-
id: claim.id,
|
|
75
|
-
...(claim.status ? { status: claim.status } : {}),
|
|
76
|
-
// The server always stamps a description; default only for total safety.
|
|
77
|
-
description: claim.description ?? 'editing',
|
|
78
|
-
heldBy: claim.actor,
|
|
79
|
-
participantKind: claim.participantKind,
|
|
80
|
-
expiresAt: claim.expiresAt,
|
|
81
|
-
...(claim.position !== undefined ? { position: claim.position } : {}),
|
|
82
|
-
target: {
|
|
83
|
-
...streamTarget(claim.target),
|
|
84
|
-
...details,
|
|
85
|
-
...(meta !== undefined ? { meta: declaredMeta(meta) } : {}),
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
36
|
/** @internal Constructed only by the typed HTTP facade. */
|
|
90
37
|
export function createHttpTransport(options) {
|
|
91
38
|
const env = readProcessEnv();
|
|
@@ -120,8 +67,7 @@ export function createHttpTransport(options) {
|
|
|
120
67
|
const code = errorRecord?.code;
|
|
121
68
|
const isConflict = code === 'stale_context' ||
|
|
122
69
|
code === 'claim_conflict' ||
|
|
123
|
-
code === 'entity_claimed'
|
|
124
|
-
(typeof code === 'string' && code.startsWith('policy:'));
|
|
70
|
+
code === 'entity_claimed';
|
|
125
71
|
if (!isConflict)
|
|
126
72
|
return;
|
|
127
73
|
const rawConflicts = errorRecord?.conflicts;
|
|
@@ -161,6 +107,7 @@ export function createHttpTransport(options) {
|
|
|
161
107
|
let activeRequests = 0;
|
|
162
108
|
let requestIdleWaiters = [];
|
|
163
109
|
let disposePromise = null;
|
|
110
|
+
const readChangeControllers = new Set();
|
|
164
111
|
function requestStarted() {
|
|
165
112
|
activeRequests += 1;
|
|
166
113
|
}
|
|
@@ -268,7 +215,23 @@ export function createHttpTransport(options) {
|
|
|
268
215
|
}
|
|
269
216
|
return target.toString();
|
|
270
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
|
+
}
|
|
271
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
|
+
});
|
|
272
235
|
/**
|
|
273
236
|
* Issues one request and returns its decoded body without a contract.
|
|
274
237
|
*
|
|
@@ -456,18 +419,6 @@ export function createHttpTransport(options) {
|
|
|
456
419
|
// Receipt observation must never change the commit outcome.
|
|
457
420
|
}
|
|
458
421
|
}
|
|
459
|
-
function replicationLagTimeout(request, response) {
|
|
460
|
-
return new AbloConnectionError(`The source accepted commit ${request.idempotencyKey}, but its replication echo did not arrive within ${requestTimeoutMs}ms.`, {
|
|
461
|
-
code: 'replication_lag_timeout',
|
|
462
|
-
httpStatus: 504,
|
|
463
|
-
details: {
|
|
464
|
-
clientTxId: request.idempotencyKey,
|
|
465
|
-
...(response.correlationId ? { correlationId: response.correlationId } : {}),
|
|
466
|
-
timeoutMs: requestTimeoutMs,
|
|
467
|
-
accepted: true,
|
|
468
|
-
},
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
422
|
/**
|
|
472
423
|
* Replays one byte-identical, idempotent HTTP commit until mutation-log
|
|
473
424
|
* replay reports the source echo as confirmed. `queued` is acceptance only:
|
|
@@ -485,7 +436,7 @@ export function createHttpTransport(options) {
|
|
|
485
436
|
while (current.status === 'queued') {
|
|
486
437
|
const remaining = deadlineAt === null ? null : deadlineAt - Date.now();
|
|
487
438
|
if (remaining !== null && remaining <= 0) {
|
|
488
|
-
throw replicationLagTimeout(request, current);
|
|
439
|
+
throw replicationLagTimeout(request, current, requestTimeoutMs);
|
|
489
440
|
}
|
|
490
441
|
const confirmationController = new AbortController();
|
|
491
442
|
const confirmationDeadline = remaining !== null
|
|
@@ -513,7 +464,7 @@ export function createHttpTransport(options) {
|
|
|
513
464
|
catch (error) {
|
|
514
465
|
if (confirmationController.signal.aborted ||
|
|
515
466
|
(deadlineAt !== null && Date.now() >= deadlineAt)) {
|
|
516
|
-
throw replicationLagTimeout(request, current);
|
|
467
|
+
throw replicationLagTimeout(request, current, requestTimeoutMs);
|
|
517
468
|
}
|
|
518
469
|
throw error;
|
|
519
470
|
}
|
|
@@ -762,43 +713,6 @@ export function createHttpTransport(options) {
|
|
|
762
713
|
return response;
|
|
763
714
|
});
|
|
764
715
|
}
|
|
765
|
-
function createClientTxId(idempotencyKey) {
|
|
766
|
-
if (idempotencyKey && idempotencyKey.length > 0)
|
|
767
|
-
return idempotencyKey;
|
|
768
|
-
return typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
|
|
769
|
-
? crypto.randomUUID()
|
|
770
|
-
: `tx_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
771
|
-
}
|
|
772
|
-
function createModelId(modelName, idempotencyKey) {
|
|
773
|
-
if (idempotencyKey) {
|
|
774
|
-
return uuidv5(`${modelName}:${idempotencyKey}`, 'aa4ba6d4-bf0b-5b38-9c45-116f79a6e548');
|
|
775
|
-
}
|
|
776
|
-
return typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
|
|
777
|
-
? crypto.randomUUID()
|
|
778
|
-
: `id_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
779
|
-
}
|
|
780
|
-
function normalizeCommitOperation(op, defaults, fence, claim) {
|
|
781
|
-
return {
|
|
782
|
-
action: op.action,
|
|
783
|
-
model: op.model,
|
|
784
|
-
id: op.id ?? null,
|
|
785
|
-
data: op.data ?? null,
|
|
786
|
-
where: op.where ?? null,
|
|
787
|
-
transactionId: op.transactionId ?? null,
|
|
788
|
-
claimId: op.claimId ?? claimIdFor(claim?.target, claim?.id, op.model, op.id ?? null),
|
|
789
|
-
readAt: op.readAt ?? defaults.readAt ?? null,
|
|
790
|
-
onStale: op.onStale ?? defaults.onStale ?? null,
|
|
791
|
-
fenceToken: op.fenceToken ?? fenceTokenFor(fence, op.model, op.id ?? null),
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
function normalizeCommitOperations(commitOptions, fence) {
|
|
795
|
-
if (commitOptions.operations.length === 0) {
|
|
796
|
-
throw new AbloValidationError('Commit requires a non-empty `operations` array.', {
|
|
797
|
-
code: 'commit_operation_required',
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
return commitOptions.operations.map((op) => normalizeCommitOperation(op, commitOptions, fence, commitOptions.claim ?? null));
|
|
801
|
-
}
|
|
802
716
|
async function listClaimState(target) {
|
|
803
717
|
const params = new URLSearchParams();
|
|
804
718
|
if (target?.model)
|
|
@@ -936,11 +850,9 @@ export function createHttpTransport(options) {
|
|
|
936
850
|
assertWriteOptions({
|
|
937
851
|
idempotencyKey: commitOptions.idempotencyKey,
|
|
938
852
|
readAt: commitOptions.readAt,
|
|
939
|
-
onStale: commitOptions.onStale,
|
|
940
853
|
wait: commitOptions.wait,
|
|
941
854
|
claim: commitOptions.claim,
|
|
942
855
|
reads: commitOptions.reads,
|
|
943
|
-
track: commitOptions.track,
|
|
944
856
|
}, 'commits.create');
|
|
945
857
|
const clientTxId = createClientTxId(commitOptions.idempotencyKey);
|
|
946
858
|
// Same claim vocabulary as the WS client's `commits.create`: a handle
|
|
@@ -949,12 +861,10 @@ export function createHttpTransport(options) {
|
|
|
949
861
|
const operations = normalizeCommitOperations({
|
|
950
862
|
...commitOptions,
|
|
951
863
|
readAt: commitOptions.readAt ?? claim?.readAt ?? null,
|
|
952
|
-
onStale: commitOptions.onStale ?? (claim?.readAt !== undefined ? 'reject' : null),
|
|
953
864
|
}, batchFence(claim?.target, claim?.fenceToken));
|
|
954
865
|
const requestBody = {
|
|
955
866
|
operations,
|
|
956
867
|
reads: commitOptions.reads,
|
|
957
|
-
track: commitOptions.track,
|
|
958
868
|
};
|
|
959
869
|
const wait = commitOptions.wait ?? 'confirmed';
|
|
960
870
|
let body;
|
|
@@ -986,9 +896,6 @@ export function createHttpTransport(options) {
|
|
|
986
896
|
id: body.id ?? body.clientTxId,
|
|
987
897
|
status: body.status,
|
|
988
898
|
lastSyncId: body.lastSyncId,
|
|
989
|
-
...(body.notifications && body.notifications.length > 0
|
|
990
|
-
? { notifications: body.notifications }
|
|
991
|
-
: {}),
|
|
992
899
|
...(body.missingIds && body.missingIds.length > 0 ? { missingIds: body.missingIds } : {}),
|
|
993
900
|
...(body.operationResults && body.operationResults.length > 0
|
|
994
901
|
? { operationResults: body.operationResults }
|
|
@@ -1093,11 +1000,11 @@ export function createHttpTransport(options) {
|
|
|
1093
1000
|
...(res.evidence ? { evidence: res.evidence } : {}),
|
|
1094
1001
|
};
|
|
1095
1002
|
}
|
|
1096
|
-
async function
|
|
1003
|
+
async function readModel(modelName, params) {
|
|
1097
1004
|
await applyClaimedPolicy({ model: modelName, id: params.id }, params);
|
|
1098
1005
|
const query = await requestJson(`/v1/models/${encodeURIComponent(modelName)}/${encodeURIComponent(params.id)}`, { method: 'GET' }, modelReadResponseSchema);
|
|
1099
1006
|
// A miss is `data: undefined`, not a thrown error. The WebSocket client's
|
|
1100
|
-
// `
|
|
1007
|
+
// `read` returns `T | undefined` for a missing row; throwing only here
|
|
1101
1008
|
// made the obvious read ("does this row exist?") a hard edge that an agent
|
|
1102
1009
|
// had to wrap in try/catch. Both transports agree: an absent row means absent
|
|
1103
1010
|
// data. Callers branch on `.data` (the documented `.data?.x` usage).
|
|
@@ -1123,13 +1030,13 @@ export function createHttpTransport(options) {
|
|
|
1123
1030
|
assertWriteOptions(options && {
|
|
1124
1031
|
idempotencyKey: options.idempotencyKey,
|
|
1125
1032
|
readAt: options.readAt,
|
|
1126
|
-
onStale: options.onStale,
|
|
1127
1033
|
claim: options.claim,
|
|
1128
1034
|
claimRef: options.claimRef,
|
|
1129
1035
|
fenceToken: options.fenceToken,
|
|
1130
1036
|
reads: options.reads,
|
|
1131
|
-
track: options.track,
|
|
1132
1037
|
}, `${modelName} ${action}`);
|
|
1038
|
+
if (action !== 'create')
|
|
1039
|
+
assertWriteTarget(action, modelName, id);
|
|
1133
1040
|
const clientTxId = createClientTxId(options?.idempotencyKey);
|
|
1134
1041
|
const encModel = encodeURIComponent(modelName);
|
|
1135
1042
|
const path = action === 'create'
|
|
@@ -1148,10 +1055,8 @@ export function createHttpTransport(options) {
|
|
|
1148
1055
|
const readAt = options?.readAt ?? claimHandle?.readAt;
|
|
1149
1056
|
const requestBody = {
|
|
1150
1057
|
claim: normalizeClaimId(options?.claimRef) ?? claimHandle?.id,
|
|
1151
|
-
onStale: options?.onStale ?? (claimHandle?.readAt !== undefined ? 'reject' : undefined),
|
|
1152
1058
|
readAt,
|
|
1153
1059
|
reads: options?.reads,
|
|
1154
|
-
track: options?.track,
|
|
1155
1060
|
// The claim's fencing token (Option B), so the per-model HTTP write door
|
|
1156
1061
|
// fences the same as the WS proxy and `commits.create`.
|
|
1157
1062
|
fenceToken: options?.fenceToken ?? claimHandle?.fenceToken,
|
|
@@ -1280,7 +1185,15 @@ export function createHttpTransport(options) {
|
|
|
1280
1185
|
}, claimHeartbeatReplySchema);
|
|
1281
1186
|
return heldHeartbeatReply(reply, `claim ${claimId} on ${name}/${id}`);
|
|
1282
1187
|
};
|
|
1283
|
-
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;
|
|
1284
1197
|
let acquired;
|
|
1285
1198
|
try {
|
|
1286
1199
|
acquired = await acquireClaim(params);
|
|
@@ -1306,13 +1219,6 @@ export function createHttpTransport(options) {
|
|
|
1306
1219
|
id: params.id,
|
|
1307
1220
|
description: claimDescription(params),
|
|
1308
1221
|
});
|
|
1309
|
-
const { data, stamp } = await retrieveModel(name, { id: params.id });
|
|
1310
|
-
// A held claim hands back a snapshot; the typed `HeldClaim.data` is `T`.
|
|
1311
|
-
// `retrieve` now reports a miss as `undefined` rather than throwing, but a
|
|
1312
|
-
// claim on a row that doesn't exist has nothing to hold — surface it.
|
|
1313
|
-
if (data === undefined) {
|
|
1314
|
-
throw new AbloNotFoundError(`Cannot claim ${name}/${params.id}: it does not exist (or is outside this credential's scope).`, [params.id]);
|
|
1315
|
-
}
|
|
1316
1222
|
// One reading of the heartbeat options — cadence and callbacks from
|
|
1317
1223
|
// whichever spelling the caller used (plan object, shorthand, or the
|
|
1318
1224
|
// deprecated flat callbacks).
|
|
@@ -1345,10 +1251,9 @@ export function createHttpTransport(options) {
|
|
|
1345
1251
|
// way. `subTarget` is wire-shaped by contract, including here, where the
|
|
1346
1252
|
// value happens to have started out declared.
|
|
1347
1253
|
const { meta, ...narrowed } = subTarget(params, name);
|
|
1348
|
-
|
|
1254
|
+
const lease = {
|
|
1349
1255
|
object: 'claim',
|
|
1350
1256
|
id: claimId,
|
|
1351
|
-
readAt: stamp,
|
|
1352
1257
|
...(fenceToken !== undefined ? { fenceToken } : {}),
|
|
1353
1258
|
target: {
|
|
1354
1259
|
...streamTarget({ model: name, id: params.id }),
|
|
@@ -1356,7 +1261,6 @@ export function createHttpTransport(options) {
|
|
|
1356
1261
|
...(meta !== undefined ? { meta: declaredMeta(meta) } : {}),
|
|
1357
1262
|
},
|
|
1358
1263
|
description: claimDescription(params),
|
|
1359
|
-
data,
|
|
1360
1264
|
release,
|
|
1361
1265
|
revoke: () => {
|
|
1362
1266
|
void release().catch(() => { });
|
|
@@ -1364,6 +1268,21 @@ export function createHttpTransport(options) {
|
|
|
1364
1268
|
heartbeat,
|
|
1365
1269
|
[Symbol.asyncDispose]: release,
|
|
1366
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 };
|
|
1367
1286
|
}
|
|
1368
1287
|
const claimsForEntity = (params) => requestJson(`/v1/claims?model=${encodeURIComponent(name)}&id=${encodeURIComponent(params.id)}${''}`, { method: 'GET' }, claimListResponseSchema);
|
|
1369
1288
|
const claim = Object.assign(claimImpl, {
|
|
@@ -1374,6 +1293,19 @@ export function createHttpTransport(options) {
|
|
|
1374
1293
|
const first = res.data.find((row) => row.status !== 'queued');
|
|
1375
1294
|
return first ? claimFromModelClaim(first) : null;
|
|
1376
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
|
+
},
|
|
1377
1309
|
queue: async (params) => {
|
|
1378
1310
|
const res = await claimsForEntity(params);
|
|
1379
1311
|
return claimQueueView(res.data
|
|
@@ -1396,12 +1328,23 @@ export function createHttpTransport(options) {
|
|
|
1396
1328
|
if (!claimInput)
|
|
1397
1329
|
return run(input);
|
|
1398
1330
|
if (isClaimHandle(claimInput)) {
|
|
1331
|
+
// The lease's watermark travels with it. Unwrapping the handle to a
|
|
1332
|
+
// `claimRef` is what put this here: `mutateModel` reads `readAt` off a
|
|
1333
|
+
// handle on `claim`, and this sets `claim: undefined` before it looks,
|
|
1334
|
+
// so the stale guard was silently dropped on every write that named a
|
|
1335
|
+
// handle. The result was mutual exclusion without lost-update
|
|
1336
|
+
// detection, on the transport agents run, under code that reads as
|
|
1337
|
+
// though it had both. The reactive client binds the same three values
|
|
1338
|
+
// from the claim it holds; a caller's own `readAt` wins.
|
|
1399
1339
|
return run({
|
|
1400
1340
|
...input,
|
|
1401
1341
|
claimRef: { id: claimInput.id },
|
|
1402
1342
|
...(claimInput.fenceToken !== undefined
|
|
1403
1343
|
? { fenceToken: claimInput.fenceToken }
|
|
1404
1344
|
: {}),
|
|
1345
|
+
...(input?.readAt === undefined && claimInput.readAt !== undefined
|
|
1346
|
+
? { readAt: claimInput.readAt }
|
|
1347
|
+
: {}),
|
|
1405
1348
|
claim: undefined,
|
|
1406
1349
|
});
|
|
1407
1350
|
}
|
|
@@ -1427,7 +1370,7 @@ export function createHttpTransport(options) {
|
|
|
1427
1370
|
function updateModel(arg, updater, contention) {
|
|
1428
1371
|
// Functional form: update(id, current => next). The SDK owns the
|
|
1429
1372
|
// read-fresh → compute → compare-and-swap → reconcile loop; correctness
|
|
1430
|
-
// rides on the row's watermark (readAt
|
|
1373
|
+
// rides on the row's watermark (`readAt`), so no claim
|
|
1431
1374
|
// or per-participant identity is needed and contention never clobbers.
|
|
1432
1375
|
if (typeof arg === 'string') {
|
|
1433
1376
|
const id = arg;
|
|
@@ -1439,12 +1382,11 @@ export function createHttpTransport(options) {
|
|
|
1439
1382
|
model: name,
|
|
1440
1383
|
id,
|
|
1441
1384
|
readFresh: async () => {
|
|
1442
|
-
const read = await
|
|
1385
|
+
const read = await readModel(name, { id });
|
|
1443
1386
|
return { data: read.data, stamp: read.stamp };
|
|
1444
1387
|
},
|
|
1445
1388
|
writeNext: (patch, readAt) => mutateModel('update', name, id, patch, {
|
|
1446
1389
|
readAt,
|
|
1447
|
-
onStale: 'reject',
|
|
1448
1390
|
}),
|
|
1449
1391
|
});
|
|
1450
1392
|
}
|
|
@@ -1456,11 +1398,8 @@ export function createHttpTransport(options) {
|
|
|
1456
1398
|
}
|
|
1457
1399
|
return {
|
|
1458
1400
|
claim,
|
|
1459
|
-
|
|
1460
|
-
return
|
|
1461
|
-
},
|
|
1462
|
-
retrieve(params) {
|
|
1463
|
-
return retrieveModel(name, params);
|
|
1401
|
+
read(params) {
|
|
1402
|
+
return readModel(name, params);
|
|
1464
1403
|
},
|
|
1465
1404
|
list(options) {
|
|
1466
1405
|
return listModel(name, options);
|
|
@@ -1476,7 +1415,7 @@ export function createHttpTransport(options) {
|
|
|
1476
1415
|
// an existing id, the existing row rather than the caller's input.
|
|
1477
1416
|
let created;
|
|
1478
1417
|
await mutateModel('create', name, id, params.data, options, async () => {
|
|
1479
|
-
const read = await
|
|
1418
|
+
const read = await readModel(name, { id });
|
|
1480
1419
|
if (read.data === undefined) {
|
|
1481
1420
|
throw new AbloNotFoundError(`create ${name}/${id} did not yield a readable row (the write did not confirm).`, [id]);
|
|
1482
1421
|
}
|
|
@@ -1490,6 +1429,51 @@ export function createHttpTransport(options) {
|
|
|
1490
1429
|
return created;
|
|
1491
1430
|
});
|
|
1492
1431
|
},
|
|
1432
|
+
/**
|
|
1433
|
+
* Creates many rows as ONE commit, and returns them.
|
|
1434
|
+
*
|
|
1435
|
+
* Atomic on purpose: a batch that half-lands leaves the caller to work
|
|
1436
|
+
* out which half, and every other write door here declines whole. One
|
|
1437
|
+
* rejected row declines the batch.
|
|
1438
|
+
*
|
|
1439
|
+
* A fresh receipt returns the authoritative rows directly from the
|
|
1440
|
+
* writing transaction. A durable idempotency replay deliberately redacts
|
|
1441
|
+
* those rows, so that path verifies every deterministic id with a point
|
|
1442
|
+
* read and fails loudly if policy prevents a complete answer. Neither
|
|
1443
|
+
* path can report a partial collection as success.
|
|
1444
|
+
*
|
|
1445
|
+
* Ids are resolved here rather than left to the server, so the results
|
|
1446
|
+
* can be returned in the caller's own order rather than the order the
|
|
1447
|
+
* transaction happened to settle them.
|
|
1448
|
+
*/
|
|
1449
|
+
async createMany(params) {
|
|
1450
|
+
if (params.data.length === 0)
|
|
1451
|
+
return [];
|
|
1452
|
+
// A claim/stale guard addresses one existing row, so the canonical
|
|
1453
|
+
// batch-create options do not admit those fields at all.
|
|
1454
|
+
const { data, ...options } = params;
|
|
1455
|
+
const ids = data.map((row, index) => resolveCreateId(undefined, row) ??
|
|
1456
|
+
createModelId(name, params.idempotencyKey ? `${params.idempotencyKey}:${index}` : null));
|
|
1457
|
+
const receipt = await commits.create({
|
|
1458
|
+
...options,
|
|
1459
|
+
operations: data.map((row, index) => ({
|
|
1460
|
+
action: 'create',
|
|
1461
|
+
model: name,
|
|
1462
|
+
id: ids[index] ?? null,
|
|
1463
|
+
data: row,
|
|
1464
|
+
})),
|
|
1465
|
+
wait: 'confirmed',
|
|
1466
|
+
});
|
|
1467
|
+
return resolveCreatedRows({
|
|
1468
|
+
modelName: name,
|
|
1469
|
+
ids,
|
|
1470
|
+
operationResults: receipt.operationResults,
|
|
1471
|
+
readRow: async (id) => {
|
|
1472
|
+
const read = await readModel(name, { id });
|
|
1473
|
+
return read.data;
|
|
1474
|
+
},
|
|
1475
|
+
});
|
|
1476
|
+
},
|
|
1493
1477
|
update: updateModel,
|
|
1494
1478
|
async delete(params) {
|
|
1495
1479
|
return withMutationClaim(params.id, params, async (options) => {
|
|
@@ -1497,29 +1481,6 @@ export function createHttpTransport(options) {
|
|
|
1497
1481
|
return mutateModel('delete', name, params.id, undefined, options);
|
|
1498
1482
|
});
|
|
1499
1483
|
},
|
|
1500
|
-
async track(params) {
|
|
1501
|
-
const dependency = {
|
|
1502
|
-
model: name.toLowerCase(),
|
|
1503
|
-
id: params.id,
|
|
1504
|
-
...(params.readAt !== undefined ? { readAt: params.readAt } : {}),
|
|
1505
|
-
};
|
|
1506
|
-
// A track carries no write, so it rides the commit lane as a
|
|
1507
|
-
// zero-operation body — the shape `/v1/commits` accepts for registering
|
|
1508
|
-
// a premise without one. Going through the same durable lane as every
|
|
1509
|
-
// other commit means a disconnect replays the registration rather than
|
|
1510
|
-
// dropping it, and a notification that had already fired is not lost to
|
|
1511
|
-
// a retry.
|
|
1512
|
-
const body = await dispatchHttpCommit({
|
|
1513
|
-
path: '/v1/commits',
|
|
1514
|
-
method: 'POST',
|
|
1515
|
-
idempotencyKey: createClientTxId(),
|
|
1516
|
-
body: { track: [dependency] },
|
|
1517
|
-
wait: 'confirmed',
|
|
1518
|
-
});
|
|
1519
|
-
return body.notifications && body.notifications.length > 0
|
|
1520
|
-
? { notifications: body.notifications }
|
|
1521
|
-
: {};
|
|
1522
|
-
},
|
|
1523
1484
|
};
|
|
1524
1485
|
}
|
|
1525
1486
|
return {
|
|
@@ -1532,6 +1493,9 @@ export function createHttpTransport(options) {
|
|
|
1532
1493
|
}),
|
|
1533
1494
|
dispose() {
|
|
1534
1495
|
if (!disposePromise) {
|
|
1496
|
+
for (const controller of readChangeControllers)
|
|
1497
|
+
controller.abort();
|
|
1498
|
+
readChangeControllers.clear();
|
|
1535
1499
|
const scheduledCommits = httpCommitLane;
|
|
1536
1500
|
disposePromise = (async () => {
|
|
1537
1501
|
await scheduledCommits;
|
|
@@ -1541,6 +1505,7 @@ export function createHttpTransport(options) {
|
|
|
1541
1505
|
return disposePromise;
|
|
1542
1506
|
},
|
|
1543
1507
|
async purge() { },
|
|
1508
|
+
onChange,
|
|
1544
1509
|
commits,
|
|
1545
1510
|
claims,
|
|
1546
1511
|
logs,
|
|
@@ -1614,4 +1579,4 @@ function parseBody(bodyText) {
|
|
|
1614
1579
|
return bodyText;
|
|
1615
1580
|
}
|
|
1616
1581
|
}
|
|
1617
|
-
//# sourceMappingURL=
|
|
1582
|
+
//# sourceMappingURL=transport.js.map
|