@sixb/core 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/delegated-admission.d.ts +24 -0
- package/dist/actions/delegated-admission.d.ts.map +1 -0
- package/dist/actions/descriptor.d.ts +29 -0
- package/dist/actions/descriptor.d.ts.map +1 -0
- package/dist/actions/execution.d.ts +5 -5
- package/dist/actions/execution.d.ts.map +1 -1
- package/dist/actions/index.js +36 -30
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-authorization.d.ts +20 -0
- package/dist/actions/run-authorization.d.ts.map +1 -0
- package/dist/actions/run-dispatch.d.ts +3 -1
- package/dist/actions/run-dispatch.d.ts.map +1 -1
- package/dist/actions/worker.js +3 -3
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +5 -122
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +1 -1
- package/dist/agents/authority.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/context.js +1 -1
- package/dist/agents/errors.d.ts +0 -9
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/identity.d.ts +3 -0
- package/dist/agents/identity.d.ts.map +1 -0
- package/dist/agents/index.d.ts +3 -3
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +43 -43
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +4 -5
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +2 -0
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/tool-definition.d.ts +0 -1
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +0 -4
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/ai-usage/execution.d.ts.map +1 -1
- package/dist/auth/index.js +8 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/decision.d.ts +10 -2
- 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 +7 -4
- package/dist/authorization/index.js.map +1 -1
- package/dist/bootstrap/discovery.d.ts +7 -1
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.js +46 -39
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
- package/dist/chunk-19jp6g9d.js +131 -0
- package/dist/chunk-19jp6g9d.js.map +11 -0
- package/dist/{chunk-x0qhkqje.js → chunk-2dw777qw.js} +50 -5
- package/dist/{chunk-x0qhkqje.js.map → chunk-2dw777qw.js.map} +4 -3
- package/dist/chunk-359jm1jw.js +147 -0
- package/dist/chunk-359jm1jw.js.map +10 -0
- package/dist/{chunk-2b5qtban.js → chunk-3xep5cjx.js} +56 -21
- package/dist/chunk-3xep5cjx.js.map +15 -0
- package/dist/{chunk-qjycjdj6.js → chunk-3z1qec12.js} +6 -8
- package/dist/{chunk-qjycjdj6.js.map → chunk-3z1qec12.js.map} +2 -2
- package/dist/{chunk-5jcdmjam.js → chunk-4jjp5k14.js} +1 -1
- package/dist/{chunk-n2arzn6e.js → chunk-4qfkag59.js} +44 -221
- package/dist/chunk-4qfkag59.js.map +20 -0
- package/dist/{chunk-rre42skh.js → chunk-4sm0aznx.js} +515 -80
- package/dist/{chunk-rre42skh.js.map → chunk-4sm0aznx.js.map} +11 -7
- package/dist/chunk-4yqmp43v.js +159 -0
- package/dist/chunk-4yqmp43v.js.map +11 -0
- package/dist/{chunk-atmkaf60.js → chunk-5e3pq99w.js} +2 -6
- package/dist/{chunk-atmkaf60.js.map → chunk-5e3pq99w.js.map} +3 -3
- package/dist/{chunk-agsvg9ar.js → chunk-5ntny1qx.js} +1 -1
- package/dist/{chunk-z2sery1b.js → chunk-9nbmsvn5.js} +60 -20
- package/dist/chunk-9nbmsvn5.js.map +11 -0
- package/dist/{chunk-e4rvtvpw.js → chunk-aa2pen2v.js} +250 -78
- package/dist/chunk-aa2pen2v.js.map +34 -0
- package/dist/{chunk-64sr682n.js → chunk-ajnan18g.js} +11 -8
- package/dist/chunk-ajnan18g.js.map +12 -0
- package/dist/{chunk-9aehf39w.js → chunk-f26bck4t.js} +4 -4
- package/dist/{chunk-7ds9620f.js → chunk-fvt9rjsa.js} +23 -7
- package/dist/chunk-fvt9rjsa.js.map +10 -0
- package/dist/{chunk-kt81c11h.js → chunk-gbejpkex.js} +5 -5
- package/dist/{chunk-kt81c11h.js.map → chunk-gbejpkex.js.map} +1 -1
- package/dist/{chunk-vjjv9mrb.js → chunk-gzasd5b6.js} +5 -5
- package/dist/{chunk-vjjv9mrb.js.map → chunk-gzasd5b6.js.map} +3 -3
- package/dist/{chunk-d63tybny.js → chunk-h0k55pc7.js} +4 -4
- package/dist/{chunk-d63tybny.js.map → chunk-h0k55pc7.js.map} +1 -1
- package/dist/chunk-h5vqbfmd.js +1537 -0
- package/dist/chunk-h5vqbfmd.js.map +19 -0
- package/dist/{chunk-3kv70xwp.js → chunk-j1sbhm7p.js} +18 -2
- package/dist/chunk-j1sbhm7p.js.map +10 -0
- package/dist/{chunk-hdz94br2.js → chunk-k522z7v6.js} +10 -5
- package/dist/chunk-k522z7v6.js.map +10 -0
- package/dist/{chunk-wjgm6jjt.js → chunk-mth82m8t.js} +128 -94
- package/dist/chunk-mth82m8t.js.map +14 -0
- package/dist/{chunk-qv38twt8.js → chunk-mwsxn98e.js} +46 -25
- package/dist/{chunk-qv38twt8.js.map → chunk-mwsxn98e.js.map} +6 -6
- package/dist/chunk-n4khvw9n.js +111 -0
- package/dist/chunk-n4khvw9n.js.map +11 -0
- package/dist/{chunk-qjzp9xyb.js → chunk-nn0tekr1.js} +6 -8
- package/dist/chunk-nn0tekr1.js.map +12 -0
- package/dist/chunk-nx7k8tpr.js +436 -0
- package/dist/chunk-nx7k8tpr.js.map +12 -0
- package/dist/{chunk-08twe8m6.js → chunk-p1rzczbt.js} +1 -1
- package/dist/{chunk-37wk412q.js → chunk-p1x242ad.js} +587 -70
- package/dist/chunk-p1x242ad.js.map +25 -0
- package/dist/{chunk-tn7xcs2n.js → chunk-pc7ys28c.js} +68 -5
- package/dist/chunk-pc7ys28c.js.map +14 -0
- package/dist/{chunk-3fqt22c4.js → chunk-q0k9nc5a.js} +280 -88
- package/dist/chunk-q0k9nc5a.js.map +14 -0
- package/dist/chunk-r8jrnexe.js +403 -0
- package/dist/chunk-r8jrnexe.js.map +10 -0
- package/dist/{chunk-gbrpsx4m.js → chunk-rafagrwr.js} +30 -2
- package/dist/chunk-rafagrwr.js.map +11 -0
- package/dist/{chunk-xdpwpkha.js → chunk-rv2hkwwa.js} +1 -1
- package/dist/{chunk-6ed5bwnd.js → chunk-sbzzr4kx.js} +1203 -691
- package/dist/{chunk-6ed5bwnd.js.map → chunk-sbzzr4kx.js.map} +15 -9
- package/dist/{chunk-d2ndstdf.js → chunk-v1xppd0y.js} +13 -11
- package/dist/{chunk-d2ndstdf.js.map → chunk-v1xppd0y.js.map} +2 -2
- package/dist/chunk-v4en4jc2.js +252 -0
- package/dist/chunk-v4en4jc2.js.map +10 -0
- package/dist/{chunk-1kamz6j0.js → chunk-w1tvjszy.js} +1 -1
- package/dist/{chunk-rp1mvzb4.js → chunk-w9tg6yyb.js} +11 -6
- package/dist/{chunk-rp1mvzb4.js.map → chunk-w9tg6yyb.js.map} +3 -3
- package/dist/{chunk-4nxeacx7.js → chunk-wdage1eb.js} +1 -1
- package/dist/{chunk-ha58tjtt.js → chunk-wtf06et8.js} +9 -5
- package/dist/{chunk-ha58tjtt.js.map → chunk-wtf06et8.js.map} +3 -3
- package/dist/{chunk-h0knpbz5.js → chunk-xajtptbw.js} +782 -211
- package/dist/chunk-xajtptbw.js.map +40 -0
- package/dist/{chunk-xc7hq65b.js → chunk-yp8ee62z.js} +49 -2
- package/dist/chunk-yp8ee62z.js.map +11 -0
- package/dist/chunk-z4ccwbkz.js +139 -0
- package/dist/chunk-z4ccwbkz.js.map +10 -0
- package/dist/datasets/builders.d.ts +11 -2
- package/dist/datasets/builders.d.ts.map +1 -1
- package/dist/datasets/changes.d.ts +14 -4
- package/dist/datasets/changes.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +15 -1
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/index.d.ts +1 -0
- package/dist/datasets/index.d.ts.map +1 -1
- package/dist/datasets/sequence.d.ts +7 -0
- package/dist/datasets/sequence.d.ts.map +1 -0
- package/dist/datasets/types.d.ts +1 -0
- package/dist/datasets/types.d.ts.map +1 -1
- package/dist/datasets/validation.d.ts.map +1 -1
- package/dist/datasets/write.d.ts +37 -0
- package/dist/datasets/write.d.ts.map +1 -0
- package/dist/datasets/write.js +17 -0
- package/dist/datasets/write.js.map +9 -0
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/types/datasets.d.ts +2 -6
- package/dist/events/types/datasets.d.ts.map +1 -1
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +39 -32
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +58 -20
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +69 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -0
- package/dist/execution/durable.d.ts.map +1 -1
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/primitive.js +39 -32
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.d.ts +11 -0
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +76 -40
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/scopes.d.ts +16 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/types.d.ts +9 -0
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts +2 -0
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -78
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/definition-updates.d.ts.map +1 -1
- package/dist/lake-storage/errors.d.ts +5 -1
- package/dist/lake-storage/errors.d.ts.map +1 -1
- package/dist/lake-storage/in-memory.d.ts +1 -0
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +6 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +24 -7
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/merge-validation.d.ts.map +1 -1
- package/dist/lake-storage/merge.d.ts +13 -2
- package/dist/lake-storage/merge.d.ts.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +19 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -0
- package/dist/lake-storage/sql-transforms.d.ts +2 -1
- package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +10 -5
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/lake-storage/version-inputs.d.ts +4 -0
- package/dist/lake-storage/version-inputs.d.ts.map +1 -0
- package/dist/materializer/index.js +25 -22
- package/dist/materializer/index.js.map +1 -1
- package/dist/objects/authorized-ontology-view.d.ts +25 -0
- package/dist/objects/authorized-ontology-view.d.ts.map +1 -0
- package/dist/objects/execution.d.ts +1 -1
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +29 -26
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/link/authorization.d.ts +2 -7
- package/dist/objects/link/authorization.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +4 -2
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.js +24 -21
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/links.d.ts +22 -1
- package/dist/objects/query/links.d.ts.map +1 -1
- package/dist/objects/query/selected-read-admission.d.ts +27 -0
- package/dist/objects/query/selected-read-admission.d.ts.map +1 -0
- package/dist/objects/query/validate.d.ts +60 -2
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/object-handle.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +2 -7
- 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/list-service.d.ts +2 -3
- package/dist/objects/service/list-service.d.ts.map +1 -1
- package/dist/objects/telemetry/history.d.ts +8 -6
- package/dist/objects/telemetry/history.d.ts.map +1 -1
- package/dist/objects/telemetry/index.d.ts +2 -2
- package/dist/objects/telemetry/index.d.ts.map +1 -1
- package/dist/objects/telemetry/workload.d.ts +11 -0
- package/dist/objects/telemetry/workload.d.ts.map +1 -0
- package/dist/ontology/index.d.ts +2 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +13 -12
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/inference/index.d.ts +2 -1
- package/dist/ontology/inference/index.d.ts.map +1 -1
- package/dist/ontology/internal.d.ts +0 -1
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +5 -10
- package/dist/ontology/internal.js.map +3 -3
- package/dist/ontology/json-schema.d.ts +10 -6
- package/dist/ontology/json-schema.d.ts.map +1 -1
- package/dist/ontology/link-path-selection.d.ts +35 -0
- package/dist/ontology/link-path-selection.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +2 -0
- package/dist/ontology/refs.d.ts.map +1 -1
- package/dist/ontology/tokens.d.ts +2 -1
- package/dist/ontology/tokens.d.ts.map +1 -1
- package/dist/pipelines/execution.d.ts.map +1 -1
- package/dist/pipelines/index.js +27 -24
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/request.d.ts.map +1 -1
- package/dist/projections/execution.d.ts.map +1 -1
- package/dist/projections/internal.js +25 -22
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/rules/execution.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +4 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +2 -0
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +2 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +2 -0
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +4 -0
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +3 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/schedules/execution.d.ts +2 -1
- package/dist/schedules/execution.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 +7 -2
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +1 -0
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +7 -1
- 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/shares/access-plan.d.ts +22 -0
- package/dist/shares/access-plan.d.ts.map +1 -0
- package/dist/shares/builders.d.ts +14 -0
- package/dist/shares/builders.d.ts.map +1 -0
- package/dist/shares/compiler.d.ts +14 -0
- package/dist/shares/compiler.d.ts.map +1 -0
- package/dist/shares/errors.d.ts +4 -0
- package/dist/shares/errors.d.ts.map +1 -0
- package/dist/shares/execution.d.ts +57 -0
- package/dist/shares/execution.d.ts.map +1 -0
- package/dist/shares/index.d.ts +10 -0
- package/dist/shares/index.d.ts.map +1 -0
- package/dist/shares/internal.d.ts +3 -0
- package/dist/shares/internal.d.ts.map +1 -0
- package/dist/shares/internal.js +239 -0
- package/dist/shares/internal.js.map +10 -0
- package/dist/shares/intersection.d.ts +9 -0
- package/dist/shares/intersection.d.ts.map +1 -0
- package/dist/shares/session-protocol.d.ts +41 -0
- package/dist/shares/session-protocol.d.ts.map +1 -0
- package/dist/shares/types.d.ts +51 -0
- package/dist/shares/types.d.ts.map +1 -0
- package/dist/shares/validation.d.ts +11 -0
- package/dist/shares/validation.d.ts.map +1 -0
- package/dist/storage/action-runs/provider.js +2 -2
- package/dist/storage/agents/provider.js +2 -2
- package/dist/storage/executions/in-memory.d.ts +3 -0
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +4 -1
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +23 -3
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/run-link.d.ts +7 -0
- package/dist/storage/executions/run-link.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts +6 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts +8 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +8 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +65 -36
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/objects/execution-limits.d.ts +25 -0
- package/dist/storage/objects/execution-limits.d.ts.map +1 -0
- package/dist/storage/objects/guard.d.ts +16 -0
- package/dist/storage/objects/guard.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/index.d.ts +3 -0
- package/dist/storage/objects/in-memory/index.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/keys.d.ts +10 -0
- package/dist/storage/objects/in-memory/keys.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/query.d.ts +31 -0
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/read-scope.d.ts +18 -0
- package/dist/storage/objects/in-memory/read-scope.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/read-source.d.ts +10 -0
- package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/selected-reader.d.ts +9 -0
- package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -0
- package/dist/storage/objects/{in-memory.d.ts → in-memory/storage.d.ts} +13 -10
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -0
- package/dist/storage/objects/index.d.ts +4 -1
- package/dist/storage/objects/index.d.ts.map +1 -1
- package/dist/storage/objects/keys.d.ts +1 -1
- package/dist/storage/objects/keys.d.ts.map +1 -1
- package/dist/storage/objects/read-scope.d.ts +25 -0
- package/dist/storage/objects/read-scope.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +114 -22
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts +3 -0
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +4 -2
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +2 -2
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/share-grants/errors.d.ts +8 -0
- package/dist/storage/share-grants/errors.d.ts.map +1 -0
- package/dist/storage/share-grants/in-memory.d.ts +11 -0
- package/dist/storage/share-grants/in-memory.d.ts.map +1 -0
- package/dist/storage/share-grants/index.d.ts +5 -0
- package/dist/storage/share-grants/index.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.d.ts +4 -0
- package/dist/storage/share-grants/provider.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.js +24 -0
- package/dist/storage/share-grants/provider.js.map +9 -0
- package/dist/storage/share-grants/record.d.ts +11 -0
- package/dist/storage/share-grants/record.d.ts.map +1 -0
- package/dist/storage/share-grants/types.d.ts +97 -0
- package/dist/storage/share-grants/types.d.ts.map +1 -0
- package/dist/storage/share-sessions/errors.d.ts +8 -0
- package/dist/storage/share-sessions/errors.d.ts.map +1 -0
- package/dist/storage/share-sessions/in-memory.d.ts +14 -0
- package/dist/storage/share-sessions/in-memory.d.ts.map +1 -0
- package/dist/storage/share-sessions/index.d.ts +5 -0
- package/dist/storage/share-sessions/index.d.ts.map +1 -0
- package/dist/storage/share-sessions/provider.d.ts +3 -0
- package/dist/storage/share-sessions/provider.d.ts.map +1 -0
- package/dist/storage/share-sessions/provider.js +20 -0
- package/dist/storage/share-sessions/provider.js.map +9 -0
- package/dist/storage/share-sessions/record.d.ts +8 -0
- package/dist/storage/share-sessions/record.d.ts.map +1 -0
- package/dist/storage/share-sessions/types.d.ts +50 -0
- package/dist/storage/share-sessions/types.d.ts.map +1 -0
- package/dist/storage/sync-runs/provider.js +2 -2
- package/dist/storage/transaction.d.ts +2 -1
- package/dist/storage/transaction.d.ts.map +1 -1
- package/dist/storage/types.d.ts +8 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.js +2 -2
- package/dist/storage/workflow-runs/provider.js +10 -7
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.js +27 -24
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/testing/dataset-sequence-contract.d.ts +4 -0
- package/dist/testing/dataset-sequence-contract.d.ts.map +1 -0
- package/dist/testing/effective-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts +4 -0
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2555 -908
- package/dist/testing/index.js.map +11 -7
- package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
- package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-read-scope-contract.d.ts +22 -0
- package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
- package/dist/testing/share-grant-storage-contract.d.ts +10 -0
- package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
- package/dist/testing/share-session-storage-contract.d.ts +9 -0
- package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
- package/dist/webhooks/internal.js +24 -21
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/index.js +42 -35
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/package.json +25 -1
- package/src/actions/delegated-admission.ts +72 -0
- package/src/actions/descriptor.ts +58 -0
- package/src/actions/execution.ts +99 -24
- package/src/actions/request.ts +136 -19
- package/src/actions/run-authorization.ts +53 -0
- package/src/actions/run-dispatch.ts +8 -1
- package/src/agents/adapters.ts +30 -420
- package/src/agents/authority.ts +3 -4
- package/src/agents/context-resolution.ts +1 -4
- package/src/agents/errors.ts +0 -10
- package/src/agents/execution.ts +13 -5
- package/src/agents/identity.ts +4 -0
- package/src/agents/index.ts +1 -20
- package/src/agents/message.ts +4 -5
- package/src/agents/model-loop.ts +54 -6
- package/src/agents/request.ts +16 -3
- package/src/agents/tool-definition.ts +0 -19
- package/src/agents/validation.ts +6 -65
- package/src/ai-usage/execution.ts +4 -11
- package/src/authorization/decision.ts +29 -14
- package/src/authorization/grant-kinds.ts +10 -0
- package/src/authorization/index.ts +1 -0
- package/src/bootstrap/discovery.ts +3 -0
- package/src/bootstrap/ontology-type-manifest.ts +12 -6
- package/src/datasets/builders.ts +23 -2
- package/src/datasets/changes.ts +16 -4
- package/src/datasets/execution.ts +76 -5
- package/src/datasets/index.ts +1 -0
- package/src/datasets/sequence.ts +77 -0
- package/src/datasets/types.ts +1 -0
- package/src/datasets/validation.ts +26 -0
- package/src/datasets/write.ts +240 -0
- package/src/events/execution.ts +57 -7
- package/src/events/types/datasets.ts +2 -6
- package/src/execution/agent.ts +1 -4
- package/src/execution/authorization.ts +470 -90
- package/src/execution/authorized-object-reader.ts +695 -0
- package/src/execution/durable.ts +10 -2
- package/src/execution/index.ts +1 -0
- package/src/execution/request.ts +63 -13
- package/src/execution/scopes.ts +36 -6
- package/src/execution/types.ts +8 -0
- package/src/http/api-routes.ts +45 -0
- package/src/index.ts +36 -15
- package/src/lake-storage/definition-updates.ts +9 -0
- package/src/lake-storage/errors.ts +6 -1
- package/src/lake-storage/in-memory.ts +53 -17
- package/src/lake-storage/index.ts +10 -1
- package/src/lake-storage/merge-validation.ts +12 -2
- package/src/lake-storage/merge.ts +40 -2
- package/src/lake-storage/source-ordering.ts +95 -0
- package/src/lake-storage/sql-transforms.ts +2 -1
- package/src/lake-storage/types.ts +10 -5
- package/src/lake-storage/version-inputs.ts +14 -0
- package/src/objects/authorized-ontology-view.ts +512 -0
- package/src/objects/execution.ts +98 -143
- package/src/objects/link/authorization.ts +3 -2
- package/src/objects/query/executor.ts +45 -34
- package/src/objects/query/links.ts +84 -25
- package/src/objects/query/selected-read-admission.ts +310 -0
- package/src/objects/query/validate.ts +353 -36
- package/src/objects/sdk/object-handle.ts +2 -8
- package/src/objects/sdk/object-set.ts +10 -11
- package/src/objects/sdk/runtime-query-executor.ts +8 -28
- package/src/objects/sdk/telemetry-channel.ts +11 -7
- package/src/objects/service/list-service.ts +15 -29
- package/src/objects/telemetry/history.ts +297 -17
- package/src/objects/telemetry/index.ts +2 -2
- package/src/objects/telemetry/workload.ts +79 -0
- package/src/ontology/index.ts +7 -1
- package/src/ontology/inference/index.ts +4 -1
- package/src/ontology/internal.ts +0 -1
- package/src/ontology/json-schema.ts +13 -12
- package/src/ontology/link-path-selection.ts +193 -0
- package/src/ontology/refs.ts +19 -0
- package/src/ontology/tokens.ts +15 -8
- package/src/pipelines/execution.ts +30 -7
- package/src/pipelines/request.ts +5 -0
- package/src/projections/execution.ts +72 -11
- package/src/projections/run-dispatch.ts +6 -12
- package/src/rules/execution.ts +20 -8
- package/src/runtime/create.ts +5 -1
- package/src/runtime/definitions.ts +2 -0
- package/src/runtime/host.ts +25 -6
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +9 -0
- package/src/runtime/sixb.ts +23 -2
- package/src/runtime/types.ts +3 -0
- package/src/schedules/execution.ts +24 -2
- package/src/security/every.ts +4 -0
- package/src/security/grants.ts +45 -3
- package/src/security/index.ts +1 -0
- package/src/security/registry.ts +3 -0
- package/src/security/types.ts +8 -0
- package/src/security/validation.ts +3 -0
- package/src/shares/access-plan.ts +225 -0
- package/src/shares/builders.ts +381 -0
- package/src/shares/compiler.ts +359 -0
- package/src/shares/errors.ts +3 -0
- package/src/shares/execution.ts +394 -0
- package/src/shares/index.ts +28 -0
- package/src/shares/internal.ts +9 -0
- package/src/shares/intersection.ts +178 -0
- package/src/shares/session-protocol.ts +258 -0
- package/src/shares/types.ts +76 -0
- package/src/shares/validation.ts +40 -0
- package/src/storage/executions/in-memory.ts +9 -1
- package/src/storage/executions/provider.ts +30 -1
- package/src/storage/executions/run-link.ts +29 -0
- package/src/storage/executions/validation.ts +46 -1
- package/src/storage/in-memory/index.ts +21 -2
- package/src/storage/index.ts +51 -0
- package/src/storage/objects/execution-limits.ts +283 -0
- package/src/storage/objects/guard.ts +55 -0
- package/src/storage/objects/in-memory/index.ts +2 -0
- package/src/storage/objects/in-memory/keys.ts +46 -0
- package/src/storage/objects/in-memory/query.ts +754 -0
- package/src/storage/objects/in-memory/read-scope.ts +211 -0
- package/src/storage/objects/in-memory/read-source.ts +10 -0
- package/src/storage/objects/in-memory/selected-reader.ts +252 -0
- package/src/storage/objects/in-memory/storage.ts +589 -0
- package/src/storage/objects/index.ts +21 -0
- package/src/storage/objects/keys.ts +1 -1
- package/src/storage/objects/read-scope.ts +672 -0
- package/src/storage/objects/types.ts +123 -19
- package/src/storage/operation-scope.ts +16 -0
- package/src/storage/share-grants/errors.ts +14 -0
- package/src/storage/share-grants/in-memory.ts +107 -0
- package/src/storage/share-grants/index.ts +14 -0
- package/src/storage/share-grants/provider.ts +11 -0
- package/src/storage/share-grants/record.ts +347 -0
- package/src/storage/share-grants/types.ts +112 -0
- package/src/storage/share-sessions/errors.ts +14 -0
- package/src/storage/share-sessions/in-memory.ts +105 -0
- package/src/storage/share-sessions/index.ts +11 -0
- package/src/storage/share-sessions/provider.ts +9 -0
- package/src/storage/share-sessions/record.ts +176 -0
- package/src/storage/share-sessions/types.ts +57 -0
- package/src/storage/transaction.ts +14 -2
- package/src/storage/types.ts +27 -0
- package/src/syncs/execution.ts +25 -5
- package/src/syncs/request.ts +5 -0
- package/src/testing/dataset-sequence-contract.ts +373 -0
- package/src/testing/effective-storage-contract.ts +34 -0
- package/src/testing/execution-storage-contract.ts +79 -0
- package/src/testing/index.ts +16 -0
- package/src/testing/lake-merge-storage-contract.ts +3 -0
- package/src/testing/lake-storage-contract.ts +58 -0
- package/src/testing/object-read-scope-contract.ts +939 -0
- package/src/testing/share-grant-storage-contract.ts +325 -0
- package/src/testing/share-session-storage-contract.ts +235 -0
- package/src/workflows/execution.ts +53 -14
- package/src/workflows/request.ts +5 -0
- package/dist/chunk-2b5qtban.js.map +0 -14
- package/dist/chunk-37wk412q.js.map +0 -23
- package/dist/chunk-3fqt22c4.js.map +0 -14
- package/dist/chunk-3kv70xwp.js.map +0 -10
- package/dist/chunk-64sr682n.js.map +0 -12
- package/dist/chunk-7ds9620f.js.map +0 -10
- package/dist/chunk-dqn23610.js +0 -72
- package/dist/chunk-dqn23610.js.map +0 -11
- package/dist/chunk-e4rvtvpw.js.map +0 -34
- package/dist/chunk-gbrpsx4m.js.map +0 -11
- package/dist/chunk-h0knpbz5.js.map +0 -38
- package/dist/chunk-hdz94br2.js.map +0 -10
- package/dist/chunk-n2arzn6e.js.map +0 -20
- package/dist/chunk-qjzp9xyb.js.map +0 -12
- package/dist/chunk-tn7xcs2n.js.map +0 -13
- package/dist/chunk-wjgm6jjt.js.map +0 -13
- package/dist/chunk-xc7hq65b.js.map +0 -10
- package/dist/chunk-y35ma3mj.js +0 -551
- package/dist/chunk-y35ma3mj.js.map +0 -15
- package/dist/chunk-z2sery1b.js.map +0 -11
- package/dist/storage/objects/in-memory.d.ts.map +0 -1
- package/src/storage/objects/in-memory.ts +0 -1241
- /package/dist/{chunk-5jcdmjam.js.map → chunk-4jjp5k14.js.map} +0 -0
- /package/dist/{chunk-agsvg9ar.js.map → chunk-5ntny1qx.js.map} +0 -0
- /package/dist/{chunk-9aehf39w.js.map → chunk-f26bck4t.js.map} +0 -0
- /package/dist/{chunk-08twe8m6.js.map → chunk-p1rzczbt.js.map} +0 -0
- /package/dist/{chunk-xdpwpkha.js.map → chunk-rv2hkwwa.js.map} +0 -0
- /package/dist/{chunk-1kamz6j0.js.map → chunk-w1tvjszy.js.map} +0 -0
- /package/dist/{chunk-4nxeacx7.js.map → chunk-wdage1eb.js.map} +0 -0
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
validateSchemaOrRefValue
|
|
4
|
+
} from "./chunk-2dw777qw.js";
|
|
5
|
+
import {
|
|
6
|
+
snapshotLinkPathSelection
|
|
7
|
+
} from "./chunk-19jp6g9d.js";
|
|
2
8
|
import {
|
|
3
9
|
AuthRuntimeError,
|
|
4
10
|
assertNonEmpty,
|
|
@@ -17,7 +23,14 @@ import {
|
|
|
17
23
|
grantKindOf,
|
|
18
24
|
resolveAuthorizationContext,
|
|
19
25
|
resolveRoleGrants
|
|
20
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-p1x242ad.js";
|
|
27
|
+
import {
|
|
28
|
+
coerceSchemaValueToTyped,
|
|
29
|
+
normalizeSchemaValue
|
|
30
|
+
} from "./chunk-h0k55pc7.js";
|
|
31
|
+
import {
|
|
32
|
+
OntologyValidationError
|
|
33
|
+
} from "./chunk-dktq02ne.js";
|
|
21
34
|
|
|
22
35
|
// src/auth/access-tokens.ts
|
|
23
36
|
import { createHash, randomBytes, randomUUID } from "crypto";
|
|
@@ -210,6 +223,7 @@ var GRANT_CAPABILITIES = Object.keys({
|
|
|
210
223
|
edit: true,
|
|
211
224
|
append: true,
|
|
212
225
|
apply: true,
|
|
226
|
+
share: true,
|
|
213
227
|
run: true,
|
|
214
228
|
observe: true,
|
|
215
229
|
manage: true
|
|
@@ -544,7 +558,8 @@ var BREADTH_TARGETS = [
|
|
|
544
558
|
"sync",
|
|
545
559
|
"pipeline",
|
|
546
560
|
"application",
|
|
547
|
-
"connector"
|
|
561
|
+
"connector",
|
|
562
|
+
"share"
|
|
548
563
|
];
|
|
549
564
|
function isBreadthSelector(value) {
|
|
550
565
|
if (typeof value !== "object" || value === null)
|
|
@@ -578,8 +593,405 @@ var every = {
|
|
|
578
593
|
sync: () => all("sync"),
|
|
579
594
|
pipeline: () => all("pipeline"),
|
|
580
595
|
application: () => all("application"),
|
|
581
|
-
connector: () => all("connector")
|
|
596
|
+
connector: () => all("connector"),
|
|
597
|
+
share: () => all("share")
|
|
582
598
|
};
|
|
599
|
+
// src/actions/errors.ts
|
|
600
|
+
class ActionDefinitionError extends Error {
|
|
601
|
+
name = "ActionDefinitionError";
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
class ActionEditCommitError extends Error {
|
|
605
|
+
name = "ActionEditCommitError";
|
|
606
|
+
}
|
|
607
|
+
function missingActionMutationMessage(actionId) {
|
|
608
|
+
return `Action "${actionId}" must declare .writeback(...) or .edits(...).`;
|
|
609
|
+
}
|
|
610
|
+
function effectsWithoutEditsMessage(actionId) {
|
|
611
|
+
return `Action "${actionId}" cannot declare .effects(...) without .edits(...).`;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// src/actions/validation.ts
|
|
615
|
+
function assertNonEmpty2(value, field) {
|
|
616
|
+
if (!value.trim()) {
|
|
617
|
+
throw new ActionDefinitionError(`Action ${field} must not be empty.`);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function isActionDefinition(value) {
|
|
621
|
+
const binding = value?.binding;
|
|
622
|
+
return typeof value === "object" && value !== null && value.kind === "action" && (binding?.kind === "global" || binding?.kind === "object");
|
|
623
|
+
}
|
|
624
|
+
function isGlobalActionDefinition(value) {
|
|
625
|
+
return value.binding.kind === "global";
|
|
626
|
+
}
|
|
627
|
+
function isObjectActionDefinition(value) {
|
|
628
|
+
return value.binding.kind === "object";
|
|
629
|
+
}
|
|
630
|
+
function normalizeActionParams(runtime, paramsConfig, params, pathPrefix) {
|
|
631
|
+
const knownParamIds = new Set(Object.keys(paramsConfig));
|
|
632
|
+
const normalized = {};
|
|
633
|
+
for (const paramId of Object.keys(params)) {
|
|
634
|
+
if (!knownParamIds.has(paramId)) {
|
|
635
|
+
throw new OntologyValidationError(`Unknown param '${paramId}' for action '${pathPrefix}'`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
|
|
639
|
+
const value = params[paramId];
|
|
640
|
+
if (value === undefined) {
|
|
641
|
+
if (paramDef.required) {
|
|
642
|
+
throw new OntologyValidationError(`Missing required param '${paramId}' for action '${pathPrefix}'`);
|
|
643
|
+
}
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if (value === null) {
|
|
647
|
+
if (!paramDef.nullable) {
|
|
648
|
+
throw new OntologyValidationError(`[Sixb] Action param ${pathPrefix}.${paramId} cannot be null`);
|
|
649
|
+
}
|
|
650
|
+
normalized[paramId] = null;
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
validateSchemaOrRefValue(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
|
|
654
|
+
normalized[paramId] = normalizeSchemaOrRefValue(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
|
|
655
|
+
}
|
|
656
|
+
return normalized;
|
|
657
|
+
}
|
|
658
|
+
function coerceActionParamsToTyped(paramsConfig, params, valueTypesById) {
|
|
659
|
+
const coerced = { ...params };
|
|
660
|
+
for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
|
|
661
|
+
const value = params[paramId];
|
|
662
|
+
if (value === undefined)
|
|
663
|
+
continue;
|
|
664
|
+
const schema = paramDef.schema;
|
|
665
|
+
if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
coerced[paramId] = coerceSchemaValueToTyped(schema, value, valueTypesById);
|
|
669
|
+
}
|
|
670
|
+
return coerced;
|
|
671
|
+
}
|
|
672
|
+
function validateActionSubject(action, subject) {
|
|
673
|
+
if (isGlobalActionDefinition(action) && subject.kind !== "none") {
|
|
674
|
+
throw new OntologyValidationError(`Action '${action.id}' does not accept an object subject.`);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function resolveObjectActionSubject(params) {
|
|
678
|
+
const { runtime, action, subject } = params;
|
|
679
|
+
if (subject.kind !== "object") {
|
|
680
|
+
throw new OntologyValidationError(`Action '${action.id}' requires an object subject.`);
|
|
681
|
+
}
|
|
682
|
+
const objectType = runtime.ontology.resolveObjectType(subject.objectTypeId);
|
|
683
|
+
if (!actionAppliesToObjectType(runtime, action, objectType)) {
|
|
684
|
+
throw new OntologyValidationError(`Action '${action.id}' is not valid for object type '${objectType.id}'.`);
|
|
685
|
+
}
|
|
686
|
+
return objectType;
|
|
687
|
+
}
|
|
688
|
+
function actionAppliesToObjectType(runtime, action, objectType) {
|
|
689
|
+
return runtime.actionRegistry.listForType(objectType).some((candidate) => candidate.id === action.id);
|
|
690
|
+
}
|
|
691
|
+
function normalizeSchemaOrRefValue(schema, value, path, valueTypesById) {
|
|
692
|
+
if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
|
|
693
|
+
const refValue = value;
|
|
694
|
+
return {
|
|
695
|
+
objectTypeId: refValue.objectTypeId,
|
|
696
|
+
primaryId: refValue.primaryId
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
return normalizeSchemaValue(schema, value, path, valueTypesById);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// src/shares/errors.ts
|
|
703
|
+
class ShareDefinitionError extends Error {
|
|
704
|
+
name = "ShareDefinitionError";
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// src/shares/builders.ts
|
|
708
|
+
var shareTargets = new WeakSet;
|
|
709
|
+
function defineShare(id, options) {
|
|
710
|
+
assertNonEmpty3(id, "Share id");
|
|
711
|
+
if (!isObjectType(options.target)) {
|
|
712
|
+
throw invalid(`Share '${id}' target must be an object type.`);
|
|
713
|
+
}
|
|
714
|
+
if (typeof options.grants !== "function") {
|
|
715
|
+
throw invalid(`Share '${id}' grants must be a function.`);
|
|
716
|
+
}
|
|
717
|
+
if (options.description !== undefined && typeof options.description !== "string") {
|
|
718
|
+
throw invalid(`Share '${id}' description must be a string.`);
|
|
719
|
+
}
|
|
720
|
+
const target = createShareTarget(options.target.id);
|
|
721
|
+
let authoredGrants;
|
|
722
|
+
try {
|
|
723
|
+
authoredGrants = options.grants({ target });
|
|
724
|
+
} catch (error) {
|
|
725
|
+
if (error instanceof ShareDefinitionError)
|
|
726
|
+
throw error;
|
|
727
|
+
const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
|
|
728
|
+
throw invalid(`Share '${id}' grants are invalid: ${reason}`);
|
|
729
|
+
}
|
|
730
|
+
if (!Array.isArray(authoredGrants) || authoredGrants.length === 0) {
|
|
731
|
+
throw invalid(`Share '${id}' must declare at least one grant.`);
|
|
732
|
+
}
|
|
733
|
+
const grants = snapshotShareGrants(id, options.target.id, authoredGrants);
|
|
734
|
+
return Object.freeze({
|
|
735
|
+
kind: "share",
|
|
736
|
+
id,
|
|
737
|
+
target: Object.freeze({ kind: "object", objectTypeId: options.target.id }),
|
|
738
|
+
grants,
|
|
739
|
+
...options.description === undefined ? {} : { description: options.description }
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
function isShareDefinition(value) {
|
|
743
|
+
if (!isRecord2(value) || value.kind !== "share" || !isNonEmpty(value.id))
|
|
744
|
+
return false;
|
|
745
|
+
if (!isRecord2(value.target) || value.target.kind !== "object" || !isNonEmpty(value.target.objectTypeId)) {
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
return Array.isArray(value.grants);
|
|
749
|
+
}
|
|
750
|
+
function snapshotShareDefinition(value) {
|
|
751
|
+
try {
|
|
752
|
+
if (!isRecord2(value)) {
|
|
753
|
+
throw invalid("Share definition kind must be 'share'.");
|
|
754
|
+
}
|
|
755
|
+
const kind = value.kind;
|
|
756
|
+
const authoredId = value.id;
|
|
757
|
+
const target = value.target;
|
|
758
|
+
const authoredGrants = value.grants;
|
|
759
|
+
const description = value.description;
|
|
760
|
+
if (kind !== "share") {
|
|
761
|
+
throw invalid("Share definition kind must be 'share'.");
|
|
762
|
+
}
|
|
763
|
+
const id = nonEmpty(authoredId, "Share id");
|
|
764
|
+
if (!isRecord2(target)) {
|
|
765
|
+
throw invalid(`Share '${id}' target must be an object type.`);
|
|
766
|
+
}
|
|
767
|
+
const targetKind = target.kind;
|
|
768
|
+
const authoredObjectTypeId = target.objectTypeId;
|
|
769
|
+
if (targetKind !== "object" || !isNonEmpty(authoredObjectTypeId)) {
|
|
770
|
+
throw invalid(`Share '${id}' target must be an object type.`);
|
|
771
|
+
}
|
|
772
|
+
if (!Array.isArray(authoredGrants) || authoredGrants.length === 0) {
|
|
773
|
+
throw invalid(`Share '${id}' must declare grants.`);
|
|
774
|
+
}
|
|
775
|
+
if (description !== undefined && typeof description !== "string") {
|
|
776
|
+
throw invalid(`Share '${id}' description must be a string.`);
|
|
777
|
+
}
|
|
778
|
+
const objectTypeId = authoredObjectTypeId;
|
|
779
|
+
return Object.freeze({
|
|
780
|
+
kind: "share",
|
|
781
|
+
id,
|
|
782
|
+
target: Object.freeze({ kind: "object", objectTypeId }),
|
|
783
|
+
grants: snapshotShareGrants(id, objectTypeId, authoredGrants),
|
|
784
|
+
...description === undefined ? {} : { description }
|
|
785
|
+
});
|
|
786
|
+
} catch (error) {
|
|
787
|
+
if (error instanceof ShareDefinitionError)
|
|
788
|
+
throw error;
|
|
789
|
+
const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
|
|
790
|
+
throw invalid(`Share definition is invalid: ${reason}`);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
function isShareTarget(value) {
|
|
794
|
+
return typeof value === "object" && value !== null && shareTargets.has(value);
|
|
795
|
+
}
|
|
796
|
+
function createShareViewGrant(target) {
|
|
797
|
+
assertShareTarget(target);
|
|
798
|
+
return createShareViewGrantWithLinks(target.objectTypeId, Object.freeze({ kind: "none" }));
|
|
799
|
+
}
|
|
800
|
+
function createShareActionGrant(action, target) {
|
|
801
|
+
assertShareTarget(target);
|
|
802
|
+
const objectTypeId = action.binding.objectType.id;
|
|
803
|
+
if (target.objectTypeId !== objectTypeId) {
|
|
804
|
+
throw invalid(`Action '${action.id}' is defined on '${objectTypeId}', not Share target '${target.objectTypeId}'. Shared Actions are exact-type only in V1.`);
|
|
805
|
+
}
|
|
806
|
+
return Object.freeze({
|
|
807
|
+
kind: "action.apply",
|
|
808
|
+
actionId: action.id,
|
|
809
|
+
subjectObjectTypeId: target.objectTypeId
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
function createShareTarget(objectTypeId) {
|
|
813
|
+
const target = { objectTypeId };
|
|
814
|
+
shareTargets.add(target);
|
|
815
|
+
return Object.freeze(target);
|
|
816
|
+
}
|
|
817
|
+
function createShareViewGrantWithLinks(targetObjectTypeId, links) {
|
|
818
|
+
const grant = {
|
|
819
|
+
kind: "object.view",
|
|
820
|
+
targetObjectTypeId,
|
|
821
|
+
links
|
|
822
|
+
};
|
|
823
|
+
Object.defineProperty(grant, "withLinks", {
|
|
824
|
+
configurable: false,
|
|
825
|
+
enumerable: false,
|
|
826
|
+
writable: false,
|
|
827
|
+
value: (...args) => {
|
|
828
|
+
if (args.length === 0) {
|
|
829
|
+
return freezeViewGrant(targetObjectTypeId, Object.freeze({ kind: "all" }));
|
|
830
|
+
}
|
|
831
|
+
const selected = args[0];
|
|
832
|
+
if (!Array.isArray(selected)) {
|
|
833
|
+
throw invalid("withLinks(...) expects an array, or no argument for every direct link.");
|
|
834
|
+
}
|
|
835
|
+
return freezeViewGrant(targetObjectTypeId, Object.freeze({
|
|
836
|
+
kind: "selected",
|
|
837
|
+
links: Object.freeze(selected.map(snapshotLinkPathSelection))
|
|
838
|
+
}));
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
return Object.freeze(grant);
|
|
842
|
+
}
|
|
843
|
+
function freezeViewGrant(targetObjectTypeId, links) {
|
|
844
|
+
return Object.freeze({ kind: "object.view", targetObjectTypeId, links });
|
|
845
|
+
}
|
|
846
|
+
function snapshotShareGrants(shareId, targetObjectTypeId, authored) {
|
|
847
|
+
const grants = [];
|
|
848
|
+
const actionIds = new Set;
|
|
849
|
+
let viewCount = 0;
|
|
850
|
+
for (let index = 0;index < authored.length; index += 1) {
|
|
851
|
+
const grant = authored[index];
|
|
852
|
+
if (!isRecord2(grant)) {
|
|
853
|
+
throw invalid(`Share '${shareId}' grant ${index} must come from 'can'.`);
|
|
854
|
+
}
|
|
855
|
+
const kind = grant.kind;
|
|
856
|
+
if (kind === "object.view") {
|
|
857
|
+
const authoredTargetObjectTypeId = grant.targetObjectTypeId;
|
|
858
|
+
const links = grant.links;
|
|
859
|
+
if (authoredTargetObjectTypeId !== targetObjectTypeId) {
|
|
860
|
+
throw invalid(`Share '${shareId}' view grant must use its contextual target.`);
|
|
861
|
+
}
|
|
862
|
+
viewCount += 1;
|
|
863
|
+
if (viewCount > 1) {
|
|
864
|
+
throw invalid(`Share '${shareId}' must declare exactly one view grant.`);
|
|
865
|
+
}
|
|
866
|
+
grants.push(Object.freeze({
|
|
867
|
+
kind: "object.view",
|
|
868
|
+
targetObjectTypeId,
|
|
869
|
+
links: snapshotLinkMode(links)
|
|
870
|
+
}));
|
|
871
|
+
continue;
|
|
872
|
+
}
|
|
873
|
+
if (kind === "action.apply") {
|
|
874
|
+
const actionId = grant.actionId;
|
|
875
|
+
const subjectObjectTypeId = grant.subjectObjectTypeId;
|
|
876
|
+
if (!isNonEmpty(actionId) || subjectObjectTypeId !== targetObjectTypeId) {
|
|
877
|
+
throw invalid(`Share '${shareId}' action grant must apply to its contextual target.`);
|
|
878
|
+
}
|
|
879
|
+
if (actionIds.has(actionId)) {
|
|
880
|
+
throw invalid(`Share '${shareId}' contains duplicate action '${actionId}'.`);
|
|
881
|
+
}
|
|
882
|
+
actionIds.add(actionId);
|
|
883
|
+
grants.push(Object.freeze({
|
|
884
|
+
kind: "action.apply",
|
|
885
|
+
actionId,
|
|
886
|
+
subjectObjectTypeId: targetObjectTypeId
|
|
887
|
+
}));
|
|
888
|
+
continue;
|
|
889
|
+
}
|
|
890
|
+
throw invalid(`Share '${shareId}' grant ${index} must come from 'can'.`);
|
|
891
|
+
}
|
|
892
|
+
if (viewCount !== 1) {
|
|
893
|
+
throw invalid(`Share '${shareId}' must declare exactly one can.view(target) grant.`);
|
|
894
|
+
}
|
|
895
|
+
return Object.freeze(grants);
|
|
896
|
+
}
|
|
897
|
+
function snapshotLinkMode(value) {
|
|
898
|
+
if (!isRecord2(value))
|
|
899
|
+
throw invalid("Share link selection must be an object.");
|
|
900
|
+
const kind = value.kind;
|
|
901
|
+
const links = value.links;
|
|
902
|
+
if (kind === "none" || kind === "all") {
|
|
903
|
+
return Object.freeze({ kind });
|
|
904
|
+
}
|
|
905
|
+
if (kind !== "selected" || !Array.isArray(links)) {
|
|
906
|
+
throw invalid("Share link selection must be none, all, or selected links.");
|
|
907
|
+
}
|
|
908
|
+
if (links.length === 0) {
|
|
909
|
+
throw invalid("withLinks([]) is empty; omit withLinks() when no links should be shared.");
|
|
910
|
+
}
|
|
911
|
+
try {
|
|
912
|
+
return Object.freeze({
|
|
913
|
+
kind: "selected",
|
|
914
|
+
links: snapshotLinkPaths(links)
|
|
915
|
+
});
|
|
916
|
+
} catch (error) {
|
|
917
|
+
if (error instanceof ShareDefinitionError)
|
|
918
|
+
throw error;
|
|
919
|
+
const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
|
|
920
|
+
throw invalid(`Share link selection is invalid: ${reason}`);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
function snapshotLinkPaths(values) {
|
|
924
|
+
const byKey = new Map;
|
|
925
|
+
for (const value of values) {
|
|
926
|
+
const captured = canonicalizeLinkPath(snapshotLinkPathSelection(value));
|
|
927
|
+
const key = JSON.stringify([captured.sourceObjectTypeId, captured.linkId]);
|
|
928
|
+
const current = byKey.get(key);
|
|
929
|
+
if (!current) {
|
|
930
|
+
byKey.set(key, captured);
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
if (!sameLinkTargets(current.targetObjectTypeId, captured.targetObjectTypeId)) {
|
|
934
|
+
throw invalid(`Link '${captured.sourceObjectTypeId}.${captured.linkId}' declares inconsistent targets.`);
|
|
935
|
+
}
|
|
936
|
+
byKey.set(key, Object.freeze({
|
|
937
|
+
...current,
|
|
938
|
+
selection: mergeLinkModes(current.selection, captured.selection)
|
|
939
|
+
}));
|
|
940
|
+
}
|
|
941
|
+
return Object.freeze([...byKey.values()]);
|
|
942
|
+
}
|
|
943
|
+
function canonicalizeLinkPath(value) {
|
|
944
|
+
return Object.freeze({
|
|
945
|
+
...value,
|
|
946
|
+
selection: value.selection.kind === "selected" ? Object.freeze({
|
|
947
|
+
kind: "selected",
|
|
948
|
+
links: snapshotLinkPaths(value.selection.links)
|
|
949
|
+
}) : value.selection
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
function mergeLinkModes(left, right) {
|
|
953
|
+
if (left.kind === "all" || right.kind === "all")
|
|
954
|
+
return Object.freeze({ kind: "all" });
|
|
955
|
+
if (left.kind === "none")
|
|
956
|
+
return right;
|
|
957
|
+
if (right.kind === "none")
|
|
958
|
+
return left;
|
|
959
|
+
return Object.freeze({
|
|
960
|
+
kind: "selected",
|
|
961
|
+
links: snapshotLinkPaths([...left.links, ...right.links])
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
function sameLinkTargets(left, right) {
|
|
965
|
+
if (typeof left === "string" || typeof right === "string")
|
|
966
|
+
return left === right;
|
|
967
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
968
|
+
}
|
|
969
|
+
function assertShareTarget(value) {
|
|
970
|
+
if (!isShareTarget(value)) {
|
|
971
|
+
throw invalid("Shared grants must use the target provided by defineShare(...).");
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function isObjectType(value) {
|
|
975
|
+
return isRecord2(value) && isNonEmpty(value.id) && Array.isArray(value.properties) && Array.isArray(value.links);
|
|
976
|
+
}
|
|
977
|
+
function isRecord2(value) {
|
|
978
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
979
|
+
}
|
|
980
|
+
function isNonEmpty(value) {
|
|
981
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
982
|
+
}
|
|
983
|
+
function assertNonEmpty3(value, field) {
|
|
984
|
+
if (!isNonEmpty(value))
|
|
985
|
+
throw invalid(`${field} must not be empty.`);
|
|
986
|
+
}
|
|
987
|
+
function nonEmpty(value, field) {
|
|
988
|
+
assertNonEmpty3(value, field);
|
|
989
|
+
return value;
|
|
990
|
+
}
|
|
991
|
+
function invalid(message) {
|
|
992
|
+
return new ShareDefinitionError(`[Sixb] ${message}`);
|
|
993
|
+
}
|
|
994
|
+
|
|
583
995
|
// src/security/grants.ts
|
|
584
996
|
var VIEW_TARGETS = ["object", "dataset"];
|
|
585
997
|
var RUN_TARGETS = ["workflow", "sync", "pipeline"];
|
|
@@ -589,7 +1001,8 @@ var TARGET_BY_DEFINITION_KIND = {
|
|
|
589
1001
|
pipeline: "pipeline",
|
|
590
1002
|
workflow: "workflow",
|
|
591
1003
|
application: "application",
|
|
592
|
-
connector: "connector"
|
|
1004
|
+
connector: "connector",
|
|
1005
|
+
share: "share"
|
|
593
1006
|
};
|
|
594
1007
|
var UNDISCRIMINATED_TARGETS = ["object", "action"];
|
|
595
1008
|
function targetOfDefinition(item, label, allowedTargets) {
|
|
@@ -640,6 +1053,8 @@ function access(input) {
|
|
|
640
1053
|
return { kind: "grant", capability: "access", target: "application", selection };
|
|
641
1054
|
}
|
|
642
1055
|
function view(input) {
|
|
1056
|
+
if (isShareTarget(input))
|
|
1057
|
+
return createShareViewGrant(input);
|
|
643
1058
|
const { target, selection } = resolveGrant(input, "can.view", VIEW_TARGETS);
|
|
644
1059
|
return { kind: "grant", capability: "view", target, selection };
|
|
645
1060
|
}
|
|
@@ -658,11 +1073,28 @@ function append(input) {
|
|
|
658
1073
|
};
|
|
659
1074
|
}
|
|
660
1075
|
function apply(input) {
|
|
661
|
-
|
|
1076
|
+
const grant = {
|
|
662
1077
|
kind: "grant",
|
|
663
1078
|
capability: "apply",
|
|
664
1079
|
selection: resolveGrant(input, "can.apply", ["action"]).selection
|
|
665
1080
|
};
|
|
1081
|
+
const one = Array.isArray(input) || isBreadthSelector(input) ? undefined : input;
|
|
1082
|
+
if (one && isObjectActionDefinition(one)) {
|
|
1083
|
+
Object.defineProperty(grant, "on", {
|
|
1084
|
+
configurable: false,
|
|
1085
|
+
enumerable: false,
|
|
1086
|
+
writable: false,
|
|
1087
|
+
value: (target) => createShareActionGrant(one, target)
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
return grant;
|
|
1091
|
+
}
|
|
1092
|
+
function share(input) {
|
|
1093
|
+
return {
|
|
1094
|
+
kind: "grant",
|
|
1095
|
+
capability: "share",
|
|
1096
|
+
selection: resolveGrant(input, "can.share", ["share"]).selection
|
|
1097
|
+
};
|
|
666
1098
|
}
|
|
667
1099
|
function run(input) {
|
|
668
1100
|
if (isAgentReference(input)) {
|
|
@@ -711,6 +1143,7 @@ var can = {
|
|
|
711
1143
|
edit,
|
|
712
1144
|
append,
|
|
713
1145
|
apply,
|
|
1146
|
+
share,
|
|
714
1147
|
run,
|
|
715
1148
|
observe,
|
|
716
1149
|
manage
|
|
@@ -736,7 +1169,8 @@ class SecurityRegistry {
|
|
|
736
1169
|
agentAvailable: input.agentAvailable,
|
|
737
1170
|
connectorIds: input.connectorIds,
|
|
738
1171
|
observableIds: new Set(["logs", "aiUsage"]),
|
|
739
|
-
manageableIds: new Set(["aiUsage"])
|
|
1172
|
+
manageableIds: new Set(["aiUsage"]),
|
|
1173
|
+
shareIds: input.shareIds
|
|
740
1174
|
});
|
|
741
1175
|
const universe = {
|
|
742
1176
|
applicationIds: input.applicationIds ?? APPLICATION_IDS,
|
|
@@ -749,6 +1183,7 @@ class SecurityRegistry {
|
|
|
749
1183
|
connectorIds: input.connectorIds ?? new Set,
|
|
750
1184
|
observableIds: new Set(["logs", "aiUsage"]),
|
|
751
1185
|
manageableIds: new Set(["aiUsage"]),
|
|
1186
|
+
shareIds: input.shareIds ?? new Set,
|
|
752
1187
|
getSubTypes: input.getSubTypes ?? (() => [])
|
|
753
1188
|
};
|
|
754
1189
|
this.groupsById = definitions.groupsById;
|
|
@@ -855,7 +1290,7 @@ function cloneDate(value) {
|
|
|
855
1290
|
function dateOrNow(value) {
|
|
856
1291
|
return value ? cloneDate(value) : new Date;
|
|
857
1292
|
}
|
|
858
|
-
function
|
|
1293
|
+
function assertNonEmpty4(value, label) {
|
|
859
1294
|
const normalized = value.trim();
|
|
860
1295
|
if (!normalized) {
|
|
861
1296
|
throw new AuthStorageError("invalid_input", `[Sixb] ${label} must be a non-empty string.`);
|
|
@@ -863,10 +1298,10 @@ function assertNonEmpty2(value, label) {
|
|
|
863
1298
|
return normalized;
|
|
864
1299
|
}
|
|
865
1300
|
function normalizeEmail(email) {
|
|
866
|
-
return
|
|
1301
|
+
return assertNonEmpty4(email, "Email").toLowerCase();
|
|
867
1302
|
}
|
|
868
1303
|
function normalizeGroupIds(groupIds) {
|
|
869
|
-
return [...new Set((groupIds ?? []).map((groupId) =>
|
|
1304
|
+
return [...new Set((groupIds ?? []).map((groupId) => assertNonEmpty4(groupId, "Group id")))];
|
|
870
1305
|
}
|
|
871
1306
|
function normalizeOptionalGroupIds(groupIds) {
|
|
872
1307
|
return groupIds === undefined ? undefined : normalizeGroupIds(groupIds);
|
|
@@ -953,18 +1388,18 @@ function assertSessionIdAvailable(state, projectId, sessionId) {
|
|
|
953
1388
|
}
|
|
954
1389
|
}
|
|
955
1390
|
function validateCompleteSessionInput(state, projectId, session) {
|
|
956
|
-
const sessionId =
|
|
957
|
-
|
|
958
|
-
|
|
1391
|
+
const sessionId = assertNonEmpty4(session.id, "Session id");
|
|
1392
|
+
assertNonEmpty4(session.audience, "Session audience");
|
|
1393
|
+
assertNonEmpty4(session.tokenHash, "Session token hash");
|
|
959
1394
|
assertSessionIdAvailable(state, projectId, sessionId);
|
|
960
1395
|
}
|
|
961
1396
|
function createSessionRecord(state, input) {
|
|
962
|
-
const id =
|
|
963
|
-
const projectId =
|
|
964
|
-
const userId =
|
|
965
|
-
const strategyId =
|
|
1397
|
+
const id = assertNonEmpty4(input.id, "Session id");
|
|
1398
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1399
|
+
const userId = assertNonEmpty4(input.userId, "User id");
|
|
1400
|
+
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
966
1401
|
const audience = resolveAuthSessionAudience(input.audience);
|
|
967
|
-
const tokenHash =
|
|
1402
|
+
const tokenHash = assertNonEmpty4(input.tokenHash, "Session token hash");
|
|
968
1403
|
assertSessionIdAvailable(state, projectId, id);
|
|
969
1404
|
const session = {
|
|
970
1405
|
id,
|
|
@@ -983,9 +1418,9 @@ function createSessionRecord(state, input) {
|
|
|
983
1418
|
return session;
|
|
984
1419
|
}
|
|
985
1420
|
function createServiceAccountRecord(state, input) {
|
|
986
|
-
const id =
|
|
987
|
-
const projectId =
|
|
988
|
-
const name =
|
|
1421
|
+
const id = assertNonEmpty4(input.id, "Service account id");
|
|
1422
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1423
|
+
const name = assertNonEmpty4(input.name, "Service account name");
|
|
989
1424
|
const key = serviceAccountKey(projectId, id);
|
|
990
1425
|
if (state.serviceAccounts.has(key)) {
|
|
991
1426
|
throw new AuthStorageError("duplicate_service_account", `[Sixb] Service account '${id}' already exists for project '${projectId}'.`);
|
|
@@ -1006,9 +1441,9 @@ function createServiceAccountRecord(state, input) {
|
|
|
1006
1441
|
return serviceAccount;
|
|
1007
1442
|
}
|
|
1008
1443
|
function upsertServiceAccountGroupMembershipRecord(state, input) {
|
|
1009
|
-
const projectId =
|
|
1010
|
-
const serviceAccountId =
|
|
1011
|
-
const groupId =
|
|
1444
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1445
|
+
const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
|
|
1446
|
+
const groupId = assertNonEmpty4(input.groupId, "Group id");
|
|
1012
1447
|
if (!state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
|
|
1013
1448
|
throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
|
|
1014
1449
|
}
|
|
@@ -1028,11 +1463,11 @@ function upsertServiceAccountGroupMembershipRecord(state, input) {
|
|
|
1028
1463
|
return membership;
|
|
1029
1464
|
}
|
|
1030
1465
|
function createAccessTokenRecord(state, input) {
|
|
1031
|
-
const id =
|
|
1032
|
-
const projectId =
|
|
1033
|
-
const name =
|
|
1034
|
-
const subjectId =
|
|
1035
|
-
const tokenHash =
|
|
1466
|
+
const id = assertNonEmpty4(input.id, "Access token id");
|
|
1467
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1468
|
+
const name = assertNonEmpty4(input.name, "Access token name");
|
|
1469
|
+
const subjectId = assertNonEmpty4(input.subjectId, "Access token subject id");
|
|
1470
|
+
const tokenHash = assertNonEmpty4(input.tokenHash, "Access token hash");
|
|
1036
1471
|
assertAccessTokenSubject(input.kind, input.subjectType);
|
|
1037
1472
|
assertAccessTokenSubjectExists(state, projectId, input.subjectType, subjectId);
|
|
1038
1473
|
const key = accessTokenKey(projectId, id);
|
|
@@ -1057,9 +1492,9 @@ function createAccessTokenRecord(state, input) {
|
|
|
1057
1492
|
return token;
|
|
1058
1493
|
}
|
|
1059
1494
|
function upsertGroupMembershipRecord(state, input) {
|
|
1060
|
-
const projectId =
|
|
1061
|
-
const userId =
|
|
1062
|
-
const groupId =
|
|
1495
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1496
|
+
const userId = assertNonEmpty4(input.userId, "User id");
|
|
1497
|
+
const groupId = assertNonEmpty4(input.groupId, "Group id");
|
|
1063
1498
|
if (!state.users.has(userKey(projectId, userId))) {
|
|
1064
1499
|
throw new AuthStorageError("missing_user", `[Sixb] User '${userId}' not found for project '${projectId}'.`);
|
|
1065
1500
|
}
|
|
@@ -1079,9 +1514,9 @@ function upsertGroupMembershipRecord(state, input) {
|
|
|
1079
1514
|
return membership;
|
|
1080
1515
|
}
|
|
1081
1516
|
function removeGroupMembershipRecord(state, params) {
|
|
1082
|
-
const projectId =
|
|
1083
|
-
const userId =
|
|
1084
|
-
const groupId =
|
|
1517
|
+
const projectId = assertNonEmpty4(params.projectId, "Project id");
|
|
1518
|
+
const userId = assertNonEmpty4(params.userId, "User id");
|
|
1519
|
+
const groupId = assertNonEmpty4(params.groupId, "Group id");
|
|
1085
1520
|
const key = groupMembershipKey(projectId, userId, groupId);
|
|
1086
1521
|
const existing = state.groupMemberships.get(key);
|
|
1087
1522
|
if (!existing) {
|
|
@@ -1107,9 +1542,9 @@ function assertAccessTokenSubjectExists(state, projectId, subjectType, subjectId
|
|
|
1107
1542
|
throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${subjectId}' not found for project '${projectId}'.`);
|
|
1108
1543
|
}
|
|
1109
1544
|
function consumeMagicLinkRecord(state, params) {
|
|
1110
|
-
const projectId =
|
|
1111
|
-
const id =
|
|
1112
|
-
const tokenHash =
|
|
1545
|
+
const projectId = assertNonEmpty4(params.projectId, "Project id");
|
|
1546
|
+
const id = assertNonEmpty4(params.id, "Magic link id");
|
|
1547
|
+
const tokenHash = assertNonEmpty4(params.tokenHash, "Magic link token hash");
|
|
1113
1548
|
const key = magicLinkKey(projectId, id);
|
|
1114
1549
|
const existing = state.magicLinks.get(key);
|
|
1115
1550
|
if (!existing) {
|
|
@@ -1129,9 +1564,9 @@ function consumeMagicLinkRecord(state, params) {
|
|
|
1129
1564
|
return consumed;
|
|
1130
1565
|
}
|
|
1131
1566
|
function consumeOidcAttemptRecord(state, params) {
|
|
1132
|
-
const projectId =
|
|
1133
|
-
const id =
|
|
1134
|
-
const stateHash =
|
|
1567
|
+
const projectId = assertNonEmpty4(params.projectId, "Project id");
|
|
1568
|
+
const id = assertNonEmpty4(params.id, "OIDC authorization attempt id");
|
|
1569
|
+
const stateHash = assertNonEmpty4(params.stateHash, "OIDC state hash");
|
|
1135
1570
|
const key = oidcAttemptKey(projectId, id);
|
|
1136
1571
|
const existing = state.oidcAuthorizationAttempts.get(key);
|
|
1137
1572
|
if (!existing) {
|
|
@@ -1222,8 +1657,8 @@ class InMemoryAuthDeviceAuthorizationStore {
|
|
|
1222
1657
|
this.state = state;
|
|
1223
1658
|
}
|
|
1224
1659
|
async create(input) {
|
|
1225
|
-
const id =
|
|
1226
|
-
const projectId =
|
|
1660
|
+
const id = assertNonEmpty4(input.id, "Device authorization id");
|
|
1661
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1227
1662
|
for (const [key2, authorization] of this.state.deviceAuthorizations) {
|
|
1228
1663
|
if (authorization.projectId === projectId && authorization.expiresAt <= input.createdAt) {
|
|
1229
1664
|
this.state.deviceAuthorizations.delete(key2);
|
|
@@ -1240,10 +1675,10 @@ class InMemoryAuthDeviceAuthorizationStore {
|
|
|
1240
1675
|
const record = {
|
|
1241
1676
|
id,
|
|
1242
1677
|
projectId,
|
|
1243
|
-
deviceCodeHash:
|
|
1244
|
-
userCode:
|
|
1245
|
-
clientName:
|
|
1246
|
-
tokenName:
|
|
1678
|
+
deviceCodeHash: assertNonEmpty4(input.deviceCodeHash, "Device code hash"),
|
|
1679
|
+
userCode: assertNonEmpty4(input.userCode, "User code"),
|
|
1680
|
+
clientName: assertNonEmpty4(input.clientName, "Client name"),
|
|
1681
|
+
tokenName: assertNonEmpty4(input.tokenName, "Token name"),
|
|
1247
1682
|
tokenExpiresAt: new Date(input.tokenExpiresAt),
|
|
1248
1683
|
status: "pending",
|
|
1249
1684
|
createdAt: new Date(input.createdAt),
|
|
@@ -1274,8 +1709,8 @@ class InMemoryAuthDeviceAuthorizationStore {
|
|
|
1274
1709
|
const next = {
|
|
1275
1710
|
...record,
|
|
1276
1711
|
status: "approved",
|
|
1277
|
-
approvedUserId:
|
|
1278
|
-
approvedSessionId:
|
|
1712
|
+
approvedUserId: assertNonEmpty4(params.userId, "Approved user id"),
|
|
1713
|
+
approvedSessionId: assertNonEmpty4(params.sessionId, "Approved session id"),
|
|
1279
1714
|
approvedAt: new Date(params.approvedAt)
|
|
1280
1715
|
};
|
|
1281
1716
|
this.state.deviceAuthorizations.set(deviceAuthorizationKey(params.projectId, params.id), next);
|
|
@@ -1334,10 +1769,10 @@ class InMemoryAuthUserIdentityStore {
|
|
|
1334
1769
|
this.state = state;
|
|
1335
1770
|
}
|
|
1336
1771
|
async upsert(input) {
|
|
1337
|
-
const projectId =
|
|
1338
|
-
const strategyId =
|
|
1339
|
-
const subject =
|
|
1340
|
-
const userId =
|
|
1772
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1773
|
+
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
1774
|
+
const subject = assertNonEmpty4(input.subject, "Subject");
|
|
1775
|
+
const userId = assertNonEmpty4(input.userId, "User id");
|
|
1341
1776
|
const key = identityKey(projectId, strategyId, subject);
|
|
1342
1777
|
const existing = this.state.identities.get(key);
|
|
1343
1778
|
const createdAt = existing?.createdAt ?? dateOrNow(input.createdAt);
|
|
@@ -1387,8 +1822,8 @@ class InMemoryAuthInvitationStore {
|
|
|
1387
1822
|
this.state = state;
|
|
1388
1823
|
}
|
|
1389
1824
|
async createOrUpdateActive(input) {
|
|
1390
|
-
const id =
|
|
1391
|
-
const projectId =
|
|
1825
|
+
const id = assertNonEmpty4(input.id, "Invitation id");
|
|
1826
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1392
1827
|
const email = normalizeEmail(input.email);
|
|
1393
1828
|
const groupIds = normalizeGroupIds(input.groupIds);
|
|
1394
1829
|
const now = dateOrNow(input.updatedAt ?? input.createdAt);
|
|
@@ -1486,12 +1921,12 @@ class InMemoryAuthMagicLinkStore {
|
|
|
1486
1921
|
this.state = state;
|
|
1487
1922
|
}
|
|
1488
1923
|
async create(input) {
|
|
1489
|
-
const id =
|
|
1490
|
-
const projectId =
|
|
1491
|
-
const strategyId =
|
|
1924
|
+
const id = assertNonEmpty4(input.id, "Magic link id");
|
|
1925
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1926
|
+
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
1492
1927
|
const audience = resolveAuthSessionAudience(input.audience);
|
|
1493
1928
|
const email = normalizeEmail(input.email);
|
|
1494
|
-
const tokenHash =
|
|
1929
|
+
const tokenHash = assertNonEmpty4(input.tokenHash, "Magic link token hash");
|
|
1495
1930
|
const key = magicLinkKey(projectId, id);
|
|
1496
1931
|
if (this.state.magicLinks.has(key)) {
|
|
1497
1932
|
throw new AuthStorageError("duplicate_magic_link", `[Sixb] Magic link '${id}' already exists for project '${projectId}'.`);
|
|
@@ -1535,13 +1970,13 @@ class InMemoryAuthOidcAuthorizationAttemptStore {
|
|
|
1535
1970
|
this.state = state;
|
|
1536
1971
|
}
|
|
1537
1972
|
async create(input) {
|
|
1538
|
-
const id =
|
|
1539
|
-
const projectId =
|
|
1540
|
-
const strategyId =
|
|
1973
|
+
const id = assertNonEmpty4(input.id, "OIDC authorization attempt id");
|
|
1974
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1975
|
+
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
1541
1976
|
const audience = resolveAuthSessionAudience(input.audience);
|
|
1542
|
-
const stateHash =
|
|
1543
|
-
const nonceHash =
|
|
1544
|
-
const codeVerifier =
|
|
1977
|
+
const stateHash = assertNonEmpty4(input.stateHash, "OIDC state hash");
|
|
1978
|
+
const nonceHash = assertNonEmpty4(input.nonceHash, "OIDC nonce hash");
|
|
1979
|
+
const codeVerifier = assertNonEmpty4(input.codeVerifier, "OIDC code verifier");
|
|
1545
1980
|
const key = oidcAttemptKey(projectId, id);
|
|
1546
1981
|
if (this.state.oidcAuthorizationAttempts.has(key)) {
|
|
1547
1982
|
throw new AuthStorageError("duplicate_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' already exists for project '${projectId}'.`);
|
|
@@ -1580,8 +2015,8 @@ class InMemoryAuthServiceAccountGroupMembershipStore {
|
|
|
1580
2015
|
return cloneRecord(upsertServiceAccountGroupMembershipRecord(this.state, input));
|
|
1581
2016
|
}
|
|
1582
2017
|
async reconcileForServiceAccount(input) {
|
|
1583
|
-
const projectId =
|
|
1584
|
-
const serviceAccountId =
|
|
2018
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
2019
|
+
const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
|
|
1585
2020
|
if (!this.state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
|
|
1586
2021
|
throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
|
|
1587
2022
|
}
|
|
@@ -1632,8 +2067,8 @@ class InMemoryAuthServiceAccountStore {
|
|
|
1632
2067
|
return cloneOptionalRecord(record);
|
|
1633
2068
|
}
|
|
1634
2069
|
async update(input) {
|
|
1635
|
-
const projectId =
|
|
1636
|
-
const id =
|
|
2070
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
2071
|
+
const id = assertNonEmpty4(input.id, "Service account id");
|
|
1637
2072
|
const key = serviceAccountKey(projectId, id);
|
|
1638
2073
|
const existing = this.state.serviceAccounts.get(key);
|
|
1639
2074
|
if (!existing) {
|
|
@@ -1641,7 +2076,7 @@ class InMemoryAuthServiceAccountStore {
|
|
|
1641
2076
|
}
|
|
1642
2077
|
const next = {
|
|
1643
2078
|
...existing,
|
|
1644
|
-
name: input.name === undefined ? existing.name :
|
|
2079
|
+
name: input.name === undefined ? existing.name : assertNonEmpty4(input.name, "Service account name"),
|
|
1645
2080
|
description: input.description === undefined ? existing.description : input.description,
|
|
1646
2081
|
status: input.status ?? existing.status,
|
|
1647
2082
|
updatedAt: input.updatedAt ? cloneDate(input.updatedAt) : new Date
|
|
@@ -1749,8 +2184,8 @@ class InMemoryAuthUserStore {
|
|
|
1749
2184
|
this.state = state;
|
|
1750
2185
|
}
|
|
1751
2186
|
async create(input) {
|
|
1752
|
-
const id =
|
|
1753
|
-
const projectId =
|
|
2187
|
+
const id = assertNonEmpty4(input.id, "User id");
|
|
2188
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1754
2189
|
const email = normalizeEmail(input.email);
|
|
1755
2190
|
const key = userKey(projectId, id);
|
|
1756
2191
|
if (this.state.users.has(key)) {
|
|
@@ -1898,7 +2333,7 @@ class InMemoryAuthStorage {
|
|
|
1898
2333
|
return { authorization: cloneRecord(consumed), accessToken: cloneRecord(accessToken) };
|
|
1899
2334
|
}
|
|
1900
2335
|
async completeMagicLinkSignIn(input) {
|
|
1901
|
-
const projectId =
|
|
2336
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1902
2337
|
const completedAt = cloneDate(input.completedAt);
|
|
1903
2338
|
const magicLink = this.state.magicLinks.get(magicLinkKey(projectId, input.magicLinkId));
|
|
1904
2339
|
if (!magicLink) {
|
|
@@ -1945,7 +2380,7 @@ class InMemoryAuthStorage {
|
|
|
1945
2380
|
assertSignInSessionAudience(projectId, input.session.audience, magicLink.audience);
|
|
1946
2381
|
let newUserId;
|
|
1947
2382
|
if (shouldCreateUser) {
|
|
1948
|
-
newUserId =
|
|
2383
|
+
newUserId = assertNonEmpty4(input.newUserId, "User id");
|
|
1949
2384
|
if (this.state.users.has(userKey(projectId, newUserId))) {
|
|
1950
2385
|
throw new AuthStorageError("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
|
|
1951
2386
|
}
|
|
@@ -1959,7 +2394,7 @@ class InMemoryAuthStorage {
|
|
|
1959
2394
|
let user = existingUser;
|
|
1960
2395
|
if (!user) {
|
|
1961
2396
|
user = {
|
|
1962
|
-
id: newUserId ??
|
|
2397
|
+
id: newUserId ?? assertNonEmpty4(input.newUserId, "User id"),
|
|
1963
2398
|
projectId,
|
|
1964
2399
|
email: magicLink.email,
|
|
1965
2400
|
displayName: input.newUserDisplayName,
|
|
@@ -1997,7 +2432,7 @@ class InMemoryAuthStorage {
|
|
|
1997
2432
|
};
|
|
1998
2433
|
}
|
|
1999
2434
|
async completeOidcSignIn(input) {
|
|
2000
|
-
const projectId =
|
|
2435
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
2001
2436
|
const completedAt = cloneDate(input.completedAt);
|
|
2002
2437
|
const attempt = this.state.oidcAuthorizationAttempts.get(oidcAttemptKey(projectId, input.oidcAuthorizationAttemptId));
|
|
2003
2438
|
if (!attempt) {
|
|
@@ -2009,7 +2444,7 @@ class InMemoryAuthStorage {
|
|
|
2009
2444
|
if (attempt.expiresAt <= completedAt) {
|
|
2010
2445
|
throw new AuthStorageError("expired_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' is expired for project '${projectId}'.`);
|
|
2011
2446
|
}
|
|
2012
|
-
const subject =
|
|
2447
|
+
const subject = assertNonEmpty4(input.subject, "Subject");
|
|
2013
2448
|
const email = normalizeEmail(input.email);
|
|
2014
2449
|
const claims = normalizeClaims(input.claims);
|
|
2015
2450
|
const identity = this.state.identities.get(identityKey(projectId, attempt.strategyId, subject));
|
|
@@ -2045,7 +2480,7 @@ class InMemoryAuthStorage {
|
|
|
2045
2480
|
assertSignInSessionAudience(projectId, input.session.audience, attempt.audience);
|
|
2046
2481
|
let newUserId;
|
|
2047
2482
|
if (shouldCreateUser) {
|
|
2048
|
-
newUserId =
|
|
2483
|
+
newUserId = assertNonEmpty4(input.newUserId, "User id");
|
|
2049
2484
|
if (this.state.users.has(userKey(projectId, newUserId))) {
|
|
2050
2485
|
throw new AuthStorageError("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
|
|
2051
2486
|
}
|
|
@@ -2053,7 +2488,7 @@ class InMemoryAuthStorage {
|
|
|
2053
2488
|
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2054
2489
|
if (!user) {
|
|
2055
2490
|
user = {
|
|
2056
|
-
id: newUserId ??
|
|
2491
|
+
id: newUserId ?? assertNonEmpty4(input.newUserId, "User id"),
|
|
2057
2492
|
projectId,
|
|
2058
2493
|
email,
|
|
2059
2494
|
displayName: input.displayName,
|
|
@@ -3200,6 +3635,6 @@ var SYSTEM_PRINCIPAL = { type: "system", id: "system" };
|
|
|
3200
3635
|
function principalsEqual(left, right) {
|
|
3201
3636
|
return left.type === right.type && left.id === right.id;
|
|
3202
3637
|
}
|
|
3203
|
-
export { PERSONAL_ACCESS_TOKEN_PREFIX, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX, generateAccessTokenSecret, hashAccessTokenSecret, formatAccessTokenValue, parseAccessTokenValue, getBearerAccessTokenValue, createAccessTokenCredential, CSRF_HEADER_NAME, generateCsrfToken, isCsrfExemptMethod, verifyDoubleSubmitCsrf, applications, SecurityValidationError, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup, defineRole, defineMembershipPolicy, every, can, SecurityRegistry, AuthStorageError, MAX_PENDING_DEVICE_AUTHORIZATIONS, paginate, InMemoryAuthStorage, generateSessionSecret, hashSessionSecret, formatSessionCookieValue, parseSessionCookieValue, createSessionCredential, AuthRuntime, SYSTEM_PRINCIPAL, principalsEqual };
|
|
3638
|
+
export { ActionDefinitionError, ActionEditCommitError, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2 as assertNonEmpty, isActionDefinition, isGlobalActionDefinition, isObjectActionDefinition, normalizeActionParams, coerceActionParamsToTyped, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX, generateAccessTokenSecret, hashAccessTokenSecret, formatAccessTokenValue, parseAccessTokenValue, getBearerAccessTokenValue, createAccessTokenCredential, CSRF_HEADER_NAME, generateCsrfToken, isCsrfExemptMethod, verifyDoubleSubmitCsrf, applications, SecurityValidationError, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup, defineRole, defineMembershipPolicy, every, ShareDefinitionError, defineShare, isShareDefinition, snapshotShareDefinition, can, SecurityRegistry, AuthStorageError, MAX_PENDING_DEVICE_AUTHORIZATIONS, paginate, InMemoryAuthStorage, generateSessionSecret, hashSessionSecret, formatSessionCookieValue, parseSessionCookieValue, createSessionCredential, AuthRuntime, SYSTEM_PRINCIPAL, principalsEqual };
|
|
3204
3639
|
|
|
3205
|
-
//# debugId=
|
|
3640
|
+
//# debugId=883B08C31B88A92764756E2164756E21
|