@sixb/core 0.2.2 → 0.2.3
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 +55 -49
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run/executor.d.ts +0 -2
- package/dist/actions/run/executor.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +5 -1
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +2 -1
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/fork.d.ts.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +82 -75
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/request.d.ts +7 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +73 -10
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +3 -0
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/streams/index.js +2 -2
- package/dist/agents/streams/internal.js +2 -2
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/access.d.ts +37 -17
- package/dist/artifacts/access.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +65 -0
- package/dist/artifacts/canvas-display.d.ts.map +1 -0
- package/dist/artifacts/canvas.d.ts +6 -1
- package/dist/artifacts/canvas.d.ts.map +1 -1
- package/dist/artifacts/comment-text.d.ts +19 -0
- package/dist/artifacts/comment-text.d.ts.map +1 -0
- package/dist/artifacts/comments.d.ts +52 -0
- package/dist/artifacts/comments.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +3 -3
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +14 -0
- package/dist/artifacts/events.d.ts.map +1 -0
- package/dist/artifacts/execution.d.ts +129 -22
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +12 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/grants.d.ts +8 -5
- package/dist/artifacts/frames/grants.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +1 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +32 -964
- package/dist/artifacts/frames/index.js.map +4 -8
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +78 -0
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +17 -7
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/holders.d.ts +23 -0
- package/dist/artifacts/holders.d.ts.map +1 -0
- package/dist/artifacts/ids.d.ts +2 -0
- package/dist/artifacts/ids.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +6 -4
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +108 -13
- package/dist/artifacts/index.js.map +5 -4
- package/dist/artifacts/limits.d.ts +24 -3
- package/dist/artifacts/limits.d.ts.map +1 -1
- package/dist/artifacts/live/board.d.ts +103 -0
- package/dist/artifacts/live/board.d.ts.map +1 -0
- package/dist/artifacts/live/diff.d.ts +43 -0
- package/dist/artifacts/live/diff.d.ts.map +1 -0
- package/dist/artifacts/live/document.d.ts +55 -0
- package/dist/artifacts/live/document.d.ts.map +1 -0
- package/dist/artifacts/live/files.d.ts +16 -0
- package/dist/artifacts/live/files.d.ts.map +1 -0
- package/dist/artifacts/live/index.d.ts +9 -0
- package/dist/artifacts/live/index.d.ts.map +1 -0
- package/dist/artifacts/live/index.js +593 -0
- package/dist/artifacts/live/index.js.map +10 -0
- package/dist/artifacts/live/presence.d.ts +55 -0
- package/dist/artifacts/live/presence.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +109 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.js +21 -0
- package/dist/artifacts/live/protocol.js.map +9 -0
- package/dist/artifacts/live/server.d.ts +10 -0
- package/dist/artifacts/live/server.d.ts.map +1 -0
- package/dist/artifacts/live/server.js +86 -0
- package/dist/artifacts/live/server.js.map +9 -0
- package/dist/artifacts/live/state.d.ts +26 -0
- package/dist/artifacts/live/state.d.ts.map +1 -0
- package/dist/artifacts/outline.d.ts +11 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/publish/index.d.ts +8 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +61 -33
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +75 -0
- package/dist/artifacts/publish/merge.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +153 -0
- package/dist/artifacts/publish/previews.d.ts.map +1 -0
- package/dist/artifacts/publish/publish.d.ts +29 -8
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +20 -0
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -0
- package/dist/artifacts/publish/references.d.ts +4 -3
- package/dist/artifacts/publish/references.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/canvas.d.ts.map +1 -1
- package/dist/artifacts/theme.d.ts +5 -1
- package/dist/artifacts/theme.d.ts.map +1 -1
- package/dist/auth/directory.d.ts +33 -0
- package/dist/auth/directory.d.ts.map +1 -0
- package/dist/auth/index.js +13 -12
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/member-events.d.ts +5 -1
- package/dist/auth/member-events.d.ts.map +1 -1
- package/dist/auth/runtime.d.ts +22 -1
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/strategy.d.ts +2 -2
- package/dist/auth/strategy.d.ts.map +1 -1
- package/dist/auth/types.d.ts +42 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +6 -5
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +7 -6
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/index.js +4 -4
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/bootstrap/index.js +62 -56
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.js +1 -1
- package/dist/broker/types.d.ts +4 -0
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/{chunk-s7j8ewqv.js → chunk-0k3r5kb3.js} +257 -43
- package/dist/{chunk-s7j8ewqv.js.map → chunk-0k3r5kb3.js.map} +14 -13
- package/dist/{chunk-e5wf5vz0.js → chunk-0kgrghqx.js} +13 -1
- package/dist/chunk-0kgrghqx.js.map +10 -0
- package/dist/{chunk-80gym75n.js → chunk-186k5yz3.js} +1 -1
- package/dist/chunk-191jz8a6.js +61 -0
- package/dist/chunk-191jz8a6.js.map +10 -0
- package/dist/{chunk-mmagke4x.js → chunk-22d3qg4x.js} +2 -2
- package/dist/{chunk-mmagke4x.js.map → chunk-22d3qg4x.js.map} +3 -3
- package/dist/{chunk-m2vh8gh0.js → chunk-26qet7wh.js} +62 -15
- package/dist/{chunk-m2vh8gh0.js.map → chunk-26qet7wh.js.map} +5 -5
- package/dist/{chunk-eqgr6nsa.js → chunk-2by73sm2.js} +982 -184
- package/dist/chunk-2by73sm2.js.map +75 -0
- package/dist/chunk-2c4j899j.js.map +2 -2
- package/dist/{chunk-e6xgz4h4.js → chunk-3014rfjz.js} +197 -18
- package/dist/chunk-3014rfjz.js.map +21 -0
- package/dist/chunk-38yvdqzd.js +70 -0
- package/dist/chunk-38yvdqzd.js.map +10 -0
- package/dist/{chunk-ytzcxtpt.js → chunk-3ba89vm7.js} +1 -1
- package/dist/chunk-3hzhcfsv.js +139 -0
- package/dist/chunk-3hzhcfsv.js.map +10 -0
- package/dist/chunk-3sgvd10b.js +69 -0
- package/dist/chunk-3sgvd10b.js.map +10 -0
- package/dist/{chunk-djs3hw9p.js → chunk-3zagkr6w.js} +73 -6
- package/dist/chunk-3zagkr6w.js.map +21 -0
- package/dist/{chunk-wkq3kvzd.js → chunk-48c1z8nj.js} +6 -6
- package/dist/chunk-48c1z8nj.js.map +10 -0
- package/dist/{chunk-3sqqhpr7.js → chunk-4j0sagwv.js} +134 -19
- package/dist/{chunk-3sqqhpr7.js.map → chunk-4j0sagwv.js.map} +11 -10
- package/dist/{chunk-d04g36fw.js → chunk-5qqmndhm.js} +1 -1
- package/dist/{chunk-scyq22td.js → chunk-5rqqp8cr.js} +19 -4
- package/dist/chunk-5rqqp8cr.js.map +12 -0
- package/dist/{chunk-f1h34y3r.js → chunk-6gtxshcc.js} +6 -6
- package/dist/{chunk-f1h34y3r.js.map → chunk-6gtxshcc.js.map} +1 -1
- package/dist/{chunk-jspskey0.js → chunk-7j4yydm2.js} +67 -45
- package/dist/chunk-7j4yydm2.js.map +11 -0
- package/dist/{chunk-5wtnmpze.js → chunk-7qe46788.js} +1 -1
- package/dist/{chunk-31kcqmhf.js → chunk-855w9nvw.js} +1 -1
- package/dist/{chunk-e7v3trpz.js → chunk-8a8k38tz.js} +4 -3
- package/dist/chunk-8a8k38tz.js.map +10 -0
- package/dist/{chunk-2ajw5rz0.js → chunk-8p7bze4c.js} +3 -3
- package/dist/{chunk-jftd33rc.js → chunk-8t2ynwg0.js} +105 -9
- package/dist/chunk-8t2ynwg0.js.map +11 -0
- package/dist/{chunk-9whfmsfk.js → chunk-8tqnsx3q.js} +1 -1
- package/dist/{chunk-s3we74h8.js → chunk-9nsjjd44.js} +38 -5
- package/dist/chunk-9nsjjd44.js.map +12 -0
- package/dist/{chunk-hz5d43gn.js → chunk-9vsc919v.js} +14 -6
- package/dist/chunk-9vsc919v.js.map +10 -0
- package/dist/{chunk-waqk73p1.js → chunk-a6fjkcne.js} +185 -341
- package/dist/{chunk-waqk73p1.js.map → chunk-a6fjkcne.js.map} +6 -7
- package/dist/{chunk-s038wa5v.js → chunk-b9qfh2ya.js} +1 -1
- package/dist/{chunk-5taem5aw.js → chunk-bc3y6gff.js} +13 -4
- package/dist/chunk-bc3y6gff.js.map +10 -0
- package/dist/{chunk-w1btn96n.js → chunk-bkmnd7zq.js} +523 -254
- package/dist/chunk-bkmnd7zq.js.map +49 -0
- package/dist/chunk-bz5bnjjt.js +358 -0
- package/dist/chunk-bz5bnjjt.js.map +12 -0
- package/dist/{chunk-w976a4me.js → chunk-czct88ht.js} +28 -4
- package/dist/chunk-czct88ht.js.map +10 -0
- package/dist/{chunk-5kyvrtjh.js → chunk-d9xbwh3h.js} +131 -32
- package/dist/chunk-d9xbwh3h.js.map +13 -0
- package/dist/{chunk-kfee1h52.js → chunk-dfveegqq.js} +28 -8
- package/dist/chunk-dfveegqq.js.map +13 -0
- package/dist/{chunk-2g0r46hy.js → chunk-dhkc9b23.js} +15 -2
- package/dist/chunk-dhkc9b23.js.map +12 -0
- package/dist/chunk-dmnd9ea6.js +106 -0
- package/dist/chunk-dmnd9ea6.js.map +10 -0
- package/dist/{chunk-nz7815t3.js → chunk-e0hnbb1m.js} +27 -2
- package/dist/chunk-e0hnbb1m.js.map +14 -0
- package/dist/chunk-e91fmg6t.js +288 -0
- package/dist/chunk-e91fmg6t.js.map +11 -0
- package/dist/{chunk-a5v4gjdx.js → chunk-e9w4mgdh.js} +308 -220
- package/dist/{chunk-a5v4gjdx.js.map → chunk-e9w4mgdh.js.map} +21 -19
- package/dist/{chunk-w122ymx4.js → chunk-f6ahf5gf.js} +15 -4
- package/dist/{chunk-w122ymx4.js.map → chunk-f6ahf5gf.js.map} +3 -3
- package/dist/{chunk-jjmggm9a.js → chunk-fe6r7yhg.js} +1 -1
- package/dist/{chunk-165c9wm6.js → chunk-g2ph4873.js} +1 -1
- package/dist/chunk-hgj98cbb.js +22 -0
- package/dist/chunk-hgj98cbb.js.map +10 -0
- package/dist/{chunk-mbc5hvnj.js → chunk-hkaa807g.js} +18 -7
- package/dist/{chunk-mbc5hvnj.js.map → chunk-hkaa807g.js.map} +3 -3
- package/dist/chunk-hn2r7z41.js.map +3 -3
- package/dist/chunk-j0wgh8gv.js +250 -0
- package/dist/chunk-j0wgh8gv.js.map +10 -0
- package/dist/{chunk-z8fx5cgb.js → chunk-j2zm215x.js} +37 -3
- package/dist/chunk-j2zm215x.js.map +12 -0
- package/dist/{chunk-j1ny5fwh.js → chunk-k1g14kk3.js} +11 -83
- package/dist/{chunk-j1ny5fwh.js.map → chunk-k1g14kk3.js.map} +4 -5
- package/dist/{chunk-ga63a3dz.js → chunk-k66rp2hr.js} +3 -3
- package/dist/chunk-kr6dx38r.js +25 -0
- package/dist/chunk-kr6dx38r.js.map +10 -0
- package/dist/{chunk-a7aa0nzj.js → chunk-kv0kvknv.js} +14 -14
- package/dist/{chunk-a7aa0nzj.js.map → chunk-kv0kvknv.js.map} +1 -1
- package/dist/chunk-m2jerfef.js +474 -0
- package/dist/chunk-m2jerfef.js.map +11 -0
- package/dist/chunk-m7b9q5dk.js +234 -0
- package/dist/chunk-m7b9q5dk.js.map +12 -0
- package/dist/{chunk-escedwyt.js → chunk-mvz89age.js} +6 -1
- package/dist/{chunk-escedwyt.js.map → chunk-mvz89age.js.map} +3 -3
- package/dist/chunk-mwcqz3e3.js +30 -0
- package/dist/chunk-mwcqz3e3.js.map +10 -0
- package/dist/chunk-n2ay51px.js +21 -0
- package/dist/chunk-n2ay51px.js.map +10 -0
- package/dist/{chunk-gkv8r794.js → chunk-n68vz95m.js} +5 -5
- package/dist/{chunk-gkv8r794.js.map → chunk-n68vz95m.js.map} +3 -3
- package/dist/{chunk-0j3crh1w.js → chunk-p351afzm.js} +14 -14
- package/dist/{chunk-0j3crh1w.js.map → chunk-p351afzm.js.map} +4 -4
- package/dist/chunk-pk539cwv.js +370 -0
- package/dist/chunk-pk539cwv.js.map +11 -0
- package/dist/{chunk-jbw70d6t.js → chunk-ppxf7gw2.js} +52 -10
- package/dist/chunk-ppxf7gw2.js.map +11 -0
- package/dist/{chunk-9x8dybsb.js → chunk-pvpq483h.js} +10 -2
- package/dist/chunk-pvpq483h.js.map +10 -0
- package/dist/chunk-qafng88v.js +225 -0
- package/dist/chunk-qafng88v.js.map +11 -0
- package/dist/chunk-qds484t8.js +1363 -0
- package/dist/chunk-qds484t8.js.map +18 -0
- package/dist/{chunk-4zm1k3xj.js → chunk-r2psmn42.js} +1 -1
- package/dist/{chunk-kkjfve0t.js → chunk-rt9deb92.js} +4 -3
- package/dist/{chunk-kkjfve0t.js.map → chunk-rt9deb92.js.map} +3 -3
- package/dist/{chunk-r1cxq7vv.js → chunk-rtdrm592.js} +2 -2
- package/dist/{chunk-c7cfe31p.js → chunk-s5n9617r.js} +15 -15
- package/dist/{chunk-c7cfe31p.js.map → chunk-s5n9617r.js.map} +1 -1
- package/dist/{chunk-4bm0caep.js → chunk-smnt672s.js} +1 -1
- package/dist/{chunk-21q0j5f2.js → chunk-stmxh0hv.js} +2 -2
- package/dist/{chunk-nh26e7c5.js → chunk-sysnvjce.js} +5 -5
- package/dist/{chunk-nh26e7c5.js.map → chunk-sysnvjce.js.map} +3 -3
- package/dist/{chunk-57g0215c.js → chunk-t24yktqr.js} +296 -7
- package/dist/{chunk-57g0215c.js.map → chunk-t24yktqr.js.map} +6 -3
- package/dist/{chunk-ff5xkv0p.js → chunk-tfzvjdms.js} +1 -1
- package/dist/chunk-tqa68kj7.js +1322 -0
- package/dist/chunk-tqa68kj7.js.map +25 -0
- package/dist/chunk-vtjzwymr.js +37 -0
- package/dist/chunk-vtjzwymr.js.map +10 -0
- package/dist/{chunk-twfreyxr.js → chunk-vzkxqf8h.js} +23 -13
- package/dist/{chunk-twfreyxr.js.map → chunk-vzkxqf8h.js.map} +6 -6
- package/dist/{chunk-6b61s40c.js → chunk-w3t94hm6.js} +1 -1
- package/dist/{chunk-j8thxj7w.js → chunk-w9s23r24.js} +1218 -101
- package/dist/chunk-w9s23r24.js.map +30 -0
- package/dist/{chunk-fwsvshr5.js → chunk-wa05txmk.js} +20 -7
- package/dist/{chunk-fwsvshr5.js.map → chunk-wa05txmk.js.map} +3 -3
- package/dist/chunk-whbwf3np.js +12 -0
- package/dist/chunk-whbwf3np.js.map +10 -0
- package/dist/{chunk-t5608tkq.js → chunk-yv8hv4wq.js} +3 -1
- package/dist/{chunk-t5608tkq.js.map → chunk-yv8hv4wq.js.map} +3 -3
- package/dist/{chunk-dsv783c3.js → chunk-z0t4p2sk.js} +169 -53
- package/dist/{chunk-dsv783c3.js.map → chunk-z0t4p2sk.js.map} +7 -7
- package/dist/connectors/builders.d.ts +2 -2
- package/dist/connectors/builders.d.ts.map +1 -1
- package/dist/connectors/connections/access.d.ts +11 -0
- package/dist/connectors/connections/access.d.ts.map +1 -0
- package/dist/connectors/connections/contracts.d.ts +6 -1
- package/dist/connectors/connections/contracts.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +1 -1
- package/dist/connectors/connections/runs.d.ts +6 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +25 -0
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/connections/views.d.ts +1 -1
- package/dist/connectors/connections/views.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/service.d.ts +3 -0
- package/dist/connectors/service.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +21 -2
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +12 -6
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/ingest-flush-batch.d.ts +59 -0
- package/dist/datasets/ingest-flush-batch.d.ts.map +1 -0
- package/dist/datasets/ingest-flush-job.d.ts +33 -0
- package/dist/datasets/ingest-flush-job.d.ts.map +1 -0
- package/dist/datasets/ingest-flush.d.ts +66 -0
- package/dist/datasets/ingest-flush.d.ts.map +1 -0
- package/dist/datasets/produced-version.d.ts +21 -0
- package/dist/datasets/produced-version.d.ts.map +1 -0
- package/dist/datasets/write.d.ts +22 -1
- package/dist/datasets/write.d.ts.map +1 -1
- package/dist/datasets/write.js +8 -4
- package/dist/datasets/write.js.map +1 -1
- package/dist/deploy/internal.js +5 -4
- package/dist/deploy/internal.js.map +4 -4
- package/dist/deploy/types.d.ts +2 -3
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/error-reporting/capability.d.ts +8 -2
- package/dist/error-reporting/capability.d.ts.map +1 -1
- package/dist/error-reporting/internal.d.ts +1 -1
- package/dist/error-reporting/internal.d.ts.map +1 -1
- package/dist/error-reporting/internal.js +17 -5
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/error-reporting/reporter.d.ts.map +1 -1
- package/dist/error-reporting/reports.d.ts +55 -0
- package/dist/error-reporting/reports.d.ts.map +1 -1
- package/dist/error-reporting/types.d.ts +82 -1
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +5 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +1 -1
- package/dist/events/definitions.d.ts +4 -0
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts +1 -0
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +5 -5
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/types/artifacts.d.ts +38 -0
- package/dist/events/types/artifacts.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +3 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/events/types/users.d.ts +5 -2
- package/dist/events/types/users.d.ts.map +1 -1
- package/dist/execution/agent.js +57 -51
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +10 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/object-reader-clearance.d.ts +6 -0
- package/dist/execution/object-reader-clearance.d.ts.map +1 -1
- package/dist/execution/object-reader-security.d.ts +9 -2
- package/dist/execution/object-reader-security.d.ts.map +1 -1
- package/dist/execution/primitive.js +55 -49
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.js +49 -43
- package/dist/execution/request.js.map +2 -2
- package/dist/http/api-routes.d.ts +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -87
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/errors.d.ts +15 -0
- package/dist/lake-storage/errors.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +3 -2
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +16 -10
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/maintenance.d.ts +88 -0
- package/dist/lake-storage/maintenance.d.ts.map +1 -0
- package/dist/lake-storage/merge.d.ts +3 -1
- package/dist/lake-storage/merge.d.ts.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +23 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +10 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/maintenance/heartbeat.d.ts +5 -0
- package/dist/maintenance/heartbeat.d.ts.map +1 -0
- package/dist/maintenance/index.d.ts +4 -2
- package/dist/maintenance/index.d.ts.map +1 -1
- package/dist/maintenance/index.js +515 -0
- package/dist/maintenance/index.js.map +16 -0
- package/dist/maintenance/lake-retention-status.d.ts +36 -0
- package/dist/maintenance/lake-retention-status.d.ts.map +1 -0
- package/dist/maintenance/lake-retention.d.ts +84 -0
- package/dist/maintenance/lake-retention.d.ts.map +1 -0
- package/dist/maintenance/loop.d.ts +95 -0
- package/dist/maintenance/loop.d.ts.map +1 -0
- package/dist/maintenance/ontology-maintenance.d.ts +17 -16
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/maintenance/passes/cron-pass.d.ts +21 -0
- package/dist/maintenance/passes/cron-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/directory-pass.d.ts +12 -0
- package/dist/maintenance/passes/directory-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/ingest-pass.d.ts +26 -0
- package/dist/maintenance/passes/ingest-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/lake-change-feed.d.ts +38 -0
- package/dist/maintenance/passes/lake-change-feed.d.ts.map +1 -0
- package/dist/maintenance/passes/lake-retention-pass.d.ts +20 -0
- package/dist/maintenance/passes/lake-retention-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/ontology-pass.d.ts +8 -0
- package/dist/maintenance/passes/ontology-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/projections-pass.d.ts +26 -0
- package/dist/maintenance/passes/projections-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/recovery-pass.d.ts +6 -0
- package/dist/maintenance/passes/recovery-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/recovery-passes.d.ts +24 -0
- package/dist/maintenance/passes/recovery-passes.d.ts.map +1 -0
- package/dist/maintenance/passes/runs-pass.d.ts +6 -0
- package/dist/maintenance/passes/runs-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/triggers-pass.d.ts +41 -0
- package/dist/maintenance/passes/triggers-pass.d.ts.map +1 -0
- package/dist/maintenance/status.d.ts +19 -0
- package/dist/maintenance/status.d.ts.map +1 -0
- package/dist/maintenance/types.d.ts +25 -24
- package/dist/maintenance/types.d.ts.map +1 -1
- package/dist/materialization/model.d.ts +11 -2
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/artifact-refs.d.ts +33 -0
- package/dist/materializer/edits/artifact-refs.d.ts.map +1 -0
- package/dist/materializer/edits/commit.d.ts.map +1 -1
- package/dist/materializer/edits/operations.d.ts +7 -1
- package/dist/materializer/edits/operations.d.ts.map +1 -1
- package/dist/materializer/edits/plan.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts +6 -0
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.js +30 -27
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/materializer/telemetry/plan.d.ts.map +1 -1
- package/dist/models/execution/index.js +29 -26
- package/dist/models/execution/index.js.map +1 -1
- package/dist/objects/artifact-refs.d.ts +5 -0
- package/dist/objects/artifact-refs.d.ts.map +1 -0
- package/dist/objects/index.js +58 -53
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/materializer-adapter.d.ts +4 -3
- package/dist/objects/materializer-adapter.d.ts.map +1 -1
- package/dist/objects/object/upsert-batch.d.ts.map +1 -1
- package/dist/objects/object/upsert.d.ts.map +1 -1
- package/dist/objects/query/index.js +28 -25
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/ir.d.ts +3 -1
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/scalar-values.d.ts.map +1 -1
- package/dist/objects/runtime-batch.d.ts +2 -0
- package/dist/objects/runtime-batch.d.ts.map +1 -1
- package/dist/ontology/artifact-ref.d.ts +36 -0
- package/dist/ontology/artifact-ref.d.ts.map +1 -0
- package/dist/ontology/docs-markdown.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +3 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +8 -5
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/inference/index.d.ts +2 -0
- package/dist/ontology/inference/index.d.ts.map +1 -1
- package/dist/ontology/internal.js +7 -6
- package/dist/ontology/internal.js.map +1 -1
- package/dist/ontology/json-schema.d.ts.map +1 -1
- package/dist/ontology/primitives.d.ts.map +1 -1
- package/dist/ontology/reference-values.d.ts +10 -0
- package/dist/ontology/reference-values.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +6 -1
- package/dist/ontology/refs.d.ts.map +1 -1
- package/dist/ontology/registry.d.ts +9 -1
- package/dist/ontology/registry.d.ts.map +1 -1
- package/dist/ontology/types.d.ts +2 -1
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/ontology/user-ref.d.ts +16 -0
- package/dist/ontology/user-ref.d.ts.map +1 -1
- package/dist/ontology/validation/normalize.d.ts.map +1 -1
- package/dist/ontology/validation/properties.d.ts.map +1 -1
- package/dist/ontology/validation/schema.d.ts.map +1 -1
- package/dist/pending-tasks.d.ts +17 -0
- package/dist/pending-tasks.d.ts.map +1 -0
- package/dist/pipelines/index.js +36 -33
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/run-dispatch.d.ts +6 -0
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/predicates/types.d.ts +4 -0
- package/dist/predicates/types.d.ts.map +1 -1
- package/dist/projections/builders.d.ts +13 -11
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/internal.js +29 -26
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/types.d.ts +1 -1
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +2 -2
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +6 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +55 -2
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +3 -0
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +22 -5
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +6 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +51 -30
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/sixb.d.ts +6 -1
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/index.js +8 -7
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +0 -2
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +3 -6
- package/dist/scheduler/index.js.map +1 -1
- package/dist/schedules/index.js +9 -11
- package/dist/schedules/index.js.map +1 -1
- package/dist/security/internal.js +1 -1
- package/dist/shared/backoff.d.ts +12 -0
- package/dist/shared/backoff.d.ts.map +1 -0
- package/dist/shared/duration.d.ts +3 -0
- package/dist/shared/duration.d.ts.map +1 -0
- package/dist/shared/params/artifact-refs.d.ts +19 -0
- package/dist/shared/params/artifact-refs.d.ts.map +1 -0
- package/dist/shares/guest-name.d.ts +8 -0
- package/dist/shares/guest-name.d.ts.map +1 -0
- package/dist/shares/internal.d.ts +1 -0
- package/dist/shares/internal.d.ts.map +1 -1
- package/dist/shares/internal.js +68 -27
- package/dist/shares/internal.js.map +3 -3
- package/dist/shares/session-protocol.d.ts +13 -0
- package/dist/shares/session-protocol.d.ts.map +1 -1
- package/dist/storage/action-runs/failure.js +2 -2
- package/dist/storage/ai-limits/enforcement.js +2 -2
- package/dist/storage/artifacts/errors.d.ts +9 -4
- package/dist/storage/artifacts/errors.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +27 -4
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +39 -2
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +328 -39
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts +2 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/identities.d.ts +4 -0
- package/dist/storage/auth/in-memory/identities.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/shared.d.ts +3 -1
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/users.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +1 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +39 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/in-memory.d.ts +1 -1
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/index.d.ts +1 -1
- package/dist/storage/connector-connections/index.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/shared.d.ts +12 -2
- package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.d.ts +1 -0
- package/dist/storage/connector-connections/provider.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +21 -5
- package/dist/storage/connector-connections/provider.js.map +5 -5
- package/dist/storage/connector-connections/types.d.ts +1 -1
- package/dist/storage/connector-connections/types.d.ts.map +1 -1
- package/dist/storage/dataset-ingest/codec.d.ts +6 -0
- package/dist/storage/dataset-ingest/codec.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/in-memory.d.ts +28 -0
- package/dist/storage/dataset-ingest/in-memory.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/index.d.ts +4 -0
- package/dist/storage/dataset-ingest/index.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/provider.d.ts +157 -0
- package/dist/storage/dataset-ingest/provider.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/provider.js +17 -0
- package/dist/storage/dataset-ingest/provider.js.map +9 -0
- package/dist/storage/dataset-ingest/types.d.ts +188 -0
- package/dist/storage/dataset-ingest/types.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/provider.js +12 -11
- package/dist/storage/file-upload-sessions/provider.js.map +1 -1
- package/dist/storage/in-memory/index.d.ts +12 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +18 -11
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +55 -45
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +4 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +81 -5
- package/dist/storage/internal.js.map +4 -3
- package/dist/storage/lake-retention-runs/in-memory.d.ts +11 -0
- package/dist/storage/lake-retention-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/lake-retention-runs/index.d.ts +3 -0
- package/dist/storage/lake-retention-runs/index.d.ts.map +1 -0
- package/dist/storage/lake-retention-runs/types.d.ts +21 -0
- package/dist/storage/lake-retention-runs/types.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/in-memory.d.ts +11 -0
- package/dist/storage/maintenance-heartbeats/in-memory.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/index.d.ts +3 -0
- package/dist/storage/maintenance-heartbeats/index.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/record.d.ts +11 -0
- package/dist/storage/maintenance-heartbeats/record.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/types.d.ts +30 -0
- package/dist/storage/maintenance-heartbeats/types.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/storage.d.ts +15 -1
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -1
- package/dist/storage/objects/read-scope.d.ts.map +1 -1
- package/dist/storage/objects/types.d.ts +18 -1
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/replacement-plans.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/materializations.d.ts +20 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/provider-work.d.ts +7 -1
- package/dist/storage/ontology/provider-work.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/pipeline-runs/in-memory.d.ts +8 -2
- package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/index.d.ts +1 -1
- package/dist/storage/pipeline-runs/index.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +1 -1
- package/dist/storage/pipeline-runs/transitions.d.ts +2 -2
- package/dist/storage/pipeline-runs/transitions.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/types.d.ts +26 -6
- package/dist/storage/pipeline-runs/types.d.ts.map +1 -1
- package/dist/storage/projection-runs/errors.d.ts +6 -0
- package/dist/storage/projection-runs/errors.d.ts.map +1 -1
- package/dist/storage/projection-runs/in-memory.d.ts +5 -1
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/projection-runs/index.d.ts +2 -2
- package/dist/storage/projection-runs/index.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts +1 -0
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/projection-runs/types.d.ts +16 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/run-claim.d.ts +132 -0
- package/dist/storage/run-claim.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.js +3 -3
- package/dist/storage/share-sessions/in-memory.d.ts +2 -1
- package/dist/storage/share-sessions/in-memory.d.ts.map +1 -1
- package/dist/storage/share-sessions/index.d.ts +1 -1
- package/dist/storage/share-sessions/index.d.ts.map +1 -1
- package/dist/storage/share-sessions/provider.d.ts +1 -1
- package/dist/storage/share-sessions/provider.d.ts.map +1 -1
- package/dist/storage/share-sessions/provider.js +4 -2
- package/dist/storage/share-sessions/provider.js.map +1 -1
- package/dist/storage/share-sessions/record.d.ts +2 -1
- package/dist/storage/share-sessions/record.d.ts.map +1 -1
- package/dist/storage/share-sessions/types.d.ts +17 -1
- package/dist/storage/share-sessions/types.d.ts.map +1 -1
- package/dist/storage/sync-runs/in-memory.d.ts +10 -2
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/index.d.ts +1 -1
- package/dist/storage/sync-runs/index.d.ts.map +1 -1
- package/dist/storage/sync-runs/transitions.d.ts +2 -2
- package/dist/storage/sync-runs/transitions.d.ts.map +1 -1
- package/dist/storage/sync-runs/types.d.ts +29 -3
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/types.d.ts +12 -6
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/in-memory.d.ts +2 -1
- package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/webhook-runs/index.d.ts +2 -2
- package/dist/storage/webhook-runs/index.d.ts.map +1 -1
- package/dist/storage/webhook-runs/types.d.ts +33 -2
- package/dist/storage/webhook-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts +6 -3
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/index.d.ts +1 -1
- package/dist/storage/workflow-runs/index.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +12 -11
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +11 -28
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +37 -34
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +2 -0
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
- package/dist/testing/artifact-holders-contract.d.ts +15 -0
- package/dist/testing/artifact-holders-contract.d.ts.map +1 -0
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
- package/dist/testing/dataset-ingest-storage-contract.d.ts +11 -0
- package/dist/testing/dataset-ingest-storage-contract.d.ts.map +1 -0
- package/dist/testing/dataset-sequence-contract.d.ts +1 -1
- package/dist/testing/dataset-sequence-contract.d.ts.map +1 -1
- package/dist/testing/execution.d.ts.map +1 -1
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6244 -3191
- package/dist/testing/index.js.map +28 -19
- package/dist/testing/lake-retention-run-storage-contract.d.ts +9 -0
- package/dist/testing/lake-retention-run-storage-contract.d.ts.map +1 -0
- package/dist/testing/maintenance-heartbeat-storage-contract.d.ts +9 -0
- package/dist/testing/maintenance-heartbeat-storage-contract.d.ts.map +1 -0
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/testing/pipeline-execution.d.ts.map +1 -1
- package/dist/testing/pipeline-run-read-contract.d.ts +13 -0
- package/dist/testing/pipeline-run-read-contract.d.ts.map +1 -0
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/run-claim-storage-contract.d.ts +12 -0
- package/dist/testing/run-claim-storage-contract.d.ts.map +1 -0
- package/dist/testing/run-claim.d.ts +30 -0
- package/dist/testing/run-claim.d.ts.map +1 -0
- package/dist/testing/run-recovery-contract.d.ts +49 -0
- package/dist/testing/run-recovery-contract.d.ts.map +1 -0
- package/dist/testing/share-session-storage-contract.d.ts.map +1 -1
- package/dist/testing/stored-artifacts.d.ts +10 -0
- package/dist/testing/stored-artifacts.d.ts.map +1 -0
- package/dist/testing/sync-execution.d.ts.map +1 -1
- package/dist/testing/webhook-execution.d.ts +1 -1
- package/dist/testing/webhook-execution.d.ts.map +1 -1
- package/dist/testing/webhook-run-storage-contract.d.ts.map +1 -1
- package/dist/users/execution.d.ts +18 -1
- package/dist/users/execution.d.ts.map +1 -1
- package/dist/users/index.d.ts +1 -1
- package/dist/users/index.d.ts.map +1 -1
- package/dist/webhooks/delivery-lease.d.ts +13 -0
- package/dist/webhooks/delivery-lease.d.ts.map +1 -0
- package/dist/webhooks/internal.d.ts +2 -0
- package/dist/webhooks/internal.d.ts.map +1 -1
- package/dist/webhooks/internal.js +67 -35
- package/dist/webhooks/internal.js.map +5 -4
- package/dist/webhooks/run-admission.d.ts.map +1 -1
- package/dist/workers/index.d.ts +5 -1
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +193 -58
- package/dist/workers/index.js.map +8 -7
- package/dist/workers/job-ids.d.ts +17 -0
- package/dist/workers/job-ids.d.ts.map +1 -0
- package/dist/workers/lost-projection-runs.d.ts +26 -0
- package/dist/workers/lost-projection-runs.d.ts.map +1 -0
- package/dist/workers/lost-runs.d.ts +51 -0
- package/dist/workers/lost-runs.d.ts.map +1 -0
- package/dist/workers/queue-delivery.d.ts.map +1 -1
- package/dist/workers/queue-worker.d.ts +1 -2
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts +90 -0
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -0
- package/dist/workers/run-lease.d.ts +25 -0
- package/dist/workers/run-lease.d.ts.map +1 -0
- package/dist/workers/run-worker.d.ts +95 -0
- package/dist/workers/run-worker.d.ts.map +1 -0
- package/dist/workflows/index.js +63 -57
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +6 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/package.json +41 -3
- package/src/actions/request.ts +24 -7
- package/src/actions/run/executor.ts +9 -42
- package/src/actions/types/context.ts +8 -3
- package/src/agents/execution.ts +10 -2
- package/src/agents/fork.ts +12 -4
- package/src/agents/index.ts +7 -1
- package/src/agents/request.ts +42 -31
- package/src/agents/run-artifacts.ts +290 -46
- package/src/agents/run-session-http.ts +4 -0
- package/src/agents/run-session-serve.ts +10 -0
- package/src/agents/run-session.ts +8 -1
- package/src/agents/streams/protocol.ts +5 -10
- package/src/agents/validation.ts +3 -0
- package/src/artifacts/access.ts +71 -28
- package/src/artifacts/canvas-display.ts +160 -0
- package/src/artifacts/canvas.ts +26 -1
- package/src/artifacts/comment-text.ts +32 -0
- package/src/artifacts/comments.ts +275 -0
- package/src/artifacts/errors.ts +6 -1
- package/src/artifacts/events.ts +58 -0
- package/src/artifacts/execution.ts +496 -53
- package/src/artifacts/frames/assets.ts +20 -1
- package/src/artifacts/frames/grants.ts +31 -10
- package/src/artifacts/frames/index.ts +2 -0
- package/src/artifacts/frames/kit.ts +8 -5
- package/src/artifacts/frames/protocol.ts +149 -0
- package/src/artifacts/frames/runtime.ts +317 -29
- package/src/artifacts/holders.ts +120 -0
- package/src/artifacts/ids.ts +8 -0
- package/src/artifacts/index.ts +28 -2
- package/src/artifacts/limits.ts +28 -4
- package/src/artifacts/live/board.ts +759 -0
- package/src/artifacts/live/diff.ts +297 -0
- package/src/artifacts/live/document.ts +354 -0
- package/src/artifacts/live/files.ts +82 -0
- package/src/artifacts/live/index.ts +50 -0
- package/src/artifacts/live/presence.ts +144 -0
- package/src/artifacts/live/protocol.ts +134 -0
- package/src/artifacts/live/server.ts +16 -0
- package/src/artifacts/live/state.ts +115 -0
- package/src/artifacts/outline.ts +12 -0
- package/src/artifacts/publish/index.ts +26 -1
- package/src/artifacts/publish/merge.ts +271 -0
- package/src/artifacts/publish/previews.ts +485 -0
- package/src/artifacts/publish/publish.ts +92 -39
- package/src/artifacts/publish/query-answers.ts +85 -0
- package/src/artifacts/publish/references.ts +10 -4
- package/src/artifacts/publish/validate/canvas.ts +133 -1
- package/src/artifacts/theme.ts +9 -1
- package/src/auth/directory.ts +166 -0
- package/src/auth/member-events.ts +10 -3
- package/src/auth/runtime.ts +108 -8
- package/src/auth/strategy.ts +3 -1
- package/src/auth/types.ts +44 -0
- package/src/authorization/decision.ts +6 -5
- package/src/authorization/event-visibility.ts +4 -0
- package/src/broker/in-memory.ts +33 -6
- package/src/broker/types.ts +4 -0
- package/src/connectors/builders.ts +34 -2
- package/src/connectors/connections/access.ts +83 -0
- package/src/connectors/connections/contracts.ts +6 -1
- package/src/connectors/connections/execution.ts +2 -2
- package/src/connectors/connections/runs.ts +51 -2
- package/src/connectors/connections/service.ts +208 -41
- package/src/connectors/connections/views.ts +11 -4
- package/src/connectors/execution.ts +27 -3
- package/src/connectors/index.ts +2 -0
- package/src/connectors/service.ts +12 -0
- package/src/connectors/types.ts +37 -2
- package/src/datasets/execution.ts +74 -37
- package/src/datasets/ingest-flush-batch.ts +289 -0
- package/src/datasets/ingest-flush-job.ts +112 -0
- package/src/datasets/ingest-flush.ts +377 -0
- package/src/datasets/produced-version.ts +55 -0
- package/src/datasets/write.ts +65 -11
- package/src/deploy/services.ts +1 -1
- package/src/deploy/types.ts +2 -3
- package/src/deploy/validation.ts +1 -0
- package/src/error-reporting/capability.ts +66 -0
- package/src/error-reporting/internal.ts +12 -0
- package/src/error-reporting/reporter.ts +11 -35
- package/src/error-reporting/reports.ts +167 -0
- package/src/error-reporting/types.ts +99 -0
- package/src/errors/catalog.ts +6 -0
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +77 -28
- package/src/events/index.ts +3 -0
- package/src/events/scope.ts +2 -0
- package/src/events/types/artifacts.ts +40 -0
- package/src/events/types/index.ts +3 -0
- package/src/events/types/users.ts +5 -2
- package/src/execution/authorized-object-reader.ts +34 -0
- package/src/execution/object-reader-clearance.ts +31 -0
- package/src/execution/object-reader-security.ts +33 -13
- package/src/http/api-routes.ts +105 -4
- package/src/index.ts +22 -4
- package/src/lake-storage/errors.ts +21 -0
- package/src/lake-storage/index.ts +9 -1
- package/src/lake-storage/maintenance.ts +93 -0
- package/src/lake-storage/merge.ts +3 -1
- package/src/lake-storage/source-ordering.ts +28 -2
- package/src/lake-storage/types.ts +14 -0
- package/src/maintenance/heartbeat.ts +14 -0
- package/src/maintenance/index.ts +5 -3
- package/src/maintenance/lake-retention-status.ts +81 -0
- package/src/maintenance/lake-retention.ts +347 -0
- package/src/maintenance/loop.ts +365 -0
- package/src/maintenance/ontology-maintenance.ts +76 -229
- package/src/maintenance/passes/cron-pass.ts +217 -0
- package/src/maintenance/passes/directory-pass.ts +22 -0
- package/src/maintenance/passes/ingest-pass.ts +94 -0
- package/src/maintenance/passes/lake-change-feed.ts +112 -0
- package/src/maintenance/passes/lake-retention-pass.ts +71 -0
- package/src/maintenance/passes/ontology-pass.ts +19 -0
- package/src/maintenance/passes/projections-pass.ts +238 -0
- package/src/maintenance/passes/recovery-pass.ts +17 -0
- package/src/maintenance/passes/recovery-passes.ts +39 -0
- package/src/maintenance/passes/runs-pass.ts +12 -0
- package/src/maintenance/passes/triggers-pass.ts +332 -0
- package/src/maintenance/status.ts +75 -0
- package/src/maintenance/types.ts +27 -25
- package/src/materialization/model.ts +33 -21
- package/src/materializer/README.md +13 -2
- package/src/materializer/edits/artifact-refs.ts +140 -0
- package/src/materializer/edits/commit.ts +20 -7
- package/src/materializer/edits/operations.ts +23 -7
- package/src/materializer/edits/plan.ts +2 -0
- package/src/materializer/execution/work-records.ts +61 -0
- package/src/materializer/projections/replacement-plan.ts +2 -0
- package/src/materializer/shared/normalize.ts +14 -0
- package/src/materializer/telemetry/plan.ts +2 -0
- package/src/objects/artifact-refs.ts +34 -0
- package/src/objects/materializer-adapter.ts +8 -3
- package/src/objects/object/upsert-batch.ts +7 -0
- package/src/objects/object/upsert.ts +11 -2
- package/src/objects/query/ir.ts +2 -0
- package/src/objects/query/scalar-values.ts +5 -3
- package/src/objects/runtime-batch.ts +8 -1
- package/src/objects/vectors/README.md +4 -4
- package/src/ontology/artifact-ref.ts +83 -0
- package/src/ontology/docs-markdown.ts +17 -0
- package/src/ontology/index.ts +3 -1
- package/src/ontology/inference/index.ts +2 -0
- package/src/ontology/json-schema.ts +13 -0
- package/src/ontology/primitives.ts +14 -0
- package/src/ontology/reference-values.ts +62 -0
- package/src/ontology/refs.ts +7 -1
- package/src/ontology/registry.ts +26 -1
- package/src/ontology/types.ts +2 -0
- package/src/ontology/user-ref.ts +35 -45
- package/src/ontology/validation/normalize.ts +13 -0
- package/src/ontology/validation/properties.ts +9 -0
- package/src/ontology/validation/schema.ts +12 -0
- package/src/pending-tasks.ts +51 -0
- package/src/pipelines/run-dispatch.ts +120 -238
- package/src/predicates/types.ts +2 -1
- package/src/projections/builders.ts +28 -13
- package/src/projections/run-dispatch.ts +1 -1
- package/src/projections/types.ts +1 -1
- package/src/projections/validation.ts +22 -8
- package/src/queues/in-memory.ts +50 -3
- package/src/queues/index.ts +4 -0
- package/src/queues/types.ts +68 -1
- package/src/runtime/create.ts +4 -0
- package/src/runtime/host.ts +118 -13
- package/src/runtime/index.ts +0 -1
- package/src/runtime/internal.ts +13 -0
- package/src/runtime/ontology-mutations.ts +1 -1
- package/src/runtime/sixb.ts +14 -5
- package/src/scheduler/index.ts +0 -2
- package/src/shared/backoff.ts +34 -0
- package/src/shared/duration.ts +15 -0
- package/src/shared/params/artifact-refs.ts +42 -0
- package/src/shares/compiler.ts +1 -1
- package/src/shares/guest-name.ts +20 -0
- package/src/shares/internal.ts +1 -0
- package/src/shares/session-protocol.ts +63 -0
- package/src/storage/artifacts/errors.ts +10 -2
- package/src/storage/artifacts/in-memory.ts +579 -96
- package/src/storage/artifacts/index.ts +22 -1
- package/src/storage/artifacts/record.ts +255 -11
- package/src/storage/artifacts/types.ts +343 -40
- package/src/storage/auth/in-memory/auth-storage.ts +42 -5
- package/src/storage/auth/in-memory/identities.ts +16 -0
- package/src/storage/auth/in-memory/shared.ts +15 -0
- package/src/storage/auth/in-memory/users.ts +17 -16
- package/src/storage/auth/index.ts +3 -0
- package/src/storage/auth/types.ts +38 -0
- package/src/storage/connector-connections/in-memory.ts +4 -1
- package/src/storage/connector-connections/index.ts +1 -0
- package/src/storage/connector-connections/provider/runs.ts +3 -0
- package/src/storage/connector-connections/provider/shared.ts +30 -0
- package/src/storage/connector-connections/provider.ts +4 -0
- package/src/storage/connector-connections/types.ts +1 -0
- package/src/storage/dataset-ingest/codec.ts +90 -0
- package/src/storage/dataset-ingest/in-memory.ts +277 -0
- package/src/storage/dataset-ingest/index.ts +16 -0
- package/src/storage/dataset-ingest/provider.ts +592 -0
- package/src/storage/dataset-ingest/types.ts +191 -0
- package/src/storage/in-memory/index.ts +33 -0
- package/src/storage/index.ts +65 -5
- package/src/storage/internal.ts +20 -0
- package/src/storage/lake-retention-runs/in-memory.ts +22 -0
- package/src/storage/lake-retention-runs/index.ts +2 -0
- package/src/storage/lake-retention-runs/types.ts +19 -0
- package/src/storage/maintenance-heartbeats/in-memory.ts +24 -0
- package/src/storage/maintenance-heartbeats/index.ts +7 -0
- package/src/storage/maintenance-heartbeats/record.ts +50 -0
- package/src/storage/maintenance-heartbeats/types.ts +30 -0
- package/src/storage/objects/in-memory/query.ts +1 -0
- package/src/storage/objects/in-memory/storage.ts +81 -0
- package/src/storage/objects/read-scope.ts +1 -0
- package/src/storage/objects/types.ts +16 -1
- package/src/storage/ontology/in-memory/materializations.ts +8 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +4 -1
- package/src/storage/ontology/index.ts +2 -0
- package/src/storage/ontology/materializations.ts +18 -0
- package/src/storage/ontology/provider-work.ts +39 -0
- package/src/storage/pipeline-runs/in-memory.ts +97 -24
- package/src/storage/pipeline-runs/index.ts +0 -1
- package/src/storage/pipeline-runs/provider.ts +1 -1
- package/src/storage/pipeline-runs/transitions.ts +7 -4
- package/src/storage/pipeline-runs/types.ts +33 -7
- package/src/storage/projection-runs/errors.ts +10 -0
- package/src/storage/projection-runs/in-memory.ts +56 -1
- package/src/storage/projection-runs/index.ts +2 -1
- package/src/storage/projection-runs/lifecycle.ts +9 -1
- package/src/storage/projection-runs/types.ts +20 -1
- package/src/storage/run-claim.ts +224 -0
- package/src/storage/share-sessions/in-memory.ts +21 -0
- package/src/storage/share-sessions/index.ts +1 -0
- package/src/storage/share-sessions/provider.ts +1 -0
- package/src/storage/share-sessions/record.ts +28 -0
- package/src/storage/share-sessions/types.ts +19 -1
- package/src/storage/sync-runs/in-memory.ts +109 -29
- package/src/storage/sync-runs/index.ts +1 -1
- package/src/storage/sync-runs/transitions.ts +7 -4
- package/src/storage/sync-runs/types.ts +36 -3
- package/src/storage/types.ts +15 -5
- package/src/storage/webhook-runs/in-memory.ts +26 -2
- package/src/storage/webhook-runs/index.ts +3 -1
- package/src/storage/webhook-runs/types.ts +44 -3
- package/src/storage/workflow-runs/in-memory.ts +50 -36
- package/src/storage/workflow-runs/index.ts +0 -2
- package/src/storage/workflow-runs/types.ts +18 -30
- package/src/syncs/run-dispatch.ts +118 -239
- package/src/testing/ai-model-call-groups-contract.ts +2 -1
- package/src/testing/artifact-holders-contract.ts +392 -0
- package/src/testing/artifact-storage-contract.ts +1205 -151
- package/src/testing/auth-storage-contract.ts +228 -1
- package/src/testing/broker-contract.ts +56 -0
- package/src/testing/connector-connection-storage-contract.ts +94 -5
- package/src/testing/dataset-ingest-storage-contract.ts +480 -0
- package/src/testing/dataset-sequence-contract.ts +97 -12
- package/src/testing/execution.ts +23 -0
- package/src/testing/index.ts +31 -0
- package/src/testing/lake-retention-run-storage-contract.ts +75 -0
- package/src/testing/maintenance-heartbeat-storage-contract.ts +99 -0
- package/src/testing/object-query-contract.ts +93 -0
- package/src/testing/pipeline-execution.ts +3 -1
- package/src/testing/pipeline-run-read-contract.ts +123 -0
- package/src/testing/projection-run-storage-contract.ts +113 -0
- package/src/testing/queues-contract.ts +112 -0
- package/src/testing/run-claim-storage-contract.ts +736 -0
- package/src/testing/run-claim.ts +69 -0
- package/src/testing/run-recovery-contract.ts +176 -0
- package/src/testing/share-session-storage-contract.ts +43 -0
- package/src/testing/stored-artifacts.ts +43 -0
- package/src/testing/sync-execution.ts +3 -1
- package/src/testing/webhook-execution.ts +7 -2
- package/src/testing/webhook-run-storage-contract.ts +102 -5
- package/src/users/execution.ts +50 -2
- package/src/users/index.ts +1 -0
- package/src/webhooks/delivery-lease.ts +40 -0
- package/src/webhooks/internal.ts +2 -0
- package/src/webhooks/run-admission.ts +22 -9
- package/src/workers/README.md +169 -0
- package/src/workers/index.ts +9 -1
- package/src/workers/job-ids.ts +31 -0
- package/src/workers/lost-projection-runs.ts +114 -0
- package/src/workers/lost-runs.ts +397 -0
- package/src/workers/queue-delivery.ts +2 -14
- package/src/workers/queue-worker.ts +9 -17
- package/src/workers/queued-run-dispatch.ts +308 -0
- package/src/workers/run-lease.ts +46 -0
- package/src/workers/run-worker.ts +312 -0
- package/src/workers/worker.ts +4 -17
- package/src/workflows/request.ts +2 -0
- package/src/workflows/run-dispatch.ts +22 -4
- package/src/workflows/snapshot.ts +1 -0
- package/dist/chunk-2g0r46hy.js.map +0 -12
- package/dist/chunk-3fqxbn31.js +0 -107
- package/dist/chunk-3fqxbn31.js.map +0 -11
- package/dist/chunk-4s753g3k.js +0 -314
- package/dist/chunk-4s753g3k.js.map +0 -12
- package/dist/chunk-5kyvrtjh.js.map +0 -12
- package/dist/chunk-5taem5aw.js.map +0 -10
- package/dist/chunk-65abf64x.js +0 -13
- package/dist/chunk-65abf64x.js.map +0 -10
- package/dist/chunk-9x8dybsb.js.map +0 -10
- package/dist/chunk-az47zep4.js +0 -41
- package/dist/chunk-az47zep4.js.map +0 -10
- package/dist/chunk-c706qvyc.js +0 -299
- package/dist/chunk-c706qvyc.js.map +0 -11
- package/dist/chunk-djs3hw9p.js.map +0 -20
- package/dist/chunk-e5wf5vz0.js.map +0 -10
- package/dist/chunk-e6xgz4h4.js.map +0 -21
- package/dist/chunk-e7v3trpz.js.map +0 -10
- package/dist/chunk-eqgr6nsa.js.map +0 -72
- package/dist/chunk-fb3feg1e.js +0 -298
- package/dist/chunk-fb3feg1e.js.map +0 -12
- package/dist/chunk-hz5d43gn.js.map +0 -10
- package/dist/chunk-j8thxj7w.js.map +0 -22
- package/dist/chunk-jbw70d6t.js.map +0 -10
- package/dist/chunk-jftd33rc.js.map +0 -11
- package/dist/chunk-jspskey0.js.map +0 -10
- package/dist/chunk-kfee1h52.js.map +0 -13
- package/dist/chunk-kwfhd1g0.js +0 -144
- package/dist/chunk-kwfhd1g0.js.map +0 -13
- package/dist/chunk-nz7815t3.js.map +0 -14
- package/dist/chunk-s3we74h8.js.map +0 -12
- package/dist/chunk-scyq22td.js.map +0 -12
- package/dist/chunk-w1btn96n.js.map +0 -44
- package/dist/chunk-w976a4me.js.map +0 -10
- package/dist/chunk-wkq3kvzd.js.map +0 -10
- package/dist/chunk-wrjx1fqz.js +0 -587
- package/dist/chunk-wrjx1fqz.js.map +0 -18
- package/dist/chunk-yw9pyg66.js +0 -143
- package/dist/chunk-yw9pyg66.js.map +0 -11
- package/dist/chunk-z8fx5cgb.js.map +0 -11
- package/dist/scheduler/runtime.d.ts +0 -40
- package/dist/scheduler/runtime.d.ts.map +0 -1
- package/dist/workers/unstarted-run.d.ts +0 -10
- package/dist/workers/unstarted-run.d.ts.map +0 -1
- package/src/scheduler/runtime.ts +0 -214
- package/src/workers/unstarted-run.ts +0 -18
- /package/dist/{chunk-80gym75n.js.map → chunk-186k5yz3.js.map} +0 -0
- /package/dist/{chunk-ytzcxtpt.js.map → chunk-3ba89vm7.js.map} +0 -0
- /package/dist/{chunk-d04g36fw.js.map → chunk-5qqmndhm.js.map} +0 -0
- /package/dist/{chunk-5wtnmpze.js.map → chunk-7qe46788.js.map} +0 -0
- /package/dist/{chunk-31kcqmhf.js.map → chunk-855w9nvw.js.map} +0 -0
- /package/dist/{chunk-2ajw5rz0.js.map → chunk-8p7bze4c.js.map} +0 -0
- /package/dist/{chunk-9whfmsfk.js.map → chunk-8tqnsx3q.js.map} +0 -0
- /package/dist/{chunk-s038wa5v.js.map → chunk-b9qfh2ya.js.map} +0 -0
- /package/dist/{chunk-jjmggm9a.js.map → chunk-fe6r7yhg.js.map} +0 -0
- /package/dist/{chunk-165c9wm6.js.map → chunk-g2ph4873.js.map} +0 -0
- /package/dist/{chunk-ga63a3dz.js.map → chunk-k66rp2hr.js.map} +0 -0
- /package/dist/{chunk-4zm1k3xj.js.map → chunk-r2psmn42.js.map} +0 -0
- /package/dist/{chunk-r1cxq7vv.js.map → chunk-rtdrm592.js.map} +0 -0
- /package/dist/{chunk-4bm0caep.js.map → chunk-smnt672s.js.map} +0 -0
- /package/dist/{chunk-21q0j5f2.js.map → chunk-stmxh0hv.js.map} +0 -0
- /package/dist/{chunk-ff5xkv0p.js.map → chunk-tfzvjdms.js.map} +0 -0
- /package/dist/{chunk-6b61s40c.js.map → chunk-w3t94hm6.js.map} +0 -0
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
import { type DefaultTreeAdapterTypes, parse } from "parse5"
|
|
2
|
+
import type * as Y from "yjs"
|
|
3
|
+
import { mergeText } from "./diff"
|
|
4
|
+
|
|
5
|
+
// A canvas's board as an editor changes it in place: the static elements of its HTML, each at an
|
|
6
|
+
// address that names where it is in the source, and edits to them as changes to the source's
|
|
7
|
+
// text, applied to the board's `Y.Text` in the live document. What a script builds is in no
|
|
8
|
+
// source, so it has no address and cannot be edited. Browser-safe.
|
|
9
|
+
|
|
10
|
+
type Node = DefaultTreeAdapterTypes.Node
|
|
11
|
+
type Element = DefaultTreeAdapterTypes.Element
|
|
12
|
+
type TextNode = DefaultTreeAdapterTypes.TextNode
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What an editor can do with an element:
|
|
16
|
+
*
|
|
17
|
+
* - `text`: type into it. Its words, with the inline tags among them, are one block of text.
|
|
18
|
+
* - `image`: replace an `<img>`'s picture or its description.
|
|
19
|
+
* - `whole`: something drawn whole, such as an `<svg>` or an embed; only its style changes.
|
|
20
|
+
* - `box`: anything else, holding other elements; only its style changes.
|
|
21
|
+
*
|
|
22
|
+
* Every kind takes the style properties in {@link BOARD_STYLE_PROPERTIES}.
|
|
23
|
+
*/
|
|
24
|
+
export type BoardElementKind = "text" | "image" | "whole" | "box"
|
|
25
|
+
|
|
26
|
+
/** A static element of a board's source. */
|
|
27
|
+
export interface BoardElement {
|
|
28
|
+
/**
|
|
29
|
+
* Where it is in the source: each step its tag and its index among its siblings of that tag,
|
|
30
|
+
* from the body down, as `body>main:0>h1:0`. The same source gives the same addresses.
|
|
31
|
+
*/
|
|
32
|
+
readonly address: string
|
|
33
|
+
readonly tag: string
|
|
34
|
+
readonly kind: BoardElementKind
|
|
35
|
+
/** Where it is in the source, from its start tag to its end tag included. */
|
|
36
|
+
readonly start: number
|
|
37
|
+
readonly end: number
|
|
38
|
+
/** Its first words, or an image's description: what names it once it is gone. */
|
|
39
|
+
readonly label: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A change to a board's source: `remove` characters at `index`, then `insert` there. */
|
|
43
|
+
export interface BoardChange {
|
|
44
|
+
readonly index: number
|
|
45
|
+
readonly remove: number
|
|
46
|
+
readonly insert: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The changes an edit makes, in order through the source, none overlapping. */
|
|
50
|
+
export type BoardEdit = readonly BoardChange[]
|
|
51
|
+
|
|
52
|
+
/** The style properties an editor may set on an element. */
|
|
53
|
+
export const BOARD_STYLE_PROPERTIES = [
|
|
54
|
+
"color",
|
|
55
|
+
"background",
|
|
56
|
+
"background-color",
|
|
57
|
+
"font-size",
|
|
58
|
+
"font-weight",
|
|
59
|
+
"text-align",
|
|
60
|
+
"padding",
|
|
61
|
+
"gap",
|
|
62
|
+
"border-radius",
|
|
63
|
+
] as const
|
|
64
|
+
|
|
65
|
+
export type BoardStyleProperty = (typeof BOARD_STYLE_PROPERTIES)[number]
|
|
66
|
+
|
|
67
|
+
/** The attributes the frame sets on each addressed element of a board served for editing. */
|
|
68
|
+
export const BOARD_ADDRESS_ATTRIBUTE = "data-sixb-at"
|
|
69
|
+
export const BOARD_KIND_ATTRIBUTE = "data-sixb-edit"
|
|
70
|
+
/** A text element's words as the source has them, hashed: one a script rewrote is not editable. */
|
|
71
|
+
export const BOARD_TEXT_ATTRIBUTE = "data-sixb-text"
|
|
72
|
+
|
|
73
|
+
/** The longest label an element gets. */
|
|
74
|
+
const MAX_LABEL_LENGTH = 80
|
|
75
|
+
/** The longest value a style property takes. */
|
|
76
|
+
const MAX_STYLE_VALUE_LENGTH = 100
|
|
77
|
+
|
|
78
|
+
/** Elements that hold no part of what a board shows, or that scripts fill: never addressed. */
|
|
79
|
+
const UNADDRESSED = new Set([
|
|
80
|
+
"script",
|
|
81
|
+
"style",
|
|
82
|
+
"template",
|
|
83
|
+
"noscript",
|
|
84
|
+
"link",
|
|
85
|
+
"meta",
|
|
86
|
+
"base",
|
|
87
|
+
"title",
|
|
88
|
+
])
|
|
89
|
+
/** Elements drawn whole: their insides are not addressed. */
|
|
90
|
+
const WHOLE = new Set([
|
|
91
|
+
"svg",
|
|
92
|
+
"math",
|
|
93
|
+
"canvas",
|
|
94
|
+
"video",
|
|
95
|
+
"audio",
|
|
96
|
+
"iframe",
|
|
97
|
+
"object",
|
|
98
|
+
"embed",
|
|
99
|
+
"picture",
|
|
100
|
+
"select",
|
|
101
|
+
"textarea",
|
|
102
|
+
"input",
|
|
103
|
+
"sixb-embed",
|
|
104
|
+
])
|
|
105
|
+
/** Tags that format words inside a block of text. */
|
|
106
|
+
const INLINE = new Set([
|
|
107
|
+
"a",
|
|
108
|
+
"abbr",
|
|
109
|
+
"b",
|
|
110
|
+
"bdi",
|
|
111
|
+
"bdo",
|
|
112
|
+
"br",
|
|
113
|
+
"cite",
|
|
114
|
+
"code",
|
|
115
|
+
"data",
|
|
116
|
+
"dfn",
|
|
117
|
+
"em",
|
|
118
|
+
"i",
|
|
119
|
+
"kbd",
|
|
120
|
+
"mark",
|
|
121
|
+
"q",
|
|
122
|
+
"s",
|
|
123
|
+
"samp",
|
|
124
|
+
"small",
|
|
125
|
+
"span",
|
|
126
|
+
"strong",
|
|
127
|
+
"sub",
|
|
128
|
+
"sup",
|
|
129
|
+
"time",
|
|
130
|
+
"u",
|
|
131
|
+
"var",
|
|
132
|
+
"wbr",
|
|
133
|
+
])
|
|
134
|
+
/** Blocks meant for words: typed into even while empty, where an empty `<div>` may be a script's. */
|
|
135
|
+
const TEXT_BLOCKS = new Set([
|
|
136
|
+
"p",
|
|
137
|
+
"h1",
|
|
138
|
+
"h2",
|
|
139
|
+
"h3",
|
|
140
|
+
"h4",
|
|
141
|
+
"h5",
|
|
142
|
+
"h6",
|
|
143
|
+
"li",
|
|
144
|
+
"td",
|
|
145
|
+
"th",
|
|
146
|
+
"dt",
|
|
147
|
+
"dd",
|
|
148
|
+
"figcaption",
|
|
149
|
+
"blockquote",
|
|
150
|
+
"label",
|
|
151
|
+
"caption",
|
|
152
|
+
"button",
|
|
153
|
+
"legend",
|
|
154
|
+
"summary",
|
|
155
|
+
])
|
|
156
|
+
|
|
157
|
+
interface Located {
|
|
158
|
+
readonly element: BoardElement
|
|
159
|
+
readonly node: Element
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Every static element of a board's source, in source order. */
|
|
163
|
+
export function boardElements(source: string): BoardElement[] {
|
|
164
|
+
return located(source).map(({ element }) => element)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** The element at an address in a board's source; null when the source has none there. */
|
|
168
|
+
export function boardElement(source: string, address: string): BoardElement | null {
|
|
169
|
+
return located(source).find(({ element }) => element.address === address)?.element ?? null
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The source with each static element marked with its address, its kind, and a text element's
|
|
174
|
+
* words hashed, as the frame serves a board for editing. Nothing else in it changes.
|
|
175
|
+
*/
|
|
176
|
+
export function annotateBoard(source: string): string {
|
|
177
|
+
const changes: BoardChange[] = []
|
|
178
|
+
for (const { element, node } of located(source)) {
|
|
179
|
+
const index = startTagClose(source, node)
|
|
180
|
+
if (index === null) continue
|
|
181
|
+
|
|
182
|
+
const attributes = [
|
|
183
|
+
`${BOARD_ADDRESS_ATTRIBUTE}="${escapeAttribute(element.address)}"`,
|
|
184
|
+
`${BOARD_KIND_ATTRIBUTE}="${element.kind}"`,
|
|
185
|
+
...(element.kind === "text"
|
|
186
|
+
? [`${BOARD_TEXT_ATTRIBUTE}="${boardTextHash(textOf(node))}"`]
|
|
187
|
+
: []),
|
|
188
|
+
]
|
|
189
|
+
changes.push({ index, remove: 0, insert: ` ${attributes.join(" ")}` })
|
|
190
|
+
}
|
|
191
|
+
return applyBoardEdit(source, changes)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Sets a text element's words. Only what changed is replaced, inside the text it falls in, so
|
|
196
|
+
* the inline tags around the rest stay: typing in a bold word keeps it bold.
|
|
197
|
+
*/
|
|
198
|
+
export function setBoardText(source: string, address: string, text: string): BoardEdit {
|
|
199
|
+
const { node } = elementAt(source, address, ["text"])
|
|
200
|
+
const nodes = textNodes(node)
|
|
201
|
+
const before = nodes.map((each) => each.value).join("")
|
|
202
|
+
if (before === text) return []
|
|
203
|
+
|
|
204
|
+
// The span that changed, between what both start and end with.
|
|
205
|
+
let prefix = 0
|
|
206
|
+
const most = Math.min(before.length, text.length)
|
|
207
|
+
while (prefix < most && before[prefix] === text[prefix]) prefix += 1
|
|
208
|
+
let suffix = 0
|
|
209
|
+
while (
|
|
210
|
+
suffix < most - prefix &&
|
|
211
|
+
before[before.length - 1 - suffix] === text[text.length - 1 - suffix]
|
|
212
|
+
) {
|
|
213
|
+
suffix += 1
|
|
214
|
+
}
|
|
215
|
+
const from = prefix
|
|
216
|
+
const to = before.length - suffix
|
|
217
|
+
const insert = escapeText(text.slice(prefix, text.length - suffix))
|
|
218
|
+
|
|
219
|
+
// An element with no words yet takes them right after its start tag.
|
|
220
|
+
if (nodes.length === 0) {
|
|
221
|
+
const index = startTagEnd(node)
|
|
222
|
+
return index === null ? [] : [{ index, remove: 0, insert }]
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// The words go into the text where the change starts, after what it follows: typed at the end
|
|
226
|
+
// of a bold word, they are bold too.
|
|
227
|
+
const ends: number[] = []
|
|
228
|
+
let total = 0
|
|
229
|
+
for (const each of nodes) {
|
|
230
|
+
total += each.value.length
|
|
231
|
+
ends.push(total)
|
|
232
|
+
}
|
|
233
|
+
const into = Math.max(
|
|
234
|
+
0,
|
|
235
|
+
ends.findIndex((end) => from <= end)
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
const changes: BoardChange[] = []
|
|
239
|
+
for (const [position, each] of nodes.entries()) {
|
|
240
|
+
const end = ends[position] as number
|
|
241
|
+
const start = end - each.value.length
|
|
242
|
+
const removeFrom = Math.max(from, start)
|
|
243
|
+
const removeTo = Math.min(to, end)
|
|
244
|
+
const removes = removeFrom < removeTo
|
|
245
|
+
const takes = position === into
|
|
246
|
+
if (!takes && !removes) continue
|
|
247
|
+
|
|
248
|
+
const raw = rawOffsets(source, each)
|
|
249
|
+
if (raw) {
|
|
250
|
+
const index = raw[(takes ? from : removeFrom) - start] as number
|
|
251
|
+
const until = removes ? (raw[removeTo - start] as number) : index
|
|
252
|
+
changes.push({ index, remove: until - index, insert: takes ? insert : "" })
|
|
253
|
+
continue
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Text whose source does not map character by character onto its words, as an entity this
|
|
257
|
+
// does not know: written again whole, with the change.
|
|
258
|
+
const value =
|
|
259
|
+
each.value.slice(0, (takes ? from : removeFrom) - start) +
|
|
260
|
+
(takes ? text.slice(prefix, text.length - suffix) : "") +
|
|
261
|
+
each.value.slice(removes ? removeTo - start : (takes ? from : removeFrom) - start)
|
|
262
|
+
changes.push({ index: each.start, remove: each.end - each.start, insert: escapeText(value) })
|
|
263
|
+
}
|
|
264
|
+
return changes.filter((change) => change.remove > 0 || change.insert.length > 0)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Sets a text element's words from what someone typed into it, starting from `base`, its words as
|
|
269
|
+
* they saw them: what others changed in it since is kept, merged as the live document merges
|
|
270
|
+
* concurrent edits. Throws when the address names no text any more: the board changed, and the
|
|
271
|
+
* editor reloads it.
|
|
272
|
+
*/
|
|
273
|
+
export function mergeBoardText(
|
|
274
|
+
source: string,
|
|
275
|
+
address: string,
|
|
276
|
+
base: string,
|
|
277
|
+
typed: string
|
|
278
|
+
): BoardEdit {
|
|
279
|
+
const { node } = elementAt(source, address, ["text"])
|
|
280
|
+
const live = textOf(node)
|
|
281
|
+
return setBoardText(source, address, live === base ? typed : mergeText(base, typed, live))
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** Replaces an image's picture, its description, or both. */
|
|
285
|
+
export function setBoardImage(
|
|
286
|
+
source: string,
|
|
287
|
+
address: string,
|
|
288
|
+
image: { readonly src?: string; readonly alt?: string }
|
|
289
|
+
): BoardEdit {
|
|
290
|
+
const { node } = elementAt(source, address, ["image"])
|
|
291
|
+
if (image.src !== undefined) checkImageSource(image.src)
|
|
292
|
+
|
|
293
|
+
const changes: BoardChange[] = []
|
|
294
|
+
for (const name of ["src", "alt"] as const) {
|
|
295
|
+
const value = image[name]
|
|
296
|
+
if (value !== undefined) changes.push(attributeChange(source, node, name, value))
|
|
297
|
+
}
|
|
298
|
+
return changes.sort((left, right) => left.index - right.index)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Sets style properties in an element's inline style, or removes those set to `null`. The rest of
|
|
303
|
+
* its style stays as it is.
|
|
304
|
+
*/
|
|
305
|
+
export function setBoardStyle(
|
|
306
|
+
source: string,
|
|
307
|
+
address: string,
|
|
308
|
+
properties: Readonly<Partial<Record<BoardStyleProperty, string | null>>>
|
|
309
|
+
): BoardEdit {
|
|
310
|
+
const { node } = elementAt(source, address, ["text", "image", "whole", "box"])
|
|
311
|
+
|
|
312
|
+
const declarations = parseStyle(
|
|
313
|
+
node.attrs.find((attribute) => attribute.name === "style")?.value ?? ""
|
|
314
|
+
)
|
|
315
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
316
|
+
if (!(BOARD_STYLE_PROPERTIES as readonly string[]).includes(name)) {
|
|
317
|
+
throw new Error(
|
|
318
|
+
`[Sixb] '${name}' is not a style a board's element takes in place: ${BOARD_STYLE_PROPERTIES.join(", ")}.`
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
const index = declarations.findIndex(([property]) => property === name)
|
|
322
|
+
if (value === null || value === undefined) {
|
|
323
|
+
if (index >= 0) declarations.splice(index, 1)
|
|
324
|
+
continue
|
|
325
|
+
}
|
|
326
|
+
const checked = checkStyleValue(name, value)
|
|
327
|
+
if (index >= 0) declarations[index] = [name, checked]
|
|
328
|
+
else declarations.push([name, checked])
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const style = declarations.map(([property, value]) => `${property}: ${value}`).join("; ")
|
|
332
|
+
if (style === "" && !node.attrs.some((attribute) => attribute.name === "style")) return []
|
|
333
|
+
return [attributeChange(source, node, "style", style)]
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** A board's source once an edit is made to it. */
|
|
337
|
+
export function applyBoardEdit(source: string, edit: BoardEdit): string {
|
|
338
|
+
let result = ""
|
|
339
|
+
let at = 0
|
|
340
|
+
for (const change of edit) {
|
|
341
|
+
result += source.slice(at, change.index) + change.insert
|
|
342
|
+
at = change.index + change.remove
|
|
343
|
+
}
|
|
344
|
+
return result + source.slice(at)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Makes an edit to a board's text in the live document, in one transaction under `origin`. It
|
|
349
|
+
* must be made from what the text holds now.
|
|
350
|
+
*/
|
|
351
|
+
export function applyBoardEditToText(text: Y.Text, edit: BoardEdit, origin?: unknown): void {
|
|
352
|
+
if (edit.length === 0) return
|
|
353
|
+
const apply = () => {
|
|
354
|
+
// From the end, so each change's index still names where it was made.
|
|
355
|
+
for (const change of [...edit].reverse()) {
|
|
356
|
+
if (change.remove > 0) text.delete(change.index, change.remove)
|
|
357
|
+
if (change.insert.length > 0) text.insert(change.index, change.insert)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const doc = text.doc
|
|
361
|
+
if (doc) doc.transact(apply, origin)
|
|
362
|
+
else apply()
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** What a frame showing a board for editing changes in place, for one element. */
|
|
366
|
+
export interface BoardFramePatch {
|
|
367
|
+
readonly address: string
|
|
368
|
+
/** Every attribute it holds now, the frame's own included. */
|
|
369
|
+
readonly attributes?: Readonly<Record<string, string>>
|
|
370
|
+
/** What it holds now, for an element that holds no addressed element. */
|
|
371
|
+
readonly html?: string
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* What a frame showing `before` for editing changes so it shows `after`, element by element; null
|
|
376
|
+
* when the elements themselves changed, added, removed or moved, and the frame loads `after`
|
|
377
|
+
* instead.
|
|
378
|
+
*/
|
|
379
|
+
export function boardFramePatches(before: string, after: string): BoardFramePatch[] | null {
|
|
380
|
+
if (before === after) return []
|
|
381
|
+
const beforeSource = annotateBoard(before)
|
|
382
|
+
const afterSource = annotateBoard(after)
|
|
383
|
+
const old = located(beforeSource)
|
|
384
|
+
const next = located(afterSource)
|
|
385
|
+
const same =
|
|
386
|
+
old.length === next.length &&
|
|
387
|
+
old.every(
|
|
388
|
+
({ element }, index) =>
|
|
389
|
+
element.address === next[index]?.element.address &&
|
|
390
|
+
element.kind === next[index]?.element.kind
|
|
391
|
+
)
|
|
392
|
+
if (!same) return null
|
|
393
|
+
|
|
394
|
+
const patches: BoardFramePatch[] = []
|
|
395
|
+
for (const [index, { element, node }] of next.entries()) {
|
|
396
|
+
const previous = (old[index] as Located).node
|
|
397
|
+
const attributes = attributesOf(node)
|
|
398
|
+
const changed = JSON.stringify(attributesOf(previous)) !== JSON.stringify(attributes)
|
|
399
|
+
|
|
400
|
+
// What holds no addressed element is written whole. A box's own words, between its
|
|
401
|
+
// children, are not: the frame loads the board again when they change.
|
|
402
|
+
let html: string | undefined
|
|
403
|
+
if (element.kind === "box") {
|
|
404
|
+
if (ownContent(beforeSource, previous) !== ownContent(afterSource, node)) return null
|
|
405
|
+
} else {
|
|
406
|
+
const inner = innerOf(afterSource, node)
|
|
407
|
+
if (inner !== null && innerOf(beforeSource, previous) !== inner) html = inner
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (changed || html !== undefined) {
|
|
411
|
+
patches.push({
|
|
412
|
+
address: element.address,
|
|
413
|
+
...(changed ? { attributes } : {}),
|
|
414
|
+
...(html === undefined ? {} : { html }),
|
|
415
|
+
})
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return patches
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* The hash of a text element's words that marks it in a board served for editing: FNV-1a over
|
|
423
|
+
* its UTF-16 code units, in hex. The frame's runtime hashes what the element holds the same way.
|
|
424
|
+
*/
|
|
425
|
+
export function boardTextHash(text: string): string {
|
|
426
|
+
let hash = 0x811c9dc5
|
|
427
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
428
|
+
hash ^= text.charCodeAt(index)
|
|
429
|
+
hash = Math.imul(hash, 0x01000193) >>> 0
|
|
430
|
+
}
|
|
431
|
+
return hash.toString(16)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** The address an image's picture is given from a board: its file's path, from the board's folder. */
|
|
435
|
+
export function boardFilePath(board: string, file: string): string {
|
|
436
|
+
const from = board.split("/").slice(0, -1)
|
|
437
|
+
const to = file.split("/")
|
|
438
|
+
let common = 0
|
|
439
|
+
while (common < from.length && common < to.length - 1 && from[common] === to[common]) common += 1
|
|
440
|
+
const path = [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/")
|
|
441
|
+
return path.split("/").map(encodeURIComponent).join("/")
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// ── The source as a tree ────────────────────────────────────────────────
|
|
445
|
+
|
|
446
|
+
function located(source: string): Located[] {
|
|
447
|
+
const document = parse(source, { sourceCodeLocationInfo: true })
|
|
448
|
+
const html = document.childNodes.find(isElement)
|
|
449
|
+
const body = html?.childNodes.find(
|
|
450
|
+
(child): child is Element => isElement(child) && child.tagName === "body"
|
|
451
|
+
)
|
|
452
|
+
if (!body) return []
|
|
453
|
+
|
|
454
|
+
const found: Located[] = []
|
|
455
|
+
const visit = (node: Element, address: string) => {
|
|
456
|
+
if (node.sourceCodeLocation?.startTag) {
|
|
457
|
+
const kind = kindOf(node)
|
|
458
|
+
found.push({
|
|
459
|
+
node,
|
|
460
|
+
element: {
|
|
461
|
+
address,
|
|
462
|
+
tag: node.tagName,
|
|
463
|
+
kind,
|
|
464
|
+
start: node.sourceCodeLocation.startOffset,
|
|
465
|
+
end: node.sourceCodeLocation.endOffset,
|
|
466
|
+
label: labelOf(node, kind),
|
|
467
|
+
},
|
|
468
|
+
})
|
|
469
|
+
if (kind !== "box") return
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const seen = new Map<string, number>()
|
|
473
|
+
for (const child of node.childNodes) {
|
|
474
|
+
if (!isElement(child) || UNADDRESSED.has(child.tagName)) continue
|
|
475
|
+
const index = seen.get(child.tagName) ?? 0
|
|
476
|
+
seen.set(child.tagName, index + 1)
|
|
477
|
+
visit(child, `${address}>${child.tagName}:${index}`)
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
visit(body, "body")
|
|
481
|
+
return found
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function kindOf(node: Element): BoardElementKind {
|
|
485
|
+
if (node.tagName === "img") return "image"
|
|
486
|
+
if (WHOLE.has(node.tagName) || node.namespaceURI !== "http://www.w3.org/1999/xhtml") {
|
|
487
|
+
return "whole"
|
|
488
|
+
}
|
|
489
|
+
if (!holdsOnlyWords(node)) return "box"
|
|
490
|
+
return textOf(node).trim() !== "" || TEXT_BLOCKS.has(node.tagName) || INLINE.has(node.tagName)
|
|
491
|
+
? "text"
|
|
492
|
+
: "box"
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** Whether an element holds only words and the inline tags that format them. */
|
|
496
|
+
function holdsOnlyWords(node: Element): boolean {
|
|
497
|
+
return node.childNodes.every((child) => {
|
|
498
|
+
if (isText(child)) return true
|
|
499
|
+
if (!isElement(child)) return child.nodeName === "#comment"
|
|
500
|
+
return INLINE.has(child.tagName) && holdsOnlyWords(child)
|
|
501
|
+
})
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function labelOf(node: Element, kind: BoardElementKind): string {
|
|
505
|
+
const words =
|
|
506
|
+
kind === "image"
|
|
507
|
+
? (node.attrs.find((attribute) => attribute.name === "alt")?.value ?? "")
|
|
508
|
+
: kind === "text"
|
|
509
|
+
? spokenWords(node)
|
|
510
|
+
: textNodes(node)
|
|
511
|
+
.map((each) => each.value)
|
|
512
|
+
.join(" ")
|
|
513
|
+
const label = words.replace(/\s+/g, " ").trim()
|
|
514
|
+
return label.length > MAX_LABEL_LENGTH ? `${label.slice(0, MAX_LABEL_LENGTH - 1)}…` : label
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** A text's words as they read: a line break between two words parts them. */
|
|
518
|
+
function spokenWords(node: Element): string {
|
|
519
|
+
let words = ""
|
|
520
|
+
const visit = (each: Node) => {
|
|
521
|
+
if (isText(each)) {
|
|
522
|
+
words += each.value
|
|
523
|
+
} else if (isElement(each)) {
|
|
524
|
+
if (each.tagName === "br") words += " "
|
|
525
|
+
else if (!UNADDRESSED.has(each.tagName)) for (const child of each.childNodes) visit(child)
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
for (const child of node.childNodes) visit(child)
|
|
529
|
+
return words
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function textOf(node: Element): string {
|
|
533
|
+
return textNodes(node)
|
|
534
|
+
.map((each) => each.value)
|
|
535
|
+
.join("")
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
interface SourceText {
|
|
539
|
+
readonly value: string
|
|
540
|
+
readonly start: number
|
|
541
|
+
readonly end: number
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** The texts inside an element, in order, where the source has them. */
|
|
545
|
+
function textNodes(node: Element): SourceText[] {
|
|
546
|
+
const texts: SourceText[] = []
|
|
547
|
+
const visit = (each: Node) => {
|
|
548
|
+
if (isText(each)) {
|
|
549
|
+
const location = each.sourceCodeLocation
|
|
550
|
+
if (location)
|
|
551
|
+
texts.push({ value: each.value, start: location.startOffset, end: location.endOffset })
|
|
552
|
+
return
|
|
553
|
+
}
|
|
554
|
+
if (isElement(each) && !UNADDRESSED.has(each.tagName)) {
|
|
555
|
+
for (const child of each.childNodes) visit(child)
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
for (const child of node.childNodes) visit(child)
|
|
559
|
+
return texts
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Where in the source each character of a text starts, and one past its end: null when the
|
|
564
|
+
* source's characters do not map one by one onto the text's, as an entity the decoding here does
|
|
565
|
+
* not know would.
|
|
566
|
+
*/
|
|
567
|
+
function rawOffsets(source: string, text: SourceText): number[] | null {
|
|
568
|
+
const raw = source.slice(text.start, text.end)
|
|
569
|
+
const offsets: number[] = []
|
|
570
|
+
let decoded = ""
|
|
571
|
+
let at = 0
|
|
572
|
+
while (at < raw.length) {
|
|
573
|
+
const entity = raw[at] === "&" ? /^&(#x[\da-f]+|#\d+|[a-z]+);/i.exec(raw.slice(at)) : null
|
|
574
|
+
// The parser reads a line break as one `\n`, whether it was written `\r\n` or `\r`.
|
|
575
|
+
const crlf = raw[at] === "\r" && raw[at + 1] === "\n"
|
|
576
|
+
const value = entity ? decodeEntity(entity[1] as string) : raw[at] === "\r" ? "\n" : raw[at]
|
|
577
|
+
const length = entity ? entity[0].length : crlf ? 2 : 1
|
|
578
|
+
if (value === null || value === undefined) return null
|
|
579
|
+
|
|
580
|
+
for (let unit = 0; unit < value.length; unit += 1) offsets.push(text.start + at)
|
|
581
|
+
decoded += value
|
|
582
|
+
at += length
|
|
583
|
+
}
|
|
584
|
+
offsets.push(text.end)
|
|
585
|
+
return decoded === text.value ? offsets : null
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const NAMED_ENTITIES: Readonly<Record<string, string>> = {
|
|
589
|
+
amp: "&",
|
|
590
|
+
lt: "<",
|
|
591
|
+
gt: ">",
|
|
592
|
+
quot: '"',
|
|
593
|
+
apos: "'",
|
|
594
|
+
nbsp: "\u00a0",
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function decodeEntity(entity: string): string | null {
|
|
598
|
+
if (entity[0] !== "#") return NAMED_ENTITIES[entity.toLowerCase()] ?? null
|
|
599
|
+
const codePoint =
|
|
600
|
+
entity[1]?.toLowerCase() === "x"
|
|
601
|
+
? Number.parseInt(entity.slice(2), 16)
|
|
602
|
+
: Number(entity.slice(1))
|
|
603
|
+
// A single character only: one that takes two code units would split between them.
|
|
604
|
+
return Number.isInteger(codePoint) && codePoint > 0 && codePoint < 0x10000
|
|
605
|
+
? String.fromCharCode(codePoint)
|
|
606
|
+
: null
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/** Just past an element's start tag. */
|
|
610
|
+
function startTagEnd(node: Element): number | null {
|
|
611
|
+
return node.sourceCodeLocation?.startTag?.endOffset ?? null
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/** Where an attribute goes in an element's start tag: before its `>`, or its `/>`. */
|
|
615
|
+
function startTagClose(source: string, node: Element): number | null {
|
|
616
|
+
const end = startTagEnd(node)
|
|
617
|
+
if (end === null) return null
|
|
618
|
+
|
|
619
|
+
// A `/` before the `>` closes the tag unless it ends an unquoted value, as `src=/a/b/` does.
|
|
620
|
+
const attributes = Object.values(node.sourceCodeLocation?.attrs ?? {})
|
|
621
|
+
const lastValueEnd = Math.max(0, ...attributes.map((location) => location.endOffset))
|
|
622
|
+
let at = end - 1
|
|
623
|
+
if (source[at - 1] === "/" && lastValueEnd < at) at -= 1
|
|
624
|
+
while (at > lastValueEnd && /\s/.test(source[at - 1] ?? "")) at -= 1
|
|
625
|
+
return at
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function attributeChange(source: string, node: Element, name: string, value: string): BoardChange {
|
|
629
|
+
const written = `${name}="${escapeAttribute(value)}"`
|
|
630
|
+
const location = node.sourceCodeLocation?.attrs?.[name]
|
|
631
|
+
if (location) {
|
|
632
|
+
return {
|
|
633
|
+
index: location.startOffset,
|
|
634
|
+
remove: location.endOffset - location.startOffset,
|
|
635
|
+
insert: written,
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const index = startTagClose(source, node)
|
|
639
|
+
if (index === null) throw new Error("[Sixb] This element has no start tag in the board's source.")
|
|
640
|
+
return { index, remove: 0, insert: ` ${written}` }
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function attributesOf(node: Element): Record<string, string> {
|
|
644
|
+
return Object.fromEntries(node.attrs.map((attribute) => [attribute.name, attribute.value]))
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/** What an element holds in the source, between its tags; null for one with no end tag. */
|
|
648
|
+
function innerOf(source: string, node: Element): string | null {
|
|
649
|
+
const location = node.sourceCodeLocation
|
|
650
|
+
const start = location?.startTag?.endOffset
|
|
651
|
+
const end = location?.endTag?.startOffset
|
|
652
|
+
if (start === undefined) return null
|
|
653
|
+
return source.slice(start, end ?? location?.endOffset ?? start)
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** What a box holds in the source besides its addressed children. */
|
|
657
|
+
function ownContent(source: string, node: Element): string | null {
|
|
658
|
+
const inner = innerOf(source, node)
|
|
659
|
+
const start = node.sourceCodeLocation?.startTag?.endOffset
|
|
660
|
+
if (inner === null || start === undefined) return inner
|
|
661
|
+
|
|
662
|
+
let own = ""
|
|
663
|
+
let at = start
|
|
664
|
+
for (const child of node.childNodes) {
|
|
665
|
+
if (!isElement(child) || UNADDRESSED.has(child.tagName) || !child.sourceCodeLocation) continue
|
|
666
|
+
own += source.slice(at, child.sourceCodeLocation.startOffset)
|
|
667
|
+
at = child.sourceCodeLocation.endOffset
|
|
668
|
+
}
|
|
669
|
+
return own + source.slice(at, start + inner.length)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function elementAt(source: string, address: string, kinds: readonly BoardElementKind[]): Located {
|
|
673
|
+
const found = located(source).find(({ element }) => element.address === address)
|
|
674
|
+
if (!found) {
|
|
675
|
+
throw new Error(
|
|
676
|
+
`[Sixb] The board holds no element at '${address}': it changed, or a script builds it.`
|
|
677
|
+
)
|
|
678
|
+
}
|
|
679
|
+
if (!kinds.includes(found.element.kind)) {
|
|
680
|
+
throw new Error(
|
|
681
|
+
`[Sixb] The element at '${address}' is ${articled(found.element.kind)}: it takes no such edit.`
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
return found
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
function articled(kind: BoardElementKind): string {
|
|
688
|
+
return { text: "text", image: "an image", whole: "drawn whole", box: "a box of elements" }[kind]
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/** Declarations of an inline style, in order. */
|
|
692
|
+
function parseStyle(style: string): [string, string][] {
|
|
693
|
+
const declarations: [string, string][] = []
|
|
694
|
+
let depth = 0
|
|
695
|
+
let quote: string | null = null
|
|
696
|
+
let current = ""
|
|
697
|
+
const flush = () => {
|
|
698
|
+
const colon = current.indexOf(":")
|
|
699
|
+
if (colon > 0) {
|
|
700
|
+
const property = current.slice(0, colon).trim().toLowerCase()
|
|
701
|
+
const value = current.slice(colon + 1).trim()
|
|
702
|
+
if (property && value) declarations.push([property, value])
|
|
703
|
+
}
|
|
704
|
+
current = ""
|
|
705
|
+
}
|
|
706
|
+
for (const char of style) {
|
|
707
|
+
if (quote) {
|
|
708
|
+
if (char === quote) quote = null
|
|
709
|
+
} else if (char === '"' || char === "'") quote = char
|
|
710
|
+
else if (char === "(") depth += 1
|
|
711
|
+
else if (char === ")") depth = Math.max(0, depth - 1)
|
|
712
|
+
else if (char === ";" && depth === 0) {
|
|
713
|
+
flush()
|
|
714
|
+
continue
|
|
715
|
+
}
|
|
716
|
+
current += char
|
|
717
|
+
}
|
|
718
|
+
flush()
|
|
719
|
+
return declarations
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function checkStyleValue(property: string, value: string): string {
|
|
723
|
+
const trimmed = value.trim()
|
|
724
|
+
if (
|
|
725
|
+
trimmed === "" ||
|
|
726
|
+
trimmed.length > MAX_STYLE_VALUE_LENGTH ||
|
|
727
|
+
/[;{}<>"'\\]|\/\*|url\s*\(|expression\s*\(|@/i.test(trimmed)
|
|
728
|
+
) {
|
|
729
|
+
throw new Error(`[Sixb] '${value}' is not a value '${property}' takes in place.`)
|
|
730
|
+
}
|
|
731
|
+
return trimmed
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function checkImageSource(src: string): void {
|
|
735
|
+
const trimmed = src.trim()
|
|
736
|
+
if (
|
|
737
|
+
trimmed === "" ||
|
|
738
|
+
trimmed.length > 2048 ||
|
|
739
|
+
/^(javascript|vbscript|data:text)/i.test(trimmed.replace(/[\s\u0000-\u001f]/g, ""))
|
|
740
|
+
) {
|
|
741
|
+
throw new Error(`[Sixb] '${src}' is not a picture a board's image shows.`)
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
function escapeText(text: string): string {
|
|
746
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function escapeAttribute(value: string): string {
|
|
750
|
+
return value.replace(/&/g, "&").replace(/"/g, """)
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
function isElement(node: Node): node is Element {
|
|
754
|
+
return "tagName" in node
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
function isText(node: Node): node is TextNode {
|
|
758
|
+
return node.nodeName === "#text"
|
|
759
|
+
}
|