@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
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
import {
|
|
21
21
|
createHttpTransport,
|
|
22
22
|
type HttpTransport,
|
|
23
|
-
} from './
|
|
24
|
-
import { modelWireNames } from '
|
|
25
|
-
import type { HttpClientConfig } from './
|
|
23
|
+
} from './transport.js';
|
|
24
|
+
import { modelWireNames } from '../../auth/capability.js';
|
|
25
|
+
import type { HttpClientConfig } from './options.js';
|
|
26
26
|
import type {
|
|
27
27
|
CommitResource,
|
|
28
28
|
CommitReceipt,
|
|
@@ -36,38 +36,37 @@ import type {
|
|
|
36
36
|
CreateSessionParams,
|
|
37
37
|
AbloSession,
|
|
38
38
|
SessionResource,
|
|
39
|
-
} from '
|
|
40
|
-
import { modelList } from '
|
|
39
|
+
} from '../../client/resources/httpResources.js';
|
|
40
|
+
import { collectModelList, modelList } from '../../client/resources/httpResources.js';
|
|
41
|
+
import { resolveCreateId } from '../../client/resources/modelCreate.js';
|
|
41
42
|
import type {
|
|
42
43
|
ModelCreateParams,
|
|
44
|
+
ModelCreateManyParams,
|
|
43
45
|
ModelDeleteParams,
|
|
44
46
|
ServerReadOptions,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
ModelTrackResult,
|
|
47
|
+
ListAllOptions,
|
|
48
|
+
ModelReadParams,
|
|
48
49
|
ModelUpdateParams,
|
|
49
|
-
} from '
|
|
50
|
-
import type { Schema, SchemaRecord, InferModel, InferCreate } from '
|
|
51
|
-
import { omittedModelError } from '
|
|
50
|
+
} from '../../client/resources/modelOperations.js';
|
|
51
|
+
import type { Schema, SchemaRecord, InferModel, InferCreate } from '../../schema/schema.js';
|
|
52
|
+
import { omittedModelError } from '../../schema/select.js';
|
|
52
53
|
import {
|
|
53
54
|
reconcileFunctionalUpdate,
|
|
54
55
|
type ModelUpdater,
|
|
55
56
|
type FunctionalUpdateOptions,
|
|
56
|
-
} from '
|
|
57
|
-
import type { HeldClaim } from '
|
|
58
|
-
import { AbloConnectionError, AbloValidationError } from '
|
|
59
|
-
import type {
|
|
57
|
+
} from '../../client/resources/functionalUpdate.js';
|
|
58
|
+
import type { HeldClaim, HeldLease } from '../../types/streams.js';
|
|
59
|
+
import { AbloConnectionError, AbloValidationError } from '../../errors.js';
|
|
60
|
+
import type { ReadDependency } from '../../coordination/schema.js';
|
|
60
61
|
import {
|
|
61
|
-
abortReadSetCommit,
|
|
62
62
|
capturePointRead,
|
|
63
63
|
createReadSetContext,
|
|
64
|
-
consumeReadSet,
|
|
65
64
|
kReadEvidence,
|
|
66
65
|
prepareReadSet,
|
|
67
66
|
type ReadSetContext,
|
|
68
|
-
} from '
|
|
69
|
-
import { recordHttpCommitReceipt } from '
|
|
70
|
-
import type { EffectiveAuthority } from '
|
|
67
|
+
} from '../../commit/readSetContext.js';
|
|
68
|
+
import { recordHttpCommitReceipt } from '../../commit/recordRuntime.js';
|
|
69
|
+
import type { EffectiveAuthority } from '../../auth/capability.js';
|
|
71
70
|
|
|
72
71
|
export interface AbloHttpClientOptions<S extends SchemaRecord>
|
|
73
72
|
extends HttpClientConfig<S> {
|
|
@@ -93,9 +92,10 @@ export type HttpModelMutationParams<P> = Omit<P, 'reads'> & {
|
|
|
93
92
|
|
|
94
93
|
/**
|
|
95
94
|
* The per-model surface of the stateless HTTP client — everything reachable over
|
|
96
|
-
* request/response: reads (`get` and `list`),
|
|
97
|
-
*
|
|
98
|
-
*
|
|
95
|
+
* request/response: observational reads (`get` and `list`), declared decision
|
|
96
|
+
* reads (`read`), writes (`create`, `update`,
|
|
97
|
+
* and `delete`), and the durable-lease {@link HttpClaimApi | claim} plane for
|
|
98
|
+
* coordinated writes.
|
|
99
99
|
* It deliberately omits the stateful client's local-only
|
|
100
100
|
* reads (the `local` namespace) and live subscriptions (`onChange`), which need
|
|
101
101
|
* a resident graph and a persistent socket; those are absent from the type, so
|
|
@@ -105,37 +105,37 @@ export type HttpModelMutationParams<P> = Omit<P, 'reads'> & {
|
|
|
105
105
|
* than a parallel list it happens to agree with — a verb added here arrives
|
|
106
106
|
* there without a second edit.
|
|
107
107
|
*
|
|
108
|
-
* The typed model contract is transport-independent: `get`
|
|
109
|
-
* `list` returns rows, `create`/`update` return the resulting row, and `delete`
|
|
108
|
+
* The typed model contract is transport-independent: `get` and `read` return
|
|
109
|
+
* one row, `list` returns rows, `create`/`update` return the resulting row, and `delete`
|
|
110
110
|
* returns nothing. The low-level protocol client keeps its read watermark and
|
|
111
111
|
* commit receipt envelopes internally; callers should not have to change data
|
|
112
112
|
* access syntax when they switch transport.
|
|
113
113
|
*/
|
|
114
114
|
export interface HttpModelClient<T, C = T> {
|
|
115
|
+
/** Reads one current row without declaring it as input to a later decision. */
|
|
116
|
+
get(params: ModelReadParams & ModelReadOptions): Promise<T | undefined>;
|
|
115
117
|
/**
|
|
116
118
|
* Reads one row by id. Resolves to `undefined` when no such row exists — a
|
|
117
119
|
* miss is data-absence, not an error.
|
|
118
120
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* synchronous `local.get` exists alongside this: same read, restricted
|
|
123
|
-
* to what is already here.
|
|
121
|
+
* Unlike `get`, the exact returned object privately carries model, id, and
|
|
122
|
+
* readAt evidence. Pass it in one mutation's `reads` array when that mutation
|
|
123
|
+
* was decided from this version.
|
|
124
124
|
*/
|
|
125
|
-
|
|
126
|
-
get(params: ModelRetrieveParams & ModelReadOptions): Promise<CapturedRow<T> | undefined>;
|
|
127
|
-
/** @deprecated Use `get({ id })` for an authoritative point lookup. */
|
|
128
|
-
retrieve(params: ModelRetrieveParams & ModelReadOptions): Promise<CapturedRow<T> | undefined>;
|
|
125
|
+
read(params: ModelReadParams & ModelReadOptions): Promise<CapturedRow<T> | undefined>;
|
|
129
126
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
127
|
+
* Observes the rows matching a filter, deduplicating concurrent identical
|
|
128
|
+
* calls. List rows are plain values; deliberately `read({ id })` any row a
|
|
129
|
+
* later mutation depends on.
|
|
132
130
|
*/
|
|
133
131
|
/**
|
|
134
132
|
* The rows are an array as before; `hasMore` and `nextCursor` on the result
|
|
135
133
|
* say whether the collection continues past this page. Pass `nextCursor`
|
|
136
134
|
* back as `cursor`, with the same `where` and `orderBy`, to walk it.
|
|
137
135
|
*/
|
|
138
|
-
list(options?: ServerReadOptions<T>): Promise<ModelList<
|
|
136
|
+
list(options?: ServerReadOptions<T>): Promise<ModelList<T>>;
|
|
137
|
+
/** Reads every matching row, following cursors with a bounded traversal. */
|
|
138
|
+
listAll(options?: ListAllOptions<T>): Promise<T[]>;
|
|
139
139
|
/**
|
|
140
140
|
* Creates a row and returns it, including any framework-applied defaults.
|
|
141
141
|
* Passing an id that already exists is idempotent: the existing row is
|
|
@@ -148,6 +148,11 @@ export interface HttpModelClient<T, C = T> {
|
|
|
148
148
|
* of `update` and `delete`.
|
|
149
149
|
*/
|
|
150
150
|
create(params: HttpModelMutationParams<ModelCreateParams<T, C>>): Promise<T>;
|
|
151
|
+
/**
|
|
152
|
+
* Creates many rows as one atomic commit, and resolves to them in the order
|
|
153
|
+
* they were given. One rejected row declines the batch.
|
|
154
|
+
*/
|
|
155
|
+
create(params: HttpModelMutationParams<ModelCreateManyParams<C>>): Promise<T[]>;
|
|
151
156
|
update(params: HttpModelMutationParams<ModelUpdateParams<T, C>>): Promise<T>;
|
|
152
157
|
/**
|
|
153
158
|
* Updates a row with a function of its latest value — `update(id, current =>
|
|
@@ -165,24 +170,6 @@ export interface HttpModelClient<T, C = T> {
|
|
|
165
170
|
): Promise<T | undefined>;
|
|
166
171
|
delete(params: HttpModelMutationParams<ModelDeleteParams<T, C>>): Promise<void>;
|
|
167
172
|
claim: HttpClaimApi<T, C>;
|
|
168
|
-
/**
|
|
169
|
-
* Registers a durable premise on a row — "keep telling me about this one".
|
|
170
|
-
* Any change that lands on the tracked row rides back on the `notifications`
|
|
171
|
-
* of this client's next commit, so a long-running agent learns its context
|
|
172
|
-
* went stale without re-reading. A track it already holds is refreshed, not
|
|
173
|
-
* duplicated.
|
|
174
|
-
*
|
|
175
|
-
* ```ts
|
|
176
|
-
* await ablo.items.track({ id: 'item_42' });
|
|
177
|
-
* // …minutes of other work later, on the next write…
|
|
178
|
-
* const res = await ablo.commits.create({ operations: [ … ] });
|
|
179
|
-
* res.notifications; // populated if item_42 moved in the meantime
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* The returned `notifications` are only the tracks that had ALREADY fired at
|
|
183
|
-
* registration time; the ongoing signal arrives on later receipts.
|
|
184
|
-
*/
|
|
185
|
-
track(params: ModelTrackParams): Promise<ModelTrackResult>;
|
|
186
173
|
}
|
|
187
174
|
|
|
188
175
|
/**
|
|
@@ -203,7 +190,7 @@ export type AbloHttpClient<S extends SchemaRecord> = {
|
|
|
203
190
|
ready(): Promise<void>;
|
|
204
191
|
/** Replays every pending durable HTTP write in seal order and waits for confirmation. */
|
|
205
192
|
waitForFlush(): Promise<void>;
|
|
206
|
-
readonly commits: CommitResource
|
|
193
|
+
readonly commits: CommitResource<ReadDependency | CapturedRow>;
|
|
207
194
|
/**
|
|
208
195
|
* Claim-ticket operations keyed by `claimId`: `retrieve` polls a queued
|
|
209
196
|
* ticket to its grant, `heartbeat` keeps one lease (held or queued) alive,
|
|
@@ -266,7 +253,7 @@ function createHttpModelClient<T, C = T>(
|
|
|
266
253
|
readSetContext: ReadSetContext | undefined,
|
|
267
254
|
): HttpModelClient<T, C> {
|
|
268
255
|
async function readRow(id: string): Promise<T | undefined> {
|
|
269
|
-
const read = await protocol.
|
|
256
|
+
const read = await protocol.read({ id });
|
|
270
257
|
capturePointRead(readSetContext, clientIdentity, modelName, id, read.data, read.stamp);
|
|
271
258
|
return read.data;
|
|
272
259
|
}
|
|
@@ -300,7 +287,6 @@ function createHttpModelClient<T, C = T>(
|
|
|
300
287
|
readonly claim?: unknown;
|
|
301
288
|
readonly idempotencyKey?: string | null;
|
|
302
289
|
readonly readAt?: number | null;
|
|
303
|
-
readonly onStale?: OnStaleMode | null;
|
|
304
290
|
readonly reads?: readonly unknown[] | null;
|
|
305
291
|
}>(
|
|
306
292
|
params: P,
|
|
@@ -309,22 +295,16 @@ function createHttpModelClient<T, C = T>(
|
|
|
309
295
|
readSetContext,
|
|
310
296
|
clientIdentity,
|
|
311
297
|
params.readAt,
|
|
312
|
-
params.onStale,
|
|
313
298
|
params.idempotencyKey,
|
|
314
299
|
params.reads,
|
|
315
300
|
);
|
|
316
301
|
return {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
? { idempotencyKey: prepared.idempotencyKey }
|
|
324
|
-
: {}),
|
|
325
|
-
},
|
|
326
|
-
consumed: prepared.consumed,
|
|
327
|
-
automaticCommit: prepared.automaticCommit,
|
|
302
|
+
...mutationOptions(params),
|
|
303
|
+
...(prepared.readAt !== undefined ? { readAt: prepared.readAt } : {}),
|
|
304
|
+
...(prepared.reads !== undefined ? { reads: prepared.reads } : {}),
|
|
305
|
+
...(prepared.idempotencyKey !== undefined
|
|
306
|
+
? { idempotencyKey: prepared.idempotencyKey }
|
|
307
|
+
: {}),
|
|
328
308
|
};
|
|
329
309
|
}
|
|
330
310
|
|
|
@@ -357,7 +337,7 @@ function createHttpModelClient<T, C = T>(
|
|
|
357
337
|
model: modelName,
|
|
358
338
|
id: arg,
|
|
359
339
|
readFresh: async () => {
|
|
360
|
-
const read = await protocol.
|
|
340
|
+
const read = await protocol.read({ id: arg });
|
|
361
341
|
capturePointRead(
|
|
362
342
|
readSetContext,
|
|
363
343
|
clientIdentity,
|
|
@@ -369,112 +349,117 @@ function createHttpModelClient<T, C = T>(
|
|
|
369
349
|
return { data: read.data, stamp: read.stamp };
|
|
370
350
|
},
|
|
371
351
|
writeNext: async (patch, readAt) => {
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
...prepared.options,
|
|
382
|
-
id: arg,
|
|
383
|
-
data: patch,
|
|
384
|
-
});
|
|
385
|
-
consumeReadSet(
|
|
386
|
-
readSetContext,
|
|
387
|
-
clientIdentity,
|
|
388
|
-
prepared.consumed,
|
|
389
|
-
prepared.automaticCommit,
|
|
390
|
-
);
|
|
391
|
-
return result;
|
|
392
|
-
} catch (error) {
|
|
393
|
-
abortReadSetCommit(readSetContext, prepared.automaticCommit);
|
|
394
|
-
throw error;
|
|
395
|
-
}
|
|
352
|
+
const opts = preparedMutation({
|
|
353
|
+
readAt,
|
|
354
|
+
reads: options?.reads,
|
|
355
|
+
});
|
|
356
|
+
return await protocol.update({
|
|
357
|
+
...opts,
|
|
358
|
+
id: arg,
|
|
359
|
+
data: patch,
|
|
360
|
+
});
|
|
396
361
|
},
|
|
397
362
|
},
|
|
398
363
|
);
|
|
399
364
|
return receipt === undefined ? undefined : requireUpdatedRow(arg);
|
|
400
365
|
}
|
|
401
366
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
data: arg.data,
|
|
408
|
-
});
|
|
409
|
-
} catch (error) {
|
|
410
|
-
abortReadSetCommit(readSetContext, prepared.automaticCommit);
|
|
411
|
-
throw error;
|
|
412
|
-
}
|
|
413
|
-
consumeReadSet(
|
|
414
|
-
readSetContext,
|
|
415
|
-
clientIdentity,
|
|
416
|
-
prepared.consumed,
|
|
417
|
-
prepared.automaticCommit,
|
|
418
|
-
);
|
|
367
|
+
await protocol.update({
|
|
368
|
+
...preparedMutation(arg),
|
|
369
|
+
id: arg.id,
|
|
370
|
+
data: arg.data,
|
|
371
|
+
});
|
|
419
372
|
return requireUpdatedRow(arg.id);
|
|
420
373
|
}
|
|
421
374
|
|
|
422
375
|
const get = async (
|
|
423
|
-
params:
|
|
376
|
+
params: ModelReadParams & ModelReadOptions,
|
|
377
|
+
): Promise<T | undefined> => {
|
|
378
|
+
const result = await protocol.read(params);
|
|
379
|
+
return result.data;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const read = async (
|
|
383
|
+
params: ModelReadParams & ModelReadOptions,
|
|
424
384
|
): Promise<CapturedRow<T> | undefined> => {
|
|
425
|
-
const
|
|
385
|
+
const result = await protocol.read(params);
|
|
426
386
|
capturePointRead(
|
|
427
387
|
readSetContext,
|
|
428
388
|
clientIdentity,
|
|
429
389
|
modelName,
|
|
430
390
|
params.id,
|
|
431
|
-
|
|
432
|
-
|
|
391
|
+
result.data,
|
|
392
|
+
result.stamp,
|
|
433
393
|
);
|
|
434
|
-
return
|
|
394
|
+
return result.data as CapturedRow<T> | undefined;
|
|
435
395
|
};
|
|
436
396
|
|
|
397
|
+
// `create` is overloaded: one row, or a list of them as one atomic commit.
|
|
398
|
+
// A real overloaded function rather than a property arrow, so both public
|
|
399
|
+
// signatures survive — the same reason `updateModel` is written this way.
|
|
400
|
+
function createModel(
|
|
401
|
+
params: HttpModelMutationParams<ModelCreateParams<T, C>>,
|
|
402
|
+
): Promise<CapturedRow<T>>;
|
|
403
|
+
function createModel(
|
|
404
|
+
params: HttpModelMutationParams<ModelCreateManyParams<C>>,
|
|
405
|
+
): Promise<CapturedRow<T>[]>;
|
|
406
|
+
async function createModel(
|
|
407
|
+
params:
|
|
408
|
+
| HttpModelMutationParams<ModelCreateParams<T, C>>
|
|
409
|
+
| HttpModelMutationParams<ModelCreateManyParams<C>>,
|
|
410
|
+
): Promise<CapturedRow<T> | CapturedRow<T>[]> {
|
|
411
|
+
const opts = preparedMutation(params);
|
|
412
|
+
// The list form is one atomic commit through the protocol's batch door.
|
|
413
|
+
// Same verb because it is the same act; the argument says how many.
|
|
414
|
+
if (Array.isArray(params.data)) {
|
|
415
|
+
const rows = await protocol.createMany({
|
|
416
|
+
data: params.data as readonly Record<string, unknown>[],
|
|
417
|
+
...(opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {}),
|
|
418
|
+
...(opts.reads ? { reads: [...opts.reads] } : {}),
|
|
419
|
+
});
|
|
420
|
+
return rows as CapturedRow<T>[];
|
|
421
|
+
}
|
|
422
|
+
const single = params as HttpModelMutationParams<ModelCreateParams<T, C>>;
|
|
423
|
+
const resolvedId = resolveCreateId(single.id, single.data);
|
|
424
|
+
const row = await protocol.create({
|
|
425
|
+
...opts,
|
|
426
|
+
...(resolvedId !== undefined ? { id: resolvedId } : {}),
|
|
427
|
+
data: single.data as Record<string, unknown>,
|
|
428
|
+
});
|
|
429
|
+
return row as CapturedRow<T>;
|
|
430
|
+
}
|
|
431
|
+
|
|
437
432
|
const list = async (
|
|
438
433
|
options?: ServerReadOptions<T>,
|
|
439
|
-
): Promise<ModelList<
|
|
434
|
+
): Promise<ModelList<T>> => {
|
|
440
435
|
const snapshot = await protocol.list(options);
|
|
441
|
-
|
|
442
|
-
snapshot.data
|
|
436
|
+
return modelList<T>(
|
|
437
|
+
snapshot.data,
|
|
443
438
|
snapshot,
|
|
439
|
+
(cursor) => list({ ...options, cursor }),
|
|
444
440
|
);
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
for (const row of snapshot.data) {
|
|
455
|
-
const id = typeof row === 'object' && row !== null
|
|
456
|
-
? Reflect.get(row as object, 'id')
|
|
457
|
-
: undefined;
|
|
458
|
-
const stamp = typeof id === 'string' ? byId.get(id) : undefined;
|
|
459
|
-
if (typeof id !== 'string' || stamp === undefined) {
|
|
460
|
-
throw new AbloConnectionError(
|
|
461
|
-
`${modelName}.list returned a row without matching evidence.`,
|
|
462
|
-
{ code: 'commit_no_result' },
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
capturePointRead(readSetContext, clientIdentity, modelName, id, row, stamp);
|
|
466
|
-
}
|
|
467
|
-
return page;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const listAll = async (
|
|
444
|
+
options: ListAllOptions<T> = {},
|
|
445
|
+
): Promise<T[]> => {
|
|
446
|
+
const { maxPages, signal, ...readOptions } = options;
|
|
447
|
+
signal?.throwIfAborted();
|
|
448
|
+
const first = await list(readOptions);
|
|
449
|
+
return collectModelList(first, { maxPages, signal });
|
|
468
450
|
};
|
|
469
451
|
|
|
470
452
|
// Claim acquisition performs its authoritative read only after the grant.
|
|
471
453
|
// Preserve that exact post-grant watermark while retaining the callable
|
|
472
|
-
// namespace and all of its state/queue/release members through the proxy.
|
|
454
|
+
// namespace and all of its state/list/queue/release/reorder members through the proxy.
|
|
473
455
|
const claim = new Proxy(protocol.claim, {
|
|
474
456
|
apply(target, thisArg, argArray) {
|
|
475
|
-
const result = Reflect.apply(target, thisArg, argArray) as Promise<
|
|
457
|
+
const result = Reflect.apply(target, thisArg, argArray) as Promise<
|
|
458
|
+
HeldClaim<T> | HeldLease | null
|
|
459
|
+
>;
|
|
476
460
|
return result.then((held) => {
|
|
477
|
-
|
|
461
|
+
// A row-free lease (`claim(id)`) carries no snapshot: nothing to capture.
|
|
462
|
+
if (held && 'data' in held && held.readAt !== undefined) {
|
|
478
463
|
capturePointRead(
|
|
479
464
|
readSetContext,
|
|
480
465
|
clientIdentity,
|
|
@@ -491,48 +476,15 @@ function createHttpModelClient<T, C = T>(
|
|
|
491
476
|
|
|
492
477
|
return {
|
|
493
478
|
get,
|
|
494
|
-
|
|
479
|
+
read,
|
|
495
480
|
list,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
const prepared = preparedMutation(params);
|
|
499
|
-
let row: T;
|
|
500
|
-
try {
|
|
501
|
-
row = await protocol.create({
|
|
502
|
-
...prepared.options,
|
|
503
|
-
...(params.id !== undefined ? { id: params.id } : {}),
|
|
504
|
-
data: params.data as Record<string, unknown>,
|
|
505
|
-
});
|
|
506
|
-
} catch (error) {
|
|
507
|
-
abortReadSetCommit(readSetContext, prepared.automaticCommit);
|
|
508
|
-
throw error;
|
|
509
|
-
}
|
|
510
|
-
consumeReadSet(
|
|
511
|
-
readSetContext,
|
|
512
|
-
clientIdentity,
|
|
513
|
-
prepared.consumed,
|
|
514
|
-
prepared.automaticCommit,
|
|
515
|
-
);
|
|
516
|
-
return row;
|
|
517
|
-
},
|
|
481
|
+
listAll,
|
|
482
|
+
create: createModel,
|
|
518
483
|
update,
|
|
519
484
|
async delete(params): Promise<void> {
|
|
520
|
-
|
|
521
|
-
try {
|
|
522
|
-
await protocol.delete({ ...prepared.options, id: params.id });
|
|
523
|
-
} catch (error) {
|
|
524
|
-
abortReadSetCommit(readSetContext, prepared.automaticCommit);
|
|
525
|
-
throw error;
|
|
526
|
-
}
|
|
527
|
-
consumeReadSet(
|
|
528
|
-
readSetContext,
|
|
529
|
-
clientIdentity,
|
|
530
|
-
prepared.consumed,
|
|
531
|
-
prepared.automaticCommit,
|
|
532
|
-
);
|
|
485
|
+
await protocol.delete({ ...preparedMutation(params), id: params.id });
|
|
533
486
|
},
|
|
534
487
|
claim,
|
|
535
|
-
track: (params) => protocol.track(params),
|
|
536
488
|
};
|
|
537
489
|
}
|
|
538
490
|
|
|
@@ -581,12 +533,41 @@ export function createAbloHttpClient<S extends SchemaRecord>(
|
|
|
581
533
|
return created;
|
|
582
534
|
};
|
|
583
535
|
|
|
536
|
+
const commits: CommitResource<ReadDependency | CapturedRow> = {
|
|
537
|
+
async create(commitOptions) {
|
|
538
|
+
const prepared = prepareReadSet(
|
|
539
|
+
readSetContext,
|
|
540
|
+
clientIdentity,
|
|
541
|
+
commitOptions.readAt,
|
|
542
|
+
commitOptions.idempotencyKey,
|
|
543
|
+
commitOptions.reads,
|
|
544
|
+
);
|
|
545
|
+
return transport.commits.create({
|
|
546
|
+
operations: commitOptions.operations,
|
|
547
|
+
...(commitOptions.claim !== undefined ? { claim: commitOptions.claim } : {}),
|
|
548
|
+
...(commitOptions.wait !== undefined ? { wait: commitOptions.wait } : {}),
|
|
549
|
+
...(prepared.readAt !== undefined ? { readAt: prepared.readAt } : {}),
|
|
550
|
+
...(prepared.reads !== undefined ? { reads: prepared.reads } : {}),
|
|
551
|
+
...(prepared.idempotencyKey !== undefined
|
|
552
|
+
? { idempotencyKey: prepared.idempotencyKey }
|
|
553
|
+
: {}),
|
|
554
|
+
});
|
|
555
|
+
},
|
|
556
|
+
get: (options) => transport.commits.get(options),
|
|
557
|
+
list: (options) => transport.commits.list(options),
|
|
558
|
+
};
|
|
559
|
+
|
|
584
560
|
const facade = new Proxy<Partial<AbloHttpClient<S>>>({}, {
|
|
585
561
|
get(_target, prop) {
|
|
586
562
|
if (prop === kReadEvidence) {
|
|
587
|
-
return {
|
|
563
|
+
return {
|
|
564
|
+
context: readSetContext,
|
|
565
|
+
client: clientIdentity,
|
|
566
|
+
onChange: transport.onChange,
|
|
567
|
+
};
|
|
588
568
|
}
|
|
589
569
|
if (typeof prop !== 'string') return undefined;
|
|
570
|
+
if (prop === 'commits') return commits;
|
|
590
571
|
// Real protocol members pass through unchanged.
|
|
591
572
|
if (isProtocolMember(prop)) {
|
|
592
573
|
return transport[prop];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AbloClaimedError, AbloConnectionError } from '../../errors.js';
|
|
2
|
+
import { commitReceiptSchema, type CommitReceiptWire } from '../../commit/contract.js';
|
|
3
|
+
import type { ClaimHeartbeatReply } from '../../claims/contract.js';
|
|
4
|
+
import type { ModelClaim } from '../../client/resources/httpResources.js';
|
|
5
|
+
import { subTarget, streamTarget } from '../../claims/locator.js';
|
|
6
|
+
import { declaredMeta } from '../../claims/meta.js';
|
|
7
|
+
import type { Claim, ClaimHeartbeat } from '../../types/streams.js';
|
|
8
|
+
|
|
9
|
+
/** Interpret a heartbeat reply for a lease this handle currently holds. */
|
|
10
|
+
export function heldHeartbeatReply(
|
|
11
|
+
reply: ClaimHeartbeatReply,
|
|
12
|
+
label: string,
|
|
13
|
+
): ClaimHeartbeat {
|
|
14
|
+
if (reply.status === 'held' && typeof reply.expiresAt === 'number') {
|
|
15
|
+
return {
|
|
16
|
+
expiresAt: reply.expiresAt,
|
|
17
|
+
...(reply.queueDepth !== undefined ? { queueDepth: reply.queueDepth } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
throw new AbloClaimedError(
|
|
21
|
+
`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.`,
|
|
22
|
+
{ code: 'claim_lost' },
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function parseSuccessfulCommitResponse(
|
|
27
|
+
value: unknown,
|
|
28
|
+
idempotencyKey: string,
|
|
29
|
+
): CommitReceiptWire {
|
|
30
|
+
const parsed = commitReceiptSchema.safeParse(value);
|
|
31
|
+
if (!parsed.success || parsed.data.clientTxId !== idempotencyKey) {
|
|
32
|
+
throw new AbloConnectionError(
|
|
33
|
+
'The commit endpoint returned an invalid success receipt; its outcome remains pending and is safe to retry.',
|
|
34
|
+
{
|
|
35
|
+
code: 'commit_no_result',
|
|
36
|
+
cause: parsed.success
|
|
37
|
+
? new Error('Commit receipt clientTxId did not match its idempotency key')
|
|
38
|
+
: parsed.error,
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return parsed.data;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Decode the HTTP claim DTO into the public Claim shape. */
|
|
46
|
+
export function claimFromModelClaim(claim: ModelClaim): Claim {
|
|
47
|
+
const { meta, ...details } = subTarget(claim.target);
|
|
48
|
+
return {
|
|
49
|
+
object: 'claim',
|
|
50
|
+
id: claim.id,
|
|
51
|
+
...(claim.status ? { status: claim.status } : {}),
|
|
52
|
+
description: claim.description ?? 'editing',
|
|
53
|
+
heldBy: claim.actor,
|
|
54
|
+
participantKind: claim.participantKind,
|
|
55
|
+
expiresAt: claim.expiresAt,
|
|
56
|
+
...(claim.position !== undefined ? { position: claim.position } : {}),
|
|
57
|
+
target: {
|
|
58
|
+
...streamTarget(claim.target),
|
|
59
|
+
...details,
|
|
60
|
+
...(meta !== undefined ? { meta: declaredMeta(meta) } : {}),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
* without declaring `extends`; the composition root keeps owning its own type.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { Schema, SchemaRecord } from '
|
|
14
|
-
import type { AuthClientOptions } from '
|
|
15
|
-
import type { CoordinationObservability } from '
|
|
16
|
-
import type { CommitOutboxScope } from '
|
|
17
|
-
import type { CommitReceiptWire } from '
|
|
13
|
+
import type { Schema, SchemaRecord } from '../../schema/schema.js';
|
|
14
|
+
import type { AuthClientOptions } from '../../auth/apiKey.js';
|
|
15
|
+
import type { CoordinationObservability } from '../../observability.js';
|
|
16
|
+
import type { CommitOutboxScope } from '../../commit/confirmation/commitEnvelope.js';
|
|
17
|
+
import type { CommitReceiptWire } from '../../commit/contract.js';
|
|
18
18
|
import type {
|
|
19
19
|
DurableWriteStore,
|
|
20
20
|
DurableWritesConfig,
|
|
21
|
-
} from '
|
|
21
|
+
} from '../../commit/durableWrites.js';
|
|
22
22
|
|
|
23
23
|
export interface HttpClientConfig<S extends SchemaRecord = SchemaRecord>
|
|
24
24
|
// The credential fields come from the one place that defines them, so this
|