@powerhousedao/shared 6.2.3-dev.8 → 6.2.3-dev.81
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/analytics/index.d.ts +4 -4
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +25 -24
- package/dist/analytics/index.js.map +1 -1
- package/dist/clis/args/access-token.d.mts +15 -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-BpLj4peE.d.mts +186 -0
- package/dist/clis/args/common-BpLj4peE.d.mts.map +1 -0
- package/dist/clis/args/{common-CcYbXrBx.mjs → common-CBLen_yt.mjs} +58 -12
- package/dist/clis/args/common-CBLen_yt.mjs.map +1 -0
- package/dist/clis/args/common.d.mts +3 -2
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/connect.d.mts +449 -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-CA916Fvj.mjs → generate-a36SaAn4.mjs} +40 -2
- package/dist/clis/args/generate-a36SaAn4.mjs.map +1 -0
- package/dist/clis/args/generate.d.mts +102 -2
- package/dist/clis/args/generate.d.mts.map +1 -0
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-Bqbgbalu.mjs → help-Cb66IK-J.mjs} +59 -16
- package/dist/clis/args/help-Cb66IK-J.mjs.map +1 -0
- package/dist/clis/args/help-CmnOv3z3.d.mts +227 -0
- package/dist/clis/args/help-CmnOv3z3.d.mts.map +1 -0
- package/dist/clis/args/help.d.mts +3 -2
- package/dist/clis/args/help.mjs +14 -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 +22 -19
- package/dist/clis/args/index.mjs +21 -19
- package/dist/clis/args/init.d.mts +54 -2
- package/dist/clis/args/init.d.mts.map +1 -0
- package/dist/clis/args/init.mjs +71 -1
- package/dist/clis/args/init.mjs.map +1 -0
- package/dist/clis/args/inspect.d.mts +12 -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 +36 -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/list.d.mts +9 -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 +24 -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/mcp.d.mts +15 -0
- 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 +18 -2
- package/dist/clis/args/migrate.d.mts.map +1 -0
- package/dist/clis/args/migrate.mjs +27 -1
- package/dist/clis/args/migrate.mjs.map +1 -0
- package/dist/clis/args/publish.d.mts +15 -2
- package/dist/clis/args/publish.d.mts.map +1 -0
- package/dist/clis/args/publish.mjs +18 -1
- package/dist/clis/args/publish.mjs.map +1 -0
- package/dist/clis/args/registry.d.mts +16 -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/run.d.mts +18 -0
- package/dist/clis/args/run.d.mts.map +1 -0
- package/dist/clis/args/run.mjs +28 -0
- package/dist/clis/args/run.mjs.map +1 -0
- package/dist/clis/args/service-IZ0Aq58z.d.mts +27 -0
- package/dist/clis/args/service-IZ0Aq58z.d.mts.map +1 -0
- package/dist/clis/args/service.d.mts +3 -2
- package/dist/clis/args/service.mjs +10 -1
- package/dist/clis/args/service.mjs.map +1 -0
- package/dist/clis/args/switchboard.d.mts +69 -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 +27 -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 +21 -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-b4KUu1Ax.mjs → vetra-DlAEC_Mv.mjs} +18 -2
- package/dist/clis/args/vetra-DlAEC_Mv.mjs.map +1 -0
- package/dist/clis/args/vetra.d.mts +113 -2
- package/dist/clis/args/vetra.d.mts.map +1 -0
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/build-config-xZgi0nyb.mjs +278 -0
- package/dist/clis/build-config-xZgi0nyb.mjs.map +1 -0
- package/dist/clis/build-config.d.mts +56 -10616
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +2 -88
- package/dist/clis/build-pieces.d.mts +160 -0
- package/dist/clis/build-pieces.d.mts.map +1 -0
- package/dist/clis/build-pieces.mjs +549 -0
- package/dist/clis/build-pieces.mjs.map +1 -0
- package/dist/clis/command-names.d.mts +6 -2
- 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 +3 -462
- package/dist/clis/constants.mjs +87 -21
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/feature-flags.d.mts +17 -0
- package/dist/clis/feature-flags.d.mts.map +1 -0
- package/dist/clis/feature-flags.mjs +21 -0
- package/dist/clis/feature-flags.mjs.map +1 -0
- package/dist/clis/index-DnZYG-8g.d.mts +11154 -0
- package/dist/clis/index-DnZYG-8g.d.mts.map +1 -0
- package/dist/clis/index.d.mts +3474 -1967
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +1208 -875
- 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 +10 -4
- 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/project-ports.d.mts +5 -5
- package/dist/clis/project-ports.d.mts.map +1 -1
- package/dist/clis/project-ports.mjs +1 -1
- package/dist/clis/project-ports.mjs.map +1 -1
- package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/clis/services/telemetry.d.mts +7 -7
- package/dist/clis/services/telemetry.d.mts.map +1 -1
- package/dist/clis/services/telemetry.mjs.map +1 -1
- package/dist/clis/types-DKuZRMVO.d.mts +2353 -0
- package/dist/clis/types-DKuZRMVO.d.mts.map +1 -0
- package/dist/clis/utils.d.mts +4 -4
- package/dist/clis/utils.d.mts.map +1 -1
- package/dist/clis/utils.mjs.map +1 -1
- package/dist/{config-loader-B845Hidf.js → config-loader-B7SqNz8z.js} +50 -12
- package/dist/config-loader-B7SqNz8z.js.map +1 -0
- package/dist/connect/config-loader.d.ts +21 -8
- 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 +449 -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 +226 -643
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +443 -507
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/json-adapter.d.ts +3 -4
- package/dist/connect/json-adapter.d.ts.map +1 -1
- package/dist/connect/json-adapter.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-CsotSch2.d.ts +1736 -0
- package/dist/connect-config-schema-CsotSch2.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 +3 -2
- package/dist/constants.js +17 -5
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +103 -101
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +41 -32
- 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 +152 -0
- package/dist/document-model/errors.js.map +1 -0
- package/dist/document-model/index.d.ts +7 -4
- package/dist/document-model/index.js +7 -5143
- package/dist/document-model/mock.d.ts +2 -3
- package/dist/document-model/mock.d.ts.map +1 -1
- package/dist/document-model/mock.js +2 -1
- package/dist/document-model/mock.js.map +1 -1
- package/dist/document-model/utils.d.ts +4 -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-D8Z3NUYl.js +5202 -0
- package/dist/document-model-D8Z3NUYl.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-D58WVj_E.d.ts +246 -0
- package/dist/index-D58WVj_E.d.ts.map +1 -0
- package/dist/index-iCvF3gYi.d.ts +36 -0
- package/dist/index-iCvF3gYi.d.ts.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js.map +1 -1
- package/dist/processors/index.d.ts +3 -2
- package/dist/processors/index.js +180 -67
- 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-YMJM0Vl7.js +402 -0
- package/dist/purge-YMJM0Vl7.js.map +1 -0
- package/dist/registry/index.d.ts +15 -15
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +64 -12
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +4 -3
- package/dist/registry/manifest-slim.d.ts.map +1 -1
- package/dist/registry/manifest-slim.js +21 -0
- package/dist/registry/manifest-slim.js.map +1 -1
- package/dist/registry/updates.d.ts +3 -3
- package/dist/registry/updates.d.ts.map +1 -1
- package/dist/registry/updates.js.map +1 -1
- package/dist/registry/urls.d.ts +2 -2
- package/dist/registry/urls.d.ts.map +1 -1
- package/dist/registry/urls.js.map +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
- package/dist/types-Bsp8VL2y.d.ts.map +1 -0
- package/dist/types-CJNZYvPc.d.ts +4547 -0
- package/dist/types-CJNZYvPc.d.ts.map +1 -0
- package/dist/{types-YqLqb0Zb.d.ts → types-avXn3ESK.d.ts} +39 -43
- package/dist/types-avXn3ESK.d.ts.map +1 -0
- package/dist/{utils-DP122OSS.d.ts → utils-BrKxCmKx.d.ts} +2 -2
- package/dist/utils-BrKxCmKx.d.ts.map +1 -0
- package/dist/{utils-aaTmfxFW.js → utils-CSF716ux.js} +10 -3
- package/dist/utils-CSF716ux.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 +34 -7
- package/dist/clis/args/access-token--9H57y8J.d.mts +0 -18
- package/dist/clis/args/access-token--9H57y8J.d.mts.map +0 -1
- package/dist/clis/args/access-token-To5LaIfL.mjs +0 -22
- package/dist/clis/args/access-token-To5LaIfL.mjs.map +0 -1
- package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
- package/dist/clis/args/common-Dsf1vpHV.d.mts +0 -183
- package/dist/clis/args/common-Dsf1vpHV.d.mts.map +0 -1
- package/dist/clis/args/connect-BVVvCmL9.mjs +0 -198
- package/dist/clis/args/connect-BVVvCmL9.mjs.map +0 -1
- package/dist/clis/args/connect-DetTnI8g.d.mts +0 -443
- package/dist/clis/args/connect-DetTnI8g.d.mts.map +0 -1
- package/dist/clis/args/generate-CA916Fvj.mjs.map +0 -1
- package/dist/clis/args/generate-DnV-bfXt.d.mts +0 -87
- package/dist/clis/args/generate-DnV-bfXt.d.mts.map +0 -1
- package/dist/clis/args/help-Bqbgbalu.mjs.map +0 -1
- package/dist/clis/args/help-CjAsudUn.d.mts +0 -193
- package/dist/clis/args/help-CjAsudUn.d.mts.map +0 -1
- package/dist/clis/args/init-CUXyfquF.d.mts +0 -55
- package/dist/clis/args/init-CUXyfquF.d.mts.map +0 -1
- package/dist/clis/args/init-rz9Ei7nq.mjs +0 -67
- package/dist/clis/args/init-rz9Ei7nq.mjs.map +0 -1
- package/dist/clis/args/inspect-DtZeoA5c.d.mts +0 -15
- package/dist/clis/args/inspect-DtZeoA5c.d.mts.map +0 -1
- package/dist/clis/args/inspect-tckH8mSw.mjs +0 -15
- package/dist/clis/args/inspect-tckH8mSw.mjs.map +0 -1
- package/dist/clis/args/install-CkP8zcHb.d.mts +0 -40
- package/dist/clis/args/install-CkP8zcHb.d.mts.map +0 -1
- package/dist/clis/args/install-Sz2DlCHh.mjs +0 -32
- package/dist/clis/args/install-Sz2DlCHh.mjs.map +0 -1
- package/dist/clis/args/list-BGf8s_gj.d.mts +0 -12
- package/dist/clis/args/list-BGf8s_gj.d.mts.map +0 -1
- package/dist/clis/args/list-DM2d6f1m.mjs +0 -7
- package/dist/clis/args/list-DM2d6f1m.mjs.map +0 -1
- package/dist/clis/args/login-DNsHwvqk.d.mts +0 -27
- package/dist/clis/args/login-DNsHwvqk.d.mts.map +0 -1
- package/dist/clis/args/login-DiKT5Jfu.mjs +0 -40
- package/dist/clis/args/login-DiKT5Jfu.mjs.map +0 -1
- package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs +0 -1013
- package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs.map +0 -1
- package/dist/clis/args/migrate-CG_gWc4k.mjs +0 -29
- package/dist/clis/args/migrate-CG_gWc4k.mjs.map +0 -1
- package/dist/clis/args/migrate-sixkWhxm.d.mts +0 -21
- package/dist/clis/args/migrate-sixkWhxm.d.mts.map +0 -1
- package/dist/clis/args/publish-DDZYsUfV.mjs +0 -19
- package/dist/clis/args/publish-DDZYsUfV.mjs.map +0 -1
- package/dist/clis/args/publish-Dqe5DUst.d.mts +0 -18
- package/dist/clis/args/publish-Dqe5DUst.d.mts.map +0 -1
- package/dist/clis/args/registry-C_OVFQmI.mjs +0 -23
- package/dist/clis/args/registry-C_OVFQmI.mjs.map +0 -1
- package/dist/clis/args/registry-C_RfTsKB.d.mts +0 -19
- package/dist/clis/args/registry-C_RfTsKB.d.mts.map +0 -1
- package/dist/clis/args/service-CHOOr0Gg.mjs +0 -11
- package/dist/clis/args/service-CHOOr0Gg.mjs.map +0 -1
- package/dist/clis/args/service-DhIkf8-O.d.mts +0 -22
- package/dist/clis/args/service-DhIkf8-O.d.mts.map +0 -1
- package/dist/clis/args/switchboard-BlPaq2at.d.mts +0 -72
- package/dist/clis/args/switchboard-BlPaq2at.d.mts.map +0 -1
- package/dist/clis/args/switchboard-Dsp7nosi.mjs +0 -85
- package/dist/clis/args/switchboard-Dsp7nosi.mjs.map +0 -1
- package/dist/clis/args/uninstall-BpA3YYbw.d.mts +0 -31
- package/dist/clis/args/uninstall-BpA3YYbw.d.mts.map +0 -1
- package/dist/clis/args/uninstall-CTwTX0u_.mjs +0 -16
- package/dist/clis/args/uninstall-CTwTX0u_.mjs.map +0 -1
- package/dist/clis/args/unpublish-BPMkGEg5.mjs +0 -30
- package/dist/clis/args/unpublish-BPMkGEg5.mjs.map +0 -1
- package/dist/clis/args/unpublish-CvwaIimG.d.mts +0 -24
- package/dist/clis/args/unpublish-CvwaIimG.d.mts.map +0 -1
- package/dist/clis/args/vetra-DLQ6lhLl.d.mts +0 -113
- package/dist/clis/args/vetra-DLQ6lhLl.d.mts.map +0 -1
- package/dist/clis/args/vetra-b4KUu1Ax.mjs.map +0 -1
- package/dist/clis/args/vetra-ports.test.d.mts +0 -1
- package/dist/clis/args/vetra-ports.test.mjs +0 -13249
- package/dist/clis/args/vetra-ports.test.mjs.map +0 -1
- package/dist/clis/build-config.mjs.map +0 -1
- package/dist/clis/constants.d.mts.map +0 -1
- package/dist/config-loader-B845Hidf.js.map +0 -1
- package/dist/constants-BP_gjn8g.d.ts +0 -8
- package/dist/constants-BP_gjn8g.d.ts.map +0 -1
- package/dist/document-model/index.js.map +0 -1
- package/dist/index-C_iVZe7f.d.ts +0 -7
- package/dist/index-C_iVZe7f.d.ts.map +0 -1
- package/dist/index-DyYIJtVy.d.ts +0 -836
- package/dist/index-DyYIJtVy.d.ts.map +0 -1
- package/dist/types-C1in4fl3.d.ts.map +0 -1
- package/dist/types-CpnWmiFY.d.ts +0 -3167
- package/dist/types-CpnWmiFY.d.ts.map +0 -1
- package/dist/types-YqLqb0Zb.d.ts.map +0 -1
- package/dist/utils-DP122OSS.d.ts.map +0 -1
- package/dist/utils-aaTmfxFW.js.map +0 -1
package/dist/clis/index.mjs
CHANGED
|
@@ -1,48 +1,25 @@
|
|
|
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
4
|
import { homedir } from "node:os";
|
|
5
5
|
import path, { join } from "node:path";
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, 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, valid } from "semver";
|
|
13
|
+
import { clean, compare, satisfies, valid } from "semver";
|
|
14
14
|
import spawn from "cross-spawn";
|
|
15
15
|
import { isTruthy } from "remeda";
|
|
16
16
|
import npa from "npm-package-arg";
|
|
17
17
|
import { packageDirectory } from "package-directory";
|
|
18
18
|
import { execSync } from "child_process";
|
|
19
|
-
import { dirname } from "path";
|
|
19
|
+
import { dirname, resolve } from "path";
|
|
20
20
|
import { writePackage } from "write-package";
|
|
21
|
+
import { toJSONSchema, z } from "zod";
|
|
21
22
|
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), 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 ? __defProp(target, "default", {
|
|
41
|
-
value: mod,
|
|
42
|
-
enumerable: true
|
|
43
|
-
}) : target, mod));
|
|
44
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
45
|
-
//#endregion
|
|
46
23
|
//#region clis/constants.ts
|
|
47
24
|
const SERVICE_ACTIONS = [
|
|
48
25
|
"start",
|
|
@@ -51,7 +28,7 @@ const SERVICE_ACTIONS = [
|
|
|
51
28
|
"setup",
|
|
52
29
|
"restart"
|
|
53
30
|
];
|
|
54
|
-
const SECONDS_IN_DAY =
|
|
31
|
+
const SECONDS_IN_DAY = 86400;
|
|
55
32
|
const DEFAULT_EXPIRY_DAYS = 7;
|
|
56
33
|
const DEFAULT_EXPIRY_SECONDS = 7 * SECONDS_IN_DAY;
|
|
57
34
|
const DRIVES_PRESERVE_STRATEGIES = ["preserve-all", "preserve-by-url-and-detach"];
|
|
@@ -74,6 +51,18 @@ const PROJECT_PORT_BAND_SIZE = 1e3;
|
|
|
74
51
|
const PROJECT_PORT_BAND_SWITCHBOARD = 7e3;
|
|
75
52
|
const PROJECT_PORT_BAND_STUDIO = 6e3;
|
|
76
53
|
const PROJECT_PORT_BAND_VETRA_CONNECT = 2e3;
|
|
54
|
+
/**
|
|
55
|
+
* Icon for the drives switchboard creates by default, inlined as a data URI.
|
|
56
|
+
*
|
|
57
|
+
* A remote URL is the wrong shape for this: the value is baked into the drive
|
|
58
|
+
* document and rendered by every Connect that opens it, so the icon only
|
|
59
|
+
* appears when that client can reach that host. A desktop or air-gapped install
|
|
60
|
+
* cannot, and the ipfs.io gateway this previously pointed at now answers 403
|
|
61
|
+
* regardless.
|
|
62
|
+
*
|
|
63
|
+
* The mark is drawn dark-on-light so it stays legible against either theme.
|
|
64
|
+
*/
|
|
65
|
+
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
66
|
const DEFAULT_VETRA_DRIVE_ID = "vetra";
|
|
78
67
|
const MINIMUM_NODE_VERSION = "24.0.0";
|
|
79
68
|
const PH_BIN = "ph-cli-legacy";
|
|
@@ -82,11 +71,18 @@ const PH_GLOBAL_DIR_NAME = ".ph";
|
|
|
82
71
|
const PH_GLOBAL_PROJECT_NAME = ".ph";
|
|
83
72
|
const HOME_DIR = homedir();
|
|
84
73
|
const POWERHOUSE_GLOBAL_DIR = join(HOME_DIR, ".ph");
|
|
85
|
-
const VERSIONED_PEER_DEPENDENCIES = [
|
|
74
|
+
const VERSIONED_PEER_DEPENDENCIES = [
|
|
75
|
+
"document-model",
|
|
76
|
+
"@powerhousedao/reactor-browser",
|
|
77
|
+
"@powerhousedao/connect-core"
|
|
78
|
+
];
|
|
86
79
|
const REACTOR_API_PACKAGE = "@powerhousedao/reactor-api";
|
|
87
80
|
const ANALYTICS_ENGINE_CORE_PACKAGE = "@powerhousedao/analytics-engine-core";
|
|
88
81
|
const GRAPHQL_PACKAGE = "graphql";
|
|
89
82
|
const GRAPHQL_TAG_PACKAGE = "graphql-tag";
|
|
83
|
+
const PIECES_FRAMEWORK_PACKAGE = "@powerhousedao/pieces-framework";
|
|
84
|
+
const KYSELY_PACKAGE = "kysely";
|
|
85
|
+
const RELATIONAL_DB_PROCESSOR_CLASS = "RelationalDbProcessor";
|
|
90
86
|
const PEER_EXTERNAL_DEPENDENCIES = {
|
|
91
87
|
[GRAPHQL_PACKAGE]: {
|
|
92
88
|
peer: "^16",
|
|
@@ -106,14 +102,43 @@ const PEER_EXTERNAL_DEPENDENCIES = {
|
|
|
106
102
|
},
|
|
107
103
|
zod: {
|
|
108
104
|
peer: "^4",
|
|
109
|
-
dev: "4.
|
|
105
|
+
dev: "4.6.5"
|
|
106
|
+
},
|
|
107
|
+
"@tanstack/react-router": {
|
|
108
|
+
peer: "^1.170.41",
|
|
109
|
+
dev: "1.170.41"
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
-
const FEATURE_DEPENDENCIES = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
const FEATURE_DEPENDENCIES = {
|
|
113
|
+
analyticsProcessor: {
|
|
114
|
+
peerVersioned: [ANALYTICS_ENGINE_CORE_PACKAGE],
|
|
115
|
+
peerExternal: {},
|
|
116
|
+
devVersioned: []
|
|
117
|
+
},
|
|
118
|
+
relationalDbProcessor: {
|
|
119
|
+
peerVersioned: [],
|
|
120
|
+
peerExternal: { [KYSELY_PACKAGE]: {
|
|
121
|
+
peer: "^0.28",
|
|
122
|
+
dev: "0.28.16"
|
|
123
|
+
} },
|
|
124
|
+
devVersioned: []
|
|
125
|
+
},
|
|
126
|
+
subgraph: {
|
|
127
|
+
peerVersioned: [REACTOR_API_PACKAGE],
|
|
128
|
+
peerExternal: {},
|
|
129
|
+
devVersioned: []
|
|
130
|
+
},
|
|
131
|
+
piece: {
|
|
132
|
+
peerVersioned: [],
|
|
133
|
+
peerExternal: {},
|
|
134
|
+
devVersioned: [PIECES_FRAMEWORK_PACKAGE]
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const VERSIONED_DEPENDENCIES = [
|
|
138
|
+
...VERSIONED_PEER_DEPENDENCIES,
|
|
139
|
+
...FEATURE_DEPENDENCIES.analyticsProcessor.peerVersioned,
|
|
140
|
+
...FEATURE_DEPENDENCIES.subgraph.peerVersioned
|
|
141
|
+
];
|
|
117
142
|
const BOILERPLATE_ALLOWED_BUILDS = [
|
|
118
143
|
"@apollo/protobufjs",
|
|
119
144
|
"@datadog/pprof",
|
|
@@ -135,7 +160,12 @@ const VERSIONED_DEV_DEPENDENCIES = [
|
|
|
135
160
|
"@powerhousedao/reactor",
|
|
136
161
|
"@powerhousedao/shared",
|
|
137
162
|
"@powerhousedao/connect",
|
|
138
|
-
"@powerhousedao/design-system"
|
|
163
|
+
"@powerhousedao/design-system",
|
|
164
|
+
"@powerhousedao/host-core",
|
|
165
|
+
"@powerhousedao/clint",
|
|
166
|
+
"@powerhousedao/desktop",
|
|
167
|
+
"@powerhousedao/vetra-studio",
|
|
168
|
+
"@powerhousedao/switchboard"
|
|
139
169
|
];
|
|
140
170
|
const packageJsonExports = {
|
|
141
171
|
".": {
|
|
@@ -169,24 +199,37 @@ const packageJsonExports = {
|
|
|
169
199
|
},
|
|
170
200
|
"./subgraphs": {
|
|
171
201
|
types: "./dist/types/subgraphs/index.d.ts",
|
|
172
|
-
browser: "./dist/browser/subgraphs/index.js",
|
|
173
202
|
node: "./dist/node/subgraphs/index.mjs"
|
|
174
203
|
},
|
|
204
|
+
"./scalars": {
|
|
205
|
+
types: "./dist/types/scalars/index.d.ts",
|
|
206
|
+
browser: "./dist/browser/scalars/index.js",
|
|
207
|
+
node: "./dist/node/scalars/index.mjs"
|
|
208
|
+
},
|
|
209
|
+
"./connect-routes": { browser: "./dist/browser/connect-routes.js" },
|
|
175
210
|
"./processors": {
|
|
176
211
|
types: "./dist/types/processors/index.d.ts",
|
|
177
212
|
browser: "./dist/browser/processors/index.js",
|
|
178
213
|
node: "./dist/node/processors/index.mjs"
|
|
179
214
|
},
|
|
215
|
+
"./pieces": {
|
|
216
|
+
types: "./dist/types/pieces/index.d.ts",
|
|
217
|
+
node: "./dist/node/pieces/index.mjs"
|
|
218
|
+
},
|
|
219
|
+
"./pieces/*": {
|
|
220
|
+
types: "./dist/types/pieces/*/index.d.ts",
|
|
221
|
+
node: "./dist/node/pieces/*/index.mjs"
|
|
222
|
+
},
|
|
180
223
|
"./manifest": "./dist/powerhouse.manifest.json",
|
|
181
224
|
"./style.css": "./dist/style.css"
|
|
182
225
|
};
|
|
183
226
|
const packageScripts = {
|
|
184
227
|
"test:watch": "vitest",
|
|
185
|
-
lint: "oxlint --type-aware --type-check",
|
|
186
|
-
"lint:fix": "oxlint --type-aware --type-check --fix",
|
|
228
|
+
lint: "ph-cli generate connect-routes && oxlint --type-aware --type-check",
|
|
229
|
+
"lint:fix": "ph-cli generate connect-routes && oxlint --type-aware --type-check --fix",
|
|
187
230
|
format: "oxfmt",
|
|
188
231
|
"format:check": "oxfmt --check",
|
|
189
|
-
tsc: "tsc",
|
|
232
|
+
tsc: "ph-cli generate connect-routes && tsc",
|
|
190
233
|
"tsc:watch": "tsc --watch",
|
|
191
234
|
generate: "ph-cli generate",
|
|
192
235
|
connect: "ph-cli connect",
|
|
@@ -194,6 +237,7 @@ const packageScripts = {
|
|
|
194
237
|
reactor: "ph-cli reactor",
|
|
195
238
|
service: "ph-cli service",
|
|
196
239
|
vetra: "ph-cli vetra",
|
|
240
|
+
mcp: "ph-cli mcp",
|
|
197
241
|
"service-startup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh",
|
|
198
242
|
"service-unstartup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"
|
|
199
243
|
};
|
|
@@ -242,15 +286,14 @@ const externalDevDependencies = {
|
|
|
242
286
|
"@types/react": "^19.2.3",
|
|
243
287
|
"@types/react-dom": "^19.2.3",
|
|
244
288
|
"@vitejs/plugin-react": "^6.0.1",
|
|
245
|
-
"@vitest/coverage-v8": "
|
|
246
|
-
oxfmt: "0.
|
|
247
|
-
oxlint: "1.
|
|
248
|
-
"oxlint-tsgolint": "0.
|
|
289
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
290
|
+
oxfmt: "0.68.0",
|
|
291
|
+
oxlint: "1.83.0",
|
|
292
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
249
293
|
tailwindcss: "^4.1.16",
|
|
250
|
-
typescript: "
|
|
294
|
+
typescript: "~7.0.2",
|
|
251
295
|
vite: "^8.0.10",
|
|
252
|
-
|
|
253
|
-
vitest: "4.1.1"
|
|
296
|
+
vitest: "5.0.3"
|
|
254
297
|
};
|
|
255
298
|
const defaultManifest = {
|
|
256
299
|
name: "",
|
|
@@ -309,6 +352,20 @@ const buildArgs = {
|
|
|
309
352
|
defaultValue: () => "dist",
|
|
310
353
|
defaultValueIsSerializable: true
|
|
311
354
|
}),
|
|
355
|
+
noSharedDeps: flag({
|
|
356
|
+
type: boolean,
|
|
357
|
+
long: "no-shared-deps",
|
|
358
|
+
description: "Bundle the shared dependency set instead of externalizing it (default: externalize)",
|
|
359
|
+
defaultValue: () => false,
|
|
360
|
+
defaultValueIsSerializable: true
|
|
361
|
+
}),
|
|
362
|
+
ignoreTypeErrors: flag({
|
|
363
|
+
type: boolean,
|
|
364
|
+
long: "ignore-type-errors",
|
|
365
|
+
description: "Unsafe: build even when tsc reports type errors, without asking. The package can load and still fail at runtime",
|
|
366
|
+
defaultValue: () => false,
|
|
367
|
+
defaultValueIsSerializable: true
|
|
368
|
+
}),
|
|
312
369
|
...debugArgs
|
|
313
370
|
};
|
|
314
371
|
const packageManagerArgs = {
|
|
@@ -357,10 +414,9 @@ const localPackage = option({
|
|
|
357
414
|
env: "PH_LOCAL_PACKAGE"
|
|
358
415
|
});
|
|
359
416
|
const disableLocalPackages = flag({
|
|
360
|
-
type: boolean,
|
|
417
|
+
type: optional(boolean),
|
|
361
418
|
long: "ignore-local",
|
|
362
|
-
description: "Do not load local packages from this project"
|
|
363
|
-
defaultValue: () => false
|
|
419
|
+
description: "Do not load local packages from this project"
|
|
364
420
|
});
|
|
365
421
|
const httpsKeyFile = option({
|
|
366
422
|
type: optional(string),
|
|
@@ -414,7 +470,7 @@ const vetraSwitchboardArgs = {
|
|
|
414
470
|
const defaultDrivesUrl = option({
|
|
415
471
|
type: optional(string),
|
|
416
472
|
long: "default-drives-url",
|
|
417
|
-
description: "
|
|
473
|
+
description: "Comma-separated drive URLs to use as Connect's default drives.",
|
|
418
474
|
defaultValue: () => ""
|
|
419
475
|
});
|
|
420
476
|
const logLevel = option({
|
|
@@ -551,7 +607,7 @@ const connectRuntimeOverrideArgs = {
|
|
|
551
607
|
json: option({
|
|
552
608
|
type: optional(string),
|
|
553
609
|
long: "json",
|
|
554
|
-
description: "Inline JSON override for the runtime connect.* block, e.g. '{\"renown\":{\"url\":\"...\"}}'. Validated against the runtime schema; deep-merged on top of
|
|
610
|
+
description: "Inline JSON override for the runtime connect.* block, without the \"connect\" wrapper, e.g. '{\"app\":{\"workflowsEnabled\":true},\"renown\":{\"url\":\"...\"}}'. A top-level packageRegistryUrl is also accepted. Validated against the runtime schema (unknown keys fail); deep-merged on top of source powerhouse.config.json. Individual --flag values beat --json on collision."
|
|
555
611
|
}),
|
|
556
612
|
renownUrl: option({
|
|
557
613
|
type: optional(string),
|
|
@@ -580,6 +636,11 @@ const connectRuntimeOverrideArgs = {
|
|
|
580
636
|
long: "external-packages",
|
|
581
637
|
description: "Override connect.packages.externalEnabled."
|
|
582
638
|
}),
|
|
639
|
+
workflows: option({
|
|
640
|
+
type: optional(cliBoolean),
|
|
641
|
+
long: "workflows",
|
|
642
|
+
description: "Override connect.app.workflowsEnabled (load the @powerhousedao/workflow package: workflow + connection documents, their editors and Workflow Studio)."
|
|
643
|
+
}),
|
|
583
644
|
remoteDrivesEnabled: option({
|
|
584
645
|
type: optional(cliBoolean),
|
|
585
646
|
long: "remote-drives-enabled",
|
|
@@ -623,7 +684,7 @@ const connectRuntimeOverrideArgs = {
|
|
|
623
684
|
homeBackground: option({
|
|
624
685
|
type: optional(string),
|
|
625
686
|
long: "home-background",
|
|
626
|
-
description: "Override connect.
|
|
687
|
+
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."
|
|
627
688
|
}),
|
|
628
689
|
sentryDsn: option({
|
|
629
690
|
type: optional(string),
|
|
@@ -671,7 +732,7 @@ const connectBuildArgs = {
|
|
|
671
732
|
favicon: option({
|
|
672
733
|
type: optional(string),
|
|
673
734
|
long: "favicon",
|
|
674
|
-
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."
|
|
735
|
+
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."
|
|
675
736
|
}),
|
|
676
737
|
...commonArgs
|
|
677
738
|
};
|
|
@@ -801,6 +862,44 @@ const generateArgs = {
|
|
|
801
862
|
long: "subgraph",
|
|
802
863
|
description: "Subgraph name."
|
|
803
864
|
}),
|
|
865
|
+
pieceName: option({
|
|
866
|
+
type: optional(string),
|
|
867
|
+
long: "piece",
|
|
868
|
+
description: "Piece name."
|
|
869
|
+
}),
|
|
870
|
+
pieceId: option({
|
|
871
|
+
type: optional(string),
|
|
872
|
+
long: "piece-id",
|
|
873
|
+
description: "Piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name."
|
|
874
|
+
}),
|
|
875
|
+
pieceAuth: option({
|
|
876
|
+
type: oneOf([
|
|
877
|
+
"none",
|
|
878
|
+
"secret",
|
|
879
|
+
"custom"
|
|
880
|
+
]),
|
|
881
|
+
long: "piece-auth",
|
|
882
|
+
description: "The kind of connection the generated piece asks for. Default is custom.",
|
|
883
|
+
defaultValue: () => "custom",
|
|
884
|
+
defaultValueIsSerializable: true
|
|
885
|
+
}),
|
|
886
|
+
pieceActionName: option({
|
|
887
|
+
type: optional(string),
|
|
888
|
+
long: "piece-action",
|
|
889
|
+
description: "Name of an action to generate inside a piece."
|
|
890
|
+
}),
|
|
891
|
+
pieceTriggerName: option({
|
|
892
|
+
type: optional(string),
|
|
893
|
+
long: "piece-trigger",
|
|
894
|
+
description: "Name of a trigger to generate inside a piece."
|
|
895
|
+
}),
|
|
896
|
+
pieceTriggerStrategy: option({
|
|
897
|
+
type: oneOf(["polling", "webhook"]),
|
|
898
|
+
long: "piece-trigger-strategy",
|
|
899
|
+
description: "How a generated trigger fires. Default is polling.",
|
|
900
|
+
defaultValue: () => "polling",
|
|
901
|
+
defaultValueIsSerializable: true
|
|
902
|
+
}),
|
|
804
903
|
importScriptName: option({
|
|
805
904
|
type: optional(string),
|
|
806
905
|
long: "import-script",
|
|
@@ -866,6 +965,52 @@ const generateArgs = {
|
|
|
866
965
|
...debugArgs
|
|
867
966
|
};
|
|
868
967
|
//#endregion
|
|
968
|
+
//#region clis/feature-flags.ts
|
|
969
|
+
/**
|
|
970
|
+
* Feature toggles shared by the CLIs (ph-cli and ph-cmd's dispatch/help).
|
|
971
|
+
* Hand-rolled env predicates by the CLI convention — deliberately no
|
|
972
|
+
* OpenFeature dependency here; that stack belongs to the runtime apps.
|
|
973
|
+
*/
|
|
974
|
+
/**
|
|
975
|
+
* Gates the uniform-runners surface: the `ph run` command (registration,
|
|
976
|
+
* help listing, and ph-cmd forwarding), host-name sugar, and the `ph init`
|
|
977
|
+
* hosts/ scaffold. Off by default; set to `1` or `true` to enable. Rollout
|
|
978
|
+
* plan: docs/plans/2026-10-13-uniform-runners.md.
|
|
979
|
+
*/
|
|
980
|
+
const UNIFORM_RUNNERS_FLAG = "FEATURE_UNIFORM_RUNNERS_ENABLED";
|
|
981
|
+
function isUniformRunnersEnabled(env = process.env) {
|
|
982
|
+
const value = env[UNIFORM_RUNNERS_FLAG]?.trim().toLowerCase();
|
|
983
|
+
return value === "1" || value === "true";
|
|
984
|
+
}
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region clis/args/host.ts
|
|
987
|
+
const hostCheckArgs = {
|
|
988
|
+
host: positional({
|
|
989
|
+
type: string,
|
|
990
|
+
displayName: "host",
|
|
991
|
+
description: "the host to check (a directory under hosts/)"
|
|
992
|
+
}),
|
|
993
|
+
envFile: option({
|
|
994
|
+
type: optional(string),
|
|
995
|
+
long: "env",
|
|
996
|
+
description: "check against this env file alone instead of the project .env and the process env"
|
|
997
|
+
}),
|
|
998
|
+
verb: option({
|
|
999
|
+
type: optional(string),
|
|
1000
|
+
long: "verb",
|
|
1001
|
+
description: "the verb to check at (default: run)"
|
|
1002
|
+
})
|
|
1003
|
+
};
|
|
1004
|
+
positional({
|
|
1005
|
+
type: string,
|
|
1006
|
+
displayName: "host",
|
|
1007
|
+
description: "the host to export (a directory under hosts/)"
|
|
1008
|
+
}), option({
|
|
1009
|
+
type: optional(string),
|
|
1010
|
+
long: "out",
|
|
1011
|
+
description: "write the JSON to this file instead of stdout"
|
|
1012
|
+
});
|
|
1013
|
+
//#endregion
|
|
869
1014
|
//#region clis/args/inspect.ts
|
|
870
1015
|
const inspectArgs = {
|
|
871
1016
|
packageName: positional({
|
|
@@ -941,20 +1086,36 @@ const loginArgs = {
|
|
|
941
1086
|
...debugArgs
|
|
942
1087
|
};
|
|
943
1088
|
//#endregion
|
|
1089
|
+
//#region clis/args/mcp.ts
|
|
1090
|
+
const mcpArgs = {
|
|
1091
|
+
projectDir: option({
|
|
1092
|
+
type: optional(string),
|
|
1093
|
+
long: "project-dir",
|
|
1094
|
+
description: "Powerhouse project to serve. Defaults to the nearest directory above the working directory that holds powerhouse.config.json."
|
|
1095
|
+
}),
|
|
1096
|
+
startTimeout: option({
|
|
1097
|
+
type: number,
|
|
1098
|
+
long: "start-timeout",
|
|
1099
|
+
description: "Seconds to wait for Vetra to answer /ready after starting it on the first tool call",
|
|
1100
|
+
defaultValue: () => 120,
|
|
1101
|
+
defaultValueIsSerializable: true
|
|
1102
|
+
}),
|
|
1103
|
+
...debugArgs
|
|
1104
|
+
};
|
|
1105
|
+
//#endregion
|
|
944
1106
|
//#region clis/args/migrate.ts
|
|
1107
|
+
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.";
|
|
945
1108
|
const migrateArgs = {
|
|
946
1109
|
versionPositional: positional({
|
|
947
1110
|
type: optional(string),
|
|
948
1111
|
displayName: "version",
|
|
949
|
-
description:
|
|
1112
|
+
description: versionDescription
|
|
950
1113
|
}),
|
|
951
1114
|
version: option({
|
|
952
1115
|
long: "version",
|
|
953
1116
|
short: "v",
|
|
954
|
-
type: string,
|
|
955
|
-
description:
|
|
956
|
-
defaultValue: () => "latest",
|
|
957
|
-
defaultValueIsSerializable: true
|
|
1117
|
+
type: optional(string),
|
|
1118
|
+
description: versionDescription
|
|
958
1119
|
}),
|
|
959
1120
|
force: flag({
|
|
960
1121
|
type: optional(boolean),
|
|
@@ -997,6 +1158,30 @@ const registryLoginArgs = {
|
|
|
997
1158
|
...debugArgs
|
|
998
1159
|
};
|
|
999
1160
|
//#endregion
|
|
1161
|
+
//#region clis/args/run.ts
|
|
1162
|
+
const runArgs = {
|
|
1163
|
+
host: positional({
|
|
1164
|
+
type: string,
|
|
1165
|
+
displayName: "host",
|
|
1166
|
+
description: "the host to run (a directory under hosts/)"
|
|
1167
|
+
}),
|
|
1168
|
+
verb: positional({
|
|
1169
|
+
type: optional(string),
|
|
1170
|
+
displayName: "verb",
|
|
1171
|
+
description: "optional verb the runner forwards (dev, build, serve, …)"
|
|
1172
|
+
}),
|
|
1173
|
+
debug: flag({
|
|
1174
|
+
type: optional(boolean),
|
|
1175
|
+
long: "debug",
|
|
1176
|
+
description: "verbose runner diagnostics"
|
|
1177
|
+
}),
|
|
1178
|
+
explain: option({
|
|
1179
|
+
type: optional(string),
|
|
1180
|
+
long: "explain",
|
|
1181
|
+
description: "explain a resolved aspect instead of running (drives, outputs)"
|
|
1182
|
+
})
|
|
1183
|
+
};
|
|
1184
|
+
//#endregion
|
|
1000
1185
|
//#region clis/args/switchboard.ts
|
|
1001
1186
|
const switchboardArgs = {
|
|
1002
1187
|
...vetraSwitchboardArgs,
|
|
@@ -1011,7 +1196,7 @@ const switchboardArgs = {
|
|
|
1011
1196
|
basePath: option({
|
|
1012
1197
|
type: optional(string),
|
|
1013
1198
|
long: "base-path",
|
|
1014
|
-
description: "base path for the API endpoints (
|
|
1199
|
+
description: "base path for the API endpoints (overrides BASE_PATH)"
|
|
1015
1200
|
}),
|
|
1016
1201
|
keypairPath: option({
|
|
1017
1202
|
type: optional(string),
|
|
@@ -1090,6 +1275,13 @@ const uninstallArgs = {
|
|
|
1090
1275
|
//#endregion
|
|
1091
1276
|
//#region clis/project-env.ts
|
|
1092
1277
|
let loadedFor;
|
|
1278
|
+
let namesBeforeLoad;
|
|
1279
|
+
/** `PH_NO_DOTENV=1` (or `true`): no `.env` file is read, so a launcher's
|
|
1280
|
+
* explicit environment is the whole environment. */
|
|
1281
|
+
function isDotenvDisabled(env = process.env) {
|
|
1282
|
+
const value = env.PH_NO_DOTENV?.trim().toLowerCase();
|
|
1283
|
+
return value === "1" || value === "true";
|
|
1284
|
+
}
|
|
1093
1285
|
/**
|
|
1094
1286
|
* Load the project's `.env.local` and `.env` into `process.env`.
|
|
1095
1287
|
*
|
|
@@ -1103,8 +1295,10 @@ let loadedFor;
|
|
|
1103
1295
|
* call it more than once per process.
|
|
1104
1296
|
*/
|
|
1105
1297
|
function loadProjectEnv(cwd = process.cwd()) {
|
|
1298
|
+
if (isDotenvDisabled()) return;
|
|
1106
1299
|
if (loadedFor === cwd) return;
|
|
1107
1300
|
loadedFor = cwd;
|
|
1301
|
+
namesBeforeLoad ??= new Set(Object.keys(process.env));
|
|
1108
1302
|
dotenv.config({ path: join(cwd, ".env.local") });
|
|
1109
1303
|
dotenv.config({ path: join(cwd, ".env") });
|
|
1110
1304
|
}
|
|
@@ -1177,6 +1371,13 @@ const vetraArgs = {
|
|
|
1177
1371
|
defaultValue: () => false,
|
|
1178
1372
|
defaultValueIsSerializable: true
|
|
1179
1373
|
}),
|
|
1374
|
+
restart: flag({
|
|
1375
|
+
type: boolean,
|
|
1376
|
+
long: "restart",
|
|
1377
|
+
description: "Stop this project's running Vetra first (the pid in .ph/vetra-runtime.json), then start",
|
|
1378
|
+
defaultValue: () => false,
|
|
1379
|
+
defaultValueIsSerializable: true
|
|
1380
|
+
}),
|
|
1180
1381
|
disableConnect: flag({
|
|
1181
1382
|
type: boolean,
|
|
1182
1383
|
long: "disable-connect",
|
|
@@ -1209,6 +1410,8 @@ const vetraArgs = {
|
|
|
1209
1410
|
//#endregion
|
|
1210
1411
|
//#region clis/command-names.ts
|
|
1211
1412
|
const phCliCommandNames = [
|
|
1413
|
+
"run",
|
|
1414
|
+
"host",
|
|
1212
1415
|
"generate",
|
|
1213
1416
|
"vetra",
|
|
1214
1417
|
"connect",
|
|
@@ -1220,6 +1423,7 @@ const phCliCommandNames = [
|
|
|
1220
1423
|
"registry-login",
|
|
1221
1424
|
"inspect",
|
|
1222
1425
|
"is",
|
|
1426
|
+
"mcp",
|
|
1223
1427
|
"migrate",
|
|
1224
1428
|
"switchboard",
|
|
1225
1429
|
"reactor",
|
|
@@ -1243,7 +1447,19 @@ function helpCommand(config) {
|
|
|
1243
1447
|
aliases
|
|
1244
1448
|
});
|
|
1245
1449
|
}
|
|
1246
|
-
const
|
|
1450
|
+
const allPhCliHelpCommands = {
|
|
1451
|
+
run: helpCommand({
|
|
1452
|
+
name: "run",
|
|
1453
|
+
args: runArgs,
|
|
1454
|
+
description: "Run a host from hosts/ with its runner",
|
|
1455
|
+
handler: () => {}
|
|
1456
|
+
}),
|
|
1457
|
+
host: helpCommand({
|
|
1458
|
+
name: "host",
|
|
1459
|
+
args: hostCheckArgs,
|
|
1460
|
+
description: "Check or export a host from hosts/: `ph host check|export <host>`",
|
|
1461
|
+
handler: () => {}
|
|
1462
|
+
}),
|
|
1247
1463
|
generate: helpCommand({
|
|
1248
1464
|
name: "generate",
|
|
1249
1465
|
args: generateArgs,
|
|
@@ -1300,6 +1516,12 @@ const phCliHelpCommands = {
|
|
|
1300
1516
|
description: "Inspect a package",
|
|
1301
1517
|
handler: () => {}
|
|
1302
1518
|
}),
|
|
1519
|
+
mcp: helpCommand({
|
|
1520
|
+
name: "mcp",
|
|
1521
|
+
args: mcpArgs,
|
|
1522
|
+
description: "Serve the project's reactor-mcp tools over stdio, starting Vetra on the first tool call",
|
|
1523
|
+
handler: () => {}
|
|
1524
|
+
}),
|
|
1303
1525
|
migrate: helpCommand({
|
|
1304
1526
|
name: "migrate",
|
|
1305
1527
|
args: migrateArgs,
|
|
@@ -1340,6 +1562,7 @@ const phCliHelpCommands = {
|
|
|
1340
1562
|
handler: () => {}
|
|
1341
1563
|
})
|
|
1342
1564
|
};
|
|
1565
|
+
const phCliHelpCommands = isUniformRunnersEnabled() ? allPhCliHelpCommands : (({ run: _run, host: _host, ...rest }) => rest)(allPhCliHelpCommands);
|
|
1343
1566
|
//#endregion
|
|
1344
1567
|
//#region clis/args/init.ts
|
|
1345
1568
|
const initArgs = {
|
|
@@ -1395,6 +1618,11 @@ const initArgs = {
|
|
|
1395
1618
|
short: "r",
|
|
1396
1619
|
description: "Remote drive identifier."
|
|
1397
1620
|
}),
|
|
1621
|
+
uniformRunners: flag({
|
|
1622
|
+
type: optional(boolean),
|
|
1623
|
+
long: "uniform-runners",
|
|
1624
|
+
description: "Scaffold the hosts/ folder (uniform-runners architecture). Also enabled project-wide by FEATURE_UNIFORM_RUNNERS_ENABLED."
|
|
1625
|
+
}),
|
|
1398
1626
|
clone: option({
|
|
1399
1627
|
type: optional(string),
|
|
1400
1628
|
long: "clone",
|
|
@@ -1434,9 +1662,44 @@ const unpublishArgs = {
|
|
|
1434
1662
|
})
|
|
1435
1663
|
};
|
|
1436
1664
|
//#endregion
|
|
1665
|
+
//#region clis/ph-dir.ts
|
|
1666
|
+
/**
|
|
1667
|
+
* The project's `.ph` tree — stores, identity, run records, registry cache.
|
|
1668
|
+
*
|
|
1669
|
+
* Classically `<cwd>/.ph` (every classic command resolves it exactly so). A
|
|
1670
|
+
* desktop shell relocates the WHOLE tree under the user's profile by setting
|
|
1671
|
+
* `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names
|
|
1672
|
+
* under a different root, and nothing of the user's lands in the install
|
|
1673
|
+
* dir. One resolver replaces the former `.ph/...` literals; it adds no path
|
|
1674
|
+
* names and no layout of its own.
|
|
1675
|
+
*/
|
|
1676
|
+
function resolvePhDir(base = process.cwd(), env = process.env) {
|
|
1677
|
+
return path.join(env.PH_USER_DATA_DIR ?? base, ".ph");
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* The two PGlite store dirs the switchboard defaults to, for the server and
|
|
1681
|
+
* for `ph switchboard --reset` (which must touch the same paths). Without a
|
|
1682
|
+
* user-data root these are the classic literals, verbatim — byte-identical
|
|
1683
|
+
* to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they
|
|
1684
|
+
* are the same names inside `${userData}/.ph`.
|
|
1685
|
+
*/
|
|
1686
|
+
function defaultStoreDirs(env = process.env, phDir) {
|
|
1687
|
+
const root = phDir ?? (env.PH_USER_DATA_DIR ? resolvePhDir(void 0, env) : void 0);
|
|
1688
|
+
if (root === void 0) return {
|
|
1689
|
+
reactor: "./.ph/reactor-storage",
|
|
1690
|
+
readModel: ".ph/read-storage"
|
|
1691
|
+
};
|
|
1692
|
+
return {
|
|
1693
|
+
reactor: path.join(root, "reactor-storage"),
|
|
1694
|
+
readModel: path.join(root, "read-storage")
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
//#endregion
|
|
1437
1698
|
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
1438
1699
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1439
|
-
let p = process || {}
|
|
1700
|
+
let p = process || {};
|
|
1701
|
+
let argv = p.argv || [];
|
|
1702
|
+
let env = p.env || {};
|
|
1440
1703
|
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
1441
1704
|
let formatter = (open, close, replace = open) => (input) => {
|
|
1442
1705
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
@@ -1524,7 +1787,7 @@ var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1524
1787
|
};
|
|
1525
1788
|
}));
|
|
1526
1789
|
//#endregion
|
|
1527
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.
|
|
1790
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.29.7/node_modules/@babel/helper-validator-identifier/lib/identifier.js
|
|
1528
1791
|
var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1529
1792
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1530
1793
|
exports.isIdentifierChar = isIdentifierChar;
|
|
@@ -2532,7 +2795,7 @@ var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2532
2795
|
}
|
|
2533
2796
|
}));
|
|
2534
2797
|
//#endregion
|
|
2535
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.
|
|
2798
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.29.7/node_modules/@babel/helper-validator-identifier/lib/keyword.js
|
|
2536
2799
|
var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2537
2800
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2538
2801
|
exports.isKeyword = isKeyword;
|
|
@@ -2611,7 +2874,7 @@ var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2611
2874
|
}
|
|
2612
2875
|
}));
|
|
2613
2876
|
//#endregion
|
|
2614
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.
|
|
2877
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@7.29.7/node_modules/@babel/helper-validator-identifier/lib/index.js
|
|
2615
2878
|
var require_lib$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2616
2879
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2617
2880
|
Object.defineProperty(exports, "isIdentifierChar", {
|
|
@@ -2698,7 +2961,7 @@ var import_lib = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2698
2961
|
function getDefs(enabled) {
|
|
2699
2962
|
return enabled ? defsOn : defsOff;
|
|
2700
2963
|
}
|
|
2701
|
-
const sometimesKeywords = new Set([
|
|
2964
|
+
const sometimesKeywords = /* @__PURE__ */ new Set([
|
|
2702
2965
|
"as",
|
|
2703
2966
|
"async",
|
|
2704
2967
|
"from",
|
|
@@ -2765,9 +3028,10 @@ var import_lib = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2765
3028
|
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
2766
3029
|
else markerLines[lineNumber] = [0, source[lineNumber - i].length];
|
|
2767
3030
|
}
|
|
2768
|
-
else if (startColumn === endColumn)
|
|
2769
|
-
|
|
2770
|
-
|
|
3031
|
+
else if (startColumn === endColumn) {
|
|
3032
|
+
if (startColumn) markerLines[startLine] = [startColumn, 0];
|
|
3033
|
+
else markerLines[startLine] = true;
|
|
3034
|
+
} else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
2771
3035
|
return {
|
|
2772
3036
|
start,
|
|
2773
3037
|
end,
|
|
@@ -4227,49 +4491,47 @@ var require_validate_npm_package_license = /* @__PURE__ */ __commonJSMin(((expor
|
|
|
4227
4491
|
};
|
|
4228
4492
|
}));
|
|
4229
4493
|
//#endregion
|
|
4230
|
-
//#region ../../node_modules/.pnpm/lru-cache@11.
|
|
4494
|
+
//#region ../../node_modules/.pnpm/lru-cache@11.5.0/node_modules/lru-cache/dist/commonjs/node/index.min.js
|
|
4231
4495
|
var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4496
|
+
var j = (c, t) => () => (t || c((t = { exports: {} }).exports, t), t.exports);
|
|
4497
|
+
var I = j((O) => {
|
|
4498
|
+
"use strict";
|
|
4499
|
+
Object.defineProperty(O, "__esModule", { value: !0 });
|
|
4500
|
+
O.tracing = O.metrics = void 0;
|
|
4501
|
+
var U = __require("node:diagnostics_channel");
|
|
4502
|
+
O.metrics = (0, U.channel)("lru-cache:metrics");
|
|
4503
|
+
O.tracing = (0, U.tracingChannel)("lru-cache");
|
|
4504
|
+
});
|
|
4505
|
+
var P = j((D) => {
|
|
4506
|
+
"use strict";
|
|
4507
|
+
Object.defineProperty(D, "__esModule", { value: !0 });
|
|
4508
|
+
D.defaultPerf = void 0;
|
|
4509
|
+
D.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
4510
|
+
});
|
|
4232
4511
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
4233
4512
|
exports.LRUCache = void 0;
|
|
4234
|
-
var
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
}, C = class {
|
|
4247
|
-
constructor() {
|
|
4248
|
-
t();
|
|
4249
|
-
}
|
|
4250
|
-
signal = new L();
|
|
4251
|
-
abort(i) {
|
|
4252
|
-
if (!this.signal.aborted) {
|
|
4253
|
-
this.signal.reason = i, this.signal.aborted = !0;
|
|
4254
|
-
for (let s of this.signal._onabort) s(i);
|
|
4255
|
-
this.signal.onabort?.(i);
|
|
4256
|
-
}
|
|
4257
|
-
}
|
|
4258
|
-
};
|
|
4259
|
-
let c = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
4260
|
-
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));
|
|
4261
|
-
};
|
|
4262
|
-
}
|
|
4263
|
-
var x = (c) => !U.has(c), y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c), 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, z = class extends Array {
|
|
4513
|
+
var g = I();
|
|
4514
|
+
var N = P();
|
|
4515
|
+
var C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers;
|
|
4516
|
+
var k = /* @__PURE__ */ new Set();
|
|
4517
|
+
var G = typeof process == "object" && process ? process : {};
|
|
4518
|
+
var V = (c, t, e, i) => {
|
|
4519
|
+
typeof G.emitWarning == "function" ? G.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
|
|
4520
|
+
};
|
|
4521
|
+
var q = (c) => !k.has(c);
|
|
4522
|
+
var T = (c) => !!c && c === Math.floor(c) && c > 0 && isFinite(c);
|
|
4523
|
+
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;
|
|
4524
|
+
var W = class extends Array {
|
|
4264
4525
|
constructor(t) {
|
|
4265
4526
|
super(t), this.fill(0);
|
|
4266
4527
|
}
|
|
4267
|
-
}
|
|
4528
|
+
};
|
|
4529
|
+
var x = class c {
|
|
4268
4530
|
heap;
|
|
4269
4531
|
length;
|
|
4270
4532
|
static #o = !1;
|
|
4271
4533
|
static create(t) {
|
|
4272
|
-
let e =
|
|
4534
|
+
let e = H(t);
|
|
4273
4535
|
if (!e) return [];
|
|
4274
4536
|
c.#o = !0;
|
|
4275
4537
|
let i = new c(t, e);
|
|
@@ -4289,14 +4551,14 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4289
4551
|
exports.LRUCache = class c {
|
|
4290
4552
|
#o;
|
|
4291
4553
|
#c;
|
|
4292
|
-
#w;
|
|
4293
|
-
#C;
|
|
4294
|
-
#S;
|
|
4295
|
-
#L;
|
|
4296
|
-
#U;
|
|
4297
4554
|
#m;
|
|
4555
|
+
#W;
|
|
4556
|
+
#S;
|
|
4557
|
+
#M;
|
|
4558
|
+
#j;
|
|
4559
|
+
#w;
|
|
4298
4560
|
get perf() {
|
|
4299
|
-
return this.#
|
|
4561
|
+
return this.#w;
|
|
4300
4562
|
}
|
|
4301
4563
|
ttl;
|
|
4302
4564
|
ttlResolution;
|
|
@@ -4313,48 +4575,49 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4313
4575
|
allowStaleOnFetchAbort;
|
|
4314
4576
|
allowStaleOnFetchRejection;
|
|
4315
4577
|
ignoreFetchAbort;
|
|
4578
|
+
backgroundFetchSize;
|
|
4316
4579
|
#n;
|
|
4317
|
-
#
|
|
4580
|
+
#b;
|
|
4318
4581
|
#s;
|
|
4319
4582
|
#i;
|
|
4320
4583
|
#t;
|
|
4321
|
-
#a;
|
|
4322
|
-
#u;
|
|
4323
4584
|
#l;
|
|
4585
|
+
#u;
|
|
4586
|
+
#a;
|
|
4324
4587
|
#h;
|
|
4325
|
-
#
|
|
4588
|
+
#_;
|
|
4326
4589
|
#r;
|
|
4327
4590
|
#y;
|
|
4328
|
-
#
|
|
4591
|
+
#F;
|
|
4329
4592
|
#d;
|
|
4330
4593
|
#g;
|
|
4331
4594
|
#T;
|
|
4332
|
-
#
|
|
4595
|
+
#U;
|
|
4333
4596
|
#f;
|
|
4334
|
-
#
|
|
4597
|
+
#D;
|
|
4335
4598
|
static unsafeExposeInternals(t) {
|
|
4336
4599
|
return {
|
|
4337
|
-
starts: t.#
|
|
4600
|
+
starts: t.#F,
|
|
4338
4601
|
ttls: t.#d,
|
|
4339
4602
|
autopurgeTimers: t.#g,
|
|
4340
4603
|
sizes: t.#y,
|
|
4341
4604
|
keyMap: t.#s,
|
|
4342
4605
|
keyList: t.#i,
|
|
4343
4606
|
valList: t.#t,
|
|
4344
|
-
next: t.#
|
|
4607
|
+
next: t.#l,
|
|
4345
4608
|
prev: t.#u,
|
|
4346
4609
|
get head() {
|
|
4347
|
-
return t.#
|
|
4610
|
+
return t.#a;
|
|
4348
4611
|
},
|
|
4349
4612
|
get tail() {
|
|
4350
4613
|
return t.#h;
|
|
4351
4614
|
},
|
|
4352
|
-
free: t.#
|
|
4615
|
+
free: t.#_,
|
|
4353
4616
|
isBackgroundFetch: (e) => t.#e(e),
|
|
4354
|
-
backgroundFetch: (e, i, s, n) => t.#
|
|
4355
|
-
moveToTail: (e) => t.#
|
|
4356
|
-
indexes: (e) => t.#
|
|
4357
|
-
rindexes: (e) => t.#
|
|
4617
|
+
backgroundFetch: (e, i, s, n) => t.#G(e, i, s, n),
|
|
4618
|
+
moveToTail: (e) => t.#L(e),
|
|
4619
|
+
indexes: (e) => t.#A(e),
|
|
4620
|
+
rindexes: (e) => t.#z(e),
|
|
4358
4621
|
isStale: (e) => t.#p(e)
|
|
4359
4622
|
};
|
|
4360
4623
|
}
|
|
@@ -4365,188 +4628,190 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4365
4628
|
return this.#c;
|
|
4366
4629
|
}
|
|
4367
4630
|
get calculatedSize() {
|
|
4368
|
-
return this.#
|
|
4631
|
+
return this.#b;
|
|
4369
4632
|
}
|
|
4370
4633
|
get size() {
|
|
4371
4634
|
return this.#n;
|
|
4372
4635
|
}
|
|
4373
4636
|
get fetchMethod() {
|
|
4374
|
-
return this.#
|
|
4637
|
+
return this.#M;
|
|
4375
4638
|
}
|
|
4376
4639
|
get memoMethod() {
|
|
4377
|
-
return this.#
|
|
4640
|
+
return this.#j;
|
|
4378
4641
|
}
|
|
4379
4642
|
get dispose() {
|
|
4380
|
-
return this.#
|
|
4643
|
+
return this.#m;
|
|
4381
4644
|
}
|
|
4382
4645
|
get onInsert() {
|
|
4383
|
-
return this.#
|
|
4646
|
+
return this.#W;
|
|
4384
4647
|
}
|
|
4385
4648
|
get disposeAfter() {
|
|
4386
4649
|
return this.#S;
|
|
4387
4650
|
}
|
|
4388
4651
|
constructor(t) {
|
|
4389
|
-
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet:
|
|
4390
|
-
if (v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
4391
|
-
if (this.#
|
|
4392
|
-
let
|
|
4393
|
-
if (!
|
|
4394
|
-
if (this.#o = e, this.#c =
|
|
4652
|
+
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;
|
|
4653
|
+
if (this.backgroundFetchSize = M, v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
4654
|
+
if (this.#w = v ?? N.defaultPerf, e !== 0 && !T(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
4655
|
+
let E = e ? H(e) : Array;
|
|
4656
|
+
if (!E) throw new Error("invalid max value: " + e);
|
|
4657
|
+
if (this.#o = e, this.#c = p, this.maxEntrySize = f || this.#c, this.sizeCalculation = b, this.sizeCalculation) {
|
|
4395
4658
|
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
4396
4659
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
4397
4660
|
}
|
|
4398
4661
|
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
4399
|
-
if (this.#
|
|
4400
|
-
if (this.#
|
|
4401
|
-
if (this.#c !== 0 && !
|
|
4402
|
-
if (!
|
|
4403
|
-
this.#
|
|
4662
|
+
if (this.#j = S, l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
4663
|
+
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) {
|
|
4664
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
4665
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
4666
|
+
this.#X();
|
|
4404
4667
|
}
|
|
4405
|
-
if (this.allowStale = !!
|
|
4406
|
-
if (!
|
|
4407
|
-
this.#
|
|
4668
|
+
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) {
|
|
4669
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
4670
|
+
this.#k();
|
|
4408
4671
|
}
|
|
4409
4672
|
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
4410
4673
|
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
4411
|
-
let
|
|
4412
|
-
|
|
4674
|
+
let R = "LRU_CACHE_UNBOUNDED";
|
|
4675
|
+
q(R) && (k.add(R), V("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", R, c));
|
|
4413
4676
|
}
|
|
4414
4677
|
}
|
|
4415
4678
|
getRemainingTTL(t) {
|
|
4416
|
-
return this.#s.has(t) ?
|
|
4417
|
-
}
|
|
4418
|
-
#
|
|
4419
|
-
let t = new
|
|
4420
|
-
this.#d = t, this.#
|
|
4421
|
-
let i = this.ttlAutopurge ?
|
|
4422
|
-
this.#g = i, this.#
|
|
4423
|
-
e[h] =
|
|
4679
|
+
return this.#s.has(t) ? 1 / 0 : 0;
|
|
4680
|
+
}
|
|
4681
|
+
#k() {
|
|
4682
|
+
let t = new W(this.#o), e = new W(this.#o);
|
|
4683
|
+
this.#d = t, this.#F = e;
|
|
4684
|
+
let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
4685
|
+
this.#g = i, this.#H = (h, a, o = this.#w.now()) => {
|
|
4686
|
+
e[h] = a !== 0 ? o : 0, t[h] = a, s(h, a);
|
|
4424
4687
|
}, this.#R = (h) => {
|
|
4425
|
-
e[h] = t[h] !== 0 ? this.#
|
|
4688
|
+
e[h] = t[h] !== 0 ? this.#w.now() : 0, s(h, t[h]);
|
|
4426
4689
|
};
|
|
4427
|
-
let s = this.ttlAutopurge ? (h,
|
|
4428
|
-
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0),
|
|
4429
|
-
let
|
|
4430
|
-
this.#p(h) && this.#
|
|
4431
|
-
},
|
|
4432
|
-
|
|
4690
|
+
let s = this.ttlAutopurge ? (h, a) => {
|
|
4691
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), a && a !== 0 && i) {
|
|
4692
|
+
let o = setTimeout(() => {
|
|
4693
|
+
this.#p(h) && this.#v(this.#i[h], "expire");
|
|
4694
|
+
}, a + 1);
|
|
4695
|
+
o.unref && o.unref(), i[h] = o;
|
|
4433
4696
|
}
|
|
4434
4697
|
} : () => {};
|
|
4435
|
-
this.#
|
|
4436
|
-
if (t[
|
|
4437
|
-
let
|
|
4438
|
-
if (!
|
|
4439
|
-
h.ttl =
|
|
4440
|
-
h.remainingTTL =
|
|
4698
|
+
this.#E = (h, a) => {
|
|
4699
|
+
if (t[a]) {
|
|
4700
|
+
let o = t[a], d = e[a];
|
|
4701
|
+
if (!o || !d) return;
|
|
4702
|
+
h.ttl = o, h.start = d, h.now = n || r();
|
|
4703
|
+
h.remainingTTL = o - (h.now - d);
|
|
4441
4704
|
}
|
|
4442
4705
|
};
|
|
4443
|
-
let n = 0,
|
|
4444
|
-
let h = this.#
|
|
4706
|
+
let n = 0, r = () => {
|
|
4707
|
+
let h = this.#w.now();
|
|
4445
4708
|
if (this.ttlResolution > 0) {
|
|
4446
4709
|
n = h;
|
|
4447
|
-
let
|
|
4448
|
-
|
|
4710
|
+
let a = setTimeout(() => n = 0, this.ttlResolution);
|
|
4711
|
+
a.unref && a.unref();
|
|
4449
4712
|
}
|
|
4450
4713
|
return h;
|
|
4451
4714
|
};
|
|
4452
4715
|
this.getRemainingTTL = (h) => {
|
|
4453
|
-
let
|
|
4454
|
-
if (
|
|
4455
|
-
let
|
|
4456
|
-
if (!
|
|
4457
|
-
return
|
|
4716
|
+
let a = this.#s.get(h);
|
|
4717
|
+
if (a === void 0) return 0;
|
|
4718
|
+
let o = t[a], d = e[a];
|
|
4719
|
+
if (!o || !d) return 1 / 0;
|
|
4720
|
+
return o - ((n || r()) - d);
|
|
4458
4721
|
}, this.#p = (h) => {
|
|
4459
|
-
let
|
|
4460
|
-
return !!
|
|
4722
|
+
let a = e[h], o = t[h];
|
|
4723
|
+
return !!o && !!a && (n || r()) - a > o;
|
|
4461
4724
|
};
|
|
4462
4725
|
}
|
|
4463
4726
|
#R = () => {};
|
|
4464
|
-
#
|
|
4465
|
-
#
|
|
4727
|
+
#E = () => {};
|
|
4728
|
+
#H = () => {};
|
|
4466
4729
|
#p = () => !1;
|
|
4467
|
-
#
|
|
4468
|
-
let t = new
|
|
4469
|
-
this.#
|
|
4470
|
-
this.#
|
|
4471
|
-
}, this.#
|
|
4472
|
-
if (
|
|
4473
|
-
|
|
4474
|
-
if (
|
|
4475
|
-
|
|
4476
|
-
|
|
4730
|
+
#X() {
|
|
4731
|
+
let t = new W(this.#o);
|
|
4732
|
+
this.#b = 0, this.#y = t, this.#C = (e) => {
|
|
4733
|
+
this.#b -= t[e], t[e] = 0;
|
|
4734
|
+
}, this.#N = (e, i, s, n) => {
|
|
4735
|
+
if (!T(s)) {
|
|
4736
|
+
if (this.#e(i)) return this.backgroundFetchSize;
|
|
4737
|
+
if (n) {
|
|
4738
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
4739
|
+
if (s = n(i, e), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
4740
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
4741
|
+
}
|
|
4477
4742
|
return s;
|
|
4478
|
-
}, this.#
|
|
4743
|
+
}, this.#I = (e, i, s) => {
|
|
4479
4744
|
if (t[e] = i, this.#c) {
|
|
4480
4745
|
let n = this.#c - t[e];
|
|
4481
|
-
for (; this.#
|
|
4746
|
+
for (; this.#b > n;) this.#P(!0);
|
|
4482
4747
|
}
|
|
4483
|
-
this.#
|
|
4748
|
+
this.#b += t[e], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
|
|
4484
4749
|
};
|
|
4485
4750
|
}
|
|
4486
|
-
#
|
|
4487
|
-
#
|
|
4488
|
-
#
|
|
4751
|
+
#C = (t) => {};
|
|
4752
|
+
#I = (t, e, i) => {};
|
|
4753
|
+
#N = (t, e, i, s) => {
|
|
4489
4754
|
if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
4490
4755
|
return 0;
|
|
4491
4756
|
};
|
|
4492
|
-
*#
|
|
4493
|
-
if (this.#n) for (let e = this.#h;
|
|
4757
|
+
*#A({ allowStale: t = this.allowStale } = {}) {
|
|
4758
|
+
if (this.#n) for (let e = this.#h; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#a);) e = this.#u[e];
|
|
4494
4759
|
}
|
|
4495
|
-
*#
|
|
4496
|
-
if (this.#n) for (let e = this.#
|
|
4760
|
+
*#z({ allowStale: t = this.allowStale } = {}) {
|
|
4761
|
+
if (this.#n) for (let e = this.#a; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#h);) e = this.#l[e];
|
|
4497
4762
|
}
|
|
4498
|
-
#
|
|
4763
|
+
#V(t) {
|
|
4499
4764
|
return t !== void 0 && this.#s.get(this.#i[t]) === t;
|
|
4500
4765
|
}
|
|
4501
4766
|
*entries() {
|
|
4502
|
-
for (let t of this.#
|
|
4767
|
+
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]]);
|
|
4503
4768
|
}
|
|
4504
4769
|
*rentries() {
|
|
4505
|
-
for (let t of this.#
|
|
4770
|
+
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]]);
|
|
4506
4771
|
}
|
|
4507
4772
|
*keys() {
|
|
4508
|
-
for (let t of this.#
|
|
4773
|
+
for (let t of this.#A()) {
|
|
4509
4774
|
let e = this.#i[t];
|
|
4510
4775
|
e !== void 0 && !this.#e(this.#t[t]) && (yield e);
|
|
4511
4776
|
}
|
|
4512
4777
|
}
|
|
4513
4778
|
*rkeys() {
|
|
4514
|
-
for (let t of this.#
|
|
4779
|
+
for (let t of this.#z()) {
|
|
4515
4780
|
let e = this.#i[t];
|
|
4516
4781
|
e !== void 0 && !this.#e(this.#t[t]) && (yield e);
|
|
4517
4782
|
}
|
|
4518
4783
|
}
|
|
4519
4784
|
*values() {
|
|
4520
|
-
for (let t of this.#
|
|
4785
|
+
for (let t of this.#A()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
4521
4786
|
}
|
|
4522
4787
|
*rvalues() {
|
|
4523
|
-
for (let t of this.#
|
|
4788
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
4524
4789
|
}
|
|
4525
4790
|
[Symbol.iterator]() {
|
|
4526
4791
|
return this.entries();
|
|
4527
4792
|
}
|
|
4528
4793
|
[Symbol.toStringTag] = "LRUCache";
|
|
4529
4794
|
find(t, e = {}) {
|
|
4530
|
-
for (let i of this.#
|
|
4795
|
+
for (let i of this.#A()) {
|
|
4531
4796
|
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4532
|
-
if (n !== void 0 && t(n, this.#i[i], this)) return this
|
|
4797
|
+
if (n !== void 0 && t(n, this.#i[i], this)) return this.#x(this.#i[i], e);
|
|
4533
4798
|
}
|
|
4534
4799
|
}
|
|
4535
4800
|
forEach(t, e = this) {
|
|
4536
|
-
for (let i of this.#
|
|
4801
|
+
for (let i of this.#A()) {
|
|
4537
4802
|
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4538
4803
|
n !== void 0 && t.call(e, n, this.#i[i], this);
|
|
4539
4804
|
}
|
|
4540
4805
|
}
|
|
4541
4806
|
rforEach(t, e = this) {
|
|
4542
|
-
for (let i of this.#
|
|
4807
|
+
for (let i of this.#z()) {
|
|
4543
4808
|
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4544
4809
|
n !== void 0 && t.call(e, n, this.#i[i], this);
|
|
4545
4810
|
}
|
|
4546
4811
|
}
|
|
4547
4812
|
purgeStale() {
|
|
4548
4813
|
let t = !1;
|
|
4549
|
-
for (let e of this.#
|
|
4814
|
+
for (let e of this.#z({ allowStale: !0 })) this.#p(e) && (this.#v(this.#i[e], "expire"), t = !0);
|
|
4550
4815
|
return t;
|
|
4551
4816
|
}
|
|
4552
4817
|
info(t) {
|
|
@@ -4555,24 +4820,24 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4555
4820
|
let i = this.#t[e], s = this.#e(i) ? i.__staleWhileFetching : i;
|
|
4556
4821
|
if (s === void 0) return;
|
|
4557
4822
|
let n = { value: s };
|
|
4558
|
-
if (this.#d && this.#
|
|
4559
|
-
let
|
|
4560
|
-
if (
|
|
4823
|
+
if (this.#d && this.#F) {
|
|
4824
|
+
let r = this.#d[e], h = this.#F[e];
|
|
4825
|
+
if (r && h) n.ttl = r - (this.#w.now() - h), n.start = Date.now();
|
|
4561
4826
|
}
|
|
4562
4827
|
return this.#y && (n.size = this.#y[e]), n;
|
|
4563
4828
|
}
|
|
4564
4829
|
dump() {
|
|
4565
4830
|
let t = [];
|
|
4566
|
-
for (let e of this.#
|
|
4831
|
+
for (let e of this.#A({ allowStale: !0 })) {
|
|
4567
4832
|
let i = this.#i[e], s = this.#t[e], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
4568
4833
|
if (n === void 0 || i === void 0) continue;
|
|
4569
|
-
let
|
|
4570
|
-
if (this.#d && this.#
|
|
4571
|
-
|
|
4572
|
-
let h = this.#
|
|
4573
|
-
|
|
4834
|
+
let r = { value: n };
|
|
4835
|
+
if (this.#d && this.#F) {
|
|
4836
|
+
r.ttl = this.#d[e];
|
|
4837
|
+
let h = this.#w.now() - this.#F[e];
|
|
4838
|
+
r.start = Math.floor(Date.now() - h);
|
|
4574
4839
|
}
|
|
4575
|
-
this.#y && (
|
|
4840
|
+
this.#y && (r.size = this.#y[e]), t.unshift([i, r]);
|
|
4576
4841
|
}
|
|
4577
4842
|
return t;
|
|
4578
4843
|
}
|
|
@@ -4581,53 +4846,60 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4581
4846
|
for (let [e, i] of t) {
|
|
4582
4847
|
if (i.start) {
|
|
4583
4848
|
let s = Date.now() - i.start;
|
|
4584
|
-
i.start = this.#
|
|
4849
|
+
i.start = this.#w.now() - s;
|
|
4585
4850
|
}
|
|
4586
|
-
this
|
|
4851
|
+
this.#O(e, i.value, i);
|
|
4587
4852
|
}
|
|
4588
4853
|
}
|
|
4589
4854
|
set(t, e, i = {}) {
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4855
|
+
let { status: s = g.metrics.hasSubscribers ? {} : void 0 } = i;
|
|
4856
|
+
i.status = s, s && (s.op = "set", s.key = t, e !== void 0 && (s.value = e), s.cache = this);
|
|
4857
|
+
let n = this.#O(t, e, i);
|
|
4858
|
+
return s && g.metrics.hasSubscribers && g.metrics.publish(s), n;
|
|
4859
|
+
}
|
|
4860
|
+
#O(t, e, i, s) {
|
|
4861
|
+
let { ttl: n = this.ttl, start: r, noDisposeOnSet: h = this.noDisposeOnSet, sizeCalculation: a = this.sizeCalculation, status: o } = i, d = this.#e(e);
|
|
4862
|
+
if (e === void 0) return o && (o.set = "deleted"), this.delete(t), this;
|
|
4863
|
+
let { noUpdateTTL: _ = this.noUpdateTTL } = i;
|
|
4864
|
+
o && !d && (o.value = e);
|
|
4865
|
+
let y = this.#N(t, e, i.size || 0, a, o);
|
|
4866
|
+
if (this.maxEntrySize && y > this.maxEntrySize) return this.#v(t, "set"), o && (o.set = "miss", o.maxEntrySizeExceeded = !0), this;
|
|
4867
|
+
let u = this.#n === 0 ? void 0 : this.#s.get(t);
|
|
4868
|
+
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");
|
|
4595
4869
|
else {
|
|
4596
|
-
this.#
|
|
4597
|
-
let
|
|
4598
|
-
if (e !==
|
|
4599
|
-
if (
|
|
4600
|
-
|
|
4601
|
-
let { __staleWhileFetching:
|
|
4602
|
-
|
|
4603
|
-
|
|
4870
|
+
this.#L(u);
|
|
4871
|
+
let p = this.#t[u];
|
|
4872
|
+
if (e !== p) {
|
|
4873
|
+
if (!h) if (this.#e(p)) {
|
|
4874
|
+
p !== s && p.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
|
|
4875
|
+
let { __staleWhileFetching: f } = p;
|
|
4876
|
+
f !== void 0 && f !== e && (this.#T && this.#m?.(f, t, "set"), this.#f && this.#r?.push([
|
|
4877
|
+
f,
|
|
4604
4878
|
t,
|
|
4605
4879
|
"set"
|
|
4606
4880
|
]));
|
|
4607
|
-
} else
|
|
4608
|
-
|
|
4881
|
+
} else this.#T && this.#m?.(p, t, "set"), this.#f && this.#r?.push([
|
|
4882
|
+
p,
|
|
4609
4883
|
t,
|
|
4610
4884
|
"set"
|
|
4611
|
-
])
|
|
4612
|
-
if (this.#
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
g !== void 0 && (r.oldValue = g);
|
|
4885
|
+
]);
|
|
4886
|
+
if (this.#C(u), this.#I(u, y, o), this.#t[u] = e, !d) {
|
|
4887
|
+
let f = p && this.#e(p) ? p.__staleWhileFetching : p, b = f === void 0 ? "add" : e !== f ? "replace" : "update";
|
|
4888
|
+
o && (o.set = b, f !== void 0 && (o.oldValue = f)), this.#D && this.onInsert?.(e, t, b);
|
|
4616
4889
|
}
|
|
4617
|
-
} else
|
|
4618
|
-
this.#I && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
4890
|
+
} else d || (o && (o.set = "update"), this.#D && this.onInsert?.(e, t, "update"));
|
|
4619
4891
|
}
|
|
4620
|
-
if (
|
|
4621
|
-
let
|
|
4622
|
-
for (;
|
|
4892
|
+
if (n !== 0 && !this.#d && this.#k(), this.#d && (_ || this.#H(u, n, r), o && this.#E(o, u)), !h && this.#f && this.#r) {
|
|
4893
|
+
let p = this.#r, f;
|
|
4894
|
+
for (; f = p?.shift();) this.#S?.(...f);
|
|
4623
4895
|
}
|
|
4624
4896
|
return this;
|
|
4625
4897
|
}
|
|
4626
4898
|
pop() {
|
|
4627
4899
|
try {
|
|
4628
4900
|
for (; this.#n;) {
|
|
4629
|
-
let t = this.#t[this.#
|
|
4630
|
-
if (this.#
|
|
4901
|
+
let t = this.#t[this.#a];
|
|
4902
|
+
if (this.#P(!0), this.#e(t)) {
|
|
4631
4903
|
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
4632
4904
|
} else if (t !== void 0) return t;
|
|
4633
4905
|
}
|
|
@@ -4638,163 +4910,214 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4638
4910
|
}
|
|
4639
4911
|
}
|
|
4640
4912
|
}
|
|
4641
|
-
#
|
|
4642
|
-
let e = this.#
|
|
4643
|
-
|
|
4644
|
-
|
|
4913
|
+
#P(t) {
|
|
4914
|
+
let e = this.#a, i = this.#i[e], s = this.#t[e], n = this.#e(s);
|
|
4915
|
+
n && s.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
|
|
4916
|
+
let r = n ? s.__staleWhileFetching : s;
|
|
4917
|
+
return (this.#T || this.#f) && r !== void 0 && (this.#T && this.#m?.(r, i, "evict"), this.#f && this.#r?.push([
|
|
4918
|
+
r,
|
|
4645
4919
|
i,
|
|
4646
4920
|
"evict"
|
|
4647
|
-
])), this.#
|
|
4921
|
+
])), 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;
|
|
4648
4922
|
}
|
|
4649
4923
|
has(t, e = {}) {
|
|
4924
|
+
let { status: i = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
4925
|
+
e.status = i, i && (i.op = "has", i.key = t, i.cache = this);
|
|
4926
|
+
let s = this.#Y(t, e);
|
|
4927
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i), s;
|
|
4928
|
+
}
|
|
4929
|
+
#Y(t, e = {}) {
|
|
4650
4930
|
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, n = this.#s.get(t);
|
|
4651
4931
|
if (n !== void 0) {
|
|
4652
|
-
let
|
|
4653
|
-
if (this.#e(
|
|
4654
|
-
if (this.#p(n)) s && (s.has = "stale", this.#
|
|
4655
|
-
else return i && this.#R(n), s && (s.has = "hit", this.#
|
|
4932
|
+
let r = this.#t[n];
|
|
4933
|
+
if (this.#e(r) && r.__staleWhileFetching === void 0) return !1;
|
|
4934
|
+
if (this.#p(n)) s && (s.has = "stale", this.#E(s, n));
|
|
4935
|
+
else return i && this.#R(n), s && (s.has = "hit", this.#E(s, n)), !0;
|
|
4656
4936
|
} else s && (s.has = "miss");
|
|
4657
4937
|
return !1;
|
|
4658
4938
|
}
|
|
4659
4939
|
peek(t, e = {}) {
|
|
4660
|
-
let {
|
|
4661
|
-
|
|
4662
|
-
let
|
|
4663
|
-
return
|
|
4940
|
+
let { status: i = C() ? {} : void 0 } = e;
|
|
4941
|
+
i && (i.op = "peek", i.key = t, i.cache = this), e.status = i;
|
|
4942
|
+
let s = this.#J(t, e);
|
|
4943
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i), s;
|
|
4944
|
+
}
|
|
4945
|
+
#J(t, e) {
|
|
4946
|
+
let { status: i, allowStale: s = this.allowStale } = e, n = this.#s.get(t);
|
|
4947
|
+
if (n === void 0 || !s && this.#p(n)) {
|
|
4948
|
+
i && (i.peek = n === void 0 ? "miss" : "stale");
|
|
4949
|
+
return;
|
|
4950
|
+
}
|
|
4951
|
+
let r = this.#t[n], h = this.#e(r) ? r.__staleWhileFetching : r;
|
|
4952
|
+
return i && (h !== void 0 ? (i.peek = "hit", i.value = h) : i.peek = "miss"), h;
|
|
4664
4953
|
}
|
|
4665
|
-
#
|
|
4954
|
+
#G(t, e, i, s) {
|
|
4666
4955
|
let n = e === void 0 ? void 0 : this.#t[e];
|
|
4667
4956
|
if (this.#e(n)) return n;
|
|
4668
|
-
let
|
|
4669
|
-
h?.addEventListener("abort", () =>
|
|
4670
|
-
let
|
|
4671
|
-
signal:
|
|
4957
|
+
let r = new AbortController(), { signal: h } = i;
|
|
4958
|
+
h?.addEventListener("abort", () => r.abort(h.reason), { signal: r.signal });
|
|
4959
|
+
let a = {
|
|
4960
|
+
signal: r.signal,
|
|
4672
4961
|
options: i,
|
|
4673
4962
|
context: s
|
|
4674
|
-
},
|
|
4675
|
-
let { aborted: l } =
|
|
4676
|
-
if (i.status && (l && !
|
|
4677
|
-
let
|
|
4678
|
-
return (
|
|
4679
|
-
},
|
|
4680
|
-
let { aborted: l } =
|
|
4681
|
-
if (this.#t[e] ===
|
|
4682
|
-
if (
|
|
4683
|
-
},
|
|
4684
|
-
let l = this.#
|
|
4685
|
-
|
|
4686
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (
|
|
4687
|
-
});
|
|
4963
|
+
}, o = (f, b = !1) => {
|
|
4964
|
+
let { aborted: l } = r.signal, S = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
|
|
4965
|
+
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);
|
|
4966
|
+
let w = u, m = this.#t[e];
|
|
4967
|
+
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;
|
|
4968
|
+
}, d = (f) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = f), _(f, !1)), _ = (f, b) => {
|
|
4969
|
+
let { aborted: l } = r.signal, S = l && i.allowStaleOnFetchAbort, F = S || i.allowStaleOnFetchRejection, w = F || i.noDeleteOnFetchRejection, m = u;
|
|
4970
|
+
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;
|
|
4971
|
+
if (m.__returned === m) throw f;
|
|
4972
|
+
}, y = (f, b) => {
|
|
4973
|
+
let l = this.#M?.(t, n, a);
|
|
4974
|
+
r.signal.addEventListener("abort", () => {
|
|
4975
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (S) => o(S, !0)));
|
|
4976
|
+
}), l && l instanceof Promise ? l.then((S) => f(S === void 0 ? void 0 : S), b) : l !== void 0 && f(l);
|
|
4688
4977
|
};
|
|
4689
4978
|
i.status && (i.status.fetchDispatched = !0);
|
|
4690
|
-
let
|
|
4691
|
-
__abortController:
|
|
4979
|
+
let u = new Promise(y).then(o, d), p = Object.assign(u, {
|
|
4980
|
+
__abortController: r,
|
|
4692
4981
|
__staleWhileFetching: n,
|
|
4693
4982
|
__returned: void 0
|
|
4694
4983
|
});
|
|
4695
|
-
return e === void 0 ? (this
|
|
4696
|
-
...
|
|
4984
|
+
return e === void 0 ? (this.#O(t, p, {
|
|
4985
|
+
...a.options,
|
|
4697
4986
|
status: void 0
|
|
4698
|
-
}), e = this.#s.get(t)) : this.#t[e] =
|
|
4987
|
+
}), e = this.#s.get(t)) : this.#t[e] = p, p;
|
|
4699
4988
|
}
|
|
4700
4989
|
#e(t) {
|
|
4701
|
-
if (!this.#
|
|
4990
|
+
if (!this.#U) return !1;
|
|
4702
4991
|
let e = t;
|
|
4703
|
-
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof
|
|
4992
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
|
|
4993
|
+
}
|
|
4994
|
+
fetch(t, e = {}) {
|
|
4995
|
+
let i = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
4996
|
+
e.status = s, s && e.context && (s.context = e.context);
|
|
4997
|
+
let n = this.#q(t, e);
|
|
4998
|
+
return s && i && (s.trace = !0, g.tracing.tracePromise(() => n, s).catch(() => {})), n;
|
|
4704
4999
|
}
|
|
4705
|
-
async
|
|
4706
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl:
|
|
4707
|
-
if (!this.#
|
|
5000
|
+
async #q(t, e = {}) {
|
|
5001
|
+
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;
|
|
5002
|
+
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, {
|
|
4708
5003
|
allowStale: i,
|
|
4709
5004
|
updateAgeOnGet: s,
|
|
4710
5005
|
noDeleteOnStaleGet: n,
|
|
4711
5006
|
status: l
|
|
4712
5007
|
});
|
|
4713
|
-
let
|
|
5008
|
+
let F = {
|
|
4714
5009
|
allowStale: i,
|
|
4715
5010
|
updateAgeOnGet: s,
|
|
4716
5011
|
noDeleteOnStaleGet: n,
|
|
4717
|
-
ttl:
|
|
5012
|
+
ttl: r,
|
|
4718
5013
|
noDisposeOnSet: h,
|
|
4719
|
-
size:
|
|
4720
|
-
sizeCalculation:
|
|
4721
|
-
noUpdateTTL:
|
|
4722
|
-
noDeleteOnFetchRejection:
|
|
4723
|
-
allowStaleOnFetchRejection:
|
|
4724
|
-
allowStaleOnFetchAbort:
|
|
4725
|
-
ignoreFetchAbort:
|
|
5014
|
+
size: a,
|
|
5015
|
+
sizeCalculation: o,
|
|
5016
|
+
noUpdateTTL: d,
|
|
5017
|
+
noDeleteOnFetchRejection: _,
|
|
5018
|
+
allowStaleOnFetchRejection: y,
|
|
5019
|
+
allowStaleOnFetchAbort: p,
|
|
5020
|
+
ignoreFetchAbort: u,
|
|
4726
5021
|
status: l,
|
|
4727
5022
|
signal: S
|
|
4728
|
-
},
|
|
4729
|
-
if (
|
|
5023
|
+
}, w = this.#s.get(t);
|
|
5024
|
+
if (w === void 0) {
|
|
4730
5025
|
l && (l.fetch = "miss");
|
|
4731
|
-
let
|
|
4732
|
-
return
|
|
5026
|
+
let m = this.#G(t, w, F, f);
|
|
5027
|
+
return m.__returned = m;
|
|
4733
5028
|
} else {
|
|
4734
|
-
let
|
|
4735
|
-
if (this.#e(
|
|
4736
|
-
let E = i &&
|
|
4737
|
-
return l && (l.fetch = "inflight", E && (l.returnedStale = !0)), E ?
|
|
5029
|
+
let m = this.#t[w];
|
|
5030
|
+
if (this.#e(m)) {
|
|
5031
|
+
let E = i && m.__staleWhileFetching !== void 0;
|
|
5032
|
+
return l && (l.fetch = "inflight", E && (l.returnedStale = !0)), E ? m.__staleWhileFetching : m.__returned = m;
|
|
4738
5033
|
}
|
|
4739
|
-
let
|
|
4740
|
-
if (!
|
|
4741
|
-
let
|
|
4742
|
-
return l && (l.fetch =
|
|
5034
|
+
let A = this.#p(w);
|
|
5035
|
+
if (!b && !A) return l && (l.fetch = "hit"), this.#L(w), s && this.#R(w), l && this.#E(l, w), m;
|
|
5036
|
+
let z = this.#G(t, w, F, f), v = z.__staleWhileFetching !== void 0 && i;
|
|
5037
|
+
return l && (l.fetch = A ? "stale" : "refresh", v && A && (l.returnedStale = !0)), v ? z.__staleWhileFetching : z.__returned = z;
|
|
4743
5038
|
}
|
|
4744
5039
|
}
|
|
4745
|
-
|
|
4746
|
-
let i =
|
|
5040
|
+
forceFetch(t, e = {}) {
|
|
5041
|
+
let i = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
5042
|
+
e.status = s, s && e.context && (s.context = e.context);
|
|
5043
|
+
let n = this.#K(t, e);
|
|
5044
|
+
return s && i && (s.trace = !0, g.tracing.tracePromise(() => n, s).catch(() => {})), n;
|
|
5045
|
+
}
|
|
5046
|
+
async #K(t, e = {}) {
|
|
5047
|
+
let i = await this.#q(t, e);
|
|
4747
5048
|
if (i === void 0) throw new Error("fetch() returned undefined");
|
|
4748
5049
|
return i;
|
|
4749
5050
|
}
|
|
4750
5051
|
memo(t, e = {}) {
|
|
4751
|
-
let i =
|
|
5052
|
+
let { status: i = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
5053
|
+
e.status = i, i && (i.op = "memo", i.key = t, e.context && (i.context = e.context), i.cache = this);
|
|
5054
|
+
let s = this.#Q(t, e);
|
|
5055
|
+
return i && (i.value = s), g.metrics.hasSubscribers && g.metrics.publish(i), s;
|
|
5056
|
+
}
|
|
5057
|
+
#Q(t, e = {}) {
|
|
5058
|
+
let i = this.#j;
|
|
4752
5059
|
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
4753
|
-
let { context: s,
|
|
4754
|
-
|
|
4755
|
-
let
|
|
4756
|
-
|
|
5060
|
+
let { context: s, status: n, forceRefresh: r, ...h } = e;
|
|
5061
|
+
n && r && (n.forceRefresh = !0);
|
|
5062
|
+
let a = this.#x(t, h), o = r || a === void 0;
|
|
5063
|
+
if (n && (n.memo = o ? "miss" : "hit", o || (n.value = a)), !o) return a;
|
|
5064
|
+
let d = i(t, a, {
|
|
5065
|
+
options: h,
|
|
4757
5066
|
context: s
|
|
4758
5067
|
});
|
|
4759
|
-
return this
|
|
5068
|
+
return n && (n.value = d), this.#O(t, d, h), d;
|
|
4760
5069
|
}
|
|
4761
5070
|
get(t, e = {}) {
|
|
4762
|
-
let {
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
5071
|
+
let { status: i = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
5072
|
+
e.status = i, i && (i.op = "get", i.key = t, i.cache = this);
|
|
5073
|
+
let s = this.#x(t, e);
|
|
5074
|
+
return i && (s !== void 0 && (i.value = s), g.metrics.hasSubscribers && g.metrics.publish(i)), s;
|
|
5075
|
+
}
|
|
5076
|
+
#x(t, e = {}) {
|
|
5077
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: r } = e, h = this.#s.get(t);
|
|
5078
|
+
if (h === void 0) {
|
|
5079
|
+
r && (r.get = "miss");
|
|
5080
|
+
return;
|
|
5081
|
+
}
|
|
5082
|
+
let a = this.#t[h], o = this.#e(a);
|
|
5083
|
+
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);
|
|
4767
5084
|
}
|
|
4768
|
-
#
|
|
4769
|
-
this.#u[e] = t, this.#
|
|
5085
|
+
#B(t, e) {
|
|
5086
|
+
this.#u[e] = t, this.#l[t] = e;
|
|
4770
5087
|
}
|
|
4771
|
-
#
|
|
4772
|
-
t !== this.#h && (t === this.#
|
|
5088
|
+
#L(t) {
|
|
5089
|
+
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);
|
|
4773
5090
|
}
|
|
4774
5091
|
delete(t) {
|
|
4775
|
-
return this.#
|
|
4776
|
-
}
|
|
4777
|
-
#
|
|
5092
|
+
return this.#v(t, "delete");
|
|
5093
|
+
}
|
|
5094
|
+
#v(t, e) {
|
|
5095
|
+
g.metrics.hasSubscribers && g.metrics.publish({
|
|
5096
|
+
op: "delete",
|
|
5097
|
+
delete: e,
|
|
5098
|
+
key: t,
|
|
5099
|
+
cache: this
|
|
5100
|
+
});
|
|
4778
5101
|
let i = !1;
|
|
4779
5102
|
if (this.#n !== 0) {
|
|
4780
5103
|
let s = this.#s.get(t);
|
|
4781
|
-
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = !0, this.#n === 1) this
|
|
5104
|
+
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = !0, this.#n === 1) this.#$(e);
|
|
4782
5105
|
else {
|
|
4783
|
-
this.#
|
|
5106
|
+
this.#C(s);
|
|
4784
5107
|
let n = this.#t[s];
|
|
4785
|
-
if (this.#e(n) ? n.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#
|
|
5108
|
+
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([
|
|
4786
5109
|
n,
|
|
4787
5110
|
t,
|
|
4788
5111
|
e
|
|
4789
5112
|
])), this.#s.delete(t), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
4790
|
-
else if (s === this.#
|
|
5113
|
+
else if (s === this.#a) this.#a = this.#l[s];
|
|
4791
5114
|
else {
|
|
4792
|
-
let
|
|
4793
|
-
this.#
|
|
4794
|
-
let h = this.#
|
|
5115
|
+
let r = this.#u[s];
|
|
5116
|
+
this.#l[r] = this.#l[s];
|
|
5117
|
+
let h = this.#l[s];
|
|
4795
5118
|
this.#u[h] = this.#u[s];
|
|
4796
5119
|
}
|
|
4797
|
-
this.#n--, this.#
|
|
5120
|
+
this.#n--, this.#_.push(s);
|
|
4798
5121
|
}
|
|
4799
5122
|
}
|
|
4800
5123
|
if (this.#f && this.#r?.length) {
|
|
@@ -4804,27 +5127,27 @@ var require_index_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4804
5127
|
return i;
|
|
4805
5128
|
}
|
|
4806
5129
|
clear() {
|
|
4807
|
-
return this
|
|
5130
|
+
return this.#$("delete");
|
|
4808
5131
|
}
|
|
4809
|
-
|
|
4810
|
-
for (let e of this.#
|
|
5132
|
+
#$(t) {
|
|
5133
|
+
for (let e of this.#z({ allowStale: !0 })) {
|
|
4811
5134
|
let i = this.#t[e];
|
|
4812
5135
|
if (this.#e(i)) i.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
|
|
4813
5136
|
else {
|
|
4814
5137
|
let s = this.#i[e];
|
|
4815
|
-
this.#T && this.#
|
|
5138
|
+
this.#T && this.#m?.(i, s, t), this.#f && this.#r?.push([
|
|
4816
5139
|
i,
|
|
4817
5140
|
s,
|
|
4818
5141
|
t
|
|
4819
5142
|
]);
|
|
4820
5143
|
}
|
|
4821
5144
|
}
|
|
4822
|
-
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#
|
|
4823
|
-
this.#d.fill(0), this.#
|
|
5145
|
+
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
5146
|
+
this.#d.fill(0), this.#F.fill(0);
|
|
4824
5147
|
for (let e of this.#g ?? []) e !== void 0 && clearTimeout(e);
|
|
4825
5148
|
this.#g?.fill(void 0);
|
|
4826
5149
|
}
|
|
4827
|
-
if (this.#y && this.#y.fill(0), this.#
|
|
5150
|
+
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) {
|
|
4828
5151
|
let e = this.#r, i;
|
|
4829
5152
|
for (; i = e?.shift();) this.#S?.(...i);
|
|
4830
5153
|
}
|
|
@@ -5020,8 +5343,10 @@ var require_parse_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5020
5343
|
if (Object.prototype.hasOwnProperty.call(protocols, proto)) return arg;
|
|
5021
5344
|
if (arg.substr(firstColon, 3) === "://") return arg;
|
|
5022
5345
|
const firstAt = arg.indexOf("@");
|
|
5023
|
-
if (firstAt > -1)
|
|
5024
|
-
|
|
5346
|
+
if (firstAt > -1) {
|
|
5347
|
+
if (firstAt > firstColon) return `git+ssh://${arg}`;
|
|
5348
|
+
else return arg;
|
|
5349
|
+
}
|
|
5025
5350
|
return `${arg.slice(0, firstColon + 1)}//${arg.slice(firstColon + 1)}`;
|
|
5026
5351
|
};
|
|
5027
5352
|
const correctUrl = (giturl) => {
|
|
@@ -5058,7 +5383,8 @@ var require_from_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5058
5383
|
};
|
|
5059
5384
|
module.exports = (giturl, opts, { gitHosts, protocols }) => {
|
|
5060
5385
|
if (!giturl) return;
|
|
5061
|
-
const
|
|
5386
|
+
const correctedUrl = isGitHubShorthand(giturl) ? `github:${giturl}` : giturl;
|
|
5387
|
+
const parsed = parseUrl(correctedUrl, protocols);
|
|
5062
5388
|
if (!parsed) return;
|
|
5063
5389
|
const gitHostShortcut = gitHosts.byShortcut[parsed.protocol];
|
|
5064
5390
|
const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith("www.") ? parsed.hostname.slice(4) : parsed.hostname];
|
|
@@ -5521,17 +5847,22 @@ var require_fixer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5521
5847
|
var hosted = hostedGitInfo.fromUrl(data.repository.url);
|
|
5522
5848
|
if (hosted && hosted.bugs()) data.bugs = { url: hosted.bugs() };
|
|
5523
5849
|
} else if (data.bugs) {
|
|
5524
|
-
if (typeof data.bugs === "string")
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5850
|
+
if (typeof data.bugs === "string") {
|
|
5851
|
+
if (isEmail(data.bugs)) data.bugs = { email: data.bugs };
|
|
5852
|
+
else if (URL$1.canParse(data.bugs)) data.bugs = { url: data.bugs };
|
|
5853
|
+
else this.warn("nonEmailUrlBugsString");
|
|
5854
|
+
} else {
|
|
5528
5855
|
bugsTypos(data.bugs, this.warn);
|
|
5529
5856
|
var oldBugs = data.bugs;
|
|
5530
5857
|
data.bugs = {};
|
|
5531
|
-
if (oldBugs.url)
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5858
|
+
if (oldBugs.url) {
|
|
5859
|
+
if (URL$1.canParse(oldBugs.url)) data.bugs.url = oldBugs.url;
|
|
5860
|
+
else this.warn("nonUrlBugsUrlField");
|
|
5861
|
+
}
|
|
5862
|
+
if (oldBugs.email) {
|
|
5863
|
+
if (typeof oldBugs.email === "string" && isEmail(oldBugs.email)) data.bugs.email = oldBugs.email;
|
|
5864
|
+
else this.warn("nonEmailBugsEmailField");
|
|
5865
|
+
}
|
|
5535
5866
|
}
|
|
5536
5867
|
if (!data.bugs.email && !data.bugs.url) {
|
|
5537
5868
|
delete data.bugs;
|
|
@@ -5763,10 +6094,19 @@ const _readPackage = (file, normalize) => {
|
|
|
5763
6094
|
return json;
|
|
5764
6095
|
};
|
|
5765
6096
|
async function readPackage({ cwd, normalize = true } = {}) {
|
|
5766
|
-
|
|
6097
|
+
const packageFile = await fsPromises.readFile(getPackagePath(cwd), "utf8");
|
|
6098
|
+
return _readPackage(packageFile, normalize);
|
|
5767
6099
|
}
|
|
5768
6100
|
//#endregion
|
|
5769
6101
|
//#region clis/file-system/spawn-async.ts
|
|
6102
|
+
var SpawnError = class extends Error {
|
|
6103
|
+
stdout;
|
|
6104
|
+
constructor(message, stdout) {
|
|
6105
|
+
super(message);
|
|
6106
|
+
this.stdout = stdout;
|
|
6107
|
+
this.name = "SpawnError";
|
|
6108
|
+
}
|
|
6109
|
+
};
|
|
5770
6110
|
function spawnAsync(command, args, options = {}) {
|
|
5771
6111
|
return new Promise((resolve, reject) => {
|
|
5772
6112
|
const child = spawn(command, args, {
|
|
@@ -5780,26 +6120,36 @@ function spawnAsync(command, args, options = {}) {
|
|
|
5780
6120
|
});
|
|
5781
6121
|
let stdout = "";
|
|
5782
6122
|
let stderr = "";
|
|
6123
|
+
child.stdout?.setEncoding("utf8");
|
|
6124
|
+
child.stderr?.setEncoding("utf8");
|
|
5783
6125
|
child.stdout?.on("data", (d) => {
|
|
5784
|
-
stdout += d
|
|
6126
|
+
stdout += d;
|
|
5785
6127
|
});
|
|
5786
6128
|
child.stderr?.on("data", (d) => {
|
|
5787
|
-
stderr += d
|
|
6129
|
+
stderr += d;
|
|
5788
6130
|
});
|
|
5789
6131
|
child.on("error", reject);
|
|
5790
6132
|
child.on("close", (code) => {
|
|
5791
6133
|
if (code === 0) resolve(stdout.trim());
|
|
5792
|
-
else reject(new
|
|
6134
|
+
else reject(new SpawnError(stderr.trim() || stdout.trim() || `${command} exited with code ${code}`, stdout.trim()));
|
|
5793
6135
|
});
|
|
5794
6136
|
});
|
|
5795
6137
|
}
|
|
5796
6138
|
//#endregion
|
|
5797
6139
|
//#region clis/file-system/dependencies.ts
|
|
5798
6140
|
async function fetchNpmVersionFromRegistryForTag(packageName, tag) {
|
|
5799
|
-
const
|
|
6141
|
+
const version = await fetchPackageVersionFromNpmRegistry(`${packageName}@${tag}`);
|
|
6142
|
+
const cleanedVersion = clean(version);
|
|
5800
6143
|
if (!cleanedVersion) throw new Error(`Failed to fetch version for package "${packageName}" at tag "${tag}".`);
|
|
5801
6144
|
return cleanedVersion;
|
|
5802
6145
|
}
|
|
6146
|
+
/** Whether `version` is in the semver `range`; false when it is not a range. */
|
|
6147
|
+
function versionSatisfies(version, range) {
|
|
6148
|
+
return satisfies(version, range);
|
|
6149
|
+
}
|
|
6150
|
+
function lowestVersion(versions) {
|
|
6151
|
+
return [...versions].sort(compare)[0];
|
|
6152
|
+
}
|
|
5803
6153
|
async function fetchPackageVersionFromNpmRegistry(packageSpecifier, registryUrl) {
|
|
5804
6154
|
const failedFetchErrorMessage = `Failed to fetch version from npm registry for ${packageSpecifier}.`;
|
|
5805
6155
|
try {
|
|
@@ -6046,7 +6396,7 @@ PH CLI package manager: ${packageManager}
|
|
|
6046
6396
|
//#endregion
|
|
6047
6397
|
//#region clis/file-system/write-file-ensuring-dir.ts
|
|
6048
6398
|
async function writeFileEnsuringDir(filePath, contents) {
|
|
6049
|
-
await mkdir(dirname(filePath), { recursive: true });
|
|
6399
|
+
await mkdir(dirname(resolve(filePath)), { recursive: true });
|
|
6050
6400
|
await writeFile(filePath, contents, { encoding: "utf-8" });
|
|
6051
6401
|
}
|
|
6052
6402
|
//#endregion
|
|
@@ -6268,18 +6618,35 @@ function getTelemetryStatus() {
|
|
|
6268
6618
|
//#region constants.ts
|
|
6269
6619
|
const PACKAGES_DEPENDENCIES = [
|
|
6270
6620
|
"@powerhousedao/builder-tools",
|
|
6621
|
+
"@powerhousedao/clint",
|
|
6271
6622
|
"@powerhousedao/codegen",
|
|
6272
6623
|
"@powerhousedao/common",
|
|
6273
6624
|
"@powerhousedao/config",
|
|
6625
|
+
"@powerhousedao/connect-core",
|
|
6274
6626
|
"@powerhousedao/design-system",
|
|
6627
|
+
"@powerhousedao/desktop",
|
|
6628
|
+
"@powerhousedao/host-core",
|
|
6275
6629
|
"document-drive",
|
|
6276
6630
|
"document-model",
|
|
6631
|
+
"@powerhousedao/opentelemetry-instrumentation-reactor",
|
|
6632
|
+
"@powerhousedao/pieces-framework",
|
|
6633
|
+
"@powerhousedao/portle",
|
|
6277
6634
|
"@powerhousedao/reactor",
|
|
6278
6635
|
"@powerhousedao/reactor-api",
|
|
6636
|
+
"@powerhousedao/reactor-attachments",
|
|
6279
6637
|
"@powerhousedao/reactor-browser",
|
|
6638
|
+
"@powerhousedao/reactor-drive",
|
|
6639
|
+
"@powerhousedao/reactor-group",
|
|
6640
|
+
"@powerhousedao/reactor-hypercore",
|
|
6280
6641
|
"@powerhousedao/reactor-mcp",
|
|
6642
|
+
"@powerhousedao/reactor-privacy",
|
|
6643
|
+
"@powerhousedao/reactor-router",
|
|
6644
|
+
"@powerhousedao/reactor-workflow",
|
|
6645
|
+
"@powerhousedao/registry",
|
|
6281
6646
|
"@powerhousedao/switchboard-gui",
|
|
6282
6647
|
"@powerhousedao/vetra",
|
|
6648
|
+
"@powerhousedao/vetra-studio",
|
|
6649
|
+
"@powerhousedao/workflow",
|
|
6283
6650
|
"@powerhousedao/analytics-engine-core",
|
|
6284
6651
|
"@powerhousedao/analytics-engine-knex",
|
|
6285
6652
|
"@powerhousedao/analytics-engine-pg",
|
|
@@ -6287,11 +6654,6 @@ const PACKAGES_DEPENDENCIES = [
|
|
|
6287
6654
|
"@powerhousedao/analytics-engine-graphql",
|
|
6288
6655
|
"@powerhousedao/shared",
|
|
6289
6656
|
"@powerhousedao/powerhouse-vetra-packages",
|
|
6290
|
-
"@powerhousedao/analytics-engine-core",
|
|
6291
|
-
"@powerhousedao/analytics-engine-graphql",
|
|
6292
|
-
"@powerhousedao/analytics-engine-knex",
|
|
6293
|
-
"@powerhousedao/analytics-engine-pg",
|
|
6294
|
-
"@powerhousedao/analytics-engine-browser",
|
|
6295
6657
|
"@renown/sdk"
|
|
6296
6658
|
];
|
|
6297
6659
|
const CLIS_DEPENDENCIES = ["ph-cmd", "@powerhousedao/ph-cli"];
|
|
@@ -6357,7 +6719,35 @@ async function runUseLocal(monorepoPath, skipInstall) {
|
|
|
6357
6719
|
runCmd(`pnpm install`);
|
|
6358
6720
|
}
|
|
6359
6721
|
}
|
|
6722
|
+
const WORKSPACE_DIRS = [
|
|
6723
|
+
"packages",
|
|
6724
|
+
"packages/analytics-engine",
|
|
6725
|
+
"clis",
|
|
6726
|
+
"apps"
|
|
6727
|
+
];
|
|
6728
|
+
const workspaces = /* @__PURE__ */ new Map();
|
|
6729
|
+
function workspacePackages(monorepoPath) {
|
|
6730
|
+
let dirs = workspaces.get(monorepoPath);
|
|
6731
|
+
if (dirs) return dirs;
|
|
6732
|
+
dirs = /* @__PURE__ */ new Map();
|
|
6733
|
+
for (const parent of WORKSPACE_DIRS) {
|
|
6734
|
+
const root = path.join(monorepoPath, parent);
|
|
6735
|
+
if (!existsSync(root)) continue;
|
|
6736
|
+
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
6737
|
+
const manifest = path.join(root, entry.name, "package.json");
|
|
6738
|
+
if (!entry.isDirectory() || !existsSync(manifest)) continue;
|
|
6739
|
+
try {
|
|
6740
|
+
const { name } = JSON.parse(readFileSync(manifest, "utf8"));
|
|
6741
|
+
if (name) dirs.set(name, path.join(root, entry.name));
|
|
6742
|
+
} catch {}
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
workspaces.set(monorepoPath, dirs);
|
|
6746
|
+
return dirs;
|
|
6747
|
+
}
|
|
6360
6748
|
function buildPnpmLink(packageName, monorepoPath) {
|
|
6749
|
+
const dir = workspacePackages(monorepoPath).get(packageName);
|
|
6750
|
+
if (dir) return `link:${dir}`;
|
|
6361
6751
|
const isCli = CLIS_DEPENDENCIES.includes(packageName);
|
|
6362
6752
|
const isApp = APPS_DEPENDENCIES.includes(packageName);
|
|
6363
6753
|
const packageDir = isCli ? "clis" : isApp ? "apps" : "packages";
|
|
@@ -6365,6 +6755,415 @@ function buildPnpmLink(packageName, monorepoPath) {
|
|
|
6365
6755
|
return `link:${path.join(monorepoPath, packageDir, packageNameWithoutNamespace).replace("analytics-engine-", "analytics-engine/")}`;
|
|
6366
6756
|
}
|
|
6367
6757
|
//#endregion
|
|
6758
|
+
//#region connect/connect-config-schema.ts
|
|
6759
|
+
const IMAGE_REF = "Image reference: a project-relative file path, a URL, or a data URI.";
|
|
6760
|
+
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.";
|
|
6761
|
+
/** An image reference: a project-relative file path (the Connect build turns
|
|
6762
|
+
* it into a data URI or an emitted file), a URL, or a data URI. */
|
|
6763
|
+
const connectImageRefSchema = z.string().describe(IMAGE_REF);
|
|
6764
|
+
/** An image reference where `null` (or omitting it) keeps the default. */
|
|
6765
|
+
const optionalImageRef = (description = IMAGE_REF_OR_DEFAULT) => connectImageRefSchema.nullable().optional().describe(description);
|
|
6766
|
+
/** An image per colour scheme: one reference for both, or `{ light, dark }`
|
|
6767
|
+
* (`dark` falls back to `light`). */
|
|
6768
|
+
const connectSchemedImageSchema = z.union([connectImageRefSchema, z.strictObject({
|
|
6769
|
+
light: connectImageRefSchema,
|
|
6770
|
+
dark: connectImageRefSchema.nullable().optional()
|
|
6771
|
+
})]).describe("One image for both colour schemes, or { light, dark } (dark falls back to light).");
|
|
6772
|
+
/** A CSS colour per colour scheme (`dark` falls back to `light`). */
|
|
6773
|
+
const connectSchemedColorSchema = z.union([z.string(), z.strictObject({
|
|
6774
|
+
light: z.string(),
|
|
6775
|
+
dark: z.string().nullable().optional()
|
|
6776
|
+
})]);
|
|
6777
|
+
/** A CSS length: a number is px, a string is passed through as written. */
|
|
6778
|
+
const connectLengthSchema = z.union([z.number(), z.string()]);
|
|
6779
|
+
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)\").");
|
|
6780
|
+
/** Distances to the four edges; each is optional. */
|
|
6781
|
+
const connectEdgesSchema = z.strictObject({
|
|
6782
|
+
top: optionalLength(),
|
|
6783
|
+
right: optionalLength(),
|
|
6784
|
+
bottom: optionalLength(),
|
|
6785
|
+
left: optionalLength()
|
|
6786
|
+
});
|
|
6787
|
+
/** One image of a decorated pane, absolutely positioned inside it. */
|
|
6788
|
+
const connectBackgroundLayerSchema = z.strictObject({
|
|
6789
|
+
src: connectSchemedImageSchema,
|
|
6790
|
+
position: connectEdgesSchema.nullable().optional().describe("Distances to the pane's edges; at most one per axis. Omitted: centred both ways."),
|
|
6791
|
+
width: optionalLength(),
|
|
6792
|
+
height: optionalLength(),
|
|
6793
|
+
minWidth: optionalLength(),
|
|
6794
|
+
minHeight: optionalLength(),
|
|
6795
|
+
maxWidth: optionalLength(),
|
|
6796
|
+
maxHeight: optionalLength(),
|
|
6797
|
+
opacity: z.number().min(0).max(1).nullable().optional().describe("0 to 1 (default 1)."),
|
|
6798
|
+
fade: connectEdgesSchema.nullable().optional().describe("Feather depth per edge, fading the layer into the page colour.")
|
|
6799
|
+
}).describe("An image laid over the page, absolutely positioned: the edges set in `position` pin it, an axis with neither edge set is centred.");
|
|
6800
|
+
/** A decorated pane: the page colour and the images laid over it. */
|
|
6801
|
+
const connectBackgroundLayersSchema = z.strictObject({
|
|
6802
|
+
color: connectSchemedColorSchema.nullable().optional().describe("The page colour, or { light, dark }. Omitted or null: the theme's page background."),
|
|
6803
|
+
layers: z.array(connectBackgroundLayerSchema).describe("Painted in order; the first is at the back.")
|
|
6804
|
+
});
|
|
6805
|
+
/** A pane's background: layers over a page colour, or one image as
|
|
6806
|
+
* shorthand for a single layer pinned bottom-right. */
|
|
6807
|
+
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.");
|
|
6808
|
+
/** The loading image and the motion applied to it. */
|
|
6809
|
+
const connectLoaderSchema = z.strictObject({
|
|
6810
|
+
src: connectImageRefSchema,
|
|
6811
|
+
animation: z.enum([
|
|
6812
|
+
"pulse",
|
|
6813
|
+
"spin",
|
|
6814
|
+
"none"
|
|
6815
|
+
]).nullable().optional().describe("Motion applied to the image (default pulse)."),
|
|
6816
|
+
size: z.number().min(16).max(512).nullable().optional().describe("Rendered width in CSS pixels (default 96); the height follows the image.")
|
|
6817
|
+
});
|
|
6818
|
+
/** `connect.branding`: Connect's identity and look. */
|
|
6819
|
+
const connectBrandingSchema = z.strictObject({
|
|
6820
|
+
appName: z.string().nullable().optional().describe("Browser tab title, installed-app name and in-app brand text. null or omitted: 'Powerhouse Connect'."),
|
|
6821
|
+
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."),
|
|
6822
|
+
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."),
|
|
6823
|
+
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.")
|
|
6824
|
+
}).describe("App identity and visual branding. Every field is optional; null means the default.");
|
|
6825
|
+
/** `connect.home`: the home screen (the generic chrome's landing page). */
|
|
6826
|
+
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).");
|
|
6827
|
+
const connectAppSchema = z.strictObject({
|
|
6828
|
+
logLevel: z.enum([
|
|
6829
|
+
"debug",
|
|
6830
|
+
"info",
|
|
6831
|
+
"warn",
|
|
6832
|
+
"error"
|
|
6833
|
+
]).optional().meta({
|
|
6834
|
+
description: "Log level applied by Connect's logger at boot. Affects browser-side output only.",
|
|
6835
|
+
default: "info"
|
|
6836
|
+
}),
|
|
6837
|
+
basePath: z.string().optional().meta({
|
|
6838
|
+
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.",
|
|
6839
|
+
default: "/"
|
|
6840
|
+
}),
|
|
6841
|
+
offline: z.boolean().optional().meta({
|
|
6842
|
+
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.",
|
|
6843
|
+
default: true
|
|
6844
|
+
}),
|
|
6845
|
+
studioMode: z.boolean().optional().meta({
|
|
6846
|
+
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.",
|
|
6847
|
+
default: false
|
|
6848
|
+
}),
|
|
6849
|
+
cookieBanner: z.boolean().optional().meta({
|
|
6850
|
+
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.",
|
|
6851
|
+
default: true
|
|
6852
|
+
}),
|
|
6853
|
+
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.")
|
|
6854
|
+
}).describe("Top-level Connect application behaviour.");
|
|
6855
|
+
const connectAiSchema = z.strictObject({ assistantEnabled: z.boolean().optional().meta({
|
|
6856
|
+
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.",
|
|
6857
|
+
default: false
|
|
6858
|
+
}) }).describe("AI assistant (chat) behaviour.");
|
|
6859
|
+
const connectPackagesSchema = z.strictObject({
|
|
6860
|
+
externalEnabled: z.boolean().optional().meta({
|
|
6861
|
+
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.",
|
|
6862
|
+
default: true
|
|
6863
|
+
}),
|
|
6864
|
+
liveReload: z.boolean().optional().meta({
|
|
6865
|
+
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).",
|
|
6866
|
+
default: false
|
|
6867
|
+
})
|
|
6868
|
+
}).describe("Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).");
|
|
6869
|
+
const EXPLORER_ICONS_DESCRIPTION = "The drive explorer's icons (the generic plugin's); each null keeps the built-in icon.";
|
|
6870
|
+
/** The drive explorer's icons: the generic chrome's, owned by the generic
|
|
6871
|
+
* plugin. Each `null` keeps the built-in icon. */
|
|
6872
|
+
const connectExplorerIconsSchema = z.strictObject({
|
|
6873
|
+
localDrive: optionalImageRef("Local drives without an icon of their own."),
|
|
6874
|
+
remoteDrive: optionalImageRef("Remote drives without an icon of their own."),
|
|
6875
|
+
folder: optionalImageRef("Folders."),
|
|
6876
|
+
document: optionalImageRef("Documents whose type has no icon in `documents`."),
|
|
6877
|
+
documents: z.record(z.string(), connectImageRefSchema).nullable().optional().describe("Per document type, e.g. \"acme/invoice\".")
|
|
6878
|
+
}).describe(EXPLORER_ICONS_DESCRIPTION);
|
|
6879
|
+
const connectDefaultDriveRemoteSchema = z.strictObject({
|
|
6880
|
+
url: z.string(),
|
|
6881
|
+
name: z.string().nullable().optional(),
|
|
6882
|
+
icon: z.string().nullable().optional()
|
|
6883
|
+
});
|
|
6884
|
+
const connectDefaultDriveLocalSchema = z.strictObject({
|
|
6885
|
+
local: z.literal(true).describe("Discriminator: this entry is a local drive created on first boot."),
|
|
6886
|
+
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."),
|
|
6887
|
+
name: z.string().nullable().optional(),
|
|
6888
|
+
icon: z.string().nullable().optional(),
|
|
6889
|
+
app: z.string().optional().describe("Drive app (preferred editor) to open on the drive.")
|
|
6890
|
+
});
|
|
6891
|
+
const connectDefaultDriveSchema = z.union([connectDefaultDriveRemoteSchema, connectDefaultDriveLocalSchema]);
|
|
6892
|
+
/** `connect.drives.sections.{remote,local}`: three affirmative toggles. */
|
|
6893
|
+
const connectDriveSectionSchema = z.strictObject({
|
|
6894
|
+
enabled: z.boolean().optional().meta({
|
|
6895
|
+
description: "When false, the section is hidden in the sidebar.",
|
|
6896
|
+
default: true
|
|
6897
|
+
}),
|
|
6898
|
+
allowAdd: z.boolean().optional().meta({
|
|
6899
|
+
description: "When false, the section's 'add drive' affordance is hidden.",
|
|
6900
|
+
default: true
|
|
6901
|
+
}),
|
|
6902
|
+
allowDelete: z.boolean().optional().meta({
|
|
6903
|
+
description: "When false, drives in this section cannot be deleted from the UI.",
|
|
6904
|
+
default: true
|
|
6905
|
+
})
|
|
6906
|
+
}).describe("Visibility and add/delete affordances for a drive section in the sidebar.");
|
|
6907
|
+
const connectDriveSectionsSchema = z.strictObject({
|
|
6908
|
+
remote: connectDriveSectionSchema.optional(),
|
|
6909
|
+
local: connectDriveSectionSchema.optional()
|
|
6910
|
+
}).describe("Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.");
|
|
6911
|
+
/** Mirrors DRIVES_PRESERVE_STRATEGIES (../clis/constants.ts, which imports
|
|
6912
|
+
* node: modules, so it is not imported here); a test pins the two. */
|
|
6913
|
+
const connectDrivePreserveStrategySchema = z.enum(["preserve-all", "preserve-by-url-and-detach"]);
|
|
6914
|
+
const connectDrivesSchema = z.strictObject({
|
|
6915
|
+
allowAddDrive: z.boolean().optional().meta({
|
|
6916
|
+
description: "When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.",
|
|
6917
|
+
default: true
|
|
6918
|
+
}),
|
|
6919
|
+
defaultDrives: z.array(connectDefaultDriveSchema).optional().meta({
|
|
6920
|
+
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).",
|
|
6921
|
+
default: []
|
|
6922
|
+
}),
|
|
6923
|
+
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."),
|
|
6924
|
+
sections: connectDriveSectionsSchema.optional(),
|
|
6925
|
+
icons: connectExplorerIconsSchema.nullable().optional().describe(EXPLORER_ICONS_DESCRIPTION)
|
|
6926
|
+
}).describe("Default-drive and add-drive UI behaviour.");
|
|
6927
|
+
const connectRenownRainbowAdapterSchema = z.strictObject({
|
|
6928
|
+
walletConnectProjectId: z.string().optional().describe("WalletConnect project id; required for this adapter to function."),
|
|
6929
|
+
infuraProjectId: z.string().optional().describe("Optional Infura project id used to build RPC transports.")
|
|
6930
|
+
}).describe("wagmi + RainbowKit external-wallet adapter config.");
|
|
6931
|
+
const connectRenownPrivyAdapterSchema = z.strictObject({
|
|
6932
|
+
appId: z.string().optional().describe("Privy application id; required for this adapter to function."),
|
|
6933
|
+
clientId: z.string().optional().describe("Optional Privy client id."),
|
|
6934
|
+
methods: z.array(z.string()).optional().describe("Login methods this adapter offers; default per adapter when omitted.")
|
|
6935
|
+
}).describe("Privy embedded/social adapter config.");
|
|
6936
|
+
const connectRenownAdaptersSchema = z.strictObject({
|
|
6937
|
+
rainbow: connectRenownRainbowAdapterSchema.optional(),
|
|
6938
|
+
privy: connectRenownPrivyAdapterSchema.optional()
|
|
6939
|
+
}).describe("Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.");
|
|
6940
|
+
const connectRenownSchema = z.strictObject({
|
|
6941
|
+
url: z.string().optional().meta({
|
|
6942
|
+
description: "Renown auth service URL.",
|
|
6943
|
+
default: "https://www.renown.id"
|
|
6944
|
+
}),
|
|
6945
|
+
networkId: z.string().optional().meta({
|
|
6946
|
+
description: "CAIP-2 network namespace (e.g. 'eip155').",
|
|
6947
|
+
default: "eip155"
|
|
6948
|
+
}),
|
|
6949
|
+
chainId: z.number().optional().meta({
|
|
6950
|
+
description: "CAIP-2 chain reference within the network namespace.",
|
|
6951
|
+
default: 1
|
|
6952
|
+
}),
|
|
6953
|
+
namespace: z.string().optional().describe("Renown localStorage namespace; share it across Connects to share login."),
|
|
6954
|
+
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`."),
|
|
6955
|
+
adapters: connectRenownAdaptersSchema.optional()
|
|
6956
|
+
}).describe("Renown identity / authentication coordinates.");
|
|
6957
|
+
const connectSentrySchema = z.strictObject({
|
|
6958
|
+
dsn: z.string().nullable().optional().meta({
|
|
6959
|
+
description: "Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.",
|
|
6960
|
+
default: null
|
|
6961
|
+
}),
|
|
6962
|
+
env: z.string().optional().meta({
|
|
6963
|
+
description: "Sentry environment label, surfaced as the `environment` tag on every event.",
|
|
6964
|
+
default: "dev"
|
|
6965
|
+
}),
|
|
6966
|
+
tracing: z.boolean().optional().meta({
|
|
6967
|
+
description: "Enable Sentry performance tracing.",
|
|
6968
|
+
default: false
|
|
6969
|
+
})
|
|
6970
|
+
}).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.");
|
|
6971
|
+
const connectOpenPanelSchema = z.strictObject({
|
|
6972
|
+
clientId: z.string().optional().meta({
|
|
6973
|
+
description: "OpenPanel client id. Empty string disables OpenPanel entirely.",
|
|
6974
|
+
default: ""
|
|
6975
|
+
}),
|
|
6976
|
+
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."),
|
|
6977
|
+
trackUiEvents: z.boolean().optional().meta({
|
|
6978
|
+
description: "Track UI events.",
|
|
6979
|
+
default: true
|
|
6980
|
+
}),
|
|
6981
|
+
trackOperations: z.boolean().optional().meta({
|
|
6982
|
+
description: "Track document operations.",
|
|
6983
|
+
default: true
|
|
6984
|
+
})
|
|
6985
|
+
}).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.");
|
|
6986
|
+
/** Which reactor client Connect runs (see PHReactorClientMode). */
|
|
6987
|
+
const connectReactorClientModeSchema = z.enum([
|
|
6988
|
+
"in-process",
|
|
6989
|
+
"worker",
|
|
6990
|
+
"remote",
|
|
6991
|
+
"router"
|
|
6992
|
+
]);
|
|
6993
|
+
const connectInstanceSchema = z.strictObject({
|
|
6994
|
+
namespace: z.string().nullable().meta({
|
|
6995
|
+
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.",
|
|
6996
|
+
default: null
|
|
6997
|
+
}),
|
|
6998
|
+
reactorWorker: z.boolean().meta({
|
|
6999
|
+
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.",
|
|
7000
|
+
default: false
|
|
7001
|
+
}),
|
|
7002
|
+
multiReactor: z.boolean().optional().meta({
|
|
7003
|
+
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.",
|
|
7004
|
+
default: false
|
|
7005
|
+
})
|
|
7006
|
+
}).describe("Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.");
|
|
7007
|
+
const connectReactorFeatureFlagsSchema = z.strictObject({
|
|
7008
|
+
documentDecisions: z.boolean().optional().meta({
|
|
7009
|
+
description: "Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.",
|
|
7010
|
+
default: false
|
|
7011
|
+
}),
|
|
7012
|
+
authEnforcement: z.boolean().optional().meta({
|
|
7013
|
+
description: "Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.",
|
|
7014
|
+
default: false
|
|
7015
|
+
}),
|
|
7016
|
+
authGroups: z.boolean().optional().meta({
|
|
7017
|
+
description: "Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.",
|
|
7018
|
+
default: false
|
|
7019
|
+
}),
|
|
7020
|
+
authConditions: z.boolean().optional().meta({
|
|
7021
|
+
description: "Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.",
|
|
7022
|
+
default: false
|
|
7023
|
+
})
|
|
7024
|
+
}).describe("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.");
|
|
7025
|
+
const connectReactorSchema = z.strictObject({
|
|
7026
|
+
featureFlags: connectReactorFeatureFlagsSchema.optional(),
|
|
7027
|
+
createSignaturePolicy: z.enum(["legacy", "v2-required"]).optional().meta({
|
|
7028
|
+
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.",
|
|
7029
|
+
default: "v2-required"
|
|
7030
|
+
}),
|
|
7031
|
+
unsupportedStoredDocuments: z.enum(["refuse", "read-only"]).optional().meta({
|
|
7032
|
+
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.",
|
|
7033
|
+
default: "refuse"
|
|
7034
|
+
})
|
|
7035
|
+
}).describe("Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.");
|
|
7036
|
+
/** A runtime-caching / denylist URL match. A string is handed to Workbox
|
|
7037
|
+
* verbatim; `{ source, flags }` is rebuilt into a RegExp at build time. */
|
|
7038
|
+
const connectPwaUrlPatternSchema = z.union([z.string(), z.strictObject({
|
|
7039
|
+
source: z.string().describe("RegExp source."),
|
|
7040
|
+
flags: z.string().optional().describe("RegExp flags (e.g. 'i').")
|
|
7041
|
+
}).refine((p) => {
|
|
7042
|
+
try {
|
|
7043
|
+
new RegExp(p.source, p.flags);
|
|
7044
|
+
return true;
|
|
7045
|
+
} catch {
|
|
7046
|
+
return false;
|
|
7047
|
+
}
|
|
7048
|
+
}, { 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.");
|
|
7049
|
+
const connectPwaCacheStrategySchema = z.enum([
|
|
7050
|
+
"CacheFirst",
|
|
7051
|
+
"CacheOnly",
|
|
7052
|
+
"NetworkFirst",
|
|
7053
|
+
"NetworkOnly",
|
|
7054
|
+
"StaleWhileRevalidate"
|
|
7055
|
+
]);
|
|
7056
|
+
/** Serialisable subset of a Workbox `RuntimeCaching` rule. */
|
|
7057
|
+
const connectPwaRuntimeCachingSchema = z.strictObject({
|
|
7058
|
+
urlPattern: connectPwaUrlPatternSchema,
|
|
7059
|
+
handler: connectPwaCacheStrategySchema,
|
|
7060
|
+
method: z.enum([
|
|
7061
|
+
"GET",
|
|
7062
|
+
"POST",
|
|
7063
|
+
"PUT",
|
|
7064
|
+
"DELETE",
|
|
7065
|
+
"HEAD",
|
|
7066
|
+
"PATCH"
|
|
7067
|
+
]).optional(),
|
|
7068
|
+
options: z.strictObject({
|
|
7069
|
+
cacheName: z.string().optional(),
|
|
7070
|
+
networkTimeoutSeconds: z.number().optional().describe("Seconds a NetworkFirst rule waits for the network before falling back to the cache."),
|
|
7071
|
+
expiration: z.strictObject({
|
|
7072
|
+
maxEntries: z.number().optional(),
|
|
7073
|
+
maxAgeSeconds: z.number().optional()
|
|
7074
|
+
}).optional(),
|
|
7075
|
+
cacheableResponse: z.strictObject({
|
|
7076
|
+
statuses: z.array(z.number()).optional(),
|
|
7077
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
7078
|
+
}).optional()
|
|
7079
|
+
}).optional()
|
|
7080
|
+
});
|
|
7081
|
+
const connectPwaIconSchema = z.strictObject({
|
|
7082
|
+
src: z.string(),
|
|
7083
|
+
sizes: z.string().optional(),
|
|
7084
|
+
type: z.string().optional(),
|
|
7085
|
+
purpose: z.string().optional()
|
|
7086
|
+
});
|
|
7087
|
+
/** A File Handling API entry. No `action`: every handler opens at Connect's
|
|
7088
|
+
* app root, because consuming launched files needs Connect's own code. */
|
|
7089
|
+
const connectPwaFileHandlerSchema = z.strictObject({
|
|
7090
|
+
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."),
|
|
7091
|
+
icons: z.array(connectPwaIconSchema).optional().describe("OS-level file-type icons."),
|
|
7092
|
+
launch_type: z.enum(["single-client", "multiple-clients"]).optional()
|
|
7093
|
+
});
|
|
7094
|
+
/** Web-app-manifest fields a package or project may override. */
|
|
7095
|
+
const connectPwaManifestSchema = z.strictObject({
|
|
7096
|
+
name: z.string().optional(),
|
|
7097
|
+
short_name: z.string().optional(),
|
|
7098
|
+
description: z.string().optional(),
|
|
7099
|
+
theme_color: z.string().optional(),
|
|
7100
|
+
background_color: z.string().optional(),
|
|
7101
|
+
display: z.enum([
|
|
7102
|
+
"fullscreen",
|
|
7103
|
+
"standalone",
|
|
7104
|
+
"minimal-ui",
|
|
7105
|
+
"browser"
|
|
7106
|
+
]).optional(),
|
|
7107
|
+
start_url: z.string().optional(),
|
|
7108
|
+
scope: z.string().optional(),
|
|
7109
|
+
icons: z.array(connectPwaIconSchema).optional().describe("Icons appended to the built-in set and de-duplicated by (src, sizes, purpose)."),
|
|
7110
|
+
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."),
|
|
7111
|
+
launch_handler: z.strictObject({ client_mode: z.enum([
|
|
7112
|
+
"auto",
|
|
7113
|
+
"focus-existing",
|
|
7114
|
+
"navigate-existing",
|
|
7115
|
+
"navigate-new"
|
|
7116
|
+
]) }).optional().describe("How the OS launches the app for handled files/links. Connect defaults to focus-existing.")
|
|
7117
|
+
}).describe("Web-app-manifest field overrides.");
|
|
7118
|
+
const pwaShape = {
|
|
7119
|
+
globPatterns: z.array(z.string()).optional().describe("Extra Workbox precache globs, unioned with the built-ins."),
|
|
7120
|
+
globIgnores: z.array(z.string()).optional().describe("Extra precache ignore globs, unioned with the built-ins."),
|
|
7121
|
+
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."),
|
|
7122
|
+
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."),
|
|
7123
|
+
navigateFallbackDenylist: z.array(connectPwaUrlPatternSchema).optional().describe("Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.")
|
|
7124
|
+
};
|
|
7125
|
+
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.";
|
|
7126
|
+
/** `connect.pwa` as authored. */
|
|
7127
|
+
const connectPwaSchema = z.strictObject({
|
|
7128
|
+
manifest: connectPwaManifestSchema.optional(),
|
|
7129
|
+
...pwaShape
|
|
7130
|
+
}).describe(PWA_DESCRIPTION);
|
|
7131
|
+
/**
|
|
7132
|
+
* The `connect` block as authored: powerhouse.config.json's `connect`, the
|
|
7133
|
+
* connect host's `config`, and `ph connect config` writes. Every field is
|
|
7134
|
+
* optional; omit the section entirely for default behaviour.
|
|
7135
|
+
*/
|
|
7136
|
+
const connectConfigSchema = z.strictObject({
|
|
7137
|
+
branding: connectBrandingSchema.optional(),
|
|
7138
|
+
home: connectHomeSchema.optional(),
|
|
7139
|
+
app: connectAppSchema.optional(),
|
|
7140
|
+
ai: connectAiSchema.optional(),
|
|
7141
|
+
packages: connectPackagesSchema.optional(),
|
|
7142
|
+
drives: connectDrivesSchema.optional(),
|
|
7143
|
+
renown: connectRenownSchema.optional(),
|
|
7144
|
+
sentry: connectSentrySchema.optional(),
|
|
7145
|
+
openPanel: connectOpenPanelSchema.optional(),
|
|
7146
|
+
instance: connectInstanceSchema.optional(),
|
|
7147
|
+
reactor: connectReactorSchema.optional(),
|
|
7148
|
+
pwa: connectPwaSchema.optional()
|
|
7149
|
+
}).describe("Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.");
|
|
7150
|
+
/** One entry of the host.js composition, projected into the served config as
|
|
7151
|
+
* data (module specifier + validated config). */
|
|
7152
|
+
const connectCompositionEntrySchema = z.strictObject({
|
|
7153
|
+
module: z.string(),
|
|
7154
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
7155
|
+
});
|
|
7156
|
+
/** `instance` plus `reactorClient`, derived from the host's reactor backends. */
|
|
7157
|
+
const connectRuntimeInstanceSchema = connectInstanceSchema.extend({ reactorClient: connectReactorClientModeSchema.optional() });
|
|
7158
|
+
/** The manifest plus `categories`, derived from contributors' `category`. */
|
|
7159
|
+
const connectRuntimePwaManifestSchema = connectPwaManifestSchema.extend({ categories: z.array(z.string()).optional() });
|
|
7160
|
+
const connectRuntimePwaSchema = connectPwaSchema.extend({ manifest: connectRuntimePwaManifestSchema.optional() });
|
|
7161
|
+
connectConfigSchema.extend({
|
|
7162
|
+
composition: z.array(connectCompositionEntrySchema).optional(),
|
|
7163
|
+
instance: connectRuntimeInstanceSchema.optional(),
|
|
7164
|
+
pwa: connectRuntimePwaSchema.optional()
|
|
7165
|
+
});
|
|
7166
|
+
//#endregion
|
|
6368
7167
|
//#region connect/schema-fragments.ts
|
|
6369
7168
|
const powerhousePackageSchema = {
|
|
6370
7169
|
type: "object",
|
|
@@ -6395,510 +7194,17 @@ const powerhousePackageSchema = {
|
|
|
6395
7194
|
}
|
|
6396
7195
|
}
|
|
6397
7196
|
};
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
type: "boolean",
|
|
6410
|
-
description: "When false, the section's 'add drive' affordance is hidden.",
|
|
6411
|
-
default: true
|
|
6412
|
-
},
|
|
6413
|
-
allowDelete: {
|
|
6414
|
-
type: "boolean",
|
|
6415
|
-
description: "When false, drives in this section cannot be deleted from the UI.",
|
|
6416
|
-
default: true
|
|
6417
|
-
}
|
|
6418
|
-
}
|
|
6419
|
-
};
|
|
6420
|
-
const pwaUrlPatternSchema = {
|
|
6421
|
-
description: "URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.",
|
|
6422
|
-
oneOf: [{ type: "string" }, {
|
|
6423
|
-
type: "object",
|
|
6424
|
-
additionalProperties: false,
|
|
6425
|
-
required: ["source"],
|
|
6426
|
-
properties: {
|
|
6427
|
-
source: {
|
|
6428
|
-
type: "string",
|
|
6429
|
-
description: "RegExp source."
|
|
6430
|
-
},
|
|
6431
|
-
flags: {
|
|
6432
|
-
type: "string",
|
|
6433
|
-
description: "RegExp flags (e.g. 'i')."
|
|
6434
|
-
}
|
|
6435
|
-
}
|
|
6436
|
-
}]
|
|
6437
|
-
};
|
|
6438
|
-
const pwaIconSchema = {
|
|
6439
|
-
type: "object",
|
|
6440
|
-
additionalProperties: false,
|
|
6441
|
-
required: ["src"],
|
|
6442
|
-
properties: {
|
|
6443
|
-
src: { type: "string" },
|
|
6444
|
-
sizes: { type: "string" },
|
|
6445
|
-
type: { type: "string" },
|
|
6446
|
-
purpose: { type: "string" }
|
|
6447
|
-
}
|
|
6448
|
-
};
|
|
6449
|
-
const phConnectRuntimeConfigSchema = {
|
|
6450
|
-
type: "object",
|
|
6451
|
-
additionalProperties: false,
|
|
6452
|
-
description: "Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.",
|
|
6453
|
-
properties: {
|
|
6454
|
-
branding: {
|
|
6455
|
-
type: "object",
|
|
6456
|
-
additionalProperties: false,
|
|
6457
|
-
description: "App identity and visual branding.",
|
|
6458
|
-
properties: {
|
|
6459
|
-
appName: {
|
|
6460
|
-
type: "string",
|
|
6461
|
-
description: "Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'."
|
|
6462
|
-
},
|
|
6463
|
-
homeBackground: {
|
|
6464
|
-
type: ["string", "null"],
|
|
6465
|
-
description: "Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image."
|
|
6466
|
-
}
|
|
6467
|
-
}
|
|
6468
|
-
},
|
|
6469
|
-
app: {
|
|
6470
|
-
type: "object",
|
|
6471
|
-
additionalProperties: false,
|
|
6472
|
-
description: "Top-level Connect application behaviour.",
|
|
6473
|
-
properties: {
|
|
6474
|
-
logLevel: {
|
|
6475
|
-
type: "string",
|
|
6476
|
-
enum: [
|
|
6477
|
-
"debug",
|
|
6478
|
-
"info",
|
|
6479
|
-
"warn",
|
|
6480
|
-
"error"
|
|
6481
|
-
],
|
|
6482
|
-
description: "Log level applied by Connect's logger at boot. Affects browser-side output only.",
|
|
6483
|
-
default: "info"
|
|
6484
|
-
},
|
|
6485
|
-
basePath: {
|
|
6486
|
-
type: "string",
|
|
6487
|
-
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.",
|
|
6488
|
-
default: "/"
|
|
6489
|
-
},
|
|
6490
|
-
offline: {
|
|
6491
|
-
type: "boolean",
|
|
6492
|
-
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.",
|
|
6493
|
-
default: true
|
|
6494
|
-
},
|
|
6495
|
-
studioMode: {
|
|
6496
|
-
type: "boolean",
|
|
6497
|
-
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.",
|
|
6498
|
-
default: false
|
|
6499
|
-
}
|
|
6500
|
-
}
|
|
6501
|
-
},
|
|
6502
|
-
ai: {
|
|
6503
|
-
type: "object",
|
|
6504
|
-
additionalProperties: false,
|
|
6505
|
-
description: "AI assistant (chat) behaviour.",
|
|
6506
|
-
properties: { assistantEnabled: {
|
|
6507
|
-
type: "boolean",
|
|
6508
|
-
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.",
|
|
6509
|
-
default: false
|
|
6510
|
-
} }
|
|
6511
|
-
},
|
|
6512
|
-
packages: {
|
|
6513
|
-
type: "object",
|
|
6514
|
-
additionalProperties: false,
|
|
6515
|
-
description: "Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).",
|
|
6516
|
-
properties: {
|
|
6517
|
-
externalEnabled: {
|
|
6518
|
-
type: "boolean",
|
|
6519
|
-
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.",
|
|
6520
|
-
default: true
|
|
6521
|
-
},
|
|
6522
|
-
liveReload: {
|
|
6523
|
-
type: "boolean",
|
|
6524
|
-
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).",
|
|
6525
|
-
default: false
|
|
6526
|
-
}
|
|
6527
|
-
}
|
|
6528
|
-
},
|
|
6529
|
-
drives: {
|
|
6530
|
-
type: "object",
|
|
6531
|
-
additionalProperties: false,
|
|
6532
|
-
description: "Default-drive and add-drive UI behaviour.",
|
|
6533
|
-
properties: {
|
|
6534
|
-
allowAddDrive: {
|
|
6535
|
-
type: "boolean",
|
|
6536
|
-
description: "When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.",
|
|
6537
|
-
default: true
|
|
6538
|
-
},
|
|
6539
|
-
defaultDrives: {
|
|
6540
|
-
type: "array",
|
|
6541
|
-
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).",
|
|
6542
|
-
default: [],
|
|
6543
|
-
items: { oneOf: [{
|
|
6544
|
-
type: "object",
|
|
6545
|
-
additionalProperties: false,
|
|
6546
|
-
required: ["url"],
|
|
6547
|
-
properties: {
|
|
6548
|
-
url: { type: "string" },
|
|
6549
|
-
name: { type: ["string", "null"] },
|
|
6550
|
-
icon: { type: ["string", "null"] }
|
|
6551
|
-
}
|
|
6552
|
-
}, {
|
|
6553
|
-
type: "object",
|
|
6554
|
-
additionalProperties: false,
|
|
6555
|
-
required: ["local", "id"],
|
|
6556
|
-
properties: {
|
|
6557
|
-
local: {
|
|
6558
|
-
const: true,
|
|
6559
|
-
description: "Discriminator: this entry is a local drive created on first boot."
|
|
6560
|
-
},
|
|
6561
|
-
id: {
|
|
6562
|
-
type: "string",
|
|
6563
|
-
description: "Stable drive id. The drive is created with this id on first boot and is not re-created on later boots."
|
|
6564
|
-
},
|
|
6565
|
-
name: { type: ["string", "null"] },
|
|
6566
|
-
icon: { type: ["string", "null"] },
|
|
6567
|
-
app: {
|
|
6568
|
-
type: "string",
|
|
6569
|
-
description: "Drive app (preferred editor) to open on the drive."
|
|
6570
|
-
}
|
|
6571
|
-
}
|
|
6572
|
-
}] }
|
|
6573
|
-
},
|
|
6574
|
-
preserveStrategy: {
|
|
6575
|
-
type: "string",
|
|
6576
|
-
enum: ["preserve-all", "preserve-by-url-and-detach"],
|
|
6577
|
-
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."
|
|
6578
|
-
},
|
|
6579
|
-
sections: {
|
|
6580
|
-
type: "object",
|
|
6581
|
-
additionalProperties: false,
|
|
6582
|
-
description: "Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.",
|
|
6583
|
-
properties: {
|
|
6584
|
-
remote: driveSectionSchema,
|
|
6585
|
-
local: driveSectionSchema
|
|
6586
|
-
}
|
|
6587
|
-
}
|
|
6588
|
-
}
|
|
6589
|
-
},
|
|
6590
|
-
renown: {
|
|
6591
|
-
type: "object",
|
|
6592
|
-
additionalProperties: false,
|
|
6593
|
-
description: "Renown identity / authentication coordinates.",
|
|
6594
|
-
properties: {
|
|
6595
|
-
url: {
|
|
6596
|
-
type: "string",
|
|
6597
|
-
description: "Renown auth service URL.",
|
|
6598
|
-
default: "https://www.renown.id"
|
|
6599
|
-
},
|
|
6600
|
-
networkId: {
|
|
6601
|
-
type: "string",
|
|
6602
|
-
description: "CAIP-2 network namespace (e.g. 'eip155').",
|
|
6603
|
-
default: "eip155"
|
|
6604
|
-
},
|
|
6605
|
-
chainId: {
|
|
6606
|
-
type: "number",
|
|
6607
|
-
description: "CAIP-2 chain reference within the network namespace.",
|
|
6608
|
-
default: 1
|
|
6609
|
-
},
|
|
6610
|
-
namespace: {
|
|
6611
|
-
type: "string",
|
|
6612
|
-
description: "Renown localStorage namespace; share it across Connects to share login."
|
|
6613
|
-
},
|
|
6614
|
-
switchboardUrl: {
|
|
6615
|
-
type: "string",
|
|
6616
|
-
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`."
|
|
6617
|
-
},
|
|
6618
|
-
adapters: {
|
|
6619
|
-
type: "object",
|
|
6620
|
-
additionalProperties: false,
|
|
6621
|
-
description: "Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.",
|
|
6622
|
-
properties: {
|
|
6623
|
-
rainbow: {
|
|
6624
|
-
type: "object",
|
|
6625
|
-
additionalProperties: false,
|
|
6626
|
-
description: "wagmi + RainbowKit external-wallet adapter config.",
|
|
6627
|
-
properties: {
|
|
6628
|
-
walletConnectProjectId: {
|
|
6629
|
-
type: "string",
|
|
6630
|
-
description: "WalletConnect project id; required for this adapter to function."
|
|
6631
|
-
},
|
|
6632
|
-
infuraProjectId: {
|
|
6633
|
-
type: "string",
|
|
6634
|
-
description: "Optional Infura project id used to build RPC transports."
|
|
6635
|
-
}
|
|
6636
|
-
}
|
|
6637
|
-
},
|
|
6638
|
-
privy: {
|
|
6639
|
-
type: "object",
|
|
6640
|
-
additionalProperties: false,
|
|
6641
|
-
description: "Privy embedded/social adapter config.",
|
|
6642
|
-
properties: {
|
|
6643
|
-
appId: {
|
|
6644
|
-
type: "string",
|
|
6645
|
-
description: "Privy application id; required for this adapter to function."
|
|
6646
|
-
},
|
|
6647
|
-
clientId: {
|
|
6648
|
-
type: "string",
|
|
6649
|
-
description: "Optional Privy client id."
|
|
6650
|
-
},
|
|
6651
|
-
methods: {
|
|
6652
|
-
type: "array",
|
|
6653
|
-
description: "Login methods this adapter offers; default per adapter when omitted.",
|
|
6654
|
-
items: { type: "string" }
|
|
6655
|
-
}
|
|
6656
|
-
}
|
|
6657
|
-
}
|
|
6658
|
-
}
|
|
6659
|
-
}
|
|
6660
|
-
}
|
|
6661
|
-
},
|
|
6662
|
-
sentry: {
|
|
6663
|
-
type: "object",
|
|
6664
|
-
additionalProperties: false,
|
|
6665
|
-
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.",
|
|
6666
|
-
properties: {
|
|
6667
|
-
dsn: {
|
|
6668
|
-
type: ["string", "null"],
|
|
6669
|
-
description: "Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.",
|
|
6670
|
-
default: null
|
|
6671
|
-
},
|
|
6672
|
-
env: {
|
|
6673
|
-
type: "string",
|
|
6674
|
-
description: "Sentry environment label, surfaced as the `environment` tag on every event.",
|
|
6675
|
-
default: "dev"
|
|
6676
|
-
},
|
|
6677
|
-
tracing: {
|
|
6678
|
-
type: "boolean",
|
|
6679
|
-
description: "Enable Sentry performance tracing.",
|
|
6680
|
-
default: false
|
|
6681
|
-
}
|
|
6682
|
-
}
|
|
6683
|
-
},
|
|
6684
|
-
instance: {
|
|
6685
|
-
type: "object",
|
|
6686
|
-
additionalProperties: false,
|
|
6687
|
-
required: ["namespace", "reactorWorker"],
|
|
6688
|
-
description: "Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.",
|
|
6689
|
-
properties: {
|
|
6690
|
-
namespace: {
|
|
6691
|
-
type: ["string", "null"],
|
|
6692
|
-
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.",
|
|
6693
|
-
default: null
|
|
6694
|
-
},
|
|
6695
|
-
reactorWorker: {
|
|
6696
|
-
type: "boolean",
|
|
6697
|
-
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.",
|
|
6698
|
-
default: false
|
|
6699
|
-
}
|
|
6700
|
-
}
|
|
6701
|
-
},
|
|
6702
|
-
reactor: {
|
|
6703
|
-
type: "object",
|
|
6704
|
-
additionalProperties: false,
|
|
6705
|
-
description: "Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.",
|
|
6706
|
-
properties: { featureFlags: {
|
|
6707
|
-
type: "object",
|
|
6708
|
-
additionalProperties: false,
|
|
6709
|
-
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.",
|
|
6710
|
-
properties: {
|
|
6711
|
-
documentDecisions: {
|
|
6712
|
-
type: "boolean",
|
|
6713
|
-
description: "Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.",
|
|
6714
|
-
default: false
|
|
6715
|
-
},
|
|
6716
|
-
authEnforcement: {
|
|
6717
|
-
type: "boolean",
|
|
6718
|
-
description: "Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.",
|
|
6719
|
-
default: false
|
|
6720
|
-
},
|
|
6721
|
-
authGroups: {
|
|
6722
|
-
type: "boolean",
|
|
6723
|
-
description: "Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.",
|
|
6724
|
-
default: false
|
|
6725
|
-
},
|
|
6726
|
-
authConditions: {
|
|
6727
|
-
type: "boolean",
|
|
6728
|
-
description: "Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.",
|
|
6729
|
-
default: false
|
|
6730
|
-
}
|
|
6731
|
-
}
|
|
6732
|
-
} }
|
|
6733
|
-
},
|
|
6734
|
-
pwa: {
|
|
6735
|
-
type: "object",
|
|
6736
|
-
additionalProperties: false,
|
|
6737
|
-
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.",
|
|
6738
|
-
properties: {
|
|
6739
|
-
manifest: {
|
|
6740
|
-
type: "object",
|
|
6741
|
-
additionalProperties: false,
|
|
6742
|
-
description: "Web-app-manifest field overrides.",
|
|
6743
|
-
properties: {
|
|
6744
|
-
name: { type: "string" },
|
|
6745
|
-
short_name: { type: "string" },
|
|
6746
|
-
description: { type: "string" },
|
|
6747
|
-
theme_color: { type: "string" },
|
|
6748
|
-
background_color: { type: "string" },
|
|
6749
|
-
display: {
|
|
6750
|
-
type: "string",
|
|
6751
|
-
enum: [
|
|
6752
|
-
"fullscreen",
|
|
6753
|
-
"standalone",
|
|
6754
|
-
"minimal-ui",
|
|
6755
|
-
"browser"
|
|
6756
|
-
]
|
|
6757
|
-
},
|
|
6758
|
-
start_url: { type: "string" },
|
|
6759
|
-
scope: { type: "string" },
|
|
6760
|
-
icons: {
|
|
6761
|
-
type: "array",
|
|
6762
|
-
description: "Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).",
|
|
6763
|
-
items: pwaIconSchema
|
|
6764
|
-
},
|
|
6765
|
-
file_handlers: {
|
|
6766
|
-
type: "array",
|
|
6767
|
-
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.",
|
|
6768
|
-
items: {
|
|
6769
|
-
type: "object",
|
|
6770
|
-
additionalProperties: false,
|
|
6771
|
-
required: ["accept"],
|
|
6772
|
-
properties: {
|
|
6773
|
-
accept: {
|
|
6774
|
-
type: "object",
|
|
6775
|
-
description: "MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.",
|
|
6776
|
-
additionalProperties: {
|
|
6777
|
-
type: "array",
|
|
6778
|
-
items: {
|
|
6779
|
-
type: "string",
|
|
6780
|
-
pattern: "^\\."
|
|
6781
|
-
}
|
|
6782
|
-
}
|
|
6783
|
-
},
|
|
6784
|
-
icons: {
|
|
6785
|
-
type: "array",
|
|
6786
|
-
description: "OS-level file-type icons.",
|
|
6787
|
-
items: pwaIconSchema
|
|
6788
|
-
},
|
|
6789
|
-
launch_type: {
|
|
6790
|
-
type: "string",
|
|
6791
|
-
enum: ["single-client", "multiple-clients"]
|
|
6792
|
-
}
|
|
6793
|
-
}
|
|
6794
|
-
}
|
|
6795
|
-
},
|
|
6796
|
-
launch_handler: {
|
|
6797
|
-
type: "object",
|
|
6798
|
-
additionalProperties: false,
|
|
6799
|
-
required: ["client_mode"],
|
|
6800
|
-
description: "How the OS launches the app for handled files/links. Connect defaults to focus-existing.",
|
|
6801
|
-
properties: { client_mode: {
|
|
6802
|
-
type: "string",
|
|
6803
|
-
enum: [
|
|
6804
|
-
"auto",
|
|
6805
|
-
"focus-existing",
|
|
6806
|
-
"navigate-existing",
|
|
6807
|
-
"navigate-new"
|
|
6808
|
-
]
|
|
6809
|
-
} }
|
|
6810
|
-
}
|
|
6811
|
-
}
|
|
6812
|
-
},
|
|
6813
|
-
globPatterns: {
|
|
6814
|
-
type: "array",
|
|
6815
|
-
items: { type: "string" },
|
|
6816
|
-
description: "Extra Workbox precache globs, unioned with the built-ins."
|
|
6817
|
-
},
|
|
6818
|
-
globIgnores: {
|
|
6819
|
-
type: "array",
|
|
6820
|
-
items: { type: "string" },
|
|
6821
|
-
description: "Extra precache ignore globs, unioned with the built-ins."
|
|
6822
|
-
},
|
|
6823
|
-
maximumFileSizeToCacheInBytes: {
|
|
6824
|
-
type: "number",
|
|
6825
|
-
description: "Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit."
|
|
6826
|
-
},
|
|
6827
|
-
runtimeCaching: {
|
|
6828
|
-
type: "array",
|
|
6829
|
-
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.",
|
|
6830
|
-
items: {
|
|
6831
|
-
type: "object",
|
|
6832
|
-
additionalProperties: false,
|
|
6833
|
-
required: ["urlPattern", "handler"],
|
|
6834
|
-
properties: {
|
|
6835
|
-
urlPattern: pwaUrlPatternSchema,
|
|
6836
|
-
handler: {
|
|
6837
|
-
type: "string",
|
|
6838
|
-
enum: [
|
|
6839
|
-
"CacheFirst",
|
|
6840
|
-
"CacheOnly",
|
|
6841
|
-
"NetworkFirst",
|
|
6842
|
-
"NetworkOnly",
|
|
6843
|
-
"StaleWhileRevalidate"
|
|
6844
|
-
]
|
|
6845
|
-
},
|
|
6846
|
-
method: {
|
|
6847
|
-
type: "string",
|
|
6848
|
-
enum: [
|
|
6849
|
-
"GET",
|
|
6850
|
-
"POST",
|
|
6851
|
-
"PUT",
|
|
6852
|
-
"DELETE",
|
|
6853
|
-
"HEAD",
|
|
6854
|
-
"PATCH"
|
|
6855
|
-
]
|
|
6856
|
-
},
|
|
6857
|
-
options: {
|
|
6858
|
-
type: "object",
|
|
6859
|
-
additionalProperties: false,
|
|
6860
|
-
properties: {
|
|
6861
|
-
cacheName: { type: "string" },
|
|
6862
|
-
networkTimeoutSeconds: {
|
|
6863
|
-
type: "number",
|
|
6864
|
-
description: "Seconds a NetworkFirst rule waits for the network before falling back to the cache."
|
|
6865
|
-
},
|
|
6866
|
-
expiration: {
|
|
6867
|
-
type: "object",
|
|
6868
|
-
additionalProperties: false,
|
|
6869
|
-
properties: {
|
|
6870
|
-
maxEntries: { type: "number" },
|
|
6871
|
-
maxAgeSeconds: { type: "number" }
|
|
6872
|
-
}
|
|
6873
|
-
},
|
|
6874
|
-
cacheableResponse: {
|
|
6875
|
-
type: "object",
|
|
6876
|
-
additionalProperties: false,
|
|
6877
|
-
properties: {
|
|
6878
|
-
statuses: {
|
|
6879
|
-
type: "array",
|
|
6880
|
-
items: { type: "number" }
|
|
6881
|
-
},
|
|
6882
|
-
headers: {
|
|
6883
|
-
type: "object",
|
|
6884
|
-
additionalProperties: { type: "string" }
|
|
6885
|
-
}
|
|
6886
|
-
}
|
|
6887
|
-
}
|
|
6888
|
-
}
|
|
6889
|
-
}
|
|
6890
|
-
}
|
|
6891
|
-
}
|
|
6892
|
-
},
|
|
6893
|
-
navigateFallbackDenylist: {
|
|
6894
|
-
type: "array",
|
|
6895
|
-
description: "Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.",
|
|
6896
|
-
items: pwaUrlPatternSchema
|
|
6897
|
-
}
|
|
6898
|
-
}
|
|
6899
|
-
}
|
|
6900
|
-
}
|
|
6901
|
-
};
|
|
7197
|
+
/** Emits a zod schema as a draft-07 fragment: input shape, no `$schema`. */
|
|
7198
|
+
function emitJsonSchemaFragment(schema) {
|
|
7199
|
+
const { $schema: _, ...fragment } = toJSONSchema(schema, {
|
|
7200
|
+
target: "draft-7",
|
|
7201
|
+
io: "input",
|
|
7202
|
+
unrepresentable: "throw"
|
|
7203
|
+
});
|
|
7204
|
+
return fragment;
|
|
7205
|
+
}
|
|
7206
|
+
/** The authored `connect` block, as validated by Ajv. */
|
|
7207
|
+
const phConnectRuntimeConfigSchema = /* @__PURE__ */ emitJsonSchemaFragment(connectConfigSchema);
|
|
6902
7208
|
//#endregion
|
|
6903
7209
|
//#region clis/source-config-schema.ts
|
|
6904
7210
|
const SOURCE_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.source.json";
|
|
@@ -7100,9 +7406,36 @@ const sourceConfigSchema = {
|
|
|
7100
7406
|
connectPort: {
|
|
7101
7407
|
type: "integer",
|
|
7102
7408
|
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."
|
|
7409
|
+
},
|
|
7410
|
+
previewDrive: {
|
|
7411
|
+
type: "object",
|
|
7412
|
+
additionalProperties: false,
|
|
7413
|
+
description: "The Vetra Preview drive `ph vetra` creates in watch mode.",
|
|
7414
|
+
properties: { app: {
|
|
7415
|
+
type: "string",
|
|
7416
|
+
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."
|
|
7417
|
+
} }
|
|
7103
7418
|
}
|
|
7104
7419
|
}
|
|
7105
7420
|
},
|
|
7421
|
+
assistant: {
|
|
7422
|
+
type: "object",
|
|
7423
|
+
additionalProperties: false,
|
|
7424
|
+
description: "The project's agent host (hosts/assistant): a headless Mastra agent API on the project switchboard.",
|
|
7425
|
+
properties: { port: {
|
|
7426
|
+
type: "integer",
|
|
7427
|
+
description: "Port the assistant host's chat-completions API listens on. Read by hosts/assistant/host.js (default 4910)."
|
|
7428
|
+
} }
|
|
7429
|
+
},
|
|
7430
|
+
workflows: {
|
|
7431
|
+
type: "object",
|
|
7432
|
+
additionalProperties: false,
|
|
7433
|
+
description: "Powerhouse workflows on this reactor.",
|
|
7434
|
+
properties: { enabled: {
|
|
7435
|
+
type: "boolean",
|
|
7436
|
+
description: "Register the workflow document models and run workflows, on the reactor and in Connect. PH_WORKFLOWS_ENABLED overrides it for the reactor, and connect.app.workflowsEnabled for Connect."
|
|
7437
|
+
} }
|
|
7438
|
+
},
|
|
7106
7439
|
packageRegistryUrl: {
|
|
7107
7440
|
type: "string",
|
|
7108
7441
|
description: "Project-wide package registry endpoint. Used by `ph install` / `ph publish` / `ph registry-login` and Switchboard, and copied verbatim into the runtime config so the Connect SPA's Package Manager UI reads the same registry."
|
|
@@ -7144,6 +7477,6 @@ function assertNodeVersion(nodeVersion = process.versions.node) {
|
|
|
7144
7477
|
if (lt(nodeVersion, "24.0.0")) throw new NodeVersionError(nodeVersion, MINIMUM_NODE_VERSION);
|
|
7145
7478
|
}
|
|
7146
7479
|
//#endregion
|
|
7147
|
-
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, 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, 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 };
|
|
7480
|
+
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_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, 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, SECONDS_IN_DAY, SERVICE_ACTIONS, SOURCE_CONFIG_SCHEMA_ID, 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, 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, resolvePhDir, resolveSwitchboardPortDefault, resolveTelemetryConsent, runCmd, runUseLocal, serviceArgs, setTelemetryConsent, sourceConfigSchema, spawnAsync, switchboardArgs, uninstallArgs, unpublishArgs, versionSatisfies, vetraArgs, vetraSwitchboardArgs, writeFileEnsuringDir };
|
|
7148
7481
|
|
|
7149
7482
|
//# sourceMappingURL=index.mjs.map
|