@powerhousedao/codegen 6.0.0-dev.19 → 6.0.0-dev.191

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 (688) hide show
  1. package/{dist/src/templates/boilerplate/LICENSE.js → LICENSE} +1 -4
  2. package/dist/file-builders-BV9wDPPZ.mjs +1652 -0
  3. package/dist/file-builders-BV9wDPPZ.mjs.map +1 -0
  4. package/dist/index-CHAnPBj2.d.mts +199 -0
  5. package/dist/index-CHAnPBj2.d.mts.map +1 -0
  6. package/dist/index-CJZGVSYg.d.mts +65 -0
  7. package/dist/index-CJZGVSYg.d.mts.map +1 -0
  8. package/dist/index.d.mts +298 -0
  9. package/dist/index.d.mts.map +1 -0
  10. package/dist/index.mjs +802 -0
  11. package/dist/index.mjs.map +1 -0
  12. package/dist/src/file-builders/index.d.mts +3 -0
  13. package/dist/src/file-builders/index.mjs +3 -0
  14. package/dist/src/name-builders/index.d.mts +2 -0
  15. package/dist/src/name-builders/index.mjs +146 -0
  16. package/dist/src/name-builders/index.mjs.map +1 -0
  17. package/dist/src/templates/index.d.mts +415 -0
  18. package/dist/src/templates/index.d.mts.map +1 -0
  19. package/dist/src/templates/index.mjs +2 -0
  20. package/dist/src/utils/index.d.mts +125 -0
  21. package/dist/src/utils/index.d.mts.map +1 -0
  22. package/dist/src/utils/index.mjs +380 -0
  23. package/dist/src/utils/index.mjs.map +1 -0
  24. package/dist/templates-BbNsigQX.mjs +6387 -0
  25. package/dist/templates-BbNsigQX.mjs.map +1 -0
  26. package/dist/types-e2ztuDtG.d.mts +87 -0
  27. package/dist/types-e2ztuDtG.d.mts.map +1 -0
  28. package/dist/validation-Bpg_44mW.d.mts +43 -0
  29. package/dist/validation-Bpg_44mW.d.mts.map +1 -0
  30. package/package.json +31 -58
  31. package/dist/index.d.ts +0 -8
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/index.js +0 -7
  34. package/dist/index.js.map +0 -1
  35. package/dist/src/codegen/.hygen/package.json +0 -6
  36. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js +0 -10
  37. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +0 -17
  38. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/schema.esm.t +0 -16
  39. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/actions.esm.t +0 -16
  40. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +0 -9
  41. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/customUtils.esm.t +0 -5
  42. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-schema.esm.t +0 -56
  43. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-type.esm.t +0 -6
  44. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +0 -7
  45. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +0 -121
  46. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/hooks.esm.t +0 -49
  47. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +0 -23
  48. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +0 -127
  49. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/module.esm.t +0 -22
  50. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +0 -93
  51. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +0 -46
  52. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/root-utils.esm.t +0 -11
  53. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootActions.esm.t +0 -13
  54. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +0 -14
  55. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +0 -6
  56. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/src-index.esm.t +0 -5
  57. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +0 -31
  58. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +0 -77
  59. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t +0 -22
  60. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +0 -37
  61. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +0 -44
  62. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/error.esm.t +0 -36
  63. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +0 -71
  64. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t +0 -17
  65. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +0 -118
  66. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +0 -130
  67. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +0 -44
  68. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +0 -58
  69. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveContents.esm.t +0 -23
  70. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +0 -32
  71. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EmptyState.esm.t +0 -19
  72. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Files.esm.t +0 -29
  73. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +0 -108
  74. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Folders.esm.t +0 -28
  75. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/NavigationBreadcrumbs.esm.t +0 -14
  76. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +0 -11
  77. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +0 -20
  78. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +0 -25
  79. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/module.esm.t +0 -15
  80. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +0 -80
  81. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +0 -90
  82. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/module.esm.t +0 -16
  83. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.esm.t +0 -59
  84. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js +0 -9
  85. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/utils.esm.t +0 -100
  86. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +0 -22
  87. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +0 -62
  88. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js +0 -12
  89. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.esm.t +0 -10
  90. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.inject.esm.t +0 -12
  91. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.esm.t +0 -34
  92. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_call.esm.t +0 -7
  93. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_export.esm.t +0 -7
  94. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_import.esm.t +0 -7
  95. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +0 -40
  96. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +0 -47
  97. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js +0 -12
  98. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.esm.t +0 -10
  99. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.inject.esm.t +0 -12
  100. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +0 -34
  101. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_call.esm.t +0 -7
  102. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_export.esm.t +0 -9
  103. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_import.esm.t +0 -7
  104. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t +0 -23
  105. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/schema.esm.t +0 -13
  106. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +0 -17
  107. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js +0 -10
  108. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/lib.esm.t +0 -9
  109. package/dist/src/codegen/__tests__/config.d.ts +0 -3
  110. package/dist/src/codegen/__tests__/config.d.ts.map +0 -1
  111. package/dist/src/codegen/__tests__/config.js +0 -3
  112. package/dist/src/codegen/__tests__/config.js.map +0 -1
  113. package/dist/src/codegen/__tests__/constants.d.ts +0 -16
  114. package/dist/src/codegen/__tests__/constants.d.ts.map +0 -1
  115. package/dist/src/codegen/__tests__/constants.js +0 -16
  116. package/dist/src/codegen/__tests__/constants.js.map +0 -1
  117. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts +0 -2
  118. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts.map +0 -1
  119. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js +0 -9
  120. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js.map +0 -1
  121. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts +0 -3
  122. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts.map +0 -1
  123. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js +0 -33
  124. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js.map +0 -1
  125. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts +0 -2
  126. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts.map +0 -1
  127. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js +0 -23
  128. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js.map +0 -1
  129. package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts +0 -2
  130. package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts.map +0 -1
  131. package/dist/src/codegen/__tests__/fixtures/typecheck.js +0 -23
  132. package/dist/src/codegen/__tests__/fixtures/typecheck.js.map +0 -1
  133. package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts +0 -2
  134. package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts.map +0 -1
  135. package/dist/src/codegen/__tests__/generate-doc-model.test.js +0 -234
  136. package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +0 -1
  137. package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts +0 -2
  138. package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts.map +0 -1
  139. package/dist/src/codegen/__tests__/generate-drive-editor.test.js +0 -181
  140. package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +0 -1
  141. package/dist/src/codegen/__tests__/generate-editor.test.d.ts +0 -2
  142. package/dist/src/codegen/__tests__/generate-editor.test.d.ts.map +0 -1
  143. package/dist/src/codegen/__tests__/generate-editor.test.js +0 -119
  144. package/dist/src/codegen/__tests__/generate-editor.test.js.map +0 -1
  145. package/dist/src/codegen/__tests__/generate-manifest.test.d.ts +0 -2
  146. package/dist/src/codegen/__tests__/generate-manifest.test.d.ts.map +0 -1
  147. package/dist/src/codegen/__tests__/generate-manifest.test.js +0 -192
  148. package/dist/src/codegen/__tests__/generate-manifest.test.js.map +0 -1
  149. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.d.ts +0 -2
  150. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.d.ts.map +0 -1
  151. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.js +0 -159
  152. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.js.map +0 -1
  153. package/dist/src/codegen/__tests__/global-setup.d.ts +0 -2
  154. package/dist/src/codegen/__tests__/global-setup.d.ts.map +0 -1
  155. package/dist/src/codegen/__tests__/global-setup.js +0 -21
  156. package/dist/src/codegen/__tests__/global-setup.js.map +0 -1
  157. package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts +0 -2
  158. package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts.map +0 -1
  159. package/dist/src/codegen/__tests__/ts-morph-generator.test.js +0 -73
  160. package/dist/src/codegen/__tests__/ts-morph-generator.test.js.map +0 -1
  161. package/dist/src/codegen/__tests__/utils.d.ts +0 -7
  162. package/dist/src/codegen/__tests__/utils.d.ts.map +0 -1
  163. package/dist/src/codegen/__tests__/utils.js +0 -52
  164. package/dist/src/codegen/__tests__/utils.js.map +0 -1
  165. package/dist/src/codegen/generate.d.ts +0 -79
  166. package/dist/src/codegen/generate.d.ts.map +0 -1
  167. package/dist/src/codegen/generate.js +0 -332
  168. package/dist/src/codegen/generate.js.map +0 -1
  169. package/dist/src/codegen/graphql.d.ts +0 -36
  170. package/dist/src/codegen/graphql.d.ts.map +0 -1
  171. package/dist/src/codegen/graphql.js +0 -146
  172. package/dist/src/codegen/graphql.js.map +0 -1
  173. package/dist/src/codegen/hygen.d.ts +0 -47
  174. package/dist/src/codegen/hygen.d.ts.map +0 -1
  175. package/dist/src/codegen/hygen.js +0 -230
  176. package/dist/src/codegen/hygen.js.map +0 -1
  177. package/dist/src/codegen/index.d.ts +0 -7
  178. package/dist/src/codegen/index.d.ts.map +0 -1
  179. package/dist/src/codegen/index.js +0 -7
  180. package/dist/src/codegen/index.js.map +0 -1
  181. package/dist/src/codegen/kysely.d.ts +0 -6
  182. package/dist/src/codegen/kysely.d.ts.map +0 -1
  183. package/dist/src/codegen/kysely.js +0 -51
  184. package/dist/src/codegen/kysely.js.map +0 -1
  185. package/dist/src/codegen/types.d.ts +0 -9
  186. package/dist/src/codegen/types.d.ts.map +0 -1
  187. package/dist/src/codegen/types.js +0 -2
  188. package/dist/src/codegen/types.js.map +0 -1
  189. package/dist/src/codegen/utils.d.ts +0 -7
  190. package/dist/src/codegen/utils.d.ts.map +0 -1
  191. package/dist/src/codegen/utils.js +0 -79
  192. package/dist/src/codegen/utils.js.map +0 -1
  193. package/dist/src/create-lib/checkout-project.d.ts +0 -13
  194. package/dist/src/create-lib/checkout-project.d.ts.map +0 -1
  195. package/dist/src/create-lib/checkout-project.js +0 -47
  196. package/dist/src/create-lib/checkout-project.js.map +0 -1
  197. package/dist/src/create-lib/create-project.d.ts +0 -10
  198. package/dist/src/create-lib/create-project.d.ts.map +0 -1
  199. package/dist/src/create-lib/create-project.js +0 -106
  200. package/dist/src/create-lib/create-project.js.map +0 -1
  201. package/dist/src/create-lib/feature-flags.d.ts +0 -4
  202. package/dist/src/create-lib/feature-flags.d.ts.map +0 -1
  203. package/dist/src/create-lib/feature-flags.js +0 -4
  204. package/dist/src/create-lib/feature-flags.js.map +0 -1
  205. package/dist/src/create-lib/index.d.ts +0 -3
  206. package/dist/src/create-lib/index.d.ts.map +0 -1
  207. package/dist/src/create-lib/index.js +0 -3
  208. package/dist/src/create-lib/index.js.map +0 -1
  209. package/dist/src/create-lib/utils.d.ts +0 -8
  210. package/dist/src/create-lib/utils.d.ts.map +0 -1
  211. package/dist/src/create-lib/utils.js +0 -34
  212. package/dist/src/create-lib/utils.js.map +0 -1
  213. package/dist/src/file-builders/boilerplate/build-package-json.test.d.ts +0 -2
  214. package/dist/src/file-builders/boilerplate/build-package-json.test.d.ts.map +0 -1
  215. package/dist/src/file-builders/boilerplate/build-package-json.test.js +0 -28
  216. package/dist/src/file-builders/boilerplate/build-package-json.test.js.map +0 -1
  217. package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts +0 -2
  218. package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts.map +0 -1
  219. package/dist/src/file-builders/boilerplate/ci-templates.test.js +0 -114
  220. package/dist/src/file-builders/boilerplate/ci-templates.test.js.map +0 -1
  221. package/dist/src/file-builders/boilerplate/package-json-versions.test.d.ts +0 -2
  222. package/dist/src/file-builders/boilerplate/package-json-versions.test.d.ts.map +0 -1
  223. package/dist/src/file-builders/boilerplate/package-json-versions.test.js +0 -34
  224. package/dist/src/file-builders/boilerplate/package-json-versions.test.js.map +0 -1
  225. package/dist/src/file-builders/boilerplate/package.json.d.ts +0 -6
  226. package/dist/src/file-builders/boilerplate/package.json.d.ts.map +0 -1
  227. package/dist/src/file-builders/boilerplate/package.json.js +0 -18
  228. package/dist/src/file-builders/boilerplate/package.json.js.map +0 -1
  229. package/dist/src/file-builders/clis/generate-cli-docs.d.ts +0 -17
  230. package/dist/src/file-builders/clis/generate-cli-docs.d.ts.map +0 -1
  231. package/dist/src/file-builders/clis/generate-cli-docs.js +0 -36
  232. package/dist/src/file-builders/clis/generate-cli-docs.js.map +0 -1
  233. package/dist/src/file-builders/document-editor.d.ts +0 -8
  234. package/dist/src/file-builders/document-editor.d.ts.map +0 -1
  235. package/dist/src/file-builders/document-editor.js +0 -57
  236. package/dist/src/file-builders/document-editor.js.map +0 -1
  237. package/dist/src/file-builders/document-model/document-model.d.ts +0 -8
  238. package/dist/src/file-builders/document-model/document-model.d.ts.map +0 -1
  239. package/dist/src/file-builders/document-model/document-model.js +0 -246
  240. package/dist/src/file-builders/document-model/document-model.js.map +0 -1
  241. package/dist/src/file-builders/document-model/gen-dir.d.ts +0 -3
  242. package/dist/src/file-builders/document-model/gen-dir.d.ts.map +0 -1
  243. package/dist/src/file-builders/document-model/gen-dir.js +0 -201
  244. package/dist/src/file-builders/document-model/gen-dir.js.map +0 -1
  245. package/dist/src/file-builders/document-model/root-dir.d.ts +0 -3
  246. package/dist/src/file-builders/document-model/root-dir.d.ts.map +0 -1
  247. package/dist/src/file-builders/document-model/root-dir.js +0 -51
  248. package/dist/src/file-builders/document-model/root-dir.js.map +0 -1
  249. package/dist/src/file-builders/document-model/src-dir.d.ts +0 -3
  250. package/dist/src/file-builders/document-model/src-dir.d.ts.map +0 -1
  251. package/dist/src/file-builders/document-model/src-dir.js +0 -118
  252. package/dist/src/file-builders/document-model/src-dir.js.map +0 -1
  253. package/dist/src/file-builders/document-model/tests-dir.d.ts +0 -3
  254. package/dist/src/file-builders/document-model/tests-dir.d.ts.map +0 -1
  255. package/dist/src/file-builders/document-model/tests-dir.js +0 -127
  256. package/dist/src/file-builders/document-model/tests-dir.js.map +0 -1
  257. package/dist/src/file-builders/document-model/upgrades-dir.d.ts +0 -31
  258. package/dist/src/file-builders/document-model/upgrades-dir.d.ts.map +0 -1
  259. package/dist/src/file-builders/document-model/upgrades-dir.js +0 -135
  260. package/dist/src/file-builders/document-model/upgrades-dir.js.map +0 -1
  261. package/dist/src/file-builders/drive-editor.d.ts +0 -9
  262. package/dist/src/file-builders/drive-editor.d.ts.map +0 -1
  263. package/dist/src/file-builders/drive-editor.js +0 -164
  264. package/dist/src/file-builders/drive-editor.js.map +0 -1
  265. package/dist/src/file-builders/editor-common.d.ts +0 -13
  266. package/dist/src/file-builders/editor-common.d.ts.map +0 -1
  267. package/dist/src/file-builders/editor-common.js +0 -26
  268. package/dist/src/file-builders/editor-common.js.map +0 -1
  269. package/dist/src/file-builders/index-files.d.ts +0 -18
  270. package/dist/src/file-builders/index-files.d.ts.map +0 -1
  271. package/dist/src/file-builders/index-files.js +0 -25
  272. package/dist/src/file-builders/index-files.js.map +0 -1
  273. package/dist/src/file-builders/index.d.ts +0 -11
  274. package/dist/src/file-builders/index.d.ts.map +0 -1
  275. package/dist/src/file-builders/index.js +0 -10
  276. package/dist/src/file-builders/index.js.map +0 -1
  277. package/dist/src/file-builders/module-files.d.ts +0 -52
  278. package/dist/src/file-builders/module-files.d.ts.map +0 -1
  279. package/dist/src/file-builders/module-files.js +0 -230
  280. package/dist/src/file-builders/module-files.js.map +0 -1
  281. package/dist/src/file-builders/subgraphs.d.ts +0 -6
  282. package/dist/src/file-builders/subgraphs.d.ts.map +0 -1
  283. package/dist/src/file-builders/subgraphs.js +0 -53
  284. package/dist/src/file-builders/subgraphs.js.map +0 -1
  285. package/dist/src/file-builders/types.d.ts +0 -84
  286. package/dist/src/file-builders/types.d.ts.map +0 -1
  287. package/dist/src/file-builders/types.js +0 -2
  288. package/dist/src/file-builders/types.js.map +0 -1
  289. package/dist/src/index.d.ts +0 -5
  290. package/dist/src/index.d.ts.map +0 -1
  291. package/dist/src/index.js +0 -5
  292. package/dist/src/index.js.map +0 -1
  293. package/dist/src/name-builders/get-action-names.d.ts +0 -6
  294. package/dist/src/name-builders/get-action-names.d.ts.map +0 -1
  295. package/dist/src/name-builders/get-action-names.js +0 -16
  296. package/dist/src/name-builders/get-action-names.js.map +0 -1
  297. package/dist/src/name-builders/get-variable-names.d.ts +0 -48
  298. package/dist/src/name-builders/get-variable-names.d.ts.map +0 -1
  299. package/dist/src/name-builders/get-variable-names.js +0 -147
  300. package/dist/src/name-builders/get-variable-names.js.map +0 -1
  301. package/dist/src/name-builders/index.d.ts +0 -3
  302. package/dist/src/name-builders/index.d.ts.map +0 -1
  303. package/dist/src/name-builders/index.js +0 -3
  304. package/dist/src/name-builders/index.js.map +0 -1
  305. package/dist/src/templates/boilerplate/AGENTS.md.d.ts +0 -2
  306. package/dist/src/templates/boilerplate/AGENTS.md.d.ts.map +0 -1
  307. package/dist/src/templates/boilerplate/AGENTS.md.js +0 -449
  308. package/dist/src/templates/boilerplate/AGENTS.md.js.map +0 -1
  309. package/dist/src/templates/boilerplate/CLAUDE.md.d.ts +0 -2
  310. package/dist/src/templates/boilerplate/CLAUDE.md.d.ts.map +0 -1
  311. package/dist/src/templates/boilerplate/CLAUDE.md.js +0 -2
  312. package/dist/src/templates/boilerplate/CLAUDE.md.js.map +0 -1
  313. package/dist/src/templates/boilerplate/LICENSE.d.ts +0 -2
  314. package/dist/src/templates/boilerplate/LICENSE.d.ts.map +0 -1
  315. package/dist/src/templates/boilerplate/LICENSE.js.map +0 -1
  316. package/dist/src/templates/boilerplate/README.md.d.ts +0 -2
  317. package/dist/src/templates/boilerplate/README.md.d.ts.map +0 -1
  318. package/dist/src/templates/boilerplate/README.md.js +0 -194
  319. package/dist/src/templates/boilerplate/README.md.js.map +0 -1
  320. package/dist/src/templates/boilerplate/claude/settings.local.json.d.ts +0 -2
  321. package/dist/src/templates/boilerplate/claude/settings.local.json.d.ts.map +0 -1
  322. package/dist/src/templates/boilerplate/claude/settings.local.json.js +0 -18
  323. package/dist/src/templates/boilerplate/claude/settings.local.json.js.map +0 -1
  324. package/dist/src/templates/boilerplate/cursor/mcp.json.d.ts +0 -2
  325. package/dist/src/templates/boilerplate/cursor/mcp.json.d.ts.map +0 -1
  326. package/dist/src/templates/boilerplate/cursor/mcp.json.js +0 -12
  327. package/dist/src/templates/boilerplate/cursor/mcp.json.js.map +0 -1
  328. package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts +0 -2
  329. package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts.map +0 -1
  330. package/dist/src/templates/boilerplate/docker/Dockerfile.js +0 -144
  331. package/dist/src/templates/boilerplate/docker/Dockerfile.js.map +0 -1
  332. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts +0 -2
  333. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts.map +0 -1
  334. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js +0 -18
  335. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js.map +0 -1
  336. package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts +0 -2
  337. package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts.map +0 -1
  338. package/dist/src/templates/boilerplate/docker/nginx.conf.js +0 -79
  339. package/dist/src/templates/boilerplate/docker/nginx.conf.js.map +0 -1
  340. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts +0 -2
  341. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts.map +0 -1
  342. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js +0 -19
  343. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js.map +0 -1
  344. package/dist/src/templates/boilerplate/document-models/document-models.d.ts +0 -2
  345. package/dist/src/templates/boilerplate/document-models/document-models.d.ts.map +0 -1
  346. package/dist/src/templates/boilerplate/document-models/document-models.js +0 -7
  347. package/dist/src/templates/boilerplate/document-models/document-models.js.map +0 -1
  348. package/dist/src/templates/boilerplate/document-models/index.d.ts +0 -2
  349. package/dist/src/templates/boilerplate/document-models/index.d.ts.map +0 -1
  350. package/dist/src/templates/boilerplate/document-models/index.js +0 -2
  351. package/dist/src/templates/boilerplate/document-models/index.js.map +0 -1
  352. package/dist/src/templates/boilerplate/editors/editors.d.ts +0 -2
  353. package/dist/src/templates/boilerplate/editors/editors.d.ts.map +0 -1
  354. package/dist/src/templates/boilerplate/editors/editors.js +0 -7
  355. package/dist/src/templates/boilerplate/editors/editors.js.map +0 -1
  356. package/dist/src/templates/boilerplate/editors/index.d.ts +0 -2
  357. package/dist/src/templates/boilerplate/editors/index.d.ts.map +0 -1
  358. package/dist/src/templates/boilerplate/editors/index.js +0 -2
  359. package/dist/src/templates/boilerplate/editors/index.js.map +0 -1
  360. package/dist/src/templates/boilerplate/eslint.config.js.d.ts +0 -2
  361. package/dist/src/templates/boilerplate/eslint.config.js.d.ts.map +0 -1
  362. package/dist/src/templates/boilerplate/eslint.config.js.js +0 -140
  363. package/dist/src/templates/boilerplate/eslint.config.js.js.map +0 -1
  364. package/dist/src/templates/boilerplate/gemini/settings.json.d.ts +0 -2
  365. package/dist/src/templates/boilerplate/gemini/settings.json.d.ts.map +0 -1
  366. package/dist/src/templates/boilerplate/gemini/settings.json.js +0 -12
  367. package/dist/src/templates/boilerplate/gemini/settings.json.js.map +0 -1
  368. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts +0 -2
  369. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts.map +0 -1
  370. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js +0 -376
  371. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js.map +0 -1
  372. package/dist/src/templates/boilerplate/gitignore.d.ts +0 -2
  373. package/dist/src/templates/boilerplate/gitignore.d.ts.map +0 -1
  374. package/dist/src/templates/boilerplate/gitignore.js +0 -11
  375. package/dist/src/templates/boilerplate/gitignore.js.map +0 -1
  376. package/dist/src/templates/boilerplate/index.d.ts +0 -2
  377. package/dist/src/templates/boilerplate/index.d.ts.map +0 -1
  378. package/dist/src/templates/boilerplate/index.html.d.ts +0 -2
  379. package/dist/src/templates/boilerplate/index.html.d.ts.map +0 -1
  380. package/dist/src/templates/boilerplate/index.html.js +0 -31
  381. package/dist/src/templates/boilerplate/index.html.js.map +0 -1
  382. package/dist/src/templates/boilerplate/index.html.legacy.d.ts +0 -2
  383. package/dist/src/templates/boilerplate/index.html.legacy.d.ts.map +0 -1
  384. package/dist/src/templates/boilerplate/index.html.legacy.js +0 -36
  385. package/dist/src/templates/boilerplate/index.html.legacy.js.map +0 -1
  386. package/dist/src/templates/boilerplate/index.js +0 -8
  387. package/dist/src/templates/boilerplate/index.js.map +0 -1
  388. package/dist/src/templates/boilerplate/mcp.json.d.ts +0 -2
  389. package/dist/src/templates/boilerplate/mcp.json.d.ts.map +0 -1
  390. package/dist/src/templates/boilerplate/mcp.json.js +0 -12
  391. package/dist/src/templates/boilerplate/mcp.json.js.map +0 -1
  392. package/dist/src/templates/boilerplate/npmrc.d.ts +0 -2
  393. package/dist/src/templates/boilerplate/npmrc.d.ts.map +0 -1
  394. package/dist/src/templates/boilerplate/npmrc.js +0 -2
  395. package/dist/src/templates/boilerplate/npmrc.js.map +0 -1
  396. package/dist/src/templates/boilerplate/package.json.d.ts +0 -2
  397. package/dist/src/templates/boilerplate/package.json.d.ts.map +0 -1
  398. package/dist/src/templates/boilerplate/package.json.js +0 -114
  399. package/dist/src/templates/boilerplate/package.json.js.map +0 -1
  400. package/dist/src/templates/boilerplate/package.json.legacy.d.ts +0 -55
  401. package/dist/src/templates/boilerplate/package.json.legacy.d.ts.map +0 -1
  402. package/dist/src/templates/boilerplate/package.json.legacy.js +0 -55
  403. package/dist/src/templates/boilerplate/package.json.legacy.js.map +0 -1
  404. package/dist/src/templates/boilerplate/powerhouse.config.json.d.ts +0 -6
  405. package/dist/src/templates/boilerplate/powerhouse.config.json.d.ts.map +0 -1
  406. package/dist/src/templates/boilerplate/powerhouse.config.json.js +0 -46
  407. package/dist/src/templates/boilerplate/powerhouse.config.json.js.map +0 -1
  408. package/dist/src/templates/boilerplate/powerhouse.manifest.json.d.ts +0 -2
  409. package/dist/src/templates/boilerplate/powerhouse.manifest.json.d.ts.map +0 -1
  410. package/dist/src/templates/boilerplate/powerhouse.manifest.json.js +0 -19
  411. package/dist/src/templates/boilerplate/powerhouse.manifest.json.js.map +0 -1
  412. package/dist/src/templates/boilerplate/processors/index.d.ts +0 -2
  413. package/dist/src/templates/boilerplate/processors/index.d.ts.map +0 -1
  414. package/dist/src/templates/boilerplate/processors/index.js +0 -2
  415. package/dist/src/templates/boilerplate/processors/index.js.map +0 -1
  416. package/dist/src/templates/boilerplate/style.css.d.ts +0 -2
  417. package/dist/src/templates/boilerplate/style.css.d.ts.map +0 -1
  418. package/dist/src/templates/boilerplate/style.css.js +0 -17
  419. package/dist/src/templates/boilerplate/style.css.js.map +0 -1
  420. package/dist/src/templates/boilerplate/subgraphs/index.d.ts +0 -2
  421. package/dist/src/templates/boilerplate/subgraphs/index.d.ts.map +0 -1
  422. package/dist/src/templates/boilerplate/subgraphs/index.js +0 -2
  423. package/dist/src/templates/boilerplate/subgraphs/index.js.map +0 -1
  424. package/dist/src/templates/boilerplate/tsconfig.json.d.ts +0 -2
  425. package/dist/src/templates/boilerplate/tsconfig.json.d.ts.map +0 -1
  426. package/dist/src/templates/boilerplate/tsconfig.json.js +0 -46
  427. package/dist/src/templates/boilerplate/tsconfig.json.js.map +0 -1
  428. package/dist/src/templates/boilerplate/vite.config.ts.d.ts +0 -2
  429. package/dist/src/templates/boilerplate/vite.config.ts.d.ts.map +0 -1
  430. package/dist/src/templates/boilerplate/vite.config.ts.js +0 -21
  431. package/dist/src/templates/boilerplate/vite.config.ts.js.map +0 -1
  432. package/dist/src/templates/boilerplate/vitest.config.ts.d.ts +0 -2
  433. package/dist/src/templates/boilerplate/vitest.config.ts.d.ts.map +0 -1
  434. package/dist/src/templates/boilerplate/vitest.config.ts.js +0 -21
  435. package/dist/src/templates/boilerplate/vitest.config.ts.js.map +0 -1
  436. package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts +0 -8
  437. package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts.map +0 -1
  438. package/dist/src/templates/cli-docs/docs-from-cli-help.js +0 -86
  439. package/dist/src/templates/cli-docs/docs-from-cli-help.js.map +0 -1
  440. package/dist/src/templates/document-editor/editor.d.ts +0 -5
  441. package/dist/src/templates/document-editor/editor.d.ts.map +0 -1
  442. package/dist/src/templates/document-editor/editor.js +0 -85
  443. package/dist/src/templates/document-editor/editor.js.map +0 -1
  444. package/dist/src/templates/document-editor/module.d.ts +0 -7
  445. package/dist/src/templates/document-editor/module.d.ts.map +0 -1
  446. package/dist/src/templates/document-editor/module.js +0 -16
  447. package/dist/src/templates/document-editor/module.js.map +0 -1
  448. package/dist/src/templates/document-model/actions.d.ts +0 -3
  449. package/dist/src/templates/document-model/actions.d.ts.map +0 -1
  450. package/dist/src/templates/document-model/actions.js +0 -28
  451. package/dist/src/templates/document-model/actions.js.map +0 -1
  452. package/dist/src/templates/document-model/gen/actions.d.ts +0 -3
  453. package/dist/src/templates/document-model/gen/actions.d.ts.map +0 -1
  454. package/dist/src/templates/document-model/gen/actions.js +0 -40
  455. package/dist/src/templates/document-model/gen/actions.js.map +0 -1
  456. package/dist/src/templates/document-model/gen/creators.d.ts +0 -3
  457. package/dist/src/templates/document-model/gen/creators.d.ts.map +0 -1
  458. package/dist/src/templates/document-model/gen/creators.js +0 -16
  459. package/dist/src/templates/document-model/gen/creators.js.map +0 -1
  460. package/dist/src/templates/document-model/gen/document-schema.d.ts +0 -3
  461. package/dist/src/templates/document-model/gen/document-schema.d.ts.map +0 -1
  462. package/dist/src/templates/document-model/gen/document-schema.js +0 -56
  463. package/dist/src/templates/document-model/gen/document-schema.js.map +0 -1
  464. package/dist/src/templates/document-model/gen/document-type.d.ts +0 -3
  465. package/dist/src/templates/document-model/gen/document-type.d.ts.map +0 -1
  466. package/dist/src/templates/document-model/gen/document-type.js +0 -5
  467. package/dist/src/templates/document-model/gen/document-type.js.map +0 -1
  468. package/dist/src/templates/document-model/gen/index.d.ts +0 -3
  469. package/dist/src/templates/document-model/gen/index.d.ts.map +0 -1
  470. package/dist/src/templates/document-model/gen/index.js +0 -29
  471. package/dist/src/templates/document-model/gen/index.js.map +0 -1
  472. package/dist/src/templates/document-model/gen/modules/actions.d.ts +0 -8
  473. package/dist/src/templates/document-model/gen/modules/actions.d.ts.map +0 -1
  474. package/dist/src/templates/document-model/gen/modules/actions.js +0 -39
  475. package/dist/src/templates/document-model/gen/modules/actions.js.map +0 -1
  476. package/dist/src/templates/document-model/gen/modules/creators.d.ts +0 -3
  477. package/dist/src/templates/document-model/gen/modules/creators.d.ts.map +0 -1
  478. package/dist/src/templates/document-model/gen/modules/creators.js +0 -97
  479. package/dist/src/templates/document-model/gen/modules/creators.js.map +0 -1
  480. package/dist/src/templates/document-model/gen/modules/error.d.ts +0 -3
  481. package/dist/src/templates/document-model/gen/modules/error.d.ts.map +0 -1
  482. package/dist/src/templates/document-model/gen/modules/error.js +0 -73
  483. package/dist/src/templates/document-model/gen/modules/error.js.map +0 -1
  484. package/dist/src/templates/document-model/gen/modules/operations.d.ts +0 -3
  485. package/dist/src/templates/document-model/gen/modules/operations.d.ts.map +0 -1
  486. package/dist/src/templates/document-model/gen/modules/operations.js +0 -61
  487. package/dist/src/templates/document-model/gen/modules/operations.js.map +0 -1
  488. package/dist/src/templates/document-model/gen/ph-factories.d.ts +0 -3
  489. package/dist/src/templates/document-model/gen/ph-factories.d.ts.map +0 -1
  490. package/dist/src/templates/document-model/gen/ph-factories.js +0 -93
  491. package/dist/src/templates/document-model/gen/ph-factories.js.map +0 -1
  492. package/dist/src/templates/document-model/gen/reducer.d.ts +0 -3
  493. package/dist/src/templates/document-model/gen/reducer.d.ts.map +0 -1
  494. package/dist/src/templates/document-model/gen/reducer.js +0 -106
  495. package/dist/src/templates/document-model/gen/reducer.js.map +0 -1
  496. package/dist/src/templates/document-model/gen/schema/index.d.ts +0 -2
  497. package/dist/src/templates/document-model/gen/schema/index.d.ts.map +0 -1
  498. package/dist/src/templates/document-model/gen/schema/index.js +0 -6
  499. package/dist/src/templates/document-model/gen/schema/index.js.map +0 -1
  500. package/dist/src/templates/document-model/gen/types.d.ts +0 -3
  501. package/dist/src/templates/document-model/gen/types.d.ts.map +0 -1
  502. package/dist/src/templates/document-model/gen/types.js +0 -38
  503. package/dist/src/templates/document-model/gen/types.js.map +0 -1
  504. package/dist/src/templates/document-model/gen/utils.d.ts +0 -3
  505. package/dist/src/templates/document-model/gen/utils.d.ts.map +0 -1
  506. package/dist/src/templates/document-model/gen/utils.js +0 -77
  507. package/dist/src/templates/document-model/gen/utils.js.map +0 -1
  508. package/dist/src/templates/document-model/hooks.d.ts +0 -3
  509. package/dist/src/templates/document-model/hooks.d.ts.map +0 -1
  510. package/dist/src/templates/document-model/hooks.js +0 -52
  511. package/dist/src/templates/document-model/hooks.js.map +0 -1
  512. package/dist/src/templates/document-model/index.d.ts +0 -2
  513. package/dist/src/templates/document-model/index.d.ts.map +0 -1
  514. package/dist/src/templates/document-model/index.js +0 -9
  515. package/dist/src/templates/document-model/index.js.map +0 -1
  516. package/dist/src/templates/document-model/module.d.ts +0 -9
  517. package/dist/src/templates/document-model/module.d.ts.map +0 -1
  518. package/dist/src/templates/document-model/module.js +0 -26
  519. package/dist/src/templates/document-model/module.js.map +0 -1
  520. package/dist/src/templates/document-model/src/index.d.ts +0 -2
  521. package/dist/src/templates/document-model/src/index.d.ts.map +0 -1
  522. package/dist/src/templates/document-model/src/index.js +0 -5
  523. package/dist/src/templates/document-model/src/index.js.map +0 -1
  524. package/dist/src/templates/document-model/src/tests/document-model.test.d.ts +0 -3
  525. package/dist/src/templates/document-model/src/tests/document-model.test.d.ts.map +0 -1
  526. package/dist/src/templates/document-model/src/tests/document-model.test.js +0 -121
  527. package/dist/src/templates/document-model/src/tests/document-model.test.js.map +0 -1
  528. package/dist/src/templates/document-model/src/tests/module.test.d.ts +0 -6
  529. package/dist/src/templates/document-model/src/tests/module.test.d.ts.map +0 -1
  530. package/dist/src/templates/document-model/src/tests/module.test.js +0 -87
  531. package/dist/src/templates/document-model/src/tests/module.test.js.map +0 -1
  532. package/dist/src/templates/document-model/src/utils.d.ts +0 -2
  533. package/dist/src/templates/document-model/src/utils.d.ts.map +0 -1
  534. package/dist/src/templates/document-model/src/utils.js +0 -5
  535. package/dist/src/templates/document-model/src/utils.js.map +0 -1
  536. package/dist/src/templates/document-model/upgrades/upgrade-transition.d.ts +0 -7
  537. package/dist/src/templates/document-model/upgrades/upgrade-transition.d.ts.map +0 -1
  538. package/dist/src/templates/document-model/upgrades/upgrade-transition.js +0 -22
  539. package/dist/src/templates/document-model/upgrades/upgrade-transition.js.map +0 -1
  540. package/dist/src/templates/document-model/utils.d.ts +0 -3
  541. package/dist/src/templates/document-model/utils.d.ts.map +0 -1
  542. package/dist/src/templates/document-model/utils.js +0 -11
  543. package/dist/src/templates/document-model/utils.js.map +0 -1
  544. package/dist/src/templates/drive-editor/components/CreateDocument.d.ts +0 -2
  545. package/dist/src/templates/drive-editor/components/CreateDocument.d.ts.map +0 -1
  546. package/dist/src/templates/drive-editor/components/CreateDocument.js +0 -58
  547. package/dist/src/templates/drive-editor/components/CreateDocument.js.map +0 -1
  548. package/dist/src/templates/drive-editor/components/DriveContents.d.ts +0 -2
  549. package/dist/src/templates/drive-editor/components/DriveContents.d.ts.map +0 -1
  550. package/dist/src/templates/drive-editor/components/DriveContents.js +0 -24
  551. package/dist/src/templates/drive-editor/components/DriveContents.js.map +0 -1
  552. package/dist/src/templates/drive-editor/components/DriveExplorer.d.ts +0 -2
  553. package/dist/src/templates/drive-editor/components/DriveExplorer.d.ts.map +0 -1
  554. package/dist/src/templates/drive-editor/components/DriveExplorer.js +0 -32
  555. package/dist/src/templates/drive-editor/components/DriveExplorer.js.map +0 -1
  556. package/dist/src/templates/drive-editor/components/EmptyState.d.ts +0 -2
  557. package/dist/src/templates/drive-editor/components/EmptyState.d.ts.map +0 -1
  558. package/dist/src/templates/drive-editor/components/EmptyState.js +0 -19
  559. package/dist/src/templates/drive-editor/components/EmptyState.js.map +0 -1
  560. package/dist/src/templates/drive-editor/components/Files.d.ts +0 -2
  561. package/dist/src/templates/drive-editor/components/Files.d.ts.map +0 -1
  562. package/dist/src/templates/drive-editor/components/Files.js +0 -30
  563. package/dist/src/templates/drive-editor/components/Files.js.map +0 -1
  564. package/dist/src/templates/drive-editor/components/FolderTree.d.ts +0 -2
  565. package/dist/src/templates/drive-editor/components/FolderTree.d.ts.map +0 -1
  566. package/dist/src/templates/drive-editor/components/FolderTree.js +0 -108
  567. package/dist/src/templates/drive-editor/components/FolderTree.js.map +0 -1
  568. package/dist/src/templates/drive-editor/components/Folders.d.ts +0 -2
  569. package/dist/src/templates/drive-editor/components/Folders.d.ts.map +0 -1
  570. package/dist/src/templates/drive-editor/components/Folders.js +0 -28
  571. package/dist/src/templates/drive-editor/components/Folders.js.map +0 -1
  572. package/dist/src/templates/drive-editor/components/NavigationBreadcrumbs.d.ts +0 -2
  573. package/dist/src/templates/drive-editor/components/NavigationBreadcrumbs.d.ts.map +0 -1
  574. package/dist/src/templates/drive-editor/components/NavigationBreadcrumbs.js +0 -14
  575. package/dist/src/templates/drive-editor/components/NavigationBreadcrumbs.js.map +0 -1
  576. package/dist/src/templates/drive-editor/config.d.ts +0 -5
  577. package/dist/src/templates/drive-editor/config.d.ts.map +0 -1
  578. package/dist/src/templates/drive-editor/config.js +0 -11
  579. package/dist/src/templates/drive-editor/config.js.map +0 -1
  580. package/dist/src/templates/drive-editor/editor.d.ts +0 -2
  581. package/dist/src/templates/drive-editor/editor.d.ts.map +0 -1
  582. package/dist/src/templates/drive-editor/editor.js +0 -20
  583. package/dist/src/templates/drive-editor/editor.js.map +0 -1
  584. package/dist/src/templates/index.d.ts +0 -71
  585. package/dist/src/templates/index.d.ts.map +0 -1
  586. package/dist/src/templates/index.js +0 -71
  587. package/dist/src/templates/index.js.map +0 -1
  588. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts +0 -2
  589. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts.map +0 -1
  590. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +0 -491
  591. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js.map +0 -1
  592. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +0 -11
  593. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +0 -1
  594. package/dist/src/ts-morph-generator/core/FileGenerator.js +0 -11
  595. package/dist/src/ts-morph-generator/core/FileGenerator.js.map +0 -1
  596. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +0 -39
  597. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +0 -1
  598. package/dist/src/ts-morph-generator/core/GenerationContext.js +0 -2
  599. package/dist/src/ts-morph-generator/core/GenerationContext.js.map +0 -1
  600. package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts +0 -12
  601. package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts.map +0 -1
  602. package/dist/src/ts-morph-generator/core/ReducerGenerator.js +0 -147
  603. package/dist/src/ts-morph-generator/core/ReducerGenerator.js.map +0 -1
  604. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +0 -20
  605. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +0 -1
  606. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js +0 -120
  607. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js.map +0 -1
  608. package/dist/src/ts-morph-generator/index.d.ts +0 -4
  609. package/dist/src/ts-morph-generator/index.d.ts.map +0 -1
  610. package/dist/src/ts-morph-generator/index.js +0 -4
  611. package/dist/src/ts-morph-generator/index.js.map +0 -1
  612. package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts +0 -5
  613. package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts.map +0 -1
  614. package/dist/src/ts-morph-generator/utilities/DeclarationManager.js +0 -10
  615. package/dist/src/ts-morph-generator/utilities/DeclarationManager.js.map +0 -1
  616. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +0 -13
  617. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +0 -1
  618. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js +0 -45
  619. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js.map +0 -1
  620. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +0 -15
  621. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +0 -1
  622. package/dist/src/ts-morph-generator/utilities/ImportManager.js +0 -50
  623. package/dist/src/ts-morph-generator/utilities/ImportManager.js.map +0 -1
  624. package/dist/src/ts-morph-generator/utilities/index.d.ts +0 -4
  625. package/dist/src/ts-morph-generator/utilities/index.d.ts.map +0 -1
  626. package/dist/src/ts-morph-generator/utilities/index.js +0 -4
  627. package/dist/src/ts-morph-generator/utilities/index.js.map +0 -1
  628. package/dist/src/utils/cli.d.ts +0 -26
  629. package/dist/src/utils/cli.d.ts.map +0 -1
  630. package/dist/src/utils/cli.js +0 -57
  631. package/dist/src/utils/cli.js.map +0 -1
  632. package/dist/src/utils/constants.d.ts +0 -13
  633. package/dist/src/utils/constants.d.ts.map +0 -1
  634. package/dist/src/utils/constants.js +0 -29
  635. package/dist/src/utils/constants.js.map +0 -1
  636. package/dist/src/utils/dependencies.d.ts +0 -33
  637. package/dist/src/utils/dependencies.d.ts.map +0 -1
  638. package/dist/src/utils/dependencies.js +0 -97
  639. package/dist/src/utils/dependencies.js.map +0 -1
  640. package/dist/src/utils/document-type-metadata.d.ts +0 -15
  641. package/dist/src/utils/document-type-metadata.d.ts.map +0 -1
  642. package/dist/src/utils/document-type-metadata.js +0 -67
  643. package/dist/src/utils/document-type-metadata.js.map +0 -1
  644. package/dist/src/utils/format-with-prettier.d.ts +0 -5
  645. package/dist/src/utils/format-with-prettier.d.ts.map +0 -1
  646. package/dist/src/utils/format-with-prettier.js +0 -20
  647. package/dist/src/utils/format-with-prettier.js.map +0 -1
  648. package/dist/src/utils/index.d.ts +0 -14
  649. package/dist/src/utils/index.d.ts.map +0 -1
  650. package/dist/src/utils/index.js +0 -14
  651. package/dist/src/utils/index.js.map +0 -1
  652. package/dist/src/utils/mock.d.ts +0 -3
  653. package/dist/src/utils/mock.d.ts.map +0 -1
  654. package/dist/src/utils/mock.js +0 -5
  655. package/dist/src/utils/mock.js.map +0 -1
  656. package/dist/src/utils/source-files.d.ts +0 -18
  657. package/dist/src/utils/source-files.d.ts.map +0 -1
  658. package/dist/src/utils/source-files.js +0 -39
  659. package/dist/src/utils/source-files.js.map +0 -1
  660. package/dist/src/utils/spawn-async.d.ts +0 -5
  661. package/dist/src/utils/spawn-async.d.ts.map +0 -1
  662. package/dist/src/utils/spawn-async.js +0 -29
  663. package/dist/src/utils/spawn-async.js.map +0 -1
  664. package/dist/src/utils/syntax-builders.d.ts +0 -8
  665. package/dist/src/utils/syntax-builders.d.ts.map +0 -1
  666. package/dist/src/utils/syntax-builders.js +0 -72
  667. package/dist/src/utils/syntax-builders.js.map +0 -1
  668. package/dist/src/utils/syntax-getters.d.ts +0 -9
  669. package/dist/src/utils/syntax-getters.d.ts.map +0 -1
  670. package/dist/src/utils/syntax-getters.js +0 -20
  671. package/dist/src/utils/syntax-getters.js.map +0 -1
  672. package/dist/src/utils/ts-morph-project.d.ts +0 -15
  673. package/dist/src/utils/ts-morph-project.d.ts.map +0 -1
  674. package/dist/src/utils/ts-morph-project.js +0 -28
  675. package/dist/src/utils/ts-morph-project.js.map +0 -1
  676. package/dist/src/utils/unsafe-utils.d.ts +0 -8
  677. package/dist/src/utils/unsafe-utils.d.ts.map +0 -1
  678. package/dist/src/utils/unsafe-utils.js +0 -23
  679. package/dist/src/utils/unsafe-utils.js.map +0 -1
  680. package/dist/src/utils/validation.d.ts +0 -18
  681. package/dist/src/utils/validation.d.ts.map +0 -1
  682. package/dist/src/utils/validation.js +0 -138
  683. package/dist/src/utils/validation.js.map +0 -1
  684. package/dist/tsconfig.tsbuildinfo +0 -1
  685. package/dist/vitest.config.d.ts +0 -3
  686. package/dist/vitest.config.d.ts.map +0 -1
  687. package/dist/vitest.config.js +0 -19
  688. package/dist/vitest.config.js.map +0 -1
@@ -0,0 +1,125 @@
1
+ import { o as DocumentModelDocumentTypeMetadata } from "../../types-e2ztuDtG.mjs";
2
+ import { a as parseConfig, i as parseArgs, n as validateDocumentModelState, r as configSpec, t as DocumentModelStateValidationResult } from "../../validation-Bpg_44mW.mjs";
3
+ import * as ts_morph0 from "ts-morph";
4
+ import { IndentationText, ObjectLiteralExpression, Project, SourceFile, SyntaxKind, VariableStatement, ts } from "ts-morph";
5
+
6
+ //#region src/utils/constants.d.ts
7
+ /** Document model metadata for the `powerhouse/document-model` document type.
8
+ *
9
+ * Assumed to always be present during codegen.
10
+ */
11
+ declare const documentModelDocumentTypeMetadata: {
12
+ readonly documentModelId: "powerhouse/document-model";
13
+ readonly documentModelDocumentTypeName: "DocumentModelDocument";
14
+ readonly documentModelDirName: "document-model";
15
+ readonly documentModelImportPath: "document-model";
16
+ };
17
+ //#endregion
18
+ //#region src/utils/document-type-metadata.d.ts
19
+ type GetDocumentTypeMetadataArgs = {
20
+ project: Project;
21
+ documentModelId: string;
22
+ documentModelsDirPath: string;
23
+ };
24
+ /** Gets the document model metadata for the --document-type argument
25
+ * passed to the `generate --editor` and `generate --app` commands.
26
+ */
27
+ declare function getDocumentTypeMetadata({
28
+ project,
29
+ documentModelId,
30
+ documentModelsDirPath
31
+ }: GetDocumentTypeMetadataArgs): DocumentModelDocumentTypeMetadata;
32
+ declare function getPHDocumentTypeNameFromSourceFile(sourceFile: SourceFile): string | undefined;
33
+ //#endregion
34
+ //#region src/utils/format-with-prettier.d.ts
35
+ /** Formats the text of a ts-morph source file with prettier before writing the text to memory */
36
+ declare function formatSourceFileWithPrettier(sourceFile: SourceFile): Promise<void>;
37
+ declare function runPrettier(): Promise<void>;
38
+ //#endregion
39
+ //#region src/utils/source-files.d.ts
40
+ /** Gets a SourceFile by name in a ts-morph Project, or creates a new one
41
+ * if none with that path exists.
42
+ */
43
+ declare function getOrCreateSourceFile(project: Project, filePath: string): {
44
+ alreadyExists: boolean;
45
+ sourceFile: ts_morph0.SourceFile;
46
+ };
47
+ /** Gets a Directory by name in a ts-morph Project, or creates a new one
48
+ * if none with that path exists.
49
+ */
50
+ declare function getOrCreateDirectory(project: Project, dirPath: string): {
51
+ alreadyExists: boolean;
52
+ directory: ts_morph0.Directory;
53
+ };
54
+ /** Ensures that the directories at the given paths exist within the
55
+ * ts-morph Project
56
+ */
57
+ declare function ensureDirectoriesExist(project: Project, ...pathsToEnsure: string[]): Promise<void>;
58
+ declare function getPreviousVersionSourceFile(args: {
59
+ project: Project;
60
+ version: number;
61
+ filePath: string;
62
+ }): ts_morph0.SourceFile | undefined;
63
+ //#endregion
64
+ //#region src/utils/syntax-builders.d.ts
65
+ /** Builds a ts-morph ObjectLiteralExpression from a ts/js object
66
+ * Useful for substituting the value of a runtime object in templates
67
+ */
68
+ declare function buildObjectLiteral(inputObject: object, sourceFile: SourceFile): string;
69
+ declare function buildStringLiteral(value: string): ts.StringLiteral;
70
+ //#endregion
71
+ //#region src/utils/syntax-getters.d.ts
72
+ /** Returns a ts-morph ObjectLiteralExpression from a variable statement
73
+ * if the type matches
74
+ */
75
+ declare function getObjectLiteral(statement: VariableStatement | undefined): ObjectLiteralExpression | undefined;
76
+ /** Returns the value of a property in a ts-morph ObjectLiteralExpression of type T if it exists */
77
+ declare function getObjectProperty<T extends SyntaxKind>(object: ObjectLiteralExpression | undefined, propertyName: string, propertyType: T): ts_morph0.KindToNodeMappings[T] | undefined;
78
+ declare function getVariableDeclarationByTypeName(sourceFile: SourceFile, typeName: string): ts_morph0.VariableDeclaration | undefined;
79
+ //#endregion
80
+ //#region src/utils/ts-morph-project.d.ts
81
+ declare const DEFAULT_PROJECT_OPTIONS: {
82
+ readonly skipAddingFilesFromTsConfig: true;
83
+ readonly skipLoadingLibFiles: true;
84
+ readonly manipulationSettings: {
85
+ readonly useTrailingCommas: true;
86
+ readonly indentationText: IndentationText.TwoSpaces;
87
+ readonly indentMultiLineObjectLiteralBeginningOnBlankLine: true;
88
+ };
89
+ };
90
+ /** Returns the minimal typescript config for use in ts-morph file generation */
91
+ declare function getDefaultProjectOptions(tsConfigFilePath: string): {
92
+ tsConfigFilePath: string;
93
+ skipAddingFilesFromTsConfig: true;
94
+ skipLoadingLibFiles: true;
95
+ manipulationSettings: {
96
+ readonly useTrailingCommas: true;
97
+ readonly indentationText: IndentationText.TwoSpaces;
98
+ readonly indentMultiLineObjectLiteralBeginningOnBlankLine: true;
99
+ };
100
+ };
101
+ /** Instantiates a ts-morph Project using the default typescript config and nearest tsconfig.json file */
102
+ declare function buildTsMorphProject(projectDir: string): Project;
103
+ //#endregion
104
+ //#region src/utils/unsafe-utils.d.ts
105
+ declare function getInitialStates(scopeState: {
106
+ global: any;
107
+ local: any;
108
+ }): {
109
+ initialGlobalState: string;
110
+ initialLocalState: string;
111
+ };
112
+ //#endregion
113
+ //#region src/utils/graphql-type-prefixes.d.ts
114
+ /**
115
+ * Extract type names from a GraphQL schema.
116
+ * Finds all type, enum, union, interface, and input definitions.
117
+ */
118
+ declare function extractTypeNames(schema: string): string[];
119
+ /**
120
+ * Apply type prefixes to GraphQL schema to namespace types and avoid collisions.
121
+ */
122
+ declare function applyGraphQLTypePrefixes(schema: string, prefix: string, externalTypeNames?: string[]): string;
123
+ //#endregion
124
+ export { DEFAULT_PROJECT_OPTIONS, DocumentModelStateValidationResult, applyGraphQLTypePrefixes, buildObjectLiteral, buildStringLiteral, buildTsMorphProject, configSpec, documentModelDocumentTypeMetadata, ensureDirectoriesExist, extractTypeNames, formatSourceFileWithPrettier, getDefaultProjectOptions, getDocumentTypeMetadata, getInitialStates, getObjectLiteral, getObjectProperty, getOrCreateDirectory, getOrCreateSourceFile, getPHDocumentTypeNameFromSourceFile, getPreviousVersionSourceFile, getVariableDeclarationByTypeName, parseArgs, parseConfig, runPrettier, validateDocumentModelState };
125
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/utils/constants.ts","../../../src/utils/document-type-metadata.ts","../../../src/utils/format-with-prettier.ts","../../../src/utils/source-files.ts","../../../src/utils/syntax-builders.ts","../../../src/utils/syntax-getters.ts","../../../src/utils/ts-morph-project.ts","../../../src/utils/unsafe-utils.ts","../../../src/utils/graphql-type-prefixes.ts"],"mappings":";;;;;;;;;;cAIa,iCAAA;EAAA;;;;;;;KCER,2BAAA;EACH,OAAA,EAAS,OAAA;EACT,eAAA;EACA,qBAAA;AAAA;ADLF;;;AAAA,iBCUgB,uBAAA,CAAA;EACd,OAAA;EACA,eAAA;EACA;AAAA,GACC,2BAAA,GAA2B,iCAAA;AAAA,iBAiGd,mCAAA,CAAoC,UAAA,EAAY,UAAA;;;;iBC9G1C,4BAAA,CAA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
+ import { IndentationText, Project, SyntaxKind, ts } from "ts-morph";
4
+ import arg from "arg";
5
+ import { format } from "prettier";
6
+ //#region src/utils/cli.ts
7
+ const configSpec = {
8
+ "--document-models": String,
9
+ "--editors": String,
10
+ "--interactive": Boolean,
11
+ "--skip-format": Boolean,
12
+ "--watch": Boolean,
13
+ "-i": "--interactive",
14
+ "-sf": "--skip-format",
15
+ "-w": "--watch"
16
+ };
17
+ function parseArgs(argv, spec) {
18
+ return arg(spec, {
19
+ permissive: true,
20
+ argv
21
+ });
22
+ }
23
+ function parseConfig(argv) {
24
+ const config = {};
25
+ const args = parseArgs(argv, configSpec);
26
+ if ("--document-models" in args) config.documentModelsDir = args["--document-models"];
27
+ if ("--editors" in args) config.editorsDir = args["--editors"];
28
+ if ("--skip-format" in args) config.skipFormat = true;
29
+ if ("--interactive" in args) config.interactive = true;
30
+ if ("--watch" in args) config.watch = true;
31
+ return config;
32
+ }
33
+ //#endregion
34
+ //#region src/utils/constants.ts
35
+ /** Document model metadata for the `powerhouse/document-model` document type.
36
+ *
37
+ * Assumed to always be present during codegen.
38
+ */
39
+ const documentModelDocumentTypeMetadata = {
40
+ documentModelId: "powerhouse/document-model",
41
+ documentModelDocumentTypeName: "DocumentModelDocument",
42
+ documentModelDirName: "document-model",
43
+ documentModelImportPath: "document-model"
44
+ };
45
+ //#endregion
46
+ //#region src/utils/syntax-getters.ts
47
+ /** Returns a ts-morph ObjectLiteralExpression from a variable statement
48
+ * if the type matches
49
+ */
50
+ function getObjectLiteral(statement) {
51
+ return statement?.getDeclarations().at(0)?.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);
52
+ }
53
+ /** Returns the value of a property in a ts-morph ObjectLiteralExpression of type T if it exists */
54
+ function getObjectProperty(object, propertyName, propertyType) {
55
+ return object?.getProperty(propertyName)?.asKind(SyntaxKind.PropertyAssignment)?.getChildren().find((child) => child.getKind() === propertyType)?.asKindOrThrow(propertyType);
56
+ }
57
+ function getVariableDeclarationByTypeName(sourceFile, typeName) {
58
+ return sourceFile.getVariableDeclaration((declaration) => {
59
+ if ((declaration.getTypeNode()?.getText() ?? "").includes(typeName)) return true;
60
+ return declaration.getType().getText().includes(typeName);
61
+ });
62
+ }
63
+ //#endregion
64
+ //#region src/utils/document-type-metadata.ts
65
+ /** Gets the document model metadata for the --document-type argument
66
+ * passed to the `generate --editor` and `generate --app` commands.
67
+ */
68
+ function getDocumentTypeMetadata({ project, documentModelId, documentModelsDirPath }) {
69
+ const sourceFile = project.getSourceFiles().filter((file) => {
70
+ return file.getBaseName() === "document-model.ts";
71
+ }).find((file) => getDocumentModelFileByDocumentId(file, documentModelId));
72
+ if (!sourceFile) throw new Error(`No document-model.ts file exists for ${documentModelId}`);
73
+ const documentModelsDir = project.getDirectory(documentModelsDirPath);
74
+ if (!documentModelsDir) throw new Error(`No document-models dir exists for ${documentModelId}`);
75
+ const documentModelDir = project.getDirectories().find((dir) => sourceFile.getDirectory().isDescendantOf(dir) && dir.isDescendantOf(documentModelsDir));
76
+ if (!documentModelDir) throw new Error(`No document model dir exists for ${documentModelId}`);
77
+ const documentModelDirName = documentModelDir.getBaseName();
78
+ const documentModelImportPath = path.join("document-models", documentModelDirName);
79
+ const sourceFileDir = sourceFile.getDirectoryPath();
80
+ const documentModelGenTypesFilePath = path.join(sourceFileDir, "types.ts");
81
+ const documentModelGenTypesFile = project.getSourceFile(documentModelGenTypesFilePath);
82
+ if (!documentModelGenTypesFile) throw new Error(`No generated types file exists for ${documentModelId}`);
83
+ const documentModelDocumentTypeName = getPHDocumentTypeNameFromSourceFile(documentModelGenTypesFile);
84
+ if (!documentModelDocumentTypeName) throw new Error(`Generated type file is missing PHDocument type declaration for ${documentModelId}`);
85
+ return {
86
+ documentModelDirName,
87
+ documentModelDocumentTypeName,
88
+ documentModelId,
89
+ documentModelImportPath
90
+ };
91
+ }
92
+ function getDocumentModelFileByDocumentId(sourceFile, documentModelId) {
93
+ const documentModelStatement = sourceFile.getVariableStatement("documentModel");
94
+ if (!documentModelStatement) return false;
95
+ const documentModelObject = getObjectLiteral(documentModelStatement);
96
+ if (!documentModelObject) return false;
97
+ return getObjectProperty(documentModelObject, "id", SyntaxKind.StringLiteral)?.getLiteralValue() === documentModelId;
98
+ }
99
+ function getPHDocumentTypeNameFromSourceFile(sourceFile) {
100
+ return sourceFile.getTypeAliases().find((alias) => {
101
+ return (alias.getTypeNode()?.getText())?.includes("PHDocument");
102
+ })?.getName();
103
+ }
104
+ //#endregion
105
+ //#region src/utils/format-with-prettier.ts
106
+ /** Formats the text of a ts-morph source file with prettier before writing the text to memory */
107
+ async function formatSourceFileWithPrettier(sourceFile) {
108
+ const sourceText = sourceFile.getFullText();
109
+ let formattedText = sourceText;
110
+ try {
111
+ formattedText = await format(sourceText, { parser: "typescript" });
112
+ } catch (error) {
113
+ console.error(error);
114
+ }
115
+ sourceFile.replaceWithText(formattedText);
116
+ }
117
+ async function runPrettier() {
118
+ await spawnAsync("npx", [
119
+ "prettier",
120
+ "--write",
121
+ "."
122
+ ]);
123
+ }
124
+ //#endregion
125
+ //#region src/utils/source-files.ts
126
+ /** Gets a SourceFile by name in a ts-morph Project, or creates a new one
127
+ * if none with that path exists.
128
+ */
129
+ function getOrCreateSourceFile(project, filePath) {
130
+ const sourceFile = project.getSourceFile(filePath);
131
+ if (!sourceFile) return {
132
+ alreadyExists: false,
133
+ sourceFile: project.createSourceFile(filePath, "")
134
+ };
135
+ return {
136
+ alreadyExists: true,
137
+ sourceFile
138
+ };
139
+ }
140
+ /** Gets a Directory by name in a ts-morph Project, or creates a new one
141
+ * if none with that path exists.
142
+ */
143
+ function getOrCreateDirectory(project, dirPath) {
144
+ const directory = project.getDirectory(dirPath);
145
+ if (!directory) return {
146
+ alreadyExists: false,
147
+ directory: project.createDirectory(dirPath)
148
+ };
149
+ return {
150
+ alreadyExists: true,
151
+ directory
152
+ };
153
+ }
154
+ /** Ensures that the directories at the given paths exist within the
155
+ * ts-morph Project
156
+ */
157
+ async function ensureDirectoriesExist(project, ...pathsToEnsure) {
158
+ for (const dirPath of pathsToEnsure) if (!project.getDirectory(dirPath)) project.createDirectory(dirPath);
159
+ await project.save();
160
+ }
161
+ function getPreviousVersionSourceFile(args) {
162
+ const { project, version, filePath } = args;
163
+ const previousVersion = version - 1;
164
+ if (previousVersion < 1) return;
165
+ const previousVersionFilePath = filePath.replace(`/v${version}/`, `/v${previousVersion}/`);
166
+ return project.getSourceFile(previousVersionFilePath);
167
+ }
168
+ //#endregion
169
+ //#region src/utils/syntax-builders.ts
170
+ /** Builds a ts-morph ObjectLiteralExpression from a ts/js object
171
+ * Useful for substituting the value of a runtime object in templates
172
+ */
173
+ function buildObjectLiteral(inputObject, sourceFile) {
174
+ const propertyAssignments = [];
175
+ for (const [key, value] of Object.entries(inputObject)) {
176
+ const propertyAssignment = buildPropertyAssignment(key, value);
177
+ propertyAssignments.push(propertyAssignment);
178
+ }
179
+ const objectLiteral = ts.factory.createObjectLiteralExpression(propertyAssignments, true);
180
+ return buildNodePrinter(sourceFile)(objectLiteral);
181
+ }
182
+ function buildFalse() {
183
+ return ts.factory.createFalse();
184
+ }
185
+ function buildTrue() {
186
+ return ts.factory.createTrue();
187
+ }
188
+ function buildBoolean(value) {
189
+ return value ? buildTrue() : buildFalse();
190
+ }
191
+ function buildNull() {
192
+ return ts.factory.createNull();
193
+ }
194
+ function buildUndefined() {
195
+ return ts.factory.createIdentifier("undefined");
196
+ }
197
+ function buildNumericLiteral(value) {
198
+ return ts.factory.createNumericLiteral(value);
199
+ }
200
+ function buildStringLiteral(value) {
201
+ return ts.factory.createStringLiteral(value);
202
+ }
203
+ function buildArrayLiteral(elements) {
204
+ return ts.factory.createArrayLiteralExpression(elements, true);
205
+ }
206
+ function valueToExpression(value) {
207
+ if (value === null) return buildNull();
208
+ if (value === void 0) return buildUndefined();
209
+ if (typeof value === "boolean") return buildBoolean(value);
210
+ if (typeof value === "string") return buildStringLiteral(value);
211
+ if (typeof value === "number") return buildNumericLiteral(value);
212
+ if (Array.isArray(value)) return buildArrayLiteral(value.map((item) => valueToExpression(item)));
213
+ if (typeof value === "object") return ts.factory.createObjectLiteralExpression(Object.entries(value).map(([key, v]) => {
214
+ const name = ts.factory.createIdentifier(key);
215
+ return ts.factory.createPropertyAssignment(name, valueToExpression(v));
216
+ }), true);
217
+ throw new Error("Invalid value passed: ", value);
218
+ }
219
+ function buildPropertyAssignment(name, value) {
220
+ const nameIdentifier = ts.factory.createIdentifier(name);
221
+ const valueExpression = valueToExpression(value);
222
+ return ts.factory.createPropertyAssignment(nameIdentifier, valueExpression);
223
+ }
224
+ function buildNodePrinter(sourceFile) {
225
+ const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
226
+ return (node) => printer.printNode(ts.EmitHint.Unspecified, node, sourceFile.compilerNode);
227
+ }
228
+ //#endregion
229
+ //#region src/utils/ts-morph-project.ts
230
+ const DEFAULT_PROJECT_OPTIONS = {
231
+ skipAddingFilesFromTsConfig: true,
232
+ skipLoadingLibFiles: true,
233
+ manipulationSettings: {
234
+ useTrailingCommas: true,
235
+ indentationText: IndentationText.TwoSpaces,
236
+ indentMultiLineObjectLiteralBeginningOnBlankLine: true
237
+ }
238
+ };
239
+ /** Returns the minimal typescript config for use in ts-morph file generation */
240
+ function getDefaultProjectOptions(tsConfigFilePath) {
241
+ return {
242
+ ...DEFAULT_PROJECT_OPTIONS,
243
+ tsConfigFilePath
244
+ };
245
+ }
246
+ /** Instantiates a ts-morph Project using the default typescript config and nearest tsconfig.json file */
247
+ function buildTsMorphProject(projectDir) {
248
+ return new Project(getDefaultProjectOptions(path.join(projectDir, "tsconfig.json")));
249
+ }
250
+ //#endregion
251
+ //#region src/utils/unsafe-utils.ts
252
+ function getInitialStates(scopeState) {
253
+ const { global, local } = scopeState;
254
+ const scopes = {
255
+ global,
256
+ local
257
+ };
258
+ Object.entries(scopes).forEach(([scope, state]) => {
259
+ if (!isEmptyStateSchema(state.schema) && state.initialValue === "") throw new Error(`${scope.charAt(0).toLocaleUpperCase() + scope.slice(1)} scope has a defined schema but is missing an initial value.`);
260
+ });
261
+ return {
262
+ initialGlobalState: handleEmptyState(global.initialValue),
263
+ initialLocalState: handleEmptyState(local.initialValue)
264
+ };
265
+ }
266
+ function isEmptyStateSchema(schema) {
267
+ return schema === "" || !schema.includes("{");
268
+ }
269
+ function handleEmptyState(state) {
270
+ return state === "" ? "{}" : state;
271
+ }
272
+ //#endregion
273
+ //#region src/utils/validation.ts
274
+ /**
275
+ * Validates that a DocumentModelGlobalState has all required properties for successful code generation.
276
+ *
277
+ * @param documentModelState - The DocumentModelGlobalState to validate
278
+ * @returns Validation result with isValid flag and error messages
279
+ */
280
+ function validateDocumentModelState(documentModelState) {
281
+ const errors = [];
282
+ if (!documentModelState.id || typeof documentModelState.id !== "string" || documentModelState.id.trim() === "") errors.push("Property \"id\" is required and must be a non-empty string");
283
+ if (!documentModelState.name || typeof documentModelState.name !== "string" || documentModelState.name.trim() === "") errors.push("Property \"name\" is required and must be a non-empty string");
284
+ if (typeof documentModelState.extension !== "string") errors.push("Property \"extension\" must be a string");
285
+ if (!Array.isArray(documentModelState.specifications) || documentModelState.specifications.length === 0) {
286
+ errors.push("Property \"specifications\" is required and must be a non-empty array");
287
+ return {
288
+ isValid: false,
289
+ errors
290
+ };
291
+ }
292
+ const latestSpec = documentModelState.specifications[documentModelState.specifications.length - 1];
293
+ if (!latestSpec) {
294
+ errors.push("Latest specification is missing or invalid");
295
+ return {
296
+ isValid: false,
297
+ errors
298
+ };
299
+ }
300
+ if (!latestSpec.state) {
301
+ errors.push("Latest specification must have a \"state\" property");
302
+ return {
303
+ isValid: false,
304
+ errors
305
+ };
306
+ }
307
+ if (!latestSpec.state.global) errors.push("Latest specification state must have a \"global\" property");
308
+ else {
309
+ const globalState = latestSpec.state.global;
310
+ if (typeof globalState.schema !== "string") errors.push("Global state \"schema\" must be a string");
311
+ if (typeof globalState.initialValue !== "string") errors.push("Global state \"initialValue\" must be a string");
312
+ if (globalState.schema && globalState.schema.trim() !== "" && globalState.schema.includes("{") && (!globalState.initialValue || globalState.initialValue.trim() === "")) errors.push("Global state has a defined schema but is missing an initial value");
313
+ }
314
+ if (!latestSpec.state.local) errors.push("Latest specification state must have a \"local\" property");
315
+ else {
316
+ const localState = latestSpec.state.local;
317
+ if (typeof localState.schema !== "string") errors.push("Local state \"schema\" must be a string");
318
+ if (typeof localState.initialValue !== "string") errors.push("Local state \"initialValue\" must be a string");
319
+ if (localState.schema && localState.schema.trim() !== "" && localState.schema.includes("{") && (!localState.initialValue || localState.initialValue.trim() === "")) errors.push("Local state has a defined schema but is missing an initial value");
320
+ }
321
+ if (!Array.isArray(latestSpec.modules)) errors.push("Latest specification must have a \"modules\" array");
322
+ else {
323
+ if (latestSpec.modules.length === 0) errors.push("Latest specification must have at least one module defined");
324
+ latestSpec.modules.forEach((module, moduleIndex) => {
325
+ if (!module.name || typeof module.name !== "string" || module.name.trim() === "") errors.push(`Module at index ${moduleIndex} must have a non-empty "name" property`);
326
+ if (!Array.isArray(module.operations)) errors.push(`Module "${module.name || `at index ${moduleIndex}`}" must have an "operations" array`);
327
+ else {
328
+ if (module.operations.length === 0) errors.push(`Module "${module.name || `at index ${moduleIndex}`}" must have at least one operation defined`);
329
+ module.operations.forEach((operation, operationIndex) => {
330
+ const operationId = operation.name || `at index ${operationIndex}`;
331
+ const moduleId = module.name || `at index ${moduleIndex}`;
332
+ if (!operation.name || typeof operation.name !== "string" || operation.name.trim() === "") errors.push(`Operation ${operationId} in module "${moduleId}" must have a non-empty "name" property`);
333
+ if (operation.schema !== null && typeof operation.schema !== "string") errors.push(`Operation "${operationId}" in module "${moduleId}" must have a "schema" that is either null or a string`);
334
+ if (operation.scope !== void 0 && typeof operation.scope !== "string") errors.push(`Operation "${operationId}" in module "${moduleId}" must have a "scope" that is a string if provided`);
335
+ if (!Array.isArray(operation.errors)) errors.push(`Operation "${operationId}" in module "${moduleId}" must have an "errors" array`);
336
+ });
337
+ }
338
+ });
339
+ }
340
+ return {
341
+ isValid: errors.length === 0,
342
+ errors
343
+ };
344
+ }
345
+ //#endregion
346
+ //#region src/utils/graphql-type-prefixes.ts
347
+ /**
348
+ * Extract type names from a GraphQL schema.
349
+ * Finds all type, enum, union, interface, and input definitions.
350
+ */
351
+ function extractTypeNames(schema) {
352
+ const found = schema.match(/(type|enum|union|interface|input)\s+(\w+)\s/g);
353
+ if (!found) return [];
354
+ return found.map((f) => f.replaceAll("type ", "").replaceAll("enum ", "").replaceAll("union ", "").replaceAll("interface ", "").replaceAll("input ", "").trim());
355
+ }
356
+ /**
357
+ * Apply type prefixes to GraphQL schema to namespace types and avoid collisions.
358
+ */
359
+ function applyGraphQLTypePrefixes(schema, prefix, externalTypeNames = []) {
360
+ if (!schema || !schema.trim()) return schema;
361
+ let processedSchema = schema;
362
+ const localTypeNames = extractTypeNames(schema);
363
+ const allTypeNames = [...new Set([...localTypeNames, ...externalTypeNames])];
364
+ if (allTypeNames.length === 0) return schema;
365
+ allTypeNames.forEach((typeName) => {
366
+ const typeRegex = new RegExp(`(?<![_A-Za-z0-9])(${typeName})(?![_A-Za-z0-9])|\\[(${typeName})\\]|\\[(${typeName})!\\]|\\[(${typeName})\\]!|\\[(${typeName})!\\]!`, "g");
367
+ processedSchema = processedSchema.replace(typeRegex, (match, p1, p2, p3, p4, p5) => {
368
+ if (match.startsWith("[")) {
369
+ const captured = p2 || p3 || p4 || p5;
370
+ return match.replace(captured, `${prefix}_${captured}`);
371
+ }
372
+ return `${prefix}_${p1}`;
373
+ });
374
+ });
375
+ return processedSchema;
376
+ }
377
+ //#endregion
378
+ export { DEFAULT_PROJECT_OPTIONS, applyGraphQLTypePrefixes, buildObjectLiteral, buildStringLiteral, buildTsMorphProject, configSpec, documentModelDocumentTypeMetadata, ensureDirectoriesExist, extractTypeNames, formatSourceFileWithPrettier, getDefaultProjectOptions, getDocumentTypeMetadata, getInitialStates, getObjectLiteral, getObjectProperty, getOrCreateDirectory, getOrCreateSourceFile, getPHDocumentTypeNameFromSourceFile, getPreviousVersionSourceFile, getVariableDeclarationByTypeName, parseArgs, parseConfig, runPrettier, validateDocumentModelState };
379
+
380
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/cli.ts","../../../src/utils/constants.ts","../../../src/utils/syntax-getters.ts","../../../src/utils/document-type-metadata.ts","../../../src/utils/format-with-prettier.ts","../../../src/utils/source-files.ts","../../../src/utils/syntax-builders.ts","../../../src/utils/ts-morph-project.ts","../../../src/utils/unsafe-utils.ts","../../../src/utils/validation.ts","../../../src/utils/graphql-type-prefixes.ts"],"sourcesContent":["import arg from \"arg\";\n\nexport const configSpec = {\n \"--document-models\": String,\n \"--editors\": String,\n \"--interactive\": Boolean,\n \"--skip-format\": Boolean,\n \"--watch\": Boolean,\n \"-i\": \"--interactive\",\n \"-sf\": \"--skip-format\",\n \"-w\": \"--watch\",\n} as const;\n\nexport function parseArgs<T extends arg.Spec>(argv: string[], spec: T) {\n const args = arg(spec, {\n permissive: true,\n argv,\n });\n\n return args;\n}\n\nexport function parseConfig(argv: string[]) {\n const config: Partial<{\n documentModelsDir?: string;\n editorsDir?: string;\n skipFormat?: boolean;\n interactive?: boolean;\n watch?: boolean;\n }> = {};\n const args = parseArgs(argv, configSpec);\n\n if (\"--document-models\" in args) {\n config.documentModelsDir = args[\"--document-models\"];\n }\n\n if (\"--editors\" in args) {\n config.editorsDir = args[\"--editors\"];\n }\n\n if (\"--skip-format\" in args) {\n config.skipFormat = true;\n }\n if (\"--interactive\" in args) {\n config.interactive = true;\n }\n if (\"--watch\" in args) {\n config.watch = true;\n }\n\n return config;\n}\n","/** Document model metadata for the `powerhouse/document-model` document type.\n *\n * Assumed to always be present during codegen.\n */\nexport const documentModelDocumentTypeMetadata = {\n documentModelId: \"powerhouse/document-model\",\n documentModelDocumentTypeName: \"DocumentModelDocument\",\n documentModelDirName: \"document-model\",\n documentModelImportPath: \"document-model\",\n} as const;\n","import type {\n ObjectLiteralExpression,\n SourceFile,\n VariableStatement,\n} from \"ts-morph\";\nimport { SyntaxKind } from \"ts-morph\";\n\n/** Returns a ts-morph ObjectLiteralExpression from a variable statement\n * if the type matches\n */\nexport function getObjectLiteral(statement: VariableStatement | undefined) {\n return statement\n ?.getDeclarations()\n .at(0)\n ?.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);\n}\n\n/** Returns the value of a property in a ts-morph ObjectLiteralExpression of type T if it exists */\nexport function getObjectProperty<T extends SyntaxKind>(\n object: ObjectLiteralExpression | undefined,\n propertyName: string,\n propertyType: T,\n) {\n return object\n ?.getProperty(propertyName)\n ?.asKind(SyntaxKind.PropertyAssignment)\n ?.getChildren()\n .find((child) => child.getKind() === propertyType)\n ?.asKindOrThrow(propertyType);\n}\n\nexport function getVariableDeclarationByTypeName(\n sourceFile: SourceFile,\n typeName: string,\n) {\n const declaration = sourceFile.getVariableDeclaration((declaration) => {\n // First try matching the type annotation text (more reliable when types\n // can't be fully resolved, e.g. in external projects with linked deps)\n const typeAnnotation = declaration.getTypeNode()?.getText() ?? \"\";\n if (typeAnnotation.includes(typeName)) return true;\n // Fall back to resolved type text\n return declaration.getType().getText().includes(typeName);\n });\n return declaration;\n}\n","import type { DocumentModelDocumentTypeMetadata } from \"file-builders\";\nimport path from \"path\";\nimport type { Project, SourceFile } from \"ts-morph\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { getObjectLiteral, getObjectProperty } from \"./syntax-getters.js\";\n\ntype GetDocumentTypeMetadataArgs = {\n project: Project;\n documentModelId: string;\n documentModelsDirPath: string;\n};\n/** Gets the document model metadata for the --document-type argument\n * passed to the `generate --editor` and `generate --app` commands.\n */\nexport function getDocumentTypeMetadata({\n project,\n documentModelId,\n documentModelsDirPath,\n}: GetDocumentTypeMetadataArgs) {\n const sourceFiles = project.getSourceFiles().filter((file) => {\n return file.getBaseName() === \"document-model.ts\";\n });\n\n const sourceFile = sourceFiles.find((file) =>\n getDocumentModelFileByDocumentId(file, documentModelId),\n );\n\n if (!sourceFile) {\n throw new Error(`No document-model.ts file exists for ${documentModelId}`);\n }\n\n const documentModelsDir = project.getDirectory(documentModelsDirPath);\n\n if (!documentModelsDir) {\n throw new Error(`No document-models dir exists for ${documentModelId}`);\n }\n\n const documentModelDir = project\n .getDirectories()\n .find(\n (dir) =>\n sourceFile.getDirectory().isDescendantOf(dir) &&\n dir.isDescendantOf(documentModelsDir),\n );\n\n if (!documentModelDir) {\n throw new Error(`No document model dir exists for ${documentModelId}`);\n }\n\n const documentModelDirName = documentModelDir.getBaseName();\n\n const documentModelImportPath = path.join(\n \"document-models\",\n documentModelDirName,\n );\n\n // types.ts lives in the same gen/ directory as document-model.ts\n // For non-versioned: <model>/gen/types.ts\n // For versioned: <model>/v1/gen/types.ts\n const sourceFileDir = sourceFile.getDirectoryPath();\n const documentModelGenTypesFilePath = path.join(sourceFileDir, \"types.ts\");\n\n const documentModelGenTypesFile = project.getSourceFile(\n documentModelGenTypesFilePath,\n );\n\n if (!documentModelGenTypesFile) {\n throw new Error(`No generated types file exists for ${documentModelId}`);\n }\n\n const documentModelDocumentTypeName = getPHDocumentTypeNameFromSourceFile(\n documentModelGenTypesFile,\n );\n\n if (!documentModelDocumentTypeName) {\n throw new Error(\n `Generated type file is missing PHDocument type declaration for ${documentModelId}`,\n );\n }\n const documentTypeMetadata: DocumentModelDocumentTypeMetadata = {\n documentModelDirName,\n documentModelDocumentTypeName,\n documentModelId,\n documentModelImportPath,\n };\n\n return documentTypeMetadata;\n}\n\nfunction getDocumentModelFileByDocumentId(\n sourceFile: SourceFile,\n documentModelId: string,\n) {\n const documentModelStatement =\n sourceFile.getVariableStatement(\"documentModel\");\n\n if (!documentModelStatement) {\n return false;\n }\n\n const documentModelObject = getObjectLiteral(documentModelStatement);\n\n if (!documentModelObject) {\n return false;\n }\n\n const documentModelIdProperty = getObjectProperty(\n documentModelObject,\n \"id\",\n SyntaxKind.StringLiteral,\n );\n\n return documentModelIdProperty?.getLiteralValue() === documentModelId;\n}\n\nexport function getPHDocumentTypeNameFromSourceFile(sourceFile: SourceFile) {\n return sourceFile\n .getTypeAliases()\n .find((alias) => {\n const typeNodeText = alias.getTypeNode()?.getText();\n return typeNodeText?.includes(\"PHDocument\");\n })\n ?.getName();\n}\n","import { spawnAsync } from \"@powerhousedao/shared/clis\";\nimport { format } from \"prettier\";\nimport type { SourceFile } from \"ts-morph\";\n\n/** Formats the text of a ts-morph source file with prettier before writing the text to memory */\nexport async function formatSourceFileWithPrettier(sourceFile: SourceFile) {\n const sourceText = sourceFile.getFullText();\n let formattedText = sourceText;\n try {\n formattedText = await format(sourceText, {\n parser: \"typescript\",\n });\n } catch (error) {\n console.error(error);\n }\n sourceFile.replaceWithText(formattedText);\n}\n\nexport async function runPrettier() {\n await spawnAsync(\"npx\", [\"prettier\", \"--write\", \".\"]);\n}\n","import type { Project } from \"ts-morph\";\n\n/** Gets a SourceFile by name in a ts-morph Project, or creates a new one\n * if none with that path exists.\n */\nexport function getOrCreateSourceFile(project: Project, filePath: string) {\n const sourceFile = project.getSourceFile(filePath);\n if (!sourceFile) {\n const newSourceFile = project.createSourceFile(filePath, \"\");\n return {\n alreadyExists: false,\n sourceFile: newSourceFile,\n };\n }\n return {\n alreadyExists: true,\n sourceFile,\n };\n}\n\n/** Gets a Directory by name in a ts-morph Project, or creates a new one\n * if none with that path exists.\n */\nexport function getOrCreateDirectory(project: Project, dirPath: string) {\n const directory = project.getDirectory(dirPath);\n if (!directory) {\n const newDirectory = project.createDirectory(dirPath);\n return {\n alreadyExists: false,\n directory: newDirectory,\n };\n }\n return {\n alreadyExists: true,\n directory,\n };\n}\n\n/** Ensures that the directories at the given paths exist within the\n * ts-morph Project\n */\nexport async function ensureDirectoriesExist(\n project: Project,\n ...pathsToEnsure: string[]\n) {\n for (const dirPath of pathsToEnsure) {\n const dir = project.getDirectory(dirPath);\n if (!dir) {\n project.createDirectory(dirPath);\n }\n }\n await project.save();\n}\n\nexport function getPreviousVersionSourceFile(args: {\n project: Project;\n version: number;\n filePath: string;\n}) {\n const { project, version, filePath } = args;\n const previousVersion = version - 1;\n if (previousVersion < 1) return;\n const previousVersionFilePath = filePath.replace(\n `/v${version}/`,\n `/v${previousVersion}/`,\n );\n\n const previousVersionFile = project.getSourceFile(previousVersionFilePath);\n\n return previousVersionFile;\n}\n","import type { SourceFile } from \"ts-morph\";\nimport { ts } from \"ts-morph\";\n\n/** Builds a ts-morph ObjectLiteralExpression from a ts/js object\n * Useful for substituting the value of a runtime object in templates\n */\nexport function buildObjectLiteral(\n inputObject: object,\n sourceFile: SourceFile,\n) {\n const propertyAssignments: ts.PropertyAssignment[] = [];\n for (const [key, value] of Object.entries(inputObject)) {\n const propertyAssignment = buildPropertyAssignment(key, value);\n propertyAssignments.push(propertyAssignment);\n }\n const objectLiteral = ts.factory.createObjectLiteralExpression(\n propertyAssignments,\n true,\n );\n\n const printNode = buildNodePrinter(sourceFile);\n return printNode(objectLiteral);\n}\n\nfunction buildFalse() {\n return ts.factory.createFalse();\n}\n\nfunction buildTrue() {\n return ts.factory.createTrue();\n}\n\nfunction buildBoolean(value: boolean) {\n return value ? buildTrue() : buildFalse();\n}\n\nfunction buildNull() {\n return ts.factory.createNull();\n}\n\nfunction buildUndefined() {\n return ts.factory.createIdentifier(\"undefined\");\n}\n\nfunction buildNumericLiteral(value: number) {\n return ts.factory.createNumericLiteral(value);\n}\n\nexport function buildStringLiteral(value: string) {\n return ts.factory.createStringLiteral(value);\n}\n\nfunction buildArrayLiteral(elements: ts.Expression[]) {\n return ts.factory.createArrayLiteralExpression(elements, true);\n}\n\nfunction valueToExpression(value: unknown): ts.Expression {\n if (value === null) return buildNull();\n if (value === undefined) return buildUndefined();\n if (typeof value === \"boolean\") return buildBoolean(value);\n if (typeof value === \"string\") return buildStringLiteral(value);\n if (typeof value === \"number\") return buildNumericLiteral(value);\n\n if (Array.isArray(value)) {\n const elements = value.map((item) => valueToExpression(item));\n return buildArrayLiteral(elements);\n }\n\n if (typeof value === \"object\") {\n return ts.factory.createObjectLiteralExpression(\n Object.entries(value).map(([key, v]) => {\n const name = ts.factory.createIdentifier(key);\n return ts.factory.createPropertyAssignment(name, valueToExpression(v));\n }),\n true,\n );\n }\n\n throw new Error(\"Invalid value passed: \", value);\n}\n\nfunction buildPropertyAssignment(name: string, value: unknown) {\n const nameIdentifier = ts.factory.createIdentifier(name);\n const valueExpression = valueToExpression(value);\n\n const propertyAssignment = ts.factory.createPropertyAssignment(\n nameIdentifier,\n valueExpression,\n );\n\n return propertyAssignment;\n}\n\nfunction buildNodePrinter(sourceFile: SourceFile) {\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n return (node: ts.Node) =>\n printer.printNode(ts.EmitHint.Unspecified, node, sourceFile.compilerNode);\n}\n","import path from \"path\";\nimport { IndentationText, Project } from \"ts-morph\";\n\nexport const DEFAULT_PROJECT_OPTIONS = {\n // don't add files from the tsconfig.json file, only use the ones we need\n skipAddingFilesFromTsConfig: true,\n // don't load library files, we only need the files we're adding\n skipLoadingLibFiles: true,\n // use formatting rules which match prettier\n manipulationSettings: {\n useTrailingCommas: true,\n indentationText: IndentationText.TwoSpaces,\n indentMultiLineObjectLiteralBeginningOnBlankLine: true,\n },\n} as const;\n\n/** Returns the minimal typescript config for use in ts-morph file generation */\nexport function getDefaultProjectOptions(tsConfigFilePath: string) {\n return {\n ...DEFAULT_PROJECT_OPTIONS,\n tsConfigFilePath,\n };\n}\n\n/** Instantiates a ts-morph Project using the default typescript config and nearest tsconfig.json file */\nexport function buildTsMorphProject(projectDir: string) {\n const tsConfigFilePath = path.join(projectDir, \"tsconfig.json\");\n const project = new Project(getDefaultProjectOptions(tsConfigFilePath));\n return project;\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nexport function getInitialStates(scopeState: { global: any; local: any }) {\n const { global, local } = scopeState;\n const scopes = { global, local };\n\n Object.entries(scopes).forEach(([scope, state]) => {\n if (!isEmptyStateSchema(state.schema) && state.initialValue === \"\") {\n throw new Error(\n `${\n scope.charAt(0).toLocaleUpperCase() + scope.slice(1)\n } scope has a defined schema but is missing an initial value.`,\n );\n }\n });\n\n return {\n initialGlobalState: handleEmptyState(global.initialValue),\n initialLocalState: handleEmptyState(local.initialValue),\n };\n}\n\nfunction isEmptyStateSchema(schema: string | string[]) {\n return schema === \"\" || !schema.includes(\"{\");\n}\n\nfunction handleEmptyState(state: string) {\n return state === \"\" ? \"{}\" : state;\n}\n","import type { DocumentModelGlobalState } from \"@powerhousedao/shared/document-model\";\n\n/**\n * Validation result for DocumentModelGlobalState code generation requirements\n */\nexport interface DocumentModelStateValidationResult {\n /** Whether the DocumentModelGlobalState is valid for code generation */\n isValid: boolean;\n /** Array of validation error messages if validation fails */\n errors: string[];\n}\n\n/**\n * Validates that a DocumentModelGlobalState has all required properties for successful code generation.\n *\n * @param documentModelState - The DocumentModelGlobalState to validate\n * @returns Validation result with isValid flag and error messages\n */\nexport function validateDocumentModelState(\n documentModelState: DocumentModelGlobalState,\n): DocumentModelStateValidationResult {\n const errors: string[] = [];\n\n // Validate top-level required properties\n if (\n !documentModelState.id ||\n typeof documentModelState.id !== \"string\" ||\n documentModelState.id.trim() === \"\"\n ) {\n errors.push('Property \"id\" is required and must be a non-empty string');\n }\n\n if (\n !documentModelState.name ||\n typeof documentModelState.name !== \"string\" ||\n documentModelState.name.trim() === \"\"\n ) {\n errors.push('Property \"name\" is required and must be a non-empty string');\n }\n\n // Extension field is optional (can be empty string)\n if (typeof documentModelState.extension !== \"string\") {\n errors.push('Property \"extension\" must be a string');\n }\n\n // Validate specifications array\n if (\n !Array.isArray(documentModelState.specifications) ||\n documentModelState.specifications.length === 0\n ) {\n errors.push(\n 'Property \"specifications\" is required and must be a non-empty array',\n );\n return { isValid: false, errors };\n }\n\n // Get the latest specification (used by code generation)\n const latestSpec =\n documentModelState.specifications[\n documentModelState.specifications.length - 1\n ];\n\n if (!latestSpec) {\n errors.push(\"Latest specification is missing or invalid\");\n return { isValid: false, errors };\n }\n\n // Validate state structure\n if (!latestSpec.state) {\n errors.push('Latest specification must have a \"state\" property');\n return { isValid: false, errors };\n }\n\n // Validate global state (required)\n if (!latestSpec.state.global) {\n errors.push('Latest specification state must have a \"global\" property');\n } else {\n const globalState = latestSpec.state.global;\n\n if (typeof globalState.schema !== \"string\") {\n errors.push('Global state \"schema\" must be a string');\n }\n\n if (typeof globalState.initialValue !== \"string\") {\n errors.push('Global state \"initialValue\" must be a string');\n }\n\n // Check if schema is non-empty but initialValue is missing\n const hasNonEmptySchema =\n globalState.schema &&\n globalState.schema.trim() !== \"\" &&\n globalState.schema.includes(\"{\");\n if (\n hasNonEmptySchema &&\n (!globalState.initialValue || globalState.initialValue.trim() === \"\")\n ) {\n errors.push(\n \"Global state has a defined schema but is missing an initial value\",\n );\n }\n }\n\n // Validate local state (required - templates directly access it)\n if (!latestSpec.state.local) {\n errors.push('Latest specification state must have a \"local\" property');\n } else {\n const localState = latestSpec.state.local;\n\n if (typeof localState.schema !== \"string\") {\n errors.push('Local state \"schema\" must be a string');\n }\n\n if (typeof localState.initialValue !== \"string\") {\n errors.push('Local state \"initialValue\" must be a string');\n }\n\n // Check if schema is non-empty but initialValue is missing\n const hasNonEmptySchema =\n localState.schema &&\n localState.schema.trim() !== \"\" &&\n localState.schema.includes(\"{\");\n if (\n hasNonEmptySchema &&\n (!localState.initialValue || localState.initialValue.trim() === \"\")\n ) {\n errors.push(\n \"Local state has a defined schema but is missing an initial value\",\n );\n }\n }\n\n // Validate modules array (required but can be empty)\n if (!Array.isArray(latestSpec.modules)) {\n errors.push('Latest specification must have a \"modules\" array');\n } else {\n // Validate that there's at least one module\n if (latestSpec.modules.length === 0) {\n errors.push(\"Latest specification must have at least one module defined\");\n }\n\n latestSpec.modules.forEach((module, moduleIndex) => {\n if (\n !module.name ||\n typeof module.name !== \"string\" ||\n module.name.trim() === \"\"\n ) {\n errors.push(\n `Module at index ${moduleIndex} must have a non-empty \"name\" property`,\n );\n }\n\n if (!Array.isArray(module.operations)) {\n errors.push(\n `Module \"${module.name || `at index ${moduleIndex}`}\" must have an \"operations\" array`,\n );\n } else {\n // Validate that each module has at least one operation\n if (module.operations.length === 0) {\n errors.push(\n `Module \"${module.name || `at index ${moduleIndex}`}\" must have at least one operation defined`,\n );\n }\n\n module.operations.forEach((operation, operationIndex) => {\n const operationId = operation.name || `at index ${operationIndex}`;\n const moduleId = module.name || `at index ${moduleIndex}`;\n\n // operation.name is required for code generation\n if (\n !operation.name ||\n typeof operation.name !== \"string\" ||\n operation.name.trim() === \"\"\n ) {\n errors.push(\n `Operation ${operationId} in module \"${moduleId}\" must have a non-empty \"name\" property`,\n );\n }\n\n // operation.schema can be null or string (required property)\n if (\n operation.schema !== null &&\n typeof operation.schema !== \"string\"\n ) {\n errors.push(\n `Operation \"${operationId}\" in module \"${moduleId}\" must have a \"schema\" that is either null or a string`,\n );\n }\n\n // operation.scope is optional - template uses `a.scope || \"global\"` fallback\n if (\n operation.scope !== undefined &&\n typeof operation.scope !== \"string\"\n ) {\n errors.push(\n `Operation \"${operationId}\" in module \"${moduleId}\" must have a \"scope\" that is a string if provided`,\n );\n }\n\n // operation.errors is required - templates directly access it\n if (!Array.isArray(operation.errors)) {\n errors.push(\n `Operation \"${operationId}\" in module \"${moduleId}\" must have an \"errors\" array`,\n );\n }\n });\n }\n });\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n };\n}\n","/**\n * Extract type names from a GraphQL schema.\n * Finds all type, enum, union, interface, and input definitions.\n */\nexport function extractTypeNames(schema: string): string[] {\n const found = schema.match(/(type|enum|union|interface|input)\\s+(\\w+)\\s/g);\n if (!found) return [];\n return found.map((f) =>\n f\n .replaceAll(\"type \", \"\")\n .replaceAll(\"enum \", \"\")\n .replaceAll(\"union \", \"\")\n .replaceAll(\"interface \", \"\")\n .replaceAll(\"input \", \"\")\n .trim(),\n );\n}\n\n/**\n * Apply type prefixes to GraphQL schema to namespace types and avoid collisions.\n */\nexport function applyGraphQLTypePrefixes(\n schema: string,\n prefix: string,\n externalTypeNames: string[] = [],\n): string {\n if (!schema || !schema.trim()) {\n return schema;\n }\n\n let processedSchema = schema;\n\n // Find types defined in this schema\n const localTypeNames = extractTypeNames(schema);\n\n // Combine with external type names (remove duplicates)\n const allTypeNames = [...new Set([...localTypeNames, ...externalTypeNames])];\n\n if (allTypeNames.length === 0) {\n return schema;\n }\n\n allTypeNames.forEach((typeName) => {\n const typeRegex = new RegExp(\n // Match type references in various GraphQL contexts\n `(?<![_A-Za-z0-9])(${typeName})(?![_A-Za-z0-9])|` +\n `\\\\[(${typeName})\\\\]|` +\n `\\\\[(${typeName})!\\\\]|` +\n `\\\\[(${typeName})\\\\]!|` +\n `\\\\[(${typeName})!\\\\]!`,\n \"g\",\n );\n\n processedSchema = processedSchema.replace(\n typeRegex,\n (\n match: string,\n p1: string,\n p2: string,\n p3: string,\n p4: string,\n p5: string,\n ) => {\n if (match.startsWith(\"[\")) {\n const captured = p2 || p3 || p4 || p5;\n return match.replace(captured, `${prefix}_${captured}`);\n }\n // Basic type reference\n return `${prefix}_${p1}`;\n },\n );\n });\n\n return processedSchema;\n}\n"],"mappings":";;;;;;AAEA,MAAa,aAAa;CACxB,qBAAqB;CACrB,aAAa;CACb,iBAAiB;CACjB,iBAAiB;CACjB,WAAW;CACX,MAAM;CACN,OAAO;CACP,MAAM;CACP;AAED,SAAgB,UAA8B,MAAgB,MAAS;AAMrE,QALa,IAAI,MAAM;EACrB,YAAY;EACZ;EACD,CAAC;;AAKJ,SAAgB,YAAY,MAAgB;CAC1C,MAAM,SAMD,EAAE;CACP,MAAM,OAAO,UAAU,MAAM,WAAW;AAExC,KAAI,uBAAuB,KACzB,QAAO,oBAAoB,KAAK;AAGlC,KAAI,eAAe,KACjB,QAAO,aAAa,KAAK;AAG3B,KAAI,mBAAmB,KACrB,QAAO,aAAa;AAEtB,KAAI,mBAAmB,KACrB,QAAO,cAAc;AAEvB,KAAI,aAAa,K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