@powerhousedao/shared 6.2.3-dev.6 → 6.2.3-dev.60
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/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-To5LaIfL.mjs → access-token-3Hqv_U8I.mjs} +2 -2
- package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-3Hqv_U8I.mjs.map} +1 -1
- package/dist/clis/args/access-token-C5sKsH2O.d.mts +16 -0
- package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +1 -0
- package/dist/clis/args/access-token.d.mts +3 -2
- package/dist/clis/args/access-token.mjs +1 -1
- package/dist/clis/args/{common-CcYbXrBx.mjs → common-BXabdhiO.mjs} +30 -7
- package/dist/clis/args/common-BXabdhiO.mjs.map +1 -0
- package/dist/clis/args/common-Bnm859xU.d.mts +186 -0
- package/dist/clis/args/common-Bnm859xU.d.mts.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-BVVvCmL9.mjs → connect-BG3HkYBk.mjs} +8 -3
- package/dist/clis/args/connect-BG3HkYBk.mjs.map +1 -0
- package/dist/clis/args/connect-DjeiqXus.d.mts +450 -0
- package/dist/clis/args/connect-DjeiqXus.d.mts.map +1 -0
- package/dist/clis/args/connect.d.mts +3 -2
- package/dist/clis/args/connect.mjs +1 -1
- package/dist/clis/args/dist-CorQTQL-.mjs +1533 -0
- package/dist/clis/args/dist-CorQTQL-.mjs.map +1 -0
- package/dist/clis/args/{generate-CA916Fvj.mjs → generate-BOItUNvP.mjs} +40 -2
- package/dist/clis/args/generate-BOItUNvP.mjs.map +1 -0
- package/dist/clis/args/generate-BPBBLeUD.d.mts +103 -0
- package/dist/clis/args/generate-BPBBLeUD.d.mts.map +1 -0
- package/dist/clis/args/generate.d.mts +3 -2
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-Bqbgbalu.mjs → help-BfAqpYvC.mjs} +43 -16
- package/dist/clis/args/help-BfAqpYvC.mjs.map +1 -0
- package/dist/clis/args/help-KuqI-EEG.d.mts +203 -0
- package/dist/clis/args/help-KuqI-EEG.d.mts.map +1 -0
- package/dist/clis/args/help.d.mts +3 -2
- package/dist/clis/args/help.mjs +1 -1
- package/dist/clis/args/index.d.mts +20 -19
- package/dist/clis/args/index.mjs +18 -18
- package/dist/clis/args/init-CTaK80wE.d.mts +55 -0
- package/dist/clis/args/init-CTaK80wE.d.mts.map +1 -0
- package/dist/clis/args/{init-rz9Ei7nq.mjs → init-xlCNZ8Oe.mjs} +7 -2
- package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-xlCNZ8Oe.mjs.map} +1 -1
- package/dist/clis/args/init.d.mts +3 -2
- package/dist/clis/args/init.mjs +1 -1
- package/dist/clis/args/inspect-BjRmtB86.d.mts +13 -0
- package/dist/clis/args/inspect-BjRmtB86.d.mts.map +1 -0
- package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-UNQgtuR0.mjs} +2 -2
- package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-UNQgtuR0.mjs.map} +1 -1
- package/dist/clis/args/inspect.d.mts +3 -2
- package/dist/clis/args/inspect.mjs +1 -1
- package/dist/clis/args/install-B0tMyUMw.d.mts +37 -0
- package/dist/clis/args/install-B0tMyUMw.d.mts.map +1 -0
- package/dist/clis/args/{install-Sz2DlCHh.mjs → install-F-27kF6m.mjs} +2 -2
- package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-F-27kF6m.mjs.map} +1 -1
- package/dist/clis/args/install.d.mts +3 -2
- package/dist/clis/args/install.mjs +1 -1
- package/dist/clis/args/{list-DM2d6f1m.mjs → list-Bkfn8Yuo.mjs} +2 -2
- package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-Bkfn8Yuo.mjs.map} +1 -1
- package/dist/clis/args/list-DrbxA7JJ.d.mts +10 -0
- package/dist/clis/args/list-DrbxA7JJ.d.mts.map +1 -0
- package/dist/clis/args/list.d.mts +3 -2
- package/dist/clis/args/list.mjs +1 -1
- package/dist/clis/args/{login-DiKT5Jfu.mjs → login-CIFkQExi.mjs} +2 -2
- package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-CIFkQExi.mjs.map} +1 -1
- package/dist/clis/args/login-CXRJXg71.d.mts +25 -0
- package/dist/clis/args/login-CXRJXg71.d.mts.map +1 -0
- package/dist/clis/args/login.d.mts +3 -2
- package/dist/clis/args/login.mjs +1 -1
- package/dist/clis/args/migrate-DkCQRL2D.d.mts +19 -0
- package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +1 -0
- package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-DwJGhc2d.mjs} +2 -2
- package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-DwJGhc2d.mjs.map} +1 -1
- package/dist/clis/args/migrate.d.mts +3 -2
- package/dist/clis/args/migrate.mjs +1 -1
- package/dist/clis/args/publish-CeW4bOrl.d.mts +16 -0
- package/dist/clis/args/publish-CeW4bOrl.d.mts.map +1 -0
- package/dist/clis/args/{publish-DDZYsUfV.mjs → publish-DHqlGWmL.mjs} +2 -2
- package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish-DHqlGWmL.mjs.map} +1 -1
- package/dist/clis/args/publish.d.mts +3 -2
- package/dist/clis/args/publish.mjs +1 -1
- package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-DIwES3l2.mjs} +2 -2
- package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-DIwES3l2.mjs.map} +1 -1
- package/dist/clis/args/registry-DNH8xuaE.d.mts +17 -0
- package/dist/clis/args/registry-DNH8xuaE.d.mts.map +1 -0
- package/dist/clis/args/registry.d.mts +3 -2
- package/dist/clis/args/registry.mjs +1 -1
- package/dist/clis/args/run-CYp5t1xU.mjs +28 -0
- package/dist/clis/args/run-CYp5t1xU.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 +2 -0
- package/dist/clis/args/service-CHjY5epu.d.mts +27 -0
- package/dist/clis/args/service-CHjY5epu.d.mts.map +1 -0
- package/dist/clis/args/{service-CHOOr0Gg.mjs → service-Cpjlyeu5.mjs} +2 -2
- package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-Cpjlyeu5.mjs.map} +1 -1
- package/dist/clis/args/service.d.mts +3 -2
- package/dist/clis/args/service.mjs +1 -1
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-CCaAtU56.mjs} +2 -2
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-CCaAtU56.mjs.map} +1 -1
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts +70 -0
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +1 -0
- package/dist/clis/args/switchboard.d.mts +3 -2
- package/dist/clis/args/switchboard.mjs +1 -1
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-3U0B8g5c.mjs} +2 -2
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-3U0B8g5c.mjs.map} +1 -1
- package/dist/clis/args/uninstall-CDx7lwxn.d.mts +28 -0
- package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +1 -0
- package/dist/clis/args/uninstall.d.mts +3 -2
- package/dist/clis/args/uninstall.mjs +1 -1
- package/dist/clis/args/unpublish-CEDsk6uv.d.mts +22 -0
- package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +1 -0
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-s9zUh6Gw.mjs} +2 -2
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-s9zUh6Gw.mjs.map} +1 -1
- package/dist/clis/args/unpublish.d.mts +3 -2
- package/dist/clis/args/unpublish.mjs +1 -1
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-BUNlAAPp.mjs} +2 -2
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-BUNlAAPp.mjs.map} +1 -1
- package/dist/clis/args/vetra-DkDaWFPi.d.mts +111 -0
- package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +1 -0
- package/dist/clis/args/vetra-ports.test.d.mts +2 -1
- package/dist/clis/args/vetra-ports.test.mjs +7366 -5728
- package/dist/clis/args/vetra-ports.test.mjs.map +1 -1
- package/dist/clis/args/vetra.d.mts +3 -2
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/build-config-HbYUSZS1.mjs +252 -0
- package/dist/clis/build-config-HbYUSZS1.mjs.map +1 -0
- package/dist/clis/build-config.d.mts +52 -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 +2 -2
- package/dist/clis/command-names.d.mts.map +1 -1
- package/dist/clis/command-names.mjs +1 -0
- package/dist/clis/command-names.mjs.map +1 -1
- package/dist/clis/constants.d.mts +3 -462
- package/dist/clis/constants.mjs +43 -12
- 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-6CZwrmQi.d.mts +11154 -0
- package/dist/clis/index-6CZwrmQi.d.mts.map +1 -0
- package/dist/clis/index.d.mts +1448 -1225
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +665 -352
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/project-env.d.mts +4 -4
- package/dist/clis/project-env.d.mts.map +1 -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/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-DvsXtkR2.d.mts +582 -0
- package/dist/clis/types-DvsXtkR2.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-DBJolZd0.js} +43 -9
- package/dist/config-loader-DBJolZd0.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/index.d.ts +203 -57
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +318 -31
- 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/constants-DVJon33y.d.ts +9 -0
- package/dist/constants-DVJon33y.d.ts.map +1 -0
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +14 -5
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +131 -105
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +116 -54
- package/dist/document-drive/index.js.map +1 -1
- 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 +5 -4
- package/dist/document-model/index.js +296 -390
- package/dist/document-model/index.js.map +1 -1
- 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 +3 -2
- package/dist/document-model/utils.js +1 -1
- 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/index-bx0vYtFw.d.ts +36 -0
- package/dist/index-bx0vYtFw.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 +63 -4
- package/dist/processors/index.js.map +1 -1
- package/dist/purge-v06m_oGz.js +381 -0
- package/dist/purge-v06m_oGz.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 +24 -6
- 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/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
- package/dist/types-Bsp8VL2y.d.ts.map +1 -0
- package/dist/{types-YqLqb0Zb.d.ts → types-CfU91XFU.d.ts} +39 -43
- package/dist/types-CfU91XFU.d.ts.map +1 -0
- package/dist/{types-CpnWmiFY.d.ts → types-DzleLgA8.d.ts} +2038 -822
- package/dist/types-DzleLgA8.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/version-BxLITo9P.d.ts +6 -0
- package/dist/version-BxLITo9P.d.ts.map +1 -0
- package/package.json +15 -6
- 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/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.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/inspect-DtZeoA5c.d.mts +0 -15
- package/dist/clis/args/inspect-DtZeoA5c.d.mts.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/list-BGf8s_gj.d.mts +0 -12
- package/dist/clis/args/list-BGf8s_gj.d.mts.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/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-sixkWhxm.d.mts +0 -21
- package/dist/clis/args/migrate-sixkWhxm.d.mts.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_RfTsKB.d.mts +0 -19
- package/dist/clis/args/registry-C_RfTsKB.d.mts.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/uninstall-BpA3YYbw.d.mts +0 -31
- package/dist/clis/args/uninstall-BpA3YYbw.d.mts.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/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/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.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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
2
|
//#region document-model/mock.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Builds a mock value for a schema, with `overrides` taking precedence.
|
|
@@ -16,7 +15,7 @@ import { z } from "zod";
|
|
|
16
15
|
* override still throws, which is correct: there is no way to invent a value
|
|
17
16
|
* for it, and the caller needs to say what it should be.
|
|
18
17
|
*/
|
|
19
|
-
declare function generateMock<TSchema extends z.ZodType>(schema: TSchema, overrides?: Partial<z.infer<TSchema>>): z.infer<TSchema>;
|
|
18
|
+
export declare function generateMock<TSchema extends z.ZodType>(schema: TSchema, overrides?: Partial<z.infer<TSchema>>): z.infer<TSchema>;
|
|
20
19
|
//#endregion
|
|
21
|
-
export {
|
|
20
|
+
export {};
|
|
22
21
|
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","names":[],"sources":["../../document-model/mock.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock.d.ts","names":[],"sources":["../../document-model/mock.ts"],"mappings":";;;;;;;;;;;;;;;;;wBA0BgB,aAAa,gBAAgB,EAAE,SAC7C,QAAQ,SACR,YAAY,QAAQ,EAAE,MAAM,YAC3B,EAAE,MAAM"}
|
|
@@ -32,8 +32,9 @@ function generateMock(schema, overrides) {
|
|
|
32
32
|
};
|
|
33
33
|
const omittable = overriddenKeys.filter((key) => key in schema.shape);
|
|
34
34
|
const mask = Object.fromEntries(omittable.map((key) => [key, true]));
|
|
35
|
+
const schemaToGenerate = omittable.length ? schema.omit(mask) : schema;
|
|
35
36
|
return {
|
|
36
|
-
...zocker(
|
|
37
|
+
...zocker(schemaToGenerate).generate(),
|
|
37
38
|
...overrides
|
|
38
39
|
};
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.js","names":[],"sources":["../../document-model/mock.ts"],"sourcesContent":["import { zocker } from \"zocker\";\nimport { z } from \"zod\";\n\n/**\n * Narrows to an object schema whose shape we can omit keys from. Callers may\n * pass any `ZodType`, so this has to be checked rather than assumed.\n */\nfunction isObjectSchema(schema: z.ZodType): schema is z.ZodObject {\n return schema instanceof z.ZodObject;\n}\n\n/**\n * Builds a mock value for a schema, with `overrides` taking precedence.\n *\n * Overridden fields are removed from the schema *before* generation rather than\n * being overwritten afterwards. That ordering is what makes overrides usable as\n * an escape hatch: some scalars compile to `z.custom(...)` (`AttachmentRef`,\n * `Address`), and zocker cannot synthesise a value satisfying an arbitrary\n * predicate — it throws. Generating first meant the throw happened before the\n * caller's value was ever applied, so an override could not rescue the field it\n * was written for.\n *\n * Only the overridden keys are skipped. A `z.custom(...)` field with no\n * override still throws, which is correct: there is no way to invent a value\n * for it, and the caller needs to say what it should be.\n */\nexport function generateMock<TSchema extends z.ZodType>(\n schema: TSchema,\n overrides?: Partial<z.infer<TSchema>>,\n): z.infer<TSchema> {\n if (!overrides) return zocker(schema).generate() as z.infer<TSchema>;\n\n const overriddenKeys = Object.keys(overrides);\n if (overriddenKeys.length === 0 || !isObjectSchema(schema)) {\n // Nothing to skip, or a schema with no shape to omit from: generate the\n // whole value and let the overrides win by merge, as before.\n const generated = zocker(schema).generate() as z.infer<TSchema>;\n return { ...(generated as object), ...overrides } as z.infer<TSchema>;\n }\n\n // Omitting a key the shape does not have is an error in zod, and an override\n // for an unknown key should still pass through to the result.\n const omittable = overriddenKeys.filter((key) => key in schema.shape);\n // `omit` is typed against the shape's literal keys; ours are only known at\n // runtime, so the mask has to be asserted into that parameter type.\n const mask = Object.fromEntries(\n omittable.map((key) => [key, true]),\n ) as Parameters<typeof schema.omit>[0];\n const schemaToGenerate = omittable.length ? schema.omit(mask) : schema;\n\n const generated = zocker(schemaToGenerate).generate() as object;\n return { ...generated, ...overrides } as z.infer<TSchema>;\n}\n"],"mappings":";;;;;;;AAOA,SAAS,eAAe,QAA0C;
|
|
1
|
+
{"version":3,"file":"mock.js","names":[],"sources":["../../document-model/mock.ts"],"sourcesContent":["import { zocker } from \"zocker\";\nimport { z } from \"zod\";\n\n/**\n * Narrows to an object schema whose shape we can omit keys from. Callers may\n * pass any `ZodType`, so this has to be checked rather than assumed.\n */\nfunction isObjectSchema(schema: z.ZodType): schema is z.ZodObject {\n return schema instanceof z.ZodObject;\n}\n\n/**\n * Builds a mock value for a schema, with `overrides` taking precedence.\n *\n * Overridden fields are removed from the schema *before* generation rather than\n * being overwritten afterwards. That ordering is what makes overrides usable as\n * an escape hatch: some scalars compile to `z.custom(...)` (`AttachmentRef`,\n * `Address`), and zocker cannot synthesise a value satisfying an arbitrary\n * predicate — it throws. Generating first meant the throw happened before the\n * caller's value was ever applied, so an override could not rescue the field it\n * was written for.\n *\n * Only the overridden keys are skipped. A `z.custom(...)` field with no\n * override still throws, which is correct: there is no way to invent a value\n * for it, and the caller needs to say what it should be.\n */\nexport function generateMock<TSchema extends z.ZodType>(\n schema: TSchema,\n overrides?: Partial<z.infer<TSchema>>,\n): z.infer<TSchema> {\n if (!overrides) return zocker(schema).generate() as z.infer<TSchema>;\n\n const overriddenKeys = Object.keys(overrides);\n if (overriddenKeys.length === 0 || !isObjectSchema(schema)) {\n // Nothing to skip, or a schema with no shape to omit from: generate the\n // whole value and let the overrides win by merge, as before.\n const generated = zocker(schema).generate() as z.infer<TSchema>;\n return { ...(generated as object), ...overrides } as z.infer<TSchema>;\n }\n\n // Omitting a key the shape does not have is an error in zod, and an override\n // for an unknown key should still pass through to the result.\n const omittable = overriddenKeys.filter((key) => key in schema.shape);\n // `omit` is typed against the shape's literal keys; ours are only known at\n // runtime, so the mask has to be asserted into that parameter type.\n const mask = Object.fromEntries(\n omittable.map((key) => [key, true]),\n ) as Parameters<typeof schema.omit>[0];\n const schemaToGenerate = omittable.length ? schema.omit(mask) : schema;\n\n const generated = zocker(schemaToGenerate).generate() as object;\n return { ...generated, ...overrides } as z.infer<TSchema>;\n}\n"],"mappings":";;;;;;;AAOA,SAAS,eAAe,QAA0C;CAChE,OAAO,kBAAkB,EAAE;AAC7B;;;;;;;;;;;;;;;;AAiBA,SAAgB,aACd,QACA,WACkB;CAClB,IAAI,CAAC,WAAW,OAAO,OAAO,MAAM,CAAC,CAAC,SAAS;CAE/C,MAAM,iBAAiB,OAAO,KAAK,SAAS;CAC5C,IAAI,eAAe,WAAW,KAAK,CAAC,eAAe,MAAM,GAIvD,OAAO;EAAE,GADS,OAAO,MAAM,CAAC,CAAC,SACZ;EAAc,GAAG;CAAU;CAKlD,MAAM,YAAY,eAAe,QAAQ,QAAQ,OAAO,OAAO,KAAK;CAGpE,MAAM,OAAO,OAAO,YAClB,UAAU,KAAK,QAAQ,CAAC,KAAK,IAAI,CAAC,CACpC;CACA,MAAM,mBAAmB,UAAU,SAAS,OAAO,KAAK,IAAI,IAAI;CAGhE,OAAO;EAAE,GADS,OAAO,gBAAgB,CAAC,CAAC,SACvB;EAAG,GAAG;CAAU;AACtC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { n as generateId, r as generateMock, t as deriveOperationId } from "../utils-
|
|
2
|
-
export { deriveOperationId, generateId, generateMock };
|
|
1
|
+
import { n as generateId, r as generateMock, t as deriveOperationId } from "../utils-BrKxCmKx.js";
|
|
2
|
+
export { deriveOperationId, generateId, generateMock };
|
|
3
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as generateId, r as generateMock, t as deriveOperationId } from "../utils-
|
|
1
|
+
import { n as generateId, r as generateMock, t as deriveOperationId } from "../utils-CSF716ux.js";
|
|
2
2
|
export { deriveOperationId, generateId, generateMock };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../document-model/version.ts"],"sourcesContent":["// Documents stamped 0 or unversioned are version 1, as the registry assigns;\n// resolving 0 to \"latest\" would re-pin a legacy document to the newest module.\nexport function normalizeDocumentModelVersion(\n version: number | undefined | null,\n): number {\n return version && version > 0 ? version : 1;\n}\n"],"mappings":";AAEA,SAAgB,8BACd,SACQ;CACR,OAAO,WAAW,UAAU,IAAI,UAAU;AAC5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "./types-CfU91XFU.js";
|
|
2
|
+
import { SignaturePolicy } from "@powerhousedao/shared/document-model";
|
|
3
|
+
import { DocumentDriveLocalState, Node } from "@powerhousedao/shared/document-drive";
|
|
4
|
+
//#region document-drive/src/types.d.ts
|
|
5
|
+
type GenerateNodesCopySrc = {
|
|
6
|
+
srcId: Node["id"];
|
|
7
|
+
targetName?: Node["name"];
|
|
8
|
+
targetParentFolder?: Node["parentFolder"];
|
|
9
|
+
};
|
|
10
|
+
type GenerateNodesCopyIdGenerator = (nodeToCopy: Node) => Node["id"];
|
|
11
|
+
type DriveInput = {
|
|
12
|
+
global: {
|
|
13
|
+
name: string;
|
|
14
|
+
icon?: string | null;
|
|
15
|
+
};
|
|
16
|
+
id?: string;
|
|
17
|
+
slug?: string;
|
|
18
|
+
preferredEditor?: string;
|
|
19
|
+
local?: Partial<DocumentDriveLocalState>;
|
|
20
|
+
/** Merged over the drive's defaults; `signature: 2` makes it v2-required. */
|
|
21
|
+
protocolVersions?: {
|
|
22
|
+
[protocol: string]: number;
|
|
23
|
+
};
|
|
24
|
+
/** Overrides the client's creation default for this drive. */
|
|
25
|
+
signaturePolicy?: SignaturePolicy;
|
|
26
|
+
};
|
|
27
|
+
type SharingType = "LOCAL" | "CLOUD" | "PUBLIC";
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region git.d.ts
|
|
30
|
+
declare const GITHUB_REPO_URL = "https://github.com/powerhouse-inc/powerhouse";
|
|
31
|
+
declare function buildTreeUrl(sha: string): string | null;
|
|
32
|
+
declare function shortGitSha(sha: string): string;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { GenerateNodesCopyIdGenerator as a, DriveInput as i, buildTreeUrl as n, GenerateNodesCopySrc as o, shortGitSha as r, SharingType as s, GITHUB_REPO_URL as t };
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=index-bx0vYtFw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-bx0vYtFw.d.ts","names":[],"sources":["../document-drive/src/types.ts","../git.ts"],"mappings":";;;;KAMY;EACV,OAAO;EACP,aAAa;EACb,qBAAqB;;KAGX,gCAAgC,YAAY,SAAS;KAErD;EACV;IACE;IACA;;EAEF;EACA;EACA;EACA,QAAQ,QAAQ;;EAEhB;KAAsB;;;EAEtB,kBAAkB;;KAGR;;;cC7BC;iBAEG,aAAa;iBAKb,YAAY"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { a as AnalyticsSeriesInput, c as CompoundAnalyticsExpression, d as ConversionMetric, f as IAnalyticsStore, i as AnalyticsSeries, l as CompoundAnalyticsInputs, n as AnalyticsOperand, o as AnalyticsSeriesQuery, p as MultiCurrencyConversion, r as AnalyticsQuery, s as AnalyticsUpdateCallback, t as AnalyticsDimension, u as CompoundAnalyticsQuery } from "./types-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-
|
|
4
|
-
import { $ as LegacySynchronizationUnit, A as TriggerData, B as
|
|
5
|
-
import { n as buildTreeUrl, r as shortGitSha, t as GITHUB_REPO_URL } from "./index-
|
|
6
|
-
export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, ActionErrorCallback, ActionSignatureContext, ActionSigningHandler, ActionVerificationHandler, Actions, AddChangeLogItemAction, AddChangeLogItemInput, AddFileAction, AddFileInput, AddFolderAction, AddFolderInput, AddListenerAction, AddListenerInput, AddModuleAction, AddModuleInput, AddOperationAction, AddOperationErrorAction, AddOperationErrorInput, AddOperationExampleAction, AddOperationExampleInput, AddOperationInput, AddRelationshipAction, AddRelationshipActionInput, AddStateExampleAction, AddStateExampleInput, AddTriggerAction, AddTriggerInput, AnalyticsDimension, AnalyticsOperand, AnalyticsQuery, AnalyticsSeries, AnalyticsSeriesInput, AnalyticsSeriesQuery, AnalyticsUpdateCallback, AssertIsDocumentOfType, AssertIsStateOfType, Author, CLIS_DEPENDENCIES, CodeExample, CompoundAnalyticsExpression, CompoundAnalyticsInputs, CompoundAnalyticsQuery, ConfigEntry, ConfigEntryType, ConversionMetric, CopyChildDocumentInput, CopyChildDocumentSignal, CopyNodeAction, CopyNodeInput, CreateChildDocumentInput, CreateChildDocumentSignal, CreateDocument, CreateDocumentAction, CreateDocumentActionInput, CreateState, DeleteChangeLogItemAction, DeleteChangeLogItemInput, DeleteChildDocumentInput, DeleteChildDocumentSignal, DeleteDocumentAction, DeleteDocumentActionInput, DeleteModuleAction, DeleteModuleInput, DeleteNodeAction, DeleteNodeInput, DeleteOperationAction, DeleteOperationErrorAction, DeleteOperationErrorInput, DeleteOperationExampleAction, DeleteOperationExampleInput, DeleteOperationInput, DeleteStateExampleAction, DeleteStateExampleInput, DocumentAction, DocumentDriveAction, DocumentDriveDocument, DocumentDriveDriveAction, DocumentDriveDriveOperations, DocumentDriveGlobalState, DocumentDriveLocalState, DocumentDriveNodeAction, DocumentDriveNodeOperations, DocumentDrivePHState, DocumentModelAction, DocumentModelDocument, DocumentModelDocumentModelModule, DocumentModelGlobalState, DocumentModelHeaderAction, DocumentModelHeaderOperations, DocumentModelInput, DocumentModelLib, DocumentModelLocalState, DocumentModelModule, DocumentModelModuleAction, DocumentModelModuleOperations, DocumentModelOperationAction, DocumentModelOperationErrorAction, DocumentModelOperationErrorOperations, DocumentModelOperationExampleAction, DocumentModelOperationExampleOperations, DocumentModelOperationOperations, DocumentModelPHState, DocumentModelStateAction, DocumentModelStateOperations, DocumentModelUtils, DocumentModelVersioningAction, DocumentModelVersioningOperations, DocumentOperationsIgnoreMap, DocumentSpecification, DriveDocumentModelModule, DriveInput, DrivePreserveStrategies, DrivePreserveStrategy, ENSInfo, EditorDispatch, EditorModule, EditorProps, Exact, FileInput, FileNode, FolderNode, GITHUB_REPO_URL, GenerateNodesCopyIdGenerator, GenerateNodesCopySrc, GetDocumentOptions, IAction, IAnalyticsStore, ID, IDocument, IOperation, IProcessor, IProcessorDispatch, IProcessorHostModuleBase, IProcessorManager, ISignal, ISignalResult, ISigner, Incremental, InputMaybe, IsDocumentOfType, IsStateOfType, LegacyAddFileAction, LegacyAddFileInput, LegacySynchronizationUnit, Listener, ListenerCallInfo, ListenerCallInfoInput, ListenerFilter, ListenerFilterInput, ListenerInput, LoadFromFile, LoadFromInput, LoadStateAction, LoadStateActionInput, LoadStateActionStateInput, Load_State, LogLevel, LogLevels, MakeEmpty, MakeMaybe, MakeOptional, Manifest, MappedOperation, Maybe, MinimalBackupData, ModuleSpecification, MoveNodeAction, MoveNodeInput, MoveOperationAction, MoveOperationInput, MultiCurrencyConversion, Mutation, MutationAddChangeLogItemInputArgs, MutationAddModuleArgs, MutationAddOperationArgs, MutationAddOperationErrorArgs, MutationAddOperationExampleArgs, MutationAddStateExampleArgs, MutationDeleteChangeLogItemInputArgs, MutationDeleteModuleArgs, MutationDeleteOperationArgs, MutationDeleteOperationErrorArgs, MutationDeleteOperationExampleArgs, MutationDeleteStateExampleArgs, MutationLoadStateArgs, MutationMoveOperationArgs, MutationPruneArgs, MutationRedoArgs, MutationReorderChangeLogItemsInputArgs, MutationReorderModuleOperationsArgs, MutationReorderModulesArgs, MutationReorderOperationErrorsArgs, MutationReorderOperationExamplesArgs, MutationReorderStateExamplesArgs, MutationSetAuthorNameArgs, MutationSetAuthorWebsiteArgs, MutationSetInitialStateArgs, MutationSetModelDescriptionArgs, MutationSetModelExtensionArgs, MutationSetModelIdArgs, MutationSetModelNameArgs, MutationSetModuleDescriptionArgs, MutationSetModuleNameArgs, MutationSetNameArgs, MutationSetOperationDescriptionArgs, MutationSetOperationErrorCodeArgs, MutationSetOperationErrorDescriptionArgs, MutationSetOperationErrorNameArgs, MutationSetOperationErrorTemplateArgs, MutationSetOperationNameArgs, MutationSetOperationReducerArgs, MutationSetOperationSchemaArgs, MutationSetOperationTemplateArgs, MutationSetStateSchemaArgs, MutationUndoArgs, MutationUpdateChangeLogItemInputArgs, MutationUpdateOperationExampleArgs, MutationUpdateStateExampleArgs, NOOPAction, Node, OperationErrorSpecification, OperationIndex, OperationSpecification, OperationsByScope, PACKAGES_DEPENDENCIES, PHConnectAi, PHConnectApp, PHConnectBranding, PHConnectDefaultDrive, PHConnectDefaultDriveLocal, PHConnectDefaultDriveRemote, PHConnectDriveSection, PHConnectDriveSections, PHConnectDrives, PHConnectInstance, PHConnectPackages, PHConnectPwa, PHConnectPwaCacheStrategy, PHConnectPwaFileHandler, PHConnectPwaIcon, PHConnectPwaManifest, PHConnectPwaRuntimeCaching, PHConnectPwaUrlPattern, PHConnectReactor, PHConnectReactorFeatureFlags, PHConnectRenown, PHConnectRenownAdapters, PHConnectRuntimeConfig, PHConnectSentry, PHPackageProvider, PHReactorRenown, PHRenownPrivyAdapterConfig, PHRenownRainbowAdapterConfig, PackageInfo, PackageListItem, PackageManagerArgs, PackagePage, ParsedCmdResult, PartialRecord, PartialState, PathValidation, PhAiToolAnnotations, PhAiToolDescriptor, PowerhouseConfig, PowerhouseModule, PowerhousePackage, ProcessorApp, ProcessorApps, ProcessorDispatchResult, ProcessorFactory, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, ProcessorStatus, Prune, PruneAction, PruneActionInput, Publisher, PullResponderTriggerData, PullResponderTriggerDataInput, Query, Redo, RedoAction, RedoActionInput, Reducer, ReducerOptions, RegistryPackage, RegistryPackageList, RegistryPackageMap, RegistryPackageSource, RegistryPackageStatus, ReleaseNewVersionAction, RemoveListenerAction, RemoveListenerInput, RemoveRelationshipAction, RemoveRelationshipActionInput, RemoveTriggerAction, RemoveTriggerInput, ReorderChangeLogItemsAction, ReorderChangeLogItemsInput, ReorderModuleOperationsAction, ReorderModuleOperationsInput, ReorderModulesAction, ReorderModulesInput, ReorderOperationErrorsAction, ReorderOperationErrorsInput, ReorderOperationExamplesAction, ReorderOperationExamplesInput, ReorderStateExamplesAction, ReorderStateExamplesInput, ReplayDocumentOptions, RevisionsFilter, SaveToFile, SaveToFileHandle, Scalars, SchemaLoadStateAction, SchemaNOOPAction, SchemaPruneAction, SchemaRedoAction, SchemaSetNameAction, SchemaSetPreferredEditorAction, SchemaUndoAction, ScopeState, ServiceAction, ServiceActions, SetAuthorNameAction, SetAuthorNameInput, SetAuthorWebsiteAction, SetAuthorWebsiteInput, SetAvailableOfflineAction, SetAvailableOfflineInput, SetDriveIconAction, SetDriveIconInput, SetDriveNameAction, SetDriveNameInput, SetInitialStateAction, SetInitialStateInput, SetModelDescriptionAction, SetModelDescriptionInput, SetModelExtensionAction, SetModelExtensionInput, SetModelIdAction, SetModelIdInput, SetModelNameAction, SetModelNameInput, SetModuleDescriptionAction, SetModuleDescriptionInput, SetModuleNameAction, SetModuleNameInput, SetNameAction, SetNameActionInput, SetNameOperation, SetOperationDescriptionAction, SetOperationDescriptionInput, SetOperationErrorCodeAction, SetOperationErrorCodeInput, SetOperationErrorDescriptionAction, SetOperationErrorDescriptionInput, SetOperationErrorNameAction, SetOperationErrorNameInput, SetOperationErrorTemplateAction, SetOperationErrorTemplateInput, SetOperationNameAction, SetOperationNameInput, SetOperationReducerAction, SetOperationReducerInput, SetOperationSchemaAction, SetOperationSchemaInput, SetOperationScopeAction, SetOperationScopeInput, SetOperationTemplateAction, SetOperationTemplateInput, SetPreferredEditorAction, SetPreferredEditorActionInput, SetPreferredEditorOperation, SetSharingTypeAction, SetSharingTypeInput, SetStateSchemaAction, SetStateSchemaInput, Set_Name, Set_PreferredEditor, SharingType, Signal, SignalDispatch, SignalResult, SignalResults, SignalType, SignatureVerificationHandler, SigningParameters, SkipHeaderOperationIndex, SkipHeaderOperations, State, StateReducer, SubgraphModule, TrackedProcessor, TransmitterType, Trigger, TriggerData, TriggerInput, TriggerType, Undo, UndoAction, UndoActionInput, UndoRedoAction, UpdateChangeLogItemAction, UpdateChangeLogItemInput, UpdateFileAction, UpdateFileInput, UpdateNodeAction, UpdateNodeInput, UpdateOperationExampleAction, UpdateOperationExampleInput, UpdateRelationshipAction, UpdateRelationshipActionInput, UpdateStateExampleAction, UpdateStateExampleInput, UpgradeDocumentAction, UpgradeDocumentActionInput, User, ValidationError, buildTreeUrl, shortGitSha };
|
|
1
|
+
import { a as AnalyticsSeriesInput, c as CompoundAnalyticsExpression, d as ConversionMetric, f as IAnalyticsStore, i as AnalyticsSeries, l as CompoundAnalyticsInputs, n as AnalyticsOperand, o as AnalyticsSeriesQuery, p as MultiCurrencyConversion, r as AnalyticsQuery, s as AnalyticsUpdateCallback, t as AnalyticsDimension, u as CompoundAnalyticsQuery } from "./types-Bsp8VL2y.js";
|
|
2
|
+
import { $ as AddOperationAction, $i as SetOperationErrorNameInput, $n as MutationDeleteOperationExampleArgs, $r as ReleaseNewVersionAction, $t as DocumentModelOperationErrorAction, A as PHConnectSentry, Aa as SubgraphModule, Ai as SetInitialStateInput, An as LoadFromFile, Ar as MutationUpdateChangeLogItemInputArgs, At as DeleteModuleInput, B as PowerhousePackage, Ba as UpdateRelationshipActionInput, Bi as SetModuleDescriptionInput, Bn as MoveOperationAction, Br as PhAiToolAnnotations, Bt as DocumentModelAction, C as PHConnectPwaRuntimeCaching, Ca as SignalType, Ci as SchemaUndoAction, Cn as ISignal, Cr as MutationSetOperationErrorTemplateArgs, Ct as DeleteChangeLogItemAction, D as PHConnectRenown, Da as SkipHeaderOperations, Di as SetAuthorWebsiteAction, Dn as InputMaybe, Dr as MutationSetOperationTemplateArgs, Dt as DeleteDocumentAction, E as PHConnectReactorFeatureFlags, Ea as SkipHeaderOperationIndex, Ei as SetAuthorNameInput, En as Incremental, Er as MutationSetOperationSchemaArgs, Et as DeleteChildDocumentSignal, F as PHRenownRainbowAdapterConfig, Fa as UpdateChangeLogItemAction, Fi as SetModelIdAction, Fn as Manifest, Fr as OperationIndex, Ft as DeleteOperationExampleInput, G as ActionSignatureContext, Ga as User, Gi as SetNameOperation, Gn as MutationAddOperationArgs, Gr as PurgeDocumentAction, Gt as DocumentModelHeaderOperations, H as ServiceActions, Ha as UpdateStateExampleInput, Hi as SetModuleNameInput, Hn as Mutation, Hr as PieceModule, Ht as DocumentModelDocumentModelModule, I as PackageManagerArgs, Ia as UpdateChangeLogItemInput, Ii as SetModelIdInput, In as MappedOperation, Ir as OperationSpecification, It as DeleteOperationInput, J as Actions, Ji as SetOperationErrorCodeAction, Jn as MutationAddStateExampleArgs, Jr as Redo, Jt as DocumentModelLocalState, K as ActionSigningHandler, Ka as ValidationError, Ki as SetOperationDescriptionAction, Kn as MutationAddOperationErrorArgs, Kr as PurgeDocumentActionInput, Kt as DocumentModelInput, L as ParsedCmdResult, La as UpdateOperationExampleAction, Li as SetModelNameAction, Ln as Maybe, Lr as OperationsByScope, Lt as DeleteStateExampleAction, M as PHReactorClientMode, Ma as UndoAction, Mi as SetModelDescriptionInput, Mn as MakeEmpty, Mr as MutationUpdateStateExampleArgs, Mt as DeleteOperationErrorAction, N as PHReactorRenown, Na as UndoActionInput, Ni as SetModelExtensionAction, Nn as MakeMaybe, Nr as NOOPAction, Nt as DeleteOperationErrorInput, O as PHConnectRenownAdapters, Oa as State, Oi as SetAuthorWebsiteInput, On as IsDocumentOfType, Or as MutationSetStateSchemaArgs, Ot as DeleteDocumentActionInput, P as PHRenownPrivyAdapterConfig, Pa as UndoRedoAction, Pi as SetModelExtensionInput, Pn as MakeOptional, Pr as OperationErrorSpecification, Pt as DeleteOperationExampleAction, Q as AddModuleInput, Qi as SetOperationErrorNameAction, Qn as MutationDeleteOperationErrorArgs, Qr as ReducerOptions, Qt as DocumentModelOperationAction, R as PathValidation, Ra as UpdateOperationExampleInput, Ri as SetModelNameInput, Rn as MinimalBackupData, Rr as PartialRecord, Rt as DeleteStateExampleInput, S as PHConnectPwaManifest, Sa as SignalResults, Si as SchemaSetPreferredEditorAction, Sn as IOperation, Sr as MutationSetOperationErrorNameArgs, St as CreateState, T as PHConnectReactor, Ta as SigningParameters, Ti as SetAuthorNameAction, Tn as ISigner, Tr as MutationSetOperationReducerArgs, Tt as DeleteChildDocumentInput, Ua as UpgradeDocumentAction, Ui as SetNameAction, Un as MutationAddChangeLogItemInputArgs, Ur as PowerhouseModule, Ut as DocumentModelGlobalState, V as ServiceAction, Va as UpdateStateExampleAction, Vi as SetModuleNameAction, Vn as MoveOperationInput, Vr as PhAiToolDescriptor, Vt as DocumentModelDocument, W as ActionErrorCallback, Wa as UpgradeDocumentActionInput, Wi as SetNameActionInput, Wn as MutationAddModuleArgs, Wr as Publisher, Wt as DocumentModelHeaderAction, X as AddChangeLogItemInput, Xi as SetOperationErrorDescriptionAction, Xn as MutationDeleteModuleArgs, Xr as RedoActionInput, Xt as DocumentModelModuleAction, Y as AddChangeLogItemAction, Yi as SetOperationErrorCodeInput, Yn as MutationDeleteChangeLogItemInputArgs, Yr as RedoAction, Yt as DocumentModelModule, Z as AddModuleAction, Zi as SetOperationErrorDescriptionInput, Zn as MutationDeleteOperationArgs, Zr as Reducer, Zt as DocumentModelModuleOperations, _ as PHConnectPackages, _a as Set_Name, _i as SaveToFileHandle, _n as FileInput, _o as ProcessorFactoryBuilder, _r as MutationSetModuleNameArgs, _t as CreateChildDocumentInput, a as PHConnectAi, aa as SetOperationReducerInput, ai as ReorderModuleOperationsInput, an as DocumentModelStateAction, ar as MutationReorderModulesArgs, at as AddRelationshipAction, b as PHConnectPwaFileHandler, ba as SignalDispatch, bi as SchemaRedoAction, bn as ID, bo as ProcessorStatus, br as MutationSetOperationErrorCodeArgs, bt as CreateDocumentAction, c as PHConnectCompositionEntry, ca as SetOperationScopeAction, ci as ReorderOperationErrorsAction, cn as DocumentModelVersioningAction, cr as MutationReorderStateExamplesArgs, ct as AddStateExampleInput, d as PHConnectDefaultDriveRemote, da as SetOperationTemplateInput, di as ReorderOperationExamplesInput, dn as DocumentSpecification, do as IProcessorHostModuleBase, dr as MutationSetInitialStateArgs, dt as Author, ea as SetOperationErrorTemplateAction, ei as RemoveRelationshipAction, en as DocumentModelOperationErrorOperations, er as MutationDeleteStateExampleArgs, et as AddOperationErrorAction, f as PHConnectDriveSection, fa as SetPreferredEditorAction, fi as ReorderStateExamplesAction, fn as ENSInfo, fo as IProcessorManager, fr as MutationSetModelDescriptionArgs, ft as CodeExample, g as PHConnectOpenPanel, ga as SetStateSchemaInput, gi as SaveToFile, gn as Exact, go as ProcessorFactory, gr as MutationSetModuleDescriptionArgs, gt as CopyChildDocumentSignal, h as PHConnectInstance, ha as SetStateSchemaAction, hi as RevisionsFilter, hn as EditorProps, ho as ProcessorDispatchResult, hr as MutationSetModelNameArgs, ht as CopyChildDocumentInput, i as LogLevels, ia as SetOperationReducerAction, ii as ReorderModuleOperationsAction, in as DocumentModelPHState, ir as MutationReorderModuleOperationsArgs, it as AddOperationInput, j as PHPackageProvider, ja as Undo, ji as SetModelDescriptionAction, jn as LoadFromInput, jr as MutationUpdateOperationExampleArgs, jt as DeleteOperationAction, k as PHConnectRuntimeConfig, ka as StateReducer, ki as SetInitialStateAction, kn as IsStateOfType, kr as MutationUndoArgs, kt as DeleteModuleAction, l as PHConnectDefaultDrive, la as SetOperationScopeInput, li as ReorderOperationErrorsInput, ln as DocumentModelVersioningOperations, lo as IProcessor, lr as MutationSetAuthorNameArgs, lt as AssertIsDocumentOfType, m as PHConnectDrives, ma as SetPreferredEditorOperation, mi as ReplayDocumentOptions, mn as EditorModule, mo as ProcessorApps, mr as MutationSetModelIdArgs, mt as ConfigEntryType, n as DrivePreserveStrategy, na as SetOperationNameAction, ni as ReorderChangeLogItemsAction, nn as DocumentModelOperationExampleOperations, nr as MutationRedoArgs, nt as AddOperationExampleAction, o as PHConnectApp, oa as SetOperationSchemaAction, oi as ReorderModulesAction, on as DocumentModelStateOperations, or as MutationReorderOperationErrorsArgs, ot as AddRelationshipActionInput, p as PHConnectDriveSections, pa as SetPreferredEditorActionInput, pi as ReorderStateExamplesInput, pn as EditorDispatch, po as ProcessorApp, pr as MutationSetModelExtensionArgs, pt as ConfigEntry, q as ActionVerificationHandler, qi as SetOperationDescriptionInput, qn as MutationAddOperationExampleArgs, qr as Query, qt as DocumentModelLib, r as LogLevel, ra as SetOperationNameInput, ri as ReorderChangeLogItemsInput, rn as DocumentModelOperationOperations, rr as MutationReorderChangeLogItemsInputArgs, rt as AddOperationExampleInput, s as PHConnectBranding, sa as SetOperationSchemaInput, si as ReorderModulesInput, sn as DocumentModelUtils, sr as MutationReorderOperationExamplesArgs, st as AddStateExampleAction, t as DrivePreserveStrategies, ta as SetOperationErrorTemplateInput, ti as RemoveRelationshipActionInput, tn as DocumentModelOperationExampleAction, tr as MutationMoveOperationArgs, tt as AddOperationErrorInput, u as PHConnectDefaultDriveLocal, ua as SetOperationTemplateAction, ui as ReorderOperationExamplesAction, un as DocumentOperationsIgnoreMap, uo as IProcessorDispatch, ur as MutationSetAuthorWebsiteArgs, ut as AssertIsStateOfType, v as PHConnectPwa, va as Set_PreferredEditor, vi as Scalars, vn as GetDocumentOptions, vo as ProcessorFilter, vr as MutationSetNameArgs, vt as CreateChildDocumentSignal, w as PHConnectPwaUrlPattern, wa as SignatureVerificationHandler, wi as ScopeState, wn as ISignalResult, wr as MutationSetOperationNameArgs, wt as DeleteChangeLogItemInput, x as PHConnectPwaIcon, xa as SignalResult, xi as SchemaSetNameAction, xn as IDocument, xo as TrackedProcessor, xr as MutationSetOperationErrorDescriptionArgs, xt as CreateDocumentActionInput, y as PHConnectPwaCacheStrategy, ya as Signal, yi as SchemaNOOPAction, yn as IAction, yo as ProcessorRecord, yr as MutationSetOperationDescriptionArgs, yt as CreateDocument, z as PowerhouseConfig, za as UpdateRelationshipAction, zi as SetModuleDescriptionAction, zn as ModuleSpecification, zr as PartialState, zt as DocumentAction } from "./types-DzleLgA8.js";
|
|
3
|
+
import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-DVJon33y.js";
|
|
4
|
+
import { $ as LegacySynchronizationUnit, A as TriggerData, B as PackagePage, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, F as PACKAGE_MODULE_TYPES, G as RegistryPackageSource, H as RegistryPackage, I as PackageFacets, J as DriveDocumentModelModule, K as RegistryPackageStatus, L as PackageInfo, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as LegacyAddFileInput, R as PackageListItem, S as RemoveListenerInput, T as SetDriveIconInput, U as RegistryPackageList, V as Page, W as RegistryPackageMap, X as DocumentDriveDocument, Y as DocumentDriveAction, Z as LegacyAddFileAction, _ as ListenerInput, _t as SetDriveNameAction, a as CopyNodeInput, at as DocumentDriveNodeOperations, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as UpdateNodeAction, d as FolderNode, dt as DocumentDriveDriveAction, et as AddFileAction, f as Listener, ft as DocumentDriveDriveOperations, g as ListenerFilterInput, gt as SetDriveIconAction, h as ListenerFilter, ht as SetAvailableOfflineAction, i as AddTriggerInput, it as DocumentDriveNodeAction, j as TriggerInput, k as Trigger, lt as AddListenerAction, m as ListenerCallInfoInput, mt as RemoveTriggerAction, n as AddFolderInput, nt as CopyNodeAction, o as DeleteNodeInput, ot as MoveNodeAction, p as ListenerCallInfo, pt as RemoveListenerAction, q as DocumentDrivePHState, r as AddListenerInput, rt as DeleteNodeAction, s as DocumentDriveGlobalState, st as UpdateFileAction, t as AddFileInput, tt as AddFolderAction, u as FileNode, ut as AddTriggerAction, v as MoveNodeInput, vt as SetSharingTypeAction, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node, z as PackageModuleType } from "./types-CfU91XFU.js";
|
|
5
|
+
import { a as GenerateNodesCopyIdGenerator, i as DriveInput, n as buildTreeUrl, o as GenerateNodesCopySrc, r as shortGitSha, s as SharingType, t as GITHUB_REPO_URL } from "./index-bx0vYtFw.js";
|
|
6
|
+
export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, type ActionErrorCallback, type ActionSignatureContext, type ActionSigningHandler, type ActionVerificationHandler, type Actions, type AddChangeLogItemAction, type AddChangeLogItemInput, type AddFileAction, type AddFileInput, type AddFolderAction, type AddFolderInput, type AddListenerAction, type AddListenerInput, type AddModuleAction, type AddModuleInput, type AddOperationAction, type AddOperationErrorAction, type AddOperationErrorInput, type AddOperationExampleAction, type AddOperationExampleInput, type AddOperationInput, type AddRelationshipAction, type AddRelationshipActionInput, type AddStateExampleAction, type AddStateExampleInput, type AddTriggerAction, type AddTriggerInput, type AnalyticsDimension, type AnalyticsOperand, type AnalyticsQuery, type AnalyticsSeries, type AnalyticsSeriesInput, type AnalyticsSeriesQuery, type AnalyticsUpdateCallback, type AssertIsDocumentOfType, type AssertIsStateOfType, type Author, CLIS_DEPENDENCIES, type CodeExample, type CompoundAnalyticsExpression, type CompoundAnalyticsInputs, type CompoundAnalyticsQuery, type ConfigEntry, type ConfigEntryType, type ConversionMetric, type CopyChildDocumentInput, type CopyChildDocumentSignal, type CopyNodeAction, type CopyNodeInput, type CreateChildDocumentInput, type CreateChildDocumentSignal, type CreateDocument, type CreateDocumentAction, type CreateDocumentActionInput, type CreateState, type DeleteChangeLogItemAction, type DeleteChangeLogItemInput, type DeleteChildDocumentInput, type DeleteChildDocumentSignal, type DeleteDocumentAction, type DeleteDocumentActionInput, type DeleteModuleAction, type DeleteModuleInput, type DeleteNodeAction, type DeleteNodeInput, type DeleteOperationAction, type DeleteOperationErrorAction, type DeleteOperationErrorInput, type DeleteOperationExampleAction, type DeleteOperationExampleInput, type DeleteOperationInput, type DeleteStateExampleAction, type DeleteStateExampleInput, type DocumentAction, type DocumentDriveAction, type DocumentDriveDocument, type DocumentDriveDriveAction, type DocumentDriveDriveOperations, type DocumentDriveGlobalState, type DocumentDriveLocalState, type DocumentDriveNodeAction, type DocumentDriveNodeOperations, type DocumentDrivePHState, type DocumentModelAction, type DocumentModelDocument, type DocumentModelDocumentModelModule, type DocumentModelGlobalState, type DocumentModelHeaderAction, type DocumentModelHeaderOperations, type DocumentModelInput, type DocumentModelLib, type DocumentModelLocalState, type DocumentModelModule, type DocumentModelModuleAction, type DocumentModelModuleOperations, type DocumentModelOperationAction, type DocumentModelOperationErrorAction, type DocumentModelOperationErrorOperations, type DocumentModelOperationExampleAction, type DocumentModelOperationExampleOperations, type DocumentModelOperationOperations, type DocumentModelPHState, type DocumentModelStateAction, type DocumentModelStateOperations, type DocumentModelUtils, type DocumentModelVersioningAction, type DocumentModelVersioningOperations, type DocumentOperationsIgnoreMap, type DocumentSpecification, type DriveDocumentModelModule, type DriveInput, type DrivePreserveStrategies, type DrivePreserveStrategy, type ENSInfo, type EditorDispatch, type EditorModule, type EditorProps, type Exact, type FileInput, type FileNode, type FolderNode, GITHUB_REPO_URL, type GenerateNodesCopyIdGenerator, type GenerateNodesCopySrc, type GetDocumentOptions, type IAction, type IAnalyticsStore, type ID, type IDocument, type IOperation, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, type ISignal, type ISignalResult, type ISigner, type Incremental, type InputMaybe, type IsDocumentOfType, type IsStateOfType, type LegacyAddFileAction, type LegacyAddFileInput, type LegacySynchronizationUnit, type Listener, type ListenerCallInfo, type ListenerCallInfoInput, type ListenerFilter, type ListenerFilterInput, type ListenerInput, type LoadFromFile, type LoadFromInput, type LogLevel, type LogLevels, type MakeEmpty, type MakeMaybe, type MakeOptional, type Manifest, type MappedOperation, type Maybe, type MinimalBackupData, type ModuleSpecification, type MoveNodeAction, type MoveNodeInput, type MoveOperationAction, type MoveOperationInput, type MultiCurrencyConversion, type Mutation, type MutationAddChangeLogItemInputArgs, type MutationAddModuleArgs, type MutationAddOperationArgs, type MutationAddOperationErrorArgs, type MutationAddOperationExampleArgs, type MutationAddStateExampleArgs, type MutationDeleteChangeLogItemInputArgs, type MutationDeleteModuleArgs, type MutationDeleteOperationArgs, type MutationDeleteOperationErrorArgs, type MutationDeleteOperationExampleArgs, type MutationDeleteStateExampleArgs, type MutationMoveOperationArgs, type MutationRedoArgs, type MutationReorderChangeLogItemsInputArgs, type MutationReorderModuleOperationsArgs, type MutationReorderModulesArgs, type MutationReorderOperationErrorsArgs, type MutationReorderOperationExamplesArgs, type MutationReorderStateExamplesArgs, type MutationSetAuthorNameArgs, type MutationSetAuthorWebsiteArgs, type MutationSetInitialStateArgs, type MutationSetModelDescriptionArgs, type MutationSetModelExtensionArgs, type MutationSetModelIdArgs, type MutationSetModelNameArgs, type MutationSetModuleDescriptionArgs, type MutationSetModuleNameArgs, type MutationSetNameArgs, type MutationSetOperationDescriptionArgs, type MutationSetOperationErrorCodeArgs, type MutationSetOperationErrorDescriptionArgs, type MutationSetOperationErrorNameArgs, type MutationSetOperationErrorTemplateArgs, type MutationSetOperationNameArgs, type MutationSetOperationReducerArgs, type MutationSetOperationSchemaArgs, type MutationSetOperationTemplateArgs, type MutationSetStateSchemaArgs, type MutationUndoArgs, type MutationUpdateChangeLogItemInputArgs, type MutationUpdateOperationExampleArgs, type MutationUpdateStateExampleArgs, type NOOPAction, type Node, type OperationErrorSpecification, type OperationIndex, type OperationSpecification, type OperationsByScope, PACKAGES_DEPENDENCIES, type PACKAGE_MODULE_TYPES, type PHConnectAi, type PHConnectApp, type PHConnectBranding, type PHConnectCompositionEntry, type PHConnectDefaultDrive, type PHConnectDefaultDriveLocal, type PHConnectDefaultDriveRemote, type PHConnectDriveSection, type PHConnectDriveSections, type PHConnectDrives, type PHConnectInstance, type PHConnectOpenPanel, type PHConnectPackages, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, type PHConnectReactor, type PHConnectReactorFeatureFlags, type PHConnectRenown, type PHConnectRenownAdapters, type PHConnectRuntimeConfig, type PHConnectSentry, type PHPackageProvider, type PHReactorClientMode, type PHReactorRenown, type PHRenownPrivyAdapterConfig, type PHRenownRainbowAdapterConfig, type PackageFacets, type PackageInfo, type PackageListItem, type PackageManagerArgs, type PackageModuleType, type PackagePage, type Page, type ParsedCmdResult, type PartialRecord, type PartialState, type PathValidation, type PhAiToolAnnotations, type PhAiToolDescriptor, type PieceModule, type PowerhouseConfig, type PowerhouseModule, type PowerhousePackage, type ProcessorApp, type ProcessorApps, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorRecord, type ProcessorStatus, type Publisher, type PullResponderTriggerData, type PullResponderTriggerDataInput, type PurgeDocumentAction, type PurgeDocumentActionInput, type Query, type Redo, type RedoAction, type RedoActionInput, type Reducer, type ReducerOptions, type RegistryPackage, type RegistryPackageList, type RegistryPackageMap, type RegistryPackageSource, type RegistryPackageStatus, type ReleaseNewVersionAction, type RemoveListenerAction, type RemoveListenerInput, type RemoveRelationshipAction, type RemoveRelationshipActionInput, type RemoveTriggerAction, type RemoveTriggerInput, type ReorderChangeLogItemsAction, type ReorderChangeLogItemsInput, type ReorderModuleOperationsAction, type ReorderModuleOperationsInput, type ReorderModulesAction, type ReorderModulesInput, type ReorderOperationErrorsAction, type ReorderOperationErrorsInput, type ReorderOperationExamplesAction, type ReorderOperationExamplesInput, type ReorderStateExamplesAction, type ReorderStateExamplesInput, type ReplayDocumentOptions, type RevisionsFilter, type SaveToFile, type SaveToFileHandle, type Scalars, type SchemaNOOPAction, type SchemaRedoAction, type SchemaSetNameAction, type SchemaSetPreferredEditorAction, type SchemaUndoAction, type ScopeState, type ServiceAction, type ServiceActions, type SetAuthorNameAction, type SetAuthorNameInput, type SetAuthorWebsiteAction, type SetAuthorWebsiteInput, type SetAvailableOfflineAction, type SetAvailableOfflineInput, type SetDriveIconAction, type SetDriveIconInput, type SetDriveNameAction, type SetDriveNameInput, type SetInitialStateAction, type SetInitialStateInput, type SetModelDescriptionAction, type SetModelDescriptionInput, type SetModelExtensionAction, type SetModelExtensionInput, type SetModelIdAction, type SetModelIdInput, type SetModelNameAction, type SetModelNameInput, type SetModuleDescriptionAction, type SetModuleDescriptionInput, type SetModuleNameAction, type SetModuleNameInput, type SetNameAction, type SetNameActionInput, type SetNameOperation, type SetOperationDescriptionAction, type SetOperationDescriptionInput, type SetOperationErrorCodeAction, type SetOperationErrorCodeInput, type SetOperationErrorDescriptionAction, type SetOperationErrorDescriptionInput, type SetOperationErrorNameAction, type SetOperationErrorNameInput, type SetOperationErrorTemplateAction, type SetOperationErrorTemplateInput, type SetOperationNameAction, type SetOperationNameInput, type SetOperationReducerAction, type SetOperationReducerInput, type SetOperationSchemaAction, type SetOperationSchemaInput, type SetOperationScopeAction, type SetOperationScopeInput, type SetOperationTemplateAction, type SetOperationTemplateInput, type SetPreferredEditorAction, type SetPreferredEditorActionInput, type SetPreferredEditorOperation, type SetSharingTypeAction, type SetSharingTypeInput, type SetStateSchemaAction, type SetStateSchemaInput, type Set_Name, type Set_PreferredEditor, type SharingType, type Signal, type SignalDispatch, type SignalResult, type SignalResults, type SignalType, type SignatureVerificationHandler, type SigningParameters, type SkipHeaderOperationIndex, type SkipHeaderOperations, type State, type StateReducer, type SubgraphModule, type TrackedProcessor, type TransmitterType, type Trigger, type TriggerData, type TriggerInput, type TriggerType, type Undo, type UndoAction, type UndoActionInput, type UndoRedoAction, type UpdateChangeLogItemAction, type UpdateChangeLogItemInput, type UpdateFileAction, type UpdateFileInput, type UpdateNodeAction, type UpdateNodeInput, type UpdateOperationExampleAction, type UpdateOperationExampleInput, type UpdateRelationshipAction, type UpdateRelationshipActionInput, type UpdateStateExampleAction, type UpdateStateExampleInput, type UpgradeDocumentAction, type UpgradeDocumentActionInput, type User, type ValidationError, buildTreeUrl, shortGitSha };
|
|
7
|
+
export {};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../git.ts"],"sourcesContent":["export const GITHUB_REPO_URL = \"https://github.com/powerhouse-inc/powerhouse\";\n\nexport function buildTreeUrl(sha: string): string | null {\n if (!sha || sha === \"unknown\") return null;\n return `${GITHUB_REPO_URL}/tree/${sha}`;\n}\n\nexport function shortGitSha(sha: string): string {\n return sha === \"unknown\" ? sha : sha.slice(0, 7);\n}\n"],"mappings":";;AAAA,MAAa,kBAAkB;AAE/B,SAAgB,aAAa,KAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../git.ts"],"sourcesContent":["export const GITHUB_REPO_URL = \"https://github.com/powerhouse-inc/powerhouse\";\n\nexport function buildTreeUrl(sha: string): string | null {\n if (!sha || sha === \"unknown\") return null;\n return `${GITHUB_REPO_URL}/tree/${sha}`;\n}\n\nexport function shortGitSha(sha: string): string {\n return sha === \"unknown\" ? sha : sha.slice(0, 7);\n}\n"],"mappings":";;AAAA,MAAa,kBAAkB;AAE/B,SAAgB,aAAa,KAA4B;CACvD,IAAI,CAAC,OAAO,QAAQ,WAAW,OAAO;CACtC,OAAO,GAAG,gBAAgB,QAAQ;AACpC;AAEA,SAAgB,YAAY,KAAqB;CAC/C,OAAO,QAAQ,YAAY,MAAM,IAAI,MAAM,GAAG,CAAC;AACjD"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
export { AuthorizerResult, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, ExtractProcessorSchemaOrSelf, HashAlgorithms, IBaseRelationalDb, IHttpScope, IProcessor, IProcessorDispatch, IProcessorHostModuleBase, IProcessorManager, IRelationalDb, IRelationalDbProcessor, IRelationalQueryBuilder, IRelationalQueryMethods, IWebhookEndpoints, IWebhookScope, NodeRouteSpec, PROCESSOR_APPS, ProcessorApp, ProcessorApps, ProcessorDispatchResult, ProcessorFactory, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, ProcessorStatus, RelationalDbProcessor, RelationalDbProcessorClass, RouteActor, RouteAuth, RouteAuthorizer, RouteBody, RouteContext, RouteHandler, RouteMethod, RouteOptions, RouteSpec, RouteTransport, RouteUser, ScopedRouteHandle, TrackedProcessor, WebhookEndpointInfo, WebhookField, WebhookHashAlgorithm, WebhookPolicy, WebhookReply, WebhookRequest, WebhookScheme, WebhookSignatureEncoding, WebhookSpec, WebhookVerification, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, hashNamespace, relationalDbToQueryBuilder };
|
|
1
|
+
import { $a as DOCUMENT_ID_COLUMNS, Ao as RouteBody, Bo as WebhookField, Co as IHttpScope, Do as RouteActor, Eh as PROCESSOR_APPS, Eo as NodeRouteSpec, Fo as RouteSpec, Go as WebhookScheme, Ho as WebhookPolicy, Io as RouteTransport, Ja as createNamespacedQueryBuilder, Jo as WebhookVerification, Ko as WebhookSignatureEncoding, Lo as RouteUser, Mo as RouteHandler, No as RouteMethod, Oo as RouteAuth, Po as RouteOptions, Qa as relationalDbToQueryBuilder, Ro as ScopedRouteHandle, So as AuthorizerResult, Th as DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, To as IWebhookScope, Uo as WebhookReply, Vo as WebhookHashAlgorithm, Wo as WebhookRequest, Xa as hashNamespace, Ya as createRelationalDb, Yo as deletedDocumentId, Za as namespaceSchemaOf, _o as ProcessorFactoryBuilder, ao as IRelationalQueryBuilder, bo as ProcessorStatus, co as RelationalDbProcessorClass, do as IProcessorHostModuleBase, eo as ExtractProcessorSchemaOrSelf, fo as IProcessorManager, go as ProcessorFactory, ho as ProcessorDispatchResult, io as IRelationalDbProcessor, jo as RouteContext, ko as RouteAuthorizer, lo as IProcessor, mo as ProcessorApps, no as IBaseRelationalDb, oo as IRelationalQueryMethods, po as ProcessorApp, qa as createNamespacedDb, qo as WebhookSpec, ro as IRelationalDb, so as RelationalDbProcessor, to as HashAlgorithms, uo as IProcessorDispatch, vo as ProcessorFilter, wh as DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, wo as IWebhookEndpoints, xo as TrackedProcessor, yo as ProcessorRecord, zo as WebhookEndpointInfo } from "../types-DzleLgA8.js";
|
|
2
|
+
export { type AuthorizerResult, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, DOCUMENT_ID_COLUMNS, ExtractProcessorSchemaOrSelf, HashAlgorithms, IBaseRelationalDb, type IHttpScope, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, IRelationalDb, IRelationalDbProcessor, IRelationalQueryBuilder, IRelationalQueryMethods, type IWebhookEndpoints, type IWebhookScope, type NodeRouteSpec, PROCESSOR_APPS, type ProcessorApp, type ProcessorApps, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorRecord, type ProcessorStatus, RelationalDbProcessor, RelationalDbProcessorClass, type RouteActor, type RouteAuth, type RouteAuthorizer, type RouteBody, type RouteContext, type RouteHandler, type RouteMethod, type RouteOptions, type RouteSpec, type RouteTransport, type RouteUser, type ScopedRouteHandle, type TrackedProcessor, type WebhookEndpointInfo, type WebhookField, type WebhookHashAlgorithm, type WebhookPolicy, type WebhookReply, type WebhookRequest, type WebhookScheme, type WebhookSignatureEncoding, type WebhookSpec, type WebhookVerification, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, deletedDocumentId, hashNamespace, namespaceSchemaOf, relationalDbToQueryBuilder };
|
|
3
|
+
export {};
|
package/dist/processors/index.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import "../purge-v06m_oGz.js";
|
|
2
|
+
import { sql } from "kysely";
|
|
1
3
|
import fnv1a from "@sindresorhus/fnv1a";
|
|
2
4
|
//#region processors/constants.ts
|
|
3
5
|
const PROCESSOR_APPS = ["connect", "switchboard"];
|
|
4
6
|
const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = "relational-db";
|
|
5
7
|
const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = "analytics-db";
|
|
6
8
|
//#endregion
|
|
9
|
+
//#region processors/deletion.ts
|
|
10
|
+
/** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */
|
|
11
|
+
function deletedDocumentId(op) {
|
|
12
|
+
const { type, input } = op.operation.action;
|
|
13
|
+
if (type !== "DELETE_DOCUMENT" && type !== "PURGE_DOCUMENT") return void 0;
|
|
14
|
+
const documentId = input?.documentId;
|
|
15
|
+
return typeof documentId === "string" ? documentId : op.context.documentId;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
7
18
|
//#region processors/relational/utils.ts
|
|
8
19
|
const SUPPORTED_SIZES = [
|
|
9
20
|
32,
|
|
@@ -23,7 +34,8 @@ const LOG2_26 = Math.log2(26);
|
|
|
23
34
|
*/
|
|
24
35
|
function hashNamespace(str, length = 10) {
|
|
25
36
|
const requiredBits = Math.ceil(length * LOG2_26);
|
|
26
|
-
|
|
37
|
+
const bitSize = SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024;
|
|
38
|
+
return toBase26(fnv1a(str, { size: bitSize }), length);
|
|
27
39
|
}
|
|
28
40
|
function toBase26(num, length = 10) {
|
|
29
41
|
const alphabet = "abcdefghijklmnopqrstuvwxyz";
|
|
@@ -49,7 +61,14 @@ function createRelationalDb(baseDb, baseOptions) {
|
|
|
49
61
|
async function createNamespacedDb(db, namespace, options) {
|
|
50
62
|
const hashValue = options?.hashNamespace ?? true ? hashNamespace(namespace) : namespace;
|
|
51
63
|
await db.schema.createSchema(hashValue).ifNotExists().execute();
|
|
52
|
-
|
|
64
|
+
const schemaRelationalDb = db.withSchema(hashValue);
|
|
65
|
+
Object.defineProperty(schemaRelationalDb, NAMESPACE_SCHEMA, { value: hashValue });
|
|
66
|
+
return schemaRelationalDb;
|
|
67
|
+
}
|
|
68
|
+
const NAMESPACE_SCHEMA = Symbol.for("ph.relational.namespaceSchema");
|
|
69
|
+
/** The schema behind a handle from `createNamespace`; undefined otherwise. */
|
|
70
|
+
function namespaceSchemaOf(db) {
|
|
71
|
+
return db[NAMESPACE_SCHEMA];
|
|
53
72
|
}
|
|
54
73
|
function createNamespacedQueryBuilder(db, namespace, options) {
|
|
55
74
|
const hashValue = options?.hashNamespace ?? true ? hashNamespace(namespace) : namespace;
|
|
@@ -71,6 +90,8 @@ function relationalDbToQueryBuilder(query) {
|
|
|
71
90
|
}
|
|
72
91
|
//#endregion
|
|
73
92
|
//#region processors/relational/types.ts
|
|
93
|
+
/** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */
|
|
94
|
+
const DOCUMENT_ID_COLUMNS = ["document_id", "documentId"];
|
|
74
95
|
const IS_RELATIONAL_DB_PROCESSOR = Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");
|
|
75
96
|
/**
|
|
76
97
|
* Base class for relational db processors that require a relational database storage.
|
|
@@ -78,10 +99,15 @@ const IS_RELATIONAL_DB_PROCESSOR = Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");
|
|
|
78
99
|
* allowing derived classes to focus on business logic.
|
|
79
100
|
*/
|
|
80
101
|
var RelationalDbProcessor = class {
|
|
81
|
-
|
|
102
|
+
_namespace;
|
|
103
|
+
_filter;
|
|
104
|
+
relationalDb;
|
|
105
|
+
_driveId;
|
|
106
|
+
constructor(_namespace, _filter, relationalDb, _driveId) {
|
|
82
107
|
this._namespace = _namespace;
|
|
83
108
|
this._filter = _filter;
|
|
84
109
|
this.relationalDb = relationalDb;
|
|
110
|
+
this._driveId = _driveId;
|
|
85
111
|
}
|
|
86
112
|
static [IS_RELATIONAL_DB_PROCESSOR] = true;
|
|
87
113
|
/**
|
|
@@ -110,8 +136,41 @@ var RelationalDbProcessor = class {
|
|
|
110
136
|
get query() {
|
|
111
137
|
return relationalDbToQueryBuilder(this.relationalDb);
|
|
112
138
|
}
|
|
139
|
+
/** True for this processor's drive when its namespace is that drive's alone. */
|
|
140
|
+
isNamespaceDrive(documentId) {
|
|
141
|
+
const driveId = this._driveId;
|
|
142
|
+
if (driveId === void 0 || documentId !== driveId) return false;
|
|
143
|
+
const processorClass = this.constructor;
|
|
144
|
+
if (processorClass.getNamespace(driveId) !== this._namespace) return false;
|
|
145
|
+
return processorClass.getNamespace(`${driveId}-other`) !== this._namespace;
|
|
146
|
+
}
|
|
147
|
+
/** Deletes a document's rows from every table with a document-id column. */
|
|
148
|
+
async deleteDocumentRows(documentId) {
|
|
149
|
+
const schema = this.namespaceSchema();
|
|
150
|
+
const columns = await sql`
|
|
151
|
+
select c.table_name, c.column_name
|
|
152
|
+
from information_schema.columns c
|
|
153
|
+
join information_schema.tables t
|
|
154
|
+
on t.table_schema = c.table_schema and t.table_name = c.table_name
|
|
155
|
+
where c.table_schema = ${schema}
|
|
156
|
+
and t.table_type = 'BASE TABLE'
|
|
157
|
+
and c.column_name in (${sql.join([...DOCUMENT_ID_COLUMNS])})
|
|
158
|
+
order by c.table_name, c.column_name
|
|
159
|
+
`.execute(this.relationalDb);
|
|
160
|
+
const db = this.relationalDb;
|
|
161
|
+
for (const { table_name, column_name } of columns.rows) await db.deleteFrom(table_name).where(column_name, "=", documentId).execute();
|
|
162
|
+
}
|
|
163
|
+
/** Drops this processor's namespace and every table in it. */
|
|
164
|
+
async dropNamespace() {
|
|
165
|
+
await this.relationalDb.schema.dropSchema(this.namespaceSchema()).ifExists().cascade().execute();
|
|
166
|
+
}
|
|
167
|
+
namespaceSchema() {
|
|
168
|
+
const schema = namespaceSchemaOf(this.relationalDb);
|
|
169
|
+
if (schema === void 0) throw new Error(`Namespace '${this._namespace}' was not opened with createNamespace`);
|
|
170
|
+
return schema;
|
|
171
|
+
}
|
|
113
172
|
};
|
|
114
173
|
//#endregion
|
|
115
|
-
export { DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, PROCESSOR_APPS, RelationalDbProcessor, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, hashNamespace, relationalDbToQueryBuilder };
|
|
174
|
+
export { DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, DOCUMENT_ID_COLUMNS, PROCESSOR_APPS, RelationalDbProcessor, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, deletedDocumentId, hashNamespace, namespaceSchemaOf, relationalDbToQueryBuilder };
|
|
116
175
|
|
|
117
176
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../processors/constants.ts","../../processors/relational/utils.ts","../../processors/relational/types.ts"],"sourcesContent":["export const PROCESSOR_APPS = [\"connect\", \"switchboard\"] as const;\nexport const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = \"relational-db\";\nexport const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = \"analytics-db\";\n","import type { Options } from \"@sindresorhus/fnv1a\";\nimport fnv1a from \"@sindresorhus/fnv1a\";\nimport type {\n IBaseRelationalDb,\n IRelationalDb,\n IRelationalQueryBuilder,\n} from \"./types.js\";\n\nconst SUPPORTED_SIZES: Options[\"size\"][] = [32, 64, 128, 256, 512, 1024];\nconst LOG2_26 = Math.log2(26); //\n/**\n * Hashes a string to a lowercase base-26 string.\n * @param str The string to hash.\n * @param length The length of the hash. Defaults to 10.\n * @param algorithm The hashing algorithm to use. Defaults to \"fnv1a\".\n * @returns The hashed string.\n */\nexport function hashNamespace(str: string, length = 10) {\n const requiredBits = Math.ceil(length * LOG2_26);\n const bitSize =\n SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024;\n const hash = fnv1a(str, { size: bitSize });\n return toBase26(hash, length);\n}\n\n// converts hash to lowercase letters\nfunction toBase26(num: bigint, length = 10): string {\n const alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n let out = \"\";\n while (num > 0n && out.length < length) {\n out = alphabet[Number(num % 26n)] + out;\n num /= 26n;\n }\n return out.padStart(length, \"a\"); // optional padding\n}\n\n/**\n * Creates a RelationalDb instance with namespace support.\n * @param baseDb The base RelationalDb instance to enhance.\n * @param baseOptions The default options for namespace creation. Hashes namespace by default.\n * @returns The enhanced RelationalDb instance.\n */\nexport function createRelationalDb<Schema>(\n baseDb: IBaseRelationalDb<Schema>,\n baseOptions?: NamespaceOptions,\n): IRelationalDb<Schema> {\n const relationalDb = baseDb as IRelationalDb<Schema>;\n\n relationalDb.createNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedDb<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n relationalDb.queryNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedQueryBuilder<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n return relationalDb;\n}\n\ntype NamespaceOptions = {\n hashNamespace?: boolean;\n};\n\nexport async function createNamespacedDb<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): Promise<IRelationalDb<Schema>> {\n // hash the namespace to avoid too long namespaces\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n await db.schema.createSchema(hashValue).ifNotExists().execute();\n const schemaRelationalDb = db.withSchema(hashValue);\n return schemaRelationalDb as IRelationalDb<Schema>;\n}\n\nexport function createNamespacedQueryBuilder<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): IRelationalQueryBuilder<Schema> {\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n const namespacedDb = db.withSchema(hashValue) as IRelationalDb<Schema>;\n return relationalDbToQueryBuilder(namespacedDb);\n}\n\n/**\n * Returns a query builder for a RelationalDb instance.\n * @param query The RelationalDb instance to convert.\n * @returns The IRelationalQueryBuilder instance.\n */\nexport function relationalDbToQueryBuilder<TSchema>(\n query: IBaseRelationalDb<TSchema>,\n): IRelationalQueryBuilder<TSchema> {\n return {\n selectFrom: query.selectFrom.bind(query),\n selectNoFrom: query.selectNoFrom.bind(query),\n with: query.with.bind(query),\n withRecursive: query.withRecursive.bind(query),\n withSchema: (schema: string) =>\n relationalDbToQueryBuilder<TSchema>(query.withSchema(schema)),\n };\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport type { Kysely, QueryCreator } from \"kysely\";\nimport type { IProcessor, ProcessorFilter } from \"../types.js\";\nimport { relationalDbToQueryBuilder } from \"./utils.js\";\n\nexport type IRelationalQueryMethods =\n | \"selectFrom\"\n | \"selectNoFrom\"\n | \"with\"\n | \"withRecursive\";\n\nexport type IRelationalQueryBuilder<Schema = unknown> = Pick<\n QueryCreator<Schema>,\n IRelationalQueryMethods\n> & {\n withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;\n};\n\nexport type HashAlgorithms = \"fnv1a\";\nexport type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;\n\n/**\n * The standardized relational database interface for relational db processors.\n * This abstraction provides type-safe database operations while hiding the underlying\n * database framework implementation details.\n **/\nexport type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {\n createNamespace<NamespaceSchema>(\n namespace: string,\n ): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;\n queryNamespace<NamespaceSchema>(\n namespace: string,\n ): IRelationalQueryBuilder<NamespaceSchema>;\n};\n\nexport type ExtractProcessorSchemaOrSelf<TProcessor> =\n TProcessor extends RelationalDbProcessor<infer TSchema>\n ? TSchema\n : TProcessor;\n\nexport type RelationalDbProcessorClass<TSchema> =\n typeof RelationalDbProcessor<TSchema>;\n\nexport interface IRelationalDbProcessor<\n TDatabaseSchema = unknown,\n> extends IProcessor {\n namespace: string;\n query: IRelationalQueryBuilder<TDatabaseSchema>;\n filter: ProcessorFilter;\n initAndUpgrade(): Promise<void>;\n}\n\nconst IS_RELATIONAL_DB_PROCESSOR = Symbol.for(\"ph.IS_RELATIONAL_DB_PROCESSOR\");\n\n/**\n * Base class for relational db processors that require a relational database storage.\n * This class abstracts database initialization, migration management, and resource cleanup,\n * allowing derived classes to focus on business logic.\n */\nexport abstract class RelationalDbProcessor<\n TDatabaseSchema = unknown,\n> implements IRelationalDbProcessor<TDatabaseSchema> {\n constructor(\n protected _namespace: string,\n protected _filter: ProcessorFilter,\n protected relationalDb: IRelationalDb<TDatabaseSchema>,\n ) {}\n\n static [IS_RELATIONAL_DB_PROCESSOR] = true;\n\n /**\n * Returns the namespace for a given drive id.\n * This method can be overridden by derived classes to provide a custom namespace.\n */\n static getNamespace(driveId: string): string {\n return `${this.name}_${driveId.replaceAll(\"-\", \"_\")}`;\n }\n\n static query<Schema>(\n this: RelationalDbProcessorClass<Schema>,\n driveId: string,\n db: IRelationalDb<any>,\n ): IRelationalQueryBuilder<Schema> {\n return db.queryNamespace(this.getNamespace(driveId));\n }\n\n /**\n * Processes a list of operations with context.\n * Called when operations match this processor's filter.\n */\n abstract onOperations(operations: OperationWithContext[]): Promise<void>;\n\n /**\n * Returns the filter for the processor.\n * This method can be overridden by derived classes to provide a custom filter.\n */\n get filter(): ProcessorFilter {\n return this._filter;\n }\n\n /**\n * Returns the namespace used by the processor.\n */\n get namespace(): string {\n return this._namespace;\n }\n\n get query(): IRelationalQueryBuilder<TDatabaseSchema> {\n return relationalDbToQueryBuilder(this.relationalDb);\n }\n\n /**\n * Abstract method that derived classes must implement.\n * This method is meant to be called on subclasses to initialize and upgrade the database.\n */\n abstract initAndUpgrade(): Promise<void>;\n\n /**\n * Called when the processor is disconnected.\n * This method is meant to be overridden by subclasses to clean up resources.\n */\n abstract onDisconnect(): Promise<void>;\n}\n"],"mappings":";;AAAA,MAAa,iBAAiB,CAAC,WAAW,cAAc;AACxD,MAAa,uCAAuC;AACpD,MAAa,sCAAsC;;;ACMnD,MAAM,kBAAqC;CAAC;CAAI;CAAI;CAAK;CAAK;CAAK;CAAK;AACxE,MAAM,UAAU,KAAK,KAAK,GAAG;;;;;;;;AAQ7B,SAAgB,cAAc,KAAa,SAAS,IAAI;CACtD,MAAM,eAAe,KAAK,KAAK,SAAS,QAAQ;AAIhD,QAAO,SADM,MAAM,KAAK,EAAE,MADxB,gBAAgB,MAAM,SAAS,QAAQ,QAAQ,aAAa,IAAI,MACzB,CAAC,EACpB,OAAO;;AAI/B,SAAS,SAAS,KAAa,SAAS,IAAY;CAClD,MAAM,WAAW;CACjB,IAAI,MAAM;AACV,QAAO,MAAM,MAAM,IAAI,SAAS,QAAQ;AACtC,QAAM,SAAS,OAAO,MAAM,IAAI,IAAI;AACpC,SAAO;;AAET,QAAO,IAAI,SAAS,QAAQ,IAAI;;;;;;;;AASlC,SAAgB,mBACd,QACA,aACuB;CACvB,MAAM,eAAe;AAErB,cAAa,mBACX,WACA,YAEA,mBACE,QACA,WACA,WAAW,YACZ;AAEH,cAAa,kBACX,WACA,YAEA,6BACE,QACA,WACA,WAAW,YACZ;AAEH,QAAO;;AAOT,eAAsB,mBACpB,IACA,WACA,SACgC;CAGhC,MAAM,YADa,SAAS,iBAAiB,OACd,cAAc,UAAU,GAAG;AAC1D,OAAM,GAAG,OAAO,aAAa,UAAU,CAAC,aAAa,CAAC,SAAS;AAE/D,QAD2B,GAAG,WAAW,UAAU;;AAIrD,SAAgB,6BACd,IACA,WACA,SACiC;CAEjC,MAAM,YADa,SAAS,iBAAiB,OACd,cAAc,UAAU,GAAG;AAE1D,QAAO,2BADc,GAAG,WAAW,UAAU,CACE;;;;;;;AAQjD,SAAgB,2BACd,OACkC;AAClC,QAAO;EACL,YAAY,MAAM,WAAW,KAAK,MAAM;EACxC,cAAc,MAAM,aAAa,KAAK,MAAM;EAC5C,MAAM,MAAM,KAAK,KAAK,MAAM;EAC5B,eAAe,MAAM,cAAc,KAAK,MAAM;EAC9C,aAAa,WACX,2BAAoC,MAAM,WAAW,OAAO,CAAC;EAChE;;;;AC9DH,MAAM,6BAA6B,OAAO,IAAI,gCAAgC;;;;;;AAO9E,IAAsB,wBAAtB,MAEqD;CACnD,YACE,YACA,SACA,cACA;AAHU,OAAA,aAAA;AACA,OAAA,UAAA;AACA,OAAA,eAAA;;CAGZ,QAAQ,8BAA8B;;;;;CAMtC,OAAO,aAAa,SAAyB;AAC3C,SAAO,GAAG,KAAK,KAAK,GAAG,QAAQ,WAAW,KAAK,IAAI;;CAGrD,OAAO,MAEL,SACA,IACiC;AACjC,SAAO,GAAG,eAAe,KAAK,aAAa,QAAQ,CAAC;;;;;;CAatD,IAAI,SAA0B;AAC5B,SAAO,KAAK;;;;;CAMd,IAAI,YAAoB;AACtB,SAAO,KAAK;;CAGd,IAAI,QAAkD;AACpD,SAAO,2BAA2B,KAAK,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../processors/constants.ts","../../processors/deletion.ts","../../processors/relational/utils.ts","../../processors/relational/types.ts"],"sourcesContent":["export const PROCESSOR_APPS = [\"connect\", \"switchboard\"] as const;\nexport const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = \"relational-db\";\nexport const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = \"analytics-db\";\n","import type { OperationWithContext } from \"../document-model/index.js\";\nimport { PURGE_DOCUMENT } from \"../document-model/purge.js\";\n\n/** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */\nexport function deletedDocumentId(\n op: OperationWithContext,\n): string | undefined {\n const { type, input } = op.operation.action;\n if (type !== \"DELETE_DOCUMENT\" && type !== PURGE_DOCUMENT) return undefined;\n const documentId = (input as { documentId?: unknown } | undefined)\n ?.documentId;\n return typeof documentId === \"string\" ? documentId : op.context.documentId;\n}\n","import type { Options } from \"@sindresorhus/fnv1a\";\nimport fnv1a from \"@sindresorhus/fnv1a\";\nimport type {\n IBaseRelationalDb,\n IRelationalDb,\n IRelationalQueryBuilder,\n} from \"./types.js\";\n\nconst SUPPORTED_SIZES: Options[\"size\"][] = [32, 64, 128, 256, 512, 1024];\nconst LOG2_26 = Math.log2(26); //\n/**\n * Hashes a string to a lowercase base-26 string.\n * @param str The string to hash.\n * @param length The length of the hash. Defaults to 10.\n * @param algorithm The hashing algorithm to use. Defaults to \"fnv1a\".\n * @returns The hashed string.\n */\nexport function hashNamespace(str: string, length = 10) {\n const requiredBits = Math.ceil(length * LOG2_26);\n const bitSize =\n SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024;\n const hash = fnv1a(str, { size: bitSize });\n return toBase26(hash, length);\n}\n\n// converts hash to lowercase letters\nfunction toBase26(num: bigint, length = 10): string {\n const alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n let out = \"\";\n while (num > 0n && out.length < length) {\n out = alphabet[Number(num % 26n)] + out;\n num /= 26n;\n }\n return out.padStart(length, \"a\"); // optional padding\n}\n\n/**\n * Creates a RelationalDb instance with namespace support.\n * @param baseDb The base RelationalDb instance to enhance.\n * @param baseOptions The default options for namespace creation. Hashes namespace by default.\n * @returns The enhanced RelationalDb instance.\n */\nexport function createRelationalDb<Schema>(\n baseDb: IBaseRelationalDb<Schema>,\n baseOptions?: NamespaceOptions,\n): IRelationalDb<Schema> {\n const relationalDb = baseDb as IRelationalDb<Schema>;\n\n relationalDb.createNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedDb<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n relationalDb.queryNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedQueryBuilder<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n return relationalDb;\n}\n\ntype NamespaceOptions = {\n hashNamespace?: boolean;\n};\n\nexport async function createNamespacedDb<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): Promise<IRelationalDb<Schema>> {\n // hash the namespace to avoid too long namespaces\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n await db.schema.createSchema(hashValue).ifNotExists().execute();\n const schemaRelationalDb = db.withSchema(hashValue);\n Object.defineProperty(schemaRelationalDb, NAMESPACE_SCHEMA, {\n value: hashValue,\n });\n return schemaRelationalDb as IRelationalDb<Schema>;\n}\n\nconst NAMESPACE_SCHEMA = Symbol.for(\"ph.relational.namespaceSchema\");\n\n/** The schema behind a handle from `createNamespace`; undefined otherwise. */\nexport function namespaceSchemaOf(db: object): string | undefined {\n return (db as { [NAMESPACE_SCHEMA]?: string })[NAMESPACE_SCHEMA];\n}\n\nexport function createNamespacedQueryBuilder<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): IRelationalQueryBuilder<Schema> {\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n const namespacedDb = db.withSchema(hashValue) as IRelationalDb<Schema>;\n return relationalDbToQueryBuilder(namespacedDb);\n}\n\n/**\n * Returns a query builder for a RelationalDb instance.\n * @param query The RelationalDb instance to convert.\n * @returns The IRelationalQueryBuilder instance.\n */\nexport function relationalDbToQueryBuilder<TSchema>(\n query: IBaseRelationalDb<TSchema>,\n): IRelationalQueryBuilder<TSchema> {\n return {\n selectFrom: query.selectFrom.bind(query),\n selectNoFrom: query.selectNoFrom.bind(query),\n with: query.with.bind(query),\n withRecursive: query.withRecursive.bind(query),\n withSchema: (schema: string) =>\n relationalDbToQueryBuilder<TSchema>(query.withSchema(schema)),\n };\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport { sql, type Kysely, type QueryCreator } from \"kysely\";\nimport type { IProcessor, ProcessorFilter } from \"../types.js\";\nimport { namespaceSchemaOf, relationalDbToQueryBuilder } from \"./utils.js\";\n\n/** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */\nexport const DOCUMENT_ID_COLUMNS = [\"document_id\", \"documentId\"] as const;\n\nexport type IRelationalQueryMethods =\n | \"selectFrom\"\n | \"selectNoFrom\"\n | \"with\"\n | \"withRecursive\";\n\nexport type IRelationalQueryBuilder<Schema = unknown> = Pick<\n QueryCreator<Schema>,\n IRelationalQueryMethods\n> & {\n withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;\n};\n\nexport type HashAlgorithms = \"fnv1a\";\nexport type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;\n\n/**\n * The standardized relational database interface for relational db processors.\n * This abstraction provides type-safe database operations while hiding the underlying\n * database framework implementation details.\n **/\nexport type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {\n createNamespace<NamespaceSchema>(\n namespace: string,\n ): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;\n queryNamespace<NamespaceSchema>(\n namespace: string,\n ): IRelationalQueryBuilder<NamespaceSchema>;\n};\n\nexport type ExtractProcessorSchemaOrSelf<TProcessor> =\n TProcessor extends RelationalDbProcessor<infer TSchema>\n ? TSchema\n : TProcessor;\n\nexport type RelationalDbProcessorClass<TSchema> =\n typeof RelationalDbProcessor<TSchema>;\n\nexport interface IRelationalDbProcessor<\n TDatabaseSchema = unknown,\n> extends IProcessor {\n namespace: string;\n query: IRelationalQueryBuilder<TDatabaseSchema>;\n filter: ProcessorFilter;\n initAndUpgrade(): Promise<void>;\n}\n\nconst IS_RELATIONAL_DB_PROCESSOR = Symbol.for(\"ph.IS_RELATIONAL_DB_PROCESSOR\");\n\n/**\n * Base class for relational db processors that require a relational database storage.\n * This class abstracts database initialization, migration management, and resource cleanup,\n * allowing derived classes to focus on business logic.\n */\nexport abstract class RelationalDbProcessor<\n TDatabaseSchema = unknown,\n> implements IRelationalDbProcessor<TDatabaseSchema> {\n constructor(\n protected _namespace: string,\n protected _filter: ProcessorFilter,\n protected relationalDb: IRelationalDb<TDatabaseSchema>,\n /** The drive the factory created this processor for. */\n protected _driveId?: string,\n ) {}\n\n static [IS_RELATIONAL_DB_PROCESSOR] = true;\n\n /**\n * Returns the namespace for a given drive id.\n * This method can be overridden by derived classes to provide a custom namespace.\n */\n static getNamespace(driveId: string): string {\n return `${this.name}_${driveId.replaceAll(\"-\", \"_\")}`;\n }\n\n static query<Schema>(\n this: RelationalDbProcessorClass<Schema>,\n driveId: string,\n db: IRelationalDb<any>,\n ): IRelationalQueryBuilder<Schema> {\n return db.queryNamespace(this.getNamespace(driveId));\n }\n\n /**\n * Processes a list of operations with context.\n * Called when operations match this processor's filter.\n */\n abstract onOperations(operations: OperationWithContext[]): Promise<void>;\n\n /**\n * Returns the filter for the processor.\n * This method can be overridden by derived classes to provide a custom filter.\n */\n get filter(): ProcessorFilter {\n return this._filter;\n }\n\n /**\n * Returns the namespace used by the processor.\n */\n get namespace(): string {\n return this._namespace;\n }\n\n get query(): IRelationalQueryBuilder<TDatabaseSchema> {\n return relationalDbToQueryBuilder(this.relationalDb);\n }\n\n /** True for this processor's drive when its namespace is that drive's alone. */\n protected isNamespaceDrive(documentId: string): boolean {\n const driveId = this._driveId;\n if (driveId === undefined || documentId !== driveId) return false;\n const processorClass = this.constructor as typeof RelationalDbProcessor;\n if (processorClass.getNamespace(driveId) !== this._namespace) return false;\n return processorClass.getNamespace(`${driveId}-other`) !== this._namespace;\n }\n\n /** Deletes a document's rows from every table with a document-id column. */\n protected async deleteDocumentRows(documentId: string): Promise<void> {\n const schema = this.namespaceSchema();\n const columns = await sql<{ table_name: string; column_name: string }>`\n select c.table_name, c.column_name\n from information_schema.columns c\n join information_schema.tables t\n on t.table_schema = c.table_schema and t.table_name = c.table_name\n where c.table_schema = ${schema}\n and t.table_type = 'BASE TABLE'\n and c.column_name in (${sql.join([...DOCUMENT_ID_COLUMNS])})\n order by c.table_name, c.column_name\n `.execute(this.relationalDb);\n const db = this.relationalDb as unknown as Kysely<any>;\n for (const { table_name, column_name } of columns.rows) {\n await db\n .deleteFrom(table_name)\n .where(column_name, \"=\", documentId)\n .execute();\n }\n }\n\n /** Drops this processor's namespace and every table in it. */\n protected async dropNamespace(): Promise<void> {\n await this.relationalDb.schema\n .dropSchema(this.namespaceSchema())\n .ifExists()\n .cascade()\n .execute();\n }\n\n private namespaceSchema(): string {\n const schema = namespaceSchemaOf(this.relationalDb);\n if (schema === undefined) {\n throw new Error(\n `Namespace '${this._namespace}' was not opened with createNamespace`,\n );\n }\n return schema;\n }\n\n /**\n * Abstract method that derived classes must implement.\n * This method is meant to be called on subclasses to initialize and upgrade the database.\n */\n abstract initAndUpgrade(): Promise<void>;\n\n /**\n * Called when the processor is disconnected.\n * This method is meant to be overridden by subclasses to clean up resources.\n */\n abstract onDisconnect(): Promise<void>;\n}\n"],"mappings":";;;;AAAA,MAAa,iBAAiB,CAAC,WAAW,aAAa;AACvD,MAAa,uCAAuC;AACpD,MAAa,sCAAsC;;;;ACEnD,SAAgB,kBACd,IACoB;CACpB,MAAM,EAAE,MAAM,UAAU,GAAG,UAAU;CACrC,IAAI,SAAS,qBAAqB,SAAA,kBAAyB,OAAO,KAAA;CAClE,MAAM,aAAc,OAChB;CACJ,OAAO,OAAO,eAAe,WAAW,aAAa,GAAG,QAAQ;AAClE;;;ACJA,MAAM,kBAAqC;CAAC;CAAI;CAAI;CAAK;CAAK;CAAK;AAAI;AACvE,MAAM,UAAU,KAAK,KAAK,EAAE;;;;;;;;AAQ5B,SAAgB,cAAc,KAAa,SAAS,IAAI;CACtD,MAAM,eAAe,KAAK,KAAK,SAAS,OAAO;CAC/C,MAAM,UACJ,gBAAgB,MAAM,SAAS,QAAQ,QAAQ,YAAY,KAAK;CAElE,OAAO,SADM,MAAM,KAAK,EAAE,MAAM,QAAQ,CACrB,GAAG,MAAM;AAC9B;AAGA,SAAS,SAAS,KAAa,SAAS,IAAY;CAClD,MAAM,WAAW;CACjB,IAAI,MAAM;CACV,OAAO,MAAM,MAAM,IAAI,SAAS,QAAQ;EACtC,MAAM,SAAS,OAAO,MAAM,GAAG,KAAK;EACpC,OAAO;CACT;CACA,OAAO,IAAI,SAAS,QAAQ,GAAG;AACjC;;;;;;;AAQA,SAAgB,mBACd,QACA,aACuB;CACvB,MAAM,eAAe;CAErB,aAAa,mBACX,WACA,YAEA,mBACE,QACA,WACA,WAAW,WACb;CAEF,aAAa,kBACX,WACA,YAEA,6BACE,QACA,WACA,WAAW,WACb;CAEF,OAAO;AACT;AAMA,eAAsB,mBACpB,IACA,WACA,SACgC;CAGhC,MAAM,YADa,SAAS,iBAAiB,OACd,cAAc,SAAS,IAAI;CAC1D,MAAM,GAAG,OAAO,aAAa,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ;CAC9D,MAAM,qBAAqB,GAAG,WAAW,SAAS;CAClD,OAAO,eAAe,oBAAoB,kBAAkB,EAC1D,OAAO,UACT,CAAC;CACD,OAAO;AACT;AAEA,MAAM,mBAAmB,OAAO,IAAI,+BAA+B;;AAGnE,SAAgB,kBAAkB,IAAgC;CAChE,OAAQ,GAAuC;AACjD;AAEA,SAAgB,6BACd,IACA,WACA,SACiC;CAEjC,MAAM,YADa,SAAS,iBAAiB,OACd,cAAc,SAAS,IAAI;CAE1D,OAAO,2BADc,GAAG,WAAW,SACU,CAAC;AAChD;;;;;;AAOA,SAAgB,2BACd,OACkC;CAClC,OAAO;EACL,YAAY,MAAM,WAAW,KAAK,KAAK;EACvC,cAAc,MAAM,aAAa,KAAK,KAAK;EAC3C,MAAM,MAAM,KAAK,KAAK,KAAK;EAC3B,eAAe,MAAM,cAAc,KAAK,KAAK;EAC7C,aAAa,WACX,2BAAoC,MAAM,WAAW,MAAM,CAAC;CAChE;AACF;;;;ACvHA,MAAa,sBAAsB,CAAC,eAAe,YAAY;AAiD/D,MAAM,6BAA6B,OAAO,IAAI,+BAA+B;;;;;;AAO7E,IAAsB,wBAAtB,MAEqD;CAEvC;CACA;CACA;CAEA;CALZ,YACE,YACA,SACA,cAEA,UACA;EALU,KAAA,aAAA;EACA,KAAA,UAAA;EACA,KAAA,eAAA;EAEA,KAAA,WAAA;CACT;CAEH,QAAQ,8BAA8B;;;;;CAMtC,OAAO,aAAa,SAAyB;EAC3C,OAAO,GAAG,KAAK,KAAK,GAAG,QAAQ,WAAW,KAAK,GAAG;CACpD;CAEA,OAAO,MAEL,SACA,IACiC;EACjC,OAAO,GAAG,eAAe,KAAK,aAAa,OAAO,CAAC;CACrD;;;;;CAYA,IAAI,SAA0B;EAC5B,OAAO,KAAK;CACd;;;;CAKA,IAAI,YAAoB;EACtB,OAAO,KAAK;CACd;CAEA,IAAI,QAAkD;EACpD,OAAO,2BAA2B,KAAK,YAAY;CACrD;;CAGA,iBAA2B,YAA6B;EACtD,MAAM,UAAU,KAAK;EACrB,IAAI,YAAY,KAAA,KAAa,eAAe,SAAS,OAAO;EAC5D,MAAM,iBAAiB,KAAK;EAC5B,IAAI,eAAe,aAAa,OAAO,MAAM,KAAK,YAAY,OAAO;EACrE,OAAO,eAAe,aAAa,GAAG,QAAQ,OAAO,MAAM,KAAK;CAClE;;CAGA,MAAgB,mBAAmB,YAAmC;EACpE,MAAM,SAAS,KAAK,gBAAgB;EACpC,MAAM,UAAU,MAAM,GAAgD;;;;;+BAK3C,OAAO;;gCAEN,IAAI,KAAK,CAAC,GAAG,mBAAmB,CAAC,EAAE;;MAE7D,QAAQ,KAAK,YAAY;EAC3B,MAAM,KAAK,KAAK;EAChB,KAAK,MAAM,EAAE,YAAY,iBAAiB,QAAQ,MAChD,MAAM,GACH,WAAW,UAAU,CAAC,CACtB,MAAM,aAAa,KAAK,UAAU,CAAC,CACnC,QAAQ;CAEf;;CAGA,MAAgB,gBAA+B;EAC7C,MAAM,KAAK,aAAa,OACrB,WAAW,KAAK,gBAAgB,CAAC,CAAC,CAClC,SAAS,CAAC,CACV,QAAQ,CAAC,CACT,QAAQ;CACb;CAEA,kBAAkC;EAChC,MAAM,SAAS,kBAAkB,KAAK,YAAY;EAClD,IAAI,WAAW,KAAA,GACb,MAAM,IAAI,MACR,cAAc,KAAK,WAAW,sCAChC;EAEF,OAAO;CACT;AAaF"}
|