@powerhousedao/builder-tools 4.1.0-dev.11 → 4.1.0-dev.111

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 (250) hide show
  1. package/README.md +1 -0
  2. package/dist/browser.d.ts +2 -0
  3. package/dist/browser.d.ts.map +1 -0
  4. package/dist/browser.js +2 -0
  5. package/dist/browser.js.map +1 -0
  6. package/dist/connect-build/build.d.ts +1 -1
  7. package/dist/connect-build/build.d.ts.map +1 -1
  8. package/dist/connect-build/build.js +4 -3
  9. package/dist/connect-build/build.js.map +1 -1
  10. package/dist/connect-build/helpers.d.ts +6 -2
  11. package/dist/connect-build/helpers.d.ts.map +1 -1
  12. package/dist/connect-build/helpers.js +19 -3
  13. package/dist/connect-build/helpers.js.map +1 -1
  14. package/dist/connect-build/preview.d.ts +1 -1
  15. package/dist/connect-build/preview.d.ts.map +1 -1
  16. package/dist/connect-build/preview.js +1 -1
  17. package/dist/connect-build/preview.js.map +1 -1
  18. package/dist/connect-studio/index.d.ts +0 -1
  19. package/dist/connect-studio/index.d.ts.map +1 -1
  20. package/dist/connect-studio/index.js +0 -1
  21. package/dist/connect-studio/index.js.map +1 -1
  22. package/dist/connect-studio/server.d.ts +1 -1
  23. package/dist/connect-studio/server.d.ts.map +1 -1
  24. package/dist/connect-studio/server.js +53 -15
  25. package/dist/connect-studio/server.js.map +1 -1
  26. package/dist/connect-studio/studio.d.ts +1 -1
  27. package/dist/connect-studio/studio.d.ts.map +1 -1
  28. package/dist/connect-studio/studio.js +7 -1
  29. package/dist/connect-studio/studio.js.map +1 -1
  30. package/dist/connect-studio/types.d.ts +5 -1
  31. package/dist/connect-studio/types.d.ts.map +1 -1
  32. package/dist/connect-utils/build.d.ts +3 -0
  33. package/dist/connect-utils/build.d.ts.map +1 -0
  34. package/dist/connect-utils/build.js +21 -0
  35. package/dist/connect-utils/build.js.map +1 -0
  36. package/dist/connect-utils/env-config.d.ts +816 -0
  37. package/dist/connect-utils/env-config.d.ts.map +1 -0
  38. package/dist/connect-utils/env-config.js +508 -0
  39. package/dist/connect-utils/env-config.js.map +1 -0
  40. package/dist/connect-utils/helpers.d.ts +11 -3
  41. package/dist/connect-utils/helpers.d.ts.map +1 -1
  42. package/dist/connect-utils/helpers.js +77 -5
  43. package/dist/connect-utils/helpers.js.map +1 -1
  44. package/dist/connect-utils/index.d.ts +9 -0
  45. package/dist/connect-utils/index.d.ts.map +1 -1
  46. package/dist/connect-utils/index.js +9 -0
  47. package/dist/connect-utils/index.js.map +1 -1
  48. package/dist/connect-utils/preview.d.ts +3 -0
  49. package/dist/connect-utils/preview.d.ts.map +1 -0
  50. package/dist/connect-utils/preview.js +33 -0
  51. package/dist/connect-utils/preview.js.map +1 -0
  52. package/dist/connect-utils/studio.d.ts +7 -0
  53. package/dist/connect-utils/studio.d.ts.map +1 -0
  54. package/dist/connect-utils/studio.js +30 -0
  55. package/dist/connect-utils/studio.js.map +1 -0
  56. package/dist/connect-utils/types.d.ts +37 -0
  57. package/dist/connect-utils/types.d.ts.map +1 -0
  58. package/dist/connect-utils/types.js +2 -0
  59. package/dist/connect-utils/types.js.map +1 -0
  60. package/dist/connect-utils/vite-config.d.ts +61 -0
  61. package/dist/connect-utils/vite-config.d.ts.map +1 -0
  62. package/dist/connect-utils/vite-config.js +254 -0
  63. package/dist/connect-utils/vite-config.js.map +1 -0
  64. package/dist/connect-utils/vite-plugins/base.d.ts +1 -1
  65. package/dist/connect-utils/vite-plugins/base.d.ts.map +1 -1
  66. package/dist/connect-utils/vite-plugins/base.js.map +1 -1
  67. package/dist/connect-utils/vite-plugins/document-models-hmr.d.ts +3 -0
  68. package/dist/connect-utils/vite-plugins/document-models-hmr.d.ts.map +1 -0
  69. package/dist/connect-utils/vite-plugins/document-models-hmr.js +62 -0
  70. package/dist/connect-utils/vite-plugins/document-models-hmr.js.map +1 -0
  71. package/dist/connect-utils/vite-plugins/editors-hmr.d.ts +3 -0
  72. package/dist/connect-utils/vite-plugins/editors-hmr.d.ts.map +1 -0
  73. package/dist/connect-utils/vite-plugins/editors-hmr.js +61 -0
  74. package/dist/connect-utils/vite-plugins/editors-hmr.js.map +1 -0
  75. package/dist/connect-utils/vite-plugins/external-packages.d.ts +1 -1
  76. package/dist/connect-utils/vite-plugins/external-packages.d.ts.map +1 -1
  77. package/dist/connect-utils/vite-plugins/external-packages.js +15 -7
  78. package/dist/connect-utils/vite-plugins/external-packages.js.map +1 -1
  79. package/dist/connect-utils/vite-plugins/importmap.d.ts +1 -1
  80. package/dist/connect-utils/vite-plugins/importmap.d.ts.map +1 -1
  81. package/dist/connect-utils/vite-plugins/importmap.js +3 -1
  82. package/dist/connect-utils/vite-plugins/importmap.js.map +1 -1
  83. package/dist/connect-utils/vite-plugins/ph-external-packages.d.ts +2 -0
  84. package/dist/connect-utils/vite-plugins/ph-external-packages.d.ts.map +1 -0
  85. package/dist/connect-utils/vite-plugins/ph-external-packages.js +147 -0
  86. package/dist/connect-utils/vite-plugins/ph-external-packages.js.map +1 -0
  87. package/dist/connect-utils/vite-plugins/studio.d.ts +1 -1
  88. package/dist/connect-utils/vite-plugins/studio.d.ts.map +1 -1
  89. package/dist/document-model-editor/components/button.d.ts +1 -3
  90. package/dist/document-model-editor/components/button.d.ts.map +1 -1
  91. package/dist/document-model-editor/components/button.js.map +1 -1
  92. package/dist/document-model-editor/components/code-editors/constants.d.ts +3 -0
  93. package/dist/document-model-editor/components/code-editors/constants.d.ts.map +1 -0
  94. package/dist/document-model-editor/components/code-editors/constants.js +38 -0
  95. package/dist/document-model-editor/components/code-editors/constants.js.map +1 -0
  96. package/dist/document-model-editor/components/code-editors/factories.d.ts +4 -0
  97. package/dist/document-model-editor/components/code-editors/factories.d.ts.map +1 -0
  98. package/dist/document-model-editor/components/code-editors/factories.js +47 -0
  99. package/dist/document-model-editor/components/code-editors/factories.js.map +1 -0
  100. package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts +3 -3
  101. package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts.map +1 -1
  102. package/dist/document-model-editor/components/code-editors/graphql-editor.js +6 -2
  103. package/dist/document-model-editor/components/code-editors/graphql-editor.js.map +1 -1
  104. package/dist/document-model-editor/components/code-editors/hooks.d.ts +23 -0
  105. package/dist/document-model-editor/components/code-editors/hooks.d.ts.map +1 -0
  106. package/dist/document-model-editor/components/code-editors/hooks.js +59 -0
  107. package/dist/document-model-editor/components/code-editors/hooks.js.map +1 -0
  108. package/dist/document-model-editor/components/code-editors/json-editor.d.ts +2 -2
  109. package/dist/document-model-editor/components/code-editors/json-editor.d.ts.map +1 -1
  110. package/dist/document-model-editor/components/code-editors/json-editor.js +7 -4
  111. package/dist/document-model-editor/components/code-editors/json-editor.js.map +1 -1
  112. package/dist/document-model-editor/components/code-editors/linting.d.ts +6 -0
  113. package/dist/document-model-editor/components/code-editors/linting.d.ts.map +1 -0
  114. package/dist/document-model-editor/components/code-editors/linting.js +59 -0
  115. package/dist/document-model-editor/components/code-editors/linting.js.map +1 -0
  116. package/dist/document-model-editor/components/divider.js +1 -1
  117. package/dist/document-model-editor/components/divider.js.map +1 -1
  118. package/dist/document-model-editor/components/form.d.ts +1 -1
  119. package/dist/document-model-editor/components/form.d.ts.map +1 -1
  120. package/dist/document-model-editor/components/form.js +1 -1
  121. package/dist/document-model-editor/components/form.js.map +1 -1
  122. package/dist/document-model-editor/components/label.d.ts +1 -1
  123. package/dist/document-model-editor/components/label.d.ts.map +1 -1
  124. package/dist/document-model-editor/components/label.js.map +1 -1
  125. package/dist/document-model-editor/components/model-metadata-form.d.ts +4 -4
  126. package/dist/document-model-editor/components/model-metadata-form.d.ts.map +1 -1
  127. package/dist/document-model-editor/components/model-metadata-form.js +5 -5
  128. package/dist/document-model-editor/components/model-metadata-form.js.map +1 -1
  129. package/dist/document-model-editor/components/module-form.d.ts +3 -3
  130. package/dist/document-model-editor/components/module-form.d.ts.map +1 -1
  131. package/dist/document-model-editor/components/module-form.js +1 -1
  132. package/dist/document-model-editor/components/module-form.js.map +1 -1
  133. package/dist/document-model-editor/components/module.d.ts +1 -1
  134. package/dist/document-model-editor/components/module.d.ts.map +1 -1
  135. package/dist/document-model-editor/components/modules.d.ts +2 -2
  136. package/dist/document-model-editor/components/modules.d.ts.map +1 -1
  137. package/dist/document-model-editor/components/modules.js +1 -1
  138. package/dist/document-model-editor/components/modules.js.map +1 -1
  139. package/dist/document-model-editor/components/operation-description-form.d.ts +2 -2
  140. package/dist/document-model-editor/components/operation-description-form.d.ts.map +1 -1
  141. package/dist/document-model-editor/components/operation-error-form.d.ts +3 -3
  142. package/dist/document-model-editor/components/operation-error-form.d.ts.map +1 -1
  143. package/dist/document-model-editor/components/operation-error-form.js.map +1 -1
  144. package/dist/document-model-editor/components/operation-errors.d.ts +2 -2
  145. package/dist/document-model-editor/components/operation-errors.d.ts.map +1 -1
  146. package/dist/document-model-editor/components/operation-form.d.ts +3 -3
  147. package/dist/document-model-editor/components/operation-form.d.ts.map +1 -1
  148. package/dist/document-model-editor/components/operation-form.js +1 -1
  149. package/dist/document-model-editor/components/operation-form.js.map +1 -1
  150. package/dist/document-model-editor/components/operation.d.ts +4 -4
  151. package/dist/document-model-editor/components/operation.d.ts.map +1 -1
  152. package/dist/document-model-editor/components/operation.js +3 -3
  153. package/dist/document-model-editor/components/operation.js.map +1 -1
  154. package/dist/document-model-editor/components/operations.d.ts +3 -3
  155. package/dist/document-model-editor/components/operations.d.ts.map +1 -1
  156. package/dist/document-model-editor/components/state-schemas.d.ts +4 -2
  157. package/dist/document-model-editor/components/state-schemas.d.ts.map +1 -1
  158. package/dist/document-model-editor/components/state-schemas.js +7 -7
  159. package/dist/document-model-editor/components/state-schemas.js.map +1 -1
  160. package/dist/document-model-editor/components/text-field.d.ts.map +1 -1
  161. package/dist/document-model-editor/components/text-field.js.map +1 -1
  162. package/dist/document-model-editor/config.d.ts +3 -0
  163. package/dist/document-model-editor/config.d.ts.map +1 -0
  164. package/dist/document-model-editor/config.js +4 -0
  165. package/dist/document-model-editor/config.js.map +1 -0
  166. package/dist/document-model-editor/context/form-context.d.ts +1 -1
  167. package/dist/document-model-editor/context/form-context.d.ts.map +1 -1
  168. package/dist/document-model-editor/context/schema-context.d.ts +1 -1
  169. package/dist/document-model-editor/context/schema-context.d.ts.map +1 -1
  170. package/dist/document-model-editor/context/schema-context.js.map +1 -1
  171. package/dist/document-model-editor/document-model-editor.stories.d.ts +6 -6
  172. package/dist/document-model-editor/document-model-editor.stories.d.ts.map +1 -1
  173. package/dist/document-model-editor/document-model-editor.stories.js +195 -183
  174. package/dist/document-model-editor/document-model-editor.stories.js.map +1 -1
  175. package/dist/document-model-editor/editor.d.ts +1 -2
  176. package/dist/document-model-editor/editor.d.ts.map +1 -1
  177. package/dist/document-model-editor/editor.js +80 -61
  178. package/dist/document-model-editor/editor.js.map +1 -1
  179. package/dist/document-model-editor/hooks/index.d.ts +3 -0
  180. package/dist/document-model-editor/hooks/index.d.ts.map +1 -0
  181. package/dist/document-model-editor/hooks/index.js +3 -0
  182. package/dist/document-model-editor/hooks/index.js.map +1 -0
  183. package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts +5 -0
  184. package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts.map +1 -0
  185. package/dist/document-model-editor/hooks/useDocumentModelDocument.js +8 -0
  186. package/dist/document-model-editor/hooks/useDocumentModelDocument.js.map +1 -0
  187. package/dist/document-model-editor/index.d.ts +1 -2
  188. package/dist/document-model-editor/index.d.ts.map +1 -1
  189. package/dist/document-model-editor/index.js +1 -2
  190. package/dist/document-model-editor/index.js.map +1 -1
  191. package/dist/document-model-editor/module.d.ts +2 -3
  192. package/dist/document-model-editor/module.d.ts.map +1 -1
  193. package/dist/document-model-editor/module.js +4 -6
  194. package/dist/document-model-editor/module.js.map +1 -1
  195. package/dist/document-model-editor/schemas/inputs.d.ts +2 -2
  196. package/dist/document-model-editor/types/documents.d.ts +1 -1
  197. package/dist/document-model-editor/types/documents.d.ts.map +1 -1
  198. package/dist/document-model-editor/utils/helpers.d.ts +4 -7
  199. package/dist/document-model-editor/utils/helpers.d.ts.map +1 -1
  200. package/dist/document-model-editor/utils/helpers.js +11 -10
  201. package/dist/document-model-editor/utils/helpers.js.map +1 -1
  202. package/dist/document-model-editor/utils/linting.d.ts +1 -1
  203. package/dist/document-model-editor/utils/linting.d.ts.map +1 -1
  204. package/dist/document-model-editor/utils/linting.js +3 -5
  205. package/dist/document-model-editor/utils/linting.js.map +1 -1
  206. package/dist/document-model-editor/utils/style.d.ts +1 -1
  207. package/dist/document-model-editor/utils/style.d.ts.map +1 -1
  208. package/dist/document-model-editor/utils/style.js.map +1 -1
  209. package/dist/editor-utils/components/documentEditor.d.ts +1 -1
  210. package/dist/editor-utils/components/documentEditor.d.ts.map +1 -1
  211. package/dist/editor-utils/components/editorToolbar.d.ts +1 -1
  212. package/dist/editor-utils/components/editorToolbar.d.ts.map +1 -1
  213. package/dist/editor-utils/components/editorWorksheet.d.ts +1 -1
  214. package/dist/editor-utils/components/editorWorksheet.d.ts.map +1 -1
  215. package/dist/editor-utils/components/styles.d.ts +1 -1
  216. package/dist/editor-utils/components/styles.d.ts.map +1 -1
  217. package/dist/editor-utils/components/stylesVariant.d.ts +1 -1
  218. package/dist/editor-utils/components/stylesVariant.d.ts.map +1 -1
  219. package/dist/editor-utils/components/textInput.d.ts +1 -1
  220. package/dist/editor-utils/components/textInput.d.ts.map +1 -1
  221. package/dist/editor-utils/components/textInput.js.map +1 -1
  222. package/dist/editor-utils/components/textInputVariant.d.ts +1 -1
  223. package/dist/editor-utils/components/textInputVariant.d.ts.map +1 -1
  224. package/dist/editor-utils/components/textInputVariant.js +1 -1
  225. package/dist/editor-utils/components/textInputVariant.js.map +1 -1
  226. package/dist/editor-utils/components/toolbarButton.d.ts +1 -1
  227. package/dist/editor-utils/components/toolbarButton.d.ts.map +1 -1
  228. package/dist/editor-utils/hooks/useEnsInfo.d.ts +1 -1
  229. package/dist/editor-utils/hooks/useEnsInfo.d.ts.map +1 -1
  230. package/dist/editor-utils/hooks/useEnsInfo.js +1 -1
  231. package/dist/editor-utils/hooks/useEnsInfo.js.map +1 -1
  232. package/dist/editor-utils/reducer.d.ts +2 -2
  233. package/dist/editor-utils/reducer.d.ts.map +1 -1
  234. package/dist/editor-utils/reducer.js +2 -2
  235. package/dist/editor-utils/reducer.js.map +1 -1
  236. package/dist/editor-utils/storybook.d.ts +17 -14
  237. package/dist/editor-utils/storybook.d.ts.map +1 -1
  238. package/dist/editor-utils/storybook.js +34 -49
  239. package/dist/editor-utils/storybook.js.map +1 -1
  240. package/dist/index.d.ts +4 -0
  241. package/dist/index.d.ts.map +1 -0
  242. package/dist/index.js +4 -0
  243. package/dist/index.js.map +1 -0
  244. package/dist/style.css +4 -891
  245. package/dist/tsconfig.tsbuildinfo +1 -1
  246. package/package.json +72 -44
  247. package/dist/document-model-editor/components/code-editors/utils.d.ts +0 -32
  248. package/dist/document-model-editor/components/code-editors/utils.d.ts.map +0 -1
  249. package/dist/document-model-editor/components/code-editors/utils.js +0 -193
  250. package/dist/document-model-editor/components/code-editors/utils.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-config.d.ts","sourceRoot":"","sources":["../../connect-utils/env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB;;GAEG;AACH,QAAA,MAAM,cAAc;IAClB;;;OAGG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAiVH;;GAEG;AACH,eAAO,MAAM,gBAAgB;IA1U3B;;;OAGG;;IAGH;;;OAGG;;IAKH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;;OAGG;;;IAYH;;;OAGG;;IAGH;;;OAGG;;IAGH;;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UAAU,CAAC,GAAG,IAAI,CA0B/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuB1D"}
@@ -0,0 +1,508 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Coerces string values to boolean.
4
+ * Accepts: "true", "false", true, false
5
+ */
6
+ const booleanString = z
7
+ .union([z.boolean(), z.enum(["true", "false"])])
8
+ .transform((val) => {
9
+ if (typeof val === "boolean")
10
+ return val;
11
+ return val === "true";
12
+ });
13
+ /**
14
+ * Coerces string values to number.
15
+ */
16
+ const numberString = z.union([z.number(), z.string()]).transform((val) => {
17
+ if (typeof val === "number")
18
+ return val;
19
+ return parseInt(val, 10);
20
+ });
21
+ // ============================================================================
22
+ // Build-time Environment Variables
23
+ // ============================================================================
24
+ /**
25
+ * Build-time configuration schema
26
+ */
27
+ const buildEnvSchema = z.object({
28
+ /**
29
+ * Path to powerhouse config file
30
+ * @default "powerhouse.config.json"
31
+ */
32
+ PH_CONFIG_PATH: z.string().optional(),
33
+ /**
34
+ * Comma-separated list of package names to load
35
+ * @example "package1,package2"
36
+ */
37
+ PH_PACKAGES: z.string().optional(),
38
+ /**
39
+ * Path to local package to load during development
40
+ */
41
+ PH_LOCAL_PACKAGE: z.string().optional(),
42
+ /**
43
+ * Disable loading of local package
44
+ * @default false
45
+ */
46
+ PH_DISABLE_LOCAL_PACKAGE: booleanString.default(false),
47
+ /**
48
+ * Sentry authentication token for uploading source maps
49
+ */
50
+ PH_SENTRY_AUTH_TOKEN: z.string().optional(),
51
+ /**
52
+ * Sentry organization slug
53
+ */
54
+ PH_SENTRY_ORG: z.string().optional(),
55
+ /**
56
+ * Sentry project slug
57
+ */
58
+ PH_SENTRY_PROJECT: z.string().optional(),
59
+ });
60
+ // ============================================================================
61
+ // Application Configuration
62
+ // ============================================================================
63
+ /**
64
+ * Application configuration schema
65
+ */
66
+ const appConfigSchema = z.object({
67
+ /**
68
+ * Application version number
69
+ * @default "unknown"
70
+ */
71
+ PH_CONNECT_VERSION: z.string().default("unknown"),
72
+ /**
73
+ * Log level for the application
74
+ * @default "info"
75
+ */
76
+ PH_CONNECT_LOG_LEVEL: z
77
+ .enum(["debug", "info", "warn", "error"])
78
+ .default("info"),
79
+ /**
80
+ * Whether app requires hard refresh on updates
81
+ * @default true
82
+ */
83
+ PH_CONNECT_REQUIRES_HARD_REFRESH: booleanString.default(true),
84
+ /**
85
+ * Show warning when app version is outdated
86
+ * @default false
87
+ */
88
+ PH_CONNECT_WARN_OUTDATED_APP: booleanString.default(false),
89
+ /**
90
+ * Enable studio mode features
91
+ * @default false
92
+ */
93
+ PH_CONNECT_STUDIO_MODE: booleanString.default(false),
94
+ /**
95
+ * Base path for the Connect router, defaults to import.meta.env.BASE_URL
96
+ */
97
+ PH_CONNECT_BASE_PATH: z.string().optional(),
98
+ /**
99
+ * Default drives URL to load on startup
100
+ */
101
+ PH_CONNECT_DEFAULT_DRIVES_URL: z.string().optional(),
102
+ /**
103
+ * Strategy for preserving drives
104
+ */
105
+ PH_CONNECT_DRIVES_PRESERVE_STRATEGY: z.string().optional(),
106
+ /**
107
+ * Interval in milliseconds to check for version updates
108
+ * @default 3600000 (1 hour)
109
+ */
110
+ PH_CONNECT_VERSION_CHECK_INTERVAL: numberString.default(60 * 60 * 1000),
111
+ /**
112
+ * CLI version number
113
+ */
114
+ PH_CONNECT_CLI_VERSION: z.string().optional(),
115
+ /**
116
+ * Chunk size for file upload operations
117
+ * @default 50
118
+ */
119
+ PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE: numberString.default(50),
120
+ });
121
+ // ============================================================================
122
+ // Feature Flags & UI Configuration
123
+ // ============================================================================
124
+ /**
125
+ * Feature flags and UI configuration schema
126
+ */
127
+ const featureFlagsSchema = z.object({
128
+ /**
129
+ * Hide the "Add Drive" button completely
130
+ * @default false
131
+ */
132
+ PH_CONNECT_DISABLE_ADD_DRIVE: booleanString.default(false),
133
+ /**
134
+ * Show search bar in the UI
135
+ * @default false
136
+ */
137
+ PH_CONNECT_SEARCH_BAR_ENABLED: booleanString.default(false),
138
+ /**
139
+ * Hide document model selection in settings
140
+ * @default true
141
+ */
142
+ PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS: booleanString.default(true),
143
+ /**
144
+ * Comma-separated list of enabled editor types
145
+ * Use "*" to enable all editors
146
+ * @example "editor1,editor2" or "*"
147
+ */
148
+ PH_CONNECT_ENABLED_EDITORS: z.string().optional(),
149
+ /**
150
+ * Comma-separated list of disabled editor types
151
+ * @default "powerhouse/document-drive"
152
+ */
153
+ PH_CONNECT_DISABLED_EDITORS: z.string().default("powerhouse/document-drive"),
154
+ /**
155
+ * Google Analytics tracking ID
156
+ */
157
+ PH_CONNECT_GA_TRACKING_ID: z.string().optional(),
158
+ /**
159
+ * Disable loading of external packages
160
+ * @default false
161
+ */
162
+ PH_CONNECT_EXTERNAL_PACKAGES_DISABLED: booleanString.default(false),
163
+ });
164
+ // ============================================================================
165
+ // Drives Configuration
166
+ // ============================================================================
167
+ /**
168
+ * Drives configuration schema
169
+ */
170
+ const drivesConfigSchema = z.object({
171
+ /**
172
+ * Enable public drives section
173
+ * @default true
174
+ */
175
+ PH_CONNECT_PUBLIC_DRIVES_ENABLED: booleanString.default(true),
176
+ /**
177
+ * Allow adding public drives
178
+ * @default true
179
+ */
180
+ PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES: booleanString.default(false),
181
+ /**
182
+ * Allow deleting public drives
183
+ * @default true
184
+ */
185
+ PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES: booleanString.default(false),
186
+ /**
187
+ * Enable cloud drives section
188
+ * @default true
189
+ */
190
+ PH_CONNECT_CLOUD_DRIVES_ENABLED: booleanString.default(true),
191
+ /**
192
+ * Allow adding cloud drives
193
+ * @default true
194
+ */
195
+ PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES: booleanString.default(false),
196
+ /**
197
+ * Allow deleting cloud drives
198
+ * @default true
199
+ */
200
+ PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES: booleanString.default(false),
201
+ /**
202
+ * Enable local drives section
203
+ * @default true
204
+ */
205
+ PH_CONNECT_LOCAL_DRIVES_ENABLED: booleanString.default(true),
206
+ /**
207
+ * Allow adding local drives
208
+ * @default true
209
+ */
210
+ PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES: booleanString.default(false),
211
+ /**
212
+ * Allow deleting local drives
213
+ * @default true
214
+ */
215
+ PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES: booleanString.default(false),
216
+ });
217
+ // ============================================================================
218
+ // Analytics Processor Configuration
219
+ // ============================================================================
220
+ /**
221
+ * Analytics processor configuration schema
222
+ */
223
+ const analyticsProcessorsConfigSchema = z.object({
224
+ /**
225
+ * Enable analytics
226
+ * @default true
227
+ */
228
+ PH_CONNECT_ANALYTICS_ENABLED: booleanString.default(true),
229
+ /**
230
+ * Name of the analytics database
231
+ * Defaults to basename + ":analytics"
232
+ */
233
+ PH_CONNECT_ANALYTICS_DATABASE_NAME: z.string().optional(),
234
+ /**
235
+ * Disable analytics database worker
236
+ * @default false
237
+ */
238
+ PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED: booleanString.default(true),
239
+ /**
240
+ * Enable diff analytics tracking
241
+ * @default false
242
+ */
243
+ PH_CONNECT_DIFF_ANALYTICS_ENABLED: booleanString.default(false),
244
+ /**
245
+ * Enable drive analytics tracking
246
+ * @default true
247
+ */
248
+ PH_CONNECT_DRIVE_ANALYTICS_ENABLED: booleanString.default(true),
249
+ /**
250
+ * Enable external analytics processors
251
+ * @default true
252
+ */
253
+ PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED: booleanString.default(true),
254
+ });
255
+ /**
256
+ * Relational DB processor configuration schema
257
+ */
258
+ const relationalProcessorsConfigSchema = z.object({
259
+ /**
260
+ * Enable relational processors
261
+ * @default true
262
+ */
263
+ PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED: booleanString.default(true),
264
+ /**
265
+ * Enable external relational processors
266
+ * @default true
267
+ */
268
+ PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED: booleanString.default(true),
269
+ });
270
+ /**
271
+ * External processors configuration schema
272
+ */
273
+ const processorsBaseConfigSchema = z.object({
274
+ /**
275
+ * Enable processors
276
+ * @default true
277
+ */
278
+ PH_CONNECT_PROCESSORS_ENABLED: booleanString.default(true),
279
+ /**
280
+ * Enable external processors
281
+ * @default true
282
+ */
283
+ PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED: booleanString.default(true),
284
+ });
285
+ const processorsConfigSchema = processorsBaseConfigSchema
286
+ .merge(analyticsProcessorsConfigSchema)
287
+ .merge(relationalProcessorsConfigSchema);
288
+ // ============================================================================
289
+ // Sentry Configuration
290
+ // ============================================================================
291
+ /**
292
+ * Sentry error tracking configuration schema
293
+ */
294
+ const sentryConfigSchema = z.object({
295
+ /**
296
+ * Sentry release identifier
297
+ * Defaults to app version
298
+ */
299
+ PH_CONNECT_SENTRY_RELEASE: z.string().optional(),
300
+ /**
301
+ * Sentry DSN for error reporting
302
+ */
303
+ PH_CONNECT_SENTRY_DSN: z.string().optional(),
304
+ /**
305
+ * Sentry environment name
306
+ * @default "prod"
307
+ */
308
+ PH_CONNECT_SENTRY_ENV: z.string().default("dev"),
309
+ /**
310
+ * Enable Sentry performance tracing
311
+ * @default false
312
+ */
313
+ PH_CONNECT_SENTRY_TRACING_ENABLED: booleanString.default(false),
314
+ });
315
+ // ============================================================================
316
+ // Renown Configuration
317
+ // ============================================================================
318
+ /**
319
+ * Renown authentication configuration schema
320
+ */
321
+ const renownConfigSchema = z.object({
322
+ /**
323
+ * Renown authentication service URL
324
+ * @default "https://auth.renown.id"
325
+ */
326
+ PH_CONNECT_RENOWN_URL: z.string().default("https://auth.renown.id"),
327
+ /**
328
+ * Renown network ID
329
+ * @default "eip155"
330
+ */
331
+ PH_CONNECT_RENOWN_NETWORK_ID: z.string().default("eip155"),
332
+ /**
333
+ * Renown chain ID
334
+ * @default 1
335
+ */
336
+ PH_CONNECT_RENOWN_CHAIN_ID: numberString.default(1),
337
+ });
338
+ // ============================================================================
339
+ // Combined Schemas
340
+ // ============================================================================
341
+ /**
342
+ * Complete runtime environment schema (all PH_CONNECT_* vars)
343
+ */
344
+ export const runtimeEnvSchema = appConfigSchema
345
+ .merge(featureFlagsSchema)
346
+ .merge(drivesConfigSchema)
347
+ .merge(processorsConfigSchema)
348
+ .merge(sentryConfigSchema)
349
+ .merge(renownConfigSchema);
350
+ /**
351
+ * Complete environment schema (build + runtime)
352
+ */
353
+ export const connectEnvSchema = buildEnvSchema.merge(runtimeEnvSchema);
354
+ /**
355
+ * Internal helper to merge environment sources with priority.
356
+ * Validates each value and falls back to next priority if invalid.
357
+ */
358
+ function mergeEnvSources(options, keys, schema) {
359
+ const { processEnv = {}, optionsEnv = {}, fileEnv = {} } = options;
360
+ const merged = {};
361
+ // Apply priority: fileEnv < optionsEnv < processEnv
362
+ for (const key of keys) {
363
+ const sources = [
364
+ { name: "process.env", value: processEnv[key] },
365
+ { name: "options", value: optionsEnv[key] },
366
+ { name: "fileEnv", value: fileEnv[key] },
367
+ ];
368
+ // Try each source in priority order
369
+ for (const source of sources) {
370
+ const value = source.value;
371
+ if (value === undefined || value === "")
372
+ continue;
373
+ // Try to validate just this field
374
+ try {
375
+ const fieldSchema = schema.shape[key];
376
+ if (fieldSchema) {
377
+ fieldSchema.parse(value);
378
+ merged[key] = value;
379
+ break; // Successfully validated, use this value
380
+ }
381
+ // No schema for this key, accept it
382
+ console.warn(`Unknown environment variable: '${key}'`);
383
+ merged[key] = value;
384
+ break;
385
+ }
386
+ catch {
387
+ // Validation failed, log warning and try next source
388
+ const valueStr = value === null
389
+ ? "null"
390
+ : typeof value === "object"
391
+ ? JSON.stringify(value)
392
+ : value;
393
+ console.warn(`Invalid value for ${key} from ${source.name}: ${valueStr}. Trying next source.`);
394
+ }
395
+ }
396
+ }
397
+ return merged;
398
+ }
399
+ /**
400
+ * Loads and validates environment variables with priority:
401
+ * 1. process.env (highest)
402
+ * 2. options
403
+ * 3. fileEnv
404
+ * 4. defaults from schema (lowest)
405
+ *
406
+ * @param options - Environment sources in priority order
407
+ * @returns Validated and typed environment configuration
408
+ */
409
+ export function loadConnectEnv(options = {}) {
410
+ const allKeys = new Set([
411
+ ...Object.keys(buildEnvSchema.shape),
412
+ ...Object.keys(runtimeEnvSchema.shape),
413
+ ]);
414
+ const merged = mergeEnvSources(options, allKeys, connectEnvSchema);
415
+ return connectEnvSchema.parse(merged);
416
+ }
417
+ /**
418
+ * Loads only runtime environment variables
419
+ *
420
+ * @param options - Environment sources in priority order
421
+ * @returns Validated runtime environment configuration
422
+ */
423
+ export function loadRuntimeEnv(options = {}) {
424
+ const allKeys = new Set(Object.keys(runtimeEnvSchema.shape));
425
+ const merged = mergeEnvSources(options, allKeys, runtimeEnvSchema);
426
+ return runtimeEnvSchema.parse(merged);
427
+ }
428
+ /**
429
+ * Loads only build-time environment variables
430
+ *
431
+ * @param options - Environment sources in priority order
432
+ * @returns Validated build environment configuration
433
+ */
434
+ export function loadBuildEnv(options = {}) {
435
+ const allKeys = new Set(Object.keys(buildEnvSchema.shape));
436
+ const merged = mergeEnvSources(options, allKeys, buildEnvSchema);
437
+ return buildEnvSchema.parse(merged);
438
+ }
439
+ /**
440
+ * Safely sets Connect environment variables with validation.
441
+ * Invalid values will log a warning and be skipped.
442
+ *
443
+ * @param values - Type-safe object with key-value pairs to set
444
+ *
445
+ * @example
446
+ * ```ts
447
+ * setConnectEnv({
448
+ * PH_CONNECT_LOG_LEVEL: "debug",
449
+ * PH_CONNECT_VERSION: "1.2.3",
450
+ * PH_CONNECT_STUDIO_MODE: true,
451
+ * });
452
+ * ```
453
+ */
454
+ export function setConnectEnv(values) {
455
+ for (const [key, value] of Object.entries(values)) {
456
+ // Check if key exists in schema
457
+ const fieldSchema = connectEnvSchema.shape[key];
458
+ if (!fieldSchema) {
459
+ console.warn(`Unknown environment variable: ${key}. Variable not set. Valid keys: ${Object.keys(connectEnvSchema.shape).join(", ")}`);
460
+ continue;
461
+ }
462
+ try {
463
+ // Validate the value
464
+ fieldSchema.parse(value);
465
+ // Set the value (convert to string for process.env compatibility)
466
+ process.env[key] = String(value);
467
+ }
468
+ catch (error) {
469
+ console.warn(`Invalid value for ${key}: ${String(value)}. Validation failed.`, error);
470
+ }
471
+ }
472
+ }
473
+ /**
474
+ * Normalizes a base path to ensure it:
475
+ * - Starts with a forward slash (/)
476
+ * - Ends with a forward slash (/)
477
+ * - Has no relative path prefix (.)
478
+ *
479
+ * @param basePath - The base path to normalize
480
+ * @returns The normalized base path
481
+ *
482
+ * @example
483
+ * normalizeBasePath('/app') // '/app/'
484
+ * normalizeBasePath('./app/') // '/app/'
485
+ * normalizeBasePath('app') // '/app/'
486
+ * normalizeBasePath('/') // '/'
487
+ * normalizeBasePath('') // '/'
488
+ */
489
+ export function normalizeBasePath(basePath) {
490
+ if (!basePath) {
491
+ return "/";
492
+ }
493
+ let normalized = basePath;
494
+ // Remove relative path prefix
495
+ if (normalized.startsWith(".")) {
496
+ normalized = normalized.slice(1);
497
+ }
498
+ // Ensure it starts with a forward slash
499
+ if (!normalized.startsWith("/")) {
500
+ normalized = `/${normalized}`;
501
+ }
502
+ // Ensure it ends with a forward slash
503
+ if (!normalized.endsWith("/")) {
504
+ normalized = `${normalized}/`;
505
+ }
506
+ return normalized;
507
+ }
508
+ //# sourceMappingURL=env-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-config.js","sourceRoot":"","sources":["../../connect-utils/env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC;KACpB,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAA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AG,CAAC;IAChC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,10 +1,17 @@
1
- import { type PowerhouseConfig } from "@powerhousedao/config/powerhouse";
2
- import { type Plugin } from "vite";
1
+ import type { PowerhouseConfig } from "@powerhousedao/config";
2
+ import type { Plugin } from "vite";
3
+ import type { ConnectCommonOptions } from "./types.js";
4
+ export declare const DEFAULT_CONNECT_OUTDIR = ".ph/connect-build/dist/";
5
+ export declare function loadVite(): Promise<typeof import("vite")>;
6
+ export declare function commonConnectOptionsToEnv(options: ConnectCommonOptions): void;
7
+ export declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
3
8
  export declare function resolvePackage(packageName: string, root?: string): string;
9
+ export declare function resolveConnectPackageJson(root?: string): JSON | null;
4
10
  /**
5
11
  * Finds the dist dir of Connect on the local machine
6
12
  */
7
- export declare function resolveConnect(root?: string): string;
13
+ export declare function resolveConnectBundle(root?: string): string;
14
+ export declare function resolveConnectPublicDir(root?: string): string;
8
15
  /**
9
16
  * Copies the Connect dist dir to the target path
10
17
  */
@@ -37,4 +44,5 @@ export declare function appendToHtmlHead(pathToHtml: string, contents: string):
37
44
  */
38
45
  export declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
39
46
  export declare function runTsc(outDir: string): void;
47
+ export declare function stripVersionFromPackage(packageName: string): string;
40
48
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../connect-utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAMzE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,SAAgB,UAIvE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAgB,UAGlD;AAED;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EpC;AAID,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CASnE"}
@@ -2,19 +2,79 @@ import { exec, execSync } from "node:child_process";
2
2
  import fs, { existsSync } from "node:fs";
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import { createRequire } from "node:module";
5
- import { join, resolve } from "node:path";
5
+ import path, { join, resolve } from "node:path";
6
+ import { cwd } from "node:process";
6
7
  import { LOCAL_PACKAGE_ID } from "./constants.js";
8
+ import { setConnectEnv } from "./env-config.js";
9
+ export const DEFAULT_CONNECT_OUTDIR = ".ph/connect-build/dist/";
10
+ export async function loadVite() {
11
+ try {
12
+ return await import("vite");
13
+ }
14
+ catch (error) {
15
+ const viteError = new Error("Could not load 'vite'. Is it installed in your project?");
16
+ throw viteError;
17
+ }
18
+ }
19
+ export function commonConnectOptionsToEnv(options) {
20
+ const { base, configFile, defaultDrivesUrl, drivesPreserveStrategy, disableLocalPackage, } = options;
21
+ if (base) {
22
+ setConnectEnv({
23
+ PH_CONNECT_BASE_PATH: base,
24
+ });
25
+ }
26
+ if (configFile) {
27
+ setConnectEnv({
28
+ PH_CONFIG_PATH: configFile,
29
+ });
30
+ }
31
+ if (defaultDrivesUrl) {
32
+ setConnectEnv({
33
+ PH_CONNECT_DEFAULT_DRIVES_URL: defaultDrivesUrl.join(","),
34
+ });
35
+ }
36
+ if (drivesPreserveStrategy) {
37
+ setConnectEnv({
38
+ PH_CONNECT_DRIVES_PRESERVE_STRATEGY: drivesPreserveStrategy,
39
+ });
40
+ }
41
+ if (disableLocalPackage) {
42
+ setConnectEnv({
43
+ PH_DISABLE_LOCAL_PACKAGE: true,
44
+ });
45
+ }
46
+ }
47
+ export function resolveViteConfigPath(options) {
48
+ const { projectRoot = cwd(), viteConfigFile } = options;
49
+ return viteConfigFile || join(projectRoot, "vite.config.ts");
50
+ }
7
51
  export function resolvePackage(packageName, root = process.cwd()) {
8
52
  // find connect installation
9
53
  const require = createRequire(root);
10
54
  return require.resolve(packageName, { paths: [root] });
11
55
  }
56
+ export function resolveConnectPackageJson(root = process.cwd()) {
57
+ try {
58
+ const connectPackageJsonPath = resolvePackage("@powerhousedao/connect/package.json", root);
59
+ const fileContents = fs.readFileSync(connectPackageJsonPath, "utf-8");
60
+ return JSON.parse(fileContents);
61
+ }
62
+ catch (error) {
63
+ console.error(`Error reading Connect package.json:`, error);
64
+ return null;
65
+ }
66
+ }
12
67
  /**
13
68
  * Finds the dist dir of Connect on the local machine
14
69
  */
15
- export function resolveConnect(root = process.cwd()) {
16
- const connectHTMLPath = resolvePackage("@powerhousedao/connect", root);
17
- return resolve(connectHTMLPath, "..");
70
+ export function resolveConnectBundle(root = process.cwd()) {
71
+ const connectIndexPath = resolvePackage("@powerhousedao/connect", root);
72
+ const connectRootPath = connectIndexPath.substring(0, connectIndexPath.indexOf("connect") + "connect".length);
73
+ return join(connectRootPath, "dist/");
74
+ }
75
+ export function resolveConnectPublicDir(root = process.cwd()) {
76
+ const connectIconPath = resolvePackage("@powerhousedao/connect/public/icon.ico", root);
77
+ return path.join(connectIconPath, "../");
18
78
  }
19
79
  /**
20
80
  * Copies the Connect dist dir to the target path
@@ -124,7 +184,7 @@ export function makeImportScriptFromPackages(args) {
124
184
  const fileContent = `${imports.join("\n")}\n\n${exportStatement}`;
125
185
  return fileContent;
126
186
  }
127
- export function ensureNodeVersion(minVersion = "20") {
187
+ export function ensureNodeVersion(minVersion = "22") {
128
188
  const version = process.versions.node;
129
189
  if (!version) {
130
190
  return;
@@ -190,4 +250,16 @@ export async function prependToHtmlHead(pathToHtml, contents) {
190
250
  export function runTsc(outDir) {
191
251
  execSync(`npx tsc --outDir ${outDir}`, { stdio: "inherit" });
192
252
  }
253
+ // Helper function to remove version suffix from package name
254
+ // Handles formats like: @scope/package@version -> @scope/package
255
+ export function stripVersionFromPackage(packageName) {
256
+ const trimmed = packageName.trim();
257
+ if (!trimmed)
258
+ return "";
259
+ const lastAtIndex = trimmed.lastIndexOf("@");
260
+ if (lastAtIndex > 0) {
261
+ return trimmed.substring(0, lastAtIndex);
262
+ }
263
+ return trimmed;
264
+ }
193
265
  //# sourceMappingURL=helpers.js.map