@sixb/core 0.1.9 → 0.1.11
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 +9 -9
- package/dist/agents/index.js +17 -16
- package/dist/agents/index.js.map +1 -1
- package/dist/blob-storage/types.d.ts +4 -1
- package/dist/blob-storage/types.d.ts.map +1 -1
- package/dist/bootstrap/index.js +21 -20
- 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-ypbtykv6.js → chunk-01kj2pbh.js} +1 -1
- package/dist/{chunk-k3cqkkn2.js → chunk-1824gssz.js} +30 -65
- package/dist/chunk-1824gssz.js.map +12 -0
- package/dist/{chunk-xyr8kppc.js → chunk-1yefycb1.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-m3z3x9v0.js → chunk-3ckk0xfj.js} +2 -2
- 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-52hbv0ak.js → chunk-4zhmdsx6.js} +141 -55
- package/dist/chunk-4zhmdsx6.js.map +36 -0
- package/dist/{chunk-zcnq6105.js → chunk-85cd7e8c.js} +2 -1
- package/dist/chunk-85cd7e8c.js.map +10 -0
- package/dist/{chunk-3f7veca0.js → chunk-9x8dybsb.js} +3 -3
- package/dist/chunk-9x8dybsb.js.map +10 -0
- package/dist/{chunk-0w35wavj.js → chunk-a0e6x5hd.js} +1 -1
- package/dist/{chunk-r29fxdhn.js → chunk-aa6z4a19.js} +160 -44
- package/dist/chunk-aa6z4a19.js.map +12 -0
- package/dist/{chunk-emyyk7dx.js → chunk-cfvakeax.js} +22 -145
- package/dist/chunk-cfvakeax.js.map +12 -0
- package/dist/chunk-d62kjtbg.js.map +1 -1
- package/dist/{chunk-h1gfhhbh.js → chunk-d63nnr5b.js} +2 -2
- package/dist/{chunk-r4tfx1sf.js → chunk-fh8kgex1.js} +5 -5
- 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-jjy0fhrn.js → chunk-g91qxjj0.js} +20 -3
- package/dist/chunk-g91qxjj0.js.map +12 -0
- package/dist/{chunk-hpr1r6av.js → chunk-gq8vhakp.js} +51 -40
- package/dist/{chunk-hpr1r6av.js.map → chunk-gq8vhakp.js.map} +6 -6
- 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-mjbk2djy.js → chunk-gqm76kse.js} +231 -125
- package/dist/{chunk-mjbk2djy.js.map → chunk-gqm76kse.js.map} +9 -8
- package/dist/{chunk-e0d1rzef.js → chunk-jsy70480.js} +16 -3
- package/dist/chunk-jsy70480.js.map +15 -0
- package/dist/{chunk-0rdrecsb.js → chunk-kfee1h52.js} +116 -32
- package/dist/chunk-kfee1h52.js.map +13 -0
- package/dist/{chunk-3frsnm7x.js → chunk-qma80ych.js} +4 -6
- package/dist/chunk-qma80ych.js.map +11 -0
- package/dist/{chunk-vf691g1r.js → chunk-sepyxgpc.js} +3 -3
- package/dist/chunk-v2vcg0w6.js +151 -0
- package/dist/chunk-v2vcg0w6.js.map +11 -0
- package/dist/{chunk-3tgwrcyh.js → chunk-wf88w4kp.js} +17 -23
- package/dist/chunk-wf88w4kp.js.map +14 -0
- package/dist/{chunk-xfbydgzy.js → chunk-x9m9x2eq.js} +7 -8
- package/dist/{chunk-xfbydgzy.js.map → chunk-x9m9x2eq.js.map} +3 -3
- package/dist/{chunk-qhcpj9wc.js → chunk-z0271qkp.js} +98 -2
- package/dist/chunk-z0271qkp.js.map +15 -0
- package/dist/{chunk-1enhpacz.js → chunk-z0s4axeh.js} +6 -6
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/command-context.d.ts +2 -0
- package/dist/connectors/connections/command-context.d.ts.map +1 -1
- package/dist/connectors/connections/contracts.d.ts +4 -1
- package/dist/connectors/connections/contracts.d.ts.map +1 -1
- package/dist/connectors/connections/execution.d.ts +1 -0
- package/dist/connectors/connections/execution.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 +1 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +2 -0
- package/dist/connectors/connections/service.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/outbox-dispatcher.d.ts +2 -2
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/service.d.ts +2 -2
- package/dist/events/service.d.ts.map +1 -1
- package/dist/execution/agent.js +17 -16
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +17 -16
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +17 -16
- 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 +31 -29
- 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 +38 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/logging/internal.js +1 -1
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/maintenance/types.d.ts +1 -1
- package/dist/maintenance/types.d.ts.map +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 +6 -6
- 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/definitions.d.ts +7 -0
- package/dist/models/definitions.d.ts.map +1 -1
- package/dist/models/execution/index.js +6 -6
- package/dist/models/index.js +1 -1
- package/dist/objects/index.js +10 -10
- package/dist/objects/query/index.js +6 -6
- package/dist/pipelines/index.js +7 -7
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/projections/internal.js +7 -9
- 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 +5 -5
- package/dist/storage/agents/provider.js +1 -1
- package/dist/storage/connector-connections/in-memory.d.ts +1 -0
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/connections.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/runs.d.ts +1 -0
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/shared.d.ts +1 -0
- package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.d.ts +1 -0
- package/dist/storage/connector-connections/provider.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +11 -17
- package/dist/storage/connector-connections/provider.js.map +6 -6
- package/dist/storage/connector-connections/types.d.ts +6 -3
- 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 +5 -5
- 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/outbox.d.ts +1 -0
- package/dist/storage/ontology/outbox.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 +9 -8
- 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 +1499 -963
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/lake-changes-contract.d.ts +6 -0
- package/dist/testing/lake-changes-contract.d.ts.map +1 -0
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- 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 +55 -10
- 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 +18 -17
- 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/agents/model-loop.ts +7 -0
- package/src/blob-storage/types.ts +4 -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/command-context.ts +21 -4
- package/src/connectors/connections/contracts.ts +7 -1
- package/src/connectors/connections/execution.ts +3 -0
- package/src/connectors/connections/request.ts +56 -22
- package/src/connectors/connections/runs.ts +39 -1
- package/src/connectors/connections/service.ts +6 -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/outbox-dispatcher.ts +20 -26
- 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 +75 -0
- package/src/lake-storage/index.ts +4 -0
- package/src/lake-storage/types.ts +42 -0
- package/src/logging/service.ts +1 -1
- package/src/maintenance/ontology-maintenance.ts +6 -2
- package/src/maintenance/types.ts +1 -1
- package/src/materialization/index.ts +2 -0
- package/src/materialization/model.ts +14 -1
- package/src/materializer/README.md +1 -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/models/definitions.ts +19 -0
- package/src/models/pricing.ts +6 -2
- 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 +19 -19
- package/src/storage/connector-connections/provider/connections.ts +1 -15
- package/src/storage/connector-connections/provider/runs.ts +9 -1
- package/src/storage/connector-connections/provider/shared.ts +2 -3
- package/src/storage/connector-connections/provider.ts +6 -0
- package/src/storage/connector-connections/types.ts +8 -3
- 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 +36 -4
- 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/outbox.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 +29 -12
- package/src/testing/index.ts +1 -0
- package/src/testing/lake-changes-contract.ts +240 -0
- package/src/testing/lake-storage-contract.ts +29 -0
- package/src/testing/materializer-storage-contract.ts +172 -1
- package/src/testing/ontology-storage-contract.ts +15 -3
- 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-3tgwrcyh.js.map +0 -14
- package/dist/chunk-52hbv0ak.js.map +0 -36
- package/dist/chunk-e0d1rzef.js.map +0 -15
- 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-ypbtykv6.js.map → chunk-01kj2pbh.js.map} +0 -0
- /package/dist/{chunk-xyr8kppc.js.map → chunk-1yefycb1.js.map} +0 -0
- /package/dist/{chunk-m3z3x9v0.js.map → chunk-3ckk0xfj.js.map} +0 -0
- /package/dist/{chunk-0w35wavj.js.map → chunk-a0e6x5hd.js.map} +0 -0
- /package/dist/{chunk-h1gfhhbh.js.map → chunk-d63nnr5b.js.map} +0 -0
- /package/dist/{chunk-r4tfx1sf.js.map → chunk-fh8kgex1.js.map} +0 -0
- /package/dist/{chunk-vf691g1r.js.map → chunk-sepyxgpc.js.map} +0 -0
- /package/dist/{chunk-1enhpacz.js.map → chunk-z0s4axeh.js.map} +0 -0
|
@@ -24,6 +24,7 @@ function shareOntologyMutationRuntime2(source, target) {
|
|
|
24
24
|
}
|
|
25
25
|
function createOntologyMutationRuntime2(input) {
|
|
26
26
|
const runtime = {
|
|
27
|
+
getProjectionSource: (source) => input.materializer.projections.getActive(source),
|
|
27
28
|
commitEdits: (command) => commitAndNotify(() => input.materializer.edits.commit(command), input.notifyCommittedFacts),
|
|
28
29
|
replaceProjection: (command) => commitAndNotify(() => input.materializer.projections.replace(command), input.notifyCommittedFacts),
|
|
29
30
|
finishProjection: (command) => input.materializer.projections.finishRun(command),
|
|
@@ -47,4 +48,4 @@ function notifyWithoutAffectingCommit(notify) {
|
|
|
47
48
|
|
|
48
49
|
export { registerOntologyMutationRuntime2, getOntologyMutationRuntime2, shareOntologyMutationRuntime2, createOntologyMutationRuntime2 };
|
|
49
50
|
|
|
50
|
-
//# debugId=
|
|
51
|
+
//# debugId=F32DD2FCEBE55F1A64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/runtime/ontology-mutations.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type {\n EditCommitResult,\n OntologyEditCommit,\n ProjectionCommitResult,\n ProjectionRunFinishInput,\n ProjectionSourceRef,\n ProjectionSourceReplacement,\n TelemetryAppend,\n TelemetryCommitResult,\n} from \"../materialization/model\"\nimport type { BoundOntologyMaterializer } from \"../materializer\"\nimport type { OntologySourceRecord } from \"../storage/ontology\"\n\nexport interface OntologyMutationRuntime {\n getProjectionSource?(source: ProjectionSourceRef): Promise<OntologySourceRecord | null>\n commitEdits(input: OntologyEditCommit): Promise<EditCommitResult>\n replaceProjection(input: ProjectionSourceReplacement): Promise<ProjectionCommitResult>\n finishProjection(input: ProjectionRunFinishInput): Promise<void>\n appendTelemetry(input: TelemetryAppend): Promise<TelemetryCommitResult>\n}\n\nconst ontologyMutationRuntimeKey: unique symbol = Symbol(\"sixb.ontologyMutationRuntime\")\n\ninterface OntologyMutationRuntimeOwner {\n readonly [ontologyMutationRuntimeKey]?: OntologyMutationRuntime\n}\n\nexport function registerOntologyMutationRuntime(\n owner: object,\n runtime: OntologyMutationRuntime\n): void {\n const registered = (owner as OntologyMutationRuntimeOwner)[ontologyMutationRuntimeKey]\n if (registered && registered !== runtime) {\n throw new Error(\"[Sixb] Ontology mutation runtime is already registered for this owner.\")\n }\n Object.defineProperty(owner, ontologyMutationRuntimeKey, {\n configurable: false,\n enumerable: true,\n value: runtime,\n writable: false,\n })\n}\n\nexport function getOntologyMutationRuntime(owner: object): OntologyMutationRuntime {\n const runtime = (owner as OntologyMutationRuntimeOwner)[ontologyMutationRuntimeKey]\n if (runtime) return runtime\n throw new Error(\"[Sixb] Ontology mutation runtime is not registered for this runtime context.\")\n}\n\n/** Copies the opaque capability when an internal runtime context is reconstructed. */\nexport function shareOntologyMutationRuntime(source: object, target: object): void {\n registerOntologyMutationRuntime(target, getOntologyMutationRuntime(source))\n}\n\n/** Adapt an already-bound Materializer to the internal ontology mutation runtime. */\nexport function createOntologyMutationRuntime(input: {\n readonly materializer: BoundOntologyMaterializer\n readonly notifyCommittedFacts: () => void\n}): OntologyMutationRuntime {\n const runtime: OntologyMutationRuntime = {\n getProjectionSource: (source) => input.materializer.projections.getActive(source),\n commitEdits: (command) =>\n commitAndNotify(() => input.materializer.edits.commit(command), input.notifyCommittedFacts),\n replaceProjection: (command) =>\n commitAndNotify(\n () => input.materializer.projections.replace(command),\n input.notifyCommittedFacts\n ),\n finishProjection: (command) => input.materializer.projections.finishRun(command),\n appendTelemetry: (command) =>\n commitAndNotify(\n () => input.materializer.telemetry.append(command),\n input.notifyCommittedFacts\n ),\n }\n return Object.freeze(runtime)\n}\n\nasync function commitAndNotify<TResult extends { readonly eventCount: number }>(\n commit: () => Promise<TResult>,\n notify: () => void\n): Promise<TResult> {\n const result = await commit()\n if (result.eventCount > 0) notifyWithoutAffectingCommit(notify)\n return result\n}\n\nfunction notifyWithoutAffectingCommit(notify: () => void): void {\n try {\n notify()\n } catch (error) {\n // The ontology commit is already durable. A wake-up failure must never turn it into an apparent\n // mutation failure; API-hosted ontology maintenance remains the correctness fallback.\n console.error(\"[Sixb] Failed to wake the ontology outbox dispatcher:\", error)\n }\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAqBA,IAAM,6BAA4C,OAAO,8BAA8B;AAMhF,SAAS,gCAA+B,CAC7C,OACA,SACM;AAAA,EACN,MAAM,aAAc,MAAuC;AAAA,EAC3D,IAAI,cAAc,eAAe,SAAS;AAAA,IACxC,MAAM,IAAI,MAAM,wEAAwE;AAAA,EAC1F;A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1A64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -6,7 +6,7 @@ function isOAuthConnectorAdapter(value) {
|
|
|
6
6
|
function isOAuthConnectorDefinition2(value) {
|
|
7
7
|
return isOAuthConnectorAdapter(value.adapter);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function isStaticConnectorDefinition2(value) {
|
|
10
10
|
return !isOAuthConnectorDefinition2(value);
|
|
11
11
|
}
|
|
12
12
|
function isConnectorDefinition(value) {
|
|
@@ -28,6 +28,6 @@ function isRecord(value) {
|
|
|
28
28
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export { isOAuthConnectorAdapter, isOAuthConnectorDefinition2,
|
|
31
|
+
export { isOAuthConnectorAdapter, isOAuthConnectorDefinition2, isStaticConnectorDefinition2, isConnectorDefinition };
|
|
32
32
|
|
|
33
|
-
//# debugId=
|
|
33
|
+
//# debugId=A4070C2D57BB016C64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/connectors/types.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { ReadonlyJsonObject } from \"../json\"\nimport type { WebhookDefinition } from \"../webhooks/types\"\n\n/**\n * Runtime context passed to connector adapters when Sixb establishes a connection.\n *\n * Connectors can use this to scope logs, build cache keys, or attach cancellation\n * to long-running startup work.\n */\nexport interface ConnectorContext {\n readonly projectId: string\n readonly connectorId: string\n readonly signal: AbortSignal\n}\n\n/**\n * Minimal contract for a Sixb connector adapter.\n *\n * Adapters are responsible for creating and optionally tearing down a client for an\n * external system. They should return the client shape that feels natural for that system.\n */\nexport interface ConnectorAdapter<TType extends string = string, TClient = unknown> {\n readonly type: TType\n readonly authentication?: never\n readonly webhooks?: readonly WebhookDefinition<unknown, TClient>[]\n connect(context: ConnectorContext): Promise<TClient> | TClient\n disconnect?(client: TClient): Promise<void> | void\n}\n\n/** One OAuth token set normalized by an OAuth connector adapter. */\nexport interface ConnectorOAuthCredentials {\n readonly accessToken: string\n readonly refreshToken?: string\n readonly tokenType?: string\n readonly scopes?: readonly string[]\n readonly expiresAt?: Date\n /**\n * Provider-owned grant context, encrypted with the tokens and never exposed in connection views.\n * Available to account discovery, refresh, and revoke. Refresh preserves it when omitted;\n * returning an object replaces it (use {} to clear it). Code exchange starts fresh on reauthorization.\n */\n readonly authorizationContext?: ReadonlyJsonObject\n}\n\n/** Public, non-secret account information returned for framework-owned selection UI. */\nexport interface ConnectorAccountCandidate {\n readonly id: string\n readonly label: string\n readonly description?: string\n readonly avatarUrl?: string\n}\n\n/** V1 intentionally supports project-owned connector connections only. */\nexport interface ProjectConnectorConnectionOwner {\n readonly type: \"project\"\n}\n\nexport type ConnectorConnectionOwner = ProjectConnectorConnectionOwner\n\n/** Stable application-defined lookup key for one connector connection. */\nexport interface ConnectorConnectionSelector {\n readonly owner: ConnectorConnectionOwner\n readonly slot: string\n}\n\n/** Stable, non-secret metadata shared by connector connection consumers. */\nexport interface ConnectorConnectionMetadata extends ConnectorConnectionSelector {\n readonly id: string\n readonly connectorId: string\n readonly account: ConnectorAccountCandidate\n}\n\n/** Credential protection required when an OAuth connector uses durable connection storage. */\nexport interface ConnectorConnectionOptions {\n /** Canonical base64url encoding of exactly 32 random bytes, shared by storage replicas. */\n readonly encryptionKey: string\n}\n\nexport interface OAuthConnectorAuthorizationContext extends ConnectorContext {\n readonly redirectUri: string\n}\n\nexport interface OAuthConnectorAuthorizationUrlInput {\n readonly state: string\n /** Present only when the adapter enables PKCE (S256 by default). */\n readonly codeChallenge?: string\n readonly codeChallengeMethod?: \"S256\"\n}\n\nexport interface OAuthConnectorCodeExchangeInput {\n readonly code: string\n /** Present only when this authorization attempt used PKCE. */\n readonly codeVerifier?: string\n /** Allowlisted callback values. Untrusted until the adapter validates them with the provider. */\n readonly callbackParameters?: Readonly<Record<string, string>>\n}\n\nexport interface ConnectorConnectionClientContext extends ConnectorContext {\n readonly connectionId: string\n readonly account: ConnectorAccountCandidate\n readonly tokenSource: ConnectorTokenSource\n}\n\n/** One delivered token, bound to the credential revision that produced it. */\nexport interface ConnectorAccessToken {\n readonly accessToken: string\n readonly tokenType?: string\n /** Report this exact token as rejected so Sixb can refresh only its credential revision. */\n invalidate(): void\n}\n\n/** Live credential source owned by Sixb. Adapters must resolve a token for each request. */\nexport interface ConnectorTokenSource {\n get(): Promise<ConnectorAccessToken>\n}\n\n/**\n * OAuth-backed connector adapter. Sixb owns persistence, OAuth state, refresh coordination and UI;\n * the adapter owns provider protocol details and typed client creation.\n */\nexport interface ConnectorOAuth2Authentication {\n readonly type: \"oauth2\"\n /** Defaults to S256. Disable only for providers whose flow does not support PKCE. */\n readonly pkce?: \"S256\" | \"disabled\"\n /** Additional callback parameter names accepted by exchangeCode; framework OAuth fields are reserved. */\n readonly callbackParameters?: readonly string[]\n authorizationUrl(\n context: OAuthConnectorAuthorizationContext,\n input: OAuthConnectorAuthorizationUrlInput\n ): Promise<string | URL> | string | URL\n exchangeCode(\n context: OAuthConnectorAuthorizationContext,\n input: OAuthConnectorCodeExchangeInput\n ): Promise<ConnectorOAuthCredentials> | ConnectorOAuthCredentials\n refresh(\n context: ConnectorContext,\n credentials: ConnectorOAuthCredentials\n ): Promise<ConnectorOAuthCredentials> | ConnectorOAuthCredentials\n /**\n * Revokes the grant idempotently. An already revoked or invalid grant must resolve successfully\n * so Sixb can converge after losing an earlier provider response.\n */\n revoke?(context: ConnectorContext, credentials: ConnectorOAuthCredentials): Promise<void> | void\n}\n\nexport interface OAuthConnectorAdapter<TType extends string = string, TClient = unknown> {\n readonly type: TType\n readonly authentication: ConnectorOAuth2Authentication\n readonly webhooks?: readonly WebhookDefinition<unknown, TClient>[]\n discoverAccounts(\n context: ConnectorContext,\n credentials: ConnectorOAuthCredentials\n ): Promise<readonly ConnectorAccountCandidate[]> | readonly ConnectorAccountCandidate[]\n connect(context: ConnectorConnectionClientContext): Promise<TClient> | TClient\n}\n\nexport type AnyConnectorAdapter = ConnectorAdapter | OAuthConnectorAdapter\n\n/**\n * Inert connector definition registered with Sixb.\n *\n * Definitions are safe to export from `connectors/` modules. The runtime turns them into\n * live clients when `sixb.connector(...)` is called.\n */\nexport interface ConnectorDefinition<\n TId extends string = string,\n TAdapter extends AnyConnectorAdapter = AnyConnectorAdapter,\n> {\n readonly kind: \"connector\"\n readonly id: TId\n readonly adapter: TAdapter\n}\n\nexport type StaticConnectorDefinition = ConnectorDefinition<string, ConnectorAdapter>\n\n/** Infer the connected client type returned by a connector adapter. */\nexport type ConnectorClient<TAdapter extends AnyConnectorAdapter> = Awaited<\n ReturnType<TAdapter[\"connect\"]>\n>\n\nexport function isOAuthConnectorAdapter(\n value: AnyConnectorAdapter\n): value is OAuthConnectorAdapter {\n return \"authentication\" in value && value.authentication?.type === \"oauth2\"\n}\n\nexport function isOAuthConnectorDefinition(\n value: ConnectorDefinition\n): value is ConnectorDefinition<string, OAuthConnectorAdapter> {\n return isOAuthConnectorAdapter(value.adapter)\n}\n\nexport function isStaticConnectorDefinition(\n value: ConnectorDefinition\n): value is StaticConnectorDefinition {\n return !isOAuthConnectorDefinition(value)\n}\n\nexport function isConnectorDefinition(value: unknown): value is ConnectorDefinition {\n if (!isRecord(value)) {\n return false\n }\n\n const adapter = value.adapter\n if (\n value.kind === \"connector\" &&\n typeof value.id === \"string\" &&\n isRecord(adapter) &&\n typeof adapter.type === \"string\" &&\n typeof adapter.connect === \"function\"\n ) {\n if (adapter.authentication === undefined) return true\n const authentication = adapter.authentication\n if (!isRecord(authentication) || authentication.type !== \"oauth2\") return false\n return (\n typeof authentication.authorizationUrl === \"function\" &&\n typeof authentication.exchangeCode === \"function\" &&\n typeof authentication.refresh === \"function\" &&\n typeof adapter.discoverAccounts === \"function\"\n )\n }\n\n return false\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAoLO,SAAS,uBAAuB,CACrC,OACgC;AAAA,EAChC,OAAO,oBAAoB,SAAS,MAAM,gBAAgB,SAAS;AAAA;AAG9D,SAAS,2BAA0B,CACxC,OAC6D;AAAA,EAC7D,OAAO,wBAAwB,MAAM,OAAO;AAAA;AAGvC,SAAS,4BAA2B,CACzC,OACoC;AAAA,EACpC,OAAO,CAAC,4BAA2B,KAAK;AAAA;AAGnC,SAAS,qBAAqB,CAAC,OAA8C;AAAA,EAClF,IAAI,CAAC,SAAS,KAAK,GAAG;AAAA,IACpB,OAAO;AAAA,EACT;AAAA,EAEA,MAAM,UAAU,MAAM;AAAA,EACtB,IACE,MAAM,SAAS,eACf,OAAO,MAAM,OAAO,YACpB,SAAS,OAAO,KAChB,OAAO,QAAQ,SAAS,YACxB,OAAO,QAAQ,YAAY,YAC3B;AAAA,IACA,IAAI,QAAQ,mBAAmB;AAAA,MAAW,OAAO;AAAA,IACjD,MAAM,iBAAiB,QAAQ;AAAA,IAC/B,IAAI,CAAC,SAAS,cAAc,KAAK,eAAe,SAAS;AAAA,MAAU,OAAO;AAAA,IAC1E,OACE,OAAO,eAAe,qBAAqB,cAC3C,OAAO,eAAe,iBAAiB,cACvC,OAAO,eAAe,YAAY,cAClC,OAAO,QAAQ,qBAAqB;AAAA,EAExC;AAAA,EAEA,OAAO;AAAA;AAGT,SAAS,QAAQ,CAAC,OAAkD;AAAA,EAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAAA;",
|
|
8
|
+
"debugId": "A4070C2D57BB016C64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -5,6 +5,80 @@ class QueueError2 extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
// src/queues/in-memory.ts
|
|
7
7
|
import { randomUUID } from "crypto";
|
|
8
|
+
|
|
9
|
+
// src/queues/indexed-heap.ts
|
|
10
|
+
class IndexedHeap {
|
|
11
|
+
compare;
|
|
12
|
+
items = [];
|
|
13
|
+
positions = new Map;
|
|
14
|
+
constructor(compare) {
|
|
15
|
+
this.compare = compare;
|
|
16
|
+
}
|
|
17
|
+
peek() {
|
|
18
|
+
return this.items[0];
|
|
19
|
+
}
|
|
20
|
+
pop() {
|
|
21
|
+
const first = this.peek();
|
|
22
|
+
if (first !== undefined)
|
|
23
|
+
this.delete(first);
|
|
24
|
+
return first;
|
|
25
|
+
}
|
|
26
|
+
set(item) {
|
|
27
|
+
const index = this.positions.get(item);
|
|
28
|
+
if (index === undefined) {
|
|
29
|
+
this.positions.set(item, this.items.length);
|
|
30
|
+
this.items.push(item);
|
|
31
|
+
this.up(this.items.length - 1);
|
|
32
|
+
} else {
|
|
33
|
+
this.down(this.up(index));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
delete(item) {
|
|
37
|
+
const index = this.positions.get(item);
|
|
38
|
+
if (index === undefined)
|
|
39
|
+
return;
|
|
40
|
+
const last = this.items.pop();
|
|
41
|
+
this.positions.delete(item);
|
|
42
|
+
if (index === this.items.length)
|
|
43
|
+
return;
|
|
44
|
+
this.items[index] = last;
|
|
45
|
+
this.positions.set(last, index);
|
|
46
|
+
this.down(this.up(index));
|
|
47
|
+
}
|
|
48
|
+
up(start) {
|
|
49
|
+
let index = start;
|
|
50
|
+
while (index > 0) {
|
|
51
|
+
const parent = Math.floor((index - 1) / 2);
|
|
52
|
+
if (this.compare(this.items[parent], this.items[index]) <= 0)
|
|
53
|
+
break;
|
|
54
|
+
this.swap(parent, index);
|
|
55
|
+
index = parent;
|
|
56
|
+
}
|
|
57
|
+
return index;
|
|
58
|
+
}
|
|
59
|
+
down(start) {
|
|
60
|
+
let index = start;
|
|
61
|
+
while (index * 2 + 1 < this.items.length) {
|
|
62
|
+
const left = index * 2 + 1;
|
|
63
|
+
const right = left + 1;
|
|
64
|
+
const child = right < this.items.length && this.compare(this.items[right], this.items[left]) < 0 ? right : left;
|
|
65
|
+
if (this.compare(this.items[index], this.items[child]) <= 0)
|
|
66
|
+
break;
|
|
67
|
+
this.swap(index, child);
|
|
68
|
+
index = child;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
swap(left, right) {
|
|
72
|
+
const a = this.items[left];
|
|
73
|
+
const b = this.items[right];
|
|
74
|
+
this.items[left] = b;
|
|
75
|
+
this.items[right] = a;
|
|
76
|
+
this.positions.set(a, right);
|
|
77
|
+
this.positions.set(b, left);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/queues/in-memory.ts
|
|
8
82
|
function assertNonEmpty(value, fieldName) {
|
|
9
83
|
if (value.trim().length === 0) {
|
|
10
84
|
throw new QueueError2(`[Sixb] Queue ${fieldName} must not be empty`);
|
|
@@ -26,16 +100,15 @@ function clearLease(record) {
|
|
|
26
100
|
record.leaseId = null;
|
|
27
101
|
record.claimedAt = null;
|
|
28
102
|
record.leaseExpiresAt = null;
|
|
103
|
+
record.leaseExpiryMs = null;
|
|
29
104
|
}
|
|
30
105
|
function compareQueueRecords(left, right) {
|
|
31
|
-
const availableDifference =
|
|
32
|
-
if (availableDifference !== 0)
|
|
106
|
+
const availableDifference = left.availableAtMs - right.availableAtMs;
|
|
107
|
+
if (availableDifference !== 0)
|
|
33
108
|
return availableDifference;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (createdDifference !== 0) {
|
|
109
|
+
const createdDifference = left.createdAtMs - right.createdAtMs;
|
|
110
|
+
if (createdDifference !== 0)
|
|
37
111
|
return createdDifference;
|
|
38
|
-
}
|
|
39
112
|
return left.sequence - right.sequence;
|
|
40
113
|
}
|
|
41
114
|
function createQueueJob(projectId, newJob) {
|
|
@@ -54,10 +127,10 @@ function createQueueJob(projectId, newJob) {
|
|
|
54
127
|
};
|
|
55
128
|
}
|
|
56
129
|
function leaseExpiresAtMs(record) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return
|
|
130
|
+
return record.leaseExpiryMs;
|
|
131
|
+
}
|
|
132
|
+
function eligibleAt(record) {
|
|
133
|
+
return Math.max(record.availableAtMs, record.leaseExpiryMs ?? -Infinity);
|
|
61
134
|
}
|
|
62
135
|
function toClaimedQueueJob(record) {
|
|
63
136
|
if (!record.leaseId || !record.claimedAt || !record.leaseExpiresAt) {
|
|
@@ -72,37 +145,78 @@ function toClaimedQueueJob(record) {
|
|
|
72
145
|
}
|
|
73
146
|
|
|
74
147
|
class InMemoryQueueStore {
|
|
75
|
-
|
|
148
|
+
projects = new Map;
|
|
76
149
|
nextSequence = 1;
|
|
77
150
|
add(projectId, queueId, job) {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
sequence: this.nextSequence
|
|
151
|
+
const lane = this.lane(projectId, queueId);
|
|
152
|
+
const record = {
|
|
153
|
+
sequence: this.nextSequence++,
|
|
81
154
|
queueId,
|
|
82
155
|
job,
|
|
156
|
+
availableAtMs: parseTimestamp(job.availableAt, "job.availableAt"),
|
|
157
|
+
createdAtMs: parseTimestamp(job.createdAt, "job.createdAt"),
|
|
158
|
+
leaseExpiryMs: null,
|
|
83
159
|
state: "queued",
|
|
84
160
|
failure: null,
|
|
85
161
|
leaseId: null,
|
|
86
162
|
claimedAt: null,
|
|
87
163
|
leaseExpiresAt: null
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
list(projectId, queueId) {
|
|
92
|
-
const records = this.recordsByProject.get(projectId) ?? [];
|
|
93
|
-
return records.filter((record) => record.queueId === queueId);
|
|
164
|
+
};
|
|
165
|
+
lane.records.set(job.id, record);
|
|
166
|
+
this.schedule(projectId, record, Date.now());
|
|
94
167
|
}
|
|
95
168
|
find(projectId, queueId, jobId) {
|
|
96
|
-
return this.
|
|
169
|
+
return this.projects.get(projectId)?.get(queueId)?.records.get(jobId) ?? null;
|
|
97
170
|
}
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
|
|
171
|
+
schedule(projectId, record, now) {
|
|
172
|
+
const lane = this.lane(projectId, record.queueId);
|
|
173
|
+
if (record.state !== "queued") {
|
|
174
|
+
lane.ready.delete(record);
|
|
175
|
+
lane.waiting.delete(record);
|
|
176
|
+
} else if (eligibleAt(record) <= now) {
|
|
177
|
+
lane.waiting.delete(record);
|
|
178
|
+
lane.ready.set(record);
|
|
179
|
+
} else {
|
|
180
|
+
lane.ready.delete(record);
|
|
181
|
+
lane.waiting.set(record);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
takeReady(projectId, queueId, now, limit) {
|
|
185
|
+
const lane = this.projects.get(projectId)?.get(queueId);
|
|
186
|
+
if (!lane)
|
|
187
|
+
return [];
|
|
188
|
+
while (lane.waiting.peek() && eligibleAt(lane.waiting.peek()) <= now) {
|
|
189
|
+
lane.ready.set(lane.waiting.pop());
|
|
190
|
+
}
|
|
191
|
+
const selected = [];
|
|
192
|
+
while (selected.length < limit) {
|
|
193
|
+
const record = lane.ready.peek();
|
|
194
|
+
if (!record || record.availableAtMs > now)
|
|
195
|
+
break;
|
|
196
|
+
lane.ready.pop();
|
|
197
|
+
if (eligibleAt(record) > now)
|
|
198
|
+
lane.waiting.set(record);
|
|
199
|
+
else
|
|
200
|
+
selected.push(record);
|
|
201
|
+
}
|
|
202
|
+
return selected;
|
|
203
|
+
}
|
|
204
|
+
lane(projectId, queueId) {
|
|
205
|
+
let queues = this.projects.get(projectId);
|
|
206
|
+
if (!queues) {
|
|
207
|
+
queues = new Map;
|
|
208
|
+
this.projects.set(projectId, queues);
|
|
209
|
+
}
|
|
210
|
+
let lane = queues.get(queueId);
|
|
211
|
+
if (!lane) {
|
|
212
|
+
lane = {
|
|
213
|
+
records: new Map,
|
|
214
|
+
ready: new IndexedHeap(compareQueueRecords),
|
|
215
|
+
waiting: new IndexedHeap((left, right) => eligibleAt(left) - eligibleAt(right) || left.sequence - right.sequence)
|
|
216
|
+
};
|
|
217
|
+
queues.set(queueId, lane);
|
|
102
218
|
}
|
|
103
|
-
|
|
104
|
-
this.recordsByProject.set(projectId, records);
|
|
105
|
-
return records;
|
|
219
|
+
return lane;
|
|
106
220
|
}
|
|
107
221
|
}
|
|
108
222
|
|
|
@@ -134,24 +248,17 @@ class InMemoryQueue {
|
|
|
134
248
|
async claim(params) {
|
|
135
249
|
assertNonEmpty(params.projectId, "projectId");
|
|
136
250
|
assertNonEmpty(params.workerId, "workerId");
|
|
137
|
-
const limit = params.limit ?? 1;
|
|
138
|
-
if (limit
|
|
251
|
+
const limit = Math.trunc(params.limit ?? 1);
|
|
252
|
+
if (!(limit > 0)) {
|
|
139
253
|
return [];
|
|
140
254
|
}
|
|
141
255
|
const leaseMs = params.leaseMs ?? 30000;
|
|
142
256
|
assertPositiveNumber(leaseMs, "leaseMs");
|
|
143
257
|
const now = Date.now();
|
|
144
|
-
const claimable = this.store.list(params.projectId, this.queueId).filter((record) => {
|
|
145
|
-
if (record.state !== "queued") {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
if (parseTimestamp(record.job.availableAt, "job.availableAt") > now) {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
const expiresAt = leaseExpiresAtMs(record);
|
|
152
|
-
return expiresAt === null || expiresAt <= now;
|
|
153
|
-
}).sort(compareQueueRecords).slice(0, limit);
|
|
154
258
|
const claimedAt = new Date(now).toISOString();
|
|
259
|
+
const leaseExpiry = new Date(now + leaseMs);
|
|
260
|
+
const leaseExpiresAt = leaseExpiry.toISOString();
|
|
261
|
+
const claimable = this.store.takeReady(params.projectId, this.queueId, now, limit);
|
|
155
262
|
return claimable.map((record) => {
|
|
156
263
|
record.job = {
|
|
157
264
|
...record.job,
|
|
@@ -159,7 +266,9 @@ class InMemoryQueue {
|
|
|
159
266
|
};
|
|
160
267
|
record.leaseId = randomUUID();
|
|
161
268
|
record.claimedAt = claimedAt;
|
|
162
|
-
record.leaseExpiresAt =
|
|
269
|
+
record.leaseExpiresAt = leaseExpiresAt;
|
|
270
|
+
record.leaseExpiryMs = leaseExpiry.getTime();
|
|
271
|
+
this.store.schedule(params.projectId, record, now);
|
|
163
272
|
return toClaimedQueueJob(record);
|
|
164
273
|
});
|
|
165
274
|
}
|
|
@@ -167,22 +276,26 @@ class InMemoryQueue {
|
|
|
167
276
|
const record = this.requireActiveLease(params);
|
|
168
277
|
record.state = "completed";
|
|
169
278
|
clearLease(record);
|
|
279
|
+
this.store.schedule(params.projectId, record, Date.now());
|
|
170
280
|
}
|
|
171
281
|
async retry(params) {
|
|
172
282
|
const record = this.requireActiveLease(params);
|
|
173
283
|
const availableAt = params.availableAt ?? new Date().toISOString();
|
|
174
|
-
parseTimestamp(availableAt, "availableAt");
|
|
284
|
+
const availableAtMs = parseTimestamp(availableAt, "availableAt");
|
|
285
|
+
record.availableAtMs = availableAtMs;
|
|
175
286
|
record.job = {
|
|
176
287
|
...record.job,
|
|
177
288
|
availableAt
|
|
178
289
|
};
|
|
179
290
|
clearLease(record);
|
|
291
|
+
this.store.schedule(params.projectId, record, Date.now());
|
|
180
292
|
}
|
|
181
293
|
async fail(params) {
|
|
182
294
|
const record = this.requireActiveLease(params);
|
|
183
295
|
record.state = "failed";
|
|
184
296
|
record.failure = structuredClone(params.failure);
|
|
185
297
|
clearLease(record);
|
|
298
|
+
this.store.schedule(params.projectId, record, Date.now());
|
|
186
299
|
}
|
|
187
300
|
async renewLease(params) {
|
|
188
301
|
assertPositiveNumber(params.leaseMs, "leaseMs");
|
|
@@ -198,7 +311,10 @@ class InMemoryQueue {
|
|
|
198
311
|
if (expiresAt <= now) {
|
|
199
312
|
return null;
|
|
200
313
|
}
|
|
201
|
-
|
|
314
|
+
const leaseExpiry = new Date(now + params.leaseMs);
|
|
315
|
+
record.leaseExpiresAt = leaseExpiry.toISOString();
|
|
316
|
+
record.leaseExpiryMs = leaseExpiry.getTime();
|
|
317
|
+
this.store.schedule(params.projectId, record, now);
|
|
202
318
|
return toClaimedQueueJob(record);
|
|
203
319
|
}
|
|
204
320
|
requireActiveLease(params) {
|
|
@@ -239,4 +355,4 @@ class InMemoryQueues2 {
|
|
|
239
355
|
}
|
|
240
356
|
export { QueueError2, InMemoryQueues2 };
|
|
241
357
|
|
|
242
|
-
//# debugId=
|
|
358
|
+
//# debugId=40F6801A008F592764756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/queues/errors.ts", "../src/queues/in-memory.ts", "../src/queues/indexed-heap.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Error for queue invariants and invalid queue operations.\n */\nexport class QueueError extends Error {\n readonly name = \"QueueError\"\n}\n",
|
|
6
|
+
"import { randomUUID } from \"node:crypto\"\nimport type { SixbErrorCode } from \"../errors/types\"\nimport { QueueError } from \"./errors\"\nimport { IndexedHeap } from \"./indexed-heap\"\nimport type {\n ActionQueueJobFailureCode,\n ActionRunRequestedQueueJob,\n AgentQueueJob,\n AgentQueueJobFailureCode,\n ClaimedQueueJob,\n NewQueueJob,\n PipelineQueueJobFailureCode,\n PipelineRunRequestedQueueJob,\n ProjectionQueueJobFailureCode,\n ProjectionRunRequestedQueueJob,\n Queue,\n QueueJob,\n QueueJobFailure,\n Queues,\n SubagentQueueJob,\n SyncQueueJobFailureCode,\n SyncRunRequestedQueueJob,\n WorkflowQueueJob,\n WorkflowQueueJobFailureCode,\n} from \"./types\"\n\ntype QueueRecordState = \"queued\" | \"completed\" | \"failed\"\n\ninterface QueueRecord<TQueueJob extends QueueJob = QueueJob> {\n readonly sequence: number\n readonly queueId: string\n job: TQueueJob\n availableAtMs: number\n readonly createdAtMs: number\n leaseExpiryMs: number | null\n // A leased job stays \"queued\" until a worker completes or fails it.\n state: QueueRecordState\n failure: QueueJobFailure | null\n leaseId: string | null\n claimedAt: string | null\n leaseExpiresAt: string | null\n}\n\nfunction assertNonEmpty(value: string, fieldName: string): void {\n if (value.trim().length === 0) {\n throw new QueueError(`[Sixb] Queue ${fieldName} must not be empty`)\n }\n}\n\nfunction parseTimestamp(value: string, fieldName: string): number {\n const timestamp = Date.parse(value)\n\n if (Number.isNaN(timestamp)) {\n throw new QueueError(`[Sixb] Queue ${fieldName} must be a valid timestamp`)\n }\n\n return timestamp\n}\n\nfunction assertPositiveNumber(value: number, fieldName: string): void {\n if (!Number.isFinite(value) || value <= 0) {\n throw new QueueError(`[Sixb] Queue ${fieldName} must be greater than 0`)\n }\n}\n\nfunction clearLease(record: QueueRecord): void {\n record.leaseId = null\n record.claimedAt = null\n record.leaseExpiresAt = null\n record.leaseExpiryMs = null\n}\n\n// Best-effort ordering is part of the contract; this keeps the in-memory provider deterministic.\nfunction compareQueueRecords(left: QueueRecord, right: QueueRecord): number {\n const availableDifference = left.availableAtMs - right.availableAtMs\n if (availableDifference !== 0) return availableDifference\n const createdDifference = left.createdAtMs - right.createdAtMs\n if (createdDifference !== 0) return createdDifference\n\n return left.sequence - right.sequence\n}\n\nfunction createQueueJob<TQueueJob extends QueueJob>(\n projectId: string,\n newJob: NewQueueJob<TQueueJob>\n): TQueueJob {\n const createdAt = new Date().toISOString()\n const availableAt = newJob.availableAt ?? createdAt\n parseTimestamp(availableAt, \"availableAt\")\n\n return {\n id: newJob.id ?? randomUUID(),\n projectId,\n createdAt,\n availableAt,\n attempt: 0,\n metadata: newJob.metadata ? structuredClone(newJob.metadata) : undefined,\n type: newJob.type,\n payload: structuredClone(newJob.payload),\n } as TQueueJob\n}\n\nfunction leaseExpiresAtMs(record: QueueRecord): number | null {\n return record.leaseExpiryMs\n}\n\nfunction eligibleAt(record: QueueRecord): number {\n return Math.max(record.availableAtMs, record.leaseExpiryMs ?? -Infinity)\n}\n\ninterface QueueLane {\n // Terminal records remain here for caller-id deduplication, never in the delivery indexes.\n readonly records: Map<string, QueueRecord>\n readonly ready: IndexedHeap<QueueRecord>\n readonly waiting: IndexedHeap<QueueRecord>\n}\n\nfunction toClaimedQueueJob<TQueueJob extends QueueJob>(\n record: QueueRecord<TQueueJob>\n): ClaimedQueueJob<TQueueJob> {\n if (!record.leaseId || !record.claimedAt || !record.leaseExpiresAt) {\n throw new QueueError(`[Sixb] Queue job '${record.job.id}' is not currently leased`)\n }\n\n return {\n leaseId: record.leaseId,\n claimedAt: record.claimedAt,\n leaseExpiresAt: record.leaseExpiresAt,\n job: structuredClone(record.job),\n }\n}\n\nclass InMemoryQueueStore {\n private readonly projects = new Map<string, Map<string, QueueLane>>()\n private nextSequence = 1\n\n add<TQueueJob extends QueueJob>(projectId: string, queueId: string, job: TQueueJob): void {\n const lane = this.lane(projectId, queueId)\n const record: QueueRecord = {\n sequence: this.nextSequence++,\n queueId,\n job,\n availableAtMs: parseTimestamp(job.availableAt, \"job.availableAt\"),\n createdAtMs: parseTimestamp(job.createdAt, \"job.createdAt\"),\n leaseExpiryMs: null,\n state: \"queued\",\n failure: null,\n leaseId: null,\n claimedAt: null,\n leaseExpiresAt: null,\n }\n lane.records.set(job.id, record)\n this.schedule(projectId, record, Date.now())\n }\n\n find<TQueueJob extends QueueJob>(\n projectId: string,\n queueId: string,\n jobId: string\n ): QueueRecord<TQueueJob> | null {\n return (this.projects.get(projectId)?.get(queueId)?.records.get(jobId) ??\n null) as QueueRecord<TQueueJob> | null\n }\n\n schedule(projectId: string, record: QueueRecord, now: number): void {\n const lane = this.lane(projectId, record.queueId)\n if (record.state !== \"queued\") {\n lane.ready.delete(record)\n lane.waiting.delete(record)\n } else if (eligibleAt(record) <= now) {\n lane.waiting.delete(record)\n lane.ready.set(record)\n } else {\n lane.ready.delete(record)\n lane.waiting.set(record)\n }\n }\n\n takeReady<TQueueJob extends QueueJob>(\n projectId: string,\n queueId: string,\n now: number,\n limit: number\n ): QueueRecord<TQueueJob>[] {\n const lane = this.projects.get(projectId)?.get(queueId)\n if (!lane) return []\n // Wake delayed jobs and expired leases, then order all ready jobs by the original contract.\n // A lease expiry controls eligibility, not the priority of a redelivered job.\n while (lane.waiting.peek() && eligibleAt(lane.waiting.peek()!) <= now) {\n lane.ready.set(lane.waiting.pop()!)\n }\n const selected: QueueRecord[] = []\n while (selected.length < limit) {\n const record = lane.ready.peek()\n if (!record || record.availableAtMs > now) break\n lane.ready.pop()\n // A backwards wall-clock adjustment can make a previously expired lease live again.\n if (eligibleAt(record) > now) lane.waiting.set(record)\n else selected.push(record)\n }\n return selected as QueueRecord<TQueueJob>[]\n }\n\n private lane(projectId: string, queueId: string): QueueLane {\n let queues = this.projects.get(projectId)\n if (!queues) {\n queues = new Map()\n this.projects.set(projectId, queues)\n }\n let lane = queues.get(queueId)\n if (!lane) {\n lane = {\n records: new Map(),\n ready: new IndexedHeap(compareQueueRecords),\n waiting: new IndexedHeap(\n (left, right) => eligibleAt(left) - eligibleAt(right) || left.sequence - right.sequence\n ),\n }\n queues.set(queueId, lane)\n }\n return lane\n }\n}\n\nclass InMemoryQueue<TQueueJob extends QueueJob, TFailureCode extends SixbErrorCode>\n implements Queue<TQueueJob, TFailureCode>\n{\n constructor(\n private readonly store: InMemoryQueueStore,\n private readonly queueId: string\n ) {\n assertNonEmpty(queueId, \"queueId\")\n }\n\n async enqueue(params: {\n projectId: string\n jobs: readonly NewQueueJob<TQueueJob>[]\n }): Promise<readonly TQueueJob[]> {\n assertNonEmpty(params.projectId, \"projectId\")\n\n if (params.jobs.length === 0) {\n return []\n }\n\n const createdJobs = params.jobs.map((job) => {\n if (job.id !== undefined) assertNonEmpty(job.id, \"job.id\")\n const existing = job.id\n ? this.store.find<TQueueJob>(params.projectId, this.queueId, job.id)\n : null\n if (existing) return existing.job\n\n const created = createQueueJob(params.projectId, job)\n this.store.add(params.projectId, this.queueId, created)\n return created\n })\n\n return createdJobs.map((job) => structuredClone(job))\n }\n\n async claim(params: {\n projectId: string\n workerId: string\n limit?: number\n leaseMs?: number\n }): Promise<readonly ClaimedQueueJob<TQueueJob>[]> {\n assertNonEmpty(params.projectId, \"projectId\")\n assertNonEmpty(params.workerId, \"workerId\")\n\n const limit = Math.trunc(params.limit ?? 1)\n if (!(limit > 0)) {\n return []\n }\n\n const leaseMs = params.leaseMs ?? 30_000\n assertPositiveNumber(leaseMs, \"leaseMs\")\n\n const now = Date.now()\n const claimedAt = new Date(now).toISOString()\n // Validate before removing candidates, and cache the same millisecond precision we return.\n const leaseExpiry = new Date(now + leaseMs)\n const leaseExpiresAt = leaseExpiry.toISOString()\n const claimable = this.store.takeReady<TQueueJob>(params.projectId, this.queueId, now, limit)\n\n return claimable.map((record) => {\n // Attempts count claims so redelivery after lease expiry or retry is visible to workers.\n record.job = {\n ...record.job,\n attempt: record.job.attempt + 1,\n }\n record.leaseId = randomUUID()\n record.claimedAt = claimedAt\n record.leaseExpiresAt = leaseExpiresAt\n record.leaseExpiryMs = leaseExpiry.getTime()\n this.store.schedule(params.projectId, record, now)\n\n return toClaimedQueueJob(record)\n })\n }\n\n async complete(params: { projectId: string; jobId: string; leaseId: string }): Promise<void> {\n const record = this.requireActiveLease(params)\n record.state = \"completed\"\n clearLease(record)\n this.store.schedule(params.projectId, record, Date.now())\n }\n\n async retry(params: {\n projectId: string\n jobId: string\n leaseId: string\n availableAt?: string\n }): Promise<void> {\n const record = this.requireActiveLease(params)\n const availableAt = params.availableAt ?? new Date().toISOString()\n const availableAtMs = parseTimestamp(availableAt, \"availableAt\")\n\n record.availableAtMs = availableAtMs\n record.job = {\n ...record.job,\n availableAt,\n }\n clearLease(record)\n this.store.schedule(params.projectId, record, Date.now())\n }\n\n async fail(params: {\n projectId: string\n jobId: string\n leaseId: string\n failure: QueueJobFailure<TFailureCode>\n }): Promise<void> {\n const record = this.requireActiveLease(params)\n record.state = \"failed\"\n record.failure = structuredClone(params.failure)\n clearLease(record)\n this.store.schedule(params.projectId, record, Date.now())\n }\n\n async renewLease(params: {\n projectId: string\n jobId: string\n leaseId: string\n leaseMs: number\n }): Promise<ClaimedQueueJob<TQueueJob> | null> {\n assertPositiveNumber(params.leaseMs, \"leaseMs\")\n\n const record = this.store.find<TQueueJob>(params.projectId, this.queueId, params.jobId)\n if (!record || record.state !== \"queued\") {\n return null\n }\n\n const now = Date.now()\n const expiresAt = leaseExpiresAtMs(record)\n if (record.leaseId !== params.leaseId || expiresAt === null) {\n return null\n }\n\n if (expiresAt <= now) {\n return null\n }\n\n const leaseExpiry = new Date(now + params.leaseMs)\n record.leaseExpiresAt = leaseExpiry.toISOString()\n record.leaseExpiryMs = leaseExpiry.getTime()\n this.store.schedule(params.projectId, record, now)\n return toClaimedQueueJob(record)\n }\n\n private requireActiveLease(params: {\n projectId: string\n jobId: string\n leaseId: string\n }): QueueRecord<TQueueJob> {\n assertNonEmpty(params.projectId, \"projectId\")\n assertNonEmpty(params.jobId, \"jobId\")\n assertNonEmpty(params.leaseId, \"leaseId\")\n\n const record = this.store.find<TQueueJob>(params.projectId, this.queueId, params.jobId)\n\n if (!record) {\n throw new QueueError(`[Sixb] Unknown queue job '${params.jobId}'`)\n }\n\n if (record.state !== \"queued\") {\n throw new QueueError(`[Sixb] Queue job '${params.jobId}' is no longer active`)\n }\n\n if (record.leaseId !== params.leaseId || !record.leaseExpiresAt) {\n throw new QueueError(`[Sixb] Lease mismatch for queue job '${params.jobId}'`)\n }\n\n const expiresAt = leaseExpiresAtMs(record)\n if (expiresAt === null || expiresAt <= Date.now()) {\n throw new QueueError(`[Sixb] Lease for queue job '${params.jobId}' has expired`)\n }\n\n return record\n }\n}\n\nexport class InMemoryQueues implements Queues {\n readonly scope = \"process\" as const\n private readonly store = new InMemoryQueueStore()\n\n readonly syncRuns = new InMemoryQueue<SyncRunRequestedQueueJob, SyncQueueJobFailureCode>(\n this.store,\n \"sync.runs\"\n )\n readonly pipelines = new InMemoryQueue<PipelineRunRequestedQueueJob, PipelineQueueJobFailureCode>(\n this.store,\n \"pipeline.runs\"\n )\n readonly projections = new InMemoryQueue<\n ProjectionRunRequestedQueueJob,\n ProjectionQueueJobFailureCode\n >(this.store, \"projection.runs\")\n readonly workflows = new InMemoryQueue<WorkflowQueueJob, WorkflowQueueJobFailureCode>(\n this.store,\n \"workflow.runs\"\n )\n readonly actions = new InMemoryQueue<ActionRunRequestedQueueJob, ActionQueueJobFailureCode>(\n this.store,\n \"action.runs\"\n )\n readonly agents = new InMemoryQueue<AgentQueueJob, AgentQueueJobFailureCode>(\n this.store,\n \"agent.runs\"\n )\n readonly agentChildren = new InMemoryQueue<SubagentQueueJob, AgentQueueJobFailureCode>(\n this.store,\n \"agent.children\"\n )\n\n /** Nothing to reach: the store is a field of this object. */\n health(): Promise<void> {\n return Promise.resolve()\n }\n}\n",
|
|
7
|
+
"/** Internal mutable priority index. Updating or removing an entry never leaves stale copies. */\nexport class IndexedHeap<T> {\n private readonly items: T[] = []\n private readonly positions = new Map<T, number>()\n\n constructor(private readonly compare: (left: T, right: T) => number) {}\n\n peek(): T | undefined {\n return this.items[0]\n }\n\n pop(): T | undefined {\n const first = this.peek()\n if (first !== undefined) this.delete(first)\n return first\n }\n\n set(item: T): void {\n const index = this.positions.get(item)\n if (index === undefined) {\n this.positions.set(item, this.items.length)\n this.items.push(item)\n this.up(this.items.length - 1)\n } else {\n this.down(this.up(index))\n }\n }\n\n delete(item: T): void {\n const index = this.positions.get(item)\n if (index === undefined) return\n const last = this.items.pop()!\n this.positions.delete(item)\n if (index === this.items.length) return\n this.items[index] = last\n this.positions.set(last, index)\n this.down(this.up(index))\n }\n\n private up(start: number): number {\n let index = start\n while (index > 0) {\n const parent = Math.floor((index - 1) / 2)\n if (this.compare(this.items[parent]!, this.items[index]!) <= 0) break\n this.swap(parent, index)\n index = parent\n }\n return index\n }\n\n private down(start: number): void {\n let index = start\n while (index * 2 + 1 < this.items.length) {\n const left = index * 2 + 1\n const right = left + 1\n const child =\n right < this.items.length && this.compare(this.items[right]!, this.items[left]!) < 0\n ? right\n : left\n if (this.compare(this.items[index]!, this.items[child]!) <= 0) break\n this.swap(index, child)\n index = child\n }\n }\n\n private swap(left: number, right: number): void {\n const a = this.items[left]!\n const b = this.items[right]!\n this.items[left] = b\n this.items[right] = a\n this.positions.set(a, right)\n this.positions.set(b, left)\n }\n}\n"
|
|
8
|
+
],
|
|
9
|
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