@highstate/designer 0.19.1 → 0.20.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/.output/nitro.json +3 -3
- package/.output/public/_nuxt/57B6Rca8.js +1 -0
- package/.output/public/_nuxt/5X7smno1.js +1 -0
- package/.output/public/_nuxt/{Cp2bjttb.js → 83L43bj1.js} +1 -1
- package/.output/public/_nuxt/8MSfy8uY.js +1 -0
- package/.output/public/_nuxt/9I37tBe7.js +1 -0
- package/.output/public/_nuxt/Aopv2gwH.js +1 -0
- package/.output/public/_nuxt/B13uiJCv.js +1 -0
- package/.output/public/_nuxt/B7c-h3xW.js +1 -0
- package/.output/public/_nuxt/B8nw2aST.js +2 -0
- package/.output/public/_nuxt/{1DNp92w6.js → B93PlW-d.js} +1 -1
- package/.output/public/_nuxt/BA0jw7CM.js +1 -0
- package/.output/public/_nuxt/BBf5iR-q.js +1 -0
- package/.output/public/_nuxt/BCVaR2pQ.js +1 -0
- package/.output/public/_nuxt/BDAHnC4j.js +1 -0
- package/.output/public/_nuxt/BDa1f6PF.js +2 -0
- package/.output/public/_nuxt/{YB_1Ta41.js → BDs6uo3D.js} +1 -1
- package/.output/public/_nuxt/BEEt8Am7.js +1 -0
- package/.output/public/_nuxt/BE_Meo09.js +269 -0
- package/.output/public/_nuxt/BGHnOYBU.js +1 -0
- package/.output/public/_nuxt/BH7IYjvW.js +1 -0
- package/.output/public/_nuxt/BJDFO7_C.js +1 -0
- package/.output/public/_nuxt/BJK6uMxG.js +1 -0
- package/.output/public/_nuxt/BLF3u89x.js +1 -0
- package/.output/public/_nuxt/{Xi2tawMN.js → BLmx8bSh.js} +1 -1
- package/.output/public/_nuxt/{DlfHMoPT.js → BPQ3VLAy.js} +1 -1
- package/.output/public/_nuxt/BPcwi1q2.js +1 -0
- package/.output/public/_nuxt/{BBGuKPBd.js → BR5kRUq4.js} +1 -1
- package/.output/public/_nuxt/BTifaqeh.js +1 -0
- package/.output/public/_nuxt/BUNf2Yb8.js +1 -0
- package/.output/public/_nuxt/BUw7H-hv.js +1 -0
- package/.output/public/_nuxt/{DRprw4p4.js → BVQ-GDCI.js} +1 -1
- package/.output/public/_nuxt/{BbQj0Z2C.js → BYV0-3_D.js} +1 -1
- package/.output/public/_nuxt/BZvkOJ9d.js +1 -0
- package/.output/public/_nuxt/Ba13S78F.js +1 -0
- package/.output/public/_nuxt/BcVCzyr7.js +1 -0
- package/.output/public/_nuxt/BhRPY-oY.js +1 -0
- package/.output/public/_nuxt/{uMbE6_td.js → Bhrxn6JZ.js} +1 -1
- package/.output/public/_nuxt/BkNNRtnm.js +1 -0
- package/.output/public/_nuxt/BlfjmxyP.js +1 -0
- package/.output/public/_nuxt/Bmn6On1c.js +1 -0
- package/.output/public/_nuxt/Bo8jzlL1.js +18 -0
- package/.output/public/_nuxt/BpkvlDNi.js +1 -0
- package/.output/public/_nuxt/{BIAuTxu3.js → Br6cN0cg.js} +1 -1
- package/.output/public/_nuxt/{CUEJCptM.js → BrzmwbiE.js} +1 -1
- package/.output/public/_nuxt/{D32k8WzR.js → BtvRca6l.js} +1 -1
- package/.output/public/_nuxt/BuJgCY_C.js +1 -0
- package/.output/public/_nuxt/Bv_4Rxtq.js +1 -0
- package/.output/public/_nuxt/BvzEVeQv.js +1 -0
- package/.output/public/_nuxt/BxAss8Tj.js +1 -0
- package/.output/public/_nuxt/BxaP9l2T.js +1 -0
- package/.output/public/_nuxt/BxgE0vQu.js +1 -0
- package/.output/public/_nuxt/ByBNG4eo.js +1 -0
- package/.output/public/_nuxt/{COI20M4I.js → BzTr9Aqm.js} +1 -1
- package/.output/public/_nuxt/{CXu1NL6O.js → C-HG3fhB.js} +1 -1
- package/.output/public/_nuxt/C-sUppwS.js +1 -0
- package/.output/public/_nuxt/C1FLL1Qz.js +1 -0
- package/.output/public/_nuxt/C3Wv6jpd.js +1 -0
- package/.output/public/_nuxt/C47S-Tmv.js +1 -0
- package/.output/public/_nuxt/C4EeE6gA.js +1 -0
- package/.output/public/_nuxt/{C-Jbm3Hp.js → C4gqWexZ.js} +1 -1
- package/.output/public/_nuxt/{DTMYz4Jt.js → C5YyOfLZ.js} +1 -1
- package/.output/public/_nuxt/C7zT0LnQ.js +1 -0
- package/.output/public/_nuxt/C8lm7lgC.js +1 -0
- package/.output/public/_nuxt/C9dUb6Cb.js +1 -0
- package/.output/public/_nuxt/{DS1LvVMU.js → C9oPPf7i.js} +1 -1
- package/.output/public/_nuxt/{D1uDOp7C.js → CFHQjOhq.js} +1 -1
- package/.output/public/_nuxt/{Dtc2v4kS.js → CGscLIrv.js} +1 -1
- package/.output/public/_nuxt/{DKzvysjW.js → CH1njM8p.js} +1 -1
- package/.output/public/_nuxt/CJWmG4YP.js +12 -0
- package/.output/public/_nuxt/CLZrNe3w.js +1 -0
- package/.output/public/_nuxt/CMTm3GFP.js +1 -0
- package/.output/public/_nuxt/CMjwMIkn.js +1 -0
- package/.output/public/_nuxt/COcwbKMJ.js +1 -0
- package/.output/public/_nuxt/CPZSvMBB.js +1 -0
- package/.output/public/_nuxt/CPpO8vcZ.js +1 -0
- package/.output/public/_nuxt/CQ8jqdy-.js +1 -0
- package/.output/public/_nuxt/CV5MeYf9.js +1 -0
- package/.output/public/_nuxt/{CcyOm34o.js → CVdnzihN.js} +1 -1
- package/.output/public/_nuxt/CW8IKDeL.js +1 -0
- package/.output/public/_nuxt/{pkIJ47B4.js → CXZktZb0.js} +1 -1
- package/.output/public/_nuxt/CYsAdtH9.js +1 -0
- package/.output/public/_nuxt/{BUyGWigt.js → CZhp0h8q.js} +1 -1
- package/.output/public/_nuxt/CaJ-zn_Z.js +2 -0
- package/.output/public/_nuxt/CcOKGYBt.js +1 -0
- package/.output/public/_nuxt/{oTG82Wo1.js → CenWIFCC.js} +1 -1
- package/.output/public/_nuxt/ChaZkl1J.js +1 -0
- package/.output/public/_nuxt/CjoLj4QM.js +1 -0
- package/.output/public/_nuxt/{BtsDLbAf.js → Cl0AqbOI.js} +1 -1
- package/.output/public/_nuxt/Cm-2nZ05.js +1 -0
- package/.output/public/_nuxt/{DUSGQflk.js → Cm3UrAx6.js} +1 -1
- package/.output/public/_nuxt/{BGHREFWD.js → CmIQRyeF.js} +1 -1
- package/.output/public/_nuxt/{f7oK2omx.js → Cn7AkR1O.js} +1 -1
- package/.output/public/_nuxt/{JhPuU2gP.js → CnnebwVN.js} +1 -1
- package/.output/public/_nuxt/CnsnAmq5.js +1 -0
- package/.output/public/_nuxt/CoDkCxhg.js +1 -0
- package/.output/public/_nuxt/{B-hkwWGT.js → CpOuai2O.js} +1 -1
- package/.output/public/_nuxt/CudFwYib.js +1 -0
- package/.output/public/_nuxt/{BDzgwa52.js → CufHLc7y.js} +1 -1
- package/.output/public/_nuxt/CwoSXNpI.js +1 -0
- package/.output/public/_nuxt/CxEW7TG8.js +1 -0
- package/.output/public/_nuxt/CxLEBnE3.js +1 -0
- package/.output/public/_nuxt/{DNrj_gVY.js → CxbxFI8M.js} +1 -1
- package/.output/public/_nuxt/CzSiA7V6.js +1 -0
- package/.output/public/_nuxt/D-wGZMZP.js +1 -0
- package/.output/public/_nuxt/D27ZAKIj.js +1 -0
- package/.output/public/_nuxt/D2aToa54.js +1 -0
- package/.output/public/_nuxt/D2obegTF.js +1 -0
- package/.output/public/_nuxt/{NleAzG8P.js → D4_iv3hh.js} +1 -1
- package/.output/public/_nuxt/D53aC0YG.js +1 -0
- package/.output/public/_nuxt/D5z-4QVk.js +1 -0
- package/.output/public/_nuxt/D6fh7rEe.js +2 -0
- package/.output/public/_nuxt/D87Tk5Gz.js +1 -0
- package/.output/public/_nuxt/D8_7TLub.js +1 -0
- package/.output/public/_nuxt/D91rOou-.js +13 -0
- package/.output/public/_nuxt/DCBCRx0O.js +1 -0
- package/.output/public/_nuxt/DCR009rv.js +1 -0
- package/.output/public/_nuxt/DCinzvm1.js +1 -0
- package/.output/public/_nuxt/DEthMvLe.js +1 -0
- package/.output/public/_nuxt/DFWUc33u.js +1 -0
- package/.output/public/_nuxt/{5bLW0GMw.js → DGP4VlC8.js} +1 -1
- package/.output/public/_nuxt/{CnK8MTSM.js → DHQR4-dF.js} +1 -1
- package/.output/public/_nuxt/DJN0y8jO.js +1 -0
- package/.output/public/_nuxt/DJjDtW9f.js +1 -0
- package/.output/public/_nuxt/DKhcu7kD.js +1 -0
- package/.output/public/_nuxt/DMwsHuHA.js +1 -0
- package/.output/public/_nuxt/{GAB5JH5K.js → DNqd6Nek.js} +1 -1
- package/.output/public/_nuxt/DOMRsNpU.js +1 -0
- package/.output/public/_nuxt/DOPqH6_T.js +1 -0
- package/.output/public/_nuxt/DQHHT9y-.js +1 -0
- package/.output/public/_nuxt/{B5ZR69Tn.js → DQwYQDb2.js} +1 -1
- package/.output/public/_nuxt/DQyhUUbL.js +1 -0
- package/.output/public/_nuxt/DRfxs3PN.js +1 -0
- package/.output/public/_nuxt/{DPcUKYIF.js → DRw_LuNl.js} +1 -1
- package/.output/public/_nuxt/DV7GczEv.js +1 -0
- package/.output/public/_nuxt/DWQRqdcR.js +1 -0
- package/.output/public/_nuxt/DWa2aw6r.js +1 -0
- package/.output/public/_nuxt/DYoxhk2S.js +1 -0
- package/.output/public/_nuxt/DZf3V79B.js +1 -0
- package/.output/public/_nuxt/{BPzJO5Oe.js → DZu-aV2c.js} +1 -1
- package/.output/public/_nuxt/Dbwml2gB.js +1 -0
- package/.output/public/_nuxt/DfvKjH24.js +1 -0
- package/.output/public/_nuxt/{Cdx7mHEO.js → DhmSosst.js} +1 -1
- package/.output/public/_nuxt/DiTMzCP2.js +1 -0
- package/.output/public/_nuxt/{CA7CTBwS.js → Dph4kLrZ.js} +1 -1
- package/.output/public/_nuxt/DqQDbK_p.js +1 -0
- package/.output/public/_nuxt/DsS90Fp6.js +1 -0
- package/.output/public/_nuxt/Dspwwk_N.js +1 -0
- package/.output/public/_nuxt/DsumFeuD.js +1 -0
- package/.output/public/_nuxt/DxERyYWQ.js +1 -0
- package/.output/public/_nuxt/{D7ScPSBf.js → DxNHbxmM.js} +1 -1
- package/.output/public/_nuxt/{CLvts2aQ.js → DxSwrfjg.js} +1 -1
- package/.output/public/_nuxt/{DcmvOc98.js → DyMmfYiE.js} +1 -1
- package/.output/public/_nuxt/DzWdbJvx.js +1 -0
- package/.output/public/_nuxt/{COEtLSDF.js → Dzze3sRP.js} +1 -1
- package/.output/public/_nuxt/G13IRnB2.js +1 -0
- package/.output/public/_nuxt/GDxZ_Nvm.js +14 -0
- package/.output/public/_nuxt/GgtqCdye.js +1 -0
- package/.output/public/_nuxt/{DkhsQLT2.js → GsRaNv29.js} +1 -1
- package/.output/public/_nuxt/IF9eRakj.js +1 -0
- package/.output/public/_nuxt/RCBWmVHz.js +1 -0
- package/.output/public/_nuxt/{Cb0HU5_O.js → RNghxpo_.js} +1 -1
- package/.output/public/_nuxt/{SecretValueField.DcyO8gGc.css → SecretValueField.Dy80RlGP.css} +1 -1
- package/.output/public/_nuxt/{B8ROHVmM.js → TsXTqZ29.js} +1 -1
- package/.output/public/_nuxt/VCDPK7BO.js +1 -0
- package/.output/public/_nuxt/{CU27uY9n.js → W9tJ9s81.js} +1 -1
- package/.output/public/_nuxt/{CmALWFRB.js → XEA9GSJd.js} +16 -468
- package/.output/public/_nuxt/{DeWFVDHI.js → YqXBG_HV.js} +1 -1
- package/.output/public/_nuxt/ZbicA1ry.js +1 -0
- package/.output/public/_nuxt/_snapshotId_.ChuSNeNY.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/a1fec520-0c95-4ae0-af5e-964780fad341.json +1 -0
- package/.output/public/_nuxt/d-NZQb9b.js +1 -0
- package/.output/public/_nuxt/edge-router-BdPMCV6u.js +1 -0
- package/.output/public/_nuxt/{entry.dxugZJXl.css → entry.Bc0aTA0K.css} +1 -1
- package/.output/public/_nuxt/error-404.X7H_YhdC.css +1 -0
- package/.output/public/_nuxt/error-500.BOQe1fsk.css +1 -0
- package/.output/public/_nuxt/f3TOpYbw.js +1 -0
- package/.output/public/_nuxt/{DrZfEa88.js → fKv21gyL.js} +1 -1
- package/.output/public/_nuxt/graph-layout-B7wl80r3.js +1 -0
- package/.output/public/_nuxt/graph-resolver-DKNtntr2.js +180 -0
- package/.output/public/_nuxt/{CGqH5EJj.js → hJgmCMqR.js} +1 -1
- package/.output/public/_nuxt/{BoKiGodi.js → k_qm7-4y.js} +1 -1
- package/.output/public/_nuxt/{IvJ92aGK.js → m17aaUwq.js} +1 -1
- package/.output/public/_nuxt/mUFnM-_q.js +1 -0
- package/.output/public/_nuxt/mWjccvbQ.js +1 -0
- package/.output/public/_nuxt/{BXY8tDGw.js → mjskCLCv.js} +1 -1
- package/.output/public/_nuxt/n0RAZLbO.js +1 -0
- package/.output/public/_nuxt/n2N0HUVH.js +1 -0
- package/.output/public/_nuxt/o_m1mZtJ.js +6 -0
- package/.output/public/_nuxt/pxXmJ8QX.js +1 -0
- package/.output/public/_nuxt/{BHrmToEH.js → qdsjHGoJ.js} +1 -1
- package/.output/public/_nuxt/{BbcW6ACK.js → rGO070M0.js} +1 -1
- package/.output/public/_nuxt/rcFevLEP.js +2 -0
- package/.output/public/_nuxt/rgN_MdZl.js +1 -0
- package/.output/public/_nuxt/tsyQDnRt.js +5 -0
- package/.output/public/_nuxt/u5AG7uiY.js +1 -0
- package/.output/public/_nuxt/uYugtg8r.js +1 -0
- package/.output/public/_nuxt/vuetify.BzdWZaIq.css +1 -0
- package/.output/public/_nuxt/{BMMyXqK5.js → wDzz0qaB.js} +1 -1
- package/.output/public/_nuxt/xA6NntuA.js +1 -0
- package/.output/public/_nuxt/xdsXwj_J.js +1 -0
- package/.output/public/_nuxt/xp27HhqZ.js +1 -0
- package/.output/public/_nuxt/xrNU8mHG.js +3 -0
- package/.output/public/_nuxt/yaml.worker-C1Cl1y5J.js +399 -0
- package/.output/public/_nuxt/ziXKbM2N.js +1 -0
- package/.output/public/libavoid.wasm +0 -0
- package/.output/server/index.mjs +2213 -6830
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/@babel/parser/lib/index.js +427 -440
- package/.output/server/node_modules/@babel/parser/package.json +6 -6
- package/.output/server/node_modules/@trpc/server/dist/adapters/fetch/index.mjs +4 -4
- package/.output/server/node_modules/@trpc/server/dist/adapters/ws.mjs +10 -10
- package/.output/server/node_modules/@trpc/server/dist/{utils-CLZnJdb_.mjs → codes-DagpWZLc.mjs} +66 -66
- package/.output/server/node_modules/@trpc/server/dist/{getErrorShape-BH60iMC2.mjs → getErrorShape-vC8mUXJD.mjs} +3 -3
- package/.output/server/node_modules/@trpc/server/dist/index.mjs +4 -4
- package/.output/server/node_modules/@trpc/server/dist/{initTRPC-CB9uBez5.mjs → initTRPC-RoZMIBeA.mjs} +4 -4
- package/.output/server/node_modules/@trpc/server/dist/{node-http-8dtdvMrE.mjs → node-http-DtA2iLK9.mjs} +7 -5
- package/.output/server/node_modules/@trpc/server/dist/{parseTRPCMessage-BlZeZ60t.mjs → parseTRPCMessage-CTow-umk.mjs} +2 -2
- package/.output/server/node_modules/@trpc/server/dist/{resolveResponse-DngSgha6.mjs → resolveResponse-BVDlNZwN.mjs} +45 -48
- package/.output/server/node_modules/@trpc/server/dist/{tracked-Blz8XOf1.mjs → tracked-Bjtgv3wJ.mjs} +11 -9
- package/.output/server/node_modules/@trpc/server/dist/{unstable-core-do-not-import-D89CaGtL.mjs → unstable-core-do-not-import-9NNw8uQM.mjs} +5 -3
- package/.output/server/node_modules/@trpc/server/dist/{ws-BR20IWki.mjs → ws-CJgZE7Hg.mjs} +60 -20
- package/.output/server/node_modules/@trpc/server/package.json +6 -6
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +128 -106
- package/.output/server/node_modules/@vue/compiler-core/package.json +5 -5
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +54 -54
- package/.output/server/node_modules/@vue/compiler-dom/package.json +3 -3
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +35 -33
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +105 -42
- package/.output/server/node_modules/@vue/reactivity/package.json +2 -2
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +2129 -2063
- package/.output/server/node_modules/@vue/runtime-core/package.json +3 -3
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +78 -31
- package/.output/server/node_modules/@vue/runtime-dom/package.json +5 -5
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +6 -6
- package/.output/server/node_modules/@vue/server-renderer/package.json +4 -4
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +1 -1
- package/.output/server/node_modules/@vue/shared/package.json +1 -1
- package/.output/server/node_modules/copy-anything/dist/index.js +47 -31
- package/.output/server/node_modules/copy-anything/package.json +19 -72
- package/.output/server/node_modules/devalue/index.js +1 -0
- package/.output/server/node_modules/devalue/package.json +2 -2
- package/.output/server/node_modules/devalue/src/constants.js +1 -0
- package/.output/server/node_modules/devalue/src/parse.js +55 -4
- package/.output/server/node_modules/devalue/src/stringify.js +101 -12
- package/.output/server/node_modules/devalue/src/uneval.js +100 -13
- package/.output/server/node_modules/devalue/src/utils.js +35 -1
- package/.output/server/node_modules/entities/{lib/decode_codepoint.js → dist/commonjs/decode-codepoint.js} +16 -15
- package/.output/server/node_modules/entities/{lib → dist/commonjs}/decode.js +200 -168
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/.output/server/node_modules/entities/package.json +99 -69
- package/.output/server/node_modules/hookable/dist/index.mjs +244 -268
- package/.output/server/node_modules/hookable/package.json +29 -26
- package/.output/server/node_modules/is-what/dist/getType.js +4 -0
- package/.output/server/node_modules/is-what/dist/index.js +43 -171
- package/.output/server/node_modules/is-what/dist/isAnyObject.js +8 -0
- package/.output/server/node_modules/is-what/dist/isArray.js +5 -0
- package/.output/server/node_modules/is-what/dist/isBigInt.js +5 -0
- package/.output/server/node_modules/is-what/dist/isBlob.js +5 -0
- package/.output/server/node_modules/is-what/dist/isBoolean.js +5 -0
- package/.output/server/node_modules/is-what/dist/isDate.js +5 -0
- package/.output/server/node_modules/is-what/dist/isEmptyArray.js +5 -0
- package/.output/server/node_modules/is-what/dist/isEmptyObject.js +8 -0
- package/.output/server/node_modules/is-what/dist/isEmptyString.js +4 -0
- package/.output/server/node_modules/is-what/dist/isError.js +5 -0
- package/.output/server/node_modules/is-what/dist/isFile.js +5 -0
- package/.output/server/node_modules/is-what/dist/isFullArray.js +5 -0
- package/.output/server/node_modules/is-what/dist/isFullObject.js +8 -0
- package/.output/server/node_modules/is-what/dist/isFullString.js +5 -0
- package/.output/server/node_modules/is-what/dist/isFunction.js +4 -0
- package/.output/server/node_modules/is-what/dist/isHexDecimal.js +12 -0
- package/.output/server/node_modules/is-what/dist/isInstanceOf.js +19 -0
- package/.output/server/node_modules/is-what/dist/isInteger.js +5 -0
- package/.output/server/node_modules/is-what/dist/isIterable.js +16 -0
- package/.output/server/node_modules/is-what/dist/isMap.js +5 -0
- package/.output/server/node_modules/is-what/dist/isNaNValue.js +5 -0
- package/.output/server/node_modules/is-what/dist/isNegativeInteger.js +5 -0
- package/.output/server/node_modules/is-what/dist/isNegativeNumber.js +5 -0
- package/.output/server/node_modules/is-what/dist/isNull.js +5 -0
- package/.output/server/node_modules/is-what/dist/isNullOrUndefined.js +5 -0
- package/.output/server/node_modules/is-what/dist/isNumber.js +9 -0
- package/.output/server/node_modules/is-what/dist/isObject.js +8 -0
- package/.output/server/node_modules/is-what/dist/isObjectLike.js +11 -0
- package/.output/server/node_modules/is-what/dist/isOneOf.js +15 -0
- package/.output/server/node_modules/is-what/dist/isPlainObject.js +11 -0
- package/.output/server/node_modules/is-what/dist/isPositiveInteger.js +5 -0
- package/.output/server/node_modules/is-what/dist/isPositiveNumber.js +5 -0
- package/.output/server/node_modules/is-what/dist/isPrimitive.js +21 -0
- package/.output/server/node_modules/is-what/dist/isPromise.js +5 -0
- package/.output/server/node_modules/is-what/dist/isRegExp.js +5 -0
- package/.output/server/node_modules/is-what/dist/isSet.js +5 -0
- package/.output/server/node_modules/is-what/dist/isString.js +5 -0
- package/.output/server/node_modules/is-what/dist/isSymbol.js +5 -0
- package/.output/server/node_modules/is-what/dist/isType.js +20 -0
- package/.output/server/node_modules/is-what/dist/isUndefined.js +5 -0
- package/.output/server/node_modules/is-what/dist/isWeakMap.js +5 -0
- package/.output/server/node_modules/is-what/dist/isWeakSet.js +5 -0
- package/.output/server/node_modules/is-what/package.json +23 -88
- package/.output/server/node_modules/superjson/dist/index.js +9 -6
- package/.output/server/node_modules/superjson/dist/pathstringifier.js +13 -2
- package/.output/server/node_modules/superjson/dist/plainer.js +23 -11
- package/.output/server/node_modules/superjson/dist/transformer.js +4 -1
- package/.output/server/node_modules/superjson/package.json +5 -21
- package/.output/server/node_modules/ufo/dist/index.mjs +16 -9
- package/.output/server/node_modules/ufo/package.json +15 -14
- package/.output/server/node_modules/unhead/dist/plugins.mjs +2 -2
- package/.output/server/node_modules/unhead/dist/server.mjs +4 -6
- package/.output/server/node_modules/unhead/dist/shared/{unhead.DH45uomy.mjs → unhead.BFfcxOoW.mjs} +3 -3
- package/.output/server/node_modules/unhead/dist/shared/{unhead.DZbvapt-.mjs → unhead.CbpEuj3y.mjs} +3 -2
- package/.output/server/node_modules/unhead/dist/shared/{unhead.Djo8ep_Y.mjs → unhead.ckV6dpEQ.mjs} +1 -1
- package/.output/server/node_modules/unhead/dist/shared/{unhead.BpRRHAhY.mjs → unhead.eK9_7LaY.mjs} +16 -12
- package/.output/server/node_modules/unhead/dist/utils.mjs +2 -2
- package/.output/server/node_modules/unhead/package.json +2 -2
- package/.output/server/node_modules/vue/dist/vue.cjs.js +1 -1
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +1 -1
- package/.output/server/node_modules/vue/package.json +6 -6
- package/.output/server/node_modules/ws/lib/constants.js +1 -0
- package/.output/server/node_modules/ws/lib/websocket-server.js +5 -1
- package/.output/server/node_modules/ws/lib/websocket.js +13 -8
- package/.output/server/node_modules/ws/package.json +1 -1
- package/.output/server/node_modules/zod/package.json +1 -1
- package/.output/server/node_modules/zod/v4/classic/checks.js +1 -1
- package/.output/server/node_modules/zod/v4/classic/external.js +3 -1
- package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +584 -0
- package/.output/server/node_modules/zod/v4/classic/schemas.js +121 -4
- package/.output/server/node_modules/zod/v4/core/api.js +157 -0
- package/.output/server/node_modules/zod/v4/core/checks.js +8 -2
- package/.output/server/node_modules/zod/v4/core/core.js +20 -11
- package/.output/server/node_modules/zod/v4/core/index.js +2 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +605 -0
- package/.output/server/node_modules/zod/v4/core/regexes.js +8 -2
- package/.output/server/node_modules/zod/v4/core/registries.js +3 -4
- package/.output/server/node_modules/zod/v4/core/schemas.js +204 -66
- package/.output/server/node_modules/zod/v4/core/to-json-schema.js +391 -869
- package/.output/server/node_modules/zod/v4/core/util.js +58 -8
- package/.output/server/node_modules/zod/v4/core/versions.js +2 -2
- package/.output/server/node_modules/zod/v4/locales/ar.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/az.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/be.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/bg.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/ca.js +14 -25
- package/.output/server/node_modules/zod/v4/locales/cs.js +18 -42
- package/.output/server/node_modules/zod/v4/locales/da.js +23 -39
- package/.output/server/node_modules/zod/v4/locales/de.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/en.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/eo.js +17 -24
- package/.output/server/node_modules/zod/v4/locales/es.js +42 -59
- package/.output/server/node_modules/zod/v4/locales/fa.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/fi.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/fr-CA.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/fr.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/he.js +175 -78
- package/.output/server/node_modules/zod/v4/locales/hu.js +16 -25
- package/.output/server/node_modules/zod/v4/locales/hy.js +147 -0
- package/.output/server/node_modules/zod/v4/locales/id.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/index.js +2 -0
- package/.output/server/node_modules/zod/v4/locales/is.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/it.js +16 -25
- package/.output/server/node_modules/zod/v4/locales/ja.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/ka.js +19 -32
- package/.output/server/node_modules/zod/v4/locales/km.js +17 -24
- package/.output/server/node_modules/zod/v4/locales/ko.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/lt.js +27 -54
- package/.output/server/node_modules/zod/v4/locales/mk.js +16 -25
- package/.output/server/node_modules/zod/v4/locales/ms.js +15 -24
- package/.output/server/node_modules/zod/v4/locales/nl.js +25 -32
- package/.output/server/node_modules/zod/v4/locales/no.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/ota.js +17 -25
- package/.output/server/node_modules/zod/v4/locales/pl.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/ps.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/pt.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/ru.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/sl.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/sv.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/ta.js +17 -24
- package/.output/server/node_modules/zod/v4/locales/th.js +17 -24
- package/.output/server/node_modules/zod/v4/locales/tr.js +14 -24
- package/.output/server/node_modules/zod/v4/locales/uk.js +16 -25
- package/.output/server/node_modules/zod/v4/locales/ur.js +17 -24
- package/.output/server/node_modules/zod/v4/locales/uz.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/vi.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/yo.js +16 -24
- package/.output/server/node_modules/zod/v4/locales/zh-CN.js +17 -24
- package/.output/server/node_modules/zod/v4/locales/zh-TW.js +14 -24
- package/.output/server/package.json +22 -22
- package/package.json +6 -6
- package/.output/public/_nuxt/-oaD50UK.js +0 -1
- package/.output/public/_nuxt/0ekw3e2V.js +0 -1
- package/.output/public/_nuxt/1f5tAgHw.js +0 -1
- package/.output/public/_nuxt/5ggY4uig.js +0 -1
- package/.output/public/_nuxt/6nHXG8SA.js +0 -1
- package/.output/public/_nuxt/9hmcqHPO.js +0 -1
- package/.output/public/_nuxt/BBxmzUt6.js +0 -1
- package/.output/public/_nuxt/BE2KfCdU.js +0 -1
- package/.output/public/_nuxt/BFNM2w_f.js +0 -1
- package/.output/public/_nuxt/BGLu70Yq.js +0 -1
- package/.output/public/_nuxt/BIuj43Wh.js +0 -1
- package/.output/public/_nuxt/BLsOQd1H.js +0 -280
- package/.output/public/_nuxt/BNGfscqk.js +0 -1
- package/.output/public/_nuxt/BQvybpQq.js +0 -1
- package/.output/public/_nuxt/BU7Cl-8B.js +0 -1
- package/.output/public/_nuxt/BUXOnL59.js +0 -1
- package/.output/public/_nuxt/Bbwybh3N.js +0 -2
- package/.output/public/_nuxt/BczD6j-v.js +0 -1
- package/.output/public/_nuxt/BepWV7mh.js +0 -1
- package/.output/public/_nuxt/Bh0qehhp.js +0 -1
- package/.output/public/_nuxt/Bl2oy6fF.js +0 -1
- package/.output/public/_nuxt/BmDdxTjo.js +0 -1
- package/.output/public/_nuxt/BqeRdtD4.js +0 -2
- package/.output/public/_nuxt/BvAqAH-y.js +0 -1
- package/.output/public/_nuxt/BxZD33h1.js +0 -1
- package/.output/public/_nuxt/C4zpeTvm.js +0 -1
- package/.output/public/_nuxt/C7Pw0Ztw.js +0 -1
- package/.output/public/_nuxt/C8-UwF3o.js +0 -1
- package/.output/public/_nuxt/CCd08HS_.js +0 -1
- package/.output/public/_nuxt/CEYFgC8B.js +0 -1
- package/.output/public/_nuxt/CHadp7IV.js +0 -1
- package/.output/public/_nuxt/CHh-QcGE.js +0 -1
- package/.output/public/_nuxt/CIUZ1G5V.js +0 -1
- package/.output/public/_nuxt/CJ6lOLXp.js +0 -1
- package/.output/public/_nuxt/CN9dMhDM.js +0 -1
- package/.output/public/_nuxt/CQ4fj8p0.js +0 -1
- package/.output/public/_nuxt/CTWiQX6C.js +0 -1
- package/.output/public/_nuxt/CXxzV4dz.js +0 -1
- package/.output/public/_nuxt/CZlF05X6.js +0 -1
- package/.output/public/_nuxt/CatV_12G.js +0 -1
- package/.output/public/_nuxt/CeMkeBDb.js +0 -1
- package/.output/public/_nuxt/CelvVQyk.js +0 -1
- package/.output/public/_nuxt/CfV455SO.js +0 -1
- package/.output/public/_nuxt/CfeIJUat.js +0 -1
- package/.output/public/_nuxt/CfqrF6sE.js +0 -1
- package/.output/public/_nuxt/Cfs9EX91.js +0 -1
- package/.output/public/_nuxt/ChH_ziBE.js +0 -1
- package/.output/public/_nuxt/ChM1GEGa.js +0 -1
- package/.output/public/_nuxt/Cu8OsqJL.js +0 -1
- package/.output/public/_nuxt/CusJppg0.js +0 -1
- package/.output/public/_nuxt/Cv9koXgw.js +0 -1
- package/.output/public/_nuxt/CvELRi2k.js +0 -5
- package/.output/public/_nuxt/Cw6nGM9K.js +0 -1
- package/.output/public/_nuxt/CwUT5n6w.js +0 -1
- package/.output/public/_nuxt/D-AHKB2i.js +0 -6
- package/.output/public/_nuxt/D-kcn2fr.js +0 -1
- package/.output/public/_nuxt/D08WgyRC.js +0 -1
- package/.output/public/_nuxt/D1Jbgd7O.js +0 -13
- package/.output/public/_nuxt/D1ibY74j.js +0 -1
- package/.output/public/_nuxt/D22FLkUw.js +0 -1
- package/.output/public/_nuxt/D2CYqzqI.js +0 -1
- package/.output/public/_nuxt/D34EmFco.js +0 -1
- package/.output/public/_nuxt/D4OhWExI.js +0 -1
- package/.output/public/_nuxt/DDHikT5j.js +0 -1
- package/.output/public/_nuxt/DDTT3lYc.js +0 -1
- package/.output/public/_nuxt/DHLkt8Yr.js +0 -1
- package/.output/public/_nuxt/DHuTDtaT.js +0 -12
- package/.output/public/_nuxt/DKYwYmdq.js +0 -1
- package/.output/public/_nuxt/DMDPKkZ0.js +0 -1
- package/.output/public/_nuxt/DNEoBllO.js +0 -1
- package/.output/public/_nuxt/DRzH1pOL.js +0 -1
- package/.output/public/_nuxt/DSUF3NDE.js +0 -1
- package/.output/public/_nuxt/DTAwr92a.js +0 -1
- package/.output/public/_nuxt/DWmtspXK.js +0 -1
- package/.output/public/_nuxt/DXh9HyqW.js +0 -1
- package/.output/public/_nuxt/DXtl0MQI.js +0 -1
- package/.output/public/_nuxt/D_zCY0Xl.js +0 -1
- package/.output/public/_nuxt/DaZJpzOl.js +0 -1
- package/.output/public/_nuxt/Df68jz8_.js +0 -1
- package/.output/public/_nuxt/DhQfdAdO.js +0 -1
- package/.output/public/_nuxt/DiinP2Uv.js +0 -1
- package/.output/public/_nuxt/DljmTZ5-.js +0 -1
- package/.output/public/_nuxt/Dm4QKadl.js +0 -26
- package/.output/public/_nuxt/DmCK90gL.js +0 -1
- package/.output/public/_nuxt/Dn2_MT6a.js +0 -1
- package/.output/public/_nuxt/Don94nLk.js +0 -1
- package/.output/public/_nuxt/Dr8Zlu6v.js +0 -1
- package/.output/public/_nuxt/Drp5UXmf.js +0 -1
- package/.output/public/_nuxt/DtFoCuZo.js +0 -1
- package/.output/public/_nuxt/DxuitVdg.js +0 -2
- package/.output/public/_nuxt/DyJlTyXw.js +0 -1
- package/.output/public/_nuxt/Jep7L2Wt.js +0 -1
- package/.output/public/_nuxt/LUl67wzp.js +0 -1
- package/.output/public/_nuxt/M2rHlmBj.js +0 -1
- package/.output/public/_nuxt/N3RVRbLb.js +0 -1
- package/.output/public/_nuxt/NBseiqgx.js +0 -1
- package/.output/public/_nuxt/PoHY5YXO.js +0 -1
- package/.output/public/_nuxt/SdwduGaY.js +0 -1
- package/.output/public/_nuxt/SytC7lKg.js +0 -1
- package/.output/public/_nuxt/U3pqMjXV.js +0 -1
- package/.output/public/_nuxt/UInuXPgp.js +0 -1
- package/.output/public/_nuxt/YXI84j39.js +0 -2
- package/.output/public/_nuxt/ZZ6g6dXy.js +0 -2
- package/.output/public/_nuxt/builds/meta/033f259e-8ba9-4c82-8824-56febea80b7d.json +0 -1
- package/.output/public/_nuxt/dglhsJpM.js +0 -1
- package/.output/public/_nuxt/dwrHE3tM.js +0 -14
- package/.output/public/_nuxt/edge-router-yEORMNQw.js +0 -4
- package/.output/public/_nuxt/error-404.CttAF9VE.css +0 -1
- package/.output/public/_nuxt/error-500.DXXd6-x4.css +0 -1
- package/.output/public/_nuxt/ga9TZ2z5.js +0 -1
- package/.output/public/_nuxt/graph-layout-CFj469YF.js +0 -1
- package/.output/public/_nuxt/graph-resolver-eG1ZUsYn.js +0 -166
- package/.output/public/_nuxt/ov4D99rA.js +0 -1
- package/.output/public/_nuxt/qYU5Tabh.js +0 -1
- package/.output/public/_nuxt/qliWkHmV.js +0 -1
- package/.output/public/_nuxt/vuetify.BrkCt9t5.css +0 -5
- package/.output/public/_nuxt/yaml.worker-CQ6dFw39.js +0 -405
- package/.output/server/node_modules/entities/lib/generated/decode-data-html.js +0 -9
- package/.output/server/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
|
@@ -1,915 +1,437 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { globalRegistry } from "./registries.js";
|
|
2
|
+
// function initializeContext<T extends schemas.$ZodType>(inputs: JSONSchemaGeneratorParams<T>): ToJSONSchemaContext<T> {
|
|
3
|
+
// return {
|
|
4
|
+
// processor: inputs.processor,
|
|
5
|
+
// metadataRegistry: inputs.metadata ?? globalRegistry,
|
|
6
|
+
// target: inputs.target ?? "draft-2020-12",
|
|
7
|
+
// unrepresentable: inputs.unrepresentable ?? "throw",
|
|
8
|
+
// };
|
|
9
|
+
// }
|
|
10
|
+
export function initializeContext(params) {
|
|
11
|
+
// Normalize target: convert old non-hyphenated versions to hyphenated versions
|
|
12
|
+
let target = params?.target ?? "draft-2020-12";
|
|
13
|
+
if (target === "draft-4")
|
|
14
|
+
target = "draft-04";
|
|
15
|
+
if (target === "draft-7")
|
|
16
|
+
target = "draft-07";
|
|
17
|
+
return {
|
|
18
|
+
processors: params.processors ?? {},
|
|
19
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
20
|
+
target,
|
|
21
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
22
|
+
override: params?.override ?? (() => { }),
|
|
23
|
+
io: params?.io ?? "output",
|
|
24
|
+
counter: 0,
|
|
25
|
+
seen: new Map(),
|
|
26
|
+
cycles: params?.cycles ?? "ref",
|
|
27
|
+
reused: params?.reused ?? "inline",
|
|
28
|
+
external: params?.external ?? undefined,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
32
|
+
var _a;
|
|
33
|
+
const def = schema._zod.def;
|
|
34
|
+
// check for schema in seens
|
|
35
|
+
const seen = ctx.seen.get(schema);
|
|
36
|
+
if (seen) {
|
|
37
|
+
seen.count++;
|
|
38
|
+
// check if cycle
|
|
39
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
40
|
+
if (isCycle) {
|
|
41
|
+
seen.cycle = _params.path;
|
|
42
|
+
}
|
|
43
|
+
return seen.schema;
|
|
44
|
+
}
|
|
45
|
+
// initialize
|
|
46
|
+
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
|
47
|
+
ctx.seen.set(schema, result);
|
|
48
|
+
// custom method overrides default behavior
|
|
49
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
50
|
+
if (overrideSchema) {
|
|
51
|
+
result.schema = overrideSchema;
|
|
12
52
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
url: "uri",
|
|
19
|
-
datetime: "date-time",
|
|
20
|
-
json_string: "json-string",
|
|
21
|
-
regex: "", // do not set
|
|
53
|
+
else {
|
|
54
|
+
const params = {
|
|
55
|
+
..._params,
|
|
56
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
57
|
+
path: _params.path,
|
|
22
58
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (seen) {
|
|
26
|
-
seen.count++;
|
|
27
|
-
// check if cycle
|
|
28
|
-
const isCycle = _params.schemaPath.includes(schema);
|
|
29
|
-
if (isCycle) {
|
|
30
|
-
seen.cycle = _params.path;
|
|
31
|
-
}
|
|
32
|
-
return seen.schema;
|
|
33
|
-
}
|
|
34
|
-
// initialize
|
|
35
|
-
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
|
36
|
-
this.seen.set(schema, result);
|
|
37
|
-
// custom method overrides default behavior
|
|
38
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
39
|
-
if (overrideSchema) {
|
|
40
|
-
result.schema = overrideSchema;
|
|
59
|
+
if (schema._zod.processJSONSchema) {
|
|
60
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
41
61
|
}
|
|
42
62
|
else {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
const parent = schema._zod.parent;
|
|
49
|
-
if (parent) {
|
|
50
|
-
// schema was cloned from another schema
|
|
51
|
-
result.ref = parent;
|
|
52
|
-
this.process(parent, params);
|
|
53
|
-
this.seen.get(parent).isParent = true;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const _json = result.schema;
|
|
57
|
-
switch (def.type) {
|
|
58
|
-
case "string": {
|
|
59
|
-
const json = _json;
|
|
60
|
-
json.type = "string";
|
|
61
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod
|
|
62
|
-
.bag;
|
|
63
|
-
if (typeof minimum === "number")
|
|
64
|
-
json.minLength = minimum;
|
|
65
|
-
if (typeof maximum === "number")
|
|
66
|
-
json.maxLength = maximum;
|
|
67
|
-
// custom pattern overrides format
|
|
68
|
-
if (format) {
|
|
69
|
-
json.format = formatMap[format] ?? format;
|
|
70
|
-
if (json.format === "")
|
|
71
|
-
delete json.format; // empty format is not valid
|
|
72
|
-
}
|
|
73
|
-
if (contentEncoding)
|
|
74
|
-
json.contentEncoding = contentEncoding;
|
|
75
|
-
if (patterns && patterns.size > 0) {
|
|
76
|
-
const regexes = [...patterns];
|
|
77
|
-
if (regexes.length === 1)
|
|
78
|
-
json.pattern = regexes[0].source;
|
|
79
|
-
else if (regexes.length > 1) {
|
|
80
|
-
result.schema.allOf = [
|
|
81
|
-
...regexes.map((regex) => ({
|
|
82
|
-
...(this.target === "draft-7" || this.target === "draft-4" || this.target === "openapi-3.0"
|
|
83
|
-
? { type: "string" }
|
|
84
|
-
: {}),
|
|
85
|
-
pattern: regex.source,
|
|
86
|
-
})),
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
case "number": {
|
|
93
|
-
const json = _json;
|
|
94
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
95
|
-
if (typeof format === "string" && format.includes("int"))
|
|
96
|
-
json.type = "integer";
|
|
97
|
-
else
|
|
98
|
-
json.type = "number";
|
|
99
|
-
if (typeof exclusiveMinimum === "number") {
|
|
100
|
-
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
101
|
-
json.minimum = exclusiveMinimum;
|
|
102
|
-
json.exclusiveMinimum = true;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
json.exclusiveMinimum = exclusiveMinimum;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (typeof minimum === "number") {
|
|
109
|
-
json.minimum = minimum;
|
|
110
|
-
if (typeof exclusiveMinimum === "number" && this.target !== "draft-4") {
|
|
111
|
-
if (exclusiveMinimum >= minimum)
|
|
112
|
-
delete json.minimum;
|
|
113
|
-
else
|
|
114
|
-
delete json.exclusiveMinimum;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (typeof exclusiveMaximum === "number") {
|
|
118
|
-
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
119
|
-
json.maximum = exclusiveMaximum;
|
|
120
|
-
json.exclusiveMaximum = true;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
json.exclusiveMaximum = exclusiveMaximum;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (typeof maximum === "number") {
|
|
127
|
-
json.maximum = maximum;
|
|
128
|
-
if (typeof exclusiveMaximum === "number" && this.target !== "draft-4") {
|
|
129
|
-
if (exclusiveMaximum <= maximum)
|
|
130
|
-
delete json.maximum;
|
|
131
|
-
else
|
|
132
|
-
delete json.exclusiveMaximum;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (typeof multipleOf === "number")
|
|
136
|
-
json.multipleOf = multipleOf;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
case "boolean": {
|
|
140
|
-
const json = _json;
|
|
141
|
-
json.type = "boolean";
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
case "bigint": {
|
|
145
|
-
if (this.unrepresentable === "throw") {
|
|
146
|
-
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
case "symbol": {
|
|
151
|
-
if (this.unrepresentable === "throw") {
|
|
152
|
-
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
153
|
-
}
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
case "null": {
|
|
157
|
-
if (this.target === "openapi-3.0") {
|
|
158
|
-
_json.type = "string";
|
|
159
|
-
_json.nullable = true;
|
|
160
|
-
_json.enum = [null];
|
|
161
|
-
}
|
|
162
|
-
else
|
|
163
|
-
_json.type = "null";
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
case "any": {
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
case "unknown": {
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
case "undefined": {
|
|
173
|
-
if (this.unrepresentable === "throw") {
|
|
174
|
-
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
175
|
-
}
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
case "void": {
|
|
179
|
-
if (this.unrepresentable === "throw") {
|
|
180
|
-
throw new Error("Void cannot be represented in JSON Schema");
|
|
181
|
-
}
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
case "never": {
|
|
185
|
-
_json.not = {};
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
case "date": {
|
|
189
|
-
if (this.unrepresentable === "throw") {
|
|
190
|
-
throw new Error("Date cannot be represented in JSON Schema");
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
case "array": {
|
|
195
|
-
const json = _json;
|
|
196
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
197
|
-
if (typeof minimum === "number")
|
|
198
|
-
json.minItems = minimum;
|
|
199
|
-
if (typeof maximum === "number")
|
|
200
|
-
json.maxItems = maximum;
|
|
201
|
-
json.type = "array";
|
|
202
|
-
json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
case "object": {
|
|
206
|
-
const json = _json;
|
|
207
|
-
json.type = "object";
|
|
208
|
-
json.properties = {};
|
|
209
|
-
const shape = def.shape; // params.shapeCache.get(schema)!;
|
|
210
|
-
for (const key in shape) {
|
|
211
|
-
json.properties[key] = this.process(shape[key], {
|
|
212
|
-
...params,
|
|
213
|
-
path: [...params.path, "properties", key],
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
// required keys
|
|
217
|
-
const allKeys = new Set(Object.keys(shape));
|
|
218
|
-
// const optionalKeys = new Set(def.optional);
|
|
219
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
220
|
-
const v = def.shape[key]._zod;
|
|
221
|
-
if (this.io === "input") {
|
|
222
|
-
return v.optin === undefined;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
return v.optout === undefined;
|
|
226
|
-
}
|
|
227
|
-
}));
|
|
228
|
-
if (requiredKeys.size > 0) {
|
|
229
|
-
json.required = Array.from(requiredKeys);
|
|
230
|
-
}
|
|
231
|
-
// catchall
|
|
232
|
-
if (def.catchall?._zod.def.type === "never") {
|
|
233
|
-
// strict
|
|
234
|
-
json.additionalProperties = false;
|
|
235
|
-
}
|
|
236
|
-
else if (!def.catchall) {
|
|
237
|
-
// regular
|
|
238
|
-
if (this.io === "output")
|
|
239
|
-
json.additionalProperties = false;
|
|
240
|
-
}
|
|
241
|
-
else if (def.catchall) {
|
|
242
|
-
json.additionalProperties = this.process(def.catchall, {
|
|
243
|
-
...params,
|
|
244
|
-
path: [...params.path, "additionalProperties"],
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
case "union": {
|
|
250
|
-
const json = _json;
|
|
251
|
-
const options = def.options.map((x, i) => this.process(x, {
|
|
252
|
-
...params,
|
|
253
|
-
path: [...params.path, "anyOf", i],
|
|
254
|
-
}));
|
|
255
|
-
json.anyOf = options;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
case "intersection": {
|
|
259
|
-
const json = _json;
|
|
260
|
-
const a = this.process(def.left, {
|
|
261
|
-
...params,
|
|
262
|
-
path: [...params.path, "allOf", 0],
|
|
263
|
-
});
|
|
264
|
-
const b = this.process(def.right, {
|
|
265
|
-
...params,
|
|
266
|
-
path: [...params.path, "allOf", 1],
|
|
267
|
-
});
|
|
268
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
269
|
-
const allOf = [
|
|
270
|
-
...(isSimpleIntersection(a) ? a.allOf : [a]),
|
|
271
|
-
...(isSimpleIntersection(b) ? b.allOf : [b]),
|
|
272
|
-
];
|
|
273
|
-
json.allOf = allOf;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
case "tuple": {
|
|
277
|
-
const json = _json;
|
|
278
|
-
json.type = "array";
|
|
279
|
-
const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
280
|
-
const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
281
|
-
const prefixItems = def.items.map((x, i) => this.process(x, {
|
|
282
|
-
...params,
|
|
283
|
-
path: [...params.path, prefixPath, i],
|
|
284
|
-
}));
|
|
285
|
-
const rest = def.rest
|
|
286
|
-
? this.process(def.rest, {
|
|
287
|
-
...params,
|
|
288
|
-
path: [...params.path, restPath, ...(this.target === "openapi-3.0" ? [def.items.length] : [])],
|
|
289
|
-
})
|
|
290
|
-
: null;
|
|
291
|
-
if (this.target === "draft-2020-12") {
|
|
292
|
-
json.prefixItems = prefixItems;
|
|
293
|
-
if (rest) {
|
|
294
|
-
json.items = rest;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else if (this.target === "openapi-3.0") {
|
|
298
|
-
json.items = {
|
|
299
|
-
anyOf: prefixItems,
|
|
300
|
-
};
|
|
301
|
-
if (rest) {
|
|
302
|
-
json.items.anyOf.push(rest);
|
|
303
|
-
}
|
|
304
|
-
json.minItems = prefixItems.length;
|
|
305
|
-
if (!rest) {
|
|
306
|
-
json.maxItems = prefixItems.length;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
json.items = prefixItems;
|
|
311
|
-
if (rest) {
|
|
312
|
-
json.additionalItems = rest;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
// length
|
|
316
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
317
|
-
if (typeof minimum === "number")
|
|
318
|
-
json.minItems = minimum;
|
|
319
|
-
if (typeof maximum === "number")
|
|
320
|
-
json.maxItems = maximum;
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
case "record": {
|
|
324
|
-
const json = _json;
|
|
325
|
-
json.type = "object";
|
|
326
|
-
if (this.target === "draft-7" || this.target === "draft-2020-12") {
|
|
327
|
-
json.propertyNames = this.process(def.keyType, {
|
|
328
|
-
...params,
|
|
329
|
-
path: [...params.path, "propertyNames"],
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
json.additionalProperties = this.process(def.valueType, {
|
|
333
|
-
...params,
|
|
334
|
-
path: [...params.path, "additionalProperties"],
|
|
335
|
-
});
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
case "map": {
|
|
339
|
-
if (this.unrepresentable === "throw") {
|
|
340
|
-
throw new Error("Map cannot be represented in JSON Schema");
|
|
341
|
-
}
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
case "set": {
|
|
345
|
-
if (this.unrepresentable === "throw") {
|
|
346
|
-
throw new Error("Set cannot be represented in JSON Schema");
|
|
347
|
-
}
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
case "enum": {
|
|
351
|
-
const json = _json;
|
|
352
|
-
const values = getEnumValues(def.entries);
|
|
353
|
-
// Number enums can have both string and number values
|
|
354
|
-
if (values.every((v) => typeof v === "number"))
|
|
355
|
-
json.type = "number";
|
|
356
|
-
if (values.every((v) => typeof v === "string"))
|
|
357
|
-
json.type = "string";
|
|
358
|
-
json.enum = values;
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
case "literal": {
|
|
362
|
-
const json = _json;
|
|
363
|
-
const vals = [];
|
|
364
|
-
for (const val of def.values) {
|
|
365
|
-
if (val === undefined) {
|
|
366
|
-
if (this.unrepresentable === "throw") {
|
|
367
|
-
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
// do not add to vals
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
else if (typeof val === "bigint") {
|
|
374
|
-
if (this.unrepresentable === "throw") {
|
|
375
|
-
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
376
|
-
}
|
|
377
|
-
else {
|
|
378
|
-
vals.push(Number(val));
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
vals.push(val);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
if (vals.length === 0) {
|
|
386
|
-
// do nothing (an undefined literal was stripped)
|
|
387
|
-
}
|
|
388
|
-
else if (vals.length === 1) {
|
|
389
|
-
const val = vals[0];
|
|
390
|
-
json.type = val === null ? "null" : typeof val;
|
|
391
|
-
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
392
|
-
json.enum = [val];
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
json.const = val;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
if (vals.every((v) => typeof v === "number"))
|
|
400
|
-
json.type = "number";
|
|
401
|
-
if (vals.every((v) => typeof v === "string"))
|
|
402
|
-
json.type = "string";
|
|
403
|
-
if (vals.every((v) => typeof v === "boolean"))
|
|
404
|
-
json.type = "string";
|
|
405
|
-
if (vals.every((v) => v === null))
|
|
406
|
-
json.type = "null";
|
|
407
|
-
json.enum = vals;
|
|
408
|
-
}
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
case "file": {
|
|
412
|
-
const json = _json;
|
|
413
|
-
const file = {
|
|
414
|
-
type: "string",
|
|
415
|
-
format: "binary",
|
|
416
|
-
contentEncoding: "binary",
|
|
417
|
-
};
|
|
418
|
-
const { minimum, maximum, mime } = schema._zod.bag;
|
|
419
|
-
if (minimum !== undefined)
|
|
420
|
-
file.minLength = minimum;
|
|
421
|
-
if (maximum !== undefined)
|
|
422
|
-
file.maxLength = maximum;
|
|
423
|
-
if (mime) {
|
|
424
|
-
if (mime.length === 1) {
|
|
425
|
-
file.contentMediaType = mime[0];
|
|
426
|
-
Object.assign(json, file);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
json.anyOf = mime.map((m) => {
|
|
430
|
-
const mFile = { ...file, contentMediaType: m };
|
|
431
|
-
return mFile;
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
Object.assign(json, file);
|
|
437
|
-
}
|
|
438
|
-
// if (this.unrepresentable === "throw") {
|
|
439
|
-
// throw new Error("File cannot be represented in JSON Schema");
|
|
440
|
-
// }
|
|
441
|
-
break;
|
|
442
|
-
}
|
|
443
|
-
case "transform": {
|
|
444
|
-
if (this.unrepresentable === "throw") {
|
|
445
|
-
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
446
|
-
}
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
case "nullable": {
|
|
450
|
-
const inner = this.process(def.innerType, params);
|
|
451
|
-
if (this.target === "openapi-3.0") {
|
|
452
|
-
result.ref = def.innerType;
|
|
453
|
-
_json.nullable = true;
|
|
454
|
-
}
|
|
455
|
-
else {
|
|
456
|
-
_json.anyOf = [inner, { type: "null" }];
|
|
457
|
-
}
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
case "nonoptional": {
|
|
461
|
-
this.process(def.innerType, params);
|
|
462
|
-
result.ref = def.innerType;
|
|
463
|
-
break;
|
|
464
|
-
}
|
|
465
|
-
case "success": {
|
|
466
|
-
const json = _json;
|
|
467
|
-
json.type = "boolean";
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
case "default": {
|
|
471
|
-
this.process(def.innerType, params);
|
|
472
|
-
result.ref = def.innerType;
|
|
473
|
-
_json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
case "prefault": {
|
|
477
|
-
this.process(def.innerType, params);
|
|
478
|
-
result.ref = def.innerType;
|
|
479
|
-
if (this.io === "input")
|
|
480
|
-
_json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
case "catch": {
|
|
484
|
-
// use conditionals
|
|
485
|
-
this.process(def.innerType, params);
|
|
486
|
-
result.ref = def.innerType;
|
|
487
|
-
let catchValue;
|
|
488
|
-
try {
|
|
489
|
-
catchValue = def.catchValue(undefined);
|
|
490
|
-
}
|
|
491
|
-
catch {
|
|
492
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
493
|
-
}
|
|
494
|
-
_json.default = catchValue;
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
case "nan": {
|
|
498
|
-
if (this.unrepresentable === "throw") {
|
|
499
|
-
throw new Error("NaN cannot be represented in JSON Schema");
|
|
500
|
-
}
|
|
501
|
-
break;
|
|
502
|
-
}
|
|
503
|
-
case "template_literal": {
|
|
504
|
-
const json = _json;
|
|
505
|
-
const pattern = schema._zod.pattern;
|
|
506
|
-
if (!pattern)
|
|
507
|
-
throw new Error("Pattern not found in template literal");
|
|
508
|
-
json.type = "string";
|
|
509
|
-
json.pattern = pattern.source;
|
|
510
|
-
break;
|
|
511
|
-
}
|
|
512
|
-
case "pipe": {
|
|
513
|
-
const innerType = this.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
|
|
514
|
-
this.process(innerType, params);
|
|
515
|
-
result.ref = innerType;
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
case "readonly": {
|
|
519
|
-
this.process(def.innerType, params);
|
|
520
|
-
result.ref = def.innerType;
|
|
521
|
-
_json.readOnly = true;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
// passthrough types
|
|
525
|
-
case "promise": {
|
|
526
|
-
this.process(def.innerType, params);
|
|
527
|
-
result.ref = def.innerType;
|
|
528
|
-
break;
|
|
529
|
-
}
|
|
530
|
-
case "optional": {
|
|
531
|
-
this.process(def.innerType, params);
|
|
532
|
-
result.ref = def.innerType;
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
case "lazy": {
|
|
536
|
-
const innerType = schema._zod.innerType;
|
|
537
|
-
this.process(innerType, params);
|
|
538
|
-
result.ref = innerType;
|
|
539
|
-
break;
|
|
540
|
-
}
|
|
541
|
-
case "custom": {
|
|
542
|
-
if (this.unrepresentable === "throw") {
|
|
543
|
-
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
544
|
-
}
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
case "function": {
|
|
548
|
-
if (this.unrepresentable === "throw") {
|
|
549
|
-
throw new Error("Function types cannot be represented in JSON Schema");
|
|
550
|
-
}
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
default: {
|
|
554
|
-
def;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
63
|
+
const _json = result.schema;
|
|
64
|
+
const processor = ctx.processors[def.type];
|
|
65
|
+
if (!processor) {
|
|
66
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
557
67
|
}
|
|
68
|
+
processor(schema, ctx, _json, params);
|
|
558
69
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
delete result.schema.default;
|
|
70
|
+
const parent = schema._zod.parent;
|
|
71
|
+
if (parent) {
|
|
72
|
+
// Also set ref if processor didn't (for inheritance)
|
|
73
|
+
if (!result.ref)
|
|
74
|
+
result.ref = parent;
|
|
75
|
+
process(parent, ctx, params);
|
|
76
|
+
ctx.seen.get(parent).isParent = true;
|
|
567
77
|
}
|
|
568
|
-
// set prefault as default
|
|
569
|
-
if (this.io === "input" && result.schema._prefault)
|
|
570
|
-
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
571
|
-
delete result.schema._prefault;
|
|
572
|
-
// pulling fresh from this.seen in case it was overwritten
|
|
573
|
-
const _result = this.seen.get(schema);
|
|
574
|
-
return _result.schema;
|
|
575
78
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
609
|
-
}
|
|
610
|
-
if (entry[1] === root) {
|
|
611
|
-
return { ref: "#" };
|
|
79
|
+
// metadata
|
|
80
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
81
|
+
if (meta)
|
|
82
|
+
Object.assign(result.schema, meta);
|
|
83
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
84
|
+
// examples/defaults only apply to output type of pipe
|
|
85
|
+
delete result.schema.examples;
|
|
86
|
+
delete result.schema.default;
|
|
87
|
+
}
|
|
88
|
+
// set prefault as default
|
|
89
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
90
|
+
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
91
|
+
delete result.schema._prefault;
|
|
92
|
+
// pulling fresh from ctx.seen in case it was overwritten
|
|
93
|
+
const _result = ctx.seen.get(schema);
|
|
94
|
+
return _result.schema;
|
|
95
|
+
}
|
|
96
|
+
export function extractDefs(ctx, schema
|
|
97
|
+
// params: EmitParams
|
|
98
|
+
) {
|
|
99
|
+
// iterate over seen map;
|
|
100
|
+
const root = ctx.seen.get(schema);
|
|
101
|
+
if (!root)
|
|
102
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
103
|
+
// Track ids to detect duplicates across different schemas
|
|
104
|
+
const idToSchema = new Map();
|
|
105
|
+
for (const entry of ctx.seen.entries()) {
|
|
106
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
107
|
+
if (id) {
|
|
108
|
+
const existing = idToSchema.get(id);
|
|
109
|
+
if (existing && existing !== entry[0]) {
|
|
110
|
+
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
612
111
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
//
|
|
620
|
-
//
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
112
|
+
idToSchema.set(id, entry[0]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// returns a ref to the schema
|
|
116
|
+
// defId will be empty if the ref points to an external schema (or #)
|
|
117
|
+
const makeURI = (entry) => {
|
|
118
|
+
// comparing the seen objects because sometimes
|
|
119
|
+
// multiple schemas map to the same seen object.
|
|
120
|
+
// e.g. lazy
|
|
121
|
+
// external is configured
|
|
122
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
123
|
+
if (ctx.external) {
|
|
124
|
+
const externalId = ctx.external.registry.get(entry[0])?.id; // ?? "__shared";// `__schema${ctx.counter++}`;
|
|
125
|
+
// check if schema is in the external registry
|
|
126
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
127
|
+
if (externalId) {
|
|
128
|
+
return { ref: uriGenerator(externalId) };
|
|
625
129
|
}
|
|
130
|
+
// otherwise, add to __shared
|
|
131
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
132
|
+
entry[1].defId = id; // set defId so it will be reused if needed
|
|
133
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
134
|
+
}
|
|
135
|
+
if (entry[1] === root) {
|
|
136
|
+
return { ref: "#" };
|
|
137
|
+
}
|
|
138
|
+
// self-contained schema
|
|
139
|
+
const uriPrefix = `#`;
|
|
140
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
141
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
142
|
+
return { defId, ref: defUriPrefix + defId };
|
|
143
|
+
};
|
|
144
|
+
// stored cached version in `def` property
|
|
145
|
+
// remove all properties, set $ref
|
|
146
|
+
const extractToDef = (entry) => {
|
|
147
|
+
// if the schema is already a reference, do not extract it
|
|
148
|
+
if (entry[1].schema.$ref) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const seen = entry[1];
|
|
152
|
+
const { ref, defId } = makeURI(entry);
|
|
153
|
+
seen.def = { ...seen.schema };
|
|
154
|
+
// defId won't be set if the schema is a reference to an external schema
|
|
155
|
+
// or if the schema is the root schema
|
|
156
|
+
if (defId)
|
|
157
|
+
seen.defId = defId;
|
|
158
|
+
// wipe away all properties except $ref
|
|
159
|
+
const schema = seen.schema;
|
|
160
|
+
for (const key in schema) {
|
|
161
|
+
delete schema[key];
|
|
162
|
+
}
|
|
163
|
+
schema.$ref = ref;
|
|
164
|
+
};
|
|
165
|
+
// throw on cycles
|
|
166
|
+
// break cycles
|
|
167
|
+
if (ctx.cycles === "throw") {
|
|
168
|
+
for (const entry of ctx.seen.entries()) {
|
|
626
169
|
const seen = entry[1];
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
seen.defId = defId;
|
|
632
|
-
// wipe away all properties except $ref
|
|
633
|
-
const schema = seen.schema;
|
|
634
|
-
for (const key in schema) {
|
|
635
|
-
delete schema[key];
|
|
636
|
-
}
|
|
637
|
-
schema.$ref = ref;
|
|
638
|
-
};
|
|
639
|
-
// throw on cycles
|
|
640
|
-
// break cycles
|
|
641
|
-
if (params.cycles === "throw") {
|
|
642
|
-
for (const entry of this.seen.entries()) {
|
|
643
|
-
const seen = entry[1];
|
|
644
|
-
if (seen.cycle) {
|
|
645
|
-
throw new Error("Cycle detected: " +
|
|
646
|
-
`#/${seen.cycle?.join("/")}/<root>` +
|
|
647
|
-
'\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
|
648
|
-
}
|
|
170
|
+
if (seen.cycle) {
|
|
171
|
+
throw new Error("Cycle detected: " +
|
|
172
|
+
`#/${seen.cycle?.join("/")}/<root>` +
|
|
173
|
+
'\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
|
649
174
|
}
|
|
650
175
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
continue;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
// extract schemas with `id` meta
|
|
668
|
-
const id = this.metadataRegistry.get(entry[0])?.id;
|
|
669
|
-
if (id) {
|
|
176
|
+
}
|
|
177
|
+
// extract schemas into $defs
|
|
178
|
+
for (const entry of ctx.seen.entries()) {
|
|
179
|
+
const seen = entry[1];
|
|
180
|
+
// convert root schema to # $ref
|
|
181
|
+
if (schema === entry[0]) {
|
|
182
|
+
extractToDef(entry); // this has special handling for the root schema
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// extract schemas that are in the external registry
|
|
186
|
+
if (ctx.external) {
|
|
187
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
188
|
+
if (schema !== entry[0] && ext) {
|
|
670
189
|
extractToDef(entry);
|
|
671
190
|
continue;
|
|
672
191
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
192
|
+
}
|
|
193
|
+
// extract schemas with `id` meta
|
|
194
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
195
|
+
if (id) {
|
|
196
|
+
extractToDef(entry);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
// break cycles
|
|
200
|
+
if (seen.cycle) {
|
|
201
|
+
// any
|
|
202
|
+
extractToDef(entry);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
// extract reused schemas
|
|
206
|
+
if (seen.count > 1) {
|
|
207
|
+
if (ctx.reused === "ref") {
|
|
676
208
|
extractToDef(entry);
|
|
209
|
+
// biome-ignore lint:
|
|
677
210
|
continue;
|
|
678
211
|
}
|
|
679
|
-
// extract reused schemas
|
|
680
|
-
if (seen.count > 1) {
|
|
681
|
-
if (params.reused === "ref") {
|
|
682
|
-
extractToDef(entry);
|
|
683
|
-
// biome-ignore lint:
|
|
684
|
-
continue;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
212
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export function finalize(ctx, schema) {
|
|
216
|
+
const root = ctx.seen.get(schema);
|
|
217
|
+
if (!root)
|
|
218
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
219
|
+
// flatten refs - inherit properties from parent schemas
|
|
220
|
+
const flattenRef = (zodSchema) => {
|
|
221
|
+
const seen = ctx.seen.get(zodSchema);
|
|
222
|
+
// already processed
|
|
223
|
+
if (seen.ref === null)
|
|
224
|
+
return;
|
|
225
|
+
const schema = seen.def ?? seen.schema;
|
|
226
|
+
const _cached = { ...schema };
|
|
227
|
+
const ref = seen.ref;
|
|
228
|
+
seen.ref = null; // prevent infinite recursion
|
|
229
|
+
if (ref) {
|
|
230
|
+
flattenRef(ref);
|
|
231
|
+
const refSeen = ctx.seen.get(ref);
|
|
232
|
+
const refSchema = refSeen.schema;
|
|
233
|
+
// merge referenced schema into current
|
|
234
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
235
|
+
// older drafts can't combine $ref with other properties
|
|
236
|
+
schema.allOf = schema.allOf ?? [];
|
|
237
|
+
schema.allOf.push(refSchema);
|
|
696
238
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
Object.assign(schema, _cached); // prevent overwriting any fields in the original schema
|
|
239
|
+
else {
|
|
240
|
+
Object.assign(schema, refSchema);
|
|
241
|
+
}
|
|
242
|
+
// restore child's own properties (child wins)
|
|
243
|
+
Object.assign(schema, _cached);
|
|
244
|
+
const isParentRef = zodSchema._zod.parent === ref;
|
|
245
|
+
// For parent chain, child is a refinement - remove parent-only properties
|
|
246
|
+
if (isParentRef) {
|
|
247
|
+
for (const key in schema) {
|
|
248
|
+
if (key === "$ref" || key === "allOf")
|
|
249
|
+
continue;
|
|
250
|
+
if (!(key in _cached)) {
|
|
251
|
+
delete schema[key];
|
|
252
|
+
}
|
|
712
253
|
}
|
|
713
254
|
}
|
|
714
|
-
//
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
flattenRef(entry[0], { target: this.target });
|
|
724
|
-
}
|
|
725
|
-
const result = {};
|
|
726
|
-
if (this.target === "draft-2020-12") {
|
|
727
|
-
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
728
|
-
}
|
|
729
|
-
else if (this.target === "draft-7") {
|
|
730
|
-
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
731
|
-
}
|
|
732
|
-
else if (this.target === "draft-4") {
|
|
733
|
-
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
734
|
-
}
|
|
735
|
-
else if (this.target === "openapi-3.0") {
|
|
736
|
-
// OpenAPI 3.0 schema objects should not include a $schema property
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
// @ts-ignore
|
|
740
|
-
console.warn(`Invalid target: ${this.target}`);
|
|
741
|
-
}
|
|
742
|
-
if (params.external?.uri) {
|
|
743
|
-
const id = params.external.registry.get(schema)?.id;
|
|
744
|
-
if (!id)
|
|
745
|
-
throw new Error("Schema is missing an `id` property");
|
|
746
|
-
result.$id = params.external.uri(id);
|
|
747
|
-
}
|
|
748
|
-
Object.assign(result, root.def);
|
|
749
|
-
// build defs object
|
|
750
|
-
const defs = params.external?.defs ?? {};
|
|
751
|
-
for (const entry of this.seen.entries()) {
|
|
752
|
-
const seen = entry[1];
|
|
753
|
-
if (seen.def && seen.defId) {
|
|
754
|
-
defs[seen.defId] = seen.def;
|
|
255
|
+
// When ref was extracted to $defs, remove properties that match the definition
|
|
256
|
+
if (refSchema.$ref && refSeen.def) {
|
|
257
|
+
for (const key in schema) {
|
|
258
|
+
if (key === "$ref" || key === "allOf")
|
|
259
|
+
continue;
|
|
260
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {
|
|
261
|
+
delete schema[key];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
755
264
|
}
|
|
756
265
|
}
|
|
757
|
-
//
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
266
|
+
// If parent was extracted (has $ref), propagate $ref to this schema
|
|
267
|
+
// This handles cases like: readonly().meta({id}).describe()
|
|
268
|
+
// where processor sets ref to innerType but parent should be referenced
|
|
269
|
+
const parent = zodSchema._zod.parent;
|
|
270
|
+
if (parent && parent !== ref) {
|
|
271
|
+
// Ensure parent is processed first so its def has inherited properties
|
|
272
|
+
flattenRef(parent);
|
|
273
|
+
const parentSeen = ctx.seen.get(parent);
|
|
274
|
+
if (parentSeen?.schema.$ref) {
|
|
275
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
276
|
+
// De-duplicate with parent's definition
|
|
277
|
+
if (parentSeen.def) {
|
|
278
|
+
for (const key in schema) {
|
|
279
|
+
if (key === "$ref" || key === "allOf")
|
|
280
|
+
continue;
|
|
281
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
282
|
+
delete schema[key];
|
|
283
|
+
}
|
|
284
|
+
}
|
|
767
285
|
}
|
|
768
286
|
}
|
|
769
287
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
288
|
+
// execute overrides
|
|
289
|
+
ctx.override({
|
|
290
|
+
zodSchema: zodSchema,
|
|
291
|
+
jsonSchema: schema,
|
|
292
|
+
path: seen.path ?? [],
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
296
|
+
flattenRef(entry[0]);
|
|
779
297
|
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
298
|
+
const result = {};
|
|
299
|
+
if (ctx.target === "draft-2020-12") {
|
|
300
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
301
|
+
}
|
|
302
|
+
else if (ctx.target === "draft-07") {
|
|
303
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
304
|
+
}
|
|
305
|
+
else if (ctx.target === "draft-04") {
|
|
306
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
307
|
+
}
|
|
308
|
+
else if (ctx.target === "openapi-3.0") {
|
|
309
|
+
// OpenAPI 3.0 schema objects should not include a $schema property
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// Arbitrary string values are allowed but won't have a $schema property set
|
|
313
|
+
}
|
|
314
|
+
if (ctx.external?.uri) {
|
|
315
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
316
|
+
if (!id)
|
|
317
|
+
throw new Error("Schema is missing an `id` property");
|
|
318
|
+
result.$id = ctx.external.uri(id);
|
|
319
|
+
}
|
|
320
|
+
Object.assign(result, root.def ?? root.schema);
|
|
321
|
+
// build defs object
|
|
322
|
+
const defs = ctx.external?.defs ?? {};
|
|
323
|
+
for (const entry of ctx.seen.entries()) {
|
|
324
|
+
const seen = entry[1];
|
|
325
|
+
if (seen.def && seen.defId) {
|
|
326
|
+
defs[seen.defId] = seen.def;
|
|
801
327
|
}
|
|
328
|
+
}
|
|
329
|
+
// set definitions in result
|
|
330
|
+
if (ctx.external) {
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
802
333
|
if (Object.keys(defs).length > 0) {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
334
|
+
if (ctx.target === "draft-2020-12") {
|
|
335
|
+
result.$defs = defs;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
result.definitions = defs;
|
|
339
|
+
}
|
|
807
340
|
}
|
|
808
|
-
return { schemas };
|
|
809
341
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
342
|
+
try {
|
|
343
|
+
// this "finalizes" this schema and ensures all cycles are removed
|
|
344
|
+
// each call to finalize() is functionally independent
|
|
345
|
+
// though the seen map is shared
|
|
346
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
347
|
+
Object.defineProperty(finalized, "~standard", {
|
|
348
|
+
value: {
|
|
349
|
+
...schema["~standard"],
|
|
350
|
+
jsonSchema: {
|
|
351
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
352
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors),
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
enumerable: false,
|
|
356
|
+
writable: false,
|
|
357
|
+
});
|
|
358
|
+
return finalized;
|
|
359
|
+
}
|
|
360
|
+
catch (_err) {
|
|
361
|
+
throw new Error("Error converting schema to JSON.");
|
|
362
|
+
}
|
|
813
363
|
}
|
|
814
364
|
function isTransforming(_schema, _ctx) {
|
|
815
365
|
const ctx = _ctx ?? { seen: new Set() };
|
|
816
366
|
if (ctx.seen.has(_schema))
|
|
817
367
|
return false;
|
|
818
368
|
ctx.seen.add(_schema);
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}
|
|
850
|
-
case "union": {
|
|
851
|
-
for (const option of def.options) {
|
|
852
|
-
if (isTransforming(option, ctx))
|
|
853
|
-
return true;
|
|
854
|
-
}
|
|
855
|
-
return false;
|
|
856
|
-
}
|
|
857
|
-
case "intersection": {
|
|
858
|
-
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
859
|
-
}
|
|
860
|
-
case "tuple": {
|
|
861
|
-
for (const item of def.items) {
|
|
862
|
-
if (isTransforming(item, ctx))
|
|
863
|
-
return true;
|
|
864
|
-
}
|
|
865
|
-
if (def.rest && isTransforming(def.rest, ctx))
|
|
369
|
+
const def = _schema._zod.def;
|
|
370
|
+
if (def.type === "transform")
|
|
371
|
+
return true;
|
|
372
|
+
if (def.type === "array")
|
|
373
|
+
return isTransforming(def.element, ctx);
|
|
374
|
+
if (def.type === "set")
|
|
375
|
+
return isTransforming(def.valueType, ctx);
|
|
376
|
+
if (def.type === "lazy")
|
|
377
|
+
return isTransforming(def.getter(), ctx);
|
|
378
|
+
if (def.type === "promise" ||
|
|
379
|
+
def.type === "optional" ||
|
|
380
|
+
def.type === "nonoptional" ||
|
|
381
|
+
def.type === "nullable" ||
|
|
382
|
+
def.type === "readonly" ||
|
|
383
|
+
def.type === "default" ||
|
|
384
|
+
def.type === "prefault") {
|
|
385
|
+
return isTransforming(def.innerType, ctx);
|
|
386
|
+
}
|
|
387
|
+
if (def.type === "intersection") {
|
|
388
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
389
|
+
}
|
|
390
|
+
if (def.type === "record" || def.type === "map") {
|
|
391
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
392
|
+
}
|
|
393
|
+
if (def.type === "pipe") {
|
|
394
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
395
|
+
}
|
|
396
|
+
if (def.type === "object") {
|
|
397
|
+
for (const key in def.shape) {
|
|
398
|
+
if (isTransforming(def.shape[key], ctx))
|
|
866
399
|
return true;
|
|
867
|
-
return false;
|
|
868
400
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
case "set": {
|
|
876
|
-
return isTransforming(def.valueType, ctx);
|
|
877
|
-
}
|
|
878
|
-
// inner types
|
|
879
|
-
case "promise":
|
|
880
|
-
case "optional":
|
|
881
|
-
case "nonoptional":
|
|
882
|
-
case "nullable":
|
|
883
|
-
case "readonly":
|
|
884
|
-
return isTransforming(def.innerType, ctx);
|
|
885
|
-
case "lazy":
|
|
886
|
-
return isTransforming(def.getter(), ctx);
|
|
887
|
-
case "default": {
|
|
888
|
-
return isTransforming(def.innerType, ctx);
|
|
889
|
-
}
|
|
890
|
-
case "prefault": {
|
|
891
|
-
return isTransforming(def.innerType, ctx);
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
if (def.type === "union") {
|
|
404
|
+
for (const option of def.options) {
|
|
405
|
+
if (isTransforming(option, ctx))
|
|
406
|
+
return true;
|
|
892
407
|
}
|
|
893
|
-
|
|
894
|
-
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
if (def.type === "tuple") {
|
|
411
|
+
for (const item of def.items) {
|
|
412
|
+
if (isTransforming(item, ctx))
|
|
413
|
+
return true;
|
|
895
414
|
}
|
|
896
|
-
|
|
415
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
897
416
|
return true;
|
|
898
|
-
|
|
899
|
-
case "pipe": {
|
|
900
|
-
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
901
|
-
}
|
|
902
|
-
case "success": {
|
|
903
|
-
return false;
|
|
904
|
-
}
|
|
905
|
-
case "catch": {
|
|
906
|
-
return false;
|
|
907
|
-
}
|
|
908
|
-
case "function": {
|
|
909
|
-
return false;
|
|
910
|
-
}
|
|
911
|
-
default:
|
|
912
|
-
def;
|
|
417
|
+
return false;
|
|
913
418
|
}
|
|
914
|
-
|
|
419
|
+
return false;
|
|
915
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
423
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
424
|
+
*/
|
|
425
|
+
export const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
426
|
+
const ctx = initializeContext({ ...params, processors });
|
|
427
|
+
process(schema, ctx);
|
|
428
|
+
extractDefs(ctx, schema);
|
|
429
|
+
return finalize(ctx, schema);
|
|
430
|
+
};
|
|
431
|
+
export const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
432
|
+
const { libraryOptions, target } = params ?? {};
|
|
433
|
+
const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
|
|
434
|
+
process(schema, ctx);
|
|
435
|
+
extractDefs(ctx, schema);
|
|
436
|
+
return finalize(ctx, schema);
|
|
437
|
+
};
|