@abloatai/transaction 0.37.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 +83 -0
- package/README.md +48 -0
- package/dist/ablo.d.ts +90 -0
- package/dist/ablo.d.ts.map +1 -0
- package/dist/ablo.js +34 -0
- package/dist/ablo.js.map +1 -0
- package/dist/ai-sdk/coordinatedTool.d.ts +123 -0
- package/dist/ai-sdk/coordinatedTool.d.ts.map +1 -0
- package/dist/ai-sdk/coordinatedTool.js +135 -0
- package/dist/ai-sdk/coordinatedTool.js.map +1 -0
- package/dist/ai-sdk/index.d.ts +2 -0
- package/dist/ai-sdk/index.d.ts.map +1 -0
- package/dist/ai-sdk/index.js +2 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/auth/apiKey.d.ts +154 -0
- package/dist/auth/apiKey.d.ts.map +1 -0
- package/dist/auth/apiKey.js +408 -0
- package/dist/auth/apiKey.js.map +1 -0
- package/dist/auth/bootstrapScope.d.ts +16 -0
- package/dist/auth/bootstrapScope.d.ts.map +1 -0
- package/dist/auth/bootstrapScope.js +2 -0
- package/dist/auth/bootstrapScope.js.map +1 -0
- package/dist/auth/browserCredentialSafety.d.ts +7 -0
- package/dist/auth/browserCredentialSafety.d.ts.map +1 -0
- package/dist/auth/browserCredentialSafety.js +29 -0
- package/dist/auth/browserCredentialSafety.js.map +1 -0
- package/dist/auth/capability.d.ts +241 -0
- package/dist/auth/capability.d.ts.map +1 -0
- package/dist/auth/capability.js +253 -0
- package/dist/auth/capability.js.map +1 -0
- package/dist/auth/capabilityLifecycle.d.ts +47 -0
- package/dist/auth/capabilityLifecycle.d.ts.map +1 -0
- package/dist/auth/capabilityLifecycle.js +108 -0
- package/dist/auth/capabilityLifecycle.js.map +1 -0
- package/dist/auth/credentialEndpoint.d.ts +10 -0
- package/dist/auth/credentialEndpoint.d.ts.map +1 -0
- package/dist/auth/credentialEndpoint.js +58 -0
- package/dist/auth/credentialEndpoint.js.map +1 -0
- package/dist/auth/credentialEndpointProtocol.d.ts +24 -0
- package/dist/auth/credentialEndpointProtocol.d.ts.map +1 -0
- package/dist/auth/credentialEndpointProtocol.js +34 -0
- package/dist/auth/credentialEndpointProtocol.js.map +1 -0
- package/dist/auth/credentialKind.d.ts +4 -0
- package/dist/auth/credentialKind.d.ts.map +1 -0
- package/dist/auth/credentialKind.js +15 -0
- package/dist/auth/credentialKind.js.map +1 -0
- package/dist/auth/credentialPolicy.d.ts +141 -0
- package/dist/auth/credentialPolicy.d.ts.map +1 -0
- package/dist/auth/credentialPolicy.js +113 -0
- package/dist/auth/credentialPolicy.js.map +1 -0
- package/dist/auth/credentialResult.d.ts +7 -0
- package/dist/auth/credentialResult.d.ts.map +1 -0
- package/dist/auth/credentialResult.js +9 -0
- package/dist/auth/credentialResult.js.map +1 -0
- package/dist/auth/credentialSource.d.ts +31 -0
- package/dist/auth/credentialSource.d.ts.map +1 -0
- package/dist/auth/credentialSource.js +56 -0
- package/dist/auth/credentialSource.js.map +1 -0
- package/dist/auth/hostedEndpoints.d.ts +22 -0
- package/dist/auth/hostedEndpoints.d.ts.map +1 -0
- package/dist/auth/hostedEndpoints.js +22 -0
- package/dist/auth/hostedEndpoints.js.map +1 -0
- package/dist/auth/identity.d.ts +62 -0
- package/dist/auth/identity.d.ts.map +1 -0
- package/dist/auth/identity.js +224 -0
- package/dist/auth/identity.js.map +1 -0
- package/dist/auth/index.d.ts +189 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +312 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/schemas.d.ts +41 -0
- package/dist/auth/schemas.d.ts.map +1 -0
- package/dist/auth/schemas.js +69 -0
- package/dist/auth/schemas.js.map +1 -0
- package/dist/auth/sessionMint.d.ts +29 -0
- package/dist/auth/sessionMint.d.ts.map +1 -0
- package/dist/auth/sessionMint.js +92 -0
- package/dist/auth/sessionMint.js.map +1 -0
- package/dist/auth/token.d.ts +4 -0
- package/dist/auth/token.d.ts.map +1 -0
- package/dist/auth/token.js +4 -0
- package/dist/auth/token.js.map +1 -0
- package/dist/batching/index.d.ts +56 -0
- package/dist/batching/index.d.ts.map +1 -0
- package/dist/batching/index.js +148 -0
- package/dist/batching/index.js.map +1 -0
- package/dist/coordination/awaitClaimGrant.d.ts +57 -0
- package/dist/coordination/awaitClaimGrant.d.ts.map +1 -0
- package/dist/coordination/awaitClaimGrant.js +138 -0
- package/dist/coordination/awaitClaimGrant.js.map +1 -0
- package/dist/coordination/claimHeartbeatLoop.d.ts +85 -0
- package/dist/coordination/claimHeartbeatLoop.d.ts.map +1 -0
- package/dist/coordination/claimHeartbeatLoop.js +109 -0
- package/dist/coordination/claimHeartbeatLoop.js.map +1 -0
- package/dist/coordination/claimMeta.d.ts +50 -0
- package/dist/coordination/claimMeta.d.ts.map +1 -0
- package/dist/coordination/claimMeta.js +53 -0
- package/dist/coordination/claimMeta.js.map +1 -0
- package/dist/coordination/events.d.ts +75 -0
- package/dist/coordination/events.d.ts.map +1 -0
- package/dist/coordination/events.js +8 -0
- package/dist/coordination/events.js.map +1 -0
- package/dist/coordination/index.d.ts +20 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +46 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/locator.d.ts +106 -0
- package/dist/coordination/locator.d.ts.map +1 -0
- package/dist/coordination/locator.js +110 -0
- package/dist/coordination/locator.js.map +1 -0
- package/dist/coordination/schema.d.ts +1332 -0
- package/dist/coordination/schema.d.ts.map +1 -0
- package/dist/coordination/schema.js +1137 -0
- package/dist/coordination/schema.js.map +1 -0
- package/dist/coordination/targetConflict.d.ts +3 -0
- package/dist/coordination/targetConflict.d.ts.map +1 -0
- package/dist/coordination/targetConflict.js +74 -0
- package/dist/coordination/targetConflict.js.map +1 -0
- package/dist/coordination/trace.d.ts +79 -0
- package/dist/coordination/trace.d.ts.map +1 -0
- package/dist/coordination/trace.js +139 -0
- package/dist/coordination/trace.js.map +1 -0
- package/dist/docs/catalog.d.ts +73 -0
- package/dist/docs/catalog.d.ts.map +1 -0
- package/dist/docs/catalog.js +231 -0
- package/dist/docs/catalog.js.map +1 -0
- package/dist/docs/index.d.ts +11 -0
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +11 -0
- package/dist/docs/index.js.map +1 -0
- package/dist/durableWrites.d.ts +63 -0
- package/dist/durableWrites.d.ts.map +1 -0
- package/dist/durableWrites.js +72 -0
- package/dist/durableWrites.js.map +1 -0
- package/dist/environment.d.ts +106 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +109 -0
- package/dist/environment.js.map +1 -0
- package/dist/errorCodes.d.ts +411 -0
- package/dist/errorCodes.d.ts.map +1 -0
- package/dist/errorCodes.js +500 -0
- package/dist/errorCodes.js.map +1 -0
- package/dist/errors.d.ts +429 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +687 -0
- package/dist/errors.js.map +1 -0
- package/dist/footprint.d.ts +112 -0
- package/dist/footprint.d.ts.map +1 -0
- package/dist/footprint.js +0 -0
- package/dist/footprint.js.map +1 -0
- package/dist/headlessClient.d.ts +10 -0
- package/dist/headlessClient.d.ts.map +1 -0
- package/dist/headlessClient.js +114 -0
- package/dist/headlessClient.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/keys/index.d.ts +88 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +208 -0
- package/dist/keys/index.js.map +1 -0
- package/dist/log/syncDeltaRow.d.ts +159 -0
- package/dist/log/syncDeltaRow.d.ts.map +1 -0
- package/dist/log/syncDeltaRow.js +96 -0
- package/dist/log/syncDeltaRow.js.map +1 -0
- package/dist/logger.d.ts +17 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +8 -0
- package/dist/logger.js.map +1 -0
- package/dist/observability.d.ts +54 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +20 -0
- package/dist/observability.js.map +1 -0
- package/dist/policy/types.d.ts +218 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +127 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/resources/functionalUpdate.d.ts +80 -0
- package/dist/resources/functionalUpdate.d.ts.map +1 -0
- package/dist/resources/functionalUpdate.js +88 -0
- package/dist/resources/functionalUpdate.js.map +1 -0
- package/dist/resources/httpResources.d.ts +449 -0
- package/dist/resources/httpResources.d.ts.map +1 -0
- package/dist/resources/httpResources.js +8 -0
- package/dist/resources/httpResources.js.map +1 -0
- package/dist/resources/modelOperations.d.ts +380 -0
- package/dist/resources/modelOperations.d.ts.map +1 -0
- package/dist/resources/modelOperations.js +13 -0
- package/dist/resources/modelOperations.js.map +1 -0
- package/dist/resources/mutationOptions.d.ts +67 -0
- package/dist/resources/mutationOptions.d.ts.map +1 -0
- package/dist/resources/mutationOptions.js +10 -0
- package/dist/resources/mutationOptions.js.map +1 -0
- package/dist/resources/where.d.ts +102 -0
- package/dist/resources/where.d.ts.map +1 -0
- package/dist/resources/where.js +116 -0
- package/dist/resources/where.js.map +1 -0
- package/dist/resources/writeOptionsSchema.d.ts +48 -0
- package/dist/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/resources/writeOptionsSchema.js +74 -0
- package/dist/resources/writeOptionsSchema.js.map +1 -0
- package/dist/schema/coordination.d.ts +113 -0
- package/dist/schema/coordination.d.ts.map +1 -0
- package/dist/schema/coordination.js +134 -0
- package/dist/schema/coordination.js.map +1 -0
- package/dist/schema/ddl.d.ts +98 -0
- package/dist/schema/ddl.d.ts.map +1 -0
- package/dist/schema/ddl.js +492 -0
- package/dist/schema/ddl.js.map +1 -0
- package/dist/schema/ddlLock.d.ts +36 -0
- package/dist/schema/ddlLock.d.ts.map +1 -0
- package/dist/schema/ddlLock.js +47 -0
- package/dist/schema/ddlLock.js.map +1 -0
- package/dist/schema/diff.d.ts +226 -0
- package/dist/schema/diff.d.ts.map +1 -0
- package/dist/schema/diff.js +290 -0
- package/dist/schema/diff.js.map +1 -0
- package/dist/schema/field.d.ts +121 -0
- package/dist/schema/field.d.ts.map +1 -0
- package/dist/schema/field.js +266 -0
- package/dist/schema/field.js.map +1 -0
- package/dist/schema/fieldRef.d.ts +58 -0
- package/dist/schema/fieldRef.d.ts.map +1 -0
- package/dist/schema/fieldRef.js +26 -0
- package/dist/schema/fieldRef.js.map +1 -0
- package/dist/schema/generate.d.ts +20 -0
- package/dist/schema/generate.d.ts.map +1 -0
- package/dist/schema/generate.js +87 -0
- package/dist/schema/generate.js.map +1 -0
- package/dist/schema/index.d.ts +43 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +81 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/loadStrategy.d.ts +46 -0
- package/dist/schema/loadStrategy.d.ts.map +1 -0
- package/dist/schema/loadStrategy.js +47 -0
- package/dist/schema/loadStrategy.js.map +1 -0
- package/dist/schema/model.d.ts +380 -0
- package/dist/schema/model.d.ts.map +1 -0
- package/dist/schema/model.js +124 -0
- package/dist/schema/model.js.map +1 -0
- package/dist/schema/openapi.d.ts +59 -0
- package/dist/schema/openapi.d.ts.map +1 -0
- package/dist/schema/openapi.js +508 -0
- package/dist/schema/openapi.js.map +1 -0
- package/dist/schema/queries.d.ts +202 -0
- package/dist/schema/queries.d.ts.map +1 -0
- package/dist/schema/queries.js +144 -0
- package/dist/schema/queries.js.map +1 -0
- package/dist/schema/relation.d.ts +205 -0
- package/dist/schema/relation.d.ts.map +1 -0
- package/dist/schema/relation.js +105 -0
- package/dist/schema/relation.js.map +1 -0
- package/dist/schema/residency.d.ts +30 -0
- package/dist/schema/residency.d.ts.map +1 -0
- package/dist/schema/residency.js +26 -0
- package/dist/schema/residency.js.map +1 -0
- package/dist/schema/roles.d.ts +250 -0
- package/dist/schema/roles.d.ts.map +1 -0
- package/dist/schema/roles.js +231 -0
- package/dist/schema/roles.js.map +1 -0
- package/dist/schema/schema.d.ts +352 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/schema/schema.js +326 -0
- package/dist/schema/schema.js.map +1 -0
- package/dist/schema/select.d.ts +41 -0
- package/dist/schema/select.d.ts.map +1 -0
- package/dist/schema/select.js +91 -0
- package/dist/schema/select.js.map +1 -0
- package/dist/schema/serialize.d.ts +116 -0
- package/dist/schema/serialize.d.ts.map +1 -0
- package/dist/schema/serialize.js +278 -0
- package/dist/schema/serialize.js.map +1 -0
- package/dist/schema/sugar.d.ts +110 -0
- package/dist/schema/sugar.d.ts.map +1 -0
- package/dist/schema/sugar.js +84 -0
- package/dist/schema/sugar.js.map +1 -0
- package/dist/schema/tenancy.d.ts +140 -0
- package/dist/schema/tenancy.d.ts.map +1 -0
- package/dist/schema/tenancy.js +191 -0
- package/dist/schema/tenancy.js.map +1 -0
- package/dist/server/adapter.d.ts +174 -0
- package/dist/server/adapter.d.ts.map +1 -0
- package/dist/server/adapter.js +19 -0
- package/dist/server/adapter.js.map +1 -0
- package/dist/server/commit.d.ts +108 -0
- package/dist/server/commit.d.ts.map +1 -0
- package/dist/server/commit.js +2 -0
- package/dist/server/commit.js.map +1 -0
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/readConfig.d.ts +81 -0
- package/dist/server/readConfig.d.ts.map +1 -0
- package/dist/server/readConfig.js +9 -0
- package/dist/server/readConfig.js.map +1 -0
- package/dist/server/storageMode.d.ts +24 -0
- package/dist/server/storageMode.d.ts.map +1 -0
- package/dist/server/storageMode.js +18 -0
- package/dist/server/storageMode.js.map +1 -0
- package/dist/source/adapter.d.ts +84 -0
- package/dist/source/adapter.d.ts.map +1 -0
- package/dist/source/adapter.js +25 -0
- package/dist/source/adapter.js.map +1 -0
- package/dist/source/adapters/drizzle.d.ts +49 -0
- package/dist/source/adapters/drizzle.d.ts.map +1 -0
- package/dist/source/adapters/drizzle.js +220 -0
- package/dist/source/adapters/drizzle.js.map +1 -0
- package/dist/source/adapters/kysely.d.ts +43 -0
- package/dist/source/adapters/kysely.d.ts.map +1 -0
- package/dist/source/adapters/kysely.js +206 -0
- package/dist/source/adapters/kysely.js.map +1 -0
- package/dist/source/adapters/kyselyMutationCore.d.ts +77 -0
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -0
- package/dist/source/adapters/kyselyMutationCore.js +126 -0
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -0
- package/dist/source/adapters/memory.d.ts +14 -0
- package/dist/source/adapters/memory.d.ts.map +1 -0
- package/dist/source/adapters/memory.js +131 -0
- package/dist/source/adapters/memory.js.map +1 -0
- package/dist/source/adapters/prisma.d.ts +64 -0
- package/dist/source/adapters/prisma.d.ts.map +1 -0
- package/dist/source/adapters/prisma.js +203 -0
- package/dist/source/adapters/prisma.js.map +1 -0
- package/dist/source/conformance.d.ts +38 -0
- package/dist/source/conformance.d.ts.map +1 -0
- package/dist/source/conformance.js +216 -0
- package/dist/source/conformance.js.map +1 -0
- package/dist/source/connector.d.ts +96 -0
- package/dist/source/connector.d.ts.map +1 -0
- package/dist/source/connector.js +267 -0
- package/dist/source/connector.js.map +1 -0
- package/dist/source/connectorProtocol.d.ts +155 -0
- package/dist/source/connectorProtocol.d.ts.map +1 -0
- package/dist/source/connectorProtocol.js +164 -0
- package/dist/source/connectorProtocol.js.map +1 -0
- package/dist/source/contract.d.ts +196 -0
- package/dist/source/contract.d.ts.map +1 -0
- package/dist/source/contract.js +165 -0
- package/dist/source/contract.js.map +1 -0
- package/dist/source/drizzle.d.ts +2 -0
- package/dist/source/drizzle.d.ts.map +1 -0
- package/dist/source/drizzle.js +2 -0
- package/dist/source/drizzle.js.map +1 -0
- package/dist/source/factory.d.ts +93 -0
- package/dist/source/factory.d.ts.map +1 -0
- package/dist/source/factory.js +287 -0
- package/dist/source/factory.js.map +1 -0
- package/dist/source/idempotency.d.ts +62 -0
- package/dist/source/idempotency.d.ts.map +1 -0
- package/dist/source/idempotency.js +145 -0
- package/dist/source/idempotency.js.map +1 -0
- package/dist/source/index.d.ts +24 -0
- package/dist/source/index.d.ts.map +1 -0
- package/dist/source/index.js +29 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/kysely.d.ts +3 -0
- package/dist/source/kysely.d.ts.map +1 -0
- package/dist/source/kysely.js +3 -0
- package/dist/source/kysely.js.map +1 -0
- package/dist/source/migrations.d.ts +22 -0
- package/dist/source/migrations.d.ts.map +1 -0
- package/dist/source/migrations.js +104 -0
- package/dist/source/migrations.js.map +1 -0
- package/dist/source/next.d.ts +33 -0
- package/dist/source/next.d.ts.map +1 -0
- package/dist/source/next.js +26 -0
- package/dist/source/next.js.map +1 -0
- package/dist/source/pushQueue.d.ts +135 -0
- package/dist/source/pushQueue.d.ts.map +1 -0
- package/dist/source/pushQueue.js +257 -0
- package/dist/source/pushQueue.js.map +1 -0
- package/dist/source/signing.d.ts +93 -0
- package/dist/source/signing.d.ts.map +1 -0
- package/dist/source/signing.js +163 -0
- package/dist/source/signing.js.map +1 -0
- package/dist/source/types.d.ts +402 -0
- package/dist/source/types.d.ts.map +1 -0
- package/dist/source/types.js +60 -0
- package/dist/source/types.js.map +1 -0
- package/dist/syncLog/contract.d.ts +21 -0
- package/dist/syncLog/contract.d.ts.map +1 -0
- package/dist/syncLog/contract.js +20 -0
- package/dist/syncLog/contract.js.map +1 -0
- package/dist/syncLog/index.d.ts +2 -0
- package/dist/syncLog/index.d.ts.map +1 -0
- package/dist/syncLog/index.js +2 -0
- package/dist/syncLog/index.js.map +1 -0
- package/dist/testing/fixtures/httpResponses.d.ts +74 -0
- package/dist/testing/fixtures/httpResponses.d.ts.map +1 -0
- package/dist/testing/fixtures/httpResponses.js +102 -0
- package/dist/testing/fixtures/httpResponses.js.map +1 -0
- package/dist/transactionLayer.d.ts +110 -0
- package/dist/transactionLayer.d.ts.map +1 -0
- package/dist/transactionLayer.js +25 -0
- package/dist/transactionLayer.js.map +1 -0
- package/dist/transactions/settlement/commitEnvelope.d.ts +144 -0
- package/dist/transactions/settlement/commitEnvelope.d.ts.map +1 -0
- package/dist/transactions/settlement/commitEnvelope.js +162 -0
- package/dist/transactions/settlement/commitEnvelope.js.map +1 -0
- package/dist/transactions/settlement/httpCommitEnvelope.d.ts +54 -0
- package/dist/transactions/settlement/httpCommitEnvelope.d.ts.map +1 -0
- package/dist/transactions/settlement/httpCommitEnvelope.js +208 -0
- package/dist/transactions/settlement/httpCommitEnvelope.js.map +1 -0
- package/dist/transactions/settlement/idempotencyKey.d.ts +11 -0
- package/dist/transactions/settlement/idempotencyKey.d.ts.map +1 -0
- package/dist/transactions/settlement/idempotencyKey.js +10 -0
- package/dist/transactions/settlement/idempotencyKey.js.map +1 -0
- package/dist/transactions/settlement/pendingWrite.d.ts +113 -0
- package/dist/transactions/settlement/pendingWrite.d.ts.map +1 -0
- package/dist/transactions/settlement/pendingWrite.js +21 -0
- package/dist/transactions/settlement/pendingWrite.js.map +1 -0
- package/dist/transport/commitFrames.d.ts +91 -0
- package/dist/transport/commitFrames.d.ts.map +1 -0
- package/dist/transport/commitFrames.js +135 -0
- package/dist/transport/commitFrames.js.map +1 -0
- package/dist/transport/connectionManager.d.ts +216 -0
- package/dist/transport/connectionManager.d.ts.map +1 -0
- package/dist/transport/connectionManager.js +674 -0
- package/dist/transport/connectionManager.js.map +1 -0
- package/dist/transport/credentialLifecycle.d.ts +178 -0
- package/dist/transport/credentialLifecycle.d.ts.map +1 -0
- package/dist/transport/credentialLifecycle.js +324 -0
- package/dist/transport/credentialLifecycle.js.map +1 -0
- package/dist/transport/heartbeat.d.ts +66 -0
- package/dist/transport/heartbeat.d.ts.map +1 -0
- package/dist/transport/heartbeat.js +94 -0
- package/dist/transport/heartbeat.js.map +1 -0
- package/dist/transport/httpClient.d.ts +143 -0
- package/dist/transport/httpClient.d.ts.map +1 -0
- package/dist/transport/httpClient.js +150 -0
- package/dist/transport/httpClient.js.map +1 -0
- package/dist/transport/httpFeed.d.ts +4 -0
- package/dist/transport/httpFeed.d.ts.map +1 -0
- package/dist/transport/httpFeed.js +94 -0
- package/dist/transport/httpFeed.js.map +1 -0
- package/dist/transport/httpOptions.d.ts +34 -0
- package/dist/transport/httpOptions.d.ts.map +1 -0
- package/dist/transport/httpOptions.js +13 -0
- package/dist/transport/httpOptions.js.map +1 -0
- package/dist/transport/httpTransport.d.ts +68 -0
- package/dist/transport/httpTransport.d.ts.map +1 -0
- package/dist/transport/httpTransport.js +1433 -0
- package/dist/transport/httpTransport.js.map +1 -0
- package/dist/transport/networkProbe.d.ts +85 -0
- package/dist/transport/networkProbe.d.ts.map +1 -0
- package/dist/transport/networkProbe.js +208 -0
- package/dist/transport/networkProbe.js.map +1 -0
- package/dist/transport/wsFrameHandlers.d.ts +129 -0
- package/dist/transport/wsFrameHandlers.d.ts.map +1 -0
- package/dist/transport/wsFrameHandlers.js +429 -0
- package/dist/transport/wsFrameHandlers.js.map +1 -0
- package/dist/transport/wsTransport.d.ts +575 -0
- package/dist/transport/wsTransport.d.ts.map +1 -0
- package/dist/transport/wsTransport.js +1024 -0
- package/dist/transport/wsTransport.js.map +1 -0
- package/dist/types/assertExact.d.ts +18 -0
- package/dist/types/assertExact.d.ts.map +1 -0
- package/dist/types/assertExact.js +2 -0
- package/dist/types/assertExact.js.map +1 -0
- package/dist/types/global.d.ts +108 -0
- package/dist/types/global.d.ts.map +1 -0
- package/dist/types/global.js +41 -0
- package/dist/types/global.js.map +1 -0
- package/dist/types/index.d.ts +206 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +57 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/modelData.d.ts +11 -0
- package/dist/types/modelData.d.ts.map +1 -0
- package/dist/types/modelData.js +10 -0
- package/dist/types/modelData.js.map +1 -0
- package/dist/types/participant.d.ts +21 -0
- package/dist/types/participant.d.ts.map +1 -0
- package/dist/types/participant.js +11 -0
- package/dist/types/participant.js.map +1 -0
- package/dist/types/streams.d.ts +545 -0
- package/dist/types/streams.d.ts.map +1 -0
- package/dist/types/streams.js +12 -0
- package/dist/types/streams.js.map +1 -0
- package/dist/utils/asyncIterator.d.ts +35 -0
- package/dist/utils/asyncIterator.d.ts.map +1 -0
- package/dist/utils/asyncIterator.js +136 -0
- package/dist/utils/asyncIterator.js.map +1 -0
- package/dist/utils/duration.d.ts +51 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +78 -0
- package/dist/utils/duration.js.map +1 -0
- package/dist/utils/json.d.ts +58 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +277 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/webhooks/events.d.ts +44 -0
- package/dist/webhooks/events.d.ts.map +1 -0
- package/dist/webhooks/events.js +43 -0
- package/dist/webhooks/events.js.map +1 -0
- package/dist/webhooks/index.d.ts +9 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +9 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/wire/accountResponses.d.ts +463 -0
- package/dist/wire/accountResponses.d.ts.map +1 -0
- package/dist/wire/accountResponses.js +294 -0
- package/dist/wire/accountResponses.js.map +1 -0
- package/dist/wire/auth.d.ts +57 -0
- package/dist/wire/auth.d.ts.map +1 -0
- package/dist/wire/auth.js +71 -0
- package/dist/wire/auth.js.map +1 -0
- package/dist/wire/bootstrapReason.d.ts +10 -0
- package/dist/wire/bootstrapReason.d.ts.map +1 -0
- package/dist/wire/bootstrapReason.js +9 -0
- package/dist/wire/bootstrapReason.js.map +1 -0
- package/dist/wire/claimEvent.d.ts +70 -0
- package/dist/wire/claimEvent.d.ts.map +1 -0
- package/dist/wire/claimEvent.js +74 -0
- package/dist/wire/claimEvent.js.map +1 -0
- package/dist/wire/claims.d.ts +475 -0
- package/dist/wire/claims.d.ts.map +1 -0
- package/dist/wire/claims.js +326 -0
- package/dist/wire/claims.js.map +1 -0
- package/dist/wire/commit.d.ts +604 -0
- package/dist/wire/commit.d.ts.map +1 -0
- package/dist/wire/commit.js +322 -0
- package/dist/wire/commit.js.map +1 -0
- package/dist/wire/delta.d.ts +251 -0
- package/dist/wire/delta.d.ts.map +1 -0
- package/dist/wire/delta.js +148 -0
- package/dist/wire/delta.js.map +1 -0
- package/dist/wire/errorEnvelope.d.ts +73 -0
- package/dist/wire/errorEnvelope.d.ts.map +1 -0
- package/dist/wire/errorEnvelope.js +124 -0
- package/dist/wire/errorEnvelope.js.map +1 -0
- package/dist/wire/feedCursor.d.ts +61 -0
- package/dist/wire/feedCursor.d.ts.map +1 -0
- package/dist/wire/feedCursor.js +83 -0
- package/dist/wire/feedCursor.js.map +1 -0
- package/dist/wire/feedEvent.d.ts +264 -0
- package/dist/wire/feedEvent.d.ts.map +1 -0
- package/dist/wire/feedEvent.js +66 -0
- package/dist/wire/feedEvent.js.map +1 -0
- package/dist/wire/frames.d.ts +195 -0
- package/dist/wire/frames.d.ts.map +1 -0
- package/dist/wire/frames.js +51 -0
- package/dist/wire/frames.js.map +1 -0
- package/dist/wire/inboundFrames.d.ts +490 -0
- package/dist/wire/inboundFrames.d.ts.map +1 -0
- package/dist/wire/inboundFrames.js +117 -0
- package/dist/wire/inboundFrames.js.map +1 -0
- package/dist/wire/index.d.ts +55 -0
- package/dist/wire/index.d.ts.map +1 -0
- package/dist/wire/index.js +84 -0
- package/dist/wire/index.js.map +1 -0
- package/dist/wire/listEnvelope.d.ts +38 -0
- package/dist/wire/listEnvelope.d.ts.map +1 -0
- package/dist/wire/listEnvelope.js +43 -0
- package/dist/wire/listEnvelope.js.map +1 -0
- package/dist/wire/modelMutations.d.ts +32 -0
- package/dist/wire/modelMutations.d.ts.map +1 -0
- package/dist/wire/modelMutations.js +53 -0
- package/dist/wire/modelMutations.js.map +1 -0
- package/dist/wire/modelResponses.d.ts +79 -0
- package/dist/wire/modelResponses.d.ts.map +1 -0
- package/dist/wire/modelResponses.js +44 -0
- package/dist/wire/modelResponses.js.map +1 -0
- package/dist/wire/modelShape.d.ts +79 -0
- package/dist/wire/modelShape.d.ts.map +1 -0
- package/dist/wire/modelShape.js +75 -0
- package/dist/wire/modelShape.js.map +1 -0
- package/dist/wire/protocol.d.ts +39 -0
- package/dist/wire/protocol.d.ts.map +1 -0
- package/dist/wire/protocol.js +39 -0
- package/dist/wire/protocol.js.map +1 -0
- package/dist/wire/protocolVersion.d.ts +74 -0
- package/dist/wire/protocolVersion.d.ts.map +1 -0
- package/dist/wire/protocolVersion.js +84 -0
- package/dist/wire/protocolVersion.js.map +1 -0
- package/package.json +187 -0
- package/src/ablo.ts +139 -0
- package/src/ai-sdk/coordinatedTool.ts +214 -0
- package/src/ai-sdk/index.ts +7 -0
- package/src/auth/apiKey.ts +540 -0
- package/src/auth/bootstrapScope.ts +15 -0
- package/src/auth/browserCredentialSafety.ts +48 -0
- package/src/auth/capability.ts +326 -0
- package/src/auth/capabilityLifecycle.ts +174 -0
- package/src/auth/credentialEndpoint.ts +79 -0
- package/src/auth/credentialEndpointProtocol.ts +51 -0
- package/src/auth/credentialKind.ts +20 -0
- package/src/auth/credentialPolicy.ts +244 -0
- package/src/auth/credentialResult.ts +23 -0
- package/src/auth/credentialSource.ts +99 -0
- package/src/auth/hostedEndpoints.ts +24 -0
- package/src/auth/identity.ts +330 -0
- package/src/auth/index.ts +592 -0
- package/src/auth/schemas.ts +94 -0
- package/src/auth/sessionMint.ts +126 -0
- package/src/auth/token.ts +4 -0
- package/src/batching/index.ts +200 -0
- package/src/coordination/awaitClaimGrant.ts +243 -0
- package/src/coordination/claimHeartbeatLoop.ts +165 -0
- package/src/coordination/claimMeta.ts +56 -0
- package/src/coordination/events.ts +86 -0
- package/src/coordination/index.ts +181 -0
- package/src/coordination/locator.ts +200 -0
- package/src/coordination/schema.ts +1346 -0
- package/src/coordination/targetConflict.ts +85 -0
- package/src/coordination/trace.ts +173 -0
- package/src/docs/catalog.ts +274 -0
- package/src/docs/index.ts +18 -0
- package/src/durableWrites.ts +134 -0
- package/src/environment.ts +132 -0
- package/src/errorCodes.ts +1591 -0
- package/src/errors.ts +918 -0
- package/src/footprint.ts +0 -0
- package/src/headlessClient.ts +161 -0
- package/src/index.ts +52 -0
- package/src/keys/index.ts +254 -0
- package/src/log/syncDeltaRow.ts +119 -0
- package/src/logger.ts +22 -0
- package/src/observability.ts +85 -0
- package/src/policy/types.ts +292 -0
- package/src/resources/functionalUpdate.ts +151 -0
- package/src/resources/httpResources.ts +520 -0
- package/src/resources/modelOperations.ts +444 -0
- package/src/resources/mutationOptions.ts +66 -0
- package/src/resources/where.ts +160 -0
- package/src/resources/writeOptionsSchema.ts +91 -0
- package/src/schema/coordination.ts +161 -0
- package/src/schema/ddl.ts +593 -0
- package/src/schema/ddlLock.ts +53 -0
- package/src/schema/diff.ts +489 -0
- package/src/schema/field.ts +321 -0
- package/src/schema/fieldRef.ts +88 -0
- package/src/schema/generate.ts +95 -0
- package/src/schema/index.ts +278 -0
- package/src/schema/loadStrategy.ts +52 -0
- package/src/schema/model.ts +476 -0
- package/src/schema/openapi.ts +658 -0
- package/src/schema/queries.ts +273 -0
- package/src/schema/relation.ts +291 -0
- package/src/schema/residency.ts +30 -0
- package/src/schema/roles.ts +325 -0
- package/src/schema/schema.ts +825 -0
- package/src/schema/select.ts +115 -0
- package/src/schema/serialize.ts +373 -0
- package/src/schema/sugar.ts +194 -0
- package/src/schema/tenancy.ts +221 -0
- package/src/server/adapter.ts +203 -0
- package/src/server/commit.ts +109 -0
- package/src/server/index.ts +26 -0
- package/src/server/readConfig.ts +82 -0
- package/src/server/storageMode.ts +20 -0
- package/src/source/adapter.ts +85 -0
- package/src/source/adapters/drizzle.ts +291 -0
- package/src/source/adapters/kysely.ts +346 -0
- package/src/source/adapters/kyselyMutationCore.ts +220 -0
- package/src/source/adapters/memory.ts +154 -0
- package/src/source/adapters/prisma.ts +282 -0
- package/src/source/conformance.ts +287 -0
- package/src/source/connector.ts +394 -0
- package/src/source/connectorProtocol.ts +189 -0
- package/src/source/contract.ts +221 -0
- package/src/source/drizzle.ts +1 -0
- package/src/source/factory.ts +444 -0
- package/src/source/idempotency.ts +189 -0
- package/src/source/index.ts +182 -0
- package/src/source/kysely.ts +2 -0
- package/src/source/migrations.ts +109 -0
- package/src/source/next.ts +38 -0
- package/src/source/pushQueue.ts +368 -0
- package/src/source/signing.ts +279 -0
- package/src/source/types.ts +502 -0
- package/src/syncLog/contract.ts +32 -0
- package/src/syncLog/index.ts +1 -0
- package/src/testing/fixtures/httpResponses.ts +155 -0
- package/src/transactionLayer.ts +122 -0
- package/src/transactions/settlement/commitEnvelope.ts +192 -0
- package/src/transactions/settlement/httpCommitEnvelope.ts +250 -0
- package/src/transactions/settlement/idempotencyKey.ts +11 -0
- package/src/transactions/settlement/pendingWrite.ts +24 -0
- package/src/transport/commitFrames.ts +225 -0
- package/src/transport/connectionManager.ts +856 -0
- package/src/transport/credentialLifecycle.ts +389 -0
- package/src/transport/heartbeat.ts +118 -0
- package/src/transport/httpClient.ts +354 -0
- package/src/transport/httpFeed.ts +111 -0
- package/src/transport/httpOptions.ts +41 -0
- package/src/transport/httpTransport.ts +1976 -0
- package/src/transport/networkProbe.ts +249 -0
- package/src/transport/wsFrameHandlers.ts +619 -0
- package/src/transport/wsTransport.ts +1491 -0
- package/src/types/assertExact.ts +17 -0
- package/src/types/global.ts +123 -0
- package/src/types/index.ts +270 -0
- package/src/types/modelData.ts +11 -0
- package/src/types/participant.ts +22 -0
- package/src/types/streams.ts +702 -0
- package/src/utils/asyncIterator.ts +141 -0
- package/src/utils/duration.ts +88 -0
- package/src/utils/json.ts +281 -0
- package/src/webhooks/events.ts +96 -0
- package/src/webhooks/index.ts +12 -0
- package/src/wire/accountResponses.ts +328 -0
- package/src/wire/auth.ts +86 -0
- package/src/wire/bootstrapReason.ts +10 -0
- package/src/wire/claimEvent.ts +85 -0
- package/src/wire/claims.ts +370 -0
- package/src/wire/commit.ts +379 -0
- package/src/wire/delta.ts +173 -0
- package/src/wire/errorEnvelope.ts +133 -0
- package/src/wire/feedCursor.ts +91 -0
- package/src/wire/feedEvent.ts +74 -0
- package/src/wire/frames.ts +77 -0
- package/src/wire/inboundFrames.ts +182 -0
- package/src/wire/index.ts +328 -0
- package/src/wire/listEnvelope.ts +51 -0
- package/src/wire/modelMutations.ts +55 -0
- package/src/wire/modelResponses.ts +48 -0
- package/src/wire/modelShape.ts +83 -0
- package/src/wire/protocol.ts +39 -0
- package/src/wire/protocolVersion.ts +97 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application-level heartbeat for the sync WebSocket.
|
|
3
|
+
*
|
|
4
|
+
* The browser WebSocket API hides RFC 6455 protocol-level ping and pong frames
|
|
5
|
+
* from JavaScript, so the server's keepalive cannot be observed by client
|
|
6
|
+
* code. That leaves the client unable to tell a healthy idle connection apart
|
|
7
|
+
* from a "zombie" socket whose underlying TCP connection has silently broken
|
|
8
|
+
* (laptop sleep, NAT timeout, mobile handoff). To close the gap, the client
|
|
9
|
+
* sends an application-level `{ type: 'ping' }` every 30 seconds and
|
|
10
|
+
* force-closes the socket if no inbound traffic arrives within 10 seconds. Any
|
|
11
|
+
* inbound message counts as proof the connection is alive; the explicit `pong`
|
|
12
|
+
* merely guarantees that something arrives even on an otherwise idle stream.
|
|
13
|
+
*/
|
|
14
|
+
import { PING_INTERVAL_MS } from '../wire/protocol.js';
|
|
15
|
+
import { noopSocketObservability, } from '../observability.js';
|
|
16
|
+
/**
|
|
17
|
+
* The interval between application-level pings, shared with both sides of the
|
|
18
|
+
* connection: the client pings at the same {@link PING_INTERVAL_MS} the server
|
|
19
|
+
* uses for its own keepalive, and the claim lease window is derived from the
|
|
20
|
+
* same constant.
|
|
21
|
+
*/
|
|
22
|
+
export const HEARTBEAT_INTERVAL_MS = PING_INTERVAL_MS;
|
|
23
|
+
export const HEARTBEAT_TIMEOUT_MS = 10_000;
|
|
24
|
+
/**
|
|
25
|
+
* Runs the application-level heartbeat for one socket. While the socket is
|
|
26
|
+
* open, it sends a `{ type: 'ping' }` frame every {@link HEARTBEAT_INTERVAL_MS}
|
|
27
|
+
* and arms a {@link HEARTBEAT_TIMEOUT_MS} watchdog. Any inbound frame clears
|
|
28
|
+
* the watchdog — the owner calls {@link HeartbeatController.clearHeartbeatTimeout}
|
|
29
|
+
* from its message handler. If the watchdog fires first, the connection is
|
|
30
|
+
* treated as a zombie and force-closed, which lets the owner's reconnect path
|
|
31
|
+
* run.
|
|
32
|
+
*
|
|
33
|
+
* The heartbeat exists because the client cannot see the protocol-level
|
|
34
|
+
* keepalive: browsers answer the server's pings automatically but never expose
|
|
35
|
+
* those frames to JavaScript. On a half-open connection (laptop wake, NAT
|
|
36
|
+
* timeout, mobile handoff) the socket can report itself open for minutes
|
|
37
|
+
* before the operating system surfaces the break, so observable application
|
|
38
|
+
* traffic is the only reliable signal.
|
|
39
|
+
*/
|
|
40
|
+
export class HeartbeatController {
|
|
41
|
+
transport;
|
|
42
|
+
observability;
|
|
43
|
+
heartbeatTimer = null;
|
|
44
|
+
heartbeatTimeoutTimer = null;
|
|
45
|
+
constructor(transport, observability = noopSocketObservability) {
|
|
46
|
+
this.transport = transport;
|
|
47
|
+
this.observability = observability;
|
|
48
|
+
}
|
|
49
|
+
start() {
|
|
50
|
+
this.stop();
|
|
51
|
+
this.heartbeatTimer = setInterval(() => {
|
|
52
|
+
if (!this.transport.isSocketOpen())
|
|
53
|
+
return;
|
|
54
|
+
// Send the ping. If it throws, the socket is already dead, so
|
|
55
|
+
// force-close it to let the close event drive the reconnect cycle.
|
|
56
|
+
try {
|
|
57
|
+
this.transport.sendPing();
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
this.observability.captureWebSocketError({
|
|
61
|
+
context: 'heartbeat-send-failed',
|
|
62
|
+
error: err instanceof Error ? err.message : String(err),
|
|
63
|
+
});
|
|
64
|
+
this.transport.forceClose('heartbeat-send-failed');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// Arm the timeout. Any inbound message clears it; an explicit `pong` is
|
|
68
|
+
// not required, since a delta or any other frame is equally good proof
|
|
69
|
+
// that the connection is alive.
|
|
70
|
+
if (this.heartbeatTimeoutTimer)
|
|
71
|
+
clearTimeout(this.heartbeatTimeoutTimer);
|
|
72
|
+
this.heartbeatTimeoutTimer = setTimeout(() => {
|
|
73
|
+
this.observability.captureWebSocketError({
|
|
74
|
+
context: 'heartbeat-timeout',
|
|
75
|
+
});
|
|
76
|
+
this.transport.forceClose('heartbeat-timeout');
|
|
77
|
+
}, HEARTBEAT_TIMEOUT_MS);
|
|
78
|
+
}, HEARTBEAT_INTERVAL_MS);
|
|
79
|
+
}
|
|
80
|
+
stop() {
|
|
81
|
+
if (this.heartbeatTimer) {
|
|
82
|
+
clearInterval(this.heartbeatTimer);
|
|
83
|
+
this.heartbeatTimer = null;
|
|
84
|
+
}
|
|
85
|
+
this.clearHeartbeatTimeout();
|
|
86
|
+
}
|
|
87
|
+
clearHeartbeatTimeout() {
|
|
88
|
+
if (this.heartbeatTimeoutTimer) {
|
|
89
|
+
clearTimeout(this.heartbeatTimeoutTimer);
|
|
90
|
+
this.heartbeatTimeoutTimer = null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=heartbeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../../src/transport/heartbeat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,uBAAuB,GAExB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAoB3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,mBAAmB;IAKX;IACA;IALX,cAAc,GAA0C,IA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,CAAC,cAAc,EAAE,CAAC;YACxB,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACnC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC;IAED,qBAAqB;QACnB,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC/B,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YACzC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QACpC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { HttpClientConfig } from './httpOptions.js';
|
|
2
|
+
import type { CommitResource, HttpClaimApi, HttpClaimsResource, HttpLogsResource, ModelReadOptions, SessionResource } from '../resources/httpResources.js';
|
|
3
|
+
import type { ModelCreateParams, ModelDeleteParams, ServerReadOptions, ModelRetrieveParams, ModelTrackParams, ModelTrackResult, ModelUpdateParams } from '../resources/modelOperations.js';
|
|
4
|
+
import type { Schema, SchemaRecord, InferModel, InferCreate } from '../schema/schema.js';
|
|
5
|
+
import type { ModelUpdater, ContentionOptions } from '../resources/functionalUpdate.js';
|
|
6
|
+
export interface AbloHttpClientOptions<S extends SchemaRecord> extends HttpClientConfig<S> {
|
|
7
|
+
/**
|
|
8
|
+
* Per-request deadline. A black-holed HTTP request otherwise has no platform
|
|
9
|
+
* timeout and can stall a headless worker forever. Pass `0` to disable it.
|
|
10
|
+
* @default 30_000
|
|
11
|
+
*/
|
|
12
|
+
readonly timeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The per-model surface of the stateless HTTP client — everything reachable over
|
|
16
|
+
* request/response: reads (`get` and `list`), writes (`create`, `update`,
|
|
17
|
+
* and `delete`), the durable-lease {@link HttpClaimApi | claim} plane for
|
|
18
|
+
* coordinated writes, and `track`, which registers a durable premise on a row.
|
|
19
|
+
* It deliberately omits the stateful client's local-only
|
|
20
|
+
* reads (the `local` namespace) and live subscriptions (`onChange`), which need
|
|
21
|
+
* a resident graph and a persistent socket; those are absent from the type, so
|
|
22
|
+
* reaching for one is a compile error rather than a runtime gap.
|
|
23
|
+
*
|
|
24
|
+
* This is also the base the reactive per-model surface is composed from, rather
|
|
25
|
+
* than a parallel list it happens to agree with — a verb added here arrives
|
|
26
|
+
* there without a second edit.
|
|
27
|
+
*
|
|
28
|
+
* The typed model contract is transport-independent: `get` returns one row,
|
|
29
|
+
* `list` returns rows, `create`/`update` return the resulting row, and `delete`
|
|
30
|
+
* returns nothing. The low-level protocol client keeps its read watermark and
|
|
31
|
+
* commit receipt envelopes internally; callers should not have to change data
|
|
32
|
+
* access syntax when they switch transport.
|
|
33
|
+
*/
|
|
34
|
+
export interface HttpModelClient<T, C = T> {
|
|
35
|
+
/**
|
|
36
|
+
* Reads one row by id. Resolves to `undefined` when no such row exists — a
|
|
37
|
+
* miss is data-absence, not an error.
|
|
38
|
+
*
|
|
39
|
+
* This is the default "get me this row", and the one a stateless client
|
|
40
|
+
* wants, since it holds nothing locally. A client with a resident graph
|
|
41
|
+
* answers from it first and falls back to the network, which is why the
|
|
42
|
+
* synchronous `local.get` exists alongside this: same read, restricted
|
|
43
|
+
* to what is already here.
|
|
44
|
+
*/
|
|
45
|
+
/** Canonical authoritative point lookup. A miss resolves to `undefined`. */
|
|
46
|
+
get(params: ModelRetrieveParams & ModelReadOptions): Promise<T | undefined>;
|
|
47
|
+
/** @deprecated Use `get({ id })` for an authoritative point lookup. */
|
|
48
|
+
retrieve(params: ModelRetrieveParams & ModelReadOptions): Promise<T | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Reads the rows matching a filter. Same resolution as `get`, in bulk,
|
|
51
|
+
* and deduplicated so concurrent identical calls share one request.
|
|
52
|
+
*/
|
|
53
|
+
list(options?: ServerReadOptions<T>): Promise<T[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a row and returns it, including any framework-applied defaults.
|
|
56
|
+
* Passing an id that already exists is idempotent: the existing row is
|
|
57
|
+
* returned unchanged.
|
|
58
|
+
*
|
|
59
|
+
* When the client keeps a local graph the write is optimistic — it resolves
|
|
60
|
+
* once the mutation is queued locally, and a server rejection rolls it back
|
|
61
|
+
* (watch `sync.syncStatus`). A stateless client has no local graph to roll
|
|
62
|
+
* back, so it resolves on the server's confirmation instead. The same is true
|
|
63
|
+
* of `update` and `delete`.
|
|
64
|
+
*/
|
|
65
|
+
create(params: ModelCreateParams<T, C>): Promise<T>;
|
|
66
|
+
update(params: ModelUpdateParams<T, C>): Promise<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Updates a row with a function of its latest value — `update(id, current =>
|
|
69
|
+
* next)`, the data-layer equivalent of a `setState(prev => next)` reducer. The
|
|
70
|
+
* client reads the freshest row, runs your updater, and writes the result as a
|
|
71
|
+
* compare-and-swap against the row's watermark; if another write landed first it
|
|
72
|
+
* re-reads and re-runs. No claim or conflict handling is needed: the write either
|
|
73
|
+
* lands or throws `AbloContentionError` once its retry budget is spent. Return
|
|
74
|
+
* `null` or `undefined` from the updater to skip the write.
|
|
75
|
+
*/
|
|
76
|
+
update(id: string, updater: ModelUpdater<T>, options?: ContentionOptions): Promise<T | undefined>;
|
|
77
|
+
delete(params: ModelDeleteParams<T, C>): Promise<void>;
|
|
78
|
+
claim: HttpClaimApi<T, C>;
|
|
79
|
+
/**
|
|
80
|
+
* Registers a durable premise on a row — "keep telling me about this one".
|
|
81
|
+
* Any change that lands on the tracked row rides back on the `notifications`
|
|
82
|
+
* of this client's next commit, so a long-running agent learns its context
|
|
83
|
+
* went stale without re-reading. A track it already holds is refreshed, not
|
|
84
|
+
* duplicated.
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* await ablo.tasks.track({ id: 'task_42' });
|
|
88
|
+
* // …minutes of other work later, on the next write…
|
|
89
|
+
* const res = await ablo.commits.create({ operations: [ … ] });
|
|
90
|
+
* res.notifications; // populated if task_42 moved in the meantime
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* The returned `notifications` are only the tracks that had ALREADY fired at
|
|
94
|
+
* registration time; the ongoing signal arrives on later receipts.
|
|
95
|
+
*/
|
|
96
|
+
track(params: ModelTrackParams): Promise<ModelTrackResult>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The type of the stateless HTTP client: a typed {@link HttpModelClient} per
|
|
100
|
+
* schema model, plus `commits`, `dispose`, and the session-mint surface. It
|
|
101
|
+
* exposes only what request/response transport can do, so reaching for a
|
|
102
|
+
* stateful-only capability — the `local` reads, `onChange`, or the synchronous
|
|
103
|
+
* `claim.state`/`queue`/`reorder` reads — is a compile error rather than a value
|
|
104
|
+
* that is `undefined` at runtime.
|
|
105
|
+
*/
|
|
106
|
+
export type AbloHttpClient<S extends SchemaRecord> = {
|
|
107
|
+
readonly [K in keyof S & string]: HttpModelClient<InferModel<Schema<S>, K>, InferCreate<Schema<S>, K>>;
|
|
108
|
+
} & {
|
|
109
|
+
/** Runs one-time setup (durable-outbox scope resolution and replay) before the client is used. It also runs lazily ahead of the first request, so calling it yourself is optional. */
|
|
110
|
+
ready(): Promise<void>;
|
|
111
|
+
/** Replays every pending durable HTTP write in seal order and waits for settlement. */
|
|
112
|
+
waitForFlush(): Promise<void>;
|
|
113
|
+
readonly commits: CommitResource;
|
|
114
|
+
/**
|
|
115
|
+
* Claim-ticket operations keyed by `claimId`: `retrieve` polls a queued
|
|
116
|
+
* ticket to its grant, `heartbeat` keeps one lease (held or queued) alive,
|
|
117
|
+
* `heartbeatAll` beats every lease this identity holds in one round trip.
|
|
118
|
+
* The id comes from `AbloClaimedError('claim_queued')`, which carries it on
|
|
119
|
+
* `error.claims`.
|
|
120
|
+
*/
|
|
121
|
+
readonly claims: HttpClaimsResource;
|
|
122
|
+
/** Durable, credential-scoped authoritative event pages. */
|
|
123
|
+
readonly logs: HttpLogsResource;
|
|
124
|
+
dispose(): Promise<void>;
|
|
125
|
+
/** Resolves the bearer credential this client authenticates with, or `null` if none is set. */
|
|
126
|
+
getAuthToken(): Promise<string | null>;
|
|
127
|
+
/**
|
|
128
|
+
* Mints a short-lived, scoped session token. Minting is itself a stateless
|
|
129
|
+
* request, so it is available here even though the local-cache reads are not.
|
|
130
|
+
* Pass `{ user }` to mint an end-user key (`ek_`) or `{ agent, can }` to mint a
|
|
131
|
+
* scoped agent key (`rk_`). See {@link CreateSessionParams}.
|
|
132
|
+
*/
|
|
133
|
+
readonly sessions: SessionResource<S>;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Builds the stateless, typed HTTP client. Each `client.<model>` resolves to the
|
|
137
|
+
* protocol client's model accessor, while `commits`, `dispose`, and the other
|
|
138
|
+
* protocol members pass through unchanged. No socket is ever opened; the bearer
|
|
139
|
+
* credential is the identity.
|
|
140
|
+
*/
|
|
141
|
+
/** @internal Constructed only through the public `Ablo({ transport: 'http' })` factory. */
|
|
142
|
+
export declare function createAbloHttpClient<S extends SchemaRecord>(options: AbloHttpClientOptions<S>): AbloHttpClient<S>;
|
|
143
|
+
//# sourceMappingURL=httpClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../src/transport/httpClient.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAEhB,gBAAgB,EAIhB,eAAe,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,KAAK,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,EAAE,CAAC,CAAC,CAAC;IAC1B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC5D;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,YAAY,IAAI;IACnD,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,GAAG,eAAe,CAC/C,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAC1B;CACF,GAAG;IACF,sLAAsL;IACtL,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,uFAAuF;IACvF,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,+FAA+F;IAC/F,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvC;;;;;MAKE;IACF,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAmHF;;;;;GAKG;AACH,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,YAAY,EACzD,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAChC,cAAc,CAAC,CAAC,CAAC,CAyCnB"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a stateless, typed HTTP client for server-side actors — agents,
|
|
3
|
+
* workers, and serverless handlers. It talks to Ablo over plain request/response
|
|
4
|
+
* HTTP, uses the bearer credential as its identity, and holds no WebSocket and no
|
|
5
|
+
* connection state.
|
|
6
|
+
*
|
|
7
|
+
* This is the counterpart to the stateful {@link Ablo} client. The stateful
|
|
8
|
+
* client is for interactive participants: it opens a WebSocket, learns its
|
|
9
|
+
* identity (user id and organization id) during the connect-and-bootstrap step,
|
|
10
|
+
* and routes writes through a queue that waits for that identity. A server-side
|
|
11
|
+
* actor has no socket, so instead of reusing that machinery it uses this client,
|
|
12
|
+
* where the credential itself carries identity and the server resolves it on
|
|
13
|
+
* every request.
|
|
14
|
+
*
|
|
15
|
+
* Under the hood this wraps one schema-agnostic protocol client in a typed
|
|
16
|
+
* proxy. That protocol layer keeps transport envelopes and string-keyed model
|
|
17
|
+
* routing private; application code gets the same `client.<model>` surface the
|
|
18
|
+
* stateful client offers.
|
|
19
|
+
*/
|
|
20
|
+
import { createHttpTransport, } from './httpTransport.js';
|
|
21
|
+
import { modelWireNames } from '../auth/capability.js';
|
|
22
|
+
import { AbloConnectionError, AbloValidationError } from '../errors.js';
|
|
23
|
+
/**
|
|
24
|
+
* Private transport members that pass straight through the facade. Everything
|
|
25
|
+
* else must be a declared schema model; there is no dynamic fallback namespace.
|
|
26
|
+
*/
|
|
27
|
+
const PROTOCOL_MEMBERS = new Set([
|
|
28
|
+
'ready',
|
|
29
|
+
'waitForFlush',
|
|
30
|
+
'dispose',
|
|
31
|
+
'commits',
|
|
32
|
+
'claims',
|
|
33
|
+
'logs',
|
|
34
|
+
'getAuthToken',
|
|
35
|
+
'sessions',
|
|
36
|
+
]);
|
|
37
|
+
/** Narrows a bare property name to a transport key so the facade can index it typed. */
|
|
38
|
+
function isProtocolMember(prop) {
|
|
39
|
+
return PROTOCOL_MEMBERS.has(prop);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Adapts one low-level protocol model to the public typed model contract. The
|
|
43
|
+
* protocol deliberately retains `{ data, stamp, claims }` reads and commit
|
|
44
|
+
* receipts because functional updates need them. This is the single boundary
|
|
45
|
+
* that unwraps those transport details for application code.
|
|
46
|
+
*/
|
|
47
|
+
function createHttpModelClient(protocol) {
|
|
48
|
+
async function readRow(id) {
|
|
49
|
+
const read = await protocol.get({ id });
|
|
50
|
+
return read.data;
|
|
51
|
+
}
|
|
52
|
+
async function requireUpdatedRow(id) {
|
|
53
|
+
const row = await readRow(id);
|
|
54
|
+
if (row === undefined) {
|
|
55
|
+
throw new AbloConnectionError(`update settled but ${id} could not be read back from the server.`, { code: 'commit_no_result' });
|
|
56
|
+
}
|
|
57
|
+
return row;
|
|
58
|
+
}
|
|
59
|
+
// The protocol resource is schema-agnostic and types claim handles as records.
|
|
60
|
+
// The typed facade carries the same handle with its row type attached; runtime
|
|
61
|
+
// mutation code only reads the handle identity. Normalize that one generic
|
|
62
|
+
// boundary here instead of leaking casts into every model method.
|
|
63
|
+
function mutationOptions(params) {
|
|
64
|
+
const { claim, ...rest } = params;
|
|
65
|
+
return {
|
|
66
|
+
...rest,
|
|
67
|
+
...(claim !== undefined ? { claim } : {}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function update(arg, updater, options) {
|
|
71
|
+
if (typeof arg === 'string') {
|
|
72
|
+
if (!updater) {
|
|
73
|
+
throw new AbloValidationError('Functional update requires an updater function.', { code: 'write_options_invalid' });
|
|
74
|
+
}
|
|
75
|
+
const receipt = await protocol.update(arg, updater, options);
|
|
76
|
+
return receipt === undefined ? undefined : requireUpdatedRow(arg);
|
|
77
|
+
}
|
|
78
|
+
await protocol.update({
|
|
79
|
+
...mutationOptions(arg),
|
|
80
|
+
data: arg.data,
|
|
81
|
+
});
|
|
82
|
+
return requireUpdatedRow(arg.id);
|
|
83
|
+
}
|
|
84
|
+
const get = async (params) => {
|
|
85
|
+
const read = await protocol.get(params);
|
|
86
|
+
return read.data;
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
get,
|
|
90
|
+
retrieve: get,
|
|
91
|
+
list: (options) => protocol.list(options),
|
|
92
|
+
async create(params) {
|
|
93
|
+
const row = await protocol.create({
|
|
94
|
+
...mutationOptions(params),
|
|
95
|
+
data: params.data,
|
|
96
|
+
});
|
|
97
|
+
return row;
|
|
98
|
+
},
|
|
99
|
+
update,
|
|
100
|
+
async delete(params) {
|
|
101
|
+
await protocol.delete(mutationOptions(params));
|
|
102
|
+
},
|
|
103
|
+
claim: protocol.claim,
|
|
104
|
+
track: (params) => protocol.track(params),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Builds the stateless, typed HTTP client. Each `client.<model>` resolves to the
|
|
109
|
+
* protocol client's model accessor, while `commits`, `dispose`, and the other
|
|
110
|
+
* protocol members pass through unchanged. No socket is ever opened; the bearer
|
|
111
|
+
* credential is the identity.
|
|
112
|
+
*/
|
|
113
|
+
/** @internal Constructed only through the public `Ablo({ transport: 'http' })` factory. */
|
|
114
|
+
export function createAbloHttpClient(options) {
|
|
115
|
+
const { schema, ...rest } = options;
|
|
116
|
+
const transport = createHttpTransport({
|
|
117
|
+
...rest,
|
|
118
|
+
// Derived from the schema this client is bound to, never assembled by hand
|
|
119
|
+
// — see `auth/capability.ts`.
|
|
120
|
+
modelTypenames: modelWireNames(schema.models),
|
|
121
|
+
});
|
|
122
|
+
const schemaModels = new Set(Object.keys(schema.models));
|
|
123
|
+
const models = new Map();
|
|
124
|
+
const model = (name) => {
|
|
125
|
+
const cached = models.get(name);
|
|
126
|
+
if (cached)
|
|
127
|
+
return cached;
|
|
128
|
+
const created = createHttpModelClient(transport.model(name));
|
|
129
|
+
models.set(name, created);
|
|
130
|
+
return created;
|
|
131
|
+
};
|
|
132
|
+
const facade = new Proxy({}, {
|
|
133
|
+
get(_target, prop) {
|
|
134
|
+
if (typeof prop !== 'string')
|
|
135
|
+
return undefined;
|
|
136
|
+
// Real protocol members pass through unchanged.
|
|
137
|
+
if (isProtocolMember(prop)) {
|
|
138
|
+
return transport[prop];
|
|
139
|
+
}
|
|
140
|
+
// Only schema models become model accessors. A typo or retired top-level
|
|
141
|
+
// member resolves to undefined instead of manufacturing a plausible client.
|
|
142
|
+
return schemaModels.has(prop) ? model(prop) : undefined;
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
// A single boundary cast. `AbloHttpClient<S>` declares only what the model
|
|
146
|
+
// accessor and the passed-through protocol members actually implement, so no
|
|
147
|
+
// method on this type is missing at runtime.
|
|
148
|
+
return facade;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=httpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpClient.js","sourceRoot":"","sources":["../../src/transport/httpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAyBvD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA8IxE;;;GAGG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS;IACvC,OAAO;IACP,cAAc;IACd,SAAS;IACT,SAAS;IACT,QAAQ;IACR,MAAM;IACN,cAAc;IACd,UAAU;CACX,CAAC,CAAC;AAEH,wFAAwF;AACxF,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAC5B,QAAkC;IAElC,KAAK,UAAU,OAAO,CAAC,EAAU;QAC/B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,UAAU,iBAAiB,CAAC,EAAU;QACzC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,GAAG,KAAK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,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,OAAO,GAAG,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,KAAK,CAA6B,EAAE,EAAE;QACvD,GAAG,CAAC,OAAO,EAAE,IAAI;YACf,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAC/C,gDAAgD;YAChD,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;YACD,yEAAyE;YACzE,4EAA4E;YAC5E,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,CAAC;KACF,CAAC,CAAC;IAEH,2EAA2E;IAC3E,6EAA6E;IAC7E,6CAA6C;IAC7C,OAAO,MAA2B,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HttpLogsResource } from '../resources/httpResources.js';
|
|
2
|
+
import type { ObserveOptions, ObservedDelta } from '../transactionLayer.js';
|
|
3
|
+
export declare function createHttpFeed(logs: HttpLogsResource): (input?: ObserveOptions | string | readonly string[]) => AsyncIterable<ObservedDelta>;
|
|
4
|
+
//# sourceMappingURL=httpFeed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpFeed.d.ts","sourceRoot":"","sources":["../../src/transport/httpFeed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,wBAAwB,CAAC;AAuChC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,gBAAgB,GACrB,CACD,KAAK,CAAC,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,KAChD,aAAa,CAAC,aAAa,CAAC,CA8DhC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { formatFeedCursor, parseFeedCursor } from '../wire/feedCursor.js';
|
|
2
|
+
const DEFAULT_PAGE_SIZE = 100;
|
|
3
|
+
const DEFAULT_POLL_INTERVAL_MS = 500;
|
|
4
|
+
const DEDUPE_WINDOW_SIZE = 400;
|
|
5
|
+
function normalizeOptions(input) {
|
|
6
|
+
if (typeof input === 'string')
|
|
7
|
+
return { models: input };
|
|
8
|
+
if (Array.isArray(input))
|
|
9
|
+
return { models: input };
|
|
10
|
+
return input ?? {};
|
|
11
|
+
}
|
|
12
|
+
function cancelled(signal) {
|
|
13
|
+
return signal.reason instanceof Error
|
|
14
|
+
? signal.reason
|
|
15
|
+
: new Error('Observation was cancelled.');
|
|
16
|
+
}
|
|
17
|
+
async function pause(ms, signal) {
|
|
18
|
+
if (signal?.aborted)
|
|
19
|
+
throw cancelled(signal);
|
|
20
|
+
await new Promise((resolve, reject) => {
|
|
21
|
+
const timer = setTimeout(finish, ms);
|
|
22
|
+
function finish() {
|
|
23
|
+
signal?.removeEventListener('abort', abort);
|
|
24
|
+
resolve();
|
|
25
|
+
}
|
|
26
|
+
function abort() {
|
|
27
|
+
clearTimeout(timer);
|
|
28
|
+
reject(cancelled(signal));
|
|
29
|
+
}
|
|
30
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function createHttpFeed(logs) {
|
|
34
|
+
return async function* observe(input) {
|
|
35
|
+
const options = normalizeOptions(input);
|
|
36
|
+
const cursorKey = options.cursorKey ?? 'default';
|
|
37
|
+
const storedCursor = options.cursorStore
|
|
38
|
+
? await options.cursorStore.load(cursorKey)
|
|
39
|
+
: null;
|
|
40
|
+
let after = options.after ?? storedCursor ?? undefined;
|
|
41
|
+
const models = typeof options.models === 'string'
|
|
42
|
+
? [options.models]
|
|
43
|
+
: options.models ?? [];
|
|
44
|
+
const requestedModels = new Set(models.map((model) => model.toLowerCase()));
|
|
45
|
+
const delivered = new Set();
|
|
46
|
+
while (true) {
|
|
47
|
+
if (options.signal?.aborted)
|
|
48
|
+
throw cancelled(options.signal);
|
|
49
|
+
const page = await logs.list({
|
|
50
|
+
...(after !== undefined ? { after } : {}),
|
|
51
|
+
limit: DEFAULT_PAGE_SIZE,
|
|
52
|
+
...(requestedModels.size === 1
|
|
53
|
+
? { model: requestedModels.values().next().value }
|
|
54
|
+
: {}),
|
|
55
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
56
|
+
});
|
|
57
|
+
const nextCursor = page.next_cursor ?? after;
|
|
58
|
+
const parsedCursor = nextCursor ? parseFeedCursor(nextCursor) : null;
|
|
59
|
+
for (const event of page.data) {
|
|
60
|
+
if (event.object !== 'log_event' || event.delta === undefined)
|
|
61
|
+
continue;
|
|
62
|
+
if (requestedModels.size > 0
|
|
63
|
+
&& !requestedModels.has(event.model.toLowerCase())) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const deliveryKey = `log:${event.id}`;
|
|
67
|
+
if (delivered.has(deliveryKey))
|
|
68
|
+
continue;
|
|
69
|
+
delivered.add(deliveryKey);
|
|
70
|
+
if (delivered.size > DEDUPE_WINDOW_SIZE) {
|
|
71
|
+
const oldest = delivered.values().next().value;
|
|
72
|
+
if (oldest !== undefined)
|
|
73
|
+
delivered.delete(oldest);
|
|
74
|
+
}
|
|
75
|
+
const cursor = formatFeedCursor({
|
|
76
|
+
log: event.id,
|
|
77
|
+
claims: parsedCursor?.claims ?? 0,
|
|
78
|
+
});
|
|
79
|
+
yield {
|
|
80
|
+
...event.delta,
|
|
81
|
+
cursor,
|
|
82
|
+
checkpoint: () => options.cursorStore?.save(cursorKey, cursor)
|
|
83
|
+
?? Promise.resolve(),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (nextCursor !== undefined)
|
|
87
|
+
after = nextCursor;
|
|
88
|
+
if (page.has_more)
|
|
89
|
+
continue;
|
|
90
|
+
await pause(Math.max(0, options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS), options.signal);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=httpFeed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpFeed.js","sourceRoot":"","sources":["../../src/transport/httpFeed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAO1E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,SAAS,gBAAgB,CACvB,KAA8D;IAE9D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACxD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,KAA0B,EAAE,CAAC;IACxE,OAAQ,KAAoC,IAAI,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,SAAS,CAAC,MAAmB;IACpC,OAAO,MAAM,CAAC,MAAM,YAAY,KAAK;QACnC,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB;IACnD,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7C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SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;oBAAE,SAAS;gBACzC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBAC3B,IAAI,SAAS,CAAC,IAAI,GAAG,kBAAkB,EAAE,CAAC;oBACxC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;oBAC/C,IAAI,MAAM,KAAK,SAAS;wBAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrD,CAAC;gBACD,MAAM,MAAM,GAAG,gBAAgB,CAAC;oBAC9B,GAAG,EAAE,KAAK,CAAC,EAAE;oBACb,MAAM,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;iBAClC,CAAC,CAAC;gBACH,MAAM;oBACJ,GAAG,KAAK,CAAC,KAAK;oBACd,MAAM;oBACN,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;2BACzD,OAAO,CAAC,OAAO,EAAE;iBACvB,CAAC;YACJ,CAAC;YAED,IAAI,UAAU,KAAK,SAAS;gBAAE,KAAK,GAAG,UAAU,CAAC;YACjD,IAAI,IAAI,CAAC,QAAQ;gBAAE,SAAS;YAC5B,MAAM,KAAK,CACT,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,IAAI,wBAAwB,CAAC,EAC/D,OAAO,CAAC,MAAM,CACf,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of client configuration the HTTP transport reads.
|
|
3
|
+
*
|
|
4
|
+
* The composed `Ablo({ ... })` bag is assembled by the consumer and carries far
|
|
5
|
+
* more than this — persistence, offline, reactivity. The transport needs only
|
|
6
|
+
* the fields below, so the core declares them and stays out of the composition
|
|
7
|
+
* surface (ADR 0016).
|
|
8
|
+
*
|
|
9
|
+
* TypeScript is structural, so a consumer's full options object satisfies this
|
|
10
|
+
* without declaring `extends`; the composition root keeps owning its own type.
|
|
11
|
+
*/
|
|
12
|
+
import type { Schema, SchemaRecord } from '../schema/schema.js';
|
|
13
|
+
import type { AuthClientOptions } from '../auth/apiKey.js';
|
|
14
|
+
import type { CoordinationObservability } from '../observability.js';
|
|
15
|
+
import type { CommitOutboxScope } from '../transactions/settlement/commitEnvelope.js';
|
|
16
|
+
import type { DurableWriteStore, DurableWritesConfig } from '../durableWrites.js';
|
|
17
|
+
export interface HttpClientConfig<S extends SchemaRecord = SchemaRecord> extends AuthClientOptions {
|
|
18
|
+
schema: Schema<S>;
|
|
19
|
+
/** Overrides where credential exchange and bootstrap are reached. */
|
|
20
|
+
bootstrapBaseUrl?: string;
|
|
21
|
+
fetch?: typeof fetch | undefined;
|
|
22
|
+
defaultHeaders?: Record<string, string | null | undefined> | undefined;
|
|
23
|
+
defaultQuery?: Record<string, string | undefined> | undefined;
|
|
24
|
+
observability?: CoordinationObservability;
|
|
25
|
+
/** Crash-durable writes: the outbox is sealed before a request is dispatched. */
|
|
26
|
+
durableWrites?: DurableWritesConfig;
|
|
27
|
+
/** Compatibility input for pre-`durableWrites` clients. */
|
|
28
|
+
commitOutbox?: DurableWriteStore;
|
|
29
|
+
/** Compatibility input and internal child-client identity seam. */
|
|
30
|
+
commitOutboxScope?: CommitOutboxScope;
|
|
31
|
+
/** Which transport carries this client's traffic. */
|
|
32
|
+
transport?: 'websocket' | 'http' | undefined;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=httpOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpOptions.d.ts","sourceRoot":"","sources":["../../src/transport/httpOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAGrE,SAAQ,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC9D,aAAa,CAAC,EAAE,yBAAyB,CAAC;IAC1C,iFAAiF;IACjF,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,2DAA2D;IAC3D,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,qDAAqD;IACrD,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of client configuration the HTTP transport reads.
|
|
3
|
+
*
|
|
4
|
+
* The composed `Ablo({ ... })` bag is assembled by the consumer and carries far
|
|
5
|
+
* more than this — persistence, offline, reactivity. The transport needs only
|
|
6
|
+
* the fields below, so the core declares them and stays out of the composition
|
|
7
|
+
* surface (ADR 0016).
|
|
8
|
+
*
|
|
9
|
+
* TypeScript is structural, so a consumer's full options object satisfies this
|
|
10
|
+
* without declaring `extends`; the composition root keeps owning its own type.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=httpOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpOptions.js","sourceRoot":"","sources":["../../src/transport/httpOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private HTTP protocol client behind `Ablo({ schema, transport: 'http' })`.
|
|
3
|
+
* It carries no object pool, local database, or WebSocket and maps Model,
|
|
4
|
+
* Claim, and Commit protocol shapes directly to server routes. The typed
|
|
5
|
+
* facade in `httpClient.ts` is the application boundary; this module owns
|
|
6
|
+
* transport envelopes, watermarks, replay, and route details.
|
|
7
|
+
*/
|
|
8
|
+
import type { HttpClientConfig } from './httpOptions.js';
|
|
9
|
+
import type { CommitResource, HttpClaimsResource, HttpTransportModel, HttpLogsResource, SessionResource } from '../resources/httpResources.js';
|
|
10
|
+
import type { SchemaRecord } from '../schema/schema.js';
|
|
11
|
+
import type { CoordinationObservability } from '../observability.js';
|
|
12
|
+
/** @internal Private options for the schema-agnostic HTTP protocol transport. */
|
|
13
|
+
export type HttpTransportOptions = Omit<HttpClientConfig, 'schema'> & {
|
|
14
|
+
readonly bootstrapBaseUrl?: string | undefined;
|
|
15
|
+
/** Schema-key to wire-typename mapping used only when minting agent sessions. */
|
|
16
|
+
readonly modelTypenames?: Readonly<Record<string, string>> | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The observability provider forwarded from `Ablo({ observability })`. The HTTP
|
|
19
|
+
* transport emits the same claim and conflict events as the WebSocket transport,
|
|
20
|
+
* so a `ClaimLog` works identically for headless server-agent evaluations.
|
|
21
|
+
*/
|
|
22
|
+
readonly observability?: CoordinationObservability;
|
|
23
|
+
/**
|
|
24
|
+
* Per-request deadline in milliseconds for the stateless HTTP transport.
|
|
25
|
+
* Every request this client issues is aborted after this long and surfaces
|
|
26
|
+
* as a retryable connection error — without it a black-holed server hangs
|
|
27
|
+
* a headless agent forever (browsers never time fetch out on their own).
|
|
28
|
+
* Pass `0` to disable the deadline.
|
|
29
|
+
*
|
|
30
|
+
* @default 30_000
|
|
31
|
+
*/
|
|
32
|
+
readonly timeoutMs?: number;
|
|
33
|
+
};
|
|
34
|
+
/** @internal Default per-request deadline for the private HTTP transport. */
|
|
35
|
+
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
36
|
+
/** @internal Private protocol surface wrapped by `AbloHttpClient`. */
|
|
37
|
+
export interface HttpTransport {
|
|
38
|
+
ready(): Promise<void>;
|
|
39
|
+
waitForFlush(): Promise<void>;
|
|
40
|
+
dispose(): Promise<void>;
|
|
41
|
+
purge(): Promise<void>;
|
|
42
|
+
readonly commits: CommitResource;
|
|
43
|
+
/**
|
|
44
|
+
* Claim-ticket operations keyed by `claimId` — the id a queued acquire
|
|
45
|
+
* hands back on `AbloClaimedError('claim_queued')`. See
|
|
46
|
+
* {@link HttpClaimsResource}.
|
|
47
|
+
*/
|
|
48
|
+
readonly claims: HttpClaimsResource;
|
|
49
|
+
readonly logs: HttpLogsResource;
|
|
50
|
+
model<T = Record<string, unknown>, Fields = T>(name: string): HttpTransportModel<T, Fields>;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the active bearer credential this client authenticates with — the
|
|
53
|
+
* same token its own requests carry in `Authorization`. Returns `null` when
|
|
54
|
+
* no credential is configured. Async because the API key may be supplied as
|
|
55
|
+
* an async setter. Use it to authenticate a side-band request to the same
|
|
56
|
+
* server with the credential this client already holds — no re-mint.
|
|
57
|
+
*/
|
|
58
|
+
getAuthToken(): Promise<string | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Mint a short-lived scoped session. Minting is a control-plane HTTP call (no
|
|
61
|
+
* socket), so it lives on this stateless client too, not only the realtime one.
|
|
62
|
+
* `{ user }` mints an `ek_`; `{ agent, can }` mints an `rk_`.
|
|
63
|
+
*/
|
|
64
|
+
readonly sessions: SessionResource<SchemaRecord>;
|
|
65
|
+
}
|
|
66
|
+
/** @internal Constructed only by the typed HTTP facade. */
|
|
67
|
+
export declare function createHttpTransport(options: HttpTransportOptions): HttpTransport;
|
|
68
|
+
//# sourceMappingURL=httpTransport.d.ts.map
|