@sixb/core 0.1.8 → 0.1.10
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/index.js +77 -89
- package/dist/actions/index.js.map +1 -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 +3 -3
- 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/index.d.ts +4 -4
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +193 -204
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +1 -1
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +2 -0
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/request.d.ts +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/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.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 -108
- 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/index.js +51 -56
- 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 +14 -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 +80 -88
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/in-memory.d.ts +8 -2
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.d.ts +4 -2
- package/dist/broker/index.d.ts.map +1 -1
- package/dist/broker/index.js +12 -10
- package/dist/broker/index.js.map +1 -1
- package/dist/broker/retention.d.ts +4 -0
- package/dist/broker/retention.d.ts.map +1 -0
- package/dist/broker/subscriber.d.ts +10 -0
- package/dist/broker/subscriber.d.ts.map +1 -0
- package/dist/broker/types.d.ts +14 -1
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/chunk-0y39rgsb.js +43 -0
- package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
- package/dist/{chunk-k522z7v6.js → chunk-17kfctj6.js} +16 -11
- package/dist/chunk-17kfctj6.js.map +10 -0
- package/dist/{chunk-ajnan18g.js → chunk-1824gssz.js} +74 -106
- package/dist/chunk-1824gssz.js.map +12 -0
- package/dist/chunk-28ja2cjs.js +602 -0
- package/dist/chunk-28ja2cjs.js.map +18 -0
- package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
- package/dist/chunk-2c4j899j.js.map +11 -0
- package/dist/{chunk-rv2hkwwa.js → chunk-358caqf5.js} +157 -180
- package/dist/chunk-358caqf5.js.map +12 -0
- package/dist/{chunk-fvt9rjsa.js → chunk-38zv5rkr.js} +4 -4
- package/dist/{chunk-fvt9rjsa.js.map → chunk-38zv5rkr.js.map} +1 -1
- 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-s5y30bc9.js → chunk-3qms4nax.js} +52 -50
- package/dist/{chunk-s5y30bc9.js.map → chunk-3qms4nax.js.map} +5 -5
- 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-wtf06et8.js → chunk-5c7ga8zz.js} +54 -177
- package/dist/chunk-5c7ga8zz.js.map +12 -0
- 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-xajtptbw.js → chunk-5p1v802y.js} +1401 -445
- package/dist/chunk-5p1v802y.js.map +44 -0
- 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-p1rzczbt.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-xhy826cz.js → chunk-85cd7e8c.js} +8 -7
- package/dist/chunk-85cd7e8c.js.map +10 -0
- package/dist/{chunk-pc7ys28c.js → chunk-860dwwy0.js} +29 -29
- package/dist/{chunk-pc7ys28c.js.map → chunk-860dwwy0.js.map} +2 -2
- 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-rafagrwr.js → chunk-93csa55g.js} +45 -17
- package/dist/chunk-93csa55g.js.map +11 -0
- package/dist/{chunk-aa2pen2v.js → chunk-976rxdpx.js} +188 -175
- package/dist/{chunk-aa2pen2v.js.map → chunk-976rxdpx.js.map} +2 -2
- package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
- package/dist/chunk-98cw09sw.js.map +10 -0
- package/dist/{chunk-n4khvw9n.js → chunk-9qsh3p5y.js} +17 -17
- package/dist/{chunk-n4khvw9n.js.map → chunk-9qsh3p5y.js.map} +2 -2
- package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
- package/dist/{chunk-9nbmsvn5.js → chunk-9vx5e9g1.js} +9 -9
- package/dist/{chunk-9nbmsvn5.js.map → chunk-9vx5e9g1.js.map} +2 -2
- package/dist/{chunk-8m5ejdpn.js → chunk-9x8dybsb.js} +5 -5
- package/dist/chunk-9x8dybsb.js.map +10 -0
- package/dist/chunk-aa6z4a19.js +358 -0
- package/dist/chunk-aa6z4a19.js.map +12 -0
- package/dist/{chunk-3xep5cjx.js → chunk-agbbygvh.js} +104 -86
- package/dist/chunk-agbbygvh.js.map +15 -0
- package/dist/{chunk-2dw777qw.js → chunk-ap0g1g74.js} +37 -82
- package/dist/{chunk-2dw777qw.js.map → chunk-ap0g1g74.js.map} +3 -4
- package/dist/{chunk-v4en4jc2.js → chunk-awbhdqyc.js} +7 -7
- package/dist/{chunk-v4en4jc2.js.map → chunk-awbhdqyc.js.map} +2 -2
- package/dist/{chunk-w9tg6yyb.js → chunk-b0ec55a1.js} +54 -37
- package/dist/chunk-b0ec55a1.js.map +12 -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-gbejpkex.js → chunk-bn138h9w.js} +27 -28
- package/dist/{chunk-gbejpkex.js.map → chunk-bn138h9w.js.map} +3 -3
- package/dist/{chunk-nx7k8tpr.js → chunk-br3k6qbf.js} +23 -23
- package/dist/{chunk-nx7k8tpr.js.map → chunk-br3k6qbf.js.map} +2 -2
- 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-5e3pq99w.js → chunk-dmn70ztd.js} +30 -30
- package/dist/chunk-dmn70ztd.js.map +11 -0
- package/dist/{chunk-p1x242ad.js → chunk-dz5h08xv.js} +175 -175
- package/dist/{chunk-p1x242ad.js.map → chunk-dz5h08xv.js.map} +2 -2
- 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-19jp6g9d.js → chunk-f0rwz2vh.js} +54 -33
- 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-f26bck4t.js → chunk-ftv470j8.js} +393 -355
- package/dist/{chunk-f26bck4t.js.map → chunk-ftv470j8.js.map} +7 -7
- package/dist/{chunk-4sm0aznx.js → chunk-g00bfdq6.js} +254 -256
- package/dist/{chunk-4sm0aznx.js.map → chunk-g00bfdq6.js.map} +3 -3
- 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-q0k9nc5a.js → chunk-g7knyczr.js} +98 -98
- package/dist/{chunk-q0k9nc5a.js.map → chunk-g7knyczr.js.map} +2 -2
- 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-8tsf6dmc.js → chunk-gqh45d2n.js} +244 -205
- package/dist/chunk-gqh45d2n.js.map +15 -0
- package/dist/chunk-h3v76ams.js +32 -0
- package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
- 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-wdage1eb.js → chunk-jmfet9r4.js} +6 -6
- package/dist/{chunk-wdage1eb.js.map → chunk-jmfet9r4.js.map} +2 -2
- package/dist/{chunk-k34z5rvh.js → chunk-kfee1h52.js} +132 -48
- package/dist/chunk-kfee1h52.js.map +13 -0
- 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-4jjp5k14.js → chunk-mmagke4x.js} +6 -6
- package/dist/{chunk-4jjp5k14.js.map → chunk-mmagke4x.js.map} +2 -2
- package/dist/{chunk-359jm1jw.js → chunk-mrp7k0pw.js} +20 -20
- package/dist/{chunk-359jm1jw.js.map → chunk-mrp7k0pw.js.map} +2 -2
- package/dist/{chunk-h0k55pc7.js → chunk-ms2tmn1k.js} +139 -139
- package/dist/{chunk-h0k55pc7.js.map → chunk-ms2tmn1k.js.map} +2 -2
- package/dist/{chunk-h5vqbfmd.js → chunk-nmbxcaqx.js} +117 -117
- package/dist/{chunk-h5vqbfmd.js.map → chunk-nmbxcaqx.js.map} +3 -3
- package/dist/{chunk-n2w475r0.js → chunk-nt99sxd6.js} +82 -82
- package/dist/{chunk-n2w475r0.js.map → chunk-nt99sxd6.js.map} +3 -3
- package/dist/{chunk-v1xppd0y.js → chunk-p5vcsw9c.js} +60 -60
- package/dist/{chunk-v1xppd0y.js.map → chunk-p5vcsw9c.js.map} +2 -2
- package/dist/{chunk-sbzzr4kx.js → chunk-p6a4npdx.js} +1260 -1289
- package/dist/chunk-p6a4npdx.js.map +58 -0
- 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-nn0tekr1.js → chunk-pr2h4bv4.js} +33 -33
- package/dist/{chunk-nn0tekr1.js.map → chunk-pr2h4bv4.js.map} +2 -2
- 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-5ntny1qx.js → chunk-qf954wje.js} +6 -6
- package/dist/{chunk-5ntny1qx.js.map → chunk-qf954wje.js.map} +2 -2
- package/dist/chunk-qma80ych.js +30 -0
- package/dist/chunk-qma80ych.js.map +11 -0
- package/dist/{chunk-mth82m8t.js → chunk-qyeptdyv.js} +171 -77
- package/dist/chunk-qyeptdyv.js.map +15 -0
- 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-mwsxn98e.js → chunk-r7fj830t.js} +253 -200
- package/dist/chunk-r7fj830t.js.map +36 -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-gzasd5b6.js → chunk-rtk71jzp.js} +22 -22
- package/dist/{chunk-gzasd5b6.js.map → chunk-rtk71jzp.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-3z1qec12.js → chunk-t1f4f1ve.js} +107 -64
- package/dist/{chunk-3z1qec12.js.map → chunk-t1f4f1ve.js.map} +3 -3
- package/dist/chunk-v2vcg0w6.js +151 -0
- package/dist/chunk-v2vcg0w6.js.map +11 -0
- package/dist/{chunk-r8jrnexe.js → chunk-v4jbb3rs.js} +4 -4
- package/dist/{chunk-r8jrnexe.js.map → chunk-v4jbb3rs.js.map} +2 -2
- package/dist/{chunk-w1tvjszy.js → chunk-vsj3mdfj.js} +8 -8
- package/dist/{chunk-w1tvjszy.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-z4ccwbkz.js → chunk-x9v4cx1d.js} +1 -1
- 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-yp8ee62z.js → chunk-z30bv4ga.js} +35 -35
- package/dist/{chunk-yp8ee62z.js.map → chunk-z30bv4ga.js.map} +2 -2
- 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-4yqmp43v.js → chunk-z8fx5cgb.js} +12 -12
- package/dist/{chunk-4yqmp43v.js.map → chunk-z8fx5cgb.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/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/contracts.d.ts +3 -0
- package/dist/connectors/connections/contracts.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +9 -10
- package/dist/connectors/connections/internal.js.map +1 -1
- package/dist/connectors/connections/request.d.ts +3 -1
- package/dist/connectors/connections/request.d.ts.map +1 -1
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/tokens.d.ts.map +1 -1
- package/dist/connectors/connections/validation.d.ts +5 -1
- package/dist/connectors/connections/validation.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +19 -4
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +8 -12
- package/dist/datasets/write.js.map +1 -1
- 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 +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/service.d.ts +2 -2
- package/dist/events/service.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 +71 -82
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/durable.d.ts +1 -0
- package/dist/execution/durable.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 +64 -71
- package/dist/execution/primitive.js.map +3 -3
- package/dist/execution/request.d.ts +1 -0
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +66 -75
- package/dist/execution/request.js.map +3 -3
- package/dist/http/index.js +10 -11
- package/dist/http/index.js.map +1 -1
- package/dist/index.d.ts +17 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +457 -477
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/changes.d.ts +5 -0
- package/dist/lake-storage/changes.d.ts.map +1 -0
- package/dist/lake-storage/in-memory.d.ts +2 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +2 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +40 -42
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/types.d.ts +36 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- 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.d.ts +1 -1
- package/dist/materialization/index.d.ts.map +1 -1
- package/dist/materialization/index.js +46 -49
- package/dist/materialization/index.js.map +1 -1
- package/dist/materialization/model.d.ts +12 -1
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.d.ts +1 -1
- package/dist/materializer/index.d.ts.map +1 -1
- package/dist/materializer/index.js +137 -145
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/materializer.d.ts +5 -1
- package/dist/materializer/materializer.d.ts.map +1 -1
- package/dist/materializer/projections/entry-validator.d.ts +2 -1
- package/dist/materializer/projections/entry-validator.d.ts.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/source-materialization.d.ts +4 -3
- package/dist/materializer/projections/source-materialization.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +2 -1
- package/dist/materializer/shared/normalize.d.ts.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/execution.d.ts.map +1 -1
- package/dist/objects/index.js +75 -87
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/index.js +67 -76
- package/dist/objects/query/index.js.map +1 -1
- package/dist/ontology/index.d.ts +1 -2
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +62 -113
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/internal.d.ts +7 -0
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +65 -116
- package/dist/ontology/internal.js.map +3 -4
- package/dist/pipelines/index.js +57 -66
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/projections/internal.js +56 -67
- 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/in-memory.d.ts +7 -3
- package/dist/queues/in-memory.d.ts.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/indexed-heap.d.ts +15 -0
- package/dist/queues/indexed-heap.d.ts.map +1 -0
- package/dist/queues/types.d.ts +3 -20
- package/dist/queues/types.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 +2 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +2 -1
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.js +13 -14
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/ontology-mutations.d.ts +3 -1
- package/dist/runtime/ontology-mutations.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +2 -0
- package/dist/runtime/sixb.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/index.js +31 -33
- package/dist/schedules/index.js.map +1 -1
- package/dist/shares/internal.js +46 -54
- package/dist/shares/internal.js.map +2 -2
- 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/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +35 -37
- package/dist/storage/connector-connections/provider.js.map +3 -3
- package/dist/storage/connector-connections/types.d.ts +3 -2
- package/dist/storage/connector-connections/types.d.ts.map +1 -1
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +2 -1
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +14 -11
- package/dist/storage/executions/provider.js.map +3 -3
- 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 +2 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +7 -8
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +221 -256
- 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/ontology/in-memory/materializations-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/shared-state.d.ts +15 -2
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/source-roots.d.ts +6 -0
- package/dist/storage/ontology/in-memory/source-roots.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +1 -1
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +16 -0
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +107 -109
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/ontology/sources.d.ts +13 -4
- package/dist/storage/ontology/sources.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +18 -19
- 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/lifecycle.d.ts.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/projection-runs/types.d.ts +2 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/share-grants/provider.js +17 -19
- package/dist/storage/share-grants/provider.js.map +1 -1
- package/dist/storage/share-sessions/provider.js +14 -15
- package/dist/storage/share-sessions/provider.js.map +1 -1
- package/dist/storage/sync-runs/provider.js +4 -6
- package/dist/storage/sync-runs/provider.js.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 -21
- 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/index.js +56 -65
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/run-dispatch.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/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
- 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 +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2282 -1662
- package/dist/testing/index.js.map +16 -15
- package/dist/testing/lake-changes-contract.d.ts +6 -0
- package/dist/testing/lake-changes-contract.d.ts.map +1 -0
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/workflow-execution.d.ts +1 -0
- package/dist/testing/workflow-execution.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +6 -0
- package/dist/webhooks/connections.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.d.ts +2 -0
- package/dist/webhooks/internal.d.ts.map +1 -1
- package/dist/webhooks/internal.js +98 -61
- package/dist/webhooks/internal.js.map +4 -3
- package/dist/webhooks/registry.d.ts +1 -1
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/types.d.ts +15 -4
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/index.js +11 -13
- package/dist/workers/index.js.map +2 -2
- package/dist/workflows/failure.d.ts +2 -0
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.js +136 -147
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +3 -2
- 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 +48 -30
- package/src/actions/run-dispatch.ts +2 -6
- package/src/actions/types/context.ts +2 -0
- package/src/actions/validation.ts +2 -1
- package/src/agents/adapters.ts +4 -9
- 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 +1 -1
- package/src/agents/index.ts +4 -4
- package/src/agents/message.ts +1 -1
- package/src/agents/model-loop.ts +8 -0
- package/src/agents/request.ts +11 -26
- 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/types.ts +1 -1
- package/src/agents/validation.ts +3 -7
- package/src/auth/index.ts +0 -1
- package/src/bootstrap/discovery.ts +81 -24
- package/src/bootstrap/index.ts +8 -1
- package/src/broker/in-memory.ts +104 -39
- package/src/broker/index.ts +4 -1
- package/src/broker/retention.ts +28 -0
- package/src/broker/subscriber.ts +21 -0
- package/src/broker/types.ts +15 -1
- package/src/connectors/builders.ts +0 -6
- package/src/connectors/connections/authorizations.ts +11 -5
- package/src/connectors/connections/contracts.ts +3 -0
- package/src/connectors/connections/request.ts +56 -22
- package/src/connectors/connections/runs.ts +1 -0
- package/src/connectors/connections/tokens.ts +4 -0
- package/src/connectors/connections/validation.ts +91 -5
- package/src/connectors/types.ts +19 -4
- 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 +2 -2
- package/src/events/service.ts +3 -3
- package/src/execution/agent.ts +5 -3
- package/src/execution/durable.ts +11 -1
- package/src/execution/primitive.ts +5 -1
- package/src/execution/request.ts +3 -0
- package/src/index.ts +30 -20
- package/src/lake-storage/changes.ts +43 -0
- package/src/lake-storage/in-memory.ts +73 -0
- package/src/lake-storage/index.ts +4 -0
- package/src/lake-storage/types.ts +40 -0
- package/src/logging/index.ts +2 -33
- package/src/logging/internal.ts +43 -0
- package/src/logging/service.ts +1 -1
- package/src/materialization/index.ts +2 -0
- package/src/materialization/model.ts +14 -1
- package/src/materializer/index.ts +2 -0
- package/src/materializer/materializer.ts +10 -0
- package/src/materializer/projections/entry-validator.ts +19 -1
- package/src/materializer/projections/replace.ts +36 -1
- package/src/materializer/projections/source-materialization.ts +26 -6
- package/src/materializer/shared/normalize.ts +1 -1
- 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/execution.ts +1 -1
- package/src/ontology/index.ts +1 -2
- package/src/ontology/internal.ts +35 -0
- package/src/pipelines/run-dispatch.ts +21 -1
- package/src/projections/run-dispatch.ts +31 -68
- package/src/query.ts +0 -1
- package/src/queues/in-memory.ts +105 -62
- package/src/queues/index.ts +4 -2
- package/src/queues/indexed-heap.ts +74 -0
- package/src/queues/types.ts +6 -25
- package/src/runtime/create.ts +2 -1
- package/src/runtime/host.ts +2 -15
- package/src/runtime/ontology-mutations.ts +4 -0
- package/src/runtime/sixb.ts +4 -0
- package/src/sandboxes/errors.ts +5 -0
- package/src/sandboxes/index.ts +3 -0
- package/src/sandboxes/sandbox.ts +35 -7
- 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/connector-connections/in-memory.ts +3 -1
- package/src/storage/connector-connections/provider/runs.ts +3 -1
- package/src/storage/connector-connections/types.ts +3 -2
- package/src/storage/executions/in-memory.ts +4 -9
- package/src/storage/executions/provider.ts +4 -0
- package/src/storage/executions/types.ts +6 -2
- package/src/storage/executions/validation.ts +32 -0
- package/src/storage/in-memory/index.ts +16 -1
- package/src/storage/index.ts +4 -29
- package/src/storage/internal.ts +20 -0
- package/src/storage/ontology/in-memory/materializations-state.ts +5 -18
- package/src/storage/ontology/in-memory/materializations.ts +73 -92
- package/src/storage/ontology/in-memory/shared-state.ts +26 -1
- package/src/storage/ontology/in-memory/source-roots.ts +123 -0
- package/src/storage/ontology/in-memory/sources.ts +78 -23
- package/src/storage/ontology/index.ts +1 -0
- package/src/storage/ontology/provider.ts +70 -0
- package/src/storage/ontology/sources.ts +14 -3
- package/src/storage/projection-runs/lifecycle.ts +5 -2
- package/src/storage/projection-runs/types.ts +4 -3
- package/src/storage/workflow-runs/in-memory.ts +0 -2
- package/src/storage/workflow-runs/types.ts +0 -3
- package/src/syncs/run-dispatch.ts +19 -1
- 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/broker-contract.ts +95 -0
- package/src/testing/connector-connection-storage-contract.ts +18 -1
- package/src/testing/execution-storage-contract.ts +59 -1
- package/src/testing/execution.ts +6 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/lake-changes-contract.ts +240 -0
- package/src/testing/materializer-storage-contract.ts +172 -1
- package/src/testing/ontology-storage-contract.ts +7 -0
- package/src/testing/projection-run-storage-contract.ts +34 -0
- package/src/testing/workflow-execution.ts +4 -0
- package/src/webhooks/connections.ts +56 -0
- package/src/webhooks/index.ts +2 -0
- package/src/webhooks/internal.ts +2 -0
- package/src/webhooks/registry.ts +3 -4
- package/src/webhooks/types.ts +17 -4
- package/src/workflows/failure.ts +62 -1
- package/src/workflows/request.ts +0 -9
- package/src/workflows/run-dispatch.ts +42 -32
- 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-19jp6g9d.js.map +0 -11
- package/dist/chunk-2xns679x.js.map +0 -11
- package/dist/chunk-3xep5cjx.js.map +0 -15
- package/dist/chunk-407j3msh.js +0 -60
- package/dist/chunk-4qfkag59.js +0 -1568
- package/dist/chunk-4qfkag59.js.map +0 -20
- package/dist/chunk-5e3pq99w.js.map +0 -11
- package/dist/chunk-5gd7tpv6.js.map +0 -11
- package/dist/chunk-7y0f6rf1.js.map +0 -10
- package/dist/chunk-8m5ejdpn.js.map +0 -10
- package/dist/chunk-8tsf6dmc.js.map +0 -15
- package/dist/chunk-ajnan18g.js.map +0 -12
- package/dist/chunk-c15dr03f.js +0 -43
- package/dist/chunk-d8qkxt2v.js.map +0 -10
- package/dist/chunk-jq43kdvk.js +0 -50
- package/dist/chunk-k34z5rvh.js.map +0 -11
- package/dist/chunk-k522z7v6.js.map +0 -10
- package/dist/chunk-mth82m8t.js.map +0 -14
- package/dist/chunk-mwsxn98e.js.map +0 -36
- package/dist/chunk-p03r0h5s.js.map +0 -16
- package/dist/chunk-p1rzczbt.js +0 -218
- package/dist/chunk-rafagrwr.js.map +0 -11
- package/dist/chunk-rv2hkwwa.js.map +0 -14
- package/dist/chunk-sbzzr4kx.js.map +0 -63
- package/dist/chunk-tpnd31c1.js +0 -242
- package/dist/chunk-tpnd31c1.js.map +0 -11
- package/dist/chunk-w9tg6yyb.js.map +0 -12
- package/dist/chunk-wtf06et8.js.map +0 -14
- package/dist/chunk-xajtptbw.js.map +0 -40
- package/dist/chunk-xhy826cz.js.map +0 -10
- package/dist/chunk-y64skrwp.js +0 -19
- package/dist/chunk-zcnhxkvd.js +0 -7
- package/dist/logging/types.js +0 -27
- package/dist/logging/types.js.map +0 -9
- /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-j1sbhm7p.js → chunk-ey1nk510.js} +0 -0
- /package/dist/{chunk-j1sbhm7p.js.map → chunk-ey1nk510.js.map} +0 -0
- /package/dist/{chunk-z4ccwbkz.js.map → chunk-x9v4cx1d.js.map} +0 -0
|
@@ -1,99 +1,35 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
createSixbError2,
|
|
4
|
+
toSixbFailure2
|
|
5
|
+
} from "./chunk-f4w3yp4f.js";
|
|
5
6
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
executionRecordInputFromRuntime
|
|
9
|
-
} from "./chunk-k522z7v6.js";
|
|
7
|
+
reportRunFailure2
|
|
8
|
+
} from "./chunk-7apz6hg4.js";
|
|
10
9
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
resolveExecutionScopeAuthorization,
|
|
11
|
+
assertAuthorized2
|
|
12
|
+
} from "./chunk-dz5h08xv.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
SYNC_RUN_FAILURE_CODES2
|
|
15
|
+
} from "./chunk-p6a4npdx.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
SyncRunError2
|
|
18
|
+
} from "./chunk-jmfet9r4.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
assertAuthorized,
|
|
25
|
-
assertProviderAccess,
|
|
26
|
-
resolveExecutionScopeAuthorization
|
|
27
|
-
} from "./chunk-p1x242ad.js";
|
|
28
|
-
import {
|
|
29
|
-
createSixbError,
|
|
30
|
-
isSixbError,
|
|
31
|
-
toSixbFailure
|
|
32
|
-
} from "./chunk-2xns679x.js";
|
|
33
|
-
|
|
34
|
-
// src/connectors/errors.ts
|
|
35
|
-
class ConnectorError extends Error {
|
|
36
|
-
name = "ConnectorError";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class ConnectorNotFoundError extends ConnectorError {
|
|
40
|
-
connectorId;
|
|
41
|
-
name = "ConnectorNotFoundError";
|
|
42
|
-
constructor(connectorId) {
|
|
43
|
-
super(`Unknown connector '${connectorId}'`);
|
|
44
|
-
this.connectorId = connectorId;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
class ConnectorOAuthError extends ConnectorError {
|
|
49
|
-
kind;
|
|
50
|
-
name = "ConnectorOAuthError";
|
|
51
|
-
constructor(kind, message, options) {
|
|
52
|
-
super(message, options);
|
|
53
|
-
this.kind = kind;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function createConnectorCodedError(code, message, options = {}) {
|
|
57
|
-
return createSixbError(code, message.startsWith("[Sixb]") ? message : `[Sixb] ${message}`, options);
|
|
58
|
-
}
|
|
59
|
-
function createAmbiguousProviderOperationError(options = {}) {
|
|
60
|
-
return createConnectorCodedError("connector.provider_failed", "Connector provider operation outcome is ambiguous.", options);
|
|
61
|
-
}
|
|
62
|
-
function oauthErrorKind(error) {
|
|
63
|
-
return error instanceof ConnectorOAuthError ? error.kind : "ambiguous";
|
|
64
|
-
}
|
|
65
|
-
function providerFailureCode(error) {
|
|
66
|
-
return oauthErrorKind(error) === "retryable" ? "connector.provider_unavailable" : "connector.provider_failed";
|
|
67
|
-
}
|
|
68
|
-
function providerBoundaryError(error, code, message) {
|
|
69
|
-
if (isSixbError(error) && error.code.startsWith("connector."))
|
|
70
|
-
return error;
|
|
71
|
-
return createConnectorCodedError(code, message, { cause: error });
|
|
72
|
-
}
|
|
73
|
-
function isConnectorStorageError(error, code) {
|
|
74
|
-
return error instanceof ConnectorConnectionStorageError && (code === undefined || error.code === code);
|
|
75
|
-
}
|
|
76
|
-
function storageBoundaryError(error, message) {
|
|
77
|
-
return createConnectorCodedError("internal.unexpected", message, { cause: error });
|
|
78
|
-
}
|
|
79
|
-
async function recoverConnectorFailure(primaryError, message, recovery) {
|
|
80
|
-
try {
|
|
81
|
-
return await recovery();
|
|
82
|
-
} catch (recoveryError) {
|
|
83
|
-
throw createConnectorCodedError("internal.unexpected", message, {
|
|
84
|
-
cause: new AggregateError([primaryError, recoveryError], message)
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
20
|
+
executionRecordInputFromRuntime,
|
|
21
|
+
ensureExecutionRecord2,
|
|
22
|
+
createPrimitiveExecutionRecord
|
|
23
|
+
} from "./chunk-17kfctj6.js";
|
|
88
24
|
|
|
89
25
|
// src/syncs/errors.ts
|
|
90
|
-
class
|
|
26
|
+
class SyncValidationError2 extends Error {
|
|
91
27
|
name = "SyncValidationError";
|
|
92
28
|
}
|
|
93
29
|
|
|
94
30
|
// src/syncs/run-dispatch.ts
|
|
95
31
|
import { randomUUID } from "crypto";
|
|
96
|
-
class
|
|
32
|
+
class SyncRunDispatcher2 {
|
|
97
33
|
dependencies;
|
|
98
34
|
constructor(dependencies) {
|
|
99
35
|
this.dependencies = dependencies;
|
|
@@ -102,7 +38,7 @@ class SyncRunDispatcher {
|
|
|
102
38
|
assertAutomaticDispatchInput(input);
|
|
103
39
|
const sync = this.dependencies.definitions.syncs.getById(input.syncId);
|
|
104
40
|
if (!sync)
|
|
105
|
-
throw new
|
|
41
|
+
throw new SyncValidationError2(`[Sixb] Unknown sync '${input.syncId}'`);
|
|
106
42
|
return dispatchSyncRun({
|
|
107
43
|
errorReporterHost: this.dependencies,
|
|
108
44
|
projectId: this.dependencies.id,
|
|
@@ -129,7 +65,10 @@ class SyncRunDispatcher {
|
|
|
129
65
|
}
|
|
130
66
|
async function dispatchSyncRun(input) {
|
|
131
67
|
const runId = createSyncRunId(input.runId);
|
|
132
|
-
|
|
68
|
+
let persisted = await persistSyncRun(input, runId);
|
|
69
|
+
if (!persisted.publish && input.validateExistingRun && persisted.run.status === "queued") {
|
|
70
|
+
persisted = await reuseSyncRun(input, persisted.run);
|
|
71
|
+
}
|
|
133
72
|
if (!persisted.publish)
|
|
134
73
|
return existingSyncRunResult(persisted.run);
|
|
135
74
|
return publishSyncRun(input, persisted);
|
|
@@ -165,7 +104,7 @@ async function persistSyncRun(input, runId) {
|
|
|
165
104
|
return { publish: true, run, execution, queuedAt, created: true };
|
|
166
105
|
}, { isolation: "serializable" });
|
|
167
106
|
} catch (error) {
|
|
168
|
-
if (!(error instanceof
|
|
107
|
+
if (!(error instanceof SyncRunError2))
|
|
169
108
|
throw error;
|
|
170
109
|
const raced = await syncRuns.getById({ projectId: input.projectId, id: runId });
|
|
171
110
|
if (!raced)
|
|
@@ -178,6 +117,15 @@ async function persistSyncRun(input, runId) {
|
|
|
178
117
|
async function reuseSyncRun(input, existing) {
|
|
179
118
|
assertExistingRunMatchesRequest(existing, input);
|
|
180
119
|
await input.validateExistingRun?.(existing, input.storage);
|
|
120
|
+
if (input.validateExistingRun && existing.status === "queued") {
|
|
121
|
+
const execution = await input.storage.executions.getById({
|
|
122
|
+
projectId: input.projectId,
|
|
123
|
+
id: existing.executionId
|
|
124
|
+
});
|
|
125
|
+
if (!execution)
|
|
126
|
+
throw new SyncRunError2(`[Sixb] Execution '${existing.executionId}' was not found.`);
|
|
127
|
+
return { publish: true, run: existing, execution, queuedAt: existing.queuedAt, created: false };
|
|
128
|
+
}
|
|
181
129
|
if (existing.status !== "failed" || existing.error?.code !== "queue.enqueue_failed" || !existing.error.retryable) {
|
|
182
130
|
return { publish: false, run: existing };
|
|
183
131
|
}
|
|
@@ -186,7 +134,7 @@ async function reuseSyncRun(input, existing) {
|
|
|
186
134
|
id: existing.executionId
|
|
187
135
|
});
|
|
188
136
|
if (!execution) {
|
|
189
|
-
throw new
|
|
137
|
+
throw new SyncRunError2(`[Sixb] Execution '${existing.executionId}' for Sync run '${existing.id}' was not found.`);
|
|
190
138
|
}
|
|
191
139
|
const queuedAt = new Date;
|
|
192
140
|
const run = await requireSyncRunStorage(input.storage).queue({
|
|
@@ -215,6 +163,9 @@ async function publishSyncRun(input, persisted) {
|
|
|
215
163
|
}
|
|
216
164
|
]
|
|
217
165
|
});
|
|
166
|
+
if (!job || job.id !== persisted.run.id) {
|
|
167
|
+
throw new SyncRunError2(`[Sixb] Queue did not acknowledge Sync run '${persisted.run.id}'.`);
|
|
168
|
+
}
|
|
218
169
|
return {
|
|
219
170
|
syncId: persisted.run.syncId,
|
|
220
171
|
runId: persisted.run.id,
|
|
@@ -223,6 +174,8 @@ async function publishSyncRun(input, persisted) {
|
|
|
223
174
|
created: persisted.created
|
|
224
175
|
};
|
|
225
176
|
} catch (error) {
|
|
177
|
+
if (input.validateExistingRun)
|
|
178
|
+
throw error;
|
|
226
179
|
const failedAt = new Date;
|
|
227
180
|
const failure = toEnqueueFailure(error, persisted.run, failedAt);
|
|
228
181
|
const failed = await requireSyncRunStorage(input.storage).finish({
|
|
@@ -232,7 +185,7 @@ async function publishSyncRun(input, persisted) {
|
|
|
232
185
|
finishedAt: failedAt,
|
|
233
186
|
error: failure
|
|
234
187
|
});
|
|
235
|
-
|
|
188
|
+
reportRunFailure2(input.errorReporterHost, error, {
|
|
236
189
|
projectId: input.projectId,
|
|
237
190
|
runKind: "sync",
|
|
238
191
|
run: { runId: failed.id, syncId: failed.syncId },
|
|
@@ -243,7 +196,7 @@ async function publishSyncRun(input, persisted) {
|
|
|
243
196
|
}
|
|
244
197
|
function assertExistingRunMatchesRequest(existing, input) {
|
|
245
198
|
if (existing.syncId !== input.sync.id || existing.datasetId !== input.sync.target.dataset.id || existing.mode !== input.sync.config.mode || existing.expectedLatestVersionId !== input.expectedLatestVersionId || existing.commitMessage !== input.commitMessage) {
|
|
246
|
-
throw new
|
|
199
|
+
throw new SyncRunError2(`[Sixb] Sync run '${existing.id}' already exists with a different request payload.`);
|
|
247
200
|
}
|
|
248
201
|
}
|
|
249
202
|
function existingSyncRunResult(existing) {
|
|
@@ -256,14 +209,14 @@ function existingSyncRunResult(existing) {
|
|
|
256
209
|
}
|
|
257
210
|
function requireSyncRunStorage(storage) {
|
|
258
211
|
if (!storage.syncRuns)
|
|
259
|
-
throw new
|
|
212
|
+
throw new SyncValidationError2("[Sixb] Sync run storage is not configured.");
|
|
260
213
|
return storage.syncRuns;
|
|
261
214
|
}
|
|
262
215
|
function createSyncRunId(runId) {
|
|
263
216
|
if (runId === undefined)
|
|
264
217
|
return `run_${randomUUID()}`;
|
|
265
218
|
if (!runId.trim())
|
|
266
|
-
throw new
|
|
219
|
+
throw new SyncValidationError2("[Sixb] Sync run id must not be empty");
|
|
267
220
|
return runId;
|
|
268
221
|
}
|
|
269
222
|
function assertAutomaticDispatchInput(input) {
|
|
@@ -275,34 +228,34 @@ function assertAutomaticDispatchInput(input) {
|
|
|
275
228
|
async function assertAutomaticExecutionIdentity(storage, projectId, input, run) {
|
|
276
229
|
const execution = await storage.executions.getById({ projectId, id: run.executionId });
|
|
277
230
|
if (!execution || execution.source.type !== input.source.type || execution.source.eventId !== input.source.eventId || execution.correlationId !== input.correlationId || execution.requestedBy !== undefined) {
|
|
278
|
-
throw new
|
|
231
|
+
throw new SyncValidationError2(`[Sixb] Sync run '${run.id}' already exists with different automatic provenance.`);
|
|
279
232
|
}
|
|
280
233
|
}
|
|
281
234
|
function toEnqueueFailure(error, run, at) {
|
|
282
|
-
const enqueueError =
|
|
235
|
+
const enqueueError = createSixbError2("queue.enqueue_failed", `[Sixb] Could not enqueue Sync run '${run.id}'.`, {
|
|
283
236
|
cause: error,
|
|
284
237
|
details: { syncId: run.syncId, runId: run.id, phase: "enqueue" }
|
|
285
238
|
});
|
|
286
|
-
return
|
|
239
|
+
return toSixbFailure2(enqueueError, { allowedCodes: SYNC_RUN_FAILURE_CODES2, at });
|
|
287
240
|
}
|
|
288
241
|
function assertNonBlank(value, label) {
|
|
289
242
|
if (!value.trim())
|
|
290
|
-
throw new
|
|
243
|
+
throw new SyncValidationError2(`[Sixb] ${label} must not be empty.`);
|
|
291
244
|
}
|
|
292
245
|
|
|
293
246
|
// src/syncs/request.ts
|
|
294
|
-
async function
|
|
247
|
+
async function requestSyncRun2(runtime, execution, sync, options = {}) {
|
|
295
248
|
resolveExecutionScopeAuthorization(runtime.projectId, {
|
|
296
249
|
execution,
|
|
297
250
|
authorization: runtime.runtimeAuthorization
|
|
298
251
|
});
|
|
299
|
-
|
|
252
|
+
assertAuthorized2(runtime, { kind: "sync.run", syncId: sync.id });
|
|
300
253
|
if (!runtime.storage.syncRuns) {
|
|
301
|
-
throw new
|
|
254
|
+
throw new SyncValidationError2("[Sixb] Sync run storage is not configured.");
|
|
302
255
|
}
|
|
303
256
|
const queue = runtime.queues.syncRuns;
|
|
304
257
|
if (!queue) {
|
|
305
|
-
throw new
|
|
258
|
+
throw new SyncValidationError2("[Sixb] Sync run queue is not configured.");
|
|
306
259
|
}
|
|
307
260
|
return dispatchSyncRun({
|
|
308
261
|
errorReporterHost: runtime,
|
|
@@ -312,7 +265,7 @@ async function requestSyncRun(runtime, execution, sync, options = {}) {
|
|
|
312
265
|
queue,
|
|
313
266
|
...options,
|
|
314
267
|
createExecution: async (executionId, runId) => {
|
|
315
|
-
const caller = await
|
|
268
|
+
const caller = await ensureExecutionRecord2(runtime.storage.executions, executionRecordInputFromRuntime({
|
|
316
269
|
execution,
|
|
317
270
|
runtimeAuthorization: runtime.runtimeAuthorization
|
|
318
271
|
}));
|
|
@@ -325,82 +278,6 @@ async function requestSyncRun(runtime, execution, sync, options = {}) {
|
|
|
325
278
|
});
|
|
326
279
|
}
|
|
327
280
|
|
|
328
|
-
|
|
329
|
-
var sourceResolvers = new WeakMap;
|
|
330
|
-
function createConnectorRuntime(runtime, execution, service) {
|
|
331
|
-
const connector = (definition, selector) => {
|
|
332
|
-
if (isOAuthConnectorDefinition(definition)) {
|
|
333
|
-
assertConnectorConnectionAccess(runtime, execution);
|
|
334
|
-
if (!selector) {
|
|
335
|
-
throw createConnectorCodedError("connector.configuration_invalid", `[Sixb] Connector '${definition.id}' uses persistent connections and requires an explicit owner and slot.`);
|
|
336
|
-
}
|
|
337
|
-
return service.connectConnection(definition, selector);
|
|
338
|
-
}
|
|
339
|
-
if (selector) {
|
|
340
|
-
throw createConnectorCodedError("connector.configuration_invalid", `[Sixb] Static connector '${definition.id}' does not accept a connection.`);
|
|
341
|
-
}
|
|
342
|
-
assertProviderAccess(runtime, execution, "connector.connect");
|
|
343
|
-
return service.connect(definition);
|
|
344
|
-
};
|
|
345
|
-
registerConnectorExecutionSourceResolver(connector, {
|
|
346
|
-
async list(definition) {
|
|
347
|
-
if (!isOAuthConnectorDefinition(definition)) {
|
|
348
|
-
return [
|
|
349
|
-
{
|
|
350
|
-
connect: (_signal) => connector(definition)
|
|
351
|
-
}
|
|
352
|
-
];
|
|
353
|
-
}
|
|
354
|
-
assertConnectorConnectionAccess(runtime, execution);
|
|
355
|
-
const connections = await service.listExecutionConnections(definition);
|
|
356
|
-
return connections.map((connection) => ({
|
|
357
|
-
connection: {
|
|
358
|
-
id: connection.id,
|
|
359
|
-
connectorId: connection.connectorId,
|
|
360
|
-
owner: connection.owner,
|
|
361
|
-
slot: connection.slot,
|
|
362
|
-
account: connection.account
|
|
363
|
-
},
|
|
364
|
-
connect: (signal) => service.connectExecutionConnection(definition, connection, signal)
|
|
365
|
-
}));
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
return connector;
|
|
369
|
-
}
|
|
370
|
-
function registerConnectorExecutionSourceResolver(connector, resolver) {
|
|
371
|
-
const registered = sourceResolvers.get(connector);
|
|
372
|
-
if (registered && registered !== resolver) {
|
|
373
|
-
throw new Error("[Sixb] Connector source resolver is already registered for this execution.");
|
|
374
|
-
}
|
|
375
|
-
sourceResolvers.set(connector, resolver);
|
|
376
|
-
}
|
|
377
|
-
function getConnectorExecutionSourceResolver(connector) {
|
|
378
|
-
const resolver = sourceResolvers.get(connector);
|
|
379
|
-
if (resolver)
|
|
380
|
-
return resolver;
|
|
381
|
-
return {
|
|
382
|
-
async list(definition) {
|
|
383
|
-
if (isOAuthConnectorDefinition(definition)) {
|
|
384
|
-
throw createConnectorCodedError("connector.configuration_invalid", `[Sixb] OAuth connector '${definition.id}' cannot be resolved without the managed connection runtime.`);
|
|
385
|
-
}
|
|
386
|
-
return [
|
|
387
|
-
{
|
|
388
|
-
connect: (_signal) => connector(definition)
|
|
389
|
-
}
|
|
390
|
-
];
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
function assertConnectorConnectionAccess(runtime, execution) {
|
|
395
|
-
const resolved = resolveExecutionScopeAuthorization(runtime.projectId, {
|
|
396
|
-
execution,
|
|
397
|
-
authorization: runtime.runtimeAuthorization
|
|
398
|
-
});
|
|
399
|
-
if (resolved.type === "unrestricted" && resolved.ref.type === "trustedPrimitive")
|
|
400
|
-
return;
|
|
401
|
-
throw new AuthorizationError("privileged:connector-connection.connect", "[Sixb] Connector connection clients are restricted to trusted primitive executions.");
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
export { ConnectorError, ConnectorNotFoundError, ConnectorOAuthError, createConnectorCodedError, createAmbiguousProviderOperationError, oauthErrorKind, providerFailureCode, providerBoundaryError, isConnectorStorageError, storageBoundaryError, recoverConnectorFailure, createConnectorRuntime, getConnectorExecutionSourceResolver, SyncValidationError, SyncRunDispatcher, requestSyncRun };
|
|
281
|
+
export { SyncValidationError2, SyncRunDispatcher2, requestSyncRun2 };
|
|
405
282
|
|
|
406
|
-
//# debugId=
|
|
283
|
+
//# debugId=145F9F0BA5C3020C64756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/syncs/errors.ts", "../src/syncs/run-dispatch.ts", "../src/syncs/request.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export class SyncValidationError extends Error {\n readonly name = \"SyncValidationError\"\n}\n",
|
|
6
|
+
"import { randomUUID } from \"node:crypto\"\nimport { reportRunFailure } from \"../error-reporting/capability\"\nimport { createSixbError, toSixbFailure } from \"../errors/internal\"\nimport type { SixbFailure } from \"../errors/types\"\nimport type { RunDispatcher } from \"../execution/dispatch\"\nimport { createPrimitiveExecutionRecord } from \"../execution/durable\"\nimport type { Queues } from \"../queues\"\nimport type { SixbDefinitions } from \"../runtime/definitions\"\nimport type { CreateExecutionInput, Storage, SyncRunFailureCode, SyncRunRecord } from \"../storage\"\nimport { SYNC_RUN_FAILURE_CODES, SyncRunError } from \"../storage\"\nimport { SyncValidationError } from \"./errors\"\nimport type { SyncRunRequestOptions, SyncRunRequestResult } from \"./request\"\nimport type { SyncDefinition } from \"./types\"\n\nexport type AutomaticSyncExecutionSource =\n | { readonly type: \"schedule\"; readonly eventId: string }\n | { readonly type: \"event\"; readonly eventId: string }\n\nexport interface AutomaticSyncRunDispatchInput extends SyncRunRequestOptions {\n readonly syncId: string\n readonly runId: string\n readonly source: AutomaticSyncExecutionSource\n readonly correlationId: string\n readonly metadata?: Readonly<Record<string, string>>\n}\n\nexport type SyncRunDispatchPort = RunDispatcher<AutomaticSyncRunDispatchInput, SyncRunRequestResult>\n\nexport interface SyncRunDispatcherDependencies {\n readonly id: string\n readonly definitions: Pick<SixbDefinitions, \"syncs\">\n readonly storage: Storage\n readonly queues: Pick<Queues, \"syncRuns\">\n}\n\ninterface DispatchSyncRunInput extends SyncRunRequestOptions {\n readonly errorReporterHost: object\n readonly projectId: string\n readonly sync: SyncDefinition\n readonly storage: Storage\n readonly queue: Queues[\"syncRuns\"]\n readonly metadata?: Readonly<Record<string, string>>\n readonly createExecution: (executionId: string, runId: string) => Promise<CreateExecutionInput>\n readonly validateExistingRun?: (run: SyncRunRecord, storage: Storage) => Promise<void>\n}\n\ntype PersistedSyncRun =\n | { readonly publish: false; readonly run: SyncRunRecord }\n | {\n readonly publish: true\n readonly run: SyncRunRecord\n readonly execution: CreateExecutionInput\n readonly queuedAt: Date\n readonly created: boolean\n }\n\n/** Core-owned durable dispatch boundary used by automatic Sync triggers. */\nexport class SyncRunDispatcher implements SyncRunDispatchPort {\n constructor(private readonly dependencies: SyncRunDispatcherDependencies) {}\n\n async dispatch(input: AutomaticSyncRunDispatchInput): Promise<SyncRunRequestResult> {\n assertAutomaticDispatchInput(input)\n const sync = this.dependencies.definitions.syncs.getById(input.syncId)\n if (!sync) throw new SyncValidationError(`[Sixb] Unknown sync '${input.syncId}'`)\n\n return dispatchSyncRun({\n errorReporterHost: this.dependencies,\n projectId: this.dependencies.id,\n sync,\n storage: this.dependencies.storage,\n queue: this.dependencies.queues.syncRuns,\n runId: input.runId,\n expectedLatestVersionId: input.expectedLatestVersionId,\n commitMessage: input.commitMessage,\n metadata: input.metadata,\n validateExistingRun: (run, storage) =>\n assertAutomaticExecutionIdentity(storage, this.dependencies.id, input, run),\n createExecution: async (executionId, runId) =>\n createPrimitiveExecutionRecord({\n id: executionId,\n primitive: { kind: \"sync\", id: sync.id, runId },\n origin: {\n type: \"automatic\",\n projectId: this.dependencies.id,\n source: input.source,\n correlationId: input.correlationId,\n },\n }),\n })\n }\n}\n\n/** Persist a Sync execution and queued run before publishing its queue job. */\nexport async function dispatchSyncRun(input: DispatchSyncRunInput): Promise<SyncRunRequestResult> {\n const runId = createSyncRunId(input.runId)\n let persisted = await persistSyncRun(input, runId)\n if (!persisted.publish && input.validateExistingRun && persisted.run.status === \"queued\") {\n persisted = await reuseSyncRun(input, persisted.run)\n }\n if (!persisted.publish) return existingSyncRunResult(persisted.run)\n return publishSyncRun(input, persisted)\n}\n\nasync function persistSyncRun(\n input: DispatchSyncRunInput,\n runId: string\n): Promise<PersistedSyncRun> {\n const syncRuns = requireSyncRunStorage(input.storage)\n const existing = await syncRuns.getById({ projectId: input.projectId, id: runId })\n if (existing) return reuseSyncRun(input, existing)\n\n const execution = await input.createExecution(`exec_${randomUUID()}`, runId)\n const queuedAt = new Date()\n try {\n return await input.storage.transaction(\n async (tx): Promise<PersistedSyncRun> => {\n const transactionalRuns = requireSyncRunStorage(tx)\n const raced = await transactionalRuns.getById({ projectId: input.projectId, id: runId })\n if (raced) {\n assertExistingRunMatchesRequest(raced, input)\n await input.validateExistingRun?.(raced, tx)\n return { publish: false, run: raced }\n }\n\n await tx.executions.create(execution)\n const run = await transactionalRuns.queue({\n projectId: input.projectId,\n id: runId,\n executionId: execution.id,\n syncId: input.sync.id,\n datasetId: input.sync.target.dataset.id,\n mode: input.sync.config.mode,\n queuedAt,\n expectedLatestVersionId: input.expectedLatestVersionId,\n commitMessage: input.commitMessage,\n })\n return { publish: true, run, execution, queuedAt, created: true }\n },\n { isolation: \"serializable\" }\n )\n } catch (error) {\n if (!(error instanceof SyncRunError)) throw error\n const raced = await syncRuns.getById({ projectId: input.projectId, id: runId })\n if (!raced) throw error\n assertExistingRunMatchesRequest(raced, input)\n await input.validateExistingRun?.(raced, input.storage)\n return { publish: false, run: raced }\n }\n}\n\nasync function reuseSyncRun(\n input: DispatchSyncRunInput,\n existing: SyncRunRecord\n): Promise<PersistedSyncRun> {\n assertExistingRunMatchesRequest(existing, input)\n await input.validateExistingRun?.(existing, input.storage)\n if (input.validateExistingRun && existing.status === \"queued\") {\n const execution = await input.storage.executions.getById({\n projectId: input.projectId,\n id: existing.executionId,\n })\n if (!execution)\n throw new SyncRunError(`[Sixb] Execution '${existing.executionId}' was not found.`)\n return { publish: true, run: existing, execution, queuedAt: existing.queuedAt, created: false }\n }\n if (\n existing.status !== \"failed\" ||\n existing.error?.code !== \"queue.enqueue_failed\" ||\n !existing.error.retryable\n ) {\n return { publish: false, run: existing }\n }\n\n const execution = await input.storage.executions.getById({\n projectId: input.projectId,\n id: existing.executionId,\n })\n if (!execution) {\n throw new SyncRunError(\n `[Sixb] Execution '${existing.executionId}' for Sync run '${existing.id}' was not found.`\n )\n }\n\n const queuedAt = new Date()\n const run = await requireSyncRunStorage(input.storage).queue({\n projectId: input.projectId,\n id: existing.id,\n executionId: existing.executionId,\n syncId: existing.syncId,\n datasetId: existing.datasetId,\n mode: existing.mode,\n queuedAt,\n expectedLatestVersionId: existing.expectedLatestVersionId,\n commitMessage: existing.commitMessage,\n })\n return { publish: true, run, execution, queuedAt, created: false }\n}\n\nasync function publishSyncRun(\n input: DispatchSyncRunInput,\n persisted: Extract<PersistedSyncRun, { readonly publish: true }>\n): Promise<SyncRunRequestResult> {\n try {\n const [job] = await input.queue.enqueue({\n projectId: input.projectId,\n jobs: [\n {\n id: persisted.run.id,\n type: \"sync.run.requested\",\n payload: { runId: persisted.run.id },\n ...(input.metadata === undefined ? {} : { metadata: input.metadata }),\n },\n ],\n })\n if (!job || job.id !== persisted.run.id) {\n throw new SyncRunError(`[Sixb] Queue did not acknowledge Sync run '${persisted.run.id}'.`)\n }\n return {\n syncId: persisted.run.syncId,\n runId: persisted.run.id,\n queuedAt: persisted.queuedAt.toISOString(),\n ...(job?.id ? { jobId: job.id } : {}),\n created: persisted.created,\n }\n } catch (error) {\n // Automatic consumers retain the batch and retry. Keep uncertain delivery queued:\n // a lost reply does not prove that the queue rejected the job.\n if (input.validateExistingRun) throw error\n const failedAt = new Date()\n const failure = toEnqueueFailure(error, persisted.run, failedAt)\n const failed = await requireSyncRunStorage(input.storage).finish({\n projectId: input.projectId,\n id: persisted.run.id,\n status: \"failed\",\n finishedAt: failedAt,\n error: failure,\n })\n reportRunFailure(input.errorReporterHost, error, {\n projectId: input.projectId,\n runKind: \"sync\",\n run: { runId: failed.id, syncId: failed.syncId },\n failure,\n })\n throw error\n }\n}\n\nfunction assertExistingRunMatchesRequest(\n existing: SyncRunRecord,\n input: Pick<DispatchSyncRunInput, \"sync\" | \"expectedLatestVersionId\" | \"commitMessage\">\n): void {\n if (\n existing.syncId !== input.sync.id ||\n existing.datasetId !== input.sync.target.dataset.id ||\n existing.mode !== input.sync.config.mode ||\n existing.expectedLatestVersionId !== input.expectedLatestVersionId ||\n existing.commitMessage !== input.commitMessage\n ) {\n throw new SyncRunError(\n `[Sixb] Sync run '${existing.id}' already exists with a different request payload.`\n )\n }\n}\n\nfunction existingSyncRunResult(existing: SyncRunRecord): SyncRunRequestResult {\n return {\n syncId: existing.syncId,\n runId: existing.id,\n queuedAt: existing.queuedAt.toISOString(),\n created: false,\n }\n}\n\nfunction requireSyncRunStorage(storage: Storage): NonNullable<Storage[\"syncRuns\"]> {\n if (!storage.syncRuns) throw new SyncValidationError(\"[Sixb] Sync run storage is not configured.\")\n return storage.syncRuns\n}\n\nfunction createSyncRunId(runId: string | undefined): string {\n if (runId === undefined) return `run_${randomUUID()}`\n if (!runId.trim()) throw new SyncValidationError(\"[Sixb] Sync run id must not be empty\")\n return runId\n}\n\nfunction assertAutomaticDispatchInput(input: AutomaticSyncRunDispatchInput): void {\n assertNonBlank(input.syncId, \"Sync id\")\n assertNonBlank(input.runId, \"Sync run id\")\n assertNonBlank(input.source.eventId, \"Sync source event id\")\n assertNonBlank(input.correlationId, \"Sync correlation id\")\n}\n\nasync function assertAutomaticExecutionIdentity(\n storage: Storage,\n projectId: string,\n input: AutomaticSyncRunDispatchInput,\n run: SyncRunRecord\n): Promise<void> {\n const execution = await storage.executions.getById({ projectId, id: run.executionId })\n if (\n !execution ||\n execution.source.type !== input.source.type ||\n execution.source.eventId !== input.source.eventId ||\n execution.correlationId !== input.correlationId ||\n execution.requestedBy !== undefined\n ) {\n throw new SyncValidationError(\n `[Sixb] Sync run '${run.id}' already exists with different automatic provenance.`\n )\n }\n}\n\nfunction toEnqueueFailure(\n error: unknown,\n run: SyncRunRecord,\n at: Date\n): SixbFailure<SyncRunFailureCode> {\n const enqueueError = createSixbError(\n \"queue.enqueue_failed\",\n `[Sixb] Could not enqueue Sync run '${run.id}'.`,\n {\n cause: error,\n details: { syncId: run.syncId, runId: run.id, phase: \"enqueue\" },\n }\n )\n return toSixbFailure(enqueueError, { allowedCodes: SYNC_RUN_FAILURE_CODES, at })\n}\n\nfunction assertNonBlank(value: string, label: string): void {\n if (!value.trim()) throw new SyncValidationError(`[Sixb] ${label} must not be empty.`)\n}\n",
|
|
7
|
+
"import { assertAuthorized } from \"../authorization\"\nimport { resolveExecutionScopeAuthorization } from \"../execution/authorization\"\nimport {\n createPrimitiveExecutionRecord,\n ensureExecutionRecord,\n executionRecordInputFromRuntime,\n} from \"../execution/durable\"\nimport type { ExecutionContext } from \"../execution/types\"\nimport type { SixbRuntimeContext } from \"../runtime/types\"\nimport { SyncValidationError } from \"./errors\"\nimport { dispatchSyncRun } from \"./run-dispatch\"\nimport type { SyncDefinition } from \"./types\"\n\nexport interface SyncRunRequestOptions {\n /** Stable identity used to make dispatch idempotent. */\n readonly runId?: string\n /** Optimistic concurrency guard: fail the run if the dataset moved past this version. */\n readonly expectedLatestVersionId?: string\n readonly commitMessage?: string\n}\n\nexport interface RequestSyncRunInput extends SyncRunRequestOptions {\n readonly syncId: string\n}\n\nexport interface SyncRunRequestResult {\n readonly syncId: string\n readonly runId: string\n /** Durable time at which the run entered the queue. */\n readonly queuedAt: string\n readonly jobId?: string\n readonly created: boolean\n}\n\n/**\n * Authorize and queue a sync run request.\n *\n * Operates on an already-resolved definition and the shared runtime context, so the HTTP route and\n * the runtime verb cannot drift apart.\n *\n * The immutable child execution and queued run are persisted before queue publication.\n */\nexport async function requestSyncRun(\n runtime: SixbRuntimeContext,\n execution: ExecutionContext,\n sync: SyncDefinition,\n options: SyncRunRequestOptions = {}\n): Promise<SyncRunRequestResult> {\n resolveExecutionScopeAuthorization(runtime.projectId, {\n execution,\n authorization: runtime.runtimeAuthorization,\n })\n assertAuthorized(runtime, { kind: \"sync.run\", syncId: sync.id })\n if (!runtime.storage.syncRuns) {\n throw new SyncValidationError(\"[Sixb] Sync run storage is not configured.\")\n }\n\n const queue = runtime.queues.syncRuns\n if (!queue) {\n throw new SyncValidationError(\"[Sixb] Sync run queue is not configured.\")\n }\n\n return dispatchSyncRun({\n errorReporterHost: runtime,\n projectId: runtime.projectId,\n sync,\n storage: runtime.storage,\n queue,\n ...options,\n createExecution: async (executionId, runId) => {\n const caller = await ensureExecutionRecord(\n runtime.storage.executions,\n executionRecordInputFromRuntime({\n execution,\n runtimeAuthorization: runtime.runtimeAuthorization,\n })\n )\n return createPrimitiveExecutionRecord({\n id: executionId,\n primitive: { kind: \"sync\", id: sync.id, runId },\n origin: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/D,IAAI,CAAC,QAAQ,QAAQ,UAAU;AAAA,IAC7B,MAAM,IAAI,qBAAoB,4CAA4C;AAAA,EAC5E;AAAA,EAEA,MAAM,QAAQ,QAAQ,OAAO;AAAA,EAC7B,IAAI,CAAC,OAAO;AAAA,IACV,MAAM,IAAI,qBAAoB,0CAA0C;AAAA,EAC1E;AAAA,EAEA,OAAO,gBAAgB;AAAA,IACrB,mBAAmB;AAAA,IACnB,WAAW,QAAQ;AAAA,IACnB;AAAA,IACA,SAAS,QAAQ;AAAA,IACjB;AAAA,OACG;AAAA,IACH,iBAAiB,OAAO,aAAa,UAAU;AAAA,MAC7C,MAAM,SAAS,MAAM,uBACnB,QAAQ,QAAQ,YAChB,gCAAgC;AAAA,QAC9B;AAAA,QACA,sBAAsB,QAAQ;AAAA,MAChC,CAAC,CACH;AAAA,MACA,OAAO,+BAA+B;AAAA,QACpC,IAAI;AAAA,QACJ,WAAW,EAAE,MAAM,QAAQ,IAAI,KAAK,IAAI,MAAM;AAAA,QAC9C,QAAQ,EAAE,MAAM,aAAa,QAAQ,OAAO;AAAA,MAC9C,CAAC;AAAA;AAAA,EAEL,CAAC;AAAA;",
|
|
10
|
+
"debugId": "145F9F0BA5C3020C64756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/objects/query/errors.ts
|
|
3
|
-
class
|
|
3
|
+
class ObjectQueryValidationError2 extends Error {
|
|
4
4
|
name = "ObjectQueryValidationError";
|
|
5
5
|
issues;
|
|
6
6
|
constructor(issues) {
|
|
@@ -9,7 +9,7 @@ class ObjectQueryValidationError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class ObjectQueryPlanningError2 extends Error {
|
|
13
13
|
name = "ObjectQueryPlanningError";
|
|
14
14
|
issues;
|
|
15
15
|
constructor(issues) {
|
|
@@ -18,7 +18,7 @@ class ObjectQueryPlanningError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
class
|
|
21
|
+
class ObjectQueryExecutionError2 extends Error {
|
|
22
22
|
name = "ObjectQueryExecutionError";
|
|
23
23
|
code;
|
|
24
24
|
path;
|
|
@@ -44,7 +44,7 @@ function formatQueryPlanningMessage(issues) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// src/objects/query/normalize.ts
|
|
47
|
-
function
|
|
47
|
+
function normalizeObjectQuery2(query) {
|
|
48
48
|
return hoistExpand(normalizeNode(query));
|
|
49
49
|
}
|
|
50
50
|
function normalizeNode(query) {
|
|
@@ -61,14 +61,14 @@ function normalizeNode(query) {
|
|
|
61
61
|
case "text":
|
|
62
62
|
return {
|
|
63
63
|
...query,
|
|
64
|
-
input:
|
|
64
|
+
input: normalizeObjectQuery2(query.input),
|
|
65
65
|
fields: query.fields ? uniqueStrings(query.fields) : undefined,
|
|
66
66
|
fieldsByObjectType: query.fieldsByObjectType ? uniqueStringRecord(query.fieldsByObjectType) : undefined
|
|
67
67
|
};
|
|
68
68
|
case "vector":
|
|
69
|
-
return { ...query, input:
|
|
69
|
+
return { ...query, input: normalizeObjectQuery2(query.input), vector: [...query.vector] };
|
|
70
70
|
case "traverse":
|
|
71
|
-
return { ...query, input:
|
|
71
|
+
return { ...query, input: normalizeObjectQuery2(query.input) };
|
|
72
72
|
case "set":
|
|
73
73
|
return normalizeSet(query);
|
|
74
74
|
case "sort":
|
|
@@ -76,11 +76,11 @@ function normalizeNode(query) {
|
|
|
76
76
|
case "limit":
|
|
77
77
|
return normalizeLimit(query.input, query.limit);
|
|
78
78
|
case "page":
|
|
79
|
-
return { ...query, input:
|
|
79
|
+
return { ...query, input: normalizeObjectQuery2(query.input) };
|
|
80
80
|
case "project":
|
|
81
81
|
return {
|
|
82
82
|
...query,
|
|
83
|
-
input:
|
|
83
|
+
input: normalizeObjectQuery2(query.input),
|
|
84
84
|
properties: query.properties ? uniqueStrings(query.properties) : undefined
|
|
85
85
|
};
|
|
86
86
|
case "expand":
|
|
@@ -94,7 +94,7 @@ function hoistExpand(query) {
|
|
|
94
94
|
if (query.input.kind !== "expand")
|
|
95
95
|
return query;
|
|
96
96
|
const inner = query.input;
|
|
97
|
-
const rebuilt =
|
|
97
|
+
const rebuilt = normalizeObjectQuery2({ ...query, input: inner.input });
|
|
98
98
|
if (rebuilt.kind === "expand") {
|
|
99
99
|
return {
|
|
100
100
|
kind: "expand",
|
|
@@ -105,7 +105,7 @@ function hoistExpand(query) {
|
|
|
105
105
|
return { kind: "expand", input: rebuilt, expansions: inner.expansions };
|
|
106
106
|
}
|
|
107
107
|
function normalizeExpand(input, expansions) {
|
|
108
|
-
const normalizedInput =
|
|
108
|
+
const normalizedInput = normalizeObjectQuery2(input);
|
|
109
109
|
const normalizedExpansions = normalizeExpansions(expansions);
|
|
110
110
|
if (normalizedInput.kind === "expand") {
|
|
111
111
|
return {
|
|
@@ -149,12 +149,12 @@ function mergeExpansion(a, b) {
|
|
|
149
149
|
function expansionKey(expansion) {
|
|
150
150
|
return `${expansion.direction}\x00${expansion.linkId}\x00${expansion.sourceObjectTypeId ?? ""}`;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function normalizeObjectQueryPredicate2(predicate) {
|
|
153
153
|
switch (predicate.op) {
|
|
154
154
|
case "and":
|
|
155
155
|
case "or": {
|
|
156
156
|
const items = predicate.items.flatMap((item) => {
|
|
157
|
-
const normalized =
|
|
157
|
+
const normalized = normalizeObjectQueryPredicate2(item);
|
|
158
158
|
if (normalized.op === predicate.op)
|
|
159
159
|
return normalized.items;
|
|
160
160
|
return [normalized];
|
|
@@ -162,7 +162,7 @@ function normalizeObjectQueryPredicate(predicate) {
|
|
|
162
162
|
return items.length === 1 ? items[0] : { op: predicate.op, items };
|
|
163
163
|
}
|
|
164
164
|
case "not":
|
|
165
|
-
return { op: "not", item:
|
|
165
|
+
return { op: "not", item: normalizeObjectQueryPredicate2(predicate.item) };
|
|
166
166
|
case "in":
|
|
167
167
|
return { ...predicate, values: [...predicate.values] };
|
|
168
168
|
default:
|
|
@@ -170,10 +170,10 @@ function normalizeObjectQueryPredicate(predicate) {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
function normalizeFilter(input, predicate) {
|
|
173
|
-
const normalizedInput =
|
|
174
|
-
const normalizedPredicate =
|
|
173
|
+
const normalizedInput = normalizeObjectQuery2(input);
|
|
174
|
+
const normalizedPredicate = normalizeObjectQueryPredicate2(predicate);
|
|
175
175
|
if (normalizedInput.kind === "filter") {
|
|
176
|
-
return
|
|
176
|
+
return normalizeObjectQuery2({
|
|
177
177
|
kind: "filter",
|
|
178
178
|
input: normalizedInput.input,
|
|
179
179
|
predicate: {
|
|
@@ -190,7 +190,7 @@ function normalizeFilter(input, predicate) {
|
|
|
190
190
|
}
|
|
191
191
|
function normalizeSet(query) {
|
|
192
192
|
const inputs = query.inputs.flatMap((input) => {
|
|
193
|
-
const normalized =
|
|
193
|
+
const normalized = normalizeObjectQuery2(input);
|
|
194
194
|
if (normalized.kind === "set" && normalized.op === query.op)
|
|
195
195
|
return normalized.inputs;
|
|
196
196
|
return [normalized];
|
|
@@ -198,7 +198,7 @@ function normalizeSet(query) {
|
|
|
198
198
|
return { ...query, inputs };
|
|
199
199
|
}
|
|
200
200
|
function normalizeSort(input, fields) {
|
|
201
|
-
const normalizedInput =
|
|
201
|
+
const normalizedInput = normalizeObjectQuery2(input);
|
|
202
202
|
const normalizedFields = fields.map((field) => ({ ...field }));
|
|
203
203
|
if (normalizedInput.kind === "sort") {
|
|
204
204
|
return {
|
|
@@ -214,7 +214,7 @@ function normalizeSort(input, fields) {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
function normalizeLimit(input, limit) {
|
|
217
|
-
const normalizedInput =
|
|
217
|
+
const normalizedInput = normalizeObjectQuery2(input);
|
|
218
218
|
if (normalizedInput.kind === "limit") {
|
|
219
219
|
return {
|
|
220
220
|
kind: "limit",
|
|
@@ -254,7 +254,7 @@ function uniqueStringRecord(record) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
// src/objects/query/explain-format.ts
|
|
257
|
-
function
|
|
257
|
+
function formatObjectQueryExplanation2(explanation) {
|
|
258
258
|
const lines = [];
|
|
259
259
|
const status = explanation.valid === undefined ? "not validated" : explanation.valid ? "valid" : "invalid";
|
|
260
260
|
const result = explanation.result ? ` result=${explanation.result.objectTypeIds.join(" | ")}` : "";
|
|
@@ -276,6 +276,6 @@ function appendNodeLines(node, lines, depth) {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
export {
|
|
279
|
+
export { ObjectQueryValidationError2, ObjectQueryPlanningError2, ObjectQueryExecutionError2, normalizeObjectQuery2, normalizeObjectQueryPredicate2, formatObjectQueryExplanation2 };
|
|
280
280
|
|
|
281
|
-
//# debugId=
|
|
281
|
+
//# debugId=B52ED952FD0DBCA864756E2164756E21
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"import type {\n ObjectExpansion,\n ObjectQuery,\n ObjectQueryPredicate,\n ObjectQuerySet,\n ObjectQuerySortField,\n} from \"./ir\"\n\n/**\n * Canonicalizes query trees before validation/planning so providers see a\n * stable shape regardless of how the typed builder assembled the query.\n *\n * `expand` is output-shaping, so it is hoisted to the outermost layer here: two\n * queries that differ only in where `.expand(...)` was chained normalize to the\n * same tree (and therefore the same cache key).\n */\nexport function normalizeObjectQuery(query: ObjectQuery): ObjectQuery {\n return hoistExpand(normalizeNode(query))\n}\n\nfunction normalizeNode(query: ObjectQuery): ObjectQuery {\n switch (query.kind) {\n case \"start\":\n return { ...query }\n case \"refs\":\n return {\n kind: \"refs\",\n refs: uniqueRefs(query.refs),\n }\n case \"filter\":\n return normalizeFilter(query.input, query.predicate)\n case \"text\":\n return {\n ...query,\n input: normalizeObjectQuery(query.input),\n fields: query.fields ? uniqueStrings(query.fields) : undefined,\n fieldsByObjectType: query.fieldsByObjectType\n ? uniqueStringRecord(query.fieldsByObjectType)\n : undefined,\n }\n case \"vector\":\n return { ...query, input: normalizeObjectQuery(query.input), vector: [...query.vector] }\n case \"traverse\":\n return { ...query, input: normalizeObjectQuery(query.input) }\n case \"set\":\n return normalizeSet(query)\n case \"sort\":\n return normalizeSort(query.input, query.fields)\n case \"limit\":\n return normalizeLimit(query.input, query.limit)\n case \"page\":\n return { ...query, input: normalizeObjectQuery(query.input) }\n case \"project\":\n return {\n ...query,\n input: normalizeObjectQuery(query.input),\n properties: query.properties ? uniqueStrings(query.properties) : undefined,\n }\n case \"expand\":\n return normalizeExpand(query.input, query.expansions)\n }\n}\n\n/**\n * Keeps `expand` at the outermost layer. A single-input wrapper sitting above an\n * `expand` is swapped so the `expand` wraps the (re-normalized) wrapper subtree;\n * re-normalizing collapses any nodes that became adjacent, and a wrapper that\n * lands above another `expand` is merged into one.\n */\nfunction hoistExpand(query: ObjectQuery): ObjectQuery {\n if (\n query.kind === \"start\" ||\n query.kind === \"refs\" ||\n query.kind === \"set\" ||\n query.kind === \"expand\"\n ) {\n return query\n }\n if (query.input.kind !== \"expand\") return query\n\n const inner = query.input\n const rebuilt = normalizeObjectQuery({ ...query, input: inner.input })\n if (rebuilt.kind === \"expand\") {\n return {\n kind: \"expand\",\n input: rebuilt.input,\n expansions: normalizeExpansions([...inner.expansions, ...rebuilt.expansions]),\n }\n }\n return { kind: \"expand\", input: rebuilt, expansions: inner.expansions }\n}\n\nfunction normalizeExpand(input: ObjectQuery, expansions: readonly ObjectExpansion[]): ObjectQuery {\n const normalizedInput = normalizeObjectQuery(input)\n const normalizedExpansions = normalizeExpansions(expansions)\n\n // A directly-nested expand (`a.expand(X).expand(Y)` builds\n // `expand(expand(start, [X]), [Y])`) collapses into one outermost expand.\n if (normalizedInput.kind === \"expand\") {\n return {\n kind: \"expand\",\n input: normalizedInput.input,\n expansions: normalizeExpansions([...normalizedInput.expansions, ...normalizedExpansions]),\n }\n }\n\n return { kind: \"expand\", input: normalizedInput, expansions: normalizedExpansions }\n}\n\nfunction normalizeExpansions(expansions: readonly ObjectExpansion[]): ObjectExpansion[] {\n const byKey = new Map<string, ObjectExpansion>()\n for (const expansion of expansions) {\n const normalized = normalizeExpansion(expansion)\n const key = expansionKey(normalized)\n const existing = byKey.get(key)\n byKey.set(key, existing ? mergeExpansion(existing, normalized) : normalized)\n }\n\n return [...byKey.values()].sort((a, b) => {\n const left = expansionKey(a)\n const right = expansionKey(b)\n return left < right ? -1 : left > right ? 1 : 0\n })\n}\n\nfunction normalizeExpansion(expansion: ObjectExpansion): ObjectExpansion {\n const nested = expansion.expand ? normalizeExpansions(expansion.expand) : []\n return {\n linkId: expansion.linkId,\n direction: expansion.direction,\n ...(expansion.sourceObjectTypeId !== undefined\n ? { sourceObjectTypeId: expansion.sourceObjectTypeId }\n : {}),\n ...(expansion.limit !== undefined ? { limit: expansion.limit } : {}),\n ...(expansion.orderBy ? { orderBy: expansion.orderBy.map((field) => ({ ...field })) } : {}),\n ...(nested.length > 0 ? { expand: nested } : {}),\n }\n}\n\n// Two expansions of the same link in the same direction are one hydration; their\n// nested expansions merge so the normalized tree never double-hydrates a link.\nfunction mergeExpansion(a: ObjectExpansion, b: ObjectExpansion): ObjectExpansion {\n const nested = normalizeExpansions([...(a.expand ?? []), ...(b.expand ?? [])])\n const { expand: _existing, ...base } = a\n return nested.length > 0 ? { ...base, expand: nested } : base\n}\n\nfunction expansionKey(expansion: ObjectExpansion): string {\n return `${expansion.direction}\\0${expansion.linkId}\\0${expansion.sourceObjectTypeId ?? \"\"}`\n}\n\nexport function normalizeObjectQueryPredicate(\n predicate: ObjectQueryPredicate\n): ObjectQueryPredicate {\n switch (predicate.op) {\n case \"and\":\n case \"or\": {\n const items = predicate.items.flatMap((item) => {\n const normalized = normalizeObjectQueryPredicate(item)\n if (normalized.op === predicate.op) return normalized.items\n return [normalized]\n })\n return items.length === 1 ? items[0] : { op: predicate.op, items }\n }\n case \"not\":\n return { op: \"not\", item: normalizeObjectQueryPredicate(predicate.item) }\n case \"in\":\n return { ...predicate, values: [...predicate.values] }\n default:\n return { ...predicate }\n }\n}\n\nfunction normalizeFilter(input: ObjectQuery, predicate: ObjectQueryPredicate): ObjectQuery {\n const normalizedInput = normalizeObjectQuery(input)\n const normalizedPredicate = normalizeObjectQueryPredicate(predicate)\n\n // Adjacent filters are equivalent to a single conjunction and are easier for\n // capability checks and providers to inspect.\n if (normalizedInput.kind === \"filter\") {\n return normalizeObjectQuery({\n kind: \"filter\",\n input: normalizedInput.input,\n predicate: {\n op: \"and\",\n items: [normalizedInput.predicate, normalizedPredicate],\n },\n })\n }\n\n return {\n kind: \"filter\",\n input: normalizedInput,\n predicate: normalizedPredicate,\n }\n}\n\nfunction normalizeSet(query: ObjectQuerySet): ObjectQuery {\n const inputs = query.inputs.flatMap((input) => {\n const normalized = normalizeObjectQuery(input)\n if (normalized.kind === \"set\" && normalized.op === query.op) return normalized.inputs\n return [normalized]\n })\n\n return { ...query, inputs }\n}\n\nfunction normalizeSort(input: ObjectQuery, fields: readonly ObjectQuerySortField[]): ObjectQuery {\n const normalizedInput = normalizeObjectQuery(input)\n const normalizedFields = fields.map((field) => ({ ...field }))\n\n // A later sort fully determines result order, so it replaces an adjacent sort.\n if (normalizedInput.kind === \"sort\") {\n return {\n kind: \"sort\",\n input: normalizedInput.input,\n fields: normalizedFields,\n }\n }\n\n return {\n kind: \"sort\",\n input: normalizedInput,\n fields: normalizedFields,\n }\n}\n\nfunction normalizeLimit(input: ObjectQuery, limit: number): ObjectQuery {\n const normalizedInput = normalizeObjectQuery(input)\n\n // Adjacent limits collapse to the stricter bound.\n if (normalizedInput.kind === \"limit\") {\n return {\n kind: \"limit\",\n input: normalizedInput.input,\n limit: Math.min(normalizedInput.limit, limit),\n }\n }\n\n return {\n kind: \"limit\",\n input: normalizedInput,\n limit,\n }\n}\n\nfunction uniqueStrings(values: readonly string[]): string[] {\n return [...new Set(values)]\n}\n\nfunction uniqueRefs(\n refs: readonly { objectTypeId: string; primaryId: string }[]\n): { objectTypeId: string; primaryId: string }[] {\n const seen = new Set<string>()\n const unique = refs.flatMap((ref) => {\n const key = JSON.stringify([ref.objectTypeId, ref.primaryId])\n if (seen.has(key)) return []\n seen.add(key)\n return [{ ...ref }]\n })\n\n // `refs` is an object-set source, not a positional batch response. Canonical\n // identity order makes equivalent sets normalize identically and matches the\n // default ordering used by provider query sources.\n return unique.sort(\n (left, right) =>\n compareStrings(left.objectTypeId, right.objectTypeId) ||\n compareStrings(left.primaryId, right.primaryId)\n )\n}\n\nfunction compareStrings(left: string, right: string): number {\n if (left < right) return -1\n if (left > right) return 1\n return 0\n}\n\nfunction uniqueStringRecord(\n record: Readonly<Record<string, readonly string[]>>\n): Record<string, string[]> {\n return Object.fromEntries(\n Object.entries(record).map(([objectTypeId, fields]) => [objectTypeId, uniqueStrings(fields)])\n )\n}\n",
|
|
7
7
|
"/**\n * Formatting for object query explanations.\n *\n * Lives apart from `explain.ts` so the fluent builder (and browser bundles\n * built on it) can import the formatter without pulling in the explanation\n * builder and its validation machinery.\n */\nimport type { ObjectQueryExplainNode, ObjectQueryExplanation } from \"./explain\"\n\nexport function formatObjectQueryExplanation(explanation: ObjectQueryExplanation): string {\n const lines: string[] = []\n const status =\n explanation.valid === undefined ? \"not validated\" : explanation.valid ? \"valid\" : \"invalid\"\n const result = explanation.result ? ` result=${explanation.result.objectTypeIds.join(\" | \")}` : \"\"\n\n lines.push(`ObjectQuery ${status}${result}`)\n appendNodeLines(explanation.tree, lines, 0)\n\n if (explanation.issues.length > 0) {\n lines.push(\"Issues:\")\n for (const issue of explanation.issues) {\n lines.push(`- ${issue.path} [${issue.code}] ${issue.message}`)\n }\n }\n\n return lines.join(\"\\n\")\n}\n\nfunction appendNodeLines(node: ObjectQueryExplainNode, lines: string[], depth: number): void {\n lines.push(`${\" \".repeat(depth)}- ${node.path} ${node.summary}`)\n for (const child of node.children) {\n appendNodeLines(child, lines, depth + 1)\n }\n}\n"
|
|
8
8
|
],
|
|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