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,224 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TrellisVcsEngine,
|
|
3
|
+
init_engine
|
|
4
|
+
} from "./chunk-YY3GF7DH.js";
|
|
5
|
+
import "./chunk-4XIVMVHC.js";
|
|
6
|
+
import "./chunk-B3ZIFA2O.js";
|
|
7
|
+
import "./chunk-36VSSTL7.js";
|
|
8
|
+
import "./chunk-BXSTJVE3.js";
|
|
9
|
+
import "./chunk-GLM4HGN4.js";
|
|
10
|
+
import "./chunk-KFQGP6VL.js";
|
|
11
|
+
|
|
12
|
+
// src/federation/remote-manager.ts
|
|
13
|
+
init_engine();
|
|
14
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
15
|
+
import { join, resolve } from "path";
|
|
16
|
+
var RemoteManager = class {
|
|
17
|
+
trellisPath;
|
|
18
|
+
remotesPath;
|
|
19
|
+
constructor(trellisPath) {
|
|
20
|
+
this.trellisPath = trellisPath;
|
|
21
|
+
this.remotesPath = join(trellisPath, "remotes.json");
|
|
22
|
+
}
|
|
23
|
+
/** Load remotes configuration */
|
|
24
|
+
loadRemotes() {
|
|
25
|
+
if (!existsSync(this.remotesPath)) {
|
|
26
|
+
return { remotes: {} };
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const content = readFileSync(this.remotesPath, "utf8");
|
|
30
|
+
return JSON.parse(content);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw new Error(`Failed to load remotes config: ${error}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Save remotes configuration */
|
|
36
|
+
saveRemotes(config) {
|
|
37
|
+
try {
|
|
38
|
+
if (!existsSync(this.trellisPath)) {
|
|
39
|
+
mkdirSync(this.trellisPath, { recursive: true });
|
|
40
|
+
}
|
|
41
|
+
writeFileSync(this.remotesPath, JSON.stringify(config, null, 2), "utf8");
|
|
42
|
+
} catch (error) {
|
|
43
|
+
throw new Error(`Failed to save remotes config: ${error}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Add a new remote */
|
|
47
|
+
addRemote(name, path) {
|
|
48
|
+
const config = this.loadRemotes();
|
|
49
|
+
if (config.remotes[name]) {
|
|
50
|
+
throw new Error(`Remote '${name}' already exists`);
|
|
51
|
+
}
|
|
52
|
+
const resolvedPath = resolve(path);
|
|
53
|
+
if (!TrellisVcsEngine.isRepo(resolvedPath)) {
|
|
54
|
+
throw new Error(`Not a TrellisVCS repository: ${resolvedPath}`);
|
|
55
|
+
}
|
|
56
|
+
config.remotes[name] = {
|
|
57
|
+
name,
|
|
58
|
+
path: resolvedPath
|
|
59
|
+
};
|
|
60
|
+
this.saveRemotes(config);
|
|
61
|
+
}
|
|
62
|
+
/** Remove a remote */
|
|
63
|
+
removeRemote(name) {
|
|
64
|
+
const config = this.loadRemotes();
|
|
65
|
+
if (!config.remotes[name]) {
|
|
66
|
+
throw new Error(`Remote '${name}' not found`);
|
|
67
|
+
}
|
|
68
|
+
delete config.remotes[name];
|
|
69
|
+
this.saveRemotes(config);
|
|
70
|
+
}
|
|
71
|
+
/** List all remotes */
|
|
72
|
+
listRemotes() {
|
|
73
|
+
const config = this.loadRemotes();
|
|
74
|
+
return Object.values(config.remotes);
|
|
75
|
+
}
|
|
76
|
+
/** Pull new ops from a specific remote */
|
|
77
|
+
async pullRemote(remoteName, localEngine) {
|
|
78
|
+
const startTime = Date.now();
|
|
79
|
+
const config = this.loadRemotes();
|
|
80
|
+
const remote = config.remotes[remoteName];
|
|
81
|
+
if (!remote) {
|
|
82
|
+
throw new Error(`Remote '${remoteName}' not found`);
|
|
83
|
+
}
|
|
84
|
+
const errors = [];
|
|
85
|
+
let newOps = 0;
|
|
86
|
+
let latestOpId = remote.lastOpId || "";
|
|
87
|
+
try {
|
|
88
|
+
const remoteEngine = new TrellisVcsEngine({ rootPath: remote.path });
|
|
89
|
+
remoteEngine.open();
|
|
90
|
+
const remoteOps = remoteEngine.getOps();
|
|
91
|
+
if (remoteOps.length === 0) {
|
|
92
|
+
return {
|
|
93
|
+
remote: remoteName,
|
|
94
|
+
newOps: 0,
|
|
95
|
+
latestOpId: "",
|
|
96
|
+
durationMs: Date.now() - startTime,
|
|
97
|
+
errors: []
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const lastOpHash = remote.lastOpId;
|
|
101
|
+
let startIndex = 0;
|
|
102
|
+
if (lastOpHash) {
|
|
103
|
+
startIndex = remoteOps.findIndex((op) => op.hash === lastOpHash);
|
|
104
|
+
if (startIndex === -1) {
|
|
105
|
+
startIndex = 0;
|
|
106
|
+
errors.push(
|
|
107
|
+
`Last op hash ${lastOpHash} not found in remote, pulling all ops`
|
|
108
|
+
);
|
|
109
|
+
} else {
|
|
110
|
+
startIndex++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const opsToPull = remoteOps.slice(startIndex);
|
|
114
|
+
if (opsToPull.length > 0) {
|
|
115
|
+
const prefixedOps = opsToPull.map(
|
|
116
|
+
(op) => this.prefixOpEntities(op, remoteName)
|
|
117
|
+
);
|
|
118
|
+
for (const op of prefixedOps) {
|
|
119
|
+
localEngine.opLog.append(op);
|
|
120
|
+
newOps++;
|
|
121
|
+
}
|
|
122
|
+
latestOpId = remoteOps[remoteOps.length - 1].hash;
|
|
123
|
+
}
|
|
124
|
+
remote.lastOpId = latestOpId;
|
|
125
|
+
remote.pulledAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
126
|
+
this.saveRemotes(config);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
errors.push(`Failed to pull from remote: ${error}`);
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
remote: remoteName,
|
|
132
|
+
newOps,
|
|
133
|
+
latestOpId,
|
|
134
|
+
durationMs: Date.now() - startTime,
|
|
135
|
+
errors
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Pull from all configured remotes */
|
|
139
|
+
async pullAll(localEngine) {
|
|
140
|
+
const config = this.loadRemotes();
|
|
141
|
+
const remoteNames = Object.keys(config.remotes);
|
|
142
|
+
if (remoteNames.length === 0) {
|
|
143
|
+
return {
|
|
144
|
+
results: [],
|
|
145
|
+
totalNewOps: 0,
|
|
146
|
+
totalDurationMs: 0
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const startTime = Date.now();
|
|
150
|
+
const results = [];
|
|
151
|
+
let totalNewOps = 0;
|
|
152
|
+
for (const remoteName of remoteNames) {
|
|
153
|
+
try {
|
|
154
|
+
const result = await this.pullRemote(remoteName, localEngine);
|
|
155
|
+
results.push(result);
|
|
156
|
+
totalNewOps += result.newOps;
|
|
157
|
+
} catch (error) {
|
|
158
|
+
results.push({
|
|
159
|
+
remote: remoteName,
|
|
160
|
+
newOps: 0,
|
|
161
|
+
latestOpId: "",
|
|
162
|
+
durationMs: 0,
|
|
163
|
+
errors: [`Failed to pull: ${error}`]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
results,
|
|
169
|
+
totalNewOps,
|
|
170
|
+
totalDurationMs: Date.now() - startTime
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/** Prefix entity IDs in operations with remote name */
|
|
174
|
+
prefixOpEntities(op, remoteName) {
|
|
175
|
+
const prefixed = { ...op };
|
|
176
|
+
if (op.vcs) {
|
|
177
|
+
const vcs = { ...op.vcs };
|
|
178
|
+
if (vcs.issueId && !vcs.issueId.includes(":")) {
|
|
179
|
+
vcs.issueId = `${remoteName}:${vcs.issueId}`;
|
|
180
|
+
}
|
|
181
|
+
if (vcs.parentIssueId && !vcs.parentIssueId.includes(":")) {
|
|
182
|
+
vcs.parentIssueId = `${remoteName}:${vcs.parentIssueId}`;
|
|
183
|
+
}
|
|
184
|
+
if (vcs.blockedByIssueId && !vcs.blockedByIssueId.includes(":")) {
|
|
185
|
+
vcs.blockedByIssueId = `${remoteName}:${vcs.blockedByIssueId}`;
|
|
186
|
+
}
|
|
187
|
+
if (vcs.decisionId && !vcs.decisionId.includes(":")) {
|
|
188
|
+
vcs.decisionId = `${remoteName}:${vcs.decisionId}`;
|
|
189
|
+
}
|
|
190
|
+
prefixed.vcs = vcs;
|
|
191
|
+
}
|
|
192
|
+
if (op.facts) {
|
|
193
|
+
prefixed.facts = op.facts.map((fact) => {
|
|
194
|
+
if (fact.e === "entity" && fact.a === "id" && typeof fact.v === "string" && !fact.v.includes(":")) {
|
|
195
|
+
return { ...fact, v: `${remoteName}:${fact.v}` };
|
|
196
|
+
}
|
|
197
|
+
if (fact.e === "entity" && fact.a === "from" && typeof fact.v === "string" && !fact.v.includes(":")) {
|
|
198
|
+
return { ...fact, v: `${remoteName}:${fact.v}` };
|
|
199
|
+
}
|
|
200
|
+
if (fact.e === "entity" && fact.a === "to" && typeof fact.v === "string" && !fact.v.includes(":")) {
|
|
201
|
+
return { ...fact, v: `${remoteName}:${fact.v}` };
|
|
202
|
+
}
|
|
203
|
+
return fact;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (op.links) {
|
|
207
|
+
prefixed.links = op.links.map((link) => ({
|
|
208
|
+
...link,
|
|
209
|
+
e1: link.e1.includes(":") ? link.e1 : `${remoteName}:${link.e1}`,
|
|
210
|
+
e2: link.e2.includes(":") ? link.e2 : `${remoteName}:${link.e2}`
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
if (!prefixed.facts) prefixed.facts = [];
|
|
214
|
+
prefixed.facts.push({
|
|
215
|
+
e: "op",
|
|
216
|
+
a: "remote",
|
|
217
|
+
v: remoteName
|
|
218
|
+
});
|
|
219
|
+
return prefixed;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
export {
|
|
223
|
+
RemoteManager
|
|
224
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/scaffold/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/scaffold/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMhD,MAAM,WAAW,mBAAm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
* Trellis Schema — typed entity definitions over the ontology.
|
|
3
|
+
*
|
|
4
|
+
* `defineType` is the Trellis answer to Jazz's `co.map`: one definition produces
|
|
5
|
+
* BOTH a runtime {@link SchemaDefinition} (registerable in the kernel via
|
|
6
|
+
* `createOntology`) AND a static TypeScript type via {@link InferType}. Zod
|
|
7
|
+
* handles leaf validation + inference; a second options bag handles the graph
|
|
8
|
+
* semantics Zod can't express — relation cardinality, rollups, formulas, tier.
|
|
9
|
+
*
|
|
10
|
+
* This deliberately targets `SchemaDefinition` (the live kernel path consumed by
|
|
11
|
+
* schema/rollup middleware), not the legacy `OntologySchema` registry — see
|
|
12
|
+
* {@link TrellisType.toOntologySchema} for the legacy adapter.
|
|
13
|
+
*
|
|
14
|
+
* import { defineType, rel } from 'trellis/schema';
|
|
15
|
+
* import { z } from 'zod';
|
|
16
|
+
*
|
|
17
|
+
* const NavItem = defineType('NavItem', {
|
|
18
|
+
* label: z.string(),
|
|
19
|
+
* icon: z.string().optional(),
|
|
20
|
+
* order: z.number(),
|
|
21
|
+
* }, { title: 'label' });
|
|
22
|
+
*
|
|
23
|
+
* const NavSection = defineType('NavSection', {
|
|
24
|
+
* label: z.string(),
|
|
25
|
+
* order: z.number(),
|
|
26
|
+
* collapsed: z.boolean(),
|
|
27
|
+
* }, { title: 'label', relations: { items: rel(() => NavItem, 'many') } });
|
|
28
|
+
*
|
|
29
|
+
* type Section = InferType<typeof NavSection>;
|
|
30
|
+
* // { id: string; type: 'NavSection'; label: string; order: number;
|
|
31
|
+
* // collapsed: boolean; items: Ref<typeof NavItem>[] }
|
|
32
|
+
*
|
|
33
|
+
* @module trellis/schema
|
|
34
|
+
*/
|
|
35
|
+
import { z } from 'zod';
|
|
36
|
+
import type { OntologySchema, OntologyTier, PropertyType, PropertyValueSpecification, SchemaDefinition } from '../core/ontology/types.js';
|
|
37
|
+
/**
|
|
38
|
+
* A reference to another entity. Unresolved it is the target's id (a `string`);
|
|
39
|
+
* a future `resolve` option swaps it for the loaded {@link InferType} value.
|
|
40
|
+
*/
|
|
41
|
+
export type Ref<S extends AnyType = AnyType> = string & {
|
|
42
|
+
readonly __ref?: S;
|
|
43
|
+
};
|
|
44
|
+
export type RelTarget<S extends AnyType> = (() => S) | string;
|
|
45
|
+
export interface Relation<S extends AnyType, C extends 'one' | 'many'> {
|
|
46
|
+
readonly target: RelTarget<S>;
|
|
47
|
+
readonly cardinality: C;
|
|
48
|
+
}
|
|
49
|
+
/** Declare a relation field. Target may be a thunk (define-order safe) or a name. */
|
|
50
|
+
export declare function rel<S extends AnyType, C extends 'one' | 'many' = 'one'>(target: RelTarget<S>, cardinality?: C): Relation<S, C>;
|
|
51
|
+
export type RelationMap = Record<string, Relation<AnyType, 'one' | 'many'>>;
|
|
52
|
+
export interface ComputedField {
|
|
53
|
+
readonly spec: Partial<PropertyValueSpecification> & {
|
|
54
|
+
valueType: PropertyType;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export type ComputedMap = Record<string, ComputedField>;
|
|
58
|
+
/** Declare a rollup over a relation (e.g. count of linked items). */
|
|
59
|
+
export declare function rollup(cfg: NonNullable<PropertyValueSpecification['rollup']>): ComputedField;
|
|
60
|
+
/** Declare a formula field. */
|
|
61
|
+
export declare function formula(expr: string): ComputedField;
|
|
62
|
+
export interface TrellisType<Name extends string, Z extends z.ZodRawShape, R extends RelationMap, C extends ComputedMap> {
|
|
63
|
+
readonly type: Name;
|
|
64
|
+
/** Leaf validator (does not include relations/computed). */
|
|
65
|
+
readonly zod: z.ZodObject<Z>;
|
|
66
|
+
readonly relations: R;
|
|
67
|
+
readonly computed: C;
|
|
68
|
+
/** Kernel-facing schema, keyed by `@id` = `trellis:<Name>`. */
|
|
69
|
+
readonly definition: SchemaDefinition;
|
|
70
|
+
/** Adapter to the legacy OntologyRegistry (relation resolution only). */
|
|
71
|
+
toOntologySchema(): OntologySchema;
|
|
72
|
+
}
|
|
73
|
+
export type AnyType = TrellisType<string, z.ZodRawShape, RelationMap, ComputedMap>;
|
|
74
|
+
type RelValue<X> = X extends Relation<infer S, infer C> ? C extends 'many' ? Ref<S>[] : Ref<S> : never;
|
|
75
|
+
export type InferType<T> = T extends TrellisType<infer Name, infer Z, infer R, infer C> ? {
|
|
76
|
+
id: string;
|
|
77
|
+
type: Name;
|
|
78
|
+
} & z.infer<z.ZodObject<Z>> & {
|
|
79
|
+
[K in keyof R]: RelValue<R[K]>;
|
|
80
|
+
} & {
|
|
81
|
+
readonly [K in keyof C]: number;
|
|
82
|
+
} : never;
|
|
83
|
+
/** Target entity schema of a relation field. */
|
|
84
|
+
type RelationTarget<R> = R extends Relation<infer S, 'one' | 'many'> ? S : never;
|
|
85
|
+
/**
|
|
86
|
+
* Typed `resolve` spec for {@link InferResolvedType} — mirrors runtime
|
|
87
|
+
* {@link import('./resolve.js').ResolveSpec} but keyed to declared relations.
|
|
88
|
+
*
|
|
89
|
+
* `{ items: true }` — expand `items` to full entities.
|
|
90
|
+
* `{ items: { section: true } }` — expand `items`, then each item's `section`.
|
|
91
|
+
*/
|
|
92
|
+
export type ResolveSpecFor<T extends AnyType> = {
|
|
93
|
+
[K in keyof T['relations'] & string]?: true | ResolveSpecFor<RelationTarget<T['relations'][K]>>;
|
|
94
|
+
};
|
|
95
|
+
/** Expand one relation key according to a resolve spec entry (`true` or nested). */
|
|
96
|
+
type ApplyResolve<Field extends Relation<AnyType, 'one' | 'many'>, Spec> = Field extends Relation<infer S, infer C> ? [Spec] extends [true] ? C extends 'many' ? InferType<S>[] : InferType<S> : Spec extends ResolveSpecFor<S> ? C extends 'many' ? InferResolvedType<S, Spec>[] : InferResolvedType<S, Spec> : RelValue<Field> : never;
|
|
97
|
+
/**
|
|
98
|
+
* Like {@link InferType}, but relation keys in `resolve` are expanded entity
|
|
99
|
+
* shapes instead of `Ref` ids. Nested objects recurse (TRL-4).
|
|
100
|
+
*/
|
|
101
|
+
export type InferResolvedType<T extends AnyType, R extends ResolveSpecFor<T>> = T extends TrellisType<infer Name, infer Z, infer Rel, infer C> ? {
|
|
102
|
+
id: string;
|
|
103
|
+
type: Name;
|
|
104
|
+
} & z.infer<z.ZodObject<Z>> & {
|
|
105
|
+
[K in keyof Rel]: K extends keyof R ? ApplyResolve<Rel[K], R[K]> : RelValue<Rel[K]>;
|
|
106
|
+
} & {
|
|
107
|
+
readonly [K in keyof C]: number;
|
|
108
|
+
} : never;
|
|
109
|
+
/**
|
|
110
|
+
* Infer the entity array shape returned by typed live reads (`useEntities`,
|
|
111
|
+
* `entitiesStore`) from optional read options.
|
|
112
|
+
*/
|
|
113
|
+
export type InferEntitiesRead<S extends AnyType, O> = O extends {
|
|
114
|
+
resolve: infer R;
|
|
115
|
+
} ? R extends ResolveSpecFor<S> ? InferResolvedType<S, R>[] : InferType<S>[] : InferType<S>[];
|
|
116
|
+
/**
|
|
117
|
+
* Infer the entity shape returned by typed single-entity reads (`useEntity`,
|
|
118
|
+
* `entityStore`) from optional read options.
|
|
119
|
+
*/
|
|
120
|
+
export type InferEntityRead<S extends AnyType, O> = O extends {
|
|
121
|
+
resolve: infer R;
|
|
122
|
+
} ? R extends ResolveSpecFor<S> ? InferResolvedType<S, R> | null : InferType<S> | null : InferType<S> | null;
|
|
123
|
+
export interface DefineTypeOptions<Z extends z.ZodRawShape, R extends RelationMap, C extends ComputedMap> {
|
|
124
|
+
/** Which leaf key is the entity's `title` property. */
|
|
125
|
+
title?: Extract<keyof Z, string>;
|
|
126
|
+
relations?: R;
|
|
127
|
+
computed?: C;
|
|
128
|
+
/** Defaults to 'user'. Core/system are reserved for shipped schemas. */
|
|
129
|
+
tier?: OntologyTier;
|
|
130
|
+
version?: string;
|
|
131
|
+
/** Parent type name (`subClassOf`). */
|
|
132
|
+
extends?: string;
|
|
133
|
+
label?: string;
|
|
134
|
+
}
|
|
135
|
+
export declare function defineType<Name extends string, Z extends z.ZodRawShape, R extends RelationMap = Record<never, never>, C extends ComputedMap = Record<never, never>>(type: Name, shape: Z, opts?: DefineTypeOptions<Z, R, C>): TrellisType<Name,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AC,CAAC,CAAC,GAAG,IAAI,GACrB,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAMxB,MAAM,WAAW,iBAAiB,CAChC,CAAC,SAAS,CAAC,CAAC,WAAW,EACvB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,WAAW;IAErB,uDAAuD;IACvD,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,wEAAwE;IACxE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,UAAU,CACxB,IAAI,SAAS,MAAM,EACnB,CAAC,SAAS,CAAC,CAAC,WAAW,EACvB,CAAC,SAAS,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC5C,CAAC,SAAS,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAE5C,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,EACR,IAAI,GAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAM,GACpC,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAgC5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity projection — sparse EQL bindings ↔ plain entity records.
|
|
3
|
+
*
|
|
4
|
+
* Shared by the realtime subscription path (server hydrates before push) and
|
|
5
|
+
* the client read layer (skips `read()` when rows are already full entities).
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/schema
|
|
8
|
+
*/
|
|
9
|
+
import type { EntityData } from '../client/sdk.js';
|
|
10
|
+
/** Minimal kernel surface for hydration. */
|
|
11
|
+
export interface EntityReader {
|
|
12
|
+
getEntity(id: string): EntityRecordLike | null;
|
|
13
|
+
}
|
|
14
|
+
export interface EntityRecordLike {
|
|
15
|
+
id: string;
|
|
16
|
+
type: string;
|
|
17
|
+
facts: Array<{
|
|
18
|
+
a: string;
|
|
19
|
+
v: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export declare function entityRecordToPlain(entity: EntityRecordLike): EntityData;
|
|
23
|
+
/** Extract an entity id from a query binding row. */
|
|
24
|
+
export declare function bindingEntityId(row: Record<string, unknown>): string | null;
|
|
25
|
+
/** True when the row is a sparse `{ e: id }` trigger, not a hydrated entity. */
|
|
26
|
+
export declare function isSparseBinding(row: Record<string, unknown>): boolean;
|
|
27
|
+
/** Normalize a binding row to {@link EntityData} (hydrated or sparse+partial). */
|
|
28
|
+
export declare function bindingToEntity(row: Record<string, unknown>): EntityData;
|
|
29
|
+
/**
|
|
30
|
+
* Hydrate sparse subscription bindings to full entity records via the kernel.
|
|
31
|
+
* Already-hydrated rows pass through unchanged.
|
|
32
|
+
*/
|
|
33
|
+
export declare function hydrateBindings(kernel: EntityReader, bindings: Record<string, unknown>[]): EntityData[];
|
|
34
|
+
//# sourceMappingURL=entity-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-projection.d.ts","sourceRoot":"","sources":["../../src/schema/entity-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACzC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAMxE;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAG3E;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAIrE;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAOxE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAClC,UAAU,EAAE,CAOd"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EQL-S query builders shared by every typed read adapter (React/Vue/Svelte).
|
|
3
|
+
*
|
|
4
|
+
* Centralised so filter encoding has one home — typed reads, live subscriptions,
|
|
5
|
+
* and HTTP `/query` all share the same `find ?e where …` shape.
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/schema
|
|
8
|
+
*/
|
|
9
|
+
/** Escape a value for inclusion in a double-quoted EQL literal. */
|
|
10
|
+
export declare function escapeValue(v: string): string;
|
|
11
|
+
/** Comparison operators supported by {@link parseSimple}. */
|
|
12
|
+
export type WhereOp = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith';
|
|
13
|
+
/** Structured filter for one attribute (TRL-7). */
|
|
14
|
+
export type WhereFilter = {
|
|
15
|
+
eq?: unknown;
|
|
16
|
+
ne?: unknown;
|
|
17
|
+
lt?: number | string;
|
|
18
|
+
lte?: number | string;
|
|
19
|
+
gt?: number | string;
|
|
20
|
+
gte?: number | string;
|
|
21
|
+
contains?: string;
|
|
22
|
+
startsWith?: string;
|
|
23
|
+
endsWith?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Equality shorthand or a {@link WhereFilter} object. */
|
|
26
|
+
export type WhereValue = unknown | WhereFilter;
|
|
27
|
+
export declare function isWhereFilter(value: unknown): value is WhereFilter;
|
|
28
|
+
/** Format a JS value as an EQL-S literal (quoted string, bare number, or boolean). */
|
|
29
|
+
export declare function formatEqlLiteral(value: unknown): string;
|
|
30
|
+
/**
|
|
31
|
+
* One `attr op value` fragment for `find ?e where …`.
|
|
32
|
+
* Throws when a filter object specifies more than one operator.
|
|
33
|
+
*/
|
|
34
|
+
export declare function whereCondition(attr: string, value: WhereValue): string;
|
|
35
|
+
export type WhereInput = Record<string, WhereValue>;
|
|
36
|
+
/**
|
|
37
|
+
* `find ?e where type = "<Type>" [and <k> <op> <v> …]` — entities of a type,
|
|
38
|
+
* optionally narrowed by attribute filters (ANDed).
|
|
39
|
+
*/
|
|
40
|
+
export declare function entitiesQuery(type: string, where?: WhereInput): string;
|
|
41
|
+
/**
|
|
42
|
+
* Single-entity live subscription query (TRL-9).
|
|
43
|
+
* Narrows the type pattern to one entity id — avoids full-type fan-out on the wire.
|
|
44
|
+
*/
|
|
45
|
+
export declare function entityQuery(type: string, entityId: string): string;
|
|
46
|
+
//# sourceMappingURL=eql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eql.d.ts","sourceRoot":"","sources":["../../src/schema/eql.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,6DAA6D;AAC7D,MAAM,MAAM,OAAO,GACf,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,UAAU,GACV,YAAY,GACZ,UAAU,CAAC;AAEf,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,WAAW,CAAC;AAc/C,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAOlE;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQvD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAiBtE;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAOtE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIlE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trellis Schema — Public API Surface
|
|
3
|
+
*
|
|
4
|
+
* Typed entity definitions (`defineType`) that emit a kernel `SchemaDefinition`
|
|
5
|
+
* and a static TS type. Import from `trellis/schema`:
|
|
6
|
+
*
|
|
7
|
+
* import { defineType, rel, type InferType } from 'trellis/schema';
|
|
8
|
+
*
|
|
9
|
+
* @module trellis/schema
|
|
10
|
+
*/
|
|
11
|
+
export { defineType, rel, rollup, formula, } from './define.js';
|
|
12
|
+
export type { AnyType, ComputedField, ComputedMap, DefineTypeOptions, InferEntitiesRead, InferEntityRead, InferType, InferResolvedType, Ref, Relation, RelationMap, RelTarget, ResolveSpecFor, TrellisType, } from './define.js';
|
|
13
|
+
export { entitiesQuery, entityQuery, escapeValue, formatEqlLiteral, isWhereFilter, whereCondition, } from './eql.js';
|
|
14
|
+
export type { WhereFilter, WhereInput, WhereOp, WhereValue } from './eql.js';
|
|
15
|
+
export { entityMutations } from './mutations.js';
|
|
16
|
+
export type { EntityMutations } from './mutations.js';
|
|
17
|
+
export { resolveRelations, inverseForeignKey } from './resolve.js';
|
|
18
|
+
export type { ResolveSpec } from './resolve.js';
|
|
19
|
+
export { bindingEntityId, bindingToEntity, entityRecordToPlain, hydrateBindings, isSparseBinding, } from './entity-projection.js';
|
|
20
|
+
export type { EntityReader, EntityRecordLike } from './entity-projection.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,UAAU,EACV,GAAG,EACH,MAAM,EACN,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,OAAO,EACP,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineType,
|
|
3
|
+
formula,
|
|
4
|
+
rel,
|
|
5
|
+
rollup
|
|
6
|
+
} from "../chunk-44FFQKQX.js";
|
|
7
|
+
import {
|
|
8
|
+
entityMutations
|
|
9
|
+
} from "../chunk-USEINYUL.js";
|
|
10
|
+
import {
|
|
11
|
+
bindingEntityId,
|
|
12
|
+
bindingToEntity,
|
|
13
|
+
entitiesQuery,
|
|
14
|
+
entityQuery,
|
|
15
|
+
entityRecordToPlain,
|
|
16
|
+
escapeValue,
|
|
17
|
+
formatEqlLiteral,
|
|
18
|
+
hydrateBindings,
|
|
19
|
+
inverseForeignKey,
|
|
20
|
+
isSparseBinding,
|
|
21
|
+
isWhereFilter,
|
|
22
|
+
resolveRelations,
|
|
23
|
+
whereCondition
|
|
24
|
+
} from "../chunk-JUEMDWLU.js";
|
|
25
|
+
import "../chunk-KFQGP6VL.js";
|
|
26
|
+
export {
|
|
27
|
+
bindingEntityId,
|
|
28
|
+
bindingToEntity,
|
|
29
|
+
defineType,
|
|
30
|
+
entitiesQuery,
|
|
31
|
+
entityMutations,
|
|
32
|
+
entityQuery,
|
|
33
|
+
entityRecordToPlain,
|
|
34
|
+
escapeValue,
|
|
35
|
+
formatEqlLiteral,
|
|
36
|
+
formula,
|
|
37
|
+
hydrateBindings,
|
|
38
|
+
inverseForeignKey,
|
|
39
|
+
isSparseBinding,
|
|
40
|
+
isWhereFilter,
|
|
41
|
+
rel,
|
|
42
|
+
resolveRelations,
|
|
43
|
+
rollup,
|
|
44
|
+
whereCondition
|
|
45
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TrellisKernel } from '../core/kernel/trellis-kernel.js';
|
|
2
|
+
import type { SchemaDefinition } from '../core/ontology/types.js';
|
|
3
|
+
import type { EntityData } from '../client/sdk.js';
|
|
4
|
+
import type { RelationResolveClient } from './resolve.js';
|
|
5
|
+
import { type AnyType } from './define.js';
|
|
6
|
+
import { type ResolveSpec } from './resolve.js';
|
|
7
|
+
/** Short name from `trellis:NavSection` → `NavSection`. */
|
|
8
|
+
export declare function ontologyTypeName(id: string): string;
|
|
9
|
+
/** Find a registered ontology schema by entity `type` fact value. */
|
|
10
|
+
export declare function findOntologyByTypeName(kernel: TrellisKernel, typeName: string): SchemaDefinition | undefined;
|
|
11
|
+
/** Build a minimal {@link AnyType} handle from a kernel ontology (for server resolve). */
|
|
12
|
+
export declare function schemaHandleFromOntology(def: SchemaDefinition, typeName?: string): AnyType;
|
|
13
|
+
/** Lookup table for relation targets registered in the kernel. */
|
|
14
|
+
export declare function createSchemaLookup(kernel: TrellisKernel): (typeName: string) => AnyType | null;
|
|
15
|
+
/** {@link TrellisDb} surface backed by an in-process kernel (server resolve path). */
|
|
16
|
+
export declare function createKernelResolveClient(kernel: TrellisKernel): RelationResolveClient;
|
|
17
|
+
/**
|
|
18
|
+
* Hydrate query bindings and optionally expand relations before wire push.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hydrateAndResolve(kernel: TrellisKernel, bindings: Record<string, unknown>[], entityType?: string, resolve?: ResolveSpec): Promise<EntityData[]>;
|
|
21
|
+
//# sourceMappingURL=kernel-resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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Framework-agnostic, schema-typed mutations. The React `useMutation`, Vue
|
|
3
|
+
* `useMutation`, and Svelte mutation helper all delegate here so create/update
|
|
4
|
+
* payloads are checked against the schema in exactly one place.
|
|
5
|
+
*
|
|
6
|
+
* @module trellis/schema
|
|
7
|
+
*/
|
|
8
|
+
import type { TrellisDb } from '../client/sdk.js';
|
|
9
|
+
import type { AnyType, InferType } from './define.js';
|
|
10
|
+
export interface EntityMutations<E> {
|
|
11
|
+
/** Create an entity of this type. Returns the new id. */
|
|
12
|
+
create(attrs: Omit<E, 'id' | 'type'>): Promise<string>;
|
|
13
|
+
/** Patch an entity's attributes. */
|
|
14
|
+
update(id: string, attrs: Partial<Omit<E, 'id' | 'type'>>): Promise<void>;
|
|
15
|
+
/** Delete an entity by id. */
|
|
16
|
+
remove(id: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/** Bind create/update/remove for a schema to a client. */
|
|
19
|
+
export declare function entityMutations<S extends AnyType>(client: TrellisDb, schema: S): EntityMutations<InferType<S>>;
|
|
20
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/schema/mutations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,yDAAyD;IACzD,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,oCAAoC;IACpC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,8BAA8B;IAC9B,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,EAC/C,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,CAAC,GACR,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAQ/B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AnyType } from './define.js';
|
|
2
|
+
import type { EntityData, TrellisDb } from '../client/sdk.js';
|
|
3
|
+
/** Read/query surface used by relation expansion (client or in-process kernel). */
|
|
4
|
+
export type RelationResolveClient = Pick<TrellisDb, 'read' | 'query'>;
|
|
5
|
+
/**
|
|
6
|
+
* Runtime resolve map (loose keys). For static types use
|
|
7
|
+
* {@link import('./define.js').ResolveSpecFor}.
|
|
8
|
+
*/
|
|
9
|
+
export type ResolveSpec = {
|
|
10
|
+
[key: string]: boolean | ResolveSpec | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** Child attribute pointing at `parent` (inverse of a `many` relation). */
|
|
13
|
+
export declare function inverseForeignKey(parent: AnyType, relationName: string, child: AnyType): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Expand `resolve` relation keys on hydrated entities. Mutates rows in place.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveRelations(client: RelationResolveClient, schema: AnyType, entities: EntityData[], spec: ResolveSpec, opts?: {
|
|
18
|
+
copy?: boolean;
|
|
19
|
+
schemaLookup?: (typeName: string) => AnyType | null;
|
|
20
|
+
}): Promise<EntityData[]>;
|
|
21
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/schema/resolve.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D,mFAAmF;AACnF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;CAClD,CAAC;AAoBF,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,OAAO,EACf,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,IAAI,CAKf;AA4ED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,UAAU,EAAE,EACtB,IAAI,EAAE,WAAW,EACjB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAA;CAAE,GAC7E,OAAO,CAAC,UAAU,EAAE,CAAC,CA6DvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FetchError,
|
|
3
|
+
TrellisDb
|
|
4
|
+
} from "./chunk-IG2X2BVO.js";
|
|
5
|
+
import "./chunk-JA7AIHRK.js";
|
|
6
|
+
import "./chunk-OQNDWRDE.js";
|
|
7
|
+
import "./chunk-SPSPV5BC.js";
|
|
8
|
+
import "./chunk-XMQ7G77X.js";
|
|
9
|
+
import "./chunk-7KJ7T4D3.js";
|
|
10
|
+
import "./chunk-4XIVMVHC.js";
|
|
11
|
+
import "./chunk-6CTA6MCE.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
FetchError,
|
|
15
|
+
TrellisDb
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FetchError,
|
|
3
|
+
TrellisDb
|
|
4
|
+
} from "./chunk-QHA2DM3C.js";
|
|
5
|
+
import "./chunk-OQNDWRDE.js";
|
|
6
|
+
import "./chunk-JA7AIHRK.js";
|
|
7
|
+
import "./chunk-SPSPV5BC.js";
|
|
8
|
+
import "./chunk-XMQ7G77X.js";
|
|
9
|
+
import "./chunk-7KJ7T4D3.js";
|
|
10
|
+
import "./chunk-4XIVMVHC.js";
|
|
11
|
+
import "./chunk-6CTA6MCE.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
FetchError,
|
|
15
|
+
TrellisDb
|
|
16
|
+
};
|