@sixb/core 0.1.0 → 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 +54 -23
- 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 +34 -23
- 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 +4 -4
- 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/builders.d.ts +8 -1
- package/dist/agents/builders.d.ts.map +1 -1
- package/dist/agents/context.js +2 -2
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +16 -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 +10 -10
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +81 -14
- 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/tool-definition.d.ts +9 -0
- package/dist/agents/tool-definition.d.ts.map +1 -0
- package/dist/agents/types.d.ts +64 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +16 -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 +3 -2
- package/dist/blob-storage/browser.js.map +1 -1
- 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 +4 -3
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/blob-storage/validation.d.ts.map +1 -1
- 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 +59 -59
- 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-mx84y05q.js → chunk-3j7573mj.js} +2 -2
- package/dist/{chunk-mx84y05q.js.map → chunk-3j7573mj.js.map} +2 -2
- package/dist/{chunk-45tw90k7.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-dhmj53mx.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-8r8cw2xw.js → chunk-63te770v.js} +40 -5
- package/dist/{chunk-8r8cw2xw.js.map → chunk-63te770v.js.map} +3 -3
- 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-f2b5e2gf.js → chunk-85j5ybfj.js} +18 -3
- package/dist/{chunk-f2b5e2gf.js.map → chunk-85j5ybfj.js.map} +3 -3
- package/dist/{chunk-vj723r3p.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-r65yscvk.js → chunk-a31h57d5.js} +131 -13
- package/dist/chunk-a31h57d5.js.map +13 -0
- 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-jdwx7vzs.js → chunk-c6qd89g5.js} +240 -143
- package/dist/chunk-c6qd89g5.js.map +15 -0
- package/dist/{chunk-2s6sydsh.js → chunk-ckxfnx7f.js} +294 -4
- package/dist/chunk-ckxfnx7f.js.map +13 -0
- 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-yxss87qa.js → chunk-f2rt4vkh.js} +48 -29
- package/dist/chunk-f2rt4vkh.js.map +14 -0
- package/dist/{chunk-q4qzq0ea.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-c3zd880g.js → chunk-ghteq96b.js} +8 -8
- package/dist/{chunk-c3zd880g.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-dcgrzj1t.js → chunk-jaj13078.js} +121 -9
- package/dist/chunk-jaj13078.js.map +38 -0
- package/dist/{chunk-t358gywy.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-2gpr6jsz.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-tsk2bxs3.js → chunk-rnshztfq.js} +13 -13
- package/dist/{chunk-tsk2bxs3.js.map → chunk-rnshztfq.js.map} +3 -3
- package/dist/chunk-sa4340y1.js +607 -0
- package/dist/chunk-sa4340y1.js.map +14 -0
- package/dist/{chunk-yvef9xwc.js → chunk-st4xgxey.js} +583 -251
- package/dist/chunk-st4xgxey.js.map +45 -0
- package/dist/{chunk-1vffvydj.js → chunk-t8t39h7v.js} +6 -6
- package/dist/chunk-t8t39h7v.js.map +10 -0
- 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-p6r5g77m.js → chunk-vybf6pkp.js} +1 -1
- package/dist/{chunk-wj01s5hr.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-aebzcsxr.js → chunk-ys1nse2v.js} +2178 -382
- package/dist/chunk-ys1nse2v.js.map +56 -0
- package/dist/{chunk-5yny9z0e.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-4pycxcj3.js → chunk-zqysyfjt.js} +6 -9
- package/dist/{chunk-4pycxcj3.js.map → chunk-zqysyfjt.js.map} +3 -3
- 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/builders.d.ts +18 -5
- package/dist/datasets/builders.d.ts.map +1 -1
- package/dist/datasets/changes.d.ts +18 -0
- package/dist/datasets/changes.d.ts.map +1 -0
- package/dist/datasets/execution.d.ts +8 -0
- package/dist/datasets/execution.d.ts.map +1 -0
- package/dist/datasets/index.d.ts +3 -1
- package/dist/datasets/index.d.ts.map +1 -1
- package/dist/datasets/types.d.ts +2 -0
- package/dist/datasets/types.d.ts.map +1 -1
- package/dist/datasets/validation.d.ts.map +1 -1
- 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/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +35 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -111
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +8 -2
- package/dist/json.d.ts.map +1 -1
- package/dist/lake-storage/definition-updates.d.ts.map +1 -1
- package/dist/lake-storage/in-memory.d.ts +15 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +3 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +15 -7
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/merge-validation.d.ts +10 -0
- package/dist/lake-storage/merge-validation.d.ts.map +1 -0
- package/dist/lake-storage/merge.d.ts +32 -0
- package/dist/lake-storage/merge.d.ts.map +1 -0
- package/dist/lake-storage/types.d.ts +3 -1
- package/dist/lake-storage/types.d.ts.map +1 -1
- 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 +7 -6
- package/dist/ontology/internal.js.map +3 -3
- package/dist/ontology/registry.d.ts +15 -2
- package/dist/ontology/registry.d.ts.map +1 -1
- package/dist/ontology/validation/normalize.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 +90 -27
- 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 +35 -14
- 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 +30 -30
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/builders.d.ts +11 -3
- package/dist/syncs/builders.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 +34 -22
- package/dist/syncs/types.d.ts.map +1 -1
- package/dist/syncs/validation.d.ts +14 -0
- package/dist/syncs/validation.d.ts.map +1 -0
- 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 +13 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +4270 -1484
- package/dist/testing/index.js.map +27 -14
- package/dist/testing/lake-merge-storage-contract.d.ts +7 -0
- package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -0
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- 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 +63 -35
- 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 +8 -12
- package/src/agents/authority.ts +189 -0
- package/src/agents/builders.ts +53 -3
- package/src/agents/dispatch.ts +1 -6
- package/src/agents/errors.ts +24 -0
- package/src/agents/execution.ts +254 -0
- package/src/agents/index.ts +37 -5
- package/src/agents/prompt.ts +17 -5
- package/src/agents/request.ts +153 -13
- package/src/agents/streams.ts +150 -3
- package/src/agents/tool-definition.ts +93 -0
- package/src/agents/types.ts +99 -0
- package/src/agents/validation.ts +289 -5
- 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/blob-storage/validation.ts +2 -10
- 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/builders.ts +49 -5
- package/src/datasets/changes.ts +13 -0
- package/src/datasets/execution.ts +24 -0
- package/src/datasets/index.ts +3 -0
- package/src/datasets/types.ts +5 -0
- package/src/datasets/validation.ts +53 -11
- 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 +42 -7
- package/src/index.ts +127 -10
- package/src/json.ts +11 -8
- package/src/lake-storage/definition-updates.ts +21 -0
- package/src/lake-storage/in-memory.ts +284 -2
- package/src/lake-storage/index.ts +14 -0
- package/src/lake-storage/merge-validation.ts +117 -0
- package/src/lake-storage/merge.ts +35 -0
- package/src/lake-storage/types.ts +3 -1
- 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/json-schema.ts +2 -1
- package/src/ontology/registry.ts +16 -2
- package/src/ontology/validation/normalize.ts +9 -15
- 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 -807
- 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 +155 -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 +92 -9
- package/src/storage/sync-runs/index.ts +5 -1
- package/src/storage/sync-runs/provider.ts +25 -0
- package/src/storage/sync-runs/types.ts +44 -15
- package/src/storage/types.ts +45 -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 +91 -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 +38 -25
- package/src/syncs/builders.ts +33 -15
- package/src/syncs/execution.ts +78 -0
- package/src/syncs/index.ts +14 -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 +75 -25
- package/src/syncs/validation.ts +77 -0
- 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 +56 -0
- package/src/testing/lake-merge-storage-contract.ts +302 -0
- package/src/testing/lake-storage-contract.ts +23 -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/snapshot.ts +1 -10
- 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-0fygrz37.js +0 -354
- package/dist/chunk-0fygrz37.js.map +0 -17
- package/dist/chunk-0psb6kdw.js +0 -989
- package/dist/chunk-0psb6kdw.js.map +0 -15
- package/dist/chunk-1vffvydj.js.map +0 -10
- package/dist/chunk-2gpr6jsz.js.map +0 -13
- package/dist/chunk-2s6sydsh.js.map +0 -12
- package/dist/chunk-50kv63vj.js.map +0 -12
- package/dist/chunk-590dejbp.js +0 -49
- package/dist/chunk-590dejbp.js.map +0 -10
- package/dist/chunk-867jxh7c.js.map +0 -19
- package/dist/chunk-aebzcsxr.js.map +0 -48
- package/dist/chunk-btpe64e4.js +0 -554
- package/dist/chunk-btpe64e4.js.map +0 -13
- package/dist/chunk-dcgrzj1t.js.map +0 -36
- package/dist/chunk-dhmj53mx.js.map +0 -16
- package/dist/chunk-hsv43v58.js +0 -1390
- package/dist/chunk-hsv43v58.js.map +0 -21
- package/dist/chunk-jdwx7vzs.js.map +0 -14
- package/dist/chunk-k25jm1x5.js +0 -102
- package/dist/chunk-k25jm1x5.js.map +0 -10
- package/dist/chunk-k41ajtz7.js +0 -352
- package/dist/chunk-k41ajtz7.js.map +0 -13
- package/dist/chunk-k6j72mtt.js +0 -9
- package/dist/chunk-k6j72mtt.js.map +0 -10
- package/dist/chunk-nvamz5dv.js +0 -819
- package/dist/chunk-nvamz5dv.js.map +0 -21
- package/dist/chunk-pv1yad91.js +0 -1165
- package/dist/chunk-pv1yad91.js.map +0 -27
- package/dist/chunk-q4qzq0ea.js.map +0 -14
- package/dist/chunk-r65yscvk.js.map +0 -11
- package/dist/chunk-t358gywy.js.map +0 -34
- package/dist/chunk-t72dvahb.js.map +0 -12
- package/dist/chunk-v5c085yp.js.map +0 -10
- package/dist/chunk-wj01s5hr.js.map +0 -11
- package/dist/chunk-wxhdnwh4.js +0 -37
- package/dist/chunk-wxhdnwh4.js.map +0 -10
- package/dist/chunk-xz5g49bp.js.map +0 -11
- package/dist/chunk-ya6brh8a.js.map +0 -11
- package/dist/chunk-yvef9xwc.js.map +0 -44
- package/dist/chunk-yxss87qa.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-45tw90k7.js.map → chunk-4gz41why.js.map} +0 -0
- /package/dist/{chunk-vj723r3p.js.map → chunk-8b55ygje.js.map} +0 -0
- /package/dist/{chunk-p6r5g77m.js.map → chunk-vybf6pkp.js.map} +0 -0
- /package/dist/{chunk-5yny9z0e.js.map → chunk-z3zp0bj1.js.map} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/authorization/grant-kinds.ts", "../src/execution/types.ts", "../src/execution/authorization.ts", "../src/authorization/errors.ts", "../src/authorization/decision.ts", "../src/authorization/application-access.ts", "../src/authorization/event-visibility.ts", "../src/authorization/resolve.ts", "../src/projections/errors.ts", "../src/projections/ownership.ts", "../src/projections/validation.ts", "../src/projections/builders.ts", "../src/authorization/run-visibility.ts", "../src/authorization/types.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Grant kinds: the single source of truth for the (capability, target) space.\n *\n * Every grant collapses to one `GrantKind` discriminant — the same\n * `capability:target` string the decision engine uses as a grant key (e.g.\n * `view:object`, `run:sync`). Resolution, validation, enforcement, and the\n * resolved `GrantIndex` all key off it, so adding a grant family is a single\n * entry in `GRANT_KINDS` plus the compile errors that forces at every consumer.\n */\n\nimport type { GrantDefinition } from \"../security/types\"\n\nexport type GrantKind =\n | \"access:application\"\n | \"view:object\"\n | \"view:dataset\"\n | \"edit:object\"\n | \"append:telemetry\"\n | \"apply:action\"\n | \"run:workflow\"\n | \"run:sync\"\n | \"run:pipeline\"\n | \"run:agent\"\n | \"observe:logs\"\n | \"manage:connector\"\n\n/** Registered id universes a grant kind ranges over, plus subtype expansion. */\nexport interface GrantUniverse {\n readonly applicationIds: ReadonlySet<string>\n readonly objectTypeIds: ReadonlySet<string>\n readonly datasetIds: ReadonlySet<string>\n readonly actionIds: ReadonlySet<string>\n readonly workflowIds: ReadonlySet<string>\n readonly syncIds: ReadonlySet<string>\n readonly pipelineIds: ReadonlySet<string>\n readonly agentIds: ReadonlySet<string>\n readonly observableIds: ReadonlySet<string>\n readonly connectorIds: ReadonlySet<string>\n readonly getSubTypes: (objectTypeId: string) => readonly string[]\n}\n\n/** The registered-id sets a grant kind validates against (no subtype hook). */\nexport type GrantUniverseKey = Exclude<keyof GrantUniverse, \"getSubTypes\">\n\ninterface GrantKindSpec {\n /** Registered universe the grant's ids must belong to. */\n readonly universeKey: GrantUniverseKey\n /** Subject noun used in validation errors (\"unknown <subject> '<id>'\"). */\n readonly subject: string\n /** Actionable hint appended to the \"unknown <subject>\" error. */\n readonly fix: string\n /** Only object-type grants also expand to subtypes. */\n readonly expandsSubtypes?: true\n}\n\n/**\n * The exhaustive grant-kind table. A new grant family is one entry here; the\n * `Record<GrantKind, …>` makes every omission a compile error.\n */\nexport const GRANT_KINDS: Record<GrantKind, GrantKindSpec> = {\n \"access:application\": {\n universeKey: \"applicationIds\",\n subject: \"application\",\n fix: \"Use an application exported from '@sixb/core'.\",\n },\n \"view:object\": {\n universeKey: \"objectTypeIds\",\n subject: \"object type\",\n fix: \"Register it in 'ontology/' or pass it to createSixb({ ontologies }).\",\n expandsSubtypes: true,\n },\n \"view:dataset\": {\n universeKey: \"datasetIds\",\n subject: \"dataset\",\n fix: \"Add it to 'datasets/' or pass it to createSixb({ datasets }).\",\n },\n // Deliberately no `expandsSubtypes`: granting writes on a parent type must not\n // silently extend to types added under it later. `view:object` expands because\n // a read of a subtype reveals nothing the parent's grant did not already cover.\n \"edit:object\": {\n universeKey: \"objectTypeIds\",\n subject: \"object type\",\n fix: \"Register it in 'ontology/' or pass it to createSixb({ ontologies }).\",\n },\n \"append:telemetry\": {\n universeKey: \"objectTypeIds\",\n subject: \"object type\",\n fix: \"Register it in 'ontology/' or pass it to createSixb({ ontologies }).\",\n },\n \"apply:action\": {\n universeKey: \"actionIds\",\n subject: \"action\",\n fix: \"Add it to 'actions/' or pass it to createSixb({ actions }).\",\n },\n \"run:workflow\": {\n universeKey: \"workflowIds\",\n subject: \"workflow\",\n fix: \"Add it to 'workflows/' or pass it to createSixb({ workflows }).\",\n },\n \"run:sync\": {\n universeKey: \"syncIds\",\n subject: \"sync\",\n fix: \"Add it to 'syncs/' or pass it to createSixb({ syncs }).\",\n },\n \"run:pipeline\": {\n universeKey: \"pipelineIds\",\n subject: \"pipeline\",\n fix: \"Add it to 'pipelines/' or pass it to createSixb({ pipelines }).\",\n },\n \"run:agent\": {\n universeKey: \"agentIds\",\n subject: \"agent\",\n fix: \"Add it to 'agents/' or pass it to createSixb({ agents }).\",\n },\n \"observe:logs\": {\n universeKey: \"observableIds\",\n subject: \"observability surface\",\n fix: 'Use can.observe(\"logs\").',\n },\n \"manage:connector\": {\n universeKey: \"connectorIds\",\n subject: \"connector\",\n fix: \"Add it to 'connectors/' or pass it to createSixb({ connectors }).\",\n },\n}\n\nexport const GRANT_KIND_KEYS = Object.keys(GRANT_KINDS) as readonly GrantKind[]\n\n/** The grant kind a stored grant resolves to. */\nexport function grantKindOf(grant: GrantDefinition): GrantKind {\n switch (grant.capability) {\n case \"access\":\n return \"access:application\"\n case \"view\":\n return `view:${grant.target}`\n case \"edit\":\n return \"edit:object\"\n case \"append\":\n return \"append:telemetry\"\n case \"apply\":\n return \"apply:action\"\n case \"run\":\n return `run:${grant.target}`\n case \"observe\":\n return \"observe:logs\"\n case \"manage\":\n return \"manage:connector\"\n }\n}\n\n/** A fresh, mutable grant index with one empty id set per kind. */\nexport function emptyGrantSets(): Record<GrantKind, Set<string>> {\n const sets = {} as Record<GrantKind, Set<string>>\n for (const kind of GRANT_KIND_KEYS) {\n sets[kind] = new Set<string>()\n }\n return sets\n}\n",
|
|
6
|
+
"import type { Principal } from \"../auth/types\"\n\n/** User or service account that may initiate or authorize an execution. */\nexport type AuthorizablePrincipal = Extract<Principal, { readonly type: \"user\" | \"serviceAccount\" }>\n\n/** Registered primitive kinds that may receive internal trusted authority. */\nexport type TrustedPrimitiveKind =\n | \"action\"\n | \"pipeline\"\n | \"projection\"\n | \"rule\"\n | \"sync\"\n | \"webhook\"\n | \"workflow\"\n\nexport interface TrustedPrimitiveRef {\n readonly kind: TrustedPrimitiveKind\n readonly id: string\n readonly runId: string\n}\n\nexport type KernelOperation = {\n readonly type: \"ontology.recover\"\n readonly recoveryId: string\n}\n\n/** Workload currently executing. This is provenance and never grants authority by itself. */\nexport type ExecutionExecutor =\n | { readonly type: \"request\"; readonly requestId: string }\n | {\n readonly type: \"primitive\"\n readonly kind: TrustedPrimitiveKind\n readonly id: string\n readonly runId: string\n }\n | { readonly type: \"agent\"; readonly agentId: string; readonly runId: string }\n | { readonly type: \"kernel\"; readonly operation: KernelOperation }\n\n/**\n * Occurrence that directly triggered an execution.\n *\n * An `execution` source is the single logical parent of a nested execution.\n */\nexport type ExecutionSource =\n | { readonly type: \"http\"; readonly requestId: string }\n | { readonly type: \"webhook\"; readonly deliveryId: string }\n | { readonly type: \"schedule\"; readonly eventId: string }\n | { readonly type: \"event\"; readonly eventId: string }\n | { readonly type: \"datasetVersion\"; readonly datasetId: string; readonly versionId: string }\n | { readonly type: \"execution\"; readonly executionId: string }\n\n/** Immutable provenance for one request, primitive run, agent run, or kernel operation. */\nexport interface ExecutionContext {\n readonly id: string\n readonly projectId: string\n readonly requestedBy?: AuthorizablePrincipal\n readonly executor: ExecutionExecutor\n readonly source: ExecutionSource\n readonly correlationId: string\n}\n\n/** Durable descriptor used to rebuild authority. A reference is never authoritative by itself. */\nexport type AuthorizationRef =\n | {\n readonly type: \"principal\"\n readonly principal: AuthorizablePrincipal\n readonly credential?:\n | { readonly type: \"session\"; readonly id: string }\n | { readonly type: \"accessToken\"; readonly id: string }\n }\n | { readonly type: \"trustedPrimitive\"; readonly primitive: TrustedPrimitiveRef }\n | { readonly type: \"kernel\"; readonly operation: KernelOperation }\n | { readonly type: \"disabled\" }\n\nclass RuntimeAuthorizationCapability {\n readonly #runtimeAuthorization = true\n\n private constructor() {}\n\n static create(): RuntimeAuthorizationCapability {\n const capability = new RuntimeAuthorizationCapability()\n Object.freeze(capability)\n return capability\n }\n\n static is(value: unknown): value is RuntimeAuthorizationCapability {\n return typeof value === \"object\" && value !== null && #runtimeAuthorization in value\n }\n}\n\n/**\n * Opaque, process-local authority.\n *\n * The private class makes it nominal in TypeScript; Core registry membership makes it authoritative\n * at runtime. The capability itself is never persisted.\n */\nexport type RuntimeAuthorization = RuntimeAuthorizationCapability\n\n/** Execution provenance paired with the process-local authority that permits its operations. */\nexport interface ExecutionScope {\n readonly execution: ExecutionContext\n readonly authorization: RuntimeAuthorization\n}\n\n/** Internal constructor; the package root exports only the opaque type. */\nexport function createRuntimeAuthorizationCapability(): RuntimeAuthorization {\n return RuntimeAuthorizationCapability.create()\n}\n\n/** Internal runtime guard; registry membership remains the source of authority. */\nexport function isRuntimeAuthorizationCapability(value: unknown): value is RuntimeAuthorization {\n return RuntimeAuthorizationCapability.is(value)\n}\n",
|
|
7
|
+
"import type { Principal } from \"../auth\"\nimport { emptyGrantSets, GRANT_KIND_KEYS } from \"../authorization/grant-kinds\"\nimport type { AuthorizationContext, GrantIndex } from \"../authorization/types\"\nimport { createSixbError } from \"../errors/internal\"\nimport {\n type AuthorizablePrincipal,\n type AuthorizationRef,\n createRuntimeAuthorizationCapability,\n type ExecutionScope,\n isRuntimeAuthorizationCapability,\n type KernelOperation,\n type RuntimeAuthorization,\n type TrustedPrimitiveKind,\n type TrustedPrimitiveRef,\n} from \"./types\"\n\nexport type ResolvedRuntimeAuthorization =\n | {\n readonly type: \"principal\"\n readonly projectId: string\n readonly context: AuthorizationContext\n readonly ref: Extract<AuthorizationRef, { readonly type: \"principal\" }>\n /** Process-local binding used by provider façades that explicitly support agent runs. */\n readonly executionBinding?: AgentExecutionBinding\n }\n | {\n readonly type: \"unrestricted\"\n readonly projectId: string\n readonly ref: Exclude<AuthorizationRef, { readonly type: \"principal\" }>\n }\n | { readonly type: \"denied\" }\n\ntype RegisteredRuntimeAuthorization = Exclude<\n ResolvedRuntimeAuthorization,\n { readonly type: \"denied\" }\n>\n\ntype PrincipalAuthorizationContext = Omit<AuthorizationContext, \"principal\"> & {\n readonly principal: AuthorizablePrincipal\n}\n\ninterface AgentExecutionBinding {\n readonly type: \"agent\"\n readonly executionId: string\n readonly agentId: string\n readonly runId: string\n}\n\nconst registeredAuthorizations = new WeakMap<RuntimeAuthorization, RegisteredRuntimeAuthorization>()\n\nexport function createPrincipalRuntimeAuthorization(input: {\n readonly projectId: string\n readonly context: AuthorizationContext\n readonly credential?: Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]\n}): RuntimeAuthorization {\n return createRegisteredPrincipalAuthorization(input)\n}\n\n/** Register service-account authority bound to one exact agent run. */\nexport function createAgentRuntimeAuthorization(input: {\n readonly projectId: string\n readonly context: AuthorizationContext\n readonly executionId: string\n readonly agentId: string\n readonly runId: string\n}): RuntimeAuthorization {\n if (input.context.principal.type !== \"serviceAccount\") {\n throw new Error(\"[Sixb] Agent execution authority must belong to a service account.\")\n }\n assertNonEmpty(input.executionId, \"Execution id\")\n assertNonEmpty(input.agentId, \"Agent id\")\n assertNonEmpty(input.runId, \"Agent run id\")\n return createRegisteredPrincipalAuthorization(input, {\n type: \"agent\",\n executionId: input.executionId,\n agentId: input.agentId,\n runId: input.runId,\n })\n}\n\nfunction createRegisteredPrincipalAuthorization(\n input: {\n readonly projectId: string\n readonly context: AuthorizationContext\n readonly credential?: Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]\n },\n executionBinding?: AgentExecutionBinding\n): RuntimeAuthorization {\n const context = snapshotAuthorizationContext(input.context)\n const credential = input.credential ? snapshotCredential(input.credential) : undefined\n assertCredentialMatchesContext(context, credential)\n const ref: Extract<AuthorizationRef, { readonly type: \"principal\" }> = Object.freeze({\n type: \"principal\",\n principal: context.principal,\n ...(credential === undefined ? {} : { credential }),\n })\n return register({\n type: \"principal\",\n projectId: input.projectId,\n context,\n ref,\n ...(executionBinding === undefined\n ? {}\n : { executionBinding: Object.freeze({ ...executionBinding }) }),\n })\n}\n\nexport function createDisabledRuntimeAuthorization(projectId: string): RuntimeAuthorization {\n return register({ type: \"unrestricted\", projectId, ref: Object.freeze({ type: \"disabled\" }) })\n}\n\nexport function createTrustedPrimitiveRuntimeAuthorization(input: {\n readonly projectId: string\n readonly primitive: TrustedPrimitiveRef\n}): RuntimeAuthorization {\n const primitive = snapshotTrustedPrimitive(input.primitive)\n return register({\n type: \"unrestricted\",\n projectId: input.projectId,\n ref: Object.freeze({ type: \"trustedPrimitive\", primitive }),\n })\n}\n\nexport function createKernelRuntimeAuthorization(input: {\n readonly projectId: string\n readonly operation: KernelOperation\n}): RuntimeAuthorization {\n const operation = snapshotKernelOperation(input.operation)\n return register({\n type: \"unrestricted\",\n projectId: input.projectId,\n ref: Object.freeze({ type: \"kernel\", operation }),\n })\n}\n\nexport function resolveRuntimeAuthorization(authorization: unknown): ResolvedRuntimeAuthorization {\n if (!isRuntimeAuthorizationCapability(authorization)) {\n return { type: \"denied\" }\n }\n return registeredAuthorizations.get(authorization) ?? { type: \"denied\" }\n}\n\nexport function getAuthorizationRef(authorization: RuntimeAuthorization): AuthorizationRef {\n const resolved = resolveRuntimeAuthorization(authorization)\n if (resolved.type === \"denied\") {\n throw new Error(\"[Sixb] Runtime authorization is not a registered Core capability.\")\n }\n return cloneAuthorizationRef(resolved.ref)\n}\n\nexport function assertExecutionScopeProject(projectId: string, scope: ExecutionScope): void {\n assertNonEmpty(projectId, \"Project id\")\n if (scope.execution.projectId !== projectId) {\n throw createSixbError(\n \"internal.unexpected\",\n `[Sixb] Execution scope belongs to project '${scope.execution.projectId}', not '${projectId}'.`,\n {\n details: {\n executionId: scope.execution.id,\n expectedProjectId: projectId,\n scopeProjectId: scope.execution.projectId,\n },\n }\n )\n }\n\n const resolved = resolveRuntimeAuthorization(scope.authorization)\n if (resolved.type === \"denied\") {\n throw createSixbError(\n \"internal.unexpected\",\n \"[Sixb] Execution scope carries unregistered runtime authorization.\",\n { details: { executionId: scope.execution.id, projectId } }\n )\n }\n if (resolved.projectId !== projectId) {\n throw createSixbError(\n \"internal.unexpected\",\n `[Sixb] Execution authorization belongs to project '${resolved.projectId}', not '${projectId}'.`,\n {\n details: {\n authorizationProjectId: resolved.projectId,\n executionId: scope.execution.id,\n expectedProjectId: projectId,\n },\n }\n )\n }\n}\n\n/** Validate that one registered authority belongs to the exact execution it accompanies. */\nexport function resolveExecutionScopeAuthorization(\n projectId: string,\n scope: ExecutionScope\n): RegisteredRuntimeAuthorization {\n assertExecutionScopeProject(projectId, scope)\n const resolved = resolveRuntimeAuthorization(scope.authorization)\n if (resolved.type === \"denied\") {\n throw createSixbError(\n \"internal.unexpected\",\n \"[Sixb] Execution scope carries unregistered runtime authorization.\",\n { details: { executionId: scope.execution.id, projectId } }\n )\n }\n\n const { execution } = scope\n switch (execution.executor.type) {\n case \"request\":\n if (\n execution.source.type !== \"http\" ||\n execution.source.requestId !== execution.executor.requestId\n ) {\n throw invalidExecutionAuthority(execution.id, \"request source does not match its executor\")\n }\n if (resolved.ref.type === \"principal\") {\n if (\n resolved.type !== \"principal\" ||\n resolved.executionBinding !== undefined ||\n !principalsEqual(execution.requestedBy, resolved.ref.principal)\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"request authority does not match its requested-by principal\"\n )\n }\n return resolved\n }\n if (resolved.ref.type === \"disabled\" && execution.requestedBy === undefined) return resolved\n throw invalidExecutionAuthority(\n execution.id,\n \"request execution requires principal or explicitly disabled authority\"\n )\n\n case \"primitive\":\n if (\n resolved.ref.type !== \"trustedPrimitive\" ||\n resolved.ref.primitive.kind !== execution.executor.kind ||\n resolved.ref.primitive.id !== execution.executor.id ||\n resolved.ref.primitive.runId !== execution.executor.runId\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"trusted primitive authority does not match its executor\"\n )\n }\n return resolved\n\n case \"agent\":\n if (\n resolved.type !== \"principal\" ||\n resolved.ref.type !== \"principal\" ||\n resolved.ref.principal.type !== \"serviceAccount\" ||\n resolved.ref.credential !== undefined ||\n resolved.executionBinding?.type !== \"agent\" ||\n resolved.executionBinding.executionId !== execution.id ||\n resolved.executionBinding.agentId !== execution.executor.agentId ||\n resolved.executionBinding.runId !== execution.executor.runId\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"agent authority does not match its execution binding\"\n )\n }\n return resolved\n\n case \"kernel\":\n if (\n resolved.ref.type !== \"kernel\" ||\n execution.requestedBy !== undefined ||\n resolved.ref.operation.type !== execution.executor.operation.type ||\n resolved.ref.operation.recoveryId !== execution.executor.operation.recoveryId\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"kernel authority does not match its executor\"\n )\n }\n return resolved\n }\n}\n\nfunction principalsEqual(\n left: AuthorizablePrincipal | undefined,\n right: AuthorizablePrincipal | undefined\n): boolean {\n return left?.type === right?.type && left?.id === right?.id\n}\n\nfunction invalidExecutionAuthority(executionId: string, reason: string): Error {\n return createSixbError(\n \"internal.unexpected\",\n `[Sixb] Execution '${executionId}' is incompatible with its authority: ${reason}.`,\n { details: { executionId, reason } }\n )\n}\n\nfunction register(input: RegisteredRuntimeAuthorization): RuntimeAuthorization {\n assertNonEmpty(input.projectId, \"Authorization project id\")\n const authorization = createRuntimeAuthorizationCapability()\n registeredAuthorizations.set(authorization, Object.freeze(input))\n return authorization\n}\n\nfunction snapshotAuthorizationContext(\n context: AuthorizationContext\n): PrincipalAuthorizationContext {\n const principal = snapshotAuthorizablePrincipal(context.principal)\n const grants = emptyGrantSets()\n for (const kind of GRANT_KIND_KEYS) {\n grants[kind] = new Set(context.grants[kind])\n }\n const frozenGrants: GrantIndex = Object.freeze(grants)\n return Object.freeze({\n principal,\n ...(context.sessionId === undefined ? {} : { sessionId: context.sessionId }),\n groupIds: Object.freeze([...context.groupIds]),\n roleIds: Object.freeze([...context.roleIds]),\n grants: frozenGrants,\n })\n}\n\nfunction snapshotAuthorizablePrincipal(principal: Principal): AuthorizablePrincipal {\n if (principal.type !== \"user\" && principal.type !== \"serviceAccount\") {\n throw new Error(`[Sixb] Principal type '${principal.type}' cannot hold runtime authorization.`)\n }\n assertNonEmpty(principal.id, \"Authorization principal id\")\n return Object.freeze({ type: principal.type, id: principal.id })\n}\n\nfunction snapshotCredential(\n credential: NonNullable<Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]>\n): NonNullable<Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]> {\n assertNonEmpty(credential.id, \"Authorization credential id\")\n if (credential.type !== \"session\" && credential.type !== \"accessToken\") {\n const credentialType = (credential as { readonly type: string }).type\n throw new Error(`[Sixb] Unknown authorization credential type '${credentialType}'.`)\n }\n return Object.freeze({ type: credential.type, id: credential.id })\n}\n\nfunction assertCredentialMatchesContext(\n context: PrincipalAuthorizationContext,\n credential:\n | NonNullable<Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]>\n | undefined\n): void {\n if (credential?.type === \"session\") {\n if (context.sessionId !== credential.id) {\n throw new Error(\n \"[Sixb] Session credential id must match the authorization context session id.\"\n )\n }\n return\n }\n if (context.sessionId !== undefined) {\n throw new Error(\"[Sixb] Authorization context session requires a matching session credential.\")\n }\n}\n\nfunction snapshotTrustedPrimitive(primitive: TrustedPrimitiveRef): TrustedPrimitiveRef {\n if (!isTrustedPrimitiveKind(primitive.kind)) {\n throw new Error(`[Sixb] Unknown trusted primitive kind '${primitive.kind}'.`)\n }\n assertNonEmpty(primitive.id, \"Trusted primitive id\")\n assertNonEmpty(primitive.runId, \"Trusted primitive run id\")\n return Object.freeze({ kind: primitive.kind, id: primitive.id, runId: primitive.runId })\n}\n\nfunction snapshotKernelOperation(operation: KernelOperation): KernelOperation {\n if (operation.type !== \"ontology.recover\") {\n throw new Error(`[Sixb] Unknown kernel operation '${operation.type}'.`)\n }\n assertNonEmpty(operation.recoveryId, \"Kernel recovery id\")\n return Object.freeze({ type: operation.type, recoveryId: operation.recoveryId })\n}\n\nfunction cloneAuthorizationRef(ref: AuthorizationRef): AuthorizationRef {\n switch (ref.type) {\n case \"principal\":\n return {\n type: \"principal\",\n principal: { ...ref.principal },\n ...(ref.credential === undefined ? {} : { credential: { ...ref.credential } }),\n }\n case \"trustedPrimitive\":\n return { type: \"trustedPrimitive\", primitive: { ...ref.primitive } }\n case \"kernel\":\n return { type: \"kernel\", operation: { ...ref.operation } }\n case \"disabled\":\n return { type: \"disabled\" }\n }\n}\n\nfunction isTrustedPrimitiveKind(value: string): value is TrustedPrimitiveKind {\n return (\n value === \"action\" ||\n value === \"pipeline\" ||\n value === \"projection\" ||\n value === \"rule\" ||\n value === \"sync\" ||\n value === \"webhook\" ||\n value === \"workflow\"\n )\n}\n\nfunction assertNonEmpty(value: string, label: string): void {\n if (!value.trim()) {\n throw new Error(`[Sixb] ${label} must not be empty.`)\n }\n}\n",
|
|
8
|
+
"/** Thrown when a scoped operation is not covered by the principal's grants. Maps to HTTP 403. */\nexport class AuthorizationError extends Error {\n readonly name = \"AuthorizationError\"\n\n constructor(\n /** Stable key of the missing grant, e.g. `view:object:Contract`. */\n readonly grantKey: string,\n message: string\n ) {\n super(message)\n }\n}\n",
|
|
9
|
+
"/**\n * Authorization decisions for the core data path.\n *\n * `evaluate` is the single place that maps a request to the resolved grant\n * index. `can` (boolean) and `assertAuthorized` (throw) are the two ways to\n * consume a decision; every enforcement site goes through one of them.\n *\n * Every protected leaf first resolves the opaque runtime capability. Missing, forged, or\n * unregistered authority is denied; only an explicitly registered trusted or disabled execution\n * is unrestricted.\n */\n\nimport type { AuthSessionAudience } from \"../auth/audience\"\nimport {\n type ResolvedRuntimeAuthorization,\n resolveRuntimeAuthorization,\n} from \"../execution/authorization\"\nimport type { ExecutionContext, RuntimeAuthorization } from \"../execution/types\"\nimport { AuthorizationError } from \"./errors\"\nimport type { GrantKind } from \"./grant-kinds\"\nimport type { AuthorizationContext, GrantIndex } from \"./types\"\n\n/** Something a principal may attempt, paired with the resource it targets. */\nexport type AuthzRequest =\n | { readonly kind: \"application.access\"; readonly audience: AuthSessionAudience }\n | { readonly kind: \"object.view\"; readonly objectTypeId: string }\n | { readonly kind: \"dataset.view\"; readonly datasetId: string }\n | { readonly kind: \"object.edit\"; readonly objectTypeId: string }\n | { readonly kind: \"telemetry.append\"; readonly objectTypeId: string }\n | { readonly kind: \"action.apply\"; readonly actionId: string }\n | { readonly kind: \"workflow.run\"; readonly workflowId: string }\n | { readonly kind: \"sync.run\"; readonly syncId: string }\n | { readonly kind: \"pipeline.run\"; readonly pipelineId: string }\n | { readonly kind: \"agent.run\"; readonly agentId: string }\n | { readonly kind: \"logs.observe\" }\n | { readonly kind: \"connector.manage\"; readonly connectorId: string }\n | { readonly kind: \"object.query\"; readonly touchedObjectTypeIds: readonly string[] }\n\nexport interface AuthzDecision {\n readonly allowed: boolean\n /** Grant keys the request needs, e.g. `view:object:quote`. */\n readonly requirements: readonly string[]\n /** Required keys the principal lacks; empty when allowed. */\n readonly missing: readonly string[]\n}\n\ninterface AuthorizedRuntime {\n readonly runtimeAuthorization?: RuntimeAuthorization\n readonly authorization?: AuthorizationContext\n}\n\n// A request expands to one or more atomic (grant kind, id) checks. The atom is\n// the single unit that both names a requirement and tests the grant index, so\n// the two can never drift. `kind` is the resolved-index key, so enforcement is\n// a direct lookup with no per-target dispatch.\ninterface Atom {\n readonly kind: GrantKind\n readonly id: string\n}\n\nfunction atomsFor(request: AuthzRequest): readonly Atom[] {\n switch (request.kind) {\n case \"application.access\":\n return [{ kind: \"access:application\", id: request.audience }]\n case \"object.view\":\n return [{ kind: \"view:object\", id: request.objectTypeId }]\n case \"dataset.view\":\n return [{ kind: \"view:dataset\", id: request.datasetId }]\n case \"object.edit\":\n return [{ kind: \"edit:object\", id: request.objectTypeId }]\n case \"telemetry.append\":\n return [{ kind: \"append:telemetry\", id: request.objectTypeId }]\n case \"action.apply\":\n return [{ kind: \"apply:action\", id: request.actionId }]\n case \"workflow.run\":\n return [{ kind: \"run:workflow\", id: request.workflowId }]\n case \"sync.run\":\n return [{ kind: \"run:sync\", id: request.syncId }]\n case \"pipeline.run\":\n return [{ kind: \"run:pipeline\", id: request.pipelineId }]\n case \"agent.run\":\n return [{ kind: \"run:agent\", id: request.agentId }]\n case \"logs.observe\":\n return [{ kind: \"observe:logs\", id: \"logs\" }]\n case \"connector.manage\":\n return [{ kind: \"manage:connector\", id: request.connectorId }]\n case \"object.query\":\n return request.touchedObjectTypeIds.map((id) => ({ kind: \"view:object\", id }))\n }\n}\n\nfunction atomKey(atom: Atom): string {\n if (atom.kind === \"observe:logs\") return atom.kind\n return `${atom.kind}:${atom.id}`\n}\n\nfunction holds(grants: GrantIndex, atom: Atom): boolean {\n return grants[atom.kind].has(atom.id)\n}\n\n/** Resolve a request against a principal's grants. Never throws. */\nexport function evaluate(\n authorization: AuthorizationContext | null | undefined,\n request: AuthzRequest\n): AuthzDecision {\n const atoms = atomsFor(request)\n const requirements = atoms.map(atomKey)\n const missing = authorization\n ? atoms.filter((atom) => !holds(authorization.grants, atom)).map(atomKey)\n : []\n return { allowed: missing.length === 0, requirements, missing }\n}\n\nexport function isAllowed(\n authorization: AuthorizationContext | null | undefined,\n request: AuthzRequest\n): boolean {\n return evaluate(authorization, request).allowed\n}\n\nexport function assertAuthorized(runtime: AuthorizedRuntime, request: AuthzRequest): void {\n const resolved = assertRuntimeAuthorizationBound(runtime)\n const authorization = resolved.type === \"principal\" ? resolved.context : undefined\n const decision = evaluate(authorization, request)\n if (decision.allowed) {\n return\n }\n\n throw new AuthorizationError(\n decision.missing[0] ?? request.kind,\n deniedMessage(authorization, request)\n )\n}\n\n/** Resolve registered process-local authority before a protected leaf makes a decision. */\nexport function assertRuntimeAuthorizationBound(\n runtime: AuthorizedRuntime\n): Exclude<ResolvedRuntimeAuthorization, { readonly type: \"denied\" }> {\n const resolved = resolveRuntimeAuthorization(runtime.runtimeAuthorization)\n if (resolved.type === \"denied\") {\n throw new AuthorizationError(\n \"runtime:unbound\",\n \"[Sixb] Protected operations require a registered execution scope.\"\n )\n }\n return resolved\n}\n\n/**\n * Assert a principal may write objects of this type.\n *\n * Requires `view:object` as well as `edit:object`, and that is not belt-and-braces: an upsert\n * returns the *merged* row, which the Materializer reconciles against source authority, so the\n * response can carry properties the caller never sent. Granting the write without the read would\n * leak them.\n *\n * The pairing is asserted here rather than implied during resolution: `resolveRoleGrants` has no\n * notion of one grant entailing another, and giving it one would put ids in the resolved index that\n * no role granted — an index that no longer answers \"what was actually granted\".\n *\n * Telemetry append is deliberately *not* paired this way; see {@link assertCanAppendTelemetry}.\n */\nexport function assertCanEdit(runtime: AuthorizedRuntime, objectTypeId: string): void {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n assertAuthorized(runtime, { kind: \"object.edit\", objectTypeId })\n}\n\n/**\n * Assert a principal may append telemetry points to objects of this type.\n *\n * No `view:object` requirement, unlike {@link assertCanEdit}: an append answers with no object\n * state, so there is nothing to leak. That is what makes a write-only principal — a device, an\n * ingestion service — expressible at all, and it is the reason telemetry has its own grant.\n */\nexport function assertCanAppendTelemetry(runtime: AuthorizedRuntime, objectTypeId: string): void {\n assertAuthorized(runtime, { kind: \"telemetry.append\", objectTypeId })\n}\n\n/** Assert a principal may manage lifecycle state for this connector definition. */\nexport function assertCanManageConnector(runtime: AuthorizedRuntime, connectorId: string): void {\n assertAuthorized(runtime, { kind: \"connector.manage\", connectorId })\n}\n\n/**\n * Fail closed for operations that have no grant semantics yet.\n *\n * One caller left — `listLinks`, whose rows reveal target types that no read grant covers. Object,\n * link, and telemetry writes moved to {@link assertCanEdit} / {@link assertCanAppendTelemetry}.\n * Keeps unsupported surfaces denied even if a principal-bound runtime context reaches a code path\n * the execution SDK does not expose.\n */\nexport function assertPrivileged(runtime: AuthorizedRuntime, operation: string): void {\n const resolved = assertRuntimeAuthorizationBound(runtime)\n if (resolved.type === \"unrestricted\") {\n return\n }\n\n throw new AuthorizationError(\n `privileged:${operation}`,\n `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`\n )\n}\n\n/**\n * Assert access to process providers that trusted executions and genuine agent runs may use.\n *\n * Agent provenance alone is not authority: the registered capability must be bound to the exact\n * same agent and run before this check succeeds.\n */\nexport function assertProviderAccess(\n runtime: AuthorizedRuntime,\n execution: ExecutionContext,\n operation: string\n): void {\n const resolved = assertRuntimeAuthorizationBound(runtime)\n if (resolved.type === \"unrestricted\") {\n return\n }\n\n const binding = resolved.executionBinding\n const executor = execution.executor\n if (\n binding?.type === \"agent\" &&\n executor.type === \"agent\" &&\n binding.executionId === execution.id &&\n binding.agentId === executor.agentId &&\n binding.runId === executor.runId\n ) {\n return\n }\n\n throw new AuthorizationError(\n `privileged:${operation}`,\n `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`\n )\n}\n\nfunction deniedMessage(\n authorization: AuthorizationContext | null | undefined,\n request: AuthzRequest\n): string {\n const principalId = authorization?.principal.id ?? \"unknown\"\n switch (request.kind) {\n case \"application.access\":\n return `[Sixb] Principal '${principalId}' is not allowed to access application '${request.audience}'.`\n case \"object.view\":\n return `[Sixb] Principal '${principalId}' is not allowed to view object type '${request.objectTypeId}'.`\n case \"dataset.view\":\n return `[Sixb] Principal '${principalId}' is not allowed to view dataset '${request.datasetId}'.`\n case \"object.edit\":\n return `[Sixb] Principal '${principalId}' is not allowed to write object type '${request.objectTypeId}'.`\n case \"telemetry.append\":\n return `[Sixb] Principal '${principalId}' is not allowed to append telemetry for object type '${request.objectTypeId}'.`\n case \"action.apply\":\n return `[Sixb] Principal '${principalId}' is not allowed to apply action '${request.actionId}'.`\n case \"workflow.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run workflow '${request.workflowId}'.`\n case \"sync.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run sync '${request.syncId}'.`\n case \"pipeline.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run pipeline '${request.pipelineId}'.`\n case \"agent.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run agent '${request.agentId}'.`\n case \"logs.observe\":\n return `[Sixb] Principal '${principalId}' is not allowed to observe project logs.`\n case \"connector.manage\":\n return `[Sixb] Principal '${principalId}' is not allowed to manage connector '${request.connectorId}'.`\n case \"object.query\": {\n // Name the first touched type the principal cannot view.\n const blocked = request.touchedObjectTypeIds.find(\n (objectTypeId) => !isAllowed(authorization, { kind: \"object.view\", objectTypeId })\n )\n return `[Sixb] Principal '${principalId}' is not allowed to view object type '${blocked}'.`\n }\n }\n}\n",
|
|
10
|
+
"import type { AuthSessionAudience } from \"../auth/audience\"\nimport { isAllowed } from \"./decision\"\nimport type { AuthorizationContext, ResolvedRole } from \"./types\"\n\n/** Whether declaring roles has enabled an allowlist for an application. */\nexport function isApplicationAccessControlled(\n roles: readonly ResolvedRole[],\n audience: AuthSessionAudience\n): boolean {\n return roles.some((role) => role.grants[\"access:application\"].has(audience))\n}\n\n/**\n * Whether this principal may open this application.\n *\n * KNOWN LIMITATION (0.1.x): application access is the one capability that is **not** deny-by-default.\n * While no role mentions an application, every authenticated principal may open it; the allowlist only\n * switches on once some role grants it. Every other capability — `view`, `apply`, `run`, `observe` —\n * denies unless granted, so this is the single asymmetry in the model.\n *\n * It is deliberate for now: flipping it would lock every project out of Atlas until it declares a role,\n * including projects with no security definitions at all. Closing it means shipping a default grant with\n * the scaffold first, and it is a breaking change for any project relying on the open default.\n */\nexport function canAccessApplication(\n authorization: AuthorizationContext,\n roles: readonly ResolvedRole[],\n audience: AuthSessionAudience\n): boolean {\n return (\n !isApplicationAccessControlled(roles, audience) ||\n isAllowed(authorization, { kind: \"application.access\", audience })\n )\n}\n",
|
|
11
|
+
"/**\n * Event visibility derived from grants.\n *\n * There is no standalone \"view events\" capability: a principal sees a domain\n * event only when it can view/apply/run the event's subject. A privileged\n * caller (no authorization context) sees everything.\n *\n * The topic switch is fail-closed: an unrecognized topic is hidden, because a\n * topic we don't yet model may carry a subject the principal is not allowed to\n * see. Adding an event topic therefore requires an explicit visibility decision\n * here, never a silent default.\n */\n\nimport type { StoredDomainEvent } from \"../events\"\nimport { isAllowed } from \"./decision\"\nimport type { AuthorizationContext } from \"./types\"\n\nexport function canViewEvent(\n authorization: AuthorizationContext | null | undefined,\n event: StoredDomainEvent\n): boolean {\n if (!authorization) {\n return true\n }\n\n switch (event.topic) {\n case \"objects\":\n case \"telemetry\":\n return isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: event.payload.objectTypeId,\n })\n case \"links\":\n return (\n isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: event.payload.sourceTypeId,\n }) &&\n isAllowed(authorization, { kind: \"object.view\", objectTypeId: event.payload.targetTypeId })\n )\n case \"actions\": {\n // Apply is necessary; for object-bound actions the principal must also be\n // able to view the subject type, or the event would leak a hidden\n // object's id/type — mirroring the rule in `canListAction`.\n if (!isAllowed(authorization, { kind: \"action.apply\", actionId: event.payload.actionId })) {\n return false\n }\n const subject = event.payload.subject\n return subject.kind === \"object\"\n ? isAllowed(authorization, { kind: \"object.view\", objectTypeId: subject.objectTypeId })\n : true\n }\n case \"workflows\":\n return isAllowed(authorization, {\n kind: \"workflow.run\",\n workflowId: event.payload.workflowId,\n })\n case \"rules\":\n // Rule events carry the object they fired on, so gate on viewing it —\n // otherwise they leak the existence and id of hidden-type objects.\n return isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: event.payload.subject.objectTypeId,\n })\n // Run grant gates the operational stream. These payloads may also carry the\n // produced datasetId/versionId; that target is already visible to a runner\n // through the sync/pipeline catalog (`sync.target.dataset`), so surfacing it\n // here discloses nothing new.\n case \"syncs\":\n return isAllowed(authorization, {\n kind: \"sync.run\",\n syncId: event.payload.syncId,\n })\n case \"pipelines\":\n return isAllowed(authorization, {\n kind: \"pipeline.run\",\n pipelineId: event.payload.pipelineId,\n })\n case \"schedules\":\n // Infra topics with no object/action/workflow/dataset subject: no grant\n // governs them yet, so they stay visible to any authorized reader. When\n // they gain their own grants, add the checks here.\n return true\n case \"datasets\":\n // dataset.view alone. The payload's `producer` (the sync/pipeline that\n // produced the version, plus its runId) is intentionally visible to any\n // dataset viewer as provenance — the same identity the versions API\n // already serializes for that principal. This is distinct from the\n // operational `references` in the dataset catalog (which syncs/pipelines\n // are wired to a dataset), which stays gated on the run grants.\n return isAllowed(authorization, {\n kind: \"dataset.view\",\n datasetId: event.payload.datasetId,\n })\n default:\n // Fail closed: an unmodeled topic may carry a subject we don't yet gate.\n return false\n }\n}\n",
|
|
12
|
+
"import type { Principal } from \"../auth/types\"\nimport type { RoleDefinition, Selection } from \"../security\"\nimport {\n emptyGrantSets,\n GRANT_KIND_KEYS,\n GRANT_KINDS,\n type GrantUniverse,\n grantKindOf,\n} from \"./grant-kinds\"\nimport type { AuthorizationContext, GrantIndex, ResolvedRole } from \"./types\"\n\n/**\n * Expand a role's grants into concrete id sets once at startup.\n *\n * Broad grants (`every.object().except([...])`) expand against the registered\n * universe; object-type grants also expand to subtypes. The result holds only\n * `Set`s, so per-request resolution and runtime checks stay simple `set.has`.\n * The per-kind universe and subtype rules come from the `GRANT_KINDS` table, so\n * this loop never enumerates targets by hand.\n */\nexport function resolveRoleGrants(role: RoleDefinition, universe: GrantUniverse): GrantIndex {\n const grants = emptyGrantSets()\n\n for (const grant of role.grants) {\n const kind = grantKindOf(grant)\n const spec = GRANT_KINDS[kind]\n expandSelection(\n grant.selection,\n universe[spec.universeKey],\n grants[kind],\n spec.expandsSubtypes ? universe.getSubTypes : undefined\n )\n }\n\n return grants\n}\n\nfunction expandSelection(\n selection: Selection,\n universe: ReadonlySet<string>,\n into: Set<string>,\n expand?: (id: string) => readonly string[]\n): void {\n if (selection.all) {\n const except = new Set(selection.except)\n for (const id of universe) {\n if (!except.has(id)) {\n into.add(id)\n }\n }\n return\n }\n\n for (const id of selection.ids) {\n into.add(id)\n if (expand) {\n for (const subTypeId of expand(id)) {\n into.add(subTypeId)\n }\n }\n }\n}\n\n/**\n * Resolve a principal's authorization context from its group memberships.\n *\n * Pure set-union over pre-resolved roles: roles match when their grantedTo\n * groups intersect the principal's memberships, and their concrete id sets\n * union into the principal's grant index.\n */\nexport function resolveAuthorizationContext(input: {\n readonly principal: Principal\n readonly sessionId?: string\n readonly groupIds: readonly string[]\n readonly roles: readonly ResolvedRole[]\n}): AuthorizationContext {\n const memberGroupIds = new Set(input.groupIds)\n const roleIds: string[] = []\n const grants = emptyGrantSets()\n\n for (const role of input.roles) {\n if (!role.grantedToGroupIds.some((groupId) => memberGroupIds.has(groupId))) {\n continue\n }\n\n roleIds.push(role.id)\n for (const kind of GRANT_KIND_KEYS) {\n for (const id of role.grants[kind]) {\n grants[kind].add(id)\n }\n }\n }\n\n return {\n principal: input.principal,\n ...(input.sessionId !== undefined ? { sessionId: input.sessionId } : {}),\n groupIds: input.groupIds,\n roleIds,\n grants,\n }\n}\n",
|
|
13
|
+
"export class ProjectionValidationError extends Error {\n readonly name = \"ProjectionValidationError\"\n}\n",
|
|
14
|
+
"import { compareStrings } from \"../json\"\nimport type { OntologyDefinitionCatalog } from \"../ontology\"\nimport { ProjectionValidationError } from \"./errors\"\nimport type { ProjectionDefinition, ProjectionOwnership } from \"./types\"\n\nexport function computeProjectionOwnership(\n projection: ProjectionDefinition,\n ontology: OntologyDefinitionCatalog\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",
|
|
15
|
+
"/**\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 { OntologyDefinitionCatalog } 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: OntologyDefinitionCatalog,\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: OntologyDefinitionCatalog): 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",
|
|
16
|
+
"/**\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/**\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",
|
|
17
|
+
"import type { ProjectionDefinition, ProjectionTarget } from \"../projections\"\nimport { projectionTargetOf } from \"../projections/builders\"\nimport type { ActionRunRecord } from \"../storage/action-runs\"\nimport type { PipelineRunRecord } from \"../storage/pipeline-runs\"\nimport type { WorkflowInterventionRecord } from \"../storage/workflow-interventions\"\nimport type { WorkflowRunRecord } from \"../storage/workflow-runs\"\nimport { isAllowed } from \"./decision\"\nimport type { AuthorizationContext } from \"./types\"\n\nexport function canViewActionRun(\n authorization: AuthorizationContext | null | undefined,\n run: Pick<ActionRunRecord, \"actionId\" | \"subject\">\n): boolean {\n if (!authorization) {\n return true\n }\n\n if (!isAllowed(authorization, { kind: \"action.apply\", actionId: run.actionId })) {\n return false\n }\n\n return run.subject.kind !== \"object\"\n ? true\n : isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: run.subject.objectTypeId,\n })\n}\n\nexport function canViewWorkflowRun(\n authorization: AuthorizationContext | null | undefined,\n run: Pick<WorkflowRunRecord, \"workflowId\">\n): boolean {\n return (\n !authorization || isAllowed(authorization, { kind: \"workflow.run\", workflowId: run.workflowId })\n )\n}\n\nexport function canViewWorkflowIntervention(\n authorization: AuthorizationContext | null | undefined,\n intervention: Pick<WorkflowInterventionRecord, \"workflowId\">\n): boolean {\n return (\n !authorization ||\n isAllowed(authorization, { kind: \"workflow.run\", workflowId: intervention.workflowId })\n )\n}\n\nexport function canViewPipelineRun(\n authorization: AuthorizationContext | null | undefined,\n run: Pick<PipelineRunRecord, \"pipelineId\">\n): boolean {\n return (\n !authorization || isAllowed(authorization, { kind: \"pipeline.run\", pipelineId: run.pipelineId })\n )\n}\n\n/** A projection run is viewable when its target object type(s) are viewable. */\nexport function canViewProjectionRun(\n authorization: AuthorizationContext | null | undefined,\n target: ProjectionTarget\n): boolean {\n if (!authorization) return true\n const canView = (objectTypeId: string) =>\n isAllowed(authorization, { kind: \"object.view\", objectTypeId })\n if (\"sourceObjectTypeId\" in target) {\n return canView(target.sourceObjectTypeId) && canView(target.targetObjectTypeId)\n }\n return canView(target.objectTypeId)\n}\n\n/** Whether a principal may see a projection definition (and its run history). */\nexport function canViewProjection(\n authorization: AuthorizationContext | null | undefined,\n projection: ProjectionDefinition\n): boolean {\n return canViewProjectionRun(authorization, projectionTargetOf(projection))\n}\n",
|
|
18
|
+
"/**\n * Authorization context types.\n *\n * The context is plain, immutable data resolved once per request\n * (`principal -> groups -> roles -> grants`). Grants resolve eagerly into set\n * lookups so enforcement on the hot path is synchronous and allocation-free.\n * Group and role ids are retained so decisions stay explainable.\n */\n\nimport type { Principal } from \"../auth/types\"\nimport { emptyGrantSets, type GrantKind } from \"./grant-kinds\"\n\n/**\n * Grants resolved to concrete id sets, keyed by grant kind (`view:object`,\n * `run:sync`, …). Broad grants and object subtypes are already expanded, so\n * enforcement is a single `grants[kind].has(id)` lookup. Keyed by `GrantKind`\n * so a new grant family adds one key, not a new bucket every consumer must\n * learn.\n */\nexport type GrantIndex = Readonly<Record<GrantKind, ReadonlySet<string>>>\n\n/**\n * A grant index that grants nothing, as the base for a hand-built context — typically in tests.\n *\n * This is the read-only face of `emptyGrantSets()`, the mutable builder resolution fills in and which\n * stays internal. A factory rather than a shared constant, because the sets are only `ReadonlySet` to\n * the type system: one frozen instance would be aliased into every context that spreads it.\n *\n * Writing the literal by hand is what this avoids. `GrantIndex` is deliberately a total `Record` so\n * that `grants[kind].has(id)` cannot be misspelled into a silent `undefined` — with an optional index\n * every enforcement site would read `?.has(id) ?? false`, where a typo denies instead of failing to\n * compile. The cost of totality is that a literal breaks whenever a grant family is added.\n */\nexport function emptyGrantIndex(): GrantIndex {\n return emptyGrantSets()\n}\n\n/** A role with its grants pre-expanded to concrete id sets at startup. */\nexport interface ResolvedRole {\n readonly id: string\n readonly grantedToGroupIds: readonly string[]\n readonly grants: GrantIndex\n}\n\nexport interface AuthorizationContext {\n readonly principal: Principal\n readonly sessionId?: string\n readonly groupIds: readonly string[]\n /** Roles whose grantedTo groups intersect the principal's memberships. */\n readonly roleIds: readonly string[]\n readonly grants: GrantIndex\n}\n"
|
|
19
|
+
],
|
|
20
|
+
"mappings": ";;;;;;;;;AA2DO,IAAM,cAAgD;AAAA,EAC3D,sBAAsB;AAAA,IACpB,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AAAA,EACA,eAAe;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AA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U,CAAC;AAAA;;AC3CpE,SAAS,eAAe,GAAe;AAAA,EAC5C,OAAO,eAAe;AAAA;",
|
|
21
|
+
"debugId": "EA88C5F91530A04564756E2164756E21",
|
|
22
|
+
"names": []
|
|
23
|
+
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createLinkTokenMap,
|
|
4
4
|
createPropertyTokenMap
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4gz41why.js";
|
|
6
6
|
import {
|
|
7
7
|
validatePrimaryProperties,
|
|
8
8
|
validatePropertyDefinitions,
|
|
9
9
|
validateQueryMetadata
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-rnshztfq.js";
|
|
11
11
|
import {
|
|
12
12
|
OntologyNotFoundError,
|
|
13
13
|
OntologyValidationError,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/ontology/registry.ts", "../src/ontology/builders.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Standalone ontology registry — owns all type state and resolution logic.\n *\n * Zero infrastructure dependencies: imports only from the `ontology/` module.\n * Other modules depend on `OntologyRegistry` instead of coupling to the full\n * `Sixb` facade.\n */\n\nimport {\n formatUnknownObjectTypeMessage,\n OntologyNotFoundError,\n OntologyValidationError,\n} from \"./errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport {\n validatePrimaryProperties,\n validatePropertyDefinitions,\n validateQueryMetadata,\n} from \"./validation\"\n\n// ── Input types ──────────────────────────────────────────────\n\n/** Typed wrapper used by `createSixb` to register full ontology documents. */\nexport type OntologyDocumentInput = {\n readonly id: string\n readonly version: string\n readonly objectTypes: readonly ObjectTypeWithPropertyTokens[]\n readonly valueTypes?: readonly ValueType[]\n}\n\n/**\n * Runtime accepts either full ontology documents or individual object types.\n * This keeps setup flexible while preserving strict typing.\n */\nexport type OntologySource = ObjectTypeWithPropertyTokens | OntologyDocumentInput\n\nexport interface OntologyRegistryOptions {\n readonly sources: readonly OntologySource[]\n}\n\n// ── Private helpers ──────────────────────────────────────────\n\nfunction isOntologyDocumentSource(\n source: OntologySource\n): source is Exclude<OntologySource, ObjectTypeWithPropertyTokens> {\n return \"objectTypes\" in source\n}\n\n/**\n * Recursively walk a schema tree and collect ValueTypes discovered\n * via `valueTypeRef` nodes that carry a `_resolved` schema.\n *\n * This enables auto-registration: when codegen emits `valueTypeRef(VT)`,\n * it stores the resolved schema inline. We extract it here so the runtime\n * `valueTypesById` registry is populated without requiring users to pass\n * ValueTypes explicitly.\n */\nfunction extractValueTypesFromSchema(\n schema: Schema,\n collected: Map<string, ValueType>,\n seen: Set<string>\n): void {\n if (typeof schema === \"string\") return\n\n if (schema.type === \"valueTypeRef\") {\n if (schema._resolved && !seen.has(schema.valueTypeId)) {\n seen.add(schema.valueTypeId)\n const localName = schema.valueTypeId.includes(\":\")\n ? schema.valueTypeId.slice(schema.valueTypeId.indexOf(\":\") + 1)\n : schema.valueTypeId\n collected.set(schema.valueTypeId, {\n id: schema.valueTypeId,\n name: localName,\n schema: schema._resolved,\n })\n extractValueTypesFromSchema(schema._resolved, collected, seen)\n }\n return\n }\n\n if (schema.type === \"object\") {\n for (const field of Object.values(schema.properties)) {\n extractValueTypesFromSchema(field.schema, collected, seen)\n }\n return\n }\n\n if (schema.type === \"array\") {\n extractValueTypesFromSchema(schema.items, collected, seen)\n return\n }\n\n if (schema.type === \"map\") {\n extractValueTypesFromSchema(schema.valueSchema, collected, seen)\n }\n}\n\nfunction collectOntology(sources: readonly OntologySource[]): {\n objectTypes: ObjectTypeWithPropertyTokens[]\n valueTypes: ValueType[]\n} {\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n const seenObjectTypes = new Set<ObjectTypeWithPropertyTokens>()\n\n for (const source of sources) {\n if (isOntologyDocumentSource(source)) {\n for (const ot of source.objectTypes) {\n if (!seenObjectTypes.has(ot)) {\n seenObjectTypes.add(ot)\n objectTypes.push(ot)\n }\n }\n valueTypes.push(...(source.valueTypes ?? []))\n } else {\n if (!seenObjectTypes.has(source)) {\n seenObjectTypes.add(source)\n objectTypes.push(source)\n }\n }\n }\n\n // Auto-discover ValueTypes embedded in ObjectType schemas via _resolved.\n // Explicit ValueTypes (from OntologyDocumentInput) take priority.\n const explicitIds = new Set(valueTypes.map((vt) => vt.id))\n const discovered = new Map<string, ValueType>()\n\n for (const objectType of objectTypes) {\n for (const property of objectType.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n for (const linkDef of objectType.links) {\n if (linkDef.properties) {\n for (const property of linkDef.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n }\n }\n }\n\n valueTypes.push(...discovered.values())\n\n return { objectTypes, valueTypes }\n}\n\n// ── OntologyRegistry ─────────────────────────────────────────\n\n/**\n * Self-contained registry for ontology types.\n *\n * Holds all object types, value types, the subtype graph, and the primary\n * property mapping. Validates inheritance chains and flattens inherited\n * properties at construction time.\n *\n * Exposes read-only accessors so consumers never mutate ontology state.\n */\nexport class OntologyRegistry {\n private readonly objectTypesById = new Map<string, ObjectTypeWithPropertyTokens>()\n private readonly valueTypesById = new Map<string, ValueType>()\n private readonly subTypesById = new Map<string, Set<string>>()\n private readonly primaryByTypeId: Map<string, string>\n\n constructor(options: OntologyRegistryOptions) {\n const { objectTypes, valueTypes } = collectOntology(options.sources)\n\n for (const objectType of objectTypes) {\n if (this.objectTypesById.has(objectType.id)) {\n throw new OntologyValidationError(`Duplicate object type id: ${objectType.id}`)\n }\n this.objectTypesById.set(objectType.id, objectType)\n }\n\n for (const valueType of valueTypes) {\n if (this.valueTypesById.has(valueType.id)) {\n throw new OntologyValidationError(`Duplicate value type id: ${valueType.id}`)\n }\n this.valueTypesById.set(valueType.id, valueType)\n }\n\n this.validateAndBuildExtendsRegistry()\n this.resolveInheritedProperties()\n validatePropertyDefinitions(this.objectTypesById, this.valueTypesById)\n validateQueryMetadata(this.objectTypesById, this.valueTypesById)\n this.primaryByTypeId = validatePrimaryProperties(this.objectTypesById)\n }\n\n // ── Public read API ──────────────────────────────────────\n\n /** All registered object types. */\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[] {\n return [...this.objectTypesById.values()]\n }\n\n /** Lookup an object type by id. Returns `null` if not found. */\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null {\n return this.objectTypesById.get(objectTypeId) ?? null\n }\n\n /**\n * Lookup an object type by id, throwing if it does not exist.\n *\n * Use this when the caller requires the type to exist and should fail\n * loudly on unknown types (e.g., write operations receiving a type id).\n */\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens {\n const objectType = this.objectTypesById.get(objectTypeId)\n if (!objectType) {\n throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n }\n return objectType\n }\n\n /** Get the primary property id for a given object type. Throws if unknown. */\n getPrimaryPropertyId(objectTypeId: string): string {\n const id = this.primaryByTypeId.get(objectTypeId)\n if (!id) throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n return id\n }\n\n /** Collect all transitive sub-types of the given object type id. */\n listSubTypes(objectTypeId: string): string[] {\n const result: string[] = []\n const collect = (typeId: string): void => {\n const children = this.subTypesById.get(typeId)\n if (!children) return\n for (const childId of children) {\n result.push(childId)\n collect(childId)\n }\n }\n collect(objectTypeId)\n return result\n }\n\n /** Get the structural extends chain from root ancestor to the provided type. */\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[] {\n const chain: ObjectTypeWithPropertyTokens[] = []\n let current: ObjectTypeWithPropertyTokens | null = this.resolveObjectType(objectType.id)\n const seen = new Set<string>()\n\n while (current) {\n if (seen.has(current.id)) {\n throw new OntologyValidationError(\n `Circular extends chain detected while resolving ancestors for \"${objectType.id}\".`\n )\n }\n seen.add(current.id)\n chain.push(current)\n current = current.extends ? this.resolveObjectType(current.extends) : null\n }\n\n return chain.reverse()\n }\n\n /**\n * Check whether `actual` is a valid target for a link expecting `expected`.\n *\n * Supports wildcard `\"*\"`, single concrete types, and arrays. A type\n * matches if it equals the expected type or is a transitive subtype.\n */\n isValidLinkTarget(expected: string | string[], actual: string): boolean {\n if (expected === \"*\") return true\n const types = Array.isArray(expected) ? expected : [expected]\n if (types.includes(\"*\")) return true\n for (const type of types) {\n if (actual === type || this.listSubTypes(type).includes(actual)) return true\n }\n return false\n }\n\n // ── Map accessors (read-only views) ──────────────────────\n\n /** Read-only view of all object types by id. */\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens> {\n return this.objectTypesById\n }\n\n /** Read-only view of all value types by id. */\n getValueTypesById(): ReadonlyMap<string, ValueType> {\n return this.valueTypesById\n }\n\n /** Read-only view of primary property ids by object type id. */\n getPrimaryByTypeId(): ReadonlyMap<string, string> {\n return this.primaryByTypeId\n }\n\n // ── Private initialization ───────────────────────────────\n\n /**\n * Build the subtype graph from `extends` and `parents` declarations.\n *\n * Validates that parent types exist and detects circular `extends` chains.\n */\n private validateAndBuildExtendsRegistry(): void {\n const resolving = new Set<string>()\n const resolved = new Set<string>()\n\n const registerChild = (parentId: string, childId: string): void => {\n let children = this.subTypesById.get(parentId)\n if (!children) {\n children = new Set()\n this.subTypesById.set(parentId, children)\n }\n children.add(childId)\n }\n\n const visit = (typeId: string, chain: string[]): void => {\n if (resolved.has(typeId)) return\n\n const objectType = this.objectTypesById.get(typeId)\n if (!objectType || !objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n const parentId = objectType.extends\n\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" extends unknown type \"${parentId}\". If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n\n if (resolving.has(typeId)) {\n throw new OntologyValidationError(\n `Circular extends chain detected: ${[...chain, typeId].join(\" → \")}`\n )\n }\n\n resolving.add(typeId)\n visit(parentId, [...chain, typeId])\n\n registerChild(parentId, typeId)\n\n resolving.delete(typeId)\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n visit(typeId, [])\n }\n\n for (const [typeId, objectType] of this.objectTypesById) {\n if (!objectType.parents) continue\n for (const parentId of objectType.parents) {\n if (parentId === objectType.extends) continue\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" lists unknown parent \"${parentId}\" in parents. If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n registerChild(parentId, typeId)\n }\n }\n }\n\n /**\n * For types with string `extends`, merge parent properties/links\n * and rebuild tokens. Idempotent: no-op if already flattened (codegen case).\n */\n private resolveInheritedProperties(): void {\n const resolved = new Set<string>()\n\n const resolve = (typeId: string): void => {\n if (resolved.has(typeId)) return\n const objectType = this.objectTypesById.get(typeId)!\n\n if (!objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n resolve(objectType.extends)\n const parent = this.objectTypesById.get(objectType.extends)!\n\n const mergeById = <T extends { id: string }>(\n parentItems: readonly T[],\n childItems: readonly T[]\n ): T[] => {\n const childIds = new Set(childItems.map((item) => item.id))\n const fromParent = parentItems.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...childItems]\n }\n\n const mergedProperties = mergeById(parent.properties, objectType.properties)\n const mergedLinks = mergeById(parent.links, objectType.links)\n\n const changed =\n mergedProperties.length !== objectType.properties.length ||\n mergedLinks.length !== objectType.links.length\n\n if (changed) {\n const merged: ObjectType = {\n ...objectType,\n properties: mergedProperties,\n links: mergedLinks,\n }\n const withTokens: ObjectTypeWithPropertyTokens = {\n ...merged,\n p: createPropertyTokenMap(merged),\n }\n ;(withTokens as ObjectTypeWithPropertyTokens & { l: unknown }).l =\n createLinkTokenMap(merged)\n this.objectTypesById.set(typeId, withTokens)\n }\n\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n resolve(typeId)\n }\n }\n}\n",
|
|
5
|
+
"/**\n * Standalone ontology registry — owns all type state and resolution logic.\n *\n * Zero infrastructure dependencies: imports only from the `ontology/` module.\n * Other modules depend on its read-only catalog instead of coupling to the full\n * `Sixb` facade.\n */\n\nimport {\n formatUnknownObjectTypeMessage,\n OntologyNotFoundError,\n OntologyValidationError,\n} from \"./errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport {\n validatePrimaryProperties,\n validatePropertyDefinitions,\n validateQueryMetadata,\n} from \"./validation\"\n\n// ── Input types ──────────────────────────────────────────────\n\n/** Typed wrapper used by `createSixb` to register full ontology documents. */\nexport type OntologyDocumentInput = {\n readonly id: string\n readonly version: string\n readonly objectTypes: readonly ObjectTypeWithPropertyTokens[]\n readonly valueTypes?: readonly ValueType[]\n}\n\n/**\n * Runtime accepts either full ontology documents or individual object types.\n * This keeps setup flexible while preserving strict typing.\n */\nexport type OntologySource = ObjectTypeWithPropertyTokens | OntologyDocumentInput\n\nexport interface OntologyRegistryOptions {\n readonly sources: readonly OntologySource[]\n}\n\n/** Read-only access to the host's validated ontology definitions and type graph. */\nexport interface OntologyDefinitionCatalog {\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[]\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens\n getPrimaryPropertyId(objectTypeId: string): string\n listSubTypes(objectTypeId: string): string[]\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[]\n isValidLinkTarget(expected: string | string[], actual: string): boolean\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens>\n getValueTypesById(): ReadonlyMap<string, ValueType>\n getPrimaryByTypeId(): ReadonlyMap<string, string>\n}\n\n// ── Private helpers ──────────────────────────────────────────\n\nfunction isOntologyDocumentSource(\n source: OntologySource\n): source is Exclude<OntologySource, ObjectTypeWithPropertyTokens> {\n return \"objectTypes\" in source\n}\n\n/**\n * Recursively walk a schema tree and collect ValueTypes discovered\n * via `valueTypeRef` nodes that carry a `_resolved` schema.\n *\n * This enables auto-registration: when codegen emits `valueTypeRef(VT)`,\n * it stores the resolved schema inline. We extract it here so the runtime\n * `valueTypesById` registry is populated without requiring users to pass\n * ValueTypes explicitly.\n */\nfunction extractValueTypesFromSchema(\n schema: Schema,\n collected: Map<string, ValueType>,\n seen: Set<string>\n): void {\n if (typeof schema === \"string\") return\n\n if (schema.type === \"valueTypeRef\") {\n if (schema._resolved && !seen.has(schema.valueTypeId)) {\n seen.add(schema.valueTypeId)\n const localName = schema.valueTypeId.includes(\":\")\n ? schema.valueTypeId.slice(schema.valueTypeId.indexOf(\":\") + 1)\n : schema.valueTypeId\n collected.set(schema.valueTypeId, {\n id: schema.valueTypeId,\n name: localName,\n schema: schema._resolved,\n })\n extractValueTypesFromSchema(schema._resolved, collected, seen)\n }\n return\n }\n\n if (schema.type === \"object\") {\n for (const field of Object.values(schema.properties)) {\n extractValueTypesFromSchema(field.schema, collected, seen)\n }\n return\n }\n\n if (schema.type === \"array\") {\n extractValueTypesFromSchema(schema.items, collected, seen)\n return\n }\n\n if (schema.type === \"map\") {\n extractValueTypesFromSchema(schema.valueSchema, collected, seen)\n }\n}\n\nfunction collectOntology(sources: readonly OntologySource[]): {\n objectTypes: ObjectTypeWithPropertyTokens[]\n valueTypes: ValueType[]\n} {\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n const seenObjectTypes = new Set<ObjectTypeWithPropertyTokens>()\n\n for (const source of sources) {\n if (isOntologyDocumentSource(source)) {\n for (const ot of source.objectTypes) {\n if (!seenObjectTypes.has(ot)) {\n seenObjectTypes.add(ot)\n objectTypes.push(ot)\n }\n }\n valueTypes.push(...(source.valueTypes ?? []))\n } else {\n if (!seenObjectTypes.has(source)) {\n seenObjectTypes.add(source)\n objectTypes.push(source)\n }\n }\n }\n\n // Auto-discover ValueTypes embedded in ObjectType schemas via _resolved.\n // Explicit ValueTypes (from OntologyDocumentInput) take priority.\n const explicitIds = new Set(valueTypes.map((vt) => vt.id))\n const discovered = new Map<string, ValueType>()\n\n for (const objectType of objectTypes) {\n for (const property of objectType.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n for (const linkDef of objectType.links) {\n if (linkDef.properties) {\n for (const property of linkDef.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n }\n }\n }\n\n valueTypes.push(...discovered.values())\n\n return { objectTypes, valueTypes }\n}\n\n// ── OntologyRegistry ─────────────────────────────────────────\n\n/**\n * Self-contained registry for ontology types.\n *\n * Holds all object types, value types, the subtype graph, and the primary\n * property mapping. Validates inheritance chains and flattens inherited\n * properties at construction time.\n *\n * Exposes read-only accessors so consumers never mutate ontology state.\n */\nexport class OntologyRegistry implements OntologyDefinitionCatalog {\n private readonly objectTypesById = new Map<string, ObjectTypeWithPropertyTokens>()\n private readonly valueTypesById = new Map<string, ValueType>()\n private readonly subTypesById = new Map<string, Set<string>>()\n private readonly primaryByTypeId: Map<string, string>\n\n constructor(options: OntologyRegistryOptions) {\n const { objectTypes, valueTypes } = collectOntology(options.sources)\n\n for (const objectType of objectTypes) {\n if (this.objectTypesById.has(objectType.id)) {\n throw new OntologyValidationError(`Duplicate object type id: ${objectType.id}`)\n }\n this.objectTypesById.set(objectType.id, objectType)\n }\n\n for (const valueType of valueTypes) {\n if (this.valueTypesById.has(valueType.id)) {\n throw new OntologyValidationError(`Duplicate value type id: ${valueType.id}`)\n }\n this.valueTypesById.set(valueType.id, valueType)\n }\n\n this.validateAndBuildExtendsRegistry()\n this.resolveInheritedProperties()\n validatePropertyDefinitions(this.objectTypesById, this.valueTypesById)\n validateQueryMetadata(this.objectTypesById, this.valueTypesById)\n this.primaryByTypeId = validatePrimaryProperties(this.objectTypesById)\n }\n\n // ── Public read API ──────────────────────────────────────\n\n /** All registered object types. */\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[] {\n return [...this.objectTypesById.values()]\n }\n\n /** Lookup an object type by id. Returns `null` if not found. */\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null {\n return this.objectTypesById.get(objectTypeId) ?? null\n }\n\n /**\n * Lookup an object type by id, throwing if it does not exist.\n *\n * Use this when the caller requires the type to exist and should fail\n * loudly on unknown types (e.g., write operations receiving a type id).\n */\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens {\n const objectType = this.objectTypesById.get(objectTypeId)\n if (!objectType) {\n throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n }\n return objectType\n }\n\n /** Get the primary property id for a given object type. Throws if unknown. */\n getPrimaryPropertyId(objectTypeId: string): string {\n const id = this.primaryByTypeId.get(objectTypeId)\n if (!id) throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n return id\n }\n\n /** Collect all transitive sub-types of the given object type id. */\n listSubTypes(objectTypeId: string): string[] {\n const result: string[] = []\n const collect = (typeId: string): void => {\n const children = this.subTypesById.get(typeId)\n if (!children) return\n for (const childId of children) {\n result.push(childId)\n collect(childId)\n }\n }\n collect(objectTypeId)\n return result\n }\n\n /** Get the structural extends chain from root ancestor to the provided type. */\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[] {\n const chain: ObjectTypeWithPropertyTokens[] = []\n let current: ObjectTypeWithPropertyTokens | null = this.resolveObjectType(objectType.id)\n const seen = new Set<string>()\n\n while (current) {\n if (seen.has(current.id)) {\n throw new OntologyValidationError(\n `Circular extends chain detected while resolving ancestors for \"${objectType.id}\".`\n )\n }\n seen.add(current.id)\n chain.push(current)\n current = current.extends ? this.resolveObjectType(current.extends) : null\n }\n\n return chain.reverse()\n }\n\n /**\n * Check whether `actual` is a valid target for a link expecting `expected`.\n *\n * Supports wildcard `\"*\"`, single concrete types, and arrays. A type\n * matches if it equals the expected type or is a transitive subtype.\n */\n isValidLinkTarget(expected: string | string[], actual: string): boolean {\n if (expected === \"*\") return true\n const types = Array.isArray(expected) ? expected : [expected]\n if (types.includes(\"*\")) return true\n for (const type of types) {\n if (actual === type || this.listSubTypes(type).includes(actual)) return true\n }\n return false\n }\n\n // ── Map accessors (read-only views) ──────────────────────\n\n /** Read-only view of all object types by id. */\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens> {\n return this.objectTypesById\n }\n\n /** Read-only view of all value types by id. */\n getValueTypesById(): ReadonlyMap<string, ValueType> {\n return this.valueTypesById\n }\n\n /** Read-only view of primary property ids by object type id. */\n getPrimaryByTypeId(): ReadonlyMap<string, string> {\n return this.primaryByTypeId\n }\n\n // ── Private initialization ───────────────────────────────\n\n /**\n * Build the subtype graph from `extends` and `parents` declarations.\n *\n * Validates that parent types exist and detects circular `extends` chains.\n */\n private validateAndBuildExtendsRegistry(): void {\n const resolving = new Set<string>()\n const resolved = new Set<string>()\n\n const registerChild = (parentId: string, childId: string): void => {\n let children = this.subTypesById.get(parentId)\n if (!children) {\n children = new Set()\n this.subTypesById.set(parentId, children)\n }\n children.add(childId)\n }\n\n const visit = (typeId: string, chain: string[]): void => {\n if (resolved.has(typeId)) return\n\n const objectType = this.objectTypesById.get(typeId)\n if (!objectType || !objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n const parentId = objectType.extends\n\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" extends unknown type \"${parentId}\". If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n\n if (resolving.has(typeId)) {\n throw new OntologyValidationError(\n `Circular extends chain detected: ${[...chain, typeId].join(\" → \")}`\n )\n }\n\n resolving.add(typeId)\n visit(parentId, [...chain, typeId])\n\n registerChild(parentId, typeId)\n\n resolving.delete(typeId)\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n visit(typeId, [])\n }\n\n for (const [typeId, objectType] of this.objectTypesById) {\n if (!objectType.parents) continue\n for (const parentId of objectType.parents) {\n if (parentId === objectType.extends) continue\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" lists unknown parent \"${parentId}\" in parents. If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n registerChild(parentId, typeId)\n }\n }\n }\n\n /**\n * For types with string `extends`, merge parent properties/links\n * and rebuild tokens. Idempotent: no-op if already flattened (codegen case).\n */\n private resolveInheritedProperties(): void {\n const resolved = new Set<string>()\n\n const resolve = (typeId: string): void => {\n if (resolved.has(typeId)) return\n const objectType = this.objectTypesById.get(typeId)!\n\n if (!objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n resolve(objectType.extends)\n const parent = this.objectTypesById.get(objectType.extends)!\n\n const mergeById = <T extends { id: string }>(\n parentItems: readonly T[],\n childItems: readonly T[]\n ): T[] => {\n const childIds = new Set(childItems.map((item) => item.id))\n const fromParent = parentItems.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...childItems]\n }\n\n const mergedProperties = mergeById(parent.properties, objectType.properties)\n const mergedLinks = mergeById(parent.links, objectType.links)\n\n const changed =\n mergedProperties.length !== objectType.properties.length ||\n mergedLinks.length !== objectType.links.length\n\n if (changed) {\n const merged: ObjectType = {\n ...objectType,\n properties: mergedProperties,\n links: mergedLinks,\n }\n const withTokens: ObjectTypeWithPropertyTokens = {\n ...merged,\n p: createPropertyTokenMap(merged),\n }\n ;(withTokens as ObjectTypeWithPropertyTokens & { l: unknown }).l =\n createLinkTokenMap(merged)\n this.objectTypesById.set(typeId, withTokens)\n }\n\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n resolve(typeId)\n }\n }\n}\n",
|
|
6
6
|
"/**\n * Builder helpers for ontology modeling.\n *\n * These functions provide shorthand for constructing `ObjectType`, `ValueType`,\n * `Interface`, `Property`, `ObjectLink`, and `EnumSchema` values with sensible\n * defaults so you can focus on the semantics rather than boilerplate.\n *\n * ```ts\n * import { defineObjectType, prop, link, stringEnum } from \"@sixb/core\"\n *\n * const thermostat = defineObjectType({\n * id: \"thermostat\",\n * name: \"Thermostat\",\n * properties: [\n * prop(\"currentTemperature\", \"double\", {\n * name: \"Current Temperature\",\n * semanticType: \"Temperature\",\n * required: true,\n * }),\n * prop(\"mode\", stringEnum([\"off\", \"heat\", \"cool\", \"auto\"])),\n * ],\n * links: [\n * link.ref(\"controls\", \"hvacZone\", { cardinality: \"one\" }),\n * ],\n * })\n * ```\n */\n\nimport type { ObjectTypeWithPropertyTokens, ObjectTypeWithTokens, PropertyTokenMap } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type {\n EnumSchema,\n Interface,\n LinkCardinality,\n ObjectLink,\n ObjectLinkTargetMetadata,\n ObjectType,\n Ontology,\n Property,\n PropertyMode,\n PropertyQueryMetadata,\n Schema,\n ValueType,\n ValueTypeRefSchema,\n} from \"./types\"\nimport type { QuantitativeTypeId } from \"./units\"\n\ntype NameFromOptions<TId extends string, TOptions> = TOptions extends {\n name: infer TName extends string\n}\n ? TName\n : TId\n\n/**\n * Preserve literal option values when an option key is provided.\n *\n * Why this exists:\n * - `prop(\"x\", \"string\", { required: true })` should keep `required` as literal `true`\n * (not widen to `boolean`) so downstream inference can treat the field as required.\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\nconst selfLinkTargetObjectTypeId = \"__sixb.self__\"\ntype SelfLinkTargetObjectTypeId = typeof selfLinkTargetObjectTypeId\n\ntype NormalizeSelfLink<TObjectTypeId extends string, TLink> = TLink extends {\n targetObjectTypeId: SelfLinkTargetObjectTypeId\n}\n ? Omit<TLink, \"targetObjectTypeId\"> & { targetObjectTypeId: TObjectTypeId }\n : TLink\n\ntype NormalizeSelfLinks<TObjectTypeId extends string, TLinks extends readonly ObjectLink[]> = {\n -readonly [K in keyof TLinks]: NormalizeSelfLink<TObjectTypeId, TLinks[K]>\n}\n\n// ── Extends type utilities ───────────────────────────────────\n\n/**\n * Merge parent + child collections by id. Uses built-in `Exclude` on\n * the element union — no recursion, no \"excessively deep\" errors.\n */\ntype MergedCollection<\n TParent extends readonly { id: string }[],\n TChild extends readonly { id: string }[],\n> = Array<Exclude<TParent[number], { id: TChild[number][\"id\"] }> | TChild[number]>\n\n/**\n * Extract child's own collection, normalized as a mutable tuple. Falls back to [].\n */\ntype OwnCollection<TInput, TKey extends string, TItem> =\n TInput extends Record<TKey, infer T extends readonly TItem[]> ? [...T] : []\n\ntype OwnLinks<TInput> = TInput extends { id: infer TObjectTypeId extends string }\n ? TInput extends Record<\"links\", infer TLinks extends readonly ObjectLink[]>\n ? NormalizeSelfLinks<TObjectTypeId, TLinks>\n : []\n : []\n\n/**\n * Merge two arrays by id: parent items first, child items override by id.\n */\nfunction mergeById<T extends { id: string }>(parent: readonly T[], child: readonly T[]): T[] {\n const childIds = new Set(child.map((item) => item.id))\n const fromParent = parent.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...child]\n}\n\n// ── Object Type ─────────────────────────────────────────────\n\ntype DefineObjectTypeBase = Omit<ObjectType, \"properties\" | \"links\" | \"extends\" | \"parents\">\n\n/**\n * Structural constraint for the `extends` field.\n *\n * We require only the data needed for merge (id + collections), not the\n * full `ObjectTypeWithTokens<ObjectType>`. The latter requires\n * `LinkTokenMap<ObjectType>` with a `{ [id: string]: LinkToken }` index\n * signature, which is incompatible with the literal-keyed maps produced by\n * concrete `defineObjectType()` calls.\n */\ntype DefineObjectTypeInput = DefineObjectTypeBase & {\n extends?:\n | string\n | {\n readonly id: string\n readonly properties: readonly Property[]\n readonly links: readonly ObjectLink[]\n }\n parents?: readonly string[]\n properties?: readonly Property[]\n links?: readonly ObjectLink[]\n}\n\n/**\n * Normalize `parents` from readonly tuple to mutable `string[] | undefined`.\n */\ntype NormalizeParents<TInput> = TInput extends { parents: infer P extends readonly string[] }\n ? { parents: [...P] }\n : { parents?: undefined }\n\ntype DefineObjectTypeResult<TInput extends DefineObjectTypeInput> = Omit<\n TInput,\n \"properties\" | \"links\" | \"extends\" | \"parents\"\n> &\n (TInput extends {\n extends: infer TParent extends {\n id: string\n properties: readonly Property[]\n links: readonly ObjectLink[]\n }\n }\n ? NormalizeParents<TInput> & {\n extends: TParent[\"id\"]\n properties: MergedCollection<\n TParent[\"properties\"],\n OwnCollection<TInput, \"properties\", Property>\n >\n links: MergedCollection<TParent[\"links\"], OwnLinks<TInput>>\n }\n : TInput extends { extends: infer TParentId extends string }\n ? {\n extends: TParentId\n parents: string[]\n properties: OwnCollection<TInput, \"properties\", Property>\n links: OwnLinks<TInput>\n }\n : NormalizeParents<TInput> & {\n extends: undefined\n properties: OwnCollection<TInput, \"properties\", Property>\n links: OwnLinks<TInput>\n })\n\ntype DefineObjectTypeWithTokensResult<TInput extends DefineObjectTypeInput> = ObjectTypeWithTokens<\n DefineObjectTypeResult<TInput>\n>\n\n/**\n * Define an object type with sensible defaults.\n *\n * `properties` and `links` default to `[]` so you can define\n * a bare object type with just `id` and `name`.\n */\nexport function defineObjectType<const TInput extends DefineObjectTypeInput>(\n input: TInput\n): DefineObjectTypeWithTokensResult<TInput>\nexport function defineObjectType(input: DefineObjectTypeInput): ObjectTypeWithTokens<ObjectType> {\n const ext = input.extends\n\n const ownProperties = input.properties ? [...input.properties] : []\n const ownLinks = input.links\n ? input.links.map((link) => normalizeSelfLinkTarget(input.id, link))\n : []\n\n let extendsId: string | undefined\n let parentIds: string[] | undefined\n let properties: Property[]\n let links: ObjectLink[]\n\n if (typeof ext === \"string\") {\n // Pre-flattened: string extends — no merge, properties/links taken as-is\n extendsId = ext\n parentIds = [ext, ...(input.parents ?? []).filter((id) => id !== ext)]\n properties = ownProperties\n links = ownLinks\n } else if (ext != null) {\n // Object extends — merge parent collections\n extendsId = ext.id\n parentIds = [ext.id, ...(input.parents ?? []).filter((id) => id !== ext.id)]\n properties = mergeById(ext.properties, ownProperties)\n links = mergeById([...ext.links], ownLinks)\n } else {\n // No extends\n extendsId = undefined\n parentIds = input.parents ? [...input.parents] : undefined\n properties = ownProperties\n links = ownLinks\n }\n\n const objectType: ObjectType = {\n id: input.id,\n name: input.name,\n description: input.description,\n quantityKind: input.quantityKind,\n seeAlso: input.seeAlso,\n extends: extendsId,\n parents: parentIds,\n implements: input.implements,\n properties,\n links,\n search: input.search,\n }\n\n return {\n ...objectType,\n l: createLinkTokenMap(objectType),\n p: createPropertyTokenMap(objectType),\n }\n}\n\nfunction normalizeSelfLinkTarget(objectTypeId: string, link: ObjectLink): ObjectLink {\n if (link.targetObjectTypeId !== selfLinkTargetObjectTypeId) {\n return link\n }\n\n return {\n ...link,\n targetObjectTypeId: objectTypeId,\n }\n}\n\n// ── Ontology ────────────────────────────────────────────────\n\ntype DefineOntologyBase = Omit<Ontology, \"objectTypes\" | \"valueTypes\" | \"interfaces\">\n\ntype DefineOntologyInput = DefineOntologyBase & {\n objectTypes?: readonly ObjectType[]\n valueTypes?: readonly ValueType[]\n interfaces?: readonly Interface[]\n}\n\ntype DefineOntologyResult<TInput extends DefineOntologyInput> = Omit<\n TInput,\n \"objectTypes\" | \"valueTypes\" | \"interfaces\"\n> & {\n objectTypes: TInput extends { objectTypes: infer TObjectTypes extends readonly ObjectType[] }\n ? [...TObjectTypes]\n : []\n valueTypes: TInput extends { valueTypes: infer TValueTypes extends readonly ValueType[] }\n ? [...TValueTypes]\n : []\n interfaces: TInput extends { interfaces: infer TInterfaces extends readonly Interface[] }\n ? [...TInterfaces]\n : []\n}\n\n/**\n * Define a complete ontology document.\n *\n * `objectTypes`, `valueTypes`, and `interfaces` default to `[]`.\n */\nexport function defineOntology<const TInput extends DefineOntologyInput>(\n input: TInput\n): DefineOntologyResult<TInput>\nexport function defineOntology(input: DefineOntologyInput): Ontology {\n return {\n ...input,\n objectTypes: input.objectTypes ? [...input.objectTypes] : [],\n valueTypes: input.valueTypes ? [...input.valueTypes] : [],\n interfaces: input.interfaces ? [...input.interfaces] : [],\n }\n}\n\n// ── Value Type ──────────────────────────────────────────────\n\n/**\n * Define a reusable value type.\n *\n * Identity function for type inference and discoverability — the `define*`\n * prefix makes it easy to find all ontology builders.\n */\nexport function defineValueType<const TValueType extends ValueType>(input: TValueType): TValueType {\n return input\n}\n\n// ── Interface ───────────────────────────────────────────────\n\ntype DefineInterfaceBase = Omit<Interface, \"properties\" | \"links\">\n\ntype DefineInterfaceInput = DefineInterfaceBase & {\n properties?: readonly Property[]\n links?: readonly ObjectLink[]\n}\n\ntype DefineInterfaceResult<TInput extends DefineInterfaceInput> = Omit<\n TInput,\n \"properties\" | \"links\"\n> & {\n properties: TInput extends { properties: infer TProperties extends readonly Property[] }\n ? [...TProperties]\n : []\n links: TInput extends { links: infer TLinks extends readonly ObjectLink[] } ? [...TLinks] : []\n}\n\n/**\n * Define a reusable interface contract.\n *\n * `properties` and `links` default to `[]`.\n */\nexport function defineInterface<const TInput extends DefineInterfaceInput>(\n input: TInput\n): DefineInterfaceResult<TInput>\nexport function defineInterface(input: DefineInterfaceInput): Interface {\n return {\n ...input,\n properties: input.properties ? [...input.properties] : [],\n links: input.links ? [...input.links] : [],\n }\n}\n\n// ── Property shorthand ──────────────────────────────────────\n\ntype PropertyOptions = {\n name?: string\n description?: string\n required?: boolean\n nullable?: boolean\n primary?: true\n mode?: PropertyMode\n semanticType?: QuantitativeTypeId\n query?: PropertyQueryMetadata\n}\n\ntype PropertyResult<\n TId extends string,\n TSchema extends Schema,\n TOptions extends PropertyOptions | undefined,\n> = {\n id: TId\n name: NameFromOptions<TId, TOptions>\n schema: TSchema\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"required\", boolean> &\n FieldFromOptions<TOptions, \"nullable\", boolean> &\n FieldFromOptions<TOptions, \"primary\", true> &\n FieldFromOptions<TOptions, \"mode\", PropertyMode> &\n FieldFromOptions<TOptions, \"semanticType\", QuantitativeTypeId> &\n FieldFromOptions<TOptions, \"query\", PropertyQueryMetadata>\n\n/**\n * Shorthand for creating a {@link Property}.\n *\n * `name` defaults to `id` — override via `options.name` when you need\n * a separate display name.\n *\n * ```ts\n * prop(\"currentTemperature\", \"double\", {\n * name: \"Current Temperature\",\n * semanticType: \"Temperature\",\n * required: true,\n * })\n * ```\n */\n// Overloads keep option literals (e.g. `required: true`, `mode: \"telemetry\"`) intact.\nexport function prop<const TId extends string, const TSchema extends Schema>(\n id: TId,\n schema: TSchema\n): PropertyResult<TId, TSchema, undefined>\nexport function prop<\n const TId extends string,\n const TSchema extends Schema,\n const TOptions extends PropertyOptions,\n>(id: TId, schema: TSchema, options: TOptions): PropertyResult<TId, TSchema, TOptions>\nexport function prop(id: string, schema: Schema, options?: PropertyOptions): Property {\n return {\n id,\n name: options?.name ?? id,\n schema,\n ...options,\n }\n}\n\n// ── Link shorthand ──────────────────────────────────────────\n\n/**\n * Runtime check: does a value look like an ObjectType?\n *\n * Discriminates ObjectType from LinkOptions by checking for `properties` and `links`\n * arrays — ObjectType always has them, LinkOptions never does.\n */\nfunction isObjectTypeLike(value: unknown): value is ObjectType {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Array.isArray((value as Record<string, unknown>).properties) &&\n Array.isArray((value as Record<string, unknown>).links)\n )\n}\n\ntype LinkOptions = {\n name?: string\n description?: string\n cardinality?: LinkCardinality\n properties?: Property[]\n}\n\ntype LinkResult<\n TId extends string,\n TTargetObjectTypeId,\n TOptions extends LinkOptions | undefined,\n> = {\n id: TId\n name: NameFromOptions<TId, TOptions>\n targetObjectTypeId: TTargetObjectTypeId\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"cardinality\", LinkCardinality> &\n FieldFromOptions<TOptions, \"properties\", Property[]>\n\nexport type DirectLinkResult<\n TId extends string,\n TTargetObjectTypeId,\n TOptions extends LinkOptions | undefined,\n TTarget,\n> = LinkResult<TId, TTargetObjectTypeId, TOptions> & ObjectLinkTargetMetadata<TTarget>\n\ntype ObjectTypeIdArray<TTargets extends readonly ObjectType[]> = Array<TTargets[number][\"id\"]>\nexport type DirectLinkTarget<\n TId extends string,\n TName extends string,\n TProperties extends Property[],\n> = {\n id: TId\n name: TName\n properties: TProperties\n links: ObjectLink[]\n readonly p: PropertyTokenMap<{\n id: TId\n name: TName\n properties: TProperties\n links: ObjectLink[]\n }>\n}\n\ntype DirectLinkTargetFor<TTarget extends ObjectType> = TTarget extends ObjectTypeWithPropertyTokens\n ? DirectLinkTarget<TTarget[\"id\"], TTarget[\"name\"], TTarget[\"properties\"]>\n : TTarget\n\n/**\n * Shorthand for creating an {@link ObjectLink}.\n *\n * `link(...)` accepts direct ObjectType targets and preserves their type for\n * query authoring. Use `link.ref(...)` for id-only references, `link.self(...)`\n * for recursive links, and `link.any(...)` for wildcard links.\n *\n * ```ts\n * // ObjectType target — extracts .id at runtime and preserves the target type\n * link(\"controls\", HVACZone, { cardinality: \"one\" })\n *\n * // Id target — resolved by the generated ontology type manifest\n * link.ref(\"controls\", \"hvacZone\", { cardinality: \"one\" })\n *\n * // Self target — normalized to the source object type id by defineObjectType()\n * link.self(\"parent\", { cardinality: \"one\" })\n *\n * // Multiple targets\n * link(\"rel\", [TypeA, TypeB])\n *\n * // Wildcard — accepts any target type\n * link.any(\"anything\")\n * link.any(\"anything\", { cardinality: \"many\" })\n * ```\n */\ninterface LinkCallable {\n <const TId extends string, const TTarget extends ObjectType>(\n id: TId,\n target: TTarget\n ): DirectLinkResult<TId, TTarget[\"id\"], undefined, DirectLinkTargetFor<TTarget>>\n\n <const TId extends string, const TTarget extends ObjectType, const TOptions extends LinkOptions>(\n id: TId,\n target: TTarget,\n options: TOptions\n ): DirectLinkResult<TId, TTarget[\"id\"], TOptions, DirectLinkTargetFor<TTarget>>\n\n <const TId extends string, const TTargets extends readonly ObjectType[]>(\n id: TId,\n targets: TTargets\n ): DirectLinkResult<\n TId,\n ObjectTypeIdArray<TTargets>,\n undefined,\n DirectLinkTargetFor<TTargets[number]>\n >\n\n <\n const TId extends string,\n const TTargets extends readonly ObjectType[],\n const TOptions extends LinkOptions,\n >(\n id: TId,\n targets: TTargets,\n options: TOptions\n ): DirectLinkResult<\n TId,\n ObjectTypeIdArray<TTargets>,\n TOptions,\n DirectLinkTargetFor<TTargets[number]>\n >\n}\n\ninterface LinkBuilder extends LinkCallable {\n ref: typeof linkRef\n self: typeof linkSelf\n any: typeof linkAny\n}\n\nconst linkImpl = ((\n id: string,\n targetOrTargets: ObjectType | readonly ObjectType[],\n options?: LinkOptions\n): ObjectLink => {\n if (Array.isArray(targetOrTargets)) {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: targetOrTargets.map((target) => target.id),\n ...options,\n }\n }\n\n if (isObjectTypeLike(targetOrTargets)) {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: targetOrTargets.id,\n ...options,\n }\n }\n\n throw new Error(\n `[Sixb] link(\"${id}\", ...) requires an ObjectType target. Use link.ref(...) for id references, link.self(...) for self-links, or link.any(...) for wildcard links.`\n )\n}) as LinkCallable\n\nfunction linkRef<\n const TId extends string,\n const TTargetObjectTypeId extends string | readonly string[],\n>(id: TId, targetObjectTypeId: TTargetObjectTypeId): LinkResult<TId, TTargetObjectTypeId, undefined>\nfunction linkRef<\n const TId extends string,\n const TTargetObjectTypeId extends string | readonly string[],\n const TOptions extends LinkOptions,\n>(\n id: TId,\n targetObjectTypeId: TTargetObjectTypeId,\n options: TOptions\n): LinkResult<TId, TTargetObjectTypeId, TOptions>\nfunction linkRef(\n id: string,\n targetObjectTypeId: string | readonly string[],\n options?: LinkOptions\n): ObjectLink {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId:\n typeof targetObjectTypeId === \"string\" ? targetObjectTypeId : [...targetObjectTypeId],\n ...options,\n }\n}\n\nfunction linkSelf<\n const TId extends string,\n const TOptions extends LinkOptions | undefined = undefined,\n>(id: TId, options?: TOptions): LinkResult<TId, SelfLinkTargetObjectTypeId, TOptions> {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: selfLinkTargetObjectTypeId,\n ...options,\n } as LinkResult<TId, SelfLinkTargetObjectTypeId, TOptions>\n}\n\nfunction linkAny<\n const TId extends string,\n const TOptions extends LinkOptions | undefined = undefined,\n>(id: TId, options?: TOptions): LinkResult<TId, \"*\", TOptions> {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: \"*\",\n ...options,\n } as LinkResult<TId, \"*\", TOptions>\n}\n\nexport const link: LinkBuilder = Object.assign(linkImpl, {\n ref: linkRef,\n self: linkSelf,\n any: linkAny,\n})\n\n// ── ValueType ref shorthand ─────────────────────────────────\n\n/**\n * Create a value-type reference schema.\n *\n * ```ts\n * prop(\"azimuth\", valueTypeRef(\"bsh:AzimuthShape\"))\n * prop(\"area\", valueTypeRef(AreaShape)) // self-contained, no tuple needed\n * ```\n */\n// 1. String id only (existing behavior, no resolution)\nexport function valueTypeRef<const TId extends string>(\n valueTypeId: TId\n): ValueTypeRefSchema & { valueTypeId: TId }\n// 2. ValueType object (concise, self-contained)\nexport function valueTypeRef<const TVT extends ValueType>(\n valueType: TVT\n): { type: \"valueTypeRef\"; valueTypeId: TVT[\"id\"]; _resolved: TVT[\"schema\"] }\n// 3. String id + explicit schema (escape hatch)\nexport function valueTypeRef<const TId extends string, const TResolved extends Schema>(\n valueTypeId: TId,\n resolved: TResolved\n): { type: \"valueTypeRef\"; valueTypeId: TId; _resolved: TResolved }\n// Implementation\nexport function valueTypeRef(\n idOrValueType: string | ValueType,\n resolved?: Schema\n): ValueTypeRefSchema {\n if (typeof idOrValueType === \"string\") {\n if (resolved !== undefined) {\n return { type: \"valueTypeRef\", valueTypeId: idOrValueType, _resolved: resolved }\n }\n return { type: \"valueTypeRef\", valueTypeId: idOrValueType }\n }\n return {\n type: \"valueTypeRef\",\n valueTypeId: idOrValueType.id,\n _resolved: idOrValueType.schema,\n }\n}\n\n// ── Enum helpers ────────────────────────────────────────────\n\n/**\n * Create a string enum schema.\n *\n * ```ts\n * prop(\"mode\", stringEnum([\"off\", \"heat\", \"cool\", \"auto\"]))\n * ```\n */\nexport function stringEnum<const V extends readonly string[]>(\n values: V\n): EnumSchema & {\n values: [...V]\n} {\n return { type: \"enum\", valueType: \"string\", values: [...values] }\n}\n\n/**\n * Create an integer enum schema.\n *\n * ```ts\n * prop(\"fanSpeed\", integerEnum([1, 2, 3]))\n * ```\n */\nexport function integerEnum<const V extends readonly number[]>(\n values: V\n): EnumSchema & {\n values: [...V]\n} {\n return { type: \"enum\", valueType: \"integer\", values: [...values] }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;AA4CA,SAAS,wBAAwB,CAC/B,QACiE;AAAA,EACjE,OAAO,iBAAiB;AAAA;AAY1B,SAAS,2BAA2B,CAClC,QACA,WACA,MACM;AAAA,EACN,IAAI,OAAO,WAAW;AAAA,IAAU;AAAA,EAEhC,IAAI,OAAO,SAAS,gBAAgB;AAAA,IAClC,IAAI,OAAO,aAAa,CAAC,KAAK,IAAI,OAAO,WAAW,GAAG;AAAA,MACrD,KAAK,IAAI,OAAO,WAAW;AAAA,MAC3B,MAAM,YAAY,OAAO,YAAY,SAAS,GAAG,IAC7C,OAAO,YAAY,MAAM,OAAO,YAAY,QAAQ,GAAG,IAAI,CAAC,IAC5D,OAAO;AAAA,MACX,UAAU,IAAI,OAAO,aAAa;AAAA,QAChC,IAAI,OAAO;AAAA,QACX,MAAM;AAAA,QACN,QAAQ,OAAO;AAAA,MACjB,CAAC;AAAA,MACD,4BAA4B,OAAO,WAAW,WAAW,IAAI;AAAA,IAC/D;AAAA,IACA;AAAA,EACF;AAAA,EAEA,IAAI,OAAO,SAAS,UAAU;AAAA,IAC5B,WAAW,SAAS,OAAO,OAAO,OAAO,UAAU,GAAG;AAAA,MACpD,4BAA4B,MAAM,QAAQ,WAAW,IAAI;AAAA,IAC3D;AAAA,IACA;AAAA,EACF;AAAA,EAEA,IAAI,OAAO,SAAS,SAAS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