@sixb/core 0.1.6 → 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 +50 -40
- 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 +5 -5
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +6 -166
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +22 -6
- package/dist/agents/authority.d.ts.map +1 -1
- package/dist/agents/builders.d.ts +3 -11
- package/dist/agents/builders.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/context.js +2 -2
- package/dist/agents/dispatch.d.ts +9 -1
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -10
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +9 -10
- 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/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +15 -11
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +90 -78
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +19 -13
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +58 -0
- package/dist/agents/model-loop.d.ts.map +1 -0
- package/dist/agents/reference.d.ts +4 -0
- package/dist/agents/reference.d.ts.map +1 -0
- package/dist/agents/request.d.ts +10 -8
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/retired-config.d.ts +4 -0
- package/dist/agents/retired-config.d.ts.map +1 -0
- package/dist/agents/streams.d.ts +13 -8
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +7 -5
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/tool-catalog.d.ts +9 -0
- package/dist/agents/tool-catalog.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts +1 -1
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/types.d.ts +31 -68
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +3 -13
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/ai-usage/execution.d.ts +53 -0
- package/dist/ai-usage/execution.d.ts.map +1 -0
- package/dist/ai-usage/index.d.ts +3 -0
- package/dist/ai-usage/index.d.ts.map +1 -0
- package/dist/auth/index.js +12 -9
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/decision.d.ts +14 -3
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +25 -8
- 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 +12 -7
- package/dist/authorization/index.js.map +1 -1
- package/dist/authorization/resolve.d.ts +3 -3
- package/dist/authorization/resolve.d.ts.map +1 -1
- package/dist/authorization/types.d.ts +7 -5
- package/dist/authorization/types.d.ts.map +1 -1
- package/dist/blob-storage/browser.js +2 -2
- package/dist/blob-storage/index.js +3 -3
- package/dist/bootstrap/discovery.d.ts +6 -6
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.js +62 -51
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
- package/dist/broker/index.js +2 -2
- package/dist/{chunk-zqysyfjt.js → chunk-08m3b6w8.js} +1 -1
- package/dist/chunk-19jp6g9d.js +131 -0
- package/dist/chunk-19jp6g9d.js.map +11 -0
- package/dist/{chunk-3j7573mj.js → chunk-2dw777qw.js} +50 -5
- package/dist/{chunk-3j7573mj.js.map → chunk-2dw777qw.js.map} +4 -3
- package/dist/{chunk-0172wgm9.js → chunk-2xns679x.js} +10 -2
- package/dist/{chunk-0172wgm9.js.map → chunk-2xns679x.js.map} +3 -3
- package/dist/chunk-359jm1jw.js +147 -0
- package/dist/chunk-359jm1jw.js.map +10 -0
- package/dist/{chunk-dy311asx.js → chunk-3xep5cjx.js} +58 -23
- package/dist/chunk-3xep5cjx.js.map +15 -0
- package/dist/{chunk-n4spznws.js → chunk-3z1qec12.js} +83 -12
- package/dist/chunk-3z1qec12.js.map +12 -0
- package/dist/{chunk-z3zp0bj1.js → chunk-407j3msh.js} +1 -1
- package/dist/{chunk-rhrbz7d4.js → chunk-4a849fr1.js} +1 -1
- package/dist/{chunk-cy0n5dms.js → chunk-4jjp5k14.js} +1 -1
- package/dist/chunk-4qfkag59.js +1568 -0
- package/dist/chunk-4qfkag59.js.map +20 -0
- package/dist/{chunk-1e8m6yn3.js → chunk-4sm0aznx.js} +685 -86
- package/dist/chunk-4sm0aznx.js.map +43 -0
- package/dist/chunk-4yqmp43v.js +159 -0
- package/dist/chunk-4yqmp43v.js.map +11 -0
- package/dist/{chunk-rdeagz6b.js → chunk-5e3pq99w.js} +3 -7
- package/dist/{chunk-rdeagz6b.js.map → chunk-5e3pq99w.js.map} +3 -3
- package/dist/{chunk-ezake7g1.js → chunk-5ntny1qx.js} +1 -1
- package/dist/{chunk-dm72y8wt.js → chunk-7y0f6rf1.js} +29 -16
- package/dist/chunk-7y0f6rf1.js.map +10 -0
- package/dist/{chunk-72q2y8hn.js → chunk-8tsf6dmc.js} +2 -2
- package/dist/{chunk-qewtks41.js → chunk-9nbmsvn5.js} +123 -20
- package/dist/chunk-9nbmsvn5.js.map +11 -0
- package/dist/{chunk-5sxb1168.js → chunk-aa2pen2v.js} +256 -82
- package/dist/chunk-aa2pen2v.js.map +34 -0
- package/dist/{chunk-819wnjz8.js → chunk-ajnan18g.js} +13 -10
- package/dist/chunk-ajnan18g.js.map +12 -0
- package/dist/chunk-c15dr03f.js +43 -0
- package/dist/chunk-c15dr03f.js.map +10 -0
- package/dist/{chunk-t0jjkep3.js → chunk-d8qkxt2v.js} +4 -2
- package/dist/chunk-d8qkxt2v.js.map +10 -0
- package/dist/{chunk-vybf6pkp.js → chunk-dbc80ad7.js} +1 -1
- package/dist/{chunk-nkbfrt0c.js → chunk-f26bck4t.js} +7 -7
- package/dist/{chunk-x2yw73hy.js → chunk-fvt9rjsa.js} +23 -7
- package/dist/chunk-fvt9rjsa.js.map +10 -0
- package/dist/{chunk-znagycq7.js → chunk-gbejpkex.js} +5 -5
- package/dist/{chunk-znagycq7.js.map → chunk-gbejpkex.js.map} +1 -1
- package/dist/{chunk-e42bc6m3.js → chunk-gzasd5b6.js} +5 -5
- package/dist/{chunk-e42bc6m3.js.map → chunk-gzasd5b6.js.map} +3 -3
- package/dist/{chunk-rnshztfq.js → chunk-h0k55pc7.js} +6 -6
- package/dist/{chunk-rnshztfq.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-j1sbhm7p.js +45 -0
- package/dist/chunk-j1sbhm7p.js.map +10 -0
- package/dist/chunk-jecn6t54.js +307 -0
- package/dist/chunk-jecn6t54.js.map +12 -0
- package/dist/{chunk-dsrkgtnh.js → chunk-jq43kdvk.js} +1 -1
- package/dist/{chunk-wtmzkcht.js → chunk-k34z5rvh.js} +1 -1
- package/dist/{chunk-f6erf2vv.js → chunk-k522z7v6.js} +10 -5
- package/dist/chunk-k522z7v6.js.map +10 -0
- package/dist/{chunk-htq0qh7z.js → chunk-ka3a2ft3.js} +2 -2
- package/dist/{chunk-ckxfnx7f.js → chunk-mth82m8t.js} +129 -95
- package/dist/chunk-mth82m8t.js.map +14 -0
- package/dist/{chunk-5gynx4xn.js → chunk-mwsxn98e.js} +79 -77
- package/dist/{chunk-5gynx4xn.js.map → chunk-mwsxn98e.js.map} +8 -8
- package/dist/{chunk-f2rt4vkh.js → chunk-n2w475r0.js} +3 -3
- package/dist/chunk-n4khvw9n.js +111 -0
- package/dist/chunk-n4khvw9n.js.map +11 -0
- package/dist/{chunk-t8t39h7v.js → chunk-n6jxh8sw.js} +10 -2
- package/dist/chunk-n6jxh8sw.js.map +10 -0
- package/dist/chunk-nn0tekr1.js +284 -0
- 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-drjqm1aa.js → chunk-p03r0h5s.js} +310 -28
- package/dist/chunk-p03r0h5s.js.map +16 -0
- package/dist/{chunk-1g8negke.js → chunk-p1rzczbt.js} +93 -8
- package/dist/chunk-p1rzczbt.js.map +12 -0
- package/dist/{chunk-f83ka50g.js → chunk-p1x242ad.js} +652 -77
- package/dist/chunk-p1x242ad.js.map +25 -0
- package/dist/chunk-p2vqaxkc.js +528 -0
- package/dist/chunk-p2vqaxkc.js.map +15 -0
- package/dist/{chunk-a31h57d5.js → chunk-pc7ys28c.js} +70 -7
- package/dist/chunk-pc7ys28c.js.map +14 -0
- package/dist/{chunk-md8k0r54.js → chunk-q0k9nc5a.js} +281 -89
- package/dist/chunk-q0k9nc5a.js.map +14 -0
- package/dist/{chunk-bhxaq2nn.js → chunk-qw9gvjv5.js} +1 -1
- package/dist/chunk-r8jrnexe.js +403 -0
- package/dist/chunk-r8jrnexe.js.map +10 -0
- package/dist/{chunk-h9kxd41f.js → chunk-rafagrwr.js} +48 -7
- package/dist/chunk-rafagrwr.js.map +11 -0
- package/dist/{chunk-dysw7nsm.js → chunk-rv2hkwwa.js} +2 -2
- package/dist/{chunk-ghteq96b.js → chunk-s5y30bc9.js} +2 -2
- package/dist/{chunk-t624af60.js → chunk-sbzzr4kx.js} +1848 -757
- package/dist/chunk-sbzzr4kx.js.map +63 -0
- package/dist/{chunk-6gjqgd3d.js → chunk-tpnd31c1.js} +2 -1
- package/dist/chunk-tpnd31c1.js.map +11 -0
- package/dist/chunk-trxxmgnf.js +68 -0
- package/dist/chunk-trxxmgnf.js.map +11 -0
- package/dist/{chunk-0hc5j867.js → chunk-v1xppd0y.js} +17 -13
- package/dist/{chunk-0hc5j867.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-xkthy56g.js → chunk-w1tvjszy.js} +1 -1
- package/dist/{chunk-8b55ygje.js → chunk-w3e09qqk.js} +1 -1
- package/dist/{chunk-8gv5z0zm.js → chunk-w9tg6yyb.js} +13 -8
- package/dist/{chunk-8gv5z0zm.js.map → chunk-w9tg6yyb.js.map} +3 -3
- package/dist/{chunk-62c7t4jc.js → chunk-wdage1eb.js} +1 -1
- package/dist/{chunk-tg5mee00.js → chunk-wtf06et8.js} +11 -7
- package/dist/{chunk-tg5mee00.js.map → chunk-wtf06et8.js.map} +3 -3
- package/dist/{chunk-nva1xkjz.js → chunk-xajtptbw.js} +1237 -1434
- 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/error-reporting/internal.js +4 -4
- package/dist/error-reporting/types.d.ts +7 -2
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +8 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +2 -2
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +4 -4
- 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 +18 -9
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +62 -46
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +68 -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 +55 -46
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.d.ts +14 -1
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +92 -54
- 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 +10 -1
- 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 +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +128 -109
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +2 -0
- package/dist/json.d.ts.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 +27 -10
- 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/logging/index.js +3 -3
- package/dist/logging/types.js +2 -2
- package/dist/materialization/index.js +2 -2
- package/dist/materializer/index.js +38 -31
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/catalog.d.ts +40 -0
- package/dist/models/catalog.d.ts.map +1 -0
- package/dist/models/definitions.d.ts +25 -0
- package/dist/models/definitions.d.ts.map +1 -0
- package/dist/models/errors.d.ts +52 -0
- package/dist/models/errors.d.ts.map +1 -0
- package/dist/models/events.d.ts +192 -0
- package/dist/models/events.d.ts.map +1 -0
- package/dist/models/index.d.ts +17 -39
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +50 -0
- package/dist/models/index.js.map +9 -0
- package/dist/models/language-model.d.ts +90 -0
- package/dist/models/language-model.d.ts.map +1 -0
- package/dist/models/messages.d.ts +74 -0
- package/dist/models/messages.d.ts.map +1 -0
- package/dist/models/pricing.d.ts +69 -0
- package/dist/models/pricing.d.ts.map +1 -0
- package/dist/models/rate-card.d.ts +24 -0
- package/dist/models/rate-card.d.ts.map +1 -0
- package/dist/models/tools.d.ts +24 -0
- package/dist/models/tools.d.ts.map +1 -0
- 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 +43 -36
- 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 +36 -29
- 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 +15 -14
- 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 +41 -36
- 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 +39 -32
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +3 -2
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +3 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +15 -3
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/execution.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +7 -4
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +4 -2
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +5 -2
- 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 +4 -2
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +8 -2
- 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 -4
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +12 -6
- 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 +2 -1
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +19 -5
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +6 -2
- 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/failure.js +3 -3
- package/dist/storage/action-runs/provider.js +2 -2
- 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 +3 -2
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +11 -4
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +18 -15
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +65 -17
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +2 -1
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/codec.d.ts +3 -2
- package/dist/storage/ai-cost/codec.d.ts.map +1 -1
- package/dist/storage/ai-cost/groups.d.ts +51 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +11 -1
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-cost/index.d.ts +1 -1
- package/dist/storage/ai-cost/index.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.d.ts +2 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +29 -13
- package/dist/storage/ai-cost/provider.js.map +3 -3
- package/dist/storage/ai-cost/types.d.ts +64 -15
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/validation.d.ts +2 -1
- package/dist/storage/ai-cost/validation.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.d.ts +14 -0
- package/dist/storage/ai-limits/enforcement.d.ts.map +1 -0
- package/dist/storage/ai-limits/enforcement.js +21 -0
- package/dist/storage/ai-limits/enforcement.js.map +9 -0
- package/dist/storage/ai-limits/errors.d.ts +8 -0
- package/dist/storage/ai-limits/errors.d.ts.map +1 -0
- package/dist/storage/ai-limits/in-memory.d.ts +78 -0
- package/dist/storage/ai-limits/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-limits/index.d.ts +7 -0
- package/dist/storage/ai-limits/index.d.ts.map +1 -0
- package/dist/storage/ai-limits/period.d.ts +4 -0
- package/dist/storage/ai-limits/period.d.ts.map +1 -0
- package/dist/storage/ai-limits/provider.d.ts +85 -0
- package/dist/storage/ai-limits/provider.d.ts.map +1 -0
- package/dist/storage/ai-limits/provider.js +62 -0
- package/dist/storage/ai-limits/provider.js.map +9 -0
- package/dist/storage/ai-limits/types.d.ts +175 -0
- package/dist/storage/ai-limits/types.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +4 -0
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-usage/record.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +6 -2
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/auth/errors.d.ts +1 -1
- package/dist/storage/auth/errors.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts +4 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/device-authorizations.d.ts +29 -0
- package/dist/storage/auth/in-memory/device-authorizations.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/shared.d.ts +3 -1
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +2 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +66 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/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 +14 -2
- 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 +12 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +15 -6
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +78 -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/ontology/provider.js +3 -3
- 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 +4 -4
- 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 +13 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.js +2 -2
- package/dist/storage/workflow-runs/provider.d.ts +1 -1
- package/dist/storage/workflow-runs/provider.js +14 -12
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +5 -4
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.js +41 -36
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +3 -1
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-limit-storage-contract.d.ts +18 -0
- package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts +6 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/auth-storage-contract.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 +5 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5392 -2070
- package/dist/testing/index.js.map +21 -15
- 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/queues-contract.d.ts.map +1 -1
- 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 +36 -29
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +2 -2
- package/dist/workflows/agent-step-identity.d.ts +3 -0
- package/dist/workflows/agent-step-identity.d.ts.map +1 -0
- package/dist/workflows/builders.d.ts +2 -3
- package/dist/workflows/builders.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +1 -1
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/failure.d.ts +1 -1
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +3 -2
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +63 -48
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +26 -11
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/validation.d.ts +7 -1
- package/dist/workflows/validation.d.ts.map +1 -1
- package/package.json +43 -4
- 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 +60 -456
- package/src/agents/authority.ts +215 -34
- package/src/agents/builders.ts +3 -50
- package/src/agents/context-compaction.ts +4 -0
- package/src/agents/context-resolution.ts +1 -4
- package/src/agents/dispatch.ts +59 -2
- package/src/agents/errors.ts +4 -11
- package/src/agents/execution.ts +65 -56
- package/src/agents/identity.ts +4 -0
- package/src/agents/ids.ts +16 -1
- package/src/agents/index.ts +23 -30
- package/src/agents/message.ts +20 -12
- package/src/agents/model-loop.ts +1071 -0
- package/src/agents/reference.ts +7 -0
- package/src/agents/request.ts +157 -77
- package/src/agents/retired-config.ts +20 -0
- package/src/agents/streams.ts +45 -19
- package/src/agents/tool-catalog.ts +21 -0
- package/src/agents/tool-definition.ts +9 -5
- package/src/agents/types.ts +39 -81
- package/src/agents/validation.ts +11 -216
- package/src/ai-usage/execution.ts +189 -0
- package/src/ai-usage/index.ts +15 -0
- package/src/authorization/decision.ts +54 -22
- package/src/authorization/grant-kinds.ts +72 -15
- package/src/authorization/index.ts +2 -0
- package/src/authorization/resolve.ts +12 -5
- package/src/authorization/types.ts +7 -5
- package/src/bootstrap/discovery.ts +3 -3
- 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/error-reporting/types.ts +4 -2
- package/src/errors/catalog.ts +8 -0
- package/src/events/execution.ts +57 -7
- package/src/events/types/datasets.ts +2 -6
- package/src/execution/agent.ts +129 -25
- package/src/execution/authorization.ts +493 -83
- 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 +67 -14
- package/src/execution/scopes.ts +36 -6
- package/src/execution/types.ts +9 -1
- package/src/http/api-routes.ts +108 -0
- package/src/index.ts +72 -22
- package/src/json.ts +9 -0
- 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/models/catalog.ts +137 -0
- package/src/models/definitions.ts +202 -0
- package/src/models/errors.ts +83 -0
- package/src/models/events.ts +198 -0
- package/src/models/index.ts +89 -71
- package/src/models/language-model.ts +143 -0
- package/src/models/messages.ts +78 -0
- package/src/models/pricing.ts +390 -0
- package/src/models/rate-card.ts +101 -0
- package/src/models/tools.ts +29 -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/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +11 -0
- package/src/queues/types.ts +20 -3
- package/src/rules/execution.ts +20 -8
- package/src/runtime/create.ts +11 -5
- package/src/runtime/definitions.ts +4 -2
- package/src/runtime/host.ts +28 -8
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +22 -36
- package/src/runtime/sixb.ts +29 -10
- package/src/runtime/types.ts +3 -0
- package/src/schedules/execution.ts +24 -2
- package/src/security/every.ts +4 -4
- package/src/security/grants.ts +100 -14
- package/src/security/index.ts +3 -0
- package/src/security/registry.ts +9 -5
- package/src/security/types.ts +23 -4
- package/src/security/validation.ts +33 -9
- 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/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +121 -11
- package/src/storage/agents/index.ts +7 -0
- package/src/storage/agents/provider.ts +150 -6
- package/src/storage/agents/types.ts +73 -16
- package/src/storage/ai-cost/analytics.ts +63 -6
- package/src/storage/ai-cost/codec.ts +37 -12
- package/src/storage/ai-cost/groups.ts +248 -0
- package/src/storage/ai-cost/in-memory.ts +42 -0
- package/src/storage/ai-cost/index.ts +6 -0
- package/src/storage/ai-cost/provider.ts +7 -0
- package/src/storage/ai-cost/types.ts +76 -14
- package/src/storage/ai-cost/validation.ts +147 -17
- package/src/storage/ai-limits/enforcement.ts +68 -0
- package/src/storage/ai-limits/errors.ts +23 -0
- package/src/storage/ai-limits/in-memory.ts +671 -0
- package/src/storage/ai-limits/index.ts +31 -0
- package/src/storage/ai-limits/period.ts +11 -0
- package/src/storage/ai-limits/provider.ts +430 -0
- package/src/storage/ai-limits/types.ts +195 -0
- package/src/storage/ai-usage/in-memory.ts +13 -0
- package/src/storage/ai-usage/record.ts +17 -0
- package/src/storage/ai-usage/types.ts +6 -2
- package/src/storage/auth/errors.ts +6 -0
- package/src/storage/auth/in-memory/auth-storage.ts +69 -0
- package/src/storage/auth/in-memory/device-authorizations.ts +145 -0
- package/src/storage/auth/in-memory/shared.ts +7 -0
- package/src/storage/auth/index.ts +7 -0
- package/src/storage/auth/types.ts +73 -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 +45 -6
- package/src/storage/executions/validation.ts +82 -7
- package/src/storage/in-memory/index.ts +69 -6
- package/src/storage/index.ts +102 -1
- 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 +64 -0
- package/src/storage/workflow-runs/in-memory.ts +3 -3
- package/src/storage/workflow-runs/provider.ts +2 -2
- package/src/storage/workflow-runs/types.ts +6 -3
- package/src/syncs/execution.ts +25 -5
- package/src/syncs/request.ts +5 -0
- package/src/testing/agent-execution.ts +40 -28
- package/src/testing/agent-storage-contract.ts +249 -28
- package/src/testing/ai-cost-storage-contract.ts +96 -8
- package/src/testing/ai-limit-storage-contract.ts +1134 -0
- package/src/testing/ai-model-call-groups-contract.ts +353 -0
- package/src/testing/ai-usage-storage-contract.ts +31 -0
- package/src/testing/auth-storage-contract.ts +85 -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 +81 -2
- package/src/testing/index.ts +26 -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/queues-contract.ts +36 -1
- package/src/testing/share-grant-storage-contract.ts +325 -0
- package/src/testing/share-session-storage-contract.ts +235 -0
- package/src/workflows/agent-step-identity.ts +4 -0
- package/src/workflows/builders.ts +95 -9
- package/src/workflows/execution.ts +55 -16
- package/src/workflows/failure.ts +2 -2
- package/src/workflows/index.ts +3 -0
- package/src/workflows/request.ts +5 -0
- package/src/workflows/types.ts +23 -11
- package/src/workflows/validation.ts +100 -7
- package/dist/chunk-1e8m6yn3.js.map +0 -37
- package/dist/chunk-1g8negke.js.map +0 -11
- package/dist/chunk-4gz41why.js +0 -72
- package/dist/chunk-4gz41why.js.map +0 -11
- package/dist/chunk-5sxb1168.js.map +0 -34
- package/dist/chunk-6gjqgd3d.js.map +0 -11
- package/dist/chunk-819wnjz8.js.map +0 -12
- package/dist/chunk-a31h57d5.js.map +0 -13
- package/dist/chunk-a44d5zgd.js +0 -556
- package/dist/chunk-a44d5zgd.js.map +0 -16
- package/dist/chunk-ckxfnx7f.js.map +0 -13
- package/dist/chunk-dm72y8wt.js.map +0 -10
- package/dist/chunk-drjqm1aa.js.map +0 -15
- package/dist/chunk-dy311asx.js.map +0 -14
- package/dist/chunk-f6erf2vv.js.map +0 -10
- package/dist/chunk-f83ka50g.js.map +0 -23
- package/dist/chunk-fe5ev6mr.js +0 -55
- package/dist/chunk-fe5ev6mr.js.map +0 -11
- package/dist/chunk-h9kxd41f.js.map +0 -11
- package/dist/chunk-hceck7dq.js +0 -137
- package/dist/chunk-hceck7dq.js.map +0 -10
- package/dist/chunk-md8k0r54.js.map +0 -14
- package/dist/chunk-n4spznws.js.map +0 -11
- package/dist/chunk-nva1xkjz.js.map +0 -46
- package/dist/chunk-qewtks41.js.map +0 -11
- package/dist/chunk-t0jjkep3.js.map +0 -10
- package/dist/chunk-t624af60.js.map +0 -56
- package/dist/chunk-t8t39h7v.js.map +0 -10
- package/dist/chunk-t9xghkva.js +0 -28
- package/dist/chunk-t9xghkva.js.map +0 -10
- package/dist/chunk-x2yw73hy.js.map +0 -10
- package/dist/chunk-xc7hq65b.js.map +0 -10
- package/dist/storage/objects/in-memory.d.ts.map +0 -1
- package/src/storage/objects/in-memory.ts +0 -1241
- /package/dist/{chunk-zqysyfjt.js.map → chunk-08m3b6w8.js.map} +0 -0
- /package/dist/{chunk-z3zp0bj1.js.map → chunk-407j3msh.js.map} +0 -0
- /package/dist/{chunk-rhrbz7d4.js.map → chunk-4a849fr1.js.map} +0 -0
- /package/dist/{chunk-cy0n5dms.js.map → chunk-4jjp5k14.js.map} +0 -0
- /package/dist/{chunk-ezake7g1.js.map → chunk-5ntny1qx.js.map} +0 -0
- /package/dist/{chunk-72q2y8hn.js.map → chunk-8tsf6dmc.js.map} +0 -0
- /package/dist/{chunk-vybf6pkp.js.map → chunk-dbc80ad7.js.map} +0 -0
- /package/dist/{chunk-nkbfrt0c.js.map → chunk-f26bck4t.js.map} +0 -0
- /package/dist/{chunk-dsrkgtnh.js.map → chunk-jq43kdvk.js.map} +0 -0
- /package/dist/{chunk-wtmzkcht.js.map → chunk-k34z5rvh.js.map} +0 -0
- /package/dist/{chunk-htq0qh7z.js.map → chunk-ka3a2ft3.js.map} +0 -0
- /package/dist/{chunk-f2rt4vkh.js.map → chunk-n2w475r0.js.map} +0 -0
- /package/dist/{chunk-bhxaq2nn.js.map → chunk-qw9gvjv5.js.map} +0 -0
- /package/dist/{chunk-dysw7nsm.js.map → chunk-rv2hkwwa.js.map} +0 -0
- /package/dist/{chunk-ghteq96b.js.map → chunk-s5y30bc9.js.map} +0 -0
- /package/dist/{chunk-xkthy56g.js.map → chunk-w1tvjszy.js.map} +0 -0
- /package/dist/{chunk-8b55ygje.js.map → chunk-w3e09qqk.js.map} +0 -0
- /package/dist/{chunk-62c7t4jc.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
|
|
@@ -326,11 +340,17 @@ function assertGrantDefinition(value, field, createError = (message) => new Secu
|
|
|
326
340
|
if (value.capability === "run" && value.target !== "workflow" && value.target !== "sync" && value.target !== "pipeline" && value.target !== "agent") {
|
|
327
341
|
throw createError(`[Sixb] ${field} run grant target must be 'workflow', 'sync', 'pipeline', or 'agent'.`);
|
|
328
342
|
}
|
|
329
|
-
if (value.capability === "observe" && value.target !== "logs") {
|
|
330
|
-
throw createError(`[Sixb] ${field} observe grant target must be 'logs'.`);
|
|
343
|
+
if (value.capability === "observe" && value.target !== "logs" && value.target !== "aiUsage") {
|
|
344
|
+
throw createError(`[Sixb] ${field} observe grant target must be 'logs' or 'aiUsage'.`);
|
|
345
|
+
}
|
|
346
|
+
if (value.capability === "manage" && value.target !== "connector" && value.target !== "aiUsage") {
|
|
347
|
+
throw createError(`[Sixb] ${field} manage grant target must be 'connector' or 'aiUsage'.`);
|
|
331
348
|
}
|
|
332
|
-
if (value.capability === "
|
|
333
|
-
|
|
349
|
+
if (value.capability === "run" && value.target === "agent") {
|
|
350
|
+
if (value.selection !== undefined) {
|
|
351
|
+
throw createError(`[Sixb] ${field} agent run grant must not declare a selection.`);
|
|
352
|
+
}
|
|
353
|
+
return;
|
|
334
354
|
}
|
|
335
355
|
assertSelection(value.selection, field, createError);
|
|
336
356
|
}
|
|
@@ -441,6 +461,13 @@ function validateSecurityDefinitionsAtStartup(input) {
|
|
|
441
461
|
};
|
|
442
462
|
}
|
|
443
463
|
function assertGrantReferences(roleId, grant, registered) {
|
|
464
|
+
if (grant.capability === "run" && grant.target === "agent") {
|
|
465
|
+
const spec2 = GRANT_KINDS[grantKindOf(grant)];
|
|
466
|
+
if (!registered.agentAvailable) {
|
|
467
|
+
throw new SecurityValidationError(`[Sixb] Role '${roleId}' grants ${grant.capability} on the project Agent, but it is unavailable. ${spec2.fix}`);
|
|
468
|
+
}
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
444
471
|
const spec = GRANT_KINDS[grantKindOf(grant)];
|
|
445
472
|
const universe = registered[spec.universeKey];
|
|
446
473
|
if (!universe) {
|
|
@@ -530,9 +557,9 @@ var BREADTH_TARGETS = [
|
|
|
530
557
|
"workflow",
|
|
531
558
|
"sync",
|
|
532
559
|
"pipeline",
|
|
533
|
-
"agent",
|
|
534
560
|
"application",
|
|
535
|
-
"connector"
|
|
561
|
+
"connector",
|
|
562
|
+
"share"
|
|
536
563
|
];
|
|
537
564
|
function isBreadthSelector(value) {
|
|
538
565
|
if (typeof value !== "object" || value === null)
|
|
@@ -565,21 +592,417 @@ var every = {
|
|
|
565
592
|
workflow: () => all("workflow"),
|
|
566
593
|
sync: () => all("sync"),
|
|
567
594
|
pipeline: () => all("pipeline"),
|
|
568
|
-
agent: () => all("agent"),
|
|
569
595
|
application: () => all("application"),
|
|
570
|
-
connector: () => all("connector")
|
|
596
|
+
connector: () => all("connector"),
|
|
597
|
+
share: () => all("share")
|
|
571
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
|
+
|
|
572
995
|
// src/security/grants.ts
|
|
573
996
|
var VIEW_TARGETS = ["object", "dataset"];
|
|
574
|
-
var RUN_TARGETS = ["workflow", "sync", "pipeline"
|
|
997
|
+
var RUN_TARGETS = ["workflow", "sync", "pipeline"];
|
|
575
998
|
var TARGET_BY_DEFINITION_KIND = {
|
|
576
999
|
dataset: "dataset",
|
|
577
1000
|
sync: "sync",
|
|
578
1001
|
pipeline: "pipeline",
|
|
579
|
-
agent: "agent",
|
|
580
1002
|
workflow: "workflow",
|
|
581
1003
|
application: "application",
|
|
582
|
-
connector: "connector"
|
|
1004
|
+
connector: "connector",
|
|
1005
|
+
share: "share"
|
|
583
1006
|
};
|
|
584
1007
|
var UNDISCRIMINATED_TARGETS = ["object", "action"];
|
|
585
1008
|
function targetOfDefinition(item, label, allowedTargets) {
|
|
@@ -630,6 +1053,8 @@ function access(input) {
|
|
|
630
1053
|
return { kind: "grant", capability: "access", target: "application", selection };
|
|
631
1054
|
}
|
|
632
1055
|
function view(input) {
|
|
1056
|
+
if (isShareTarget(input))
|
|
1057
|
+
return createShareViewGrant(input);
|
|
633
1058
|
const { target, selection } = resolveGrant(input, "can.view", VIEW_TARGETS);
|
|
634
1059
|
return { kind: "grant", capability: "view", target, selection };
|
|
635
1060
|
}
|
|
@@ -648,17 +1073,47 @@ function append(input) {
|
|
|
648
1073
|
};
|
|
649
1074
|
}
|
|
650
1075
|
function apply(input) {
|
|
651
|
-
|
|
1076
|
+
const grant = {
|
|
652
1077
|
kind: "grant",
|
|
653
1078
|
capability: "apply",
|
|
654
1079
|
selection: resolveGrant(input, "can.apply", ["action"]).selection
|
|
655
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
|
+
};
|
|
656
1098
|
}
|
|
657
1099
|
function run(input) {
|
|
1100
|
+
if (isAgentReference(input)) {
|
|
1101
|
+
return { kind: "grant", capability: "run", target: "agent" };
|
|
1102
|
+
}
|
|
658
1103
|
const { target, selection } = resolveGrant(input, "can.run", RUN_TARGETS);
|
|
659
1104
|
return { kind: "grant", capability: "run", target, selection };
|
|
660
1105
|
}
|
|
661
|
-
function
|
|
1106
|
+
function isAgentReference(input) {
|
|
1107
|
+
return typeof input === "object" && input !== null && !Array.isArray(input) && !isBreadthSelector(input) && "kind" in input && input.kind === "agent";
|
|
1108
|
+
}
|
|
1109
|
+
function isAgentUsageReference(input) {
|
|
1110
|
+
return typeof input === "object" && input !== null && !Array.isArray(input) && !isBreadthSelector(input) && "kind" in input && input.kind === "aiUsage";
|
|
1111
|
+
}
|
|
1112
|
+
function observe(input) {
|
|
1113
|
+
if (input !== "logs" && !isAgentUsageReference(input)) {
|
|
1114
|
+
throw new SecurityValidationError('[Sixb] can.observe accepts "logs" or agent.usage.');
|
|
1115
|
+
}
|
|
1116
|
+
const target = input === "logs" ? "logs" : "aiUsage";
|
|
662
1117
|
return {
|
|
663
1118
|
kind: "grant",
|
|
664
1119
|
capability: "observe",
|
|
@@ -667,9 +1122,18 @@ function observe(target) {
|
|
|
667
1122
|
};
|
|
668
1123
|
}
|
|
669
1124
|
function manage(input) {
|
|
1125
|
+
if (isAgentUsageReference(input)) {
|
|
1126
|
+
return {
|
|
1127
|
+
kind: "grant",
|
|
1128
|
+
capability: "manage",
|
|
1129
|
+
target: "aiUsage",
|
|
1130
|
+
selection: { all: false, ids: ["aiUsage"] }
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
670
1133
|
return {
|
|
671
1134
|
kind: "grant",
|
|
672
1135
|
capability: "manage",
|
|
1136
|
+
target: "connector",
|
|
673
1137
|
selection: resolveGrant(input, "can.manage", ["connector"]).selection
|
|
674
1138
|
};
|
|
675
1139
|
}
|
|
@@ -679,6 +1143,7 @@ var can = {
|
|
|
679
1143
|
edit,
|
|
680
1144
|
append,
|
|
681
1145
|
apply,
|
|
1146
|
+
share,
|
|
682
1147
|
run,
|
|
683
1148
|
observe,
|
|
684
1149
|
manage
|
|
@@ -701,9 +1166,11 @@ class SecurityRegistry {
|
|
|
701
1166
|
workflowIds: input.workflowIds,
|
|
702
1167
|
syncIds: input.syncIds,
|
|
703
1168
|
pipelineIds: input.pipelineIds,
|
|
704
|
-
|
|
1169
|
+
agentAvailable: input.agentAvailable,
|
|
705
1170
|
connectorIds: input.connectorIds,
|
|
706
|
-
observableIds: new Set(["logs"])
|
|
1171
|
+
observableIds: new Set(["logs", "aiUsage"]),
|
|
1172
|
+
manageableIds: new Set(["aiUsage"]),
|
|
1173
|
+
shareIds: input.shareIds
|
|
707
1174
|
});
|
|
708
1175
|
const universe = {
|
|
709
1176
|
applicationIds: input.applicationIds ?? APPLICATION_IDS,
|
|
@@ -713,9 +1180,10 @@ class SecurityRegistry {
|
|
|
713
1180
|
workflowIds: input.workflowIds ?? new Set,
|
|
714
1181
|
syncIds: input.syncIds ?? new Set,
|
|
715
1182
|
pipelineIds: input.pipelineIds ?? new Set,
|
|
716
|
-
agentIds: input.agentIds ?? new Set,
|
|
717
1183
|
connectorIds: input.connectorIds ?? new Set,
|
|
718
|
-
observableIds: new Set(["logs"]),
|
|
1184
|
+
observableIds: new Set(["logs", "aiUsage"]),
|
|
1185
|
+
manageableIds: new Set(["aiUsage"]),
|
|
1186
|
+
shareIds: input.shareIds ?? new Set,
|
|
719
1187
|
getSubTypes: input.getSubTypes ?? (() => [])
|
|
720
1188
|
};
|
|
721
1189
|
this.groupsById = definitions.groupsById;
|
|
@@ -770,7 +1238,8 @@ function createAuthStorageState() {
|
|
|
770
1238
|
invitations: new Map,
|
|
771
1239
|
groupMemberships: new Map,
|
|
772
1240
|
magicLinks: new Map,
|
|
773
|
-
oidcAuthorizationAttempts: new Map
|
|
1241
|
+
oidcAuthorizationAttempts: new Map,
|
|
1242
|
+
deviceAuthorizations: new Map
|
|
774
1243
|
};
|
|
775
1244
|
}
|
|
776
1245
|
function scopedKey(...parts) {
|
|
@@ -791,6 +1260,9 @@ function serviceAccountGroupMembershipKey(projectId, serviceAccountId, groupId)
|
|
|
791
1260
|
function sessionKey(projectId, id) {
|
|
792
1261
|
return scopedKey(projectId, id);
|
|
793
1262
|
}
|
|
1263
|
+
function deviceAuthorizationKey(projectId, id) {
|
|
1264
|
+
return scopedKey(projectId, id);
|
|
1265
|
+
}
|
|
794
1266
|
function accessTokenKey(projectId, id) {
|
|
795
1267
|
return scopedKey(projectId, id);
|
|
796
1268
|
}
|
|
@@ -818,7 +1290,7 @@ function cloneDate(value) {
|
|
|
818
1290
|
function dateOrNow(value) {
|
|
819
1291
|
return value ? cloneDate(value) : new Date;
|
|
820
1292
|
}
|
|
821
|
-
function
|
|
1293
|
+
function assertNonEmpty4(value, label) {
|
|
822
1294
|
const normalized = value.trim();
|
|
823
1295
|
if (!normalized) {
|
|
824
1296
|
throw new AuthStorageError("invalid_input", `[Sixb] ${label} must be a non-empty string.`);
|
|
@@ -826,10 +1298,10 @@ function assertNonEmpty2(value, label) {
|
|
|
826
1298
|
return normalized;
|
|
827
1299
|
}
|
|
828
1300
|
function normalizeEmail(email) {
|
|
829
|
-
return
|
|
1301
|
+
return assertNonEmpty4(email, "Email").toLowerCase();
|
|
830
1302
|
}
|
|
831
1303
|
function normalizeGroupIds(groupIds) {
|
|
832
|
-
return [...new Set((groupIds ?? []).map((groupId) =>
|
|
1304
|
+
return [...new Set((groupIds ?? []).map((groupId) => assertNonEmpty4(groupId, "Group id")))];
|
|
833
1305
|
}
|
|
834
1306
|
function normalizeOptionalGroupIds(groupIds) {
|
|
835
1307
|
return groupIds === undefined ? undefined : normalizeGroupIds(groupIds);
|
|
@@ -916,18 +1388,18 @@ function assertSessionIdAvailable(state, projectId, sessionId) {
|
|
|
916
1388
|
}
|
|
917
1389
|
}
|
|
918
1390
|
function validateCompleteSessionInput(state, projectId, session) {
|
|
919
|
-
const sessionId =
|
|
920
|
-
|
|
921
|
-
|
|
1391
|
+
const sessionId = assertNonEmpty4(session.id, "Session id");
|
|
1392
|
+
assertNonEmpty4(session.audience, "Session audience");
|
|
1393
|
+
assertNonEmpty4(session.tokenHash, "Session token hash");
|
|
922
1394
|
assertSessionIdAvailable(state, projectId, sessionId);
|
|
923
1395
|
}
|
|
924
1396
|
function createSessionRecord(state, input) {
|
|
925
|
-
const id =
|
|
926
|
-
const projectId =
|
|
927
|
-
const userId =
|
|
928
|
-
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");
|
|
929
1401
|
const audience = resolveAuthSessionAudience(input.audience);
|
|
930
|
-
const tokenHash =
|
|
1402
|
+
const tokenHash = assertNonEmpty4(input.tokenHash, "Session token hash");
|
|
931
1403
|
assertSessionIdAvailable(state, projectId, id);
|
|
932
1404
|
const session = {
|
|
933
1405
|
id,
|
|
@@ -946,9 +1418,9 @@ function createSessionRecord(state, input) {
|
|
|
946
1418
|
return session;
|
|
947
1419
|
}
|
|
948
1420
|
function createServiceAccountRecord(state, input) {
|
|
949
|
-
const id =
|
|
950
|
-
const projectId =
|
|
951
|
-
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");
|
|
952
1424
|
const key = serviceAccountKey(projectId, id);
|
|
953
1425
|
if (state.serviceAccounts.has(key)) {
|
|
954
1426
|
throw new AuthStorageError("duplicate_service_account", `[Sixb] Service account '${id}' already exists for project '${projectId}'.`);
|
|
@@ -969,9 +1441,9 @@ function createServiceAccountRecord(state, input) {
|
|
|
969
1441
|
return serviceAccount;
|
|
970
1442
|
}
|
|
971
1443
|
function upsertServiceAccountGroupMembershipRecord(state, input) {
|
|
972
|
-
const projectId =
|
|
973
|
-
const serviceAccountId =
|
|
974
|
-
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");
|
|
975
1447
|
if (!state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
|
|
976
1448
|
throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
|
|
977
1449
|
}
|
|
@@ -991,11 +1463,11 @@ function upsertServiceAccountGroupMembershipRecord(state, input) {
|
|
|
991
1463
|
return membership;
|
|
992
1464
|
}
|
|
993
1465
|
function createAccessTokenRecord(state, input) {
|
|
994
|
-
const id =
|
|
995
|
-
const projectId =
|
|
996
|
-
const name =
|
|
997
|
-
const subjectId =
|
|
998
|
-
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");
|
|
999
1471
|
assertAccessTokenSubject(input.kind, input.subjectType);
|
|
1000
1472
|
assertAccessTokenSubjectExists(state, projectId, input.subjectType, subjectId);
|
|
1001
1473
|
const key = accessTokenKey(projectId, id);
|
|
@@ -1020,9 +1492,9 @@ function createAccessTokenRecord(state, input) {
|
|
|
1020
1492
|
return token;
|
|
1021
1493
|
}
|
|
1022
1494
|
function upsertGroupMembershipRecord(state, input) {
|
|
1023
|
-
const projectId =
|
|
1024
|
-
const userId =
|
|
1025
|
-
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");
|
|
1026
1498
|
if (!state.users.has(userKey(projectId, userId))) {
|
|
1027
1499
|
throw new AuthStorageError("missing_user", `[Sixb] User '${userId}' not found for project '${projectId}'.`);
|
|
1028
1500
|
}
|
|
@@ -1042,9 +1514,9 @@ function upsertGroupMembershipRecord(state, input) {
|
|
|
1042
1514
|
return membership;
|
|
1043
1515
|
}
|
|
1044
1516
|
function removeGroupMembershipRecord(state, params) {
|
|
1045
|
-
const projectId =
|
|
1046
|
-
const userId =
|
|
1047
|
-
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");
|
|
1048
1520
|
const key = groupMembershipKey(projectId, userId, groupId);
|
|
1049
1521
|
const existing = state.groupMemberships.get(key);
|
|
1050
1522
|
if (!existing) {
|
|
@@ -1070,9 +1542,9 @@ function assertAccessTokenSubjectExists(state, projectId, subjectType, subjectId
|
|
|
1070
1542
|
throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${subjectId}' not found for project '${projectId}'.`);
|
|
1071
1543
|
}
|
|
1072
1544
|
function consumeMagicLinkRecord(state, params) {
|
|
1073
|
-
const projectId =
|
|
1074
|
-
const id =
|
|
1075
|
-
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");
|
|
1076
1548
|
const key = magicLinkKey(projectId, id);
|
|
1077
1549
|
const existing = state.magicLinks.get(key);
|
|
1078
1550
|
if (!existing) {
|
|
@@ -1092,9 +1564,9 @@ function consumeMagicLinkRecord(state, params) {
|
|
|
1092
1564
|
return consumed;
|
|
1093
1565
|
}
|
|
1094
1566
|
function consumeOidcAttemptRecord(state, params) {
|
|
1095
|
-
const projectId =
|
|
1096
|
-
const id =
|
|
1097
|
-
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");
|
|
1098
1570
|
const key = oidcAttemptKey(projectId, id);
|
|
1099
1571
|
const existing = state.oidcAuthorizationAttempts.get(key);
|
|
1100
1572
|
if (!existing) {
|
|
@@ -1175,6 +1647,100 @@ class InMemoryAuthAccessTokenStore {
|
|
|
1175
1647
|
}
|
|
1176
1648
|
}
|
|
1177
1649
|
|
|
1650
|
+
// src/storage/auth/types.ts
|
|
1651
|
+
var MAX_PENDING_DEVICE_AUTHORIZATIONS = 100;
|
|
1652
|
+
|
|
1653
|
+
// src/storage/auth/in-memory/device-authorizations.ts
|
|
1654
|
+
class InMemoryAuthDeviceAuthorizationStore {
|
|
1655
|
+
state;
|
|
1656
|
+
constructor(state) {
|
|
1657
|
+
this.state = state;
|
|
1658
|
+
}
|
|
1659
|
+
async create(input) {
|
|
1660
|
+
const id = assertNonEmpty4(input.id, "Device authorization id");
|
|
1661
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1662
|
+
for (const [key2, authorization] of this.state.deviceAuthorizations) {
|
|
1663
|
+
if (authorization.projectId === projectId && authorization.expiresAt <= input.createdAt) {
|
|
1664
|
+
this.state.deviceAuthorizations.delete(key2);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
const pending = [...this.state.deviceAuthorizations.values()].filter((authorization) => authorization.projectId === projectId && authorization.status === "pending").length;
|
|
1668
|
+
if (pending >= MAX_PENDING_DEVICE_AUTHORIZATIONS) {
|
|
1669
|
+
throw new AuthStorageError("device_authorization_limit_exceeded", `[Sixb] Project '${projectId}' has too many pending device authorizations.`);
|
|
1670
|
+
}
|
|
1671
|
+
const key = deviceAuthorizationKey(projectId, id);
|
|
1672
|
+
if (this.state.deviceAuthorizations.has(key)) {
|
|
1673
|
+
throw duplicateAuthorization(id, projectId);
|
|
1674
|
+
}
|
|
1675
|
+
const record = {
|
|
1676
|
+
id,
|
|
1677
|
+
projectId,
|
|
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"),
|
|
1682
|
+
tokenExpiresAt: new Date(input.tokenExpiresAt),
|
|
1683
|
+
status: "pending",
|
|
1684
|
+
createdAt: new Date(input.createdAt),
|
|
1685
|
+
expiresAt: new Date(input.expiresAt)
|
|
1686
|
+
};
|
|
1687
|
+
this.state.deviceAuthorizations.set(key, cloneRecord(record));
|
|
1688
|
+
return cloneRecord(record);
|
|
1689
|
+
}
|
|
1690
|
+
async getById(params) {
|
|
1691
|
+
const record = this.state.deviceAuthorizations.get(deviceAuthorizationKey(params.projectId, params.id));
|
|
1692
|
+
return record ? cloneRecord(record) : null;
|
|
1693
|
+
}
|
|
1694
|
+
async getByUserCode(params) {
|
|
1695
|
+
for (const record of this.state.deviceAuthorizations.values()) {
|
|
1696
|
+
if (record.projectId === params.projectId && record.userCode === params.userCode) {
|
|
1697
|
+
return cloneRecord(record);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
return null;
|
|
1701
|
+
}
|
|
1702
|
+
async approve(params) {
|
|
1703
|
+
const record = this.requirePending(params.projectId, params.id, params.approvedAt);
|
|
1704
|
+
const user = this.state.users.get(userKey(params.projectId, params.userId));
|
|
1705
|
+
const session = this.state.sessions.get(sessionKey(params.projectId, params.sessionId));
|
|
1706
|
+
if (!user || user.status !== "active" || !session || session.userId !== user.id || !isActiveSession(session, params.approvedAt)) {
|
|
1707
|
+
throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device authorization requires an active user session.");
|
|
1708
|
+
}
|
|
1709
|
+
const next = {
|
|
1710
|
+
...record,
|
|
1711
|
+
status: "approved",
|
|
1712
|
+
approvedUserId: assertNonEmpty4(params.userId, "Approved user id"),
|
|
1713
|
+
approvedSessionId: assertNonEmpty4(params.sessionId, "Approved session id"),
|
|
1714
|
+
approvedAt: new Date(params.approvedAt)
|
|
1715
|
+
};
|
|
1716
|
+
this.state.deviceAuthorizations.set(deviceAuthorizationKey(params.projectId, params.id), next);
|
|
1717
|
+
return cloneRecord(next);
|
|
1718
|
+
}
|
|
1719
|
+
async deny(params) {
|
|
1720
|
+
const record = this.requirePending(params.projectId, params.id, params.deniedAt);
|
|
1721
|
+
const next = {
|
|
1722
|
+
...record,
|
|
1723
|
+
status: "denied",
|
|
1724
|
+
deniedAt: new Date(params.deniedAt)
|
|
1725
|
+
};
|
|
1726
|
+
this.state.deviceAuthorizations.set(deviceAuthorizationKey(params.projectId, params.id), next);
|
|
1727
|
+
return cloneRecord(next);
|
|
1728
|
+
}
|
|
1729
|
+
requirePending(projectId, id, now) {
|
|
1730
|
+
const record = this.state.deviceAuthorizations.get(deviceAuthorizationKey(projectId, id));
|
|
1731
|
+
if (!record) {
|
|
1732
|
+
throw new AuthStorageError("missing_device_authorization", `[Sixb] Device authorization '${id}' not found for project '${projectId}'.`);
|
|
1733
|
+
}
|
|
1734
|
+
if (record.status !== "pending" || record.expiresAt <= now) {
|
|
1735
|
+
throw new AuthStorageError("invalid_device_authorization", `[Sixb] Device authorization '${id}' is no longer pending for project '${projectId}'.`);
|
|
1736
|
+
}
|
|
1737
|
+
return record;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function duplicateAuthorization(id, projectId) {
|
|
1741
|
+
return new AuthStorageError("duplicate_device_authorization", `[Sixb] Device authorization '${id}' already exists for project '${projectId}'.`);
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1178
1744
|
// src/storage/auth/in-memory/group-memberships.ts
|
|
1179
1745
|
class InMemoryAuthGroupMembershipStore {
|
|
1180
1746
|
state;
|
|
@@ -1203,10 +1769,10 @@ class InMemoryAuthUserIdentityStore {
|
|
|
1203
1769
|
this.state = state;
|
|
1204
1770
|
}
|
|
1205
1771
|
async upsert(input) {
|
|
1206
|
-
const projectId =
|
|
1207
|
-
const strategyId =
|
|
1208
|
-
const subject =
|
|
1209
|
-
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");
|
|
1210
1776
|
const key = identityKey(projectId, strategyId, subject);
|
|
1211
1777
|
const existing = this.state.identities.get(key);
|
|
1212
1778
|
const createdAt = existing?.createdAt ?? dateOrNow(input.createdAt);
|
|
@@ -1256,8 +1822,8 @@ class InMemoryAuthInvitationStore {
|
|
|
1256
1822
|
this.state = state;
|
|
1257
1823
|
}
|
|
1258
1824
|
async createOrUpdateActive(input) {
|
|
1259
|
-
const id =
|
|
1260
|
-
const projectId =
|
|
1825
|
+
const id = assertNonEmpty4(input.id, "Invitation id");
|
|
1826
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1261
1827
|
const email = normalizeEmail(input.email);
|
|
1262
1828
|
const groupIds = normalizeGroupIds(input.groupIds);
|
|
1263
1829
|
const now = dateOrNow(input.updatedAt ?? input.createdAt);
|
|
@@ -1355,12 +1921,12 @@ class InMemoryAuthMagicLinkStore {
|
|
|
1355
1921
|
this.state = state;
|
|
1356
1922
|
}
|
|
1357
1923
|
async create(input) {
|
|
1358
|
-
const id =
|
|
1359
|
-
const projectId =
|
|
1360
|
-
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");
|
|
1361
1927
|
const audience = resolveAuthSessionAudience(input.audience);
|
|
1362
1928
|
const email = normalizeEmail(input.email);
|
|
1363
|
-
const tokenHash =
|
|
1929
|
+
const tokenHash = assertNonEmpty4(input.tokenHash, "Magic link token hash");
|
|
1364
1930
|
const key = magicLinkKey(projectId, id);
|
|
1365
1931
|
if (this.state.magicLinks.has(key)) {
|
|
1366
1932
|
throw new AuthStorageError("duplicate_magic_link", `[Sixb] Magic link '${id}' already exists for project '${projectId}'.`);
|
|
@@ -1404,13 +1970,13 @@ class InMemoryAuthOidcAuthorizationAttemptStore {
|
|
|
1404
1970
|
this.state = state;
|
|
1405
1971
|
}
|
|
1406
1972
|
async create(input) {
|
|
1407
|
-
const id =
|
|
1408
|
-
const projectId =
|
|
1409
|
-
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");
|
|
1410
1976
|
const audience = resolveAuthSessionAudience(input.audience);
|
|
1411
|
-
const stateHash =
|
|
1412
|
-
const nonceHash =
|
|
1413
|
-
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");
|
|
1414
1980
|
const key = oidcAttemptKey(projectId, id);
|
|
1415
1981
|
if (this.state.oidcAuthorizationAttempts.has(key)) {
|
|
1416
1982
|
throw new AuthStorageError("duplicate_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' already exists for project '${projectId}'.`);
|
|
@@ -1449,8 +2015,8 @@ class InMemoryAuthServiceAccountGroupMembershipStore {
|
|
|
1449
2015
|
return cloneRecord(upsertServiceAccountGroupMembershipRecord(this.state, input));
|
|
1450
2016
|
}
|
|
1451
2017
|
async reconcileForServiceAccount(input) {
|
|
1452
|
-
const projectId =
|
|
1453
|
-
const serviceAccountId =
|
|
2018
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
2019
|
+
const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
|
|
1454
2020
|
if (!this.state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
|
|
1455
2021
|
throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
|
|
1456
2022
|
}
|
|
@@ -1501,8 +2067,8 @@ class InMemoryAuthServiceAccountStore {
|
|
|
1501
2067
|
return cloneOptionalRecord(record);
|
|
1502
2068
|
}
|
|
1503
2069
|
async update(input) {
|
|
1504
|
-
const projectId =
|
|
1505
|
-
const id =
|
|
2070
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
2071
|
+
const id = assertNonEmpty4(input.id, "Service account id");
|
|
1506
2072
|
const key = serviceAccountKey(projectId, id);
|
|
1507
2073
|
const existing = this.state.serviceAccounts.get(key);
|
|
1508
2074
|
if (!existing) {
|
|
@@ -1510,7 +2076,7 @@ class InMemoryAuthServiceAccountStore {
|
|
|
1510
2076
|
}
|
|
1511
2077
|
const next = {
|
|
1512
2078
|
...existing,
|
|
1513
|
-
name: input.name === undefined ? existing.name :
|
|
2079
|
+
name: input.name === undefined ? existing.name : assertNonEmpty4(input.name, "Service account name"),
|
|
1514
2080
|
description: input.description === undefined ? existing.description : input.description,
|
|
1515
2081
|
status: input.status ?? existing.status,
|
|
1516
2082
|
updatedAt: input.updatedAt ? cloneDate(input.updatedAt) : new Date
|
|
@@ -1618,8 +2184,8 @@ class InMemoryAuthUserStore {
|
|
|
1618
2184
|
this.state = state;
|
|
1619
2185
|
}
|
|
1620
2186
|
async create(input) {
|
|
1621
|
-
const id =
|
|
1622
|
-
const projectId =
|
|
2187
|
+
const id = assertNonEmpty4(input.id, "User id");
|
|
2188
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1623
2189
|
const email = normalizeEmail(input.email);
|
|
1624
2190
|
const key = userKey(projectId, id);
|
|
1625
2191
|
if (this.state.users.has(key)) {
|
|
@@ -1707,6 +2273,7 @@ class InMemoryAuthStorage {
|
|
|
1707
2273
|
groupMemberships = new InMemoryAuthGroupMembershipStore(this.state);
|
|
1708
2274
|
magicLinks = new InMemoryAuthMagicLinkStore(this.state);
|
|
1709
2275
|
oidcAuthorizationAttempts = new InMemoryAuthOidcAuthorizationAttemptStore(this.state);
|
|
2276
|
+
deviceAuthorizations = new InMemoryAuthDeviceAuthorizationStore(this.state);
|
|
1710
2277
|
snapshot() {
|
|
1711
2278
|
return {
|
|
1712
2279
|
users: structuredClone(this.state.users),
|
|
@@ -1718,7 +2285,8 @@ class InMemoryAuthStorage {
|
|
|
1718
2285
|
invitations: structuredClone(this.state.invitations),
|
|
1719
2286
|
groupMemberships: structuredClone(this.state.groupMemberships),
|
|
1720
2287
|
magicLinks: structuredClone(this.state.magicLinks),
|
|
1721
|
-
oidcAuthorizationAttempts: structuredClone(this.state.oidcAuthorizationAttempts)
|
|
2288
|
+
oidcAuthorizationAttempts: structuredClone(this.state.oidcAuthorizationAttempts),
|
|
2289
|
+
deviceAuthorizations: structuredClone(this.state.deviceAuthorizations)
|
|
1722
2290
|
};
|
|
1723
2291
|
}
|
|
1724
2292
|
restore(snapshot) {
|
|
@@ -1732,9 +2300,40 @@ class InMemoryAuthStorage {
|
|
|
1732
2300
|
restoreMap(this.state.groupMemberships, snapshot.groupMemberships);
|
|
1733
2301
|
restoreMap(this.state.magicLinks, snapshot.magicLinks);
|
|
1734
2302
|
restoreMap(this.state.oidcAuthorizationAttempts, snapshot.oidcAuthorizationAttempts);
|
|
2303
|
+
restoreMap(this.state.deviceAuthorizations, snapshot.deviceAuthorizations);
|
|
2304
|
+
}
|
|
2305
|
+
async completeDeviceAuthorization(input) {
|
|
2306
|
+
const key = deviceAuthorizationKey(input.projectId, input.id);
|
|
2307
|
+
const authorization = this.state.deviceAuthorizations.get(key);
|
|
2308
|
+
if (!authorization) {
|
|
2309
|
+
throw new AuthStorageError("missing_device_authorization", `[Sixb] Device authorization '${input.id}' not found for project '${input.projectId}'.`);
|
|
2310
|
+
}
|
|
2311
|
+
if (authorization.deviceCodeHash !== input.deviceCodeHash) {
|
|
2312
|
+
throw new AuthStorageError("invalid_device_authorization", "[Sixb] Invalid device authorization.");
|
|
2313
|
+
}
|
|
2314
|
+
if (authorization.status === "pending") {
|
|
2315
|
+
throw new AuthStorageError("pending_device_authorization", "[Sixb] Device authorization is pending.");
|
|
2316
|
+
}
|
|
2317
|
+
if (authorization.status === "denied") {
|
|
2318
|
+
throw new AuthStorageError("device_authorization_denied", "[Sixb] Device authorization was denied.");
|
|
2319
|
+
}
|
|
2320
|
+
if (authorization.status !== "approved" || !authorization.approvedUserId || !authorization.approvedSessionId || authorization.expiresAt <= input.completedAt) {
|
|
2321
|
+
throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device authorization is invalid.");
|
|
2322
|
+
}
|
|
2323
|
+
if (input.accessToken.projectId !== input.projectId || input.accessToken.subjectType !== "user" || input.accessToken.subjectId !== authorization.approvedUserId || input.accessToken.createdBySessionId !== authorization.approvedSessionId) {
|
|
2324
|
+
throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device access token is invalid.");
|
|
2325
|
+
}
|
|
2326
|
+
const accessToken = createAccessTokenRecord(this.state, input.accessToken);
|
|
2327
|
+
const consumed = {
|
|
2328
|
+
...authorization,
|
|
2329
|
+
status: "consumed",
|
|
2330
|
+
consumedAt: new Date(input.completedAt)
|
|
2331
|
+
};
|
|
2332
|
+
this.state.deviceAuthorizations.set(key, cloneRecord(consumed));
|
|
2333
|
+
return { authorization: cloneRecord(consumed), accessToken: cloneRecord(accessToken) };
|
|
1735
2334
|
}
|
|
1736
2335
|
async completeMagicLinkSignIn(input) {
|
|
1737
|
-
const projectId =
|
|
2336
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1738
2337
|
const completedAt = cloneDate(input.completedAt);
|
|
1739
2338
|
const magicLink = this.state.magicLinks.get(magicLinkKey(projectId, input.magicLinkId));
|
|
1740
2339
|
if (!magicLink) {
|
|
@@ -1781,7 +2380,7 @@ class InMemoryAuthStorage {
|
|
|
1781
2380
|
assertSignInSessionAudience(projectId, input.session.audience, magicLink.audience);
|
|
1782
2381
|
let newUserId;
|
|
1783
2382
|
if (shouldCreateUser) {
|
|
1784
|
-
newUserId =
|
|
2383
|
+
newUserId = assertNonEmpty4(input.newUserId, "User id");
|
|
1785
2384
|
if (this.state.users.has(userKey(projectId, newUserId))) {
|
|
1786
2385
|
throw new AuthStorageError("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
|
|
1787
2386
|
}
|
|
@@ -1795,7 +2394,7 @@ class InMemoryAuthStorage {
|
|
|
1795
2394
|
let user = existingUser;
|
|
1796
2395
|
if (!user) {
|
|
1797
2396
|
user = {
|
|
1798
|
-
id: newUserId ??
|
|
2397
|
+
id: newUserId ?? assertNonEmpty4(input.newUserId, "User id"),
|
|
1799
2398
|
projectId,
|
|
1800
2399
|
email: magicLink.email,
|
|
1801
2400
|
displayName: input.newUserDisplayName,
|
|
@@ -1833,7 +2432,7 @@ class InMemoryAuthStorage {
|
|
|
1833
2432
|
};
|
|
1834
2433
|
}
|
|
1835
2434
|
async completeOidcSignIn(input) {
|
|
1836
|
-
const projectId =
|
|
2435
|
+
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1837
2436
|
const completedAt = cloneDate(input.completedAt);
|
|
1838
2437
|
const attempt = this.state.oidcAuthorizationAttempts.get(oidcAttemptKey(projectId, input.oidcAuthorizationAttemptId));
|
|
1839
2438
|
if (!attempt) {
|
|
@@ -1845,7 +2444,7 @@ class InMemoryAuthStorage {
|
|
|
1845
2444
|
if (attempt.expiresAt <= completedAt) {
|
|
1846
2445
|
throw new AuthStorageError("expired_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' is expired for project '${projectId}'.`);
|
|
1847
2446
|
}
|
|
1848
|
-
const subject =
|
|
2447
|
+
const subject = assertNonEmpty4(input.subject, "Subject");
|
|
1849
2448
|
const email = normalizeEmail(input.email);
|
|
1850
2449
|
const claims = normalizeClaims(input.claims);
|
|
1851
2450
|
const identity = this.state.identities.get(identityKey(projectId, attempt.strategyId, subject));
|
|
@@ -1881,7 +2480,7 @@ class InMemoryAuthStorage {
|
|
|
1881
2480
|
assertSignInSessionAudience(projectId, input.session.audience, attempt.audience);
|
|
1882
2481
|
let newUserId;
|
|
1883
2482
|
if (shouldCreateUser) {
|
|
1884
|
-
newUserId =
|
|
2483
|
+
newUserId = assertNonEmpty4(input.newUserId, "User id");
|
|
1885
2484
|
if (this.state.users.has(userKey(projectId, newUserId))) {
|
|
1886
2485
|
throw new AuthStorageError("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
|
|
1887
2486
|
}
|
|
@@ -1889,7 +2488,7 @@ class InMemoryAuthStorage {
|
|
|
1889
2488
|
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
1890
2489
|
if (!user) {
|
|
1891
2490
|
user = {
|
|
1892
|
-
id: newUserId ??
|
|
2491
|
+
id: newUserId ?? assertNonEmpty4(input.newUserId, "User id"),
|
|
1893
2492
|
projectId,
|
|
1894
2493
|
email,
|
|
1895
2494
|
displayName: input.displayName,
|
|
@@ -3036,6 +3635,6 @@ var SYSTEM_PRINCIPAL = { type: "system", id: "system" };
|
|
|
3036
3635
|
function principalsEqual(left, right) {
|
|
3037
3636
|
return left.type === right.type && left.id === right.id;
|
|
3038
3637
|
}
|
|
3039
|
-
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, 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 };
|
|
3040
3639
|
|
|
3041
|
-
//# debugId=
|
|
3640
|
+
//# debugId=883B08C31B88A92764756E2164756E21
|