@abloatai/transaction 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONVENTIONS.md +54 -10
- package/README.md +3 -1
- package/dist/ai-sdk/modelTools.d.ts +3 -3
- package/dist/ai-sdk/modelTools.d.ts.map +1 -1
- package/dist/ai-sdk/modelTools.js +1 -1
- package/dist/ai-sdk/modelTools.js.map +1 -1
- package/dist/ai-sdk/updateTool.d.ts +5 -7
- package/dist/ai-sdk/updateTool.d.ts.map +1 -1
- package/dist/ai-sdk/updateTool.js +3 -5
- package/dist/ai-sdk/updateTool.js.map +1 -1
- package/dist/auth/capability.d.ts +5 -0
- package/dist/auth/capability.d.ts.map +1 -1
- package/dist/auth/capability.js +5 -0
- package/dist/auth/capability.js.map +1 -1
- package/dist/auth/capabilityLifecycle.d.ts +1 -1
- package/dist/auth/capabilityLifecycle.d.ts.map +1 -1
- package/dist/auth/credentialPolicy.d.ts +1 -1
- package/dist/auth/credentialPolicy.d.ts.map +1 -1
- package/dist/auth/identity.d.ts +3 -3
- package/dist/auth/identity.d.ts.map +1 -1
- package/dist/auth/identity.js +5 -5
- package/dist/auth/identity.js.map +1 -1
- package/dist/auth/index.d.ts +4 -208
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +4 -330
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +218 -0
- package/dist/auth/runtime.d.ts.map +1 -0
- package/dist/auth/runtime.js +336 -0
- package/dist/auth/runtime.js.map +1 -0
- package/dist/auth/sessionMint.d.ts +1 -1
- package/dist/auth/sessionMint.d.ts.map +1 -1
- package/dist/auth/sessionMint.js +2 -1
- package/dist/auth/sessionMint.js.map +1 -1
- package/dist/branches.d.ts +25 -21
- package/dist/branches.d.ts.map +1 -1
- package/dist/branches.js +3 -0
- package/dist/branches.js.map +1 -1
- package/dist/{coordination/awaitClaimGrant.d.ts → claims/awaitGrant.d.ts} +1 -1
- package/dist/claims/awaitGrant.d.ts.map +1 -0
- package/dist/{coordination/awaitClaimGrant.js → claims/awaitGrant.js} +4 -4
- package/dist/claims/awaitGrant.js.map +1 -0
- package/dist/{wire/claims.d.ts → claims/contract.d.ts} +1 -1
- package/dist/claims/contract.d.ts.map +1 -0
- package/dist/{wire/claims.js → claims/contract.js} +2 -2
- package/dist/claims/contract.js.map +1 -0
- package/dist/{wire/claimEvent.d.ts → claims/eventContract.d.ts} +1 -1
- package/dist/claims/eventContract.d.ts.map +1 -0
- package/dist/{wire/claimEvent.js → claims/eventContract.js} +1 -1
- package/dist/claims/eventContract.js.map +1 -0
- package/dist/{coordination → claims}/events.d.ts +7 -11
- package/dist/claims/events.d.ts.map +1 -0
- package/dist/claims/events.js +8 -0
- package/dist/claims/events.js.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.d.ts → claims/heartbeat.d.ts} +1 -1
- package/dist/claims/heartbeat.d.ts.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.js → claims/heartbeat.js} +1 -1
- package/dist/claims/heartbeat.js.map +1 -0
- package/dist/claims/index.d.ts +17 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +16 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/lifetime.d.ts +26 -0
- package/dist/claims/lifetime.d.ts.map +1 -0
- package/dist/claims/lifetime.js +62 -0
- package/dist/claims/lifetime.js.map +1 -0
- package/dist/{coordination → claims}/locator.d.ts +1 -1
- package/dist/claims/locator.d.ts.map +1 -0
- package/dist/{coordination → claims}/locator.js +2 -2
- package/dist/claims/locator.js.map +1 -0
- package/dist/{coordination/claimMeta.d.ts → claims/meta.d.ts} +1 -1
- package/dist/claims/meta.d.ts.map +1 -0
- package/dist/{coordination/claimMeta.js → claims/meta.js} +1 -1
- package/dist/claims/meta.js.map +1 -0
- package/dist/claims/routes.d.ts +59 -0
- package/dist/claims/routes.d.ts.map +1 -0
- package/dist/claims/routes.js +69 -0
- package/dist/claims/routes.js.map +1 -0
- package/dist/claims/targetConflict.d.ts.map +1 -0
- package/dist/claims/targetConflict.js.map +1 -0
- package/dist/{coordination → claims}/trace.d.ts +2 -2
- package/dist/claims/trace.d.ts.map +1 -0
- package/dist/{coordination → claims}/trace.js +5 -5
- package/dist/claims/trace.js.map +1 -0
- package/dist/{ablo.d.ts → client/ablo.d.ts} +6 -15
- package/dist/client/ablo.d.ts.map +1 -0
- package/dist/{ablo.js → client/ablo.js} +2 -2
- package/dist/client/ablo.js.map +1 -0
- package/dist/{transactionLayer.d.ts → client/contract.d.ts} +12 -14
- package/dist/client/contract.d.ts.map +1 -0
- package/dist/{transactionLayer.js → client/contract.js} +4 -5
- package/dist/client/contract.js.map +1 -0
- package/dist/{headlessClient.d.ts → client/headless.d.ts} +4 -4
- package/dist/client/headless.d.ts.map +1 -0
- package/dist/{headlessClient.js → client/headless.js} +8 -10
- package/dist/{headlessClient.js.map → client/headless.js.map} +1 -1
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.d.ts +4 -4
- package/dist/client/resources/functionalUpdate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.js +3 -3
- package/dist/client/resources/functionalUpdate.js.map +1 -0
- package/dist/{resources → client/resources}/httpResources.d.ts +92 -77
- package/dist/client/resources/httpResources.d.ts.map +1 -0
- package/dist/client/resources/httpResources.js +94 -0
- package/dist/client/resources/httpResources.js.map +1 -0
- package/dist/client/resources/modelCreate.d.ts +21 -0
- package/dist/client/resources/modelCreate.d.ts.map +1 -0
- package/dist/client/resources/modelCreate.js +49 -0
- package/dist/client/resources/modelCreate.js.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.d.ts +57 -51
- package/dist/client/resources/modelOperations.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.js +1 -1
- package/dist/client/resources/modelOperations.js.map +1 -0
- package/dist/{resources → client/resources}/mutationOptions.d.ts +4 -17
- package/dist/client/resources/mutationOptions.d.ts.map +1 -0
- package/dist/client/resources/mutationOptions.js.map +1 -0
- package/dist/client/resources/where.d.ts.map +1 -0
- package/dist/{resources → client/resources}/where.js +1 -1
- package/dist/client/resources/where.js.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.d.ts +16 -35
- package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.js +25 -18
- package/dist/client/resources/writeOptionsSchema.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
- package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
- package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
- package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
- package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
- package/dist/commit/confirmation/pendingWrite.js.map +1 -0
- package/dist/commit/contract.d.ts +1404 -0
- package/dist/commit/contract.d.ts.map +1 -0
- package/dist/{wire/commit.js → commit/contract.js} +26 -21
- package/dist/commit/contract.js.map +1 -0
- package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
- package/dist/commit/durableWrites.d.ts.map +1 -0
- package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
- package/dist/commit/durableWrites.js.map +1 -0
- package/dist/commit/httpRequest.d.ts +45 -0
- package/dist/commit/httpRequest.d.ts.map +1 -0
- package/dist/commit/httpRequest.js +66 -0
- package/dist/commit/httpRequest.js.map +1 -0
- package/dist/commit/index.d.ts +17 -0
- package/dist/commit/index.d.ts.map +1 -0
- package/dist/commit/index.js +17 -0
- package/dist/commit/index.js.map +1 -0
- package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
- package/dist/commit/readSetContext.d.ts.map +1 -0
- package/dist/{readSetContext.js → commit/readSetContext.js} +18 -28
- package/dist/commit/readSetContext.js.map +1 -0
- package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
- package/dist/commit/recordRuntime.d.ts.map +1 -0
- package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
- package/dist/commit/recordRuntime.js.map +1 -0
- package/dist/coordination/index.d.ts +6 -8
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +3 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/schema.d.ts +11 -466
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +13 -265
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +16 -9
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +14 -6
- package/dist/errorCodes.js.map +1 -1
- package/dist/errorObservation.d.ts +2 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -11
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/read-set.d.ts +3 -3
- package/dist/internal/read-set.d.ts.map +1 -1
- package/dist/internal/read-set.js +2 -2
- package/dist/internal/read-set.js.map +1 -1
- package/dist/observability.d.ts +4 -4
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +2 -2
- package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
- package/dist/observation/contract.d.ts.map +1 -0
- package/dist/{wire/delta.js → observation/contract.js} +3 -3
- package/dist/observation/contract.js.map +1 -0
- package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
- package/dist/observation/cursor.d.ts.map +1 -0
- package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
- package/dist/observation/cursor.js.map +1 -0
- package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
- package/dist/observation/deliveryContract.d.ts.map +1 -0
- package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
- package/dist/observation/deliveryContract.js.map +1 -0
- package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
- package/dist/observation/feedContract.d.ts.map +1 -0
- package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
- package/dist/observation/feedContract.js.map +1 -0
- package/dist/observation/httpFeed.d.ts +4 -0
- package/dist/observation/httpFeed.d.ts.map +1 -0
- package/dist/{transport → observation}/httpFeed.js +1 -1
- package/dist/{transport → observation}/httpFeed.js.map +1 -1
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
- package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
- package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
- package/dist/pricing.d.ts +20 -12
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +46 -26
- package/dist/pricing.js.map +1 -1
- package/dist/schema/audit.d.ts +15 -0
- package/dist/schema/audit.d.ts.map +1 -0
- package/dist/schema/audit.js +90 -0
- package/dist/schema/audit.js.map +1 -0
- package/dist/schema/ddl.d.ts.map +1 -1
- package/dist/schema/ddl.js +68 -1
- package/dist/schema/ddl.js.map +1 -1
- package/dist/schema/index.d.ts +7 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +6 -7
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +14 -27
- package/dist/schema/model.d.ts.map +1 -1
- package/dist/schema/model.js +2 -2
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +149 -8
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/roles.d.ts +27 -0
- package/dist/schema/roles.d.ts.map +1 -1
- package/dist/schema/roles.js +40 -0
- package/dist/schema/roles.js.map +1 -1
- package/dist/schema/schema.d.ts +34 -7
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +39 -3
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/serialize.d.ts +5 -5
- package/dist/schema/serialize.d.ts.map +1 -1
- package/dist/schema/serialize.js +5 -5
- package/dist/schema/serialize.js.map +1 -1
- package/dist/schema/subject.d.ts +18 -0
- package/dist/schema/subject.d.ts.map +1 -0
- package/dist/schema/subject.js +27 -0
- package/dist/schema/subject.js.map +1 -0
- package/dist/schema/tenancy.d.ts +1 -1
- package/dist/server/adapter.d.ts +3 -1
- package/dist/server/adapter.d.ts.map +1 -1
- package/dist/server/commit.d.ts +6 -14
- package/dist/server/commit.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/readConfig.d.ts +3 -0
- package/dist/server/readConfig.d.ts.map +1 -1
- package/dist/server/readConfig.js +0 -21
- package/dist/server/readConfig.js.map +1 -1
- package/dist/server/storageMode.d.ts +1 -1
- package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
- package/dist/source/adapters/adapter.d.ts.map +1 -0
- package/dist/source/adapters/adapter.js.map +1 -0
- package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
- package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
- package/dist/source/adapters/adapterFactory.js.map +1 -0
- package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
- package/dist/source/adapters/adapterProfile.js.map +1 -0
- package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
- package/dist/source/adapters/conformance.d.ts.map +1 -0
- package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
- package/dist/source/adapters/conformance.js.map +1 -0
- package/dist/source/{contract.d.ts → adapters/contract.d.ts} +20 -75
- package/dist/source/adapters/contract.d.ts.map +1 -0
- package/dist/source/{contract.js → adapters/contract.js} +20 -55
- package/dist/source/adapters/contract.js.map +1 -0
- package/dist/source/adapters/drizzle.d.ts +1 -1
- package/dist/source/adapters/drizzle.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.js +54 -25
- package/dist/source/adapters/drizzle.js.map +1 -1
- package/dist/source/adapters/idempotency.d.ts.map +1 -0
- package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
- package/dist/source/adapters/idempotency.js.map +1 -0
- package/dist/source/adapters/index.d.ts +21 -0
- package/dist/source/adapters/index.d.ts.map +1 -0
- package/dist/source/adapters/index.js +21 -0
- package/dist/source/adapters/index.js.map +1 -0
- package/dist/source/adapters/kysely.d.ts +3 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +49 -23
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +6 -3
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +17 -8
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
- package/dist/source/adapters/memory.d.ts +3 -3
- package/dist/source/adapters/memory.d.ts.map +1 -1
- package/dist/source/adapters/memory.js +20 -7
- package/dist/source/adapters/memory.js.map +1 -1
- package/dist/source/adapters/migration.d.ts +8 -0
- package/dist/source/adapters/migration.d.ts.map +1 -0
- package/dist/source/adapters/migration.js +9 -0
- package/dist/source/adapters/migration.js.map +1 -0
- package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
- package/dist/source/adapters/migrations.d.ts.map +1 -0
- package/dist/source/{migrations.js → adapters/migrations.js} +4 -31
- package/dist/source/adapters/migrations.js.map +1 -0
- package/dist/source/adapters/prisma.d.ts +1 -1
- package/dist/source/adapters/prisma.d.ts.map +1 -1
- package/dist/source/adapters/prisma.js +75 -30
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/adapters/subjectAuthorization.d.ts +16 -0
- package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
- package/dist/source/adapters/subjectAuthorization.js +126 -0
- package/dist/source/adapters/subjectAuthorization.js.map +1 -0
- package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
- package/dist/source/connector/client.d.ts.map +1 -0
- package/dist/source/{connector.js → connector/client.js} +28 -11
- package/dist/source/connector/client.js.map +1 -0
- package/dist/source/connector/index.d.ts +4 -0
- package/dist/source/connector/index.d.ts.map +1 -0
- package/dist/source/connector/index.js +4 -0
- package/dist/source/connector/index.js.map +1 -0
- package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
- package/dist/source/connector/protocol.d.ts.map +1 -0
- package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
- package/dist/source/connector/protocol.js.map +1 -0
- package/dist/source/delivery/index.d.ts +3 -0
- package/dist/source/delivery/index.d.ts.map +1 -0
- package/dist/source/delivery/index.js +3 -0
- package/dist/source/delivery/index.js.map +1 -0
- package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
- package/dist/source/delivery/pushQueue.d.ts.map +1 -0
- package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
- package/dist/source/delivery/pushQueue.js.map +1 -0
- package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +9 -3
- package/dist/source/endpoint/factory.d.ts.map +1 -0
- package/dist/source/{factory.js → endpoint/factory.js} +122 -6
- package/dist/source/endpoint/factory.js.map +1 -0
- package/dist/source/endpoint/index.d.ts +5 -0
- package/dist/source/endpoint/index.d.ts.map +1 -0
- package/dist/source/endpoint/index.js +5 -0
- package/dist/source/endpoint/index.js.map +1 -0
- package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
- package/dist/source/endpoint/next.d.ts.map +1 -0
- package/dist/source/{next.js → endpoint/next.js} +1 -1
- package/dist/source/endpoint/next.js.map +1 -0
- package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
- package/dist/source/endpoint/signing.d.ts.map +1 -0
- package/dist/source/{signing.js → endpoint/signing.js} +1 -1
- package/dist/source/endpoint/signing.js.map +1 -0
- package/dist/source/index.d.ts +15 -12
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +13 -10
- package/dist/source/index.js.map +1 -1
- package/dist/source/outbox/contract.d.ts +50 -0
- package/dist/source/outbox/contract.d.ts.map +1 -0
- package/dist/source/outbox/contract.js +50 -0
- package/dist/source/outbox/contract.js.map +1 -0
- package/dist/source/outbox/envelope.d.ts +9 -0
- package/dist/source/outbox/envelope.d.ts.map +1 -0
- package/dist/source/outbox/envelope.js +36 -0
- package/dist/source/outbox/envelope.js.map +1 -0
- package/dist/source/outbox/index.d.ts +11 -0
- package/dist/source/outbox/index.d.ts.map +1 -0
- package/dist/source/outbox/index.js +11 -0
- package/dist/source/outbox/index.js.map +1 -0
- package/dist/source/outbox/migrations.d.ts +4 -0
- package/dist/source/outbox/migrations.d.ts.map +1 -0
- package/dist/source/outbox/migrations.js +67 -0
- package/dist/source/outbox/migrations.js.map +1 -0
- package/dist/source/outbox/retention.d.ts +3 -0
- package/dist/source/outbox/retention.d.ts.map +1 -0
- package/dist/source/outbox/retention.js +3 -0
- package/dist/source/outbox/retention.js.map +1 -0
- package/dist/source/types.d.ts +59 -10
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js +2 -0
- package/dist/source/types.js.map +1 -1
- package/dist/syncLog/contract.d.ts +19 -8
- package/dist/syncLog/contract.d.ts.map +1 -1
- package/dist/syncLog/contract.js +19 -6
- package/dist/syncLog/contract.js.map +1 -1
- package/dist/testing/fixtures/httpResponses.d.ts +6 -0
- package/dist/testing/fixtures/httpResponses.d.ts.map +1 -1
- package/dist/testing/fixtures/httpResponses.js +1 -0
- package/dist/testing/fixtures/httpResponses.js.map +1 -1
- package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
- package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
- package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
- package/dist/transport/connection/credentialLifecycle.js.map +1 -0
- package/dist/transport/connection/index.d.ts +5 -0
- package/dist/transport/connection/index.d.ts.map +1 -0
- package/dist/transport/connection/index.js +5 -0
- package/dist/transport/connection/index.js.map +1 -0
- package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
- package/dist/transport/connection/manager.d.ts.map +1 -0
- package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
- package/dist/transport/connection/manager.js.map +1 -0
- package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
- package/dist/transport/connection/networkProbe.d.ts.map +1 -0
- package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
- package/dist/transport/connection/networkProbe.js.map +1 -0
- package/dist/transport/{httpClient.d.ts → http/client.d.ts} +32 -44
- package/dist/transport/http/client.d.ts.map +1 -0
- package/dist/transport/{httpClient.js → http/client.js} +96 -105
- package/dist/transport/http/client.js.map +1 -0
- package/dist/transport/http/helpers.d.ts +10 -0
- package/dist/transport/http/helpers.d.ts.map +1 -0
- package/dist/transport/http/helpers.js +46 -0
- package/dist/transport/http/helpers.js.map +1 -0
- package/dist/transport/http/index.d.ts +6 -0
- package/dist/transport/http/index.d.ts.map +1 -0
- package/dist/transport/http/index.js +6 -0
- package/dist/transport/http/index.js.map +1 -0
- package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
- package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
- package/dist/transport/{httpOptions.js → http/options.js} +1 -1
- package/dist/transport/http/options.js.map +1 -0
- package/dist/transport/http/subscription.d.ts +16 -0
- package/dist/transport/http/subscription.d.ts.map +1 -0
- package/dist/transport/http/subscription.js +146 -0
- package/dist/transport/http/subscription.js.map +1 -0
- package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
- package/dist/transport/http/transport.d.ts.map +1 -0
- package/dist/transport/{httpTransport.js → http/transport.js} +153 -188
- package/dist/transport/http/transport.js.map +1 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
- package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
- package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
- package/dist/transport/websocket/commitFrames.js.map +1 -0
- package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
- package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
- package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
- package/dist/transport/websocket/frameHandlers.js.map +1 -0
- package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
- package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
- package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
- package/dist/transport/websocket/heartbeat.js.map +1 -0
- package/dist/transport/websocket/index.d.ts +6 -0
- package/dist/transport/websocket/index.d.ts.map +1 -0
- package/dist/transport/websocket/index.js +6 -0
- package/dist/transport/websocket/index.js.map +1 -0
- package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
- package/dist/transport/websocket/transport.d.ts.map +1 -0
- package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
- package/dist/transport/websocket/transport.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/streams.d.ts +8 -48
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +2 -2
- package/dist/wire/accountResponses.d.ts +4 -72
- package/dist/wire/accountResponses.d.ts.map +1 -1
- package/dist/wire/accountResponses.js +2 -10
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/apiLifecycle.d.ts +63 -0
- package/dist/wire/apiLifecycle.d.ts.map +1 -0
- package/dist/wire/apiLifecycle.js +89 -0
- package/dist/wire/apiLifecycle.js.map +1 -0
- package/dist/wire/frames.d.ts +6 -83
- package/dist/wire/frames.d.ts.map +1 -1
- package/dist/wire/frames.js +4 -11
- package/dist/wire/frames.js.map +1 -1
- package/dist/wire/inboundFrames.d.ts +6 -131
- package/dist/wire/inboundFrames.d.ts.map +1 -1
- package/dist/wire/inboundFrames.js +3 -3
- package/dist/wire/inboundFrames.js.map +1 -1
- package/dist/wire/index.d.ts +20 -15
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +22 -8
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/modelMutations.d.ts +1 -32
- package/dist/wire/modelMutations.d.ts.map +1 -1
- package/dist/wire/modelMutations.js +1 -8
- package/dist/wire/modelMutations.js.map +1 -1
- package/dist/wire/rateLimit.d.ts +82 -0
- package/dist/wire/rateLimit.d.ts.map +1 -0
- package/dist/wire/rateLimit.js +142 -0
- package/dist/wire/rateLimit.js.map +1 -0
- package/package.json +130 -10
- package/src/ai-sdk/modelTools.ts +5 -5
- package/src/ai-sdk/updateTool.ts +5 -7
- package/src/auth/capability.ts +5 -0
- package/src/auth/capabilityLifecycle.ts +1 -1
- package/src/auth/credentialPolicy.ts +1 -1
- package/src/auth/identity.ts +7 -7
- package/src/auth/index.ts +4 -663
- package/src/auth/runtime.ts +669 -0
- package/src/auth/sessionMint.ts +3 -2
- package/src/branches.ts +3 -0
- package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
- package/src/{wire/claims.ts → claims/contract.ts} +1 -1
- package/src/{coordination → claims}/events.ts +7 -11
- package/src/claims/index.ts +21 -0
- package/src/claims/lifetime.ts +78 -0
- package/src/{coordination → claims}/locator.ts +3 -3
- package/src/claims/routes.ts +81 -0
- package/src/{coordination → claims}/trace.ts +5 -5
- package/src/{ablo.ts → client/ablo.ts} +8 -20
- package/src/{transactionLayer.ts → client/contract.ts} +11 -13
- package/src/{headlessClient.ts → client/headless.ts} +13 -15
- package/src/client/index.ts +10 -0
- package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
- package/src/{resources → client/resources}/httpResources.ts +163 -92
- package/src/client/resources/modelCreate.ts +73 -0
- package/src/{resources → client/resources}/modelOperations.ts +73 -55
- package/src/{resources → client/resources}/mutationOptions.ts +4 -17
- package/src/{resources → client/resources}/where.ts +1 -1
- package/src/{resources → client/resources}/writeOptionsSchema.ts +35 -27
- package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
- package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
- package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
- package/src/{wire/commit.ts → commit/contract.ts} +27 -26
- package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
- package/src/commit/httpRequest.ts +103 -0
- package/src/commit/index.ts +16 -0
- package/src/{readSetContext.ts → commit/readSetContext.ts} +24 -43
- package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
- package/src/coordination/index.ts +4 -54
- package/src/coordination/schema.ts +15 -309
- package/src/errorCodes.ts +62 -10
- package/src/errors.ts +32 -10
- package/src/index.ts +8 -8
- package/src/internal/read-set.ts +3 -6
- package/src/observability.ts +4 -4
- package/src/{wire/delta.ts → observation/contract.ts} +2 -2
- package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
- package/src/{transport → observation}/httpFeed.ts +3 -3
- package/src/observation/index.ts +12 -0
- package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
- package/src/pricing.ts +46 -25
- package/src/schema/audit.ts +121 -0
- package/src/schema/ddl.ts +71 -1
- package/src/schema/index.ts +20 -20
- package/src/schema/model.ts +17 -33
- package/src/schema/openapi.ts +170 -9
- package/src/schema/roles.ts +53 -0
- package/src/schema/schema.ts +91 -6
- package/src/schema/serialize.ts +8 -9
- package/src/schema/subject.ts +43 -0
- package/src/server/adapter.ts +3 -1
- package/src/server/commit.ts +6 -14
- package/src/server/index.ts +1 -1
- package/src/server/readConfig.ts +4 -0
- package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
- package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
- package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
- package/src/source/{contract.ts → adapters/contract.ts} +24 -61
- package/src/source/adapters/drizzle.ts +75 -29
- package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
- package/src/source/adapters/index.ts +20 -0
- package/src/source/adapters/kysely.ts +77 -27
- package/src/source/adapters/kyselyMutationCore.ts +23 -11
- package/src/source/adapters/memory.ts +26 -9
- package/src/source/adapters/migration.ts +11 -0
- package/src/source/{migrations.ts → adapters/migrations.ts} +6 -33
- package/src/source/adapters/prisma.ts +98 -34
- package/src/source/adapters/subjectAuthorization.ts +182 -0
- package/src/source/{connector.ts → connector/client.ts} +35 -12
- package/src/source/connector/index.ts +3 -0
- package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
- package/src/source/delivery/index.ts +2 -0
- package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
- package/src/source/{factory.ts → endpoint/factory.ts} +150 -9
- package/src/source/endpoint/index.ts +4 -0
- package/src/source/{next.ts → endpoint/next.ts} +2 -2
- package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
- package/src/source/index.ts +27 -18
- package/src/source/outbox/contract.ts +56 -0
- package/src/source/outbox/envelope.ts +47 -0
- package/src/source/outbox/index.ts +15 -0
- package/src/source/outbox/migrations.ts +71 -0
- package/src/source/outbox/retention.ts +2 -0
- package/src/source/types.ts +64 -10
- package/src/syncLog/contract.ts +19 -9
- package/src/testing/fixtures/httpResponses.ts +7 -0
- package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
- package/src/transport/connection/index.ts +4 -0
- package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
- package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
- package/src/transport/{httpClient.ts → http/client.ts} +165 -184
- package/src/transport/http/helpers.ts +63 -0
- package/src/transport/http/index.ts +5 -0
- package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
- package/src/transport/http/subscription.ts +174 -0
- package/src/transport/{httpTransport.ts → http/transport.ts} +210 -246
- package/src/transport/index.ts +7 -0
- package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
- package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
- package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
- package/src/transport/websocket/index.ts +5 -0
- package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
- package/src/types/index.ts +2 -6
- package/src/types/streams.ts +7 -61
- package/src/webhooks/events.ts +1 -1
- package/src/wire/accountResponses.ts +3 -12
- package/src/wire/apiLifecycle.ts +94 -0
- package/src/wire/frames.ts +5 -15
- package/src/wire/inboundFrames.ts +3 -3
- package/src/wire/index.ts +50 -15
- package/src/wire/modelMutations.ts +1 -14
- package/src/wire/rateLimit.ts +155 -0
- package/dist/ablo.d.ts.map +0 -1
- package/dist/ablo.js.map +0 -1
- package/dist/commitRecordRuntime.d.ts.map +0 -1
- package/dist/commitRecordRuntime.js.map +0 -1
- package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
- package/dist/coordination/awaitClaimGrant.js.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
- package/dist/coordination/claimMeta.d.ts.map +0 -1
- package/dist/coordination/claimMeta.js.map +0 -1
- package/dist/coordination/events.d.ts.map +0 -1
- package/dist/coordination/events.js +0 -8
- package/dist/coordination/events.js.map +0 -1
- package/dist/coordination/locator.d.ts.map +0 -1
- package/dist/coordination/locator.js.map +0 -1
- package/dist/coordination/targetConflict.d.ts.map +0 -1
- package/dist/coordination/targetConflict.js.map +0 -1
- package/dist/coordination/trace.d.ts.map +0 -1
- package/dist/coordination/trace.js.map +0 -1
- package/dist/durableWrites.d.ts.map +0 -1
- package/dist/durableWrites.js.map +0 -1
- package/dist/headlessClient.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.js.map +0 -1
- package/dist/policy/types.d.ts +0 -226
- package/dist/policy/types.d.ts.map +0 -1
- package/dist/policy/types.js +0 -127
- package/dist/policy/types.js.map +0 -1
- package/dist/readSetContext.d.ts.map +0 -1
- package/dist/readSetContext.js.map +0 -1
- package/dist/resources/functionalUpdate.d.ts.map +0 -1
- package/dist/resources/functionalUpdate.js.map +0 -1
- package/dist/resources/httpResources.d.ts.map +0 -1
- package/dist/resources/httpResources.js +0 -17
- package/dist/resources/httpResources.js.map +0 -1
- package/dist/resources/modelOperations.d.ts.map +0 -1
- package/dist/resources/modelOperations.js.map +0 -1
- package/dist/resources/mutationOptions.d.ts.map +0 -1
- package/dist/resources/mutationOptions.js.map +0 -1
- package/dist/resources/where.d.ts.map +0 -1
- package/dist/resources/where.js.map +0 -1
- package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
- package/dist/resources/writeOptionsSchema.js.map +0 -1
- package/dist/schema/coordination.d.ts +0 -113
- package/dist/schema/coordination.d.ts.map +0 -1
- package/dist/schema/coordination.js +0 -134
- package/dist/schema/coordination.js.map +0 -1
- package/dist/source/adapter.d.ts.map +0 -1
- package/dist/source/adapter.js.map +0 -1
- package/dist/source/adapterFactory.d.ts.map +0 -1
- package/dist/source/adapterFactory.js.map +0 -1
- package/dist/source/adapterProfile.d.ts.map +0 -1
- package/dist/source/adapterProfile.js.map +0 -1
- package/dist/source/conformance.d.ts.map +0 -1
- package/dist/source/conformance.js.map +0 -1
- package/dist/source/connector.d.ts.map +0 -1
- package/dist/source/connector.js.map +0 -1
- package/dist/source/connectorProtocol.d.ts.map +0 -1
- package/dist/source/connectorProtocol.js.map +0 -1
- package/dist/source/contract.d.ts.map +0 -1
- package/dist/source/contract.js.map +0 -1
- package/dist/source/drizzle.d.ts +0 -2
- package/dist/source/drizzle.d.ts.map +0 -1
- package/dist/source/drizzle.js +0 -2
- package/dist/source/drizzle.js.map +0 -1
- package/dist/source/factory.d.ts.map +0 -1
- package/dist/source/factory.js.map +0 -1
- package/dist/source/idempotency.d.ts.map +0 -1
- package/dist/source/idempotency.js.map +0 -1
- package/dist/source/kysely.d.ts +0 -3
- package/dist/source/kysely.d.ts.map +0 -1
- package/dist/source/kysely.js +0 -3
- package/dist/source/kysely.js.map +0 -1
- package/dist/source/migrations.d.ts.map +0 -1
- package/dist/source/migrations.js.map +0 -1
- package/dist/source/next.d.ts.map +0 -1
- package/dist/source/next.js.map +0 -1
- package/dist/source/pushQueue.d.ts.map +0 -1
- package/dist/source/pushQueue.js.map +0 -1
- package/dist/source/signing.d.ts.map +0 -1
- package/dist/source/signing.js.map +0 -1
- package/dist/transactionLayer.d.ts.map +0 -1
- package/dist/transactionLayer.js.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
- package/dist/transport/commitFrames.d.ts.map +0 -1
- package/dist/transport/commitFrames.js.map +0 -1
- package/dist/transport/connectionManager.d.ts.map +0 -1
- package/dist/transport/connectionManager.js.map +0 -1
- package/dist/transport/credentialLifecycle.d.ts.map +0 -1
- package/dist/transport/credentialLifecycle.js.map +0 -1
- package/dist/transport/heartbeat.d.ts.map +0 -1
- package/dist/transport/heartbeat.js.map +0 -1
- package/dist/transport/httpClient.d.ts.map +0 -1
- package/dist/transport/httpClient.js.map +0 -1
- package/dist/transport/httpFeed.d.ts +0 -4
- package/dist/transport/httpFeed.d.ts.map +0 -1
- package/dist/transport/httpOptions.js.map +0 -1
- package/dist/transport/httpTransport.d.ts.map +0 -1
- package/dist/transport/httpTransport.js.map +0 -1
- package/dist/transport/networkProbe.d.ts.map +0 -1
- package/dist/transport/networkProbe.js.map +0 -1
- package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
- package/dist/transport/wsFrameHandlers.js.map +0 -1
- package/dist/transport/wsTransport.d.ts.map +0 -1
- package/dist/transport/wsTransport.js.map +0 -1
- package/dist/wire/claimEvent.d.ts.map +0 -1
- package/dist/wire/claimEvent.js.map +0 -1
- package/dist/wire/claims.d.ts.map +0 -1
- package/dist/wire/claims.js.map +0 -1
- package/dist/wire/commit.d.ts +0 -2801
- package/dist/wire/commit.d.ts.map +0 -1
- package/dist/wire/commit.js.map +0 -1
- package/dist/wire/delta.d.ts.map +0 -1
- package/dist/wire/delta.js.map +0 -1
- package/dist/wire/deltaDelivery.d.ts.map +0 -1
- package/dist/wire/deltaDelivery.js.map +0 -1
- package/dist/wire/feedCursor.d.ts.map +0 -1
- package/dist/wire/feedCursor.js.map +0 -1
- package/dist/wire/feedEvent.d.ts.map +0 -1
- package/dist/wire/feedEvent.js.map +0 -1
- package/src/policy/types.ts +0 -300
- package/src/schema/coordination.ts +0 -161
- package/src/source/drizzle.ts +0 -1
- package/src/source/kysely.ts +0 -2
- /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
- /package/dist/{coordination → claims}/targetConflict.js +0 -0
- /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
- /package/dist/{resources → client/resources}/where.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
- /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
- /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
- /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
- /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
- /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
- /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
- /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
- /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
- /package/src/{coordination → claims}/targetConflict.ts +0 -0
- /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
- /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
- /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
- /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
package/src/internal/read-set.ts
CHANGED
|
@@ -3,21 +3,18 @@
|
|
|
3
3
|
* Application code declares dependencies through `reads: [returnedRow]`.
|
|
4
4
|
*/
|
|
5
5
|
export {
|
|
6
|
-
abortReadSetCommit,
|
|
7
6
|
capturePointRead,
|
|
8
7
|
createReadSetContext,
|
|
9
|
-
commitRecordIdentity,
|
|
10
|
-
consumeReadSet,
|
|
11
8
|
evidenceForRow,
|
|
12
9
|
kReadEvidence,
|
|
13
10
|
prepareReadSet,
|
|
14
11
|
publishCommitRecord,
|
|
15
12
|
readEvidenceBinding,
|
|
16
|
-
} from '../readSetContext.js';
|
|
17
|
-
export { recordWebSocketCommitReceipt } from '../
|
|
13
|
+
} from '../commit/readSetContext.js';
|
|
14
|
+
export { recordWebSocketCommitReceipt } from '../commit/recordRuntime.js';
|
|
18
15
|
export type {
|
|
19
16
|
CapturedReadEvidence,
|
|
20
17
|
PreparedReadSet,
|
|
21
18
|
ReadEvidenceBinding,
|
|
22
19
|
ReadSetContext,
|
|
23
|
-
} from '../readSetContext.js';
|
|
20
|
+
} from '../commit/readSetContext.js';
|
package/src/observability.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The observability the confirmation core reports on its own behalf.
|
|
3
3
|
*
|
|
4
|
-
* Coordination outcomes — a claim changing state
|
|
5
|
-
*
|
|
4
|
+
* Coordination outcomes — a claim changing state or a rejected write collision
|
|
5
|
+
* — happen with no UI and no local store anywhere,
|
|
6
6
|
* so the core must be able to report them without depending on the consumer's
|
|
7
7
|
* full provider (ADR 0016).
|
|
8
8
|
*
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
* this interface, so a single implementation still satisfies both.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import type { ClaimEvent, ConflictEvent } from './
|
|
14
|
+
import type { ClaimEvent, ConflictEvent } from './claims/events.js';
|
|
15
15
|
|
|
16
16
|
export interface CoordinationObservability {
|
|
17
17
|
/** Capture a claim state change (acquired / queued / granted / lost / rejected / expired). */
|
|
18
18
|
captureClaim(event: ClaimEvent): void;
|
|
19
19
|
|
|
20
|
-
/** Capture a
|
|
20
|
+
/** Capture a rejected stale-write or foreign-claim collision. */
|
|
21
21
|
captureConflict(event: ConflictEvent): void;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* layer, alongside the other protocol shapes in `wire/`.
|
|
7
7
|
*
|
|
8
8
|
* The wire delta is a projection of the stored `sync_deltas` row (the
|
|
9
|
-
* `syncDeltaRowSchema` in
|
|
9
|
+
* `syncDeltaRowSchema` in `./persistence/syncDeltaRow.ts`) and differs from it
|
|
10
10
|
* in three ways: it omits `organizationId` (the tenant-isolation predicate is
|
|
11
11
|
* never broadcast), it uses the full action vocabulary (see
|
|
12
12
|
* {@link syncDeltaActionSchema}) rather than plain create, update, and delete, and
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import { z } from 'zod';
|
|
29
|
-
import { correlationIdSchema } from '
|
|
29
|
+
import { correlationIdSchema } from '../commit/contract.js';
|
|
30
30
|
import { participantKindSchema } from '../coordination/schema.js';
|
|
31
31
|
import type { ParticipantKind, ParticipantRef } from '../types/participant.js';
|
|
32
32
|
import type { AssertExact } from '../types/assertExact.js';
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { z } from 'zod';
|
|
17
|
-
import { logEventSchema, logOpSchema, type LogEvent } from '
|
|
18
|
-
import { claimEventSchema, type ClaimEvent } from '
|
|
19
|
-
import { listEnvelopeSchema, type ListEnvelope } from '
|
|
17
|
+
import { logEventSchema, logOpSchema, type LogEvent } from '../wire/accountResponses.js';
|
|
18
|
+
import { claimEventSchema, type ClaimEvent } from '../claims/eventContract.js';
|
|
19
|
+
import { listEnvelopeSchema, type ListEnvelope } from '../wire/listEnvelope.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* One entry, from either source. Discriminated on `object`, so a consumer
|
|
@@ -71,4 +71,3 @@ export type LogQuery = z.infer<typeof logQuerySchema>;
|
|
|
71
71
|
* What is here is the definition the producer will fill: the union parses
|
|
72
72
|
* today's pages unchanged, and the cursor already carries the second position.
|
|
73
73
|
*/
|
|
74
|
-
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { formatFeedCursor, parseFeedCursor } from '
|
|
2
|
-
import type { HttpLogsResource } from '../resources/httpResources.js';
|
|
1
|
+
import { formatFeedCursor, parseFeedCursor } from './cursor.js';
|
|
2
|
+
import type { HttpLogsResource } from '../client/resources/httpResources.js';
|
|
3
3
|
import type {
|
|
4
4
|
ObserveOptions,
|
|
5
5
|
ObservedDelta,
|
|
6
|
-
} from '../
|
|
6
|
+
} from '../client/contract.js';
|
|
7
7
|
|
|
8
8
|
const DEFAULT_PAGE_SIZE = 100;
|
|
9
9
|
const DEFAULT_POLL_INTERVAL_MS = 500;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Start here and descend through delta contracts, feed contracts, cursor
|
|
5
|
+
* handling, delivery inspection, HTTP polling, and persisted row projection.
|
|
6
|
+
*/
|
|
7
|
+
export * from './contract.js';
|
|
8
|
+
export * from './cursor.js';
|
|
9
|
+
export * from './feedContract.js';
|
|
10
|
+
export * from './deliveryContract.js';
|
|
11
|
+
export * from './httpFeed.js';
|
|
12
|
+
export * from './persistence/syncDeltaRow.js';
|
|
@@ -16,25 +16,25 @@
|
|
|
16
16
|
* incorrectly as a physical-residency guarantee.
|
|
17
17
|
*
|
|
18
18
|
* This is the stored shape. The delta broadcast to clients is a narrower projection
|
|
19
|
-
* of it — see {@link import('../
|
|
19
|
+
* of it — see {@link import('../contract.js').syncDeltaWireCoreSchema} — and
|
|
20
20
|
* the field names here mirror those on that wire delta.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { z } from 'zod';
|
|
24
|
-
import type { ModelResidency } from '
|
|
24
|
+
import type { ModelResidency } from '../../schema/residency.js';
|
|
25
25
|
import {
|
|
26
26
|
participantKindSchema,
|
|
27
27
|
confirmationStateSchema,
|
|
28
28
|
syncDeltaActionSchema,
|
|
29
|
-
} from '../
|
|
29
|
+
} from '../contract.js';
|
|
30
30
|
|
|
31
31
|
// ── Enumerations that mirror the corresponding Postgres enum types ────────────
|
|
32
32
|
|
|
33
33
|
// `participant_kind` and `confirmation_state` are shared with the wire delta and
|
|
34
|
-
// live
|
|
34
|
+
// live in the observation contract (see `../contract.js`); they are re-exported here so
|
|
35
35
|
// code that imports them from `schema` keeps resolving.
|
|
36
|
-
export { participantKindSchema, confirmationStateSchema } from '../
|
|
37
|
-
export type { ParticipantKind, ConfirmationState } from '../
|
|
36
|
+
export { participantKindSchema, confirmationStateSchema } from '../contract.js';
|
|
37
|
+
export type { ParticipantKind, ConfirmationState } from '../contract.js';
|
|
38
38
|
|
|
39
39
|
/** `backfill_provenance` */
|
|
40
40
|
export const backfillProvenanceSchema = z.enum(['exact', 'inferred', 'unknown']);
|
|
@@ -116,4 +116,3 @@ export const DELTA_PHYSICAL_STORAGE = {
|
|
|
116
116
|
core: 'control',
|
|
117
117
|
attribution: 'control',
|
|
118
118
|
} as const satisfies Record<string, ModelResidency>;
|
|
119
|
-
|
package/src/pricing.ts
CHANGED
|
@@ -28,10 +28,9 @@
|
|
|
28
28
|
* invoice, because raising one number does not fail anything that pins the
|
|
29
29
|
* other.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* a claim the invoice cannot support. Add the axis when the sampler ships.
|
|
31
|
+
* Audit-log storage is quoted as an included allowance plus Scale overage. It
|
|
32
|
+
* remains separate from the request meter because GiB-months come from a
|
|
33
|
+
* periodic storage sampler rather than an API event.
|
|
35
34
|
*/
|
|
36
35
|
|
|
37
36
|
import { z } from 'zod';
|
|
@@ -47,7 +46,7 @@ export type { MeterEvent, PlanTier, RateBracket };
|
|
|
47
46
|
* could observe the difference. It is emitted into the generated pricing
|
|
48
47
|
* documentation so a stale copy is identifiable on sight.
|
|
49
48
|
*/
|
|
50
|
-
export const PRICING_VERSION = '2026-
|
|
49
|
+
export const PRICING_VERSION = '2026-08-24';
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
52
|
* Resolve a stored plan string (`stripe_subscription.plan`) to a tier.
|
|
@@ -66,8 +65,8 @@ export function toPlanTier(plan: string | null | undefined): PlanTier {
|
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
/**
|
|
69
|
-
* The axes
|
|
70
|
-
*
|
|
68
|
+
* The request-time axes: `ops` is metered and `connections` is capped. Audit
|
|
69
|
+
* storage is sampled periodically, so it does not map from a request event.
|
|
71
70
|
*/
|
|
72
71
|
export const billableAxisSchema = z.enum(['ops', 'connections']);
|
|
73
72
|
export type BillableAxis = z.infer<typeof billableAxisSchema>;
|
|
@@ -184,11 +183,12 @@ const rateCardSchema = z
|
|
|
184
183
|
* knob; the bracket structure is the contract.
|
|
185
184
|
*/
|
|
186
185
|
export const OPS_RATE_CARD: readonly RateBracket[] = rateCardSchema.parse([
|
|
187
|
-
{ throughOps:
|
|
188
|
-
{ throughOps: 500_000_000, usdPerMillionOps: 1.2 },
|
|
189
|
-
{ throughOps: null, usdPerMillionOps: 0.6 },
|
|
186
|
+
{ throughOps: null, usdPerMillionOps: 5 },
|
|
190
187
|
]);
|
|
191
188
|
|
|
189
|
+
/** Scale audit-log storage above the included allowance, per GiB-month. */
|
|
190
|
+
export const AUDIT_LOG_STORAGE_USD_PER_GIB_MONTH = 1;
|
|
191
|
+
|
|
192
192
|
/**
|
|
193
193
|
* A tier. `null` on a floor, a cap, or a quota means negotiated rather than
|
|
194
194
|
* unlimited, and the runtime treats it as "no typed default, use the operator's
|
|
@@ -206,9 +206,9 @@ export const planDefinitionSchema = z.object({
|
|
|
206
206
|
*/
|
|
207
207
|
monthlyMinimumUsd: z.number().nonnegative().nullable(),
|
|
208
208
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
209
|
+
* The no-billing monthly stop. On Free this is also the included allowance:
|
|
210
|
+
* organizations without billing enabled stop here, while organizations that
|
|
211
|
+
* enable billing pay only for operations above it. `null` on paid tiers.
|
|
212
212
|
*/
|
|
213
213
|
hardCapOps: z.number().int().positive().nullable(),
|
|
214
214
|
/**
|
|
@@ -220,7 +220,7 @@ export const planDefinitionSchema = z.object({
|
|
|
220
220
|
* are billed rather than stopped.
|
|
221
221
|
*/
|
|
222
222
|
hardCapOpsPerDay: z.number().int().positive().nullable(),
|
|
223
|
-
/**
|
|
223
|
+
/** Included audit-log storage, in GiB. `null` means contract-priced capacity. */
|
|
224
224
|
storageGib: z.number().positive().nullable(),
|
|
225
225
|
/** Hard concurrent-connection cap, the real Free to Scale boundary. */
|
|
226
226
|
maxConcurrentConnections: z.number().int().positive().nullable(),
|
|
@@ -240,7 +240,7 @@ export const PLANS = z
|
|
|
240
240
|
free: {
|
|
241
241
|
tier: 'free',
|
|
242
242
|
label: 'Free',
|
|
243
|
-
summary: '
|
|
243
|
+
summary: 'Free for early-stage teams building against the real engine.',
|
|
244
244
|
monthlyMinimumUsd: 0,
|
|
245
245
|
hardCapOps: 100_000,
|
|
246
246
|
hardCapOpsPerDay: 10_000,
|
|
@@ -252,8 +252,8 @@ export const PLANS = z
|
|
|
252
252
|
scale: {
|
|
253
253
|
tier: 'scale',
|
|
254
254
|
label: 'Scale',
|
|
255
|
-
summary: '
|
|
256
|
-
monthlyMinimumUsd:
|
|
255
|
+
summary: 'Built for scaling teams with production traffic.',
|
|
256
|
+
monthlyMinimumUsd: 250,
|
|
257
257
|
hardCapOps: null,
|
|
258
258
|
hardCapOpsPerDay: null,
|
|
259
259
|
storageGib: 50,
|
|
@@ -264,8 +264,8 @@ export const PLANS = z
|
|
|
264
264
|
enterprise: {
|
|
265
265
|
tier: 'enterprise',
|
|
266
266
|
label: 'Enterprise',
|
|
267
|
-
summary: '
|
|
268
|
-
monthlyMinimumUsd:
|
|
267
|
+
summary: 'Custom infrastructure, security, and support for critical workloads.',
|
|
268
|
+
monthlyMinimumUsd: 4_000,
|
|
269
269
|
hardCapOps: null,
|
|
270
270
|
hardCapOpsPerDay: null,
|
|
271
271
|
storageGib: null,
|
|
@@ -336,8 +336,8 @@ export function opsForUsd(usd: number): number {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
|
-
* The operations a tier includes, as shown on the pricing page.
|
|
340
|
-
*
|
|
339
|
+
* The operations a tier includes, as shown on the pricing page. Free shows its
|
|
340
|
+
* pay-as-you-go allowance; a tier with a floor shows what that floor covers, computed from the
|
|
341
341
|
* floor rather than stored beside it. `null` where the terms are contractual.
|
|
342
342
|
*/
|
|
343
343
|
export function monthlyOpsAllowance(tier: PlanTier): number | null {
|
|
@@ -348,17 +348,38 @@ export function monthlyOpsAllowance(tier: PlanTier): number | null {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
/**
|
|
351
|
-
* The invoice for a month
|
|
352
|
-
*
|
|
353
|
-
*
|
|
351
|
+
* The invoice for a month. Free subtracts its included operations before
|
|
352
|
+
* applying the rate. Scale charges the floor or metered usage, whichever is
|
|
353
|
+
* greater. `null` where the terms are contractual.
|
|
354
354
|
*/
|
|
355
355
|
export function monthlyBillUsd(tier: PlanTier, ops: number): number | null {
|
|
356
356
|
const plan = PLANS[tier];
|
|
357
357
|
if (plan.contractPriced || plan.monthlyMinimumUsd === null) return null;
|
|
358
|
-
if (plan.hardCapOps !== null)
|
|
358
|
+
if (plan.hardCapOps !== null) {
|
|
359
|
+
return roundUsd(usdForOps(Math.max(0, ops - plan.hardCapOps)));
|
|
360
|
+
}
|
|
359
361
|
return roundUsd(Math.max(plan.monthlyMinimumUsd, usdForOps(ops)));
|
|
360
362
|
}
|
|
361
363
|
|
|
364
|
+
/**
|
|
365
|
+
* Audit-log storage overage for a month. Free and Scale meter only the GiB
|
|
366
|
+
* above their included amount, and Enterprise is priced in the contract.
|
|
367
|
+
*/
|
|
368
|
+
export function auditLogStorageBillUsd(tier: PlanTier, storageGib: number): number | null {
|
|
369
|
+
const plan = PLANS[tier];
|
|
370
|
+
if (plan.contractPriced || plan.storageGib === null) return null;
|
|
371
|
+
if (!Number.isFinite(storageGib)) return 0;
|
|
372
|
+
return roundUsd(Math.max(0, storageGib - plan.storageGib) * AUDIT_LOG_STORAGE_USD_PER_GIB_MONTH);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** The complete published estimate across operation and audit-storage usage. */
|
|
376
|
+
export function monthlyEstimateUsd(tier: PlanTier, ops: number, auditStorageGib: number): number | null {
|
|
377
|
+
const operationsBill = monthlyBillUsd(tier, ops);
|
|
378
|
+
const storageBill = auditLogStorageBillUsd(tier, auditStorageGib);
|
|
379
|
+
if (operationsBill === null || storageBill === null) return null;
|
|
380
|
+
return roundUsd(operationsBill + storageBill);
|
|
381
|
+
}
|
|
382
|
+
|
|
362
383
|
/**
|
|
363
384
|
* The daily operations cap for a tier: the typed default the quota gate falls
|
|
364
385
|
* back to when no `plan_limit` row sets one. `null` means the tier is metered
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ModelJSON, SchemaJSON } from './serialize.js';
|
|
2
|
+
import { resolveTenancy } from './tenancy.js';
|
|
3
|
+
|
|
4
|
+
export interface SchemaAuditFinding {
|
|
5
|
+
readonly code: 'scope_routing_without_access_policy';
|
|
6
|
+
readonly severity: 'error';
|
|
7
|
+
readonly model: string;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly fix: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface RoutingAnchor {
|
|
13
|
+
readonly description: string;
|
|
14
|
+
readonly column: string;
|
|
15
|
+
readonly parentTable?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function tableName(key: string, model: ModelJSON): string {
|
|
19
|
+
return model.tableName ?? key;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function fieldColumn(model: ModelJSON, field: string): string {
|
|
23
|
+
return model.fields[field]?.column ?? field;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function camelToSnake(value: string): string {
|
|
27
|
+
return value.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function reachesScope(
|
|
31
|
+
key: string,
|
|
32
|
+
models: SchemaJSON['models'],
|
|
33
|
+
seen: ReadonlySet<string> = new Set(),
|
|
34
|
+
): boolean {
|
|
35
|
+
if (seen.has(key)) return false;
|
|
36
|
+
const model = models[key];
|
|
37
|
+
if (!model) return false;
|
|
38
|
+
if (model.scope) return true;
|
|
39
|
+
const nextSeen = new Set(seen).add(key);
|
|
40
|
+
return Object.values(model.relations).some(
|
|
41
|
+
(relation) => relation.type === 'belongsTo' && reachesScope(relation.target, models, nextSeen),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function routingAnchors(
|
|
46
|
+
model: ModelJSON,
|
|
47
|
+
models: SchemaJSON['models'],
|
|
48
|
+
): readonly RoutingAnchor[] {
|
|
49
|
+
const anchors: RoutingAnchor[] = [];
|
|
50
|
+
|
|
51
|
+
if (model.scope) {
|
|
52
|
+
anchors.push({ description: `scope root ${String(model.scope)}`, column: 'id' });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
for (const role of model.entityRoles ?? []) {
|
|
56
|
+
anchors.push({
|
|
57
|
+
description: `entity role ${role.kind}`,
|
|
58
|
+
column: fieldColumn(model, role.source.field),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const [relationName, relation] of Object.entries(model.relations)) {
|
|
63
|
+
if (relation.type !== 'belongsTo' || !reachesScope(relation.target, models)) continue;
|
|
64
|
+
const target = models[relation.target];
|
|
65
|
+
if (!target) continue;
|
|
66
|
+
anchors.push({
|
|
67
|
+
description: `parent scope ${relationName}`,
|
|
68
|
+
column: relation.foreignKeyColumn,
|
|
69
|
+
parentTable: tableName(relation.target, target),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return anchors;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function policyMatches(anchor: RoutingAnchor, model: ModelJSON): boolean {
|
|
77
|
+
const tenancy = resolveTenancy(model);
|
|
78
|
+
if (tenancy.kind === 'source') return true;
|
|
79
|
+
if (tenancy.kind === 'column') {
|
|
80
|
+
return tenancy.column === anchor.column || tenancy.column === camelToSnake(anchor.column);
|
|
81
|
+
}
|
|
82
|
+
if (tenancy.kind === 'parent') {
|
|
83
|
+
return tenancy.via.localKey === anchor.column &&
|
|
84
|
+
(anchor.parentTable === undefined || tenancy.via.parentTable === anchor.parentTable);
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Finds mutable models whose sync-group routing is narrower than their row-read
|
|
91
|
+
* policy. A correctly filtered list or routed stream is not evidence that a
|
|
92
|
+
* foreign row is unreadable; only the policy is the authorization boundary.
|
|
93
|
+
*/
|
|
94
|
+
export function auditSchemaAccessPolicies(schema: SchemaJSON): readonly SchemaAuditFinding[] {
|
|
95
|
+
const findings: SchemaAuditFinding[] = [];
|
|
96
|
+
|
|
97
|
+
for (const [key, model] of Object.entries(schema.models)) {
|
|
98
|
+
if (model.mutable === false || model.routingOnly === true) continue;
|
|
99
|
+
const mismatched = routingAnchors(model, schema.models)
|
|
100
|
+
.filter((anchor) => !policyMatches(anchor, model));
|
|
101
|
+
if (mismatched.length === 0) continue;
|
|
102
|
+
|
|
103
|
+
const policy = resolveTenancy(model);
|
|
104
|
+
const routedBy = mismatched.map(({ description, column }) => `${description} (${column})`).join(', ');
|
|
105
|
+
findings.push({
|
|
106
|
+
code: 'scope_routing_without_access_policy',
|
|
107
|
+
severity: 'error',
|
|
108
|
+
model: key,
|
|
109
|
+
message:
|
|
110
|
+
`Model "${key}" routes changes by ${routedBy}, but its row-access policy is ` +
|
|
111
|
+
`by ${policy.kind}. Sync groups route delivery; they do not authorize reads. ` +
|
|
112
|
+
`A filtered list or correctly routed live stream is not an authorization proof.`,
|
|
113
|
+
fix:
|
|
114
|
+
`Make policy follow the same customer/workspace boundary on every reachable model, ` +
|
|
115
|
+
`use policy: { by: 'source' } with one Ablo organization per hard tenant, or set ` +
|
|
116
|
+
`groups.routingOnly: true to explicitly acknowledge an intentionally broader read policy.`,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return findings;
|
|
121
|
+
}
|
package/src/schema/ddl.ts
CHANGED
|
@@ -27,6 +27,7 @@ import type { SchemaJSON, ModelJSON } from './serialize.js';
|
|
|
27
27
|
import type { MigrationStep, BackfillValue, FieldType } from './diff.js';
|
|
28
28
|
import type { FieldMeta } from './field.js';
|
|
29
29
|
import { resolveTenancy, tenancyColumn } from './tenancy.js';
|
|
30
|
+
import type { SubjectRule } from './subject.js';
|
|
30
31
|
|
|
31
32
|
export interface ProvisionPlan {
|
|
32
33
|
/** The Postgres schema the tables live in (`app_<id>` or `public`). */
|
|
@@ -119,6 +120,22 @@ export function sqlType(fieldType: ModelJSON['fields'][string]['type']): string
|
|
|
119
120
|
|
|
120
121
|
const BASE_COLUMNS = new Set(['id']);
|
|
121
122
|
|
|
123
|
+
function subjectPredicate(model: ModelJSON, rule: SubjectRule): string {
|
|
124
|
+
const meta = model.fields[rule.field];
|
|
125
|
+
if (!meta) {
|
|
126
|
+
throw new AbloValidationError(`subject field ${JSON.stringify(rule.field)} is not declared`, {
|
|
127
|
+
code: 'schema_definition_invalid',
|
|
128
|
+
param: 'subject.field',
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const column = meta.column ?? camelToSnake(rule.field);
|
|
132
|
+
const prefix = `${rule.group}:`.replace(/'/g, "''");
|
|
133
|
+
return (
|
|
134
|
+
`COALESCE(NULLIF(current_setting('app.current_subject_groups', true), ''), '[]')::jsonb ` +
|
|
135
|
+
`? ('${prefix}' || ${q(column)}::text)`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
122
139
|
// ── Foreign keys (relation-driven, sync-safe) ────────────────────────────────
|
|
123
140
|
|
|
124
141
|
/**
|
|
@@ -324,7 +341,20 @@ export function generateProvisionPlan(
|
|
|
324
341
|
statements.push(`ALTER TABLE ${qt} ENABLE ROW LEVEL SECURITY;`);
|
|
325
342
|
statements.push(`ALTER TABLE ${qt} FORCE ROW LEVEL SECURITY;`);
|
|
326
343
|
const policy = `${table}_tenant_isolation`;
|
|
327
|
-
const
|
|
344
|
+
const predicates = [
|
|
345
|
+
`${q(orgCol)} = current_setting('app.current_org_id', true)`,
|
|
346
|
+
...(model.subject ? [subjectPredicate(model, model.subject)] : []),
|
|
347
|
+
];
|
|
348
|
+
const predicate = predicates.length === 1
|
|
349
|
+
? predicates[0]!
|
|
350
|
+
: predicates.map((part) => `(${part})`).join(' AND ');
|
|
351
|
+
statements.push(`DROP POLICY IF EXISTS ${q(policy)} ON ${qt};`);
|
|
352
|
+
statements.push(`CREATE POLICY ${q(policy)} ON ${qt}\n USING (${predicate})\n WITH CHECK (${predicate});`);
|
|
353
|
+
} else if (model.subject) {
|
|
354
|
+
statements.push(`ALTER TABLE ${qt} ENABLE ROW LEVEL SECURITY;`);
|
|
355
|
+
statements.push(`ALTER TABLE ${qt} FORCE ROW LEVEL SECURITY;`);
|
|
356
|
+
const policy = `${table}_subject_isolation`;
|
|
357
|
+
const predicate = subjectPredicate(model, model.subject);
|
|
328
358
|
statements.push(`DROP POLICY IF EXISTS ${q(policy)} ON ${qt};`);
|
|
329
359
|
statements.push(`CREATE POLICY ${q(policy)} ON ${qt}\n USING (${predicate})\n WITH CHECK (${predicate});`);
|
|
330
360
|
}
|
|
@@ -585,5 +615,45 @@ export function generateMigrationPlan(
|
|
|
585
615
|
}
|
|
586
616
|
}
|
|
587
617
|
|
|
618
|
+
// Subject authorization is metadata rather than a field diff. Reconcile when
|
|
619
|
+
// that metadata changes, or when the protected field's physical column
|
|
620
|
+
// changes. An identical empty migration must remain a true no-op.
|
|
621
|
+
for (const [key, model] of Object.entries(next.models)) {
|
|
622
|
+
if ((model.plane ?? 'tenant') === 'control') continue;
|
|
623
|
+
const previousModel = prev?.models[key];
|
|
624
|
+
const subjectChanged = JSON.stringify(previousModel?.subject) !== JSON.stringify(model.subject);
|
|
625
|
+
const subjectColumnChanged = steps.some((step) =>
|
|
626
|
+
'model' in step && step.model === key &&
|
|
627
|
+
step.kind === 'alter_field' &&
|
|
628
|
+
(step.field === model.subject?.field || step.field === previousModel?.subject?.field) &&
|
|
629
|
+
step.changes.column !== undefined
|
|
630
|
+
);
|
|
631
|
+
if (!subjectChanged && !subjectColumnChanged) continue;
|
|
632
|
+
const table = model.tableName ?? key;
|
|
633
|
+
const qt = qtFor(table);
|
|
634
|
+
const orgCol = tenancyColumn(resolveTenancy(model));
|
|
635
|
+
const tenantPolicy = `${table}_tenant_isolation`;
|
|
636
|
+
const subjectPolicy = `${table}_subject_isolation`;
|
|
637
|
+
if (orgCol || model.subject) {
|
|
638
|
+
statements.push(`ALTER TABLE ${qt} ENABLE ROW LEVEL SECURITY;`);
|
|
639
|
+
statements.push(`ALTER TABLE ${qt} FORCE ROW LEVEL SECURITY;`);
|
|
640
|
+
statements.push(`DROP POLICY IF EXISTS ${q(tenantPolicy)} ON ${qt};`);
|
|
641
|
+
statements.push(`DROP POLICY IF EXISTS ${q(subjectPolicy)} ON ${qt};`);
|
|
642
|
+
const parts = [
|
|
643
|
+
...(orgCol ? [`${q(orgCol)} = current_setting('app.current_org_id', true)`] : []),
|
|
644
|
+
...(model.subject ? [subjectPredicate(model, model.subject)] : []),
|
|
645
|
+
];
|
|
646
|
+
const predicate = parts.length === 1
|
|
647
|
+
? parts[0]!
|
|
648
|
+
: parts.map((part) => `(${part})`).join(' AND ');
|
|
649
|
+
const policy = orgCol ? tenantPolicy : subjectPolicy;
|
|
650
|
+
statements.push(`CREATE POLICY ${q(policy)} ON ${qt}\n USING (${predicate})\n WITH CHECK (${predicate});`);
|
|
651
|
+
} else if (previousModel?.subject) {
|
|
652
|
+
statements.push(`DROP POLICY IF EXISTS ${q(subjectPolicy)} ON ${qt};`);
|
|
653
|
+
statements.push(`ALTER TABLE ${qt} NO FORCE ROW LEVEL SECURITY;`);
|
|
654
|
+
statements.push(`ALTER TABLE ${qt} DISABLE ROW LEVEL SECURITY;`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
588
658
|
return { appSchema: targetSchema, statements, concurrent };
|
|
589
659
|
}
|
package/src/schema/index.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* status: z.enum(['todo', 'doing', 'done']).default('todo'),
|
|
14
14
|
* projectId: z.string().optional(),
|
|
15
15
|
* }, {
|
|
16
|
-
* project: relation.belongsTo('projects', 'projectId'),
|
|
16
|
+
* relations: { project: relation.belongsTo('projects', 'projectId') },
|
|
17
17
|
* }),
|
|
18
18
|
* });
|
|
19
19
|
*
|
|
@@ -80,7 +80,7 @@ export {
|
|
|
80
80
|
type ParticipantKind,
|
|
81
81
|
type ConfirmationState,
|
|
82
82
|
type BackfillProvenance,
|
|
83
|
-
} from '../
|
|
83
|
+
} from '../observation/persistence/syncDeltaRow.js';
|
|
84
84
|
|
|
85
85
|
// The wire delta contract — the server-to-client projection of the stored row.
|
|
86
86
|
// Both the client SDK and the server derive their `SyncDelta` type from these with
|
|
@@ -98,7 +98,7 @@ export {
|
|
|
98
98
|
type SyncDeltaWireCore,
|
|
99
99
|
type ClientSyncDelta,
|
|
100
100
|
type ServerSyncDelta,
|
|
101
|
-
} from '../
|
|
101
|
+
} from '../observation/contract.js';
|
|
102
102
|
|
|
103
103
|
// Model builder
|
|
104
104
|
export {
|
|
@@ -115,25 +115,8 @@ export {
|
|
|
115
115
|
type PersistOptions,
|
|
116
116
|
type RelationRecord,
|
|
117
117
|
type GrantsRef,
|
|
118
|
-
type ConflictAxis,
|
|
119
118
|
} from './model.js';
|
|
120
119
|
|
|
121
|
-
// Coordination authoring helpers for the `conflict` axis — composable disposition
|
|
122
|
-
// functions plus a combinator that merges them.
|
|
123
|
-
export {
|
|
124
|
-
coordination,
|
|
125
|
-
humansOverwrite,
|
|
126
|
-
humansReject,
|
|
127
|
-
humansNotify,
|
|
128
|
-
agentsOverwrite,
|
|
129
|
-
agentsReject,
|
|
130
|
-
agentsNotify,
|
|
131
|
-
systemOverwrite,
|
|
132
|
-
systemReject,
|
|
133
|
-
systemNotify,
|
|
134
|
-
type ConflictRule,
|
|
135
|
-
} from './coordination.js';
|
|
136
|
-
|
|
137
120
|
// Claim-first shorthand for common model options: `mutable.lazy({...})` and friends
|
|
138
121
|
// encode a model's write-safety and load strategy in the verb, and fall back to
|
|
139
122
|
// sensible defaults for everything else.
|
|
@@ -145,6 +128,7 @@ export {
|
|
|
145
128
|
composeIdentitySyncGroups,
|
|
146
129
|
type Schema,
|
|
147
130
|
type SchemaRecord,
|
|
131
|
+
BASE_FIELDS,
|
|
148
132
|
type Model,
|
|
149
133
|
type Row,
|
|
150
134
|
type InferCreate,
|
|
@@ -154,12 +138,16 @@ export {
|
|
|
154
138
|
type InsertValue,
|
|
155
139
|
type UpsertValue,
|
|
156
140
|
type UpdateValue,
|
|
141
|
+
type Clearable,
|
|
157
142
|
type DeleteId,
|
|
158
143
|
type DefineSchemaOptions,
|
|
159
144
|
type Casing,
|
|
160
145
|
type CasingConvention,
|
|
161
146
|
type CasingFn,
|
|
162
147
|
composeEntitySyncGroups,
|
|
148
|
+
syncGroupsForRow,
|
|
149
|
+
InvalidRecordSubjectError,
|
|
150
|
+
type RecordSyncGroupSpec,
|
|
163
151
|
intersectRequestedWithAllowed,
|
|
164
152
|
type IdentityRole,
|
|
165
153
|
type IdentityContext,
|
|
@@ -210,6 +198,18 @@ export {
|
|
|
210
198
|
type RelationJSON,
|
|
211
199
|
} from './serialize.js';
|
|
212
200
|
|
|
201
|
+
export {
|
|
202
|
+
auditSchemaAccessPolicies,
|
|
203
|
+
type SchemaAuditFinding,
|
|
204
|
+
} from './audit.js';
|
|
205
|
+
|
|
206
|
+
export {
|
|
207
|
+
subjectRuleSchema,
|
|
208
|
+
subjectGroupForRow,
|
|
209
|
+
subjectAuthorized,
|
|
210
|
+
type SubjectRule,
|
|
211
|
+
} from './subject.js';
|
|
212
|
+
|
|
213
213
|
// Schema projection — derive an app's subset from one canonical schema.
|
|
214
214
|
export { selectModels, omitModels, omittedModelError } from './select.js';
|
|
215
215
|
|