@sixb/core 0.1.7 → 0.1.9
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 +78 -84
- 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/types/context.d.ts +2 -0
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/validation.d.ts +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/actions/worker.js +33 -37
- package/dist/actions/worker.js.map +2 -2
- package/dist/agents/adapters.d.ts +8 -125
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +1 -1
- package/dist/agents/authority.d.ts.map +1 -1
- package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
- package/dist/agents/context/entries.d.ts.map +1 -0
- package/dist/agents/context/index.d.ts +4 -0
- package/dist/agents/context/index.d.ts.map +1 -0
- package/dist/agents/context/index.js +19 -0
- package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
- package/dist/agents/context-model.d.ts +1 -1
- package/dist/agents/context-model.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +0 -9
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/identity.d.ts +3 -0
- package/dist/agents/identity.d.ts.map +1 -0
- package/dist/agents/index.d.ts +7 -7
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +193 -205
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +5 -6
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +4 -0
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/request.d.ts +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +4 -0
- package/dist/agents/streams/index.d.ts.map +1 -0
- package/dist/agents/streams/index.js +20 -0
- package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
- package/dist/agents/streams/internal.d.ts +3 -0
- package/dist/agents/streams/internal.d.ts.map +1 -0
- package/dist/agents/streams/internal.js +40 -0
- package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
- package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
- package/dist/agents/streams/protocol.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts +0 -1
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +0 -4
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/ai-usage/execution.d.ts.map +1 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +96 -105
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/strategy.js +8 -9
- package/dist/auth/strategy.js.map +1 -1
- package/dist/authorization/decision.d.ts +10 -2
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +2 -1
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.d.ts +1 -1
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +51 -53
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/browser.js +15 -17
- package/dist/blob-storage/browser.js.map +1 -1
- package/dist/blob-storage/index.js +36 -38
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/bootstrap/discovery.d.ts +20 -1
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.d.ts +2 -2
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +79 -81
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
- package/dist/broker/index.js +8 -10
- package/dist/broker/index.js.map +1 -1
- package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
- package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
- package/dist/{chunk-3fqt22c4.js → chunk-0w35wavj.js} +360 -168
- package/dist/chunk-0w35wavj.js.map +14 -0
- package/dist/chunk-0y39rgsb.js +43 -0
- package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
- package/dist/{chunk-hdz94br2.js → chunk-17kfctj6.js} +23 -13
- package/dist/chunk-17kfctj6.js.map +10 -0
- package/dist/{chunk-e4rvtvpw.js → chunk-1enhpacz.js} +418 -233
- package/dist/chunk-1enhpacz.js.map +34 -0
- package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
- package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
- package/dist/{chunk-7ds9620f.js → chunk-38zv5rkr.js} +24 -8
- package/dist/chunk-38zv5rkr.js.map +10 -0
- package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
- package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
- package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
- package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
- package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
- package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
- package/dist/chunk-3frsnm7x.js +32 -0
- package/dist/chunk-3frsnm7x.js.map +11 -0
- package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
- package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
- package/dist/{chunk-qv38twt8.js → chunk-52hbv0ak.js} +192 -171
- package/dist/{chunk-qv38twt8.js.map → chunk-52hbv0ak.js.map} +6 -6
- package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
- package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
- package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
- package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
- package/dist/chunk-653vwrzr.js +39 -0
- package/dist/chunk-653vwrzr.js.map +10 -0
- package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
- package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
- package/dist/chunk-7apz6hg4.js +50 -0
- package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
- package/dist/chunk-7bs40fe1.js +218 -0
- package/dist/{chunk-08twe8m6.js.map → chunk-7bs40fe1.js.map} +3 -3
- package/dist/chunk-7zgecwy1.js +113 -0
- package/dist/chunk-7zgecwy1.js.map +10 -0
- package/dist/{chunk-tn7xcs2n.js → chunk-860dwwy0.js} +93 -30
- package/dist/chunk-860dwwy0.js.map +14 -0
- package/dist/chunk-8vj0rjgs.js +165 -0
- package/dist/chunk-8vj0rjgs.js.map +15 -0
- package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
- package/dist/chunk-92vk7gta.js.map +10 -0
- package/dist/{chunk-gbrpsx4m.js → chunk-93csa55g.js} +72 -16
- package/dist/chunk-93csa55g.js.map +11 -0
- package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
- package/dist/chunk-98cw09sw.js.map +10 -0
- package/dist/chunk-9qsh3p5y.js +111 -0
- package/dist/chunk-9qsh3p5y.js.map +11 -0
- package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
- package/dist/{chunk-z2sery1b.js → chunk-9vx5e9g1.js} +68 -28
- package/dist/chunk-9vx5e9g1.js.map +11 -0
- package/dist/{chunk-9aehf39w.js → chunk-an5tt9y0.js} +353 -353
- package/dist/{chunk-9aehf39w.js.map → chunk-an5tt9y0.js.map} +2 -2
- package/dist/{chunk-x0qhkqje.js → chunk-ap0g1g74.js} +37 -37
- package/dist/{chunk-x0qhkqje.js.map → chunk-ap0g1g74.js.map} +2 -2
- package/dist/chunk-awbhdqyc.js +252 -0
- package/dist/chunk-awbhdqyc.js.map +10 -0
- package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
- package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
- package/dist/chunk-br3k6qbf.js +436 -0
- package/dist/chunk-br3k6qbf.js.map +12 -0
- package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
- package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
- package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
- package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
- package/dist/chunk-d62kjtbg.js +7 -0
- package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
- package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
- package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
- package/dist/{chunk-atmkaf60.js → chunk-dmn70ztd.js} +30 -34
- package/dist/chunk-dmn70ztd.js.map +11 -0
- package/dist/chunk-dz5h08xv.js +1887 -0
- package/dist/chunk-dz5h08xv.js.map +25 -0
- package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
- package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
- package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
- package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
- package/dist/{chunk-ha58tjtt.js → chunk-emyyk7dx.js} +59 -55
- package/dist/{chunk-ha58tjtt.js.map → chunk-emyyk7dx.js.map} +3 -3
- package/dist/{chunk-3kv70xwp.js → chunk-ey1nk510.js} +18 -2
- package/dist/chunk-ey1nk510.js.map +10 -0
- package/dist/chunk-f0rwz2vh.js +152 -0
- package/dist/chunk-f0rwz2vh.js.map +11 -0
- package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
- package/dist/chunk-f4w3yp4f.js.map +12 -0
- package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
- package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
- package/dist/{chunk-rre42skh.js → chunk-g00bfdq6.js} +729 -296
- package/dist/{chunk-rre42skh.js.map → chunk-g00bfdq6.js.map} +11 -7
- package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
- package/dist/chunk-g53f0e4j.js.map +15 -0
- package/dist/chunk-g6cke204.js +124 -0
- package/dist/chunk-g6cke204.js.map +10 -0
- package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
- package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
- package/dist/chunk-h1gfhhbh.js +602 -0
- package/dist/chunk-h1gfhhbh.js.map +18 -0
- package/dist/chunk-h3v76ams.js +32 -0
- package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
- package/dist/chunk-hpr1r6av.js +4006 -0
- package/dist/chunk-hpr1r6av.js.map +44 -0
- package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
- package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
- package/dist/{chunk-rp1mvzb4.js → chunk-jjy0fhrn.js} +40 -35
- package/dist/{chunk-rp1mvzb4.js.map → chunk-jjy0fhrn.js.map} +3 -3
- package/dist/{chunk-4nxeacx7.js → chunk-jmfet9r4.js} +6 -6
- package/dist/{chunk-4nxeacx7.js.map → chunk-jmfet9r4.js.map} +2 -2
- package/dist/{chunk-64sr682n.js → chunk-k3cqkkn2.js} +61 -55
- package/dist/chunk-k3cqkkn2.js.map +12 -0
- package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
- package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
- package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
- package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
- package/dist/{chunk-qjycjdj6.js → chunk-m3z3x9v0.js} +106 -65
- package/dist/{chunk-qjycjdj6.js.map → chunk-m3z3x9v0.js.map} +3 -3
- package/dist/{chunk-6ed5bwnd.js → chunk-mjbk2djy.js} +2092 -1714
- package/dist/chunk-mjbk2djy.js.map +57 -0
- package/dist/{chunk-5jcdmjam.js → chunk-mmagke4x.js} +6 -6
- package/dist/{chunk-5jcdmjam.js.map → chunk-mmagke4x.js.map} +2 -2
- package/dist/chunk-mrp7k0pw.js +147 -0
- package/dist/chunk-mrp7k0pw.js.map +10 -0
- package/dist/{chunk-d63tybny.js → chunk-ms2tmn1k.js} +139 -139
- package/dist/{chunk-d63tybny.js.map → chunk-ms2tmn1k.js.map} +2 -2
- package/dist/{chunk-xdpwpkha.js → chunk-ppytyr6w.js} +156 -179
- package/dist/{chunk-xdpwpkha.js.map → chunk-ppytyr6w.js.map} +3 -5
- package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
- package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
- package/dist/{chunk-qjzp9xyb.js → chunk-pr2h4bv4.js} +33 -35
- package/dist/chunk-pr2h4bv4.js.map +12 -0
- package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
- package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
- package/dist/{chunk-agsvg9ar.js → chunk-qf954wje.js} +6 -6
- package/dist/{chunk-agsvg9ar.js.map → chunk-qf954wje.js.map} +2 -2
- package/dist/{chunk-wjgm6jjt.js → chunk-qhcpj9wc.js} +166 -132
- package/dist/chunk-qhcpj9wc.js.map +14 -0
- package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
- package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
- package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
- package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
- package/dist/{chunk-2b5qtban.js → chunk-r4tfx1sf.js} +142 -89
- package/dist/chunk-r4tfx1sf.js.map +15 -0
- package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
- package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
- package/dist/chunk-s3csryxe.js +152 -0
- package/dist/chunk-s3csryxe.js.map +11 -0
- package/dist/chunk-s670k14v.js +60 -0
- package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
- package/dist/chunk-skz0hst3.js +788 -0
- package/dist/chunk-skz0hst3.js.map +19 -0
- package/dist/chunk-v4jbb3rs.js +403 -0
- package/dist/chunk-v4jbb3rs.js.map +10 -0
- package/dist/{chunk-d2ndstdf.js → chunk-vf691g1r.js} +61 -59
- package/dist/{chunk-d2ndstdf.js.map → chunk-vf691g1r.js.map} +2 -2
- package/dist/{chunk-1kamz6j0.js → chunk-vsj3mdfj.js} +8 -8
- package/dist/{chunk-1kamz6j0.js.map → chunk-vsj3mdfj.js.map} +2 -2
- package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
- package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
- package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
- package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
- package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
- package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
- package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
- package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
- package/dist/chunk-x9v4cx1d.js +139 -0
- package/dist/chunk-x9v4cx1d.js.map +10 -0
- package/dist/{chunk-kt81c11h.js → chunk-xfbydgzy.js} +27 -27
- package/dist/{chunk-kt81c11h.js.map → chunk-xfbydgzy.js.map} +2 -2
- package/dist/{chunk-vjjv9mrb.js → chunk-xyr8kppc.js} +22 -22
- package/dist/{chunk-vjjv9mrb.js.map → chunk-xyr8kppc.js.map} +3 -3
- package/dist/chunk-ypbtykv6.js +1537 -0
- package/dist/chunk-ypbtykv6.js.map +19 -0
- package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
- package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
- package/dist/{chunk-xc7hq65b.js → chunk-z30bv4ga.js} +80 -33
- package/dist/chunk-z30bv4ga.js.map +11 -0
- package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
- package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
- package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
- package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
- package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
- package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
- package/dist/chunk-z8fx5cgb.js +159 -0
- package/dist/chunk-z8fx5cgb.js.map +11 -0
- package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
- package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
- package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
- package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
- package/dist/connectors/connections/internal.js +9 -10
- package/dist/connectors/connections/internal.js.map +1 -1
- 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 +13 -0
- package/dist/datasets/write.js.map +9 -0
- package/dist/edits/index.js +7 -8
- package/dist/edits/index.js.map +1 -1
- package/dist/error-reporting/internal.js +22 -24
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/errors/internal.d.ts +1 -1
- package/dist/errors/internal.d.ts.map +1 -1
- package/dist/errors/internal.js +22 -24
- package/dist/errors/internal.js.map +1 -1
- package/dist/errors/redaction.d.ts +8 -0
- package/dist/errors/redaction.d.ts.map +1 -0
- package/dist/errors/types.d.ts +4 -0
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +60 -63
- package/dist/events/index.js.map +1 -1
- package/dist/events/scope.js +4 -5
- package/dist/events/scope.js.map +1 -1
- package/dist/events/selectors/index.js +9 -10
- package/dist/events/selectors/index.js.map +1 -1
- package/dist/events/types/datasets.d.ts +2 -6
- package/dist/events/types/datasets.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +3 -3
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +70 -75
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +58 -20
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +69 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -0
- package/dist/execution/durable.d.ts +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.d.ts +2 -0
- package/dist/execution/primitive.d.ts.map +1 -1
- package/dist/execution/primitive.js +63 -64
- package/dist/execution/primitive.js.map +3 -3
- package/dist/execution/request.d.ts +12 -0
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +97 -71
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/scopes.d.ts +16 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/types.d.ts +9 -0
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts +2 -0
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +10 -11
- package/dist/http/index.js.map +1 -1
- package/dist/index.d.ts +21 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +455 -463
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/definition-updates.d.ts.map +1 -1
- package/dist/lake-storage/errors.d.ts +5 -1
- package/dist/lake-storage/errors.d.ts.map +1 -1
- package/dist/lake-storage/in-memory.d.ts +1 -0
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +6 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +40 -27
- 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.d.ts +3 -4
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js +18 -40
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/internal.d.ts +5 -0
- package/dist/logging/internal.d.ts.map +1 -0
- package/dist/logging/internal.js +43 -0
- package/dist/logging/internal.js.map +9 -0
- package/dist/materialization/index.js +46 -49
- package/dist/materialization/index.js.map +1 -1
- package/dist/materializer/index.js +137 -142
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/errors.d.ts +4 -0
- package/dist/models/errors.d.ts.map +1 -1
- package/dist/models/execution/binding.d.ts +9 -0
- package/dist/models/execution/binding.d.ts.map +1 -0
- package/dist/models/execution/errors.d.ts +9 -0
- package/dist/models/execution/errors.d.ts.map +1 -0
- package/dist/models/execution/index.d.ts +11 -0
- package/dist/models/execution/index.d.ts.map +1 -0
- package/dist/models/execution/index.js +55 -0
- package/dist/models/execution/index.js.map +9 -0
- package/dist/models/execution/model-call-accounting.d.ts +17 -0
- package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
- package/dist/models/execution/model-call-admission.d.ts +47 -0
- package/dist/models/execution/model-call-admission.d.ts.map +1 -0
- package/dist/models/execution/model-call-limits.d.ts +15 -0
- package/dist/models/execution/model-call-limits.d.ts.map +1 -0
- package/dist/models/execution/model-call-recorder.d.ts +40 -0
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
- package/dist/models/execution/model-call-recovery.d.ts +12 -0
- package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
- package/dist/models/execution/recovery-queue.d.ts +5 -0
- package/dist/models/execution/recovery-queue.d.ts.map +1 -0
- package/dist/models/execution/types.d.ts +44 -0
- package/dist/models/execution/types.d.ts.map +1 -0
- package/dist/models/execution/usage.d.ts +5 -0
- package/dist/models/execution/usage.d.ts.map +1 -0
- package/dist/models/execution.d.ts +6 -0
- package/dist/models/execution.d.ts.map +1 -0
- package/dist/models/generation-types.d.ts +40 -0
- package/dist/models/generation-types.d.ts.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +42 -43
- package/dist/models/index.js.map +1 -1
- package/dist/models/language-model.d.ts +3 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/output.d.ts +5 -0
- package/dist/models/output.d.ts.map +1 -0
- package/dist/models/resolve.d.ts +4 -0
- package/dist/models/resolve.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 +75 -84
- 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 +67 -73
- 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 -2
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +61 -111
- 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 +7 -1
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +65 -121
- package/dist/ontology/internal.js.map +3 -4
- 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 +57 -63
- 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 +58 -64
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/query.d.ts +0 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +11 -15
- package/dist/query.js.map +1 -1
- package/dist/queues/index.d.ts +2 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +6 -7
- package/dist/queues/index.js.map +1 -1
- package/dist/queues/types.d.ts +3 -20
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/execution.d.ts.map +1 -1
- package/dist/rules/internal.js +4 -5
- package/dist/rules/internal.js.map +1 -1
- package/dist/runtime/create.d.ts +6 -2
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +2 -0
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +4 -1
- 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/internal.js +13 -14
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +2 -0
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +6 -0
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +3 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/sandboxes/errors.d.ts +4 -0
- package/dist/sandboxes/errors.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +2 -2
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +14 -13
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +35 -7
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -10
- package/dist/scheduler/index.js.map +1 -1
- package/dist/schedules/execution.d.ts +2 -1
- package/dist/schedules/execution.d.ts.map +1 -1
- package/dist/schedules/index.js +31 -33
- package/dist/schedules/index.js.map +1 -1
- package/dist/security/every.d.ts +4 -1
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +7 -2
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +1 -0
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +7 -1
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +2 -0
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/access-plan.d.ts +22 -0
- package/dist/shares/access-plan.d.ts.map +1 -0
- package/dist/shares/builders.d.ts +14 -0
- package/dist/shares/builders.d.ts.map +1 -0
- package/dist/shares/compiler.d.ts +14 -0
- package/dist/shares/compiler.d.ts.map +1 -0
- package/dist/shares/errors.d.ts +4 -0
- package/dist/shares/errors.d.ts.map +1 -0
- package/dist/shares/execution.d.ts +57 -0
- package/dist/shares/execution.d.ts.map +1 -0
- package/dist/shares/index.d.ts +10 -0
- package/dist/shares/index.d.ts.map +1 -0
- package/dist/shares/internal.d.ts +3 -0
- package/dist/shares/internal.d.ts.map +1 -0
- package/dist/shares/internal.js +231 -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 +7 -9
- package/dist/storage/action-runs/failure.js.map +1 -1
- package/dist/storage/action-runs/provider.js +4 -8
- package/dist/storage/action-runs/provider.js.map +1 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +26 -30
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +0 -3
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/attribution.d.ts +4 -0
- package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
- package/dist/storage/ai-cost/groups.d.ts +3 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.d.ts +1 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +30 -143
- package/dist/storage/ai-cost/provider.js.map +3 -4
- package/dist/storage/ai-cost/types.d.ts +15 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +14 -16
- package/dist/storage/ai-limits/enforcement.js.map +1 -1
- package/dist/storage/ai-limits/provider.js +56 -57
- package/dist/storage/ai-limits/provider.js.map +1 -1
- package/dist/storage/auth/in-memory.d.ts +1 -1
- package/dist/storage/auth/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +34 -36
- package/dist/storage/connector-connections/provider.js.map +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 +6 -2
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +35 -12
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/run-link.d.ts +7 -0
- package/dist/storage/executions/run-link.d.ts.map +1 -1
- package/dist/storage/executions/types.d.ts +6 -2
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts +8 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts +8 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +14 -9
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +221 -227
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +10 -0
- package/dist/storage/internal.d.ts.map +1 -0
- package/dist/storage/internal.js +47 -0
- package/dist/storage/internal.js.map +9 -0
- 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 +105 -109
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/operation-scope.d.ts +3 -0
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +18 -17
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +4 -6
- package/dist/storage/pipeline-runs/provider.js.map +1 -1
- package/dist/storage/projection-runs/provider.js +66 -70
- package/dist/storage/projection-runs/provider.js.map +1 -1
- 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 +22 -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 +19 -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 +4 -6
- package/dist/storage/sync-runs/provider.js.map +1 -1
- package/dist/storage/transaction.d.ts +2 -1
- package/dist/storage/transaction.d.ts.map +1 -1
- package/dist/storage/types.d.ts +8 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.js +4 -6
- package/dist/storage/webhook-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +13 -18
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +0 -3
- 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 +55 -62
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/testing/action-execution.d.ts +4 -1
- package/dist/testing/action-execution.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +1 -0
- 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-model-call-groups-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/execution.d.ts +1 -0
- package/dist/testing/execution.d.ts.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +3087 -1328
- package/dist/testing/index.js.map +17 -13
- package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
- package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-read-scope-contract.d.ts +22 -0
- package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
- package/dist/testing/share-grant-storage-contract.d.ts +10 -0
- package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
- package/dist/testing/share-session-storage-contract.d.ts +9 -0
- package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
- package/dist/testing/workflow-execution.d.ts +1 -0
- package/dist/testing/workflow-execution.d.ts.map +1 -1
- package/dist/webhooks/internal.js +51 -56
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +11 -13
- package/dist/workers/index.js.map +2 -2
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/failure.d.ts +2 -0
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.js +135 -140
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +0 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +2 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +72 -30
- 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 +10 -7
- package/src/actions/types/context.ts +2 -0
- package/src/actions/validation.ts +2 -1
- package/src/agents/adapters.ts +34 -429
- package/src/agents/authority.ts +3 -4
- package/src/agents/{context.ts → context/entries.ts} +4 -4
- package/src/agents/context/index.ts +15 -0
- package/src/agents/context-model.ts +1 -1
- package/src/agents/context-resolution.ts +2 -5
- package/src/agents/errors.ts +0 -10
- package/src/agents/execution.ts +13 -5
- package/src/agents/identity.ts +4 -0
- package/src/agents/index.ts +5 -24
- package/src/agents/message.ts +5 -6
- package/src/agents/model-loop.ts +62 -6
- package/src/agents/request.ts +27 -29
- package/src/agents/streams/index.ts +18 -0
- package/src/agents/streams/internal.ts +19 -0
- package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
- package/src/agents/tool-definition.ts +0 -19
- package/src/agents/types.ts +1 -1
- package/src/agents/validation.ts +9 -72
- package/src/ai-usage/execution.ts +4 -11
- package/src/auth/index.ts +0 -1
- package/src/authorization/decision.ts +29 -14
- package/src/authorization/grant-kinds.ts +10 -0
- package/src/authorization/index.ts +1 -0
- package/src/bootstrap/discovery.ts +84 -24
- package/src/bootstrap/index.ts +8 -1
- 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/errors/internal.ts +90 -10
- package/src/errors/redaction.ts +98 -0
- package/src/errors/types.ts +4 -0
- package/src/events/execution.ts +57 -7
- package/src/events/types/datasets.ts +2 -6
- package/src/execution/agent.ts +6 -7
- package/src/execution/authorization.ts +470 -90
- package/src/execution/authorized-object-reader.ts +695 -0
- package/src/execution/durable.ts +21 -3
- package/src/execution/index.ts +1 -0
- package/src/execution/primitive.ts +5 -1
- package/src/execution/request.ts +66 -13
- package/src/execution/scopes.ts +36 -6
- package/src/execution/types.ts +8 -0
- package/src/http/api-routes.ts +45 -0
- package/src/index.ts +56 -33
- 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/logging/index.ts +2 -33
- package/src/logging/internal.ts +43 -0
- package/src/models/errors.ts +12 -0
- package/src/models/execution/binding.ts +29 -0
- package/src/models/execution/errors.ts +18 -0
- package/src/models/execution/index.ts +26 -0
- package/src/models/execution/model-call-accounting.ts +211 -0
- package/src/models/execution/model-call-admission.ts +127 -0
- package/src/models/execution/model-call-limits.ts +135 -0
- package/src/models/execution/model-call-recorder.ts +235 -0
- package/src/models/execution/model-call-recovery.ts +125 -0
- package/src/models/execution/recovery-queue.ts +31 -0
- package/src/models/execution/types.ts +58 -0
- package/src/models/execution/usage.ts +23 -0
- package/src/models/execution.ts +207 -0
- package/src/models/generation-types.ts +50 -0
- package/src/models/index.ts +8 -0
- package/src/models/language-model.ts +3 -0
- package/src/models/output.ts +45 -0
- package/src/models/resolve.ts +27 -0
- package/src/objects/authorized-ontology-view.ts +512 -0
- package/src/objects/execution.ts +99 -144
- 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 -2
- package/src/ontology/inference/index.ts +4 -1
- package/src/ontology/internal.ts +35 -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 +7 -12
- package/src/query.ts +0 -1
- package/src/queues/index.ts +4 -2
- package/src/queues/types.ts +6 -25
- package/src/rules/execution.ts +20 -8
- package/src/runtime/create.ts +7 -2
- package/src/runtime/definitions.ts +2 -0
- package/src/runtime/host.ts +27 -7
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +9 -0
- package/src/runtime/sixb.ts +27 -2
- package/src/runtime/types.ts +3 -0
- package/src/sandboxes/errors.ts +5 -0
- package/src/sandboxes/index.ts +3 -0
- package/src/sandboxes/sandbox.ts +35 -7
- package/src/schedules/execution.ts +24 -2
- package/src/security/every.ts +4 -0
- package/src/security/grants.ts +45 -3
- package/src/security/index.ts +1 -0
- package/src/security/registry.ts +3 -0
- package/src/security/types.ts +8 -0
- package/src/security/validation.ts +3 -0
- package/src/shares/access-plan.ts +225 -0
- package/src/shares/builders.ts +381 -0
- package/src/shares/compiler.ts +359 -0
- package/src/shares/errors.ts +3 -0
- package/src/shares/execution.ts +394 -0
- package/src/shares/index.ts +28 -0
- package/src/shares/internal.ts +9 -0
- package/src/shares/intersection.ts +178 -0
- package/src/shares/session-protocol.ts +258 -0
- package/src/shares/types.ts +76 -0
- package/src/shares/validation.ts +40 -0
- package/src/storage/agents/in-memory.ts +0 -3
- package/src/storage/agents/types.ts +0 -3
- package/src/storage/ai-cost/analytics.ts +1 -1
- package/src/storage/ai-cost/attribution.ts +15 -0
- package/src/storage/ai-cost/groups.ts +5 -1
- package/src/storage/ai-cost/provider.ts +1 -0
- package/src/storage/ai-cost/types.ts +7 -0
- package/src/storage/auth/in-memory.ts +1 -1
- package/src/storage/executions/in-memory.ts +13 -10
- package/src/storage/executions/provider.ts +34 -1
- package/src/storage/executions/run-link.ts +29 -0
- package/src/storage/executions/types.ts +6 -2
- package/src/storage/executions/validation.ts +78 -1
- package/src/storage/in-memory/index.ts +37 -3
- package/src/storage/index.ts +54 -29
- package/src/storage/internal.ts +20 -0
- package/src/storage/objects/execution-limits.ts +283 -0
- package/src/storage/objects/guard.ts +55 -0
- package/src/storage/objects/in-memory/index.ts +2 -0
- package/src/storage/objects/in-memory/keys.ts +46 -0
- package/src/storage/objects/in-memory/query.ts +754 -0
- package/src/storage/objects/in-memory/read-scope.ts +211 -0
- package/src/storage/objects/in-memory/read-source.ts +10 -0
- package/src/storage/objects/in-memory/selected-reader.ts +252 -0
- package/src/storage/objects/in-memory/storage.ts +589 -0
- package/src/storage/objects/index.ts +21 -0
- package/src/storage/objects/keys.ts +1 -1
- package/src/storage/objects/read-scope.ts +672 -0
- package/src/storage/objects/types.ts +123 -19
- package/src/storage/operation-scope.ts +16 -0
- package/src/storage/share-grants/errors.ts +14 -0
- package/src/storage/share-grants/in-memory.ts +107 -0
- package/src/storage/share-grants/index.ts +14 -0
- package/src/storage/share-grants/provider.ts +11 -0
- package/src/storage/share-grants/record.ts +347 -0
- package/src/storage/share-grants/types.ts +112 -0
- package/src/storage/share-sessions/errors.ts +14 -0
- package/src/storage/share-sessions/in-memory.ts +105 -0
- package/src/storage/share-sessions/index.ts +11 -0
- package/src/storage/share-sessions/provider.ts +9 -0
- package/src/storage/share-sessions/record.ts +176 -0
- package/src/storage/share-sessions/types.ts +57 -0
- package/src/storage/transaction.ts +14 -2
- package/src/storage/types.ts +27 -0
- package/src/storage/workflow-runs/in-memory.ts +0 -2
- package/src/storage/workflow-runs/types.ts +0 -3
- package/src/syncs/execution.ts +25 -5
- package/src/syncs/request.ts +5 -0
- package/src/testing/action-execution.ts +9 -2
- package/src/testing/agent-execution.ts +3 -0
- package/src/testing/agent-storage-contract.ts +0 -5
- package/src/testing/ai-model-call-groups-contract.ts +74 -2
- 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 +138 -1
- package/src/testing/execution.ts +6 -0
- package/src/testing/index.ts +16 -0
- package/src/testing/lake-merge-storage-contract.ts +3 -0
- package/src/testing/lake-storage-contract.ts +58 -0
- package/src/testing/object-read-scope-contract.ts +939 -0
- package/src/testing/share-grant-storage-contract.ts +325 -0
- package/src/testing/share-session-storage-contract.ts +235 -0
- package/src/testing/workflow-execution.ts +4 -0
- package/src/workflows/execution.ts +53 -14
- package/src/workflows/failure.ts +62 -1
- package/src/workflows/request.ts +5 -9
- package/src/workflows/run-dispatch.ts +0 -3
- package/src/workflows/types.ts +2 -0
- package/src/workflows/validation.ts +1 -1
- package/dist/agents/context.d.ts.map +0 -1
- package/dist/agents/context.js +0 -23
- package/dist/agents/streams.d.ts.map +0 -1
- package/dist/agents/streams.js +0 -55
- package/dist/chunk-08m3b6w8.js +0 -32
- package/dist/chunk-08twe8m6.js +0 -218
- package/dist/chunk-2b5qtban.js.map +0 -14
- package/dist/chunk-2xns679x.js.map +0 -11
- package/dist/chunk-37wk412q.js +0 -1370
- package/dist/chunk-37wk412q.js.map +0 -23
- package/dist/chunk-3fqt22c4.js.map +0 -14
- package/dist/chunk-3kv70xwp.js.map +0 -10
- package/dist/chunk-407j3msh.js +0 -60
- package/dist/chunk-64sr682n.js.map +0 -12
- package/dist/chunk-6ed5bwnd.js.map +0 -57
- package/dist/chunk-7ds9620f.js.map +0 -10
- package/dist/chunk-7y0f6rf1.js.map +0 -10
- package/dist/chunk-atmkaf60.js.map +0 -11
- package/dist/chunk-c15dr03f.js +0 -43
- package/dist/chunk-d8qkxt2v.js.map +0 -10
- package/dist/chunk-dqn23610.js +0 -72
- package/dist/chunk-dqn23610.js.map +0 -11
- package/dist/chunk-e4rvtvpw.js.map +0 -34
- package/dist/chunk-gbrpsx4m.js.map +0 -11
- package/dist/chunk-h0knpbz5.js +0 -2486
- package/dist/chunk-h0knpbz5.js.map +0 -38
- package/dist/chunk-hdz94br2.js.map +0 -10
- package/dist/chunk-jq43kdvk.js +0 -50
- package/dist/chunk-n2arzn6e.js +0 -1745
- package/dist/chunk-n2arzn6e.js.map +0 -20
- package/dist/chunk-p03r0h5s.js.map +0 -16
- package/dist/chunk-qjzp9xyb.js.map +0 -12
- package/dist/chunk-tn7xcs2n.js.map +0 -13
- package/dist/chunk-wjgm6jjt.js.map +0 -13
- package/dist/chunk-xc7hq65b.js.map +0 -10
- package/dist/chunk-y35ma3mj.js +0 -551
- package/dist/chunk-y35ma3mj.js.map +0 -15
- package/dist/chunk-y64skrwp.js +0 -19
- package/dist/chunk-z2sery1b.js.map +0 -11
- package/dist/chunk-zcnhxkvd.js +0 -7
- package/dist/logging/types.js +0 -27
- package/dist/logging/types.js.map +0 -9
- package/dist/storage/objects/in-memory.d.ts.map +0 -1
- package/src/storage/objects/in-memory.ts +0 -1241
- /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
- /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
- /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
package/dist/chunk-37wk412q.js
DELETED
|
@@ -1,1370 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
resolveSemanticType
|
|
4
|
-
} from "./chunk-d63tybny.js";
|
|
5
|
-
import {
|
|
6
|
-
createSixbError
|
|
7
|
-
} from "./chunk-2xns679x.js";
|
|
8
|
-
import {
|
|
9
|
-
compareStrings
|
|
10
|
-
} from "./chunk-n6jxh8sw.js";
|
|
11
|
-
|
|
12
|
-
// src/authorization/grant-kinds.ts
|
|
13
|
-
var GRANT_KINDS = {
|
|
14
|
-
"access:application": {
|
|
15
|
-
universeKey: "applicationIds",
|
|
16
|
-
subject: "application",
|
|
17
|
-
fix: "Use an application exported from '@sixb/core'."
|
|
18
|
-
},
|
|
19
|
-
"view:object": {
|
|
20
|
-
universeKey: "objectTypeIds",
|
|
21
|
-
subject: "object type",
|
|
22
|
-
fix: "Register it in 'ontology/' or pass it to createSixb({ ontologies }).",
|
|
23
|
-
expandsSubtypes: true
|
|
24
|
-
},
|
|
25
|
-
"view:dataset": {
|
|
26
|
-
universeKey: "datasetIds",
|
|
27
|
-
subject: "dataset",
|
|
28
|
-
fix: "Add it to 'datasets/' or pass it to createSixb({ datasets })."
|
|
29
|
-
},
|
|
30
|
-
"edit:object": {
|
|
31
|
-
universeKey: "objectTypeIds",
|
|
32
|
-
subject: "object type",
|
|
33
|
-
fix: "Register it in 'ontology/' or pass it to createSixb({ ontologies })."
|
|
34
|
-
},
|
|
35
|
-
"append:telemetry": {
|
|
36
|
-
universeKey: "objectTypeIds",
|
|
37
|
-
subject: "object type",
|
|
38
|
-
fix: "Register it in 'ontology/' or pass it to createSixb({ ontologies })."
|
|
39
|
-
},
|
|
40
|
-
"apply:action": {
|
|
41
|
-
universeKey: "actionIds",
|
|
42
|
-
subject: "action",
|
|
43
|
-
fix: "Add it to 'actions/' or pass it to createSixb({ actions })."
|
|
44
|
-
},
|
|
45
|
-
"run:workflow": {
|
|
46
|
-
universeKey: "workflowIds",
|
|
47
|
-
subject: "workflow",
|
|
48
|
-
fix: "Add it to 'workflows/' or pass it to createSixb({ workflows })."
|
|
49
|
-
},
|
|
50
|
-
"run:sync": {
|
|
51
|
-
universeKey: "syncIds",
|
|
52
|
-
subject: "sync",
|
|
53
|
-
fix: "Add it to 'syncs/' or pass it to createSixb({ syncs })."
|
|
54
|
-
},
|
|
55
|
-
"run:pipeline": {
|
|
56
|
-
universeKey: "pipelineIds",
|
|
57
|
-
subject: "pipeline",
|
|
58
|
-
fix: "Add it to 'pipelines/' or pass it to createSixb({ pipelines })."
|
|
59
|
-
},
|
|
60
|
-
"run:agent": {
|
|
61
|
-
singleton: true,
|
|
62
|
-
subject: "agent",
|
|
63
|
-
fix: "Configure models.language and use the exported agent reference in can.run(agent)."
|
|
64
|
-
},
|
|
65
|
-
"observe:logs": {
|
|
66
|
-
universeKey: "observableIds",
|
|
67
|
-
subject: "observability surface",
|
|
68
|
-
fix: 'Use can.observe("logs").'
|
|
69
|
-
},
|
|
70
|
-
"observe:aiUsage": {
|
|
71
|
-
universeKey: "observableIds",
|
|
72
|
-
subject: "observability surface",
|
|
73
|
-
fix: "Use can.observe(agent.usage)."
|
|
74
|
-
},
|
|
75
|
-
"manage:connector": {
|
|
76
|
-
universeKey: "connectorIds",
|
|
77
|
-
subject: "connector",
|
|
78
|
-
fix: "Add it to 'connectors/' or pass it to createSixb({ connectors })."
|
|
79
|
-
},
|
|
80
|
-
"manage:aiUsage": {
|
|
81
|
-
universeKey: "manageableIds",
|
|
82
|
-
subject: "management surface",
|
|
83
|
-
fix: "Use can.manage(agent.usage)."
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var GRANT_KIND_KEYS = Object.keys(GRANT_KINDS);
|
|
87
|
-
var TARGETED_GRANT_KIND_KEYS = GRANT_KIND_KEYS.filter((kind) => kind !== "run:agent");
|
|
88
|
-
function grantKindOf(grant) {
|
|
89
|
-
switch (grant.capability) {
|
|
90
|
-
case "access":
|
|
91
|
-
return "access:application";
|
|
92
|
-
case "view":
|
|
93
|
-
return `view:${grant.target}`;
|
|
94
|
-
case "edit":
|
|
95
|
-
return "edit:object";
|
|
96
|
-
case "append":
|
|
97
|
-
return "append:telemetry";
|
|
98
|
-
case "apply":
|
|
99
|
-
return "apply:action";
|
|
100
|
-
case "run":
|
|
101
|
-
return `run:${grant.target}`;
|
|
102
|
-
case "observe":
|
|
103
|
-
return `observe:${grant.target}`;
|
|
104
|
-
case "manage":
|
|
105
|
-
return `manage:${grant.target}`;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function emptyGrantSets() {
|
|
109
|
-
return {
|
|
110
|
-
"access:application": new Set,
|
|
111
|
-
"view:object": new Set,
|
|
112
|
-
"view:dataset": new Set,
|
|
113
|
-
"edit:object": new Set,
|
|
114
|
-
"append:telemetry": new Set,
|
|
115
|
-
"apply:action": new Set,
|
|
116
|
-
"run:workflow": new Set,
|
|
117
|
-
"run:sync": new Set,
|
|
118
|
-
"run:pipeline": new Set,
|
|
119
|
-
"run:agent": false,
|
|
120
|
-
"observe:logs": new Set,
|
|
121
|
-
"observe:aiUsage": new Set,
|
|
122
|
-
"manage:connector": new Set,
|
|
123
|
-
"manage:aiUsage": new Set
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// src/execution/types.ts
|
|
128
|
-
class RuntimeAuthorizationCapability {
|
|
129
|
-
#runtimeAuthorization = true;
|
|
130
|
-
constructor() {}
|
|
131
|
-
static create() {
|
|
132
|
-
const capability = new RuntimeAuthorizationCapability;
|
|
133
|
-
Object.freeze(capability);
|
|
134
|
-
return capability;
|
|
135
|
-
}
|
|
136
|
-
static is(value) {
|
|
137
|
-
return typeof value === "object" && value !== null && #runtimeAuthorization in value;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function createRuntimeAuthorizationCapability() {
|
|
141
|
-
return RuntimeAuthorizationCapability.create();
|
|
142
|
-
}
|
|
143
|
-
function isRuntimeAuthorizationCapability(value) {
|
|
144
|
-
return RuntimeAuthorizationCapability.is(value);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// src/execution/authorization.ts
|
|
148
|
-
var registeredAuthorizations = new WeakMap;
|
|
149
|
-
function createPrincipalRuntimeAuthorization(input) {
|
|
150
|
-
return createRegisteredPrincipalAuthorization(input);
|
|
151
|
-
}
|
|
152
|
-
function createAgentRuntimeAuthorization(input) {
|
|
153
|
-
assertNonEmpty(input.executionId, "Execution id");
|
|
154
|
-
if (input.actorId !== undefined)
|
|
155
|
-
assertNonEmpty(input.actorId, "Agent actor id");
|
|
156
|
-
assertNonEmpty(input.runId, "Agent run id");
|
|
157
|
-
const executionBinding = {
|
|
158
|
-
type: "agent",
|
|
159
|
-
executionId: input.executionId,
|
|
160
|
-
...input.actorId === undefined ? {} : { actorId: input.actorId },
|
|
161
|
-
runId: input.runId
|
|
162
|
-
};
|
|
163
|
-
if (input.authority.type === "principal") {
|
|
164
|
-
return createRegisteredPrincipalAuthorization({
|
|
165
|
-
projectId: input.projectId,
|
|
166
|
-
context: input.authority.context,
|
|
167
|
-
...input.authority.credential === undefined ? {} : { credential: input.authority.credential }
|
|
168
|
-
}, executionBinding);
|
|
169
|
-
}
|
|
170
|
-
return register({
|
|
171
|
-
type: "unrestricted",
|
|
172
|
-
projectId: input.projectId,
|
|
173
|
-
ref: Object.freeze({ type: "disabled" }),
|
|
174
|
-
executionBinding: Object.freeze(executionBinding)
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
function createRegisteredPrincipalAuthorization(input, executionBinding) {
|
|
178
|
-
const context = snapshotAuthorizationContext(input.context);
|
|
179
|
-
const credential = input.credential ? snapshotCredential(input.credential) : undefined;
|
|
180
|
-
assertCredentialMatchesContext(context, credential);
|
|
181
|
-
const ref = Object.freeze({
|
|
182
|
-
type: "principal",
|
|
183
|
-
principal: context.principal,
|
|
184
|
-
...credential === undefined ? {} : { credential }
|
|
185
|
-
});
|
|
186
|
-
return register({
|
|
187
|
-
type: "principal",
|
|
188
|
-
projectId: input.projectId,
|
|
189
|
-
context,
|
|
190
|
-
ref,
|
|
191
|
-
...executionBinding === undefined ? {} : { executionBinding: Object.freeze({ ...executionBinding }) }
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
function createDisabledRuntimeAuthorization(projectId) {
|
|
195
|
-
return register({ type: "unrestricted", projectId, ref: Object.freeze({ type: "disabled" }) });
|
|
196
|
-
}
|
|
197
|
-
function createTrustedPrimitiveRuntimeAuthorization(input) {
|
|
198
|
-
const primitive = snapshotTrustedPrimitive(input.primitive);
|
|
199
|
-
return register({
|
|
200
|
-
type: "unrestricted",
|
|
201
|
-
projectId: input.projectId,
|
|
202
|
-
ref: Object.freeze({ type: "trustedPrimitive", primitive })
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
function resolveRuntimeAuthorization(authorization) {
|
|
206
|
-
if (!isRuntimeAuthorizationCapability(authorization)) {
|
|
207
|
-
return { type: "denied" };
|
|
208
|
-
}
|
|
209
|
-
return registeredAuthorizations.get(authorization) ?? { type: "denied" };
|
|
210
|
-
}
|
|
211
|
-
function getAuthorizationRef(authorization) {
|
|
212
|
-
const resolved = resolveRuntimeAuthorization(authorization);
|
|
213
|
-
if (resolved.type === "denied") {
|
|
214
|
-
throw new Error("[Sixb] Runtime authorization is not a registered Core capability.");
|
|
215
|
-
}
|
|
216
|
-
return cloneAuthorizationRef(resolved.ref);
|
|
217
|
-
}
|
|
218
|
-
function assertExecutionScopeProject(projectId, scope) {
|
|
219
|
-
assertNonEmpty(projectId, "Project id");
|
|
220
|
-
if (scope.execution.projectId !== projectId) {
|
|
221
|
-
throw createSixbError("internal.unexpected", `[Sixb] Execution scope belongs to project '${scope.execution.projectId}', not '${projectId}'.`, {
|
|
222
|
-
details: {
|
|
223
|
-
executionId: scope.execution.id,
|
|
224
|
-
expectedProjectId: projectId,
|
|
225
|
-
scopeProjectId: scope.execution.projectId
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
const resolved = resolveRuntimeAuthorization(scope.authorization);
|
|
230
|
-
if (resolved.type === "denied") {
|
|
231
|
-
throw createSixbError("internal.unexpected", "[Sixb] Execution scope carries unregistered runtime authorization.", { details: { executionId: scope.execution.id, projectId } });
|
|
232
|
-
}
|
|
233
|
-
if (resolved.projectId !== projectId) {
|
|
234
|
-
throw createSixbError("internal.unexpected", `[Sixb] Execution authorization belongs to project '${resolved.projectId}', not '${projectId}'.`, {
|
|
235
|
-
details: {
|
|
236
|
-
authorizationProjectId: resolved.projectId,
|
|
237
|
-
executionId: scope.execution.id,
|
|
238
|
-
expectedProjectId: projectId
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function resolveExecutionScopeAuthorization(projectId, scope) {
|
|
244
|
-
assertExecutionScopeProject(projectId, scope);
|
|
245
|
-
const resolved = resolveRuntimeAuthorization(scope.authorization);
|
|
246
|
-
if (resolved.type === "denied") {
|
|
247
|
-
throw createSixbError("internal.unexpected", "[Sixb] Execution scope carries unregistered runtime authorization.", { details: { executionId: scope.execution.id, projectId } });
|
|
248
|
-
}
|
|
249
|
-
const { execution } = scope;
|
|
250
|
-
switch (execution.executor.type) {
|
|
251
|
-
case "request":
|
|
252
|
-
if (execution.source.type !== "http" || execution.source.requestId !== execution.executor.requestId) {
|
|
253
|
-
throw invalidExecutionAuthority(execution.id, "request source does not match its executor");
|
|
254
|
-
}
|
|
255
|
-
if (resolved.ref.type === "principal") {
|
|
256
|
-
if (resolved.type !== "principal" || resolved.executionBinding !== undefined || !principalsEqual(execution.requestedBy, resolved.ref.principal)) {
|
|
257
|
-
throw invalidExecutionAuthority(execution.id, "request authority does not match its requested-by principal");
|
|
258
|
-
}
|
|
259
|
-
return resolved;
|
|
260
|
-
}
|
|
261
|
-
if (resolved.ref.type === "disabled" && execution.requestedBy === undefined)
|
|
262
|
-
return resolved;
|
|
263
|
-
throw invalidExecutionAuthority(execution.id, "request execution requires principal or explicitly disabled authority");
|
|
264
|
-
case "primitive":
|
|
265
|
-
if (resolved.ref.type !== "trustedPrimitive" || resolved.ref.primitive.kind !== execution.executor.kind || resolved.ref.primitive.id !== execution.executor.id || resolved.ref.primitive.runId !== execution.executor.runId) {
|
|
266
|
-
throw invalidExecutionAuthority(execution.id, "trusted primitive authority does not match its executor");
|
|
267
|
-
}
|
|
268
|
-
return resolved;
|
|
269
|
-
case "agent":
|
|
270
|
-
if (resolved.executionBinding?.type !== "agent" || resolved.executionBinding.executionId !== execution.id || resolved.executionBinding.actorId !== execution.executor.actorId || resolved.executionBinding.runId !== execution.executor.runId) {
|
|
271
|
-
throw invalidExecutionAuthority(execution.id, "agent authority does not match its execution binding");
|
|
272
|
-
}
|
|
273
|
-
if (resolved.type === "principal" && resolved.ref.type === "principal")
|
|
274
|
-
return resolved;
|
|
275
|
-
if (resolved.type === "unrestricted" && resolved.ref.type === "disabled")
|
|
276
|
-
return resolved;
|
|
277
|
-
throw invalidExecutionAuthority(execution.id, "agent authority must be principal or explicitly disabled");
|
|
278
|
-
case "kernel":
|
|
279
|
-
if (resolved.ref.type !== "kernel" || execution.requestedBy !== undefined || resolved.ref.operation.type !== execution.executor.operation.type || resolved.ref.operation.recoveryId !== execution.executor.operation.recoveryId) {
|
|
280
|
-
throw invalidExecutionAuthority(execution.id, "kernel authority does not match its executor");
|
|
281
|
-
}
|
|
282
|
-
return resolved;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function principalsEqual(left, right) {
|
|
286
|
-
return left?.type === right?.type && left?.id === right?.id;
|
|
287
|
-
}
|
|
288
|
-
function invalidExecutionAuthority(executionId, reason) {
|
|
289
|
-
return createSixbError("internal.unexpected", `[Sixb] Execution '${executionId}' is incompatible with its authority: ${reason}.`, { details: { executionId, reason } });
|
|
290
|
-
}
|
|
291
|
-
function register(input) {
|
|
292
|
-
assertNonEmpty(input.projectId, "Authorization project id");
|
|
293
|
-
const authorization = createRuntimeAuthorizationCapability();
|
|
294
|
-
registeredAuthorizations.set(authorization, Object.freeze(input));
|
|
295
|
-
return authorization;
|
|
296
|
-
}
|
|
297
|
-
function snapshotAuthorizationContext(context) {
|
|
298
|
-
const principal = snapshotAuthorizablePrincipal(context.principal);
|
|
299
|
-
const grants = emptyGrantSets();
|
|
300
|
-
grants["run:agent"] = context.grants["run:agent"];
|
|
301
|
-
for (const kind of TARGETED_GRANT_KIND_KEYS) {
|
|
302
|
-
grants[kind] = new Set(context.grants[kind]);
|
|
303
|
-
}
|
|
304
|
-
const frozenGrants = Object.freeze(grants);
|
|
305
|
-
return Object.freeze({
|
|
306
|
-
principal,
|
|
307
|
-
...context.sessionId === undefined ? {} : { sessionId: context.sessionId },
|
|
308
|
-
groupIds: Object.freeze([...context.groupIds]),
|
|
309
|
-
roleIds: Object.freeze([...context.roleIds]),
|
|
310
|
-
grants: frozenGrants
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
function snapshotAuthorizablePrincipal(principal) {
|
|
314
|
-
if (principal.type !== "user" && principal.type !== "serviceAccount") {
|
|
315
|
-
throw new Error(`[Sixb] Principal type '${principal.type}' cannot hold runtime authorization.`);
|
|
316
|
-
}
|
|
317
|
-
assertNonEmpty(principal.id, "Authorization principal id");
|
|
318
|
-
return Object.freeze({ type: principal.type, id: principal.id });
|
|
319
|
-
}
|
|
320
|
-
function snapshotCredential(credential) {
|
|
321
|
-
assertNonEmpty(credential.id, "Authorization credential id");
|
|
322
|
-
if (credential.type !== "session" && credential.type !== "accessToken") {
|
|
323
|
-
const credentialType = credential.type;
|
|
324
|
-
throw new Error(`[Sixb] Unknown authorization credential type '${credentialType}'.`);
|
|
325
|
-
}
|
|
326
|
-
return Object.freeze({ type: credential.type, id: credential.id });
|
|
327
|
-
}
|
|
328
|
-
function assertCredentialMatchesContext(context, credential) {
|
|
329
|
-
if (credential?.type === "session") {
|
|
330
|
-
if (context.sessionId !== credential.id) {
|
|
331
|
-
throw new Error("[Sixb] Session credential id must match the authorization context session id.");
|
|
332
|
-
}
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
if (context.sessionId !== undefined) {
|
|
336
|
-
throw new Error("[Sixb] Authorization context session requires a matching session credential.");
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function snapshotTrustedPrimitive(primitive) {
|
|
340
|
-
if (!isTrustedPrimitiveKind(primitive.kind)) {
|
|
341
|
-
throw new Error(`[Sixb] Unknown trusted primitive kind '${primitive.kind}'.`);
|
|
342
|
-
}
|
|
343
|
-
assertNonEmpty(primitive.id, "Trusted primitive id");
|
|
344
|
-
assertNonEmpty(primitive.runId, "Trusted primitive run id");
|
|
345
|
-
return Object.freeze({ kind: primitive.kind, id: primitive.id, runId: primitive.runId });
|
|
346
|
-
}
|
|
347
|
-
function cloneAuthorizationRef(ref) {
|
|
348
|
-
switch (ref.type) {
|
|
349
|
-
case "principal":
|
|
350
|
-
return {
|
|
351
|
-
type: "principal",
|
|
352
|
-
principal: { ...ref.principal },
|
|
353
|
-
...ref.credential === undefined ? {} : { credential: { ...ref.credential } }
|
|
354
|
-
};
|
|
355
|
-
case "trustedPrimitive":
|
|
356
|
-
return { type: "trustedPrimitive", primitive: { ...ref.primitive } };
|
|
357
|
-
case "kernel":
|
|
358
|
-
return { type: "kernel", operation: { ...ref.operation } };
|
|
359
|
-
case "disabled":
|
|
360
|
-
return { type: "disabled" };
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function isTrustedPrimitiveKind(value) {
|
|
364
|
-
return value === "action" || value === "pipeline" || value === "projection" || value === "rule" || value === "sync" || value === "webhook" || value === "workflow";
|
|
365
|
-
}
|
|
366
|
-
function assertNonEmpty(value, label) {
|
|
367
|
-
if (!value.trim()) {
|
|
368
|
-
throw new Error(`[Sixb] ${label} must not be empty.`);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// src/authorization/errors.ts
|
|
373
|
-
class AuthorizationError extends Error {
|
|
374
|
-
grantKey;
|
|
375
|
-
name = "AuthorizationError";
|
|
376
|
-
constructor(grantKey, message) {
|
|
377
|
-
super(message);
|
|
378
|
-
this.grantKey = grantKey;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// src/authorization/decision.ts
|
|
383
|
-
function atomsFor(request) {
|
|
384
|
-
switch (request.kind) {
|
|
385
|
-
case "application.access":
|
|
386
|
-
return [{ kind: "access:application", id: request.audience }];
|
|
387
|
-
case "object.view":
|
|
388
|
-
return [{ kind: "view:object", id: request.objectTypeId }];
|
|
389
|
-
case "dataset.view":
|
|
390
|
-
return [{ kind: "view:dataset", id: request.datasetId }];
|
|
391
|
-
case "object.edit":
|
|
392
|
-
return [{ kind: "edit:object", id: request.objectTypeId }];
|
|
393
|
-
case "telemetry.append":
|
|
394
|
-
return [{ kind: "append:telemetry", id: request.objectTypeId }];
|
|
395
|
-
case "action.apply":
|
|
396
|
-
return [{ kind: "apply:action", id: request.actionId }];
|
|
397
|
-
case "workflow.run":
|
|
398
|
-
return [{ kind: "run:workflow", id: request.workflowId }];
|
|
399
|
-
case "sync.run":
|
|
400
|
-
return [{ kind: "run:sync", id: request.syncId }];
|
|
401
|
-
case "pipeline.run":
|
|
402
|
-
return [{ kind: "run:pipeline", id: request.pipelineId }];
|
|
403
|
-
case "agent.run":
|
|
404
|
-
return [{ kind: "run:agent" }];
|
|
405
|
-
case "logs.observe":
|
|
406
|
-
return [{ kind: "observe:logs", id: "logs" }];
|
|
407
|
-
case "aiUsage.observe":
|
|
408
|
-
return [{ kind: "observe:aiUsage", id: "aiUsage" }];
|
|
409
|
-
case "aiUsage.manage":
|
|
410
|
-
return [{ kind: "manage:aiUsage", id: "aiUsage" }];
|
|
411
|
-
case "connector.manage":
|
|
412
|
-
return [{ kind: "manage:connector", id: request.connectorId }];
|
|
413
|
-
case "object.query":
|
|
414
|
-
return request.touchedObjectTypeIds.map((id) => ({ kind: "view:object", id }));
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
function atomKey(atom) {
|
|
418
|
-
if (atom.kind === "run:agent")
|
|
419
|
-
return atom.kind;
|
|
420
|
-
if (atom.kind === "observe:logs" || atom.kind === "observe:aiUsage" || atom.kind === "manage:aiUsage") {
|
|
421
|
-
return atom.kind;
|
|
422
|
-
}
|
|
423
|
-
return `${atom.kind}:${atom.id}`;
|
|
424
|
-
}
|
|
425
|
-
function holds(grants, atom) {
|
|
426
|
-
if (atom.kind === "run:agent")
|
|
427
|
-
return grants[atom.kind];
|
|
428
|
-
return grants[atom.kind].has(atom.id);
|
|
429
|
-
}
|
|
430
|
-
function evaluate(authorization, request) {
|
|
431
|
-
const atoms = atomsFor(request);
|
|
432
|
-
const requirements = atoms.map(atomKey);
|
|
433
|
-
const missing = authorization ? atoms.filter((atom) => !holds(authorization.grants, atom)).map(atomKey) : [];
|
|
434
|
-
return { allowed: missing.length === 0, requirements, missing };
|
|
435
|
-
}
|
|
436
|
-
function isAllowed(authorization, request) {
|
|
437
|
-
return evaluate(authorization, request).allowed;
|
|
438
|
-
}
|
|
439
|
-
function assertAuthorized(runtime, request) {
|
|
440
|
-
const resolved = assertRuntimeAuthorizationBound(runtime);
|
|
441
|
-
const authorization = resolved.type === "principal" ? resolved.context : undefined;
|
|
442
|
-
const decision = evaluate(authorization, request);
|
|
443
|
-
if (decision.allowed) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
throw new AuthorizationError(decision.missing[0] ?? request.kind, deniedMessage(authorization, request));
|
|
447
|
-
}
|
|
448
|
-
function assertRuntimeAuthorizationBound(runtime) {
|
|
449
|
-
const resolved = resolveRuntimeAuthorization(runtime.runtimeAuthorization);
|
|
450
|
-
if (resolved.type === "denied") {
|
|
451
|
-
throw new AuthorizationError("runtime:unbound", "[Sixb] Protected operations require a registered execution scope.");
|
|
452
|
-
}
|
|
453
|
-
return resolved;
|
|
454
|
-
}
|
|
455
|
-
function assertCanEdit(runtime, objectTypeId) {
|
|
456
|
-
assertAuthorized(runtime, { kind: "object.view", objectTypeId });
|
|
457
|
-
assertAuthorized(runtime, { kind: "object.edit", objectTypeId });
|
|
458
|
-
}
|
|
459
|
-
function assertCanAppendTelemetry(runtime, objectTypeId) {
|
|
460
|
-
assertAuthorized(runtime, { kind: "telemetry.append", objectTypeId });
|
|
461
|
-
}
|
|
462
|
-
function assertCanManageConnector(runtime, connectorId) {
|
|
463
|
-
assertAuthorized(runtime, { kind: "connector.manage", connectorId });
|
|
464
|
-
}
|
|
465
|
-
function assertPrivileged(runtime, operation) {
|
|
466
|
-
const resolved = assertRuntimeAuthorizationBound(runtime);
|
|
467
|
-
if (resolved.type === "unrestricted") {
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
throw new AuthorizationError(`privileged:${operation}`, `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`);
|
|
471
|
-
}
|
|
472
|
-
function assertProviderAccess(runtime, execution, operation) {
|
|
473
|
-
const resolved = assertRuntimeAuthorizationBound(runtime);
|
|
474
|
-
if (resolved.type === "unrestricted") {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
const binding = resolved.executionBinding;
|
|
478
|
-
const executor = execution.executor;
|
|
479
|
-
if (binding?.type === "agent" && executor.type === "agent" && binding.executionId === execution.id && binding.actorId === executor.actorId && binding.runId === executor.runId) {
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
throw new AuthorizationError(`privileged:${operation}`, `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`);
|
|
483
|
-
}
|
|
484
|
-
function deniedMessage(authorization, request) {
|
|
485
|
-
const principalId = authorization?.principal.id ?? "unknown";
|
|
486
|
-
switch (request.kind) {
|
|
487
|
-
case "application.access":
|
|
488
|
-
return `[Sixb] Principal '${principalId}' is not allowed to access application '${request.audience}'.`;
|
|
489
|
-
case "object.view":
|
|
490
|
-
return `[Sixb] Principal '${principalId}' is not allowed to view object type '${request.objectTypeId}'.`;
|
|
491
|
-
case "dataset.view":
|
|
492
|
-
return `[Sixb] Principal '${principalId}' is not allowed to view dataset '${request.datasetId}'.`;
|
|
493
|
-
case "object.edit":
|
|
494
|
-
return `[Sixb] Principal '${principalId}' is not allowed to write object type '${request.objectTypeId}'.`;
|
|
495
|
-
case "telemetry.append":
|
|
496
|
-
return `[Sixb] Principal '${principalId}' is not allowed to append telemetry for object type '${request.objectTypeId}'.`;
|
|
497
|
-
case "action.apply":
|
|
498
|
-
return `[Sixb] Principal '${principalId}' is not allowed to apply action '${request.actionId}'.`;
|
|
499
|
-
case "workflow.run":
|
|
500
|
-
return `[Sixb] Principal '${principalId}' is not allowed to run workflow '${request.workflowId}'.`;
|
|
501
|
-
case "sync.run":
|
|
502
|
-
return `[Sixb] Principal '${principalId}' is not allowed to run sync '${request.syncId}'.`;
|
|
503
|
-
case "pipeline.run":
|
|
504
|
-
return `[Sixb] Principal '${principalId}' is not allowed to run pipeline '${request.pipelineId}'.`;
|
|
505
|
-
case "agent.run":
|
|
506
|
-
return `[Sixb] Principal '${principalId}' is not allowed to run the project Agent.`;
|
|
507
|
-
case "logs.observe":
|
|
508
|
-
return `[Sixb] Principal '${principalId}' is not allowed to observe project logs.`;
|
|
509
|
-
case "aiUsage.observe":
|
|
510
|
-
return `[Sixb] Principal '${principalId}' is not allowed to observe project AI usage.`;
|
|
511
|
-
case "aiUsage.manage":
|
|
512
|
-
return `[Sixb] Principal '${principalId}' is not allowed to manage project AI usage limits.`;
|
|
513
|
-
case "connector.manage":
|
|
514
|
-
return `[Sixb] Principal '${principalId}' is not allowed to manage connector '${request.connectorId}'.`;
|
|
515
|
-
case "object.query": {
|
|
516
|
-
const blocked = request.touchedObjectTypeIds.find((objectTypeId) => !isAllowed(authorization, { kind: "object.view", objectTypeId }));
|
|
517
|
-
return `[Sixb] Principal '${principalId}' is not allowed to view object type '${blocked}'.`;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
// src/authorization/application-access.ts
|
|
523
|
-
function isApplicationAccessControlled(roles, audience) {
|
|
524
|
-
return roles.some((role) => role.grants["access:application"].has(audience));
|
|
525
|
-
}
|
|
526
|
-
function canAccessApplication(authorization, roles, audience) {
|
|
527
|
-
return !isApplicationAccessControlled(roles, audience) || isAllowed(authorization, { kind: "application.access", audience });
|
|
528
|
-
}
|
|
529
|
-
// src/authorization/event-visibility.ts
|
|
530
|
-
function canViewEvent(authorization, event) {
|
|
531
|
-
if (!authorization) {
|
|
532
|
-
return true;
|
|
533
|
-
}
|
|
534
|
-
switch (event.topic) {
|
|
535
|
-
case "objects":
|
|
536
|
-
case "telemetry":
|
|
537
|
-
return isAllowed(authorization, {
|
|
538
|
-
kind: "object.view",
|
|
539
|
-
objectTypeId: event.payload.objectTypeId
|
|
540
|
-
});
|
|
541
|
-
case "links":
|
|
542
|
-
return isAllowed(authorization, {
|
|
543
|
-
kind: "object.view",
|
|
544
|
-
objectTypeId: event.payload.sourceTypeId
|
|
545
|
-
}) && isAllowed(authorization, { kind: "object.view", objectTypeId: event.payload.targetTypeId });
|
|
546
|
-
case "actions": {
|
|
547
|
-
if (!isAllowed(authorization, { kind: "action.apply", actionId: event.payload.actionId })) {
|
|
548
|
-
return false;
|
|
549
|
-
}
|
|
550
|
-
const subject = event.payload.subject;
|
|
551
|
-
return subject.kind === "object" ? isAllowed(authorization, { kind: "object.view", objectTypeId: subject.objectTypeId }) : true;
|
|
552
|
-
}
|
|
553
|
-
case "workflows":
|
|
554
|
-
return isAllowed(authorization, {
|
|
555
|
-
kind: "workflow.run",
|
|
556
|
-
workflowId: event.payload.workflowId
|
|
557
|
-
});
|
|
558
|
-
case "rules":
|
|
559
|
-
return isAllowed(authorization, {
|
|
560
|
-
kind: "object.view",
|
|
561
|
-
objectTypeId: event.payload.subject.objectTypeId
|
|
562
|
-
});
|
|
563
|
-
case "syncs":
|
|
564
|
-
return isAllowed(authorization, {
|
|
565
|
-
kind: "sync.run",
|
|
566
|
-
syncId: event.payload.syncId
|
|
567
|
-
});
|
|
568
|
-
case "pipelines":
|
|
569
|
-
return isAllowed(authorization, {
|
|
570
|
-
kind: "pipeline.run",
|
|
571
|
-
pipelineId: event.payload.pipelineId
|
|
572
|
-
});
|
|
573
|
-
case "schedules":
|
|
574
|
-
return true;
|
|
575
|
-
case "datasets":
|
|
576
|
-
return isAllowed(authorization, {
|
|
577
|
-
kind: "dataset.view",
|
|
578
|
-
datasetId: event.payload.datasetId
|
|
579
|
-
});
|
|
580
|
-
default:
|
|
581
|
-
return false;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
// src/authorization/resolve.ts
|
|
585
|
-
function resolveRoleGrants(role, universe) {
|
|
586
|
-
const grants = emptyGrantSets();
|
|
587
|
-
for (const grant of role.grants) {
|
|
588
|
-
if (grant.capability === "run" && grant.target === "agent") {
|
|
589
|
-
grants["run:agent"] = true;
|
|
590
|
-
continue;
|
|
591
|
-
}
|
|
592
|
-
const kind = grantKindOf(grant);
|
|
593
|
-
const spec = GRANT_KINDS[kind];
|
|
594
|
-
expandSelection(grant.selection, universe[spec.universeKey], grants[kind], spec.expandsSubtypes ? universe.getSubTypes : undefined);
|
|
595
|
-
}
|
|
596
|
-
return grants;
|
|
597
|
-
}
|
|
598
|
-
function expandSelection(selection, universe, into, expand) {
|
|
599
|
-
if (selection.all) {
|
|
600
|
-
const except = new Set(selection.except);
|
|
601
|
-
for (const id of universe) {
|
|
602
|
-
if (!except.has(id)) {
|
|
603
|
-
into.add(id);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
for (const id of selection.ids) {
|
|
609
|
-
into.add(id);
|
|
610
|
-
if (expand) {
|
|
611
|
-
for (const subTypeId of expand(id)) {
|
|
612
|
-
into.add(subTypeId);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
function resolveAuthorizationContext(input) {
|
|
618
|
-
const memberGroupIds = new Set(input.groupIds);
|
|
619
|
-
const roleIds = [];
|
|
620
|
-
const grants = emptyGrantSets();
|
|
621
|
-
for (const role of input.roles) {
|
|
622
|
-
if (!role.grantedToGroupIds.some((groupId) => memberGroupIds.has(groupId))) {
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
roleIds.push(role.id);
|
|
626
|
-
if (role.grants["run:agent"]) {
|
|
627
|
-
grants["run:agent"] = true;
|
|
628
|
-
}
|
|
629
|
-
for (const kind of TARGETED_GRANT_KIND_KEYS) {
|
|
630
|
-
for (const id of role.grants[kind]) {
|
|
631
|
-
grants[kind].add(id);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
return {
|
|
636
|
-
principal: input.principal,
|
|
637
|
-
...input.sessionId !== undefined ? { sessionId: input.sessionId } : {},
|
|
638
|
-
groupIds: input.groupIds,
|
|
639
|
-
roleIds,
|
|
640
|
-
grants
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
// src/projections/errors.ts
|
|
644
|
-
class ProjectionValidationError extends Error {
|
|
645
|
-
name = "ProjectionValidationError";
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
// src/projections/ownership.ts
|
|
649
|
-
function computeProjectionOwnership(projection, ontology) {
|
|
650
|
-
if (projection._tag === "ObjectProjectionDefinition") {
|
|
651
|
-
const primaryId = ontology.getPrimaryPropertyId(projection.objectTypeId);
|
|
652
|
-
return freezeOwnership({
|
|
653
|
-
objects: [
|
|
654
|
-
{
|
|
655
|
-
objectTypeId: projection.objectTypeId,
|
|
656
|
-
existence: true,
|
|
657
|
-
propertyIds: Object.keys(projection.properties).filter((propertyId) => propertyId !== primaryId).sort(compareStrings)
|
|
658
|
-
}
|
|
659
|
-
],
|
|
660
|
-
links: Object.keys(projection.links).sort(compareStrings).map((linkId) => ({ sourceObjectTypeId: projection.objectTypeId, linkId })),
|
|
661
|
-
telemetry: []
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
if (projection._tag === "LinkProjectionDefinition") {
|
|
665
|
-
return freezeOwnership({
|
|
666
|
-
objects: [],
|
|
667
|
-
links: [
|
|
668
|
-
{
|
|
669
|
-
sourceObjectTypeId: projection.sourceObjectTypeId,
|
|
670
|
-
linkId: projection.linkId
|
|
671
|
-
}
|
|
672
|
-
],
|
|
673
|
-
telemetry: []
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
return freezeOwnership({
|
|
677
|
-
objects: [],
|
|
678
|
-
links: [],
|
|
679
|
-
telemetry: Object.keys(projection.properties).sort(compareStrings).map((propertyId) => ({
|
|
680
|
-
objectTypeId: projection.objectTypeId,
|
|
681
|
-
propertyId
|
|
682
|
-
}))
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
function validateProjectionOwnership(projections) {
|
|
686
|
-
const existenceOwners = new Map;
|
|
687
|
-
const propertyOwners = new Map;
|
|
688
|
-
const linkOwners = new Map;
|
|
689
|
-
const telemetryOwners = new Map;
|
|
690
|
-
for (const { definition, ownership } of projections) {
|
|
691
|
-
for (const object of ownership.objects) {
|
|
692
|
-
if (object.existence) {
|
|
693
|
-
registerOwner(existenceOwners, object.objectTypeId, definition.id, `object type '${object.objectTypeId}' existence`);
|
|
694
|
-
}
|
|
695
|
-
for (const propertyId of object.propertyIds) {
|
|
696
|
-
registerOwner(propertyOwners, JSON.stringify([object.objectTypeId, propertyId]), definition.id, `property '${object.objectTypeId}.${propertyId}'`);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
for (const link of ownership.links) {
|
|
700
|
-
registerOwner(linkOwners, JSON.stringify([link.sourceObjectTypeId, link.linkId]), definition.id, `link scope '${link.sourceObjectTypeId}.${link.linkId}'`);
|
|
701
|
-
}
|
|
702
|
-
for (const telemetry of ownership.telemetry) {
|
|
703
|
-
registerOwner(telemetryOwners, JSON.stringify([telemetry.objectTypeId, telemetry.propertyId]), definition.id, `telemetry source '${telemetry.objectTypeId}.${telemetry.propertyId}'`);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
function registerOwner(owners, key, projectionId, description) {
|
|
708
|
-
const existing = owners.get(key);
|
|
709
|
-
if (existing !== undefined) {
|
|
710
|
-
throw new ProjectionValidationError(`[Sixb] Projection '${projectionId}' overlaps ${description} owned by projection '${existing}'.`);
|
|
711
|
-
}
|
|
712
|
-
owners.set(key, projectionId);
|
|
713
|
-
}
|
|
714
|
-
function freezeOwnership(ownership) {
|
|
715
|
-
return Object.freeze({
|
|
716
|
-
objects: Object.freeze(ownership.objects.map((object) => Object.freeze({ ...object, propertyIds: Object.freeze([...object.propertyIds]) }))),
|
|
717
|
-
links: Object.freeze(ownership.links.map((link) => Object.freeze({ ...link }))),
|
|
718
|
-
telemetry: Object.freeze(ownership.telemetry.map((telemetry) => Object.freeze({ ...telemetry })))
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
// src/projections/validation.ts
|
|
723
|
-
function validatePropertyMapping(objectType, mapping) {
|
|
724
|
-
const propertyIds = new Set(objectType.properties.map((p) => p.id));
|
|
725
|
-
const mappingKeys = Object.keys(mapping);
|
|
726
|
-
for (const key of mappingKeys) {
|
|
727
|
-
if (!propertyIds.has(key)) {
|
|
728
|
-
const available = [...propertyIds].sort().join(", ");
|
|
729
|
-
throw new ProjectionValidationError(`Property '${key}' does not exist on object type '${objectType.id}'. ` + `Available properties: ${available}`);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
const primaryProperties = objectType.properties.filter((p) => p.primary === true);
|
|
733
|
-
if (primaryProperties.length !== 1) {
|
|
734
|
-
throw new ProjectionValidationError(`Object type '${objectType.id}' must have exactly one primary property, ` + `found ${primaryProperties.length}.`);
|
|
735
|
-
}
|
|
736
|
-
const primaryId = primaryProperties[0].id;
|
|
737
|
-
if (!(primaryId in mapping)) {
|
|
738
|
-
throw new ProjectionValidationError(`Primary property '${primaryId}' of object type '${objectType.id}' ` + `must be included in the property mapping.`);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
function validateAndLowerLinkMapping(objectType, linkMapping, propertyMapping) {
|
|
742
|
-
const linkIds = new Set(objectType.links.map((l) => l.id));
|
|
743
|
-
const linksById = new Map(objectType.links.map((l) => [l.id, l]));
|
|
744
|
-
const propertyIds = new Set(objectType.properties.map((p) => p.id));
|
|
745
|
-
for (const [key, descriptor] of Object.entries(linkMapping)) {
|
|
746
|
-
if (!linkIds.has(key)) {
|
|
747
|
-
const available = [...linkIds].sort().join(", ");
|
|
748
|
-
throw new ProjectionValidationError(`Link '${key}' does not exist on object type '${objectType.id}'. ` + `Available links: ${available}`);
|
|
749
|
-
}
|
|
750
|
-
if (key !== descriptor.linkId) {
|
|
751
|
-
throw new ProjectionValidationError(`Link mapping key '${key}' does not match descriptor linkId '${descriptor.linkId}'.`);
|
|
752
|
-
}
|
|
753
|
-
const link = linksById.get(key);
|
|
754
|
-
if (Array.isArray(link.targetObjectTypeId)) {
|
|
755
|
-
throw new ProjectionValidationError(`Link '${key}' on object type '${objectType.id}' has a polymorphic target. ` + `FK projection of polymorphic links is not yet supported.`);
|
|
756
|
-
}
|
|
757
|
-
if (link.targetObjectTypeId === "*") {
|
|
758
|
-
throw new ProjectionValidationError(`Link '${key}' on object type '${objectType.id}' has a wildcard target. ` + `FK projection of wildcard links is not supported.`);
|
|
759
|
-
}
|
|
760
|
-
const sourcePropertyId = descriptor.sourcePropertyId;
|
|
761
|
-
const sourceField = descriptor.sourceField;
|
|
762
|
-
if (sourcePropertyId && sourceField) {
|
|
763
|
-
throw new ProjectionValidationError(`FK link '${key}' must use either sourceProperty or sourceField, not both.`);
|
|
764
|
-
}
|
|
765
|
-
if (!sourcePropertyId && !sourceField) {
|
|
766
|
-
throw new ProjectionValidationError(`FK link '${key}' must declare sourceProperty or sourceField.`);
|
|
767
|
-
}
|
|
768
|
-
if (!sourcePropertyId) {
|
|
769
|
-
continue;
|
|
770
|
-
}
|
|
771
|
-
if (!propertyIds.has(sourcePropertyId)) {
|
|
772
|
-
const available = [...propertyIds].sort().join(", ");
|
|
773
|
-
throw new ProjectionValidationError(`Source property '${sourcePropertyId}' does not exist on ` + `object type '${objectType.id}'. Available properties: ${available}`);
|
|
774
|
-
}
|
|
775
|
-
if (!(sourcePropertyId in propertyMapping)) {
|
|
776
|
-
throw new ProjectionValidationError(`Source property '${sourcePropertyId}' for link '${key}' ` + `must be included in the property mapping.`);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
return Object.fromEntries(Object.entries(linkMapping).map(([linkId, descriptor]) => [
|
|
780
|
-
linkId,
|
|
781
|
-
{
|
|
782
|
-
linkId: descriptor.linkId,
|
|
783
|
-
...descriptor.sourcePropertyId !== undefined ? { sourcePropertyId: descriptor.sourcePropertyId } : {},
|
|
784
|
-
...descriptor.sourceField !== undefined ? { sourceField: descriptor.sourceField } : {},
|
|
785
|
-
targetObjectTypeId: descriptor.targetObjectTypeId
|
|
786
|
-
}
|
|
787
|
-
]));
|
|
788
|
-
}
|
|
789
|
-
function validateLinkProjectionTarget(linkToken) {
|
|
790
|
-
if (Array.isArray(linkToken.targetObjectTypeId)) {
|
|
791
|
-
throw new ProjectionValidationError(`Link '${linkToken.id}' has a polymorphic target. ` + `Link projection of polymorphic links is not yet supported.`);
|
|
792
|
-
}
|
|
793
|
-
if (linkToken.targetObjectTypeId === "*") {
|
|
794
|
-
throw new ProjectionValidationError(`Link '${linkToken.id}' has a wildcard target. ` + `Link projection of wildcard links is not supported.`);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
function validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, valueTypesById, prefix) {
|
|
798
|
-
const mappedProperties = Object.entries(projection.properties);
|
|
799
|
-
if (mappedProperties.length === 0) {
|
|
800
|
-
throw new ProjectionValidationError(`${prefix}: must map at least one telemetry property`);
|
|
801
|
-
}
|
|
802
|
-
const mappedFields = [
|
|
803
|
-
["objectId", projection.objectIdField],
|
|
804
|
-
["at", projection.atField]
|
|
805
|
-
];
|
|
806
|
-
for (const [fieldRole, columnName] of mappedFields) {
|
|
807
|
-
if (!datasetColumnNames.has(columnName)) {
|
|
808
|
-
throw new ProjectionValidationError(`${prefix}: ${fieldRole} field "${columnName}" references unknown dataset column ` + `on dataset "${projection.datasetId}"`);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]));
|
|
812
|
-
const resolvedProperties = new Map;
|
|
813
|
-
for (const [propertyId, mapping] of mappedProperties) {
|
|
814
|
-
const property = propertiesById.get(propertyId);
|
|
815
|
-
if (!property) {
|
|
816
|
-
throw new ProjectionValidationError(`${prefix}: unknown property "${propertyId}" on type "${projection.objectTypeId}"`);
|
|
817
|
-
}
|
|
818
|
-
if (property.mode !== "telemetry") {
|
|
819
|
-
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" on type "${projection.objectTypeId}" must be telemetry-enabled`);
|
|
820
|
-
}
|
|
821
|
-
for (const [fieldRole, columnName] of [
|
|
822
|
-
["value", mapping.valueField],
|
|
823
|
-
...mapping.unitField !== undefined ? [["unit", mapping.unitField]] : []
|
|
824
|
-
]) {
|
|
825
|
-
if (!datasetColumnNames.has(columnName)) {
|
|
826
|
-
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" ${fieldRole} field "${columnName}" references ` + `unknown dataset column on dataset "${projection.datasetId}"`);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
const semanticType = resolveSemanticType(property, valueTypesById);
|
|
830
|
-
if (semanticType !== undefined && mapping.unitField === undefined) {
|
|
831
|
-
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" requires a unit field because it uses semantic type "${semanticType}"`);
|
|
832
|
-
}
|
|
833
|
-
if (semanticType === undefined && mapping.unitField !== undefined) {
|
|
834
|
-
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" cannot map a unit field because it has no semantic type`);
|
|
835
|
-
}
|
|
836
|
-
resolvedProperties.set(propertyId, property);
|
|
837
|
-
}
|
|
838
|
-
return resolvedProperties;
|
|
839
|
-
}
|
|
840
|
-
function validateProjectionsAtStartup(projections, ontology, datasetsById) {
|
|
841
|
-
const { objectProjections, linkProjections, telemetryProjections } = projections;
|
|
842
|
-
const objectTypesById = ontology.getObjectTypesById();
|
|
843
|
-
const primaryByTypeId = ontology.getPrimaryByTypeId();
|
|
844
|
-
const validatedObjectProjections = [];
|
|
845
|
-
const validatedLinkProjections = [];
|
|
846
|
-
const validatedTelemetryProjections = [];
|
|
847
|
-
validateMaterializationOntologyConstraints(ontology);
|
|
848
|
-
for (const projection of objectProjections) {
|
|
849
|
-
const prefix = `Projection "${projection.id}"`;
|
|
850
|
-
const dataset = datasetsById.get(projection.datasetId);
|
|
851
|
-
if (!dataset) {
|
|
852
|
-
throw new ProjectionValidationError(`${prefix}: unknown dataset "${projection.datasetId}". ` + `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`);
|
|
853
|
-
}
|
|
854
|
-
const objectType = objectTypesById.get(projection.objectTypeId);
|
|
855
|
-
if (!objectType) {
|
|
856
|
-
throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
|
|
857
|
-
}
|
|
858
|
-
const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
|
|
859
|
-
const conflictResolution = projection.conflictResolution ?? { strategy: "editsWin" };
|
|
860
|
-
if (conflictResolution.strategy === "mostRecent") {
|
|
861
|
-
const sourceTimestamp = dataset.schema.columns.find((column) => column.name === conflictResolution.sourceTimestamp);
|
|
862
|
-
if (!sourceTimestamp) {
|
|
863
|
-
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" references unknown ` + `dataset column on dataset "${projection.datasetId}"`);
|
|
864
|
-
}
|
|
865
|
-
if (sourceTimestamp.type !== "timestamp") {
|
|
866
|
-
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `timestamp dataset column`);
|
|
867
|
-
}
|
|
868
|
-
if (sourceTimestamp.nullable === true) {
|
|
869
|
-
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `non-null timestamp dataset column`);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
const propertyIds = new Set(objectType.properties.map((p) => p.id));
|
|
873
|
-
for (const [propId, columnName] of Object.entries(projection.properties)) {
|
|
874
|
-
if (!propertyIds.has(propId)) {
|
|
875
|
-
throw new ProjectionValidationError(`${prefix}: unknown property "${propId}" on type "${projection.objectTypeId}"`);
|
|
876
|
-
}
|
|
877
|
-
if (!datasetColumnNames.has(columnName)) {
|
|
878
|
-
throw new ProjectionValidationError(`${prefix}: property "${propId}" references unknown dataset column "${columnName}" ` + `on dataset "${projection.datasetId}"`);
|
|
879
|
-
}
|
|
880
|
-
const property = objectType.properties.find((candidate) => candidate.id === propId);
|
|
881
|
-
if (property?.mode === "telemetry") {
|
|
882
|
-
throw new ProjectionValidationError(`[Sixb] ${prefix}: source mappings cannot own telemetry property "${projection.objectTypeId}.${propId}"`);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
const primaryId = primaryByTypeId.get(projection.objectTypeId);
|
|
886
|
-
if (!(primaryId in projection.properties)) {
|
|
887
|
-
throw new ProjectionValidationError(`${prefix}: primary property "${primaryId}" must be in property mapping`);
|
|
888
|
-
}
|
|
889
|
-
const linkIds = new Set(objectType.links.map((l) => l.id));
|
|
890
|
-
for (const [linkId, fk] of Object.entries(projection.links)) {
|
|
891
|
-
if (!linkIds.has(linkId)) {
|
|
892
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" references unknown link on type "${projection.objectTypeId}"`);
|
|
893
|
-
}
|
|
894
|
-
if (fk.linkId !== linkId) {
|
|
895
|
-
throw new ProjectionValidationError(`${prefix}: FK link mapping key "${linkId}" does not match descriptor linkId "${fk.linkId}"`);
|
|
896
|
-
}
|
|
897
|
-
const sourcePropertyId = fk.sourcePropertyId;
|
|
898
|
-
const sourceField = fk.sourceField;
|
|
899
|
-
if (sourcePropertyId && sourceField) {
|
|
900
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" must use either sourcePropertyId or sourceField, not both`);
|
|
901
|
-
}
|
|
902
|
-
if (!sourcePropertyId && !sourceField) {
|
|
903
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" must declare sourcePropertyId or sourceField`);
|
|
904
|
-
}
|
|
905
|
-
if (sourcePropertyId && !propertyIds.has(sourcePropertyId)) {
|
|
906
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" source property "${sourcePropertyId}" does not exist on type "${projection.objectTypeId}"`);
|
|
907
|
-
}
|
|
908
|
-
if (sourcePropertyId && !(sourcePropertyId in projection.properties)) {
|
|
909
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" source property "${sourcePropertyId}" must be in property mapping`);
|
|
910
|
-
}
|
|
911
|
-
if (sourceField && !datasetColumnNames.has(sourceField)) {
|
|
912
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" source field "${sourceField}" references unknown dataset column on dataset "${projection.datasetId}"`);
|
|
913
|
-
}
|
|
914
|
-
if (!objectTypesById.has(fk.targetObjectTypeId)) {
|
|
915
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" target type "${fk.targetObjectTypeId}" is unknown`);
|
|
916
|
-
}
|
|
917
|
-
if (!primaryByTypeId.has(fk.targetObjectTypeId)) {
|
|
918
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" target type "${fk.targetObjectTypeId}" has no primary property`);
|
|
919
|
-
}
|
|
920
|
-
const link = objectType.links.find((candidate) => candidate.id === linkId);
|
|
921
|
-
if (!ontology.isValidLinkTarget(link.targetObjectTypeId, fk.targetObjectTypeId)) {
|
|
922
|
-
throw new ProjectionValidationError(`${prefix}: FK link "${linkId}" target type "${fk.targetObjectTypeId}" is not compatible with its declared target`);
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
validatedObjectProjections.push({
|
|
926
|
-
definition: projection,
|
|
927
|
-
dataset,
|
|
928
|
-
ownership: computeProjectionOwnership(projection, ontology)
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
for (const projection of linkProjections) {
|
|
932
|
-
const prefix = `Projection "${projection.id}"`;
|
|
933
|
-
const dataset = datasetsById.get(projection.datasetId);
|
|
934
|
-
if (!dataset) {
|
|
935
|
-
throw new ProjectionValidationError(`${prefix}: unknown dataset "${projection.datasetId}". ` + `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`);
|
|
936
|
-
}
|
|
937
|
-
if (!objectTypesById.has(projection.sourceObjectTypeId)) {
|
|
938
|
-
throw new ProjectionValidationError(`${prefix}: unknown source type "${projection.sourceObjectTypeId}"`);
|
|
939
|
-
}
|
|
940
|
-
if (!objectTypesById.has(projection.targetObjectTypeId)) {
|
|
941
|
-
throw new ProjectionValidationError(`${prefix}: unknown target type "${projection.targetObjectTypeId}"`);
|
|
942
|
-
}
|
|
943
|
-
const sourceType = objectTypesById.get(projection.sourceObjectTypeId);
|
|
944
|
-
const link = sourceType.links.find((candidate) => candidate.id === projection.linkId);
|
|
945
|
-
if (!link) {
|
|
946
|
-
throw new ProjectionValidationError(`${prefix}: link "${projection.linkId}" does not exist on source type "${projection.sourceObjectTypeId}"`);
|
|
947
|
-
}
|
|
948
|
-
if (!ontology.isValidLinkTarget(link.targetObjectTypeId, projection.targetObjectTypeId)) {
|
|
949
|
-
throw new ProjectionValidationError(`${prefix}: target type "${projection.targetObjectTypeId}" is not compatible with link "${projection.linkId}"`);
|
|
950
|
-
}
|
|
951
|
-
const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
|
|
952
|
-
if (!datasetColumnNames.has(projection.sourceField)) {
|
|
953
|
-
throw new ProjectionValidationError(`${prefix}: source field "${projection.sourceField}" references unknown dataset column ` + `on dataset "${projection.datasetId}"`);
|
|
954
|
-
}
|
|
955
|
-
if (!datasetColumnNames.has(projection.targetField)) {
|
|
956
|
-
throw new ProjectionValidationError(`${prefix}: target field "${projection.targetField}" references unknown dataset column ` + `on dataset "${projection.datasetId}"`);
|
|
957
|
-
}
|
|
958
|
-
if (!primaryByTypeId.has(projection.sourceObjectTypeId)) {
|
|
959
|
-
throw new ProjectionValidationError(`${prefix}: source type "${projection.sourceObjectTypeId}" has no primary property`);
|
|
960
|
-
}
|
|
961
|
-
if (!primaryByTypeId.has(projection.targetObjectTypeId)) {
|
|
962
|
-
throw new ProjectionValidationError(`${prefix}: target type "${projection.targetObjectTypeId}" has no primary property`);
|
|
963
|
-
}
|
|
964
|
-
validatedLinkProjections.push({
|
|
965
|
-
definition: projection,
|
|
966
|
-
dataset,
|
|
967
|
-
ownership: computeProjectionOwnership(projection, ontology)
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
for (const projection of telemetryProjections) {
|
|
971
|
-
const prefix = `Projection "${projection.id}"`;
|
|
972
|
-
const dataset = datasetsById.get(projection.datasetId);
|
|
973
|
-
if (!dataset) {
|
|
974
|
-
throw new ProjectionValidationError(`${prefix}: unknown dataset "${projection.datasetId}". ` + `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`);
|
|
975
|
-
}
|
|
976
|
-
const objectType = objectTypesById.get(projection.objectTypeId);
|
|
977
|
-
if (!objectType) {
|
|
978
|
-
throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
|
|
979
|
-
}
|
|
980
|
-
const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
|
|
981
|
-
validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, ontology.getValueTypesById(), prefix);
|
|
982
|
-
validatedTelemetryProjections.push({
|
|
983
|
-
definition: projection,
|
|
984
|
-
dataset,
|
|
985
|
-
ownership: computeProjectionOwnership(projection, ontology)
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
const validatedProjections = [
|
|
989
|
-
...validatedObjectProjections,
|
|
990
|
-
...validatedLinkProjections,
|
|
991
|
-
...validatedTelemetryProjections
|
|
992
|
-
];
|
|
993
|
-
validateProjectionOwnership(validatedProjections);
|
|
994
|
-
return {
|
|
995
|
-
objectProjections: validatedObjectProjections,
|
|
996
|
-
linkProjections: validatedLinkProjections,
|
|
997
|
-
telemetryProjections: validatedTelemetryProjections
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
function validateMaterializationOntologyConstraints(ontology) {
|
|
1001
|
-
for (const objectType of ontology.getObjectTypesById().values()) {
|
|
1002
|
-
for (const property of objectType.properties) {
|
|
1003
|
-
if (property.mode === "telemetry" && property.required === true) {
|
|
1004
|
-
throw new ProjectionValidationError(`[Sixb] Telemetry property '${objectType.id}.${property.id}' cannot be required.`);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
for (const link of objectType.links) {
|
|
1008
|
-
for (const property of link.properties ?? []) {
|
|
1009
|
-
if (property.mode === "telemetry") {
|
|
1010
|
-
throw new ProjectionValidationError(`[Sixb] Link property '${objectType.id}.${link.id}.${property.id}' cannot use telemetry mode.`);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
// src/projections/builders.ts
|
|
1018
|
-
function assertNonEmpty2(value, field) {
|
|
1019
|
-
if (!value.trim()) {
|
|
1020
|
-
throw new ProjectionValidationError(`Projection ${field} must not be empty.`);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
function assertProjectionDataset(dataset) {
|
|
1024
|
-
if (!dataset || dataset.kind !== "dataset" || typeof dataset.id !== "string") {
|
|
1025
|
-
throw new ProjectionValidationError("Projection dataset must be a dataset definition.");
|
|
1026
|
-
}
|
|
1027
|
-
assertNonEmpty2(dataset.id, "dataset id");
|
|
1028
|
-
}
|
|
1029
|
-
function isRecord(value) {
|
|
1030
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1031
|
-
}
|
|
1032
|
-
function lowerForeignKeyMapping(mapping) {
|
|
1033
|
-
const lowered = {};
|
|
1034
|
-
for (const [linkId, descriptor] of Object.entries(mapping)) {
|
|
1035
|
-
if (!descriptor)
|
|
1036
|
-
continue;
|
|
1037
|
-
lowered[linkId] = isForeignKeyDescriptor(descriptor) ? descriptor : fromForeignKey(descriptor);
|
|
1038
|
-
}
|
|
1039
|
-
return lowered;
|
|
1040
|
-
}
|
|
1041
|
-
function isForeignKeyDescriptor(value) {
|
|
1042
|
-
return isRecord(value) && typeof value.linkId === "string";
|
|
1043
|
-
}
|
|
1044
|
-
function defineProjection(id, target) {
|
|
1045
|
-
if ("link" in target)
|
|
1046
|
-
return buildLinkProjection(id, target);
|
|
1047
|
-
if ("property" in target)
|
|
1048
|
-
return buildTelemetryProjection(id, target);
|
|
1049
|
-
return buildObjectTypeProjection(id, target);
|
|
1050
|
-
}
|
|
1051
|
-
function buildObjectTypeProjection(id, objectType) {
|
|
1052
|
-
assertNonEmpty2(id, "id");
|
|
1053
|
-
return {
|
|
1054
|
-
fromDataset(dataset) {
|
|
1055
|
-
assertProjectionDataset(dataset);
|
|
1056
|
-
const datasetId = dataset.id;
|
|
1057
|
-
return {
|
|
1058
|
-
properties(mapping) {
|
|
1059
|
-
const propertyMapping = mapping;
|
|
1060
|
-
validatePropertyMapping(objectType, propertyMapping);
|
|
1061
|
-
return objectProjectionBuilder({
|
|
1062
|
-
id,
|
|
1063
|
-
objectType,
|
|
1064
|
-
datasetId,
|
|
1065
|
-
propertyMapping,
|
|
1066
|
-
links: {},
|
|
1067
|
-
conflictResolution: { strategy: "editsWin" }
|
|
1068
|
-
});
|
|
1069
|
-
},
|
|
1070
|
-
points(mapping) {
|
|
1071
|
-
const pointMapping = lowerTelemetryPropertiesPointMapping(objectType, mapping);
|
|
1072
|
-
return {
|
|
1073
|
-
_tag: "TelemetryProjectionDefinition",
|
|
1074
|
-
id,
|
|
1075
|
-
objectTypeId: objectType.id,
|
|
1076
|
-
datasetId,
|
|
1077
|
-
objectIdField: pointMapping.objectId,
|
|
1078
|
-
atField: pointMapping.at,
|
|
1079
|
-
properties: pointMapping.properties
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
function objectProjectionBuilder(input) {
|
|
1087
|
-
const definition = {
|
|
1088
|
-
_tag: "ObjectProjectionDefinition",
|
|
1089
|
-
id: input.id,
|
|
1090
|
-
objectTypeId: input.objectType.id,
|
|
1091
|
-
datasetId: input.datasetId,
|
|
1092
|
-
properties: { ...input.propertyMapping },
|
|
1093
|
-
links: { ...input.links },
|
|
1094
|
-
conflictResolution: { ...input.conflictResolution }
|
|
1095
|
-
};
|
|
1096
|
-
return Object.assign(definition, {
|
|
1097
|
-
withLinks(linkMapping) {
|
|
1098
|
-
const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
|
|
1099
|
-
const validatedLinks = validateAndLowerLinkMapping(input.objectType, loweredLinkMapping, input.propertyMapping);
|
|
1100
|
-
return objectProjectionBuilder({ ...input, links: validatedLinks });
|
|
1101
|
-
},
|
|
1102
|
-
resolveConflicts(resolution) {
|
|
1103
|
-
validateConflictResolution(resolution);
|
|
1104
|
-
return objectProjectionBuilder({
|
|
1105
|
-
...input,
|
|
1106
|
-
conflictResolution: resolution
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
function validateConflictResolution(resolution) {
|
|
1112
|
-
if (resolution.strategy === "editsWin")
|
|
1113
|
-
return;
|
|
1114
|
-
assertNonEmpty2(resolution.sourceTimestamp, "source timestamp field");
|
|
1115
|
-
}
|
|
1116
|
-
function buildTelemetryProjection(id, propertyToken) {
|
|
1117
|
-
assertNonEmpty2(id, "id");
|
|
1118
|
-
validateTelemetryProjectionProperty(propertyToken);
|
|
1119
|
-
return {
|
|
1120
|
-
fromDataset(dataset) {
|
|
1121
|
-
assertProjectionDataset(dataset);
|
|
1122
|
-
const datasetId = dataset.id;
|
|
1123
|
-
return {
|
|
1124
|
-
points(mapping) {
|
|
1125
|
-
const pointMapping = lowerTelemetryPointMapping(mapping);
|
|
1126
|
-
return {
|
|
1127
|
-
_tag: "TelemetryProjectionDefinition",
|
|
1128
|
-
id,
|
|
1129
|
-
objectTypeId: propertyToken.objectTypeId,
|
|
1130
|
-
datasetId,
|
|
1131
|
-
objectIdField: pointMapping.objectId,
|
|
1132
|
-
atField: pointMapping.at,
|
|
1133
|
-
properties: {
|
|
1134
|
-
[propertyToken.id]: {
|
|
1135
|
-
valueField: pointMapping.value,
|
|
1136
|
-
...pointMapping.unit !== undefined ? { unitField: pointMapping.unit } : {}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
function validateTelemetryProjectionProperty(propertyToken) {
|
|
1146
|
-
if (propertyToken.property.mode !== "telemetry") {
|
|
1147
|
-
throw new ProjectionValidationError(`Projection property '${propertyToken.objectTypeId}.${propertyToken.id}' must be telemetry-enabled.`);
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
function lowerTelemetryPointMapping(mapping) {
|
|
1151
|
-
const allowedKeys = new Set(["objectId", "at", "value", "unit"]);
|
|
1152
|
-
for (const key of Object.keys(mapping)) {
|
|
1153
|
-
if (!allowedKeys.has(key)) {
|
|
1154
|
-
throw new ProjectionValidationError(`Telemetry projection point mapping contains unknown key '${key}'.`);
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
if (mapping.objectId === undefined) {
|
|
1158
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires objectId.");
|
|
1159
|
-
}
|
|
1160
|
-
if (mapping.at === undefined) {
|
|
1161
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires at.");
|
|
1162
|
-
}
|
|
1163
|
-
if (mapping.value === undefined) {
|
|
1164
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires value.");
|
|
1165
|
-
}
|
|
1166
|
-
assertNonEmpty2(mapping.objectId, "objectId field");
|
|
1167
|
-
assertNonEmpty2(mapping.at, "at field");
|
|
1168
|
-
assertNonEmpty2(mapping.value, "value field");
|
|
1169
|
-
if (mapping.unit !== undefined) {
|
|
1170
|
-
assertNonEmpty2(mapping.unit, "unit field");
|
|
1171
|
-
}
|
|
1172
|
-
return {
|
|
1173
|
-
objectId: mapping.objectId,
|
|
1174
|
-
at: mapping.at,
|
|
1175
|
-
value: mapping.value,
|
|
1176
|
-
...mapping.unit !== undefined ? { unit: mapping.unit } : {}
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
function lowerTelemetryPropertiesPointMapping(objectType, mapping) {
|
|
1180
|
-
const allowedKeys = new Set(["objectId", "at", "properties"]);
|
|
1181
|
-
for (const key of Object.keys(mapping)) {
|
|
1182
|
-
if (!allowedKeys.has(key)) {
|
|
1183
|
-
throw new ProjectionValidationError(`Telemetry projection point mapping contains unknown key '${key}'.`);
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
if (mapping.objectId === undefined) {
|
|
1187
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires objectId.");
|
|
1188
|
-
}
|
|
1189
|
-
if (mapping.at === undefined) {
|
|
1190
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires at.");
|
|
1191
|
-
}
|
|
1192
|
-
if (mapping.properties === undefined) {
|
|
1193
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires properties.");
|
|
1194
|
-
}
|
|
1195
|
-
if (!isRecord(mapping.properties)) {
|
|
1196
|
-
throw new ProjectionValidationError("Telemetry projection point mapping properties must be an object.");
|
|
1197
|
-
}
|
|
1198
|
-
assertNonEmpty2(mapping.objectId, "objectId field");
|
|
1199
|
-
assertNonEmpty2(mapping.at, "at field");
|
|
1200
|
-
const propertyEntries = Object.entries(mapping.properties);
|
|
1201
|
-
if (propertyEntries.length === 0) {
|
|
1202
|
-
throw new ProjectionValidationError("Telemetry projection point mapping requires at least one property.");
|
|
1203
|
-
}
|
|
1204
|
-
const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]));
|
|
1205
|
-
const properties = {};
|
|
1206
|
-
for (const [propertyId, input] of propertyEntries) {
|
|
1207
|
-
const property = propertiesById.get(propertyId);
|
|
1208
|
-
if (!property) {
|
|
1209
|
-
throw new ProjectionValidationError(`Property '${propertyId}' does not exist on object type '${objectType.id}'.`);
|
|
1210
|
-
}
|
|
1211
|
-
if (property.mode !== "telemetry") {
|
|
1212
|
-
throw new ProjectionValidationError(`Projection property '${objectType.id}.${propertyId}' must be telemetry-enabled.`);
|
|
1213
|
-
}
|
|
1214
|
-
properties[propertyId] = lowerTelemetryPropertyMapping(propertyId, input);
|
|
1215
|
-
}
|
|
1216
|
-
return { objectId: mapping.objectId, at: mapping.at, properties };
|
|
1217
|
-
}
|
|
1218
|
-
function lowerTelemetryPropertyMapping(propertyId, input) {
|
|
1219
|
-
if (typeof input === "string") {
|
|
1220
|
-
assertNonEmpty2(input, `property '${propertyId}' value field`);
|
|
1221
|
-
return { valueField: input };
|
|
1222
|
-
}
|
|
1223
|
-
if (!isRecord(input)) {
|
|
1224
|
-
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' must map a value column or value/unit columns.`);
|
|
1225
|
-
}
|
|
1226
|
-
const allowedKeys = new Set(["value", "unit"]);
|
|
1227
|
-
for (const key of Object.keys(input)) {
|
|
1228
|
-
if (!allowedKeys.has(key)) {
|
|
1229
|
-
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' contains unknown key '${key}'.`);
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
if (typeof input.value !== "string") {
|
|
1233
|
-
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' requires a value field.`);
|
|
1234
|
-
}
|
|
1235
|
-
if (typeof input.unit !== "string") {
|
|
1236
|
-
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' requires a unit field.`);
|
|
1237
|
-
}
|
|
1238
|
-
assertNonEmpty2(input.value, `property '${propertyId}' value field`);
|
|
1239
|
-
assertNonEmpty2(input.unit, `property '${propertyId}' unit field`);
|
|
1240
|
-
return { valueField: input.value, unitField: input.unit };
|
|
1241
|
-
}
|
|
1242
|
-
function fromForeignKey(input) {
|
|
1243
|
-
validateLinkProjectionTarget(input.link);
|
|
1244
|
-
if (input.sourceProperty) {
|
|
1245
|
-
return {
|
|
1246
|
-
linkId: input.link.id,
|
|
1247
|
-
sourcePropertyId: input.sourceProperty.id,
|
|
1248
|
-
targetObjectTypeId: input.target.id
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
if (input.sourceField === undefined) {
|
|
1252
|
-
throw new ProjectionValidationError("Foreign key sourceField is required.");
|
|
1253
|
-
}
|
|
1254
|
-
assertNonEmpty2(input.sourceField, "source field");
|
|
1255
|
-
return {
|
|
1256
|
-
linkId: input.link.id,
|
|
1257
|
-
sourceField: input.sourceField,
|
|
1258
|
-
targetObjectTypeId: input.target.id
|
|
1259
|
-
};
|
|
1260
|
-
}
|
|
1261
|
-
function buildLinkProjection(id, linkToken) {
|
|
1262
|
-
assertNonEmpty2(id, "id");
|
|
1263
|
-
validateLinkProjectionTarget(linkToken);
|
|
1264
|
-
return {
|
|
1265
|
-
fromDataset(dataset) {
|
|
1266
|
-
assertProjectionDataset(dataset);
|
|
1267
|
-
const datasetId = dataset.id;
|
|
1268
|
-
return {
|
|
1269
|
-
sourceField(columnName) {
|
|
1270
|
-
assertNonEmpty2(columnName, "source field");
|
|
1271
|
-
return {
|
|
1272
|
-
targetField(targetColumnName) {
|
|
1273
|
-
assertNonEmpty2(targetColumnName, "target field");
|
|
1274
|
-
return {
|
|
1275
|
-
_tag: "LinkProjectionDefinition",
|
|
1276
|
-
id,
|
|
1277
|
-
linkId: linkToken.id,
|
|
1278
|
-
sourceObjectTypeId: linkToken.objectTypeId,
|
|
1279
|
-
targetObjectTypeId: linkToken.targetObjectTypeId,
|
|
1280
|
-
datasetId,
|
|
1281
|
-
sourceField: columnName,
|
|
1282
|
-
targetField: targetColumnName
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
};
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
}
|
|
1291
|
-
function isObjectProjectionDefinition(value) {
|
|
1292
|
-
if (!isRecord(value))
|
|
1293
|
-
return false;
|
|
1294
|
-
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links) && isSourceEditConflictResolution(value.conflictResolution);
|
|
1295
|
-
}
|
|
1296
|
-
function isSourceEditConflictResolution(value) {
|
|
1297
|
-
if (value === undefined)
|
|
1298
|
-
return true;
|
|
1299
|
-
if (!isRecord(value) || typeof value.strategy !== "string")
|
|
1300
|
-
return false;
|
|
1301
|
-
if (value.strategy === "editsWin")
|
|
1302
|
-
return value.sourceTimestamp === undefined;
|
|
1303
|
-
return value.strategy === "mostRecent" && typeof value.sourceTimestamp === "string";
|
|
1304
|
-
}
|
|
1305
|
-
function isLinkProjectionDefinition(value) {
|
|
1306
|
-
if (!isRecord(value))
|
|
1307
|
-
return false;
|
|
1308
|
-
return value._tag === "LinkProjectionDefinition" && typeof value.id === "string" && typeof value.linkId === "string" && typeof value.sourceObjectTypeId === "string" && typeof value.targetObjectTypeId === "string" && typeof value.datasetId === "string" && typeof value.sourceField === "string" && typeof value.targetField === "string";
|
|
1309
|
-
}
|
|
1310
|
-
function isTelemetryProjectionDefinition(value) {
|
|
1311
|
-
if (!isRecord(value))
|
|
1312
|
-
return false;
|
|
1313
|
-
return value._tag === "TelemetryProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && typeof value.objectIdField === "string" && typeof value.atField === "string" && isTelemetryProjectionProperties(value.properties);
|
|
1314
|
-
}
|
|
1315
|
-
function isTelemetryProjectionProperties(value) {
|
|
1316
|
-
if (!isRecord(value) || Object.keys(value).length === 0)
|
|
1317
|
-
return false;
|
|
1318
|
-
return Object.values(value).every((mapping) => isRecord(mapping) && typeof mapping.valueField === "string" && (mapping.unitField === undefined || typeof mapping.unitField === "string"));
|
|
1319
|
-
}
|
|
1320
|
-
function isProjectionDefinition(value) {
|
|
1321
|
-
return isObjectProjectionDefinition(value) || isLinkProjectionDefinition(value) || isTelemetryProjectionDefinition(value);
|
|
1322
|
-
}
|
|
1323
|
-
function projectionTargetOf(projection) {
|
|
1324
|
-
return projection._tag === "LinkProjectionDefinition" ? {
|
|
1325
|
-
sourceObjectTypeId: projection.sourceObjectTypeId,
|
|
1326
|
-
targetObjectTypeId: projection.targetObjectTypeId
|
|
1327
|
-
} : { objectTypeId: projection.objectTypeId };
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
// src/authorization/run-visibility.ts
|
|
1331
|
-
function canViewActionRun(authorization, run) {
|
|
1332
|
-
if (!authorization) {
|
|
1333
|
-
return true;
|
|
1334
|
-
}
|
|
1335
|
-
if (!isAllowed(authorization, { kind: "action.apply", actionId: run.actionId })) {
|
|
1336
|
-
return false;
|
|
1337
|
-
}
|
|
1338
|
-
return run.subject.kind !== "object" ? true : isAllowed(authorization, {
|
|
1339
|
-
kind: "object.view",
|
|
1340
|
-
objectTypeId: run.subject.objectTypeId
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
function canViewWorkflowRun(authorization, run) {
|
|
1344
|
-
return !authorization || isAllowed(authorization, { kind: "workflow.run", workflowId: run.workflowId });
|
|
1345
|
-
}
|
|
1346
|
-
function canViewWorkflowIntervention(authorization, intervention) {
|
|
1347
|
-
return !authorization || isAllowed(authorization, { kind: "workflow.run", workflowId: intervention.workflowId });
|
|
1348
|
-
}
|
|
1349
|
-
function canViewPipelineRun(authorization, run) {
|
|
1350
|
-
return !authorization || isAllowed(authorization, { kind: "pipeline.run", pipelineId: run.pipelineId });
|
|
1351
|
-
}
|
|
1352
|
-
function canViewProjectionRun(authorization, target) {
|
|
1353
|
-
if (!authorization)
|
|
1354
|
-
return true;
|
|
1355
|
-
const canView = (objectTypeId) => isAllowed(authorization, { kind: "object.view", objectTypeId });
|
|
1356
|
-
if ("sourceObjectTypeId" in target) {
|
|
1357
|
-
return canView(target.sourceObjectTypeId) && canView(target.targetObjectTypeId);
|
|
1358
|
-
}
|
|
1359
|
-
return canView(target.objectTypeId);
|
|
1360
|
-
}
|
|
1361
|
-
function canViewProjection(authorization, projection) {
|
|
1362
|
-
return canViewProjectionRun(authorization, projectionTargetOf(projection));
|
|
1363
|
-
}
|
|
1364
|
-
// src/authorization/types.ts
|
|
1365
|
-
function emptyGrantIndex() {
|
|
1366
|
-
return emptyGrantSets();
|
|
1367
|
-
}
|
|
1368
|
-
export { ProjectionValidationError, computeProjectionOwnership, validateProjectionOwnership, validateTelemetryProjectionFieldMapping, validateProjectionsAtStartup, defineProjection, fromForeignKey, isObjectProjectionDefinition, isLinkProjectionDefinition, isTelemetryProjectionDefinition, isProjectionDefinition, projectionTargetOf, GRANT_KINDS, grantKindOf, createPrincipalRuntimeAuthorization, createAgentRuntimeAuthorization, createDisabledRuntimeAuthorization, createTrustedPrimitiveRuntimeAuthorization, getAuthorizationRef, resolveExecutionScopeAuthorization, AuthorizationError, evaluate, isAllowed, assertAuthorized, assertRuntimeAuthorizationBound, assertCanEdit, assertCanAppendTelemetry, assertCanManageConnector, assertPrivileged, assertProviderAccess, isApplicationAccessControlled, canAccessApplication, canViewEvent, resolveRoleGrants, resolveAuthorizationContext, canViewActionRun, canViewWorkflowRun, canViewWorkflowIntervention, canViewPipelineRun, canViewProjectionRun, canViewProjection, emptyGrantIndex };
|
|
1369
|
-
|
|
1370
|
-
//# debugId=61CE77C324BED20164756E2164756E21
|