@powerhousedao/shared 6.2.3 → 6.3.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-id-DON1WCeY.d.ts +19 -0
- package/dist/action-id-DON1WCeY.d.ts.map +1 -0
- package/dist/clis/args/access-token.d.mts +14 -2
- package/dist/clis/args/access-token.d.mts.map +1 -0
- package/dist/clis/args/access-token.mjs +21 -1
- package/dist/clis/args/access-token.mjs.map +1 -0
- package/dist/clis/args/{common-BXabdhiO.mjs → common-DG_SF8fN.mjs} +39 -8
- package/dist/clis/args/common-DG_SF8fN.mjs.map +1 -0
- package/dist/clis/args/{common-Bnm859xU.d.mts → common-DmerPWXo.d.mts} +8 -4
- package/dist/clis/args/common-DmerPWXo.d.mts.map +1 -0
- package/dist/clis/args/common.d.mts +1 -1
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/connect.d.mts +448 -2
- package/dist/clis/args/connect.d.mts.map +1 -0
- package/dist/clis/args/connect.mjs +202 -1
- package/dist/clis/args/connect.mjs.map +1 -0
- package/dist/clis/args/{generate-BOItUNvP.mjs → generate-DMKgc6et.mjs} +2 -21
- package/dist/clis/args/generate-DMKgc6et.mjs.map +1 -0
- package/dist/clis/args/generate.d.mts +92 -2
- package/dist/clis/args/generate.d.mts.map +1 -0
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-DVPTARGn.d.mts → help-BnD14eCa.d.mts} +62 -2
- package/dist/clis/args/help-BnD14eCa.d.mts.map +1 -0
- package/dist/clis/args/{help-DS1NlcJQ.mjs → help-Cjoe-b7d.mjs} +55 -15
- package/dist/clis/args/help-Cjoe-b7d.mjs.map +1 -0
- package/dist/clis/args/help.d.mts +1 -1
- package/dist/clis/args/help.mjs +16 -1
- package/dist/clis/args/host.d.mts +23 -0
- package/dist/clis/args/host.d.mts.map +1 -0
- package/dist/clis/args/host.mjs +35 -0
- package/dist/clis/args/host.mjs.map +1 -0
- package/dist/clis/args/index.d.mts +23 -19
- package/dist/clis/args/index.mjs +23 -19
- package/dist/clis/args/init.d.mts +53 -2
- package/dist/clis/args/init.d.mts.map +1 -0
- package/dist/clis/args/init.mjs +77 -1
- package/dist/clis/args/init.mjs.map +1 -0
- package/dist/clis/args/inspect.d.mts +11 -2
- package/dist/clis/args/inspect.d.mts.map +1 -0
- package/dist/clis/args/inspect.mjs +14 -1
- package/dist/clis/args/inspect.mjs.map +1 -0
- package/dist/clis/args/install.d.mts +35 -2
- package/dist/clis/args/install.d.mts.map +1 -0
- package/dist/clis/args/install.mjs +31 -1
- package/dist/clis/args/install.mjs.map +1 -0
- package/dist/clis/args/{login-CXRJXg71.d.mts → keyframes.d.mts} +13 -13
- package/dist/clis/args/keyframes.d.mts.map +1 -0
- package/dist/clis/args/keyframes.mjs +42 -0
- package/dist/clis/args/keyframes.mjs.map +1 -0
- package/dist/clis/args/list.d.mts +8 -2
- package/dist/clis/args/list.d.mts.map +1 -0
- package/dist/clis/args/list.mjs +6 -1
- package/dist/clis/args/list.mjs.map +1 -0
- package/dist/clis/args/login.d.mts +23 -2
- package/dist/clis/args/login.d.mts.map +1 -0
- package/dist/clis/args/login.mjs +39 -1
- package/dist/clis/args/login.mjs.map +1 -0
- package/dist/clis/args/{access-token-C5sKsH2O.d.mts → mcp.d.mts} +6 -7
- package/dist/clis/args/mcp.d.mts.map +1 -0
- package/dist/clis/args/mcp.mjs +22 -0
- package/dist/clis/args/mcp.mjs.map +1 -0
- package/dist/clis/args/migrate.d.mts +26 -2
- package/dist/clis/args/migrate.d.mts.map +1 -0
- package/dist/clis/args/migrate.mjs +43 -1
- package/dist/clis/args/migrate.mjs.map +1 -0
- package/dist/clis/args/{uninstall-CDx7lwxn.d.mts → model.d.mts} +28 -17
- package/dist/clis/args/model.d.mts.map +1 -0
- package/dist/clis/args/model.mjs +51 -0
- package/dist/clis/args/model.mjs.map +1 -0
- package/dist/clis/args/publish.d.mts +18 -2
- package/dist/clis/args/publish.d.mts.map +1 -0
- package/dist/clis/args/publish.mjs +26 -1
- package/dist/clis/args/publish.mjs.map +1 -0
- package/dist/clis/args/registry.d.mts +15 -2
- package/dist/clis/args/registry.d.mts.map +1 -0
- package/dist/clis/args/registry.mjs +22 -1
- package/dist/clis/args/registry.mjs.map +1 -0
- package/dist/clis/args/{unpublish-CEDsk6uv.d.mts → run.d.mts} +11 -12
- package/dist/clis/args/run.d.mts.map +1 -0
- package/dist/clis/args/run.mjs +33 -0
- package/dist/clis/args/run.mjs.map +1 -0
- package/dist/clis/args/{service-BBx5GDTc.d.mts → service-CLCvH3kf.d.mts} +4 -4
- package/dist/clis/args/service-CLCvH3kf.d.mts.map +1 -0
- package/dist/clis/args/service.d.mts +1 -1
- package/dist/clis/args/service.mjs +10 -1
- package/dist/clis/args/service.mjs.map +1 -0
- package/dist/clis/args/switchboard.d.mts +68 -2
- package/dist/clis/args/switchboard.d.mts.map +1 -0
- package/dist/clis/args/switchboard.mjs +84 -1
- package/dist/clis/args/switchboard.mjs.map +1 -0
- package/dist/clis/args/uninstall.d.mts +26 -2
- package/dist/clis/args/uninstall.d.mts.map +1 -0
- package/dist/clis/args/uninstall.mjs +15 -1
- package/dist/clis/args/uninstall.mjs.map +1 -0
- package/dist/clis/args/unpublish.d.mts +20 -2
- package/dist/clis/args/unpublish.d.mts.map +1 -0
- package/dist/clis/args/unpublish.mjs +29 -1
- package/dist/clis/args/unpublish.mjs.map +1 -0
- package/dist/clis/args/{vetra-BUNlAAPp.mjs → vetra-BqjDopAP.mjs} +18 -2
- package/dist/clis/args/vetra-BqjDopAP.mjs.map +1 -0
- package/dist/clis/args/vetra.d.mts +112 -2
- package/dist/clis/args/vetra.d.mts.map +1 -0
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/{build-config-CmdMi_wu.mjs → build-config-BM1RL4u_.mjs} +87 -8
- package/dist/clis/build-config-BM1RL4u_.mjs.map +1 -0
- package/dist/clis/build-config.d.mts +26 -1
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +2 -2
- package/dist/clis/build-pieces.d.mts +71 -4
- package/dist/clis/build-pieces.d.mts.map +1 -1
- package/dist/clis/build-pieces.mjs +249 -26
- package/dist/clis/build-pieces.mjs.map +1 -1
- package/dist/clis/command-names.d.mts +3 -1
- package/dist/clis/command-names.d.mts.map +1 -1
- package/dist/clis/command-names.mjs +8 -1
- package/dist/clis/command-names.mjs.map +1 -1
- package/dist/clis/constants.d.mts +2 -2
- package/dist/clis/constants.mjs +92 -20
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/definition-sources.d.mts +26 -0
- package/dist/clis/definition-sources.d.mts.map +1 -0
- package/dist/clis/definition-sources.mjs +27 -0
- package/dist/clis/definition-sources.mjs.map +1 -0
- package/dist/clis/deprecations.d.mts +73 -0
- package/dist/clis/deprecations.d.mts.map +1 -0
- package/dist/clis/deprecations.mjs +121 -0
- package/dist/clis/deprecations.mjs.map +1 -0
- package/dist/clis/{index-6CZwrmQi.d.mts → index-DnZYG-8g.d.mts} +2 -2
- package/dist/clis/{index-6CZwrmQi.d.mts.map → index-DnZYG-8g.d.mts.map} +1 -1
- package/dist/clis/index.d.mts +2584 -901
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +1540 -919
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/package-style.d.mts +32 -0
- package/dist/clis/package-style.d.mts.map +1 -0
- package/dist/clis/package-style.mjs +102 -0
- package/dist/clis/package-style.mjs.map +1 -0
- package/dist/clis/ph-dir.d.mts +26 -0
- package/dist/clis/ph-dir.d.mts.map +1 -0
- package/dist/clis/ph-dir.mjs +37 -0
- package/dist/clis/ph-dir.mjs.map +1 -0
- package/dist/clis/project-env.d.mts +6 -0
- package/dist/clis/project-env.d.mts.map +1 -1
- package/dist/clis/project-env.mjs +16 -1
- package/dist/clis/project-env.mjs.map +1 -1
- package/dist/clis/real-paths.d.mts +14 -0
- package/dist/clis/real-paths.d.mts.map +1 -0
- package/dist/clis/real-paths.mjs +36 -0
- package/dist/clis/real-paths.mjs.map +1 -0
- package/dist/clis/retired-flags.d.mts +45 -0
- package/dist/clis/retired-flags.d.mts.map +1 -0
- package/dist/clis/retired-flags.mjs +55 -0
- package/dist/clis/retired-flags.mjs.map +1 -0
- package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/clis/types-CZU17kAm.d.mts +2510 -0
- package/dist/clis/types-CZU17kAm.d.mts.map +1 -0
- package/dist/clis/utils.d.mts.map +1 -1
- package/dist/clis/utils.mjs.map +1 -1
- package/dist/{config-loader-C6dZB_iX.js → config-loader-B7SqNz8z.js} +24 -6
- package/dist/config-loader-B7SqNz8z.js.map +1 -0
- package/dist/connect/app-shell.d.ts +48 -0
- package/dist/connect/app-shell.d.ts.map +1 -0
- package/dist/connect/app-shell.js +90 -0
- package/dist/connect/app-shell.js.map +1 -0
- package/dist/connect/config-loader.d.ts +8 -1
- package/dist/connect/config-loader.d.ts.map +1 -1
- package/dist/connect/config-loader.js +2 -2
- package/dist/connect/connect-config-schema.d.ts +3 -0
- package/dist/connect/connect-config-schema.js +486 -0
- package/dist/connect/connect-config-schema.js.map +1 -0
- package/dist/connect/image-ref.d.ts +32 -0
- package/dist/connect/image-ref.d.ts.map +1 -0
- package/dist/connect/image-ref.js +80 -0
- package/dist/connect/image-ref.js.map +1 -0
- package/dist/connect/index.d.ts +84 -635
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +216 -553
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/origin-placeholder.d.ts +52 -0
- package/dist/connect/origin-placeholder.d.ts.map +1 -0
- package/dist/connect/origin-placeholder.js +101 -0
- package/dist/connect/origin-placeholder.js.map +1 -0
- package/dist/connect-config-schema-cBfkNo1b.d.ts +1872 -0
- package/dist/connect-config-schema-cBfkNo1b.d.ts.map +1 -0
- package/dist/constants-5UFY_rXh.d.ts +9 -0
- package/dist/constants-5UFY_rXh.d.ts.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +22 -6
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +3 -4
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +2 -13
- package/dist/document-drive/index.js.map +1 -1
- package/dist/document-model/action-id.d.ts +3 -0
- package/dist/document-model/action-id.js +59 -0
- package/dist/document-model/action-id.js.map +1 -0
- package/dist/document-model/dispatch.d.ts +25 -0
- package/dist/document-model/dispatch.d.ts.map +1 -0
- package/dist/document-model/dispatch.js +0 -0
- package/dist/document-model/errors.d.ts +3 -0
- package/dist/document-model/errors.js +214 -0
- package/dist/document-model/errors.js.map +1 -0
- package/dist/document-model/index.d.ts +5 -4
- package/dist/document-model/index.js +7 -5521
- package/dist/document-model/utils.d.ts +3 -2
- package/dist/document-model/utils.js +3 -2
- package/dist/document-model/version.d.ts +3 -0
- package/dist/document-model/version.js +8 -0
- package/dist/document-model/version.js.map +1 -0
- package/dist/document-model-CqySIaKV.js +5805 -0
- package/dist/document-model-CqySIaKV.js.map +1 -0
- package/dist/host-tokens/index.d.ts +3 -0
- package/dist/host-tokens/index.js +2 -0
- package/dist/host-tokens-DOeyxqLi.js +322 -0
- package/dist/host-tokens-DOeyxqLi.js.map +1 -0
- package/dist/{index-5gwOhPG5.d.ts → index-CUZ8eWun.d.ts} +2 -2
- package/dist/{index-5gwOhPG5.d.ts.map → index-CUZ8eWun.d.ts.map} +1 -1
- package/dist/index-D58WVj_E.d.ts +246 -0
- package/dist/index-D58WVj_E.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/processors/index.d.ts +2 -2
- package/dist/processors/index.js +177 -68
- package/dist/processors/index.js.map +1 -1
- package/dist/processors/testing.d.ts +22 -0
- package/dist/processors/testing.d.ts.map +1 -0
- package/dist/processors/testing.js +77 -0
- package/dist/processors/testing.js.map +1 -0
- package/dist/purge-CbAV5DVh.js +631 -0
- package/dist/purge-CbAV5DVh.js.map +1 -0
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.js +52 -9
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +2 -2
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/types-CV2j3BvH.d.ts +5709 -0
- package/dist/types-CV2j3BvH.d.ts.map +1 -0
- package/dist/{types-CI3ren9F.d.ts → types-D_6ZcaJj.d.ts} +20 -12
- package/dist/types-D_6ZcaJj.d.ts.map +1 -0
- package/dist/{utils-CSF716ux.js → utils-DiV32YIj.js} +45 -2
- package/dist/utils-DiV32YIj.js.map +1 -0
- package/dist/utils-MrLmLEVr.js +78 -0
- package/dist/utils-MrLmLEVr.js.map +1 -0
- package/dist/version-BxLITo9P.d.ts +6 -0
- package/dist/version-BxLITo9P.d.ts.map +1 -0
- package/package.json +37 -3
- package/dist/clis/args/access-token-3Hqv_U8I.mjs +0 -22
- package/dist/clis/args/access-token-3Hqv_U8I.mjs.map +0 -1
- package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +0 -1
- package/dist/clis/args/common-BXabdhiO.mjs.map +0 -1
- package/dist/clis/args/common-Bnm859xU.d.mts.map +0 -1
- package/dist/clis/args/connect-BG3HkYBk.mjs +0 -203
- package/dist/clis/args/connect-BG3HkYBk.mjs.map +0 -1
- package/dist/clis/args/connect-DjeiqXus.d.mts +0 -450
- package/dist/clis/args/connect-DjeiqXus.d.mts.map +0 -1
- package/dist/clis/args/generate-BOItUNvP.mjs.map +0 -1
- package/dist/clis/args/generate-BPBBLeUD.d.mts +0 -103
- package/dist/clis/args/generate-BPBBLeUD.d.mts.map +0 -1
- package/dist/clis/args/help-DS1NlcJQ.mjs.map +0 -1
- package/dist/clis/args/help-DVPTARGn.d.mts.map +0 -1
- package/dist/clis/args/init-CFeTq4Cq.d.mts +0 -52
- package/dist/clis/args/init-CFeTq4Cq.d.mts.map +0 -1
- package/dist/clis/args/init-Dvb42Y87.mjs +0 -67
- package/dist/clis/args/init-Dvb42Y87.mjs.map +0 -1
- package/dist/clis/args/inspect-BjRmtB86.d.mts +0 -13
- package/dist/clis/args/inspect-BjRmtB86.d.mts.map +0 -1
- package/dist/clis/args/inspect-UNQgtuR0.mjs +0 -15
- package/dist/clis/args/inspect-UNQgtuR0.mjs.map +0 -1
- package/dist/clis/args/install-B0tMyUMw.d.mts +0 -37
- package/dist/clis/args/install-B0tMyUMw.d.mts.map +0 -1
- package/dist/clis/args/install-F-27kF6m.mjs +0 -32
- package/dist/clis/args/install-F-27kF6m.mjs.map +0 -1
- package/dist/clis/args/list-Bkfn8Yuo.mjs +0 -7
- package/dist/clis/args/list-Bkfn8Yuo.mjs.map +0 -1
- package/dist/clis/args/list-DrbxA7JJ.d.mts +0 -10
- package/dist/clis/args/list-DrbxA7JJ.d.mts.map +0 -1
- package/dist/clis/args/login-CIFkQExi.mjs +0 -40
- package/dist/clis/args/login-CIFkQExi.mjs.map +0 -1
- package/dist/clis/args/login-CXRJXg71.d.mts.map +0 -1
- package/dist/clis/args/magic-string.es-BWtG0AyA.mjs +0 -1019
- package/dist/clis/args/magic-string.es-BWtG0AyA.mjs.map +0 -1
- package/dist/clis/args/migrate-DkCQRL2D.d.mts +0 -19
- package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +0 -1
- package/dist/clis/args/migrate-DwJGhc2d.mjs +0 -29
- package/dist/clis/args/migrate-DwJGhc2d.mjs.map +0 -1
- package/dist/clis/args/publish-CeW4bOrl.d.mts +0 -16
- package/dist/clis/args/publish-CeW4bOrl.d.mts.map +0 -1
- package/dist/clis/args/publish-DHqlGWmL.mjs +0 -19
- package/dist/clis/args/publish-DHqlGWmL.mjs.map +0 -1
- package/dist/clis/args/registry-DIwES3l2.mjs +0 -23
- package/dist/clis/args/registry-DIwES3l2.mjs.map +0 -1
- package/dist/clis/args/registry-DNH8xuaE.d.mts +0 -17
- package/dist/clis/args/registry-DNH8xuaE.d.mts.map +0 -1
- package/dist/clis/args/service-BBx5GDTc.d.mts.map +0 -1
- package/dist/clis/args/service-Cpjlyeu5.mjs +0 -11
- package/dist/clis/args/service-Cpjlyeu5.mjs.map +0 -1
- package/dist/clis/args/switchboard-CCaAtU56.mjs +0 -85
- package/dist/clis/args/switchboard-CCaAtU56.mjs.map +0 -1
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts +0 -70
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +0 -1
- package/dist/clis/args/uninstall-3U0B8g5c.mjs +0 -16
- package/dist/clis/args/uninstall-3U0B8g5c.mjs.map +0 -1
- package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +0 -1
- package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +0 -1
- package/dist/clis/args/unpublish-s9zUh6Gw.mjs +0 -30
- package/dist/clis/args/unpublish-s9zUh6Gw.mjs.map +0 -1
- package/dist/clis/args/vetra-BUNlAAPp.mjs.map +0 -1
- package/dist/clis/args/vetra-DkDaWFPi.d.mts +0 -111
- package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +0 -1
- package/dist/clis/args/vetra-ports.test.d.mts +0 -2
- package/dist/clis/args/vetra-ports.test.mjs +0 -13354
- package/dist/clis/args/vetra-ports.test.mjs.map +0 -1
- package/dist/clis/build-config-CmdMi_wu.mjs.map +0 -1
- package/dist/clis/types-nzer4WIr.d.mts +0 -541
- package/dist/clis/types-nzer4WIr.d.mts.map +0 -1
- package/dist/config-loader-C6dZB_iX.js.map +0 -1
- package/dist/constants-DO4IYxuR.d.ts +0 -9
- package/dist/constants-DO4IYxuR.d.ts.map +0 -1
- package/dist/document-model/index.js.map +0 -1
- package/dist/index-D6833Siv.d.ts +0 -939
- package/dist/index-D6833Siv.d.ts.map +0 -1
- package/dist/types-CI3ren9F.d.ts.map +0 -1
- package/dist/types-CmeoQg_J.d.ts +0 -3337
- package/dist/types-CmeoQg_J.d.ts.map +0 -1
- package/dist/utils-BrKxCmKx.d.ts +0 -18
- package/dist/utils-BrKxCmKx.d.ts.map +0 -1
- package/dist/utils-CSF716ux.js.map +0 -1
package/dist/clis/index.mjs
CHANGED
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.mjs";
|
|
2
2
|
import { array, boolean, command, flag, multioption, number, oneOf, option, optional, positional, rest, restPositionals, string } from "cmd-ts";
|
|
3
3
|
import { AGENTS as AGENTS$1 } from "package-manager-detector/constants";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
import path, { join } from "node:path";
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { homedir, tmpdir } from "node:os";
|
|
5
|
+
import path, { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
6
|
+
import { accessSync, constants, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import dotenv from "dotenv";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import fsPromises, { mkdir, stat, writeFile } from "node:fs/promises";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { promisify } from "node:util";
|
|
12
12
|
import { execFile } from "node:child_process";
|
|
13
|
-
import { clean, compare, valid } from "semver";
|
|
13
|
+
import { clean, compare, satisfies, valid } from "semver";
|
|
14
14
|
import spawn from "cross-spawn";
|
|
15
|
+
import coerce from "semver/functions/coerce.js";
|
|
16
|
+
import gte from "semver/functions/gte.js";
|
|
15
17
|
import { isTruthy } from "remeda";
|
|
16
18
|
import npa from "npm-package-arg";
|
|
17
19
|
import { packageDirectory } from "package-directory";
|
|
18
20
|
import { execSync } from "child_process";
|
|
19
|
-
import { dirname, resolve } from "path";
|
|
21
|
+
import { dirname as dirname$1, resolve as resolve$1 } from "path";
|
|
22
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
20
23
|
import { writePackage } from "write-package";
|
|
24
|
+
import { toJSONSchema, z } from "zod";
|
|
21
25
|
import lt from "semver/functions/lt.js";
|
|
22
|
-
//#region \0rolldown/runtime.js
|
|
23
|
-
var __create = Object.create;
|
|
24
|
-
var __defProp = Object.defineProperty;
|
|
25
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
26
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
27
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
29
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
30
|
-
var __copyProps = (to, from, except, desc) => {
|
|
31
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
32
|
-
key = keys[i];
|
|
33
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
34
|
-
get: ((k) => from[k]).bind(null, key),
|
|
35
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return to;
|
|
39
|
-
};
|
|
40
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
41
|
-
value: mod,
|
|
42
|
-
enumerable: true
|
|
43
|
-
}) : target, mod));
|
|
44
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
45
|
-
//#endregion
|
|
46
26
|
//#region clis/constants.ts
|
|
47
27
|
const SERVICE_ACTIONS = [
|
|
48
28
|
"start",
|
|
@@ -74,6 +54,18 @@ const PROJECT_PORT_BAND_SIZE = 1e3;
|
|
|
74
54
|
const PROJECT_PORT_BAND_SWITCHBOARD = 7e3;
|
|
75
55
|
const PROJECT_PORT_BAND_STUDIO = 6e3;
|
|
76
56
|
const PROJECT_PORT_BAND_VETRA_CONNECT = 2e3;
|
|
57
|
+
/**
|
|
58
|
+
* Icon for the drives switchboard creates by default, inlined as a data URI.
|
|
59
|
+
*
|
|
60
|
+
* A remote URL is the wrong shape for this: the value is baked into the drive
|
|
61
|
+
* document and rendered by every Connect that opens it, so the icon only
|
|
62
|
+
* appears when that client can reach that host. A desktop or air-gapped install
|
|
63
|
+
* cannot, and the ipfs.io gateway this previously pointed at now answers 403
|
|
64
|
+
* regardless.
|
|
65
|
+
*
|
|
66
|
+
* The mark is drawn dark-on-light so it stays legible against either theme.
|
|
67
|
+
*/
|
|
68
|
+
const DEFAULT_DRIVE_ICON = "data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Crect%20width='16'%20height='16'%20rx='3'%20fill='%23F3F5F7'/%3E%3Cpath%20fill='%23343839'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.0059%200L3.41636%205.45646C2.44979%206.25682%202.3795%207.71452%203.26456%208.60418L5.54425%2010.8957C6.21311%2011.568%206.35783%2012.6012%205.89944%2013.4314L4.48126%2016H2.13333C0.955126%2016%200%2015.0449%200%2013.8667V2.13333C0%200.955126%200.955126%200%202.13333%200H10.0059ZM11.2436%200L10.0128%202.24221C9.55899%203.06891%209.70183%204.09549%2010.3641%204.7669L12.7825%207.21868C13.6656%208.11402%2013.5866%209.57512%2012.612%2010.37L5.70922%2016H13.8667C15.0449%2016%2016%2015.0449%2016%2013.8667V2.13333C16%200.955126%2015.0449%200%2013.8667%200H11.2436Z'/%3E%3C/svg%3E";
|
|
77
69
|
const DEFAULT_VETRA_DRIVE_ID = "vetra";
|
|
78
70
|
const MINIMUM_NODE_VERSION = "24.0.0";
|
|
79
71
|
const PH_BIN = "ph-cli-legacy";
|
|
@@ -82,12 +74,18 @@ const PH_GLOBAL_DIR_NAME = ".ph";
|
|
|
82
74
|
const PH_GLOBAL_PROJECT_NAME = ".ph";
|
|
83
75
|
const HOME_DIR = homedir();
|
|
84
76
|
const POWERHOUSE_GLOBAL_DIR = join(HOME_DIR, ".ph");
|
|
85
|
-
const VERSIONED_PEER_DEPENDENCIES = [
|
|
77
|
+
const VERSIONED_PEER_DEPENDENCIES = [
|
|
78
|
+
"document-model",
|
|
79
|
+
"@powerhousedao/reactor-browser",
|
|
80
|
+
"@powerhousedao/connect-core"
|
|
81
|
+
];
|
|
86
82
|
const REACTOR_API_PACKAGE = "@powerhousedao/reactor-api";
|
|
87
83
|
const ANALYTICS_ENGINE_CORE_PACKAGE = "@powerhousedao/analytics-engine-core";
|
|
88
84
|
const GRAPHQL_PACKAGE = "graphql";
|
|
89
85
|
const GRAPHQL_TAG_PACKAGE = "graphql-tag";
|
|
90
86
|
const PIECES_FRAMEWORK_PACKAGE = "@powerhousedao/pieces-framework";
|
|
87
|
+
const KYSELY_PACKAGE = "kysely";
|
|
88
|
+
const RELATIONAL_DB_PROCESSOR_CLASS = "RelationalDbProcessor";
|
|
91
89
|
const PEER_EXTERNAL_DEPENDENCIES = {
|
|
92
90
|
[GRAPHQL_PACKAGE]: {
|
|
93
91
|
peer: "^16",
|
|
@@ -107,7 +105,11 @@ const PEER_EXTERNAL_DEPENDENCIES = {
|
|
|
107
105
|
},
|
|
108
106
|
zod: {
|
|
109
107
|
peer: "^4",
|
|
110
|
-
dev: "4.
|
|
108
|
+
dev: "4.6.5"
|
|
109
|
+
},
|
|
110
|
+
"@tanstack/react-router": {
|
|
111
|
+
peer: "^1.170.41",
|
|
112
|
+
dev: "1.170.41"
|
|
111
113
|
}
|
|
112
114
|
};
|
|
113
115
|
const FEATURE_DEPENDENCIES = {
|
|
@@ -116,13 +118,30 @@ const FEATURE_DEPENDENCIES = {
|
|
|
116
118
|
peerExternal: {},
|
|
117
119
|
devVersioned: []
|
|
118
120
|
},
|
|
121
|
+
relationalDbProcessor: {
|
|
122
|
+
peerVersioned: [],
|
|
123
|
+
peerExternal: { [KYSELY_PACKAGE]: {
|
|
124
|
+
peer: "^0.28",
|
|
125
|
+
dev: "0.28.16"
|
|
126
|
+
} },
|
|
127
|
+
devVersioned: []
|
|
128
|
+
},
|
|
129
|
+
subgraph: {
|
|
130
|
+
peerVersioned: [REACTOR_API_PACKAGE],
|
|
131
|
+
peerExternal: {},
|
|
132
|
+
devVersioned: []
|
|
133
|
+
},
|
|
119
134
|
piece: {
|
|
120
135
|
peerVersioned: [],
|
|
121
136
|
peerExternal: {},
|
|
122
137
|
devVersioned: [PIECES_FRAMEWORK_PACKAGE]
|
|
123
138
|
}
|
|
124
139
|
};
|
|
125
|
-
const VERSIONED_DEPENDENCIES = [
|
|
140
|
+
const VERSIONED_DEPENDENCIES = [
|
|
141
|
+
...VERSIONED_PEER_DEPENDENCIES,
|
|
142
|
+
...FEATURE_DEPENDENCIES.analyticsProcessor.peerVersioned,
|
|
143
|
+
...FEATURE_DEPENDENCIES.subgraph.peerVersioned
|
|
144
|
+
];
|
|
126
145
|
const BOILERPLATE_ALLOWED_BUILDS = [
|
|
127
146
|
"@apollo/protobufjs",
|
|
128
147
|
"@datadog/pprof",
|
|
@@ -139,12 +158,22 @@ const BOILERPLATE_DEPENDENCY_OVERRIDES = {
|
|
|
139
158
|
vite: "8.0.14",
|
|
140
159
|
rolldown: "1.0.2"
|
|
141
160
|
};
|
|
161
|
+
const BOILERPLATE_TRANSITIVE_OVERRIDES = {
|
|
162
|
+
"@solana/kit": "5.5.1",
|
|
163
|
+
"@solana-program/system": "0.10.0",
|
|
164
|
+
"@solana-program/token": "0.9.0"
|
|
165
|
+
};
|
|
142
166
|
const VERSIONED_DEV_DEPENDENCIES = [
|
|
143
167
|
"@powerhousedao/ph-cli",
|
|
144
168
|
"@powerhousedao/reactor",
|
|
145
169
|
"@powerhousedao/shared",
|
|
146
170
|
"@powerhousedao/connect",
|
|
147
|
-
"@powerhousedao/design-system"
|
|
171
|
+
"@powerhousedao/design-system",
|
|
172
|
+
"@powerhousedao/host-core",
|
|
173
|
+
"@powerhousedao/clint",
|
|
174
|
+
"@powerhousedao/desktop",
|
|
175
|
+
"@powerhousedao/vetra-studio",
|
|
176
|
+
"@powerhousedao/switchboard"
|
|
148
177
|
];
|
|
149
178
|
const packageJsonExports = {
|
|
150
179
|
".": {
|
|
@@ -178,9 +207,14 @@ const packageJsonExports = {
|
|
|
178
207
|
},
|
|
179
208
|
"./subgraphs": {
|
|
180
209
|
types: "./dist/types/subgraphs/index.d.ts",
|
|
181
|
-
browser: "./dist/browser/subgraphs/index.js",
|
|
182
210
|
node: "./dist/node/subgraphs/index.mjs"
|
|
183
211
|
},
|
|
212
|
+
"./scalars": {
|
|
213
|
+
types: "./dist/types/scalars/index.d.ts",
|
|
214
|
+
browser: "./dist/browser/scalars/index.js",
|
|
215
|
+
node: "./dist/node/scalars/index.mjs"
|
|
216
|
+
},
|
|
217
|
+
"./connect-routes": { browser: "./dist/browser/connect-routes.js" },
|
|
184
218
|
"./processors": {
|
|
185
219
|
types: "./dist/types/processors/index.d.ts",
|
|
186
220
|
browser: "./dist/browser/processors/index.js",
|
|
@@ -199,20 +233,39 @@ const packageJsonExports = {
|
|
|
199
233
|
};
|
|
200
234
|
const packageScripts = {
|
|
201
235
|
"test:watch": "vitest",
|
|
202
|
-
lint: "oxlint --type-aware --type-check",
|
|
203
|
-
"lint:fix": "oxlint --type-aware --type-check --fix",
|
|
236
|
+
lint: "ph-cli generate connect-routes && oxlint --type-aware --type-check",
|
|
237
|
+
"lint:fix": "ph-cli generate connect-routes && oxlint --type-aware --type-check --fix",
|
|
204
238
|
format: "oxfmt",
|
|
205
239
|
"format:check": "oxfmt --check",
|
|
206
|
-
tsc: "tsc",
|
|
240
|
+
tsc: "ph-cli generate connect-routes && tsc",
|
|
207
241
|
"tsc:watch": "tsc --watch",
|
|
208
242
|
generate: "ph-cli generate",
|
|
209
|
-
connect: "ph-cli connect",
|
|
243
|
+
connect: "ph-cli run connect",
|
|
210
244
|
build: "ph-cli build",
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
245
|
+
vetra: "ph-cli run vetra",
|
|
246
|
+
mcp: "ph-cli mcp"
|
|
247
|
+
};
|
|
248
|
+
const HOST_PACKAGE_SCRIPTS = ["connect", "vetra"];
|
|
249
|
+
const SUPERSEDED_PACKAGE_SCRIPTS = {
|
|
250
|
+
lint: [
|
|
251
|
+
"eslint --config eslint.config.js --cache",
|
|
252
|
+
"eslint --config eslint.config.js --cache --cache-strategy content",
|
|
253
|
+
"oxlint --type-aware --type-check"
|
|
254
|
+
],
|
|
255
|
+
"lint:fix": ["npm run lint -- --fix", "oxlint --type-aware --type-check --fix"],
|
|
256
|
+
tsc: ["tsc"],
|
|
257
|
+
build: ["npm run tsc && npm run tailwind"],
|
|
258
|
+
connect: ["ph-cli connect"],
|
|
259
|
+
vetra: ["ph-cli vetra"]
|
|
260
|
+
};
|
|
261
|
+
const RETIRED_PACKAGE_SCRIPTS = {
|
|
262
|
+
reactor: {
|
|
263
|
+
values: ["ph-cli reactor"],
|
|
264
|
+
replacement: "ph-cli run switchboard",
|
|
265
|
+
host: "switchboard"
|
|
266
|
+
},
|
|
267
|
+
"service-startup": { values: ["bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh"] },
|
|
268
|
+
"service-unstartup": { values: ["bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"] }
|
|
216
269
|
};
|
|
217
270
|
const externalDependencies = {};
|
|
218
271
|
const LEGACY_LINT_FORMAT_DEPENDENCIES = [
|
|
@@ -259,15 +312,14 @@ const externalDevDependencies = {
|
|
|
259
312
|
"@types/react": "^19.2.3",
|
|
260
313
|
"@types/react-dom": "^19.2.3",
|
|
261
314
|
"@vitejs/plugin-react": "^6.0.1",
|
|
262
|
-
"@vitest/coverage-v8": "
|
|
315
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
263
316
|
oxfmt: "0.68.0",
|
|
264
|
-
oxlint: "1.
|
|
265
|
-
"oxlint-tsgolint": "0.
|
|
317
|
+
oxlint: "1.83.0",
|
|
318
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
266
319
|
tailwindcss: "^4.1.16",
|
|
267
320
|
typescript: "~7.0.2",
|
|
268
321
|
vite: "^8.0.10",
|
|
269
|
-
|
|
270
|
-
vitest: "4.1.1"
|
|
322
|
+
vitest: "5.0.3"
|
|
271
323
|
};
|
|
272
324
|
const defaultManifest = {
|
|
273
325
|
name: "",
|
|
@@ -340,6 +392,14 @@ const buildArgs = {
|
|
|
340
392
|
defaultValue: () => false,
|
|
341
393
|
defaultValueIsSerializable: true
|
|
342
394
|
}),
|
|
395
|
+
/** @experimental Builds for a release: the release check, then a release approval. */
|
|
396
|
+
release: flag({
|
|
397
|
+
type: boolean,
|
|
398
|
+
long: "release",
|
|
399
|
+
description: "Experimental: check every document model as for a release and stop the build, previous output intact, when the check finds them invalid or cannot run; then write the release approval ph publish verifies",
|
|
400
|
+
defaultValue: () => false,
|
|
401
|
+
defaultValueIsSerializable: true
|
|
402
|
+
}),
|
|
343
403
|
...debugArgs
|
|
344
404
|
};
|
|
345
405
|
const packageManagerArgs = {
|
|
@@ -388,10 +448,9 @@ const localPackage = option({
|
|
|
388
448
|
env: "PH_LOCAL_PACKAGE"
|
|
389
449
|
});
|
|
390
450
|
const disableLocalPackages = flag({
|
|
391
|
-
type: boolean,
|
|
451
|
+
type: optional(boolean),
|
|
392
452
|
long: "ignore-local",
|
|
393
|
-
description: "Do not load local packages from this project"
|
|
394
|
-
defaultValue: () => false
|
|
453
|
+
description: "Do not load local packages from this project"
|
|
395
454
|
});
|
|
396
455
|
const httpsKeyFile = option({
|
|
397
456
|
type: optional(string),
|
|
@@ -659,7 +718,7 @@ const connectRuntimeOverrideArgs = {
|
|
|
659
718
|
homeBackground: option({
|
|
660
719
|
type: optional(string),
|
|
661
720
|
long: "home-background",
|
|
662
|
-
description: "Override connect.
|
|
721
|
+
description: "Override connect.home.background (the generic plugin's home screen). URL or path to an image, pinned bottom-right; pass an empty string (\"\") to reset to the bundled gradient."
|
|
663
722
|
}),
|
|
664
723
|
sentryDsn: option({
|
|
665
724
|
type: optional(string),
|
|
@@ -707,7 +766,7 @@ const connectBuildArgs = {
|
|
|
707
766
|
favicon: option({
|
|
708
767
|
type: optional(string),
|
|
709
768
|
long: "favicon",
|
|
710
|
-
description: "Path to a favicon file (e.g. .ico) to bundle in place of the default Connect icon. Emitted as icon.ico; resolved relative to the build cwd."
|
|
769
|
+
description: "Path to a favicon file (e.g. .ico) to bundle in place of the default Connect icon. Emitted as icon.ico, or icon.svg/icon.png for those types; resolved relative to the build cwd."
|
|
711
770
|
}),
|
|
712
771
|
...commonArgs
|
|
713
772
|
};
|
|
@@ -787,11 +846,6 @@ const generateArgs = {
|
|
|
787
846
|
long: "document-type",
|
|
788
847
|
description: "Document type for the generated document editor."
|
|
789
848
|
}),
|
|
790
|
-
documentTypes: option({
|
|
791
|
-
type: optional(string),
|
|
792
|
-
long: "document-types",
|
|
793
|
-
description: "[DEPRECATED] Comma separated list of document types for the generated document editor. [WARNING] Generated editor code is not set up to handle multiple document types."
|
|
794
|
-
}),
|
|
795
849
|
appName: option({
|
|
796
850
|
type: optional(string),
|
|
797
851
|
long: "app",
|
|
@@ -923,22 +977,36 @@ const generateArgs = {
|
|
|
923
977
|
short: "sf",
|
|
924
978
|
description: "Skip formatting the generated code."
|
|
925
979
|
}),
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
980
|
+
...debugArgs
|
|
981
|
+
};
|
|
982
|
+
//#endregion
|
|
983
|
+
//#region clis/args/host.ts
|
|
984
|
+
const hostCheckArgs = {
|
|
985
|
+
host: positional({
|
|
986
|
+
type: string,
|
|
987
|
+
displayName: "host",
|
|
988
|
+
description: "the host to check (a directory under hosts/)"
|
|
932
989
|
}),
|
|
933
|
-
|
|
934
|
-
type:
|
|
935
|
-
long: "
|
|
936
|
-
description: "
|
|
937
|
-
defaultValue: () => false,
|
|
938
|
-
defaultValueIsSerializable: true
|
|
990
|
+
envFile: option({
|
|
991
|
+
type: optional(string),
|
|
992
|
+
long: "env",
|
|
993
|
+
description: "check against this env file alone instead of the project .env and the process env"
|
|
939
994
|
}),
|
|
940
|
-
|
|
995
|
+
verb: option({
|
|
996
|
+
type: optional(string),
|
|
997
|
+
long: "verb",
|
|
998
|
+
description: "the verb to check at (default: run)"
|
|
999
|
+
})
|
|
941
1000
|
};
|
|
1001
|
+
positional({
|
|
1002
|
+
type: string,
|
|
1003
|
+
displayName: "host",
|
|
1004
|
+
description: "the host to export (a directory under hosts/)"
|
|
1005
|
+
}), option({
|
|
1006
|
+
type: optional(string),
|
|
1007
|
+
long: "out",
|
|
1008
|
+
description: "write the JSON to this file instead of stdout"
|
|
1009
|
+
});
|
|
942
1010
|
//#endregion
|
|
943
1011
|
//#region clis/args/inspect.ts
|
|
944
1012
|
const inspectArgs = {
|
|
@@ -977,6 +1045,43 @@ const installArgs = {
|
|
|
977
1045
|
...debugArgs
|
|
978
1046
|
};
|
|
979
1047
|
//#endregion
|
|
1048
|
+
//#region clis/args/keyframes.ts
|
|
1049
|
+
const KEYFRAMES_ACTIONS = [
|
|
1050
|
+
"preview",
|
|
1051
|
+
"clean",
|
|
1052
|
+
"status",
|
|
1053
|
+
"cancel",
|
|
1054
|
+
"reclaim"
|
|
1055
|
+
];
|
|
1056
|
+
const keyframesArgs = {
|
|
1057
|
+
action: positional({
|
|
1058
|
+
type: oneOf(KEYFRAMES_ACTIONS),
|
|
1059
|
+
displayName: "action",
|
|
1060
|
+
description: "preview: report what a clean-up would remove, without writing. clean: apply the configured keep and remove the keyframes of deleted documents (needs --yes). status: show the latest run and reclaim. cancel: stop a running clean-up. reclaim: rewrite the Keyframe table to give the space back to the disk."
|
|
1061
|
+
}),
|
|
1062
|
+
url: option({
|
|
1063
|
+
type: optional(string),
|
|
1064
|
+
long: "url",
|
|
1065
|
+
description: "The switchboard's GraphQL endpoint, e.g. http://localhost:4001/graphql. Defaults to reactor.port in powerhouse.config.json."
|
|
1066
|
+
}),
|
|
1067
|
+
token: option({
|
|
1068
|
+
type: optional(string),
|
|
1069
|
+
long: "token",
|
|
1070
|
+
description: "Admin bearer token. Defaults to PH_ACCESS_TOKEN, then a token from your `ph login` identity. Its address must be in the host's auth admins."
|
|
1071
|
+
}),
|
|
1072
|
+
yes: flag({
|
|
1073
|
+
type: optional(boolean),
|
|
1074
|
+
long: "yes",
|
|
1075
|
+
description: "Confirms a clean or a reclaim; both refuse to run without it."
|
|
1076
|
+
}),
|
|
1077
|
+
json: flag({
|
|
1078
|
+
type: optional(boolean),
|
|
1079
|
+
long: "json",
|
|
1080
|
+
description: "Print the result as JSON."
|
|
1081
|
+
}),
|
|
1082
|
+
...debugArgs
|
|
1083
|
+
};
|
|
1084
|
+
//#endregion
|
|
980
1085
|
//#region clis/args/list.ts
|
|
981
1086
|
const listArgs = { ...debugArgs };
|
|
982
1087
|
//#endregion
|
|
@@ -1015,20 +1120,36 @@ const loginArgs = {
|
|
|
1015
1120
|
...debugArgs
|
|
1016
1121
|
};
|
|
1017
1122
|
//#endregion
|
|
1123
|
+
//#region clis/args/mcp.ts
|
|
1124
|
+
const mcpArgs = {
|
|
1125
|
+
projectDir: option({
|
|
1126
|
+
type: optional(string),
|
|
1127
|
+
long: "project-dir",
|
|
1128
|
+
description: "Powerhouse project to serve. Defaults to the nearest directory above the working directory that holds powerhouse.config.json."
|
|
1129
|
+
}),
|
|
1130
|
+
startTimeout: option({
|
|
1131
|
+
type: number,
|
|
1132
|
+
long: "start-timeout",
|
|
1133
|
+
description: "Seconds to wait for Vetra to answer /ready after starting it on the first tool call",
|
|
1134
|
+
defaultValue: () => 120,
|
|
1135
|
+
defaultValueIsSerializable: true
|
|
1136
|
+
}),
|
|
1137
|
+
...debugArgs
|
|
1138
|
+
};
|
|
1139
|
+
//#endregion
|
|
1018
1140
|
//#region clis/args/migrate.ts
|
|
1141
|
+
const versionDescription = "The version to migrate to. Accepts a valid semver version or `staging`, `dev`, `latest`. Defaults to the release channel of the project's installed Powerhouse packages.";
|
|
1019
1142
|
const migrateArgs = {
|
|
1020
1143
|
versionPositional: positional({
|
|
1021
1144
|
type: optional(string),
|
|
1022
1145
|
displayName: "version",
|
|
1023
|
-
description:
|
|
1146
|
+
description: versionDescription
|
|
1024
1147
|
}),
|
|
1025
1148
|
version: option({
|
|
1026
1149
|
long: "version",
|
|
1027
1150
|
short: "v",
|
|
1028
|
-
type: string,
|
|
1029
|
-
description:
|
|
1030
|
-
defaultValue: () => "latest",
|
|
1031
|
-
defaultValueIsSerializable: true
|
|
1151
|
+
type: optional(string),
|
|
1152
|
+
description: versionDescription
|
|
1032
1153
|
}),
|
|
1033
1154
|
force: flag({
|
|
1034
1155
|
type: optional(boolean),
|
|
@@ -1036,8 +1157,62 @@ const migrateArgs = {
|
|
|
1036
1157
|
short: "f",
|
|
1037
1158
|
description: "Run migrate from the bundled codegen even if the target version cannot be resolved from the npm registry or differs from the installed ph-cli version."
|
|
1038
1159
|
}),
|
|
1160
|
+
subgraphs: flag({
|
|
1161
|
+
type: optional(boolean),
|
|
1162
|
+
long: "subgraphs",
|
|
1163
|
+
description: "Convert every schema-first subgraph under subgraphs/ into a code-first one, keeping its schema and resolvers. Code-first subgraphs are skipped, and a subgraph that cannot keep the same schema is left as it is, with the reason. Upgrades no dependencies and regenerates nothing else."
|
|
1164
|
+
}),
|
|
1165
|
+
subgraph: multioption({
|
|
1166
|
+
type: array(string),
|
|
1167
|
+
long: "subgraph",
|
|
1168
|
+
description: "Convert only this directory of subgraphs/ into a code-first subgraph. Repeat it for more directories. Implies --subgraphs.",
|
|
1169
|
+
defaultValue: () => []
|
|
1170
|
+
}),
|
|
1171
|
+
dryRun: flag({
|
|
1172
|
+
type: optional(boolean),
|
|
1173
|
+
long: "dry-run",
|
|
1174
|
+
description: "Print the diff of every file the migration would add, change or delete, and write nothing. It installs nothing and regenerates no code; it lists those steps instead."
|
|
1175
|
+
}),
|
|
1176
|
+
...debugArgs
|
|
1177
|
+
};
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region clis/args/model.ts
|
|
1180
|
+
const json = flag({
|
|
1181
|
+
type: boolean,
|
|
1182
|
+
long: "json",
|
|
1183
|
+
description: "Print exactly one JSON report on stdout and nothing else",
|
|
1184
|
+
defaultValue: () => false,
|
|
1185
|
+
defaultValueIsSerializable: true
|
|
1186
|
+
});
|
|
1187
|
+
/**
|
|
1188
|
+
* @experimental Arguments of `ph model check`. Experimental while code-first
|
|
1189
|
+
* projects are introduced.
|
|
1190
|
+
*/
|
|
1191
|
+
const modelCheckArgs = {
|
|
1192
|
+
/** @experimental Runs the release profile instead of the edit profile. */
|
|
1193
|
+
release: flag({
|
|
1194
|
+
type: boolean,
|
|
1195
|
+
long: "release",
|
|
1196
|
+
description: "Experimental: check as ph build --release does, with the release checks and host validation over every model. Writes nothing",
|
|
1197
|
+
defaultValue: () => false,
|
|
1198
|
+
defaultValueIsSerializable: true
|
|
1199
|
+
}),
|
|
1200
|
+
/** @experimental Verifies the release approval without loading the project. */
|
|
1201
|
+
prepack: flag({
|
|
1202
|
+
type: boolean,
|
|
1203
|
+
long: "prepack",
|
|
1204
|
+
description: "Experimental: without loading the package, exit 0 when the release approval ph build --release wrote matches it, 1 when it does not, and 2 when it cannot be checked. For a \"prepack\" script, so npm publish stops too",
|
|
1205
|
+
defaultValue: () => false,
|
|
1206
|
+
defaultValueIsSerializable: true
|
|
1207
|
+
}),
|
|
1208
|
+
json,
|
|
1039
1209
|
...debugArgs
|
|
1040
1210
|
};
|
|
1211
|
+
positional({
|
|
1212
|
+
type: optional(string),
|
|
1213
|
+
displayName: "documentType@version",
|
|
1214
|
+
description: "Inspect one model version, such as acme/invoice@1 (default: every model)"
|
|
1215
|
+
}), { ...debugArgs };
|
|
1041
1216
|
//#endregion
|
|
1042
1217
|
//#region clis/args/publish.ts
|
|
1043
1218
|
const publishArgs = {
|
|
@@ -1046,6 +1221,14 @@ const publishArgs = {
|
|
|
1046
1221
|
long: "registry",
|
|
1047
1222
|
description: "Registry URL to publish to (overrides config and environment)"
|
|
1048
1223
|
}),
|
|
1224
|
+
/** @experimental Refuses to publish a package without a current release approval. */
|
|
1225
|
+
requireApproval: flag({
|
|
1226
|
+
type: boolean,
|
|
1227
|
+
long: "require-approval",
|
|
1228
|
+
description: "Experimental: publish only when the release approval that ph build --release wrote matches this package; otherwise exit 1 before contacting the registry. Forwards only --tag, --access, --otp, --dry-run, --provenance, --json and --loglevel to npm, refuses npm configuration in the environment that selects another package (npm_config_workspace, npm_config_workspaces, npm_config_include_workspace_root), and publishes with --ignore-scripts so lifecycle scripts cannot change the files it checked",
|
|
1229
|
+
defaultValue: () => false,
|
|
1230
|
+
defaultValueIsSerializable: true
|
|
1231
|
+
}),
|
|
1049
1232
|
...debugArgs,
|
|
1050
1233
|
forwardedArgs: rest({
|
|
1051
1234
|
displayName: "npm-args",
|
|
@@ -1071,6 +1254,35 @@ const registryLoginArgs = {
|
|
|
1071
1254
|
...debugArgs
|
|
1072
1255
|
};
|
|
1073
1256
|
//#endregion
|
|
1257
|
+
//#region clis/args/run.ts
|
|
1258
|
+
const runArgs = {
|
|
1259
|
+
host: positional({
|
|
1260
|
+
type: string,
|
|
1261
|
+
displayName: "host",
|
|
1262
|
+
description: "the host to run (a directory under hosts/)"
|
|
1263
|
+
}),
|
|
1264
|
+
verb: positional({
|
|
1265
|
+
type: optional(string),
|
|
1266
|
+
displayName: "verb",
|
|
1267
|
+
description: "optional verb the runner forwards (dev, build, serve, …)"
|
|
1268
|
+
}),
|
|
1269
|
+
debug: flag({
|
|
1270
|
+
type: optional(boolean),
|
|
1271
|
+
long: "debug",
|
|
1272
|
+
description: "verbose runner diagnostics"
|
|
1273
|
+
}),
|
|
1274
|
+
explain: option({
|
|
1275
|
+
type: optional(string),
|
|
1276
|
+
long: "explain",
|
|
1277
|
+
description: "explain a resolved aspect instead of running (drives, outputs)"
|
|
1278
|
+
}),
|
|
1279
|
+
argv: restPositionals({
|
|
1280
|
+
type: string,
|
|
1281
|
+
displayName: "runner arguments",
|
|
1282
|
+
description: "arguments for the host's runner (e.g. --port 4001)"
|
|
1283
|
+
})
|
|
1284
|
+
};
|
|
1285
|
+
//#endregion
|
|
1074
1286
|
//#region clis/args/switchboard.ts
|
|
1075
1287
|
const switchboardArgs = {
|
|
1076
1288
|
...vetraSwitchboardArgs,
|
|
@@ -1085,7 +1297,7 @@ const switchboardArgs = {
|
|
|
1085
1297
|
basePath: option({
|
|
1086
1298
|
type: optional(string),
|
|
1087
1299
|
long: "base-path",
|
|
1088
|
-
description: "base path for the API endpoints (
|
|
1300
|
+
description: "base path for the API endpoints (overrides BASE_PATH)"
|
|
1089
1301
|
}),
|
|
1090
1302
|
keypairPath: option({
|
|
1091
1303
|
type: optional(string),
|
|
@@ -1164,6 +1376,13 @@ const uninstallArgs = {
|
|
|
1164
1376
|
//#endregion
|
|
1165
1377
|
//#region clis/project-env.ts
|
|
1166
1378
|
let loadedFor;
|
|
1379
|
+
let namesBeforeLoad;
|
|
1380
|
+
/** `PH_NO_DOTENV=1` (or `true`): no `.env` file is read, so a launcher's
|
|
1381
|
+
* explicit environment is the whole environment. */
|
|
1382
|
+
function isDotenvDisabled(env = process.env) {
|
|
1383
|
+
const value = env.PH_NO_DOTENV?.trim().toLowerCase();
|
|
1384
|
+
return value === "1" || value === "true";
|
|
1385
|
+
}
|
|
1167
1386
|
/**
|
|
1168
1387
|
* Load the project's `.env.local` and `.env` into `process.env`.
|
|
1169
1388
|
*
|
|
@@ -1177,8 +1396,10 @@ let loadedFor;
|
|
|
1177
1396
|
* call it more than once per process.
|
|
1178
1397
|
*/
|
|
1179
1398
|
function loadProjectEnv(cwd = process.cwd()) {
|
|
1399
|
+
if (isDotenvDisabled()) return;
|
|
1180
1400
|
if (loadedFor === cwd) return;
|
|
1181
1401
|
loadedFor = cwd;
|
|
1402
|
+
namesBeforeLoad ??= new Set(Object.keys(process.env));
|
|
1182
1403
|
dotenv.config({ path: join(cwd, ".env.local") });
|
|
1183
1404
|
dotenv.config({ path: join(cwd, ".env") });
|
|
1184
1405
|
}
|
|
@@ -1251,6 +1472,13 @@ const vetraArgs = {
|
|
|
1251
1472
|
defaultValue: () => false,
|
|
1252
1473
|
defaultValueIsSerializable: true
|
|
1253
1474
|
}),
|
|
1475
|
+
restart: flag({
|
|
1476
|
+
type: boolean,
|
|
1477
|
+
long: "restart",
|
|
1478
|
+
description: "Stop this project's running Vetra first (the pid in .ph/vetra-runtime.json), then start",
|
|
1479
|
+
defaultValue: () => false,
|
|
1480
|
+
defaultValueIsSerializable: true
|
|
1481
|
+
}),
|
|
1254
1482
|
disableConnect: flag({
|
|
1255
1483
|
type: boolean,
|
|
1256
1484
|
long: "disable-connect",
|
|
@@ -1283,6 +1511,8 @@ const vetraArgs = {
|
|
|
1283
1511
|
//#endregion
|
|
1284
1512
|
//#region clis/command-names.ts
|
|
1285
1513
|
const phCliCommandNames = [
|
|
1514
|
+
"run",
|
|
1515
|
+
"host",
|
|
1286
1516
|
"generate",
|
|
1287
1517
|
"vetra",
|
|
1288
1518
|
"connect",
|
|
@@ -1294,7 +1524,10 @@ const phCliCommandNames = [
|
|
|
1294
1524
|
"registry-login",
|
|
1295
1525
|
"inspect",
|
|
1296
1526
|
"is",
|
|
1527
|
+
"keyframes",
|
|
1528
|
+
"mcp",
|
|
1297
1529
|
"migrate",
|
|
1530
|
+
"model",
|
|
1298
1531
|
"switchboard",
|
|
1299
1532
|
"reactor",
|
|
1300
1533
|
"login",
|
|
@@ -1318,6 +1551,18 @@ function helpCommand(config) {
|
|
|
1318
1551
|
});
|
|
1319
1552
|
}
|
|
1320
1553
|
const phCliHelpCommands = {
|
|
1554
|
+
run: helpCommand({
|
|
1555
|
+
name: "run",
|
|
1556
|
+
args: runArgs,
|
|
1557
|
+
description: "Run a host from hosts/ with its runner",
|
|
1558
|
+
handler: () => {}
|
|
1559
|
+
}),
|
|
1560
|
+
host: helpCommand({
|
|
1561
|
+
name: "host",
|
|
1562
|
+
args: hostCheckArgs,
|
|
1563
|
+
description: "Check or export a host from hosts/: `ph host check|export <host>`",
|
|
1564
|
+
handler: () => {}
|
|
1565
|
+
}),
|
|
1321
1566
|
generate: helpCommand({
|
|
1322
1567
|
name: "generate",
|
|
1323
1568
|
args: generateArgs,
|
|
@@ -1374,12 +1619,30 @@ const phCliHelpCommands = {
|
|
|
1374
1619
|
description: "Inspect a package",
|
|
1375
1620
|
handler: () => {}
|
|
1376
1621
|
}),
|
|
1622
|
+
mcp: helpCommand({
|
|
1623
|
+
name: "mcp",
|
|
1624
|
+
args: mcpArgs,
|
|
1625
|
+
description: "Serve the project's reactor-mcp tools over stdio, starting Vetra on the first tool call",
|
|
1626
|
+
handler: () => {}
|
|
1627
|
+
}),
|
|
1628
|
+
keyframes: helpCommand({
|
|
1629
|
+
name: "keyframes",
|
|
1630
|
+
args: keyframesArgs,
|
|
1631
|
+
description: "Report on and clean up the keyframes of a running switchboard",
|
|
1632
|
+
handler: () => {}
|
|
1633
|
+
}),
|
|
1377
1634
|
migrate: helpCommand({
|
|
1378
1635
|
name: "migrate",
|
|
1379
1636
|
args: migrateArgs,
|
|
1380
1637
|
description: "Run migrations",
|
|
1381
1638
|
handler: () => {}
|
|
1382
1639
|
}),
|
|
1640
|
+
model: helpCommand({
|
|
1641
|
+
name: "model",
|
|
1642
|
+
args: modelCheckArgs,
|
|
1643
|
+
description: "Check or inspect this package's document models (experimental): `ph model check|inspect`",
|
|
1644
|
+
handler: () => {}
|
|
1645
|
+
}),
|
|
1383
1646
|
switchboard: helpCommand({
|
|
1384
1647
|
name: "switchboard",
|
|
1385
1648
|
aliases: ["reactor"],
|
|
@@ -1429,6 +1692,12 @@ const initArgs = {
|
|
|
1429
1692
|
description: "The name of your project. A new directory will be created in your current directory with this name."
|
|
1430
1693
|
}),
|
|
1431
1694
|
...packageManagerArgs,
|
|
1695
|
+
packageManager: option({
|
|
1696
|
+
type: optional(oneOf(AGENTS)),
|
|
1697
|
+
long: "package-manager",
|
|
1698
|
+
short: "p",
|
|
1699
|
+
description: "Package manager that installs the project: `npm`, `pnpm`, `yarn` or `bun`. Defaults to the one that launched ph (npx, pnpm dlx, bunx), else the one that installed ph (unless npm), else bun, then pnpm 10.14 or later if installed, else npm."
|
|
1700
|
+
}),
|
|
1432
1701
|
tag: option({
|
|
1433
1702
|
type: optional(oneOf([
|
|
1434
1703
|
"latest",
|
|
@@ -1469,10 +1738,15 @@ const initArgs = {
|
|
|
1469
1738
|
short: "r",
|
|
1470
1739
|
description: "Remote drive identifier."
|
|
1471
1740
|
}),
|
|
1741
|
+
uniformRunners: flag({
|
|
1742
|
+
type: optional(boolean),
|
|
1743
|
+
long: "uniform-runners",
|
|
1744
|
+
description: "Deprecated: no longer needed, `ph init` always scaffolds the hosts/ folder. Accepted with a warning; will be removed in a future release."
|
|
1745
|
+
}),
|
|
1472
1746
|
clone: option({
|
|
1473
1747
|
type: optional(string),
|
|
1474
1748
|
long: "clone",
|
|
1475
|
-
description: "Path to an existing scaffolded project to clone instead of resolving deps from scratch. Install runs offline from the cloned project's pnpm-lock.yaml (
|
|
1749
|
+
description: "Path to an existing scaffolded project to clone instead of resolving deps from scratch. Install runs offline from the cloned project's lockfile: pnpm-lock.yaml with pnpm, package-lock.json with npm (other package managers are refused; --version/--tag are ignored)."
|
|
1476
1750
|
}),
|
|
1477
1751
|
...debugArgs
|
|
1478
1752
|
};
|
|
@@ -1508,6 +1782,39 @@ const unpublishArgs = {
|
|
|
1508
1782
|
})
|
|
1509
1783
|
};
|
|
1510
1784
|
//#endregion
|
|
1785
|
+
//#region clis/ph-dir.ts
|
|
1786
|
+
/**
|
|
1787
|
+
* The project's `.ph` tree — stores, identity, run records, registry cache.
|
|
1788
|
+
*
|
|
1789
|
+
* Classically `<cwd>/.ph` (every classic command resolves it exactly so). A
|
|
1790
|
+
* desktop shell relocates the WHOLE tree under the user's profile by setting
|
|
1791
|
+
* `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names
|
|
1792
|
+
* under a different root, and nothing of the user's lands in the install
|
|
1793
|
+
* dir. One resolver replaces the former `.ph/...` literals; it adds no path
|
|
1794
|
+
* names and no layout of its own.
|
|
1795
|
+
*/
|
|
1796
|
+
function resolvePhDir(base = process.cwd(), env = process.env) {
|
|
1797
|
+
return path.join(env.PH_USER_DATA_DIR ?? base, ".ph");
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* The two PGlite store dirs the switchboard defaults to, for the server and
|
|
1801
|
+
* for `ph switchboard --reset` (which must touch the same paths). Without a
|
|
1802
|
+
* user-data root these are the classic literals, verbatim — byte-identical
|
|
1803
|
+
* to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they
|
|
1804
|
+
* are the same names inside `${userData}/.ph`.
|
|
1805
|
+
*/
|
|
1806
|
+
function defaultStoreDirs(env = process.env, phDir) {
|
|
1807
|
+
const root = phDir ?? (env.PH_USER_DATA_DIR ? resolvePhDir(void 0, env) : void 0);
|
|
1808
|
+
if (root === void 0) return {
|
|
1809
|
+
reactor: "./.ph/reactor-storage",
|
|
1810
|
+
readModel: ".ph/read-storage"
|
|
1811
|
+
};
|
|
1812
|
+
return {
|
|
1813
|
+
reactor: path.join(root, "reactor-storage"),
|
|
1814
|
+
readModel: path.join(root, "read-storage")
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
//#endregion
|
|
1511
1818
|
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
1512
1819
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1513
1820
|
let p = process || {};
|
|
@@ -1600,7 +1907,7 @@ var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1600
1907
|
};
|
|
1601
1908
|
}));
|
|
1602
1909
|
//#endregion
|
|
1603
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.
|
|
1910
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.29.7/node_modules/@babel/helper-validator-identifier/lib/identifier.js
|
|
1604
1911
|
var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1605
1912
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1606
1913
|
exports.isIdentifierChar = isIdentifierChar;
|
|
@@ -2608,7 +2915,7 @@ var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2608
2915
|
}
|
|
2609
2916
|
}));
|
|
2610
2917
|
//#endregion
|
|
2611
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.
|
|
2918
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.29.7/node_modules/@babel/helper-validator-identifier/lib/keyword.js
|
|
2612
2919
|
var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2613
2920
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2614
2921
|
exports.isKeyword = isKeyword;
|
|
@@ -2687,7 +2994,7 @@ var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2687
2994
|
}
|
|
2688
2995
|
}));
|
|
2689
2996
|
//#endregion
|
|
2690
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.
|
|
2997
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.29.7/node_modules/@babel/helper-validator-identifier/lib/index.js
|
|
2691
2998
|
var require_lib$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2692
2999
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2693
3000
|
Object.defineProperty(exports, "isIdentifierChar", {
|
|
@@ -4304,58 +4611,47 @@ var require_validate_npm_package_license = /* @__PURE__ */ __commonJSMin(((expor
|
|
|
4304
4611
|
};
|
|
4305
4612
|
}));
|
|
4306
4613
|
//#endregion
|
|
4307
|
-
//#region ../../node_modules/.pnpm/lru-cache@11.
|
|
4614
|
+
//#region ../../node_modules/.pnpm/lru-cache@11.5.0/node_modules/lru-cache/dist/commonjs/node/index.min.js
|
|
4308
4615
|
var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4616
|
+
var j = (c, t) => () => (t || c((t = { exports: {} }).exports, t), t.exports);
|
|
4617
|
+
var I = j((O) => {
|
|
4618
|
+
"use strict";
|
|
4619
|
+
Object.defineProperty(O, "__esModule", { value: !0 });
|
|
4620
|
+
O.tracing = O.metrics = void 0;
|
|
4621
|
+
var U = __require("node:diagnostics_channel");
|
|
4622
|
+
O.metrics = (0, U.channel)("lru-cache:metrics");
|
|
4623
|
+
O.tracing = (0, U.tracingChannel)("lru-cache");
|
|
4624
|
+
});
|
|
4625
|
+
var P = j((D) => {
|
|
4626
|
+
"use strict";
|
|
4627
|
+
Object.defineProperty(D, "__esModule", { value: !0 });
|
|
4628
|
+
D.defaultPerf = void 0;
|
|
4629
|
+
D.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
4630
|
+
});
|
|
4309
4631
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
4310
4632
|
exports.LRUCache = void 0;
|
|
4311
|
-
var
|
|
4312
|
-
var
|
|
4313
|
-
var
|
|
4314
|
-
var
|
|
4315
|
-
|
|
4633
|
+
var g = I();
|
|
4634
|
+
var N = P();
|
|
4635
|
+
var C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers;
|
|
4636
|
+
var k = /* @__PURE__ */ new Set();
|
|
4637
|
+
var G = typeof process == "object" && process ? process : {};
|
|
4638
|
+
var V = (c, t, e, i) => {
|
|
4639
|
+
typeof G.emitWarning == "function" ? G.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
|
|
4316
4640
|
};
|
|
4317
|
-
var
|
|
4318
|
-
var
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
onabort;
|
|
4322
|
-
_onabort = [];
|
|
4323
|
-
reason;
|
|
4324
|
-
aborted = !1;
|
|
4325
|
-
addEventListener(i, s) {
|
|
4326
|
-
this._onabort.push(s);
|
|
4327
|
-
}
|
|
4328
|
-
}, C = class {
|
|
4329
|
-
constructor() {
|
|
4330
|
-
t();
|
|
4331
|
-
}
|
|
4332
|
-
signal = new L();
|
|
4333
|
-
abort(i) {
|
|
4334
|
-
if (!this.signal.aborted) {
|
|
4335
|
-
this.signal.reason = i, this.signal.aborted = !0;
|
|
4336
|
-
for (let s of this.signal._onabort) s(i);
|
|
4337
|
-
this.signal.onabort?.(i);
|
|
4338
|
-
}
|
|
4339
|
-
}
|
|
4340
|
-
};
|
|
4341
|
-
let c = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
4342
|
-
c && (c = !1, I("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
4343
|
-
};
|
|
4344
|
-
}
|
|
4345
|
-
var x = (c) => !U.has(c);
|
|
4346
|
-
var y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c);
|
|
4347
|
-
var M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z : null : null;
|
|
4348
|
-
var z = class extends Array {
|
|
4641
|
+
var q = (c) => !k.has(c);
|
|
4642
|
+
var T = (c) => !!c && c === Math.floor(c) && c > 0 && isFinite(c);
|
|
4643
|
+
var H = (c) => T(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? W : null : null;
|
|
4644
|
+
var W = class extends Array {
|
|
4349
4645
|
constructor(t) {
|
|
4350
4646
|
super(t), this.fill(0);
|
|
4351
4647
|
}
|
|
4352
4648
|
};
|
|
4353
|
-
var
|
|
4649
|
+
var x = class c {
|
|
4354
4650
|
heap;
|
|
4355
4651
|
length;
|
|
4356
4652
|
static #o = !1;
|
|
4357
4653
|
static create(t) {
|
|
4358
|
-
let e =
|
|
4654
|
+
let e = H(t);
|
|
4359
4655
|
if (!e) return [];
|
|
4360
4656
|
c.#o = !0;
|
|
4361
4657
|
let i = new c(t, e);
|
|
@@ -4375,14 +4671,14 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4375
4671
|
exports.LRUCache = class c {
|
|
4376
4672
|
#o;
|
|
4377
4673
|
#c;
|
|
4378
|
-
#w;
|
|
4379
|
-
#C;
|
|
4380
|
-
#S;
|
|
4381
|
-
#L;
|
|
4382
|
-
#U;
|
|
4383
4674
|
#m;
|
|
4675
|
+
#W;
|
|
4676
|
+
#S;
|
|
4677
|
+
#M;
|
|
4678
|
+
#j;
|
|
4679
|
+
#w;
|
|
4384
4680
|
get perf() {
|
|
4385
|
-
return this.#
|
|
4681
|
+
return this.#w;
|
|
4386
4682
|
}
|
|
4387
4683
|
ttl;
|
|
4388
4684
|
ttlResolution;
|
|
@@ -4399,48 +4695,49 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4399
4695
|
allowStaleOnFetchAbort;
|
|
4400
4696
|
allowStaleOnFetchRejection;
|
|
4401
4697
|
ignoreFetchAbort;
|
|
4698
|
+
backgroundFetchSize;
|
|
4402
4699
|
#n;
|
|
4403
|
-
#
|
|
4700
|
+
#b;
|
|
4404
4701
|
#s;
|
|
4405
4702
|
#i;
|
|
4406
4703
|
#t;
|
|
4407
|
-
#a;
|
|
4408
|
-
#u;
|
|
4409
4704
|
#l;
|
|
4705
|
+
#u;
|
|
4706
|
+
#a;
|
|
4410
4707
|
#h;
|
|
4411
|
-
#
|
|
4708
|
+
#_;
|
|
4412
4709
|
#r;
|
|
4413
4710
|
#y;
|
|
4414
|
-
#
|
|
4711
|
+
#F;
|
|
4415
4712
|
#d;
|
|
4416
4713
|
#g;
|
|
4417
4714
|
#T;
|
|
4418
|
-
#
|
|
4715
|
+
#U;
|
|
4419
4716
|
#f;
|
|
4420
|
-
#
|
|
4717
|
+
#D;
|
|
4421
4718
|
static unsafeExposeInternals(t) {
|
|
4422
4719
|
return {
|
|
4423
|
-
starts: t.#
|
|
4720
|
+
starts: t.#F,
|
|
4424
4721
|
ttls: t.#d,
|
|
4425
4722
|
autopurgeTimers: t.#g,
|
|
4426
4723
|
sizes: t.#y,
|
|
4427
4724
|
keyMap: t.#s,
|
|
4428
4725
|
keyList: t.#i,
|
|
4429
4726
|
valList: t.#t,
|
|
4430
|
-
next: t.#
|
|
4727
|
+
next: t.#l,
|
|
4431
4728
|
prev: t.#u,
|
|
4432
4729
|
get head() {
|
|
4433
|
-
return t.#
|
|
4730
|
+
return t.#a;
|
|
4434
4731
|
},
|
|
4435
4732
|
get tail() {
|
|
4436
4733
|
return t.#h;
|
|
4437
4734
|
},
|
|
4438
|
-
free: t.#
|
|
4735
|
+
free: t.#_,
|
|
4439
4736
|
isBackgroundFetch: (e) => t.#e(e),
|
|
4440
|
-
backgroundFetch: (e, i, s, n) => t.#
|
|
4441
|
-
moveToTail: (e) => t.#
|
|
4442
|
-
indexes: (e) => t.#
|
|
4443
|
-
rindexes: (e) => t.#
|
|
4737
|
+
backgroundFetch: (e, i, s, n) => t.#G(e, i, s, n),
|
|
4738
|
+
moveToTail: (e) => t.#L(e),
|
|
4739
|
+
indexes: (e) => t.#A(e),
|
|
4740
|
+
rindexes: (e) => t.#z(e),
|
|
4444
4741
|
isStale: (e) => t.#p(e)
|
|
4445
4742
|
};
|
|
4446
4743
|
}
|
|
@@ -4451,188 +4748,190 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4451
4748
|
return this.#c;
|
|
4452
4749
|
}
|
|
4453
4750
|
get calculatedSize() {
|
|
4454
|
-
return this.#
|
|
4751
|
+
return this.#b;
|
|
4455
4752
|
}
|
|
4456
4753
|
get size() {
|
|
4457
4754
|
return this.#n;
|
|
4458
4755
|
}
|
|
4459
4756
|
get fetchMethod() {
|
|
4460
|
-
return this.#
|
|
4757
|
+
return this.#M;
|
|
4461
4758
|
}
|
|
4462
4759
|
get memoMethod() {
|
|
4463
|
-
return this.#
|
|
4760
|
+
return this.#j;
|
|
4464
4761
|
}
|
|
4465
4762
|
get dispose() {
|
|
4466
|
-
return this.#
|
|
4763
|
+
return this.#m;
|
|
4467
4764
|
}
|
|
4468
4765
|
get onInsert() {
|
|
4469
|
-
return this.#
|
|
4766
|
+
return this.#W;
|
|
4470
4767
|
}
|
|
4471
4768
|
get disposeAfter() {
|
|
4472
4769
|
return this.#S;
|
|
4473
4770
|
}
|
|
4474
4771
|
constructor(t) {
|
|
4475
|
-
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet:
|
|
4476
|
-
if (v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
4477
|
-
if (this.#
|
|
4478
|
-
let
|
|
4479
|
-
if (!
|
|
4480
|
-
if (this.#o = e, this.#c =
|
|
4772
|
+
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: r, updateAgeOnHas: h, allowStale: a, dispose: o, onInsert: d, disposeAfter: _, noDisposeOnSet: y, noUpdateTTL: u, maxSize: p = 0, maxEntrySize: f = 0, sizeCalculation: b, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: w, allowStaleOnFetchRejection: m, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: M = 1, perf: v } = t;
|
|
4773
|
+
if (this.backgroundFetchSize = M, v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
4774
|
+
if (this.#w = v ?? N.defaultPerf, e !== 0 && !T(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
4775
|
+
let E = e ? H(e) : Array;
|
|
4776
|
+
if (!E) throw new Error("invalid max value: " + e);
|
|
4777
|
+
if (this.#o = e, this.#c = p, this.maxEntrySize = f || this.#c, this.sizeCalculation = b, this.sizeCalculation) {
|
|
4481
4778
|
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
4482
4779
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
4483
4780
|
}
|
|
4484
4781
|
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
4485
|
-
if (this.#
|
|
4486
|
-
if (this.#
|
|
4487
|
-
if (this.#c !== 0 && !
|
|
4488
|
-
if (!
|
|
4489
|
-
this.#
|
|
4782
|
+
if (this.#j = S, l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
4783
|
+
if (this.#M = l, this.#U = !!l, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: e }).fill(void 0), this.#t = Array.from({ length: e }).fill(void 0), this.#l = new E(e), this.#u = new E(e), this.#a = 0, this.#h = 0, this.#_ = x.create(e), this.#n = 0, this.#b = 0, typeof o == "function" && (this.#m = o), typeof d == "function" && (this.#W = d), typeof _ == "function" ? (this.#S = _, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#m, this.#D = !!this.#W, this.#f = !!this.#S, this.noDisposeOnSet = !!y, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!m, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
|
|
4784
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
4785
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
4786
|
+
this.#X();
|
|
4490
4787
|
}
|
|
4491
|
-
if (this.allowStale = !!
|
|
4492
|
-
if (!
|
|
4493
|
-
this.#
|
|
4788
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!w, this.updateAgeOnGet = !!r, this.updateAgeOnHas = !!h, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
4789
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
4790
|
+
this.#k();
|
|
4494
4791
|
}
|
|
4495
4792
|
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
4496
4793
|
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
4497
|
-
let
|
|
4498
|
-
|
|
4794
|
+
let R = "LRU_CACHE_UNBOUNDED";
|
|
4795
|
+
q(R) && (k.add(R), V("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", R, c));
|
|
4499
4796
|
}
|
|
4500
4797
|
}
|
|
4501
4798
|
getRemainingTTL(t) {
|
|
4502
4799
|
return this.#s.has(t) ? 1 / 0 : 0;
|
|
4503
4800
|
}
|
|
4504
|
-
#
|
|
4505
|
-
let t = new
|
|
4506
|
-
this.#d = t, this.#
|
|
4507
|
-
let i = this.ttlAutopurge ?
|
|
4508
|
-
this.#g = i, this.#
|
|
4509
|
-
e[h] =
|
|
4801
|
+
#k() {
|
|
4802
|
+
let t = new W(this.#o), e = new W(this.#o);
|
|
4803
|
+
this.#d = t, this.#F = e;
|
|
4804
|
+
let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
4805
|
+
this.#g = i, this.#H = (h, a, o = this.#w.now()) => {
|
|
4806
|
+
e[h] = a !== 0 ? o : 0, t[h] = a, s(h, a);
|
|
4510
4807
|
}, this.#R = (h) => {
|
|
4511
|
-
e[h] = t[h] !== 0 ? this.#
|
|
4808
|
+
e[h] = t[h] !== 0 ? this.#w.now() : 0, s(h, t[h]);
|
|
4512
4809
|
};
|
|
4513
|
-
let s = this.ttlAutopurge ? (h,
|
|
4514
|
-
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0),
|
|
4515
|
-
let
|
|
4516
|
-
this.#p(h) && this.#
|
|
4517
|
-
},
|
|
4518
|
-
|
|
4810
|
+
let s = this.ttlAutopurge ? (h, a) => {
|
|
4811
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), a && a !== 0 && i) {
|
|
4812
|
+
let o = setTimeout(() => {
|
|
4813
|
+
this.#p(h) && this.#v(this.#i[h], "expire");
|
|
4814
|
+
}, a + 1);
|
|
4815
|
+
o.unref && o.unref(), i[h] = o;
|
|
4519
4816
|
}
|
|
4520
4817
|
} : () => {};
|
|
4521
|
-
this.#
|
|
4522
|
-
if (t[
|
|
4523
|
-
let
|
|
4524
|
-
if (!
|
|
4525
|
-
h.ttl =
|
|
4526
|
-
h.remainingTTL =
|
|
4818
|
+
this.#E = (h, a) => {
|
|
4819
|
+
if (t[a]) {
|
|
4820
|
+
let o = t[a], d = e[a];
|
|
4821
|
+
if (!o || !d) return;
|
|
4822
|
+
h.ttl = o, h.start = d, h.now = n || r();
|
|
4823
|
+
h.remainingTTL = o - (h.now - d);
|
|
4527
4824
|
}
|
|
4528
4825
|
};
|
|
4529
|
-
let n = 0,
|
|
4530
|
-
let h = this.#
|
|
4826
|
+
let n = 0, r = () => {
|
|
4827
|
+
let h = this.#w.now();
|
|
4531
4828
|
if (this.ttlResolution > 0) {
|
|
4532
4829
|
n = h;
|
|
4533
|
-
let
|
|
4534
|
-
|
|
4830
|
+
let a = setTimeout(() => n = 0, this.ttlResolution);
|
|
4831
|
+
a.unref && a.unref();
|
|
4535
4832
|
}
|
|
4536
4833
|
return h;
|
|
4537
4834
|
};
|
|
4538
4835
|
this.getRemainingTTL = (h) => {
|
|
4539
|
-
let
|
|
4540
|
-
if (
|
|
4541
|
-
let
|
|
4542
|
-
if (!
|
|
4543
|
-
return
|
|
4836
|
+
let a = this.#s.get(h);
|
|
4837
|
+
if (a === void 0) return 0;
|
|
4838
|
+
let o = t[a], d = e[a];
|
|
4839
|
+
if (!o || !d) return 1 / 0;
|
|
4840
|
+
return o - ((n || r()) - d);
|
|
4544
4841
|
}, this.#p = (h) => {
|
|
4545
|
-
let
|
|
4546
|
-
return !!
|
|
4842
|
+
let a = e[h], o = t[h];
|
|
4843
|
+
return !!o && !!a && (n || r()) - a > o;
|
|
4547
4844
|
};
|
|
4548
4845
|
}
|
|
4549
4846
|
#R = () => {};
|
|
4550
|
-
#
|
|
4551
|
-
#
|
|
4847
|
+
#E = () => {};
|
|
4848
|
+
#H = () => {};
|
|
4552
4849
|
#p = () => !1;
|
|
4553
|
-
#
|
|
4554
|
-
let t = new
|
|
4555
|
-
this.#
|
|
4556
|
-
this.#
|
|
4557
|
-
}, this.#
|
|
4558
|
-
if (
|
|
4559
|
-
|
|
4560
|
-
if (
|
|
4561
|
-
|
|
4562
|
-
|
|
4850
|
+
#X() {
|
|
4851
|
+
let t = new W(this.#o);
|
|
4852
|
+
this.#b = 0, this.#y = t, this.#C = (e) => {
|
|
4853
|
+
this.#b -= t[e], t[e] = 0;
|
|
4854
|
+
}, this.#N = (e, i, s, n) => {
|
|
4855
|
+
if (!T(s)) {
|
|
4856
|
+
if (this.#e(i)) return this.backgroundFetchSize;
|
|
4857
|
+
if (n) {
|
|
4858
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
4859
|
+
if (s = n(i, e), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
4860
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
4861
|
+
}
|
|
4563
4862
|
return s;
|
|
4564
|
-
}, this.#
|
|
4863
|
+
}, this.#I = (e, i, s) => {
|
|
4565
4864
|
if (t[e] = i, this.#c) {
|
|
4566
4865
|
let n = this.#c - t[e];
|
|
4567
|
-
for (; this.#
|
|
4866
|
+
for (; this.#b > n;) this.#P(!0);
|
|
4568
4867
|
}
|
|
4569
|
-
this.#
|
|
4868
|
+
this.#b += t[e], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
|
|
4570
4869
|
};
|
|
4571
4870
|
}
|
|
4572
|
-
#
|
|
4573
|
-
#
|
|
4574
|
-
#
|
|
4871
|
+
#C = (t) => {};
|
|
4872
|
+
#I = (t, e, i) => {};
|
|
4873
|
+
#N = (t, e, i, s) => {
|
|
4575
4874
|
if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
4576
4875
|
return 0;
|
|
4577
4876
|
};
|
|
4578
|
-
*#
|
|
4579
|
-
if (this.#n) for (let e = this.#h;
|
|
4877
|
+
*#A({ allowStale: t = this.allowStale } = {}) {
|
|
4878
|
+
if (this.#n) for (let e = this.#h; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#a);) e = this.#u[e];
|
|
4580
4879
|
}
|
|
4581
|
-
*#
|
|
4582
|
-
if (this.#n) for (let e = this.#
|
|
4880
|
+
*#z({ allowStale: t = this.allowStale } = {}) {
|
|
4881
|
+
if (this.#n) for (let e = this.#a; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#h);) e = this.#l[e];
|
|
4583
4882
|
}
|
|
4584
|
-
#
|
|
4883
|
+
#V(t) {
|
|
4585
4884
|
return t !== void 0 && this.#s.get(this.#i[t]) === t;
|
|
4586
4885
|
}
|
|
4587
4886
|
*entries() {
|
|
4588
|
-
for (let t of this.#
|
|
4887
|
+
for (let t of this.#A()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
4589
4888
|
}
|
|
4590
4889
|
*rentries() {
|
|
4591
|
-
for (let t of this.#
|
|
4890
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
4592
4891
|
}
|
|
4593
4892
|
*keys() {
|
|
4594
|
-
for (let t of this.#
|
|
4893
|
+
for (let t of this.#A()) {
|
|
4595
4894
|
let e = this.#i[t];
|
|
4596
4895
|
e !== void 0 && !this.#e(this.#t[t]) && (yield e);
|
|
4597
4896
|
}
|
|
4598
4897
|
}
|
|
4599
4898
|
*rkeys() {
|
|
4600
|
-
for (let t of this.#
|
|
4899
|
+
for (let t of this.#z()) {
|
|
4601
4900
|
let e = this.#i[t];
|
|
4602
4901
|
e !== void 0 && !this.#e(this.#t[t]) && (yield e);
|
|
4603
4902
|
}
|
|
4604
4903
|
}
|
|
4605
4904
|
*values() {
|
|
4606
|
-
for (let t of this.#
|
|
4905
|
+
for (let t of this.#A()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
4607
4906
|
}
|
|
4608
4907
|
*rvalues() {
|
|
4609
|
-
for (let t of this.#
|
|
4908
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
4610
4909
|
}
|
|
4611
4910
|
[Symbol.iterator]() {
|
|
4612
4911
|
return this.entries();
|
|
4613
4912
|
}
|
|
4614
4913
|
[Symbol.toStringTag] = "LRUCache";
|
|
4615
4914
|
find(t, e = {}) {
|
|
4616
|
-
for (let i of this.#
|
|
4915
|
+
for (let i of this.#A()) {
|
|
4617
4916
|
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4618
|
-
if (n !== void 0 && t(n, this.#i[i], this)) return this
|
|
4917
|
+
if (n !== void 0 && t(n, this.#i[i], this)) return this.#x(this.#i[i], e);
|
|
4619
4918
|
}
|
|
4620
4919
|
}
|
|
4621
4920
|
forEach(t, e = this) {
|
|
4622
|
-
for (let i of this.#
|
|
4921
|
+
for (let i of this.#A()) {
|
|
4623
4922
|
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4624
4923
|
n !== void 0 && t.call(e, n, this.#i[i], this);
|
|
4625
4924
|
}
|
|
4626
4925
|
}
|
|
4627
4926
|
rforEach(t, e = this) {
|
|
4628
|
-
for (let i of this.#
|
|
4927
|
+
for (let i of this.#z()) {
|
|
4629
4928
|
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4630
4929
|
n !== void 0 && t.call(e, n, this.#i[i], this);
|
|
4631
4930
|
}
|
|
4632
4931
|
}
|
|
4633
4932
|
purgeStale() {
|
|
4634
4933
|
let t = !1;
|
|
4635
|
-
for (let e of this.#
|
|
4934
|
+
for (let e of this.#z({ allowStale: !0 })) this.#p(e) && (this.#v(this.#i[e], "expire"), t = !0);
|
|
4636
4935
|
return t;
|
|
4637
4936
|
}
|
|
4638
4937
|
info(t) {
|
|
@@ -4641,24 +4940,24 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4641
4940
|
let i = this.#t[e], s = this.#e(i) ? i.__staleWhileFetching : i;
|
|
4642
4941
|
if (s === void 0) return;
|
|
4643
4942
|
let n = { value: s };
|
|
4644
|
-
if (this.#d && this.#
|
|
4645
|
-
let
|
|
4646
|
-
if (
|
|
4943
|
+
if (this.#d && this.#F) {
|
|
4944
|
+
let r = this.#d[e], h = this.#F[e];
|
|
4945
|
+
if (r && h) n.ttl = r - (this.#w.now() - h), n.start = Date.now();
|
|
4647
4946
|
}
|
|
4648
4947
|
return this.#y && (n.size = this.#y[e]), n;
|
|
4649
4948
|
}
|
|
4650
4949
|
dump() {
|
|
4651
4950
|
let t = [];
|
|
4652
|
-
for (let e of this.#
|
|
4951
|
+
for (let e of this.#A({ allowStale: !0 })) {
|
|
4653
4952
|
let i = this.#i[e], s = this.#t[e], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4654
4953
|
if (n === void 0 || i === void 0) continue;
|
|
4655
|
-
let
|
|
4656
|
-
if (this.#d && this.#
|
|
4657
|
-
|
|
4658
|
-
let h = this.#
|
|
4659
|
-
|
|
4954
|
+
let r = { value: n };
|
|
4955
|
+
if (this.#d && this.#F) {
|
|
4956
|
+
r.ttl = this.#d[e];
|
|
4957
|
+
let h = this.#w.now() - this.#F[e];
|
|
4958
|
+
r.start = Math.floor(Date.now() - h);
|
|
4660
4959
|
}
|
|
4661
|
-
this.#y && (
|
|
4960
|
+
this.#y && (r.size = this.#y[e]), t.unshift([i, r]);
|
|
4662
4961
|
}
|
|
4663
4962
|
return t;
|
|
4664
4963
|
}
|
|
@@ -4667,53 +4966,60 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4667
4966
|
for (let [e, i] of t) {
|
|
4668
4967
|
if (i.start) {
|
|
4669
4968
|
let s = Date.now() - i.start;
|
|
4670
|
-
i.start = this.#
|
|
4969
|
+
i.start = this.#w.now() - s;
|
|
4671
4970
|
}
|
|
4672
|
-
this
|
|
4971
|
+
this.#O(e, i.value, i);
|
|
4673
4972
|
}
|
|
4674
4973
|
}
|
|
4675
4974
|
set(t, e, i = {}) {
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4975
|
+
let { status: s = g.metrics.hasSubscribers ? {} : void 0 } = i;
|
|
4976
|
+
i.status = s, s && (s.op = "set", s.key = t, e !== void 0 && (s.value = e), s.cache = this);
|
|
4977
|
+
let n = this.#O(t, e, i);
|
|
4978
|
+
return s && g.metrics.hasSubscribers && g.metrics.publish(s), n;
|
|
4979
|
+
}
|
|
4980
|
+
#O(t, e, i, s) {
|
|
4981
|
+
let { ttl: n = this.ttl, start: r, noDisposeOnSet: h = this.noDisposeOnSet, sizeCalculation: a = this.sizeCalculation, status: o } = i, d = this.#e(e);
|
|
4982
|
+
if (e === void 0) return o && (o.set = "deleted"), this.delete(t), this;
|
|
4983
|
+
let { noUpdateTTL: _ = this.noUpdateTTL } = i;
|
|
4984
|
+
o && !d && (o.value = e);
|
|
4985
|
+
let y = this.#N(t, e, i.size || 0, a, o);
|
|
4986
|
+
if (this.maxEntrySize && y > this.maxEntrySize) return this.#v(t, "set"), o && (o.set = "miss", o.maxEntrySizeExceeded = !0), this;
|
|
4987
|
+
let u = this.#n === 0 ? void 0 : this.#s.get(t);
|
|
4988
|
+
if (u === void 0) u = this.#n === 0 ? this.#h : this.#_.length !== 0 ? this.#_.pop() : this.#n === this.#o ? this.#P(!1) : this.#n, this.#i[u] = t, this.#t[u] = e, this.#s.set(t, u), this.#l[this.#h] = u, this.#u[u] = this.#h, this.#h = u, this.#n++, this.#I(u, y, o), o && (o.set = "add"), _ = !1, this.#D && !d && this.#W?.(e, t, "add");
|
|
4681
4989
|
else {
|
|
4682
|
-
this.#
|
|
4683
|
-
let
|
|
4684
|
-
if (e !==
|
|
4685
|
-
if (
|
|
4686
|
-
|
|
4687
|
-
let { __staleWhileFetching:
|
|
4688
|
-
|
|
4689
|
-
|
|
4990
|
+
this.#L(u);
|
|
4991
|
+
let p = this.#t[u];
|
|
4992
|
+
if (e !== p) {
|
|
4993
|
+
if (!h) if (this.#e(p)) {
|
|
4994
|
+
p !== s && p.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
|
|
4995
|
+
let { __staleWhileFetching: f } = p;
|
|
4996
|
+
f !== void 0 && f !== e && (this.#T && this.#m?.(f, t, "set"), this.#f && this.#r?.push([
|
|
4997
|
+
f,
|
|
4690
4998
|
t,
|
|
4691
4999
|
"set"
|
|
4692
5000
|
]));
|
|
4693
|
-
} else
|
|
4694
|
-
|
|
5001
|
+
} else this.#T && this.#m?.(p, t, "set"), this.#f && this.#r?.push([
|
|
5002
|
+
p,
|
|
4695
5003
|
t,
|
|
4696
5004
|
"set"
|
|
4697
|
-
])
|
|
4698
|
-
if (this.#
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
g !== void 0 && (r.oldValue = g);
|
|
5005
|
+
]);
|
|
5006
|
+
if (this.#C(u), this.#I(u, y, o), this.#t[u] = e, !d) {
|
|
5007
|
+
let f = p && this.#e(p) ? p.__staleWhileFetching : p, b = f === void 0 ? "add" : e !== f ? "replace" : "update";
|
|
5008
|
+
o && (o.set = b, f !== void 0 && (o.oldValue = f)), this.#D && this.onInsert?.(e, t, b);
|
|
4702
5009
|
}
|
|
4703
|
-
} else
|
|
4704
|
-
this.#I && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
5010
|
+
} else d || (o && (o.set = "update"), this.#D && this.onInsert?.(e, t, "update"));
|
|
4705
5011
|
}
|
|
4706
|
-
if (
|
|
4707
|
-
let
|
|
4708
|
-
for (;
|
|
5012
|
+
if (n !== 0 && !this.#d && this.#k(), this.#d && (_ || this.#H(u, n, r), o && this.#E(o, u)), !h && this.#f && this.#r) {
|
|
5013
|
+
let p = this.#r, f;
|
|
5014
|
+
for (; f = p?.shift();) this.#S?.(...f);
|
|
4709
5015
|
}
|
|
4710
5016
|
return this;
|
|
4711
5017
|
}
|
|
4712
5018
|
pop() {
|
|
4713
5019
|
try {
|
|
4714
5020
|
for (; this.#n;) {
|
|
4715
|
-
let t = this.#t[this.#
|
|
4716
|
-
if (this.#
|
|
5021
|
+
let t = this.#t[this.#a];
|
|
5022
|
+
if (this.#P(!0), this.#e(t)) {
|
|
4717
5023
|
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
4718
5024
|
} else if (t !== void 0) return t;
|
|
4719
5025
|
}
|
|
@@ -4724,163 +5030,214 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4724
5030
|
}
|
|
4725
5031
|
}
|
|
4726
5032
|
}
|
|
4727
|
-
#
|
|
4728
|
-
let e = this.#
|
|
4729
|
-
|
|
4730
|
-
|
|
5033
|
+
#P(t) {
|
|
5034
|
+
let e = this.#a, i = this.#i[e], s = this.#t[e], n = this.#e(s);
|
|
5035
|
+
n && s.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
|
|
5036
|
+
let r = n ? s.__staleWhileFetching : s;
|
|
5037
|
+
return (this.#T || this.#f) && r !== void 0 && (this.#T && this.#m?.(r, i, "evict"), this.#f && this.#r?.push([
|
|
5038
|
+
r,
|
|
4731
5039
|
i,
|
|
4732
5040
|
"evict"
|
|
4733
|
-
])), this.#
|
|
5041
|
+
])), this.#C(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = void 0), t && (this.#i[e] = void 0, this.#t[e] = void 0, this.#_.push(e)), this.#n === 1 ? (this.#a = this.#h = 0, this.#_.length = 0) : this.#a = this.#l[e], this.#s.delete(i), this.#n--, e;
|
|
4734
5042
|
}
|
|
4735
5043
|
has(t, e = {}) {
|
|
5044
|
+
let { status: i = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
5045
|
+
e.status = i, i && (i.op = "has", i.key = t, i.cache = this);
|
|
5046
|
+
let s = this.#Y(t, e);
|
|
5047
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i), s;
|
|
5048
|
+
}
|
|
5049
|
+
#Y(t, e = {}) {
|
|
4736
5050
|
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, n = this.#s.get(t);
|
|
4737
5051
|
if (n !== void 0) {
|
|
4738
|
-
let
|
|
4739
|
-
if (this.#e(
|
|
4740
|
-
if (this.#p(n)) s && (s.has = "stale", this.#
|
|
4741
|
-
else return i && this.#R(n), s && (s.has = "hit", this.#
|
|
5052
|
+
let r = this.#t[n];
|
|
5053
|
+
if (this.#e(r) && r.__staleWhileFetching === void 0) return !1;
|
|
5054
|
+
if (this.#p(n)) s && (s.has = "stale", this.#E(s, n));
|
|
5055
|
+
else return i && this.#R(n), s && (s.has = "hit", this.#E(s, n)), !0;
|
|
4742
5056
|
} else s && (s.has = "miss");
|
|
4743
5057
|
return !1;
|
|
4744
5058
|
}
|
|
4745
5059
|
peek(t, e = {}) {
|
|
4746
|
-
let {
|
|
4747
|
-
|
|
4748
|
-
let
|
|
4749
|
-
return
|
|
5060
|
+
let { status: i = C() ? {} : void 0 } = e;
|
|
5061
|
+
i && (i.op = "peek", i.key = t, i.cache = this), e.status = i;
|
|
5062
|
+
let s = this.#J(t, e);
|
|
5063
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i), s;
|
|
5064
|
+
}
|
|
5065
|
+
#J(t, e) {
|
|
5066
|
+
let { status: i, allowStale: s = this.allowStale } = e, n = this.#s.get(t);
|
|
5067
|
+
if (n === void 0 || !s && this.#p(n)) {
|
|
5068
|
+
i && (i.peek = n === void 0 ? "miss" : "stale");
|
|
5069
|
+
return;
|
|
5070
|
+
}
|
|
5071
|
+
let r = this.#t[n], h = this.#e(r) ? r.__staleWhileFetching : r;
|
|
5072
|
+
return i && (h !== void 0 ? (i.peek = "hit", i.value = h) : i.peek = "miss"), h;
|
|
4750
5073
|
}
|
|
4751
|
-
#
|
|
5074
|
+
#G(t, e, i, s) {
|
|
4752
5075
|
let n = e === void 0 ? void 0 : this.#t[e];
|
|
4753
5076
|
if (this.#e(n)) return n;
|
|
4754
|
-
let
|
|
4755
|
-
h?.addEventListener("abort", () =>
|
|
4756
|
-
let
|
|
4757
|
-
signal:
|
|
5077
|
+
let r = new AbortController(), { signal: h } = i;
|
|
5078
|
+
h?.addEventListener("abort", () => r.abort(h.reason), { signal: r.signal });
|
|
5079
|
+
let a = {
|
|
5080
|
+
signal: r.signal,
|
|
4758
5081
|
options: i,
|
|
4759
5082
|
context: s
|
|
4760
|
-
},
|
|
4761
|
-
let { aborted: l } =
|
|
4762
|
-
if (i.status && (l && !
|
|
4763
|
-
let
|
|
4764
|
-
return (
|
|
4765
|
-
},
|
|
4766
|
-
let { aborted: l } =
|
|
4767
|
-
if (this.#t[e] ===
|
|
4768
|
-
if (
|
|
4769
|
-
},
|
|
4770
|
-
let l = this.#
|
|
4771
|
-
|
|
4772
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (
|
|
4773
|
-
});
|
|
5083
|
+
}, o = (f, b = !1) => {
|
|
5084
|
+
let { aborted: l } = r.signal, S = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
|
|
5085
|
+
if (i.status && (l && !b ? (i.status.fetchAborted = !0, i.status.fetchError = r.signal.reason, S && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), l && !S && !b) return _(r.signal.reason, F);
|
|
5086
|
+
let w = u, m = this.#t[e];
|
|
5087
|
+
return (m === u || m === void 0 && S && b) && (f === void 0 ? w.__staleWhileFetching !== void 0 ? this.#t[e] = w.__staleWhileFetching : this.#v(t, "fetch") : (i.status && (i.status.fetchUpdated = !0), this.#O(t, f, a.options, w))), f;
|
|
5088
|
+
}, d = (f) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = f), _(f, !1)), _ = (f, b) => {
|
|
5089
|
+
let { aborted: l } = r.signal, S = l && i.allowStaleOnFetchAbort, F = S || i.allowStaleOnFetchRejection, w = F || i.noDeleteOnFetchRejection, m = u;
|
|
5090
|
+
if (this.#t[e] === u && (!w || !b && m.__staleWhileFetching === void 0 ? this.#v(t, "fetch") : S || (this.#t[e] = m.__staleWhileFetching)), F) return i.status && m.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), m.__staleWhileFetching;
|
|
5091
|
+
if (m.__returned === m) throw f;
|
|
5092
|
+
}, y = (f, b) => {
|
|
5093
|
+
let l = this.#M?.(t, n, a);
|
|
5094
|
+
r.signal.addEventListener("abort", () => {
|
|
5095
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (S) => o(S, !0)));
|
|
5096
|
+
}), l && l instanceof Promise ? l.then((S) => f(S === void 0 ? void 0 : S), b) : l !== void 0 && f(l);
|
|
4774
5097
|
};
|
|
4775
5098
|
i.status && (i.status.fetchDispatched = !0);
|
|
4776
|
-
let
|
|
4777
|
-
__abortController:
|
|
5099
|
+
let u = new Promise(y).then(o, d), p = Object.assign(u, {
|
|
5100
|
+
__abortController: r,
|
|
4778
5101
|
__staleWhileFetching: n,
|
|
4779
5102
|
__returned: void 0
|
|
4780
5103
|
});
|
|
4781
|
-
return e === void 0 ? (this
|
|
4782
|
-
...
|
|
5104
|
+
return e === void 0 ? (this.#O(t, p, {
|
|
5105
|
+
...a.options,
|
|
4783
5106
|
status: void 0
|
|
4784
|
-
}), e = this.#s.get(t)) : this.#t[e] =
|
|
5107
|
+
}), e = this.#s.get(t)) : this.#t[e] = p, p;
|
|
4785
5108
|
}
|
|
4786
5109
|
#e(t) {
|
|
4787
|
-
if (!this.#
|
|
5110
|
+
if (!this.#U) return !1;
|
|
4788
5111
|
let e = t;
|
|
4789
|
-
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof
|
|
5112
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
|
|
5113
|
+
}
|
|
5114
|
+
fetch(t, e = {}) {
|
|
5115
|
+
let i = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
5116
|
+
e.status = s, s && e.context && (s.context = e.context);
|
|
5117
|
+
let n = this.#q(t, e);
|
|
5118
|
+
return s && i && (s.trace = !0, g.tracing.tracePromise(() => n, s).catch(() => {})), n;
|
|
4790
5119
|
}
|
|
4791
|
-
async
|
|
4792
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl:
|
|
4793
|
-
if (!this.#
|
|
5120
|
+
async #q(t, e = {}) {
|
|
5121
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: r = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: o = this.sizeCalculation, noUpdateTTL: d = this.noUpdateTTL, noDeleteOnFetchRejection: _ = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: y = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: f, forceRefresh: b = !1, status: l, signal: S } = e;
|
|
5122
|
+
if (l && (l.op = "fetch", l.key = t, b && (l.forceRefresh = !0), l.cache = this), !this.#U) return l && (l.fetch = "get"), this.#x(t, {
|
|
4794
5123
|
allowStale: i,
|
|
4795
5124
|
updateAgeOnGet: s,
|
|
4796
5125
|
noDeleteOnStaleGet: n,
|
|
4797
5126
|
status: l
|
|
4798
5127
|
});
|
|
4799
|
-
let
|
|
5128
|
+
let F = {
|
|
4800
5129
|
allowStale: i,
|
|
4801
5130
|
updateAgeOnGet: s,
|
|
4802
5131
|
noDeleteOnStaleGet: n,
|
|
4803
|
-
ttl:
|
|
5132
|
+
ttl: r,
|
|
4804
5133
|
noDisposeOnSet: h,
|
|
4805
|
-
size:
|
|
4806
|
-
sizeCalculation:
|
|
4807
|
-
noUpdateTTL:
|
|
4808
|
-
noDeleteOnFetchRejection:
|
|
4809
|
-
allowStaleOnFetchRejection:
|
|
4810
|
-
allowStaleOnFetchAbort:
|
|
4811
|
-
ignoreFetchAbort:
|
|
5134
|
+
size: a,
|
|
5135
|
+
sizeCalculation: o,
|
|
5136
|
+
noUpdateTTL: d,
|
|
5137
|
+
noDeleteOnFetchRejection: _,
|
|
5138
|
+
allowStaleOnFetchRejection: y,
|
|
5139
|
+
allowStaleOnFetchAbort: p,
|
|
5140
|
+
ignoreFetchAbort: u,
|
|
4812
5141
|
status: l,
|
|
4813
5142
|
signal: S
|
|
4814
|
-
},
|
|
4815
|
-
if (
|
|
5143
|
+
}, w = this.#s.get(t);
|
|
5144
|
+
if (w === void 0) {
|
|
4816
5145
|
l && (l.fetch = "miss");
|
|
4817
|
-
let
|
|
4818
|
-
return
|
|
5146
|
+
let m = this.#G(t, w, F, f);
|
|
5147
|
+
return m.__returned = m;
|
|
4819
5148
|
} else {
|
|
4820
|
-
let
|
|
4821
|
-
if (this.#e(
|
|
4822
|
-
let E = i &&
|
|
4823
|
-
return l && (l.fetch = "inflight", E && (l.returnedStale = !0)), E ?
|
|
5149
|
+
let m = this.#t[w];
|
|
5150
|
+
if (this.#e(m)) {
|
|
5151
|
+
let E = i && m.__staleWhileFetching !== void 0;
|
|
5152
|
+
return l && (l.fetch = "inflight", E && (l.returnedStale = !0)), E ? m.__staleWhileFetching : m.__returned = m;
|
|
4824
5153
|
}
|
|
4825
|
-
let
|
|
4826
|
-
if (!
|
|
4827
|
-
let
|
|
4828
|
-
return l && (l.fetch =
|
|
5154
|
+
let A = this.#p(w);
|
|
5155
|
+
if (!b && !A) return l && (l.fetch = "hit"), this.#L(w), s && this.#R(w), l && this.#E(l, w), m;
|
|
5156
|
+
let z = this.#G(t, w, F, f), v = z.__staleWhileFetching !== void 0 && i;
|
|
5157
|
+
return l && (l.fetch = A ? "stale" : "refresh", v && A && (l.returnedStale = !0)), v ? z.__staleWhileFetching : z.__returned = z;
|
|
4829
5158
|
}
|
|
4830
5159
|
}
|
|
4831
|
-
|
|
4832
|
-
let i =
|
|
5160
|
+
forceFetch(t, e = {}) {
|
|
5161
|
+
let i = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
5162
|
+
e.status = s, s && e.context && (s.context = e.context);
|
|
5163
|
+
let n = this.#K(t, e);
|
|
5164
|
+
return s && i && (s.trace = !0, g.tracing.tracePromise(() => n, s).catch(() => {})), n;
|
|
5165
|
+
}
|
|
5166
|
+
async #K(t, e = {}) {
|
|
5167
|
+
let i = await this.#q(t, e);
|
|
4833
5168
|
if (i === void 0) throw new Error("fetch() returned undefined");
|
|
4834
5169
|
return i;
|
|
4835
5170
|
}
|
|
4836
5171
|
memo(t, e = {}) {
|
|
4837
|
-
let i =
|
|
5172
|
+
let { status: i = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
5173
|
+
e.status = i, i && (i.op = "memo", i.key = t, e.context && (i.context = e.context), i.cache = this);
|
|
5174
|
+
let s = this.#Q(t, e);
|
|
5175
|
+
return i && (i.value = s), g.metrics.hasSubscribers && g.metrics.publish(i), s;
|
|
5176
|
+
}
|
|
5177
|
+
#Q(t, e = {}) {
|
|
5178
|
+
let i = this.#j;
|
|
4838
5179
|
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
4839
|
-
let { context: s,
|
|
4840
|
-
|
|
4841
|
-
let
|
|
4842
|
-
|
|
5180
|
+
let { context: s, status: n, forceRefresh: r, ...h } = e;
|
|
5181
|
+
n && r && (n.forceRefresh = !0);
|
|
5182
|
+
let a = this.#x(t, h), o = r || a === void 0;
|
|
5183
|
+
if (n && (n.memo = o ? "miss" : "hit", o || (n.value = a)), !o) return a;
|
|
5184
|
+
let d = i(t, a, {
|
|
5185
|
+
options: h,
|
|
4843
5186
|
context: s
|
|
4844
5187
|
});
|
|
4845
|
-
return this
|
|
5188
|
+
return n && (n.value = d), this.#O(t, d, h), d;
|
|
4846
5189
|
}
|
|
4847
5190
|
get(t, e = {}) {
|
|
4848
|
-
let {
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
5191
|
+
let { status: i = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
5192
|
+
e.status = i, i && (i.op = "get", i.key = t, i.cache = this);
|
|
5193
|
+
let s = this.#x(t, e);
|
|
5194
|
+
return i && (s !== void 0 && (i.value = s), g.metrics.hasSubscribers && g.metrics.publish(i)), s;
|
|
5195
|
+
}
|
|
5196
|
+
#x(t, e = {}) {
|
|
5197
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: r } = e, h = this.#s.get(t);
|
|
5198
|
+
if (h === void 0) {
|
|
5199
|
+
r && (r.get = "miss");
|
|
5200
|
+
return;
|
|
5201
|
+
}
|
|
5202
|
+
let a = this.#t[h], o = this.#e(a);
|
|
5203
|
+
return r && this.#E(r, h), this.#p(h) ? o ? (r && (r.get = "stale-fetching"), i && a.__staleWhileFetching !== void 0 ? (r && (r.returnedStale = !0), a.__staleWhileFetching) : void 0) : (n || this.#v(t, "expire"), r && (r.get = "stale"), i ? (r && (r.returnedStale = !0), a) : void 0) : (r && (r.get = o ? "fetching" : "hit"), this.#L(h), s && this.#R(h), o ? a.__staleWhileFetching : a);
|
|
4853
5204
|
}
|
|
4854
|
-
#
|
|
4855
|
-
this.#u[e] = t, this.#
|
|
5205
|
+
#B(t, e) {
|
|
5206
|
+
this.#u[e] = t, this.#l[t] = e;
|
|
4856
5207
|
}
|
|
4857
|
-
#
|
|
4858
|
-
t !== this.#h && (t === this.#
|
|
5208
|
+
#L(t) {
|
|
5209
|
+
t !== this.#h && (t === this.#a ? this.#a = this.#l[t] : this.#B(this.#u[t], this.#l[t]), this.#B(this.#h, t), this.#h = t);
|
|
4859
5210
|
}
|
|
4860
5211
|
delete(t) {
|
|
4861
|
-
return this.#
|
|
4862
|
-
}
|
|
4863
|
-
#
|
|
5212
|
+
return this.#v(t, "delete");
|
|
5213
|
+
}
|
|
5214
|
+
#v(t, e) {
|
|
5215
|
+
g.metrics.hasSubscribers && g.metrics.publish({
|
|
5216
|
+
op: "delete",
|
|
5217
|
+
delete: e,
|
|
5218
|
+
key: t,
|
|
5219
|
+
cache: this
|
|
5220
|
+
});
|
|
4864
5221
|
let i = !1;
|
|
4865
5222
|
if (this.#n !== 0) {
|
|
4866
5223
|
let s = this.#s.get(t);
|
|
4867
|
-
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = !0, this.#n === 1) this
|
|
5224
|
+
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = !0, this.#n === 1) this.#$(e);
|
|
4868
5225
|
else {
|
|
4869
|
-
this.#
|
|
5226
|
+
this.#C(s);
|
|
4870
5227
|
let n = this.#t[s];
|
|
4871
|
-
if (this.#e(n) ? n.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#
|
|
5228
|
+
if (this.#e(n) ? n.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#m?.(n, t, e), this.#f && this.#r?.push([
|
|
4872
5229
|
n,
|
|
4873
5230
|
t,
|
|
4874
5231
|
e
|
|
4875
5232
|
])), this.#s.delete(t), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
4876
|
-
else if (s === this.#
|
|
5233
|
+
else if (s === this.#a) this.#a = this.#l[s];
|
|
4877
5234
|
else {
|
|
4878
|
-
let
|
|
4879
|
-
this.#
|
|
4880
|
-
let h = this.#
|
|
5235
|
+
let r = this.#u[s];
|
|
5236
|
+
this.#l[r] = this.#l[s];
|
|
5237
|
+
let h = this.#l[s];
|
|
4881
5238
|
this.#u[h] = this.#u[s];
|
|
4882
5239
|
}
|
|
4883
|
-
this.#n--, this.#
|
|
5240
|
+
this.#n--, this.#_.push(s);
|
|
4884
5241
|
}
|
|
4885
5242
|
}
|
|
4886
5243
|
if (this.#f && this.#r?.length) {
|
|
@@ -4890,27 +5247,27 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4890
5247
|
return i;
|
|
4891
5248
|
}
|
|
4892
5249
|
clear() {
|
|
4893
|
-
return this
|
|
5250
|
+
return this.#$("delete");
|
|
4894
5251
|
}
|
|
4895
|
-
|
|
4896
|
-
for (let e of this.#
|
|
5252
|
+
#$(t) {
|
|
5253
|
+
for (let e of this.#z({ allowStale: !0 })) {
|
|
4897
5254
|
let i = this.#t[e];
|
|
4898
5255
|
if (this.#e(i)) i.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
|
|
4899
5256
|
else {
|
|
4900
5257
|
let s = this.#i[e];
|
|
4901
|
-
this.#T && this.#
|
|
5258
|
+
this.#T && this.#m?.(i, s, t), this.#f && this.#r?.push([
|
|
4902
5259
|
i,
|
|
4903
5260
|
s,
|
|
4904
5261
|
t
|
|
4905
5262
|
]);
|
|
4906
5263
|
}
|
|
4907
5264
|
}
|
|
4908
|
-
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#
|
|
4909
|
-
this.#d.fill(0), this.#
|
|
5265
|
+
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
5266
|
+
this.#d.fill(0), this.#F.fill(0);
|
|
4910
5267
|
for (let e of this.#g ?? []) e !== void 0 && clearTimeout(e);
|
|
4911
5268
|
this.#g?.fill(void 0);
|
|
4912
5269
|
}
|
|
4913
|
-
if (this.#y && this.#y.fill(0), this.#
|
|
5270
|
+
if (this.#y && this.#y.fill(0), this.#a = 0, this.#h = 0, this.#_.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
|
|
4914
5271
|
let e = this.#r, i;
|
|
4915
5272
|
for (; i = e?.shift();) this.#S?.(...i);
|
|
4916
5273
|
}
|
|
@@ -5862,6 +6219,14 @@ async function readPackage({ cwd, normalize = true } = {}) {
|
|
|
5862
6219
|
}
|
|
5863
6220
|
//#endregion
|
|
5864
6221
|
//#region clis/file-system/spawn-async.ts
|
|
6222
|
+
var SpawnError = class extends Error {
|
|
6223
|
+
stdout;
|
|
6224
|
+
constructor(message, stdout) {
|
|
6225
|
+
super(message);
|
|
6226
|
+
this.stdout = stdout;
|
|
6227
|
+
this.name = "SpawnError";
|
|
6228
|
+
}
|
|
6229
|
+
};
|
|
5865
6230
|
function spawnAsync(command, args, options = {}) {
|
|
5866
6231
|
return new Promise((resolve, reject) => {
|
|
5867
6232
|
const child = spawn(command, args, {
|
|
@@ -5875,16 +6240,18 @@ function spawnAsync(command, args, options = {}) {
|
|
|
5875
6240
|
});
|
|
5876
6241
|
let stdout = "";
|
|
5877
6242
|
let stderr = "";
|
|
6243
|
+
child.stdout?.setEncoding("utf8");
|
|
6244
|
+
child.stderr?.setEncoding("utf8");
|
|
5878
6245
|
child.stdout?.on("data", (d) => {
|
|
5879
|
-
stdout += d
|
|
6246
|
+
stdout += d;
|
|
5880
6247
|
});
|
|
5881
6248
|
child.stderr?.on("data", (d) => {
|
|
5882
|
-
stderr += d
|
|
6249
|
+
stderr += d;
|
|
5883
6250
|
});
|
|
5884
6251
|
child.on("error", reject);
|
|
5885
6252
|
child.on("close", (code) => {
|
|
5886
6253
|
if (code === 0) resolve(stdout.trim());
|
|
5887
|
-
else reject(new
|
|
6254
|
+
else reject(new SpawnError(stderr.trim() || stdout.trim() || `${command} exited with code ${code}`, stdout.trim()));
|
|
5888
6255
|
});
|
|
5889
6256
|
});
|
|
5890
6257
|
}
|
|
@@ -5896,6 +6263,10 @@ async function fetchNpmVersionFromRegistryForTag(packageName, tag) {
|
|
|
5896
6263
|
if (!cleanedVersion) throw new Error(`Failed to fetch version for package "${packageName}" at tag "${tag}".`);
|
|
5897
6264
|
return cleanedVersion;
|
|
5898
6265
|
}
|
|
6266
|
+
/** Whether `version` is in the semver `range`; false when it is not a range. */
|
|
6267
|
+
function versionSatisfies(version, range) {
|
|
6268
|
+
return satisfies(version, range);
|
|
6269
|
+
}
|
|
5899
6270
|
function lowestVersion(versions) {
|
|
5900
6271
|
return [...versions].sort(compare)[0];
|
|
5901
6272
|
}
|
|
@@ -5976,6 +6347,96 @@ async function getPackageVersionFromPackageJson(packageJsonPath) {
|
|
|
5976
6347
|
return (await readPackage({ cwd: packageJsonPath })).version;
|
|
5977
6348
|
}
|
|
5978
6349
|
//#endregion
|
|
6350
|
+
//#region clis/file-system/package-manager.ts
|
|
6351
|
+
const SUPPORTED = [
|
|
6352
|
+
"npm",
|
|
6353
|
+
"pnpm",
|
|
6354
|
+
"yarn",
|
|
6355
|
+
"bun"
|
|
6356
|
+
];
|
|
6357
|
+
/** Checked on PATH in this order when no user agent names a manager. */
|
|
6358
|
+
const PATH_PREFERENCE = ["bun", "pnpm"];
|
|
6359
|
+
/**
|
|
6360
|
+
* Oldest version detection will pick. `ph init` passes `--allow-build=<pkg>`
|
|
6361
|
+
* to `pnpm dlx` (injectPnpmAllowBuilds), which pnpm accepts from 10.14.0;
|
|
6362
|
+
* older versions fail with ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER.
|
|
6363
|
+
* An explicit --pnpm still uses whatever pnpm is installed.
|
|
6364
|
+
*/
|
|
6365
|
+
const MIN_VERSION = { pnpm: "10.14.0" };
|
|
6366
|
+
/**
|
|
6367
|
+
* Picks a package manager when the user passed no --npm/--pnpm/--yarn/--bun
|
|
6368
|
+
* flag. In order:
|
|
6369
|
+
* 1. the manager that launched us (`npm_config_user_agent`, set by
|
|
6370
|
+
* npx / pnpm dlx / yarn dlx / bunx and by package scripts)
|
|
6371
|
+
* 2. the manager that installed the CLI globally (`installedWith`), unless
|
|
6372
|
+
* that is npm
|
|
6373
|
+
* 3. bun, then pnpm, if found on PATH
|
|
6374
|
+
* 4. npm
|
|
6375
|
+
* A manager older than its MIN_VERSION is skipped. A version-manager shim
|
|
6376
|
+
* (corepack, asdf, mise) on PATH counts as installed if `--version` works.
|
|
6377
|
+
*/
|
|
6378
|
+
function detectPackageManager(options = {}) {
|
|
6379
|
+
const env = options.env ?? process.env;
|
|
6380
|
+
const platform = options.platform ?? process.platform;
|
|
6381
|
+
const allowed = options.allowed ?? SUPPORTED;
|
|
6382
|
+
const [uaName, uaVersion] = env.npm_config_user_agent?.split(" ")[0]?.split("/") ?? [];
|
|
6383
|
+
const fromUserAgent = uaName;
|
|
6384
|
+
if (fromUserAgent && allowed.includes(fromUserAgent) && isRecentEnough(fromUserAgent, uaVersion)) return {
|
|
6385
|
+
pm: fromUserAgent,
|
|
6386
|
+
source: "user-agent"
|
|
6387
|
+
};
|
|
6388
|
+
const fromInstall = options.installedWith && options.installedWith !== "npm" ? options.installedWith : void 0;
|
|
6389
|
+
const candidates = [...fromInstall ? [[fromInstall, "install"]] : [], ...PATH_PREFERENCE.map((pm) => [pm, "path"])];
|
|
6390
|
+
for (const [pm, source] of candidates) {
|
|
6391
|
+
if (!allowed.includes(pm)) continue;
|
|
6392
|
+
const file = findOnPath(pm, env, platform);
|
|
6393
|
+
if (!file) continue;
|
|
6394
|
+
if (MIN_VERSION[pm] && !isRecentEnough(pm, readVersion(file, env))) continue;
|
|
6395
|
+
return {
|
|
6396
|
+
pm,
|
|
6397
|
+
source
|
|
6398
|
+
};
|
|
6399
|
+
}
|
|
6400
|
+
return {
|
|
6401
|
+
pm: "npm",
|
|
6402
|
+
source: "fallback"
|
|
6403
|
+
};
|
|
6404
|
+
}
|
|
6405
|
+
function isRecentEnough(pm, version) {
|
|
6406
|
+
const min = MIN_VERSION[pm];
|
|
6407
|
+
if (!min) return true;
|
|
6408
|
+
const parsed = version ? coerce(version) : null;
|
|
6409
|
+
return parsed !== null && gte(parsed, min);
|
|
6410
|
+
}
|
|
6411
|
+
function readVersion(file, env) {
|
|
6412
|
+
const result = spawn.sync(file, ["--version"], {
|
|
6413
|
+
encoding: "utf8",
|
|
6414
|
+
env,
|
|
6415
|
+
timeout: 1e4
|
|
6416
|
+
});
|
|
6417
|
+
return result.status === 0 ? result.stdout.trim() : void 0;
|
|
6418
|
+
}
|
|
6419
|
+
function findOnPath(bin, env, platform) {
|
|
6420
|
+
const isWindows = platform === "win32";
|
|
6421
|
+
const pathValue = isWindows ? Object.entries(env).find(([k]) => k.toUpperCase() === "PATH")?.[1] : env.PATH;
|
|
6422
|
+
if (!pathValue) return void 0;
|
|
6423
|
+
const extensions = isWindows ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
6424
|
+
const dirs = pathValue.split(isWindows ? ";" : ":").filter(Boolean);
|
|
6425
|
+
for (const dir of dirs) for (const ext of extensions) {
|
|
6426
|
+
const file = path.join(dir, bin + ext);
|
|
6427
|
+
if (isExecutableFile(file, isWindows)) return file;
|
|
6428
|
+
}
|
|
6429
|
+
}
|
|
6430
|
+
function isExecutableFile(file, isWindows) {
|
|
6431
|
+
try {
|
|
6432
|
+
if (!statSync(file).isFile()) return false;
|
|
6433
|
+
if (!isWindows) accessSync(file, constants.X_OK);
|
|
6434
|
+
return true;
|
|
6435
|
+
} catch {
|
|
6436
|
+
return false;
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
//#endregion
|
|
5979
6440
|
//#region clis/file-system/directory-exists.ts
|
|
5980
6441
|
async function directoryExists(path) {
|
|
5981
6442
|
if (!path) return false;
|
|
@@ -6143,9 +6604,160 @@ PH CLI package manager: ${packageManager}
|
|
|
6143
6604
|
`.trim();
|
|
6144
6605
|
}
|
|
6145
6606
|
//#endregion
|
|
6607
|
+
//#region clis/file-system/write-layer.ts
|
|
6608
|
+
const recording = new AsyncLocalStorage();
|
|
6609
|
+
const isUnder = (path, dir) => path.startsWith(dir + sep);
|
|
6610
|
+
function isRemoved(state, path) {
|
|
6611
|
+
for (const removed of state.removed) if (path === removed || isUnder(path, removed)) return true;
|
|
6612
|
+
return false;
|
|
6613
|
+
}
|
|
6614
|
+
function isDirectory$1(path) {
|
|
6615
|
+
return statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
6616
|
+
}
|
|
6617
|
+
function diskFilesUnder(dir) {
|
|
6618
|
+
if (!isDirectory$1(dir)) return existsSync(dir) ? [dir] : [];
|
|
6619
|
+
return readdirSync(dir, {
|
|
6620
|
+
withFileTypes: true,
|
|
6621
|
+
recursive: true
|
|
6622
|
+
}).filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name));
|
|
6623
|
+
}
|
|
6624
|
+
function toText(contents) {
|
|
6625
|
+
return typeof contents === "string" ? contents : contents.toString("utf-8");
|
|
6626
|
+
}
|
|
6627
|
+
/**
|
|
6628
|
+
* The file access of the steps a dry run can preview. Outside a recording
|
|
6629
|
+
* every call goes to the disk. Inside {@link recordWrites} the writes and
|
|
6630
|
+
* removals are kept in memory, and the reads see them, so a step that reads
|
|
6631
|
+
* what an earlier step wrote decides as it would in a real run.
|
|
6632
|
+
*/
|
|
6633
|
+
const projectFiles = {
|
|
6634
|
+
/** True inside {@link recordWrites}. */
|
|
6635
|
+
isRecording() {
|
|
6636
|
+
return recording.getStore() !== void 0;
|
|
6637
|
+
},
|
|
6638
|
+
exists(path) {
|
|
6639
|
+
const state = recording.getStore();
|
|
6640
|
+
if (!state) return existsSync(path);
|
|
6641
|
+
const file = resolve(path);
|
|
6642
|
+
if (state.files.has(file)) return true;
|
|
6643
|
+
for (const written of state.files.keys()) if (isUnder(written, file)) return true;
|
|
6644
|
+
return !isRemoved(state, file) && existsSync(file);
|
|
6645
|
+
},
|
|
6646
|
+
/** The file as UTF-8 text; undefined when there is none. */
|
|
6647
|
+
read(path) {
|
|
6648
|
+
const state = recording.getStore();
|
|
6649
|
+
if (!state) return existsSync(path) ? readFileSync(path, "utf-8") : void 0;
|
|
6650
|
+
const file = resolve(path);
|
|
6651
|
+
const written = state.files.get(file);
|
|
6652
|
+
if (written !== void 0) return written;
|
|
6653
|
+
if (isRemoved(state, file) || !existsSync(file)) return void 0;
|
|
6654
|
+
return readFileSync(file, "utf-8");
|
|
6655
|
+
},
|
|
6656
|
+
/** The names in a folder; empty when there is none. */
|
|
6657
|
+
list(dir) {
|
|
6658
|
+
const state = recording.getStore();
|
|
6659
|
+
if (!state) return existsSync(dir) ? readdirSync(dir) : [];
|
|
6660
|
+
const folder = resolve(dir);
|
|
6661
|
+
const names = /* @__PURE__ */ new Set();
|
|
6662
|
+
if (!isRemoved(state, folder) && isDirectory$1(folder)) {
|
|
6663
|
+
for (const name of readdirSync(folder)) if (!state.removed.has(join(folder, name))) names.add(name);
|
|
6664
|
+
}
|
|
6665
|
+
for (const written of state.files.keys()) if (isUnder(written, folder)) names.add(relative(folder, written).split(sep)[0]);
|
|
6666
|
+
return [...names];
|
|
6667
|
+
},
|
|
6668
|
+
writeSync(path, contents) {
|
|
6669
|
+
const state = recording.getStore();
|
|
6670
|
+
if (!state) {
|
|
6671
|
+
mkdirSync(dirname(resolve(path)), { recursive: true });
|
|
6672
|
+
writeFileSync(path, contents, { encoding: "utf-8" });
|
|
6673
|
+
return;
|
|
6674
|
+
}
|
|
6675
|
+
const file = resolve(path);
|
|
6676
|
+
state.removed.delete(file);
|
|
6677
|
+
state.files.set(file, toText(contents));
|
|
6678
|
+
},
|
|
6679
|
+
/** Removes a file or a folder with everything in it; a missing one is fine. */
|
|
6680
|
+
remove(path) {
|
|
6681
|
+
const state = recording.getStore();
|
|
6682
|
+
if (!state) {
|
|
6683
|
+
rmSync(path, {
|
|
6684
|
+
recursive: true,
|
|
6685
|
+
force: true
|
|
6686
|
+
});
|
|
6687
|
+
return;
|
|
6688
|
+
}
|
|
6689
|
+
const target = resolve(path);
|
|
6690
|
+
for (const written of [...state.files.keys()]) if (written === target || isUnder(written, target)) state.files.delete(written);
|
|
6691
|
+
state.removed.add(target);
|
|
6692
|
+
},
|
|
6693
|
+
/**
|
|
6694
|
+
* Runs a writer that takes a file path and writes that file itself (such as
|
|
6695
|
+
* `writePackage`). In a recording the writer gets a temporary copy of the
|
|
6696
|
+
* file, and what it leaves there is recorded.
|
|
6697
|
+
*/
|
|
6698
|
+
async writeWith(path, writer) {
|
|
6699
|
+
if (!recording.getStore()) {
|
|
6700
|
+
await writer(path);
|
|
6701
|
+
return;
|
|
6702
|
+
}
|
|
6703
|
+
const scratch = mkdtempSync(join(tmpdir(), "ph-write-layer-"));
|
|
6704
|
+
try {
|
|
6705
|
+
const target = join(scratch, basename(path));
|
|
6706
|
+
const current = projectFiles.read(path);
|
|
6707
|
+
if (current !== void 0) writeFileSync(target, current);
|
|
6708
|
+
await writer(target);
|
|
6709
|
+
projectFiles.writeSync(path, readFileSync(target, "utf-8"));
|
|
6710
|
+
} finally {
|
|
6711
|
+
rmSync(scratch, {
|
|
6712
|
+
recursive: true,
|
|
6713
|
+
force: true
|
|
6714
|
+
});
|
|
6715
|
+
}
|
|
6716
|
+
}
|
|
6717
|
+
};
|
|
6718
|
+
/**
|
|
6719
|
+
* Runs `run` with every {@link projectFiles} write and removal recorded
|
|
6720
|
+
* instead of applied, and returns what a real run would change on disk,
|
|
6721
|
+
* sorted by path. A file written with the content it already has is no
|
|
6722
|
+
* change.
|
|
6723
|
+
*/
|
|
6724
|
+
async function recordWrites(run) {
|
|
6725
|
+
const state = {
|
|
6726
|
+
files: /* @__PURE__ */ new Map(),
|
|
6727
|
+
removed: /* @__PURE__ */ new Set()
|
|
6728
|
+
};
|
|
6729
|
+
const result = await recording.run(state, run);
|
|
6730
|
+
const changes = [];
|
|
6731
|
+
for (const [path, after] of state.files) {
|
|
6732
|
+
const before = existsSync(path) && !isDirectory$1(path) ? readFileSync(path, "utf-8") : void 0;
|
|
6733
|
+
if (before !== after) changes.push({
|
|
6734
|
+
path,
|
|
6735
|
+
before,
|
|
6736
|
+
after
|
|
6737
|
+
});
|
|
6738
|
+
}
|
|
6739
|
+
for (const removed of state.removed) for (const path of diskFilesUnder(removed)) {
|
|
6740
|
+
if (state.files.has(path)) continue;
|
|
6741
|
+
changes.push({
|
|
6742
|
+
path,
|
|
6743
|
+
before: readFileSync(path, "utf-8"),
|
|
6744
|
+
after: void 0
|
|
6745
|
+
});
|
|
6746
|
+
}
|
|
6747
|
+
changes.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
6748
|
+
return {
|
|
6749
|
+
result,
|
|
6750
|
+
changes
|
|
6751
|
+
};
|
|
6752
|
+
}
|
|
6753
|
+
//#endregion
|
|
6146
6754
|
//#region clis/file-system/write-file-ensuring-dir.ts
|
|
6147
6755
|
async function writeFileEnsuringDir(filePath, contents) {
|
|
6148
|
-
|
|
6756
|
+
if (projectFiles.isRecording()) {
|
|
6757
|
+
projectFiles.writeSync(filePath, contents);
|
|
6758
|
+
return;
|
|
6759
|
+
}
|
|
6760
|
+
await mkdir(dirname$1(resolve$1(filePath)), { recursive: true });
|
|
6149
6761
|
await writeFile(filePath, contents, { encoding: "utf-8" });
|
|
6150
6762
|
}
|
|
6151
6763
|
//#endregion
|
|
@@ -6367,18 +6979,35 @@ function getTelemetryStatus() {
|
|
|
6367
6979
|
//#region constants.ts
|
|
6368
6980
|
const PACKAGES_DEPENDENCIES = [
|
|
6369
6981
|
"@powerhousedao/builder-tools",
|
|
6982
|
+
"@powerhousedao/clint",
|
|
6370
6983
|
"@powerhousedao/codegen",
|
|
6371
6984
|
"@powerhousedao/common",
|
|
6372
6985
|
"@powerhousedao/config",
|
|
6986
|
+
"@powerhousedao/connect-core",
|
|
6373
6987
|
"@powerhousedao/design-system",
|
|
6988
|
+
"@powerhousedao/desktop",
|
|
6989
|
+
"@powerhousedao/host-core",
|
|
6374
6990
|
"document-drive",
|
|
6375
6991
|
"document-model",
|
|
6992
|
+
"@powerhousedao/opentelemetry-instrumentation-reactor",
|
|
6993
|
+
"@powerhousedao/pieces-framework",
|
|
6994
|
+
"@powerhousedao/portle",
|
|
6376
6995
|
"@powerhousedao/reactor",
|
|
6377
6996
|
"@powerhousedao/reactor-api",
|
|
6997
|
+
"@powerhousedao/reactor-attachments",
|
|
6378
6998
|
"@powerhousedao/reactor-browser",
|
|
6999
|
+
"@powerhousedao/reactor-drive",
|
|
7000
|
+
"@powerhousedao/reactor-group",
|
|
7001
|
+
"@powerhousedao/reactor-hypercore",
|
|
6379
7002
|
"@powerhousedao/reactor-mcp",
|
|
7003
|
+
"@powerhousedao/reactor-privacy",
|
|
7004
|
+
"@powerhousedao/reactor-router",
|
|
7005
|
+
"@powerhousedao/reactor-workflow",
|
|
7006
|
+
"@powerhousedao/registry",
|
|
6380
7007
|
"@powerhousedao/switchboard-gui",
|
|
6381
7008
|
"@powerhousedao/vetra",
|
|
7009
|
+
"@powerhousedao/vetra-studio",
|
|
7010
|
+
"@powerhousedao/workflow",
|
|
6382
7011
|
"@powerhousedao/analytics-engine-core",
|
|
6383
7012
|
"@powerhousedao/analytics-engine-knex",
|
|
6384
7013
|
"@powerhousedao/analytics-engine-pg",
|
|
@@ -6386,14 +7015,13 @@ const PACKAGES_DEPENDENCIES = [
|
|
|
6386
7015
|
"@powerhousedao/analytics-engine-graphql",
|
|
6387
7016
|
"@powerhousedao/shared",
|
|
6388
7017
|
"@powerhousedao/powerhouse-vetra-packages",
|
|
6389
|
-
"@powerhousedao/analytics-engine-core",
|
|
6390
|
-
"@powerhousedao/analytics-engine-graphql",
|
|
6391
|
-
"@powerhousedao/analytics-engine-knex",
|
|
6392
|
-
"@powerhousedao/analytics-engine-pg",
|
|
6393
|
-
"@powerhousedao/analytics-engine-browser",
|
|
6394
7018
|
"@renown/sdk"
|
|
6395
7019
|
];
|
|
6396
|
-
const CLIS_DEPENDENCIES = [
|
|
7020
|
+
const CLIS_DEPENDENCIES = [
|
|
7021
|
+
"ph-cmd",
|
|
7022
|
+
"@powerhousedao/ph-cli",
|
|
7023
|
+
"@powerhousedao/ph-run"
|
|
7024
|
+
];
|
|
6397
7025
|
const APPS_DEPENDENCIES = ["@powerhousedao/connect", "@powerhousedao/switchboard"];
|
|
6398
7026
|
const ALL_POWERHOUSE_DEPENDENCIES = [
|
|
6399
7027
|
...PACKAGES_DEPENDENCIES,
|
|
@@ -6456,7 +7084,35 @@ async function runUseLocal(monorepoPath, skipInstall) {
|
|
|
6456
7084
|
runCmd(`pnpm install`);
|
|
6457
7085
|
}
|
|
6458
7086
|
}
|
|
7087
|
+
const WORKSPACE_DIRS = [
|
|
7088
|
+
"packages",
|
|
7089
|
+
"packages/analytics-engine",
|
|
7090
|
+
"clis",
|
|
7091
|
+
"apps"
|
|
7092
|
+
];
|
|
7093
|
+
const workspaces = /* @__PURE__ */ new Map();
|
|
7094
|
+
function workspacePackages(monorepoPath) {
|
|
7095
|
+
let dirs = workspaces.get(monorepoPath);
|
|
7096
|
+
if (dirs) return dirs;
|
|
7097
|
+
dirs = /* @__PURE__ */ new Map();
|
|
7098
|
+
for (const parent of WORKSPACE_DIRS) {
|
|
7099
|
+
const root = path.join(monorepoPath, parent);
|
|
7100
|
+
if (!existsSync(root)) continue;
|
|
7101
|
+
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
7102
|
+
const manifest = path.join(root, entry.name, "package.json");
|
|
7103
|
+
if (!entry.isDirectory() || !existsSync(manifest)) continue;
|
|
7104
|
+
try {
|
|
7105
|
+
const { name } = JSON.parse(readFileSync(manifest, "utf8"));
|
|
7106
|
+
if (name) dirs.set(name, path.join(root, entry.name));
|
|
7107
|
+
} catch {}
|
|
7108
|
+
}
|
|
7109
|
+
}
|
|
7110
|
+
workspaces.set(monorepoPath, dirs);
|
|
7111
|
+
return dirs;
|
|
7112
|
+
}
|
|
6459
7113
|
function buildPnpmLink(packageName, monorepoPath) {
|
|
7114
|
+
const dir = workspacePackages(monorepoPath).get(packageName);
|
|
7115
|
+
if (dir) return `link:${dir}`;
|
|
6460
7116
|
const isCli = CLIS_DEPENDENCIES.includes(packageName);
|
|
6461
7117
|
const isApp = APPS_DEPENDENCIES.includes(packageName);
|
|
6462
7118
|
const packageDir = isCli ? "clis" : isApp ? "apps" : "packages";
|
|
@@ -6464,6 +7120,458 @@ function buildPnpmLink(packageName, monorepoPath) {
|
|
|
6464
7120
|
return `link:${path.join(monorepoPath, packageDir, packageNameWithoutNamespace).replace("analytics-engine-", "analytics-engine/")}`;
|
|
6465
7121
|
}
|
|
6466
7122
|
//#endregion
|
|
7123
|
+
//#region connect/connect-config-schema.ts
|
|
7124
|
+
const IMAGE_REF = "Image reference: a project-relative file path, a URL, or a data URI.";
|
|
7125
|
+
const IMAGE_REF_OR_DEFAULT = "Image reference: a project-relative file path (resolved by the Connect build), a URL, or a data URI. null keeps the default.";
|
|
7126
|
+
/** An image reference: a project-relative file path (the Connect build turns
|
|
7127
|
+
* it into a data URI or an emitted file), a URL, or a data URI. */
|
|
7128
|
+
const connectImageRefSchema = z.string().describe(IMAGE_REF);
|
|
7129
|
+
/** An image reference where `null` (or omitting it) keeps the default. */
|
|
7130
|
+
const optionalImageRef = (description = IMAGE_REF_OR_DEFAULT) => connectImageRefSchema.nullable().optional().describe(description);
|
|
7131
|
+
/** An image per colour scheme: one reference for both, or `{ light, dark }`
|
|
7132
|
+
* (`dark` falls back to `light`). */
|
|
7133
|
+
const connectSchemedImageSchema = z.union([connectImageRefSchema, z.strictObject({
|
|
7134
|
+
light: connectImageRefSchema,
|
|
7135
|
+
dark: connectImageRefSchema.nullable().optional()
|
|
7136
|
+
})]).describe("One image for both colour schemes, or { light, dark } (dark falls back to light).");
|
|
7137
|
+
/** A CSS colour per colour scheme (`dark` falls back to `light`). */
|
|
7138
|
+
const connectSchemedColorSchema = z.union([z.string(), z.strictObject({
|
|
7139
|
+
light: z.string(),
|
|
7140
|
+
dark: z.string().nullable().optional()
|
|
7141
|
+
})]);
|
|
7142
|
+
/** A CSS length: a number is px, a string is passed through as written. */
|
|
7143
|
+
const connectLengthSchema = z.union([z.number(), z.string()]);
|
|
7144
|
+
const optionalLength = () => connectLengthSchema.nullable().optional().describe("A CSS length: a number is px; a string is used as written (\"40%\", \"min(55%, 880px)\", \"calc(50% - 120px)\").");
|
|
7145
|
+
/** Distances to the four edges; each is optional. */
|
|
7146
|
+
const connectEdgesSchema = z.strictObject({
|
|
7147
|
+
top: optionalLength(),
|
|
7148
|
+
right: optionalLength(),
|
|
7149
|
+
bottom: optionalLength(),
|
|
7150
|
+
left: optionalLength()
|
|
7151
|
+
});
|
|
7152
|
+
/** One image of a decorated pane, absolutely positioned inside it. */
|
|
7153
|
+
const connectBackgroundLayerSchema = z.strictObject({
|
|
7154
|
+
src: connectSchemedImageSchema,
|
|
7155
|
+
position: connectEdgesSchema.nullable().optional().describe("Distances to the pane's edges; at most one per axis. Omitted: centred both ways."),
|
|
7156
|
+
width: optionalLength(),
|
|
7157
|
+
height: optionalLength(),
|
|
7158
|
+
minWidth: optionalLength(),
|
|
7159
|
+
minHeight: optionalLength(),
|
|
7160
|
+
maxWidth: optionalLength(),
|
|
7161
|
+
maxHeight: optionalLength(),
|
|
7162
|
+
opacity: z.number().min(0).max(1).nullable().optional().describe("0 to 1 (default 1)."),
|
|
7163
|
+
fade: connectEdgesSchema.nullable().optional().describe("Feather depth per edge, fading the layer into the page colour.")
|
|
7164
|
+
}).describe("An image laid over the page, absolutely positioned: the edges set in `position` pin it, an axis with neither edge set is centred.");
|
|
7165
|
+
/** A decorated pane: the page colour and the images laid over it. */
|
|
7166
|
+
const connectBackgroundLayersSchema = z.strictObject({
|
|
7167
|
+
color: connectSchemedColorSchema.nullable().optional().describe("The page colour, or { light, dark }. Omitted or null: the theme's page background."),
|
|
7168
|
+
layers: z.array(connectBackgroundLayerSchema).describe("Painted in order; the first is at the back.")
|
|
7169
|
+
});
|
|
7170
|
+
/** A pane's background: layers over a page colour, or one image as
|
|
7171
|
+
* shorthand for a single layer pinned bottom-right. */
|
|
7172
|
+
const connectBackgroundSchema = z.union([connectImageRefSchema, connectBackgroundLayersSchema]).describe("Layered images over a page colour, or a single image pinned to the bottom-right corner. null keeps the default.");
|
|
7173
|
+
/** The loading image and the motion applied to it. */
|
|
7174
|
+
const connectLoaderSchema = z.strictObject({
|
|
7175
|
+
src: connectImageRefSchema,
|
|
7176
|
+
animation: z.enum([
|
|
7177
|
+
"pulse",
|
|
7178
|
+
"spin",
|
|
7179
|
+
"none"
|
|
7180
|
+
]).nullable().optional().describe("Motion applied to the image (default pulse)."),
|
|
7181
|
+
size: z.number().min(16).max(512).nullable().optional().describe("Rendered width in CSS pixels (default 96); the height follows the image.")
|
|
7182
|
+
});
|
|
7183
|
+
/** `connect.branding`: Connect's identity and look. */
|
|
7184
|
+
const connectBrandingSchema = z.strictObject({
|
|
7185
|
+
appName: z.string().nullable().optional().describe("Browser tab title, installed-app name and in-app brand text. null or omitted: 'Powerhouse Connect'."),
|
|
7186
|
+
icon: optionalImageRef("App icon master (1024x1024 PNG recommended, or an SVG). The favicons and installed-app icons are found next to it as <name>_16x16.png, _32x32, _64x64, _192x192 and _512x512; the 64 px one is the in-app logo. null or omitted: Connect's icon."),
|
|
7187
|
+
favicon: z.string().nullable().optional().describe("The browser tab icon: a file (.ico, .svg or .png) relative to the project, served and built as icon.ico, or as icon.svg or icon.png for those types. A build input; the built runtime config leaves it out. `ph connect build --favicon` wins over it."),
|
|
7188
|
+
loader: z.union([connectImageRefSchema, connectLoaderSchema]).nullable().optional().describe("The loading image (first paint, app start, drive and editor loading). A path gets a gentle pulse; { src, animation, size } says otherwise, with animation \"none\" for an image that animates itself (animated SVG, GIF or WebP). null or omitted: Connect's animated logo.")
|
|
7189
|
+
}).describe("App identity and visual branding. Every field is optional; null means the default.");
|
|
7190
|
+
/** `connect.home`: the home screen (the generic chrome's landing page). */
|
|
7191
|
+
const connectHomeSchema = z.strictObject({ background: connectBackgroundSchema.nullable().optional().describe("The home screen's background: { color, layers } with each image positioned and sized, or one image pinned bottom-right. null or omitted: the bundled gradient.") }).describe("The home screen (the generic chrome's landing page).");
|
|
7192
|
+
const connectAppSchema = z.strictObject({
|
|
7193
|
+
logLevel: z.enum([
|
|
7194
|
+
"debug",
|
|
7195
|
+
"info",
|
|
7196
|
+
"warn",
|
|
7197
|
+
"error"
|
|
7198
|
+
]).optional().meta({
|
|
7199
|
+
description: "Log level applied by Connect's logger at boot. Affects browser-side output only.",
|
|
7200
|
+
default: "info"
|
|
7201
|
+
}),
|
|
7202
|
+
basePath: z.string().optional().meta({
|
|
7203
|
+
description: "Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.",
|
|
7204
|
+
default: "/"
|
|
7205
|
+
}),
|
|
7206
|
+
offline: z.boolean().optional().meta({
|
|
7207
|
+
description: "When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.",
|
|
7208
|
+
default: true
|
|
7209
|
+
}),
|
|
7210
|
+
studioMode: z.boolean().optional().meta({
|
|
7211
|
+
description: "Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.",
|
|
7212
|
+
default: false
|
|
7213
|
+
}),
|
|
7214
|
+
cookieBanner: z.boolean().optional().meta({
|
|
7215
|
+
description: "Show the analytics cookie consent banner on a first visit, when a plugin that needs consent (Sentry, OpenPanel) is active. When false, no banner is shown and analytics consent stays rejected. `ph vetra` turns it off for its local Studio; true by default.",
|
|
7216
|
+
default: true
|
|
7217
|
+
}),
|
|
7218
|
+
workflowsEnabled: z.boolean().optional().describe("Powerhouse workflows in Connect. When true the tab loads the @powerhousedao/workflow package (workflow + connection documents, their editors and Workflow Studio) and the reactor worker registers its document models. Falls back to the top-level `workflows.enabled`; set it to override that for Connect. Independent of studioMode. False when neither is set.")
|
|
7219
|
+
}).describe("Top-level Connect application behaviour.");
|
|
7220
|
+
const connectAiSchema = z.strictObject({ assistantEnabled: z.boolean().optional().meta({
|
|
7221
|
+
description: "When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.",
|
|
7222
|
+
default: false
|
|
7223
|
+
}) }).describe("AI assistant (chat) behaviour.");
|
|
7224
|
+
const connectPackagesSchema = z.strictObject({
|
|
7225
|
+
externalEnabled: z.boolean().optional().meta({
|
|
7226
|
+
description: "When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.",
|
|
7227
|
+
default: true
|
|
7228
|
+
}),
|
|
7229
|
+
liveReload: z.boolean().optional().meta({
|
|
7230
|
+
description: "When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).",
|
|
7231
|
+
default: false
|
|
7232
|
+
})
|
|
7233
|
+
}).describe("Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).");
|
|
7234
|
+
const EXPLORER_ICONS_DESCRIPTION = "The drive explorer's icons (the generic plugin's); each null keeps the built-in icon.";
|
|
7235
|
+
/** The drive explorer's icons: the generic chrome's, owned by the generic
|
|
7236
|
+
* plugin. Each `null` keeps the built-in icon. */
|
|
7237
|
+
const connectExplorerIconsSchema = z.strictObject({
|
|
7238
|
+
localDrive: optionalImageRef("Local drives without an icon of their own."),
|
|
7239
|
+
remoteDrive: optionalImageRef("Remote drives without an icon of their own."),
|
|
7240
|
+
folder: optionalImageRef("Folders."),
|
|
7241
|
+
document: optionalImageRef("Documents whose type has no icon in `documents`."),
|
|
7242
|
+
documents: z.record(z.string(), connectImageRefSchema).nullable().optional().describe("Per document type, e.g. \"acme/invoice\".")
|
|
7243
|
+
}).describe(EXPLORER_ICONS_DESCRIPTION);
|
|
7244
|
+
const connectDefaultDriveRemoteSchema = z.strictObject({
|
|
7245
|
+
url: z.string(),
|
|
7246
|
+
name: z.string().nullable().optional(),
|
|
7247
|
+
icon: z.string().nullable().optional()
|
|
7248
|
+
});
|
|
7249
|
+
const connectDefaultDriveLocalSchema = z.strictObject({
|
|
7250
|
+
local: z.literal(true).describe("Discriminator: this entry is a local drive created on first boot."),
|
|
7251
|
+
id: z.string().describe("Stable drive id. The drive is created with this id on first boot and is not re-created on later boots."),
|
|
7252
|
+
name: z.string().nullable().optional(),
|
|
7253
|
+
icon: z.string().nullable().optional(),
|
|
7254
|
+
app: z.string().optional().describe("Drive app (preferred editor) to open on the drive.")
|
|
7255
|
+
});
|
|
7256
|
+
const connectDefaultDriveSchema = z.union([connectDefaultDriveRemoteSchema, connectDefaultDriveLocalSchema]);
|
|
7257
|
+
/** `connect.drives.sections.{remote,local}`: three affirmative toggles. */
|
|
7258
|
+
const connectDriveSectionSchema = z.strictObject({
|
|
7259
|
+
enabled: z.boolean().optional().meta({
|
|
7260
|
+
description: "When false, the section is hidden in the sidebar.",
|
|
7261
|
+
default: true
|
|
7262
|
+
}),
|
|
7263
|
+
allowAdd: z.boolean().optional().meta({
|
|
7264
|
+
description: "When false, the section's 'add drive' affordance is hidden.",
|
|
7265
|
+
default: true
|
|
7266
|
+
}),
|
|
7267
|
+
allowDelete: z.boolean().optional().meta({
|
|
7268
|
+
description: "When false, drives in this section cannot be deleted from the UI.",
|
|
7269
|
+
default: true
|
|
7270
|
+
})
|
|
7271
|
+
}).describe("Visibility and add/delete affordances for a drive section in the sidebar.");
|
|
7272
|
+
const connectDriveSectionsSchema = z.strictObject({
|
|
7273
|
+
remote: connectDriveSectionSchema.optional(),
|
|
7274
|
+
local: connectDriveSectionSchema.optional()
|
|
7275
|
+
}).describe("Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.");
|
|
7276
|
+
/** Mirrors DRIVES_PRESERVE_STRATEGIES (../clis/constants.ts, which imports
|
|
7277
|
+
* node: modules, so it is not imported here); a test pins the two. */
|
|
7278
|
+
const connectDrivePreserveStrategySchema = z.enum(["preserve-all", "preserve-by-url-and-detach"]);
|
|
7279
|
+
const connectDrivesSchema = z.strictObject({
|
|
7280
|
+
allowAddDrive: z.boolean().optional().meta({
|
|
7281
|
+
description: "When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.",
|
|
7282
|
+
default: true
|
|
7283
|
+
}),
|
|
7284
|
+
defaultDrives: z.array(connectDefaultDriveSchema).optional().meta({
|
|
7285
|
+
description: "Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).",
|
|
7286
|
+
default: []
|
|
7287
|
+
}),
|
|
7288
|
+
preserveStrategy: connectDrivePreserveStrategySchema.optional().describe("Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only."),
|
|
7289
|
+
sections: connectDriveSectionsSchema.optional(),
|
|
7290
|
+
icons: connectExplorerIconsSchema.nullable().optional().describe(EXPLORER_ICONS_DESCRIPTION)
|
|
7291
|
+
}).describe("Default-drive and add-drive UI behaviour.");
|
|
7292
|
+
const connectRenownRainbowAdapterSchema = z.strictObject({
|
|
7293
|
+
walletConnectProjectId: z.string().optional().describe("WalletConnect project id; required for this adapter to function."),
|
|
7294
|
+
infuraProjectId: z.string().optional().describe("Optional Infura project id used to build RPC transports.")
|
|
7295
|
+
}).describe("wagmi + RainbowKit external-wallet adapter config.");
|
|
7296
|
+
const connectRenownPrivyAdapterSchema = z.strictObject({
|
|
7297
|
+
appId: z.string().optional().describe("Privy application id; required for this adapter to function."),
|
|
7298
|
+
clientId: z.string().optional().describe("Optional Privy client id."),
|
|
7299
|
+
methods: z.array(z.string()).optional().describe("Login methods this adapter offers; default per adapter when omitted.")
|
|
7300
|
+
}).describe("Privy embedded/social adapter config.");
|
|
7301
|
+
const connectRenownAdaptersSchema = z.strictObject({
|
|
7302
|
+
rainbow: connectRenownRainbowAdapterSchema.optional(),
|
|
7303
|
+
privy: connectRenownPrivyAdapterSchema.optional()
|
|
7304
|
+
}).describe("Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.");
|
|
7305
|
+
const connectRenownSchema = z.strictObject({
|
|
7306
|
+
url: z.string().optional().meta({
|
|
7307
|
+
description: "Renown auth service URL.",
|
|
7308
|
+
default: "https://www.renown.id"
|
|
7309
|
+
}),
|
|
7310
|
+
networkId: z.string().optional().meta({
|
|
7311
|
+
description: "CAIP-2 network namespace (e.g. 'eip155').",
|
|
7312
|
+
default: "eip155"
|
|
7313
|
+
}),
|
|
7314
|
+
chainId: z.number().optional().meta({
|
|
7315
|
+
description: "CAIP-2 chain reference within the network namespace.",
|
|
7316
|
+
default: 1
|
|
7317
|
+
}),
|
|
7318
|
+
namespace: z.string().optional().describe("Renown localStorage namespace; share it across Connects to share login."),
|
|
7319
|
+
switchboardUrl: z.string().optional().describe("Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`."),
|
|
7320
|
+
adapters: connectRenownAdaptersSchema.optional()
|
|
7321
|
+
}).describe("Renown identity / authentication coordinates.");
|
|
7322
|
+
const connectSentrySchema = z.strictObject({
|
|
7323
|
+
dsn: z.string().nullable().optional().meta({
|
|
7324
|
+
description: "Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.",
|
|
7325
|
+
default: null
|
|
7326
|
+
}),
|
|
7327
|
+
env: z.string().optional().meta({
|
|
7328
|
+
description: "Sentry environment label, surfaced as the `environment` tag on every event.",
|
|
7329
|
+
default: "dev"
|
|
7330
|
+
}),
|
|
7331
|
+
tracing: z.boolean().optional().meta({
|
|
7332
|
+
description: "Enable Sentry performance tracing.",
|
|
7333
|
+
default: false
|
|
7334
|
+
})
|
|
7335
|
+
}).describe("Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.");
|
|
7336
|
+
const connectOpenPanelSchema = z.strictObject({
|
|
7337
|
+
clientId: z.string().optional().meta({
|
|
7338
|
+
description: "OpenPanel client id. Empty string disables OpenPanel entirely.",
|
|
7339
|
+
default: ""
|
|
7340
|
+
}),
|
|
7341
|
+
apiUrl: z.string().optional().describe("OpenPanel API URL for self-hosted instances (e.g. 'https://openpanel.example/api'). Omit to use OpenPanel's hosted API."),
|
|
7342
|
+
trackUiEvents: z.boolean().optional().meta({
|
|
7343
|
+
description: "Track UI events.",
|
|
7344
|
+
default: true
|
|
7345
|
+
}),
|
|
7346
|
+
trackOperations: z.boolean().optional().meta({
|
|
7347
|
+
description: "Track document operations.",
|
|
7348
|
+
default: true
|
|
7349
|
+
})
|
|
7350
|
+
}).describe("OpenPanel product analytics. Set `clientId` to enable; an empty `clientId` disables it. Events are only sent after the user accepts analytics cookies. Takes precedence over the build-time PH_CONNECT_OPENPANEL_* env vars.");
|
|
7351
|
+
/** Which reactor client Connect runs (see PHReactorClientMode). */
|
|
7352
|
+
const connectReactorClientModeSchema = z.enum([
|
|
7353
|
+
"in-process",
|
|
7354
|
+
"worker",
|
|
7355
|
+
"remote",
|
|
7356
|
+
"router"
|
|
7357
|
+
]);
|
|
7358
|
+
const connectInstanceSchema = z.strictObject({
|
|
7359
|
+
namespace: z.string().nullable().meta({
|
|
7360
|
+
description: "Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.",
|
|
7361
|
+
default: null
|
|
7362
|
+
}),
|
|
7363
|
+
reactorWorker: z.boolean().meta({
|
|
7364
|
+
description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified. Packaged deployments load the worker from the prebuilt bundle `ph connect build` emits under __reactor_worker__/ (the dev server builds it lazily at the same path); when that bundle is absent the feature reports itself unavailable instead of starting a worker that cannot load.",
|
|
7365
|
+
default: false
|
|
7366
|
+
}),
|
|
7367
|
+
multiReactor: z.boolean().optional().meta({
|
|
7368
|
+
description: "Opt-in multi-reactor routing. When on, Connect routes through the in-browser reactor plus remote backends instead of the single in-browser reactor. Off by default; the single-reactor path is unchanged.",
|
|
7369
|
+
default: false
|
|
7370
|
+
})
|
|
7371
|
+
}).describe("Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.");
|
|
7372
|
+
const connectReactorFeatureFlagsSchema = z.strictObject({
|
|
7373
|
+
documentDecisions: z.boolean().optional().meta({
|
|
7374
|
+
description: "Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.",
|
|
7375
|
+
default: false
|
|
7376
|
+
}),
|
|
7377
|
+
authEnforcement: z.boolean().optional().meta({
|
|
7378
|
+
description: "Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.",
|
|
7379
|
+
default: false
|
|
7380
|
+
}),
|
|
7381
|
+
authGroups: z.boolean().optional().meta({
|
|
7382
|
+
description: "Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.",
|
|
7383
|
+
default: false
|
|
7384
|
+
}),
|
|
7385
|
+
authConditions: z.boolean().optional().meta({
|
|
7386
|
+
description: "Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.",
|
|
7387
|
+
default: false
|
|
7388
|
+
}),
|
|
7389
|
+
undoV3: z.boolean().optional().meta({ description: "Support base-reducer 3 (id-targeted undo), which new documents then take. A peer without it is held from base-reducer 3 documents until it upgrades. Unset leaves the reactor's default." })
|
|
7390
|
+
}).describe("Reactor feature flags. The four enforcement flags each imply their predecessors, and the reactor refuses to boot on a set that names a later one without an earlier one. They are consensus settings: a Connect syncing with a fleet must carry the same enforcement flags the fleet does, or the two reach different replay outcomes for the same history and diverge. undoV3 has no prerequisites; peers negotiate it.");
|
|
7391
|
+
const connectReactorSchema = z.strictObject({
|
|
7392
|
+
featureFlags: connectReactorFeatureFlagsSchema.optional(),
|
|
7393
|
+
createSignaturePolicy: z.enum(["legacy", "v2-required"]).optional().meta({
|
|
7394
|
+
description: "What new documents are created as. `v2-required` documents accept only v2 action signatures and take content-addressed ids; set `legacy` while any peer Connect syncs with predates them. Existing documents keep their policy.",
|
|
7395
|
+
default: "v2-required"
|
|
7396
|
+
}),
|
|
7397
|
+
unsupportedStoredDocuments: z.enum(["refuse", "read-only"]).optional().meta({
|
|
7398
|
+
description: "What the reactor does when this browser's store holds documents at protocol versions this build does not run. `refuse` fails the boot and names the versions; `read-only` boots and keeps those documents read-only.",
|
|
7399
|
+
default: "refuse"
|
|
7400
|
+
})
|
|
7401
|
+
}).describe("Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.");
|
|
7402
|
+
/** A runtime-caching / denylist URL match. A string is handed to Workbox
|
|
7403
|
+
* verbatim; `{ source, flags }` is rebuilt into a RegExp at build time. */
|
|
7404
|
+
const connectPwaUrlPatternSchema = z.union([z.string(), z.strictObject({
|
|
7405
|
+
source: z.string().describe("RegExp source."),
|
|
7406
|
+
flags: z.string().optional().describe("RegExp flags (e.g. 'i').")
|
|
7407
|
+
}).refine((p) => {
|
|
7408
|
+
try {
|
|
7409
|
+
new RegExp(p.source, p.flags);
|
|
7410
|
+
return true;
|
|
7411
|
+
} catch {
|
|
7412
|
+
return false;
|
|
7413
|
+
}
|
|
7414
|
+
}, { message: "source/flags do not compile to a valid RegExp" })]).describe("URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.");
|
|
7415
|
+
const connectPwaCacheStrategySchema = z.enum([
|
|
7416
|
+
"CacheFirst",
|
|
7417
|
+
"CacheOnly",
|
|
7418
|
+
"NetworkFirst",
|
|
7419
|
+
"NetworkOnly",
|
|
7420
|
+
"StaleWhileRevalidate"
|
|
7421
|
+
]);
|
|
7422
|
+
/** Serialisable subset of a Workbox `RuntimeCaching` rule. */
|
|
7423
|
+
const connectPwaRuntimeCachingSchema = z.strictObject({
|
|
7424
|
+
urlPattern: connectPwaUrlPatternSchema,
|
|
7425
|
+
handler: connectPwaCacheStrategySchema,
|
|
7426
|
+
method: z.enum([
|
|
7427
|
+
"GET",
|
|
7428
|
+
"POST",
|
|
7429
|
+
"PUT",
|
|
7430
|
+
"DELETE",
|
|
7431
|
+
"HEAD",
|
|
7432
|
+
"PATCH"
|
|
7433
|
+
]).optional(),
|
|
7434
|
+
options: z.strictObject({
|
|
7435
|
+
cacheName: z.string().optional(),
|
|
7436
|
+
networkTimeoutSeconds: z.number().optional().describe("Seconds a NetworkFirst rule waits for the network before falling back to the cache."),
|
|
7437
|
+
expiration: z.strictObject({
|
|
7438
|
+
maxEntries: z.number().optional(),
|
|
7439
|
+
maxAgeSeconds: z.number().optional()
|
|
7440
|
+
}).optional(),
|
|
7441
|
+
cacheableResponse: z.strictObject({
|
|
7442
|
+
statuses: z.array(z.number()).optional(),
|
|
7443
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
7444
|
+
}).optional()
|
|
7445
|
+
}).optional()
|
|
7446
|
+
});
|
|
7447
|
+
const connectPwaIconSchema = z.strictObject({
|
|
7448
|
+
src: z.string(),
|
|
7449
|
+
sizes: z.string().optional(),
|
|
7450
|
+
type: z.string().optional(),
|
|
7451
|
+
purpose: z.string().optional()
|
|
7452
|
+
});
|
|
7453
|
+
/** A File Handling API entry. No `action`: every handler opens at Connect's
|
|
7454
|
+
* app root, because consuming launched files needs Connect's own code. */
|
|
7455
|
+
const connectPwaFileHandlerSchema = z.strictObject({
|
|
7456
|
+
accept: z.record(z.string(), z.array(z.string().regex(/^\./, "file extensions must start with '.'"))).describe("MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it."),
|
|
7457
|
+
icons: z.array(connectPwaIconSchema).optional().describe("OS-level file-type icons."),
|
|
7458
|
+
launch_type: z.enum(["single-client", "multiple-clients"]).optional()
|
|
7459
|
+
});
|
|
7460
|
+
/** Web-app-manifest fields a package or project may override. */
|
|
7461
|
+
const connectPwaManifestSchema = z.strictObject({
|
|
7462
|
+
name: z.string().optional(),
|
|
7463
|
+
short_name: z.string().optional(),
|
|
7464
|
+
description: z.string().optional(),
|
|
7465
|
+
theme_color: z.string().optional(),
|
|
7466
|
+
background_color: z.string().optional(),
|
|
7467
|
+
display: z.enum([
|
|
7468
|
+
"fullscreen",
|
|
7469
|
+
"standalone",
|
|
7470
|
+
"minimal-ui",
|
|
7471
|
+
"browser"
|
|
7472
|
+
]).optional(),
|
|
7473
|
+
start_url: z.string().optional(),
|
|
7474
|
+
scope: z.string().optional(),
|
|
7475
|
+
icons: z.array(connectPwaIconSchema).optional().describe("Icons appended to the built-in set and de-duplicated by (src, sizes, purpose)."),
|
|
7476
|
+
file_handlers: z.array(connectPwaFileHandlerSchema).optional().describe("File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root."),
|
|
7477
|
+
launch_handler: z.strictObject({ client_mode: z.enum([
|
|
7478
|
+
"auto",
|
|
7479
|
+
"focus-existing",
|
|
7480
|
+
"navigate-existing",
|
|
7481
|
+
"navigate-new"
|
|
7482
|
+
]) }).optional().describe("How the OS launches the app for handled files/links. Connect defaults to focus-existing.")
|
|
7483
|
+
}).describe("Web-app-manifest field overrides.");
|
|
7484
|
+
const pwaShape = {
|
|
7485
|
+
globPatterns: z.array(z.string()).optional().describe("Extra Workbox precache globs, unioned with the built-ins."),
|
|
7486
|
+
globIgnores: z.array(z.string()).optional().describe("Extra precache ignore globs, unioned with the built-ins."),
|
|
7487
|
+
maximumFileSizeToCacheInBytes: z.number().optional().describe("Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit."),
|
|
7488
|
+
runtimeCaching: z.array(connectPwaRuntimeCachingSchema).optional().describe("Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL."),
|
|
7489
|
+
navigateFallbackDenylist: z.array(connectPwaUrlPatternSchema).optional().describe("Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.")
|
|
7490
|
+
};
|
|
7491
|
+
const PWA_DESCRIPTION = "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.";
|
|
7492
|
+
/** `connect.pwa` as authored. */
|
|
7493
|
+
const connectPwaSchema = z.strictObject({
|
|
7494
|
+
manifest: connectPwaManifestSchema.optional(),
|
|
7495
|
+
...pwaShape
|
|
7496
|
+
}).describe(PWA_DESCRIPTION);
|
|
7497
|
+
/**
|
|
7498
|
+
* The `connect` block as authored: powerhouse.config.json's `connect`, the
|
|
7499
|
+
* connect host's `config`, and `ph connect config` writes. Every field is
|
|
7500
|
+
* optional; omit the section entirely for default behaviour.
|
|
7501
|
+
*/
|
|
7502
|
+
const connectConfigSchema = z.strictObject({
|
|
7503
|
+
branding: connectBrandingSchema.optional(),
|
|
7504
|
+
home: connectHomeSchema.optional(),
|
|
7505
|
+
app: connectAppSchema.optional(),
|
|
7506
|
+
ai: connectAiSchema.optional(),
|
|
7507
|
+
packages: connectPackagesSchema.optional(),
|
|
7508
|
+
drives: connectDrivesSchema.optional(),
|
|
7509
|
+
renown: connectRenownSchema.optional(),
|
|
7510
|
+
sentry: connectSentrySchema.optional(),
|
|
7511
|
+
openPanel: connectOpenPanelSchema.optional(),
|
|
7512
|
+
instance: connectInstanceSchema.optional(),
|
|
7513
|
+
reactor: connectReactorSchema.optional(),
|
|
7514
|
+
pwa: connectPwaSchema.optional()
|
|
7515
|
+
}).describe("Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.");
|
|
7516
|
+
/** `schema` carrying `source`'s description and meta (zod keeps them per
|
|
7517
|
+
* instance, so `.extend()` and a rebuilt field drop them). */
|
|
7518
|
+
function withMetaOf(schema, source) {
|
|
7519
|
+
const meta = source.meta();
|
|
7520
|
+
return meta ? schema.meta(meta) : schema;
|
|
7521
|
+
}
|
|
7522
|
+
/** One entry of the host.js composition, projected into the served config as
|
|
7523
|
+
* data (module specifier + validated config). */
|
|
7524
|
+
const connectCompositionEntrySchema = z.strictObject({
|
|
7525
|
+
module: z.string(),
|
|
7526
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
7527
|
+
});
|
|
7528
|
+
/** A switchboard Connect routes to, from one of the host's remote backends. */
|
|
7529
|
+
const connectRemoteBackendSchema = z.strictObject({
|
|
7530
|
+
name: z.string().min(1).describe("The backend's key in the host config."),
|
|
7531
|
+
url: z.string().describe("A drive address on the switchboard: <switchboard>/d/<slug>."),
|
|
7532
|
+
requestTimeoutMs: z.number().int().positive().optional().describe("Give up on one request after this long. Default 30000."),
|
|
7533
|
+
breaker: z.union([z.literal(false), z.strictObject({
|
|
7534
|
+
failures: z.number().int().min(1).optional(),
|
|
7535
|
+
openMs: z.number().int().nonnegative().optional()
|
|
7536
|
+
})]).optional().describe("After `failures` failed requests in a row, send nothing for `openMs`. false: never stop trying."),
|
|
7537
|
+
realtime: z.boolean().optional().describe("Live updates over a socket. Default true.")
|
|
7538
|
+
});
|
|
7539
|
+
/** The router settings a host sets for Connect. */
|
|
7540
|
+
const connectRouterSettingsSchema = z.strictObject({
|
|
7541
|
+
newDrives: z.string().min(1).optional().describe("The remoteBackends[].name new drives are created on, with no copy in this browser. Absent: the browser reactor, else the only switchboard."),
|
|
7542
|
+
probeTimeoutMs: z.number().int().nonnegative().optional(),
|
|
7543
|
+
provisionalRouteMs: z.number().int().nonnegative().optional()
|
|
7544
|
+
});
|
|
7545
|
+
/** `sync: false` keeps no copy in this browser; unset means true. */
|
|
7546
|
+
const connectCollectionSchema = z.strictObject({
|
|
7547
|
+
backend: z.string().min(1),
|
|
7548
|
+
sync: z.boolean().optional()
|
|
7549
|
+
});
|
|
7550
|
+
/** `collections` holds placed drives that are not default drives, keyed by declared slug. */
|
|
7551
|
+
const connectRuntimeInstanceSchema = connectInstanceSchema.extend({
|
|
7552
|
+
reactorClient: connectReactorClientModeSchema.optional(),
|
|
7553
|
+
storage: z.enum(["idb", "memory"]).optional().meta({ description: "Where the browser reactor keeps its stores. `memory`: nothing outlives the page (or its shared worker). Absent: idb." }),
|
|
7554
|
+
remoteBackends: z.array(connectRemoteBackendSchema).optional(),
|
|
7555
|
+
collections: z.record(z.string(), connectCollectionSchema).optional(),
|
|
7556
|
+
router: connectRouterSettingsSchema.optional()
|
|
7557
|
+
});
|
|
7558
|
+
/** A remote default drive plus the backend serving it. */
|
|
7559
|
+
const connectRuntimeDefaultDriveRemoteSchema = connectDefaultDriveRemoteSchema.extend({
|
|
7560
|
+
backend: z.string().min(1).optional(),
|
|
7561
|
+
sync: z.boolean().optional()
|
|
7562
|
+
});
|
|
7563
|
+
const connectRuntimeDefaultDriveSchema = z.union([connectRuntimeDefaultDriveRemoteSchema, connectDefaultDriveLocalSchema]);
|
|
7564
|
+
const connectRuntimeDrivesSchema = withMetaOf(connectDrivesSchema.extend({ defaultDrives: withMetaOf(z.array(connectRuntimeDefaultDriveSchema).optional(), connectDrivesSchema.shape.defaultDrives) }), connectDrivesSchema);
|
|
7565
|
+
/** The manifest plus `categories`, derived from contributors' `category`. */
|
|
7566
|
+
const connectRuntimePwaManifestSchema = connectPwaManifestSchema.extend({ categories: z.array(z.string()).optional() });
|
|
7567
|
+
const connectRuntimePwaSchema = connectPwaSchema.extend({ manifest: connectRuntimePwaManifestSchema.optional() });
|
|
7568
|
+
connectConfigSchema.extend({
|
|
7569
|
+
composition: z.array(connectCompositionEntrySchema).optional(),
|
|
7570
|
+
drives: connectRuntimeDrivesSchema.optional(),
|
|
7571
|
+
instance: connectRuntimeInstanceSchema.optional(),
|
|
7572
|
+
pwa: connectRuntimePwaSchema.optional()
|
|
7573
|
+
});
|
|
7574
|
+
//#endregion
|
|
6467
7575
|
//#region connect/schema-fragments.ts
|
|
6468
7576
|
const powerhousePackageSchema = {
|
|
6469
7577
|
type: "object",
|
|
@@ -6494,556 +7602,35 @@ const powerhousePackageSchema = {
|
|
|
6494
7602
|
}
|
|
6495
7603
|
}
|
|
6496
7604
|
};
|
|
6497
|
-
|
|
7605
|
+
/** Emits a zod schema as a draft-07 fragment: input shape, no `$schema`. */
|
|
7606
|
+
function emitJsonSchemaFragment(schema) {
|
|
7607
|
+
const { $schema: _, ...fragment } = toJSONSchema(schema, {
|
|
7608
|
+
target: "draft-7",
|
|
7609
|
+
io: "input",
|
|
7610
|
+
unrepresentable: "throw"
|
|
7611
|
+
});
|
|
7612
|
+
return fragment;
|
|
7613
|
+
}
|
|
7614
|
+
/** The authored `connect` block, as validated by Ajv. */
|
|
7615
|
+
const phConnectRuntimeConfigSchema = /* @__PURE__ */ emitJsonSchemaFragment(connectConfigSchema);
|
|
7616
|
+
//#endregion
|
|
7617
|
+
//#region clis/source-config-schema.ts
|
|
7618
|
+
const keyframeRuleSchema = {
|
|
6498
7619
|
type: "object",
|
|
6499
7620
|
additionalProperties: false,
|
|
6500
|
-
description: "Visibility and add/delete affordances for a drive section in the sidebar.",
|
|
6501
7621
|
properties: {
|
|
6502
|
-
|
|
6503
|
-
type: "
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
},
|
|
6507
|
-
allowAdd: {
|
|
6508
|
-
type: "boolean",
|
|
6509
|
-
description: "When false, the section's 'add drive' affordance is hidden.",
|
|
6510
|
-
default: true
|
|
7622
|
+
interval: {
|
|
7623
|
+
type: "integer",
|
|
7624
|
+
minimum: 1,
|
|
7625
|
+
description: "Write a keyframe every N revisions."
|
|
6511
7626
|
},
|
|
6512
|
-
|
|
6513
|
-
type: "
|
|
6514
|
-
|
|
6515
|
-
|
|
7627
|
+
keep: {
|
|
7628
|
+
type: ["integer", "null"],
|
|
7629
|
+
minimum: 1,
|
|
7630
|
+
description: "Keyframes kept per document stream, newest first; null keeps them all."
|
|
6516
7631
|
}
|
|
6517
7632
|
}
|
|
6518
7633
|
};
|
|
6519
|
-
const pwaUrlPatternSchema = {
|
|
6520
|
-
description: "URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.",
|
|
6521
|
-
oneOf: [{ type: "string" }, {
|
|
6522
|
-
type: "object",
|
|
6523
|
-
additionalProperties: false,
|
|
6524
|
-
required: ["source"],
|
|
6525
|
-
properties: {
|
|
6526
|
-
source: {
|
|
6527
|
-
type: "string",
|
|
6528
|
-
description: "RegExp source."
|
|
6529
|
-
},
|
|
6530
|
-
flags: {
|
|
6531
|
-
type: "string",
|
|
6532
|
-
description: "RegExp flags (e.g. 'i')."
|
|
6533
|
-
}
|
|
6534
|
-
}
|
|
6535
|
-
}]
|
|
6536
|
-
};
|
|
6537
|
-
const pwaIconSchema = {
|
|
6538
|
-
type: "object",
|
|
6539
|
-
additionalProperties: false,
|
|
6540
|
-
required: ["src"],
|
|
6541
|
-
properties: {
|
|
6542
|
-
src: { type: "string" },
|
|
6543
|
-
sizes: { type: "string" },
|
|
6544
|
-
type: { type: "string" },
|
|
6545
|
-
purpose: { type: "string" }
|
|
6546
|
-
}
|
|
6547
|
-
};
|
|
6548
|
-
const phConnectRuntimeConfigSchema = {
|
|
6549
|
-
type: "object",
|
|
6550
|
-
additionalProperties: false,
|
|
6551
|
-
description: "Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.",
|
|
6552
|
-
properties: {
|
|
6553
|
-
branding: {
|
|
6554
|
-
type: "object",
|
|
6555
|
-
additionalProperties: false,
|
|
6556
|
-
description: "App identity and visual branding.",
|
|
6557
|
-
properties: {
|
|
6558
|
-
appName: {
|
|
6559
|
-
type: "string",
|
|
6560
|
-
description: "Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'."
|
|
6561
|
-
},
|
|
6562
|
-
homeBackground: {
|
|
6563
|
-
type: ["string", "null"],
|
|
6564
|
-
description: "Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image."
|
|
6565
|
-
}
|
|
6566
|
-
}
|
|
6567
|
-
},
|
|
6568
|
-
app: {
|
|
6569
|
-
type: "object",
|
|
6570
|
-
additionalProperties: false,
|
|
6571
|
-
description: "Top-level Connect application behaviour.",
|
|
6572
|
-
properties: {
|
|
6573
|
-
logLevel: {
|
|
6574
|
-
type: "string",
|
|
6575
|
-
enum: [
|
|
6576
|
-
"debug",
|
|
6577
|
-
"info",
|
|
6578
|
-
"warn",
|
|
6579
|
-
"error"
|
|
6580
|
-
],
|
|
6581
|
-
description: "Log level applied by Connect's logger at boot. Affects browser-side output only.",
|
|
6582
|
-
default: "info"
|
|
6583
|
-
},
|
|
6584
|
-
basePath: {
|
|
6585
|
-
type: "string",
|
|
6586
|
-
description: "Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.",
|
|
6587
|
-
default: "/"
|
|
6588
|
-
},
|
|
6589
|
-
offline: {
|
|
6590
|
-
type: "boolean",
|
|
6591
|
-
description: "When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.",
|
|
6592
|
-
default: true
|
|
6593
|
-
},
|
|
6594
|
-
studioMode: {
|
|
6595
|
-
type: "boolean",
|
|
6596
|
-
description: "Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.",
|
|
6597
|
-
default: false
|
|
6598
|
-
},
|
|
6599
|
-
workflowsEnabled: {
|
|
6600
|
-
type: "boolean",
|
|
6601
|
-
description: "Powerhouse workflows in Connect. When true the tab loads the @powerhousedao/workflow package (workflow + connection documents, their editors and Workflow Studio) and the reactor worker registers its document models. Falls back to the top-level `workflows.enabled`; set it to override that for Connect. Independent of studioMode. False when neither is set."
|
|
6602
|
-
}
|
|
6603
|
-
}
|
|
6604
|
-
},
|
|
6605
|
-
ai: {
|
|
6606
|
-
type: "object",
|
|
6607
|
-
additionalProperties: false,
|
|
6608
|
-
description: "AI assistant (chat) behaviour.",
|
|
6609
|
-
properties: { assistantEnabled: {
|
|
6610
|
-
type: "boolean",
|
|
6611
|
-
description: "When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.",
|
|
6612
|
-
default: false
|
|
6613
|
-
} }
|
|
6614
|
-
},
|
|
6615
|
-
packages: {
|
|
6616
|
-
type: "object",
|
|
6617
|
-
additionalProperties: false,
|
|
6618
|
-
description: "Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).",
|
|
6619
|
-
properties: {
|
|
6620
|
-
externalEnabled: {
|
|
6621
|
-
type: "boolean",
|
|
6622
|
-
description: "When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.",
|
|
6623
|
-
default: true
|
|
6624
|
-
},
|
|
6625
|
-
liveReload: {
|
|
6626
|
-
type: "boolean",
|
|
6627
|
-
description: "When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).",
|
|
6628
|
-
default: false
|
|
6629
|
-
}
|
|
6630
|
-
}
|
|
6631
|
-
},
|
|
6632
|
-
drives: {
|
|
6633
|
-
type: "object",
|
|
6634
|
-
additionalProperties: false,
|
|
6635
|
-
description: "Default-drive and add-drive UI behaviour.",
|
|
6636
|
-
properties: {
|
|
6637
|
-
allowAddDrive: {
|
|
6638
|
-
type: "boolean",
|
|
6639
|
-
description: "When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.",
|
|
6640
|
-
default: true
|
|
6641
|
-
},
|
|
6642
|
-
defaultDrives: {
|
|
6643
|
-
type: "array",
|
|
6644
|
-
description: "Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).",
|
|
6645
|
-
default: [],
|
|
6646
|
-
items: { oneOf: [{
|
|
6647
|
-
type: "object",
|
|
6648
|
-
additionalProperties: false,
|
|
6649
|
-
required: ["url"],
|
|
6650
|
-
properties: {
|
|
6651
|
-
url: { type: "string" },
|
|
6652
|
-
name: { type: ["string", "null"] },
|
|
6653
|
-
icon: { type: ["string", "null"] }
|
|
6654
|
-
}
|
|
6655
|
-
}, {
|
|
6656
|
-
type: "object",
|
|
6657
|
-
additionalProperties: false,
|
|
6658
|
-
required: ["local", "id"],
|
|
6659
|
-
properties: {
|
|
6660
|
-
local: {
|
|
6661
|
-
const: true,
|
|
6662
|
-
description: "Discriminator: this entry is a local drive created on first boot."
|
|
6663
|
-
},
|
|
6664
|
-
id: {
|
|
6665
|
-
type: "string",
|
|
6666
|
-
description: "Stable drive id. The drive is created with this id on first boot and is not re-created on later boots."
|
|
6667
|
-
},
|
|
6668
|
-
name: { type: ["string", "null"] },
|
|
6669
|
-
icon: { type: ["string", "null"] },
|
|
6670
|
-
app: {
|
|
6671
|
-
type: "string",
|
|
6672
|
-
description: "Drive app (preferred editor) to open on the drive."
|
|
6673
|
-
}
|
|
6674
|
-
}
|
|
6675
|
-
}] }
|
|
6676
|
-
},
|
|
6677
|
-
preserveStrategy: {
|
|
6678
|
-
type: "string",
|
|
6679
|
-
enum: ["preserve-all", "preserve-by-url-and-detach"],
|
|
6680
|
-
description: "Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only."
|
|
6681
|
-
},
|
|
6682
|
-
sections: {
|
|
6683
|
-
type: "object",
|
|
6684
|
-
additionalProperties: false,
|
|
6685
|
-
description: "Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.",
|
|
6686
|
-
properties: {
|
|
6687
|
-
remote: driveSectionSchema,
|
|
6688
|
-
local: driveSectionSchema
|
|
6689
|
-
}
|
|
6690
|
-
}
|
|
6691
|
-
}
|
|
6692
|
-
},
|
|
6693
|
-
renown: {
|
|
6694
|
-
type: "object",
|
|
6695
|
-
additionalProperties: false,
|
|
6696
|
-
description: "Renown identity / authentication coordinates.",
|
|
6697
|
-
properties: {
|
|
6698
|
-
url: {
|
|
6699
|
-
type: "string",
|
|
6700
|
-
description: "Renown auth service URL.",
|
|
6701
|
-
default: "https://www.renown.id"
|
|
6702
|
-
},
|
|
6703
|
-
networkId: {
|
|
6704
|
-
type: "string",
|
|
6705
|
-
description: "CAIP-2 network namespace (e.g. 'eip155').",
|
|
6706
|
-
default: "eip155"
|
|
6707
|
-
},
|
|
6708
|
-
chainId: {
|
|
6709
|
-
type: "number",
|
|
6710
|
-
description: "CAIP-2 chain reference within the network namespace.",
|
|
6711
|
-
default: 1
|
|
6712
|
-
},
|
|
6713
|
-
namespace: {
|
|
6714
|
-
type: "string",
|
|
6715
|
-
description: "Renown localStorage namespace; share it across Connects to share login."
|
|
6716
|
-
},
|
|
6717
|
-
switchboardUrl: {
|
|
6718
|
-
type: "string",
|
|
6719
|
-
description: "Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`."
|
|
6720
|
-
},
|
|
6721
|
-
adapters: {
|
|
6722
|
-
type: "object",
|
|
6723
|
-
additionalProperties: false,
|
|
6724
|
-
description: "Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.",
|
|
6725
|
-
properties: {
|
|
6726
|
-
rainbow: {
|
|
6727
|
-
type: "object",
|
|
6728
|
-
additionalProperties: false,
|
|
6729
|
-
description: "wagmi + RainbowKit external-wallet adapter config.",
|
|
6730
|
-
properties: {
|
|
6731
|
-
walletConnectProjectId: {
|
|
6732
|
-
type: "string",
|
|
6733
|
-
description: "WalletConnect project id; required for this adapter to function."
|
|
6734
|
-
},
|
|
6735
|
-
infuraProjectId: {
|
|
6736
|
-
type: "string",
|
|
6737
|
-
description: "Optional Infura project id used to build RPC transports."
|
|
6738
|
-
}
|
|
6739
|
-
}
|
|
6740
|
-
},
|
|
6741
|
-
privy: {
|
|
6742
|
-
type: "object",
|
|
6743
|
-
additionalProperties: false,
|
|
6744
|
-
description: "Privy embedded/social adapter config.",
|
|
6745
|
-
properties: {
|
|
6746
|
-
appId: {
|
|
6747
|
-
type: "string",
|
|
6748
|
-
description: "Privy application id; required for this adapter to function."
|
|
6749
|
-
},
|
|
6750
|
-
clientId: {
|
|
6751
|
-
type: "string",
|
|
6752
|
-
description: "Optional Privy client id."
|
|
6753
|
-
},
|
|
6754
|
-
methods: {
|
|
6755
|
-
type: "array",
|
|
6756
|
-
description: "Login methods this adapter offers; default per adapter when omitted.",
|
|
6757
|
-
items: { type: "string" }
|
|
6758
|
-
}
|
|
6759
|
-
}
|
|
6760
|
-
}
|
|
6761
|
-
}
|
|
6762
|
-
}
|
|
6763
|
-
}
|
|
6764
|
-
},
|
|
6765
|
-
sentry: {
|
|
6766
|
-
type: "object",
|
|
6767
|
-
additionalProperties: false,
|
|
6768
|
-
description: "Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.",
|
|
6769
|
-
properties: {
|
|
6770
|
-
dsn: {
|
|
6771
|
-
type: ["string", "null"],
|
|
6772
|
-
description: "Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.",
|
|
6773
|
-
default: null
|
|
6774
|
-
},
|
|
6775
|
-
env: {
|
|
6776
|
-
type: "string",
|
|
6777
|
-
description: "Sentry environment label, surfaced as the `environment` tag on every event.",
|
|
6778
|
-
default: "dev"
|
|
6779
|
-
},
|
|
6780
|
-
tracing: {
|
|
6781
|
-
type: "boolean",
|
|
6782
|
-
description: "Enable Sentry performance tracing.",
|
|
6783
|
-
default: false
|
|
6784
|
-
}
|
|
6785
|
-
}
|
|
6786
|
-
},
|
|
6787
|
-
openPanel: {
|
|
6788
|
-
type: "object",
|
|
6789
|
-
additionalProperties: false,
|
|
6790
|
-
description: "OpenPanel product analytics. Set `clientId` to enable; an empty `clientId` disables it. Events are only sent after the user accepts analytics cookies. Takes precedence over the build-time PH_CONNECT_OPENPANEL_* env vars.",
|
|
6791
|
-
properties: {
|
|
6792
|
-
clientId: {
|
|
6793
|
-
type: "string",
|
|
6794
|
-
description: "OpenPanel client id. Empty string disables OpenPanel entirely.",
|
|
6795
|
-
default: ""
|
|
6796
|
-
},
|
|
6797
|
-
apiUrl: {
|
|
6798
|
-
type: "string",
|
|
6799
|
-
description: "OpenPanel API URL for self-hosted instances (e.g. 'https://openpanel.example/api'). Omit to use OpenPanel's hosted API."
|
|
6800
|
-
},
|
|
6801
|
-
trackUiEvents: {
|
|
6802
|
-
type: "boolean",
|
|
6803
|
-
description: "Track UI events.",
|
|
6804
|
-
default: true
|
|
6805
|
-
},
|
|
6806
|
-
trackOperations: {
|
|
6807
|
-
type: "boolean",
|
|
6808
|
-
description: "Track document operations.",
|
|
6809
|
-
default: true
|
|
6810
|
-
}
|
|
6811
|
-
}
|
|
6812
|
-
},
|
|
6813
|
-
instance: {
|
|
6814
|
-
type: "object",
|
|
6815
|
-
additionalProperties: false,
|
|
6816
|
-
required: ["namespace", "reactorWorker"],
|
|
6817
|
-
description: "Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.",
|
|
6818
|
-
properties: {
|
|
6819
|
-
namespace: {
|
|
6820
|
-
type: ["string", "null"],
|
|
6821
|
-
description: "Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.",
|
|
6822
|
-
default: null
|
|
6823
|
-
},
|
|
6824
|
-
reactorWorker: {
|
|
6825
|
-
type: "boolean",
|
|
6826
|
-
description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.",
|
|
6827
|
-
default: false
|
|
6828
|
-
}
|
|
6829
|
-
}
|
|
6830
|
-
},
|
|
6831
|
-
reactor: {
|
|
6832
|
-
type: "object",
|
|
6833
|
-
additionalProperties: false,
|
|
6834
|
-
description: "Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.",
|
|
6835
|
-
properties: {
|
|
6836
|
-
featureFlags: {
|
|
6837
|
-
type: "object",
|
|
6838
|
-
additionalProperties: false,
|
|
6839
|
-
description: "Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.",
|
|
6840
|
-
properties: {
|
|
6841
|
-
documentDecisions: {
|
|
6842
|
-
type: "boolean",
|
|
6843
|
-
description: "Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.",
|
|
6844
|
-
default: false
|
|
6845
|
-
},
|
|
6846
|
-
authEnforcement: {
|
|
6847
|
-
type: "boolean",
|
|
6848
|
-
description: "Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.",
|
|
6849
|
-
default: false
|
|
6850
|
-
},
|
|
6851
|
-
authGroups: {
|
|
6852
|
-
type: "boolean",
|
|
6853
|
-
description: "Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.",
|
|
6854
|
-
default: false
|
|
6855
|
-
},
|
|
6856
|
-
authConditions: {
|
|
6857
|
-
type: "boolean",
|
|
6858
|
-
description: "Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.",
|
|
6859
|
-
default: false
|
|
6860
|
-
}
|
|
6861
|
-
}
|
|
6862
|
-
},
|
|
6863
|
-
createSignaturePolicy: {
|
|
6864
|
-
type: "string",
|
|
6865
|
-
enum: ["legacy", "v2-required"],
|
|
6866
|
-
description: "What new documents are created as. `v2-required` documents accept only v2 action signatures and take content-addressed ids; set `legacy` while any peer Connect syncs with predates them. Existing documents keep their policy.",
|
|
6867
|
-
default: "v2-required"
|
|
6868
|
-
},
|
|
6869
|
-
unsupportedStoredDocuments: {
|
|
6870
|
-
type: "string",
|
|
6871
|
-
enum: ["refuse", "read-only"],
|
|
6872
|
-
description: "What the reactor does when this browser's store holds documents at protocol versions this build does not run. `refuse` fails the boot and names the versions; `read-only` boots and keeps those documents read-only.",
|
|
6873
|
-
default: "refuse"
|
|
6874
|
-
}
|
|
6875
|
-
}
|
|
6876
|
-
},
|
|
6877
|
-
pwa: {
|
|
6878
|
-
type: "object",
|
|
6879
|
-
additionalProperties: false,
|
|
6880
|
-
description: "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.",
|
|
6881
|
-
properties: {
|
|
6882
|
-
manifest: {
|
|
6883
|
-
type: "object",
|
|
6884
|
-
additionalProperties: false,
|
|
6885
|
-
description: "Web-app-manifest field overrides.",
|
|
6886
|
-
properties: {
|
|
6887
|
-
name: { type: "string" },
|
|
6888
|
-
short_name: { type: "string" },
|
|
6889
|
-
description: { type: "string" },
|
|
6890
|
-
theme_color: { type: "string" },
|
|
6891
|
-
background_color: { type: "string" },
|
|
6892
|
-
display: {
|
|
6893
|
-
type: "string",
|
|
6894
|
-
enum: [
|
|
6895
|
-
"fullscreen",
|
|
6896
|
-
"standalone",
|
|
6897
|
-
"minimal-ui",
|
|
6898
|
-
"browser"
|
|
6899
|
-
]
|
|
6900
|
-
},
|
|
6901
|
-
start_url: { type: "string" },
|
|
6902
|
-
scope: { type: "string" },
|
|
6903
|
-
icons: {
|
|
6904
|
-
type: "array",
|
|
6905
|
-
description: "Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).",
|
|
6906
|
-
items: pwaIconSchema
|
|
6907
|
-
},
|
|
6908
|
-
file_handlers: {
|
|
6909
|
-
type: "array",
|
|
6910
|
-
description: "File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.",
|
|
6911
|
-
items: {
|
|
6912
|
-
type: "object",
|
|
6913
|
-
additionalProperties: false,
|
|
6914
|
-
required: ["accept"],
|
|
6915
|
-
properties: {
|
|
6916
|
-
accept: {
|
|
6917
|
-
type: "object",
|
|
6918
|
-
description: "MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.",
|
|
6919
|
-
additionalProperties: {
|
|
6920
|
-
type: "array",
|
|
6921
|
-
items: {
|
|
6922
|
-
type: "string",
|
|
6923
|
-
pattern: "^\\."
|
|
6924
|
-
}
|
|
6925
|
-
}
|
|
6926
|
-
},
|
|
6927
|
-
icons: {
|
|
6928
|
-
type: "array",
|
|
6929
|
-
description: "OS-level file-type icons.",
|
|
6930
|
-
items: pwaIconSchema
|
|
6931
|
-
},
|
|
6932
|
-
launch_type: {
|
|
6933
|
-
type: "string",
|
|
6934
|
-
enum: ["single-client", "multiple-clients"]
|
|
6935
|
-
}
|
|
6936
|
-
}
|
|
6937
|
-
}
|
|
6938
|
-
},
|
|
6939
|
-
launch_handler: {
|
|
6940
|
-
type: "object",
|
|
6941
|
-
additionalProperties: false,
|
|
6942
|
-
required: ["client_mode"],
|
|
6943
|
-
description: "How the OS launches the app for handled files/links. Connect defaults to focus-existing.",
|
|
6944
|
-
properties: { client_mode: {
|
|
6945
|
-
type: "string",
|
|
6946
|
-
enum: [
|
|
6947
|
-
"auto",
|
|
6948
|
-
"focus-existing",
|
|
6949
|
-
"navigate-existing",
|
|
6950
|
-
"navigate-new"
|
|
6951
|
-
]
|
|
6952
|
-
} }
|
|
6953
|
-
}
|
|
6954
|
-
}
|
|
6955
|
-
},
|
|
6956
|
-
globPatterns: {
|
|
6957
|
-
type: "array",
|
|
6958
|
-
items: { type: "string" },
|
|
6959
|
-
description: "Extra Workbox precache globs, unioned with the built-ins."
|
|
6960
|
-
},
|
|
6961
|
-
globIgnores: {
|
|
6962
|
-
type: "array",
|
|
6963
|
-
items: { type: "string" },
|
|
6964
|
-
description: "Extra precache ignore globs, unioned with the built-ins."
|
|
6965
|
-
},
|
|
6966
|
-
maximumFileSizeToCacheInBytes: {
|
|
6967
|
-
type: "number",
|
|
6968
|
-
description: "Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit."
|
|
6969
|
-
},
|
|
6970
|
-
runtimeCaching: {
|
|
6971
|
-
type: "array",
|
|
6972
|
-
description: "Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.",
|
|
6973
|
-
items: {
|
|
6974
|
-
type: "object",
|
|
6975
|
-
additionalProperties: false,
|
|
6976
|
-
required: ["urlPattern", "handler"],
|
|
6977
|
-
properties: {
|
|
6978
|
-
urlPattern: pwaUrlPatternSchema,
|
|
6979
|
-
handler: {
|
|
6980
|
-
type: "string",
|
|
6981
|
-
enum: [
|
|
6982
|
-
"CacheFirst",
|
|
6983
|
-
"CacheOnly",
|
|
6984
|
-
"NetworkFirst",
|
|
6985
|
-
"NetworkOnly",
|
|
6986
|
-
"StaleWhileRevalidate"
|
|
6987
|
-
]
|
|
6988
|
-
},
|
|
6989
|
-
method: {
|
|
6990
|
-
type: "string",
|
|
6991
|
-
enum: [
|
|
6992
|
-
"GET",
|
|
6993
|
-
"POST",
|
|
6994
|
-
"PUT",
|
|
6995
|
-
"DELETE",
|
|
6996
|
-
"HEAD",
|
|
6997
|
-
"PATCH"
|
|
6998
|
-
]
|
|
6999
|
-
},
|
|
7000
|
-
options: {
|
|
7001
|
-
type: "object",
|
|
7002
|
-
additionalProperties: false,
|
|
7003
|
-
properties: {
|
|
7004
|
-
cacheName: { type: "string" },
|
|
7005
|
-
networkTimeoutSeconds: {
|
|
7006
|
-
type: "number",
|
|
7007
|
-
description: "Seconds a NetworkFirst rule waits for the network before falling back to the cache."
|
|
7008
|
-
},
|
|
7009
|
-
expiration: {
|
|
7010
|
-
type: "object",
|
|
7011
|
-
additionalProperties: false,
|
|
7012
|
-
properties: {
|
|
7013
|
-
maxEntries: { type: "number" },
|
|
7014
|
-
maxAgeSeconds: { type: "number" }
|
|
7015
|
-
}
|
|
7016
|
-
},
|
|
7017
|
-
cacheableResponse: {
|
|
7018
|
-
type: "object",
|
|
7019
|
-
additionalProperties: false,
|
|
7020
|
-
properties: {
|
|
7021
|
-
statuses: {
|
|
7022
|
-
type: "array",
|
|
7023
|
-
items: { type: "number" }
|
|
7024
|
-
},
|
|
7025
|
-
headers: {
|
|
7026
|
-
type: "object",
|
|
7027
|
-
additionalProperties: { type: "string" }
|
|
7028
|
-
}
|
|
7029
|
-
}
|
|
7030
|
-
}
|
|
7031
|
-
}
|
|
7032
|
-
}
|
|
7033
|
-
}
|
|
7034
|
-
}
|
|
7035
|
-
},
|
|
7036
|
-
navigateFallbackDenylist: {
|
|
7037
|
-
type: "array",
|
|
7038
|
-
description: "Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.",
|
|
7039
|
-
items: pwaUrlPatternSchema
|
|
7040
|
-
}
|
|
7041
|
-
}
|
|
7042
|
-
}
|
|
7043
|
-
}
|
|
7044
|
-
};
|
|
7045
|
-
//#endregion
|
|
7046
|
-
//#region clis/source-config-schema.ts
|
|
7047
7634
|
const SOURCE_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.source.json";
|
|
7048
7635
|
const sourceConfigSchema = {
|
|
7049
7636
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
@@ -7145,6 +7732,22 @@ const sourceConfigSchema = {
|
|
|
7145
7732
|
description: "Required when `type: postgres`."
|
|
7146
7733
|
}
|
|
7147
7734
|
}
|
|
7735
|
+
},
|
|
7736
|
+
keyframes: {
|
|
7737
|
+
type: "object",
|
|
7738
|
+
additionalProperties: false,
|
|
7739
|
+
description: "How many keyframes a document stream keeps and how often one is written. Without this block: a keyframe every 10 revisions, all kept. `PH_KEYFRAMES` overrides it.",
|
|
7740
|
+
properties: {
|
|
7741
|
+
default: {
|
|
7742
|
+
...keyframeRuleSchema,
|
|
7743
|
+
description: "The rule for every type `types` does not name."
|
|
7744
|
+
},
|
|
7745
|
+
types: {
|
|
7746
|
+
type: "object",
|
|
7747
|
+
description: "Rules by exact document type, over `default`.",
|
|
7748
|
+
additionalProperties: keyframeRuleSchema
|
|
7749
|
+
}
|
|
7750
|
+
}
|
|
7148
7751
|
}
|
|
7149
7752
|
}
|
|
7150
7753
|
},
|
|
@@ -7243,9 +7846,27 @@ const sourceConfigSchema = {
|
|
|
7243
7846
|
connectPort: {
|
|
7244
7847
|
type: "integer",
|
|
7245
7848
|
description: "Port `ph vetra`'s Connect dev server listens on. Assigned per project by `ph init`. Overridden by PH_VETRA_CONNECT_PORT or --connect-port."
|
|
7849
|
+
},
|
|
7850
|
+
previewDrive: {
|
|
7851
|
+
type: "object",
|
|
7852
|
+
additionalProperties: false,
|
|
7853
|
+
description: "The Vetra Preview drive `ph vetra` creates in watch mode.",
|
|
7854
|
+
properties: { app: {
|
|
7855
|
+
type: "string",
|
|
7856
|
+
description: "Id of the drive app the preview drive opens in, e.g. a drive editor's `config.id`. `ph vetra` sets it on the drive each time it starts; leaving it out keeps the drive's current app."
|
|
7857
|
+
} }
|
|
7246
7858
|
}
|
|
7247
7859
|
}
|
|
7248
7860
|
},
|
|
7861
|
+
assistant: {
|
|
7862
|
+
type: "object",
|
|
7863
|
+
additionalProperties: false,
|
|
7864
|
+
description: "The project's agent host (hosts/assistant): a headless Mastra agent API on the project switchboard.",
|
|
7865
|
+
properties: { port: {
|
|
7866
|
+
type: "integer",
|
|
7867
|
+
description: "Port the assistant host's chat-completions API listens on. Read by hosts/assistant/host.js (default 4910)."
|
|
7868
|
+
} }
|
|
7869
|
+
},
|
|
7249
7870
|
workflows: {
|
|
7250
7871
|
type: "object",
|
|
7251
7872
|
additionalProperties: false,
|
|
@@ -7296,6 +7917,6 @@ function assertNodeVersion(nodeVersion = process.versions.node) {
|
|
|
7296
7917
|
if (lt(nodeVersion, "24.0.0")) throw new NodeVersionError(nodeVersion, MINIMUM_NODE_VERSION);
|
|
7297
7918
|
}
|
|
7298
7919
|
//#endregion
|
|
7299
|
-
export { AGENTS, ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_LOGIN_EXPIRY, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, NodeVersionError, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, SOURCE_CONFIG_SCHEMA_ID, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, accessTokenArgs, assertNodeVersion, buildArgs, commonArgs, commonServerArgs, connectArgs, connectBasePath, connectBuildArgs, connectConfigArgs, connectPreviewArgs, connectStudioArgs, debugArgs, defaultDrivesUrl, defaultManifest, directoryExists, directoryExistsSync, disableLocalPackages, drivesPreserveStrategy, externalDependencies, externalDevDependencies, fetchNpmVersionFromRegistryForTag, fetchPackageVersionFromNpmRegistry, fileExists, fileExistsSync, force, generateArgs, getConfig, getGlobalPowerhouseProjectDirPath, getLocalPowerhouseProjectDirPath, getPackageManagerAtPowerhouseProjectDirPath, getPackageManagerCommand, getPackageNameFromPackageJson, getPackageVersionFromPackageJson, getPhCliVersionInfo, getPhCmdVersionInfo, getPowerhouseProjectInfo, getPowerhouseProjectInstallCommand, getPowerhouseProjectUninstallCommand, getTagFromVersion, getTelemetryStatus, handleMutuallyExclusiveOptions, https, httpsCertFile, httpsKeyFile, initArgs, initCliTelemetry, injectPnpmAllowBuilds, inspectArgs, installArgs, isDirectory, isFile, isPowerhouseProject, listArgs, localPackage, logLevel, logVersionUpdate, loginArgs, lowestVersion, makeDependenciesWithVersions, makeVersionedDependencies, makeVersionedDependenciesMap, migrateArgs, packageJsonExports, packageManagerArgs, packageScripts, packages, parsePackageManager, parsePackageVersion, parseTag, phCliCommandNames, phCliHelpCommands, publishArgs, registryLoginArgs, renownNamespace, renownSwitchboardUrl, resolveConnectPortDefault, resolveSwitchboardPortDefault, resolveTelemetryConsent, runCmd, runUseLocal, serviceArgs, setTelemetryConsent, sourceConfigSchema, spawnAsync, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs, vetraSwitchboardArgs, writeFileEnsuringDir };
|
|
7920
|
+
export { AGENTS, ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, BOILERPLATE_TRANSITIVE_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_DRIVE_ICON, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_LOGIN_EXPIRY, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, HOST_PACKAGE_SCRIPTS, KEYFRAMES_ACTIONS, KYSELY_PACKAGE, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, NodeVersionError, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, RELATIONAL_DB_PROCESSOR_CLASS, RETIRED_PACKAGE_SCRIPTS, SECONDS_IN_DAY, SERVICE_ACTIONS, SOURCE_CONFIG_SCHEMA_ID, SUPERSEDED_PACKAGE_SCRIPTS, SpawnError, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, accessTokenArgs, assertNodeVersion, buildArgs, buildPnpmLink, commonArgs, commonServerArgs, connectArgs, connectBasePath, connectBuildArgs, connectConfigArgs, connectPreviewArgs, connectStudioArgs, debugArgs, defaultDrivesUrl, defaultManifest, defaultStoreDirs, detectPackageManager, directoryExists, directoryExistsSync, disableLocalPackages, drivesPreserveStrategy, externalDependencies, externalDevDependencies, fetchNpmVersionFromRegistryForTag, fetchPackageVersionFromNpmRegistry, fileExists, fileExistsSync, force, generateArgs, getConfig, getGlobalPowerhouseProjectDirPath, getLocalPowerhouseProjectDirPath, getPackageManagerAtPowerhouseProjectDirPath, getPackageManagerCommand, getPackageNameFromPackageJson, getPackageVersionFromPackageJson, getPhCliVersionInfo, getPhCmdVersionInfo, getPowerhouseProjectInfo, getPowerhouseProjectInstallCommand, getPowerhouseProjectUninstallCommand, getTagFromVersion, getTelemetryStatus, handleMutuallyExclusiveOptions, https, httpsCertFile, httpsKeyFile, initArgs, initCliTelemetry, injectPnpmAllowBuilds, inspectArgs, installArgs, isDirectory, isFile, isPowerhouseProject, keyframesArgs, listArgs, localPackage, logLevel, logVersionUpdate, loginArgs, lowestVersion, makeDependenciesWithVersions, makeVersionedDependencies, makeVersionedDependenciesMap, migrateArgs, packageJsonExports, packageManagerArgs, packageScripts, packages, parsePackageManager, parsePackageVersion, parseTag, phCliCommandNames, phCliHelpCommands, projectFiles, publishArgs, recordWrites, registryLoginArgs, renownNamespace, renownSwitchboardUrl, resolveConnectPortDefault, resolvePhDir, resolveSwitchboardPortDefault, resolveTelemetryConsent, runCmd, runUseLocal, serviceArgs, setTelemetryConsent, sourceConfigSchema, spawnAsync, switchboardArgs, uninstallArgs, unpublishArgs, versionSatisfies, vetraArgs, vetraSwitchboardArgs, writeFileEnsuringDir };
|
|
7300
7921
|
|
|
7301
7922
|
//# sourceMappingURL=index.mjs.map
|