@powerhousedao/codegen 5.1.0-staging.0 → 5.1.0

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 (235) hide show
  1. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/error.esm.t +3 -3
  2. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +3 -1
  3. package/dist/src/codegen/__tests__/config.d.ts +0 -1
  4. package/dist/src/codegen/__tests__/config.d.ts.map +1 -1
  5. package/dist/src/codegen/__tests__/config.js +0 -1
  6. package/dist/src/codegen/__tests__/config.js.map +1 -1
  7. package/dist/src/codegen/__tests__/generate-doc-model.test.js +14 -39
  8. package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -1
  9. package/dist/src/codegen/__tests__/generate-drive-editor.test.js +3 -6
  10. package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -1
  11. package/dist/src/codegen/__tests__/generate-editor.test.js +7 -8
  12. package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -1
  13. package/dist/src/codegen/generate.d.ts +6 -26
  14. package/dist/src/codegen/generate.d.ts.map +1 -1
  15. package/dist/src/codegen/generate.js +40 -139
  16. package/dist/src/codegen/generate.js.map +1 -1
  17. package/dist/src/codegen/hygen.d.ts +8 -1
  18. package/dist/src/codegen/hygen.d.ts.map +1 -1
  19. package/dist/src/codegen/hygen.js +67 -11
  20. package/dist/src/codegen/hygen.js.map +1 -1
  21. package/dist/src/index.d.ts +1 -0
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +1 -0
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/ts-morph-utils.d.ts +48 -0
  26. package/dist/src/ts-morph-utils.d.ts.map +1 -0
  27. package/dist/src/ts-morph-utils.js +207 -0
  28. package/dist/src/ts-morph-utils.js.map +1 -0
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +8 -11
  31. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/lib.esm.t +0 -9
  32. package/dist/src/ts-morph-utils/constants.d.ts +0 -18
  33. package/dist/src/ts-morph-utils/constants.d.ts.map +0 -1
  34. package/dist/src/ts-morph-utils/constants.js +0 -18
  35. package/dist/src/ts-morph-utils/constants.js.map +0 -1
  36. package/dist/src/ts-morph-utils/file-builders/document-editor.d.ts +0 -28
  37. package/dist/src/ts-morph-utils/file-builders/document-editor.d.ts.map +0 -1
  38. package/dist/src/ts-morph-utils/file-builders/document-editor.js +0 -305
  39. package/dist/src/ts-morph-utils/file-builders/document-editor.js.map +0 -1
  40. package/dist/src/ts-morph-utils/file-builders/document-model/gen-dir.d.ts +0 -3
  41. package/dist/src/ts-morph-utils/file-builders/document-model/gen-dir.d.ts.map +0 -1
  42. package/dist/src/ts-morph-utils/file-builders/document-model/gen-dir.js +0 -207
  43. package/dist/src/ts-morph-utils/file-builders/document-model/gen-dir.js.map +0 -1
  44. package/dist/src/ts-morph-utils/file-builders/document-model/root-dir.d.ts +0 -3
  45. package/dist/src/ts-morph-utils/file-builders/document-model/root-dir.d.ts.map +0 -1
  46. package/dist/src/ts-morph-utils/file-builders/document-model/root-dir.js +0 -58
  47. package/dist/src/ts-morph-utils/file-builders/document-model/root-dir.js.map +0 -1
  48. package/dist/src/ts-morph-utils/file-builders/document-model/src-dir.d.ts +0 -3
  49. package/dist/src/ts-morph-utils/file-builders/document-model/src-dir.d.ts.map +0 -1
  50. package/dist/src/ts-morph-utils/file-builders/document-model/src-dir.js +0 -64
  51. package/dist/src/ts-morph-utils/file-builders/document-model/src-dir.js.map +0 -1
  52. package/dist/src/ts-morph-utils/file-builders/document-model/types.d.ts +0 -12
  53. package/dist/src/ts-morph-utils/file-builders/document-model/types.d.ts.map +0 -1
  54. package/dist/src/ts-morph-utils/file-builders/document-model/types.js +0 -2
  55. package/dist/src/ts-morph-utils/file-builders/document-model/types.js.map +0 -1
  56. package/dist/src/ts-morph-utils/file-builders/document-model.d.ts +0 -8
  57. package/dist/src/ts-morph-utils/file-builders/document-model.d.ts.map +0 -1
  58. package/dist/src/ts-morph-utils/file-builders/document-model.js +0 -68
  59. package/dist/src/ts-morph-utils/file-builders/document-model.js.map +0 -1
  60. package/dist/src/ts-morph-utils/file-builders/drive-editor.d.ts +0 -56
  61. package/dist/src/ts-morph-utils/file-builders/drive-editor.d.ts.map +0 -1
  62. package/dist/src/ts-morph-utils/file-builders/drive-editor.js +0 -341
  63. package/dist/src/ts-morph-utils/file-builders/drive-editor.js.map +0 -1
  64. package/dist/src/ts-morph-utils/file-builders/editor-common.d.ts +0 -3
  65. package/dist/src/ts-morph-utils/file-builders/editor-common.d.ts.map +0 -1
  66. package/dist/src/ts-morph-utils/file-builders/editor-common.js +0 -15
  67. package/dist/src/ts-morph-utils/file-builders/editor-common.js.map +0 -1
  68. package/dist/src/ts-morph-utils/file-builders/index-files.d.ts +0 -17
  69. package/dist/src/ts-morph-utils/file-builders/index-files.d.ts.map +0 -1
  70. package/dist/src/ts-morph-utils/file-builders/index-files.js +0 -21
  71. package/dist/src/ts-morph-utils/file-builders/index-files.js.map +0 -1
  72. package/dist/src/ts-morph-utils/file-builders/module-files.d.ts +0 -25
  73. package/dist/src/ts-morph-utils/file-builders/module-files.d.ts.map +0 -1
  74. package/dist/src/ts-morph-utils/file-builders/module-files.js +0 -92
  75. package/dist/src/ts-morph-utils/file-builders/module-files.js.map +0 -1
  76. package/dist/src/ts-morph-utils/file-builders/subgraphs.d.ts +0 -6
  77. package/dist/src/ts-morph-utils/file-builders/subgraphs.d.ts.map +0 -1
  78. package/dist/src/ts-morph-utils/file-builders/subgraphs.js +0 -53
  79. package/dist/src/ts-morph-utils/file-builders/subgraphs.js.map +0 -1
  80. package/dist/src/ts-morph-utils/file-builders/types.d.ts +0 -13
  81. package/dist/src/ts-morph-utils/file-builders/types.d.ts.map +0 -1
  82. package/dist/src/ts-morph-utils/file-builders/types.js +0 -2
  83. package/dist/src/ts-morph-utils/file-builders/types.js.map +0 -1
  84. package/dist/src/ts-morph-utils/file-utils.d.ts +0 -28
  85. package/dist/src/ts-morph-utils/file-utils.d.ts.map +0 -1
  86. package/dist/src/ts-morph-utils/file-utils.js +0 -102
  87. package/dist/src/ts-morph-utils/file-utils.js.map +0 -1
  88. package/dist/src/ts-morph-utils/name-builders/common-files.d.ts +0 -5
  89. package/dist/src/ts-morph-utils/name-builders/common-files.d.ts.map +0 -1
  90. package/dist/src/ts-morph-utils/name-builders/common-files.js +0 -15
  91. package/dist/src/ts-morph-utils/name-builders/common-files.js.map +0 -1
  92. package/dist/src/ts-morph-utils/name-builders/document-model-files.d.ts +0 -4
  93. package/dist/src/ts-morph-utils/name-builders/document-model-files.d.ts.map +0 -1
  94. package/dist/src/ts-morph-utils/name-builders/document-model-files.js +0 -12
  95. package/dist/src/ts-morph-utils/name-builders/document-model-files.js.map +0 -1
  96. package/dist/src/ts-morph-utils/name-builders/editor-files.d.ts +0 -10
  97. package/dist/src/ts-morph-utils/name-builders/editor-files.d.ts.map +0 -1
  98. package/dist/src/ts-morph-utils/name-builders/editor-files.js +0 -37
  99. package/dist/src/ts-morph-utils/name-builders/editor-files.js.map +0 -1
  100. package/dist/src/ts-morph-utils/name-builders/get-file-paths.d.ts +0 -4
  101. package/dist/src/ts-morph-utils/name-builders/get-file-paths.d.ts.map +0 -1
  102. package/dist/src/ts-morph-utils/name-builders/get-file-paths.js +0 -21
  103. package/dist/src/ts-morph-utils/name-builders/get-file-paths.js.map +0 -1
  104. package/dist/src/ts-morph-utils/name-builders/get-variable-names.d.ts +0 -55
  105. package/dist/src/ts-morph-utils/name-builders/get-variable-names.d.ts.map +0 -1
  106. package/dist/src/ts-morph-utils/name-builders/get-variable-names.js +0 -153
  107. package/dist/src/ts-morph-utils/name-builders/get-variable-names.js.map +0 -1
  108. package/dist/src/ts-morph-utils/name-builders/types.d.ts +0 -14
  109. package/dist/src/ts-morph-utils/name-builders/types.d.ts.map +0 -1
  110. package/dist/src/ts-morph-utils/name-builders/types.js +0 -2
  111. package/dist/src/ts-morph-utils/name-builders/types.js.map +0 -1
  112. package/dist/src/ts-morph-utils/name-builders/variables.d.ts +0 -12
  113. package/dist/src/ts-morph-utils/name-builders/variables.d.ts.map +0 -1
  114. package/dist/src/ts-morph-utils/name-builders/variables.js +0 -35
  115. package/dist/src/ts-morph-utils/name-builders/variables.js.map +0 -1
  116. package/dist/src/ts-morph-utils/syntax-builders.d.ts +0 -72
  117. package/dist/src/ts-morph-utils/syntax-builders.d.ts.map +0 -1
  118. package/dist/src/ts-morph-utils/syntax-builders.js +0 -201
  119. package/dist/src/ts-morph-utils/syntax-builders.js.map +0 -1
  120. package/dist/src/ts-morph-utils/syntax-getters.d.ts +0 -10
  121. package/dist/src/ts-morph-utils/syntax-getters.d.ts.map +0 -1
  122. package/dist/src/ts-morph-utils/syntax-getters.js +0 -39
  123. package/dist/src/ts-morph-utils/syntax-getters.js.map +0 -1
  124. package/dist/src/ts-morph-utils/templates/document-model/actions.d.ts +0 -3
  125. package/dist/src/ts-morph-utils/templates/document-model/actions.d.ts.map +0 -1
  126. package/dist/src/ts-morph-utils/templates/document-model/actions.js +0 -28
  127. package/dist/src/ts-morph-utils/templates/document-model/actions.js.map +0 -1
  128. package/dist/src/ts-morph-utils/templates/document-model/gen/actions.d.ts +0 -3
  129. package/dist/src/ts-morph-utils/templates/document-model/gen/actions.d.ts.map +0 -1
  130. package/dist/src/ts-morph-utils/templates/document-model/gen/actions.js +0 -40
  131. package/dist/src/ts-morph-utils/templates/document-model/gen/actions.js.map +0 -1
  132. package/dist/src/ts-morph-utils/templates/document-model/gen/creators.d.ts +0 -3
  133. package/dist/src/ts-morph-utils/templates/document-model/gen/creators.d.ts.map +0 -1
  134. package/dist/src/ts-morph-utils/templates/document-model/gen/creators.js +0 -16
  135. package/dist/src/ts-morph-utils/templates/document-model/gen/creators.js.map +0 -1
  136. package/dist/src/ts-morph-utils/templates/document-model/gen/document-schema.d.ts +0 -3
  137. package/dist/src/ts-morph-utils/templates/document-model/gen/document-schema.d.ts.map +0 -1
  138. package/dist/src/ts-morph-utils/templates/document-model/gen/document-schema.js +0 -56
  139. package/dist/src/ts-morph-utils/templates/document-model/gen/document-schema.js.map +0 -1
  140. package/dist/src/ts-morph-utils/templates/document-model/gen/document-type.d.ts +0 -3
  141. package/dist/src/ts-morph-utils/templates/document-model/gen/document-type.d.ts.map +0 -1
  142. package/dist/src/ts-morph-utils/templates/document-model/gen/document-type.js +0 -5
  143. package/dist/src/ts-morph-utils/templates/document-model/gen/document-type.js.map +0 -1
  144. package/dist/src/ts-morph-utils/templates/document-model/gen/index.d.ts +0 -3
  145. package/dist/src/ts-morph-utils/templates/document-model/gen/index.d.ts.map +0 -1
  146. package/dist/src/ts-morph-utils/templates/document-model/gen/index.js +0 -29
  147. package/dist/src/ts-morph-utils/templates/document-model/gen/index.js.map +0 -1
  148. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/actions.d.ts +0 -8
  149. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/actions.d.ts.map +0 -1
  150. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/actions.js +0 -39
  151. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/actions.js.map +0 -1
  152. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/creators.d.ts +0 -3
  153. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/creators.d.ts.map +0 -1
  154. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/creators.js +0 -94
  155. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/creators.js.map +0 -1
  156. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/error.d.ts +0 -3
  157. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/error.d.ts.map +0 -1
  158. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/error.js +0 -73
  159. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/error.js.map +0 -1
  160. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/operations.d.ts +0 -3
  161. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/operations.d.ts.map +0 -1
  162. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/operations.js +0 -61
  163. package/dist/src/ts-morph-utils/templates/document-model/gen/modules/operations.js.map +0 -1
  164. package/dist/src/ts-morph-utils/templates/document-model/gen/ph-factories.d.ts +0 -3
  165. package/dist/src/ts-morph-utils/templates/document-model/gen/ph-factories.d.ts.map +0 -1
  166. package/dist/src/ts-morph-utils/templates/document-model/gen/ph-factories.js +0 -93
  167. package/dist/src/ts-morph-utils/templates/document-model/gen/ph-factories.js.map +0 -1
  168. package/dist/src/ts-morph-utils/templates/document-model/gen/reducer.d.ts +0 -3
  169. package/dist/src/ts-morph-utils/templates/document-model/gen/reducer.d.ts.map +0 -1
  170. package/dist/src/ts-morph-utils/templates/document-model/gen/reducer.js +0 -106
  171. package/dist/src/ts-morph-utils/templates/document-model/gen/reducer.js.map +0 -1
  172. package/dist/src/ts-morph-utils/templates/document-model/gen/schema/index.d.ts +0 -2
  173. package/dist/src/ts-morph-utils/templates/document-model/gen/schema/index.d.ts.map +0 -1
  174. package/dist/src/ts-morph-utils/templates/document-model/gen/schema/index.js +0 -6
  175. package/dist/src/ts-morph-utils/templates/document-model/gen/schema/index.js.map +0 -1
  176. package/dist/src/ts-morph-utils/templates/document-model/gen/types.d.ts +0 -3
  177. package/dist/src/ts-morph-utils/templates/document-model/gen/types.d.ts.map +0 -1
  178. package/dist/src/ts-morph-utils/templates/document-model/gen/types.js +0 -38
  179. package/dist/src/ts-morph-utils/templates/document-model/gen/types.js.map +0 -1
  180. package/dist/src/ts-morph-utils/templates/document-model/gen/utils.d.ts +0 -3
  181. package/dist/src/ts-morph-utils/templates/document-model/gen/utils.d.ts.map +0 -1
  182. package/dist/src/ts-morph-utils/templates/document-model/gen/utils.js +0 -77
  183. package/dist/src/ts-morph-utils/templates/document-model/gen/utils.js.map +0 -1
  184. package/dist/src/ts-morph-utils/templates/document-model/hooks.d.ts +0 -3
  185. package/dist/src/ts-morph-utils/templates/document-model/hooks.d.ts.map +0 -1
  186. package/dist/src/ts-morph-utils/templates/document-model/hooks.js +0 -49
  187. package/dist/src/ts-morph-utils/templates/document-model/hooks.js.map +0 -1
  188. package/dist/src/ts-morph-utils/templates/document-model/index.d.ts +0 -2
  189. package/dist/src/ts-morph-utils/templates/document-model/index.d.ts.map +0 -1
  190. package/dist/src/ts-morph-utils/templates/document-model/index.js +0 -9
  191. package/dist/src/ts-morph-utils/templates/document-model/index.js.map +0 -1
  192. package/dist/src/ts-morph-utils/templates/document-model/module.d.ts +0 -8
  193. package/dist/src/ts-morph-utils/templates/document-model/module.d.ts.map +0 -1
  194. package/dist/src/ts-morph-utils/templates/document-model/module.js +0 -25
  195. package/dist/src/ts-morph-utils/templates/document-model/module.js.map +0 -1
  196. package/dist/src/ts-morph-utils/templates/document-model/src/index.d.ts +0 -2
  197. package/dist/src/ts-morph-utils/templates/document-model/src/index.d.ts.map +0 -1
  198. package/dist/src/ts-morph-utils/templates/document-model/src/index.js +0 -5
  199. package/dist/src/ts-morph-utils/templates/document-model/src/index.js.map +0 -1
  200. package/dist/src/ts-morph-utils/templates/document-model/src/tests/document-model.test.d.ts +0 -3
  201. package/dist/src/ts-morph-utils/templates/document-model/src/tests/document-model.test.d.ts.map +0 -1
  202. package/dist/src/ts-morph-utils/templates/document-model/src/tests/document-model.test.js +0 -121
  203. package/dist/src/ts-morph-utils/templates/document-model/src/tests/document-model.test.js.map +0 -1
  204. package/dist/src/ts-morph-utils/templates/document-model/src/tests/module.test.d.ts +0 -3
  205. package/dist/src/ts-morph-utils/templates/document-model/src/tests/module.test.d.ts.map +0 -1
  206. package/dist/src/ts-morph-utils/templates/document-model/src/tests/module.test.js +0 -67
  207. package/dist/src/ts-morph-utils/templates/document-model/src/tests/module.test.js.map +0 -1
  208. package/dist/src/ts-morph-utils/templates/document-model/src/utils.d.ts +0 -2
  209. package/dist/src/ts-morph-utils/templates/document-model/src/utils.d.ts.map +0 -1
  210. package/dist/src/ts-morph-utils/templates/document-model/src/utils.js +0 -5
  211. package/dist/src/ts-morph-utils/templates/document-model/src/utils.js.map +0 -1
  212. package/dist/src/ts-morph-utils/templates/document-model/utils.d.ts +0 -3
  213. package/dist/src/ts-morph-utils/templates/document-model/utils.d.ts.map +0 -1
  214. package/dist/src/ts-morph-utils/templates/document-model/utils.js +0 -11
  215. package/dist/src/ts-morph-utils/templates/document-model/utils.js.map +0 -1
  216. package/dist/src/ts-morph-utils/templates/drive-editor.d.ts +0 -5
  217. package/dist/src/ts-morph-utils/templates/drive-editor.d.ts.map +0 -1
  218. package/dist/src/ts-morph-utils/templates/drive-editor.js +0 -211
  219. package/dist/src/ts-morph-utils/templates/drive-editor.js.map +0 -1
  220. package/dist/src/ts-morph-utils/templates/unsafe-utils.d.ts +0 -8
  221. package/dist/src/ts-morph-utils/templates/unsafe-utils.d.ts.map +0 -1
  222. package/dist/src/ts-morph-utils/templates/unsafe-utils.js +0 -23
  223. package/dist/src/ts-morph-utils/templates/unsafe-utils.js.map +0 -1
  224. package/dist/src/ts-morph-utils/templates/utils.d.ts +0 -6
  225. package/dist/src/ts-morph-utils/templates/utils.d.ts.map +0 -1
  226. package/dist/src/ts-morph-utils/templates/utils.js +0 -16
  227. package/dist/src/ts-morph-utils/templates/utils.js.map +0 -1
  228. package/dist/src/ts-morph-utils/ts-morph-project.d.ts +0 -3
  229. package/dist/src/ts-morph-utils/ts-morph-project.d.ts.map +0 -1
  230. package/dist/src/ts-morph-utils/ts-morph-project.js +0 -9
  231. package/dist/src/ts-morph-utils/ts-morph-project.js.map +0 -1
  232. package/dist/src/ts-morph-utils/types.d.ts +0 -34
  233. package/dist/src/ts-morph-utils/types.d.ts.map +0 -1
  234. package/dist/src/ts-morph-utils/types.js +0 -2
  235. package/dist/src/ts-morph-utils/types.js.map +0 -1
@@ -1,38 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- function buildEmptyLocalStateType(hasLocalSchema, localStateName) {
3
- if (hasLocalSchema)
4
- return "";
5
- return `type ${localStateName} = Record<PropertyKey, never>;`;
6
- }
7
- function buildLocalStateTypeImport(hasLocalSchema, localStateName) {
8
- if (!hasLocalSchema)
9
- return "";
10
- return localStateName;
11
- }
12
- export const documentModelGenTypesTemplate = ({ actionTypeName, stateName, globalStateName, hasLocalSchema, localStateName, phStateName, phDocumentTypeName, }) => ts `
13
- import type { PHDocument, PHBaseState } from 'document-model';
14
- import type { ${actionTypeName} } from './actions.js';
15
- import type {
16
- ${stateName} as ${globalStateName},
17
- ${buildLocalStateTypeImport(hasLocalSchema, localStateName)}
18
- } from './schema/types.js';
19
-
20
- ${buildEmptyLocalStateType(hasLocalSchema, localStateName)}
21
-
22
- type ${phStateName} = PHBaseState & {
23
- global: ${globalStateName};
24
- local: ${localStateName};
25
- };
26
- type ${phDocumentTypeName} = PHDocument<${phStateName}>;
27
-
28
- export * from './schema/types.js';
29
-
30
- export type {
31
- ${globalStateName},
32
- ${localStateName},
33
- ${phStateName},
34
- ${actionTypeName},
35
- ${phDocumentTypeName},
36
- };
37
- `.raw;
38
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAGhC,SAAS,wBAAwB,CAC/B,cAAuB,EACvB,cAAsB;IAEtB,IAAI,cAAc;QAAE,OAAO,EAAE,CAAC;IAE9B,OAAO,QAAQ,cAAc,gCAAgC,CAAC;AAChE,CAAC;AAED,SAAS,yBAAyB,CAChC,cAAuB,EACvB,cAAsB;IAEtB,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAC/B,OAAO,cAAc,CAAC;AACxB,CAAC;AACD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC5C,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,kBAAkB,GACS,EAAE,EAAE,CAC/B,EAAE,CAAA;;gBAEY,cAAc;;IAE1B,SAAS,OAAO,eAAe;IAC/B,yBAAyB,CAAC,cAAc,EAAE,cAAc,CAAC;;;EAG3D,wBAAwB,CAAC,cAAc,EAAE,cAAc,CAAC;;OAEnD,WAAW;YACN,eAAe;WAChB,cAAc;;OAElB,kBAAkB,iBAAiB,WAAW;;;;;IAKjD,eAAe;IACf,cAAc;IACd,WAAW;IACX,cAAc;IACd,kBAAkB;;CAErB,CAAC,GAAG,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { DocumentModelVariableNames } from "../../../name-builders/types.js";
2
- export declare const documentModelGenUtilsTemplate: ({ globalStateName, localStateName, phStateName, documentTypeVariableName, isPhDocumentOfTypeFunctionName, assertIsPhDocumentOfTypeFunctionName, isPhStateOfTypeFunctionName, assertIsPhStateOfTypeFunctionName, fileExtension, initialGlobalState, initialLocalState, }: DocumentModelVariableNames) => string;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/gen/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,eAAO,MAAM,6BAA6B,GAAI,yQAY3C,0BAA0B,WA2ExB,CAAC"}
@@ -1,77 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelGenUtilsTemplate = ({ globalStateName, localStateName, phStateName, documentTypeVariableName, isPhDocumentOfTypeFunctionName, assertIsPhDocumentOfTypeFunctionName, isPhStateOfTypeFunctionName, assertIsPhStateOfTypeFunctionName, fileExtension, initialGlobalState, initialLocalState, }) => ts `
3
- import type {
4
- DocumentModelUtils,
5
- } from "document-model";
6
- import {
7
- baseCreateDocument,
8
- baseSaveToFileHandle,
9
- baseLoadFromInput,
10
- defaultBaseState,
11
- generateId,
12
- } from 'document-model/core';
13
- import type {
14
- ${globalStateName},
15
- ${localStateName}
16
- } from './types.js';
17
- import type { ${phStateName} } from './types.js';
18
- import { reducer } from './reducer.js';
19
- import { ${documentTypeVariableName} } from "./document-type.js";
20
- import {
21
- ${isPhDocumentOfTypeFunctionName},
22
- ${assertIsPhDocumentOfTypeFunctionName},
23
- ${isPhStateOfTypeFunctionName},
24
- ${assertIsPhStateOfTypeFunctionName},
25
- } from "./document-schema.js";
26
-
27
- export const initialGlobalState: ${globalStateName} = ${initialGlobalState};
28
- export const initialLocalState: ${localStateName} = ${initialLocalState};
29
-
30
- export const utils: DocumentModelUtils<${phStateName}> = {
31
- fileExtension: "${fileExtension}",
32
- createState(state) {
33
- return { ...defaultBaseState(), global: { ...initialGlobalState, ...state?.global }, local: { ...initialLocalState, ...state?.local } };
34
- },
35
- createDocument(state) {
36
- const document = baseCreateDocument(
37
- utils.createState,
38
- state
39
- );
40
-
41
- document.header.documentType = ${documentTypeVariableName};
42
-
43
- // for backwards compatibility, but this is NOT a valid signed document id
44
- document.header.id = generateId();
45
-
46
- return document;
47
- },
48
- saveToFileHandle(document, input) {
49
- return baseSaveToFileHandle(document, input);
50
- },
51
- loadFromInput(input) {
52
- return baseLoadFromInput(input, reducer);
53
- },
54
- isStateOfType(state) {
55
- return ${isPhStateOfTypeFunctionName}(state);
56
- },
57
- assertIsStateOfType(state) {
58
- return ${assertIsPhStateOfTypeFunctionName}(state);
59
- },
60
- isDocumentOfType(document) {
61
- return ${isPhDocumentOfTypeFunctionName}(document);
62
- },
63
- assertIsDocumentOfType(document) {
64
- return ${assertIsPhDocumentOfTypeFunctionName}(document);
65
- },
66
- };
67
-
68
- export const createDocument = utils.createDocument;
69
- export const createState = utils.createState;
70
- export const saveToFileHandle = utils.saveToFileHandle;
71
- export const loadFromInput = utils.loadFromInput;
72
- export const isStateOfType = utils.isStateOfType;
73
- export const assertIsStateOfType = utils.assertIsStateOfType;
74
- export const isDocumentOfType = utils.isDocumentOfType;
75
- export const assertIsDocumentOfType = utils.assertIsDocumentOfType;
76
- `.raw;
77
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAGhC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC5C,eAAe,EACf,cAAc,EACd,WAAW,EACX,wBAAwB,EACxB,8BAA8B,EAC9B,oCAAoC,EACpC,2BAA2B,EAC3B,iCAAiC,EACjC,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GACU,EAAE,EAAE,CAC/B,EAAE,CAAA;;;;;;;;;;;;IAYA,eAAe;IACf,cAAc;;gBAEF,WAAW;;WAEhB,wBAAwB;;IAE/B,8BAA8B;IAC9B,oCAAoC;IACpC,2BAA2B;IAC3B,iCAAiC;;;mCAGF,eAAe,MAAM,kBAAkB;kCACxC,cAAc,MAAM,iBAAiB;;yCAE9B,WAAW;sBAC9B,aAAa;;;;;;;;;;yCAUM,wBAAwB;;;;;;;;;;;;;;iBAchD,2BAA2B;;;iBAG3B,iCAAiC;;;iBAGjC,8BAA8B;;;iBAG9B,oCAAoC;;;;;;;;;;;;CAYpD,CAAC,GAAG,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { DocumentModelVariableNames } from "../../name-builders/types.js";
2
- export declare const documentModelHooksFileTemplate: (v: DocumentModelVariableNames) => string;
3
- //# sourceMappingURL=hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE/E,eAAO,MAAM,8BAA8B,GAAI,GAAG,0BAA0B,WA+CvE,CAAC"}
@@ -1,49 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelHooksFileTemplate = (v) => ts `
3
-
4
- import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
5
- import {
6
- useDocumentsInSelectedDrive,
7
- useDocumentsInSelectedFolder,
8
- useDocumentById,
9
- useSelectedDocument,
10
- } from "@powerhousedao/reactor-browser";
11
- import type {
12
- ${v.phDocumentTypeName},
13
- ${v.actionTypeName},
14
- } from "${v.documentModelDir}";
15
- import { ${v.isPhDocumentOfTypeFunctionName} } from "./gen/document-schema.js";
16
-
17
- /** Hook to get a ${v.pascalCaseDocumentType} document by its id */
18
- export function ${v.useByIdHookName}(
19
- documentId: string | null | undefined,
20
- ):
21
- | [${v.phDocumentTypeName}, DocumentDispatch<${v.actionTypeName}>]
22
- | [undefined, undefined] {
23
- const [document, dispatch] = useDocumentById(documentId);
24
- if (!${v.isPhDocumentOfTypeFunctionName}(document)) return [undefined, undefined];
25
- return [document, dispatch];
26
- }
27
-
28
- /** Hook to get the selected ${v.pascalCaseDocumentType} document */
29
- export function ${v.useSelectedHookName}():
30
- | [${v.phDocumentTypeName}, DocumentDispatch<${v.actionTypeName}>]
31
- | [undefined, undefined] {
32
- const [document, dispatch] = useSelectedDocument();
33
- if (!${v.isPhDocumentOfTypeFunctionName}(document)) return [undefined, undefined];
34
- return [document, dispatch];
35
- }
36
-
37
- /** Hook to get all ${v.pascalCaseDocumentType} documents in the selected drive */
38
- export function ${v.useInSelectedDriveHookName}() {
39
- const documentsInSelectedDrive = useDocumentsInSelectedDrive();
40
- return documentsInSelectedDrive?.filter(${v.isPhDocumentOfTypeFunctionName});
41
- }
42
-
43
- /** Hook to get all ${v.pascalCaseDocumentType} documents in the selected folder */
44
- export function ${v.useInSelectedFolderHookName}() {
45
- const documentsInSelectedFolder = useDocumentsInSelectedFolder();
46
- return documentsInSelectedFolder?.filter(${v.isPhDocumentOfTypeFunctionName});
47
- }
48
- `.raw;
49
- //# sourceMappingURL=hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAGhC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAA6B,EAAE,EAAE,CAC9E,EAAE,CAAA;;;;;;;;;;IAUA,CAAC,CAAC,kBAAkB;IACpB,CAAC,CAAC,cAAc;UACV,CAAC,CAAC,gBAAgB;WACjB,CAAC,CAAC,8BAA8B;;oBAEvB,CAAC,CAAC,sBAAsB;kBAC1B,CAAC,CAAC,eAAe;;;OAG5B,CAAC,CAAC,kBAAkB,sBAAsB,CAAC,CAAC,cAAc;;;SAGxD,CAAC,CAAC,8BAA8B;;;;+BAIV,CAAC,CAAC,sBAAsB;kBACrC,CAAC,CAAC,mBAAmB;OAChC,CAAC,CAAC,kBAAkB,sBAAsB,CAAC,CAAC,cAAc;;;SAGxD,CAAC,CAAC,8BAA8B;;;;sBAInB,CAAC,CAAC,sBAAsB;kBAC5B,CAAC,CAAC,0BAA0B;;4CAEF,CAAC,CAAC,8BAA8B;;;sBAGtD,CAAC,CAAC,sBAAsB;kBAC5B,CAAC,CAAC,2BAA2B;;6CAEF,CAAC,CAAC,8BAA8B;;CAE5E,CAAC,GAAG,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const documentModelIndexTemplate: string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,QAMlC,CAAC"}
@@ -1,9 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelIndexTemplate = ts `
3
- export * from "./gen/index.js";
4
- export * from "./src/index.js";
5
- export * from "./hooks.js";
6
- export { actions } from "./actions.js";
7
- export { utils } from "./utils.js";
8
- `.raw;
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAA;;;;;;CAM3C,CAAC,GAAG,CAAC"}
@@ -1,8 +0,0 @@
1
- type DocumentModelModuleFileTemplateArgs = {
2
- phStateName: string;
3
- documentModelDir: string;
4
- pascalCaseDocumentType: string;
5
- };
6
- export declare function documentModelModuleFileTemplate({ phStateName, documentModelDir, pascalCaseDocumentType, }: DocumentModelModuleFileTemplateArgs): string;
7
- export {};
8
- //# sourceMappingURL=module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/module.ts"],"names":[],"mappings":"AAEA,KAAK,mCAAmC,GAAG;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AACF,wBAAgB,+BAA+B,CAAC,EAC9C,WAAW,EACX,gBAAgB,EAChB,sBAAsB,GACvB,EAAE,mCAAmC,UAuBrC"}
@@ -1,25 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export function documentModelModuleFileTemplate({ phStateName, documentModelDir, pascalCaseDocumentType, }) {
3
- const template = ts `
4
- import type { DocumentModelModule } from "document-model";
5
- import { createState } from "document-model";
6
- import { defaultBaseState } from "document-model/core";
7
- import type { ${phStateName} } from "${documentModelDir}";
8
- import {
9
- actions,
10
- documentModel,
11
- reducer,
12
- utils,
13
- } from "${documentModelDir}";
14
-
15
- /** Document model module for the Todo List document type */
16
- export const ${pascalCaseDocumentType}: DocumentModelModule<${phStateName}> = {
17
- reducer,
18
- actions,
19
- utils,
20
- documentModel: createState(defaultBaseState(), documentModel),
21
- };
22
- `;
23
- return template.raw;
24
- }
25
- //# sourceMappingURL=module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAOhC,MAAM,UAAU,+BAA+B,CAAC,EAC9C,WAAW,EACX,gBAAgB,EAChB,sBAAsB,GACc;IACpC,MAAM,QAAQ,GAAG,EAAE,CAAA;;;;kBAIH,WAAW,YAAY,gBAAgB;;;;;;YAM7C,gBAAgB;;;iBAGX,sBAAsB,yBAAyB,WAAW;;;;;;CAM1E,CAAC;IAEA,OAAO,QAAQ,CAAC,GAAG,CAAC;AACtB,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const documentModelSrcIndexFileTemplate: string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,QAEzC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelSrcIndexFileTemplate = ts `
3
- export * from "./utils.js";
4
- `.raw;
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,CAAA;;CAElD,CAAC,GAAG,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { DocumentModelVariableNames } from "../../../../name-builders/types.js";
2
- export declare const documentModelTestFileTemplate: (v: DocumentModelVariableNames) => string;
3
- //# sourceMappingURL=document-model.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/ts-morph-utils/templates/document-model/src/tests/document-model.test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAErF,eAAO,MAAM,6BAA6B,GAAI,GAAG,0BAA0B,WAuHtE,CAAC"}
@@ -1,121 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelTestFileTemplate = (v) => ts `
3
- /**
4
- * This is a scaffold file meant for customization:
5
- * - change it by adding new tests or modifying the existing ones
6
- */
7
- /**
8
- * This is a scaffold file meant for customization:
9
- * - change it by adding new tests or modifying the existing ones
10
- */
11
-
12
- import { describe, it, expect } from "vitest";
13
- import {
14
- utils,
15
- initialGlobalState,
16
- initialLocalState,
17
- ${v.documentTypeVariableName},
18
- ${v.isPhDocumentOfTypeFunctionName},
19
- ${v.assertIsPhDocumentOfTypeFunctionName},
20
- ${v.isPhStateOfTypeFunctionName},
21
- ${v.assertIsPhStateOfTypeFunctionName},
22
- } from "${v.documentModelDir}";
23
- import { ZodError } from "zod";
24
-
25
- describe("${v.pascalCaseDocumentType} Document Model", () => {
26
- it("should create a new ${v.pascalCaseDocumentType} document", () => {
27
- const document = utils.createDocument();
28
-
29
- expect(document).toBeDefined();
30
- expect(document.header.documentType).toBe(${v.documentTypeVariableName});
31
- });
32
-
33
- it("should create a new ${v.pascalCaseDocumentType} document with a valid initial state", () => {
34
- const document = utils.createDocument();
35
- expect(document.state.global).toStrictEqual(initialGlobalState);
36
- expect(document.state.local).toStrictEqual(initialLocalState);
37
- expect(${v.isPhDocumentOfTypeFunctionName}(document)).toBe(true);
38
- expect(${v.isPhStateOfTypeFunctionName}(document.state)).toBe(true);
39
- });
40
- it("should reject a document that is not a ${v.pascalCaseDocumentType} document", () => {
41
- const wrongDocumentType = utils.createDocument();
42
- wrongDocumentType.header.documentType = "the-wrong-thing-1234";
43
- try {
44
- expect(${v.assertIsPhDocumentOfTypeFunctionName}(wrongDocumentType)).toThrow();
45
- expect(${v.isPhDocumentOfTypeFunctionName}(wrongDocumentType)).toBe(false);
46
- } catch (error) {
47
- expect(error).toBeInstanceOf(ZodError);
48
- }
49
- });
50
- const wrongState = utils.createDocument();
51
- // @ts-expect-error - we are testing the error case
52
- wrongState.state.global = {
53
- ...{ notWhat: "you want" },
54
- };
55
- try {
56
- expect(${v.isPhStateOfTypeFunctionName}(wrongState.state)).toBe(false);
57
- expect(${v.assertIsPhStateOfTypeFunctionName}(wrongState.state)).toThrow();
58
- expect(${v.isPhDocumentOfTypeFunctionName}(wrongState)).toBe(false);
59
- expect(${v.assertIsPhDocumentOfTypeFunctionName}(wrongState)).toThrow();
60
- } catch (error) {
61
- expect(error).toBeInstanceOf(ZodError);
62
- }
63
-
64
- const wrongInitialState = utils.createDocument();
65
- // @ts-expect-error - we are testing the error case
66
- wrongInitialState.initialState.global = {
67
- ...{ notWhat: "you want" },
68
- };
69
- try {
70
- expect(${v.isPhStateOfTypeFunctionName}(wrongInitialState.state)).toBe(false);
71
- expect(${v.assertIsPhStateOfTypeFunctionName}(wrongInitialState.state)).toThrow();
72
- expect(${v.isPhDocumentOfTypeFunctionName}(wrongInitialState)).toBe(false);
73
- expect(${v.assertIsPhDocumentOfTypeFunctionName}(wrongInitialState)).toThrow();
74
- } catch (error) {
75
- expect(error).toBeInstanceOf(ZodError);
76
- }
77
-
78
- const missingIdInHeader = utils.createDocument();
79
- // @ts-expect-error - we are testing the error case
80
- delete missingIdInHeader.header.id;
81
- try {
82
- expect(${v.isPhDocumentOfTypeFunctionName}(missingIdInHeader)).toBe(false);
83
- expect(${v.assertIsPhDocumentOfTypeFunctionName}(missingIdInHeader)).toThrow();
84
- } catch (error) {
85
- expect(error).toBeInstanceOf(ZodError);
86
- }
87
-
88
- const missingNameInHeader = utils.createDocument();
89
- // @ts-expect-error - we are testing the error case
90
- delete missingNameInHeader.header.name;
91
- try {
92
- expect(${v.isPhDocumentOfTypeFunctionName}(missingNameInHeader)).toBe(false);
93
- expect(${v.assertIsPhDocumentOfTypeFunctionName}(missingNameInHeader)).toThrow();
94
- } catch (error) {
95
- expect(error).toBeInstanceOf(ZodError);
96
- }
97
-
98
- const missingCreatedAtUtcIsoInHeader = utils.createDocument();
99
- // @ts-expect-error - we are testing the error case
100
- delete missingCreatedAtUtcIsoInHeader.header.createdAtUtcIso;
101
- try {
102
- expect(${v.isPhDocumentOfTypeFunctionName}(missingCreatedAtUtcIsoInHeader)).toBe(false);
103
- expect(${v.assertIsPhDocumentOfTypeFunctionName}(missingCreatedAtUtcIsoInHeader)).toThrow();
104
- } catch (error) {
105
- expect(error).toBeInstanceOf(ZodError);
106
- }
107
-
108
- const missingLastModifiedAtUtcIsoInHeader = utils.createDocument();
109
- // @ts-expect-error - we are testing the error case
110
- delete missingLastModifiedAtUtcIsoInHeader.header.lastModifiedAtUtcIso;
111
- try {
112
- expect(${v.isPhDocumentOfTypeFunctionName}(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
113
- expect(
114
- ${v.assertIsPhDocumentOfTypeFunctionName}(missingLastModifiedAtUtcIsoInHeader),
115
- ).toThrow();
116
- } catch (error) {
117
- expect(error).toBeInstanceOf(ZodError);
118
- }
119
- });
120
- `.raw;
121
- //# sourceMappingURL=document-model.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document-model.test.js","sourceRoot":"","sources":["../../../../../../../src/ts-morph-utils/templates/document-model/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAGhC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAA6B,EAAE,EAAE,CAC7E,EAAE,CAAA;;;;;;;;;;;;;;;IAeA,CAAC,CAAC,wBAAwB;IAC1B,CAAC,CAAC,8BAA8B;IAChC,CAAC,CAAC,oCAAoC;IACtC,CAAC,CAAC,2BAA2B;IAC7B,CAAC,CAAC,iCAAiC;UAC7B,CAAC,CAAC,gBAAgB;;;YAGhB,CAAC,CAAC,sBAAsB;4BACR,CAAC,CAAC,sBAAsB;;;;gDAIJ,CAAC,CAAC,wBAAwB;;;4BAG9C,CAAC,CAAC,sBAAsB;;;;aAIvC,CAAC,CAAC,8BAA8B;aAChC,CAAC,CAAC,2BAA2B;;+CAEK,CAAC,CAAC,sBAAsB;;;;eAIxD,CAAC,CAAC,oCAAoC;eACtC,CAAC,CAAC,8BAA8B;;;;;;;;;;;aAWlC,CAAC,CAAC,2BAA2B;aAC7B,CAAC,CAAC,iCAAiC;aACnC,CAAC,CAAC,8BAA8B;aAChC,CAAC,CAAC,oCAAoC;;;;;;;;;;;aAWtC,CAAC,CAAC,2BAA2B;aAC7B,CAAC,CAAC,iCAAiC;aACnC,CAAC,CAAC,8BAA8B;aAChC,CAAC,CAAC,oCAAoC;;;;;;;;;aAStC,CAAC,CAAC,8BAA8B;aAChC,CAAC,CAAC,oCAAoC;;;;;;;;;aAStC,CAAC,CAAC,8BAA8B;aAChC,CAAC,CAAC,oCAAoC;;;;;;;;;aAStC,CAAC,CAAC,8BAA8B;aAChC,CAAC,CAAC,oCAAoC;;;;;;;;;aAStC,CAAC,CAAC,8BAA8B;;QAErC,CAAC,CAAC,oCAAoC;;;;;;CAM7C,CAAC,GAAG,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { AllDocumentModelVariableNames } from "../../../../name-builders/types.js";
2
- export declare const documentModelOperationsModuleTestFileTemplate: (v: AllDocumentModelVariableNames) => string;
3
- //# sourceMappingURL=module.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/ts-morph-utils/templates/document-model/src/tests/module.test.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,6BAA6B,EAC9B,MAAM,oCAAoC,CAAC;AAyD5C,eAAO,MAAM,6CAA6C,GACxD,GAAG,6BAA6B,WAsB7B,CAAC"}
@@ -1,67 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- import { camelCase, constantCase, pascalCase } from "change-case";
3
- function makeModuleOperationsTypeName(module) {
4
- const pascalCaseModuleName = pascalCase(module.name);
5
- return `${pascalCaseModuleName}Operations`;
6
- }
7
- function makeCamelCaseActionNamesForImport(actions) {
8
- return actions.map((a) => camelCase(a.name)).join(",\n");
9
- }
10
- function makeActionInputSchemasForImport(actions) {
11
- return actions.map((a) => `${pascalCase(a.name)}InputSchema`).join(",\n");
12
- }
13
- function makeTestCaseForAction(action, isPhDocumentOfTypeFunctionName) {
14
- const camelCaseActionName = camelCase(action.name);
15
- const pascalCaseActionName = pascalCase(action.name);
16
- const constantCaseActionName = constantCase(action.name);
17
- const actionInputSchemaName = `${pascalCaseActionName}InputSchema`;
18
- const scope = action.scope;
19
- return ts `
20
- it('should handle ${camelCaseActionName} operation', () => {
21
- const document = utils.createDocument();
22
- const input = generateMock(
23
- ${actionInputSchemaName}(),
24
- );
25
-
26
- const updatedDocument = reducer(
27
- document,
28
- ${camelCaseActionName}(input),
29
- );
30
-
31
- expect(${isPhDocumentOfTypeFunctionName}(updatedDocument)).toBe(true);
32
- expect(updatedDocument.operations.${scope}).toHaveLength(1);
33
- expect(updatedDocument.operations.${scope}[0].action.type).toBe(
34
- "${constantCaseActionName}",
35
- );
36
- expect(updatedDocument.operations.${scope}[0].action.input).toStrictEqual(input);
37
- expect(updatedDocument.operations.${scope}[0].index).toEqual(0);
38
- });
39
- `.raw;
40
- }
41
- function makeTestCasesForActions(actions, isPhDocumentOfTypeFunctionName) {
42
- return actions
43
- .map((action) => makeTestCaseForAction(action, isPhDocumentOfTypeFunctionName))
44
- .join("\n\n");
45
- }
46
- export const documentModelOperationsModuleTestFileTemplate = (v) => ts `
47
- /**
48
- * This is a scaffold file meant for customization:
49
- * - change it by adding new tests or modifying the existing ones
50
- */
51
-
52
- import { describe, it, expect } from 'vitest';
53
- import { generateMock } from '@powerhousedao/codegen';
54
- import {
55
- reducer,
56
- utils,
57
- ${v.isPhDocumentOfTypeFunctionName},
58
- ${makeCamelCaseActionNamesForImport(v.actions)},
59
- ${makeActionInputSchemasForImport(v.actions)},
60
- } from "${v.documentModelDir}";
61
-
62
- describe("${makeModuleOperationsTypeName(v.module)}", () => {
63
- ${makeTestCasesForActions(v.actions, v.isPhDocumentOfTypeFunctionName)}
64
- });
65
-
66
- `.raw;
67
- //# sourceMappingURL=module.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.test.js","sourceRoot":"","sources":["../../../../../../../src/ts-morph-utils/templates/document-model/src/tests/module.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOlE,SAAS,4BAA4B,CAAC,MAA2B;IAC/D,MAAM,oBAAoB,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,GAAG,oBAAoB,YAAY,CAAC;AAC7C,CAAC;AAED,SAAS,iCAAiC,CAAC,OAA8B;IACvE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,+BAA+B,CAAC,OAA8B;IACrE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,qBAAqB,CAC5B,MAA2B,EAC3B,8BAAsC;IAEtC,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,oBAAoB,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,sBAAsB,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,qBAAqB,GAAG,GAAG,oBAAoB,aAAa,CAAC;IACnE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO,EAAE,CAAA;sBACW,mBAAmB;;;cAG3B,qBAAqB;;;;;cAKrB,mBAAmB;;;iBAGhB,8BAA8B;4CACH,KAAK;4CACL,KAAK;eAClC,sBAAsB;;4CAEO,KAAK;4CACL,KAAK;;GAE9C,CAAC,GAAG,CAAC;AACR,CAAC;AAED,SAAS,uBAAuB,CAC9B,OAA8B,EAC9B,8BAAsC;IAEtC,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,qBAAqB,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAC9D;SACA,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AACD,MAAM,CAAC,MAAM,6CAA6C,GAAG,CAC3D,CAAgC,EAChC,EAAE,CACF,EAAE,CAAA;;;;;;;;;;;IAWA,CAAC,CAAC,8BAA8B;IAChC,iCAAiC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5C,+BAA+B,CAAC,CAAC,CAAC,OAAO,CAAC;UACpC,CAAC,CAAC,gBAAgB;;YAEhB,4BAA4B,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9C,uBAAuB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,8BAA8B,CAAC;;;CAGvE,CAAC,GAAG,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const documentModelSrcUtilsTemplate: string;
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,QAErC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelSrcUtilsTemplate = ts `
3
- export {};
4
- `.raw;
5
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/ts-morph-utils/templates/document-model/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAA;;CAE9C,CAAC,GAAG,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { DocumentModelVariableNames } from "../../name-builders/types.js";
2
- export declare const documentModelUtilsTemplate: ({ phStateName, pascalCaseDocumentType, }: DocumentModelVariableNames) => string;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE/E,eAAO,MAAM,0BAA0B,GAAI,0CAGxC,0BAA0B,WASxB,CAAC"}
@@ -1,11 +0,0 @@
1
- import { ts } from "@tmpl/core";
2
- export const documentModelUtilsTemplate = ({ phStateName, pascalCaseDocumentType, }) => ts `
3
- import type { DocumentModelUtils } from "document-model";
4
- import type { ${phStateName} } from "./gen/types.js";
5
- import { utils as genUtils } from "./gen/utils.js";
6
- import * as customUtils from "./src/utils.js";
7
-
8
- /** Utils for the ${pascalCaseDocumentType} document model */
9
- export const utils = { ...genUtils, ...customUtils } satisfies DocumentModelUtils<${phStateName}>;
10
- `.raw;
11
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/ts-morph-utils/templates/document-model/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAGhC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,WAAW,EACX,sBAAsB,GACK,EAAE,EAAE,CAC/B,EAAE,CAAA;;gBAEY,WAAW;;;;oBAIP,sBAAsB;oFAC0C,WAAW;CAC9F,CAAC,GAAG,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare const driveExplorerFileTemplate: string;
2
- export declare const folderTreeFileTemplate: string;
3
- export declare const emptyStateFileTemplate: string;
4
- export declare const createDocumentFileTemplate: string;
5
- //# sourceMappingURL=drive-editor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drive-editor.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-utils/templates/drive-editor.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,QA6BjC,CAAC;AAEN,eAAO,MAAM,sBAAsB,QAyG9B,CAAC;AAEN,eAAO,MAAM,sBAAsB,QAgB9B,CAAC;AAEN,eAAO,MAAM,0BAA0B,QAuDlC,CAAC"}