@powerhousedao/ph-cli 6.2.3-dev.24 → 6.2.3-dev.26

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.
Files changed (63) hide show
  1. package/dist/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
  2. package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
  3. package/dist/auth-CNhbN5UM.mjs +4 -0
  4. package/dist/build-BolXfpNU.mjs +4 -0
  5. package/dist/{build-CcT1kS8Y.mjs → build-D0PTejWA.mjs} +5 -4
  6. package/dist/{build-CcT1kS8Y.mjs.map → build-D0PTejWA.mjs.map} +1 -1
  7. package/dist/{cli-connect-override-BJ5mgqM1.mjs → cli-connect-override-Bo7L7mwc.mjs} +3 -3
  8. package/dist/{cli-connect-override-BJ5mgqM1.mjs.map → cli-connect-override-Bo7L7mwc.mjs.map} +1 -1
  9. package/dist/cli.d.mts +2 -1
  10. package/dist/cli.mjs +96 -81
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/{connect-build-C90rQrw7.mjs → connect-build-BVDpTJnS.mjs} +12 -9
  13. package/dist/{connect-build-C90rQrw7.mjs.map → connect-build-BVDpTJnS.mjs.map} +1 -1
  14. package/dist/{connect-config-C3sDVZ59.mjs → connect-config-C70IXUh6.mjs} +10 -7
  15. package/dist/{connect-config-C3sDVZ59.mjs.map → connect-config-C70IXUh6.mjs.map} +1 -1
  16. package/dist/{connect-preview-D7ypzFDc.mjs → connect-preview-CzDqR-JN.mjs} +12 -8
  17. package/dist/{connect-preview-D7ypzFDc.mjs.map → connect-preview-CzDqR-JN.mjs.map} +1 -1
  18. package/dist/{connect-studio-oKEsKMZg.mjs → connect-studio-BDkYXCvz.mjs} +15 -10
  19. package/dist/{connect-studio-oKEsKMZg.mjs.map → connect-studio-BDkYXCvz.mjs.map} +1 -1
  20. package/dist/connect-studio-r_ikfhOR.mjs +4 -0
  21. package/dist/{generate-all-DrT4ZxHX.mjs → generate-all-CIwP-3aa.mjs} +3 -3
  22. package/dist/{generate-all-DrT4ZxHX.mjs.map → generate-all-CIwP-3aa.mjs.map} +1 -1
  23. package/dist/{generate-app-DNNqA-H3.mjs → generate-app-BTs1u-9l.mjs} +7 -5
  24. package/dist/{generate-app-DNNqA-H3.mjs.map → generate-app-BTs1u-9l.mjs.map} +1 -1
  25. package/dist/{generate-document-model-BJXyODfm.mjs → generate-document-model-DhDQ_06X.mjs} +17 -7
  26. package/dist/{generate-document-model-BJXyODfm.mjs.map → generate-document-model-DhDQ_06X.mjs.map} +1 -1
  27. package/dist/{generate-editor-BejvaVVT.mjs → generate-editor-CW7Do69u.mjs} +7 -5
  28. package/dist/{generate-editor-BejvaVVT.mjs.map → generate-editor-CW7Do69u.mjs.map} +1 -1
  29. package/dist/{generate-piece-B8Kbsshu.mjs → generate-piece-BHBXK1_P.mjs} +19 -16
  30. package/dist/{generate-piece-B8Kbsshu.mjs.map → generate-piece-BHBXK1_P.mjs.map} +1 -1
  31. package/dist/{generate-piece-action-DZ14j8Gi.mjs → generate-piece-action-Byk-BmYt.mjs} +3 -3
  32. package/dist/{generate-piece-action-DZ14j8Gi.mjs.map → generate-piece-action-Byk-BmYt.mjs.map} +1 -1
  33. package/dist/{generate-piece-trigger-CvzZOIPh.mjs → generate-piece-trigger-CmPqKZej.mjs} +3 -3
  34. package/dist/{generate-piece-trigger-CvzZOIPh.mjs.map → generate-piece-trigger-CmPqKZej.mjs.map} +1 -1
  35. package/dist/{generate-processor-BK7moaDe.mjs → generate-processor-FprZJIKD.mjs} +12 -7
  36. package/dist/{generate-processor-BK7moaDe.mjs.map → generate-processor-FprZJIKD.mjs.map} +1 -1
  37. package/dist/{generate-subgraph-CCXHyg4b.mjs → generate-subgraph-DNwL9vDs.mjs} +7 -5
  38. package/dist/{generate-subgraph-CCXHyg4b.mjs.map → generate-subgraph-DNwL9vDs.mjs.map} +1 -1
  39. package/dist/{init-B3Tp7X17.mjs → init-CIEMyAug.mjs} +3 -3
  40. package/dist/{init-B3Tp7X17.mjs.map → init-CIEMyAug.mjs.map} +1 -1
  41. package/dist/{inspect-B8eX-XPA.mjs → inspect-BpCB0TPo.mjs} +4 -4
  42. package/dist/{inspect-B8eX-XPA.mjs.map → inspect-BpCB0TPo.mjs.map} +1 -1
  43. package/dist/{migrate-CM_3Luws.mjs → migrate-ORExpVlJ.mjs} +3 -3
  44. package/dist/{migrate-CM_3Luws.mjs.map → migrate-ORExpVlJ.mjs.map} +1 -1
  45. package/dist/{registry-auth-C9en-6FX.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
  46. package/dist/{registry-auth-C9en-6FX.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
  47. package/dist/{switchboard-D2IaZzgh.mjs → switchboard-B8CCCZCB.mjs} +20 -19
  48. package/dist/{switchboard-D2IaZzgh.mjs.map → switchboard-B8CCCZCB.mjs.map} +1 -1
  49. package/dist/switchboard-C5AOMSKA.mjs +4 -0
  50. package/dist/{switchboard-migrate-RN3lGK4Q.mjs → switchboard-migrate-7JQZM7-5.mjs} +5 -4
  51. package/dist/{switchboard-migrate-RN3lGK4Q.mjs.map → switchboard-migrate-7JQZM7-5.mjs.map} +1 -1
  52. package/dist/{switchboard-reset-BWLfgYuv.mjs → switchboard-reset-Ctegiqdm.mjs} +3 -3
  53. package/dist/{switchboard-reset-BWLfgYuv.mjs.map → switchboard-reset-Ctegiqdm.mjs.map} +1 -1
  54. package/dist/{utils-B6flWWiG.mjs → utils-C3c5YG6v.mjs} +3 -3
  55. package/dist/{utils-jTHrApMW.mjs → utils-CvmDmCVd.mjs} +3 -3
  56. package/dist/{utils-jTHrApMW.mjs.map → utils-CvmDmCVd.mjs.map} +1 -1
  57. package/dist/{vetra-CE-ILLGo.mjs → vetra-DhhT9bQB.mjs} +13 -10
  58. package/dist/{vetra-CE-ILLGo.mjs.map → vetra-DhhT9bQB.mjs.map} +1 -1
  59. package/package.json +15 -15
  60. package/dist/auth-BNkN6kS9.mjs +0 -4
  61. package/dist/build-BGOHkuBU.mjs +0 -4
  62. package/dist/connect-studio-xE1Tr6KS.mjs +0 -5
  63. package/dist/switchboard-CijGcBqT.mjs +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"generate-piece-trigger-CvzZOIPh.mjs","sources":["../src/services/generate-piece-trigger.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceTrigger,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceTriggerArgs } from \"../types.js\";\n\nexport async function startGeneratePieceTrigger(\n args: GeneratePieceTriggerArgs,\n projectDir: string,\n) {\n const { namePositional, name: nameOption, piece, strategy, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const triggerName = namePositional ?? nameOption;\n if (!triggerName) {\n console.log(\"Please specify the name of the trigger to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceTrigger(\n { pieceDir: piece, triggerName, strategy },\n project,\n );\n await project.save();\n await syncFeatureDependencies(detectFeatures(projectDir), projectDir);\n}\n"],"names":[],"mappings":";;;;;AAQA,eAAsB,0BACpB,MACA,YACA;CACA,MAAM,EAAE,gBAAgB,MAAM,YAAY,OAAO,UAAU,UAAU;AACrE,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,cAAc,kBAAkB;AACtC,KAAI,CAAC,aAAa;AAChB,UAAQ,IAAI,sDAAsD;AAClE;;CAEF,MAAM,UAAU,oBAAoB,WAAW;AAC/C,OAAM,qBACJ;EAAE,UAAU;EAAO;EAAa;EAAU,EAC1C,QACD;AACD,OAAM,QAAQ,MAAM;AACpB,OAAM,wBAAwB,eAAe,WAAW,EAAE,WAAW","debug_id":"67e53b6c-e0c6-5447-be38-99b160159b0d"}
1
+ {"version":3,"file":"generate-piece-trigger-CmPqKZej.mjs","sources":["../src/services/generate-piece-trigger.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceTrigger,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceTriggerArgs } from \"../types.js\";\n\nexport async function startGeneratePieceTrigger(\n args: GeneratePieceTriggerArgs,\n projectDir: string,\n) {\n const { namePositional, name: nameOption, piece, strategy, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const triggerName = namePositional ?? nameOption;\n if (!triggerName) {\n console.log(\"Please specify the name of the trigger to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceTrigger(\n { pieceDir: piece, triggerName, strategy },\n project,\n );\n await project.save();\n await syncFeatureDependencies(detectFeatures(projectDir), projectDir);\n}\n"],"names":[],"mappings":";;;;;AAQA,eAAsB,0BACpB,MACA,YACA;CACA,MAAM,EAAE,gBAAgB,MAAM,YAAY,OAAO,UAAU,UAAU;CACrE,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,cAAc,kBAAkB;CACtC,IAAI,CAAC,aAAa;EAChB,QAAQ,IAAI,qDAAqD;EACjE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,qBACJ;EAAE,UAAU;EAAO;EAAa;CAAS,GACzC,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,wBAAwB,eAAe,UAAU,GAAG,UAAU;AACtE","debug_id":"719bb72c-e797-5f3c-a89b-46f1dd69f438"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b6897ff5-8236-535b-9d42-ab154d9343e6")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="450d9102-dc73-54e2-881f-50dc24ec3ba6")}catch(e){}}();
3
3
  import { dirname } from "node:path";
4
4
  import { detectFeatures, generateAllProcessors, generateProcessor, syncFeatureDependencies } from "@powerhousedao/codegen";
5
5
  import { buildTsMorphProject, getProcessorMetadata } from "@powerhousedao/codegen/utils";
@@ -18,15 +18,20 @@ async function startGenerateProcessor(args, projectDir) {
18
18
  return;
19
19
  }
20
20
  if (all) await generateAllProcessors(project);
21
- else if (document) await generateProcessorFromDocument(await getDocument(document), project);
22
- else if (processorName) await generateProcessor({
21
+ else if (document) {
22
+ const doc = await getDocument(document);
23
+ await generateProcessorFromDocument(doc, project);
24
+ } else if (processorName) await generateProcessor({
23
25
  processorName,
24
26
  processorApps,
25
27
  processorType,
26
28
  documentTypes
27
29
  }, project);
28
- else if (dir) await generateProcessor(getProcessorMetadata(project, dirname(dir)), project);
29
- else {
30
+ else if (dir) {
31
+ const processorDirName = dirname(dir);
32
+ const processorArgs = getProcessorMetadata(project, processorDirName);
33
+ await generateProcessor(processorArgs, project);
34
+ } else {
30
35
  console.log("Please specify one of `name`, `document`, `dir`, `all`, or `extract`.");
31
36
  return;
32
37
  }
@@ -36,5 +41,5 @@ async function startGenerateProcessor(args, projectDir) {
36
41
  //#endregion
37
42
  export { startGenerateProcessor };
38
43
 
39
- //# sourceMappingURL=generate-processor-BK7moaDe.mjs.map
40
- //# debugId=b6897ff5-8236-535b-9d42-ab154d9343e6
44
+ //# sourceMappingURL=generate-processor-FprZJIKD.mjs.map
45
+ //# debugId=450d9102-dc73-54e2-881f-50dc24ec3ba6
@@ -1 +1 @@
1
- {"version":3,"file":"generate-processor-BK7moaDe.mjs","sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllProcessors,\n generateProcessor,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractProcessorDocuments,\n generateProcessorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { ProcessorModuleDocument } from \"@powerhousedao/vetra/document-models/processor-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractProcessorDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllProcessors(project);\n } else if (document) {\n const doc = (await getDocument(document)) as ProcessorModuleDocument;\n await generateProcessorFromDocument(doc, project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = dirname(dir);\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await syncFeatureDependencies(detectFeatures(projectDir), projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAoBA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,UACA,KACA,KACA,SACA,UACE;AACJ,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,SAAS;EACX,MAAM,OAAO,0BAA0B,QAAQ;AAC/C,OAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,WAAW;AAC5C,WAAQ,IAAI,SAAS,OAAO;;AAE9B;;AAEF,KAAI,IACF,OAAM,sBAAsB,QAAQ;UAC3B,SAET,OAAM,8BADO,MAAM,YAAY,SAAS,EACC,QAAQ;UACxC,cACT,OAAM,kBACJ;EACE;EACA;EACA;EACA;EACD,EACD,QACD;UACQ,IAGT,OAAM,kBADgB,qBAAqB,SADlB,QAAQ,IAAI,CACgC,EAC9B,QAAQ;MAC1C;AACL,UAAQ,IACN,wEACD;AACD;;AAEF,OAAM,QAAQ,MAAM;AACpB,OAAM,wBAAwB,eAAe,WAAW,EAAE,WAAW","debug_id":"b6897ff5-8236-535b-9d42-ab154d9343e6"}
1
+ {"version":3,"file":"generate-processor-FprZJIKD.mjs","sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllProcessors,\n generateProcessor,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractProcessorDocuments,\n generateProcessorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { ProcessorModuleDocument } from \"@powerhousedao/vetra/document-models/processor-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractProcessorDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllProcessors(project);\n } else if (document) {\n const doc = (await getDocument(document)) as ProcessorModuleDocument;\n await generateProcessorFromDocument(doc, project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = dirname(dir);\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await syncFeatureDependencies(detectFeatures(projectDir), projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAoBA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,UACA,KACA,KACA,SACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,0BAA0B,OAAO;EAC9C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,sBAAsB,OAAO;MAC9B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,8BAA8B,KAAK,OAAO;CAClD,OAAO,IAAI,eACT,MAAM,kBACJ;EACE;EACA;EACA;EACA;CACF,GACA,OACF;MACK,IAAI,KAAK;EACd,MAAM,mBAAmB,QAAQ,GAAG;EACpC,MAAM,gBAAgB,qBAAqB,SAAS,gBAAgB;EACpE,MAAM,kBAAkB,eAAe,OAAO;CAChD,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,wBAAwB,eAAe,UAAU,GAAG,UAAU;AACtE","debug_id":"450d9102-dc73-54e2-881f-50dc24ec3ba6"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="96edc708-1709-5951-8583-024052fc3031")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94b5e9b5-9048-5de9-94ab-7bdc3a45c7cc")}catch(e){}}();
3
3
  import { dirname } from "node:path";
4
4
  import { detectFeatures, generateAllSubgraphs, generateSubgraph, syncFeatureDependencies } from "@powerhousedao/codegen";
5
5
  import { buildTsMorphProject, getSubgraphMetadata } from "@powerhousedao/codegen/utils";
@@ -18,8 +18,10 @@ async function startGenerateSubgraph(args, projectDir) {
18
18
  return;
19
19
  }
20
20
  if (all) await generateAllSubgraphs(project);
21
- else if (document) await generateSubgraphFromDocument(await getDocument(document), project);
22
- else if (name) await generateSubgraph(name, project);
21
+ else if (document) {
22
+ const doc = await getDocument(document);
23
+ await generateSubgraphFromDocument(doc, project);
24
+ } else if (name) await generateSubgraph(name, project);
23
25
  else if (dir) {
24
26
  const { subgraphName } = getSubgraphMetadata(project, dirname(dir));
25
27
  if (!subgraphName) throw new Error(`Failed to get data for subgraph in dir "${dir}"`);
@@ -34,5 +36,5 @@ async function startGenerateSubgraph(args, projectDir) {
34
36
  //#endregion
35
37
  export { startGenerateSubgraph };
36
38
 
37
- //# sourceMappingURL=generate-subgraph-CCXHyg4b.mjs.map
38
- //# debugId=96edc708-1709-5951-8583-024052fc3031
39
+ //# sourceMappingURL=generate-subgraph-DNwL9vDs.mjs.map
40
+ //# debugId=94b5e9b5-9048-5de9-94ab-7bdc3a45c7cc
@@ -1 +1 @@
1
- {"version":3,"file":"generate-subgraph-CCXHyg4b.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getSubgraphMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllSubgraphs(project);\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n await generateSubgraphFromDocument(doc, project);\n } else if (name) {\n await generateSubgraph(name, project);\n } else if (dir) {\n const { subgraphName } = getSubgraphMetadata(project, dirname(dir));\n if (!subgraphName) {\n throw new Error(`Failed to get data for subgraph in dir \"${dir}\"`);\n }\n await generateSubgraph(subgraphName, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await syncFeatureDependencies(detectFeatures(projectDir), projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAoBA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;AACrD,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,SAAS;EACX,MAAM,OAAO,yBAAyB,QAAQ;AAC9C,OAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,WAAW;AAC5C,WAAQ,IAAI,SAAS,OAAO;;AAE9B;;AAEF,KAAI,IACF,OAAM,qBAAqB,QAAQ;UAC1B,SAET,OAAM,6BADO,MAAM,YAAY,SAAS,EACA,QAAQ;UACvC,KACT,OAAM,iBAAiB,MAAM,QAAQ;UAC5B,KAAK;EACd,MAAM,EAAE,iBAAiB,oBAAoB,SAAS,QAAQ,IAAI,CAAC;AACnE,MAAI,CAAC,aACH,OAAM,IAAI,MAAM,2CAA2C,IAAI,GAAG;AAEpE,QAAM,iBAAiB,cAAc,QAAQ;QACxC;AACL,UAAQ,IACN,wEACD;AACD;;AAEF,OAAM,QAAQ,MAAM;AACpB,OAAM,wBAAwB,eAAe,WAAW,EAAE,WAAW","debug_id":"96edc708-1709-5951-8583-024052fc3031"}
1
+ {"version":3,"file":"generate-subgraph-DNwL9vDs.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getSubgraphMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllSubgraphs(project);\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n await generateSubgraphFromDocument(doc, project);\n } else if (name) {\n await generateSubgraph(name, project);\n } else if (dir) {\n const { subgraphName } = getSubgraphMetadata(project, dirname(dir));\n if (!subgraphName) {\n throw new Error(`Failed to get data for subgraph in dir \"${dir}\"`);\n }\n await generateSubgraph(subgraphName, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await syncFeatureDependencies(detectFeatures(projectDir), projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAoBA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;CACrD,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,yBAAyB,OAAO;EAC7C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,qBAAqB,OAAO;MAC7B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,6BAA6B,KAAK,OAAO;CACjD,OAAO,IAAI,MACT,MAAM,iBAAiB,MAAM,OAAO;MAC/B,IAAI,KAAK;EACd,MAAM,EAAE,iBAAiB,oBAAoB,SAAS,QAAQ,GAAG,CAAC;EAClE,IAAI,CAAC,cACH,MAAM,IAAI,MAAM,2CAA2C,IAAI,EAAE;EAEnE,MAAM,iBAAiB,cAAc,OAAO;CAC9C,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,wBAAwB,eAAe,UAAU,GAAG,UAAU;AACtE","debug_id":"94b5e9b5-9048-5de9-94ab-7bdc3a45c7cc"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="180565fc-51e5-5e85-85f8-ffb7eb2bdbf9")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e721e7b0-56d6-5f1e-8748-fa042911cc0d")}catch(e){}}();
3
3
  import { handleMutuallyExclusiveOptions, parsePackageManager, parseTag } from "@powerhousedao/shared/clis";
4
4
  import { createProject } from "@powerhousedao/codegen";
5
5
  import { kebabCase } from "change-case";
@@ -127,5 +127,5 @@ async function startInit(args) {
127
127
  //#endregion
128
128
  export { startInit };
129
129
 
130
- //# sourceMappingURL=init-B3Tp7X17.mjs.map
131
- //# debugId=180565fc-51e5-5e85-85f8-ffb7eb2bdbf9
130
+ //# sourceMappingURL=init-CIEMyAug.mjs.map
131
+ //# debugId=e721e7b0-56d6-5f1e-8748-fa042911cc0d
@@ -1 +1 @@
1
- {"version":3,"file":"init-B3Tp7X17.mjs","sources":["../src/utils/validate-remote-drive.ts","../src/services/init.ts"],"sourcesContent":["import {\n createVetraDocument,\n getVetraDocuments,\n} from \"@powerhousedao/common/utils\";\n\n/**\n * Sets up a remote drive for initialization by validating and creating\n * a Vetra document if needed.\n * Returns true if setup succeeds, false if it should stop execution.\n */\nexport async function setupRemoteDrive(\n remoteDriveUrl: string,\n): Promise<boolean> {\n try {\n // Parse driveId from URL\n const driveId = remoteDriveUrl.split(\"/\").pop();\n\n if (!remoteDriveUrl || remoteDriveUrl.trim() === \"\") {\n console.error(\"❌ Remote drive URL is required\");\n return false;\n }\n\n // Construct GraphQL endpoint from base URL, preserving any subpath\n // prefix (e.g. when the reactor is served behind a proxy at /api/reactor).\n const url = new URL(remoteDriveUrl);\n const basePath = url.pathname.replace(/\\/d\\/[^/]+\\/?$/, \"\");\n const graphqlEndpoint = `${url.protocol}//${url.host}${basePath}/graphql`;\n\n let documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.log(\n \"No vetra package document found in the provided drive, creating one...\",\n );\n try {\n await createVetraDocument(graphqlEndpoint, driveId!, \"vetra-package\");\n\n // Re-fetch documents after creation\n documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.error(\n \"❌ Failed to create vetra package document in the remote drive\",\n );\n return false;\n }\n\n console.log(\"✅ Vetra package document created successfully\");\n } catch (createError) {\n console.error(\n \"❌ Failed to create vetra package document:\",\n createError,\n );\n return false;\n }\n }\n\n if (documents.length > 1) {\n console.warn(\n \"⚠️ Multiple vetra package documents were found in the provided remote drive, this might be an error in your remote drive\",\n );\n }\n\n const hasGithubUrl = documents.some((doc) => doc.githubUrl);\n\n if (hasGithubUrl) {\n console.error(\n \"❌ The remote drive provided already has been configured with a github url, please use the checkout command instead: ph checkout --remote-drive <remote drive url>\",\n );\n return false;\n }\n\n return true;\n } catch (error) {\n console.error(\"❌ Unable to fetch remote drive info:\", error);\n return false;\n }\n}\n","import { createProject } from \"@powerhousedao/codegen\";\nimport {\n handleMutuallyExclusiveOptions,\n parsePackageManager,\n parseTag,\n} from \"@powerhousedao/shared/clis\";\nimport chalk from \"chalk\";\nimport { kebabCase } from \"change-case\";\nimport enquirer from \"enquirer\";\nimport { clean, valid } from \"semver\";\nimport type { InitArgs } from \"../types.js\";\nimport { setupRemoteDrive } from \"../utils/validate-remote-drive.js\";\n\nexport async function startInit(args: InitArgs) {\n const {\n namePositional,\n nameOption,\n packageManager,\n npm,\n pnpm,\n yarn,\n bun,\n tag,\n version,\n dev,\n staging,\n rc,\n remoteDrive,\n clone,\n } = args;\n\n let name = namePositional ?? nameOption;\n if (!name) {\n const { prompt } = enquirer;\n\n const result = await prompt<{ name: string }>([\n {\n type: \"input\",\n name: \"name\",\n message: \"What is the project name?\",\n required: true,\n result: (value) => kebabCase(value),\n },\n ]);\n name = result.name;\n }\n if (!name) {\n throw new Error(\"You must provide a name for your project.\");\n }\n\n if (version !== undefined && !valid(clean(version))) {\n throw new Error(`Invalid version: ${version}`);\n }\n\n handleMutuallyExclusiveOptions(\n {\n tag,\n version,\n dev,\n staging,\n rc,\n },\n \"versioning strategy\",\n );\n\n handleMutuallyExclusiveOptions(\n {\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n },\n \"package manager\",\n );\n\n const parsedPackageManager =\n parsePackageManager({\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n }) ?? \"npm\";\n\n const parsedTag = parseTag({\n tag,\n dev,\n staging,\n rc,\n });\n\n if (clone && (tag || version || dev || staging || rc)) {\n console.log(\n chalk.yellow(\n \"⚠️ --clone is set; --version/--tag/--dev/--staging/--rc are ignored (the cloned project's dependency set is authoritative).\",\n ),\n );\n }\n\n try {\n if (remoteDrive) {\n console.log(chalk.blue(\"\\n⏳ Setting up remote drive...\\n\"));\n await setupRemoteDrive(remoteDrive);\n console.log(chalk.green(\"\\n✅ Remote drive set up.\"));\n }\n\n console.log(chalk.bold(\"\\n🚀 Initializing a new project...\\n\"));\n await createProject({\n ...args,\n name,\n packageManager: parsedPackageManager,\n tag: parsedTag,\n });\n\n if (remoteDrive) {\n console.log();\n console.log(\"To link your project to GitHub:\");\n console.log();\n console.log(\" 1. Create a new repository on GitHub\");\n console.log(` 2. cd ${name}`);\n console.log(\" 3. git add . && git commit -m 'Initial commit'\");\n console.log(\" 4. git remote add origin <your-github-url>\");\n console.log(` 5. git push -u origin main`);\n console.log();\n }\n } catch (error) {\n console.error(\"\\n❌ Failed to initialize project: \\n\");\n throw error;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,eAAsB,iBACpB,gBACkB;AAClB,KAAI;EAEF,MAAM,UAAU,eAAe,MAAM,IAAI,CAAC,KAAK;AAE/C,MAAI,CAAC,kBAAkB,eAAe,MAAM,KAAK,IAAI;AACnD,WAAQ,MAAM,iCAAiC;AAC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ACD,EACD,sBACD;AAED,gCACE;EACE;EACA;EACA;EACA;EACA;EACD,EACD,kBACD;CAED,MAAM,uBACJ,oBAAoB;EAClB;EACA;EACA;EACA;EACA;EACD,CAAC,IAAI;CAER,MAAM,YAAY,SAAS;EACzB;EACA;EACA;EACA;EACD,CAAC;AAEF,KAAI,UAAU,OAAO,WAAW,OAAO,WAAW,IAChD,SAAQ,IACN,MAAM,OACJ,+HACD,CACF;AAGH,KAAI;AACF,MAAI,aAAa;AACf,WAAQ,IAAI,MAAM,KAAK,mCAAmC,CAAC;AAC3D,SAAM,iBAAiB,YAAY;AACnC,WAAQ,IAAI,MAAM,MAAM,2BAA2B,CAAC;;AAGtD,UAAQ,IAAI,MAAM,KAAK,uCAAuC,CAAC;AAC/D,QAAM,cAAc;GAClB,GAAG;GACH;GACA,gBAAgB;GAChB,KAAK;GACN,CAAC;AAEF,MAAI,aAAa;AACf,WAAQ,KAAK;AACb,WAAQ,IAAI,kCAAkC;AAC9C,WAAQ,KAAK;AACb,WAAQ,IAAI,yCAAyC;AACrD,WAAQ,IAAI,WAAW,OAAO;AAC9B,WAAQ,IAAI,mDAAmD;AAC/D,WAAQ,IAAI,+CAA+C;AAC3D,WAAQ,IAAI,+BAA+B;AAC3C,WAAQ,KAAK;;UAER,OAAO;AACd,UAAQ,MAAM,uCAAuC;AACrD,QAAM","debug_id":"180565fc-51e5-5e85-85f8-ffb7eb2bdbf9"}
1
+ {"version":3,"file":"init-CIEMyAug.mjs","sources":["../src/utils/validate-remote-drive.ts","../src/services/init.ts"],"sourcesContent":["import {\n createVetraDocument,\n getVetraDocuments,\n} from \"@powerhousedao/common/utils\";\n\n/**\n * Sets up a remote drive for initialization by validating and creating\n * a Vetra document if needed.\n * Returns true if setup succeeds, false if it should stop execution.\n */\nexport async function setupRemoteDrive(\n remoteDriveUrl: string,\n): Promise<boolean> {\n try {\n // Parse driveId from URL\n const driveId = remoteDriveUrl.split(\"/\").pop();\n\n if (!remoteDriveUrl || remoteDriveUrl.trim() === \"\") {\n console.error(\"❌ Remote drive URL is required\");\n return false;\n }\n\n // Construct GraphQL endpoint from base URL, preserving any subpath\n // prefix (e.g. when the reactor is served behind a proxy at /api/reactor).\n const url = new URL(remoteDriveUrl);\n const basePath = url.pathname.replace(/\\/d\\/[^/]+\\/?$/, \"\");\n const graphqlEndpoint = `${url.protocol}//${url.host}${basePath}/graphql`;\n\n let documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.log(\n \"No vetra package document found in the provided drive, creating one...\",\n );\n try {\n await createVetraDocument(graphqlEndpoint, driveId!, \"vetra-package\");\n\n // Re-fetch documents after creation\n documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.error(\n \"❌ Failed to create vetra package document in the remote drive\",\n );\n return false;\n }\n\n console.log(\"✅ Vetra package document created successfully\");\n } catch (createError) {\n console.error(\n \"❌ Failed to create vetra package document:\",\n createError,\n );\n return false;\n }\n }\n\n if (documents.length > 1) {\n console.warn(\n \"⚠️ Multiple vetra package documents were found in the provided remote drive, this might be an error in your remote drive\",\n );\n }\n\n const hasGithubUrl = documents.some((doc) => doc.githubUrl);\n\n if (hasGithubUrl) {\n console.error(\n \"❌ The remote drive provided already has been configured with a github url, please use the checkout command instead: ph checkout --remote-drive <remote drive url>\",\n );\n return false;\n }\n\n return true;\n } catch (error) {\n console.error(\"❌ Unable to fetch remote drive info:\", error);\n return false;\n }\n}\n","import { createProject } from \"@powerhousedao/codegen\";\nimport {\n handleMutuallyExclusiveOptions,\n parsePackageManager,\n parseTag,\n} from \"@powerhousedao/shared/clis\";\nimport chalk from \"chalk\";\nimport { kebabCase } from \"change-case\";\nimport enquirer from \"enquirer\";\nimport { clean, valid } from \"semver\";\nimport type { InitArgs } from \"../types.js\";\nimport { setupRemoteDrive } from \"../utils/validate-remote-drive.js\";\n\nexport async function startInit(args: InitArgs) {\n const {\n namePositional,\n nameOption,\n packageManager,\n npm,\n pnpm,\n yarn,\n bun,\n tag,\n version,\n dev,\n staging,\n rc,\n remoteDrive,\n clone,\n } = args;\n\n let name = namePositional ?? nameOption;\n if (!name) {\n const { prompt } = enquirer;\n\n const result = await prompt<{ name: string }>([\n {\n type: \"input\",\n name: \"name\",\n message: \"What is the project name?\",\n required: true,\n result: (value) => kebabCase(value),\n },\n ]);\n name = result.name;\n }\n if (!name) {\n throw new Error(\"You must provide a name for your project.\");\n }\n\n if (version !== undefined && !valid(clean(version))) {\n throw new Error(`Invalid version: ${version}`);\n }\n\n handleMutuallyExclusiveOptions(\n {\n tag,\n version,\n dev,\n staging,\n rc,\n },\n \"versioning strategy\",\n );\n\n handleMutuallyExclusiveOptions(\n {\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n },\n \"package manager\",\n );\n\n const parsedPackageManager =\n parsePackageManager({\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n }) ?? \"npm\";\n\n const parsedTag = parseTag({\n tag,\n dev,\n staging,\n rc,\n });\n\n if (clone && (tag || version || dev || staging || rc)) {\n console.log(\n chalk.yellow(\n \"⚠️ --clone is set; --version/--tag/--dev/--staging/--rc are ignored (the cloned project's dependency set is authoritative).\",\n ),\n );\n }\n\n try {\n if (remoteDrive) {\n console.log(chalk.blue(\"\\n⏳ Setting up remote drive...\\n\"));\n await setupRemoteDrive(remoteDrive);\n console.log(chalk.green(\"\\n✅ Remote drive set up.\"));\n }\n\n console.log(chalk.bold(\"\\n🚀 Initializing a new project...\\n\"));\n await createProject({\n ...args,\n name,\n packageManager: parsedPackageManager,\n tag: parsedTag,\n });\n\n if (remoteDrive) {\n console.log();\n console.log(\"To link your project to GitHub:\");\n console.log();\n console.log(\" 1. Create a new repository on GitHub\");\n console.log(` 2. cd ${name}`);\n console.log(\" 3. git add . && git commit -m 'Initial commit'\");\n console.log(\" 4. git remote add origin <your-github-url>\");\n console.log(` 5. git push -u origin main`);\n console.log();\n }\n } catch (error) {\n console.error(\"\\n❌ Failed to initialize project: \\n\");\n throw error;\n }\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T,UAAU;GACV,SAAS,UAAU,UAAU,KAAK;EACpC,CACF,CAAC,EAAA,CACa;CAChB;CACA,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,2CAA2C;CAG7D,IAAI,YAAY,KAAA,KAAa,CAAC,MAAM,MAAM,OAAO,CAAC,GAChD,MAAM,IAAI,MAAM,oBAAoB,SAAS;CAG/C,+BACE;EACE;EACA;EACA;EACA;EACA;CACF,GACA,qBACF;CAEA,+BACE;EACE;EACA;EACA;EACA;EACA;CACF,GACA,iBACF;CAEA,MAAM,uBACJ,oBAAoB;EAClB;EACA;EACA;EACA;EACA;CACF,CAAC,KAAK;CAER,MAAM,YAAY,SAAS;EACzB;EACA;EACA;EACA;CACF,CAAC;CAED,IAAI,UAAU,OAAO,WAAW,OAAO,WAAW,KAChD,QAAQ,IACN,MAAM,OACJ,8HACF,CACF;CAGF,IAAI;EACF,IAAI,aAAa;GACf,QAAQ,IAAI,MAAM,KAAK,kCAAkC,CAAC;GAC1D,MAAM,iBAAiB,WAAW;GAClC,QAAQ,IAAI,MAAM,MAAM,0BAA0B,CAAC;EACrD;EAEA,QAAQ,IAAI,MAAM,KAAK,sCAAsC,CAAC;EAC9D,MAAM,cAAc;GAClB,GAAG;GACH;GACA,gBAAgB;GAChB,KAAK;EACP,CAAC;EAED,IAAI,aAAa;GACf,QAAQ,IAAI;GACZ,QAAQ,IAAI,iCAAiC;GAC7C,QAAQ,IAAI;GACZ,QAAQ,IAAI,wCAAwC;GACpD,QAAQ,IAAI,WAAW,MAAM;GAC7B,QAAQ,IAAI,kDAAkD;GAC9D,QAAQ,IAAI,8CAA8C;GAC1D,QAAQ,IAAI,8BAA8B;GAC1C,QAAQ,IAAI;EACd;CACF,SAAS,OAAO;EACd,QAAQ,MAAM,sCAAsC;EACpD,MAAM;CACR;AACF","debug_id":"e721e7b0-56d6-5f1e-8748-fa042911cc0d"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="78a3c764-69d3-5d96-a25b-7c30483242ce")}catch(e){}}();
3
- import { s as getProjectInfo } from "./utils-jTHrApMW.mjs";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="72240fd3-971a-5d5f-a8ae-1c658ec39584")}catch(e){}}();
3
+ import { s as getProjectInfo } from "./utils-CvmDmCVd.mjs";
4
4
  import fs from "node:fs";
5
5
  //#region src/services/inspect.ts
6
6
  function startInspect(args) {
@@ -51,5 +51,5 @@ function startInspect(args) {
51
51
  //#endregion
52
52
  export { startInspect };
53
53
 
54
- //# sourceMappingURL=inspect-B8eX-XPA.mjs.map
55
- //# debugId=78a3c764-69d3-5d96-a25b-7c30483242ce
54
+ //# sourceMappingURL=inspect-BpCB0TPo.mjs.map
55
+ //# debugId=72240fd3-971a-5d5f-a8ae-1c658ec39584
@@ -1 +1 @@
1
- {"version":3,"file":"inspect-B8eX-XPA.mjs","sources":["../src/services/inspect.ts"],"sourcesContent":["import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport fs from \"node:fs\";\nimport type { InspectArgs } from \"../types.js\";\nimport { getProjectInfo } from \"../utils.js\";\nexport function startInspect(args: InspectArgs) {\n if (args.debug) {\n console.log(\">>> command arguments\", args);\n }\n\n const projectInfo = getProjectInfo(args.debug);\n const { packageName } = args;\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", projectInfo);\n }\n\n try {\n const loadManifest = (path: string) =>\n JSON.parse(fs.readFileSync(path, \"utf-8\")) as Manifest;\n const manifest = loadManifest(\n `${process.cwd()}/node_modules/${packageName}/dist/powerhouse.manifest.json`,\n );\n\n console.log(manifest.name);\n if (manifest.documentModels) {\n console.log(\"\\nDocument Models:\");\n manifest.documentModels.forEach((model) => {\n console.log(`- ${model.name} (${model.id})`);\n });\n }\n\n if (manifest.editors) {\n console.log(\"\\nEditors:\");\n manifest.editors.forEach((editor) => {\n console.log(`- ${editor.name} (${editor.id})`);\n });\n }\n\n if (manifest.processors) {\n console.log(\"\\nProcessors:\");\n manifest.processors.forEach((processor) => {\n console.log(`- ${processor.name} (${processor.id})`);\n });\n }\n\n if (manifest.subgraphs) {\n console.log(\"\\nSubgraphs:\");\n manifest.subgraphs.forEach((subgraph) => {\n console.log(`- ${subgraph.name} (${subgraph.id})`);\n });\n }\n\n if (manifest.pieces) {\n console.log(\"\\nPieces:\");\n manifest.pieces.forEach((piece) => {\n const version = piece.version ? ` v${piece.version}` : \"\";\n console.log(`- ${piece.name} (${piece.id})${version}`);\n });\n }\n } catch (e) {\n if (args.debug) {\n console.error(e);\n } else {\n console.log(\"No manifest found in the package\");\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAIA,SAAgB,aAAa,MAAmB;AAC9C,KAAI,KAAK,MACP,SAAQ,IAAI,yBAAyB,KAAK;CAG5C,MAAM,cAAc,eAAe,KAAK,MAAM;CAC9C,MAAM,EAAE,gBAAgB;AAExB,KAAI,KAAK,MACP,SAAQ,IAAI,qBAAqB,YAAY;AAG/C,KAAI;EACF,MAAM,gBAAgB,SACpB,KAAK,MAAM,GAAG,aAAa,MAAM,QAAQ,CAAC;EAC5C,MAAM,WAAW,aACf,GAAG,QAAQ,KAAK,CAAC,gBAAgB,YAAY,gCAC9C;AAED,UAAQ,IAAI,SAAS,KAAK;AAC1B,MAAI,SAAS,gBAAgB;AAC3B,WAAQ,IAAI,qBAAqB;AACjC,YAAS,eAAe,SAAS,UAAU;AACzC,YAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,GAAG;KAC5C;;AAGJ,MAAI,SAAS,SAAS;AACpB,WAAQ,IAAI,aAAa;AACzB,YAAS,QAAQ,SAAS,WAAW;AACnC,YAAQ,IAAI,KAAK,OAAO,KAAK,IAAI,OAAO,GAAG,GAAG;KAC9C;;AAGJ,MAAI,SAAS,YAAY;AACvB,WAAQ,IAAI,gBAAgB;AAC5B,YAAS,WAAW,SAAS,cAAc;AACzC,YAAQ,IAAI,KAAK,UAAU,KAAK,IAAI,UAAU,GAAG,GAAG;KACpD;;AAGJ,MAAI,SAAS,WAAW;AACtB,WAAQ,IAAI,eAAe;AAC3B,YAAS,UAAU,SAAS,aAAa;AACvC,YAAQ,IAAI,KAAK,SAAS,KAAK,IAAI,SAAS,GAAG,GAAG;KAClD;;AAGJ,MAAI,SAAS,QAAQ;AACnB,WAAQ,IAAI,YAAY;AACxB,YAAS,OAAO,SAAS,UAAU;IACjC,MAAM,UAAU,MAAM,UAAU,KAAK,MAAM,YAAY;AACvD,YAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,GAAG,UAAU;KACtD;;UAEG,GAAG;AACV,MAAI,KAAK,MACP,SAAQ,MAAM,EAAE;MAEhB,SAAQ,IAAI,mCAAmC","debug_id":"78a3c764-69d3-5d96-a25b-7c30483242ce"}
1
+ {"version":3,"file":"inspect-BpCB0TPo.mjs","sources":["../src/services/inspect.ts"],"sourcesContent":["import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport fs from \"node:fs\";\nimport type { InspectArgs } from \"../types.js\";\nimport { getProjectInfo } from \"../utils.js\";\nexport function startInspect(args: InspectArgs) {\n if (args.debug) {\n console.log(\">>> command arguments\", args);\n }\n\n const projectInfo = getProjectInfo(args.debug);\n const { packageName } = args;\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", projectInfo);\n }\n\n try {\n const loadManifest = (path: string) =>\n JSON.parse(fs.readFileSync(path, \"utf-8\")) as Manifest;\n const manifest = loadManifest(\n `${process.cwd()}/node_modules/${packageName}/dist/powerhouse.manifest.json`,\n );\n\n console.log(manifest.name);\n if (manifest.documentModels) {\n console.log(\"\\nDocument Models:\");\n manifest.documentModels.forEach((model) => {\n console.log(`- ${model.name} (${model.id})`);\n });\n }\n\n if (manifest.editors) {\n console.log(\"\\nEditors:\");\n manifest.editors.forEach((editor) => {\n console.log(`- ${editor.name} (${editor.id})`);\n });\n }\n\n if (manifest.processors) {\n console.log(\"\\nProcessors:\");\n manifest.processors.forEach((processor) => {\n console.log(`- ${processor.name} (${processor.id})`);\n });\n }\n\n if (manifest.subgraphs) {\n console.log(\"\\nSubgraphs:\");\n manifest.subgraphs.forEach((subgraph) => {\n console.log(`- ${subgraph.name} (${subgraph.id})`);\n });\n }\n\n if (manifest.pieces) {\n console.log(\"\\nPieces:\");\n manifest.pieces.forEach((piece) => {\n const version = piece.version ? ` v${piece.version}` : \"\";\n console.log(`- ${piece.name} (${piece.id})${version}`);\n });\n }\n } catch (e) {\n if (args.debug) {\n console.error(e);\n } else {\n console.log(\"No manifest found in the package\");\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAIA,SAAgB,aAAa,MAAmB;CAC9C,IAAI,KAAK,OACP,QAAQ,IAAI,yBAAyB,IAAI;CAG3C,MAAM,cAAc,eAAe,KAAK,KAAK;CAC7C,MAAM,EAAE,gBAAgB;CAExB,IAAI,KAAK,OACP,QAAQ,IAAI,qBAAqB,WAAW;CAG9C,IAAI;EACF,MAAM,gBAAgB,SACpB,KAAK,MAAM,GAAG,aAAa,MAAM,OAAO,CAAC;EAC3C,MAAM,WAAW,aACf,GAAG,QAAQ,IAAI,EAAE,gBAAgB,YAAY,+BAC/C;EAEA,QAAQ,IAAI,SAAS,IAAI;EACzB,IAAI,SAAS,gBAAgB;GAC3B,QAAQ,IAAI,oBAAoB;GAChC,SAAS,eAAe,SAAS,UAAU;IACzC,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,EAAE;GAC7C,CAAC;EACH;EAEA,IAAI,SAAS,SAAS;GACpB,QAAQ,IAAI,YAAY;GACxB,SAAS,QAAQ,SAAS,WAAW;IACnC,QAAQ,IAAI,KAAK,OAAO,KAAK,IAAI,OAAO,GAAG,EAAE;GAC/C,CAAC;EACH;EAEA,IAAI,SAAS,YAAY;GACvB,QAAQ,IAAI,eAAe;GAC3B,SAAS,WAAW,SAAS,cAAc;IACzC,QAAQ,IAAI,KAAK,UAAU,KAAK,IAAI,UAAU,GAAG,EAAE;GACrD,CAAC;EACH;EAEA,IAAI,SAAS,WAAW;GACtB,QAAQ,IAAI,cAAc;GAC1B,SAAS,UAAU,SAAS,aAAa;IACvC,QAAQ,IAAI,KAAK,SAAS,KAAK,IAAI,SAAS,GAAG,EAAE;GACnD,CAAC;EACH;EAEA,IAAI,SAAS,QAAQ;GACnB,QAAQ,IAAI,WAAW;GACvB,SAAS,OAAO,SAAS,UAAU;IACjC,MAAM,UAAU,MAAM,UAAU,KAAK,MAAM,YAAY;IACvD,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,GAAG,SAAS;GACvD,CAAC;EACH;CACF,SAAS,GAAG;EACV,IAAI,KAAK,OACP,QAAQ,MAAM,CAAC;OAEf,QAAQ,IAAI,kCAAkC;CAElD;AACF","debug_id":"72240fd3-971a-5d5f-a8ae-1c658ec39584"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f8b804fa-d50c-52df-8ce6-20351220c29e")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="288dc641-e836-53ce-9021-98a43ebc15dd")}catch(e){}}();
3
3
  import { execSync } from "node:child_process";
4
4
  import { readFileSync } from "node:fs";
5
5
  import { dirname, join } from "node:path";
@@ -79,5 +79,5 @@ async function startMigrate({ versionPositional, version, force, debug }) {
79
79
  //#endregion
80
80
  export { startMigrate };
81
81
 
82
- //# sourceMappingURL=migrate-CM_3Luws.mjs.map
83
- //# debugId=f8b804fa-d50c-52df-8ce6-20351220c29e
82
+ //# sourceMappingURL=migrate-ORExpVlJ.mjs.map
83
+ //# debugId=288dc641-e836-53ce-9021-98a43ebc15dd
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-CM_3Luws.mjs","sources":["../src/services/migrate.ts"],"sourcesContent":["import {\n fetchPackageVersionFromNpmRegistry,\n injectPnpmAllowBuilds,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport type { MigrateArgs } from \"../types.js\";\n\nfunction getBundledPhCliVersion(): string | undefined {\n let dir = dirname(fileURLToPath(import.meta.url));\n for (let i = 0; i < 5; i++) {\n try {\n const pkg = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n ) as { name?: string; version?: string };\n if (pkg.name === \"@powerhousedao/ph-cli\") return pkg.version;\n } catch {\n // keep walking\n }\n dir = dirname(dir);\n }\n}\n\nexport function resolveCodegenVersion(\n codegenMod: Record<string, unknown>,\n): string | undefined {\n const getter = codegenMod.getCodegenVersion;\n if (typeof getter === \"function\") {\n const v = (getter as () => unknown)();\n if (typeof v === \"string\") return v;\n }\n return undefined;\n}\n\nexport function assertCodegenMatchesBundled(args: {\n codegenVersion: string | undefined;\n bundledVersion: string | undefined;\n force: boolean;\n}): void {\n const { codegenVersion, bundledVersion, force } = args;\n if (force) return;\n if (!codegenVersion) {\n throw new Error(\n `@powerhousedao/codegen is older than this ph-cli expects (no version export). ` +\n `Reinstall ph-cli to bring a matching codegen, or re-run with --force.`,\n );\n }\n if (bundledVersion && codegenVersion !== bundledVersion) {\n throw new Error(\n `@powerhousedao/codegen@${codegenVersion} does not match ph-cli@${bundledVersion}. ` +\n `Reinstall to align versions, or re-run with --force.`,\n );\n }\n}\n\nexport async function startMigrate({\n versionPositional,\n version,\n force,\n debug,\n}: MigrateArgs) {\n const requested = versionPositional ?? version;\n if (debug) console.log(`[migrate] requested version: ${requested}`);\n\n let targetVersion: string | undefined;\n try {\n targetVersion = await fetchPackageVersionFromNpmRegistry(\n `@powerhousedao/ph-cli@${requested}`,\n );\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n if (!force) {\n throw new Error(\n `Failed to resolve \"${requested}\" from the npm registry: ${reason}\\nRe-run with --force to migrate using the installed version.`,\n { cause: error },\n );\n }\n if (debug) {\n console.log(\n `[migrate] failed to resolve target version, --force is set, falling back to bundled codegen: ${reason}`,\n );\n }\n }\n\n const bundledVersion = getBundledPhCliVersion();\n if (debug) {\n console.log(\n `[migrate] resolved target version: ${targetVersion ?? \"(unknown)\"}`,\n );\n console.log(\n `[migrate] current ph-cli version: ${bundledVersion ?? \"(unknown)\"}`,\n );\n }\n\n if (!targetVersion || force || targetVersion === bundledVersion) {\n if (debug) console.log(`[migrate] running migrate from bundled codegen`);\n const codegenMod = await import(\"@powerhousedao/codegen\");\n const codegenVersion = resolveCodegenVersion(\n codegenMod as unknown as Record<string, unknown>,\n );\n assertCodegenMatchesBundled({\n codegenVersion,\n bundledVersion,\n force: Boolean(force),\n });\n console.log(\n `Running migrate with @powerhousedao/codegen@${codegenVersion ?? \"unknown\"}`,\n );\n await codegenMod.migrate(targetVersion ?? requested);\n return;\n }\n\n const agent = (await detect())?.agent ?? \"npm\";\n const resolved = resolveCommand(agent, \"execute\", [\n `@powerhousedao/ph-cli@${targetVersion}`,\n \"migrate\",\n \"--version\",\n targetVersion,\n ...(debug ? [\"--debug\"] : []),\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve execute command for package manager \"${agent}\".`,\n );\n }\n\n injectPnpmAllowBuilds(agent, resolved);\n\n const command = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (debug) {\n console.log(`[migrate] detected package manager: ${agent}`);\n console.log(`[migrate] re-executing: ${command}`);\n }\n execSync(command, { stdio: \"inherit\" });\n}\n"],"names":[],"mappings":";;;;;;;;;AAWA,SAAS,yBAA6C;CACpD,IAAI,MAAM,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AACjD,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,MAAI;GACF,MAAM,MAAM,KAAK,MACf,aAAa,KAAK,KAAK,eAAe,EAAE,OAAO,CAChD;AACD,OAAI,IAAI,SAAS,wBAAyB,QAAO,IAAI;UAC/C;AAGR,QAAM,QAAQ,IAAI;;;AAItB,SAAgB,sBACd,YACoB;CACpB,MAAM,SAAS,WAAW;AAC1B,KAAI,OAAO,WAAW,YAAY;EAChC,MAAM,IAAK,QAA0B;AACrC,MAAI,OAAO,MAAM,SAAU,QAAO;;;AAKtC,SAAgB,4BAA4B,MAInC;CACP,MAAM,EAAE,gBAAgB,gBAAgB,UAAU;AAClD,KAAI,MAAO;AACX,KAAI,CAAC,eACH,OAAM,IAAI,MACR,sJAED;AAEH,KAAI,kBAAkB,mBAAmB,eACvC,OAAM,IAAI,MACR,0BAA0B,eAAe,yBAAyB,eAAe,wDAElF;;AAIL,eAAsB,aAAa,EACjC,mBACA,SACA,OACA,SACc;CACd,MAAM,YAAY,qBAAqB;AACvC,KAAI,MAAO,SAAQ,IAAI,gCAAgC,YAAY;CAEnE,IAAI;AACJ,KAAI;AACF,kBAAgB,MAAM,mCACpB,yBAAyB,YAC1B;UACM,OAAO;EACd,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACrE,MAAI,CAAC,MACH,OAAM,IAAI,MACR,sBAAsB,UAAU,2BAA2B,OAAO,gEAClE,EAAE,OAAO,OAAO,CACjB;AAEH,MAAI,MACF,SAAQ,IACN,gGAAgG,SACjG;;CAIL,MAAM,iBAAiB,wBAAwB;AAC/C,KAAI,OAAO;AACT,UAAQ,IACN,sCAAsC,iBAAiB,cACxD;AACD,UAAQ,IACN,qCAAqC,kBAAkB,cACxD;;AAGH,KAAI,CAAC,iBAAiB,SAAS,kBAAkB,gBAAgB;AAC/D,MAAI,MAAO,SAAQ,IAAI,iDAAiD;EACxE,MAAM,aAAa,MAAM,OAAO;EAChC,MAAM,iBAAiB,sBACrB,WACD;AACD,8BAA4B;GAC1B;GACA;GACA,OAAO,QAAQ,MAAM;GACtB,CAAC;AACF,UAAQ,IACN,+CAA+C,kBAAkB,YAClE;AACD,QAAM,WAAW,QAAQ,iBAAiB,UAAU;AACpD;;CAGF,MAAM,SAAS,MAAM,QAAQ,GAAG,SAAS;CACzC,MAAM,WAAW,eAAe,OAAO,WAAW;EAChD,yBAAyB;EACzB;EACA;EACA;EACA,GAAI,QAAQ,CAAC,UAAU,GAAG,EAAE;EAC7B,CAAC;AACF,KAAI,CAAC,SACH,OAAM,IAAI,MACR,0DAA0D,MAAM,IACjE;AAGH,uBAAsB,OAAO,SAAS;CAEtC,MAAM,UAAU,GAAG,SAAS,QAAQ,GAAG,SAAS,KAAK,KAAK,IAAI;AAC9D,KAAI,OAAO;AACT,UAAQ,IAAI,uCAAuC,QAAQ;AAC3D,UAAQ,IAAI,2BAA2B,UAAU;;AAEnD,UAAS,SAAS,EAAE,OAAO,WAAW,CAAC","debug_id":"f8b804fa-d50c-52df-8ce6-20351220c29e"}
1
+ {"version":3,"file":"migrate-ORExpVlJ.mjs","sources":["../src/services/migrate.ts"],"sourcesContent":["import {\n fetchPackageVersionFromNpmRegistry,\n injectPnpmAllowBuilds,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport type { MigrateArgs } from \"../types.js\";\n\nfunction getBundledPhCliVersion(): string | undefined {\n let dir = dirname(fileURLToPath(import.meta.url));\n for (let i = 0; i < 5; i++) {\n try {\n const pkg = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n ) as { name?: string; version?: string };\n if (pkg.name === \"@powerhousedao/ph-cli\") return pkg.version;\n } catch {\n // keep walking\n }\n dir = dirname(dir);\n }\n}\n\nexport function resolveCodegenVersion(\n codegenMod: Record<string, unknown>,\n): string | undefined {\n const getter = codegenMod.getCodegenVersion;\n if (typeof getter === \"function\") {\n const v = (getter as () => unknown)();\n if (typeof v === \"string\") return v;\n }\n return undefined;\n}\n\nexport function assertCodegenMatchesBundled(args: {\n codegenVersion: string | undefined;\n bundledVersion: string | undefined;\n force: boolean;\n}): void {\n const { codegenVersion, bundledVersion, force } = args;\n if (force) return;\n if (!codegenVersion) {\n throw new Error(\n `@powerhousedao/codegen is older than this ph-cli expects (no version export). ` +\n `Reinstall ph-cli to bring a matching codegen, or re-run with --force.`,\n );\n }\n if (bundledVersion && codegenVersion !== bundledVersion) {\n throw new Error(\n `@powerhousedao/codegen@${codegenVersion} does not match ph-cli@${bundledVersion}. ` +\n `Reinstall to align versions, or re-run with --force.`,\n );\n }\n}\n\nexport async function startMigrate({\n versionPositional,\n version,\n force,\n debug,\n}: MigrateArgs) {\n const requested = versionPositional ?? version;\n if (debug) console.log(`[migrate] requested version: ${requested}`);\n\n let targetVersion: string | undefined;\n try {\n targetVersion = await fetchPackageVersionFromNpmRegistry(\n `@powerhousedao/ph-cli@${requested}`,\n );\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n if (!force) {\n throw new Error(\n `Failed to resolve \"${requested}\" from the npm registry: ${reason}\\nRe-run with --force to migrate using the installed version.`,\n { cause: error },\n );\n }\n if (debug) {\n console.log(\n `[migrate] failed to resolve target version, --force is set, falling back to bundled codegen: ${reason}`,\n );\n }\n }\n\n const bundledVersion = getBundledPhCliVersion();\n if (debug) {\n console.log(\n `[migrate] resolved target version: ${targetVersion ?? \"(unknown)\"}`,\n );\n console.log(\n `[migrate] current ph-cli version: ${bundledVersion ?? \"(unknown)\"}`,\n );\n }\n\n if (!targetVersion || force || targetVersion === bundledVersion) {\n if (debug) console.log(`[migrate] running migrate from bundled codegen`);\n const codegenMod = await import(\"@powerhousedao/codegen\");\n const codegenVersion = resolveCodegenVersion(\n codegenMod as unknown as Record<string, unknown>,\n );\n assertCodegenMatchesBundled({\n codegenVersion,\n bundledVersion,\n force: Boolean(force),\n });\n console.log(\n `Running migrate with @powerhousedao/codegen@${codegenVersion ?? \"unknown\"}`,\n );\n await codegenMod.migrate(targetVersion ?? requested);\n return;\n }\n\n const agent = (await detect())?.agent ?? \"npm\";\n const resolved = resolveCommand(agent, \"execute\", [\n `@powerhousedao/ph-cli@${targetVersion}`,\n \"migrate\",\n \"--version\",\n targetVersion,\n ...(debug ? [\"--debug\"] : []),\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve execute command for package manager \"${agent}\".`,\n );\n }\n\n injectPnpmAllowBuilds(agent, resolved);\n\n const command = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (debug) {\n console.log(`[migrate] detected package manager: ${agent}`);\n console.log(`[migrate] re-executing: ${command}`);\n }\n execSync(command, { stdio: \"inherit\" });\n}\n"],"names":[],"mappings":";;;;;;;;;AAWA,SAAS,yBAA6C;CACpD,IAAI,MAAM,QAAQ,cAAc,YAAY,GAAG,CAAC;CAChD,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,IAAI;GACF,MAAM,MAAM,KAAK,MACf,aAAa,KAAK,KAAK,cAAc,GAAG,MAAM,CAChD;GACA,IAAI,IAAI,SAAS,yBAAyB,OAAO,IAAI;EACvD,QAAQ,CAER;EACA,MAAM,QAAQ,GAAG;CACnB;AACF;AAEA,SAAgB,sBACd,YACoB;CACpB,MAAM,SAAS,WAAW;CAC1B,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,IAAK,OAAyB;EACpC,IAAI,OAAO,MAAM,UAAU,OAAO;CACpC;AAEF;AAEA,SAAgB,4BAA4B,MAInC;CACP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MAAM,IAAI,MACR,0DAA0D,MAAM,GAClE;CAGF,sBAAsB,OAAO,QAAQ;CAErC,MAAM,UAAU,GAAG,SAAS,QAAQ,GAAG,SAAS,KAAK,KAAK,GAAG;CAC7D,IAAI,OAAO;EACT,QAAQ,IAAI,uCAAuC,OAAO;EAC1D,QAAQ,IAAI,2BAA2B,SAAS;CAClD;CACA,SAAS,SAAS,EAAE,OAAO,UAAU,CAAC;AACxC","debug_id":"288dc641-e836-53ce-9021-98a43ebc15dd"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ecd52146-dec9-5f89-908c-807583e1bd17")}catch(e){}}();
3
- import { t as getRenown } from "./auth-AR3VxAIk.mjs";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d0d0a6bc-dc22-5a36-9c82-560310b04535")}catch(e){}}();
3
+ import { t as getRenown } from "./auth-BFUq7CvE.mjs";
4
4
  import { generateAccessToken } from "@renown/sdk/node";
5
5
  //#region src/services/registry-auth.ts
6
6
  /**
@@ -21,5 +21,5 @@ async function mintRegistryAuthToken(registryUrl, expiresInSeconds) {
21
21
  //#endregion
22
22
  export { mintRegistryAuthToken };
23
23
 
24
- //# sourceMappingURL=registry-auth-C9en-6FX.mjs.map
25
- //# debugId=ecd52146-dec9-5f89-908c-807583e1bd17
24
+ //# sourceMappingURL=registry-auth-Bm5AR-fB.mjs.map
25
+ //# debugId=d0d0a6bc-dc22-5a36-9c82-560310b04535
@@ -1 +1 @@
1
- {"version":3,"file":"registry-auth-C9en-6FX.mjs","sources":["../src/services/registry-auth.ts"],"sourcesContent":["import { generateAccessToken } from \"@renown/sdk/node\";\nimport { getRenown } from \"./auth.js\";\n\n/**\n * Mint a Renown bearer token bound to the given registry URL via the JWT\n * `aud` claim. Throws if the user is not authenticated (`ph login` first).\n *\n * The audience binding is what lets the registry distinguish a token minted\n * for it from one minted for a different service or registry.\n */\nexport async function mintRegistryAuthToken(\n registryUrl: string,\n expiresInSeconds: number,\n): Promise<string> {\n const renown = await getRenown();\n if (!renown.user) {\n throw new Error(\"Not authenticated with Renown. Run 'ph login' first.\");\n }\n const result = await generateAccessToken(renown, {\n expiresIn: expiresInSeconds,\n aud: registryUrl,\n });\n return result.token;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAUA,eAAsB,sBACpB,aACA,kBACiB;CACjB,MAAM,SAAS,MAAM,WAAW;AAChC,KAAI,CAAC,OAAO,KACV,OAAM,IAAI,MAAM,uDAAuD;AAMzE,SAJe,MAAM,oBAAoB,QAAQ;EAC/C,WAAW;EACX,KAAK;EACN,CAAC,EACY","debug_id":"ecd52146-dec9-5f89-908c-807583e1bd17"}
1
+ {"version":3,"file":"registry-auth-Bm5AR-fB.mjs","sources":["../src/services/registry-auth.ts"],"sourcesContent":["import { generateAccessToken } from \"@renown/sdk/node\";\nimport { getRenown } from \"./auth.js\";\n\n/**\n * Mint a Renown bearer token bound to the given registry URL via the JWT\n * `aud` claim. Throws if the user is not authenticated (`ph login` first).\n *\n * The audience binding is what lets the registry distinguish a token minted\n * for it from one minted for a different service or registry.\n */\nexport async function mintRegistryAuthToken(\n registryUrl: string,\n expiresInSeconds: number,\n): Promise<string> {\n const renown = await getRenown();\n if (!renown.user) {\n throw new Error(\"Not authenticated with Renown. Run 'ph login' first.\");\n }\n const result = await generateAccessToken(renown, {\n expiresIn: expiresInSeconds,\n aud: registryUrl,\n });\n return result.token;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAUA,eAAsB,sBACpB,aACA,kBACiB;CACjB,MAAM,SAAS,MAAM,UAAU;CAC/B,IAAI,CAAC,OAAO,MACV,MAAM,IAAI,MAAM,sDAAsD;CAMxE,QAAO,MAJc,oBAAoB,QAAQ;EAC/C,WAAW;EACX,KAAK;CACP,CAAC,EAAA,CACa;AAChB","debug_id":"d0d0a6bc-dc22-5a36-9c82-560310b04535"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ecab357c-3522-54b7-87c3-0904ad757ead")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0e91bcfe-f72b-5718-91f9-9b8b056422a4")}catch(e){}}();
3
3
  import path from "node:path";
4
4
  import { startSwitchboard } from "@powerhousedao/switchboard/server";
5
5
  //#region src/services/switchboard.ts
@@ -51,28 +51,29 @@ async function startSwitchboard$1(options, logger) {
51
51
  requireExisting: requireIdentity
52
52
  } : void 0;
53
53
  const packages = packagesString?.split(",");
54
+ const finalOptions = remoteDrives.length > 0 ? {
55
+ ...defaultOptions,
56
+ drive: void 0,
57
+ ...serverOptions,
58
+ remoteDrives,
59
+ identity,
60
+ packages,
61
+ logger
62
+ } : {
63
+ ...defaultOptions,
64
+ ...serverOptions,
65
+ remoteDrives,
66
+ identity,
67
+ packages,
68
+ logger
69
+ };
54
70
  return await startSwitchboard({
55
- ...remoteDrives.length > 0 ? {
56
- ...defaultOptions,
57
- drive: void 0,
58
- ...serverOptions,
59
- remoteDrives,
60
- identity,
61
- packages,
62
- logger
63
- } : {
64
- ...defaultOptions,
65
- ...serverOptions,
66
- remoteDrives,
67
- identity,
68
- packages,
69
- logger
70
- },
71
+ ...finalOptions,
71
72
  fatalErrorShutdown: true
72
73
  });
73
74
  }
74
75
  //#endregion
75
76
  export { startSwitchboard$1 as n, defaultSwitchboardOptions as t };
76
77
 
77
- //# sourceMappingURL=switchboard-D2IaZzgh.mjs.map
78
- //# debugId=ecab357c-3522-54b7-87c3-0904ad757ead
78
+ //# sourceMappingURL=switchboard-B8CCCZCB.mjs.map
79
+ //# debugId=0e91bcfe-f72b-5718-91f9-9b8b056422a4
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard-D2IaZzgh.mjs","sources":["../src/services/switchboard.ts"],"sourcesContent":["import type {\n IdentityOptions,\n StartServerOptions,\n} from \"@powerhousedao/switchboard/server\";\nimport { startSwitchboard as startSwitchboardServer } from \"@powerhousedao/switchboard/server\";\nimport type { ILogger } from \"document-model\";\nimport path from \"node:path\";\nimport type { SwitchboardArgs } from \"../types.js\";\n\nexport const defaultSwitchboardOptions = {\n port: 4001,\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: \"powerhouse\",\n slug: \"powerhouse\",\n global: {\n name: \"Powerhouse\",\n icon: \"https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7\",\n },\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n mcp: true,\n} satisfies StartServerOptions;\n\nfunction getDefaultVetraSwitchboardOptions(\n vetraDriveId: string,\n): Partial<StartServerOptions> {\n return {\n port: 4001,\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: vetraDriveId,\n slug: vetraDriveId,\n global: {\n name: \"Vetra\",\n icon: \"https://azure-elderly-tortoise-212.mypinata.cloud/ipfs/bafkreibf2xokjqqtomqjd2w2xxmmhvogq4262csevclxh6sbrjgmjfre5u\",\n },\n preferredEditor: \"vetra-drive-app\",\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n };\n}\n\nexport async function startSwitchboard(\n options: SwitchboardArgs & {\n strictPort?: boolean;\n processorConfig?: Map<string, unknown>;\n },\n logger?: ILogger,\n) {\n const {\n packages: packagesString,\n remoteDrives,\n useVetraDrive,\n vetraDriveId,\n useIdentity,\n keypairPath,\n requireIdentity,\n ...serverOptions\n } = options;\n\n // Choose the appropriate default configuration\n const defaultOptions = useVetraDrive\n ? getDefaultVetraSwitchboardOptions(vetraDriveId)\n : defaultSwitchboardOptions;\n\n // Build identity options if enabled\n const identity: IdentityOptions | undefined =\n useIdentity || keypairPath || requireIdentity\n ? {\n keypairPath,\n requireExisting: requireIdentity,\n }\n : undefined;\n\n const packages = packagesString?.split(\",\");\n\n // Only include the default drive if no remote drives are provided\n const finalOptions =\n remoteDrives.length > 0\n ? {\n ...defaultOptions,\n drive: undefined, // Don't create default drive when syncing with remote\n ...serverOptions,\n remoteDrives,\n identity,\n packages,\n logger,\n }\n : {\n ...defaultOptions,\n ...serverOptions,\n remoteDrives,\n identity,\n packages,\n logger,\n };\n\n const reactor = await startSwitchboardServer({\n ...finalOptions,\n fatalErrorShutdown: true,\n });\n\n return reactor;\n}\n"],"names":["startSwitchboard","startSwitchboardServer"],"mappings":";;;;;AASA,MAAa,4BAA4B;CACvC,MAAM;CACN,QAAQ,KAAK,KAAK,QAAQ,KAAK,EAAE,oBAAoB;CACrD,OAAO;EACL,IAAI;EACJ,MAAM;EACN,QAAQ;GACN,MAAM;GACN,MAAM;GACP;EACD,OAAO;GACL,kBAAkB;GAClB,WAAW,EAAE;GACb,aAAa;GACb,UAAU,EAAE;GACb;EACF;CACD,KAAK;CACN;AAED,SAAS,kCACP,cAC6B;AAC7B,QAAO;EACL,MAAM;EACN,QAAQ,KAAK,KAAK,QAAQ,KAAK,EAAE,oBAAoB;EACrD,OAAO;GACL,IAAI;GACJ,MAAM;GACN,QAAQ;IACN,MAAM;IACN,MAAM;IACP;GACD,iBAAiB;GACjB,OAAO;IACL,kBAAkB;IAClB,WAAW,EAAE;IACb,aAAa;IACb,UAAU,EAAE;IACb;GACF;EACF;;AAGH,eAAsBA,mBACpB,SAIA,QACA;CACA,MAAM,EACJ,UAAU,gBACV,cACA,eACA,cACA,aACA,aACA,iBACA,GAAG,kBACD;CAGJ,MAAM,iBAAiB,gBACnB,kCAAkC,aAAa,GAC/C;CAGJ,MAAM,WACJ,eAAe,eAAe,kBAC1B;EACE;EACA,iBAAiB;EAClB,GACD,KAAA;CAEN,MAAM,WAAW,gBAAgB,MAAM,IAAI;AA4B3C,QALgB,MAAMC,iBAAuB;EAC3C,GApBA,aAAa,SAAS,IAClB;GACE,GAAG;GACH,OAAO,KAAA;GACP,GAAG;GACH;GACA;GACA;GACA;GACD,GACD;GACE,GAAG;GACH,GAAG;GACH;GACA;GACA;GACA;GACD;EAIL,oBAAoB;EACrB,CAAC","debug_id":"ecab357c-3522-54b7-87c3-0904ad757ead"}
1
+ {"version":3,"file":"switchboard-B8CCCZCB.mjs","sources":["../src/services/switchboard.ts"],"sourcesContent":["import type {\n IdentityOptions,\n StartServerOptions,\n} from \"@powerhousedao/switchboard/server\";\nimport { startSwitchboard as startSwitchboardServer } from \"@powerhousedao/switchboard/server\";\nimport type { ILogger } from \"document-model\";\nimport path from \"node:path\";\nimport type { SwitchboardArgs } from \"../types.js\";\n\nexport const defaultSwitchboardOptions = {\n port: 4001,\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: \"powerhouse\",\n slug: \"powerhouse\",\n global: {\n name: \"Powerhouse\",\n icon: \"https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7\",\n },\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n mcp: true,\n} satisfies StartServerOptions;\n\nfunction getDefaultVetraSwitchboardOptions(\n vetraDriveId: string,\n): Partial<StartServerOptions> {\n return {\n port: 4001,\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: vetraDriveId,\n slug: vetraDriveId,\n global: {\n name: \"Vetra\",\n icon: \"https://azure-elderly-tortoise-212.mypinata.cloud/ipfs/bafkreibf2xokjqqtomqjd2w2xxmmhvogq4262csevclxh6sbrjgmjfre5u\",\n },\n preferredEditor: \"vetra-drive-app\",\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n };\n}\n\nexport async function startSwitchboard(\n options: SwitchboardArgs & {\n strictPort?: boolean;\n processorConfig?: Map<string, unknown>;\n },\n logger?: ILogger,\n) {\n const {\n packages: packagesString,\n remoteDrives,\n useVetraDrive,\n vetraDriveId,\n useIdentity,\n keypairPath,\n requireIdentity,\n ...serverOptions\n } = options;\n\n // Choose the appropriate default configuration\n const defaultOptions = useVetraDrive\n ? getDefaultVetraSwitchboardOptions(vetraDriveId)\n : defaultSwitchboardOptions;\n\n // Build identity options if enabled\n const identity: IdentityOptions | undefined =\n useIdentity || keypairPath || requireIdentity\n ? {\n keypairPath,\n requireExisting: requireIdentity,\n }\n : undefined;\n\n const packages = packagesString?.split(\",\");\n\n // Only include the default drive if no remote drives are provided\n const finalOptions =\n remoteDrives.length > 0\n ? {\n ...defaultOptions,\n drive: undefined, // Don't create default drive when syncing with remote\n ...serverOptions,\n remoteDrives,\n identity,\n packages,\n logger,\n }\n : {\n ...defaultOptions,\n ...serverOptions,\n remoteDrives,\n identity,\n packages,\n logger,\n };\n\n const reactor = await startSwitchboardServer({\n ...finalOptions,\n fatalErrorShutdown: true,\n });\n\n return reactor;\n}\n"],"names":["startSwitchboard","startSwitchboardServer"],"mappings":";;;;;AASA,MAAa,4BAA4B;CACvC,MAAM;CACN,QAAQ,KAAK,KAAK,QAAQ,IAAI,GAAG,mBAAmB;CACpD,OAAO;EACL,IAAI;EACJ,MAAM;EACN,QAAQ;GACN,MAAM;GACN,MAAM;EACR;EACA,OAAO;GACL,kBAAkB;GAClB,WAAW,CAAC;GACZ,aAAa;GACb,UAAU,CAAC;EACb;CACF;CACA,KAAK;AACP;AAEA,SAAS,kCACP,cAC6B;CAC7B,OAAO;EACL,MAAM;EACN,QAAQ,KAAK,KAAK,QAAQ,IAAI,GAAG,mBAAmB;EACpD,OAAO;GACL,IAAI;GACJ,MAAM;GACN,QAAQ;IACN,MAAM;IACN,MAAM;GACR;GACA,iBAAiB;GACjB,OAAO;IACL,kBAAkB;IAClB,WAAW,CAAC;IACZ,aAAa;IACb,UAAU,CAAC;GACb;EACF;CACF;AACF;AAEA,eAAsBA,mBACpB,SAIA,QACA;CACA,MAAM,EACJ,UAAU,gBACV,cACA,eACA,cACA,aACA,aACA,iBACA,GAAG,kBACD;CAGJ,MAAM,iBAAiB,gBACnB,kCAAkC,YAAY,IAC9C;CAGJ,MAAM,WACJ,eAAe,eAAe,kBAC1B;EACE;EACA,iBAAiB;CACnB,IACA,KAAA;CAEN,MAAM,WAAW,gBAAgB,MAAM,GAAG;CAG1C,MAAM,eACJ,aAAa,SAAS,IAClB;EACE,GAAG;EACH,OAAO,KAAA;EACP,GAAG;EACH;EACA;EACA;EACA;CACF,IACA;EACE,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;CACF;CAON,OAAO,MALeC,iBAAuB;EAC3C,GAAG;EACH,oBAAoB;CACtB,CAAC;AAGH","debug_id":"0e91bcfe-f72b-5718-91f9-9b8b056422a4"}
@@ -0,0 +1,4 @@
1
+ import { n as startSwitchboard } from "./switchboard-B8CCCZCB.mjs";
2
+ export { startSwitchboard };
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1b57d548-129d-55b5-be0c-091153781f31")}catch(e){}}();
4
+ //# debugId=1b57d548-129d-55b5-be0c-091153781f31
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13e0b9da-2fda-52d7-b20b-d13a8a635b3d")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8ee54547-f686-5213-81f6-e06f7bd4b297")}catch(e){}}();
3
3
  import { Kysely, PostgresDialect } from "kysely";
4
4
  import { Pool } from "pg";
5
5
  import { REACTOR_SCHEMA, getMigrationStatus, runMigrations } from "@powerhousedao/reactor";
@@ -15,7 +15,8 @@ async function runSwitchboardMigrations(options) {
15
15
  return;
16
16
  }
17
17
  console.log(`Database: ${dbPath}`);
18
- const db = new Kysely({ dialect: new PostgresDialect({ pool: new Pool({ connectionString: dbPath }) }) });
18
+ const pool = new Pool({ connectionString: dbPath });
19
+ const db = new Kysely({ dialect: new PostgresDialect({ pool }) });
19
20
  try {
20
21
  if (options.statusOnly) {
21
22
  console.log("\nChecking migration status...");
@@ -49,5 +50,5 @@ async function runSwitchboardMigrations(options) {
49
50
  //#endregion
50
51
  export { runSwitchboardMigrations };
51
52
 
52
- //# sourceMappingURL=switchboard-migrate-RN3lGK4Q.mjs.map
53
- //# debugId=13e0b9da-2fda-52d7-b20b-d13a8a635b3d
53
+ //# sourceMappingURL=switchboard-migrate-7JQZM7-5.mjs.map
54
+ //# debugId=8ee54547-f686-5213-81f6-e06f7bd4b297
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard-migrate-RN3lGK4Q.mjs","sources":["../src/services/switchboard-migrate.ts"],"sourcesContent":["import { Kysely, PostgresDialect } from \"kysely\";\nimport { Pool } from \"pg\";\nimport {\n runMigrations,\n getMigrationStatus,\n REACTOR_SCHEMA,\n} from \"@powerhousedao/reactor\";\n\ninterface MigrationOptions {\n dbPath?: string;\n statusOnly?: boolean;\n}\n\nfunction isPostgresUrl(url: string): boolean {\n return url.startsWith(\"postgresql://\") || url.startsWith(\"postgres://\");\n}\n\nexport async function runSwitchboardMigrations(\n options: MigrationOptions,\n): Promise<void> {\n const dbPath =\n options.dbPath ??\n process.env.PH_REACTOR_DATABASE_URL ??\n process.env.DATABASE_URL;\n\n if (!dbPath || !isPostgresUrl(dbPath)) {\n console.log(\"No PostgreSQL URL configured. Skipping migrations.\");\n console.log(\"(PGlite migrations are handled automatically on startup)\");\n return;\n }\n\n console.log(`Database: ${dbPath}`);\n\n const pool = new Pool({ connectionString: dbPath });\n\n const db = new Kysely<any>({\n dialect: new PostgresDialect({ pool }),\n });\n\n try {\n if (options.statusOnly) {\n console.log(\"\\nChecking migration status...\");\n const migrations = await getMigrationStatus(db, REACTOR_SCHEMA);\n\n console.log(\"\\nMigration Status:\");\n console.log(\"=================\");\n\n for (const migration of migrations) {\n const status = migration.executedAt\n ? `[OK] Executed at ${migration.executedAt.toISOString()}`\n : \"[--] Pending\";\n console.log(`${status} - ${migration.name}`);\n }\n } else {\n console.log(\"\\nRunning migrations...\");\n const result = await runMigrations(db, REACTOR_SCHEMA);\n\n if (!result.success) {\n console.error(\"Migration failed:\", result.error?.message);\n process.exit(1);\n }\n\n if (result.migrationsExecuted.length === 0) {\n console.log(\"No migrations to run - database is up to date\");\n } else {\n console.log(\n `Successfully executed ${result.migrationsExecuted.length} migration(s):`,\n );\n for (const name of result.migrationsExecuted) {\n console.log(` - ${name}`);\n }\n }\n }\n } catch (error) {\n console.error(\n \"Error:\",\n error instanceof Error ? error.message : String(error),\n );\n process.exit(1);\n } finally {\n await db.destroy();\n }\n}\n"],"names":[],"mappings":";;;;;;AAaA,SAAS,cAAc,KAAsB;AAC3C,QAAO,IAAI,WAAW,gBAAgB,IAAI,IAAI,WAAW,cAAc;;AAGzE,eAAsB,yBACpB,SACe;CACf,MAAM,SACJ,QAAQ,UACR,QAAQ,IAAI,2BACZ,QAAQ,IAAI;AAEd,KAAI,CAAC,UAAU,CAAC,cAAc,OAAO,EAAE;AACrC,UAAQ,IAAI,qDAAqD;AACjE,UAAQ,IAAI,2DAA2D;AACvE;;AAGF,SAAQ,IAAI,aAAa,SAAS;CAIlC,MAAM,KAAK,IAAI,OAAY,EACzB,SAAS,IAAI,gBAAgB,EAAE,MAHpB,IAAI,KAAK,EAAE,kBAAkB,QAAQ,CAAC,EAGZ,CAAC,EACvC,CAAC;AAEF,KAAI;AACF,MAAI,QAAQ,YAAY;AACtB,WAAQ,IAAI,iCAAiC;GAC7C,MAAM,aAAa,MAAM,mBAAmB,IAAI,eAAe;AAE/D,WAAQ,IAAI,sBAAsB;AAClC,WAAQ,IAAI,oBAAoB;AAEhC,QAAK,MAAM,aAAa,YAAY;IAClC,MAAM,SAAS,UAAU,aACrB,oBAAoB,UAAU,WAAW,aAAa,KACtD;AACJ,YAAQ,IAAI,GAAG,OAAO,KAAK,UAAU,OAAO;;SAEzC;AACL,WAAQ,IAAI,0BAA0B;GACtC,MAAM,SAAS,MAAM,cAAc,IAAI,eAAe;AAEtD,OAAI,CAAC,OAAO,SAAS;AACnB,YAAQ,MAAM,qBAAqB,OAAO,OAAO,QAAQ;AACzD,YAAQ,KAAK,EAAE;;AAGjB,OAAI,OAAO,mBAAmB,WAAW,EACvC,SAAQ,IAAI,gDAAgD;QACvD;AACL,YAAQ,IACN,yBAAyB,OAAO,mBAAmB,OAAO,gBAC3D;AACD,SAAK,MAAM,QAAQ,OAAO,mBACxB,SAAQ,IAAI,OAAO,OAAO;;;UAIzB,OAAO;AACd,UAAQ,MACN,UACA,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CACvD;AACD,UAAQ,KAAK,EAAE;WACP;AACR,QAAM,GAAG,SAAS","debug_id":"13e0b9da-2fda-52d7-b20b-d13a8a635b3d"}
1
+ {"version":3,"file":"switchboard-migrate-7JQZM7-5.mjs","sources":["../src/services/switchboard-migrate.ts"],"sourcesContent":["import { Kysely, PostgresDialect } from \"kysely\";\nimport { Pool } from \"pg\";\nimport {\n runMigrations,\n getMigrationStatus,\n REACTOR_SCHEMA,\n} from \"@powerhousedao/reactor\";\n\ninterface MigrationOptions {\n dbPath?: string;\n statusOnly?: boolean;\n}\n\nfunction isPostgresUrl(url: string): boolean {\n return url.startsWith(\"postgresql://\") || url.startsWith(\"postgres://\");\n}\n\nexport async function runSwitchboardMigrations(\n options: MigrationOptions,\n): Promise<void> {\n const dbPath =\n options.dbPath ??\n process.env.PH_REACTOR_DATABASE_URL ??\n process.env.DATABASE_URL;\n\n if (!dbPath || !isPostgresUrl(dbPath)) {\n console.log(\"No PostgreSQL URL configured. Skipping migrations.\");\n console.log(\"(PGlite migrations are handled automatically on startup)\");\n return;\n }\n\n console.log(`Database: ${dbPath}`);\n\n const pool = new Pool({ connectionString: dbPath });\n\n const db = new Kysely<any>({\n dialect: new PostgresDialect({ pool }),\n });\n\n try {\n if (options.statusOnly) {\n console.log(\"\\nChecking migration status...\");\n const migrations = await getMigrationStatus(db, REACTOR_SCHEMA);\n\n console.log(\"\\nMigration Status:\");\n console.log(\"=================\");\n\n for (const migration of migrations) {\n const status = migration.executedAt\n ? `[OK] Executed at ${migration.executedAt.toISOString()}`\n : \"[--] Pending\";\n console.log(`${status} - ${migration.name}`);\n }\n } else {\n console.log(\"\\nRunning migrations...\");\n const result = await runMigrations(db, REACTOR_SCHEMA);\n\n if (!result.success) {\n console.error(\"Migration failed:\", result.error?.message);\n process.exit(1);\n }\n\n if (result.migrationsExecuted.length === 0) {\n console.log(\"No migrations to run - database is up to date\");\n } else {\n console.log(\n `Successfully executed ${result.migrationsExecuted.length} migration(s):`,\n );\n for (const name of result.migrationsExecuted) {\n console.log(` - ${name}`);\n }\n }\n }\n } catch (error) {\n console.error(\n \"Error:\",\n error instanceof Error ? error.message : String(error),\n );\n process.exit(1);\n } finally {\n await db.destroy();\n }\n}\n"],"names":[],"mappings":";;;;;;AAaA,SAAS,cAAc,KAAsB;CAC3C,OAAO,IAAI,WAAW,eAAe,KAAK,IAAI,WAAW,aAAa;AACx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debug_id":"8ee54547-f686-5213-81f6-e06f7bd4b297"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3458acc6-5c28-5042-99a5-4fa8b596cb94")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="17d56bac-3fa6-5ce5-b8c7-495f6c94c9d7")}catch(e){}}();
3
3
  import { cyan, green, red, yellow } from "colorette";
4
4
  import { promises } from "node:fs";
5
5
  //#region src/services/switchboard-reset.ts
@@ -83,5 +83,5 @@ async function resetSwitchboardDatabase(options) {
83
83
  //#endregion
84
84
  export { resetSwitchboardDatabase };
85
85
 
86
- //# sourceMappingURL=switchboard-reset-BWLfgYuv.mjs.map
87
- //# debugId=3458acc6-5c28-5042-99a5-4fa8b596cb94
86
+ //# sourceMappingURL=switchboard-reset-Ctegiqdm.mjs.map
87
+ //# debugId=17d56bac-3fa6-5ce5-b8c7-495f6c94c9d7
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard-reset-BWLfgYuv.mjs","sources":["../src/services/switchboard-reset.ts"],"sourcesContent":["import { yellow, red, green, cyan } from \"colorette\";\nimport { promises as fs } from \"node:fs\";\n\nexport interface ResetSwitchboardOptions {\n dbPath?: string;\n yes?: boolean;\n}\n\nexport interface ResolvedResetPaths {\n reactorDir: string | null;\n readModelDir: string | null;\n postgresUrl: string | null;\n}\n\nconst CONFIRMATION_TOKEN = \"reset\";\n\nexport function isPostgresUrl(url: string): boolean {\n return url.startsWith(\"postgresql://\") || url.startsWith(\"postgres://\");\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\n/**\n * Resolves the on-disk PGlite directories that `--reset` would delete.\n * Mirrors the resolution in apps/switchboard/src/server.mts so we touch the\n * same paths the running switchboard uses. When a Postgres URL is configured\n * the corresponding directory is null and `postgresUrl` is populated so the\n * caller can refuse.\n */\nexport function resolveResetPaths(\n options: ResetSwitchboardOptions,\n env: NodeJS.ProcessEnv = process.env,\n): ResolvedResetPaths {\n const readModelDbPath =\n options.dbPath ?? env.DATABASE_URL ?? env.PH_SWITCHBOARD_DATABASE_URL;\n const readModelPath = readModelDbPath || \".ph/read-storage\";\n const reactorDbUrl =\n options.dbPath ??\n env.PH_REACTOR_DATABASE_URL ??\n env.PH_SWITCHBOARD_DATABASE_URL;\n const reactorPath = reactorDbUrl || \"./.ph/reactor-storage\";\n\n const reactorIsPostgres = !!reactorDbUrl && isPostgresUrl(reactorDbUrl);\n const readModelIsPostgres =\n !!readModelDbPath && isPostgresUrl(readModelDbPath);\n\n let postgresUrl: string | null = null;\n if (reactorIsPostgres) postgresUrl = reactorDbUrl as string;\n else if (readModelIsPostgres) postgresUrl = readModelDbPath as string;\n\n return {\n reactorDir: reactorIsPostgres ? null : reactorPath,\n readModelDir: readModelIsPostgres ? null : readModelPath,\n postgresUrl,\n };\n}\n\nasync function promptForConfirmation(): Promise<boolean> {\n const enquirer = await import(\"enquirer\");\n try {\n const answer = await enquirer.default.prompt<{ confirmation: string }>({\n type: \"input\",\n name: \"confirmation\",\n message: `Type \"${CONFIRMATION_TOKEN}\" to confirm wiping the local switchboard databases:`,\n });\n return answer.confirmation.trim() === CONFIRMATION_TOKEN;\n } catch {\n return false;\n }\n}\n\nexport async function resetSwitchboardDatabase(\n options: ResetSwitchboardOptions,\n): Promise<void> {\n const paths = resolveResetPaths(options);\n\n if (paths.postgresUrl) {\n console.error(\n red(\n `Refusing to reset: a PostgreSQL URL is configured (${paths.postgresUrl}).`,\n ),\n );\n console.error(\n yellow(\n \"`ph switchboard --reset` only wipes the local PGlite stores. \" +\n \"To reset a Postgres-backed switchboard, drop/recreate the database manually.\",\n ),\n );\n process.exit(1);\n }\n\n const targets = [paths.reactorDir, paths.readModelDir].filter(\n (d): d is string => d !== null,\n );\n\n if (targets.length === 0) {\n console.error(red(\"No local PGlite directories resolved; nothing to do.\"));\n process.exit(1);\n }\n\n console.log(yellow(\"The following directories will be permanently deleted:\"));\n for (const dir of targets) {\n console.log(` - ${dir}`);\n }\n console.log(\n yellow(\n \"This will wipe all local switchboard state. Migrations will re-run on next `ph switchboard`.\",\n ),\n );\n\n let confirmed = false;\n if (options.yes) {\n confirmed = true;\n } else if (isInteractive()) {\n confirmed = await promptForConfirmation();\n } else {\n console.error(\n red(\n \"Refusing to reset in a non-interactive context without --yes. Re-run with --yes to confirm.\",\n ),\n );\n process.exit(1);\n }\n\n if (!confirmed) {\n console.error(red(\"Aborted: confirmation not provided.\"));\n process.exit(1);\n }\n\n for (const dir of targets) {\n await fs.rm(dir, { recursive: true, force: true });\n console.log(cyan(`Removed ${dir}`));\n }\n\n console.log(\n green(\n \"Switchboard local storage reset. Run `ph switchboard` to re-initialize.\",\n ),\n );\n}\n"],"names":["fs"],"mappings":";;;;;AAcA,MAAM,qBAAqB;AAE3B,SAAgB,cAAc,KAAsB;AAClD,QAAO,IAAI,WAAW,gBAAgB,IAAI,IAAI,WAAW,cAAc;;AAGzE,SAAS,gBAAyB;AAChC,QAAO,QAAQ,QAAQ,MAAM,MAAM,IAAI,CAAC,QAAQ,IAAI;;;;;;;;;AAUtD,SAAgB,kBACd,SACA,MAAyB,QAAQ,KACb;CACpB,MAAM,kBACJ,QAAQ,UAAU,IAAI,gBAAgB,IAAI;CAC5C,MAAM,gBAAgB,mBAAmB;CACzC,MAAM,eACJ,QAAQ,UACR,IAAI,2BACJ,IAAI;CACN,MAAM,cAAc,gBAAgB;CAEpC,MAAM,oBAAoB,CAAC,CAAC,gBAAgB,cAAc,aAAa;CACvE,MAAM,sBACJ,CAAC,CAAC,mBAAmB,cAAc,gBAA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,CAAC;;AAGrC,SAAQ,IACN,MACE,0EACD,CACF","debug_id":"3458acc6-5c28-5042-99a5-4fa8b596cb94"}
1
+ {"version":3,"file":"switchboard-reset-Ctegiqdm.mjs","sources":["../src/services/switchboard-reset.ts"],"sourcesContent":["import { yellow, red, green, cyan } from \"colorette\";\nimport { promises as fs } from \"node:fs\";\n\nexport interface ResetSwitchboardOptions {\n dbPath?: string;\n yes?: boolean;\n}\n\nexport interface ResolvedResetPaths {\n reactorDir: string | null;\n readModelDir: string | null;\n postgresUrl: string | null;\n}\n\nconst CONFIRMATION_TOKEN = \"reset\";\n\nexport function isPostgresUrl(url: string): boolean {\n return url.startsWith(\"postgresql://\") || url.startsWith(\"postgres://\");\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\n/**\n * Resolves the on-disk PGlite directories that `--reset` would delete.\n * Mirrors the resolution in apps/switchboard/src/server.mts so we touch the\n * same paths the running switchboard uses. When a Postgres URL is configured\n * the corresponding directory is null and `postgresUrl` is populated so the\n * caller can refuse.\n */\nexport function resolveResetPaths(\n options: ResetSwitchboardOptions,\n env: NodeJS.ProcessEnv = process.env,\n): ResolvedResetPaths {\n const readModelDbPath =\n options.dbPath ?? env.DATABASE_URL ?? env.PH_SWITCHBOARD_DATABASE_URL;\n const readModelPath = readModelDbPath || \".ph/read-storage\";\n const reactorDbUrl =\n options.dbPath ??\n env.PH_REACTOR_DATABASE_URL ??\n env.PH_SWITCHBOARD_DATABASE_URL;\n const reactorPath = reactorDbUrl || \"./.ph/reactor-storage\";\n\n const reactorIsPostgres = !!reactorDbUrl && isPostgresUrl(reactorDbUrl);\n const readModelIsPostgres =\n !!readModelDbPath && isPostgresUrl(readModelDbPath);\n\n let postgresUrl: string | null = null;\n if (reactorIsPostgres) postgresUrl = reactorDbUrl as string;\n else if (readModelIsPostgres) postgresUrl = readModelDbPath as string;\n\n return {\n reactorDir: reactorIsPostgres ? null : reactorPath,\n readModelDir: readModelIsPostgres ? null : readModelPath,\n postgresUrl,\n };\n}\n\nasync function promptForConfirmation(): Promise<boolean> {\n const enquirer = await import(\"enquirer\");\n try {\n const answer = await enquirer.default.prompt<{ confirmation: string }>({\n type: \"input\",\n name: \"confirmation\",\n message: `Type \"${CONFIRMATION_TOKEN}\" to confirm wiping the local switchboard databases:`,\n });\n return answer.confirmation.trim() === CONFIRMATION_TOKEN;\n } catch {\n return false;\n }\n}\n\nexport async function resetSwitchboardDatabase(\n options: ResetSwitchboardOptions,\n): Promise<void> {\n const paths = resolveResetPaths(options);\n\n if (paths.postgresUrl) {\n console.error(\n red(\n `Refusing to reset: a PostgreSQL URL is configured (${paths.postgresUrl}).`,\n ),\n );\n console.error(\n yellow(\n \"`ph switchboard --reset` only wipes the local PGlite stores. \" +\n \"To reset a Postgres-backed switchboard, drop/recreate the database manually.\",\n ),\n );\n process.exit(1);\n }\n\n const targets = [paths.reactorDir, paths.readModelDir].filter(\n (d): d is string => d !== null,\n );\n\n if (targets.length === 0) {\n console.error(red(\"No local PGlite directories resolved; nothing to do.\"));\n process.exit(1);\n }\n\n console.log(yellow(\"The following directories will be permanently deleted:\"));\n for (const dir of targets) {\n console.log(` - ${dir}`);\n }\n console.log(\n yellow(\n \"This will wipe all local switchboard state. Migrations will re-run on next `ph switchboard`.\",\n ),\n );\n\n let confirmed = false;\n if (options.yes) {\n confirmed = true;\n } else if (isInteractive()) {\n confirmed = await promptForConfirmation();\n } else {\n console.error(\n red(\n \"Refusing to reset in a non-interactive context without --yes. Re-run with --yes to confirm.\",\n ),\n );\n process.exit(1);\n }\n\n if (!confirmed) {\n console.error(red(\"Aborted: confirmation not provided.\"));\n process.exit(1);\n }\n\n for (const dir of targets) {\n await fs.rm(dir, { recursive: true, force: true });\n console.log(cyan(`Removed ${dir}`));\n }\n\n console.log(\n green(\n \"Switchboard local storage reset. Run `ph switchboard` to re-initialize.\",\n ),\n );\n}\n"],"names":["fs"],"mappings":";;;;;AAcA,MAAM,qBAAqB;AAE3B,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AQ,KAAK,CAAC;CAChB;CAEA,QAAQ,IAAI,OAAO,wDAAwD,CAAC;CAC5E,KAAK,MAAM,OAAO,SAChB,QAAQ,IAAI,OAAO,KAAK;CAE1B,QAAQ,IACN,OACE,8FACF,CACF;CAEA,IAAI,YAAY;CAChB,IAAI,QAAQ,KACV,YAAY;MACP,IAAI,cAAc,GACvB,YAAY,MAAM,sBAAsB;MACnC;EACL,QAAQ,MACN,IACE,6FACF,CACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAEA,IAAI,CAAC,WAAW;EACd,QAAQ,MAAM,IAAI,qCAAqC,CAAC;EACxD,QAAQ,KAAK,CAAC;CAChB;CAEA,KAAK,MAAM,OAAO,SAAS;EACzB,MAAMA,SAAG,GAAG,KAAK;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACjD,QAAQ,IAAI,KAAK,WAAW,KAAK,CAAC;CACpC;CAEA,QAAQ,IACN,MACE,yEACF,CACF;AACF","debug_id":"17d56bac-3fa6-5ce5-b8c7-495f6c94c9d7"}
@@ -1,4 +1,4 @@
1
- import { d as updateConfigFile, p as updateStylesFile, u as removeStylesImports } from "./utils-jTHrApMW.mjs";
1
+ import { d as updateConfigFile, p as updateStylesFile, u as removeStylesImports } from "./utils-CvmDmCVd.mjs";
2
2
  export { removeStylesImports, updateConfigFile, updateStylesFile };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e014f3b0-c360-5354-80a5-89e5d65b199a")}catch(e){}}();
4
- //# debugId=e014f3b0-c360-5354-80a5-89e5d65b199a
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8a927382-3953-53ce-9038-f76fc626e4b5")}catch(e){}}();
4
+ //# debugId=8a927382-3953-53ce-9038-f76fc626e4b5
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3a02040d-5a16-5a00-844d-e22c162e4721")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fa6f49e1-f268-5ae2-8e22-cc7adc8fbfba")}catch(e){}}();
3
3
  import fs from "node:fs";
4
4
  import path, { dirname } from "node:path";
5
5
  import crypto from "node:crypto";
@@ -161,5 +161,5 @@ function removeStylesImports(dependencies, projectPath) {
161
161
  //#endregion
162
162
  export { generateProjectDriveId as a, isPowerhouseProject as c, updateConfigFile as d, updatePackagesArray as f, findNodeProjectRoot as i, packageManagers as l, POWERHOUSE_GLOBAL_DIR as n, getPackageManagerFromLockfile as o, updateStylesFile as p, defaultPathValidation as r, getProjectInfo as s, POWERHOUSE_CONFIG_FILE as t, removeStylesImports as u };
163
163
 
164
- //# sourceMappingURL=utils-jTHrApMW.mjs.map
165
- //# debugId=3a02040d-5a16-5a00-844d-e22c162e4721
164
+ //# sourceMappingURL=utils-CvmDmCVd.mjs.map
165
+ //# debugId=fa6f49e1-f268-5ae2-8e22-cc7adc8fbfba