@sixb/core 0.1.1 → 0.1.2
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/README.md +31 -20
- package/dist/actions/commit-edits.d.ts +0 -2
- package/dist/actions/commit-edits.d.ts.map +1 -1
- package/dist/actions/execution.d.ts +21 -0
- package/dist/actions/execution.d.ts.map +1 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +35 -24
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/registry.d.ts +16 -7
- package/dist/actions/registry.d.ts.map +1 -1
- package/dist/actions/request.d.ts +3 -2
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-dispatch.d.ts +21 -0
- package/dist/actions/run-dispatch.d.ts.map +1 -0
- package/dist/actions/types/context.d.ts +2 -2
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/validation.d.ts +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/actions/worker.js +7 -7
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +10 -0
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +31 -0
- package/dist/agents/authority.d.ts.map +1 -0
- package/dist/agents/context.js +2 -2
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +45 -0
- package/dist/agents/execution.d.ts.map +1 -0
- package/dist/agents/index.d.ts +6 -6
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +64 -16
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/prompt.d.ts.map +1 -1
- package/dist/agents/request.d.ts +6 -2
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams.d.ts +29 -3
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +22 -3
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/types.d.ts +2 -2
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +3 -3
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/attribution.d.ts +17 -0
- package/dist/auth/attribution.d.ts.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +9 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +4 -4
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +24 -11
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +2 -1
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.d.ts +1 -1
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +8 -4
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/browser.js +2 -2
- package/dist/blob-storage/execution.d.ts +16 -0
- package/dist/blob-storage/execution.d.ts.map +1 -0
- package/dist/blob-storage/index.js +3 -3
- package/dist/bootstrap/discovery.d.ts +90 -24
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.d.ts +2 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +60 -60
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.js +2 -2
- package/dist/broker/types.d.ts +5 -0
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/chunk-0172wgm9.js +333 -0
- package/dist/chunk-0172wgm9.js.map +11 -0
- package/dist/chunk-0k4avqr2.js +317 -0
- package/dist/chunk-0k4avqr2.js.map +11 -0
- package/dist/chunk-0mbx247x.js +2922 -0
- package/dist/chunk-0mbx247x.js.map +43 -0
- package/dist/chunk-34bqh420.js +1168 -0
- package/dist/chunk-34bqh420.js.map +23 -0
- package/dist/{chunk-y2ygpd0m.js → chunk-3j7573mj.js} +2 -2
- package/dist/{chunk-y2ygpd0m.js.map → chunk-3j7573mj.js.map} +2 -2
- package/dist/{chunk-md9jbrm9.js → chunk-4gz41why.js} +1 -1
- package/dist/chunk-4x43bkbp.js +55 -0
- package/dist/chunk-4x43bkbp.js.map +11 -0
- package/dist/{chunk-xqbtf4wn.js → chunk-57r1cpxx.js} +3 -2
- package/dist/{chunk-xqbtf4wn.js.map → chunk-57r1cpxx.js.map} +3 -3
- package/dist/chunk-57zpb99z.js +194 -0
- package/dist/chunk-57zpb99z.js.map +10 -0
- package/dist/{chunk-nbywkytr.js → chunk-5egfka8j.js} +13 -33
- package/dist/chunk-5egfka8j.js.map +15 -0
- package/dist/chunk-5gd7tpv6.js +28 -0
- package/dist/chunk-5gd7tpv6.js.map +11 -0
- package/dist/{chunk-867jxh7c.js → chunk-5sz8ta9r.js} +6 -295
- package/dist/chunk-5sz8ta9r.js.map +16 -0
- package/dist/chunk-62c7t4jc.js +27 -0
- package/dist/chunk-62c7t4jc.js.map +11 -0
- package/dist/chunk-63te770v.js.map +1 -1
- package/dist/chunk-663csy96.js +34 -0
- package/dist/chunk-663csy96.js.map +10 -0
- package/dist/{chunk-xz5g49bp.js → chunk-6gjqgd3d.js} +3 -1
- package/dist/chunk-6gjqgd3d.js.map +11 -0
- package/dist/chunk-7pc8b818.js +128 -0
- package/dist/chunk-7pc8b818.js.map +13 -0
- package/dist/{chunk-sb0shdvv.js → chunk-85j5ybfj.js} +1 -1
- package/dist/{chunk-sb0shdvv.js.map → chunk-85j5ybfj.js.map} +2 -2
- package/dist/{chunk-6rzdtvn5.js → chunk-8b55ygje.js} +1 -1
- package/dist/chunk-8m5ejdpn.js +33 -0
- package/dist/chunk-8m5ejdpn.js.map +10 -0
- package/dist/chunk-8ryen3p3.js +118 -0
- package/dist/chunk-8ryen3p3.js.map +10 -0
- package/dist/chunk-979ww6b3.js +298 -0
- package/dist/chunk-979ww6b3.js.map +12 -0
- package/dist/{chunk-ya6brh8a.js → chunk-9t8f5xfx.js} +10 -5
- package/dist/chunk-9t8f5xfx.js.map +11 -0
- package/dist/{chunk-r82k4z7z.js → chunk-a31h57d5.js} +2 -2
- package/dist/chunk-bct7hmfc.js +402 -0
- package/dist/chunk-bct7hmfc.js.map +14 -0
- package/dist/chunk-bh6k3nc6.js +164 -0
- package/dist/chunk-bh6k3nc6.js.map +12 -0
- package/dist/{chunk-t72dvahb.js → chunk-bhxaq2nn.js} +61 -44
- package/dist/chunk-bhxaq2nn.js.map +12 -0
- package/dist/{chunk-avppcgt6.js → chunk-c6qd89g5.js} +241 -144
- package/dist/chunk-c6qd89g5.js.map +15 -0
- package/dist/{chunk-qzyemcj7.js → chunk-ckxfnx7f.js} +2 -2
- package/dist/chunk-cy0n5dms.js +27 -0
- package/dist/chunk-cy0n5dms.js.map +11 -0
- package/dist/chunk-dsrkgtnh.js +50 -0
- package/dist/chunk-dsrkgtnh.js.map +10 -0
- package/dist/{chunk-50kv63vj.js → chunk-dysw7nsm.js} +118 -26
- package/dist/chunk-dysw7nsm.js.map +14 -0
- package/dist/chunk-ezake7g1.js +32 -0
- package/dist/chunk-ezake7g1.js.map +11 -0
- package/dist/{chunk-yn947ck3.js → chunk-f2rt4vkh.js} +48 -29
- package/dist/chunk-f2rt4vkh.js.map +14 -0
- package/dist/{chunk-hb9xcx9c.js → chunk-fmx1sz2h.js} +117 -56
- package/dist/chunk-fmx1sz2h.js.map +15 -0
- package/dist/chunk-g9t3kdtx.js +90 -0
- package/dist/chunk-g9t3kdtx.js.map +10 -0
- package/dist/{chunk-f6kyyeef.js → chunk-ghteq96b.js} +8 -8
- package/dist/{chunk-f6kyyeef.js.map → chunk-ghteq96b.js.map} +4 -4
- package/dist/chunk-h9kxd41f.js +271 -0
- package/dist/chunk-h9kxd41f.js.map +11 -0
- package/dist/chunk-htq0qh7z.js +59 -0
- package/dist/chunk-htq0qh7z.js.map +11 -0
- package/dist/{chunk-xt6qx9sh.js → chunk-jaj13078.js} +121 -9
- package/dist/chunk-jaj13078.js.map +38 -0
- package/dist/{chunk-p7vj8xgb.js → chunk-k9pts48t.js} +81 -58
- package/dist/chunk-k9pts48t.js.map +35 -0
- package/dist/chunk-n8herkry.js +3294 -0
- package/dist/chunk-n8herkry.js.map +35 -0
- package/dist/chunk-nf4r78r4.js +44 -0
- package/dist/chunk-nf4r78r4.js.map +10 -0
- package/dist/{chunk-b1bqvhpe.js → chunk-nnyp53zt.js} +14 -34
- package/dist/chunk-nnyp53zt.js.map +13 -0
- package/dist/chunk-nten49ta.js +404 -0
- package/dist/chunk-nten49ta.js.map +12 -0
- package/dist/chunk-qvybnnpe.js +137 -0
- package/dist/chunk-qvybnnpe.js.map +10 -0
- package/dist/{chunk-53s4asfm.js → chunk-rnshztfq.js} +2 -2
- package/dist/chunk-sa4340y1.js +607 -0
- package/dist/chunk-sa4340y1.js.map +14 -0
- package/dist/{chunk-rjqm6ksg.js → chunk-st4xgxey.js} +583 -251
- package/dist/chunk-st4xgxey.js.map +45 -0
- package/dist/{chunk-be9vm29v.js → chunk-t8t39h7v.js} +1 -1
- package/dist/{chunk-be9vm29v.js.map → chunk-t8t39h7v.js.map} +3 -3
- package/dist/chunk-t9xghkva.js +28 -0
- package/dist/chunk-t9xghkva.js.map +10 -0
- package/dist/chunk-vp1vc6ee.js +35 -0
- package/dist/chunk-vp1vc6ee.js.map +11 -0
- package/dist/{chunk-8kv2sez0.js → chunk-vybf6pkp.js} +1 -1
- package/dist/{chunk-4tvj3ate.js → chunk-wtmzkcht.js} +4 -3
- package/dist/chunk-wtmzkcht.js.map +11 -0
- package/dist/{chunk-v5c085yp.js → chunk-xhy826cz.js} +3 -2
- package/dist/chunk-xhy826cz.js.map +10 -0
- package/dist/chunk-xkthy56g.js +33 -0
- package/dist/chunk-xkthy56g.js.map +11 -0
- package/dist/{chunk-raq0x6bd.js → chunk-ys1nse2v.js} +2175 -381
- package/dist/chunk-ys1nse2v.js.map +56 -0
- package/dist/{chunk-6zrpewy4.js → chunk-z3zp0bj1.js} +1 -1
- package/dist/chunk-zcnhxkvd.js +7 -0
- package/dist/chunk-zcnhxkvd.js.map +10 -0
- package/dist/chunk-zg9yryhz.js +252 -0
- package/dist/chunk-zg9yryhz.js.map +12 -0
- package/dist/chunk-zqqz8052.js +3 -0
- package/dist/{storage/projection-runs/lifecycle.js.map → chunk-zqqz8052.js.map} +1 -1
- package/dist/{chunk-hz8m927w.js → chunk-zqysyfjt.js} +1 -1
- package/dist/connectors/builders.d.ts +2 -1
- package/dist/connectors/builders.d.ts.map +1 -1
- package/dist/connectors/connections/authorizations.d.ts +64 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -0
- package/dist/connectors/connections/capability.d.ts +7 -0
- package/dist/connectors/connections/capability.d.ts.map +1 -0
- package/dist/connectors/connections/command-context.d.ts +23 -0
- package/dist/connectors/connections/command-context.d.ts.map +1 -0
- package/dist/connectors/connections/contracts.d.ts +127 -0
- package/dist/connectors/connections/contracts.d.ts.map +1 -0
- package/dist/connectors/connections/credential-codec.d.ts +15 -0
- package/dist/connectors/connections/credential-codec.d.ts.map +1 -0
- package/dist/connectors/connections/credential-mutations.d.ts +63 -0
- package/dist/connectors/connections/credential-mutations.d.ts.map +1 -0
- package/dist/connectors/connections/execution.d.ts +20 -0
- package/dist/connectors/connections/execution.d.ts.map +1 -0
- package/dist/connectors/connections/internal.d.ts +5 -0
- package/dist/connectors/connections/internal.d.ts.map +1 -0
- package/dist/connectors/connections/internal.js +16 -0
- package/dist/connectors/connections/internal.js.map +9 -0
- package/dist/connectors/connections/provider-operation.d.ts +7 -0
- package/dist/connectors/connections/provider-operation.d.ts.map +1 -0
- package/dist/connectors/connections/request.d.ts +84 -0
- package/dist/connectors/connections/request.d.ts.map +1 -0
- package/dist/connectors/connections/runs.d.ts +51 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -0
- package/dist/connectors/connections/service.d.ts +52 -0
- package/dist/connectors/connections/service.d.ts.map +1 -0
- package/dist/connectors/connections/storage-boundary.d.ts +3 -0
- package/dist/connectors/connections/storage-boundary.d.ts.map +1 -0
- package/dist/connectors/connections/tokens.d.ts +32 -0
- package/dist/connectors/connections/tokens.d.ts.map +1 -0
- package/dist/connectors/connections/validation.d.ts +27 -0
- package/dist/connectors/connections/validation.d.ts.map +1 -0
- package/dist/connectors/connections/views.d.ts +7 -0
- package/dist/connectors/connections/views.d.ts.map +1 -0
- package/dist/connectors/credentials.d.ts +25 -0
- package/dist/connectors/credentials.d.ts.map +1 -0
- package/dist/connectors/errors.d.ts +35 -3
- package/dist/connectors/errors.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +19 -0
- package/dist/connectors/execution.d.ts.map +1 -0
- package/dist/connectors/index.d.ts +5 -3
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/service.d.ts +23 -0
- package/dist/connectors/service.d.ts.map +1 -0
- package/dist/connectors/types.d.ts +94 -2
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +8 -0
- package/dist/datasets/execution.d.ts.map +1 -0
- package/dist/error-reporting/capability.d.ts +4 -49
- package/dist/error-reporting/capability.d.ts.map +1 -1
- package/dist/error-reporting/internal.d.ts +2 -2
- package/dist/error-reporting/internal.d.ts.map +1 -1
- package/dist/error-reporting/internal.js +10 -4
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/error-reporting/reporter.d.ts +4 -1
- package/dist/error-reporting/reporter.d.ts.map +1 -1
- package/dist/error-reporting/reports.d.ts +64 -0
- package/dist/error-reporting/reports.d.ts.map +1 -0
- package/dist/error-reporting/types.d.ts +88 -34
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +141 -0
- package/dist/errors/catalog.d.ts.map +1 -0
- package/dist/errors/internal.d.ts +68 -0
- package/dist/errors/internal.d.ts.map +1 -0
- package/dist/errors/internal.js +29 -0
- package/dist/errors/internal.js.map +9 -0
- package/dist/errors/types.d.ts +20 -0
- package/dist/errors/types.d.ts.map +1 -0
- package/dist/events/definitions.d.ts +0 -1
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts +13 -0
- package/dist/events/execution.d.ts.map +1 -0
- package/dist/events/index.d.ts +3 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +10 -8
- package/dist/events/index.js.map +1 -1
- package/dist/events/outbox-dispatcher.d.ts +4 -2
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/{runtime.d.ts → service.d.ts} +13 -14
- package/dist/events/service.d.ts.map +1 -0
- package/dist/events/types/pipelines.d.ts +4 -1
- package/dist/events/types/pipelines.d.ts.map +1 -1
- package/dist/events/types/syncs.d.ts +3 -0
- package/dist/events/types/syncs.d.ts.map +1 -1
- package/dist/events/types/workflows.d.ts +4 -2
- package/dist/events/types/workflows.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +42 -0
- package/dist/execution/agent.d.ts.map +1 -0
- package/dist/execution/agent.js +70 -0
- package/dist/execution/agent.js.map +9 -0
- package/dist/execution/authorization.d.ts +60 -0
- package/dist/execution/authorization.d.ts.map +1 -0
- package/dist/execution/dispatch.d.ts +8 -0
- package/dist/execution/dispatch.d.ts.map +1 -0
- package/dist/execution/durable.d.ts +37 -0
- package/dist/execution/durable.d.ts.map +1 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/primitive.d.ts +21 -0
- package/dist/execution/primitive.d.ts.map +1 -0
- package/dist/execution/primitive.js +88 -0
- package/dist/execution/primitive.js.map +10 -0
- package/dist/execution/request.d.ts +38 -0
- package/dist/execution/request.d.ts.map +1 -0
- package/dist/execution/request.js +97 -0
- package/dist/execution/request.js.map +10 -0
- package/dist/execution/scopes.d.ts +30 -0
- package/dist/execution/scopes.d.ts.map +1 -0
- package/dist/execution/types.d.ts +111 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/index.d.ts +30 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -105
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +0 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/lake-storage/index.js +5 -5
- package/dist/logging/execution.d.ts +9 -0
- package/dist/logging/execution.d.ts.map +1 -0
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js +8 -8
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/{runtime.d.ts → service.d.ts} +7 -7
- package/dist/logging/{runtime.d.ts.map → service.d.ts.map} +1 -1
- package/dist/logging/types.js +2 -2
- package/dist/materialization/events.d.ts +1 -0
- package/dist/materialization/events.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/index.js +2 -2
- package/dist/materialization/model.d.ts +26 -17
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/commit.d.ts +2 -1
- package/dist/materializer/edits/commit.d.ts.map +1 -1
- package/dist/materializer/edits/load-state.d.ts +1 -1
- package/dist/materializer/edits/load-state.d.ts.map +1 -1
- package/dist/materializer/edits/operations.d.ts +1 -13
- package/dist/materializer/edits/operations.d.ts.map +1 -1
- package/dist/materializer/edits/plan.d.ts +2 -1
- package/dist/materializer/edits/plan.d.ts.map +1 -1
- package/dist/materializer/edits/working-state.d.ts +36 -8
- package/dist/materializer/edits/working-state.d.ts.map +1 -1
- package/dist/materializer/effective/build-events.d.ts +1 -0
- package/dist/materializer/effective/build-events.d.ts.map +1 -1
- package/dist/materializer/effective/diff.d.ts +7 -0
- package/dist/materializer/effective/diff.d.ts.map +1 -1
- package/dist/materializer/effective/load-state.d.ts +0 -2
- package/dist/materializer/effective/load-state.d.ts.map +1 -1
- package/dist/materializer/effective/resolve.d.ts +17 -2
- package/dist/materializer/effective/resolve.d.ts.map +1 -1
- package/dist/materializer/execution/commit-lifecycle.d.ts +2 -2
- package/dist/materializer/execution/commit-lifecycle.d.ts.map +1 -1
- package/dist/materializer/execution/plan-stream.d.ts.map +1 -1
- package/dist/materializer/execution/scope.d.ts +26 -0
- package/dist/materializer/execution/scope.d.ts.map +1 -0
- package/dist/materializer/execution/work-executor.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts +6 -5
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.d.ts +2 -2
- package/dist/materializer/index.d.ts.map +1 -1
- package/dist/materializer/index.js +30 -18
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/materializer.d.ts +37 -5
- package/dist/materializer/materializer.d.ts.map +1 -1
- package/dist/materializer/projections/finish-run.d.ts +2 -1
- package/dist/materializer/projections/finish-run.d.ts.map +1 -1
- package/dist/materializer/projections/replace.d.ts +2 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +1 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/batching.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/materializer/telemetry/append.d.ts +2 -1
- package/dist/materializer/telemetry/append.d.ts.map +1 -1
- package/dist/materializer/telemetry/plan.d.ts +7 -1
- package/dist/materializer/telemetry/plan.d.ts.map +1 -1
- package/dist/objects/action/request.d.ts +3 -3
- package/dist/objects/action/request.d.ts.map +1 -1
- package/dist/objects/context/index.d.ts +1 -1
- package/dist/objects/context/index.d.ts.map +1 -1
- package/dist/objects/context/types.d.ts +5 -0
- package/dist/objects/context/types.d.ts.map +1 -1
- package/dist/objects/execution.d.ts +100 -0
- package/dist/objects/execution.d.ts.map +1 -0
- package/dist/objects/index.js +37 -24
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/materializer-adapter.d.ts +1 -1
- package/dist/objects/materializer-adapter.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +3 -8
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +2 -2
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +9 -13
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/planner.d.ts +0 -3
- package/dist/objects/query/planner.d.ts.map +1 -1
- package/dist/objects/sdk/object-handle.d.ts +2 -2
- package/dist/objects/sdk/object-handle.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts +2 -0
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +2 -0
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
- package/dist/objects/service/action-service.d.ts +3 -2
- package/dist/objects/service/action-service.d.ts.map +1 -1
- package/dist/objects/service/list-service.d.ts +1 -1
- package/dist/objects/telemetry/history.d.ts +2 -0
- package/dist/objects/telemetry/history.d.ts.map +1 -1
- package/dist/objects/telemetry/write-batch.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +1 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +5 -5
- package/dist/ontology/internal.js +4 -4
- package/dist/ontology/registry.d.ts +15 -2
- package/dist/ontology/registry.d.ts.map +1 -1
- package/dist/pipelines/execution.d.ts +19 -0
- package/dist/pipelines/execution.d.ts.map +1 -0
- package/dist/pipelines/index.d.ts +1 -0
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +66 -0
- package/dist/pipelines/index.js.map +9 -0
- package/dist/pipelines/request.d.ts +6 -9
- package/dist/pipelines/request.d.ts.map +1 -1
- package/dist/pipelines/run-dispatch.d.ts +47 -0
- package/dist/pipelines/run-dispatch.d.ts.map +1 -0
- package/dist/projections/builders.d.ts +0 -2
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/capability.d.ts +7 -0
- package/dist/projections/capability.d.ts.map +1 -0
- package/dist/projections/execution.d.ts +19 -0
- package/dist/projections/execution.d.ts.map +1 -0
- package/dist/projections/index.d.ts +3 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.d.ts +4 -10
- package/dist/projections/internal.d.ts.map +1 -1
- package/dist/projections/internal.js +42 -6
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/ownership.d.ts +2 -2
- package/dist/projections/ownership.d.ts.map +1 -1
- package/dist/projections/registry.d.ts +21 -11
- package/dist/projections/registry.d.ts.map +1 -1
- package/dist/projections/revision.d.ts +2 -2
- package/dist/projections/revision.d.ts.map +1 -1
- package/dist/projections/run-dispatch.d.ts +37 -0
- package/dist/projections/run-dispatch.d.ts.map +1 -0
- package/dist/projections/run-id.d.ts +3 -0
- package/dist/projections/run-id.d.ts.map +1 -0
- package/dist/projections/types.d.ts +3 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +2 -2
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +11 -10
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +52 -42
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/execution.d.ts +14 -0
- package/dist/rules/execution.d.ts.map +1 -0
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/validation.d.ts +1 -2
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/runtime/ai-usage.d.ts +8 -0
- package/dist/runtime/ai-usage.d.ts.map +1 -0
- package/dist/runtime/create.d.ts +7 -5
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +35 -0
- package/dist/runtime/definitions.d.ts.map +1 -0
- package/dist/runtime/host.d.ts +123 -0
- package/dist/runtime/host.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +6 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +4 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +6 -2
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/ontology-mutations.d.ts +4 -2
- package/dist/runtime/ontology-mutations.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +42 -0
- package/dist/runtime/resolve-definitions.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +43 -219
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +16 -216
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +3 -6
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/runtime.d.ts +7 -2
- package/dist/scheduler/runtime.d.ts.map +1 -1
- package/dist/schedules/execution.d.ts +6 -0
- package/dist/schedules/execution.d.ts.map +1 -0
- package/dist/schedules/index.js +9 -7
- package/dist/schedules/index.js.map +1 -1
- package/dist/schedules/types.d.ts +1 -3
- package/dist/schedules/types.d.ts.map +1 -1
- package/dist/security/every.d.ts +4 -1
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +4 -1
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +3 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +42 -0
- package/dist/security/registry.d.ts.map +1 -0
- package/dist/security/types.d.ts +7 -12
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +2 -0
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/storage/action-runs/failure.d.ts +7 -0
- package/dist/storage/action-runs/failure.d.ts.map +1 -0
- package/dist/storage/action-runs/failure.js +14 -0
- package/dist/storage/action-runs/failure.js.map +9 -0
- package/dist/storage/action-runs/idempotency.d.ts.map +1 -1
- package/dist/storage/action-runs/in-memory.d.ts +3 -1
- package/dist/storage/action-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/action-runs/index.d.ts +2 -1
- package/dist/storage/action-runs/index.d.ts.map +1 -1
- package/dist/storage/action-runs/provider.d.ts +10 -0
- package/dist/storage/action-runs/provider.d.ts.map +1 -0
- package/dist/storage/action-runs/provider.js +13 -0
- package/dist/storage/action-runs/provider.js.map +9 -0
- package/dist/storage/action-runs/types.d.ts +37 -18
- package/dist/storage/action-runs/types.d.ts.map +1 -1
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +4 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +10 -0
- package/dist/storage/agents/provider.d.ts.map +1 -0
- package/dist/storage/agents/provider.js +17 -0
- package/dist/storage/agents/provider.js.map +9 -0
- package/dist/storage/agents/types.d.ts +13 -22
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-usage/errors.d.ts +8 -0
- package/dist/storage/ai-usage/errors.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +28 -0
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-usage/index.d.ts +8 -0
- package/dist/storage/ai-usage/index.d.ts.map +1 -0
- package/dist/storage/ai-usage/record.d.ts +6 -0
- package/dist/storage/ai-usage/record.d.ts.map +1 -0
- package/dist/storage/ai-usage/types.d.ts +89 -0
- package/dist/storage/ai-usage/types.d.ts.map +1 -0
- package/dist/storage/ai-usage/usage.d.ts +11 -0
- package/dist/storage/ai-usage/usage.d.ts.map +1 -0
- package/dist/storage/auth/types.d.ts +1 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/errors.d.ts +12 -0
- package/dist/storage/connector-connections/errors.d.ts.map +1 -0
- package/dist/storage/connector-connections/in-memory.d.ts +81 -0
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -0
- package/dist/storage/connector-connections/index.d.ts +7 -0
- package/dist/storage/connector-connections/index.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/authorizations.d.ts +20 -0
- package/dist/storage/connector-connections/provider/authorizations.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/connections.d.ts +17 -0
- package/dist/storage/connector-connections/provider/connections.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/runs.d.ts +14 -0
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/shared.d.ts +74 -0
- package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider.d.ts +49 -0
- package/dist/storage/connector-connections/provider.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider.js +1025 -0
- package/dist/storage/connector-connections/provider.js.map +14 -0
- package/dist/storage/connector-connections/types.d.ts +402 -0
- package/dist/storage/connector-connections/types.d.ts.map +1 -0
- package/dist/storage/executions/errors.d.ts +8 -0
- package/dist/storage/executions/errors.d.ts.map +1 -0
- package/dist/storage/executions/in-memory.d.ts +21 -0
- package/dist/storage/executions/in-memory.d.ts.map +1 -0
- package/dist/storage/executions/index.d.ts +5 -0
- package/dist/storage/executions/index.d.ts.map +1 -0
- package/dist/storage/executions/provider.d.ts +29 -0
- package/dist/storage/executions/provider.d.ts.map +1 -0
- package/dist/storage/executions/provider.js +208 -0
- package/dist/storage/executions/provider.js.map +10 -0
- package/dist/storage/executions/run-link.d.ts +24 -0
- package/dist/storage/executions/run-link.d.ts.map +1 -0
- package/dist/storage/executions/types.d.ts +62 -0
- package/dist/storage/executions/types.d.ts.map +1 -0
- package/dist/storage/executions/validation.d.ts +13 -0
- package/dist/storage/executions/validation.d.ts.map +1 -0
- package/dist/storage/in-memory/index.d.ts +20 -5
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +28 -17
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +92 -29
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/ontology/commits.d.ts +1 -0
- package/dist/storage/ontology/commits.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/index.d.ts +1 -0
- package/dist/storage/ontology/in-memory/index.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations-state.d.ts +3 -2
- package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations-work.d.ts +2 -2
- package/dist/storage/ontology/in-memory/materializations-work.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +3 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/shared-state.d.ts +7 -2
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +3 -2
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +50 -5
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/outbox.d.ts +8 -2
- package/dist/storage/ontology/outbox.d.ts.map +1 -1
- package/dist/storage/ontology/provider-work.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +5 -22
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +6 -7
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/pipeline-runs/idempotency.d.ts +3 -0
- package/dist/storage/pipeline-runs/idempotency.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/in-memory.d.ts +5 -1
- package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/index.d.ts +3 -1
- package/dist/storage/pipeline-runs/index.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/provider.d.ts +10 -0
- package/dist/storage/pipeline-runs/provider.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/provider.js +11 -0
- package/dist/storage/pipeline-runs/provider.js.map +9 -0
- package/dist/storage/pipeline-runs/types.d.ts +30 -14
- package/dist/storage/pipeline-runs/types.d.ts.map +1 -1
- package/dist/storage/projection-runs/in-memory.d.ts +8 -3
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/projection-runs/index.d.ts +2 -2
- package/dist/storage/projection-runs/index.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts +14 -8
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.d.ts +13 -0
- package/dist/storage/projection-runs/provider.d.ts.map +1 -0
- package/dist/storage/projection-runs/{lifecycle.js → provider.js} +15 -4
- package/dist/storage/projection-runs/provider.js.map +9 -0
- package/dist/storage/projection-runs/types.d.ts +28 -11
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/run-listing.d.ts +8 -9
- package/dist/storage/run-listing.d.ts.map +1 -1
- package/dist/storage/sync-runs/idempotency.d.ts +3 -0
- package/dist/storage/sync-runs/idempotency.d.ts.map +1 -0
- package/dist/storage/sync-runs/in-memory.d.ts +5 -1
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/index.d.ts +3 -1
- package/dist/storage/sync-runs/index.d.ts.map +1 -1
- package/dist/storage/sync-runs/provider.d.ts +10 -0
- package/dist/storage/sync-runs/provider.d.ts.map +1 -0
- package/dist/storage/sync-runs/provider.js +11 -0
- package/dist/storage/sync-runs/provider.js.map +9 -0
- package/dist/storage/sync-runs/types.d.ts +28 -11
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/types.d.ts +20 -15
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/errors.d.ts +3 -0
- package/dist/storage/webhook-runs/errors.d.ts.map +1 -1
- package/dist/storage/webhook-runs/in-memory.d.ts +13 -1
- package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/webhook-runs/index.d.ts +3 -2
- package/dist/storage/webhook-runs/index.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.d.ts +10 -0
- package/dist/storage/webhook-runs/provider.d.ts.map +1 -0
- package/dist/storage/webhook-runs/provider.js +11 -0
- package/dist/storage/webhook-runs/provider.js.map +9 -0
- package/dist/storage/webhook-runs/types.d.ts +37 -11
- package/dist/storage/webhook-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts +6 -2
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/index.d.ts +2 -1
- package/dist/storage/workflow-runs/index.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.d.ts +19 -0
- package/dist/storage/workflow-runs/provider.d.ts.map +1 -0
- package/dist/storage/workflow-runs/provider.js +19 -0
- package/dist/storage/workflow-runs/provider.js.map +9 -0
- package/dist/storage/workflow-runs/types.d.ts +28 -30
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/execution.d.ts +18 -0
- package/dist/syncs/execution.d.ts.map +1 -0
- package/dist/syncs/index.d.ts +3 -1
- package/dist/syncs/index.d.ts.map +1 -1
- package/dist/syncs/index.js +65 -0
- package/dist/syncs/index.js.map +9 -0
- package/dist/syncs/request.d.ts +6 -16
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +47 -0
- package/dist/syncs/run-dispatch.d.ts.map +1 -0
- package/dist/syncs/sources.d.ts +8 -0
- package/dist/syncs/sources.d.ts.map +1 -0
- package/dist/syncs/types.d.ts +16 -9
- package/dist/syncs/types.d.ts.map +1 -1
- package/dist/testing/action-execution.d.ts +12 -0
- package/dist/testing/action-execution.d.ts.map +1 -0
- package/dist/testing/agent-execution.d.ts +14 -0
- package/dist/testing/agent-execution.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts +10 -3
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-usage-storage-contract.d.ts +13 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -0
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts +16 -0
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -0
- package/dist/testing/execution-storage-contract.d.ts +15 -0
- package/dist/testing/execution-storage-contract.d.ts.map +1 -0
- package/dist/testing/execution.d.ts +23 -0
- package/dist/testing/execution.d.ts.map +1 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +4088 -1556
- package/dist/testing/index.js.map +25 -13
- package/dist/testing/materializer-fixture.d.ts +2 -2
- package/dist/testing/materializer-fixture.d.ts.map +1 -1
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/ontology-contract-fixture.d.ts +1 -0
- package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/pipeline-execution.d.ts +16 -0
- package/dist/testing/pipeline-execution.d.ts.map +1 -0
- package/dist/testing/projection-execution.d.ts +20 -0
- package/dist/testing/projection-execution.d.ts.map +1 -0
- package/dist/testing/projection-run-storage-contract.d.ts +9 -4
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/sync-execution.d.ts +16 -0
- package/dist/testing/sync-execution.d.ts.map +1 -0
- package/dist/testing/webhook-execution.d.ts +12 -0
- package/dist/testing/webhook-execution.d.ts.map +1 -0
- package/dist/testing/webhook-run-storage-contract.d.ts +11 -0
- package/dist/testing/webhook-run-storage-contract.d.ts.map +1 -0
- package/dist/testing/workflow-execution.d.ts +23 -0
- package/dist/testing/workflow-execution.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +2 -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 -0
- package/dist/webhooks/internal.js +150 -0
- package/dist/webhooks/internal.js.map +10 -0
- package/dist/webhooks/registry.d.ts +18 -4
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/run-admission.d.ts +25 -0
- package/dist/webhooks/run-admission.d.ts.map +1 -0
- package/dist/webhooks/types.d.ts +8 -5
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/index.js +18 -19
- package/dist/workers/index.js.map +4 -4
- package/dist/workers/queue-delivery.d.ts +7 -7
- package/dist/workers/queue-delivery.d.ts.map +1 -1
- package/dist/workers/queue-worker.d.ts +30 -11
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +49 -0
- package/dist/workflows/execution.d.ts.map +1 -0
- package/dist/workflows/failure.d.ts +28 -0
- package/dist/workflows/failure.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +4 -2
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +64 -36
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts +2 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +59 -0
- package/dist/workflows/run-dispatch.d.ts.map +1 -0
- package/dist/workflows/types.d.ts +38 -8
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +107 -5
- package/src/actions/commit-edits.ts +0 -3
- package/src/actions/execution.ts +83 -0
- package/src/actions/index.ts +1 -1
- package/src/actions/registry.ts +22 -10
- package/src/actions/request.ts +55 -177
- package/src/actions/run-dispatch.ts +276 -0
- package/src/actions/types/context.ts +2 -4
- package/src/actions/validation.ts +2 -2
- package/src/agents/adapters.ts +7 -3
- package/src/agents/authority.ts +189 -0
- package/src/agents/dispatch.ts +1 -6
- package/src/agents/errors.ts +2 -0
- package/src/agents/execution.ts +254 -0
- package/src/agents/index.ts +15 -3
- package/src/agents/prompt.ts +15 -3
- package/src/agents/request.ts +153 -13
- package/src/agents/streams.ts +150 -3
- package/src/agents/types.ts +2 -4
- package/src/agents/validation.ts +3 -3
- package/src/auth/attribution.ts +48 -0
- package/src/auth/index.ts +1 -0
- package/src/auth/runtime.ts +5 -5
- package/src/authorization/decision.ts +75 -14
- package/src/authorization/grant-kinds.ts +9 -0
- package/src/authorization/index.ts +2 -0
- package/src/blob-storage/execution.ts +78 -0
- package/src/bootstrap/discovery.ts +88 -268
- package/src/bootstrap/index.ts +2 -13
- package/src/broker/in-memory.ts +8 -1
- package/src/broker/types.ts +5 -0
- package/src/connectors/builders.ts +37 -2
- package/src/connectors/connections/authorizations.ts +646 -0
- package/src/connectors/connections/capability.ts +59 -0
- package/src/connectors/connections/command-context.ts +98 -0
- package/src/connectors/connections/contracts.ts +208 -0
- package/src/connectors/connections/credential-codec.ts +48 -0
- package/src/connectors/connections/credential-mutations.ts +574 -0
- package/src/connectors/connections/execution.ts +138 -0
- package/src/connectors/connections/internal.ts +17 -0
- package/src/connectors/connections/provider-operation.ts +41 -0
- package/src/connectors/connections/request.ts +447 -0
- package/src/connectors/connections/runs.ts +702 -0
- package/src/connectors/connections/service.ts +644 -0
- package/src/connectors/connections/storage-boundary.ts +13 -0
- package/src/connectors/connections/tokens.ts +292 -0
- package/src/connectors/connections/validation.ts +316 -0
- package/src/connectors/connections/views.ts +37 -0
- package/src/connectors/credentials.ts +149 -0
- package/src/connectors/errors.ts +111 -3
- package/src/connectors/execution.ts +157 -0
- package/src/connectors/index.ts +26 -2
- package/src/connectors/service.ts +142 -0
- package/src/connectors/types.ts +156 -7
- package/src/datasets/execution.ts +24 -0
- package/src/error-reporting/capability.ts +33 -106
- package/src/error-reporting/internal.ts +3 -1
- package/src/error-reporting/reporter.ts +19 -3
- package/src/error-reporting/reports.ts +172 -0
- package/src/error-reporting/types.ts +97 -43
- package/src/errors/catalog.ts +149 -0
- package/src/errors/internal.ts +322 -0
- package/src/errors/types.ts +21 -0
- package/src/events/definitions.ts +0 -4
- package/src/events/execution.ts +45 -0
- package/src/events/index.ts +15 -14
- package/src/events/outbox-dispatcher.ts +53 -18
- package/src/events/{runtime.ts → service.ts} +19 -23
- package/src/events/types/pipelines.ts +4 -1
- package/src/events/types/syncs.ts +3 -0
- package/src/events/types/workflows.ts +4 -2
- package/src/execution/agent.ts +130 -0
- package/src/execution/authorization.ts +409 -0
- package/src/execution/dispatch.ts +7 -0
- package/src/execution/durable.ts +193 -0
- package/src/execution/index.ts +12 -0
- package/src/execution/primitive.ts +50 -0
- package/src/execution/request.ts +109 -0
- package/src/execution/scopes.ts +198 -0
- package/src/execution/types.ts +113 -0
- package/src/http/api-routes.ts +3 -3
- package/src/index.ts +109 -9
- package/src/json.ts +0 -4
- package/src/logging/execution.ts +28 -0
- package/src/logging/index.ts +4 -4
- package/src/logging/{runtime.ts → service.ts} +7 -7
- package/src/materialization/events.ts +1 -0
- package/src/materialization/index.ts +2 -0
- package/src/materialization/model.ts +30 -18
- package/src/materializer/README.md +9 -13
- package/src/materializer/edits/commit.ts +85 -28
- package/src/materializer/edits/load-state.ts +79 -16
- package/src/materializer/edits/operations.ts +72 -36
- package/src/materializer/edits/plan.ts +95 -22
- package/src/materializer/edits/working-state.ts +86 -55
- package/src/materializer/effective/build-events.ts +2 -0
- package/src/materializer/effective/diff.ts +22 -0
- package/src/materializer/effective/load-state.ts +0 -31
- package/src/materializer/effective/resolve.ts +62 -0
- package/src/materializer/execution/commit-lifecycle.ts +9 -1
- package/src/materializer/execution/plan-stream.ts +33 -9
- package/src/materializer/execution/scope.ts +95 -0
- package/src/materializer/execution/work-executor.ts +6 -2
- package/src/materializer/execution/work-records.ts +39 -6
- package/src/materializer/index.ts +9 -1
- package/src/materializer/materializer.ts +67 -5
- package/src/materializer/projections/finish-run.ts +29 -11
- package/src/materializer/projections/replace.ts +55 -22
- package/src/materializer/projections/replacement-plan.ts +37 -7
- package/src/materializer/shared/batching.ts +4 -1
- package/src/materializer/shared/normalize.ts +0 -19
- package/src/materializer/telemetry/append.ts +57 -26
- package/src/materializer/telemetry/plan.ts +15 -6
- package/src/objects/action/request.ts +5 -5
- package/src/objects/context/index.ts +1 -0
- package/src/objects/context/types.ts +6 -0
- package/src/objects/execution.ts +346 -0
- package/src/objects/materializer-adapter.ts +1 -23
- package/src/objects/query/executor.ts +15 -29
- package/src/objects/query/index.ts +1 -2
- package/src/objects/query/planner.ts +0 -6
- package/src/objects/sdk/object-handle.ts +2 -2
- package/src/objects/sdk/object-set.ts +17 -7
- package/src/objects/sdk/runtime-query-executor.ts +9 -2
- package/src/objects/sdk/telemetry-channel.ts +5 -1
- package/src/objects/service/action-service.ts +5 -2
- package/src/objects/service/list-service.ts +1 -1
- package/src/objects/telemetry/history.ts +8 -3
- package/src/objects/telemetry/write-batch.ts +0 -2
- package/src/ontology/index.ts +6 -1
- package/src/ontology/registry.ts +16 -2
- package/src/pipelines/execution.ts +105 -0
- package/src/pipelines/index.ts +7 -0
- package/src/pipelines/request.ts +32 -26
- package/src/pipelines/run-dispatch.ts +308 -0
- package/src/projections/builders.ts +0 -9
- package/src/projections/capability.ts +37 -0
- package/src/projections/execution.ts +85 -0
- package/src/projections/index.ts +2 -1
- package/src/projections/internal.ts +17 -60
- package/src/projections/ownership.ts +2 -2
- package/src/projections/registry.ts +26 -11
- package/src/projections/revision.ts +7 -5
- package/src/projections/run-dispatch.ts +497 -0
- package/src/projections/run-id.ts +20 -0
- package/src/projections/types.ts +12 -0
- package/src/projections/validation.ts +3 -3
- package/src/queues/in-memory.ts +37 -11
- package/src/queues/index.ts +9 -2
- package/src/queues/types.ts +70 -45
- package/src/rules/execution.ts +49 -0
- package/src/rules/index.ts +0 -1
- package/src/rules/validation.ts +2 -6
- package/src/runtime/ai-usage.ts +17 -0
- package/src/runtime/create.ts +28 -68
- package/src/runtime/definitions.ts +44 -0
- package/src/runtime/host.ts +377 -0
- package/src/runtime/index.ts +5 -13
- package/src/runtime/internal.ts +12 -0
- package/src/runtime/ontology-mutations.ts +5 -3
- package/src/runtime/resolve-definitions.ts +238 -0
- package/src/runtime/sixb.ts +95 -822
- package/src/runtime/types.ts +17 -290
- package/src/scheduler/index.ts +1 -1
- package/src/scheduler/runtime.ts +37 -6
- package/src/schedules/execution.ts +14 -0
- package/src/schedules/types.ts +0 -8
- package/src/security/every.ts +4 -0
- package/src/security/grants.ts +13 -1
- package/src/security/index.ts +3 -1
- package/src/security/registry.ts +107 -0
- package/src/security/types.ts +8 -12
- package/src/security/validation.ts +7 -0
- package/src/storage/action-runs/failure.ts +64 -0
- package/src/storage/action-runs/idempotency.ts +3 -1
- package/src/storage/action-runs/in-memory.ts +39 -9
- package/src/storage/action-runs/index.ts +3 -0
- package/src/storage/action-runs/provider.ts +25 -0
- package/src/storage/action-runs/types.ts +61 -27
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +49 -11
- package/src/storage/agents/index.ts +2 -1
- package/src/storage/agents/provider.ts +27 -0
- package/src/storage/agents/types.ts +19 -19
- package/src/storage/ai-usage/errors.ts +13 -0
- package/src/storage/ai-usage/in-memory.ts +162 -0
- package/src/storage/ai-usage/index.ts +21 -0
- package/src/storage/ai-usage/record.ts +74 -0
- package/src/storage/ai-usage/types.ts +102 -0
- package/src/storage/ai-usage/usage.ts +104 -0
- package/src/storage/auth/types.ts +1 -0
- package/src/storage/connector-connections/errors.ts +24 -0
- package/src/storage/connector-connections/in-memory.ts +1377 -0
- package/src/storage/connector-connections/index.ts +66 -0
- package/src/storage/connector-connections/provider/authorizations.ts +446 -0
- package/src/storage/connector-connections/provider/connections.ts +291 -0
- package/src/storage/connector-connections/provider/runs.ts +369 -0
- package/src/storage/connector-connections/provider/shared.ts +342 -0
- package/src/storage/connector-connections/provider.ts +219 -0
- package/src/storage/connector-connections/types.ts +546 -0
- package/src/storage/executions/errors.ts +21 -0
- package/src/storage/executions/in-memory.ts +75 -0
- package/src/storage/executions/index.ts +16 -0
- package/src/storage/executions/provider.ts +292 -0
- package/src/storage/executions/run-link.ts +70 -0
- package/src/storage/executions/types.ts +49 -0
- package/src/storage/executions/validation.ts +370 -0
- package/src/storage/in-memory/index.ts +50 -16
- package/src/storage/index.ts +154 -15
- package/src/storage/ontology/commits.ts +1 -0
- package/src/storage/ontology/in-memory/index.ts +2 -0
- package/src/storage/ontology/in-memory/materializations-finalization.ts +2 -1
- package/src/storage/ontology/in-memory/materializations-state.ts +10 -0
- package/src/storage/ontology/in-memory/materializations-work.ts +2 -1
- package/src/storage/ontology/in-memory/materializations.ts +131 -9
- package/src/storage/ontology/in-memory/outbox.ts +1 -1
- package/src/storage/ontology/in-memory/shared-state.ts +12 -1
- package/src/storage/ontology/index.ts +6 -0
- package/src/storage/ontology/materializations.ts +50 -4
- package/src/storage/ontology/outbox.ts +13 -2
- package/src/storage/ontology/provider-header-validation.ts +1 -0
- package/src/storage/ontology/provider-work.ts +33 -14
- package/src/storage/ontology/provider.ts +72 -52
- package/src/storage/operation-scope.ts +1 -0
- package/src/storage/pipeline-runs/idempotency.ts +14 -0
- package/src/storage/pipeline-runs/in-memory.ts +88 -8
- package/src/storage/pipeline-runs/index.ts +5 -1
- package/src/storage/pipeline-runs/provider.ts +25 -0
- package/src/storage/pipeline-runs/types.ts +37 -14
- package/src/storage/projection-runs/in-memory.ts +93 -24
- package/src/storage/projection-runs/index.ts +4 -0
- package/src/storage/projection-runs/lifecycle.ts +165 -36
- package/src/storage/projection-runs/provider.ts +34 -0
- package/src/storage/projection-runs/types.ts +34 -11
- package/src/storage/run-listing.ts +22 -13
- package/src/storage/sync-runs/idempotency.ts +18 -0
- package/src/storage/sync-runs/in-memory.ts +90 -7
- package/src/storage/sync-runs/index.ts +4 -1
- package/src/storage/sync-runs/provider.ts +25 -0
- package/src/storage/sync-runs/types.ts +35 -11
- package/src/storage/types.ts +44 -17
- package/src/storage/webhook-runs/errors.ts +14 -0
- package/src/storage/webhook-runs/in-memory.ts +84 -9
- package/src/storage/webhook-runs/index.ts +5 -1
- package/src/storage/webhook-runs/provider.ts +30 -0
- package/src/storage/webhook-runs/types.ts +52 -11
- package/src/storage/workflow-runs/in-memory.ts +89 -55
- package/src/storage/workflow-runs/index.ts +2 -0
- package/src/storage/workflow-runs/provider.ts +70 -0
- package/src/storage/workflow-runs/types.ts +36 -25
- package/src/syncs/builders.ts +2 -2
- package/src/syncs/execution.ts +78 -0
- package/src/syncs/index.ts +13 -0
- package/src/syncs/request.ts +32 -43
- package/src/syncs/run-dispatch.ts +312 -0
- package/src/syncs/sources.ts +20 -0
- package/src/syncs/types.ts +32 -8
- package/src/testing/action-execution.ts +61 -0
- package/src/testing/agent-execution.ts +81 -0
- package/src/testing/agent-storage-contract.ts +158 -63
- package/src/testing/ai-usage-storage-contract.ts +528 -0
- package/src/testing/auth-storage-contract.ts +17 -1
- package/src/testing/broker-contract.ts +16 -1
- package/src/testing/connector-connection-storage-contract.ts +1052 -0
- package/src/testing/execution-storage-contract.ts +435 -0
- package/src/testing/execution.ts +48 -0
- package/src/testing/index.ts +52 -0
- package/src/testing/materializer-fixture.ts +11 -3
- package/src/testing/materializer-storage-contract.ts +213 -11
- package/src/testing/ontology-contract-fixture.ts +35 -2
- package/src/testing/ontology-storage-contract.ts +75 -14
- package/src/testing/pipeline-execution.ts +64 -0
- package/src/testing/projection-execution.ts +98 -0
- package/src/testing/projection-run-storage-contract.ts +215 -29
- package/src/testing/queues-contract.ts +40 -51
- package/src/testing/sync-execution.ts +61 -0
- package/src/testing/webhook-execution.ts +47 -0
- package/src/testing/webhook-run-storage-contract.ts +240 -0
- package/src/testing/workflow-execution.ts +77 -0
- package/src/webhooks/index.ts +2 -1
- package/src/webhooks/internal.ts +5 -0
- package/src/webhooks/registry.ts +60 -36
- package/src/webhooks/run-admission.ts +172 -0
- package/src/webhooks/types.ts +8 -5
- package/src/workers/queue-delivery.ts +25 -22
- package/src/workers/queue-worker.ts +62 -32
- package/src/workflows/execution.ts +292 -0
- package/src/workflows/failure.ts +63 -0
- package/src/workflows/index.ts +10 -1
- package/src/workflows/request.ts +39 -118
- package/src/workflows/run-dispatch.ts +359 -0
- package/src/workflows/types.ts +39 -8
- package/dist/actions/runtime.d.ts +0 -11
- package/dist/actions/runtime.d.ts.map +0 -1
- package/dist/agents/runtime.d.ts +0 -41
- package/dist/agents/runtime.d.ts.map +0 -1
- package/dist/chunk-4hwxq5e6.js +0 -49
- package/dist/chunk-4hwxq5e6.js.map +0 -10
- package/dist/chunk-4tvj3ate.js.map +0 -11
- package/dist/chunk-50kv63vj.js.map +0 -12
- package/dist/chunk-86459jn0.js +0 -1091
- package/dist/chunk-86459jn0.js.map +0 -22
- package/dist/chunk-867jxh7c.js.map +0 -19
- package/dist/chunk-9k3hgv8h.js +0 -352
- package/dist/chunk-9k3hgv8h.js.map +0 -13
- package/dist/chunk-avppcgt6.js.map +0 -14
- package/dist/chunk-b1bqvhpe.js.map +0 -13
- package/dist/chunk-b5dp7gaf.js +0 -1092
- package/dist/chunk-b5dp7gaf.js.map +0 -26
- package/dist/chunk-bh8bwma3.js +0 -37
- package/dist/chunk-bh8bwma3.js.map +0 -10
- package/dist/chunk-btcsywk4.js +0 -985
- package/dist/chunk-btcsywk4.js.map +0 -15
- package/dist/chunk-exrfbt2d.js +0 -354
- package/dist/chunk-exrfbt2d.js.map +0 -17
- package/dist/chunk-hb9xcx9c.js.map +0 -14
- package/dist/chunk-k25jm1x5.js +0 -102
- package/dist/chunk-k25jm1x5.js.map +0 -10
- package/dist/chunk-k6j72mtt.js +0 -9
- package/dist/chunk-k6j72mtt.js.map +0 -10
- package/dist/chunk-m9w0artv.js +0 -554
- package/dist/chunk-m9w0artv.js.map +0 -13
- package/dist/chunk-nbywkytr.js.map +0 -16
- package/dist/chunk-p7vj8xgb.js.map +0 -34
- package/dist/chunk-raq0x6bd.js.map +0 -48
- package/dist/chunk-rgzed50y.js +0 -1445
- package/dist/chunk-rgzed50y.js.map +0 -22
- package/dist/chunk-rjqm6ksg.js.map +0 -44
- package/dist/chunk-t72dvahb.js.map +0 -12
- package/dist/chunk-v5c085yp.js.map +0 -10
- package/dist/chunk-xt6qx9sh.js.map +0 -36
- package/dist/chunk-xz5g49bp.js.map +0 -11
- package/dist/chunk-ya6brh8a.js.map +0 -11
- package/dist/chunk-yn947ck3.js.map +0 -14
- package/dist/connectors/runtime.d.ts +0 -13
- package/dist/connectors/runtime.d.ts.map +0 -1
- package/dist/events/runtime.d.ts.map +0 -1
- package/dist/objects/contexts.d.ts +0 -45
- package/dist/objects/contexts.d.ts.map +0 -1
- package/dist/objects/helpers.d.ts +0 -7
- package/dist/objects/helpers.d.ts.map +0 -1
- package/dist/runtime/scoped.d.ts +0 -158
- package/dist/runtime/scoped.d.ts.map +0 -1
- package/dist/security/runtime.d.ts +0 -16
- package/dist/security/runtime.d.ts.map +0 -1
- package/dist/storage/webhook-deliveries/in-memory.d.ts +0 -18
- package/dist/storage/webhook-deliveries/in-memory.d.ts.map +0 -1
- package/dist/storage/webhook-deliveries/index.d.ts +0 -3
- package/dist/storage/webhook-deliveries/index.d.ts.map +0 -1
- package/dist/storage/webhook-deliveries/types.d.ts +0 -43
- package/dist/storage/webhook-deliveries/types.d.ts.map +0 -1
- package/dist/workflows/runtime.d.ts +0 -33
- package/dist/workflows/runtime.d.ts.map +0 -1
- package/src/actions/runtime.ts +0 -31
- package/src/agents/runtime.ts +0 -124
- package/src/connectors/runtime.ts +0 -100
- package/src/objects/contexts.ts +0 -64
- package/src/objects/helpers.ts +0 -18
- package/src/runtime/scoped.ts +0 -436
- package/src/security/runtime.ts +0 -101
- package/src/storage/webhook-deliveries/in-memory.ts +0 -108
- package/src/storage/webhook-deliveries/index.ts +0 -9
- package/src/storage/webhook-deliveries/types.ts +0 -41
- package/src/workflows/runtime.ts +0 -68
- /package/dist/{chunk-md9jbrm9.js.map → chunk-4gz41why.js.map} +0 -0
- /package/dist/{chunk-6rzdtvn5.js.map → chunk-8b55ygje.js.map} +0 -0
- /package/dist/{chunk-r82k4z7z.js.map → chunk-a31h57d5.js.map} +0 -0
- /package/dist/{chunk-qzyemcj7.js.map → chunk-ckxfnx7f.js.map} +0 -0
- /package/dist/{chunk-53s4asfm.js.map → chunk-rnshztfq.js.map} +0 -0
- /package/dist/{chunk-8kv2sez0.js.map → chunk-vybf6pkp.js.map} +0 -0
- /package/dist/{chunk-6zrpewy4.js.map → chunk-z3zp0bj1.js.map} +0 -0
- /package/dist/{chunk-hz8m927w.js.map → chunk-zqysyfjt.js.map} +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/projections/errors.ts", "../src/projections/ownership.ts", "../src/projections/validation.ts", "../src/projections/builders.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"export class ProjectionValidationError extends Error {\n readonly name = \"ProjectionValidationError\"\n}\n",
|
|
6
|
-
"import { compareStrings } from \"../json\"\nimport type { OntologyRegistry } from \"../ontology\"\nimport { ProjectionValidationError } from \"./errors\"\nimport type { ProjectionDefinition, ProjectionOwnership } from \"./types\"\n\nexport function computeProjectionOwnership(\n projection: ProjectionDefinition,\n ontology: OntologyRegistry\n): ProjectionOwnership {\n if (projection._tag === \"ObjectProjectionDefinition\") {\n const primaryId = ontology.getPrimaryPropertyId(projection.objectTypeId)\n return freezeOwnership({\n objects: [\n {\n objectTypeId: projection.objectTypeId,\n existence: true,\n propertyIds: Object.keys(projection.properties)\n .filter((propertyId) => propertyId !== primaryId)\n .sort(compareStrings),\n },\n ],\n links: Object.keys(projection.links)\n .sort(compareStrings)\n .map((linkId) => ({ sourceObjectTypeId: projection.objectTypeId, linkId })),\n telemetry: [],\n })\n }\n\n if (projection._tag === \"LinkProjectionDefinition\") {\n return freezeOwnership({\n objects: [],\n links: [\n {\n sourceObjectTypeId: projection.sourceObjectTypeId,\n linkId: projection.linkId,\n },\n ],\n telemetry: [],\n })\n }\n\n return freezeOwnership({\n objects: [],\n links: [],\n telemetry: [\n {\n objectTypeId: projection.objectTypeId,\n propertyId: projection.propertyId,\n },\n ],\n })\n}\n\nexport interface ProjectionOwnershipRecord<\n TDefinition extends ProjectionDefinition = ProjectionDefinition,\n> {\n readonly definition: TDefinition\n readonly ownership: ProjectionOwnership\n}\n\nexport function validateProjectionOwnership(\n projections: readonly ProjectionOwnershipRecord[]\n): void {\n const existenceOwners = new Map<string, string>()\n const propertyOwners = new Map<string, string>()\n const linkOwners = new Map<string, string>()\n const telemetryOwners = new Map<string, string>()\n\n for (const { definition, ownership } of projections) {\n for (const object of ownership.objects) {\n if (object.existence) {\n registerOwner(\n existenceOwners,\n object.objectTypeId,\n definition.id,\n `object type '${object.objectTypeId}' existence`\n )\n }\n for (const propertyId of object.propertyIds) {\n registerOwner(\n propertyOwners,\n JSON.stringify([object.objectTypeId, propertyId]),\n definition.id,\n `property '${object.objectTypeId}.${propertyId}'`\n )\n }\n }\n for (const link of ownership.links) {\n registerOwner(\n linkOwners,\n JSON.stringify([link.sourceObjectTypeId, link.linkId]),\n definition.id,\n `link scope '${link.sourceObjectTypeId}.${link.linkId}'`\n )\n }\n for (const telemetry of ownership.telemetry) {\n registerOwner(\n telemetryOwners,\n JSON.stringify([telemetry.objectTypeId, telemetry.propertyId]),\n definition.id,\n `telemetry source '${telemetry.objectTypeId}.${telemetry.propertyId}'`\n )\n }\n }\n}\n\nfunction registerOwner(\n owners: Map<string, string>,\n key: string,\n projectionId: string,\n description: string\n): void {\n const existing = owners.get(key)\n if (existing !== undefined) {\n throw new ProjectionValidationError(\n `[Sixb] Projection '${projectionId}' overlaps ${description} owned by projection '${existing}'.`\n )\n }\n owners.set(key, projectionId)\n}\n\nfunction freezeOwnership(ownership: ProjectionOwnership): ProjectionOwnership {\n return Object.freeze({\n objects: Object.freeze(\n ownership.objects.map((object) =>\n Object.freeze({ ...object, propertyIds: Object.freeze([...object.propertyIds]) })\n )\n ),\n links: Object.freeze(ownership.links.map((link) => Object.freeze({ ...link }))),\n telemetry: Object.freeze(\n ownership.telemetry.map((telemetry) => Object.freeze({ ...telemetry }))\n ),\n })\n}\n",
|
|
7
|
-
"/**\n * Build-time validation helpers for projection definitions.\n *\n * These run eagerly inside builder calls (not deferred to `.build()`).\n * They are also reusable by Increment 7 for startup validation.\n */\n\nimport type { DatasetDefinition } from \"../datasets\"\nimport type { OntologyRegistry } from \"../ontology\"\nimport type { ObjectType, Property } from \"../ontology/types\"\nimport { ProjectionValidationError } from \"./errors\"\nimport {\n computeProjectionOwnership,\n type ProjectionOwnershipRecord,\n validateProjectionOwnership,\n} from \"./ownership\"\nimport type {\n ForeignKeyDescriptor,\n LinkProjectionDefinition,\n ObjectProjectionDefinition,\n ProjectionDefinition,\n TelemetryProjectionDefinition,\n} from \"./types\"\n\n/**\n * Validates the property mapping for an object projection.\n *\n * Rules:\n * 1. All keys must be valid property ids on the object type.\n * 2. The object type must have exactly one primary property.\n * 3. The primary property must be included in the mapping.\n */\nexport function validatePropertyMapping(\n objectType: ObjectType,\n mapping: Record<string, string>\n): void {\n const propertyIds = new Set(objectType.properties.map((p) => p.id))\n const mappingKeys = Object.keys(mapping)\n\n // Rule 1: all keys are valid property ids\n for (const key of mappingKeys) {\n if (!propertyIds.has(key)) {\n const available = [...propertyIds].sort().join(\", \")\n throw new ProjectionValidationError(\n `Property '${key}' does not exist on object type '${objectType.id}'. ` +\n `Available properties: ${available}`\n )\n }\n }\n\n // Rule 2: exactly one primary property\n const primaryProperties = objectType.properties.filter((p) => p.primary === true)\n if (primaryProperties.length !== 1) {\n throw new ProjectionValidationError(\n `Object type '${objectType.id}' must have exactly one primary property, ` +\n `found ${primaryProperties.length}.`\n )\n }\n\n // Rule 3: primary property is in the mapping\n const primaryId = primaryProperties[0].id\n if (!(primaryId in mapping)) {\n throw new ProjectionValidationError(\n `Primary property '${primaryId}' of object type '${objectType.id}' ` +\n `must be included in the property mapping.`\n )\n }\n}\n\n/**\n * Validates the link mapping for an object projection and returns a validated copy.\n *\n * Rules:\n * 1. All keys must be valid link ids on the object type.\n * 2. Record key must match descriptor.linkId.\n * 3. Link target must be a single concrete type (not polymorphic or wildcard).\n * 4. The descriptor must use exactly one source: sourcePropertyId or sourceField.\n * 5. Source properties must exist and be present in the property mapping.\n * Source fields are validated later against the projection dataset.\n */\nexport function validateAndLowerLinkMapping(\n objectType: ObjectType,\n linkMapping: Record<string, ForeignKeyDescriptor>,\n propertyMapping: Record<string, string>\n): Record<string, ForeignKeyDescriptor> {\n const linkIds = new Set(objectType.links.map((l) => l.id))\n const linksById = new Map(objectType.links.map((l) => [l.id, l]))\n const propertyIds = new Set(objectType.properties.map((p) => p.id))\n\n for (const [key, descriptor] of Object.entries(linkMapping)) {\n // Rule 1: valid link id\n if (!linkIds.has(key)) {\n const available = [...linkIds].sort().join(\", \")\n throw new ProjectionValidationError(\n `Link '${key}' does not exist on object type '${objectType.id}'. ` +\n `Available links: ${available}`\n )\n }\n\n // Rule 2: key matches descriptor.linkId\n if (key !== descriptor.linkId) {\n throw new ProjectionValidationError(\n `Link mapping key '${key}' does not match descriptor linkId '${descriptor.linkId}'.`\n )\n }\n\n // Rule 3: single concrete target\n const link = linksById.get(key)!\n if (Array.isArray(link.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `Link '${key}' on object type '${objectType.id}' has a polymorphic target. ` +\n `FK projection of polymorphic links is not yet supported.`\n )\n }\n if (link.targetObjectTypeId === \"*\") {\n throw new ProjectionValidationError(\n `Link '${key}' on object type '${objectType.id}' has a wildcard target. ` +\n `FK projection of wildcard links is not supported.`\n )\n }\n\n const sourcePropertyId = descriptor.sourcePropertyId\n const sourceField = descriptor.sourceField\n if (sourcePropertyId && sourceField) {\n throw new ProjectionValidationError(\n `FK link '${key}' must use either sourceProperty or sourceField, not both.`\n )\n }\n if (!sourcePropertyId && !sourceField) {\n throw new ProjectionValidationError(\n `FK link '${key}' must declare sourceProperty or sourceField.`\n )\n }\n\n if (!sourcePropertyId) {\n continue\n }\n\n // Rule 4: source property exists on the type\n if (!propertyIds.has(sourcePropertyId)) {\n const available = [...propertyIds].sort().join(\", \")\n throw new ProjectionValidationError(\n `Source property '${sourcePropertyId}' does not exist on ` +\n `object type '${objectType.id}'. Available properties: ${available}`\n )\n }\n\n // Rule 5: source property is in the property mapping\n if (!(sourcePropertyId in propertyMapping)) {\n throw new ProjectionValidationError(\n `Source property '${sourcePropertyId}' for link '${key}' ` +\n `must be included in the property mapping.`\n )\n }\n }\n\n return Object.fromEntries(\n Object.entries(linkMapping).map(([linkId, descriptor]) => [\n linkId,\n {\n linkId: descriptor.linkId,\n ...(descriptor.sourcePropertyId !== undefined\n ? { sourcePropertyId: descriptor.sourcePropertyId }\n : {}),\n ...(descriptor.sourceField !== undefined ? { sourceField: descriptor.sourceField } : {}),\n targetObjectTypeId: descriptor.targetObjectTypeId,\n },\n ])\n )\n}\n\n/**\n * Validates that a link token points to a single concrete target type.\n *\n * Rules:\n * 1. Not an array (polymorphic).\n * 2. Not wildcard (\"*\").\n */\nexport function validateLinkProjectionTarget(linkToken: {\n readonly id: string\n readonly targetObjectTypeId: string | readonly string[]\n}): void {\n if (Array.isArray(linkToken.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `Link '${linkToken.id}' has a polymorphic target. ` +\n `Link projection of polymorphic links is not yet supported.`\n )\n }\n if (linkToken.targetObjectTypeId === \"*\") {\n throw new ProjectionValidationError(\n `Link '${linkToken.id}' has a wildcard target. ` +\n `Link projection of wildcard links is not supported.`\n )\n }\n}\n\n/**\n * Validates a telemetry projection's field mapping against its dataset columns\n * and object type: the telemetry property exists and is telemetry-enabled, and\n * every mapped field (objectId/at/value/unit) resolves to a real dataset column.\n *\n * Owned here so startup validation and the projection worker's pre-execution\n * check share one implementation and cannot drift; the worker layers\n * dataset-version column type compatibility on top of these rules. Returns the\n * resolved telemetry property for callers that need its schema.\n */\nexport function validateTelemetryProjectionFieldMapping(\n projection: TelemetryProjectionDefinition,\n objectType: { readonly id: string; readonly properties: readonly Property[] },\n datasetColumnNames: ReadonlySet<string>,\n prefix: string\n): Property {\n const property = objectType.properties.find((candidate) => candidate.id === projection.propertyId)\n if (!property) {\n throw new ProjectionValidationError(\n `${prefix}: unknown property \"${projection.propertyId}\" on type \"${projection.objectTypeId}\"`\n )\n }\n if (property.mode !== \"telemetry\") {\n throw new ProjectionValidationError(\n `${prefix}: property \"${projection.propertyId}\" on type \"${projection.objectTypeId}\" must be telemetry-enabled`\n )\n }\n\n const mappedFields = [\n [\"objectId\", projection.objectIdField],\n [\"at\", projection.atField],\n [\"value\", projection.valueField],\n ...(projection.unitField !== undefined ? ([[\"unit\", projection.unitField]] as const) : []),\n ] as const\n for (const [fieldRole, columnName] of mappedFields) {\n if (!datasetColumnNames.has(columnName)) {\n throw new ProjectionValidationError(\n `${prefix}: ${fieldRole} field \"${columnName}\" references unknown dataset column ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n }\n\n return property\n}\n\n/**\n * Validates all registered projections against the ontology at startup.\n *\n * For object projections:\n * 1. `datasetId` exists in the dataset registry.\n * 2. `objectTypeId` exists in the type registry.\n * 3. All property mapping keys are valid property ids on the type.\n * 4. All mapped dataset columns exist in the referenced dataset.\n * 5. The primary property is included in the property mapping.\n * 6. FK link descriptors reference valid links, valid source properties (present in mapping),\n * and valid target types with primaries.\n *\n * For link projections:\n * 1. `datasetId` exists in the dataset registry.\n * 2. Source and target types exist.\n * 3. The link exists on the source type.\n * 4. Source and target fields exist in the referenced dataset.\n * 5. Both source and target types have primary properties.\n *\n * For telemetry projections:\n * 1. `datasetId` exists in the dataset registry.\n * 2. `objectTypeId` exists in the type registry.\n * 3. `propertyId` exists on the object type and is telemetry-enabled.\n * 4. Point mapping fields exist in the referenced dataset.\n */\nexport interface ValidatedProjectionRecord<TDefinition extends ProjectionDefinition>\n extends ProjectionOwnershipRecord<TDefinition> {\n readonly dataset: DatasetDefinition\n}\n\nexport interface ProjectionValidationInput {\n readonly objectProjections: readonly ObjectProjectionDefinition[]\n readonly linkProjections: readonly LinkProjectionDefinition[]\n readonly telemetryProjections: readonly TelemetryProjectionDefinition[]\n}\n\nexport interface ValidatedProjectionCatalog {\n readonly objectProjections: readonly ValidatedProjectionRecord<ObjectProjectionDefinition>[]\n readonly linkProjections: readonly ValidatedProjectionRecord<LinkProjectionDefinition>[]\n readonly telemetryProjections: readonly ValidatedProjectionRecord<TelemetryProjectionDefinition>[]\n}\n\nexport function validateProjectionsAtStartup(\n projections: ProjectionValidationInput,\n ontology: OntologyRegistry,\n datasetsById: ReadonlyMap<string, DatasetDefinition>\n): ValidatedProjectionCatalog {\n const { objectProjections, linkProjections, telemetryProjections } = projections\n const objectTypesById = ontology.getObjectTypesById()\n const primaryByTypeId = ontology.getPrimaryByTypeId()\n const validatedObjectProjections: ValidatedProjectionRecord<ObjectProjectionDefinition>[] = []\n const validatedLinkProjections: ValidatedProjectionRecord<LinkProjectionDefinition>[] = []\n const validatedTelemetryProjections: ValidatedProjectionRecord<TelemetryProjectionDefinition>[] =\n []\n\n validateMaterializationOntologyConstraints(ontology)\n\n for (const projection of objectProjections) {\n const prefix = `Projection \"${projection.id}\"`\n const dataset = datasetsById.get(projection.datasetId)\n if (!dataset) {\n throw new ProjectionValidationError(\n `${prefix}: unknown dataset \"${projection.datasetId}\". ` +\n `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n const objectType = objectTypesById.get(projection.objectTypeId)\n if (!objectType) {\n throw new ProjectionValidationError(\n `${prefix}: unknown object type \"${projection.objectTypeId}\"`\n )\n }\n\n const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name))\n const propertyIds = new Set(objectType.properties.map((p) => p.id))\n for (const [propId, columnName] of Object.entries(projection.properties)) {\n if (!propertyIds.has(propId)) {\n throw new ProjectionValidationError(\n `${prefix}: unknown property \"${propId}\" on type \"${projection.objectTypeId}\"`\n )\n }\n if (!datasetColumnNames.has(columnName)) {\n throw new ProjectionValidationError(\n `${prefix}: property \"${propId}\" references unknown dataset column \"${columnName}\" ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n const property = objectType.properties.find((candidate) => candidate.id === propId)\n if (property?.mode === \"telemetry\") {\n throw new ProjectionValidationError(\n `[Sixb] ${prefix}: source mappings cannot own telemetry property \"${projection.objectTypeId}.${propId}\"`\n )\n }\n }\n\n const primaryId = primaryByTypeId.get(projection.objectTypeId)!\n if (!(primaryId in projection.properties)) {\n throw new ProjectionValidationError(\n `${prefix}: primary property \"${primaryId}\" must be in property mapping`\n )\n }\n\n const linkIds = new Set(objectType.links.map((l) => l.id))\n for (const [linkId, fk] of Object.entries(projection.links)) {\n if (!linkIds.has(linkId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" references unknown link on type \"${projection.objectTypeId}\"`\n )\n }\n if (fk.linkId !== linkId) {\n throw new ProjectionValidationError(\n `${prefix}: FK link mapping key \"${linkId}\" does not match descriptor linkId \"${fk.linkId}\"`\n )\n }\n const sourcePropertyId = fk.sourcePropertyId\n const sourceField = fk.sourceField\n if (sourcePropertyId && sourceField) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" must use either sourcePropertyId or sourceField, not both`\n )\n }\n if (!sourcePropertyId && !sourceField) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" must declare sourcePropertyId or sourceField`\n )\n }\n if (sourcePropertyId && !propertyIds.has(sourcePropertyId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" source property \"${sourcePropertyId}\" does not exist on type \"${projection.objectTypeId}\"`\n )\n }\n if (sourcePropertyId && !(sourcePropertyId in projection.properties)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" source property \"${sourcePropertyId}\" must be in property mapping`\n )\n }\n if (sourceField && !datasetColumnNames.has(sourceField)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" source field \"${sourceField}\" references unknown dataset column on dataset \"${projection.datasetId}\"`\n )\n }\n if (!objectTypesById.has(fk.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" target type \"${fk.targetObjectTypeId}\" is unknown`\n )\n }\n if (!primaryByTypeId.has(fk.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" target type \"${fk.targetObjectTypeId}\" has no primary property`\n )\n }\n const link = objectType.links.find((candidate) => candidate.id === linkId)!\n if (!ontology.isValidLinkTarget(link.targetObjectTypeId, fk.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" target type \"${fk.targetObjectTypeId}\" is not compatible with its declared target`\n )\n }\n }\n\n validatedObjectProjections.push({\n definition: projection,\n dataset,\n ownership: computeProjectionOwnership(projection, ontology),\n })\n }\n\n for (const projection of linkProjections) {\n const prefix = `Projection \"${projection.id}\"`\n const dataset = datasetsById.get(projection.datasetId)\n if (!dataset) {\n throw new ProjectionValidationError(\n `${prefix}: unknown dataset \"${projection.datasetId}\". ` +\n `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n if (!objectTypesById.has(projection.sourceObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: unknown source type \"${projection.sourceObjectTypeId}\"`\n )\n }\n if (!objectTypesById.has(projection.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: unknown target type \"${projection.targetObjectTypeId}\"`\n )\n }\n const sourceType = objectTypesById.get(projection.sourceObjectTypeId)!\n const link = sourceType.links.find((candidate) => candidate.id === projection.linkId)\n if (!link) {\n throw new ProjectionValidationError(\n `${prefix}: link \"${projection.linkId}\" does not exist on source type \"${projection.sourceObjectTypeId}\"`\n )\n }\n if (!ontology.isValidLinkTarget(link.targetObjectTypeId, projection.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: target type \"${projection.targetObjectTypeId}\" is not compatible with link \"${projection.linkId}\"`\n )\n }\n const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name))\n if (!datasetColumnNames.has(projection.sourceField)) {\n throw new ProjectionValidationError(\n `${prefix}: source field \"${projection.sourceField}\" references unknown dataset column ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n if (!datasetColumnNames.has(projection.targetField)) {\n throw new ProjectionValidationError(\n `${prefix}: target field \"${projection.targetField}\" references unknown dataset column ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n if (!primaryByTypeId.has(projection.sourceObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: source type \"${projection.sourceObjectTypeId}\" has no primary property`\n )\n }\n if (!primaryByTypeId.has(projection.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: target type \"${projection.targetObjectTypeId}\" has no primary property`\n )\n }\n\n validatedLinkProjections.push({\n definition: projection,\n dataset,\n ownership: computeProjectionOwnership(projection, ontology),\n })\n }\n\n for (const projection of telemetryProjections) {\n const prefix = `Projection \"${projection.id}\"`\n const dataset = datasetsById.get(projection.datasetId)\n if (!dataset) {\n throw new ProjectionValidationError(\n `${prefix}: unknown dataset \"${projection.datasetId}\". ` +\n `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n const objectType = objectTypesById.get(projection.objectTypeId)\n if (!objectType) {\n throw new ProjectionValidationError(\n `${prefix}: unknown object type \"${projection.objectTypeId}\"`\n )\n }\n\n const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name))\n validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, prefix)\n validatedTelemetryProjections.push({\n definition: projection,\n dataset,\n ownership: computeProjectionOwnership(projection, ontology),\n })\n }\n\n const validatedProjections = [\n ...validatedObjectProjections,\n ...validatedLinkProjections,\n ...validatedTelemetryProjections,\n ]\n validateProjectionOwnership(validatedProjections)\n return {\n objectProjections: validatedObjectProjections,\n linkProjections: validatedLinkProjections,\n telemetryProjections: validatedTelemetryProjections,\n }\n}\n\nfunction validateMaterializationOntologyConstraints(ontology: OntologyRegistry): void {\n for (const objectType of ontology.getObjectTypesById().values()) {\n for (const property of objectType.properties) {\n if (property.mode === \"telemetry\" && property.required === true) {\n throw new ProjectionValidationError(\n `[Sixb] Telemetry property '${objectType.id}.${property.id}' cannot be required.`\n )\n }\n }\n for (const link of objectType.links) {\n for (const property of link.properties ?? []) {\n if (property.mode === \"telemetry\") {\n throw new ProjectionValidationError(\n `[Sixb] Link property '${objectType.id}.${link.id}.${property.id}' cannot use telemetry mode.`\n )\n }\n }\n }\n }\n}\n",
|
|
8
|
-
"/**\n * Projection DSL builders, helpers, and type guards.\n *\n * Uses the same fluent builder style as the other definition APIs.\n */\n\nimport type {\n DatasetColumnNameOf,\n DatasetColumnType,\n DatasetColumnTypeOf,\n DatasetDefinition,\n} from \"../datasets\"\nimport type { LinkToken, PropertyToken } from \"../ontology/tokens\"\nimport type { ObjectLink, ObjectType, Property, Schema } from \"../ontology/types\"\nimport { ProjectionValidationError } from \"./errors\"\nimport type {\n ForeignKeyDescriptor,\n LinkProjectionDefinition,\n LinkProjectionTarget,\n ObjectProjectionDefinition,\n ObjectProjectionTarget,\n ProjectionDefinition,\n ProjectionTarget,\n TelemetryProjectionDefinition,\n} from \"./types\"\nimport {\n validateAndLowerLinkMapping,\n validateLinkProjectionTarget,\n validatePropertyMapping,\n} from \"./validation\"\n\n// ── Internal helpers ─────────────────────────────────────────\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (!value.trim()) {\n throw new ProjectionValidationError(`Projection ${field} must not be empty.`)\n }\n}\n\nfunction assertProjectionDataset(dataset: DatasetDefinition): void {\n if (!dataset || dataset.kind !== \"dataset\" || typeof dataset.id !== \"string\") {\n throw new ProjectionValidationError(\"Projection dataset must be a dataset definition.\")\n }\n assertNonEmpty(dataset.id, \"dataset id\")\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\n// ── Type utilities ───────────────────────────────────────────\n\n/** Union of property ids from an ObjectType. */\ntype PropertyIdOf<T extends ObjectType> = T[\"properties\"][number][\"id\"]\n\n/** Property definition by id from an ObjectType. */\ntype PropertyById<T extends ObjectType, TPropertyId extends PropertyIdOf<T>> = Extract<\n T[\"properties\"][number],\n { id: TPropertyId }\n>\n\n/** Union of link ids from an ObjectType. */\ntype LinkIdOf<T extends ObjectType> = T[\"links\"][number][\"id\"]\n\ntype LinkById<T extends ObjectType, TLinkId extends LinkIdOf<T>> = Extract<\n T[\"links\"][number],\n { id: TLinkId }\n>\n\ntype SingleTargetIdOf<TLink extends ObjectLink> = TLink[\"targetObjectTypeId\"] extends string\n ? TLink[\"targetObjectTypeId\"]\n : never\n\ntype ResolvedProjectionSchema<TSchema extends Schema> = TSchema extends {\n type: \"valueTypeRef\"\n _resolved: infer TResolved extends Schema\n}\n ? ResolvedProjectionSchema<TResolved>\n : TSchema extends { type: \"valueTypeRef\" }\n ? never\n : TSchema\n\ntype StringCompatibleProjectionSchema =\n | \"string\"\n | \"uuid\"\n | { type: \"enum\"; values: readonly string[] }\n\ntype IntegerCompatibleProjectionSchema =\n | \"integer\"\n | \"double\"\n | \"decimal\"\n | { type: \"enum\"; values: readonly number[] }\n\ntype JsonCompatibleProjectionSchema = { type: \"object\" | \"array\" | \"map\" | \"enum\" }\n\ntype ProjectionSchemaByDatasetColumnType = {\n readonly string: StringCompatibleProjectionSchema\n readonly boolean: \"boolean\"\n readonly int64: IntegerCompatibleProjectionSchema\n readonly float64: \"double\"\n readonly decimal: \"decimal\" | \"double\"\n readonly date: \"date\"\n readonly timestamp: \"timestamp\"\n readonly json: JsonCompatibleProjectionSchema\n readonly fileRef: \"fileRef\"\n}\n\ntype DatasetColumnCompatibleWithSchema<\n TColumnType extends DatasetColumnType,\n TSchema extends Schema,\n> = [ResolvedProjectionSchema<TSchema>] extends [never]\n ? false\n : ResolvedProjectionSchema<TSchema> extends ProjectionSchemaByDatasetColumnType[TColumnType]\n ? true\n : false\n\ntype DatasetColumnNameCompatibleWithSchema<\n TDataset extends DatasetDefinition,\n TSchema extends Schema,\n> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnCompatibleWithSchema<\n DatasetColumnTypeOf<TDataset, TColumnName>,\n TSchema\n > extends true\n ? TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype StringDatasetColumnNameOf<TDataset extends DatasetDefinition> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnTypeOf<\n TDataset,\n TColumnName\n > extends \"string\"\n ? TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype DateLikeDatasetColumnNameOf<TDataset extends DatasetDefinition> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnTypeOf<\n TDataset,\n TColumnName\n > extends \"string\" | \"date\" | \"timestamp\"\n ? TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype ProjectionMappingFor<TObjectType extends ObjectType, TDataset extends DatasetDefinition> = {\n readonly [TPropertyId in PropertyIdOf<TObjectType>]?: DatasetColumnNameCompatibleWithSchema<\n TDataset,\n PropertyById<TObjectType, TPropertyId>[\"schema\"]\n >\n}\n\ntype ExactProjectionMapping<TObjectType extends ObjectType, TMapping> = TMapping & {\n readonly [TKey in Exclude<keyof TMapping, PropertyIdOf<TObjectType>>]: never\n}\n\ntype TelemetryPropertyToken<TObjectTypeId extends string = string> = PropertyToken<\n TObjectTypeId,\n string,\n Property & { readonly mode: \"telemetry\" }\n>\n\ntype TelemetryProjectionPointMapping<\n TPropertyToken extends TelemetryPropertyToken,\n TDataset extends DatasetDefinition,\n> = {\n readonly objectId: StringDatasetColumnNameOf<TDataset>\n readonly at: DateLikeDatasetColumnNameOf<TDataset>\n readonly value: DatasetColumnNameCompatibleWithSchema<\n TDataset,\n TPropertyToken[\"property\"][\"schema\"]\n >\n readonly unit?: StringDatasetColumnNameOf<TDataset>\n}\n\ntype ExactTelemetryProjectionPointMapping<TMapping> = TMapping & {\n readonly [TKey in Exclude<keyof TMapping, \"objectId\" | \"at\" | \"value\" | \"unit\">]: never\n}\n\ntype ForeignKeyFromSourceProperty = Omit<\n ForeignKeyDescriptor,\n \"sourcePropertyId\" | \"sourceField\"\n> & {\n readonly sourcePropertyId: string\n readonly sourceField?: never\n}\n\ntype ForeignKeyFromSourceField<TSourceField extends string = string> = Omit<\n ForeignKeyDescriptor,\n \"sourcePropertyId\" | \"sourceField\"\n> & {\n readonly sourcePropertyId?: never\n readonly sourceField: TSourceField\n}\n\ntype ProjectionForeignKeyDescriptor<TDataset extends DatasetDefinition> =\n | ForeignKeyFromSourceProperty\n | ForeignKeyFromSourceField<StringDatasetColumnNameOf<TDataset>>\n\ntype ProjectionForeignKeyTokenInput<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n TLinkId extends LinkIdOf<TObjectType>,\n> =\n | {\n readonly link: LinkToken<\n TObjectType[\"id\"],\n TLinkId,\n SingleTargetIdOf<LinkById<TObjectType, TLinkId>>\n >\n readonly sourceProperty: PropertyToken<TObjectType[\"id\"]>\n readonly target: ObjectType &\n (\n | { id: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n | { extends: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n )\n }\n | {\n readonly link: LinkToken<\n TObjectType[\"id\"],\n TLinkId,\n SingleTargetIdOf<LinkById<TObjectType, TLinkId>>\n >\n readonly sourceField: StringDatasetColumnNameOf<TDataset>\n readonly target: ObjectType &\n (\n | { id: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n | { extends: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n )\n }\n\ntype ProjectionForeignKeyInput<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n TLinkId extends LinkIdOf<TObjectType>,\n> =\n | ProjectionForeignKeyDescriptor<TDataset>\n | ProjectionForeignKeyTokenInput<TObjectType, TDataset, TLinkId>\n\nfunction lowerForeignKeyMapping<TObjectType extends ObjectType, TDataset extends DatasetDefinition>(\n mapping: {\n [K in LinkIdOf<TObjectType>]?: ProjectionForeignKeyInput<TObjectType, TDataset, K>\n }\n): Record<string, ForeignKeyDescriptor> {\n const lowered: Record<string, ForeignKeyDescriptor> = {}\n for (const [linkId, descriptor] of Object.entries(mapping)) {\n if (!descriptor) continue\n lowered[linkId] = isForeignKeyDescriptor(descriptor)\n ? descriptor\n : fromForeignKey(descriptor as Parameters<typeof fromForeignKey>[0])\n }\n return lowered\n}\n\nfunction isForeignKeyDescriptor(value: unknown): value is ForeignKeyDescriptor {\n return isRecord(value) && typeof value.linkId === \"string\"\n}\n\n// ── defineProjection ─────────────────────────────────────────\n\ninterface ObjectProjectionSourceBuilder<TObjectType extends ObjectType> {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): ObjectProjectionMappingBuilder<TObjectType, TDataset>\n}\n\ninterface ObjectProjectionMappingBuilder<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n> {\n properties<const TMapping extends ProjectionMappingFor<TObjectType, TDataset>>(\n mapping: ExactProjectionMapping<TObjectType, TMapping>\n ): ObjectProjectionDefinition & ObjectProjectionLinkBuilder<TObjectType, TDataset>\n}\n\ninterface ObjectProjectionLinkBuilder<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n> {\n withLinks(\n mapping: { [K in LinkIdOf<TObjectType>]?: ProjectionForeignKeyInput<TObjectType, TDataset, K> }\n ): ObjectProjectionDefinition\n}\n\n/**\n * Defines an object, link, or telemetry projection from its ontology target.\n *\n * ```ts\n * defineProjection(\"room-projection\", Room)\n * .fromDataset(canonicalRoomsDataset)\n * .properties({ id: \"room_id\", name: \"room_name\" })\n * .withLinks({\n * inBuilding: {\n * link: Room.l.inBuilding,\n * sourceField: \"building_id\",\n * target: Building,\n * },\n * })\n * ```\n */\nexport function defineProjection<const TObjectType extends ObjectType>(\n id: string,\n objectType: TObjectType\n): ObjectProjectionSourceBuilder<TObjectType>\nexport function defineProjection<\n TObjectTypeId extends string,\n TLinkId extends string,\n TTargetObjectTypeId extends string,\n>(\n id: string,\n linkToken: LinkToken<TObjectTypeId, TLinkId, TTargetObjectTypeId>\n): LinkProjectionSourceBuilder\nexport function defineProjection<const TPropertyToken extends TelemetryPropertyToken>(\n id: string,\n propertyToken: TPropertyToken\n): TelemetryProjectionSourceBuilder<TPropertyToken>\nexport function defineProjection(\n id: string,\n target: ObjectType | LinkToken<string, string, string> | TelemetryPropertyToken\n):\n | ObjectProjectionSourceBuilder<ObjectType>\n | LinkProjectionSourceBuilder\n | TelemetryProjectionSourceBuilder<TelemetryPropertyToken> {\n if (\"link\" in target) return buildLinkProjection(id, target)\n if (\"property\" in target) return buildTelemetryProjection(id, target)\n return buildObjectProjection(id, target)\n}\n\nfunction buildObjectProjection<const TObjectType extends ObjectType>(\n id: string,\n objectType: TObjectType\n): ObjectProjectionSourceBuilder<TObjectType> {\n assertNonEmpty(id, \"id\")\n\n return {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): ObjectProjectionMappingBuilder<TObjectType, TDataset> {\n assertProjectionDataset(dataset)\n const datasetId = dataset.id\n\n return {\n properties<const TMapping extends ProjectionMappingFor<TObjectType, TDataset>>(\n mapping: ExactProjectionMapping<TObjectType, TMapping>\n ): ObjectProjectionDefinition & ObjectProjectionLinkBuilder<TObjectType, TDataset> {\n const propertyMapping = mapping as Record<string, string>\n validatePropertyMapping(objectType, propertyMapping)\n\n const definition: ObjectProjectionDefinition = {\n _tag: \"ObjectProjectionDefinition\",\n id,\n objectTypeId: objectType.id,\n datasetId,\n properties: { ...propertyMapping },\n links: {},\n }\n\n return Object.assign(definition, {\n withLinks(\n linkMapping: {\n [K in LinkIdOf<TObjectType>]?: ProjectionForeignKeyInput<TObjectType, TDataset, K>\n }\n ): ObjectProjectionDefinition {\n const loweredLinkMapping = lowerForeignKeyMapping(linkMapping)\n const validatedLinks = validateAndLowerLinkMapping(\n objectType,\n loweredLinkMapping,\n propertyMapping\n )\n\n return {\n _tag: \"ObjectProjectionDefinition\",\n id,\n objectTypeId: objectType.id,\n datasetId,\n properties: { ...propertyMapping },\n links: validatedLinks,\n }\n },\n })\n },\n }\n },\n }\n}\n\n// ── Telemetry projection ────────────────────────────────────\n\ninterface TelemetryProjectionSourceBuilder<TPropertyToken extends TelemetryPropertyToken> {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): TelemetryProjectionMappingBuilder<TPropertyToken, TDataset>\n}\n\ninterface TelemetryProjectionMappingBuilder<\n TPropertyToken extends TelemetryPropertyToken,\n TDataset extends DatasetDefinition,\n> {\n points<const TMapping extends TelemetryProjectionPointMapping<TPropertyToken, TDataset>>(\n mapping: ExactTelemetryProjectionPointMapping<TMapping>\n ): TelemetryProjectionDefinition\n}\n\n/**\n * Fluent builder for {@link TelemetryProjectionDefinition}.\n *\n * ```ts\n * defineProjection(\"room-temperatures\", Room.p.temperature)\n * .fromDataset(roomReadingsDataset)\n * .points({\n * objectId: \"room_id\",\n * at: \"observed_at\",\n * value: \"temperature\",\n * unit: \"unit\",\n * })\n * ```\n */\nfunction buildTelemetryProjection<const TPropertyToken extends TelemetryPropertyToken>(\n id: string,\n propertyToken: TPropertyToken\n): TelemetryProjectionSourceBuilder<TPropertyToken> {\n assertNonEmpty(id, \"id\")\n validateTelemetryProjectionProperty(propertyToken)\n\n return {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): TelemetryProjectionMappingBuilder<TPropertyToken, TDataset> {\n assertProjectionDataset(dataset)\n const datasetId = dataset.id\n\n return {\n points<const TMapping extends TelemetryProjectionPointMapping<TPropertyToken, TDataset>>(\n mapping: ExactTelemetryProjectionPointMapping<TMapping>\n ): TelemetryProjectionDefinition {\n const pointMapping = lowerTelemetryPointMapping(mapping)\n return {\n _tag: \"TelemetryProjectionDefinition\",\n id,\n objectTypeId: propertyToken.objectTypeId,\n propertyId: propertyToken.id,\n datasetId,\n objectIdField: pointMapping.objectId,\n atField: pointMapping.at,\n valueField: pointMapping.value,\n ...(pointMapping.unit !== undefined ? { unitField: pointMapping.unit } : {}),\n }\n },\n }\n },\n }\n}\n\nfunction validateTelemetryProjectionProperty(propertyToken: PropertyToken): void {\n if (propertyToken.property.mode !== \"telemetry\") {\n throw new ProjectionValidationError(\n `Projection property '${propertyToken.objectTypeId}.${propertyToken.id}' must be telemetry-enabled.`\n )\n }\n}\n\nfunction lowerTelemetryPointMapping(mapping: {\n readonly objectId?: string\n readonly at?: string\n readonly value?: string\n readonly unit?: string\n}): {\n readonly objectId: string\n readonly at: string\n readonly value: string\n readonly unit?: string\n} {\n const allowedKeys = new Set([\"objectId\", \"at\", \"value\", \"unit\"])\n for (const key of Object.keys(mapping)) {\n if (!allowedKeys.has(key)) {\n throw new ProjectionValidationError(\n `Telemetry projection point mapping contains unknown key '${key}'.`\n )\n }\n }\n\n if (mapping.objectId === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires objectId.\")\n }\n if (mapping.at === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires at.\")\n }\n if (mapping.value === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires value.\")\n }\n\n assertNonEmpty(mapping.objectId, \"objectId field\")\n assertNonEmpty(mapping.at, \"at field\")\n assertNonEmpty(mapping.value, \"value field\")\n if (mapping.unit !== undefined) {\n assertNonEmpty(mapping.unit, \"unit field\")\n }\n\n return {\n objectId: mapping.objectId,\n at: mapping.at,\n value: mapping.value,\n ...(mapping.unit !== undefined ? { unit: mapping.unit } : {}),\n }\n}\n\n// ── fromForeignKey ───────────────────────────────────────────\n\n/**\n * Creates a {@link ForeignKeyDescriptor} from typed tokens.\n *\n * Compile-time constraints:\n * - `TObjectTypeId` ties `link` and `sourceProperty` to the same object type\n * when a projected source property is used.\n * - `TTargetObjectTypeId` (inferred from the link token) constrains `target`\n * to an ObjectType whose `id` or `extends` matches the link's declared target.\n * This covers exact type match and direct subtypes. Multi-level inheritance\n * is validated at Sixb startup when the full type graph is available.\n *\n * ```ts\n * fromForeignKey({\n * link: Room.l.inBuilding,\n * sourceProperty: Room.p.buildingRef,\n * target: Building,\n * })\n * ```\n */\nexport function fromForeignKey<\n TObjectTypeId extends string,\n TTargetObjectTypeId extends string,\n>(input: {\n link: LinkToken<TObjectTypeId, string, TTargetObjectTypeId>\n sourceProperty: PropertyToken<TObjectTypeId>\n target: ObjectType &\n ({ id: NoInfer<TTargetObjectTypeId> } | { extends: NoInfer<TTargetObjectTypeId> })\n}): ForeignKeyFromSourceProperty\nexport function fromForeignKey<\n TObjectTypeId extends string,\n TTargetObjectTypeId extends string,\n const TSourceField extends string,\n>(input: {\n link: LinkToken<TObjectTypeId, string, TTargetObjectTypeId>\n sourceField: TSourceField\n target: ObjectType &\n ({ id: NoInfer<TTargetObjectTypeId> } | { extends: NoInfer<TTargetObjectTypeId> })\n}): ForeignKeyFromSourceField<TSourceField>\nexport function fromForeignKey<\n TObjectTypeId extends string,\n TTargetObjectTypeId extends string,\n>(input: {\n link: LinkToken<TObjectTypeId, string, TTargetObjectTypeId>\n sourceProperty?: PropertyToken<TObjectTypeId>\n sourceField?: string\n target: ObjectType &\n ({ id: NoInfer<TTargetObjectTypeId> } | { extends: NoInfer<TTargetObjectTypeId> })\n}): ForeignKeyDescriptor {\n validateLinkProjectionTarget(input.link)\n\n if (input.sourceProperty) {\n return {\n linkId: input.link.id,\n sourcePropertyId: input.sourceProperty.id,\n targetObjectTypeId: input.target.id,\n }\n }\n\n if (input.sourceField === undefined) {\n throw new ProjectionValidationError(\"Foreign key sourceField is required.\")\n }\n assertNonEmpty(input.sourceField, \"source field\")\n return {\n linkId: input.link.id,\n sourceField: input.sourceField,\n targetObjectTypeId: input.target.id,\n }\n}\n\n// ── Link projection ─────────────────────────────────────────\n\ninterface LinkProjectionSourceBuilder {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): LinkProjectionFieldBuilder<TDataset>\n}\n\ninterface LinkProjectionFieldBuilder<TDataset extends DatasetDefinition> {\n sourceField(\n columnName: StringDatasetColumnNameOf<TDataset>\n ): LinkProjectionTargetBuilder<TDataset>\n}\n\ninterface LinkProjectionTargetBuilder<TDataset extends DatasetDefinition> {\n targetField(columnName: StringDatasetColumnNameOf<TDataset>): LinkProjectionDefinition\n}\n\n/**\n * Fluent builder for {@link LinkProjectionDefinition} (many-to-many join datasets).\n *\n * ```ts\n * defineProjection(\"room-sensor-links\", Room.l.hasSensors)\n * .fromDataset(roomSensorsDataset)\n * .sourceField(\"room_id\")\n * .targetField(\"sensor_id\")\n * ```\n */\nfunction buildLinkProjection<\n TObjectTypeId extends string,\n TLinkId extends string,\n TTargetObjectTypeId extends string,\n>(\n id: string,\n linkToken: LinkToken<TObjectTypeId, TLinkId, TTargetObjectTypeId>\n): LinkProjectionSourceBuilder {\n assertNonEmpty(id, \"id\")\n validateLinkProjectionTarget(linkToken)\n\n return {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): LinkProjectionFieldBuilder<TDataset> {\n assertProjectionDataset(dataset)\n const datasetId = dataset.id\n\n return {\n sourceField(\n columnName: StringDatasetColumnNameOf<TDataset>\n ): LinkProjectionTargetBuilder<TDataset> {\n assertNonEmpty(columnName, \"source field\")\n\n return {\n targetField(\n targetColumnName: StringDatasetColumnNameOf<TDataset>\n ): LinkProjectionDefinition {\n assertNonEmpty(targetColumnName, \"target field\")\n\n return {\n _tag: \"LinkProjectionDefinition\",\n id,\n linkId: linkToken.id,\n sourceObjectTypeId: linkToken.objectTypeId,\n targetObjectTypeId: linkToken.targetObjectTypeId as string,\n datasetId,\n sourceField: columnName,\n targetField: targetColumnName,\n }\n },\n }\n },\n }\n },\n }\n}\n\n// ── Type guards ──────────────────────────────────────────────\n\n/** Runtime type guard for {@link ObjectProjectionDefinition}. */\nexport function isObjectProjectionDefinition(value: unknown): value is ObjectProjectionDefinition {\n if (!isRecord(value)) return false\n return (\n value._tag === \"ObjectProjectionDefinition\" &&\n typeof value.id === \"string\" &&\n typeof value.objectTypeId === \"string\" &&\n typeof value.datasetId === \"string\" &&\n isRecord(value.properties) &&\n isRecord(value.links)\n )\n}\n\n/** Runtime type guard for {@link LinkProjectionDefinition}. */\nexport function isLinkProjectionDefinition(value: unknown): value is LinkProjectionDefinition {\n if (!isRecord(value)) return false\n return (\n value._tag === \"LinkProjectionDefinition\" &&\n typeof value.id === \"string\" &&\n typeof value.linkId === \"string\" &&\n typeof value.sourceObjectTypeId === \"string\" &&\n typeof value.targetObjectTypeId === \"string\" &&\n typeof value.datasetId === \"string\" &&\n typeof value.sourceField === \"string\" &&\n typeof value.targetField === \"string\"\n )\n}\n\n/** Runtime type guard for {@link TelemetryProjectionDefinition}. */\nexport function isTelemetryProjectionDefinition(\n value: unknown\n): value is TelemetryProjectionDefinition {\n if (!isRecord(value)) return false\n return (\n value._tag === \"TelemetryProjectionDefinition\" &&\n typeof value.id === \"string\" &&\n typeof value.objectTypeId === \"string\" &&\n typeof value.propertyId === \"string\" &&\n typeof value.datasetId === \"string\" &&\n typeof value.objectIdField === \"string\" &&\n typeof value.atField === \"string\" &&\n typeof value.valueField === \"string\" &&\n (value.unitField === undefined || typeof value.unitField === \"string\")\n )\n}\n\n/** Runtime type guard for any {@link ProjectionDefinition}. */\nexport function isProjectionDefinition(value: unknown): value is ProjectionDefinition {\n return (\n isObjectProjectionDefinition(value) ||\n isLinkProjectionDefinition(value) ||\n isTelemetryProjectionDefinition(value)\n )\n}\n\n/** Returns the queue/runtime kind for a projection definition. */\nexport function projectionKindOf(\n projection: ProjectionDefinition\n): \"object\" | \"link\" | \"telemetry\" {\n if (projection._tag === \"ObjectProjectionDefinition\") return \"object\"\n if (projection._tag === \"LinkProjectionDefinition\") return \"link\"\n return \"telemetry\"\n}\n\n/**\n * Extracts the object type id(s) a projection targets, used to authorize run\n * visibility (`object.view`). Link projections require both ends; object and\n * telemetry projections target a single type.\n */\nexport function projectionTargetOf(projection: LinkProjectionDefinition): LinkProjectionTarget\nexport function projectionTargetOf(\n projection: ObjectProjectionDefinition | TelemetryProjectionDefinition\n): ObjectProjectionTarget\nexport function projectionTargetOf(projection: ProjectionDefinition): ProjectionTarget\nexport function projectionTargetOf(projection: ProjectionDefinition): ProjectionTarget {\n return projection._tag === \"LinkProjectionDefinition\"\n ? {\n sourceObjectTypeId: projection.sourceObjectTypeId,\n targetObjectTypeId: projection.targetObjectTypeId,\n }\n : { objectTypeId: projection.objectTypeId }\n}\n\n// ── Categorization ──────────────────────────────────────────\n\n/** Splits a mixed list of projection definitions into typed arrays by tag. */\nexport function categorizeProjections(projections: readonly ProjectionDefinition[]): {\n objectProjections: ObjectProjectionDefinition[]\n linkProjections: LinkProjectionDefinition[]\n telemetryProjections: TelemetryProjectionDefinition[]\n} {\n const objectProjections: ObjectProjectionDefinition[] = []\n const linkProjections: LinkProjectionDefinition[] = []\n const telemetryProjections: TelemetryProjectionDefinition[] = []\n for (const projection of projections) {\n if (isObjectProjectionDefinition(projection)) {\n objectProjections.push(projection)\n } else if (isLinkProjectionDefinition(projection)) {\n linkProjections.push(projection)\n } else if (isTelemetryProjectionDefinition(projection)) {\n telemetryProjections.push(projection)\n }\n }\n return { objectProjections, linkProjections, telemetryProjections }\n}\n"
|
|
9
|
-
],
|
|
10
|
-
"mappings": ";;;;;;AAAO,MAAM,kCAAkC,MAAM;AAAA,EAC1C,OAAO;AAClB;;;ACGO,SAAS,0BAA0B,CACxC,YACA,UACqB;AAAA,EACrB,IAAI,WAAW,SAAS,8BAA8B;AAAA,IACpD,MAAM,YAAY,SAAS,qBAAqB,WAAW,YAAY;AAAA,IACvE,OAAO,gBAAgB;AAAA,MACrB,SAAS;AAAA,QACP;AAAA,UACE,cAAc,WAAW;AAAA,UACzB,WAAW;AAAA,UACX,aAAa,OAAO,KAAK,WAAW,UAAU,EAC3C,OAAO,CAAC,eAAe,eAAe,SAAS,EAC/C,KAAK,cAAc;AAAA,QACxB;AAAA,MACF;AAAA,MACA,OAAO,OAAO,KAAK,WAAW,KAAK,EAChC,KAAK,cAAc,EACnB,IAAI,CAAC,YAAY,EAAE,oBAAoB,WAAW,cAAc,OAAO,EAAE;AAAA,MAC5E,WAAW,CAAC;AAAA,IACd,CAAC;AAAA,EACH;AAAA,EAEA,IAAI,WAAW,SAAS,4BAA4B;A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M,SAAS,mCACf,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,iBAAiB,YAC9B,OAAO,MAAM,eAAe,YAC5B,OAAO,MAAM,cAAc,YAC3B,OAAO,MAAM,kBAAkB,YAC/B,OAAO,MAAM,YAAY,YACzB,OAAO,MAAM,eAAe,aAC3B,MAAM,cAAc,aAAa,OAAO,MAAM,cAAc;AAAA;AAK1D,SAAS,sBAAsB,CAAC,OAA+C;AAAA,EACpF,OACE,6BAA6B,KAAK,KAClC,2BAA2B,KAAK,KAChC,gCAAgC,KAAK;AAAA;AAuBlC,SAAS,kBAAkB,CAAC,YAAoD;AAAA,EACrF,OAAO,WAAW,SAAS,6BACvB;AAAA,IACE,oBAAoB,WAAW;AAAA,IAC/B,oBAAoB,WAAW;AAAA,EACjC,IACA,EAAE,cAAc,WAAW,aAAa;AAAA;",
|
|
11
|
-
"debugId": "92806BDDE8D60B1764756E2164756E21",
|
|
12
|
-
"names": []
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/actions/builders/define-action.ts", "../src/actions/builders/params.ts", "../src/actions/commit-edits.ts", "../src/actions/read-facade.ts", "../src/actions/registry.ts", "../src/actions/runtime.ts", "../src/actions/validators.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { ActionDefinitionError, effectsWithoutEditsMessage } from \"../errors\"\nimport type {\n ActionBuilder,\n ActionEditsHandler,\n ActionEffectsHandler,\n ActionParamsConfig,\n ActionValidator,\n ActionWritebackHandler,\n GlobalActionDefinition,\n GlobalActionEditsHandler,\n GlobalActionEffectsHandler,\n GlobalActionPhaseBuilder,\n GlobalActionValidator,\n GlobalActionWritebackHandler,\n ObjectActionDefinition,\n ObjectActionPhaseBuilder,\n} from \"../types\"\nimport { assertNonEmpty } from \"../validation\"\n\ntype ActionOptions = {\n description?: string\n}\n\nexport function defineAction<const TId extends string>(\n id: TId,\n options?: ActionOptions\n): ActionBuilder<TId> {\n assertNonEmpty(id, \"id\")\n\n return asPublicActionType<ActionBuilder<TId>>(createActionBuilder(id, options))\n}\n\nfunction createActionBuilder(id: string, options?: ActionOptions) {\n const builder = {\n params(params: ActionParamsConfig) {\n return createGlobalActionPhaseBuilder(id, params, options)\n },\n on(objectType: ObjectTypeWithPropertyTokens) {\n assertNonEmpty(objectType.id, \"target id\")\n return createObjectActionParamsBuilder(id, objectType, options)\n },\n }\n\n return builder\n}\n\nfunction createGlobalActionPhaseBuilder(\n id: string,\n params: ActionParamsConfig,\n options?: ActionOptions\n): GlobalActionPhaseBuilder<string, ActionParamsConfig> {\n const validators: GlobalActionValidator<Record<string, unknown>>[] = []\n\n const builder = {\n validate(validator: GlobalActionValidator<Record<string, unknown>>) {\n validators.push(validator)\n return builder\n },\n writeback(handler: GlobalActionWritebackHandler<Record<string, unknown>, unknown>) {\n return createGlobalDefinition({\n id,\n params,\n description: options?.description,\n validators,\n writeback: handler,\n })\n },\n edits(handler: GlobalActionEditsHandler<Record<string, unknown>, undefined>) {\n return createGlobalDefinition({\n id,\n params,\n description: options?.description,\n validators,\n edits: handler,\n })\n },\n }\n\n return asPublicActionType<GlobalActionPhaseBuilder<string, ActionParamsConfig>>(builder)\n}\n\nfunction createObjectActionParamsBuilder(\n id: string,\n objectType: ObjectTypeWithPropertyTokens,\n options?: ActionOptions\n) {\n return {\n params(params: ActionParamsConfig) {\n return createObjectActionPhaseBuilder(id, objectType, params, options)\n },\n }\n}\n\nfunction createObjectActionPhaseBuilder(\n id: string,\n objectType: ObjectTypeWithPropertyTokens,\n params: ActionParamsConfig,\n options?: ActionOptions\n): ObjectActionPhaseBuilder<string, ObjectTypeWithPropertyTokens, ActionParamsConfig> {\n const validators: ActionValidator<ObjectTypeWithPropertyTokens, Record<string, unknown>>[] = []\n\n const builder = {\n validate(validator: ActionValidator<ObjectTypeWithPropertyTokens, Record<string, unknown>>) {\n validators.push(validator)\n return builder\n },\n writeback(\n handler: ActionWritebackHandler<\n ObjectTypeWithPropertyTokens,\n Record<string, unknown>,\n unknown\n >\n ) {\n return createObjectDefinition({\n id,\n objectType,\n params,\n description: options?.description,\n validators,\n writeback: handler,\n })\n },\n edits(\n handler: ActionEditsHandler<ObjectTypeWithPropertyTokens, Record<string, unknown>, undefined>\n ) {\n return createObjectDefinition({\n id,\n objectType,\n params,\n description: options?.description,\n validators,\n edits: handler,\n })\n },\n }\n\n return asPublicActionType<\n ObjectActionPhaseBuilder<string, ObjectTypeWithPropertyTokens, ActionParamsConfig>\n >(builder)\n}\n\nfunction createGlobalDefinition(input: {\n readonly id: string\n readonly params: ActionParamsConfig\n readonly description?: string\n readonly validators: readonly unknown[]\n readonly writeback?: unknown\n readonly edits?: unknown\n readonly effects?: unknown\n}): GlobalActionDefinition {\n const definition = {\n kind: \"action\",\n id: input.id,\n binding: { kind: \"global\" },\n params: input.params,\n phases: {\n validate: [...input.validators],\n ...(input.writeback ? { writeback: input.writeback } : {}),\n ...(input.edits ? { edits: input.edits } : {}),\n ...(input.effects ? { effects: input.effects } : {}),\n },\n ...(input.description !== undefined ? { description: input.description } : {}),\n }\n\n return asPublicActionType<GlobalActionDefinition>(\n Object.assign(definition, {\n edits(handler: GlobalActionEditsHandler<Record<string, unknown>, unknown>) {\n return createGlobalDefinition({\n ...input,\n edits: handler,\n })\n },\n effects(handler: GlobalActionEffectsHandler<Record<string, unknown>, unknown>) {\n if (!input.edits) {\n throw new ActionDefinitionError(effectsWithoutEditsMessage(input.id))\n }\n return createGlobalDefinition({\n ...input,\n effects: handler,\n })\n },\n })\n )\n}\n\nfunction createObjectDefinition(input: {\n readonly id: string\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly params: ActionParamsConfig\n readonly description?: string\n readonly validators: readonly unknown[]\n readonly writeback?: unknown\n readonly edits?: unknown\n readonly effects?: unknown\n}): ObjectActionDefinition {\n const definition = {\n kind: \"action\",\n id: input.id,\n binding: { kind: \"object\", objectType: input.objectType },\n params: input.params,\n phases: {\n validate: [...input.validators],\n ...(input.writeback ? { writeback: input.writeback } : {}),\n ...(input.edits ? { edits: input.edits } : {}),\n ...(input.effects ? { effects: input.effects } : {}),\n },\n ...(input.description !== undefined ? { description: input.description } : {}),\n }\n\n return asPublicActionType<ObjectActionDefinition>(\n Object.assign(definition, {\n edits(\n handler: ActionEditsHandler<ObjectTypeWithPropertyTokens, Record<string, unknown>, unknown>\n ) {\n return createObjectDefinition({\n ...input,\n edits: handler,\n })\n },\n effects(\n handler: ActionEffectsHandler<\n ObjectTypeWithPropertyTokens,\n Record<string, unknown>,\n unknown\n >\n ) {\n if (!input.edits) {\n throw new ActionDefinitionError(effectsWithoutEditsMessage(input.id))\n }\n return createObjectDefinition({\n ...input,\n effects: handler,\n })\n },\n })\n )\n}\n\n// Runtime builders are plain objects; public builder types carry phase-order inference.\nfunction asPublicActionType<TPublic>(value: unknown): TPublic {\n return value as TPublic\n}\n",
|
|
6
|
-
"import type { SchemaOrRef } from \"../../ontology\"\nimport type { QuantitativeTypeId } from \"../../ontology/units\"\nimport type { ActionParamConfig } from \"../types\"\n\ntype ActionParamOptions = {\n description?: string\n semanticType?: QuantitativeTypeId\n nullable?: boolean\n}\n\ntype FieldFromOptions<TOptions, TKey extends string, TFallback> =\n TOptions extends Record<TKey, infer TValue>\n ? { [K in TKey]: TValue }\n : { [K in TKey]?: TFallback }\n\ntype ActionParamResult<\n TSchema extends SchemaOrRef,\n TRequired extends boolean,\n TOptions extends ActionParamOptions | undefined,\n> = {\n schema: TSchema\n required: TRequired\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"semanticType\", QuantitativeTypeId> &\n FieldFromOptions<TOptions, \"nullable\", boolean>\n\nexport function param<\n const TSchema extends SchemaOrRef,\n const TOptions extends ActionParamOptions | undefined = undefined,\n>(schema: TSchema, options?: TOptions): ActionParamResult<TSchema, true, TOptions> {\n const result: ActionParamConfig & { required: true } = {\n schema,\n required: true,\n ...(options?.description !== undefined ? { description: options.description } : {}),\n ...(options?.semanticType !== undefined ? { semanticType: options.semanticType } : {}),\n ...(options?.nullable !== undefined ? { nullable: options.nullable } : {}),\n }\n return result as ActionParamResult<TSchema, true, TOptions>\n}\n\nexport function optional<const TParam extends ActionParamConfig>(\n paramConfig: TParam\n): Omit<TParam, \"required\"> & { readonly required: false } {\n return {\n ...paramConfig,\n required: false,\n }\n}\n",
|
|
7
|
-
"import type { EditBatch } from \"../edits\"\nimport { lowerEditBatch } from \"../edits\"\nimport type { EventActor } from \"../events/envelope\"\nimport type {\n EditCommitResult,\n EffectiveLinkChange,\n EffectiveObjectChange,\n ExpectedLinkRevision,\n ExpectedLinkScopeRevision,\n ExpectedObjectRevision,\n OntologyOperationOutcome,\n} from \"../materializer\"\nimport type { OntologyMutationRuntime } from \"../runtime/ontology-mutations\"\nimport type { Storage } from \"../storage/types\"\nimport { ActionEditCommitError } from \"./errors\"\n\n/** Exact reads an Action handler depended on, protected by row-level CAS at commit time. */\nexport interface ActionReadDependencies {\n readonly objects: readonly ExpectedObjectRevision[]\n readonly links: readonly ExpectedLinkRevision[]\n readonly linkScopes: readonly ExpectedLinkScopeRevision[]\n}\n\nconst NO_READ_DEPENDENCIES: ActionReadDependencies = { objects: [], links: [], linkScopes: [] }\n\nexport interface CommitActionEditsInput {\n readonly mutations: Pick<OntologyMutationRuntime, \"commitEdits\">\n readonly projectId: string\n readonly runId: string\n readonly actionId: string\n readonly batch: EditBatch\n readonly dependencies?: ActionReadDependencies\n readonly actor?: EventActor\n}\n\n/** The authoritative ontology commit an Action run produced. */\nexport interface ActionEditCommitResult {\n readonly commitId: string\n readonly created: boolean\n readonly eventCount: number\n readonly outcomes: readonly OntologyOperationOutcome[]\n readonly changes: {\n readonly objects: readonly EffectiveObjectChange[]\n readonly links: readonly EffectiveLinkChange[]\n }\n readonly committedAt: Date\n}\n\nexport interface FindActionEditCommitInput {\n readonly storage: Pick<Storage, \"ontology\">\n readonly projectId: string\n readonly runId: string\n}\n\n/**\n * Commits one Action run's recorded edits as a single atomic ontology commit.\n *\n * The batch lowers to canonical Materializer operations and the Materializer validates the Action run\n * identity, applies managed authority, resolves effective state, writes the authoritative commit, and\n * inserts outbox facts in one transaction. Repeating the call for the same run replays that commit;\n * a divergent request for the same run is a typed idempotency conflict.\n */\nexport async function commitActionEdits(\n input: CommitActionEditsInput\n): Promise<ActionEditCommitResult> {\n const dependencies = input.dependencies ?? NO_READ_DEPENDENCIES\n const commit = await input.mutations.commitEdits({\n mode: \"atomic\",\n source: { kind: \"action\", actionId: input.actionId, runId: input.runId },\n operations: lowerEditBatch(input.batch),\n expectedObjects: dependencies.objects,\n expectedLinks: dependencies.links,\n expectedLinkScopes: dependencies.linkScopes,\n ...(input.actor !== undefined ? { actor: input.actor } : {}),\n })\n return toActionEditCommitResult(commit)\n}\n\n/**\n * Resolves the authoritative commit an Action run already produced, if any.\n *\n * Resume uses the exact `{ actionRunId }` origin instead of rerunning handlers, so a redelivered run\n * returns the persisted result without recomputing an idempotency hash.\n */\nexport async function findActionEditCommit(\n input: FindActionEditCommitInput\n): Promise<ActionEditCommitResult | null> {\n const record = await input.storage.ontology.commits.getByOrigin({\n projectId: input.projectId,\n origin: { kind: \"action\", actionRunId: input.runId },\n })\n if (!record) return null\n if (record.result.kind !== \"edit\") {\n throw new ActionEditCommitError(\n `[Sixb] Action run '${input.runId}' resolved a '${record.result.kind}' commit instead of an edit commit.`\n )\n }\n return toActionEditCommitResult({ ...record.result, created: false })\n}\n\nfunction toActionEditCommitResult(commit: EditCommitResult): ActionEditCommitResult {\n return {\n commitId: commit.commitId,\n created: commit.created,\n eventCount: commit.eventCount,\n outcomes: commit.outcomes,\n changes: commit.changes,\n committedAt: new Date(commit.committedAt),\n }\n}\n",
|
|
8
|
-
"import { linkRefKey, linkScopeKey, objectRefKey } from \"../materialization/refs\"\nimport type {\n EffectiveLinkSnapshot,\n ExpectedLinkRevision,\n ExpectedLinkScopeRevision,\n ExpectedObjectRevision,\n OntologyLinkRef,\n OntologyObjectRef,\n} from \"../materializer\"\nimport { createLinkScopeFingerprint } from \"../materializer\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport type { ValueType } from \"../ontology/types\"\nimport type { ObjectSetListInput } from \"../runtime/types\"\nimport type { ObjectLinkRow, ObjectRow } from \"../storage\"\nimport type { ActionReadDependencies } from \"./commit-edits\"\nimport type { ActionReadFacade, ActionReadObjectSet } from \"./types\"\n\nexport type ActionReadObjectSetSource = {\n get(id: string): Promise<unknown>\n query(): unknown\n list(input?: ObjectSetListInput): Promise<unknown>\n byId(id: string): {\n get(): Promise<unknown>\n listLinks(link?: { readonly id: string }): Promise<unknown>\n }\n}\n\n/**\n * Records the exact state an Action handler observed while reading.\n *\n * A handler that reads one dependency twice keeps the first observation: the commit must fail when\n * current state no longer matches what the decision was made against, and the later read may already\n * reflect the handler's own intent. Arbitrary query phantoms stay out of this release — `query()` and\n * `list()` results are not turned into dependencies.\n */\nexport class ActionReadRecorder {\n private readonly objects = new Map<string, ExpectedObjectRevision>()\n private readonly links = new Map<string, ExpectedLinkRevision>()\n private readonly linkScopes = new Map<string, ExpectedLinkScopeRevision>()\n\n /** Records a concrete object read, including exact absence. */\n observeObject(ref: OntologyObjectRef, row: ObjectRow | null): void {\n const key = objectRefKey(ref)\n if (this.objects.has(key)) return\n if (!row) {\n this.objects.set(key, { ref, exists: false })\n return\n }\n // Rows without materializer provenance predate the commit ledger and cannot be fenced.\n if (row.lastCommitId === undefined) return\n this.objects.set(key, {\n ref,\n exists: true,\n version: row.version,\n lastCommitId: row.lastCommitId,\n })\n }\n\n /**\n * Records the complete `(source, linkId)` scopes a link listing observed.\n *\n * `linkIds` names every scope the read covered so an empty scope is recorded as an empty\n * fingerprint rather than being silently omitted.\n */\n observeLinkScopes(\n source: OntologyObjectRef,\n linkIds: readonly string[],\n rows: readonly ObjectLinkRow[]\n ): void {\n const snapshotsByLinkId = new Map<string, EffectiveLinkSnapshot[]>()\n for (const linkId of linkIds) snapshotsByLinkId.set(linkId, [])\n /** Scopes holding a row that cannot be fenced, so no expectation may be recorded for them. */\n const unfenceable = new Set<string>()\n\n for (const row of rows) {\n if (row.sourceTypeId !== source.objectTypeId || row.sourceId !== source.primaryId) continue\n const snapshots = snapshotsByLinkId.get(row.linkId)\n if (!snapshots) continue\n const snapshot = toLinkSnapshot(row)\n if (!snapshot) {\n // Same rule `observeObject` applies to rows without materializer provenance: record no\n // expectation at all. A fingerprint computed over the remaining rows would describe a scope\n // the store can never reproduce, turning every such read into a guaranteed conflict.\n unfenceable.add(row.linkId)\n continue\n }\n snapshots.push(snapshot)\n this.observeLink(snapshot.ref, snapshot)\n }\n\n for (const [linkId, snapshots] of snapshotsByLinkId) {\n if (unfenceable.has(linkId)) continue\n const key = linkScopeKey(source, linkId)\n if (this.linkScopes.has(key)) continue\n this.linkScopes.set(key, {\n source,\n linkId,\n fingerprint: createLinkScopeFingerprint(snapshots),\n })\n }\n }\n\n /** Records a concrete link read, including exact absence. */\n observeLink(ref: OntologyLinkRef, snapshot: EffectiveLinkSnapshot | null): void {\n const key = linkRefKey(ref)\n if (this.links.has(key)) return\n this.links.set(\n key,\n snapshot ? { ref, exists: true, lastCommitId: snapshot.lastCommitId } : { ref, exists: false }\n )\n }\n\n dependencies(): ActionReadDependencies {\n return {\n objects: [...this.objects.values()],\n links: [...this.links.values()],\n linkScopes: [...this.linkScopes.values()],\n }\n }\n}\n\nexport interface ActionReadFacadeOptions {\n /** Records what the handler observed, so the commit can be fenced against it. */\n readonly recorder: ActionReadRecorder\n /**\n * Every link the object type carries, inherited links included.\n *\n * Inheritance is resolved by the Ontology registry, not by the imported definition, so an\n * `extends` type would otherwise report only its own links and drop inherited ones from the\n * recorded scopes.\n */\n readonly resolveLinkIds: (objectTypeId: string) => readonly string[]\n}\n\nexport function createActionReadFacade(\n createObjectSet: <const TObjectType extends ObjectTypeWithPropertyTokens>(\n objectType: TObjectType\n ) => ActionReadObjectSetSource,\n options?: ActionReadFacadeOptions\n): ActionReadFacade {\n const facade = {\n objects<const TObjectType extends ObjectTypeWithPropertyTokens>(objectType: TObjectType) {\n return createActionReadObjectSetAdapter<TObjectType>(\n objectType,\n createObjectSet(objectType),\n options\n )\n },\n }\n\n return facade as ActionReadFacade\n}\n\nfunction createActionReadObjectSetAdapter<TObjectType extends ObjectTypeWithPropertyTokens>(\n objectType: TObjectType,\n objectSet: ActionReadObjectSetSource,\n options: ActionReadFacadeOptions | undefined\n): ActionReadObjectSet<TObjectType, readonly ValueType[], ObjectTypeWithPropertyTokens> {\n type TypedReadObjectSet = ActionReadObjectSet<\n TObjectType,\n readonly ValueType[],\n ObjectTypeWithPropertyTokens\n >\n\n async function readObject(id: string, read: () => Promise<unknown>): Promise<unknown> {\n const row = await read()\n options?.recorder.observeObject(\n { objectTypeId: objectType.id, primaryId: id },\n (row ?? null) as ObjectRow | null\n )\n return row\n }\n\n return {\n get(id) {\n return readObject(id, () => objectSet.get(id)) as ReturnType<TypedReadObjectSet[\"get\"]>\n },\n query() {\n return objectSet.query() as ReturnType<TypedReadObjectSet[\"query\"]>\n },\n list(input) {\n return objectSet.list(input) as ReturnType<TypedReadObjectSet[\"list\"]>\n },\n byId(id) {\n const handle = objectSet.byId(id)\n return {\n get() {\n return readObject(id, () => handle.get()) as ReturnType<\n ReturnType<TypedReadObjectSet[\"byId\"]>[\"get\"]\n >\n },\n async listLinks(link) {\n const rows = (await handle.listLinks(link)) as readonly ObjectLinkRow[]\n options?.recorder.observeLinkScopes(\n { objectTypeId: objectType.id, primaryId: id },\n link ? [link.id] : options.resolveLinkIds(objectType.id),\n rows\n )\n return rows as unknown as Awaited<\n ReturnType<ReturnType<TypedReadObjectSet[\"byId\"]>[\"listLinks\"]>\n >\n },\n }\n },\n }\n}\n\nfunction toLinkSnapshot(row: ObjectLinkRow): EffectiveLinkSnapshot | null {\n // Rows without materializer provenance predate the commit ledger and cannot be fenced.\n if (row.lastCommitId === undefined) return null\n return {\n ref: {\n source: { objectTypeId: row.sourceTypeId, primaryId: row.sourceId },\n linkId: row.linkId,\n target: { objectTypeId: row.targetTypeId, primaryId: row.targetId },\n },\n ...(row.properties !== undefined\n ? { properties: row.properties as EffectiveLinkSnapshot[\"properties\"] }\n : {}),\n createdAt: row.createdAt.toISOString(),\n updatedAt: row.updatedAt.toISOString(),\n lastCommitId: row.lastCommitId,\n }\n}\n",
|
|
9
|
-
"import type { ObjectType } from \"../ontology\"\nimport type { OntologyRegistry } from \"../ontology/registry\"\nimport {\n ActionDefinitionError,\n effectsWithoutEditsMessage,\n missingActionMutationMessage,\n} from \"./errors\"\nimport type { ActionDefinition, ObjectActionDefinition } from \"./types\"\nimport { isObjectActionDefinition } from \"./validation\"\n\nexport class ActionRegistry {\n private readonly byId = new Map<string, ActionDefinition>()\n private readonly globalActions: ActionDefinition[] = []\n private readonly byTargetId = new Map<string, ObjectActionDefinition[]>()\n\n constructor(\n actions: readonly ActionDefinition[],\n private readonly ontology: OntologyRegistry\n ) {\n for (const action of actions) {\n const previous = this.byId.get(action.id)\n if (previous) {\n const chainDuplicate = this.getInheritanceDuplicate(action, previous)\n if (chainDuplicate) {\n throw new ActionDefinitionError(\n `Duplicate action id \"${action.id}\" in inheritance chain of \"${chainDuplicate.objectTypeId}\": defined on both \"${chainDuplicate.firstTargetId}\" and \"${chainDuplicate.secondTargetId}\".`\n )\n }\n\n throw new ActionDefinitionError(\n `Duplicate action id \"${action.id}\" declared in multiple files.`\n )\n }\n\n this.validatePhases(action)\n this.byId.set(action.id, action)\n\n if (!isObjectActionDefinition(action)) {\n this.globalActions.push(action)\n continue\n }\n\n const objectType = action.binding.objectType\n const target = this.ontology.getObjectTypeById(objectType.id)\n if (!target) {\n throw new ActionDefinitionError(\n `Action \"${action.id}\" targets unknown object type \"${objectType.id}\". Add the object type to ontology before registering the action.`\n )\n }\n\n const bucket = this.byTargetId.get(objectType.id) ?? []\n bucket.push(action)\n this.byTargetId.set(objectType.id, bucket)\n }\n }\n\n private validatePhases(action: ActionDefinition): void {\n const hasWriteback = action.phases.writeback !== undefined\n const hasEdits = action.phases.edits !== undefined\n const hasEffects = action.phases.effects !== undefined\n\n if (!hasWriteback && !hasEdits) {\n throw new ActionDefinitionError(missingActionMutationMessage(action.id))\n }\n\n if (hasEffects && !hasEdits) {\n throw new ActionDefinitionError(effectsWithoutEditsMessage(action.id))\n }\n }\n\n list(): readonly ActionDefinition[] {\n return [...this.byId.values()]\n }\n\n getById(id: string): ActionDefinition | null {\n return this.byId.get(id) ?? null\n }\n\n getGlobalActions(): readonly ActionDefinition[] {\n return [...this.globalActions]\n }\n\n getActionsForType(type: ObjectType): readonly ObjectActionDefinition[] {\n this.ontology.resolveObjectType(type.id)\n\n const seen = new Set<string>()\n const result: ObjectActionDefinition[] = []\n\n for (const ancestor of this.ontology.listAncestorChain(type)) {\n for (const action of this.byTargetId.get(ancestor.id) ?? []) {\n if (seen.has(action.id)) continue\n seen.add(action.id)\n result.push(action)\n }\n }\n\n return result\n }\n\n private getInheritanceDuplicate(\n action: ActionDefinition,\n previous: ActionDefinition\n ): { objectTypeId: string; firstTargetId: string; secondTargetId: string } | null {\n if (!isObjectActionDefinition(action) || !isObjectActionDefinition(previous)) {\n return null\n }\n\n const actionObjectType = action.binding.objectType\n const previousObjectType = previous.binding.objectType\n\n if (actionObjectType.id === previousObjectType.id) {\n return null\n }\n\n const actionChain = this.ontology.listAncestorChain(actionObjectType)\n if (actionChain.some((ancestor) => ancestor.id === previousObjectType.id)) {\n return {\n objectTypeId: actionObjectType.id,\n firstTargetId: previousObjectType.id,\n secondTargetId: actionObjectType.id,\n }\n }\n\n const previousChain = this.ontology.listAncestorChain(previousObjectType)\n if (previousChain.some((ancestor) => ancestor.id === actionObjectType.id)) {\n return {\n objectTypeId: previousObjectType.id,\n firstTargetId: actionObjectType.id,\n secondTargetId: previousObjectType.id,\n }\n }\n\n return null\n }\n}\n",
|
|
10
|
-
"import type { SixbRuntimeContext } from \"../runtime/types\"\nimport type { ActionRunRecord } from \"../storage\"\nimport {\n type RequestActionAndWaitInput,\n type RequestActionInput,\n type RequestActionResult,\n requestAction,\n requestActionAndWait,\n type WaitForActionRunInput,\n waitForActionRun,\n} from \"./request\"\n\nexport class ActionsRuntime {\n private readonly runtime: SixbRuntimeContext\n\n constructor(runtime: SixbRuntimeContext) {\n this.runtime = runtime\n }\n\n request(input: RequestActionInput): Promise<RequestActionResult> {\n return requestAction(this.runtime, input)\n }\n\n waitFor(input: WaitForActionRunInput): Promise<ActionRunRecord> {\n return waitForActionRun(this.runtime, input)\n }\n\n requestAndWait(input: RequestActionAndWaitInput): Promise<ActionRunRecord> {\n return requestActionAndWait(this.runtime, input)\n }\n}\n",
|
|
11
|
-
"import { ActionValidationError } from \"../objects/action/errors\"\nimport type { ActionDefinition, ActionSubject, ActionTargetObject } from \"./types\"\nimport { isObjectActionDefinition } from \"./validation\"\n\ntype RuntimePhaseHandler = (ctx: unknown) => unknown | Promise<unknown>\n\nexport async function runActionValidators<TBaseContext extends object>(input: {\n readonly action: ActionDefinition\n readonly subject: ActionSubject\n readonly baseContext: TBaseContext\n readonly target?: ActionTargetObject | null\n}): Promise<void> {\n const validators = input.action.phases.validate as readonly RuntimePhaseHandler[]\n if (validators.length === 0) {\n return\n }\n\n if (!isObjectActionDefinition(input.action)) {\n for (const validator of validators) {\n const result = await validator(input.baseContext)\n if (isValidatorErrorResult(result)) {\n throw new ActionValidationError(result.error, {\n actionId: input.action.id,\n subject: input.subject,\n })\n }\n }\n return\n }\n\n if (!input.target) {\n throw new Error(`[Sixb] Action '${input.action.id}' requires an object target.`)\n }\n\n for (const validator of validators) {\n const result = await validator({\n ...input.baseContext,\n target: input.target,\n })\n if (isValidatorErrorResult(result)) {\n throw new ActionValidationError(result.error, {\n actionId: input.action.id,\n subject: input.subject,\n })\n }\n }\n}\n\nfunction isValidatorErrorResult(value: unknown): value is { readonly error: string } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"error\" in value &&\n typeof value.error === \"string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,MAAM,SAAS,MAAM,UAAU,MAAM,WAAW;AAAA,MAChD,IAAI,uBAAuB,MAAM,GAAG;AAAA,QAClC,MAAM,IAAI,sBAAsB,OAAO,OAAO;AAAA,UAC5C,UAAU,MAAM,OAAO;AAAA,UACvB,SAAS,MAAM;AAAA,QACjB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA;AAAA,EACF;AAAA,EAEA,IAAI,CAAC,MAAM,QAAQ;AAAA,IACjB,MAAM,IAAI,MAAM,kBAAkB,MAAM,OAAO,gCAAgC;AAAA,EACjF;AAAA,EAEA,WAAW,aAAa,YAAY;AAAA,IAClC,MAAM,SAAS,MAAM,UAAU;AAAA,SAC1B,MAAM;AAAA,MACT,QAAQ,MAAM;AAAA,IAChB,CAAC;AAAA,IACD,IAAI,uBAAuB,MAAM,GAAG;AAAA,MAClC,MAAM,IAAI,sBAAsB,OAAO,OAAO;AAAA,QAC5C,UAAU,MAAM,OAAO;AAAA,QACvB,SAAS,MAAM;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAGF,SAAS,sBAAsB,CAAC,OAAqD;AAAA,EACnF,OACE,OAAO,UAAU,YACjB,UAAU,QACV,WAAW,SACX,OAAO,MAAM,UAAU;AAAA;",
|
|
14
|
-
"debugId": "88C3FA04C356D50864756E2164756E21",
|
|
15
|
-
"names": []
|
|
16
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/objects/action/request.ts", "../src/objects/context/resolve.ts", "../src/objects/errors.ts", "../src/objects/materializer-adapter.ts", "../src/objects/link/authorization.ts", "../src/objects/link/remove.ts", "../src/objects/link/endpoints.ts", "../src/objects/link/upsert.ts", "../src/objects/runtime-batch.ts", "../src/objects/link/upsert-batch.ts", "../src/objects/object/delete.ts", "../src/objects/object/upsert.ts", "../src/objects/object/upsert-batch.ts", "../src/objects/telemetry/write-batch.ts", "../src/objects/telemetry/append-batch.ts", "../src/objects/telemetry/history.ts", "../src/objects/sdk/telemetry-channel.ts", "../src/objects/sdk/object-handle.ts", "../src/objects/sdk/runtime-query-executor.ts", "../src/objects/sdk/object-set.ts", "../src/objects/service/action-service.ts", "../src/objects/service/link-service.ts", "../src/objects/service/list-service.ts", "../src/objects/service/object-service.ts", "../src/objects/service/telemetry-service.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Compatibility leaf operation: request an action on an object.\n *\n * The canonical action request path lives in `actions/request.ts`; object-bound\n * helpers delegate here by supplying an object subject.\n */\nimport {\n type RequestActionAndWaitOptions,\n type RequestActionOptions,\n type RequestActionResult,\n requestAction as requestRuntimeAction,\n requestActionAndWait as requestRuntimeActionAndWait,\n} from \"../../actions/request\"\nimport type { ActionRunRecord } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\n\nexport type { RequestActionAndWaitOptions, RequestActionOptions }\n\nexport async function requestAction(\n ctx: ResolvedObjectContext,\n params: {\n primaryId: string\n actionId: string\n params?: Record<string, unknown>\n options?: RequestActionOptions\n }\n): Promise<RequestActionResult> {\n return requestRuntimeAction(ctx, {\n actionId: params.actionId,\n subject: {\n kind: \"object\",\n objectTypeId: ctx.objectType.id,\n primaryId: params.primaryId,\n },\n params: params.params,\n runId: params.options?.runId,\n signal: params.options?.signal,\n })\n}\n\nexport async function requestActionAndWait(\n ctx: ResolvedObjectContext,\n params: {\n primaryId: string\n actionId: string\n params?: Record<string, unknown>\n options?: RequestActionAndWaitOptions\n }\n): Promise<ActionRunRecord> {\n return requestRuntimeActionAndWait(ctx, {\n actionId: params.actionId,\n subject: {\n kind: \"object\",\n objectTypeId: ctx.objectType.id,\n primaryId: params.primaryId,\n },\n params: params.params,\n runId: params.options?.runId,\n timeoutMs: params.options?.timeoutMs,\n signal: params.options?.signal,\n onRequested: params.options?.onRequested,\n })\n}\n",
|
|
6
|
-
"/**\n * Context resolution factories.\n *\n * Resolve ontology identifiers into concrete type data so leaf functions\n * receive all structural information pre-resolved.\n */\n\nimport type { ObjectLink } from \"../../ontology\"\nimport { OntologyNotFoundError } from \"../../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkContext, ResolvedObjectContext } from \"./types\"\n\n/** Look up a link definition on an object type, throwing if not found. */\nexport function requireLinkDefinition(\n objectType: ObjectTypeWithPropertyTokens,\n linkId: string\n): ObjectLink {\n const def = objectType.links.find((l) => l.id === linkId)\n if (!def) throw new OntologyNotFoundError(`Unknown link '${objectType.id}.${linkId}'`)\n return def\n}\n\n/**\n * Resolve an object type id to a full ResolvedObjectContext.\n *\n * Uses ontology.resolveObjectType() and getPrimaryPropertyId() — these\n * are structural resolution calls that belong in factories, not leaf functions.\n */\nexport function resolveObjectContext(\n runtime: SixbRuntimeContext,\n objectTypeId: string\n): ResolvedObjectContext {\n const objectType = runtime.ontology.resolveObjectType(objectTypeId)\n const primaryPropertyId = runtime.ontology.getPrimaryPropertyId(objectTypeId)\n return { ...runtime, objectType, primaryPropertyId }\n}\n\n/**\n * Resolve a link id to a full ResolvedLinkContext.\n *\n * Uses requireLinkDefinition to look up the link definition on the\n * already-resolved object type.\n */\nexport function resolveLinkContext(\n objCtx: ResolvedObjectContext,\n linkId: string\n): ResolvedLinkContext {\n const linkDefinition = requireLinkDefinition(objCtx.objectType, linkId)\n return { ...objCtx, linkDefinition }\n}\n",
|
|
7
|
-
"/**\n * Error for runtime invariants and failures specific to the objects module\n * (e.g., unexpected event results after appending an object/link event).\n */\nexport class ObjectError extends Error {\n readonly name = \"ObjectError\"\n}\n",
|
|
8
|
-
"/**\n * Runtime translation onto the ontology Materializer.\n *\n * Every typed and dynamic object/link mutation lowers to canonical Materializer operations here and\n * every Materializer result is mapped back to the public runtime shapes. The adapter owns no\n * ontology semantics: authority classification, effective resolution, validation, and event\n * construction all happen inside the Materializer's single commit.\n */\n\nimport { randomUUID } from \"node:crypto\"\nimport type { EventActor } from \"../events/envelope\"\nimport type { JsonValue } from \"../json\"\nimport type {\n EditCommitResult,\n EffectiveObjectSnapshot,\n MaterializationItemError,\n OntologyEditOperation,\n OntologyLinkRef,\n OntologyObjectRef,\n OntologyOperationOutcome,\n} from \"../materialization/model\"\nimport { normalizeJsonProperties } from \"../materializer\"\nimport type { ObjectLink, ValueType } from \"../ontology\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport {\n assertKnownProperties,\n assertLinkTargetType,\n normalizeLinkProperties,\n normalizeObjectProperties,\n validateLinkProperties,\n validateObjectProperties,\n} from \"../ontology/validation\"\nimport { getOntologyMutationRuntime } from \"../runtime/ontology-mutations\"\nimport type { SixbRuntimeContext } from \"../runtime/types\"\nimport type { ObjectRow } from \"../storage\"\nimport { ObjectError } from \"./errors\"\n\n/** The runtime pieces one commit needs. */\n// `authorization` is here only so a commit can name its actor; it stays optional, so every existing\n// privileged caller still satisfies the type.\nexport type RuntimeMaterializerContext = Pick<\n SixbRuntimeContext,\n \"projectId\" | \"storage\" | \"authorization\"\n>\n\n/** One caller-supplied batch item, lowered to the operations it contributes. */\nexport interface RuntimeBatchGroup {\n /** Position in the caller's input array; item errors are reported against it. */\n readonly index: number\n readonly operations: readonly OntologyEditOperation[]\n}\n\nexport interface RuntimeBatchCommit {\n readonly commit: EditCommitResult | null\n /** Outcomes per input position, in the order the item's operations were submitted. */\n readonly outcomes: ReadonlyMap<number, readonly OntologyOperationOutcome[]>\n}\n\n/**\n * The principal behind a runtime write, when there is one.\n *\n * `origin: { kind: \"runtime\" }` already says a write bypassed an Action; this says who made it.\n * Absent on a privileged caller (workers, syncs, tests), which is what makes the field's absence\n * meaningful rather than merely unset: an event with no actor was written by the system itself.\n *\n * A `Principal` is an `EventActor` — same literals, no translation.\n */\nfunction runtimeActor(ctx: RuntimeMaterializerContext): { readonly actor?: EventActor } {\n const principal = ctx.authorization?.principal\n return principal === undefined ? {} : { actor: principal }\n}\n\n/**\n * Commits ordered operations as one atomic runtime commit.\n *\n * A fresh request id per call keeps each runtime mutation its own commit; the Materializer's\n * idempotency replay then only collapses a retry of the very same request.\n */\nexport async function commitRuntimeOperations(\n ctx: RuntimeMaterializerContext,\n operations: readonly OntologyEditOperation[]\n): Promise<EditCommitResult> {\n const mutations = getOntologyMutationRuntime(ctx)\n const commit = await mutations.commitEdits({\n mode: \"atomic\",\n source: { kind: \"runtime\", requestId: randomUUID() },\n ...runtimeActor(ctx),\n operations,\n expectedObjects: [],\n expectedLinks: [],\n expectedLinkScopes: [],\n })\n return commit\n}\n\n/**\n * Commits grouped batch operations as one ordered continue-mode transaction.\n *\n * Successful items apply against one evolving authority state while semantic failures are recorded\n * per item. Provider, serialization, and CAS failures still roll the whole transaction back.\n *\n * An item that lowers to several operations is declared as one operation group so the Materializer\n * rolls the whole item back rather than committing the operations that ran before the failure.\n */\nexport async function commitRuntimeBatch(\n ctx: RuntimeMaterializerContext,\n groups: readonly RuntimeBatchGroup[]\n): Promise<RuntimeBatchCommit> {\n const operations = groups.flatMap((group) => group.operations)\n if (operations.length === 0) {\n return { commit: null, outcomes: new Map() }\n }\n\n const operationGroups = groups\n .filter((group) => group.operations.length > 1)\n .map((group) => group.operations.map((operation) => operation.id))\n\n const mutations = getOntologyMutationRuntime(ctx)\n const commit = await mutations.commitEdits({\n mode: \"continue\",\n source: { kind: \"runtime\", requestId: randomUUID() },\n ...runtimeActor(ctx),\n operations,\n ...(operationGroups.length > 0 ? { operationGroups } : {}),\n })\n\n const byId = new Map(commit.outcomes.map((outcome) => [outcome.id, outcome]))\n const outcomes = new Map<number, readonly OntologyOperationOutcome[]>()\n for (const group of groups) {\n outcomes.set(\n group.index,\n group.operations.map((operation) => requireOutcome(byId, operation.id))\n )\n }\n return { commit, outcomes }\n}\n\n/**\n * Assigns the canonical operation id for one batch item.\n *\n * Ids derive from the caller's original ordinal so outcomes map back to input positions even when\n * earlier items failed local validation and never reached the Materializer.\n */\nexport function runtimeOperationId(index: number, subOrdinal = 0): string {\n return subOrdinal === 0 ? `op:${index}` : `op:${index}.${subOrdinal}`\n}\n\nexport interface NormalizedRuntimeObject {\n readonly primaryId: string\n /** Managed authority values; identity lives in the object ref, never in the properties. */\n readonly properties: Readonly<Record<string, JsonValue>>\n}\n\n/**\n * Validates and normalizes one runtime object input at the SDK/service boundary.\n *\n * Shape and value-type errors surface here so a batch can report them against the caller's original\n * position. Authority classification, required-property enforcement, and cardinality stay in the\n * Materializer, which validates the resolved effective object instead of the request.\n */\nexport function normalizeRuntimeObject(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly primaryPropertyId: string\n readonly properties: Record<string, unknown>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): NormalizedRuntimeObject {\n const { objectType, primaryPropertyId, properties, valueTypesById } = input\n assertKnownProperties(objectType, properties)\n validateObjectProperties(objectType, properties, valueTypesById)\n\n const primaryValue = properties[primaryPropertyId]\n if (primaryValue === undefined || primaryValue === null) {\n throw new OntologyValidationError(\n `[Sixb] Missing primary property '${primaryPropertyId}' in upsert for '${objectType.id}'`\n )\n }\n\n const normalized = normalizeObjectProperties(\n objectType.properties,\n properties,\n valueTypesById,\n objectType.id\n )\n const { [primaryPropertyId]: _identity, ...managed } = normalized\n return {\n primaryId: String(primaryValue),\n properties: normalizeJsonProperties(managed, `${objectType.id} properties`),\n }\n}\n\n/**\n * Validates and normalizes one runtime link input.\n *\n * Managed link authority carries the complete property set, so required link properties must be\n * present in the request rather than inherited from the stored edge.\n */\nexport function normalizeRuntimeLink(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly linkDefinition: ObjectLink\n readonly linkId: string\n readonly targetTypeId: string\n readonly properties?: Record<string, unknown>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n readonly isValidLinkTarget: (expected: string | string[], actual: string) => boolean\n}): Readonly<Record<string, JsonValue>> | undefined {\n const { objectType, linkDefinition, linkId, targetTypeId, properties, valueTypesById } = input\n assertLinkTargetType(objectType.id, linkId, linkDefinition, targetTypeId, input.isValidLinkTarget)\n validateLinkProperties(objectType, linkDefinition, properties, undefined, valueTypesById)\n const normalized = normalizeLinkProperties(objectType, linkDefinition, properties, valueTypesById)\n if (normalized === undefined) return undefined\n return normalizeJsonProperties(normalized, `${objectType.id}.${linkId} properties`)\n}\n\nexport function objectUpsertOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n readonly properties: Readonly<Record<string, JsonValue>>\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.upsert\", ref: input.ref, properties: input.properties }\n}\n\nexport function objectDeleteOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.delete\", ref: input.ref }\n}\n\nexport function objectRestoreOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.restore\", ref: input.ref }\n}\n\nexport function linkUpsertOperation(input: {\n readonly id: string\n readonly ref: OntologyLinkRef\n readonly properties?: Readonly<Record<string, JsonValue>>\n}): OntologyEditOperation {\n return {\n id: input.id,\n kind: \"link.upsert\",\n ref: input.ref,\n ...(input.properties !== undefined ? { properties: input.properties } : {}),\n }\n}\n\nexport function linkDeleteOperation(input: {\n readonly id: string\n readonly ref: OntologyLinkRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"link.delete\", ref: input.ref }\n}\n\n/** Reads the outcomes one batch item produced; the commit returns one per submitted operation. */\nexport function requireItemOutcomes(\n commit: RuntimeBatchCommit,\n index: number\n): readonly OntologyOperationOutcome[] {\n const outcomes = commit.outcomes.get(index)\n if (!outcomes || outcomes.length === 0) {\n throw new ObjectError(`[Sixb] Materializer returned no outcome for batch item ${index}.`)\n }\n return outcomes\n}\n\n/** Reads the effective object an ok outcome produced; runtime object writes always resolve one. */\nexport function requireEffectiveObject(outcome: OntologyOperationOutcome): EffectiveObjectSnapshot {\n if (!outcome.ok || !outcome.object) {\n throw new ObjectError(`[Sixb] Materializer returned no effective object for '${outcome.id}'.`)\n }\n return outcome.object\n}\n\nexport function toObjectRow(projectId: string, snapshot: EffectiveObjectSnapshot): ObjectRow {\n return {\n projectId,\n objectTypeId: snapshot.ref.objectTypeId,\n primaryId: snapshot.ref.primaryId,\n properties: structuredClone(snapshot.properties) as Record<string, unknown>,\n createdAt: new Date(snapshot.createdAt),\n updatedAt: new Date(snapshot.updatedAt),\n version: snapshot.version,\n lastCommitId: snapshot.lastCommitId,\n }\n}\n\n/** Rehydrates a persisted item error into the public runtime error type. */\nexport function toItemError(error: MaterializationItemError): Error {\n switch (error.code) {\n case \"validation\":\n return new OntologyValidationError(error.message)\n }\n}\n\nfunction requireOutcome(\n outcomes: ReadonlyMap<string, OntologyOperationOutcome>,\n id: string\n): OntologyOperationOutcome {\n const outcome = outcomes.get(id)\n if (!outcome) {\n throw new ObjectError(`[Sixb] Materializer returned no outcome for '${id}'.`)\n }\n return outcome\n}\n",
|
|
9
|
-
"/**\n * The authorization rule for writing a link, in one place because all three link leaves need it.\n */\nimport { type AuthorizationContext, assertAuthorized, assertCanEdit } from \"../../authorization\"\n\n/**\n * Assert a principal may create or remove a link.\n *\n * `edit` on the **source** type, `view` on the **target**: a link is declared on the source type\n * (`objectType.links`), and writing one changes the source's edges, not the target's properties.\n * Requiring `edit` on the target too would mean a clerk needs write access to every customer before\n * attaching an invoice to one.\n *\n * `view` on the target is still required, and for two reasons: it matches how links are *read* —\n * `canViewLink` already demands `view` on both endpoints — and without it the endpoint-existence\n * check that follows would answer whether a target the principal cannot see exists.\n *\n * Call this *before* any endpoint lookup, for that second reason.\n */\nexport function assertCanWriteLink(\n ctx: { readonly authorization?: AuthorizationContext },\n endpoints: { readonly sourceTypeId: string; readonly targetTypeId: string }\n): void {\n assertCanEdit(ctx, endpoints.sourceTypeId)\n assertAuthorized(ctx, { kind: \"object.view\", objectTypeId: endpoints.targetTypeId })\n}\n",
|
|
10
|
-
"/**\n * Leaf operation: remove a single link through the ontology Materializer.\n */\nimport { assertLinkTargetType } from \"../../ontology/validation\"\nimport type { ResolvedLinkContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n linkDeleteOperation,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { assertCanWriteLink } from \"./authorization\"\n\nexport async function removeLink(\n ctx: ResolvedLinkContext,\n params: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n }\n): Promise<void> {\n const { objectType, linkDefinition, ontology } = ctx\n const { sourceId, linkId, targetTypeId, targetId } = params\n assertCanWriteLink(ctx, { sourceTypeId: objectType.id, targetTypeId })\n\n assertLinkTargetType(objectType.id, linkId, linkDefinition, targetTypeId, (expected, actual) =>\n ontology.isValidLinkTarget(expected, actual)\n )\n\n // A missing link is a no-op: the delete records managed authority only when an effective edge\n // exists, so the commit reports `unchanged` instead of failing.\n await commitRuntimeOperations(ctx, [\n linkDeleteOperation({\n id: runtimeOperationId(0),\n ref: {\n source: { objectTypeId: objectType.id, primaryId: sourceId },\n linkId,\n target: { objectTypeId: targetTypeId, primaryId: targetId },\n },\n }),\n ])\n}\n",
|
|
11
|
-
"/**\n * Shared endpoint existence reads for runtime link batches.\n *\n * The Materializer independently refuses a link whose endpoints are not effective. These reads exist\n * only so batch callers keep receiving the public {@link ObjectNotFoundError} for a missing endpoint\n * instead of a generic per-item validation error.\n */\n\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport { ObjectNotFoundError } from \"../../storage/errors\"\n\nexport interface LinkEndpointItem {\n readonly objectType: { readonly id: string }\n readonly sourceId: string\n readonly targetTypeId: string\n readonly targetId: string\n}\n\nexport type EndpointExistence = ReadonlySet<string>\n\nexport function collectEndpointLookups(\n items: readonly LinkEndpointItem[]\n): { objectTypeId: string; primaryId: string }[] {\n const lookups: { objectTypeId: string; primaryId: string }[] = []\n const seen = new Set<string>()\n\n for (const item of items) {\n for (const endpoint of [\n { objectTypeId: item.objectType.id, primaryId: item.sourceId },\n { objectTypeId: item.targetTypeId, primaryId: item.targetId },\n ]) {\n const key = endpointKey(endpoint.objectTypeId, endpoint.primaryId)\n if (seen.has(key)) continue\n seen.add(key)\n lookups.push(endpoint)\n }\n }\n\n return lookups\n}\n\nexport async function loadEndpointExistence(\n ctx: Pick<SixbRuntimeContext, \"projectId\" | \"storage\">,\n lookups: readonly { objectTypeId: string; primaryId: string }[]\n): Promise<EndpointExistence> {\n if (lookups.length === 0) return new Set()\n const rows = await ctx.storage.objects.getByPrimaryIdBatch({\n projectId: ctx.projectId,\n items: lookups,\n })\n return new Set(rows.keys())\n}\n\n/** Throws {@link ObjectNotFoundError} for the first endpoint the read did not find. */\nexport function requireEndpoints(item: LinkEndpointItem, existing: EndpointExistence): void {\n if (!existing.has(endpointKey(item.objectType.id, item.sourceId))) {\n throw new ObjectNotFoundError(item.objectType.id, item.sourceId, \"Source object not found\")\n }\n if (!existing.has(endpointKey(item.targetTypeId, item.targetId))) {\n throw new ObjectNotFoundError(item.targetTypeId, item.targetId, \"Target object not found\")\n }\n}\n\nfunction endpointKey(objectTypeId: string, primaryId: string): string {\n return `${objectTypeId}:${primaryId}`\n}\n",
|
|
12
|
-
"/**\n * Leaf operation: upsert a single link through the ontology Materializer.\n */\nimport type { ResolvedLinkContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n linkUpsertOperation,\n normalizeRuntimeLink,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { assertCanWriteLink } from \"./authorization\"\nimport { collectEndpointLookups, loadEndpointExistence, requireEndpoints } from \"./endpoints\"\n\nexport async function upsertLink(\n ctx: ResolvedLinkContext,\n params: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n properties?: Record<string, unknown>\n }\n): Promise<void> {\n const { objectType, linkDefinition, ontology } = ctx\n const { sourceId, linkId, targetTypeId, targetId, properties } = params\n assertCanWriteLink(ctx, { sourceTypeId: objectType.id, targetTypeId })\n const endpoints = { objectType, sourceId, targetTypeId, targetId }\n\n // Endpoint reads keep the public `ObjectNotFoundError` contract; the Materializer independently\n // refuses a link whose endpoints are not effective when it commits. This runs before property\n // normalization so the same input reports the same error class here and through the batch APIs,\n // which check endpoints first inside `plan`.\n requireEndpoints(endpoints, await loadEndpointExistence(ctx, collectEndpointLookups([endpoints])))\n\n const normalizedProperties = normalizeRuntimeLink({\n objectType,\n linkDefinition,\n linkId,\n targetTypeId,\n properties,\n valueTypesById: ontology.getValueTypesById(),\n isValidLinkTarget: (expected, actual) => ontology.isValidLinkTarget(expected, actual),\n })\n\n await commitRuntimeOperations(ctx, [\n linkUpsertOperation({\n id: runtimeOperationId(0),\n ref: {\n source: { objectTypeId: objectType.id, primaryId: sourceId },\n linkId,\n target: { objectTypeId: targetTypeId, primaryId: targetId },\n },\n ...(normalizedProperties !== undefined ? { properties: normalizedProperties } : {}),\n }),\n ])\n}\n",
|
|
13
|
-
"/**\n * Per-item mechanics shared by every runtime batch.\n *\n * One place owns the rules the public batch APIs promise: a local failure stays at its own input\n * position, an identical repeat collapses onto the first item and shares its result, a conflicting\n * repeat is rejected, and each item's Materializer outcomes map back to the position they came from.\n */\n\nimport type { OntologyEditOperation, OntologyOperationOutcome } from \"../materialization/model\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { BatchItemResult } from \"../runtime/types\"\nimport {\n commitRuntimeBatch,\n type RuntimeMaterializerContext,\n requireItemOutcomes,\n toItemError,\n} from \"./materializer-adapter\"\n\nexport interface RuntimeBatchItemPlan {\n /** Identity this item claims. A later item claiming it must be identical. */\n readonly key: string\n /** How that identity reads in an error message, e.g. `object 'room:r1'`. */\n readonly label: string\n /** Canonical content, so an identical repeat is recognized as one. */\n readonly fingerprint: string\n readonly operations: readonly OntologyEditOperation[]\n}\n\nexport interface RuntimeItemBatch<TItem, TValue> {\n readonly ctx: RuntimeMaterializerContext\n readonly items: readonly TItem[]\n /** Lowers one item, throwing to record a local failure at that item's position. */\n plan(item: TItem, index: number): RuntimeBatchItemPlan\n /** Maps the outcomes of a fully successful item to its public value. */\n value(outcomes: readonly OntologyOperationOutcome[]): TValue\n}\n\ninterface PlannedItem {\n readonly index: number\n readonly operations: readonly OntologyEditOperation[]\n}\n\ninterface ClaimedIdentity {\n readonly index: number\n readonly fingerprint: string\n}\n\nexport async function runRuntimeItemBatch<TItem, TValue>(\n batch: RuntimeItemBatch<TItem, TValue>\n): Promise<readonly BatchItemResult<TValue>[]> {\n const { items } = batch\n if (items.length === 0) return []\n\n const results: BatchItemResult<TValue>[] = new Array(items.length)\n const planned: PlannedItem[] = []\n const claims = new Map<string, ClaimedIdentity>()\n /** Positions that repeat an earlier identical item and share its result. */\n const aliases = new Map<number, number>()\n\n for (const [index, item] of items.entries()) {\n let plan: RuntimeBatchItemPlan\n try {\n plan = batch.plan(item, index)\n } catch (error) {\n results[index] = {\n ok: false,\n error: error instanceof Error ? error : new Error(String(error)),\n }\n continue\n }\n\n const claimed = claims.get(plan.key)\n if (claimed) {\n if (claimed.fingerprint !== plan.fingerprint) {\n results[index] = {\n ok: false,\n error: new OntologyValidationError(\n `[Sixb] Conflicting duplicate ${plan.label} at batch positions ${claimed.index} and ${index}`\n ),\n }\n continue\n }\n aliases.set(index, claimed.index)\n continue\n }\n\n claims.set(plan.key, { index, fingerprint: plan.fingerprint })\n planned.push({ index, operations: plan.operations })\n }\n\n const commit = await commitRuntimeBatch(batch.ctx, planned)\n\n for (const { index } of planned) {\n const outcomes = requireItemOutcomes(commit, index)\n const failed = outcomes.find((outcome) => !outcome.ok)\n results[index] =\n failed?.ok === false\n ? { ok: false, error: toItemError(failed.error) }\n : { ok: true, value: batch.value(outcomes) }\n }\n for (const [index, source] of aliases) {\n results[index] = results[source]\n }\n return results\n}\n",
|
|
14
|
-
"/**\n * Leaf operation: batch upsert links through the ontology Materializer.\n *\n * Takes SixbRuntimeContext (shared infra) + per-item pre-resolved data, because each item can target\n * a different objectType + linkDefinition. Everything valid is submitted as one ordered\n * continue-mode commit.\n */\n\nimport { stableJsonStringify } from \"../../json\"\nimport { linkRefKey } from \"../../materialization/refs\"\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkBatchItem } from \"../context\"\nimport {\n linkUpsertOperation,\n normalizeRuntimeLink,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { runRuntimeItemBatch } from \"../runtime-batch\"\nimport { assertCanWriteLink } from \"./authorization\"\nimport { collectEndpointLookups, loadEndpointExistence, requireEndpoints } from \"./endpoints\"\n\nexport async function upsertLinkBatch(\n ctx: SixbRuntimeContext,\n items: readonly ResolvedLinkBatchItem[]\n): Promise<readonly BatchItemResult<void>[]> {\n const { ontology } = ctx\n if (items.length === 0) return []\n\n // Every item, up front, and before the endpoint lookup below. Authorization is a precondition, not\n // a per-item validation: a refused item must not become one failed `BatchItemResult` while the\n // rest of the batch commits. Asserting inside `plan` would do exactly that, and would also let the\n // existence lookup answer for targets the principal cannot see.\n for (const item of items) {\n assertCanWriteLink(ctx, {\n sourceTypeId: item.objectType.id,\n targetTypeId: item.targetTypeId,\n })\n }\n\n const existing = await loadEndpointExistence(ctx, collectEndpointLookups(items))\n const valueTypesById = ontology.getValueTypesById()\n\n return runRuntimeItemBatch({\n ctx,\n items,\n plan(item, index) {\n requireEndpoints(item, existing)\n const properties = normalizeRuntimeLink({\n objectType: item.objectType,\n linkDefinition: item.linkDefinition,\n linkId: item.linkId,\n targetTypeId: item.targetTypeId,\n properties: item.properties,\n valueTypesById,\n isValidLinkTarget: (expected, actual) => ontology.isValidLinkTarget(expected, actual),\n })\n const ref = {\n source: { objectTypeId: item.objectType.id, primaryId: item.sourceId },\n linkId: item.linkId,\n target: { objectTypeId: item.targetTypeId, primaryId: item.targetId },\n }\n const edge = linkRefKey(ref)\n return {\n key: edge,\n // The key is a JSON array, which is unreadable in the error an operator sees on a failed\n // link projection. Name the edge the way the object path names an object.\n label: `link '${item.objectType.id}:${item.sourceId}.${item.linkId} -> ${item.targetTypeId}:${item.targetId}'`,\n fingerprint: stableJsonStringify(properties ?? null),\n operations: [\n linkUpsertOperation({\n id: runtimeOperationId(index),\n ref,\n ...(properties !== undefined ? { properties } : {}),\n }),\n ],\n }\n },\n value: () => undefined,\n })\n}\n",
|
|
15
|
-
"/**\n * Leaf operations: delete and restore a single object through the ontology Materializer.\n *\n * Both are thin wrappers over one materializer operation, exactly like `removeLink` — the cascade\n * over links and the effective-state bookkeeping happen inside the commit.\n */\nimport { assertCanEdit } from \"../../authorization\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n objectDeleteOperation,\n objectRestoreOperation,\n runtimeOperationId,\n} from \"../materializer-adapter\"\n\n/**\n * Delete the object with this primary id.\n *\n * A missing object is a no-op: the delete records managed authority only where effective state\n * exists, so the commit reports `unchanged` rather than failing. An object a projection also writes\n * stays hidden even while the projection keeps asserting it — `restore()` is what reveals it again.\n */\nexport async function deleteObject(ctx: ResolvedObjectContext, primaryId: string): Promise<void> {\n assertCanEdit(ctx, ctx.objectType.id)\n await commitRuntimeOperations(ctx, [\n objectDeleteOperation({\n id: runtimeOperationId(0),\n ref: { objectTypeId: ctx.objectType.id, primaryId },\n }),\n ])\n}\n\n/**\n * Withdraw a previous delete.\n *\n * For an object written only from code this is a no-op — there is nothing left to reveal, so write it\n * again instead. For an object a projection also writes, it makes the projected state visible again.\n */\nexport async function restoreObject(ctx: ResolvedObjectContext, primaryId: string): Promise<void> {\n assertCanEdit(ctx, ctx.objectType.id)\n await commitRuntimeOperations(ctx, [\n objectRestoreOperation({\n id: runtimeOperationId(0),\n ref: { objectTypeId: ctx.objectType.id, primaryId },\n }),\n ])\n}\n",
|
|
16
|
-
"/**\n * Leaf operation: upsert a single object through the ontology Materializer.\n */\n\nimport { assertCanEdit } from \"../../authorization\"\nimport type { ObjectRow } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n normalizeRuntimeObject,\n objectUpsertOperation,\n requireEffectiveObject,\n runtimeOperationId,\n toObjectRow,\n} from \"../materializer-adapter\"\n\nexport async function upsertObject(\n ctx: ResolvedObjectContext,\n properties: Record<string, unknown>\n): Promise<ObjectRow> {\n assertCanEdit(ctx, ctx.objectType.id)\n const { objectType, primaryPropertyId, ontology } = ctx\n\n const normalized = normalizeRuntimeObject({\n objectType,\n primaryPropertyId,\n properties,\n valueTypesById: ontology.getValueTypesById(),\n })\n const ref = { objectTypeId: objectType.id, primaryId: normalized.primaryId }\n\n // The Materializer classifies this as an independent create, a patch over source authority, or a\n // restore plus patch inside its own transaction.\n const commit = await commitRuntimeOperations(ctx, [\n objectUpsertOperation({ id: runtimeOperationId(0), ref, properties: normalized.properties }),\n ])\n return toObjectRow(ctx.projectId, requireEffectiveObject(commit.outcomes[0]))\n}\n",
|
|
17
|
-
"/**\n * Leaf operation: batch upsert objects of a single type through the ontology Materializer.\n *\n * Everything that survives local normalization is submitted as one ordered continue-mode commit, so\n * later items observe earlier ones and a provider failure rolls the whole batch back.\n */\nimport { assertCanEdit } from \"../../authorization\"\nimport { stableJsonStringify } from \"../../json\"\nimport type { BatchItemResult } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n normalizeRuntimeObject,\n objectUpsertOperation,\n requireEffectiveObject,\n runtimeOperationId,\n toObjectRow,\n} from \"../materializer-adapter\"\nimport { runRuntimeItemBatch } from \"../runtime-batch\"\n\nexport async function upsertObjectBatch(\n ctx: ResolvedObjectContext,\n items: readonly { properties: Record<string, unknown> }[]\n): Promise<readonly BatchItemResult<ObjectRow>[]> {\n assertCanEdit(ctx, ctx.objectType.id)\n const { objectType, primaryPropertyId, ontology } = ctx\n const valueTypesById = ontology.getValueTypesById()\n\n return runRuntimeItemBatch({\n ctx,\n items,\n plan(item, index) {\n const normalized = normalizeRuntimeObject({\n objectType,\n primaryPropertyId,\n properties: item.properties,\n valueTypesById,\n })\n const ref = { objectTypeId: objectType.id, primaryId: normalized.primaryId }\n return {\n // One commit resolves one authority state per object, so two items for the same identity are\n // unambiguous only when they ask for the same thing.\n key: `${ref.objectTypeId}:${ref.primaryId}`,\n label: `object '${ref.objectTypeId}:${ref.primaryId}'`,\n fingerprint: stableJsonStringify(normalized.properties),\n operations: [\n objectUpsertOperation({\n id: runtimeOperationId(index),\n ref,\n properties: normalized.properties,\n }),\n ],\n }\n },\n value: ([outcome]) => toObjectRow(ctx.projectId, requireEffectiveObject(outcome)),\n })\n}\n",
|
|
18
|
-
"/**\n * Low-level write: append normalized telemetry points through the ontology Materializer.\n *\n * Shared by the batch operation and the per-property appenders in ObjectByIdHandle. The Materializer\n * persists immutable point history, derives latest telemetry state, and writes the commit's outbox\n * facts in one transaction, so this leaf never appends events or writes providers itself.\n */\nimport { randomUUID } from \"node:crypto\"\nimport type { AuthorizationContext } from \"../../authorization\"\nimport { assertCanAppendTelemetry } from \"../../authorization\"\nimport { MaterializationObjectNotFoundError } from \"../../materialization/errors\"\nimport type { TelemetryCommitResult, TelemetryPointWrite } from \"../../materialization/model\"\nimport { getOntologyMutationRuntime } from \"../../runtime/ontology-mutations\"\nimport { ObjectNotFoundError } from \"../../storage/errors\"\nimport type { RuntimeMaterializerContext } from \"../materializer-adapter\"\n\nexport type TelemetryWriteContext = RuntimeMaterializerContext & {\n readonly authorization?: AuthorizationContext\n}\n\nexport async function writeTelemetryBatch(\n ctx: TelemetryWriteContext,\n points: readonly TelemetryPointWrite[]\n): Promise<TelemetryCommitResult | null> {\n // Asserted from the points rather than a resolved context: this leaf is the low-level choke point\n // for both `appendTelemetryBatch` and the per-property `TelemetryChannel`, and only the points know\n // which object types the call actually touches.\n for (const objectTypeId of new Set(points.map((point) => point.series.object.objectTypeId))) {\n assertCanAppendTelemetry(ctx, objectTypeId)\n }\n if (points.length === 0) return null\n\n let commit: TelemetryCommitResult\n try {\n commit = await getOntologyMutationRuntime(ctx).appendTelemetry({\n source: { kind: \"runtime\", requestId: randomUUID() },\n // A `Principal` is an `EventActor` — same literals, no translation.\n ...(ctx.authorization === undefined ? {} : { actor: ctx.authorization.principal }),\n points,\n })\n } catch (error) {\n if (error instanceof MaterializationObjectNotFoundError) {\n throw new ObjectNotFoundError(\n error.objectTypeId,\n error.primaryId,\n \"Object not found for telemetry append\"\n )\n }\n throw error\n }\n return commit\n}\n",
|
|
19
|
-
"/**\n * Leaf operation: batch telemetry append for multiple objects of a single type.\n */\nimport { assertCanAppendTelemetry } from \"../../authorization\"\nimport type { TelemetryPointWrite } from \"../../materialization/model\"\nimport { telemetryPointKey } from \"../../materialization/refs\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport { assertTelemetryProperty } from \"../../ontology/validation\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport { writeTelemetryBatch } from \"./write-batch\"\n\n/**\n * Type guard for telemetry values that carry an explicit unit.\n *\n * Matches only the exact `{ value, unit }` wrapper (a string `unit` and no other\n * keys) so a legitimate JSON/object telemetry value is not silently\n * reinterpreted as value+unit. A fully explicit batch contract (passing units\n * out-of-band like the single-property appender) is tracked as a follow-up;\n * this narrows the heuristic without changing the public batch API.\n */\nfunction isUnitBearingValue(raw: unknown): raw is { value: unknown; unit: string } {\n if (raw === null || typeof raw !== \"object\") {\n return false\n }\n const record = raw as Record<string, unknown>\n return \"value\" in record && typeof record.unit === \"string\" && Object.keys(record).length === 2\n}\n\nexport async function appendTelemetryBatch(\n ctx: ResolvedObjectContext,\n items: readonly {\n id: string\n properties: Record<string, unknown | { value: unknown; unit: string }>\n at?: Date\n }[]\n): Promise<void> {\n // `writeTelemetryBatch` asserts again from the points it receives. Asserting here as well is not\n // redundant: it reports the type by name before any property is resolved, and it still refuses an\n // empty batch, which produces no points to assert over.\n assertCanAppendTelemetry(ctx, ctx.objectType.id)\n const { objectType } = ctx\n // Telemetry identity is `(series, at)`, so a repeated instant inside one call is an upsert: the\n // last value wins rather than failing the whole batch.\n const points = new Map<string, TelemetryPointWrite>()\n\n for (const item of items) {\n const at = (item.at ?? new Date()).toISOString()\n\n for (const [propertyId, rawValue] of Object.entries(item.properties)) {\n const propertyToken = objectType.p[propertyId]\n if (!propertyToken) {\n throw new OntologyValidationError(`Unknown property '${objectType.id}.${propertyId}'`)\n }\n\n assertTelemetryProperty(propertyToken.property)\n\n // Value and unit validation, plus schema normalization, happen inside the Materializer.\n const series = {\n object: { objectTypeId: objectType.id, primaryId: item.id },\n propertyId: propertyToken.id,\n }\n points.set(telemetryPointKey(series, at), {\n series,\n value: isUnitBearingValue(rawValue)\n ? (rawValue.value as TelemetryPointWrite[\"value\"])\n : (rawValue as TelemetryPointWrite[\"value\"]),\n ...(isUnitBearingValue(rawValue) ? { unit: rawValue.unit } : {}),\n at,\n })\n }\n }\n\n await writeTelemetryBatch(ctx, [...points.values()])\n}\n",
|
|
20
|
-
"import { type AuthorizationContext, assertAuthorized } from \"../../authorization\"\nimport type {\n TimeseriesHistoryBatchInput,\n TimeseriesHistoryBatchResult,\n TimeseriesHistorySeriesInput,\n TimeseriesStorage,\n} from \"../../storage\"\n\nexport interface TelemetryHistoryOptions {\n readonly storage: TimeseriesStorage\n readonly authorization?: AuthorizationContext | null\n}\n\nexport async function getTelemetryHistoryBatch(\n input: TimeseriesHistoryBatchInput,\n options: TelemetryHistoryOptions\n): Promise<readonly TimeseriesHistoryBatchResult[]> {\n assertTelemetrySeriesViewable(input.series, options.authorization)\n return options.storage.getHistoryBatch(input)\n}\n\nfunction assertTelemetrySeriesViewable(\n series: readonly TimeseriesHistorySeriesInput[],\n authorization: AuthorizationContext | null | undefined\n): void {\n for (const objectTypeId of new Set(series.map((entry) => entry.objectTypeId))) {\n assertAuthorized(\n { authorization: authorization ?? undefined },\n { kind: \"object.view\", objectTypeId }\n )\n }\n}\n",
|
|
21
|
-
"/**\n * Telemetry channel factory for ObjectByIdHandle.\n *\n * Creates a per-property channel that writes through the low-level `writeTelemetryBatch` leaf and\n * reads the same series back through `getTelemetryHistoryBatch`, both keyed by the property token.\n */\nimport type { TelemetryPointWrite } from \"../../materialization/model\"\nimport type { ValueType } from \"../../ontology\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport {\n assertPropertyTokenBelongsToObjectType,\n assertTelemetryProperty,\n} from \"../../ontology/validation\"\nimport { RuntimeError } from \"../../runtime/errors\"\nimport type {\n TelemetryChannel,\n TelemetryHistoryInput,\n TelemetryPropertyToken,\n} from \"../../runtime/types\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport { getTelemetryHistoryBatch, writeTelemetryBatch } from \"../telemetry\"\n\nexport function createTelemetryChannel<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(ctx: ResolvedObjectContext, primaryId: string) {\n return <TToken extends TelemetryPropertyToken<TObjectType>>(\n property: TToken\n ): TelemetryChannel<TToken, TValueTypes> => {\n const { objectType } = ctx\n assertPropertyTokenBelongsToObjectType(objectType, property)\n assertTelemetryProperty(property.property)\n\n const series = { objectTypeId: objectType.id, objectId: primaryId, propertyId: property.id }\n\n const channel = {\n append: async (input: { value: unknown; unit?: string; at: Date }) => {\n // Value and unit validation, plus schema normalization, happen inside the Materializer.\n await writeTelemetryBatch(ctx, [\n {\n series: {\n object: { objectTypeId: objectType.id, primaryId },\n propertyId: property.id,\n },\n value: input.value as TelemetryPointWrite[\"value\"],\n ...(input.unit !== undefined ? { unit: input.unit } : {}),\n at: input.at.toISOString(),\n },\n ])\n },\n\n history: async (input: TelemetryHistoryInput = {}) => {\n const timeseries = ctx.storage.timeseries\n if (!timeseries) {\n throw new RuntimeError(\"[Sixb] Reading telemetry requires storage.timeseries support.\")\n }\n\n const [result] = await getTelemetryHistoryBatch(\n {\n projectId: ctx.projectId,\n series: [series],\n ...(input.from !== undefined ? { from: input.from } : {}),\n ...(input.to !== undefined ? { to: input.to } : {}),\n ...(input.limit !== undefined ? { limitPerSeries: input.limit } : {}),\n ...(input.order !== undefined ? { order: input.order } : {}),\n },\n { storage: timeseries, authorization: ctx.authorization }\n )\n\n return (result?.points ?? []).map((point) => ({\n value: point.value,\n at: point.at,\n ...(point.unit !== undefined ? { unit: point.unit } : {}),\n }))\n },\n }\n\n // Cast needed: generic token inference boundary — TToken is narrower than what `channel` sees\n return channel as unknown as TelemetryChannel<TToken, TValueTypes>\n }\n}\n",
|
|
22
|
-
"/**\n * ObjectByIdHandle binds operations to a specific object id within an ObjectSet.\n * Created via `sixb.objects(MyType).byId(\"id-1\")`, it provides link/unlink and\n * per-property telemetry appenders with compile-time unit and value type safety.\n */\nimport type { ActionDefinition } from \"../../actions\"\nimport { assertAuthorized, assertPrivileged } from \"../../authorization\"\nimport type { ObjectLink, ObjectRef, ValueType } from \"../../ontology\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport type { LinkToken, ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { assertLinkTokenBelongsToObjectType } from \"../../ontology/validation\"\nimport type { ObjectByIdHandle, TwinObject } from \"../../runtime/types\"\nimport {\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport type { ResolvedLinkContext, ResolvedObjectContext } from \"../context\"\nimport { removeLink as removeLinkLeaf, upsertLink as upsertLinkLeaf } from \"../link\"\nimport { deleteObject, restoreObject } from \"../object\"\nimport { createTelemetryChannel } from \"./telemetry-channel\"\n\ntype ObjectRefInput = ObjectRef\ntype AnyLinkToken = LinkToken<string, string, string | readonly string[], ObjectLink>\n\nexport function createObjectByIdHandle<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(ctx: ResolvedObjectContext, primaryId: string): ObjectByIdHandle<TObjectType, TValueTypes> {\n const objectHandle = {\n get: async () => {\n assertAuthorized(ctx, { kind: \"object.view\", objectTypeId: ctx.objectType.id })\n const row = await ctx.storage.objects.getByPrimaryId({\n projectId: ctx.projectId,\n objectTypeId: ctx.objectType.id,\n primaryId,\n })\n return row ? (row as unknown as TwinObject<TObjectType, TValueTypes>) : null\n },\n\n listLinks: async (linkToken?: AnyLinkToken) => {\n // Link rows reveal target types; no link grant semantics exist yet.\n assertPrivileged(ctx, \"listLinks\")\n if (linkToken) {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n }\n return ctx.storage.objects.listLinks({\n projectId: ctx.projectId,\n objectTypeId: ctx.objectType.id,\n objectId: primaryId,\n linkId: linkToken?.id,\n })\n },\n\n link: async (\n linkToken: AnyLinkToken,\n target: ObjectRefInput,\n options?: { properties?: Record<string, unknown> }\n ) => {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n\n const linkCtx: ResolvedLinkContext = { ...ctx, linkDefinition: linkToken.link }\n await upsertLinkLeaf(linkCtx, {\n sourceId: primaryId,\n linkId: linkToken.id,\n targetTypeId: target.objectTypeId,\n targetId: target.primaryId,\n properties: options?.properties,\n })\n },\n\n unlink: async (linkToken: AnyLinkToken, target: ObjectRefInput) => {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n\n const linkCtx: ResolvedLinkContext = { ...ctx, linkDefinition: linkToken.link }\n await removeLinkLeaf(linkCtx, {\n sourceId: primaryId,\n linkId: linkToken.id,\n targetTypeId: target.objectTypeId,\n targetId: target.primaryId,\n })\n },\n\n delete: async () => {\n await deleteObject(ctx, primaryId)\n },\n\n restore: async () => {\n await restoreObject(ctx, primaryId)\n },\n\n requestAction: async (input: {\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n runId?: string\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestAction requires either 'action' or 'actionId'\"\n )\n }\n return requestActionLeaf(ctx, {\n primaryId,\n actionId,\n params: input.params,\n options: { runId: input.runId },\n })\n },\n\n requestActionAndWait: async (input: {\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n timeoutMs?: number\n signal?: AbortSignal\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestActionAndWait requires either 'action' or 'actionId'\"\n )\n }\n return requestActionAndWaitLeaf(ctx, {\n primaryId,\n actionId,\n params: input.params,\n options: {\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n },\n })\n },\n\n telemetry: createTelemetryChannel<TObjectType, TValueTypes>(ctx, primaryId),\n }\n\n return objectHandle as unknown as ObjectByIdHandle<TObjectType, TValueTypes>\n}\n",
|
|
23
|
-
"/**\n * Server-side ObjectQueryExecutor backed by the shared query executor and storage.\n * Validation, planning, fallback, and execution all run in-process here; the\n * HTTP executor in `@sixb/client` is the remote counterpart.\n */\n\nimport type { AuthorizationContext } from \"../../authorization\"\nimport type { OntologyRegistry } from \"../../ontology\"\nimport type { Storage } from \"../../storage\"\nimport {\n countObjects,\n executeObjectQuery,\n existsObjects,\n facetObjects,\n ObjectQueryPlanningError,\n} from \"../query\"\nimport { explainObjectQuery } from \"../query/explain\"\nimport type { ObjectQuery } from \"../query/ir\"\nimport { validateObjectQuery } from \"../query/validate\"\nimport type { ObjectQueryExecutor, ObjectQueryExecutorFacetRequest } from \"./query-executor\"\n\nexport function createRuntimeQueryExecutor(params: {\n projectId: string\n ontology: OntologyRegistry\n storage: Storage\n authorization?: AuthorizationContext\n}): ObjectQueryExecutor {\n const { projectId, ontology, storage, authorization } = params\n const executorOptions = { ontology, storage: storage.objects, authorization }\n\n return {\n async list(query: ObjectQuery, options?: { includeTotal?: boolean }) {\n try {\n return await executeObjectQuery(\n { projectId, query, includeTotal: options?.includeTotal },\n executorOptions\n )\n } catch (error) {\n if (error instanceof ObjectQueryPlanningError) {\n throw addSdkPlanningHints(error)\n }\n throw error\n }\n },\n\n async count(query: ObjectQuery) {\n const result = await countObjects({ projectId, query }, executorOptions)\n return result.count\n },\n\n async exists(query: ObjectQuery) {\n const result = await existsObjects({ projectId, query }, executorOptions)\n return result.exists\n },\n\n async facets(query: ObjectQuery, facets: readonly ObjectQueryExecutorFacetRequest[]) {\n const result = await facetObjects({ projectId, query, facets }, executorOptions)\n return result.facets.map((facet) => ({\n propertyId: facet.propertyId,\n buckets: [...facet.buckets],\n }))\n },\n\n validate(query: ObjectQuery) {\n return validateObjectQuery(query, { ontology, normalize: false })\n },\n\n explain(query: ObjectQuery) {\n return explainObjectQuery(query, { ontology, normalize: false })\n },\n }\n}\n\nfunction addSdkPlanningHints(error: ObjectQueryPlanningError): ObjectQueryPlanningError {\n if (!error.issues.some((issue) => issue.code === \"fallback_requires_bound\")) return error\n\n return new ObjectQueryPlanningError(\n error.issues.map((issue) =>\n issue.code === \"fallback_requires_bound\"\n ? {\n ...issue,\n message:\n \"Object query fallback requires an explicit result bound. Add .limit(n) or .page({ pageSize: n }) before .list().\",\n }\n : issue\n )\n )\n}\n",
|
|
24
|
-
"/**\n * ObjectSet provides a type-safe collection API for objects of a given type.\n * Created via `sixb.objects(MyType)`, it exposes upsert, query, and telemetry batch operations\n * while preserving compile-time property types inferred from the ontology definition.\n */\n\nimport type { ActionDefinition } from \"../../actions\"\nimport type { AuthorizationContext } from \"../../authorization\"\nimport { assertAuthorized } from \"../../authorization\"\nimport { shareSixbErrorReporter } from \"../../error-reporting/capability\"\nimport type { ValueType } from \"../../ontology\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { shareOntologyMutationRuntime } from \"../../runtime/ontology-mutations\"\nimport type {\n ObjectSet,\n ObjectSetListInput,\n SixbRuntimeContext,\n TwinObject,\n} from \"../../runtime/types\"\nimport {\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport type { ResolvedLinkContext, ResolvedObjectContext } from \"../context\"\nimport { requireLinkDefinition } from \"../context\"\nimport { removeLink as removeLinkLeaf, upsertLink as upsertLinkLeaf } from \"../link\"\nimport { upsertObject as upsertObjectLeaf } from \"../object\"\nimport { appendTelemetryBatch as appendTelemetryBatchLeaf } from \"../telemetry\"\nimport { createObjectByIdHandle } from \"./object-handle\"\nimport { createObjectQueryBuilder } from \"./query-builder\"\nimport { createRuntimeQueryExecutor } from \"./runtime-query-executor\"\n\nexport function createObjectSet<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TRegisteredObjectTypes extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(\n params: SixbRuntimeContext & {\n readonly objectType: TObjectType\n readonly authorization?: AuthorizationContext\n }\n): ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes> {\n const { objectType } = params\n const primaryProp = objectType.properties.find((p) => p.primary)\n if (!primaryProp) {\n throw new OntologyValidationError(`Object type '${objectType.id}' has no primary property`)\n }\n const primaryPropertyId = primaryProp.id\n\n const {\n projectId,\n ontology,\n actionRegistry,\n events,\n lakeStorage,\n blobStorage,\n storage,\n queues,\n authorization,\n } = params\n const queryExecutor = createRuntimeQueryExecutor({ projectId, ontology, storage, authorization })\n\n const resolvedCtx: ResolvedObjectContext = {\n projectId,\n ontology,\n actionRegistry,\n events,\n lakeStorage,\n blobStorage,\n storage,\n queues,\n authorization,\n objectType,\n primaryPropertyId,\n }\n shareOntologyMutationRuntime(params, resolvedCtx)\n shareSixbErrorReporter(params, resolvedCtx)\n\n const objectSet = {\n get: async (id: string) => {\n assertAuthorized(resolvedCtx, { kind: \"object.view\", objectTypeId: objectType.id })\n const row = await storage.objects.getByPrimaryId({\n projectId,\n objectTypeId: objectType.id,\n primaryId: id,\n })\n return row ? (row as unknown as TwinObject<TObjectType, TValueTypes>) : null\n },\n\n upsert: async (input: { properties: Record<string, unknown> }) => {\n const row = await upsertObjectLeaf(resolvedCtx, input.properties)\n return row as unknown as TwinObject<TObjectType, TValueTypes>\n },\n\n query: () =>\n createObjectQueryBuilder<TObjectType, TRegisteredObjectTypes, TValueTypes>({\n query: { kind: \"start\", objectTypeId: objectType.id },\n executor: queryExecutor,\n }),\n\n byId: (id: string) => createObjectByIdHandle<TObjectType, TValueTypes>(resolvedCtx, id),\n\n list: async (input?: ObjectSetListInput) => {\n assertAuthorized(resolvedCtx, { kind: \"object.view\", objectTypeId: objectType.id })\n const result = await storage.objects.list({\n projectId,\n objectTypeId: objectType.id,\n primaryIdPrefix: input?.idPrefix,\n primaryIdSuffix: input?.idSuffix,\n updatedAfter: input?.updatedAfter,\n updatedBefore: input?.updatedBefore,\n createdAfter: input?.createdAfter,\n createdBefore: input?.createdBefore,\n limit: input?.limit,\n offset: input?.offset,\n orderBy: input?.orderBy,\n order: input?.order,\n })\n\n return {\n objects: result.objects.map(\n (row) => row as unknown as TwinObject<TObjectType, TValueTypes>\n ),\n hasMore: result.hasMore,\n total: result.total ?? result.objects.length,\n }\n },\n\n appendTelemetryBatch: async (\n items: readonly {\n id: string\n properties: Record<string, unknown | { value: unknown; unit: string }>\n at?: Date\n }[]\n ) => {\n await appendTelemetryBatchLeaf(resolvedCtx, items)\n },\n\n requestAction: async (input: {\n id: string\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n runId?: string\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestAction requires either 'action' or 'actionId'\"\n )\n }\n return requestActionLeaf(resolvedCtx, {\n primaryId: input.id,\n actionId,\n params: input.params,\n options: { runId: input.runId },\n })\n },\n\n requestActionAndWait: async (input: {\n id: string\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n timeoutMs?: number\n signal?: AbortSignal\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestActionAndWait requires either 'action' or 'actionId'\"\n )\n }\n return requestActionAndWaitLeaf(resolvedCtx, {\n primaryId: input.id,\n actionId,\n params: input.params,\n options: {\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n },\n })\n },\n\n upsertLink: async (input: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n properties?: Record<string, unknown>\n }) => {\n const linkDefinition = requireLinkDefinition(objectType, input.linkId)\n const linkCtx: ResolvedLinkContext = { ...resolvedCtx, linkDefinition }\n\n await upsertLinkLeaf(linkCtx, {\n sourceId: input.sourceId,\n linkId: input.linkId,\n targetTypeId: input.targetTypeId,\n targetId: input.targetId,\n properties: input.properties,\n })\n },\n\n removeLink: async (input: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n }) => {\n const linkDefinition = requireLinkDefinition(objectType, input.linkId)\n const linkCtx: ResolvedLinkContext = { ...resolvedCtx, linkDefinition }\n\n await removeLinkLeaf(linkCtx, {\n sourceId: input.sourceId,\n linkId: input.linkId,\n targetTypeId: input.targetTypeId,\n targetId: input.targetId,\n })\n },\n }\n\n return objectSet as unknown as ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>\n}\n",
|
|
25
|
-
"/**\n * Service layer for action operations.\n *\n * Resolves objectTypeId to a typed context and delegates to the leaf function.\n */\n\nimport type { RequestActionResult } from \"../../actions/request\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ActionRunRecord } from \"../../storage\"\nimport {\n type RequestActionAndWaitOptions,\n type RequestActionOptions,\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport { resolveObjectContext } from \"../context\"\n\nexport async function requestAction(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n primaryId: string,\n actionId: string,\n params?: Record<string, unknown>,\n options?: RequestActionOptions\n): Promise<RequestActionResult> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n return requestActionLeaf(ctx, { primaryId, actionId, params, options })\n}\n\nexport async function requestActionAndWait(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n primaryId: string,\n actionId: string,\n params?: Record<string, unknown>,\n options?: RequestActionAndWaitOptions\n): Promise<ActionRunRecord> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n return requestActionAndWaitLeaf(ctx, { primaryId, actionId, params, options })\n}\n",
|
|
26
|
-
"/**\n * Service layer for link operations.\n *\n * Resolves objectTypeId to a typed context and delegates to leaf functions.\n */\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkBatchItem } from \"../context\"\nimport { requireLinkDefinition, resolveLinkContext, resolveObjectContext } from \"../context\"\nimport {\n removeLink as removeLinkLeaf,\n upsertLinkBatch as upsertLinkBatchLeaf,\n upsertLink as upsertLinkLeaf,\n} from \"../link\"\n\nexport async function upsertLink(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n const linkCtx = resolveLinkContext(ctx, linkId)\n await upsertLinkLeaf(linkCtx, {\n sourceId,\n linkId,\n targetTypeId: target.targetTypeId,\n targetId: target.targetId,\n properties: target.properties,\n })\n}\n\nexport async function upsertLinkBatch(\n runtime: SixbRuntimeContext,\n items: readonly {\n objectTypeId: string\n sourceId: string\n linkId: string\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n }[]\n): Promise<readonly BatchItemResult<void>[]> {\n const resolvedItems: ResolvedLinkBatchItem[] = items.map((item) => {\n const objectType = runtime.ontology.resolveObjectType(item.objectTypeId)\n const linkDefinition = requireLinkDefinition(objectType, item.linkId)\n return {\n objectType,\n linkDefinition,\n sourceId: item.sourceId,\n linkId: item.linkId,\n targetTypeId: item.target.targetTypeId,\n targetId: item.target.targetId,\n properties: item.target.properties,\n }\n })\n\n return upsertLinkBatchLeaf(runtime, resolvedItems)\n}\n\nexport async function removeLink(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string }\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n const linkCtx = resolveLinkContext(ctx, linkId)\n await removeLinkLeaf(linkCtx, {\n sourceId,\n linkId,\n targetTypeId: target.targetTypeId,\n targetId: target.targetId,\n })\n}\n",
|
|
27
|
-
"/**\n * Cross-type object listing for dashboards and search.\n *\n * On scoped runtimes the type filter is authorized before the storage call:\n * explicitly requested types must all be viewable, and unfiltered listings\n * narrow to the principal's viewable types instead of post-filtering rows.\n */\n\nimport { assertAuthorized } from \"../../authorization\"\nimport type { ListResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\n\nexport interface ListObjectsParams {\n objectTypeIds?: readonly string[]\n idPrefix?: string\n idSuffix?: string\n updatedAfter?: Date\n updatedBefore?: Date\n createdAfter?: Date\n createdBefore?: Date\n limit?: number\n offset?: number\n orderBy?: \"createdAt\" | \"updatedAt\" | \"primaryId\"\n order?: \"asc\" | \"desc\"\n}\n\nexport async function listObjects(\n runtime: SixbRuntimeContext,\n params: ListObjectsParams\n): Promise<ListResult<ObjectRow>> {\n const objectTypeIds = resolveAuthorizedTypeFilter(runtime, params.objectTypeIds)\n\n if (runtime.authorization && objectTypeIds !== undefined && objectTypeIds.length === 0) {\n return { objects: [], hasMore: false, total: 0 }\n }\n\n const result = await runtime.storage.objects.list({\n projectId: runtime.projectId,\n objectTypeId: objectTypeIds?.length === 1 ? objectTypeIds[0] : objectTypeIds,\n primaryIdPrefix: params.idPrefix,\n primaryIdSuffix: params.idSuffix,\n updatedAfter: params.updatedAfter,\n updatedBefore: params.updatedBefore,\n createdAfter: params.createdAfter,\n createdBefore: params.createdBefore,\n limit: params.limit,\n offset: params.offset,\n orderBy: params.orderBy,\n order: params.order,\n })\n\n return {\n objects: [...result.objects],\n hasMore: result.hasMore,\n total: result.total,\n }\n}\n\nfunction resolveAuthorizedTypeFilter(\n runtime: SixbRuntimeContext,\n requested: readonly string[] | undefined\n): readonly string[] | undefined {\n if (requested) {\n for (const objectTypeId of requested) {\n runtime.ontology.resolveObjectType(objectTypeId)\n }\n }\n\n const expanded = requested\n ? [...new Set(requested.flatMap((id) => [id, ...runtime.ontology.listSubTypes(id)]))]\n : undefined\n\n if (!runtime.authorization) {\n return expanded\n }\n\n if (!expanded) {\n // Broad listings narrow to the visible universe rather than failing. The\n // set already contains every registered type when \"all\" was granted.\n return [...runtime.authorization.grants[\"view:object\"]]\n }\n\n // Explicitly requested types must all be viewable.\n for (const objectTypeId of expanded) {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n }\n\n return expanded\n}\n",
|
|
28
|
-
"/**\n * Service layer for object upsert operations.\n *\n * Resolves objectTypeId to a typed context and delegates to leaf functions.\n */\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\nimport { resolveObjectContext } from \"../context\"\nimport {\n upsertObjectBatch as upsertObjectBatchLeaf,\n upsertObject as upsertObjectLeaf,\n} from \"../object\"\n\nexport async function upsertObject(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n properties: Record<string, unknown>\n): Promise<ObjectRow> {\n return upsertObjectLeaf(resolveObjectContext(runtime, objectTypeId), properties)\n}\n\nexport async function upsertObjectBatch(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n items: readonly { properties: Record<string, unknown> }[]\n): Promise<readonly BatchItemResult<ObjectRow>[]> {\n return upsertObjectBatchLeaf(resolveObjectContext(runtime, objectTypeId), items)\n}\n",
|
|
29
|
-
"/**\n * Service layer for telemetry operations.\n *\n * Resolves objectTypeId to a typed context and delegates to the leaf function.\n */\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport { resolveObjectContext } from \"../context\"\nimport { appendTelemetryBatch as appendTelemetryBatchLeaf } from \"../telemetry\"\n\nexport async function appendTelemetry(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n items: readonly { id: string; properties: Record<string, unknown>; at?: Date }[]\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n await appendTelemetryBatchLeaf(ctx, items)\n}\n"
|
|
30
|
-
],
|
|
31
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,eAAsB,cAAa,CACjC,KACA,QAM8B;AAAA,EAC9B,OAAO,cAAqB,KAAK;AAAA,IAC/B,UAAU,OAAO;AAAA,IACjB,SAAS;AAAA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