@sixb/core 0.1.9 → 0.1.10
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/dist/actions/index.js +8 -8
- package/dist/agents/index.js +16 -15
- package/dist/agents/index.js.map +1 -1
- package/dist/bootstrap/index.js +20 -19
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/in-memory.d.ts +8 -2
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.d.ts +4 -2
- package/dist/broker/index.d.ts.map +1 -1
- package/dist/broker/index.js +7 -3
- package/dist/broker/index.js.map +1 -1
- package/dist/broker/retention.d.ts +4 -0
- package/dist/broker/retention.d.ts.map +1 -0
- package/dist/broker/subscriber.d.ts +10 -0
- package/dist/broker/subscriber.d.ts.map +1 -0
- package/dist/broker/types.d.ts +14 -1
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/{chunk-k3cqkkn2.js → chunk-1824gssz.js} +30 -65
- package/dist/chunk-1824gssz.js.map +12 -0
- package/dist/{chunk-h1gfhhbh.js → chunk-28ja2cjs.js} +1 -1
- package/dist/chunk-2c4j899j.js.map +1 -1
- package/dist/{chunk-ppytyr6w.js → chunk-358caqf5.js} +4 -4
- package/dist/chunk-358caqf5.js.map +12 -0
- package/dist/{chunk-kxwa347f.js → chunk-3qms4nax.js} +2 -2
- package/dist/{chunk-kxwa347f.js.map → chunk-3qms4nax.js.map} +3 -3
- package/dist/{chunk-emyyk7dx.js → chunk-5c7ga8zz.js} +22 -145
- package/dist/chunk-5c7ga8zz.js.map +12 -0
- package/dist/{chunk-hpr1r6av.js → chunk-5p1v802y.js} +46 -39
- package/dist/{chunk-hpr1r6av.js.map → chunk-5p1v802y.js.map} +4 -4
- package/dist/{chunk-zcnq6105.js → chunk-85cd7e8c.js} +2 -1
- package/dist/chunk-85cd7e8c.js.map +10 -0
- package/dist/{chunk-1enhpacz.js → chunk-976rxdpx.js} +5 -5
- package/dist/{chunk-3f7veca0.js → chunk-9x8dybsb.js} +3 -3
- package/dist/chunk-9x8dybsb.js.map +10 -0
- package/dist/{chunk-r29fxdhn.js → chunk-aa6z4a19.js} +160 -44
- package/dist/chunk-aa6z4a19.js.map +12 -0
- package/dist/{chunk-r4tfx1sf.js → chunk-agbbygvh.js} +4 -4
- package/dist/{chunk-jjy0fhrn.js → chunk-b0ec55a1.js} +20 -3
- package/dist/chunk-b0ec55a1.js.map +12 -0
- package/dist/{chunk-xfbydgzy.js → chunk-bn138h9w.js} +7 -8
- package/dist/{chunk-xfbydgzy.js.map → chunk-bn138h9w.js.map} +3 -3
- package/dist/{chunk-an5tt9y0.js → chunk-ftv470j8.js} +42 -4
- package/dist/{chunk-an5tt9y0.js.map → chunk-ftv470j8.js.map} +7 -7
- package/dist/{chunk-0w35wavj.js → chunk-g7knyczr.js} +1 -1
- package/dist/{chunk-x57ycxq0.js → chunk-gqh45d2n.js} +42 -3
- package/dist/{chunk-x57ycxq0.js.map → chunk-gqh45d2n.js.map} +3 -3
- package/dist/{chunk-0rdrecsb.js → chunk-kfee1h52.js} +116 -32
- package/dist/chunk-kfee1h52.js.map +13 -0
- package/dist/{chunk-ypbtykv6.js → chunk-nmbxcaqx.js} +1 -1
- package/dist/{chunk-3tgwrcyh.js → chunk-nt99sxd6.js} +2 -2
- package/dist/{chunk-3tgwrcyh.js.map → chunk-nt99sxd6.js.map} +3 -3
- package/dist/{chunk-vf691g1r.js → chunk-p5vcsw9c.js} +2 -2
- package/dist/{chunk-mjbk2djy.js → chunk-p6a4npdx.js} +211 -106
- package/dist/{chunk-mjbk2djy.js.map → chunk-p6a4npdx.js.map} +9 -8
- package/dist/{chunk-3frsnm7x.js → chunk-qma80ych.js} +4 -6
- package/dist/chunk-qma80ych.js.map +11 -0
- package/dist/{chunk-qhcpj9wc.js → chunk-qyeptdyv.js} +96 -2
- package/dist/chunk-qyeptdyv.js.map +15 -0
- package/dist/{chunk-52hbv0ak.js → chunk-r7fj830t.js} +101 -48
- package/dist/chunk-r7fj830t.js.map +36 -0
- package/dist/{chunk-xyr8kppc.js → chunk-rtk71jzp.js} +1 -1
- package/dist/{chunk-m3z3x9v0.js → chunk-t1f4f1ve.js} +1 -1
- package/dist/chunk-v2vcg0w6.js +151 -0
- package/dist/chunk-v2vcg0w6.js.map +11 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/contracts.d.ts +3 -0
- package/dist/connectors/connections/contracts.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +1 -1
- package/dist/connectors/connections/request.d.ts +3 -1
- package/dist/connectors/connections/request.d.ts.map +1 -1
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/tokens.d.ts.map +1 -1
- package/dist/connectors/connections/validation.d.ts +5 -1
- package/dist/connectors/connections/validation.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +19 -4
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/events/execution.d.ts +1 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/service.d.ts +2 -2
- package/dist/events/service.d.ts.map +1 -1
- package/dist/execution/agent.js +16 -15
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +16 -15
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +16 -15
- package/dist/execution/request.js.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -28
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/changes.d.ts +5 -0
- package/dist/lake-storage/changes.d.ts.map +1 -0
- package/dist/lake-storage/in-memory.d.ts +2 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +2 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +4 -2
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/types.d.ts +36 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/logging/internal.js +1 -1
- package/dist/materialization/index.d.ts +1 -1
- package/dist/materialization/index.d.ts.map +1 -1
- package/dist/materialization/model.d.ts +12 -1
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.d.ts +1 -1
- package/dist/materializer/index.d.ts.map +1 -1
- package/dist/materializer/index.js +5 -5
- package/dist/materializer/materializer.d.ts +5 -1
- package/dist/materializer/materializer.d.ts.map +1 -1
- package/dist/materializer/projections/entry-validator.d.ts +2 -1
- package/dist/materializer/projections/entry-validator.d.ts.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/source-materialization.d.ts +4 -3
- package/dist/materializer/projections/source-materialization.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +2 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/execution/index.js +5 -5
- package/dist/objects/index.js +9 -9
- package/dist/objects/query/index.js +5 -5
- package/dist/pipelines/index.js +6 -6
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/projections/internal.js +6 -8
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +7 -3
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/indexed-heap.d.ts +15 -0
- package/dist/queues/indexed-heap.d.ts.map +1 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.js +1 -1
- package/dist/runtime/ontology-mutations.d.ts +3 -1
- package/dist/runtime/ontology-mutations.d.ts.map +1 -1
- package/dist/shares/internal.js +4 -4
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +2 -2
- package/dist/storage/connector-connections/provider.js.map +3 -3
- package/dist/storage/connector-connections/types.d.ts +3 -2
- package/dist/storage/connector-connections/types.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +4 -4
- package/dist/storage/internal.js +1 -1
- package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/shared-state.d.ts +15 -2
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/source-roots.d.ts +6 -0
- package/dist/storage/ontology/in-memory/source-roots.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +1 -1
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +16 -0
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +4 -2
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/ontology/sources.d.ts +13 -4
- package/dist/storage/ontology/sources.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/projection-runs/types.d.ts +2 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +8 -7
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1459 -951
- package/dist/testing/index.js.map +9 -8
- package/dist/testing/lake-changes-contract.d.ts +6 -0
- package/dist/testing/lake-changes-contract.d.ts.map +1 -0
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +6 -0
- package/dist/webhooks/connections.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.d.ts +2 -0
- package/dist/webhooks/internal.d.ts.map +1 -1
- package/dist/webhooks/internal.js +54 -9
- package/dist/webhooks/internal.js.map +4 -3
- package/dist/webhooks/registry.d.ts +1 -1
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/types.d.ts +15 -4
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workflows/index.js +17 -16
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +3 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/broker/in-memory.ts +104 -39
- package/src/broker/index.ts +4 -1
- package/src/broker/retention.ts +28 -0
- package/src/broker/subscriber.ts +21 -0
- package/src/broker/types.ts +15 -1
- package/src/connectors/builders.ts +0 -6
- package/src/connectors/connections/authorizations.ts +11 -5
- package/src/connectors/connections/contracts.ts +3 -0
- package/src/connectors/connections/request.ts +56 -22
- package/src/connectors/connections/runs.ts +1 -0
- package/src/connectors/connections/tokens.ts +4 -0
- package/src/connectors/connections/validation.ts +91 -5
- package/src/connectors/types.ts +19 -4
- package/src/events/execution.ts +2 -2
- package/src/events/service.ts +3 -3
- package/src/index.ts +10 -2
- package/src/lake-storage/changes.ts +43 -0
- package/src/lake-storage/in-memory.ts +73 -0
- package/src/lake-storage/index.ts +4 -0
- package/src/lake-storage/types.ts +40 -0
- package/src/logging/service.ts +1 -1
- package/src/materialization/index.ts +2 -0
- package/src/materialization/model.ts +14 -1
- package/src/materializer/index.ts +2 -0
- package/src/materializer/materializer.ts +10 -0
- package/src/materializer/projections/entry-validator.ts +19 -1
- package/src/materializer/projections/replace.ts +36 -1
- package/src/materializer/projections/source-materialization.ts +26 -6
- package/src/materializer/shared/normalize.ts +1 -1
- package/src/pipelines/run-dispatch.ts +21 -1
- package/src/projections/run-dispatch.ts +30 -68
- package/src/queues/in-memory.ts +105 -62
- package/src/queues/indexed-heap.ts +74 -0
- package/src/runtime/host.ts +0 -14
- package/src/runtime/ontology-mutations.ts +4 -0
- package/src/storage/connector-connections/in-memory.ts +3 -1
- package/src/storage/connector-connections/provider/runs.ts +3 -1
- package/src/storage/connector-connections/types.ts +3 -2
- package/src/storage/index.ts +1 -0
- package/src/storage/ontology/in-memory/materializations-state.ts +5 -18
- package/src/storage/ontology/in-memory/materializations.ts +73 -92
- package/src/storage/ontology/in-memory/shared-state.ts +26 -1
- package/src/storage/ontology/in-memory/source-roots.ts +123 -0
- package/src/storage/ontology/in-memory/sources.ts +78 -23
- package/src/storage/ontology/index.ts +1 -0
- package/src/storage/ontology/provider.ts +70 -0
- package/src/storage/ontology/sources.ts +14 -3
- package/src/storage/projection-runs/lifecycle.ts +5 -2
- package/src/storage/projection-runs/types.ts +4 -3
- package/src/syncs/run-dispatch.ts +19 -1
- package/src/testing/broker-contract.ts +95 -0
- package/src/testing/connector-connection-storage-contract.ts +18 -1
- package/src/testing/index.ts +1 -0
- package/src/testing/lake-changes-contract.ts +240 -0
- package/src/testing/materializer-storage-contract.ts +172 -1
- package/src/testing/ontology-storage-contract.ts +7 -0
- package/src/testing/projection-run-storage-contract.ts +34 -0
- package/src/webhooks/connections.ts +56 -0
- package/src/webhooks/index.ts +2 -0
- package/src/webhooks/internal.ts +2 -0
- package/src/webhooks/registry.ts +3 -4
- package/src/webhooks/types.ts +17 -4
- package/src/workflows/run-dispatch.ts +42 -29
- package/dist/chunk-0rdrecsb.js.map +0 -11
- package/dist/chunk-3f7veca0.js.map +0 -10
- package/dist/chunk-3frsnm7x.js.map +0 -11
- package/dist/chunk-52hbv0ak.js.map +0 -36
- package/dist/chunk-emyyk7dx.js.map +0 -14
- package/dist/chunk-jjy0fhrn.js.map +0 -12
- package/dist/chunk-k3cqkkn2.js.map +0 -12
- package/dist/chunk-ppytyr6w.js.map +0 -12
- package/dist/chunk-qhcpj9wc.js.map +0 -14
- package/dist/chunk-r29fxdhn.js.map +0 -11
- package/dist/chunk-zcnq6105.js.map +0 -10
- /package/dist/{chunk-h1gfhhbh.js.map → chunk-28ja2cjs.js.map} +0 -0
- /package/dist/{chunk-1enhpacz.js.map → chunk-976rxdpx.js.map} +0 -0
- /package/dist/{chunk-r4tfx1sf.js.map → chunk-agbbygvh.js.map} +0 -0
- /package/dist/{chunk-0w35wavj.js.map → chunk-g7knyczr.js.map} +0 -0
- /package/dist/{chunk-ypbtykv6.js.map → chunk-nmbxcaqx.js.map} +0 -0
- /package/dist/{chunk-vf691g1r.js.map → chunk-p5vcsw9c.js.map} +0 -0
- /package/dist/{chunk-xyr8kppc.js.map → chunk-rtk71jzp.js.map} +0 -0
- /package/dist/{chunk-m3z3x9v0.js.map → chunk-t1f4f1ve.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"sources": ["../src/storage/connector-connections/errors.ts", "../src/storage/connector-connections/types.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"export type ConnectorConnectionStorageErrorCode =\n | \"attempt_conflict\"\n | \"attempt_invalid\"\n | \"run_conflict\"\n | \"run_invalid\"\n | \"authorization_conflict\"\n | \"connection_conflict\"\n | \"invalid_input\"\n\n/**\n * Storage-provider control signal for atomic conflicts and invalid calls.\n *\n * These codes belong to the provider contract, not `SixbErrorCode`; Core translates errors that\n * cross the connector lifecycle boundary into documented `connector.*` failures.\n */\nexport class ConnectorConnectionStorageError extends Error {\n readonly code: ConnectorConnectionStorageErrorCode\n\n constructor(code: ConnectorConnectionStorageErrorCode, message: string) {\n super(message)\n this.name = \"ConnectorConnectionStorageError\"\n this.code = code\n }\n}\n",
|
|
6
|
-
"import type { ConnectorAccountCandidate, ConnectorConnectionSelector } from \"../../connectors\"\nimport type { SealedConnectorCredential } from \"../../connectors/credentials\"\nimport type { SixbErrorCode, SixbFailure } from \"../../errors/types\"\nimport type { AuthorizablePrincipal } from \"../../execution\"\n\nexport type {\n ConnectorConnectionOwner,\n ConnectorConnectionSelector,\n ProjectConnectorConnectionOwner,\n} from \"../../connectors\"\n\nexport const CONNECTOR_CONNECTION_RUN_FAILURE_CODES = [\n \"internal.unexpected\",\n \"connector.adapter_invalid\",\n \"connector.authorization_invalid\",\n \"connector.authorization_required\",\n \"connector.credentials_unavailable\",\n \"connector.not_found\",\n \"connector.operation_conflict\",\n \"connector.operation_in_progress\",\n \"connector.provider_failed\",\n \"connector.provider_unavailable\",\n] as const satisfies readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport type ConnectorConnectionRunFailureCode =\n (typeof CONNECTOR_CONNECTION_RUN_FAILURE_CODES)[number]\nexport type ConnectorConnectionRunFailure = SixbFailure<ConnectorConnectionRunFailureCode>\nexport type ConnectorConnectionRunKind = \"connect\" | \"reauthorize\"\n\ninterface ConnectorConnectionRunBase extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly kind: ConnectorConnectionRunKind\n /** Durable request execution that initiated and is allowed to manage this run. */\n readonly initiatedByExecutionId: string\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface ConnectorConnectionRunAwaitingProviderRecord extends ConnectorConnectionRunBase {\n readonly status: \"waiting\"\n readonly waitingFor: \"provider_authorization\"\n readonly expiresAt: Date\n}\n\nexport interface ConnectorConnectionRunProcessingRecord extends ConnectorConnectionRunBase {\n readonly status: \"running\"\n /** Fences every callback-side write after the one-shot OAuth attempt was consumed. */\n readonly processingId: string\n readonly callbackStartedAt: Date\n readonly expiresAt: Date\n /** Internal grant handle, attached as soon as a new authorization is durably persisted. */\n readonly authorizationId?: string\n}\n\nexport interface ConnectorConnectionRunAwaitingSelectionRecord extends ConnectorConnectionRunBase {\n readonly status: \"waiting\"\n readonly waitingFor: \"account_selection\"\n readonly authorizationId: string\n readonly expiresAt: Date\n}\n\nexport interface ConnectorConnectionRunSucceededRecord extends ConnectorConnectionRunBase {\n readonly status: \"succeeded\"\n readonly authorizationId: string\n /** Internal handle for a replaced grant whose provider cleanup is still retryable. */\n readonly cleanupAuthorizationId?: string\n readonly connections: readonly ConnectorConnectionRecord[]\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunFailedRecord extends ConnectorConnectionRunBase {\n readonly status: \"failed\"\n readonly error: ConnectorConnectionRunFailure\n /** Internal cleanup handle; never serialized by the Headless API. */\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunCancelledRecord extends ConnectorConnectionRunBase {\n readonly status: \"cancelled\"\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunExpiredRecord extends ConnectorConnectionRunBase {\n readonly status: \"expired\"\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport type ConnectorConnectionRunRecord =\n | ConnectorConnectionRunAwaitingProviderRecord\n | ConnectorConnectionRunProcessingRecord\n | ConnectorConnectionRunAwaitingSelectionRecord\n | ConnectorConnectionRunSucceededRecord\n | ConnectorConnectionRunFailedRecord\n | ConnectorConnectionRunCancelledRecord\n | ConnectorConnectionRunExpiredRecord\n\nexport interface CreateConnectorConnectionRunInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly kind: ConnectorConnectionRunKind\n readonly initiatedByExecutionId: string\n readonly ttlMs: number\n}\n\nexport interface CreateConnectorConnectionSelectionRunInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly initiatedByExecutionId: string\n readonly authorizationId: string\n readonly ttlMs: number\n}\n\nexport interface ClaimConnectorConnectionRunCallbackInput {\n readonly projectId: string\n readonly attemptId: string\n readonly stateHash: string\n readonly callbackBindingHash: string\n readonly redirectUri: string\n readonly processingId: string\n readonly processingTtlMs: number\n}\n\nexport type ClaimConnectorConnectionRunCallbackResult =\n | {\n readonly type: \"claimed\"\n readonly run: ConnectorConnectionRunProcessingRecord\n readonly attempt: ConnectorAuthorizationAttemptRecord\n readonly returnTo: string\n }\n | {\n readonly type: \"expired\"\n readonly run: ConnectorConnectionRunExpiredRecord\n readonly returnTo: string\n }\n\nexport interface WaitForConnectorConnectionRunSelectionInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly authorizationId: string\n readonly expiresAt: Date\n}\n\nexport interface AttachConnectorConnectionRunAuthorizationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly authorizationId: string\n}\n\nexport type FinishConnectorConnectionRunInput =\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"succeeded\"\n readonly authorizationId: string\n readonly cleanupAuthorizationId?: string\n readonly connections: readonly ConnectorConnectionRecord[]\n }\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"failed\"\n readonly error: ConnectorConnectionRunFailure\n readonly authorizationId?: string\n }\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"cancelled\"\n }\n\nexport interface GetConnectorConnectionRunInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n}\n\nexport interface ConnectorAuthorizationAttemptRecord extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n /** Durable execution that initiated and authorizes completion of this OAuth attempt. */\n readonly initiatedByExecutionId: string\n readonly stateHash: string\n readonly codeVerifier: SealedConnectorCredential\n readonly redirectUri: string\n /** Present only for attempts created by the headless connection-run API. */\n readonly connectionRunId?: string\n /** Fixed, allowlisted continuation consumed with a headless callback. */\n readonly returnTo?: string\n /** Hash of the one-shot browser callback binding secret. */\n readonly callbackBindingHash?: string\n readonly reauthorizationId?: string\n readonly reauthorizationRevision?: number\n readonly reauthorizationConnectionIds?: readonly string[]\n readonly createdAt: Date\n readonly expiresAt: Date\n}\n\nexport interface CreateConnectorAuthorizationAttemptInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly initiatedByExecutionId: string\n readonly stateHash: string\n readonly codeVerifier: SealedConnectorCredential\n readonly redirectUri: string\n readonly connectionRunId?: string\n readonly returnTo?: string\n readonly callbackBindingHash?: string\n readonly reauthorizationId?: string\n readonly reauthorizationRevision?: number\n readonly reauthorizationConnectionIds?: readonly string[]\n readonly ttlMs: number\n}\n\n/** Callback proof. The orchestration layer authorizes the returned initiating execution. */\nexport interface ConsumeConnectorAuthorizationAttemptInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly stateHash: string\n readonly redirectUri: string\n}\n\nexport type ConnectorAuthorizationStatus =\n | \"pending_selection\"\n | \"active\"\n | \"needs_reauthorization\"\n | \"revocation_pending\"\n | \"revoked\"\n\nexport type ConnectorCredentialMutationKind = \"refresh\" | \"reauthorization\" | \"revocation\"\nexport type ConnectorCredentialMutationPhase = \"prepared\" | \"executing\" | \"result_staged\"\n\nexport interface ConnectorStagedCredentials {\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n}\n\n/** Durable fencing record for one provider-side OAuth credential mutation. */\nexport interface ConnectorCredentialMutation {\n readonly id: string\n readonly kind: ConnectorCredentialMutationKind\n readonly phase: ConnectorCredentialMutationPhase\n readonly holderId: string\n readonly expiresAt: Date\n readonly deadlineAt: Date\n readonly expectedConnectionIds?: readonly string[]\n readonly stagedCredentials?: ConnectorStagedCredentials\n}\n\nexport interface ConnectorAuthorizationRecord {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizedBy: AuthorizablePrincipal\n /** Removed after provider revocation is confirmed. */\n readonly credentials?: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n readonly accounts: readonly ConnectorAccountCandidate[]\n readonly status: ConnectorAuthorizationStatus\n /** Storage-authoritative deadline for the first account selection. */\n readonly selectionExpiresAt?: Date\n readonly revision: number\n readonly credentialMutation?: ConnectorCredentialMutation\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface CreateConnectorAuthorizationInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizedBy: AuthorizablePrincipal\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n readonly accounts: readonly ConnectorAccountCandidate[]\n readonly selectionTtlMs: number\n}\n\nexport interface InitializeConnectorAuthorizationAccountsInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly accounts: readonly ConnectorAccountCandidate[]\n}\n\nexport interface ClaimConnectorCredentialMutationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly mutation: {\n readonly id: string\n readonly kind: ConnectorCredentialMutationKind\n readonly holderId: string\n }\n readonly expectedConnectionIds?: readonly string[]\n readonly leaseDurationMs: number\n readonly operationTimeoutMs: number\n}\n\nexport interface ClaimConnectorCredentialMutationResult {\n readonly authorization: ConnectorAuthorizationRecord\n readonly disconnected: readonly ConnectorConnectionRecord[]\n}\n\nexport interface ConnectorCredentialMutationFence {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly mutationId: string\n}\n\nexport interface MarkConnectorCredentialMutationExecutingInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface RenewConnectorCredentialMutationInput extends ConnectorCredentialMutationFence {\n readonly holderId: string\n readonly leaseDurationMs: number\n}\n\nexport interface StageConnectorCredentialMutationCredentialsInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n}\n\nexport interface StageConnectorCredentialMutationRevocationInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface ReleaseConnectorCredentialMutationInput extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface RecoverExpiredConnectorCredentialMutationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n}\n\nexport interface MarkConnectorAuthorizationNeedsReauthorizationInput\n extends ConnectorCredentialMutationFence {}\n\nexport interface FinalizeConnectorReauthorizationInput extends ConnectorCredentialMutationFence {\n readonly accounts: readonly ConnectorAccountCandidate[]\n}\n\nexport type ConnectorConnectionStatus = \"connected\" | \"disconnected\"\n\nexport interface ConnectorConnectionRecord extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly account: ConnectorAccountCandidate\n readonly status: ConnectorConnectionStatus\n readonly disconnectedAt?: Date\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface PutConnectorConnectionInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly account: ConnectorAccountCandidate\n readonly replace: boolean\n}\n\nexport interface PutConnectorConnectionResult {\n readonly connection: ConnectorConnectionRecord\n readonly authorization: ConnectorAuthorizationRecord\n readonly revocationPendingAuthorizationId?: string\n readonly created: boolean\n readonly replaced: boolean\n}\n\nexport interface DisconnectConnectorConnectionResult {\n readonly connection: ConnectorConnectionRecord\n readonly authorization: ConnectorAuthorizationRecord\n readonly revocationPendingAuthorizationId?: string\n}\n\nexport interface PutConnectorConnectionFromRunInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly account: ConnectorAccountCandidate\n readonly replace: boolean\n}\n\nexport interface PutConnectorConnectionFromRunResult extends PutConnectorConnectionResult {\n readonly run: ConnectorConnectionRunSucceededRecord\n}\n\nexport interface GetConnectorConnectionInput extends ConnectorConnectionSelector {\n readonly projectId: string\n readonly connectorId: string\n}\n\nexport interface ListConnectorConnectionsInput {\n readonly projectId: string\n readonly connectorId: string\n}\n\n/** Tenant-scoped identity for one connector authorization. */\nexport interface ConnectorAuthorizationKey {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n}\n\n/** Tenant-scoped identity for one selected connector connection. */\nexport interface ConnectorConnectionKey {\n readonly projectId: string\n readonly connectorId: string\n readonly connectionId: string\n}\n\n/** Persistent contract. Implementations must make every individual mutation atomic. */\nexport interface ConnectorConnectionStorage {\n readonly durability: \"ephemeral\" | \"durable\"\n\n createAuthorizationAttempt(\n input: CreateConnectorAuthorizationAttemptInput\n ): Promise<ConnectorAuthorizationAttemptRecord>\n consumeAuthorizationAttempt(\n input: ConsumeConnectorAuthorizationAttemptInput\n ): Promise<ConnectorAuthorizationAttemptRecord>\n\n createConnectionRun(\n input: CreateConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord>\n createConnectionSelectionRun(\n input: CreateConnectorConnectionSelectionRunInput\n ): Promise<ConnectorConnectionRunAwaitingSelectionRecord>\n claimConnectionRunCallback(\n input: ClaimConnectorConnectionRunCallbackInput\n ): Promise<ClaimConnectorConnectionRunCallbackResult | null>\n attachConnectionRunAuthorization(\n input: AttachConnectorConnectionRunAuthorizationInput\n ): Promise<ConnectorConnectionRunProcessingRecord | null>\n waitForConnectionRunSelection(\n input: WaitForConnectorConnectionRunSelectionInput\n ): Promise<ConnectorConnectionRunAwaitingSelectionRecord | null>\n finishConnectionRun(\n input: FinishConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord | null>\n getConnectionRun(\n input: GetConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord | null>\n\n createAuthorization(\n input: CreateConnectorAuthorizationInput\n ): Promise<ConnectorAuthorizationRecord>\n initializeAuthorizationAccounts(\n input: InitializeConnectorAuthorizationAccountsInput\n ): Promise<ConnectorAuthorizationRecord | null>\n getAuthorization(input: ConnectorAuthorizationKey): Promise<ConnectorAuthorizationRecord | null>\n getAuthorizationByConnectionId(\n input: ConnectorConnectionKey\n ): Promise<ConnectorAuthorizationRecord | null>\n claimCredentialMutation(\n input: ClaimConnectorCredentialMutationInput\n ): Promise<ClaimConnectorCredentialMutationResult | null>\n markCredentialMutationExecuting(\n input: MarkConnectorCredentialMutationExecutingInput\n ): Promise<ConnectorAuthorizationRecord | null>\n renewCredentialMutation(\n input: RenewConnectorCredentialMutationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n stageCredentialMutationCredentials(\n input: StageConnectorCredentialMutationCredentialsInput\n ): Promise<ConnectorAuthorizationRecord | null>\n stageCredentialMutationRevocation(\n input: StageConnectorCredentialMutationRevocationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n releaseCredentialMutation(input: ReleaseConnectorCredentialMutationInput): Promise<boolean>\n /**\n * Recovers an expired mutation without replaying an unknown provider effect. Prepared work is\n * released, executing refresh/reauthorization fails closed, revocation stays retryable, and a\n * staged result remains available for finalization.\n */\n recoverExpiredCredentialMutation(\n input: RecoverExpiredConnectorCredentialMutationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n markNeedsReauthorization(\n input: MarkConnectorAuthorizationNeedsReauthorizationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeRefresh(\n input: ConnectorCredentialMutationFence\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeReauthorization(\n input: FinalizeConnectorReauthorizationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeRevocation(\n input: ConnectorCredentialMutationFence\n ): Promise<ConnectorAuthorizationRecord | null>\n\n putConnection(input: PutConnectorConnectionInput): Promise<PutConnectorConnectionResult>\n putConnectionFromRun(\n input: PutConnectorConnectionFromRunInput\n ): Promise<PutConnectorConnectionFromRunResult>\n getConnection(input: GetConnectorConnectionInput): Promise<ConnectorConnectionRecord | null>\n getConnectionById(input: ConnectorConnectionKey): Promise<ConnectorConnectionRecord | null>\n listConnections(\n input: ListConnectorConnectionsInput\n ): Promise<readonly ConnectorConnectionRecord[]>\n listConnectionsByAuthorization(\n input: ConnectorAuthorizationKey\n ): Promise<readonly ConnectorConnectionRecord[]>\n disconnectConnection(\n input: ConnectorConnectionKey\n ): Promise<DisconnectConnectorConnectionResult | null>\n}\n"
|
|
6
|
+
"import type { ConnectorAccountCandidate, ConnectorConnectionSelector } from \"../../connectors\"\nimport type { SealedConnectorCredential } from \"../../connectors/credentials\"\nimport type { SixbErrorCode, SixbFailure } from \"../../errors/types\"\nimport type { AuthorizablePrincipal } from \"../../execution\"\n\nexport type {\n ConnectorConnectionOwner,\n ConnectorConnectionSelector,\n ProjectConnectorConnectionOwner,\n} from \"../../connectors\"\n\nexport const CONNECTOR_CONNECTION_RUN_FAILURE_CODES = [\n \"internal.unexpected\",\n \"connector.adapter_invalid\",\n \"connector.authorization_invalid\",\n \"connector.authorization_required\",\n \"connector.credentials_unavailable\",\n \"connector.not_found\",\n \"connector.operation_conflict\",\n \"connector.operation_in_progress\",\n \"connector.provider_failed\",\n \"connector.provider_unavailable\",\n] as const satisfies readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport type ConnectorConnectionRunFailureCode =\n (typeof CONNECTOR_CONNECTION_RUN_FAILURE_CODES)[number]\nexport type ConnectorConnectionRunFailure = SixbFailure<ConnectorConnectionRunFailureCode>\nexport type ConnectorConnectionRunKind = \"connect\" | \"reauthorize\"\n\ninterface ConnectorConnectionRunBase extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly kind: ConnectorConnectionRunKind\n /** Durable request execution that initiated and is allowed to manage this run. */\n readonly initiatedByExecutionId: string\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface ConnectorConnectionRunAwaitingProviderRecord extends ConnectorConnectionRunBase {\n readonly status: \"waiting\"\n readonly waitingFor: \"provider_authorization\"\n readonly expiresAt: Date\n}\n\nexport interface ConnectorConnectionRunProcessingRecord extends ConnectorConnectionRunBase {\n readonly status: \"running\"\n /** Fences every callback-side write after the one-shot OAuth attempt was consumed. */\n readonly processingId: string\n readonly callbackStartedAt: Date\n readonly expiresAt: Date\n /** Internal grant handle, attached as soon as a new authorization is durably persisted. */\n readonly authorizationId?: string\n}\n\nexport interface ConnectorConnectionRunAwaitingSelectionRecord extends ConnectorConnectionRunBase {\n readonly status: \"waiting\"\n readonly waitingFor: \"account_selection\"\n readonly authorizationId: string\n readonly expiresAt: Date\n}\n\nexport interface ConnectorConnectionRunSucceededRecord extends ConnectorConnectionRunBase {\n readonly status: \"succeeded\"\n readonly authorizationId: string\n /** Internal handle for a replaced grant whose provider cleanup is still retryable. */\n readonly cleanupAuthorizationId?: string\n readonly connections: readonly ConnectorConnectionRecord[]\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunFailedRecord extends ConnectorConnectionRunBase {\n readonly status: \"failed\"\n readonly error: ConnectorConnectionRunFailure\n /** Internal cleanup handle; never serialized by the Headless API. */\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunCancelledRecord extends ConnectorConnectionRunBase {\n readonly status: \"cancelled\"\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunExpiredRecord extends ConnectorConnectionRunBase {\n readonly status: \"expired\"\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport type ConnectorConnectionRunRecord =\n | ConnectorConnectionRunAwaitingProviderRecord\n | ConnectorConnectionRunProcessingRecord\n | ConnectorConnectionRunAwaitingSelectionRecord\n | ConnectorConnectionRunSucceededRecord\n | ConnectorConnectionRunFailedRecord\n | ConnectorConnectionRunCancelledRecord\n | ConnectorConnectionRunExpiredRecord\n\nexport interface CreateConnectorConnectionRunInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly kind: ConnectorConnectionRunKind\n readonly initiatedByExecutionId: string\n readonly ttlMs: number\n}\n\nexport interface CreateConnectorConnectionSelectionRunInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly initiatedByExecutionId: string\n readonly authorizationId: string\n readonly ttlMs: number\n}\n\nexport interface ClaimConnectorConnectionRunCallbackInput {\n readonly projectId: string\n readonly attemptId: string\n readonly stateHash: string\n readonly callbackBindingHash: string\n readonly redirectUri: string\n readonly processingId: string\n readonly processingTtlMs: number\n}\n\nexport type ClaimConnectorConnectionRunCallbackResult =\n | {\n readonly type: \"claimed\"\n readonly run: ConnectorConnectionRunProcessingRecord\n readonly attempt: ConnectorAuthorizationAttemptRecord\n readonly returnTo: string\n }\n | {\n readonly type: \"expired\"\n readonly run: ConnectorConnectionRunExpiredRecord\n readonly returnTo: string\n }\n\nexport interface WaitForConnectorConnectionRunSelectionInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly authorizationId: string\n readonly expiresAt: Date\n}\n\nexport interface AttachConnectorConnectionRunAuthorizationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly authorizationId: string\n}\n\nexport type FinishConnectorConnectionRunInput =\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"succeeded\"\n readonly authorizationId: string\n readonly cleanupAuthorizationId?: string\n readonly connections: readonly ConnectorConnectionRecord[]\n }\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"failed\"\n readonly error: ConnectorConnectionRunFailure\n readonly authorizationId?: string\n }\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"cancelled\"\n }\n\nexport interface GetConnectorConnectionRunInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n}\n\nexport interface ConnectorAuthorizationAttemptRecord extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n /** Durable execution that initiated and authorizes completion of this OAuth attempt. */\n readonly initiatedByExecutionId: string\n readonly stateHash: string\n /** Absent when the authorization attempt explicitly disabled PKCE. */\n readonly codeVerifier?: SealedConnectorCredential\n readonly redirectUri: string\n /** Present only for attempts created by the headless connection-run API. */\n readonly connectionRunId?: string\n /** Fixed, allowlisted continuation consumed with a headless callback. */\n readonly returnTo?: string\n /** Hash of the one-shot browser callback binding secret. */\n readonly callbackBindingHash?: string\n readonly reauthorizationId?: string\n readonly reauthorizationRevision?: number\n readonly reauthorizationConnectionIds?: readonly string[]\n readonly createdAt: Date\n readonly expiresAt: Date\n}\n\nexport interface CreateConnectorAuthorizationAttemptInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly initiatedByExecutionId: string\n readonly stateHash: string\n readonly codeVerifier?: SealedConnectorCredential\n readonly redirectUri: string\n readonly connectionRunId?: string\n readonly returnTo?: string\n readonly callbackBindingHash?: string\n readonly reauthorizationId?: string\n readonly reauthorizationRevision?: number\n readonly reauthorizationConnectionIds?: readonly string[]\n readonly ttlMs: number\n}\n\n/** Callback proof. The orchestration layer authorizes the returned initiating execution. */\nexport interface ConsumeConnectorAuthorizationAttemptInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly stateHash: string\n readonly redirectUri: string\n}\n\nexport type ConnectorAuthorizationStatus =\n | \"pending_selection\"\n | \"active\"\n | \"needs_reauthorization\"\n | \"revocation_pending\"\n | \"revoked\"\n\nexport type ConnectorCredentialMutationKind = \"refresh\" | \"reauthorization\" | \"revocation\"\nexport type ConnectorCredentialMutationPhase = \"prepared\" | \"executing\" | \"result_staged\"\n\nexport interface ConnectorStagedCredentials {\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n}\n\n/** Durable fencing record for one provider-side OAuth credential mutation. */\nexport interface ConnectorCredentialMutation {\n readonly id: string\n readonly kind: ConnectorCredentialMutationKind\n readonly phase: ConnectorCredentialMutationPhase\n readonly holderId: string\n readonly expiresAt: Date\n readonly deadlineAt: Date\n readonly expectedConnectionIds?: readonly string[]\n readonly stagedCredentials?: ConnectorStagedCredentials\n}\n\nexport interface ConnectorAuthorizationRecord {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizedBy: AuthorizablePrincipal\n /** Removed after provider revocation is confirmed. */\n readonly credentials?: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n readonly accounts: readonly ConnectorAccountCandidate[]\n readonly status: ConnectorAuthorizationStatus\n /** Storage-authoritative deadline for the first account selection. */\n readonly selectionExpiresAt?: Date\n readonly revision: number\n readonly credentialMutation?: ConnectorCredentialMutation\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface CreateConnectorAuthorizationInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizedBy: AuthorizablePrincipal\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n readonly accounts: readonly ConnectorAccountCandidate[]\n readonly selectionTtlMs: number\n}\n\nexport interface InitializeConnectorAuthorizationAccountsInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly accounts: readonly ConnectorAccountCandidate[]\n}\n\nexport interface ClaimConnectorCredentialMutationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly mutation: {\n readonly id: string\n readonly kind: ConnectorCredentialMutationKind\n readonly holderId: string\n }\n readonly expectedConnectionIds?: readonly string[]\n readonly leaseDurationMs: number\n readonly operationTimeoutMs: number\n}\n\nexport interface ClaimConnectorCredentialMutationResult {\n readonly authorization: ConnectorAuthorizationRecord\n readonly disconnected: readonly ConnectorConnectionRecord[]\n}\n\nexport interface ConnectorCredentialMutationFence {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly mutationId: string\n}\n\nexport interface MarkConnectorCredentialMutationExecutingInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface RenewConnectorCredentialMutationInput extends ConnectorCredentialMutationFence {\n readonly holderId: string\n readonly leaseDurationMs: number\n}\n\nexport interface StageConnectorCredentialMutationCredentialsInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n}\n\nexport interface StageConnectorCredentialMutationRevocationInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface ReleaseConnectorCredentialMutationInput extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface RecoverExpiredConnectorCredentialMutationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n}\n\nexport interface MarkConnectorAuthorizationNeedsReauthorizationInput\n extends ConnectorCredentialMutationFence {}\n\nexport interface FinalizeConnectorReauthorizationInput extends ConnectorCredentialMutationFence {\n readonly accounts: readonly ConnectorAccountCandidate[]\n}\n\nexport type ConnectorConnectionStatus = \"connected\" | \"disconnected\"\n\nexport interface ConnectorConnectionRecord extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly account: ConnectorAccountCandidate\n readonly status: ConnectorConnectionStatus\n readonly disconnectedAt?: Date\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface PutConnectorConnectionInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly account: ConnectorAccountCandidate\n readonly replace: boolean\n}\n\nexport interface PutConnectorConnectionResult {\n readonly connection: ConnectorConnectionRecord\n readonly authorization: ConnectorAuthorizationRecord\n readonly revocationPendingAuthorizationId?: string\n readonly created: boolean\n readonly replaced: boolean\n}\n\nexport interface DisconnectConnectorConnectionResult {\n readonly connection: ConnectorConnectionRecord\n readonly authorization: ConnectorAuthorizationRecord\n readonly revocationPendingAuthorizationId?: string\n}\n\nexport interface PutConnectorConnectionFromRunInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly account: ConnectorAccountCandidate\n readonly replace: boolean\n}\n\nexport interface PutConnectorConnectionFromRunResult extends PutConnectorConnectionResult {\n readonly run: ConnectorConnectionRunSucceededRecord\n}\n\nexport interface GetConnectorConnectionInput extends ConnectorConnectionSelector {\n readonly projectId: string\n readonly connectorId: string\n}\n\nexport interface ListConnectorConnectionsInput {\n readonly projectId: string\n readonly connectorId: string\n}\n\n/** Tenant-scoped identity for one connector authorization. */\nexport interface ConnectorAuthorizationKey {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n}\n\n/** Tenant-scoped identity for one selected connector connection. */\nexport interface ConnectorConnectionKey {\n readonly projectId: string\n readonly connectorId: string\n readonly connectionId: string\n}\n\n/** Persistent contract. Implementations must make every individual mutation atomic. */\nexport interface ConnectorConnectionStorage {\n readonly durability: \"ephemeral\" | \"durable\"\n\n createAuthorizationAttempt(\n input: CreateConnectorAuthorizationAttemptInput\n ): Promise<ConnectorAuthorizationAttemptRecord>\n consumeAuthorizationAttempt(\n input: ConsumeConnectorAuthorizationAttemptInput\n ): Promise<ConnectorAuthorizationAttemptRecord>\n\n createConnectionRun(\n input: CreateConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord>\n createConnectionSelectionRun(\n input: CreateConnectorConnectionSelectionRunInput\n ): Promise<ConnectorConnectionRunAwaitingSelectionRecord>\n claimConnectionRunCallback(\n input: ClaimConnectorConnectionRunCallbackInput\n ): Promise<ClaimConnectorConnectionRunCallbackResult | null>\n attachConnectionRunAuthorization(\n input: AttachConnectorConnectionRunAuthorizationInput\n ): Promise<ConnectorConnectionRunProcessingRecord | null>\n waitForConnectionRunSelection(\n input: WaitForConnectorConnectionRunSelectionInput\n ): Promise<ConnectorConnectionRunAwaitingSelectionRecord | null>\n finishConnectionRun(\n input: FinishConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord | null>\n getConnectionRun(\n input: GetConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord | null>\n\n createAuthorization(\n input: CreateConnectorAuthorizationInput\n ): Promise<ConnectorAuthorizationRecord>\n initializeAuthorizationAccounts(\n input: InitializeConnectorAuthorizationAccountsInput\n ): Promise<ConnectorAuthorizationRecord | null>\n getAuthorization(input: ConnectorAuthorizationKey): Promise<ConnectorAuthorizationRecord | null>\n getAuthorizationByConnectionId(\n input: ConnectorConnectionKey\n ): Promise<ConnectorAuthorizationRecord | null>\n claimCredentialMutation(\n input: ClaimConnectorCredentialMutationInput\n ): Promise<ClaimConnectorCredentialMutationResult | null>\n markCredentialMutationExecuting(\n input: MarkConnectorCredentialMutationExecutingInput\n ): Promise<ConnectorAuthorizationRecord | null>\n renewCredentialMutation(\n input: RenewConnectorCredentialMutationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n stageCredentialMutationCredentials(\n input: StageConnectorCredentialMutationCredentialsInput\n ): Promise<ConnectorAuthorizationRecord | null>\n stageCredentialMutationRevocation(\n input: StageConnectorCredentialMutationRevocationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n releaseCredentialMutation(input: ReleaseConnectorCredentialMutationInput): Promise<boolean>\n /**\n * Recovers an expired mutation without replaying an unknown provider effect. Prepared work is\n * released, executing refresh/reauthorization fails closed, revocation stays retryable, and a\n * staged result remains available for finalization.\n */\n recoverExpiredCredentialMutation(\n input: RecoverExpiredConnectorCredentialMutationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n markNeedsReauthorization(\n input: MarkConnectorAuthorizationNeedsReauthorizationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeRefresh(\n input: ConnectorCredentialMutationFence\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeReauthorization(\n input: FinalizeConnectorReauthorizationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeRevocation(\n input: ConnectorCredentialMutationFence\n ): Promise<ConnectorAuthorizationRecord | null>\n\n putConnection(input: PutConnectorConnectionInput): Promise<PutConnectorConnectionResult>\n putConnectionFromRun(\n input: PutConnectorConnectionFromRunInput\n ): Promise<PutConnectorConnectionFromRunResult>\n getConnection(input: GetConnectorConnectionInput): Promise<ConnectorConnectionRecord | null>\n getConnectionById(input: ConnectorConnectionKey): Promise<ConnectorConnectionRecord | null>\n listConnections(\n input: ListConnectorConnectionsInput\n ): Promise<readonly ConnectorConnectionRecord[]>\n listConnectionsByAuthorization(\n input: ConnectorAuthorizationKey\n ): Promise<readonly ConnectorConnectionRecord[]>\n disconnectConnection(\n input: ConnectorConnectionKey\n ): Promise<DisconnectConnectorConnectionResult | null>\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";;AAeO,MAAM,yCAAwC,MAAM;AAAA,EAChD;AAAA,EAET,WAAW,CAAC,MAA2C,SAAiB;AAAA,IACtE,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO;AAAA;AAEhB;;;ACZO,IAAM,0CAAyC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
9
9
|
"debugId": "B4781D37D7AB95BB64756E2164756E21",
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
PROJECTION_RUN_FAILURE_CODES2,
|
|
7
7
|
PROJECTION_RUN_PROGRESS_KEYS2,
|
|
8
8
|
zeroProjectionRunProgress2
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-qma80ych.js";
|
|
10
10
|
import {
|
|
11
11
|
findPrimitiveRunExecution
|
|
12
12
|
} from "./chunk-ey1nk510.js";
|
|
@@ -173,7 +173,7 @@ function mergeProjectionRunProgress2(current, patch) {
|
|
|
173
173
|
if (value === undefined)
|
|
174
174
|
continue;
|
|
175
175
|
assertProjectionRunCounter2(value, key);
|
|
176
|
-
if (value < current[key]) {
|
|
176
|
+
if (value < (current[key] ?? 0)) {
|
|
177
177
|
throw new ProjectionRunError2(`[Sixb] Projection run ${key} must not decrease.`);
|
|
178
178
|
}
|
|
179
179
|
progress[key] = value;
|
|
@@ -449,7 +449,7 @@ function projectionTargetsEqual(left, right) {
|
|
|
449
449
|
}
|
|
450
450
|
function assertProjectionRunProgress(progress) {
|
|
451
451
|
for (const key of PROJECTION_RUN_PROGRESS_KEYS2) {
|
|
452
|
-
assertProjectionRunCounter2(progress[key], key);
|
|
452
|
+
assertProjectionRunCounter2(key === "sourceChangesRead" ? progress[key] ?? 0 : progress[key], key);
|
|
453
453
|
}
|
|
454
454
|
if (progress.sourceRowsSkipped > progress.sourceRowsRead) {
|
|
455
455
|
throw new ProjectionRunError2("[Sixb] Projection run sourceRowsSkipped must not exceed sourceRowsRead.");
|
|
@@ -589,4 +589,4 @@ async function assertProjectionRunDurableExecution2(input) {
|
|
|
589
589
|
|
|
590
590
|
export { ProjectionRunError2, assertProjectionRunNonEmpty2, assertProjectionRunCounter2, assertProjectionRunListWindow2, addProjectionRunCounter2, assertProjectionRunIdentity2, assertProjectionRunIdentityMatches2, assertProjectionRunTargetMatches2, assertProjectionRunStartInput2, assertProjectionRunQueueInput2, planProjectionRunReclaim2, createProjectionRunRecord2, assertProjectionRunRunning2, assertProjectionRunAttempt2, nextProjectionRunAttempt2, mergeProjectionRunProgress2, assertGenericProgressDoesNotAdvanceTelemetry2, advanceProjectionTelemetry2, planProjectionRunFinish2, finishProjectionRunRecord2, failProjectionRunEnqueue2, canRequeueProjectionRunAfterEnqueueFailure2, restoreProjectionRun2, publicProjectionRunRecord2, createProjectionRunClaim2, requireProjectionRunExecutionToken2, staleProjectionRunExecution2, projectionRunNotFound2, immutableDatasetVersionConflict2, assertProjectionMissingTarget2, requireTelemetryProjectionRun2, assertProjectionRunDurableExecution2 };
|
|
591
591
|
|
|
592
|
-
//# debugId=
|
|
592
|
+
//# debugId=12DA83947054E7D364756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/storage/projection-runs/errors.ts", "../src/storage/projection-runs/lifecycle.ts", "../src/storage/projection-runs/provider.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n MaterializationConflictError,\n type MaterializationConflictKind,\n} from \"../../materialization/errors\"\n\n/**\n * Base error for projection-run storage operations.\n */\nexport class ProjectionRunError extends MaterializationConflictError {\n readonly name = \"ProjectionRunError\"\n\n constructor(message: string, kind: MaterializationConflictKind = \"run-correlation\") {\n super(kind, message)\n }\n}\n",
|
|
6
|
+
"import { parseSixbFailure } from \"../../errors/internal\"\nimport type { SixbFailure } from \"../../errors/types\"\nimport type {\n ProjectionMaterializationIdentity,\n ProjectionRunTerminalDecision,\n} from \"../../materialization/model\"\nimport type {\n ProjectionKind,\n ProjectionRunFailureCode,\n ProjectionTarget,\n} from \"../../projections/types\"\nimport { PROJECTION_RUN_FAILURE_CODES } from \"../../projections/types\"\nimport { ProjectionRunError } from \"./errors\"\nimport type {\n AdvanceProjectionTelemetryCheckpointInput,\n FailProjectionRunEnqueueInput,\n FinishProjectionRunInput,\n ProjectionMissingTarget,\n ProjectionRunClaim,\n ProjectionRunProgress,\n ProjectionRunRecord,\n ProjectionRunStatus,\n ProjectionTelemetryCheckpoint,\n QueueProjectionRunInput,\n StartOrReclaimProjectionRunInput,\n TelemetryProjectionRunRecord,\n} from \"./types\"\nimport { PROJECTION_RUN_PROGRESS_KEYS, zeroProjectionRunProgress } from \"./types\"\n\nexport type StoredProjectionRunRecord = ProjectionRunRecord & {\n readonly executionToken?: string\n}\n\nexport interface PersistedProjectionRunRecord {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly projectionId: string\n readonly projectionKind: ProjectionKind\n readonly protocol?: \"replacement\" | \"telemetry\"\n readonly datasetId: string\n readonly datasetVersionId: string\n readonly datasetVersionCreatedAt?: string\n readonly ontologyRevision?: string\n readonly projectionRevision?: string\n readonly ownershipHash?: string\n readonly objectTypeId?: string\n readonly sourceObjectTypeId?: string\n readonly targetObjectTypeId?: string\n readonly status: ProjectionRunStatus\n readonly queuedAt: Date\n readonly startedAt?: Date\n readonly finishedAt?: Date\n readonly attempt: number\n readonly executionToken?: string\n readonly fixedBatchSize?: number\n readonly nextBatchOrdinal?: number\n readonly nextRowOffset?: number\n readonly inputExhausted?: boolean\n readonly missingTargetObjectTypeId?: string\n readonly missingTargetObjectId?: string\n readonly missingTargetBatchOrdinal?: number\n readonly missingTargetFirstSeenAt?: Date\n readonly progress: ProjectionRunProgress\n readonly error?: unknown\n}\n\nexport interface ProjectionTelemetryAdvance {\n readonly progress: ProjectionRunProgress\n readonly checkpoint: ProjectionTelemetryCheckpoint\n}\n\nexport interface ProjectionRunFinishPlan {\n readonly status: Exclude<ProjectionRunStatus, \"queued\" | \"running\">\n readonly finishedAt: Date\n readonly progress: ProjectionRunProgress\n readonly inputExhausted?: true\n readonly error?: SixbFailure<ProjectionRunFailureCode>\n}\n\n// ── Scalar and identity validation ──────────────────────────\n\nexport function assertProjectionRunNonEmpty(value: string, fieldName: string): void {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw new ProjectionRunError(`[Sixb] Projection run ${fieldName} must not be empty.`)\n }\n}\n\nexport function assertProjectionRunCounter(value: number, fieldName: string): void {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new ProjectionRunError(\n `[Sixb] Projection run ${fieldName} must be a non-negative safe integer.`\n )\n }\n}\n\nexport function assertProjectionRunListWindow(value: number | undefined, fieldName: string): void {\n if (value !== undefined && (!Number.isSafeInteger(value) || value < 0)) {\n throw new ProjectionRunError(`[Sixb] Projection run list ${fieldName} must be >= 0.`)\n }\n}\n\nexport function addProjectionRunCounter(left: number, right: number, fieldName: string): number {\n const result = left + right\n if (!Number.isSafeInteger(result)) {\n throw new ProjectionRunError(`[Sixb] Projection run ${fieldName} exceeds safe integer range.`)\n }\n return result\n}\n\nexport function assertProjectionRunIdentity(identity: ProjectionMaterializationIdentity): void {\n assertProjectionRunNonEmpty(identity.projectionId, \"projectionId\")\n if (!isProjectionKind(identity.projectionKind)) {\n throw new ProjectionRunError(\n \"[Sixb] Projection run projectionKind must be 'object', 'link', or 'telemetry'.\"\n )\n }\n if (identity.protocol !== \"replacement\" && identity.protocol !== \"telemetry\") {\n throw new ProjectionRunError(\n \"[Sixb] Projection run protocol must be 'replacement' or 'telemetry'.\"\n )\n }\n assertProjectionRunNonEmpty(identity.datasetVersion.datasetId, \"datasetId\")\n assertProjectionRunNonEmpty(identity.datasetVersion.versionId, \"datasetVersionId\")\n assertCanonicalTimestamp(identity.datasetVersion.createdAt, \"datasetVersionCreatedAt\")\n assertProjectionRunNonEmpty(identity.ontologyRevision, \"ontologyRevision\")\n assertProjectionRunNonEmpty(identity.projectionRevision, \"projectionRevision\")\n assertProjectionRunNonEmpty(identity.ownershipHash, \"ownershipHash\")\n if ((identity.protocol === \"telemetry\") !== (identity.projectionKind === \"telemetry\")) {\n throw new ProjectionRunError(\n `[Sixb] Projection run protocol '${identity.protocol}' is incompatible with kind '${identity.projectionKind}'.`\n )\n }\n}\n\nexport function assertProjectionRunIdentityMatches(\n record: Pick<ProjectionRunRecord, \"id\" | \"identity\">,\n identity: ProjectionMaterializationIdentity\n): void {\n if (projectionRunIdentitiesEqual(record.identity, identity)) return\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' materialization identity does not match.`\n )\n}\n\nexport function assertProjectionRunTargetMatches(\n record: Pick<ProjectionRunRecord, \"id\" | \"target\">,\n target: ProjectionTarget\n): void {\n if (projectionTargetsEqual(record.target, target)) return\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' target object types do not match.`\n )\n}\n\nexport function assertProjectionRunStartInput(input: StartOrReclaimProjectionRunInput): void {\n assertProjectionRunNonEmpty(input.id, \"id\")\n assertProjectionRunNonEmpty(input.projectId, \"projectId\")\n assertProjectionRunIdentityAndTarget(input)\n if (input.startedAt) assertProjectionRunDate(input.startedAt, \"startedAt\")\n}\n\nexport function assertProjectionRunQueueInput(input: QueueProjectionRunInput): void {\n assertProjectionRunNonEmpty(input.id, \"id\")\n assertProjectionRunNonEmpty(input.projectId, \"projectId\")\n assertProjectionRunNonEmpty(input.executionId, \"executionId\")\n assertProjectionRunIdentityAndTarget(input)\n if (input.queuedAt) assertProjectionRunDate(input.queuedAt, \"queuedAt\")\n}\n\nfunction assertProjectionRunIdentityAndTarget(\n input: QueueProjectionRunInput | StartOrReclaimProjectionRunInput\n): void {\n assertProjectionRunIdentity(input.identity)\n assertProjectionTarget(input.identity.projectionKind, input.target)\n if (input.identity.projectionKind === \"telemetry\") {\n const telemetry = input as ProjectionRunIdentityInput<\"telemetry\">\n assertPositiveCounter(telemetry.fixedBatchSize, \"fixedBatchSize\")\n } else if (input.fixedBatchSize !== undefined) {\n throw new ProjectionRunError(\n \"[Sixb] Replacement projection runs cannot declare a telemetry fixedBatchSize.\"\n )\n }\n}\n\nexport function planProjectionRunReclaim(\n record: StoredProjectionRunRecord,\n input: StartOrReclaimProjectionRunInput\n): { readonly attempt: number } {\n if (record.status !== \"queued\" && record.status !== \"running\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' cannot start from status '${record.status}'.`\n )\n }\n assertProjectionRunIdentityMatches(record, input.identity)\n assertProjectionRunTargetMatches(record, input.target)\n if (record.telemetryCheckpoint?.fixedBatchSize !== input.fixedBatchSize) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${input.id}' fixed batch size does not match.`\n )\n }\n return { attempt: record.status === \"queued\" ? 1 : nextProjectionRunAttempt(record.attempt) }\n}\n\n// ── Lifecycle transitions ───────────────────────────────────\n\nexport function createProjectionRunRecord(\n input: QueueProjectionRunInput,\n now: Date = new Date()\n): ProjectionRunRecord {\n assertProjectionRunQueueInput(input)\n const base = {\n id: input.id,\n projectId: input.projectId,\n executionId: input.executionId,\n status: \"queued\" as const,\n attempt: 0,\n progress: zeroProjectionRunProgress(),\n queuedAt: new Date(input.queuedAt ?? now),\n }\n switch (input.identity.projectionKind) {\n case \"object\": {\n const object = input as ProjectionRunAdmission<\"object\">\n return { ...base, identity: object.identity, target: object.target }\n }\n case \"link\": {\n const link = input as ProjectionRunAdmission<\"link\">\n return { ...base, identity: link.identity, target: link.target }\n }\n case \"telemetry\": {\n const telemetry = input as ProjectionRunAdmission<\"telemetry\">\n return {\n ...base,\n identity: telemetry.identity,\n target: telemetry.target,\n telemetryCheckpoint: {\n fixedBatchSize: telemetry.fixedBatchSize,\n nextBatchOrdinal: 0,\n nextRowOffset: 0,\n inputExhausted: false,\n },\n }\n }\n }\n}\n\nexport function assertProjectionRunRunning(\n record: Pick<ProjectionRunRecord, \"id\" | \"projectId\" | \"status\">\n): void {\n if (record.status === \"running\") return\n if (record.status !== \"queued\") {\n throw new ProjectionRunError(`[Sixb] Projection run '${record.id}' is already terminal.`)\n }\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' for project '${record.projectId}' is not running.`\n )\n}\n\nexport function assertProjectionRunAttempt(\n record: StoredProjectionRunRecord,\n input: {\n readonly id: string\n readonly executionToken: string\n readonly identity: ProjectionMaterializationIdentity\n }\n): asserts record is StoredProjectionRunRecord & { readonly executionToken: string } {\n assertProjectionRunNonEmpty(input.executionToken, \"executionToken\")\n assertProjectionRunIdentity(input.identity)\n assertProjectionRunRunning(record)\n assertProjectionRunIdentityMatches(record, input.identity)\n if (record.executionToken !== input.executionToken) {\n throw staleProjectionRunExecution(input.id)\n }\n}\n\nexport function nextProjectionRunAttempt(current: number): number {\n assertProjectionRunCounter(current, \"attempt\")\n return addProjectionRunCounter(current, 1, \"attempt\")\n}\n\nexport function mergeProjectionRunProgress(\n current: ProjectionRunProgress,\n patch: Partial<ProjectionRunProgress>\n): ProjectionRunProgress {\n const progress = { ...current }\n for (const key of PROJECTION_RUN_PROGRESS_KEYS) {\n const value = patch[key]\n if (value === undefined) continue\n assertProjectionRunCounter(value, key)\n if (value < (current[key] ?? 0)) {\n throw new ProjectionRunError(`[Sixb] Projection run ${key} must not decrease.`)\n }\n progress[key] = value\n }\n assertProjectionRunProgress(progress)\n return progress\n}\n\nexport function assertGenericProgressDoesNotAdvanceTelemetry(\n record: Pick<ProjectionRunRecord, \"id\" | \"identity\" | \"progress\">,\n patch: Partial<ProjectionRunProgress>\n): void {\n if (record.identity.protocol !== \"telemetry\") return\n for (const key of PROJECTION_RUN_PROGRESS_KEYS) {\n if (patch[key] !== undefined && patch[key] !== record.progress[key]) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' progress can only advance with its checkpoint.`\n )\n }\n }\n}\n\nexport function advanceProjectionTelemetry(\n record: ProjectionRunRecord,\n input: AdvanceProjectionTelemetryCheckpointInput\n): ProjectionTelemetryAdvance {\n const telemetry = requireTelemetryProjectionRun(record)\n const checkpoint = telemetry.telemetryCheckpoint\n assertProjectionRunCounter(input.batchOrdinal, \"batchOrdinal\")\n assertPositiveCounter(input.batchRowCount, \"batchRowCount\")\n assertProjectionRunCounter(input.batchRowsSkipped, \"batchRowsSkipped\")\n if (input.batchRowsSkipped > input.batchRowCount) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' skipped rows exceed its batch row count.`\n )\n }\n if (input.batchOrdinal !== checkpoint.nextBatchOrdinal) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' expected batch ordinal ${checkpoint.nextBatchOrdinal}, got ${input.batchOrdinal}.`\n )\n }\n if (input.batchRowCount > checkpoint.fixedBatchSize) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' batch exceeds its fixed size.`\n )\n }\n if (!input.inputExhausted && input.batchRowCount !== checkpoint.fixedBatchSize) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot advance past a partial non-final batch.`\n )\n }\n if (checkpoint.inputExhausted) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' has already exhausted its input.`\n )\n }\n\n const nextRowOffset = addProjectionRunCounter(\n checkpoint.nextRowOffset,\n input.batchRowCount,\n \"nextRowOffset\"\n )\n return {\n progress: {\n sourceRowsRead: nextRowOffset,\n sourceRowsSkipped: addProjectionRunCounter(\n telemetry.progress.sourceRowsSkipped,\n input.batchRowsSkipped,\n \"sourceRowsSkipped\"\n ),\n },\n checkpoint: {\n ...checkpoint,\n nextBatchOrdinal: addProjectionRunCounter(checkpoint.nextBatchOrdinal, 1, \"nextBatchOrdinal\"),\n nextRowOffset,\n inputExhausted: input.inputExhausted,\n },\n }\n}\n\nexport function planProjectionRunFinish(\n record: ProjectionRunRecord,\n input: FinishProjectionRunInput,\n now: Date = new Date()\n): ProjectionRunFinishPlan {\n assertFinishDecision(record, input)\n const patch = input.progress ?? {}\n assertGenericProgressDoesNotAdvanceTelemetry(record, patch)\n const progress = mergeProjectionRunProgress(record.progress, patch)\n const finishedAt = new Date(input.finishedAt ?? now)\n assertProjectionRunDate(finishedAt, \"finishedAt\")\n return {\n status: input.status,\n finishedAt,\n progress,\n ...(input.status === \"succeeded\" && input.protocol === \"telemetry\"\n ? { inputExhausted: true as const }\n : {}),\n ...(input.status === \"succeeded\" || input.error === undefined\n ? {}\n : { error: parseSixbFailure(input.error, PROJECTION_RUN_FAILURE_CODES) }),\n }\n}\n\nexport function finishProjectionRunRecord(\n record: StoredProjectionRunRecord,\n input: FinishProjectionRunInput,\n now: Date = new Date()\n): StoredProjectionRunRecord {\n const plan = planProjectionRunFinish(record, input, now)\n const terminal = {\n executionToken: undefined,\n status: plan.status,\n finishedAt: plan.finishedAt,\n progress: plan.progress,\n error: plan.error,\n }\n if (plan.inputExhausted) {\n const telemetry = requireTelemetryProjectionRun(record)\n return {\n ...telemetry,\n ...terminal,\n telemetryCheckpoint: { ...telemetry.telemetryCheckpoint, inputExhausted: true },\n }\n }\n return { ...record, ...terminal }\n}\n\nexport function failProjectionRunEnqueue(\n record: StoredProjectionRunRecord,\n input: FailProjectionRunEnqueueInput,\n now: Date = new Date()\n): StoredProjectionRunRecord {\n if (record.status !== \"queued\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' cannot fail enqueue from status '${record.status}'.`\n )\n }\n const error = parseSixbFailure(input.error, PROJECTION_RUN_FAILURE_CODES)\n if (error.code !== \"queue.enqueue_failed\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' enqueue failure must use code 'queue.enqueue_failed'.`\n )\n }\n const finishedAt = new Date(input.finishedAt ?? now)\n assertProjectionRunDate(finishedAt, \"finishedAt\")\n return {\n ...record,\n status: \"failed\",\n finishedAt,\n error,\n }\n}\n\nexport function canRequeueProjectionRunAfterEnqueueFailure(\n record: ProjectionRunRecord,\n input: QueueProjectionRunInput\n): boolean {\n return (\n record.status === \"failed\" &&\n record.error?.code === \"queue.enqueue_failed\" &&\n record.error.retryable &&\n record.executionId === input.executionId &&\n projectionRunIdentitiesEqual(record.identity, input.identity) &&\n projectionTargetsEqual(record.target, input.target) &&\n record.telemetryCheckpoint?.fixedBatchSize === input.fixedBatchSize\n )\n}\n\n// ── Persistence mapping ─────────────────────────────────────\n\nexport function restoreProjectionRun(row: PersistedProjectionRunRecord): StoredProjectionRunRecord {\n assertProjectionRunNonEmpty(row.id, \"id\")\n assertProjectionRunNonEmpty(row.projectId, \"projectId\")\n assertProjectionRunNonEmpty(row.executionId, \"executionId\")\n assertProjectionRunCounter(row.attempt, \"attempt\")\n assertProjectionRunProgress(row.progress)\n assertValidDate(row.queuedAt, \"queuedAt\")\n if (row.startedAt) assertValidDate(row.startedAt, \"startedAt\")\n if (row.finishedAt) assertValidDate(row.finishedAt, \"finishedAt\")\n assertPersistedLifecycle(row)\n\n const identity = restoreIdentity(row)\n const base = {\n id: row.id,\n projectId: row.projectId,\n executionId: row.executionId,\n identity,\n status: row.status,\n queuedAt: new Date(row.queuedAt),\n startedAt: row.startedAt ? new Date(row.startedAt) : undefined,\n finishedAt: row.finishedAt ? new Date(row.finishedAt) : undefined,\n attempt: row.attempt,\n progress: { ...row.progress },\n error:\n row.error === undefined\n ? undefined\n : parseSixbFailure(row.error, PROJECTION_RUN_FAILURE_CODES),\n executionToken: row.executionToken,\n }\n\n if (identity.projectionKind === \"link\") {\n if (!row.sourceObjectTypeId || !row.targetObjectTypeId || row.objectTypeId) {\n throw invalidProjectionRunTarget(row.id)\n }\n assertNoCheckpoint(row)\n return {\n ...base,\n identity,\n target: {\n sourceObjectTypeId: row.sourceObjectTypeId,\n targetObjectTypeId: row.targetObjectTypeId,\n },\n }\n }\n if (!row.objectTypeId || row.sourceObjectTypeId || row.targetObjectTypeId) {\n throw invalidProjectionRunTarget(row.id)\n }\n if (identity.projectionKind === \"telemetry\") {\n const telemetryCheckpoint = restoreCheckpoint(row)\n if (row.progress.sourceRowsRead !== telemetryCheckpoint.nextRowOffset) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' progress does not match its checkpoint.`\n )\n }\n if (row.status === \"succeeded\" && !telemetryCheckpoint.inputExhausted) {\n throw incompleteProjectionRun(row.id)\n }\n const missingTarget = restoreMissingTarget(row, telemetryCheckpoint)\n return {\n ...base,\n identity,\n target: { objectTypeId: row.objectTypeId },\n telemetryCheckpoint,\n ...(missingTarget ? { missingTarget } : {}),\n }\n }\n assertNoCheckpoint(row)\n return { ...base, identity, target: { objectTypeId: row.objectTypeId } }\n}\n\nexport function publicProjectionRunRecord(record: StoredProjectionRunRecord): ProjectionRunRecord {\n const cloned = structuredClone(record)\n Reflect.deleteProperty(cloned, \"executionToken\")\n return cloned\n}\n\nexport function createProjectionRunClaim(record: StoredProjectionRunRecord): ProjectionRunClaim {\n assertProjectionRunRunning(record)\n const executionToken = requireProjectionRunExecutionToken(record)\n return {\n run: publicProjectionRunRecord(record),\n execution: { projectionRunId: record.id, executionToken },\n }\n}\n\nexport function requireProjectionRunExecutionToken(record: StoredProjectionRunRecord): string {\n if (record.executionToken) return record.executionToken\n throw incompleteProjectionRun(record.id)\n}\n\nexport function staleProjectionRunExecution(id: string): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Projection run '${id}' execution token is stale.`,\n \"execution-lost\"\n )\n}\n\nexport function projectionRunNotFound(projectId: string, id: string): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Projection run '${id}' not found for project '${projectId}'.`\n )\n}\n\nexport function immutableDatasetVersionConflict(\n identity: ProjectionMaterializationIdentity\n): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Dataset version '${identity.datasetVersion.versionId}' reused an immutable dataset version id with different metadata.`\n )\n}\n\n// ── Private helpers ─────────────────────────────────────────\n\nfunction assertPositiveCounter(value: number, fieldName: string): void {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new ProjectionRunError(\n `[Sixb] Projection run ${fieldName} must be a positive safe integer.`\n )\n }\n}\n\nfunction assertCanonicalTimestamp(value: string, fieldName: string): void {\n const milliseconds = Date.parse(value)\n if (!Number.isFinite(milliseconds) || new Date(milliseconds).toISOString() !== value) {\n throw new ProjectionRunError(\n `[Sixb] Projection run ${fieldName} must be a canonical UTC timestamp.`\n )\n }\n}\n\nfunction assertValidDate(value: Date, fieldName: string): void {\n if (!Number.isFinite(value.getTime())) {\n throw new ProjectionRunError(`[Sixb] Projection run persisted ${fieldName} is invalid.`)\n }\n}\n\nfunction assertPersistedLifecycle(row: PersistedProjectionRunRecord): void {\n const hasError = row.error !== undefined\n\n if (row.status === \"queued\") {\n if (\n row.attempt !== 0 ||\n row.startedAt !== undefined ||\n row.finishedAt !== undefined ||\n row.executionToken !== undefined ||\n hasError\n ) {\n throw incompleteProjectionRun(row.id)\n }\n return\n }\n\n if (row.status === \"running\") {\n if (\n row.attempt < 1 ||\n row.startedAt === undefined ||\n row.finishedAt !== undefined ||\n row.executionToken === undefined ||\n hasError\n ) {\n throw incompleteProjectionRun(row.id)\n }\n return\n }\n\n if (row.finishedAt === undefined || row.executionToken !== undefined) {\n throw incompleteProjectionRun(row.id)\n }\n if (row.error !== undefined) {\n const failure = parseSixbFailure(row.error, PROJECTION_RUN_FAILURE_CODES)\n if (failure.code === \"queue.enqueue_failed\") {\n if (\n !failure.retryable ||\n row.status !== \"failed\" ||\n row.attempt !== 0 ||\n row.startedAt !== undefined\n ) {\n throw incompleteProjectionRun(row.id)\n }\n return\n }\n }\n if (row.attempt < 1 || row.startedAt === undefined || (row.status === \"succeeded\" && hasError)) {\n throw incompleteProjectionRun(row.id)\n }\n}\n\nfunction assertProjectionRunDate(value: Date, fieldName: string): void {\n if (!Number.isFinite(value.getTime())) {\n throw new ProjectionRunError(`[Sixb] Projection run ${fieldName} is invalid.`)\n }\n}\n\nfunction isProjectionKind(value: unknown): value is ProjectionKind {\n return value === \"object\" || value === \"link\" || value === \"telemetry\"\n}\n\nfunction assertProjectionTarget(kind: ProjectionKind, target: ProjectionTarget): void {\n if (kind === \"link\") {\n if (!(\"sourceObjectTypeId\" in target)) {\n throw new ProjectionRunError(\n \"[Sixb] Link projection runs must declare source and target object types.\"\n )\n }\n assertProjectionRunNonEmpty(target.sourceObjectTypeId, \"sourceObjectTypeId\")\n assertProjectionRunNonEmpty(target.targetObjectTypeId, \"targetObjectTypeId\")\n return\n }\n if (!(\"objectTypeId\" in target)) {\n throw new ProjectionRunError(\n \"[Sixb] Object and telemetry projection runs must declare one object type.\"\n )\n }\n assertProjectionRunNonEmpty(target.objectTypeId, \"objectTypeId\")\n}\n\nfunction projectionRunIdentitiesEqual(\n left: ProjectionMaterializationIdentity,\n right: ProjectionMaterializationIdentity\n): boolean {\n return (\n left.projectionId === right.projectionId &&\n left.projectionKind === right.projectionKind &&\n left.protocol === right.protocol &&\n left.datasetVersion.datasetId === right.datasetVersion.datasetId &&\n left.datasetVersion.versionId === right.datasetVersion.versionId &&\n left.datasetVersion.createdAt === right.datasetVersion.createdAt &&\n left.ontologyRevision === right.ontologyRevision &&\n left.projectionRevision === right.projectionRevision &&\n left.ownershipHash === right.ownershipHash\n )\n}\n\nfunction projectionTargetsEqual(left: ProjectionTarget, right: ProjectionTarget): boolean {\n if (\"sourceObjectTypeId\" in left || \"sourceObjectTypeId\" in right) {\n return (\n \"sourceObjectTypeId\" in left &&\n \"sourceObjectTypeId\" in right &&\n left.sourceObjectTypeId === right.sourceObjectTypeId &&\n left.targetObjectTypeId === right.targetObjectTypeId\n )\n }\n return left.objectTypeId === right.objectTypeId\n}\n\nfunction assertProjectionRunProgress(progress: ProjectionRunProgress): void {\n for (const key of PROJECTION_RUN_PROGRESS_KEYS) {\n assertProjectionRunCounter(\n key === \"sourceChangesRead\" ? (progress[key] ?? 0) : progress[key],\n key\n )\n }\n if (progress.sourceRowsSkipped > progress.sourceRowsRead) {\n throw new ProjectionRunError(\n \"[Sixb] Projection run sourceRowsSkipped must not exceed sourceRowsRead.\"\n )\n }\n}\n\nfunction assertFinishDecision(\n record: ProjectionRunRecord,\n input: ProjectionRunTerminalDecision\n): void {\n if (input.status !== \"succeeded\" && input.status !== \"failed\" && input.status !== \"cancelled\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' finish status must be terminal.`\n )\n }\n if (input.protocol !== \"replacement\" && input.protocol !== \"telemetry\") {\n throw new ProjectionRunError(`[Sixb] Projection run '${record.id}' finish protocol is invalid.`)\n }\n if (input.protocol !== record.identity.protocol) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' finish protocol does not match its identity.`\n )\n }\n const inputExhausted = \"inputExhausted\" in input ? input.inputExhausted : undefined\n if (input.status === \"succeeded\" && input.protocol === \"telemetry\") {\n if (inputExhausted === true) return\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot succeed before input exhaustion.`\n )\n }\n if (inputExhausted !== undefined) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' contains telemetry-only completion metadata.`\n )\n }\n}\n\nfunction restoreIdentity(row: PersistedProjectionRunRecord): ProjectionMaterializationIdentity {\n if (\n !row.protocol ||\n !row.datasetVersionCreatedAt ||\n !row.ontologyRevision ||\n !row.projectionRevision ||\n !row.ownershipHash\n ) {\n throw incompleteProjectionRun(row.id)\n }\n const identity = {\n projectionId: row.projectionId,\n projectionKind: row.projectionKind,\n protocol: row.protocol,\n datasetVersion: {\n datasetId: row.datasetId,\n versionId: row.datasetVersionId,\n createdAt: row.datasetVersionCreatedAt,\n },\n ontologyRevision: row.ontologyRevision,\n projectionRevision: row.projectionRevision,\n ownershipHash: row.ownershipHash,\n } as ProjectionMaterializationIdentity\n assertProjectionRunIdentity(identity)\n return identity\n}\n\nfunction restoreCheckpoint(row: PersistedProjectionRunRecord): ProjectionTelemetryCheckpoint {\n if (\n row.fixedBatchSize === undefined ||\n row.nextBatchOrdinal === undefined ||\n row.nextRowOffset === undefined ||\n row.inputExhausted === undefined\n ) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' has incomplete checkpoint state.`\n )\n }\n assertPositiveCounter(row.fixedBatchSize, \"fixedBatchSize\")\n assertProjectionRunCounter(row.nextBatchOrdinal, \"nextBatchOrdinal\")\n assertProjectionRunCounter(row.nextRowOffset, \"nextRowOffset\")\n return {\n fixedBatchSize: row.fixedBatchSize,\n nextBatchOrdinal: row.nextBatchOrdinal,\n nextRowOffset: row.nextRowOffset,\n inputExhausted: row.inputExhausted,\n }\n}\n\n/**\n * A wait is either fully persisted or absent. A partially written one would read as \"waiting since\n * the epoch\" or \"waiting for nothing\", and both would decide a run's fate.\n */\nfunction restoreMissingTarget(\n row: PersistedProjectionRunRecord,\n checkpoint: ProjectionTelemetryCheckpoint\n): ProjectionMissingTarget | undefined {\n const columns = [\n row.missingTargetObjectTypeId,\n row.missingTargetObjectId,\n row.missingTargetBatchOrdinal,\n row.missingTargetFirstSeenAt,\n ]\n if (columns.every((column) => column === undefined)) return undefined\n if (\n row.missingTargetObjectTypeId === undefined ||\n row.missingTargetObjectId === undefined ||\n row.missingTargetBatchOrdinal === undefined ||\n row.missingTargetFirstSeenAt === undefined\n ) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' has a partially persisted missing target.`\n )\n }\n const missingTarget: ProjectionMissingTarget = {\n objectTypeId: row.missingTargetObjectTypeId,\n objectId: row.missingTargetObjectId,\n batchOrdinal: row.missingTargetBatchOrdinal,\n firstSeenAt: new Date(row.missingTargetFirstSeenAt),\n }\n assertValidDate(missingTarget.firstSeenAt, \"missingTarget.firstSeenAt\")\n assertProjectionRunCounter(missingTarget.batchOrdinal, \"missingTarget.batchOrdinal\")\n if (missingTarget.batchOrdinal !== checkpoint.nextBatchOrdinal) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' is waiting on a batch it has already passed.`\n )\n }\n if (missingTarget.objectTypeId !== row.objectTypeId) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' is waiting on an object type it does not write.`\n )\n }\n return missingTarget\n}\n\nfunction assertNoCheckpoint(row: PersistedProjectionRunRecord): void {\n if (\n row.fixedBatchSize === undefined &&\n row.nextBatchOrdinal === undefined &&\n row.nextRowOffset === undefined &&\n row.inputExhausted === undefined\n ) {\n return\n }\n throw new ProjectionRunError(\n `[Sixb] Replacement projection run '${row.id}' contains a telemetry checkpoint.`\n )\n}\n\nfunction incompleteProjectionRun(id: string): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Projection run '${id}' has incomplete materialization state.`\n )\n}\n\nfunction invalidProjectionRunTarget(id: string): ProjectionRunError {\n return new ProjectionRunError(`[Sixb] Projection run '${id}' has an invalid target.`)\n}\n\n/**\n * Validates a wait before it is stored, so every adapter refuses the same shapes and the SQL\n * `CHECK` behind them never has to be the thing that catches it.\n *\n * The ordinal has to be the batch the run is actually stuck on: anchored to a stale one, a wait\n * would survive the progress that resolved it and fail a run that is working. The object type\n * has to be the one this run writes, since that is the only type its telemetry can reference.\n */\nexport function assertProjectionMissingTarget(\n record: TelemetryProjectionRunRecord,\n missingTarget: ProjectionMissingTarget\n): ProjectionMissingTarget {\n assertProjectionRunNonEmpty(missingTarget.objectTypeId, \"missingTarget.objectTypeId\")\n assertProjectionRunNonEmpty(missingTarget.objectId, \"missingTarget.objectId\")\n assertProjectionRunCounter(missingTarget.batchOrdinal, \"missingTarget.batchOrdinal\")\n if (Number.isNaN(missingTarget.firstSeenAt.getTime())) {\n throw new ProjectionRunError(\"[Sixb] Projection run missingTarget.firstSeenAt is invalid.\")\n }\n if (missingTarget.objectTypeId !== record.target.objectTypeId) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot wait on '${missingTarget.objectTypeId}'; it writes '${record.target.objectTypeId}'.`\n )\n }\n if (missingTarget.batchOrdinal !== record.telemetryCheckpoint.nextBatchOrdinal) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot wait on batch ${missingTarget.batchOrdinal}; it is at ${record.telemetryCheckpoint.nextBatchOrdinal}.`\n )\n }\n return missingTarget\n}\n\nexport function requireTelemetryProjectionRun<TRecord extends ProjectionRunRecord>(\n record: TRecord\n): TRecord & TelemetryProjectionRunRecord {\n if (isTelemetryProjectionRun(record)) return record as TRecord & TelemetryProjectionRunRecord\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' does not have a telemetry checkpoint.`\n )\n}\n\ntype ProjectionRunIdentityInput<TKind extends ProjectionKind> = Extract<\n QueueProjectionRunInput | StartOrReclaimProjectionRunInput,\n { readonly identity: { readonly projectionKind: TKind } }\n>\n\ntype ProjectionRunAdmission<TKind extends ProjectionKind> = Extract<\n QueueProjectionRunInput,\n { readonly identity: { readonly projectionKind: TKind } }\n>\n\nfunction isTelemetryProjectionRun(\n record: ProjectionRunRecord\n): record is TelemetryProjectionRunRecord {\n return record.identity.projectionKind === \"telemetry\"\n}\n",
|
|
7
|
+
"import type { ExecutionStorage } from \"../executions\"\nimport { findPrimitiveRunExecution } from \"../executions/run-link\"\nimport { ProjectionRunError } from \"./errors\"\n\nexport * from \"./lifecycle\"\n\n/** Validate the semantic link between a durable Projection run and its immutable execution. */\nexport async function assertProjectionRunDurableExecution(input: {\n readonly executions: ExecutionStorage\n readonly projectId: string\n readonly executionId: string\n readonly runId: string\n readonly projectionId: string\n readonly datasetId: string\n readonly datasetVersionId: string\n}): Promise<void> {\n const execution = await findPrimitiveRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n primitive: { kind: \"projection\", id: input.projectionId, runId: input.runId },\n sourceTypes: [\"datasetVersion\"],\n })\n if (\n !execution ||\n execution.source.type !== \"datasetVersion\" ||\n execution.source.datasetId !== input.datasetId ||\n execution.source.versionId !== input.datasetVersionId\n ) {\n throw new ProjectionRunError(\n `[Sixb] Execution '${input.executionId}' does not authorize Projection run '${input.runId}'.`\n )\n }\n}\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAQO,MAAM,4BAA2B,8BAA6B;AAAA,EAC1D,OAAO;AAAA,EAEhB,WAAW,CAAC,SAAiB,OAAoC,mBAAmB;AAAA,IAClF,MAAM,MAAM,OAAO;AAAA;AAEvB;;;ACoEO,SAAS,4BAA2B,CAAC,OAAe,WAAyB;AAAA,EAClF,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,EAAE,WAAW,GAAG;AAAA,IAC1D,MAAM,IAAI,oBAAmB,yBAAyB,8BAA8B;AAAA,EACtF;AAAA;AAGK,SAAS,2BAA0B,CAAC,OAAe,WAAyB;AAAA,EACjF,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,QAAQ,GAAG;AAAA,IAC7C,MAAM,IAAI,oBACR,yBAAyB,gDAC3B;AAAA,EACF;AAAA;AAGK,SAAS,8BAA6B,CAAC,OAA2B,WAAyB;AAAA,EAChG,IAAI,UAAU,cAAc,CAAC,OAAO,cAAc,KAAK,KAAK,QAAQ,IAAI;AAAA,IACtE,MAAM,IAAI,oBAAmB,8BAA8B,yBAAyB;AAAA,EACtF;AAAA;AAGK,SAAS,wBAAuB,CAAC,MAAc,OAAe,WAA2B;AAAA,EAC9F,MAAM,SAAS,OAAO;AAAA,EACtB,IAAI,CAAC,OAAO,cAAc,MAAM,GAAG;AAAA,IACjC,MAAM,IAAI,oBAAmB,yBAAyB,uCAAuC;AAAA,EAC/F;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,4BAA2B,CAAC,UAAmD;AAAA,EAC7F,6BAA4B,SAAS,cAAc,cAAc;AAAA,EACjE,IAAI,CAAC,iBAAiB,SAAS,cAAc,GAAG;AAAA,IAC9C,MAAM,IAAI,oBACR,gFACF;AAAA,EACF;AAAA,EACA,IA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7D364756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -531,7 +531,7 @@ class LoggingService2 {
|
|
|
531
531
|
if (lines.length === 0)
|
|
532
532
|
return;
|
|
533
533
|
try {
|
|
534
|
-
handler(lines);
|
|
534
|
+
return handler(lines);
|
|
535
535
|
} catch {}
|
|
536
536
|
});
|
|
537
537
|
}
|
|
@@ -628,4 +628,4 @@ function hydrateLogRecord(record) {
|
|
|
628
628
|
|
|
629
629
|
export { ConsoleLogger2, noopLoggerProvider2, noopLogger2, DEFAULT_LOGS_MAX_BYTES2, DEFAULT_LOGS_RETENTION2, LOGS_STREAM2, LoggingService2, resolveLoggingService2 };
|
|
630
630
|
|
|
631
|
-
//# debugId=
|
|
631
|
+
//# debugId=08D1C13C76CF4A5064756E2164756E21
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"import type { BrokerStreamDefinition } from \"../broker\"\n\n/** 30 days in milliseconds — the age bound for retained log lines. */\nconst THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1000\n\n/** Default upper bound for the complete retained logs stream. */\nexport const DEFAULT_LOGS_MAX_BYTES = 256 * 1024 * 1024\n\n/** Portable retention for the project-wide, ephemeral logs stream. */\nexport const DEFAULT_LOGS_RETENTION = {\n maxAgeMs: THIRTY_DAYS_MS,\n maxRecords: 100_000,\n maxBytes: DEFAULT_LOGS_MAX_BYTES,\n} as const\n\n/** The single project-wide broker stream that carries every run's log lines. */\nexport const LOGS_STREAM: BrokerStreamDefinition = {\n id: \"__logs\",\n retention: DEFAULT_LOGS_RETENTION,\n}\n\n/** Maximum captured lines per worker execution, excluding its truncation marker. */\nexport const DEFAULT_MAX_LINES_PER_EXECUTION = 10_000\n\n/** Maximum UTF-8 size of one serialized broker record payload. */\nexport const DEFAULT_MAX_LOG_RECORD_BYTES = 64 * 1024\n\n/** Number of records that triggers an immediate broker append. */\nexport const DEFAULT_LOG_BATCH_MAX_RECORDS = 64\n\n/** Serialized payload bytes that trigger an immediate broker append. */\nexport const DEFAULT_LOG_BATCH_MAX_BYTES = 256 * 1024\n\n/** Maximum time a partial batch waits before being appended. */\nexport const DEFAULT_LOG_BATCH_MAX_DELAY_MS = 10\n\n/** Maximum pending bytes while a previous broker append is in flight. */\nexport const DEFAULT_LOG_MAX_BUFFERED_BYTES = 1024 * 1024\n",
|
|
7
7
|
"import { getInvalidJsonValueReason, type JsonValue } from \"../json\"\nimport type { LogEntry, LogFields, LogRecord } from \"./types\"\n\nconst textEncoder = new TextEncoder()\n\n/** Build the provider-independent, redacted and byte-bounded broker copy. */\nexport function sanitizeRecord(\n entry: LogEntry,\n options: {\n readonly maxBytes: number\n readonly redactPaths: readonly string[]\n readonly redactCensor: JsonValue\n }\n): LogRecord {\n const fields = sanitizeFields(entry.fields, options.redactPaths, options.redactCensor)\n let record: LogRecord = {\n level: entry.level,\n message: entry.message,\n ...(fields && Object.keys(fields).length > 0 ? { fields } : {}),\n at: entry.at,\n context: entry.context,\n }\n const originalBytes = serializedBytes(record)\n if (originalBytes <= options.maxBytes) {\n return record\n }\n\n record = {\n ...record,\n fields: { sixb_truncated: true, originalBytes },\n }\n if (serializedBytes(record) <= options.maxBytes) {\n return record\n }\n\n const characters = Array.from(record.message)\n let low = 0\n let high = characters.length\n while (low < high) {\n const middle = Math.ceil((low + high) / 2)\n const candidate = { ...record, message: characters.slice(0, middle).join(\"\") }\n if (serializedBytes(candidate) <= options.maxBytes) {\n low = middle\n } else {\n high = middle - 1\n }\n }\n return { ...record, message: characters.slice(0, low).join(\"\") }\n}\n\nexport function serializedBytes(value: unknown): number {\n return textEncoder.encode(JSON.stringify(value)).byteLength\n}\n\nfunction sanitizeFields(\n fields: LogFields | undefined,\n redactPaths: readonly string[],\n censor: JsonValue\n): LogFields | undefined {\n if (!fields) {\n return undefined\n }\n const reason = getInvalidJsonValueReason(fields, \"log fields\")\n if (reason) {\n return { sixb_unloggableFields: reason }\n }\n\n const copy = JSON.parse(JSON.stringify(fields)) as LogFields\n for (const configuredPath of redactPaths) {\n const path = configuredPath.startsWith(\"fields.\")\n ? configuredPath.slice(\"fields.\".length)\n : configuredPath\n redactPath(copy, path.split(\".\").filter(Boolean), censor)\n }\n return copy\n}\n\nfunction redactPath(target: JsonValue, path: readonly string[], censor: JsonValue): void {\n if (path.length === 0 || typeof target !== \"object\" || target === null) {\n return\n }\n const [head, ...tail] = path\n if (!head) {\n return\n }\n\n if (head === \"*\") {\n const values = Array.isArray(target) ? target : Object.values(target)\n if (tail.length === 0) {\n if (Array.isArray(target)) {\n target.fill(censor)\n } else {\n for (const key of Object.keys(target)) {\n target[key] = censor\n }\n }\n return\n }\n for (const value of values) {\n redactPath(value, tail, censor)\n }\n return\n }\n\n if (Array.isArray(target)) {\n const index = Number(head)\n if (!Number.isSafeInteger(index) || index < 0 || index >= target.length) {\n return\n }\n if (tail.length === 0) {\n target[index] = censor\n } else {\n redactPath(target[index]!, tail, censor)\n }\n return\n }\n\n if (!(head in target)) {\n return\n }\n if (tail.length === 0) {\n target[head] = censor\n } else {\n redactPath(target[head]!, tail, censor)\n }\n}\n",
|
|
8
8
|
"import type { JsonValue } from \"../json\"\nimport { sanitizeRecord, serializedBytes } from \"./record\"\nimport type {\n LogContext,\n LogEntry,\n LogFields,\n Logger,\n LoggerProvider,\n LogLevel,\n LogRecord,\n LogRunRef,\n} from \"./types\"\nimport { isLevelEnabled, normalizeLogError } from \"./types\"\n\n/** Publishes one ordered batch to the backing broker stream. */\nexport type LogPublisher = (records: readonly LogRecord[]) => Promise<void>\n\n/** @internal Fixed broker-capture safeguards for one execution. */\nexport interface RunLogCaptureOptions {\n readonly publish: LogPublisher\n readonly level: LogLevel\n readonly maxLinesPerExecution: number\n readonly maxRecordBytes: number\n readonly maxBufferedBytes: number\n readonly batchMaxRecords: number\n readonly batchMaxBytes: number\n readonly batchMaxDelayMs: number\n readonly redactPaths: readonly string[]\n readonly redactCensor: JsonValue\n}\n\n/** @internal Dependencies used to create one execution-scoped log session. */\nexport interface RunLogSessionOptions {\n readonly run: LogRunRef\n readonly provider: LoggerProvider\n readonly capture?: RunLogCaptureOptions\n}\n\ntype EmitLog = (\n level: LogLevel,\n message: string,\n fields: LogFields | undefined,\n context: Omit<LogContext, \"run\">\n) => void\n\n/**\n * Internal state and lifecycle for every handler logger created during one worker execution.\n *\n * Handler loggers are immutable views over this session. They all share its capture quota,\n * ordered broker queue, and final flush boundary.\n */\nexport class RunLogSession {\n readonly logger: Logger\n\n private captured = 0\n private droppedByLineLimit = 0\n private droppedByBackpressure = 0\n private pending: Array<{ readonly record: LogRecord; readonly bytes: number }> = []\n private pendingBytes = 0\n private bufferedBytes = 0\n private pumpPromise: Promise<void> | undefined\n private flushPromise: Promise<void> | undefined\n private flushTimer: ReturnType<typeof setTimeout> | undefined\n private captureClosed = false\n private providerFailureReported = false\n private publisherFailureReported = false\n\n private readonly emitFromContext: EmitLog = (level, message, fields, context) => {\n this.emit(level, message, fields, context)\n }\n\n constructor(private readonly options: RunLogSessionOptions) {\n this.logger = new ContextLogger(this.emitFromContext, {}, {})\n }\n\n /** Derive a handler logger with immutable framework-owned metadata. */\n withContext(context: Omit<LogContext, \"run\">): Logger {\n return new ContextLogger(this.emitFromContext, {}, { ...context })\n }\n\n /** Flush this execution's broker capture. It never flushes or closes the process provider. */\n flush(): Promise<void> {\n this.flushPromise ??= this.flushCapture()\n return this.flushPromise\n }\n\n private emit(\n level: LogLevel,\n message: string,\n fields: LogFields | undefined,\n context: Omit<LogContext, \"run\">\n ): void {\n const entry: LogEntry = {\n level,\n message,\n ...(fields && safeKeys(fields).length > 0 ? { fields } : {}),\n at: new Date().toISOString(),\n context: { ...context, run: this.options.run },\n }\n\n this.writeToProvider(entry)\n\n const capture = this.options.capture\n if (this.captureClosed || !capture || !isLevelEnabled(level, capture.level)) {\n return\n }\n\n if (this.captured >= capture.maxLinesPerExecution) {\n this.droppedByLineLimit += 1\n return\n }\n\n const record = sanitizeRecord(entry, {\n maxBytes: capture.maxRecordBytes,\n redactPaths: capture.redactPaths,\n redactCensor: capture.redactCensor,\n })\n const bytes = serializedBytes(record)\n\n if (this.bufferedBytes + bytes > capture.maxBufferedBytes) {\n this.droppedByBackpressure += 1\n return\n }\n\n this.captured += 1\n this.pending.push({ record, bytes })\n this.pendingBytes += bytes\n this.bufferedBytes += bytes\n\n if (\n this.pending.length >= capture.batchMaxRecords ||\n this.pendingBytes >= capture.batchMaxBytes\n ) {\n this.startPump()\n } else {\n this.scheduleFlush()\n }\n }\n\n private async flushCapture(): Promise<void> {\n this.captureClosed = true\n\n // Drain ordinary records first so the truncation marker cannot exceed the hard buffer bound.\n this.startPump()\n await this.drain()\n this.enqueueTruncationMarker()\n this.startPump()\n await this.drain()\n }\n\n private async drain(): Promise<void> {\n while (this.pumpPromise || this.pending.length > 0) {\n this.startPump()\n const pump = this.pumpPromise\n if (!pump) {\n return\n }\n await pump\n }\n }\n\n private writeToProvider(entry: LogEntry): void {\n try {\n this.options.provider.write(entry)\n } catch (error) {\n if (!this.providerFailureReported) {\n this.providerFailureReported = true\n reportLoggingFailure(\"output provider\", error)\n }\n }\n }\n\n private enqueueTruncationMarker(): void {\n const capture = this.options.capture\n const droppedLines = this.droppedByLineLimit + this.droppedByBackpressure\n if (droppedLines === 0 || !capture) {\n return\n }\n\n const marker = sanitizeRecord(\n {\n level: \"warn\",\n message: \"log truncated\",\n fields: {\n droppedLines,\n lineLimit: this.droppedByLineLimit,\n backpressure: this.droppedByBackpressure,\n },\n at: new Date().toISOString(),\n context: { run: this.options.run },\n },\n {\n maxBytes: capture.maxRecordBytes,\n redactPaths: [],\n redactCensor: capture.redactCensor,\n }\n )\n const bytes = serializedBytes(marker)\n if (bytes > capture.maxBufferedBytes) {\n reportLoggingFailure(\n \"broker capture\",\n new Error(\"The log truncation marker exceeds the internal capture buffer bound.\")\n )\n return\n }\n this.pending.push({ record: marker, bytes })\n this.pendingBytes += bytes\n this.bufferedBytes += bytes\n }\n\n private scheduleFlush(): void {\n if (this.flushTimer !== undefined) {\n return\n }\n const delay = this.options.capture?.batchMaxDelayMs\n if (delay === undefined) {\n return\n }\n this.flushTimer = setTimeout(() => {\n this.flushTimer = undefined\n this.startPump()\n }, delay)\n }\n\n private startPump(): void {\n if (this.flushTimer !== undefined) {\n clearTimeout(this.flushTimer)\n this.flushTimer = undefined\n }\n const publish = this.options.capture?.publish\n if (this.pending.length === 0 || !publish || this.pumpPromise) {\n return\n }\n\n this.pumpPromise = this.pump(publish).finally(() => {\n this.pumpPromise = undefined\n if (this.pending.length > 0) {\n this.startPump()\n }\n })\n }\n\n private async pump(publish: LogPublisher): Promise<void> {\n while (this.pending.length > 0) {\n const batch = this.takeBatch()\n try {\n await publish(batch.records)\n } catch (error) {\n if (!this.publisherFailureReported) {\n this.publisherFailureReported = true\n reportLoggingFailure(\"broker capture\", error)\n }\n } finally {\n this.bufferedBytes -= batch.bytes\n }\n }\n }\n\n private takeBatch(): { readonly records: readonly LogRecord[]; readonly bytes: number } {\n const capture = this.options.capture\n if (!capture) {\n return { records: [], bytes: 0 }\n }\n\n let count = 0\n let bytes = 0\n while (count < this.pending.length && count < capture.batchMaxRecords) {\n const next = this.pending[count]!\n if (count > 0 && bytes + next.bytes > capture.batchMaxBytes) {\n break\n }\n bytes += next.bytes\n count += 1\n }\n\n const items = this.pending.splice(0, count)\n this.pendingBytes -= bytes\n return { records: items.map((item) => item.record), bytes }\n }\n}\n\n/** Handler façade that binds user fields while preserving framework-owned context. */\nclass ContextLogger implements Logger {\n constructor(\n private readonly emit: EmitLog,\n private readonly fields: LogFields,\n private readonly context: Omit<LogContext, \"run\">\n ) {}\n\n debug(message: string, fields?: LogFields): void {\n this.safeEmit(\"debug\", message, fields)\n }\n\n info(message: string, fields?: LogFields): void {\n this.safeEmit(\"info\", message, fields)\n }\n\n warn(message: string, fields?: LogFields): void {\n this.safeEmit(\"warn\", message, fields)\n }\n\n error(message: string | Error, fields?: LogFields): void {\n try {\n const normalized = normalizeLogError(message, this.merge(fields))\n this.emit(\"error\", normalized.message, normalized.fields, this.context)\n } catch (error) {\n reportLoggingFailure(\"handler façade\", error)\n }\n }\n\n child(bindings: LogFields): Logger {\n try {\n return new ContextLogger(this.emit, { ...this.fields, ...bindings }, this.context)\n } catch (error) {\n reportLoggingFailure(\"handler façade\", error)\n return this\n }\n }\n\n private safeEmit(level: LogLevel, message: string, fields: LogFields | undefined): void {\n try {\n this.emit(level, message, this.merge(fields), this.context)\n } catch (error) {\n reportLoggingFailure(\"handler façade\", error)\n }\n }\n\n private merge(fields: LogFields | undefined): LogFields | undefined {\n if (!fields || safeKeys(fields).length === 0) {\n return safeKeys(this.fields).length > 0 ? this.fields : undefined\n }\n return { ...this.fields, ...fields }\n }\n}\n\nfunction safeKeys(value: object): string[] {\n try {\n return Object.keys(value)\n } catch {\n return []\n }\n}\n\nfunction reportLoggingFailure(destination: string, error: unknown): void {\n try {\n console.error(`[Sixb] Logging ${destination} failed:`, error)\n } catch {\n // Logging is best-effort and must never escape into project code.\n }\n}\n",
|
|
9
|
-
"import type { Broker, BrokerRecord, BrokerRetention, BrokerStreamDefinition } from \"../broker\"\nimport { getInvalidJsonValueReason, type JsonValue } from \"../json\"\nimport { noopLoggerProvider } from \"./console-logger\"\nimport { type LogPublisher, RunLogSession } from \"./run-logger\"\nimport {\n DEFAULT_LOG_BATCH_MAX_BYTES,\n DEFAULT_LOG_BATCH_MAX_DELAY_MS,\n DEFAULT_LOG_BATCH_MAX_RECORDS,\n DEFAULT_LOG_MAX_BUFFERED_BYTES,\n DEFAULT_LOGS_RETENTION,\n DEFAULT_MAX_LINES_PER_EXECUTION,\n DEFAULT_MAX_LOG_RECORD_BYTES,\n LOGS_STREAM,\n} from \"./stream\"\nimport {\n isLogRecord,\n LOG_LEVELS,\n type LoggerProvider,\n type LogLevel,\n type LogRecord,\n type LogRunRef,\n SIXB_RUN_KINDS,\n type SixbRunKind,\n type StoredLogLine,\n} from \"./types\"\n\nexport interface LogsPage {\n readonly lines: readonly StoredLogLine[]\n readonly cursor?: string\n readonly hasMore: boolean\n}\n\nexport interface LogsReadInput {\n readonly afterCursor?: string\n readonly limit?: number\n readonly kinds?: readonly SixbRunKind[]\n readonly levels?: readonly LogLevel[]\n readonly run?: LogRunRef\n}\n\nexport interface LogsTailInput {\n readonly beforeCursor?: string\n readonly limit?: number\n readonly kinds?: readonly SixbRunKind[]\n readonly levels?: readonly LogLevel[]\n readonly run?: LogRunRef\n}\n\nexport interface LogsSubscribeInput {\n readonly from?: \"latest\" | \"earliest\"\n readonly afterCursor?: string\n readonly kinds?: readonly SixbRunKind[]\n readonly levels?: readonly LogLevel[]\n readonly run?: LogRunRef\n}\n\nexport interface LogsObservabilityOptions {\n /** Forward handler logs to the broker. Defaults to `true`. */\n readonly enabled?: boolean\n /** Minimum level captured by the broker. Defaults to `\"info\"`. */\n readonly level?: LogLevel\n /** Retention overrides merged with the bounded defaults. */\n readonly retention?: BrokerRetention\n /** Captured lines per worker execution. Defaults to 10,000. */\n readonly maxLinesPerExecution?: number\n readonly redact?: {\n /** Dot paths relative to `fields` (an optional `fields.` prefix is accepted). */\n readonly paths: readonly string[]\n /** Replacement value. Defaults to `\"[REDACTED]\"`. */\n readonly censor?: JsonValue\n }\n}\n\nexport interface ObservabilityOptions {\n readonly logs?: LogsObservabilityOptions\n}\n\nexport interface LoggingServiceOptions {\n readonly projectId: string\n /** Broker backing the `__logs` stream. Absent means output-only logging. */\n readonly broker?: Broker\n /** Optional process-level output provider. Omit for broker-only logging. */\n readonly logger?: LoggerProvider\n readonly observability?: LogsObservabilityOptions\n /** Internal/testing stream override. */\n readonly stream?: BrokerStreamDefinition\n}\n\n/** Project-scoped logger factory and broker capture service. */\nexport class LoggingService {\n private readonly projectId: string\n private readonly broker?: Broker\n private readonly provider: LoggerProvider\n private readonly captureEnabled: boolean\n private readonly captureLevel: LogLevel\n private readonly maxLinesPerExecution: number\n private readonly redactPaths: readonly string[]\n private readonly redactCensor: JsonValue\n private readonly stream: BrokerStreamDefinition\n private ensureStreamPromise?: Promise<void>\n\n constructor(options: LoggingServiceOptions) {\n const config = options.observability ?? {}\n this.projectId = options.projectId\n this.broker = options.broker\n this.provider = options.logger ?? noopLoggerProvider\n this.captureEnabled = config.enabled ?? true\n this.captureLevel = logLevel(config.level ?? \"info\", \"observability.logs.level\")\n this.maxLinesPerExecution = nonNegativeInteger(\n config.maxLinesPerExecution ?? DEFAULT_MAX_LINES_PER_EXECUTION,\n \"observability.logs.maxLinesPerExecution\"\n )\n this.redactPaths = normalizeRedactPaths(config.redact?.paths ?? [])\n this.redactCensor = config.redact?.censor ?? \"[REDACTED]\"\n const censorReason = getInvalidJsonValueReason(\n this.redactCensor,\n \"observability.logs.redact.censor\"\n )\n if (censorReason) {\n throw new TypeError(censorReason)\n }\n\n this.stream =\n options.stream ??\n ({\n ...LOGS_STREAM,\n retention: mergeLogsRetention(config.retention),\n } satisfies BrokerStreamDefinition)\n }\n\n /** Start the single logger session owned by one worker execution. */\n startExecution(run: LogRunRef): RunLogSession {\n const publish = this.publisher()\n return new RunLogSession({\n run,\n provider: this.provider,\n capture: publish\n ? {\n publish,\n level: this.captureLevel,\n maxLinesPerExecution: this.maxLinesPerExecution,\n maxRecordBytes: DEFAULT_MAX_LOG_RECORD_BYTES,\n maxBufferedBytes: DEFAULT_LOG_MAX_BUFFERED_BYTES,\n batchMaxRecords: DEFAULT_LOG_BATCH_MAX_RECORDS,\n batchMaxBytes: DEFAULT_LOG_BATCH_MAX_BYTES,\n batchMaxDelayMs: DEFAULT_LOG_BATCH_MAX_DELAY_MS,\n redactPaths: this.redactPaths,\n redactCensor: this.redactCensor,\n }\n : undefined,\n })\n }\n\n async read(input: LogsReadInput = {}): Promise<LogsPage> {\n if (!this.broker || (input.limit !== undefined && input.limit <= 0)) {\n return { lines: [], cursor: input.afterCursor, hasMore: false }\n }\n await this.ensureStream()\n const page = await this.broker.read({\n projectId: this.projectId,\n streamId: this.stream.id,\n afterCursor: input.afterCursor,\n limit: input.limit,\n names: logRecordNames(input.kinds, input.levels, input.run),\n keys: input.run ? [`${input.run.kind}:${input.run.id}`] : undefined,\n })\n return {\n lines: page.records.map(hydrateLogRecord),\n cursor: page.cursor,\n hasMore: page.hasMore,\n }\n }\n\n async tail(input: LogsTailInput = {}): Promise<LogsPage> {\n if (!this.broker || (input.limit !== undefined && input.limit <= 0)) {\n return { lines: [], cursor: input.beforeCursor, hasMore: false }\n }\n await this.ensureStream()\n const page = await this.broker.tail({\n projectId: this.projectId,\n streamId: this.stream.id,\n beforeCursor: input.beforeCursor,\n limit: input.limit,\n names: logRecordNames(input.kinds, input.levels, input.run),\n keys: input.run ? [`${input.run.kind}:${input.run.id}`] : undefined,\n })\n return {\n lines: page.records.map(hydrateLogRecord),\n cursor: page.cursor,\n hasMore: page.hasMore,\n }\n }\n\n async subscribe(\n input: LogsSubscribeInput,\n handler: (lines: readonly StoredLogLine[]) => void\n ): Promise<() => void> {\n const broker = this.broker\n if (!broker) {\n return () => undefined\n }\n await this.ensureStream()\n return broker.subscribe(\n {\n projectId: this.projectId,\n streamId: this.stream.id,\n from: input.from,\n afterCursor: input.afterCursor,\n names: logRecordNames(input.kinds, input.levels, input.run),\n keys: input.run ? [`${input.run.kind}:${input.run.id}`] : undefined,\n },\n (records) => {\n const lines = records.map(hydrateLogRecord)\n if (lines.length === 0) return\n try {\n handler(lines)\n } catch {\n // Subscriber failures never break broker delivery.\n }\n }\n )\n }\n\n /** Flush the process provider. Execution sessions never call this globally. */\n async flush(): Promise<void> {\n await this.provider.flush?.()\n }\n\n /** Close the process provider. Lifecycle ownership stays outside handler loggers. */\n async close(): Promise<void> {\n if (this.provider.close) {\n await this.provider.close()\n return\n }\n await this.provider.flush?.()\n }\n\n private publisher(): LogPublisher | undefined {\n const broker = this.broker\n if (!broker || !this.captureEnabled) {\n return undefined\n }\n return async (records) => {\n await this.ensureStream()\n await broker.append({\n projectId: this.projectId,\n streamId: this.stream.id,\n records: records.map((record) => ({\n name: `${record.context.run.kind}.${record.level}`,\n key: `${record.context.run.kind}:${record.context.run.id}`,\n payload: record as unknown as JsonValue,\n })),\n })\n }\n }\n\n private ensureStream(): Promise<void> {\n const broker = this.broker\n if (!broker) {\n return Promise.resolve()\n }\n if (!this.ensureStreamPromise) {\n this.ensureStreamPromise = broker\n .ensureStream({ projectId: this.projectId, stream: this.stream })\n .catch((error) => {\n this.ensureStreamPromise = undefined\n throw error\n })\n }\n return this.ensureStreamPromise\n }\n}\n\n/** Resolve the logging service, falling back to a silent output-only service. */\nexport function resolveLoggingService(projectId: string, logging?: LoggingService): LoggingService {\n return logging ?? new LoggingService({ projectId, logger: noopLoggerProvider })\n}\n\nfunction normalizeRedactPaths(paths: readonly string[]): readonly string[] {\n const normalized = new Set<string>()\n for (const path of paths) {\n if (typeof path !== \"string\" || path.trim().length === 0) {\n throw new TypeError(\"observability.logs.redact.paths must contain non-empty strings\")\n }\n normalized.add(path.trim())\n }\n return [...normalized]\n}\n\nfunction mergeLogsRetention(retention: BrokerRetention | undefined): BrokerRetention {\n return {\n maxAgeMs: nonNegativeInteger(\n retention?.maxAgeMs ?? DEFAULT_LOGS_RETENTION.maxAgeMs,\n \"observability.logs.retention.maxAgeMs\"\n ),\n maxRecords: nonNegativeInteger(\n retention?.maxRecords ?? DEFAULT_LOGS_RETENTION.maxRecords,\n \"observability.logs.retention.maxRecords\"\n ),\n maxBytes: nonNegativeInteger(\n retention?.maxBytes ?? DEFAULT_LOGS_RETENTION.maxBytes,\n \"observability.logs.retention.maxBytes\"\n ),\n }\n}\n\nfunction logLevel(value: LogLevel, path: string): LogLevel {\n if (value !== \"debug\" && value !== \"info\" && value !== \"warn\" && value !== \"error\") {\n throw new TypeError(`${path} must be one of: debug, info, warn, error`)\n }\n return value\n}\n\nfunction nonNegativeInteger(value: number, path: string): number {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new TypeError(`${path} must be a non-negative safe integer`)\n }\n return value\n}\n\nfunction logRecordNames(\n kinds: readonly SixbRunKind[] | undefined,\n levels: readonly LogLevel[] | undefined,\n run: LogRunRef | undefined\n): readonly string[] | undefined {\n const selectedKinds = run ? [run.kind] : kinds\n if ((!selectedKinds || selectedKinds.length === 0) && (!levels || levels.length === 0)) {\n return undefined\n }\n const resolvedKinds = selectedKinds && selectedKinds.length > 0 ? selectedKinds : SIXB_RUN_KINDS\n const resolvedLevels = levels && levels.length > 0 ? levels : LOG_LEVELS\n return resolvedKinds.flatMap((kind) => resolvedLevels.map((level) => `${kind}.${level}`))\n}\n\nfunction hydrateLogRecord(record: BrokerRecord): StoredLogLine {\n const payload = record.payload\n if (!isLogRecord(payload)) {\n throw new Error(`[Sixb] Broker record at cursor '${record.cursor}' is not a log line.`)\n }\n return { ...(payload as LogRecord), cursor: record.cursor }\n}\n"
|
|
9
|
+
"import type { Broker, BrokerRecord, BrokerRetention, BrokerStreamDefinition } from \"../broker\"\nimport { getInvalidJsonValueReason, type JsonValue } from \"../json\"\nimport { noopLoggerProvider } from \"./console-logger\"\nimport { type LogPublisher, RunLogSession } from \"./run-logger\"\nimport {\n DEFAULT_LOG_BATCH_MAX_BYTES,\n DEFAULT_LOG_BATCH_MAX_DELAY_MS,\n DEFAULT_LOG_BATCH_MAX_RECORDS,\n DEFAULT_LOG_MAX_BUFFERED_BYTES,\n DEFAULT_LOGS_RETENTION,\n DEFAULT_MAX_LINES_PER_EXECUTION,\n DEFAULT_MAX_LOG_RECORD_BYTES,\n LOGS_STREAM,\n} from \"./stream\"\nimport {\n isLogRecord,\n LOG_LEVELS,\n type LoggerProvider,\n type LogLevel,\n type LogRecord,\n type LogRunRef,\n SIXB_RUN_KINDS,\n type SixbRunKind,\n type StoredLogLine,\n} from \"./types\"\n\nexport interface LogsPage {\n readonly lines: readonly StoredLogLine[]\n readonly cursor?: string\n readonly hasMore: boolean\n}\n\nexport interface LogsReadInput {\n readonly afterCursor?: string\n readonly limit?: number\n readonly kinds?: readonly SixbRunKind[]\n readonly levels?: readonly LogLevel[]\n readonly run?: LogRunRef\n}\n\nexport interface LogsTailInput {\n readonly beforeCursor?: string\n readonly limit?: number\n readonly kinds?: readonly SixbRunKind[]\n readonly levels?: readonly LogLevel[]\n readonly run?: LogRunRef\n}\n\nexport interface LogsSubscribeInput {\n readonly from?: \"latest\" | \"earliest\"\n readonly afterCursor?: string\n readonly kinds?: readonly SixbRunKind[]\n readonly levels?: readonly LogLevel[]\n readonly run?: LogRunRef\n}\n\nexport interface LogsObservabilityOptions {\n /** Forward handler logs to the broker. Defaults to `true`. */\n readonly enabled?: boolean\n /** Minimum level captured by the broker. Defaults to `\"info\"`. */\n readonly level?: LogLevel\n /** Retention overrides merged with the bounded defaults. */\n readonly retention?: BrokerRetention\n /** Captured lines per worker execution. Defaults to 10,000. */\n readonly maxLinesPerExecution?: number\n readonly redact?: {\n /** Dot paths relative to `fields` (an optional `fields.` prefix is accepted). */\n readonly paths: readonly string[]\n /** Replacement value. Defaults to `\"[REDACTED]\"`. */\n readonly censor?: JsonValue\n }\n}\n\nexport interface ObservabilityOptions {\n readonly logs?: LogsObservabilityOptions\n}\n\nexport interface LoggingServiceOptions {\n readonly projectId: string\n /** Broker backing the `__logs` stream. Absent means output-only logging. */\n readonly broker?: Broker\n /** Optional process-level output provider. Omit for broker-only logging. */\n readonly logger?: LoggerProvider\n readonly observability?: LogsObservabilityOptions\n /** Internal/testing stream override. */\n readonly stream?: BrokerStreamDefinition\n}\n\n/** Project-scoped logger factory and broker capture service. */\nexport class LoggingService {\n private readonly projectId: string\n private readonly broker?: Broker\n private readonly provider: LoggerProvider\n private readonly captureEnabled: boolean\n private readonly captureLevel: LogLevel\n private readonly maxLinesPerExecution: number\n private readonly redactPaths: readonly string[]\n private readonly redactCensor: JsonValue\n private readonly stream: BrokerStreamDefinition\n private ensureStreamPromise?: Promise<void>\n\n constructor(options: LoggingServiceOptions) {\n const config = options.observability ?? {}\n this.projectId = options.projectId\n this.broker = options.broker\n this.provider = options.logger ?? noopLoggerProvider\n this.captureEnabled = config.enabled ?? true\n this.captureLevel = logLevel(config.level ?? \"info\", \"observability.logs.level\")\n this.maxLinesPerExecution = nonNegativeInteger(\n config.maxLinesPerExecution ?? DEFAULT_MAX_LINES_PER_EXECUTION,\n \"observability.logs.maxLinesPerExecution\"\n )\n this.redactPaths = normalizeRedactPaths(config.redact?.paths ?? [])\n this.redactCensor = config.redact?.censor ?? \"[REDACTED]\"\n const censorReason = getInvalidJsonValueReason(\n this.redactCensor,\n \"observability.logs.redact.censor\"\n )\n if (censorReason) {\n throw new TypeError(censorReason)\n }\n\n this.stream =\n options.stream ??\n ({\n ...LOGS_STREAM,\n retention: mergeLogsRetention(config.retention),\n } satisfies BrokerStreamDefinition)\n }\n\n /** Start the single logger session owned by one worker execution. */\n startExecution(run: LogRunRef): RunLogSession {\n const publish = this.publisher()\n return new RunLogSession({\n run,\n provider: this.provider,\n capture: publish\n ? {\n publish,\n level: this.captureLevel,\n maxLinesPerExecution: this.maxLinesPerExecution,\n maxRecordBytes: DEFAULT_MAX_LOG_RECORD_BYTES,\n maxBufferedBytes: DEFAULT_LOG_MAX_BUFFERED_BYTES,\n batchMaxRecords: DEFAULT_LOG_BATCH_MAX_RECORDS,\n batchMaxBytes: DEFAULT_LOG_BATCH_MAX_BYTES,\n batchMaxDelayMs: DEFAULT_LOG_BATCH_MAX_DELAY_MS,\n redactPaths: this.redactPaths,\n redactCensor: this.redactCensor,\n }\n : undefined,\n })\n }\n\n async read(input: LogsReadInput = {}): Promise<LogsPage> {\n if (!this.broker || (input.limit !== undefined && input.limit <= 0)) {\n return { lines: [], cursor: input.afterCursor, hasMore: false }\n }\n await this.ensureStream()\n const page = await this.broker.read({\n projectId: this.projectId,\n streamId: this.stream.id,\n afterCursor: input.afterCursor,\n limit: input.limit,\n names: logRecordNames(input.kinds, input.levels, input.run),\n keys: input.run ? [`${input.run.kind}:${input.run.id}`] : undefined,\n })\n return {\n lines: page.records.map(hydrateLogRecord),\n cursor: page.cursor,\n hasMore: page.hasMore,\n }\n }\n\n async tail(input: LogsTailInput = {}): Promise<LogsPage> {\n if (!this.broker || (input.limit !== undefined && input.limit <= 0)) {\n return { lines: [], cursor: input.beforeCursor, hasMore: false }\n }\n await this.ensureStream()\n const page = await this.broker.tail({\n projectId: this.projectId,\n streamId: this.stream.id,\n beforeCursor: input.beforeCursor,\n limit: input.limit,\n names: logRecordNames(input.kinds, input.levels, input.run),\n keys: input.run ? [`${input.run.kind}:${input.run.id}`] : undefined,\n })\n return {\n lines: page.records.map(hydrateLogRecord),\n cursor: page.cursor,\n hasMore: page.hasMore,\n }\n }\n\n async subscribe(\n input: LogsSubscribeInput,\n handler: (lines: readonly StoredLogLine[]) => void\n ): Promise<() => void> {\n const broker = this.broker\n if (!broker) {\n return () => undefined\n }\n await this.ensureStream()\n return broker.subscribe(\n {\n projectId: this.projectId,\n streamId: this.stream.id,\n from: input.from,\n afterCursor: input.afterCursor,\n names: logRecordNames(input.kinds, input.levels, input.run),\n keys: input.run ? [`${input.run.kind}:${input.run.id}`] : undefined,\n },\n (records) => {\n const lines = records.map(hydrateLogRecord)\n if (lines.length === 0) return\n try {\n return handler(lines)\n } catch {\n // Subscriber failures never break broker delivery.\n }\n }\n )\n }\n\n /** Flush the process provider. Execution sessions never call this globally. */\n async flush(): Promise<void> {\n await this.provider.flush?.()\n }\n\n /** Close the process provider. Lifecycle ownership stays outside handler loggers. */\n async close(): Promise<void> {\n if (this.provider.close) {\n await this.provider.close()\n return\n }\n await this.provider.flush?.()\n }\n\n private publisher(): LogPublisher | undefined {\n const broker = this.broker\n if (!broker || !this.captureEnabled) {\n return undefined\n }\n return async (records) => {\n await this.ensureStream()\n await broker.append({\n projectId: this.projectId,\n streamId: this.stream.id,\n records: records.map((record) => ({\n name: `${record.context.run.kind}.${record.level}`,\n key: `${record.context.run.kind}:${record.context.run.id}`,\n payload: record as unknown as JsonValue,\n })),\n })\n }\n }\n\n private ensureStream(): Promise<void> {\n const broker = this.broker\n if (!broker) {\n return Promise.resolve()\n }\n if (!this.ensureStreamPromise) {\n this.ensureStreamPromise = broker\n .ensureStream({ projectId: this.projectId, stream: this.stream })\n .catch((error) => {\n this.ensureStreamPromise = undefined\n throw error\n })\n }\n return this.ensureStreamPromise\n }\n}\n\n/** Resolve the logging service, falling back to a silent output-only service. */\nexport function resolveLoggingService(projectId: string, logging?: LoggingService): LoggingService {\n return logging ?? new LoggingService({ projectId, logger: noopLoggerProvider })\n}\n\nfunction normalizeRedactPaths(paths: readonly string[]): readonly string[] {\n const normalized = new Set<string>()\n for (const path of paths) {\n if (typeof path !== \"string\" || path.trim().length === 0) {\n throw new TypeError(\"observability.logs.redact.paths must contain non-empty strings\")\n }\n normalized.add(path.trim())\n }\n return [...normalized]\n}\n\nfunction mergeLogsRetention(retention: BrokerRetention | undefined): BrokerRetention {\n return {\n maxAgeMs: nonNegativeInteger(\n retention?.maxAgeMs ?? DEFAULT_LOGS_RETENTION.maxAgeMs,\n \"observability.logs.retention.maxAgeMs\"\n ),\n maxRecords: nonNegativeInteger(\n retention?.maxRecords ?? DEFAULT_LOGS_RETENTION.maxRecords,\n \"observability.logs.retention.maxRecords\"\n ),\n maxBytes: nonNegativeInteger(\n retention?.maxBytes ?? DEFAULT_LOGS_RETENTION.maxBytes,\n \"observability.logs.retention.maxBytes\"\n ),\n }\n}\n\nfunction logLevel(value: LogLevel, path: string): LogLevel {\n if (value !== \"debug\" && value !== \"info\" && value !== \"warn\" && value !== \"error\") {\n throw new TypeError(`${path} must be one of: debug, info, warn, error`)\n }\n return value\n}\n\nfunction nonNegativeInteger(value: number, path: string): number {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new TypeError(`${path} must be a non-negative safe integer`)\n }\n return value\n}\n\nfunction logRecordNames(\n kinds: readonly SixbRunKind[] | undefined,\n levels: readonly LogLevel[] | undefined,\n run: LogRunRef | undefined\n): readonly string[] | undefined {\n const selectedKinds = run ? [run.kind] : kinds\n if ((!selectedKinds || selectedKinds.length === 0) && (!levels || levels.length === 0)) {\n return undefined\n }\n const resolvedKinds = selectedKinds && selectedKinds.length > 0 ? selectedKinds : SIXB_RUN_KINDS\n const resolvedLevels = levels && levels.length > 0 ? levels : LOG_LEVELS\n return resolvedKinds.flatMap((kind) => resolvedLevels.map((level) => `${kind}.${level}`))\n}\n\nfunction hydrateLogRecord(record: BrokerRecord): StoredLogLine {\n const payload = record.payload\n if (!isLogRecord(payload)) {\n throw new Error(`[Sixb] Broker record at cursor '${record.cursor}' is not a log line.`)\n }\n return { ...(payload as LogRecord), cursor: record.cursor }\n}\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;AAcA,IAAM,iBAAwE;AAAA,EAC5E,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AACT;AAAA;AAGO,MAAM,eAAwC;AAAA,EAC1C;AAAA,EAET,WAAW,CAAC,UAAgC,CAAC,GAAG;AAAA,IAC9C,KAAK,QAAQ,QAAQ,SAAS;AAAA;AAAA,EAGhC,KAAK,CAAC,OAAuB;AAAA,IAC3B,IAAI,CAAC,gBAAe,MAAM,OAAO,KAAK,KAAK,GAAG;AAAA,MAC5C;AAAA,IACF;AAAA,IAEA,IAAI,SAAS;AAAA,IACb,IAAI;AAAA,MACF,SAAS,IAAI,KAAK,UAAU;AAAA,WACtB,MAAM,UAAU,CAAC;AAAA,QACrB,MAAM,MAAM;AAAA,MACd,CAAC;AAAA,MACD,MAAM;AAAA,MACN,SAAS,IAAI,KAAK,UAAU,EAAE,MAAM,MAAM,SAAS,uBAAuB,KAAK,CAAC;AAAA;AAAA,IAGlF,QAAQ,eAAe,MAAM,QAAQ,GAAG,MAAM,MAAM,YAAY,KAAK,MAAM,UAAU,QAAQ;AAAA;AAEjG;AAGO,IAAM,sBAAqC;AAAA,EAChD,KAAK,GAAG;AACV;AAGO,IAAM,cAAqB;AAAA,EAChC,KAAK,GAAG;AAAA,EACR,IAAI,GAAG;AAAA,EACP,IAAI,GAAG;AAAA,EACP,KAAK,GAAG;AAAA,EACR,KAAK,GAAG;AAAA,IACN,OAAO;AAAA;AAEX;;;AC3DA,IAA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