trellis 3.1.35 → 3.2.0
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/CHANGELOG.md +16 -5
- package/README.md +19 -2
- package/bin/trellis.mjs +2 -75
- package/dist/better-sqlite-backend-2P4F6AOJ.js +209 -0
- package/dist/{better-sqlite-backend-ahx5p0br.js → better-sqlite-backend-PII64VE6.js} +37 -25
- package/dist/better-sqlite-backend-VUBVQ7SN.js +209 -0
- package/dist/better-sqlite-backend-Y3AQN65E.js +159 -0
- package/dist/better-sqlite-backend-Y3M7DXOX.js +159 -0
- package/dist/boot-middleware-FJDGVUM4.js +9 -0
- package/dist/boot-middleware-MHLHFCUC.js +9 -0
- package/dist/boot-middleware-MLJUTLUM.js +9 -0
- package/dist/boot-middleware-ZZPDZNYR.js +9 -0
- package/dist/{index-wncptktd.js → chunk-276LKLZR.js} +126 -59
- package/dist/chunk-2BRTCEHB.js +143 -0
- package/dist/chunk-2CX5UCRV.js +111 -0
- package/dist/chunk-2ESYSVXG.js +48 -0
- package/dist/{index-yp88he8n.js → chunk-2I5JU73Y.js} +88 -64
- package/dist/{index-w5wccer3.js → chunk-2UNSRRNB.js} +10 -5
- package/dist/{index-4wxa8xz4.js → chunk-335UEHQR.js} +158 -22
- package/dist/chunk-36VSSTL7.js +357 -0
- package/dist/chunk-3ETIIPPB.js +1077 -0
- package/dist/chunk-3GDRZTAW.js +45 -0
- package/dist/chunk-44FFQKQX.js +142 -0
- package/dist/chunk-4CF2L46N.js +29 -0
- package/dist/chunk-4HYPLFJD.js +150 -0
- package/dist/chunk-4XIVMVHC.js +361 -0
- package/dist/chunk-5CINODKT.js +41 -0
- package/dist/chunk-5ESGWJ5L.js +45 -0
- package/dist/chunk-5FGLQGMF.js +1676 -0
- package/dist/chunk-5IQZFITY.js +357 -0
- package/dist/{index-wt8rz4gn.js → chunk-5JWFAQDW.js} +41 -23
- package/dist/{index-7pjz3tsy.js → chunk-62UHTVU3.js} +50 -16
- package/dist/{index-h32txmxe.js → chunk-66UJQT2I.js} +6 -13
- package/dist/chunk-6CTA6MCE.js +340 -0
- package/dist/{index-4cdr7x2x.js → chunk-6RNNVOAS.js} +178 -109
- package/dist/chunk-6X23PZ6H.js +969 -0
- package/dist/chunk-7C7LL6MB.js +315 -0
- package/dist/chunk-7F4HM3JG.js +394 -0
- package/dist/chunk-7KJ7T4D3.js +910 -0
- package/dist/chunk-7QQQNUB5.js +92 -0
- package/dist/{index-53f3b8p8.js → chunk-7QWJBS72.js} +210 -165
- package/dist/chunk-7R36OZK3.js +957 -0
- package/dist/chunk-7UPKCOHE.js +946 -0
- package/dist/chunk-7WQGTFVJ.js +7434 -0
- package/dist/chunk-A3BONW34.js +35 -0
- package/dist/chunk-AHMDVHBL.js +141 -0
- package/dist/chunk-AW6A4OZY.js +171 -0
- package/dist/chunk-B3ZIFA2O.js +2240 -0
- package/dist/chunk-BJ5EKCJ5.js +458 -0
- package/dist/chunk-BJ7EZ7FP.js +145 -0
- package/dist/chunk-BQBUVMRN.js +171 -0
- package/dist/chunk-BRGYDO7D.js +223 -0
- package/dist/chunk-BXSTJVE3.js +67 -0
- package/dist/chunk-C5KPSEDN.js +359 -0
- package/dist/chunk-CCTNYTUC.js +940 -0
- package/dist/chunk-CYQ2OVD2.js +35 -0
- package/dist/chunk-DDAK7YOE.js +299 -0
- package/dist/chunk-DRILKBY6.js +965 -0
- package/dist/chunk-DXE24HNN.js +45 -0
- package/dist/chunk-E7ICUNW7.js +945 -0
- package/dist/chunk-EAL2PUOE.js +10022 -0
- package/dist/chunk-ELT7MLZB.js +109 -0
- package/dist/chunk-EO3J7GRP.js +0 -0
- package/dist/chunk-EWEIRF6G.js +171 -0
- package/dist/chunk-F5VDGQJC.js +120 -0
- package/dist/chunk-FCPL3IEQ.js +98 -0
- package/dist/{index-nq520y6k.js → chunk-FDPKYSV7.js} +43 -31
- package/dist/chunk-FES3TC24.js +171 -0
- package/dist/chunk-FF36CQHZ.js +61 -0
- package/dist/chunk-FKQO5A3H.js +35 -0
- package/dist/chunk-FOWKR5TW.js +129 -0
- package/dist/chunk-FZVCXDYW.js +150 -0
- package/dist/chunk-G3XIHPSQ.js +361 -0
- package/dist/chunk-GD5QJXSS.js +98 -0
- package/dist/chunk-GFZCJ4EH.js +108 -0
- package/dist/chunk-GKJLYLVU.js +359 -0
- package/dist/chunk-GLM4HGN4.js +55 -0
- package/dist/chunk-GNXHXNVQ.js +113 -0
- package/dist/chunk-GSR6ILTM.js +277 -0
- package/dist/chunk-GWRIMRSX.js +45 -0
- package/dist/chunk-H72UW2HJ.js +45 -0
- package/dist/chunk-HGI74PXB.js +7417 -0
- package/dist/chunk-HGRA37LO.js +145 -0
- package/dist/chunk-HO4TURXW.js +1078 -0
- package/dist/chunk-HXSRQO3L.js +145 -0
- package/dist/chunk-IG2X2BVO.js +373 -0
- package/dist/chunk-IIJVDD54.js +373 -0
- package/dist/chunk-IUWVEEOX.js +145 -0
- package/dist/chunk-IX4BBOIT.js +394 -0
- package/dist/{index-yhwjgfvj.js → chunk-IXU4RMQM.js} +67 -60
- package/dist/chunk-J3WYZO3Q.js +211 -0
- package/dist/{index-vkpkfwhq.js → chunk-J6OUIION.js} +234 -194
- package/dist/{index-xzym9w0m.js → chunk-JA7AIHRK.js} +12 -7
- package/dist/chunk-JUEMDWLU.js +233 -0
- package/dist/chunk-K46RNFDE.js +171 -0
- package/dist/chunk-KAGU2XMY.js +359 -0
- package/dist/chunk-KCVYJNVX.js +394 -0
- package/dist/chunk-KFQGP6VL.js +33 -0
- package/dist/chunk-KKDRMIV6.js +419 -0
- package/dist/chunk-KQ4A2D2P.js +910 -0
- package/dist/chunk-KSU2GW22.js +958 -0
- package/dist/chunk-KYLIQ3YI.js +399 -0
- package/dist/chunk-KZYJJIRN.js +946 -0
- package/dist/chunk-LFOX744K.js +96 -0
- package/dist/{index-rv1p47gp.js → chunk-LHOVJEWR.js} +2756 -2307
- package/dist/{index-h9e2efx4.js → chunk-LNUIGRDZ.js} +71 -55
- package/dist/chunk-LOPXTPF3.js +120 -0
- package/dist/chunk-LZR3VIFU.js +907 -0
- package/dist/chunk-MBNBTJCR.js +394 -0
- package/dist/chunk-MCKGQKYU.js +15 -0
- package/dist/{index-skhn0agf.js → chunk-MLC5BUYO.js} +19 -20
- package/dist/chunk-MPXUVGT3.js +104 -0
- package/dist/chunk-MU6EOS6F.js +0 -0
- package/dist/chunk-MWRQ2TXT.js +357 -0
- package/dist/{index-nzb3am4f.js → chunk-NO73OK2I.js} +43 -21
- package/dist/chunk-NPE2YJHK.js +394 -0
- package/dist/{index-xhcp6xrn.js → chunk-NSDXU6QX.js} +654 -500
- package/dist/chunk-NXIRDSZ6.js +145 -0
- package/dist/chunk-NZWFNHCS.js +407 -0
- package/dist/chunk-O2AV5WMN.js +48 -0
- package/dist/{index-h7zxhhhh.js → chunk-OB4CMMX6.js} +46 -38
- package/dist/chunk-OBKU74FU.js +7411 -0
- package/dist/chunk-OQNDWRDE.js +145 -0
- package/dist/chunk-OVWAJMB6.js +394 -0
- package/dist/chunk-PDHLBTTD.js +45 -0
- package/dist/chunk-PEQNRKLG.js +210 -0
- package/dist/chunk-QERIS7QY.js +7403 -0
- package/dist/chunk-QHA2DM3C.js +373 -0
- package/dist/chunk-QLM4HSYC.js +45 -0
- package/dist/chunk-RSWUFTO2.js +857 -0
- package/dist/chunk-S2OT3TQJ.js +283 -0
- package/dist/chunk-S5PHSN5K.js +907 -0
- package/dist/chunk-SIAA4J6H.js +21 -0
- package/dist/chunk-SPSPV5BC.js +390 -0
- package/dist/chunk-SQBNLUIA.js +171 -0
- package/dist/chunk-STLN6A6B.js +355 -0
- package/dist/chunk-TCKXSOBP.js +123 -0
- package/dist/chunk-U7HV7GU2.js +17 -0
- package/dist/chunk-UBGUDMUV.js +59 -0
- package/dist/chunk-UGZHOGRA.js +39 -0
- package/dist/chunk-UICF66FS.js +359 -0
- package/dist/chunk-UK3EQREE.js +1078 -0
- package/dist/chunk-UPKPURVY.js +394 -0
- package/dist/chunk-URC74VCN.js +959 -0
- package/dist/chunk-USEINYUL.js +12 -0
- package/dist/{index-bmyt7k8n.js → chunk-UZRUP7QW.js} +12 -4
- package/dist/chunk-V3G7Q3QQ.js +102 -0
- package/dist/chunk-VDAKEOML.js +857 -0
- package/dist/chunk-VUJ6SA55.js +303 -0
- package/dist/chunk-VUJQLIML.js +141 -0
- package/dist/chunk-VWKLKLYB.js +267 -0
- package/dist/chunk-VYC3RZMK.js +277 -0
- package/dist/chunk-WMERMSWI.js +154 -0
- package/dist/chunk-WMR777PO.js +2213 -0
- package/dist/{index-n9f2qyh5.js → chunk-X46IECAC.js} +55 -33
- package/dist/chunk-X5FLTRUB.js +517 -0
- package/dist/chunk-X762XWVC.js +419 -0
- package/dist/chunk-XEN3OEYY.js +2234 -0
- package/dist/chunk-XMQ7G77X.js +260 -0
- package/dist/chunk-XZQ66K7A.js +124 -0
- package/dist/{index-w7ng765c.js → chunk-YCM7ZYEZ.js} +102 -49
- package/dist/chunk-YY3GF7DH.js +7411 -0
- package/dist/chunk-ZE5R3H4C.js +907 -0
- package/dist/chunk-ZHVI7BQN.js +1077 -0
- package/dist/chunk-ZMN5LUB7.js +7411 -0
- package/dist/chunk-ZUV4MD5U.js +94 -0
- package/dist/cli/errors.d.ts +6 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/examples.d.ts +23 -0
- package/dist/cli/examples.d.ts.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2338 -6190
- package/dist/client/index.d.ts +6 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +41 -21
- package/dist/client/live.d.ts +67 -0
- package/dist/client/live.d.ts.map +1 -0
- package/dist/client/reactive.d.ts +31 -0
- package/dist/client/reactive.d.ts.map +1 -0
- package/dist/client/sdk.d.ts +26 -2
- package/dist/client/sdk.d.ts.map +1 -1
- package/dist/client/sdk.js +9 -0
- package/dist/client/vcs-client.d.ts +129 -0
- package/dist/client/vcs-client.d.ts.map +1 -0
- package/dist/cms/index.js +171 -163
- package/dist/{config-8hczw0rs.js → config-KMY6RRK3.js} +8 -9
- package/dist/config-PFTP67TR.js +19 -0
- package/dist/config-VDMK2DUJ.js +19 -0
- package/dist/core/computation/index.d.ts +5 -0
- package/dist/core/computation/index.d.ts.map +1 -0
- package/dist/core/computation/rollup.d.ts +18 -0
- package/dist/core/computation/rollup.d.ts.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +168 -101
- package/dist/core/kernel/boot-middleware.d.ts +10 -0
- package/dist/core/kernel/boot-middleware.d.ts.map +1 -0
- package/dist/core/kernel/logic-middleware.d.ts +7 -1
- package/dist/core/kernel/logic-middleware.d.ts.map +1 -1
- package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
- package/dist/core/ontology/types.d.ts +5 -0
- package/dist/core/ontology/types.d.ts.map +1 -1
- package/dist/core/persist/better-sqlite-backend.d.ts +9 -2
- package/dist/core/persist/better-sqlite-backend.d.ts.map +1 -1
- package/dist/core/persist/factory.d.ts +6 -7
- package/dist/core/persist/factory.d.ts.map +1 -1
- package/dist/core/persist/factory.js +2 -3
- package/dist/core/persist/sqljs-backend.js +2 -3
- package/dist/db/index.d.ts +4 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +69 -56
- package/dist/db/inspector.js +11 -19
- package/dist/decisions/index.js +9 -10
- package/dist/deploy-66EC752W.js +9 -0
- package/dist/deploy-SO7AFK6L.js +9 -0
- package/dist/embeddings/auto-embed.d.ts +2 -2
- package/dist/embeddings/auto-embed.d.ts.map +1 -1
- package/dist/embeddings/index.js +20 -22
- package/dist/embeddings/search.d.ts +2 -1
- package/dist/embeddings/search.d.ts.map +1 -1
- package/dist/embeddings/store.d.ts +25 -4
- package/dist/embeddings/store.d.ts.map +1 -1
- package/dist/engine-7GXBM4IT.js +7 -0
- package/dist/engine-NSR6BIF7.js +7 -0
- package/dist/engine.d.ts +32 -12
- package/dist/engine.d.ts.map +1 -1
- package/dist/factory-2P64OC7M.js +34 -0
- package/dist/factory-YP4ZZK5K.js +34 -0
- package/dist/import-AJLYHFIA.js +10 -0
- package/dist/import-UZEKXU3B.js +10 -0
- package/dist/index.js +102 -93
- package/dist/launch-explorer-AI6L2AWJ.js +91 -0
- package/dist/launch-explorer-HZ4ZJA4X.js +95 -0
- package/dist/links/index.js +24 -26
- package/dist/plugins/agent-memory/index.js +316 -0
- package/dist/plugins/idea-garden/index.js +165 -0
- package/dist/plugins/plan-approval/index.js +579 -0
- package/dist/plugins/proactive-watcher/index.js +194 -0
- package/dist/{index-2r4jxwnb.js → query-GJL3CVGN.js} +14 -15
- package/dist/query-MBJSK3EB.js +31 -0
- package/dist/query-TJHEVSKL.js +31 -0
- package/dist/query-WUIKOHPE.js +524 -0
- package/dist/query-XYLTJYSA.js +31 -0
- package/dist/react/index.js +39 -70
- package/dist/react/realtime.js +11 -0
- package/dist/react/schema-hooks.js +87 -0
- package/dist/realtime/broadcast-channel-transport.d.ts +43 -0
- package/dist/realtime/broadcast-channel-transport.d.ts.map +1 -0
- package/dist/realtime/durable-object-relay-transport.d.ts +96 -0
- package/dist/realtime/durable-object-relay-transport.d.ts.map +1 -0
- package/dist/realtime/index.d.ts +44 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +40 -0
- package/dist/realtime/memory-hub.d.ts +32 -0
- package/dist/realtime/memory-hub.d.ts.map +1 -0
- package/dist/realtime/persistent-channel.d.ts +105 -0
- package/dist/realtime/persistent-channel.d.ts.map +1 -0
- package/dist/realtime/presence.d.ts +73 -0
- package/dist/realtime/presence.d.ts.map +1 -0
- package/dist/realtime/relay-persistence.d.ts +37 -0
- package/dist/realtime/relay-persistence.d.ts.map +1 -0
- package/dist/realtime/relay-persistence.js +107 -0
- package/dist/realtime/relay-server.d.ts +103 -0
- package/dist/realtime/relay-server.d.ts.map +1 -0
- package/dist/realtime/room.d.ts +98 -0
- package/dist/realtime/room.d.ts.map +1 -0
- package/dist/realtime/text.d.ts +73 -0
- package/dist/realtime/text.d.ts.map +1 -0
- package/dist/realtime/types.d.ts +89 -0
- package/dist/realtime/types.d.ts.map +1 -0
- package/dist/realtime/websocket-relay-transport.d.ts +28 -0
- package/dist/realtime/websocket-relay-transport.d.ts.map +1 -0
- package/dist/realtime.bundle.js +1100 -0
- package/dist/remote-manager-BLJZ6KF6.js +224 -0
- package/dist/{remote-manager-xvbg4230.js → remote-manager-BPYE46SI.js} +24 -15
- package/dist/remote-manager-FMESEAFA.js +224 -0
- package/dist/remote-manager-K2WZ5RHY.js +223 -0
- package/dist/remote-manager-SG545WNY.js +224 -0
- package/dist/remote-manager-SG5PQKCH.js +224 -0
- package/dist/remote-manager-WGP6MIQZ.js +224 -0
- package/dist/scaffold/write.d.ts.map +1 -1
- package/dist/schema/define.d.ts +137 -0
- package/dist/schema/define.d.ts.map +1 -0
- package/dist/schema/entity-projection.d.ts +34 -0
- package/dist/schema/entity-projection.d.ts.map +1 -0
- package/dist/schema/eql.d.ts +46 -0
- package/dist/schema/eql.d.ts.map +1 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +45 -0
- package/dist/schema/kernel-resolve.d.ts +21 -0
- package/dist/schema/kernel-resolve.d.ts.map +1 -0
- package/dist/schema/mutations.d.ts +20 -0
- package/dist/schema/mutations.d.ts.map +1 -0
- package/dist/schema/resolve.d.ts +21 -0
- package/dist/schema/resolve.d.ts.map +1 -0
- package/dist/sdk-3KBB3E6V.js +16 -0
- package/dist/sdk-4ZQO6UTU.js +16 -0
- package/dist/sdk-6JA6GV3G.js +16 -0
- package/dist/sdk-6VTP5UTZ.js +16 -0
- package/dist/sdk-7VS6TYCD.js +16 -0
- package/dist/sdk-HQ3FTLRT.js +16 -0
- package/dist/sdk-HZ7NU3XE.js +15 -0
- package/dist/sdk-KBQE2OXT.js +16 -0
- package/dist/sdk-LZ7W3EEY.js +9 -0
- package/dist/sdk-MSCDZ7JU.js +15 -0
- package/dist/sdk-WNZOGO3S.js +15 -0
- package/dist/sdk-YLV33ZCW.js +9 -0
- package/dist/sdk-ZSUD2LLJ.js +16 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +69 -61
- package/dist/server/node-adapter.js +5 -104
- package/dist/server/realtime.d.ts +10 -2
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/server.d.ts +7 -16
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/sprites.d.ts.map +1 -1
- package/dist/server/tenancy.d.ts.map +1 -1
- package/dist/server-AFXFFBWA.js +11 -0
- package/dist/server-AGHC4VUL.js +11 -0
- package/dist/server-BOH7M4TT.js +13 -0
- package/dist/server-DBUY2KY5.js +11 -0
- package/dist/server-GWBQJPRG.js +11 -0
- package/dist/server-IGBIIJSF.js +13 -0
- package/dist/server-JZZFULVU.js +11 -0
- package/dist/server-L5XAF4M5.js +11 -0
- package/dist/server-NYFUHANA.js +12 -0
- package/dist/server-OABUB2LO.js +12 -0
- package/dist/server-P2CKZWWV.js +12 -0
- package/dist/{sprites-vc4qbrp1.js → sprites-RU3E4XQN.js} +6 -7
- package/dist/sprites-XVSMQLSI.js +15 -0
- package/dist/sql-wasm-FORCZFHZ.js +2148 -0
- package/dist/sql-wasm-JZH76RLO.js +2148 -0
- package/dist/sqljs-backend-CJQOIQYE.js +266 -0
- package/dist/sqljs-backend-KWXBUDUO.js +266 -0
- package/dist/state-demo.bundle.js +1033 -0
- package/dist/svelte/index.d.ts +17 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +51 -0
- package/dist/svelte/schema-hooks.d.ts +45 -0
- package/dist/svelte/schema-hooks.d.ts.map +1 -0
- package/dist/svelte/schema-hooks.js +71 -0
- package/dist/svelte/stores.d.ts +78 -0
- package/dist/svelte/stores.d.ts.map +1 -0
- package/dist/sync/http-transport.d.ts +3 -3
- package/dist/sync/http-transport.d.ts.map +1 -1
- package/dist/sync/index.d.ts +15 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +617 -0
- package/dist/sync/memory-room.d.ts +37 -0
- package/dist/sync/memory-room.d.ts.map +1 -0
- package/dist/sync/memory-transport.d.ts +3 -3
- package/dist/sync/memory-transport.d.ts.map +1 -1
- package/dist/sync/partykit-room.d.ts +40 -0
- package/dist/sync/partykit-room.d.ts.map +1 -0
- package/dist/sync/partykit-transport.d.ts +84 -0
- package/dist/sync/partykit-transport.d.ts.map +1 -0
- package/dist/sync/room-core.d.ts +53 -0
- package/dist/sync/room-core.d.ts.map +1 -0
- package/dist/sync/sync-engine.d.ts +40 -2
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-room-server.d.ts +39 -0
- package/dist/sync/sync-room-server.d.ts.map +1 -0
- package/dist/sync/types.d.ts +70 -3
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/vcs-sync-peer.d.ts +63 -0
- package/dist/sync/vcs-sync-peer.d.ts.map +1 -0
- package/dist/sync/ws-transport.d.ts +2 -2
- package/dist/sync/ws-transport.d.ts.map +1 -1
- package/dist/tenancy-CBWYEVUB.js +11 -0
- package/dist/tenancy-FO6WVYFN.js +13 -0
- package/dist/tenancy-FWDBESMX.js +14 -0
- package/dist/tenancy-HGPIS5QA.js +13 -0
- package/dist/tenancy-HXFALA37.js +14 -0
- package/dist/tenancy-OP34NFFS.js +14 -0
- package/dist/tenancy-S676GLID.js +14 -0
- package/dist/tenancy-V7ARWNNV.js +14 -0
- package/dist/tenancy-ZDN4GXK5.js +13 -0
- package/dist/tenancy-ZT5VMY7B.js +14 -0
- package/dist/ui/client.html +355 -67
- package/dist/ui/launch-explorer.d.ts +22 -0
- package/dist/ui/launch-explorer.d.ts.map +1 -0
- package/dist/ui/server.d.ts +1 -1
- package/dist/ui/server.d.ts.map +1 -1
- package/dist/vcs/blob-store.d.ts.map +1 -1
- package/dist/vcs/idb-op-log.d.ts +67 -0
- package/dist/vcs/idb-op-log.d.ts.map +1 -0
- package/dist/vcs/index.d.ts +1 -0
- package/dist/vcs/index.d.ts.map +1 -1
- package/dist/vcs/index.js +81 -72
- package/dist/vcs/issue.d.ts +22 -5
- package/dist/vcs/issue.d.ts.map +1 -1
- package/dist/vcs/lane-materialize.d.ts +5 -0
- package/dist/vcs/lane-materialize.d.ts.map +1 -1
- package/dist/vcs/op-log.d.ts +28 -2
- package/dist/vcs/op-log.d.ts.map +1 -1
- package/dist/vcs/ops.d.ts +10 -0
- package/dist/vcs/ops.d.ts.map +1 -1
- package/dist/{vm-config-6xhsj6b3.js → vm-config-JI4OXKDQ.js} +9 -10
- package/dist/vm-config-YZRJ3KUB.js +21 -0
- package/dist/vue/hooks.d.ts +64 -0
- package/dist/vue/hooks.d.ts.map +1 -0
- package/dist/vue/index.d.ts +19 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +59 -0
- package/dist/vue/schema-hooks.d.ts +41 -0
- package/dist/vue/schema-hooks.d.ts.map +1 -0
- package/dist/vue/schema-hooks.js +64 -0
- package/package.json +118 -16
- package/dist/deploy-999q207z.js +0 -10
- package/dist/engine-y0724kjq.js +0 -8
- package/dist/import-s2b8e0ft.js +0 -11
- package/dist/index-a76rekgs.js +0 -67
- package/dist/index-c9h37r6h.js +0 -1
- package/dist/index-hr9qvv77.js +0 -860
- package/dist/index-k5b0xskw.js +0 -1
- package/dist/index-y6a4kj0p.js +0 -43
- package/dist/sdk-bepky0xs.js +0 -16
- package/dist/server-szdjx0nt.js +0 -13
- package/dist/sqlite-backend-0vsmc6qj.js +0 -8
- package/dist/tenancy-pjm32b4v.js +0 -14
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QueryEngine,
|
|
3
|
+
isLiteral,
|
|
4
|
+
isVariable,
|
|
5
|
+
literal,
|
|
6
|
+
variable
|
|
7
|
+
} from "./chunk-6CTA6MCE.js";
|
|
8
|
+
import "./chunk-MCKGQKYU.js";
|
|
9
|
+
|
|
10
|
+
// src/core/query/parser.ts
|
|
11
|
+
function tokenize(input) {
|
|
12
|
+
const tokens = [];
|
|
13
|
+
let i = 0;
|
|
14
|
+
while (i < input.length) {
|
|
15
|
+
if (/\s/.test(input[i])) {
|
|
16
|
+
i++;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (input[i] === "/" && input[i + 1] === "/") {
|
|
20
|
+
while (i < input.length && input[i] !== "\n") i++;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const pos = i;
|
|
24
|
+
if ("[](){},:".includes(input[i])) {
|
|
25
|
+
tokens.push({ kind: "symbol", value: input[i], pos });
|
|
26
|
+
i++;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (input[i] === "!" && input[i + 1] === "=") {
|
|
30
|
+
tokens.push({ kind: "symbol", value: "!=", pos });
|
|
31
|
+
i += 2;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (input[i] === "<" && input[i + 1] === "=") {
|
|
35
|
+
tokens.push({ kind: "symbol", value: "<=", pos });
|
|
36
|
+
i += 2;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (input[i] === ">" && input[i + 1] === "=") {
|
|
40
|
+
tokens.push({ kind: "symbol", value: ">=", pos });
|
|
41
|
+
i += 2;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if ("<>=".includes(input[i])) {
|
|
45
|
+
tokens.push({ kind: "symbol", value: input[i], pos });
|
|
46
|
+
i++;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (input[i] === '"') {
|
|
50
|
+
i++;
|
|
51
|
+
let s = "";
|
|
52
|
+
while (i < input.length && input[i] !== '"') {
|
|
53
|
+
if (input[i] === "\\" && i + 1 < input.length) {
|
|
54
|
+
s += input[i + 1];
|
|
55
|
+
i += 2;
|
|
56
|
+
} else {
|
|
57
|
+
s += input[i];
|
|
58
|
+
i++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (i < input.length) i++;
|
|
62
|
+
tokens.push({ kind: "string", value: s, pos });
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1])) {
|
|
66
|
+
let n = input[i];
|
|
67
|
+
i++;
|
|
68
|
+
while (i < input.length && /[0-9.]/.test(input[i])) {
|
|
69
|
+
n += input[i];
|
|
70
|
+
i++;
|
|
71
|
+
}
|
|
72
|
+
tokens.push({ kind: "number", value: n, pos });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (/[?a-zA-Z_]/.test(input[i])) {
|
|
76
|
+
let w = "";
|
|
77
|
+
while (i < input.length && /[?a-zA-Z0-9_.:/-]/.test(input[i])) {
|
|
78
|
+
w += input[i];
|
|
79
|
+
i++;
|
|
80
|
+
}
|
|
81
|
+
tokens.push({ kind: "word", value: w, pos });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
i++;
|
|
85
|
+
}
|
|
86
|
+
tokens.push({ kind: "eof", value: "", pos: input.length });
|
|
87
|
+
return tokens;
|
|
88
|
+
}
|
|
89
|
+
var Parser = class {
|
|
90
|
+
tokens;
|
|
91
|
+
pos = 0;
|
|
92
|
+
constructor(tokens) {
|
|
93
|
+
this.tokens = tokens;
|
|
94
|
+
}
|
|
95
|
+
peek() {
|
|
96
|
+
return this.tokens[this.pos];
|
|
97
|
+
}
|
|
98
|
+
advance() {
|
|
99
|
+
return this.tokens[this.pos++];
|
|
100
|
+
}
|
|
101
|
+
expect(kind, value) {
|
|
102
|
+
const t = this.advance();
|
|
103
|
+
if (t.kind !== kind || value !== void 0 && t.value !== value) {
|
|
104
|
+
throw new Error(`Expected ${kind}${value ? ` "${value}"` : ""} at pos ${t.pos}, got ${t.kind} "${t.value}"`);
|
|
105
|
+
}
|
|
106
|
+
return t;
|
|
107
|
+
}
|
|
108
|
+
match(kind, value) {
|
|
109
|
+
const t = this.peek();
|
|
110
|
+
if (t.kind === kind && (value === void 0 || t.value === value)) {
|
|
111
|
+
this.pos++;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
isAt(kind, value) {
|
|
117
|
+
const t = this.peek();
|
|
118
|
+
return t.kind === kind && (value === void 0 || t.value === value);
|
|
119
|
+
}
|
|
120
|
+
// -----------------------------------------------------------------------
|
|
121
|
+
// Terms
|
|
122
|
+
// -----------------------------------------------------------------------
|
|
123
|
+
parseTerm() {
|
|
124
|
+
const t = this.peek();
|
|
125
|
+
if (t.kind === "word" && t.value.startsWith("?")) {
|
|
126
|
+
this.advance();
|
|
127
|
+
return variable(t.value.slice(1));
|
|
128
|
+
}
|
|
129
|
+
if (t.kind === "string") {
|
|
130
|
+
this.advance();
|
|
131
|
+
return literal(t.value);
|
|
132
|
+
}
|
|
133
|
+
if (t.kind === "number") {
|
|
134
|
+
this.advance();
|
|
135
|
+
const n = Number(t.value);
|
|
136
|
+
return literal(n);
|
|
137
|
+
}
|
|
138
|
+
if (t.kind === "word") {
|
|
139
|
+
const v = t.value;
|
|
140
|
+
this.advance();
|
|
141
|
+
if (v === "true") return literal(true);
|
|
142
|
+
if (v === "false") return literal(false);
|
|
143
|
+
return literal(v);
|
|
144
|
+
}
|
|
145
|
+
throw new Error(`Unexpected token at pos ${t.pos}: ${t.kind} "${t.value}"`);
|
|
146
|
+
}
|
|
147
|
+
// -----------------------------------------------------------------------
|
|
148
|
+
// Patterns
|
|
149
|
+
// -----------------------------------------------------------------------
|
|
150
|
+
parsePattern() {
|
|
151
|
+
const t = this.peek();
|
|
152
|
+
if (t.kind === "word" && t.value.toUpperCase() === "NOT") {
|
|
153
|
+
this.advance();
|
|
154
|
+
const inner = this.parsePattern();
|
|
155
|
+
return { kind: "not", pattern: inner };
|
|
156
|
+
}
|
|
157
|
+
if (t.kind === "word" && t.value.toUpperCase() === "OR") {
|
|
158
|
+
this.advance();
|
|
159
|
+
const branches = [];
|
|
160
|
+
while (this.isAt("symbol", "{")) {
|
|
161
|
+
this.advance();
|
|
162
|
+
const branch = [];
|
|
163
|
+
while (!this.isAt("symbol", "}") && !this.isAt("eof", void 0)) {
|
|
164
|
+
branch.push(this.parsePattern());
|
|
165
|
+
}
|
|
166
|
+
this.expect("symbol", "}");
|
|
167
|
+
branches.push(branch);
|
|
168
|
+
}
|
|
169
|
+
return { kind: "or", branches };
|
|
170
|
+
}
|
|
171
|
+
if (t.kind === "symbol" && t.value === "[") {
|
|
172
|
+
this.advance();
|
|
173
|
+
const entity = this.parseTerm();
|
|
174
|
+
const attribute = this.parseTerm();
|
|
175
|
+
const value = this.parseTerm();
|
|
176
|
+
this.expect("symbol", "]");
|
|
177
|
+
return { kind: "fact", entity, attribute, value };
|
|
178
|
+
}
|
|
179
|
+
if (t.kind === "symbol" && t.value === "(") {
|
|
180
|
+
this.advance();
|
|
181
|
+
const source = this.parseTerm();
|
|
182
|
+
const attribute = this.parseTerm();
|
|
183
|
+
const target = this.parseTerm();
|
|
184
|
+
this.expect("symbol", ")");
|
|
185
|
+
return { kind: "link", source, attribute, target };
|
|
186
|
+
}
|
|
187
|
+
if (t.kind === "word" && !t.value.startsWith("?")) {
|
|
188
|
+
const name = this.advance().value;
|
|
189
|
+
if (this.isAt("symbol", "(")) {
|
|
190
|
+
this.advance();
|
|
191
|
+
const args = [];
|
|
192
|
+
while (!this.isAt("symbol", ")") && !this.isAt("eof", void 0)) {
|
|
193
|
+
args.push(this.parseTerm());
|
|
194
|
+
this.match("symbol", ",");
|
|
195
|
+
}
|
|
196
|
+
this.expect("symbol", ")");
|
|
197
|
+
return { kind: "rule", name, args };
|
|
198
|
+
}
|
|
199
|
+
throw new Error(`Expected '(' after rule name "${name}" at pos ${t.pos}`);
|
|
200
|
+
}
|
|
201
|
+
throw new Error(`Cannot parse pattern at pos ${t.pos}: ${t.kind} "${t.value}"`);
|
|
202
|
+
}
|
|
203
|
+
// -----------------------------------------------------------------------
|
|
204
|
+
// Filter
|
|
205
|
+
// -----------------------------------------------------------------------
|
|
206
|
+
parseFilter() {
|
|
207
|
+
const left = this.parseTerm();
|
|
208
|
+
const op = this.advance().value;
|
|
209
|
+
const right = this.parseTerm();
|
|
210
|
+
return { kind: "filter", left, op, right };
|
|
211
|
+
}
|
|
212
|
+
// -----------------------------------------------------------------------
|
|
213
|
+
// Full Query
|
|
214
|
+
// -----------------------------------------------------------------------
|
|
215
|
+
parseQuery() {
|
|
216
|
+
const query = {
|
|
217
|
+
select: [],
|
|
218
|
+
where: [],
|
|
219
|
+
filters: [],
|
|
220
|
+
aggregates: [],
|
|
221
|
+
orderBy: [],
|
|
222
|
+
limit: 0,
|
|
223
|
+
offset: 0
|
|
224
|
+
};
|
|
225
|
+
while (!this.isAt("eof", void 0)) {
|
|
226
|
+
const kw = this.peek();
|
|
227
|
+
if (kw.kind !== "word") {
|
|
228
|
+
throw new Error(`Expected keyword at pos ${kw.pos}, got ${kw.kind} "${kw.value}"`);
|
|
229
|
+
}
|
|
230
|
+
switch (kw.value.toUpperCase()) {
|
|
231
|
+
case "SELECT": {
|
|
232
|
+
this.advance();
|
|
233
|
+
while (this.peek().kind === "word" && this.peek().value.startsWith("?")) {
|
|
234
|
+
query.select.push(this.advance().value.slice(1));
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case "WHERE": {
|
|
239
|
+
this.advance();
|
|
240
|
+
this.expect("symbol", "{");
|
|
241
|
+
while (!this.isAt("symbol", "}") && !this.isAt("eof", void 0)) {
|
|
242
|
+
query.where.push(this.parsePattern());
|
|
243
|
+
}
|
|
244
|
+
this.expect("symbol", "}");
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case "FILTER": {
|
|
248
|
+
this.advance();
|
|
249
|
+
query.filters.push(this.parseFilter());
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case "AGGREGATE": {
|
|
253
|
+
this.advance();
|
|
254
|
+
const op = this.advance().value;
|
|
255
|
+
this.expect("symbol", "(");
|
|
256
|
+
const varName = this.advance().value;
|
|
257
|
+
const varClean = varName.startsWith("?") ? varName.slice(1) : varName;
|
|
258
|
+
this.expect("symbol", ")");
|
|
259
|
+
this.expect("word", "AS");
|
|
260
|
+
const asName = this.advance().value;
|
|
261
|
+
const asClean = asName.startsWith("?") ? asName.slice(1) : asName;
|
|
262
|
+
query.aggregates.push({ op, variable: varClean, as: asClean });
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case "ORDER": {
|
|
266
|
+
this.advance();
|
|
267
|
+
this.expect("word", "BY");
|
|
268
|
+
while (this.peek().kind === "word" && this.peek().value.startsWith("?")) {
|
|
269
|
+
const v = this.advance().value.slice(1);
|
|
270
|
+
let dir = "asc";
|
|
271
|
+
if (this.peek().kind === "word" && ["ASC", "DESC"].includes(this.peek().value.toUpperCase())) {
|
|
272
|
+
dir = this.advance().value.toLowerCase();
|
|
273
|
+
}
|
|
274
|
+
query.orderBy.push({ variable: v, direction: dir });
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
case "LIMIT": {
|
|
279
|
+
this.advance();
|
|
280
|
+
query.limit = Number(this.expect("number").value);
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
case "OFFSET": {
|
|
284
|
+
this.advance();
|
|
285
|
+
query.offset = Number(this.expect("number").value);
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
default:
|
|
289
|
+
throw new Error(`Unknown keyword "${kw.value}" at pos ${kw.pos}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return query;
|
|
293
|
+
}
|
|
294
|
+
// -----------------------------------------------------------------------
|
|
295
|
+
// Datalog Rule
|
|
296
|
+
// -----------------------------------------------------------------------
|
|
297
|
+
parseRule() {
|
|
298
|
+
const name = this.expect("word").value;
|
|
299
|
+
this.expect("symbol", "(");
|
|
300
|
+
const params = [];
|
|
301
|
+
while (!this.isAt("symbol", ")") && !this.isAt("eof", void 0)) {
|
|
302
|
+
const v = this.expect("word").value;
|
|
303
|
+
params.push(v.startsWith("?") ? v.slice(1) : v);
|
|
304
|
+
this.match("symbol", ",");
|
|
305
|
+
}
|
|
306
|
+
this.expect("symbol", ")");
|
|
307
|
+
if (this.isAt("symbol", ":")) {
|
|
308
|
+
this.advance();
|
|
309
|
+
if (this.peek().kind === "number" && this.peek().value.startsWith("-")) {
|
|
310
|
+
this.advance();
|
|
311
|
+
}
|
|
312
|
+
} else if (this.isAt("word", ":-")) {
|
|
313
|
+
this.advance();
|
|
314
|
+
}
|
|
315
|
+
const body = [];
|
|
316
|
+
const filters = [];
|
|
317
|
+
while (!this.isAt("eof", void 0)) {
|
|
318
|
+
if (this.peek().kind === "word" && this.peek().value.toUpperCase() === "FILTER") {
|
|
319
|
+
this.advance();
|
|
320
|
+
filters.push(this.parseFilter());
|
|
321
|
+
} else {
|
|
322
|
+
body.push(this.parsePattern());
|
|
323
|
+
}
|
|
324
|
+
this.match("symbol", ",");
|
|
325
|
+
}
|
|
326
|
+
return { name, params, body, filters };
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
function parseQuery(input) {
|
|
330
|
+
const tokens = tokenize(input);
|
|
331
|
+
return new Parser(tokens).parseQuery();
|
|
332
|
+
}
|
|
333
|
+
function parseRule(input) {
|
|
334
|
+
const tokens = tokenize(input);
|
|
335
|
+
return new Parser(tokens).parseRule();
|
|
336
|
+
}
|
|
337
|
+
function parseSimple(input) {
|
|
338
|
+
const trimmed = input.trim();
|
|
339
|
+
const upper = trimmed.toUpperCase();
|
|
340
|
+
if (upper.startsWith("SELECT") || upper.startsWith("WHERE")) {
|
|
341
|
+
return parseQuery(trimmed);
|
|
342
|
+
}
|
|
343
|
+
const findMatch = trimmed.match(/^find\s+(.+?)\s+where\s+(.+)$/i);
|
|
344
|
+
if (findMatch) {
|
|
345
|
+
const vars = findMatch[1].trim().split(/\s+/);
|
|
346
|
+
const conditions = findMatch[2].trim();
|
|
347
|
+
const selectVars = vars.map((v) => v.startsWith("?") ? v : `?${v}`);
|
|
348
|
+
const entity = selectVars[0];
|
|
349
|
+
const parts = conditions.split(/\s+and\s+/i);
|
|
350
|
+
const patterns = [];
|
|
351
|
+
const filters = [];
|
|
352
|
+
for (const part of parts) {
|
|
353
|
+
const eqMatch = part.match(/^(\S+)\s*(=|!=|<|<=|>|>=|contains|startsWith|endsWith|matches)\s*(.+)$/);
|
|
354
|
+
if (eqMatch) {
|
|
355
|
+
const [, attr, op, val] = eqMatch;
|
|
356
|
+
const valTrimmed = val.trim();
|
|
357
|
+
if (op === "=") {
|
|
358
|
+
patterns.push(`[${entity} "${attr}" ${valTrimmed}]`);
|
|
359
|
+
} else {
|
|
360
|
+
const tmpVar = `?_${attr.replace(/[^a-zA-Z0-9]/g, "_")}`;
|
|
361
|
+
patterns.push(`[${entity} "${attr}" ${tmpVar}]`);
|
|
362
|
+
filters.push(`FILTER ${tmpVar} ${op} ${valTrimmed}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const fullQuery = `SELECT ${selectVars.join(" ")}
|
|
367
|
+
WHERE {
|
|
368
|
+
${patterns.join("\n ")}
|
|
369
|
+
}
|
|
370
|
+
${filters.join("\n")}`;
|
|
371
|
+
return parseQuery(fullQuery);
|
|
372
|
+
}
|
|
373
|
+
throw new Error(`Cannot parse query: "${trimmed}". Use full EQL-S syntax or "find ?e where attr = value".`);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// src/core/query/datalog.ts
|
|
377
|
+
function transitiveClosureRules(ruleName, linkAttribute) {
|
|
378
|
+
return [
|
|
379
|
+
// Base case: direct link
|
|
380
|
+
{
|
|
381
|
+
name: ruleName,
|
|
382
|
+
params: ["x", "y"],
|
|
383
|
+
body: [
|
|
384
|
+
{
|
|
385
|
+
kind: "link",
|
|
386
|
+
source: variable("x"),
|
|
387
|
+
attribute: literal(linkAttribute),
|
|
388
|
+
target: variable("y")
|
|
389
|
+
}
|
|
390
|
+
],
|
|
391
|
+
filters: []
|
|
392
|
+
},
|
|
393
|
+
// Recursive case: indirect via intermediate
|
|
394
|
+
{
|
|
395
|
+
name: ruleName,
|
|
396
|
+
params: ["x", "y"],
|
|
397
|
+
body: [
|
|
398
|
+
{
|
|
399
|
+
kind: "link",
|
|
400
|
+
source: variable("x"),
|
|
401
|
+
attribute: literal(linkAttribute),
|
|
402
|
+
target: variable("z")
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
kind: "rule",
|
|
406
|
+
name: ruleName,
|
|
407
|
+
args: [variable("z"), variable("y")]
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
filters: []
|
|
411
|
+
}
|
|
412
|
+
];
|
|
413
|
+
}
|
|
414
|
+
function reverseReachabilityRules(ruleName, linkAttribute) {
|
|
415
|
+
return [
|
|
416
|
+
{
|
|
417
|
+
name: ruleName,
|
|
418
|
+
params: ["x", "y"],
|
|
419
|
+
body: [
|
|
420
|
+
{
|
|
421
|
+
kind: "link",
|
|
422
|
+
source: variable("y"),
|
|
423
|
+
attribute: literal(linkAttribute),
|
|
424
|
+
target: variable("x")
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
filters: []
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: ruleName,
|
|
431
|
+
params: ["x", "y"],
|
|
432
|
+
body: [
|
|
433
|
+
{
|
|
434
|
+
kind: "link",
|
|
435
|
+
source: variable("z"),
|
|
436
|
+
attribute: literal(linkAttribute),
|
|
437
|
+
target: variable("x")
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
kind: "rule",
|
|
441
|
+
name: ruleName,
|
|
442
|
+
args: [variable("z"), variable("y")]
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
filters: []
|
|
446
|
+
}
|
|
447
|
+
];
|
|
448
|
+
}
|
|
449
|
+
function siblingRules(ruleName, linkAttribute) {
|
|
450
|
+
return [
|
|
451
|
+
{
|
|
452
|
+
name: ruleName,
|
|
453
|
+
params: ["a", "b"],
|
|
454
|
+
body: [
|
|
455
|
+
{
|
|
456
|
+
kind: "link",
|
|
457
|
+
source: variable("a"),
|
|
458
|
+
attribute: literal(linkAttribute),
|
|
459
|
+
target: variable("parent")
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
kind: "link",
|
|
463
|
+
source: variable("b"),
|
|
464
|
+
attribute: literal(linkAttribute),
|
|
465
|
+
target: variable("parent")
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
filters: [
|
|
469
|
+
{
|
|
470
|
+
kind: "filter",
|
|
471
|
+
left: variable("a"),
|
|
472
|
+
op: "!=",
|
|
473
|
+
right: variable("b")
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
];
|
|
478
|
+
}
|
|
479
|
+
var DatalogRuntime = class {
|
|
480
|
+
engine;
|
|
481
|
+
constructor(store) {
|
|
482
|
+
this.engine = new QueryEngine(store);
|
|
483
|
+
}
|
|
484
|
+
/** Register a Datalog rule (or multiple). */
|
|
485
|
+
addRule(rule) {
|
|
486
|
+
this.engine.addRule(rule);
|
|
487
|
+
}
|
|
488
|
+
addRules(rules) {
|
|
489
|
+
for (const r of rules) this.engine.addRule(r);
|
|
490
|
+
}
|
|
491
|
+
removeRule(name) {
|
|
492
|
+
this.engine.removeRule(name);
|
|
493
|
+
}
|
|
494
|
+
/** Register built-in transitive closure for a link attribute. */
|
|
495
|
+
registerTransitiveClosure(ruleName, linkAttribute) {
|
|
496
|
+
this.addRules(transitiveClosureRules(ruleName, linkAttribute));
|
|
497
|
+
}
|
|
498
|
+
/** Register built-in reverse reachability for a link attribute. */
|
|
499
|
+
registerReverseReachability(ruleName, linkAttribute) {
|
|
500
|
+
this.addRules(reverseReachabilityRules(ruleName, linkAttribute));
|
|
501
|
+
}
|
|
502
|
+
/** Register built-in sibling rule for a link attribute. */
|
|
503
|
+
registerSiblings(ruleName, linkAttribute) {
|
|
504
|
+
this.addRules(siblingRules(ruleName, linkAttribute));
|
|
505
|
+
}
|
|
506
|
+
/** Get the underlying QueryEngine for direct query execution. */
|
|
507
|
+
getEngine() {
|
|
508
|
+
return this.engine;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
export {
|
|
512
|
+
DatalogRuntime,
|
|
513
|
+
QueryEngine,
|
|
514
|
+
isLiteral,
|
|
515
|
+
isVariable,
|
|
516
|
+
literal,
|
|
517
|
+
parseQuery,
|
|
518
|
+
parseRule,
|
|
519
|
+
parseSimple,
|
|
520
|
+
reverseReachabilityRules,
|
|
521
|
+
siblingRules,
|
|
522
|
+
transitiveClosureRules,
|
|
523
|
+
variable
|
|
524
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DatalogRuntime,
|
|
3
|
+
parseQuery,
|
|
4
|
+
parseRule,
|
|
5
|
+
parseSimple,
|
|
6
|
+
reverseReachabilityRules,
|
|
7
|
+
siblingRules,
|
|
8
|
+
transitiveClosureRules
|
|
9
|
+
} from "./chunk-X5FLTRUB.js";
|
|
10
|
+
import {
|
|
11
|
+
QueryEngine,
|
|
12
|
+
isLiteral,
|
|
13
|
+
isVariable,
|
|
14
|
+
literal,
|
|
15
|
+
variable
|
|
16
|
+
} from "./chunk-6CTA6MCE.js";
|
|
17
|
+
import "./chunk-KFQGP6VL.js";
|
|
18
|
+
export {
|
|
19
|
+
DatalogRuntime,
|
|
20
|
+
QueryEngine,
|
|
21
|
+
isLiteral,
|
|
22
|
+
isVariable,
|
|
23
|
+
literal,
|
|
24
|
+
parseQuery,
|
|
25
|
+
parseRule,
|
|
26
|
+
parseSimple,
|
|
27
|
+
reverseReachabilityRules,
|
|
28
|
+
siblingRules,
|
|
29
|
+
transitiveClosureRules,
|
|
30
|
+
variable
|
|
31
|
+
};
|
package/dist/react/index.js
CHANGED
|
@@ -1,57 +1,17 @@
|
|
|
1
|
-
// @bun
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import"../
|
|
7
|
-
import"../index-4wxa8xz4.js";
|
|
8
|
-
import"../index-yp88he8n.js";
|
|
9
|
-
import"../index-yhwjgfvj.js";
|
|
10
|
-
import"../index-h7zxhhhh.js";
|
|
11
|
-
import"../index-a76rekgs.js";
|
|
12
|
-
|
|
13
|
-
// src/react/provider.tsx
|
|
2
|
+
TrellisProvider,
|
|
3
|
+
useTrellis
|
|
4
|
+
} from "../chunk-GWRIMRSX.js";
|
|
5
|
+
import "../chunk-X762XWVC.js";
|
|
14
6
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var TrellisContext = createContext(null);
|
|
22
|
-
function TrellisProvider({
|
|
23
|
-
url,
|
|
24
|
-
apiKey,
|
|
25
|
-
tenantId,
|
|
26
|
-
children
|
|
27
|
-
}) {
|
|
28
|
-
const client = useMemo(() => {
|
|
29
|
-
const opts = { url };
|
|
30
|
-
if (apiKey)
|
|
31
|
-
opts.apiKey = apiKey;
|
|
32
|
-
if (tenantId)
|
|
33
|
-
opts.tenantId = tenantId;
|
|
34
|
-
return new TrellisDb(opts);
|
|
35
|
-
}, [url, apiKey, tenantId]);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
return () => {
|
|
38
|
-
client.disconnect();
|
|
39
|
-
};
|
|
40
|
-
}, [client]);
|
|
41
|
-
return /* @__PURE__ */ jsxDEV(TrellisContext.Provider, {
|
|
42
|
-
value: client,
|
|
43
|
-
children
|
|
44
|
-
}, undefined, false, undefined, this);
|
|
45
|
-
}
|
|
46
|
-
function useTrellis() {
|
|
47
|
-
const client = useContext(TrellisContext);
|
|
48
|
-
if (!client) {
|
|
49
|
-
throw new Error("useTrellis() must be used within a <TrellisProvider>. " + 'Wrap your app with <TrellisProvider url="...">.');
|
|
50
|
-
}
|
|
51
|
-
return client;
|
|
52
|
-
}
|
|
7
|
+
usePresence,
|
|
8
|
+
useRoom,
|
|
9
|
+
useSignal
|
|
10
|
+
} from "../chunk-O2AV5WMN.js";
|
|
11
|
+
import "../chunk-KFQGP6VL.js";
|
|
12
|
+
|
|
53
13
|
// src/react/hooks.ts
|
|
54
|
-
import { useState, useEffect
|
|
14
|
+
import { useState, useEffect, useCallback, useRef } from "react";
|
|
55
15
|
function useEntity(id, options = {}) {
|
|
56
16
|
const client = useTrellis();
|
|
57
17
|
const [data, setData] = useState(null);
|
|
@@ -74,12 +34,11 @@ function useEntity(id, options = {}) {
|
|
|
74
34
|
setLoading(false);
|
|
75
35
|
}
|
|
76
36
|
}, [client, id]);
|
|
77
|
-
|
|
37
|
+
useEffect(() => {
|
|
78
38
|
fetch();
|
|
79
39
|
}, [fetch]);
|
|
80
|
-
|
|
81
|
-
if (!options.pollInterval || !id)
|
|
82
|
-
return;
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!options.pollInterval || !id) return;
|
|
83
42
|
const interval = setInterval(fetch, options.pollInterval);
|
|
84
43
|
return () => clearInterval(interval);
|
|
85
44
|
}, [fetch, options.pollInterval, id]);
|
|
@@ -109,12 +68,11 @@ function useEntities(options = {}) {
|
|
|
109
68
|
setLoading(false);
|
|
110
69
|
}
|
|
111
70
|
}, [client, options.type, options.limit, options.offset]);
|
|
112
|
-
|
|
71
|
+
useEffect(() => {
|
|
113
72
|
fetch();
|
|
114
73
|
}, [fetch]);
|
|
115
|
-
|
|
116
|
-
if (!options.pollInterval)
|
|
117
|
-
return;
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!options.pollInterval) return;
|
|
118
76
|
const interval = setInterval(fetch, options.pollInterval);
|
|
119
77
|
return () => clearInterval(interval);
|
|
120
78
|
}, [fetch, options.pollInterval]);
|
|
@@ -127,8 +85,7 @@ function useQuery(eql, options = {}) {
|
|
|
127
85
|
const [error, setError] = useState(null);
|
|
128
86
|
const enabled = options.enabled !== false;
|
|
129
87
|
const refetch = useCallback(async () => {
|
|
130
|
-
if (!enabled || !eql.trim())
|
|
131
|
-
return;
|
|
88
|
+
if (!enabled || !eql.trim()) return;
|
|
132
89
|
try {
|
|
133
90
|
setLoading(true);
|
|
134
91
|
const result = await client.query(eql);
|
|
@@ -140,7 +97,7 @@ function useQuery(eql, options = {}) {
|
|
|
140
97
|
setLoading(false);
|
|
141
98
|
}
|
|
142
99
|
}, [client, eql, enabled]);
|
|
143
|
-
|
|
100
|
+
useEffect(() => {
|
|
144
101
|
if (!enabled || !eql.trim()) {
|
|
145
102
|
setData([]);
|
|
146
103
|
setLoading(false);
|
|
@@ -175,16 +132,28 @@ function useMutation() {
|
|
|
175
132
|
setLoading(false);
|
|
176
133
|
}
|
|
177
134
|
}
|
|
178
|
-
const create = useCallback(
|
|
179
|
-
|
|
180
|
-
|
|
135
|
+
const create = useCallback(
|
|
136
|
+
(type, attributes = {}) => run(() => client.create(type, attributes)),
|
|
137
|
+
[client]
|
|
138
|
+
);
|
|
139
|
+
const update = useCallback(
|
|
140
|
+
(id, attributes) => run(() => client.update(id, attributes)),
|
|
141
|
+
[client]
|
|
142
|
+
);
|
|
143
|
+
const remove = useCallback(
|
|
144
|
+
(id) => run(() => client.delete(id)),
|
|
145
|
+
[client]
|
|
146
|
+
);
|
|
181
147
|
return { create, update, remove, loading, error };
|
|
182
148
|
}
|
|
183
149
|
export {
|
|
184
|
-
|
|
185
|
-
useQuery,
|
|
186
|
-
useMutation,
|
|
187
|
-
useEntity,
|
|
150
|
+
TrellisProvider,
|
|
188
151
|
useEntities,
|
|
189
|
-
|
|
152
|
+
useEntity,
|
|
153
|
+
useMutation,
|
|
154
|
+
usePresence,
|
|
155
|
+
useQuery,
|
|
156
|
+
useRoom,
|
|
157
|
+
useSignal,
|
|
158
|
+
useTrellis
|
|
190
159
|
};
|