@powerhousedao/codegen 5.0.3 → 5.0.4

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 (180) hide show
  1. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/actions.esm.t +3 -3
  2. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +3 -2
  3. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/customUtils.esm.t +1 -1
  4. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-models.esm.t +14 -0
  5. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-schema.esm.t +56 -0
  6. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-type.esm.t +6 -0
  7. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +1 -1
  8. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +110 -15
  9. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/hooks.esm.t +49 -0
  10. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +12 -4
  11. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +66 -7
  12. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.esm.t +4 -2
  13. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/module.esm.t +22 -0
  14. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +23 -23
  15. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +16 -9
  16. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/root-utils.esm.t +11 -0
  17. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootActions.esm.t +13 -0
  18. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +6 -26
  19. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +2 -2
  20. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/src-index.esm.t +5 -0
  21. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +16 -16
  22. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +31 -10
  23. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +10 -5
  24. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +13 -18
  25. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +15 -0
  26. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +99 -4
  27. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +21 -10
  28. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +4 -3
  29. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +26 -29
  30. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveContents.esm.t +23 -0
  31. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +5 -126
  32. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EmptyState.esm.t +19 -0
  33. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Files.esm.t +29 -0
  34. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +1 -1
  35. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Folders.esm.t +28 -0
  36. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/NavigationBreadcrumbs.esm.t +14 -0
  37. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +2 -1
  38. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +5 -2
  39. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editors.esm.t +14 -0
  40. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +26 -3
  41. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/lib.esm.t +4 -2
  42. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/module.esm.t +15 -0
  43. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/edit-name.esm.t +78 -0
  44. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +7 -104
  45. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editors.esm.t +14 -0
  46. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +74 -1
  47. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/lib.esm.t +4 -2
  48. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/module.esm.t +16 -0
  49. package/dist/src/codegen/.hygen/templates/powerhouse/utils.js +46 -0
  50. package/dist/src/codegen/__tests__/config.d.ts +2 -0
  51. package/dist/src/codegen/__tests__/config.d.ts.map +1 -0
  52. package/dist/src/codegen/__tests__/config.js +2 -0
  53. package/dist/src/codegen/__tests__/config.js.map +1 -0
  54. package/dist/src/codegen/__tests__/constants.d.ts +16 -0
  55. package/dist/src/codegen/__tests__/constants.d.ts.map +1 -0
  56. package/dist/src/codegen/__tests__/constants.js +16 -0
  57. package/dist/src/codegen/__tests__/constants.js.map +1 -0
  58. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts +2 -0
  59. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts.map +1 -0
  60. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js +9 -0
  61. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js.map +1 -0
  62. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts +3 -0
  63. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts.map +1 -0
  64. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js +33 -0
  65. package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js.map +1 -0
  66. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts +2 -0
  67. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts.map +1 -0
  68. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js +23 -0
  69. package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js.map +1 -0
  70. package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts +2 -0
  71. package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts.map +1 -0
  72. package/dist/src/codegen/__tests__/fixtures/typecheck.js +23 -0
  73. package/dist/src/codegen/__tests__/fixtures/typecheck.js.map +1 -0
  74. package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts +2 -0
  75. package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts.map +1 -0
  76. package/dist/src/codegen/__tests__/generate-doc-model.test.js +206 -0
  77. package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -0
  78. package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts +2 -0
  79. package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts.map +1 -0
  80. package/dist/src/codegen/__tests__/generate-drive-editor.test.js +153 -0
  81. package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -0
  82. package/dist/src/codegen/__tests__/generate-editor.test.d.ts +2 -0
  83. package/dist/src/codegen/__tests__/generate-editor.test.d.ts.map +1 -0
  84. package/dist/src/codegen/__tests__/generate-editor.test.js +112 -0
  85. package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -0
  86. package/dist/src/codegen/__tests__/generate-manifest.test.d.ts +2 -0
  87. package/dist/src/codegen/__tests__/generate-manifest.test.d.ts.map +1 -0
  88. package/dist/src/codegen/__tests__/generate-manifest.test.js +192 -0
  89. package/dist/src/codegen/__tests__/generate-manifest.test.js.map +1 -0
  90. package/dist/src/codegen/__tests__/generate-schemas.test.d.ts +2 -0
  91. package/dist/src/codegen/__tests__/generate-schemas.test.d.ts.map +1 -0
  92. package/dist/src/codegen/__tests__/generate-schemas.test.js +143 -0
  93. package/dist/src/codegen/__tests__/generate-schemas.test.js.map +1 -0
  94. package/dist/src/codegen/__tests__/global-setup.d.ts +2 -0
  95. package/dist/src/codegen/__tests__/global-setup.d.ts.map +1 -0
  96. package/dist/src/codegen/__tests__/global-setup.js +21 -0
  97. package/dist/src/codegen/__tests__/global-setup.js.map +1 -0
  98. package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts +2 -0
  99. package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts.map +1 -0
  100. package/dist/src/codegen/__tests__/ts-morph-generator.test.js +72 -0
  101. package/dist/src/codegen/__tests__/ts-morph-generator.test.js.map +1 -0
  102. package/dist/src/codegen/__tests__/utils.d.ts +7 -0
  103. package/dist/src/codegen/__tests__/utils.d.ts.map +1 -0
  104. package/dist/src/codegen/__tests__/utils.js +52 -0
  105. package/dist/src/codegen/__tests__/utils.js.map +1 -0
  106. package/dist/src/codegen/generate.d.ts +12 -2
  107. package/dist/src/codegen/generate.d.ts.map +1 -1
  108. package/dist/src/codegen/generate.js +26 -11
  109. package/dist/src/codegen/generate.js.map +1 -1
  110. package/dist/src/codegen/graphql.js +1 -1
  111. package/dist/src/codegen/graphql.js.map +1 -1
  112. package/dist/src/codegen/hygen.d.ts +19 -10
  113. package/dist/src/codegen/hygen.d.ts.map +1 -1
  114. package/dist/src/codegen/hygen.js +62 -16
  115. package/dist/src/codegen/hygen.js.map +1 -1
  116. package/dist/src/create-lib/checkout-project.d.ts +13 -0
  117. package/dist/src/create-lib/checkout-project.d.ts.map +1 -0
  118. package/dist/src/create-lib/checkout-project.js +47 -0
  119. package/dist/src/create-lib/checkout-project.js.map +1 -0
  120. package/dist/src/create-lib/create-project.d.ts +9 -5
  121. package/dist/src/create-lib/create-project.d.ts.map +1 -1
  122. package/dist/src/create-lib/create-project.js +37 -45
  123. package/dist/src/create-lib/create-project.js.map +1 -1
  124. package/dist/src/create-lib/feature-flags.d.ts +4 -0
  125. package/dist/src/create-lib/feature-flags.d.ts.map +1 -0
  126. package/dist/src/create-lib/feature-flags.js +4 -0
  127. package/dist/src/create-lib/feature-flags.js.map +1 -0
  128. package/dist/src/create-lib/index.d.ts +1 -0
  129. package/dist/src/create-lib/index.d.ts.map +1 -1
  130. package/dist/src/create-lib/index.js +1 -0
  131. package/dist/src/create-lib/index.js.map +1 -1
  132. package/dist/src/create-lib/utils.d.ts +7 -0
  133. package/dist/src/create-lib/utils.d.ts.map +1 -0
  134. package/dist/src/create-lib/utils.js +28 -0
  135. package/dist/src/create-lib/utils.js.map +1 -0
  136. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts +2 -0
  137. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts.map +1 -0
  138. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +491 -0
  139. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js.map +1 -0
  140. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +3 -1
  141. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +1 -1
  142. package/dist/src/ts-morph-generator/core/FileGenerator.js +3 -1
  143. package/dist/src/ts-morph-generator/core/FileGenerator.js.map +1 -1
  144. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +1 -0
  145. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
  146. package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts.map +1 -1
  147. package/dist/src/ts-morph-generator/core/ReducerGenerator.js +14 -7
  148. package/dist/src/ts-morph-generator/core/ReducerGenerator.js.map +1 -1
  149. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +2 -1
  150. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
  151. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js +10 -3
  152. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js.map +1 -1
  153. package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts +5 -0
  154. package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts.map +1 -0
  155. package/dist/src/ts-morph-generator/utilities/DeclarationManager.js +10 -0
  156. package/dist/src/ts-morph-generator/utilities/DeclarationManager.js.map +1 -0
  157. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +1 -0
  158. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +1 -1
  159. package/dist/src/ts-morph-generator/utilities/ImportManager.js +13 -3
  160. package/dist/src/ts-morph-generator/utilities/ImportManager.js.map +1 -1
  161. package/dist/src/ts-morph-generator/utilities/index.d.ts +1 -0
  162. package/dist/src/ts-morph-generator/utilities/index.d.ts.map +1 -1
  163. package/dist/src/ts-morph-generator/utilities/index.js +1 -0
  164. package/dist/src/ts-morph-generator/utilities/index.js.map +1 -1
  165. package/dist/src/utils/validation.d.ts.map +1 -1
  166. package/dist/src/utils/validation.js +3 -4
  167. package/dist/src/utils/validation.js.map +1 -1
  168. package/dist/tsconfig.tsbuildinfo +1 -0
  169. package/dist/vitest.config.d.ts +3 -0
  170. package/dist/vitest.config.d.ts.map +1 -0
  171. package/dist/vitest.config.js +16 -0
  172. package/dist/vitest.config.js.map +1 -0
  173. package/package.json +13 -12
  174. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.inject_export.esm.t +0 -7
  175. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.esm.t +0 -15
  176. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/lib.inject_export.esm.t +0 -7
  177. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/hooks.esm.t +0 -16
  178. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +0 -15
  179. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/lib.inject_export.esm.t +0 -7
  180. package/dist/tsconfig.lib.tsbuildinfo +0 -1
@@ -1,13 +1,13 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/actions.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/actions.ts"
3
3
  force: true
4
4
  ---
5
5
  <% modules.forEach(module => { _%>
6
- import type { <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module.name) %>Action } from './<%= module.name %>/actions.js';
6
+ import type { <%= h.changeCase.pascal(documentType) %><%= h.changeCase.pascal(module.name) %>Action } from './<%= h.changeCase.param(module.name) %>/actions.js';
7
7
  <% }); _%>
8
8
 
9
9
  <% modules.forEach(module => { _%>
10
- export * from './<%= module.name %>/actions.js';
10
+ export * from './<%= h.changeCase.param(module.name) %>/actions.js';
11
11
  <% }); _%>
12
12
 
13
13
  export <%= 'type ' + h.changeCase.pascal(documentType) %>Action =
@@ -1,8 +1,9 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/creators.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/creators.ts"
3
3
  force: true
4
4
  ---
5
5
 
6
6
  <% modules.forEach(module => { _%>
7
- export * from './<%= module.name %>/creators.js';
7
+ export * from "./<%= h.changeCase.param(module.name) %>/creators.js";
8
+ export * as <%= h.changeCase.camel(module.name) %>Actions from "./<%= h.changeCase.param(module.name) %>/creators.js";
8
9
  <% }); _%>
@@ -1,5 +1,5 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/src/utils.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/src/utils.ts"
3
3
  unless_exists: true
4
4
  ---
5
5
  export {};
@@ -0,0 +1,14 @@
1
+ ---
2
+ force: true
3
+ to: "<%= rootDir %>/document-models.ts"
4
+ ---
5
+ import type { DocumentModelModule } from "document-model";
6
+ <% moduleExports.forEach(me => { _%>
7
+ import { <%= me.pascalCaseName %> } from "./<%= me.paramCaseName %>/module.js";
8
+ <% }); _%>
9
+
10
+ export const documentModels: DocumentModelModule<any>[] = [
11
+ <% moduleExports.forEach(me => { _%>
12
+ <%= me.pascalCaseName %>,
13
+ <% }); _%>
14
+ ]
@@ -0,0 +1,56 @@
1
+ ---
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/document-schema.ts"
3
+ force: true
4
+ ---
5
+ import {
6
+ BaseDocumentHeaderSchema,
7
+ BaseDocumentStateSchema,
8
+ } from "document-model";
9
+ import { z } from "zod";
10
+ import { <%= documentTypeVariableName %> } from "./document-type.js";
11
+ import { <%= stateSchemaName %> } from "./schema/zod.js";
12
+ import type { <%= phDocumentTypeName %>, <%= phStateName %> } from "./types.js";
13
+
14
+ /** Schema for validating the header object of a <%= pascalCaseDocumentType %> document */
15
+ export const <%= phDocumentTypeName %>HeaderSchema = BaseDocumentHeaderSchema.extend({
16
+ documentType: z.literal(<%= documentTypeVariableName %>),
17
+ });
18
+
19
+ /** Schema for validating the state object of a <%= pascalCaseDocumentType %> document */
20
+ export const <%= phStateName %>Schema = BaseDocumentStateSchema.extend({
21
+ global: <%= stateSchemaName %>(),
22
+ });
23
+
24
+ export const <%= phDocumentSchemaName %> = z.object({
25
+ header: <%= phDocumentTypeName %>HeaderSchema,
26
+ state: <%= phStateName %>Schema,
27
+ initialState: <%= phStateName %>Schema,
28
+ });
29
+
30
+ /** Simple helper function to check if a state object is a <%= pascalCaseDocumentType %> document state object */
31
+ export function <%= isPhStateOfTypeFunctionName %>(
32
+ state: unknown,
33
+ ): state is <%= phStateName %> {
34
+ return <%= phStateName %>Schema.safeParse(state).success;
35
+ }
36
+
37
+ /** Simple helper function to assert that a document state object is a <%= pascalCaseDocumentType %> document state object */
38
+ export function <%= assertIsPhStateOfTypeFunctionName %>(
39
+ state: unknown,
40
+ ): asserts state is <%= phStateName %> {
41
+ <%= phStateName %>Schema.parse(state);
42
+ }
43
+
44
+ /** Simple helper function to check if a document is a <%= pascalCaseDocumentType %> document */
45
+ export function <%= isPhDocumentOfTypeFunctionName %>(
46
+ document: unknown,
47
+ ): document is <%= phDocumentTypeName %> {
48
+ return <%= phDocumentSchemaName %>.safeParse(document).success;
49
+ }
50
+
51
+ /** Simple helper function to assert that a document is a <%= pascalCaseDocumentType %> document */
52
+ export function <%= assertIsPhDocumentOfTypeFunctionName %>(
53
+ document: unknown,
54
+ ): asserts document is <%= phDocumentTypeName %> {
55
+ <%= phDocumentSchemaName %>.parse(document);
56
+ }
@@ -0,0 +1,6 @@
1
+ ---
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/document-type.ts"
3
+ force: true
4
+ ---
5
+
6
+ export const <%= documentTypeVariableName %> = "<%= documentTypeId %>";
@@ -1,5 +1,5 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/document-model.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/document-model.ts"
3
3
  force: true
4
4
  ---
5
5
  import type { DocumentModelGlobalState } from "document-model";
@@ -1,26 +1,121 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/src/tests/document-model.test.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/src/tests/document-model.test.ts"
3
3
  unless_exists: true
4
4
  ---
5
5
  /**
6
6
  * This is a scaffold file meant for customization:
7
7
  * - change it by adding new tests or modifying the existing ones
8
8
  */
9
+ /**
10
+ * This is a scaffold file meant for customization:
11
+ * - change it by adding new tests or modifying the existing ones
12
+ */
13
+
14
+ import { describe, it, expect } from "vitest";
15
+ import {
16
+ utils,
17
+ initialGlobalState,
18
+ initialLocalState,
19
+ <%= documentTypeVariableName %>,
20
+ <%= isPhDocumentOfTypeFunctionName %>,
21
+ <%= assertIsPhDocumentOfTypeFunctionName %>,
22
+ <%= isPhStateOfTypeFunctionName %>,
23
+ <%= assertIsPhStateOfTypeFunctionName %>,
24
+ } from "<%= documentModelDir %>";
25
+ import { ZodError } from "zod";
26
+
27
+ describe("<%= pascalCaseDocumentType %> Document Model", () => {
28
+ it("should create a new <%= pascalCaseDocumentType %> document", () => {
29
+ const document = utils.createDocument();
30
+
31
+ expect(document).toBeDefined();
32
+ expect(document.header.documentType).toBe(<%= documentTypeVariableName %>);
33
+ });
34
+
35
+ it("should create a new <%= pascalCaseDocumentType %> document with a valid initial state", () => {
36
+ const document = utils.createDocument();
37
+ expect(document.state.global).toStrictEqual(initialGlobalState);
38
+ expect(document.state.local).toStrictEqual(initialLocalState);
39
+ expect(<%= isPhDocumentOfTypeFunctionName %>(document)).toBe(true);
40
+ expect(<%= isPhStateOfTypeFunctionName %>(document.state)).toBe(true);
41
+ });
42
+ it("should reject a document that is not a <%= pascalCaseDocumentType %> document", () => {
43
+ const wrongDocumentType = utils.createDocument();
44
+ wrongDocumentType.header.documentType = "the-wrong-thing-1234";
45
+ try {
46
+ expect(<%= assertIsPhDocumentOfTypeFunctionName %>(wrongDocumentType)).toThrow();
47
+ expect(<%= isPhDocumentOfTypeFunctionName %>(wrongDocumentType)).toBe(false);
48
+ } catch (error) {
49
+ expect(error).toBeInstanceOf(ZodError);
50
+ }
51
+ });
52
+ const wrongState = utils.createDocument();
53
+ // @ts-expect-error - we are testing the error case
54
+ wrongState.state.global = {
55
+ ...{ notWhat: "you want" },
56
+ };
57
+ try {
58
+ expect(<%= isPhStateOfTypeFunctionName %>(wrongState.state)).toBe(false);
59
+ expect(<%= assertIsPhStateOfTypeFunctionName %>(wrongState.state)).toThrow();
60
+ expect(<%= isPhDocumentOfTypeFunctionName %>(wrongState)).toBe(false);
61
+ expect(<%= assertIsPhDocumentOfTypeFunctionName %>(wrongState)).toThrow();
62
+ } catch (error) {
63
+ expect(error).toBeInstanceOf(ZodError);
64
+ }
65
+
66
+ const wrongInitialState = utils.createDocument();
67
+ // @ts-expect-error - we are testing the error case
68
+ wrongInitialState.initialState.global = {
69
+ ...{ notWhat: "you want" },
70
+ };
71
+ try {
72
+ expect(<%= isPhStateOfTypeFunctionName %>(wrongInitialState.state)).toBe(false);
73
+ expect(<%= assertIsPhStateOfTypeFunctionName %>(wrongInitialState.state)).toThrow();
74
+ expect(<%= isPhDocumentOfTypeFunctionName %>(wrongInitialState)).toBe(false);
75
+ expect(<%= assertIsPhDocumentOfTypeFunctionName %>(wrongInitialState)).toThrow();
76
+ } catch (error) {
77
+ expect(error).toBeInstanceOf(ZodError);
78
+ }
9
79
 
10
- import { describe, it, expect, beforeEach } from 'vitest';
11
- import utils, { initialGlobalState, initialLocalState } from '../../gen/utils.js';
80
+ const missingIdInHeader = utils.createDocument();
81
+ // @ts-expect-error - we are testing the error case
82
+ delete missingIdInHeader.header.id;
83
+ try {
84
+ expect(<%= isPhDocumentOfTypeFunctionName %>(missingIdInHeader)).toBe(false);
85
+ expect(<%= assertIsPhDocumentOfTypeFunctionName %>(missingIdInHeader)).toThrow();
86
+ } catch (error) {
87
+ expect(error).toBeInstanceOf(ZodError);
88
+ }
12
89
 
13
- describe('<%= h.changeCase.title(documentType) %> Document Model', () => {
14
- it('should create a new <%= h.changeCase.title(documentType) %> document', () => {
15
- const document = utils.createDocument();
90
+ const missingNameInHeader = utils.createDocument();
91
+ // @ts-expect-error - we are testing the error case
92
+ delete missingNameInHeader.header.name;
93
+ try {
94
+ expect(<%= isPhDocumentOfTypeFunctionName %>(missingNameInHeader)).toBe(false);
95
+ expect(<%= assertIsPhDocumentOfTypeFunctionName %>(missingNameInHeader)).toThrow();
96
+ } catch (error) {
97
+ expect(error).toBeInstanceOf(ZodError);
98
+ }
16
99
 
17
- expect(document).toBeDefined();
18
- expect(document.header.documentType).toBe('<%- documentTypeId %>');
19
- });
100
+ const missingCreatedAtUtcIsoInHeader = utils.createDocument();
101
+ // @ts-expect-error - we are testing the error case
102
+ delete missingCreatedAtUtcIsoInHeader.header.createdAtUtcIso;
103
+ try {
104
+ expect(<%= isPhDocumentOfTypeFunctionName %>(missingCreatedAtUtcIsoInHeader)).toBe(false);
105
+ expect(<%= assertIsPhDocumentOfTypeFunctionName %>(missingCreatedAtUtcIsoInHeader)).toThrow();
106
+ } catch (error) {
107
+ expect(error).toBeInstanceOf(ZodError);
108
+ }
20
109
 
21
- it('should create a new <%= h.changeCase.title(documentType) %> document with a valid initial state', () => {
22
- const document = utils.createDocument();
23
- expect(document.state.global).toStrictEqual(initialGlobalState);
24
- expect(document.state.local).toStrictEqual(initialLocalState);
25
- });
26
- });
110
+ const missingLastModifiedAtUtcIsoInHeader = utils.createDocument();
111
+ // @ts-expect-error - we are testing the error case
112
+ delete missingLastModifiedAtUtcIsoInHeader.header.lastModifiedAtUtcIso;
113
+ try {
114
+ expect(<%= isPhDocumentOfTypeFunctionName %>(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
115
+ expect(
116
+ <%= assertIsPhDocumentOfTypeFunctionName %>(missingLastModifiedAtUtcIsoInHeader),
117
+ ).toThrow();
118
+ } catch (error) {
119
+ expect(error).toBeInstanceOf(ZodError);
120
+ }
121
+ });
@@ -0,0 +1,49 @@
1
+ ---
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/hooks.ts"
3
+ force: true
4
+ ---
5
+
6
+ import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
7
+ import {
8
+ useDocumentsInSelectedDrive,
9
+ useDocumentsInSelectedFolder,
10
+ useDocumentById,
11
+ useSelectedDocument,
12
+ } from "@powerhousedao/reactor-browser";
13
+ import type {
14
+ <%= phDocumentTypeName %>,
15
+ <%= actionTypeName %>,
16
+ } from "<%= documentModelDir %>";
17
+ import { <%= isPhDocumentOfTypeFunctionName %> } from "./gen/document-schema.js";
18
+
19
+ /** Hook to get a <%= pascalCaseDocumentType %> document by its id */
20
+ export function <%= useByIdHookName %>(
21
+ documentId: string | null | undefined,
22
+ ):
23
+ | [<%= phDocumentTypeName %>, DocumentDispatch<<%= actionTypeName %>>]
24
+ | [undefined, undefined] {
25
+ const [document, dispatch] = useDocumentById(documentId);
26
+ if (!<%= isPhDocumentOfTypeFunctionName %>(document)) return [undefined, undefined];
27
+ return [document, dispatch];
28
+ }
29
+
30
+ /** Hook to get the selected <%= pascalCaseDocumentType %> document */
31
+ export function <%= useSelectedHookName %>():
32
+ | [<%= phDocumentTypeName %>, DocumentDispatch<<%= actionTypeName %>>]
33
+ | [undefined, undefined] {
34
+ const [document, dispatch] = useSelectedDocument();
35
+ if (!<%= isPhDocumentOfTypeFunctionName %>(document)) return [undefined, undefined];
36
+ return [document, dispatch];
37
+ }
38
+
39
+ /** Hook to get all <%= pascalCaseDocumentType %> documents in the selected drive */
40
+ export function <%= useInSelectedDriveHookName %>() {
41
+ const documentsInSelectedDrive = useDocumentsInSelectedDrive();
42
+ return documentsInSelectedDrive?.filter(<%= isPhDocumentOfTypeFunctionName %>);
43
+ }
44
+
45
+ /** Hook to get all <%= pascalCaseDocumentType %> documents in the selected folder */
46
+ export function <%= useInSelectedFolderHookName %>() {
47
+ const documentsInSelectedFolder = useDocumentsInSelectedFolder();
48
+ return documentsInSelectedFolder?.filter(<%= isPhDocumentOfTypeFunctionName %>);
49
+ }
@@ -1,15 +1,23 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/index.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/index.ts"
3
3
  force: true
4
4
  ---
5
5
  export * from './actions.js';
6
6
  export * from './document-model.js';
7
7
  export * from './types.js';
8
- export * as actions from './creators.js';
8
+ export * from './creators.js';
9
9
  export {
10
- create<%= h.changeCase.pascal(documentType) %>Document,
10
+ create<%= phDocumentTypeName %>,
11
11
  createState,
12
12
  defaultPHState,
13
13
  defaultGlobalState,
14
14
  defaultLocalState,
15
- } from './ph-factories.js';
15
+ } from './ph-factories.js';
16
+ export * from "./utils.js";
17
+ export * from "./reducer.js";
18
+ export * from "./schema/index.js";
19
+ export * from "./document-type.js";
20
+ export * from "./document-schema.js";
21
+ <% modules.forEach(module => { _%>
22
+ export * from './<%= h.changeCase.param(module.name) %>/operations.js';
23
+ <% }); _%>
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
- const { paramCase } = require("change-case");
3
-
2
+ const { paramCase, pascalCase, camelCase } = require("change-case");
3
+ const { getModuleExports } = require("../utils.js");
4
4
  function documentModelToString(documentModel) {
5
5
  return JSON.stringify(
6
6
  {
@@ -31,18 +31,77 @@ module.exports = {
31
31
  const documentModel = JSON.parse(args.documentModel);
32
32
  const latestSpec =
33
33
  documentModel.specifications[documentModel.specifications.length - 1];
34
-
34
+ const documentType = documentModel.name;
35
+ const documentTypeId = documentModel.id;
36
+ const rootDir = args.rootDir;
37
+ const paramCaseDocumentType = paramCase(documentType);
38
+ const pascalCaseDocumentType = pascalCase(documentType);
39
+ const camelCaseDocumentType = camelCase(documentType);
40
+ const documentTypeVariableName = `${camelCaseDocumentType}DocumentType`;
41
+ const stateName = `${pascalCaseDocumentType}State`;
42
+ const globalStateName = `${pascalCaseDocumentType}GlobalState`;
43
+ const localStateName = `${pascalCaseDocumentType}LocalState`;
44
+ const phStateName = `${pascalCaseDocumentType}PHState`;
45
+ const phDocumentTypeName = `${pascalCaseDocumentType}Document`;
46
+ const actionTypeName = `${pascalCaseDocumentType}Action`;
47
+ const actionsTypeName = `${actionTypeName}s`;
48
+ const actionsName = camelCase(actionsTypeName);
49
+ const packageName = args.packageName;
50
+ const documentModelDir = `${packageName}/document-models/${paramCaseDocumentType}`;
51
+ const stateSchemaName = `${stateName}Schema`;
52
+ const phDocumentSchemaName = `${phDocumentTypeName}Schema`;
53
+ const isPhStateOfTypeFunctionName = `is${stateName}`;
54
+ const assertIsPhStateOfTypeFunctionName = `assertIs${stateName}`;
55
+ const isPhDocumentOfTypeFunctionName = `is${phDocumentTypeName}`;
56
+ const assertIsPhDocumentOfTypeFunctionName = `assertIs${phDocumentTypeName}`;
57
+ const useByIdHookName = `use${phDocumentTypeName}ById`;
58
+ const useSelectedHookName = `useSelected${phDocumentTypeName}`;
59
+ const useInSelectedDriveHookName = `use${phDocumentTypeName}sInSelectedDrive`;
60
+ const useInSelectedFolderHookName = `use${phDocumentTypeName}sInSelectedFolder`;
61
+ const moduleExports = getModuleExports(
62
+ rootDir,
63
+ /export\s+const\s+(\w+)\s*:\s*DocumentModelModule\s*<[^>]*>\s*=/,
64
+ {
65
+ paramCaseName: paramCaseDocumentType,
66
+ pascalCaseName: pascalCaseDocumentType,
67
+ },
68
+ );
35
69
  return {
36
- rootDir: args.rootDir,
70
+ rootDir,
71
+ packageName,
72
+ useByIdHookName,
73
+ useSelectedHookName,
74
+ useInSelectedDriveHookName,
75
+ useInSelectedFolderHookName,
37
76
  documentModel: documentModelToString(documentModel),
38
- documentTypeId: documentModel.id,
39
- documentType: documentModel.name,
77
+ documentTypeVariableName,
78
+ documentTypeId,
79
+ documentType,
80
+ camelCaseDocumentType,
81
+ paramCaseDocumentType,
82
+ pascalCaseDocumentType,
83
+ stateName,
84
+ globalStateName,
85
+ localStateName,
86
+ phDocumentTypeName,
87
+ phStateName,
88
+ actionTypeName,
89
+ actionsTypeName,
90
+ actionsName,
91
+ stateSchemaName,
92
+ phDocumentSchemaName,
93
+ isPhDocumentOfTypeFunctionName,
94
+ assertIsPhDocumentOfTypeFunctionName,
95
+ isPhStateOfTypeFunctionName,
96
+ assertIsPhStateOfTypeFunctionName,
97
+ documentModelDir,
40
98
  extension: documentModel.extension,
41
99
  modules: latestSpec.modules.map((m) => ({
42
100
  ...m,
43
101
  name: paramCase(m.name),
44
102
  })),
45
- fileExtension: documentModel.extension,
103
+ moduleExports,
104
+ fileExtension: documentModel.extension || "",
46
105
  hasLocalSchema: latestSpec.state.local.schema !== "",
47
106
  ...getInitialStates(latestSpec.state),
48
107
  };
@@ -1,9 +1,11 @@
1
1
  ---
2
2
  to: "<%= rootDir %>/index.ts"
3
- unless_exists: true
3
+ force: true
4
4
  ---
5
5
  /**
6
6
  * This is a scaffold file meant for customization.
7
7
  * Delete the file and run the code generator again to have it reset
8
8
  */
9
-
9
+ <% moduleExports.forEach(me => { _%>
10
+ export { <%= me.pascalCaseName %> } from "./<%= me.paramCaseName %>/module.js";
11
+ <% }); _%>
@@ -0,0 +1,22 @@
1
+ ---
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/module.ts"
3
+ force: true
4
+ ---
5
+ import type { DocumentModelModule } from "document-model";
6
+ import { createState } from "document-model";
7
+ import { defaultBaseState } from "document-model/core";
8
+ import type { <%= phStateName %> } from "<%= documentModelDir %>";
9
+ import {
10
+ actions,
11
+ documentModel,
12
+ reducer,
13
+ utils,
14
+ } from "<%= documentModelDir %>";
15
+
16
+ /** Document model module for the Todo List document type */
17
+ export const <%= pascalCaseDocumentType %>: DocumentModelModule<<%= phStateName %>> = {
18
+ reducer,
19
+ actions,
20
+ utils,
21
+ documentModel: createState(defaultBaseState(), documentModel),
22
+ };
@@ -1,9 +1,9 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/ph-factories.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/ph-factories.ts"
3
3
  force: true
4
4
  ---
5
5
  /**
6
- * Factory methods for creating <%= h.changeCase.pascal(documentType) %>Document instances
6
+ * Factory methods for creating <%= phDocumentTypeName %> instances
7
7
  */
8
8
  import type {
9
9
  PHAuthState,
@@ -15,22 +15,22 @@ import {
15
15
  defaultBaseState,
16
16
  } from "document-model/core";
17
17
  import type {
18
- <%= h.changeCase.pascal(documentType) %>Document,
19
- <%= h.changeCase.pascal(documentType) %>LocalState,
20
- <%= h.changeCase.pascal(documentType) %>GlobalState,
21
- <%= h.changeCase.pascal(documentType) %>PHState,
18
+ <%= phDocumentTypeName %>,
19
+ <%= localStateName %>,
20
+ <%= globalStateName %>,
21
+ <%= phStateName %>,
22
22
  } from "./types.js";
23
23
  import { createDocument } from "./utils.js";
24
24
 
25
- export function defaultGlobalState(): <%= h.changeCase.pascal(documentType) %>GlobalState {
25
+ export function defaultGlobalState(): <%= globalStateName %> {
26
26
  return <%- initialGlobalState %>;
27
27
  }
28
28
 
29
- export function defaultLocalState(): <%= h.changeCase.pascal(documentType) %>LocalState {
29
+ export function defaultLocalState(): <%= localStateName %> {
30
30
  return <%- initialLocalState %>;
31
31
  }
32
32
 
33
- export function defaultPHState(): <%= h.changeCase.pascal(documentType) %>PHState {
33
+ export function defaultPHState(): <%= phStateName %> {
34
34
  return {
35
35
  ...defaultBaseState(),
36
36
  global: defaultGlobalState(),
@@ -39,28 +39,28 @@ export function defaultPHState(): <%= h.changeCase.pascal(documentType) %>PHStat
39
39
  }
40
40
 
41
41
  export function createGlobalState(
42
- state?: Partial<<%= h.changeCase.pascal(documentType) %>GlobalState>,
43
- ): <%= h.changeCase.pascal(documentType) %>GlobalState {
42
+ state?: Partial<<%= globalStateName %>>,
43
+ ): <%= globalStateName %> {
44
44
  return {
45
45
  ...defaultGlobalState(),
46
46
  ...(state || {}),
47
- } as <%= h.changeCase.pascal(documentType) %>GlobalState;
47
+ } as <%= globalStateName %>;
48
48
  }
49
49
 
50
50
  export function createLocalState(
51
- state?: Partial<<%= h.changeCase.pascal(documentType) %>LocalState>,
52
- ): <%= h.changeCase.pascal(documentType) %>LocalState {
51
+ state?: Partial<<%= localStateName %>>,
52
+ ): <%= localStateName %> {
53
53
  return {
54
54
  ...defaultLocalState(),
55
55
  ...(state || {}),
56
- } as <%= h.changeCase.pascal(documentType) %>LocalState;
56
+ } as <%= localStateName %>;
57
57
  }
58
58
 
59
59
  export function createState(
60
60
  baseState?: Partial<PHBaseState>,
61
- globalState?: Partial<<%= h.changeCase.pascal(documentType) %>GlobalState>,
62
- localState?: Partial<<%= h.changeCase.pascal(documentType) %>LocalState>,
63
- ): <%= h.changeCase.pascal(documentType) %>PHState {
61
+ globalState?: Partial<<%= globalStateName %>>,
62
+ localState?: Partial<<%= localStateName %>>,
63
+ ): <%= phStateName %> {
64
64
  return {
65
65
  ...createBaseState(baseState?.auth, baseState?.document),
66
66
  global: createGlobalState(globalState),
@@ -69,18 +69,18 @@ export function createState(
69
69
  }
70
70
 
71
71
  /**
72
- * Creates a <%= h.changeCase.pascal(documentType) %>Document with custom global and local state
72
+ * Creates a <%= phDocumentTypeName %> with custom global and local state
73
73
  * This properly handles the PHBaseState requirements while allowing
74
74
  * document-specific state to be set.
75
75
  */
76
- export function create<%= h.changeCase.pascal(documentType) %>Document(
76
+ export function create<%= phDocumentTypeName %>(
77
77
  state?: Partial<{
78
78
  auth?: Partial<PHAuthState>;
79
79
  document?: Partial<PHDocumentState>;
80
- global?: Partial<<%= h.changeCase.pascal(documentType) %>GlobalState>;
81
- local?: Partial<<%= h.changeCase.pascal(documentType) %>LocalState>;
80
+ global?: Partial<<%= globalStateName %>>;
81
+ local?: Partial<<%= localStateName %>>;
82
82
  }>,
83
- ): <%= h.changeCase.pascal(documentType) %>Document {
83
+ ): <%= phDocumentTypeName %> {
84
84
  const document = createDocument(
85
85
  state ? createState(
86
86
  createBaseState(state.auth, state.document),
@@ -1,5 +1,5 @@
1
1
  ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(documentType) %>/gen/reducer.ts"
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/gen/reducer.ts"
3
3
  force: true
4
4
  ---
5
5
  // TODO: remove eslint-disable rules once refactor is done
@@ -7,14 +7,21 @@ force: true
7
7
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
8
8
  import type { StateReducer } from "document-model";
9
9
  import { isDocumentAction, createReducer } from "document-model/core";
10
- import type { <%= h.changeCase.pascal(documentType) %>PHState } from './types.js';
11
- import { z } from './types.js';
10
+ import type { <%= phStateName %> } from "<%= documentModelDir %>";
12
11
 
13
- <% modules.forEach(m => { _%>
14
- import { reducer as <%= h.changeCase.pascal(m.name) %>Reducer } from '../src/reducers/<%= h.changeCase.param(m.name) %>.js';
12
+ <% modules.forEach(module => { _%>
13
+ import { <%= camelCaseDocumentType %><%= h.changeCase.pascal(module.name) %>Operations } from "../src/reducers/<%= h.changeCase.param(module.name) %>.js";
15
14
  <%_ }); %>
16
15
 
17
- export const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>PHState> =
16
+ <% const schemas = modules.flatMap(m =>
17
+ m.operations.map(o => `${h.changeCase.pascalCase(o.name)}InputSchema`)
18
+ );
19
+ %>
20
+ import {
21
+ <%= schemas.join(',\n ') %>
22
+ } from "./schema/zod.js";
23
+
24
+ const stateReducer: StateReducer<<%= phStateName %>> =
18
25
  (state, action, dispatch) => {
19
26
  if (isDocumentAction(action)) {
20
27
  return state;
@@ -25,9 +32,9 @@ export const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>
25
32
  modules.map(m => m.operations.map(o =>
26
33
  ' case "' + h.changeCase.constant(o.name) + '":\n' +
27
34
  ' ' + (o.schema !== null ?
28
- 'z.' + h.changeCase.pascalCase(o.name) + 'InputSchema().parse(action.input);\n' :
35
+ h.changeCase.pascalCase(o.name) + 'InputSchema().parse(action.input);\n' :
29
36
  'if (Object.keys(action.input).length > 0) throw new Error("Expected empty input for action ' + h.changeCase.constant(o.name) + '");\n') +
30
- ' ' + h.changeCase.pascal(m.name) + 'Reducer.' + h.changeCase.camel(o.name) + 'Operation((state as any)[action.scope], action as any, dispatch);\n' +
37
+ ' ' + camelCaseDocumentType + h.changeCase.pascal(m.name) + 'Operations.' + h.changeCase.camel(o.name) + 'Operation((state as any)[action.scope], action as any, dispatch);\n' +
31
38
  ' break;\n'
32
39
  ).join('\n')).join('\n')
33
40
  %>
@@ -36,4 +43,4 @@ export const stateReducer: StateReducer<<%= h.changeCase.pascal(documentType) %>
36
43
  }
37
44
  }
38
45
 
39
- export const reducer = createReducer<<%= h.changeCase.pascal(documentType) %>PHState>(stateReducer);
46
+ export const reducer = createReducer<<%= phStateName %>>(stateReducer);
@@ -0,0 +1,11 @@
1
+ ---
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/utils.ts"
3
+ force: true
4
+ ---
5
+ import type { DocumentModelUtils } from "document-model";
6
+ import type { <%= phStateName %> } from "./gen/types.js";
7
+ import { utils as genUtils } from "./gen/utils.js";
8
+ import * as customUtils from "./src/utils.js";
9
+
10
+ /** Utils for the <%= pascalCaseDocumentType %> document model */
11
+ export const utils = { ...genUtils, ...customUtils } satisfies DocumentModelUtils<<%= phStateName %>>;
@@ -0,0 +1,13 @@
1
+ ---
2
+ to: "<%= rootDir %>/<%= paramCaseDocumentType %>/actions.ts"
3
+ force: true
4
+ ---
5
+ import { baseActions } from "document-model";
6
+ import { <% modules.forEach(module => { _%>
7
+ <%= h.changeCase.camel(module.name) %>Actions,
8
+ <% }); _%> } from "./gen/creators.js";
9
+
10
+ /** Actions for the <%= pascalCaseDocumentType %> document model */
11
+ export const actions = { ...baseActions, <% modules.forEach(module => { _%>
12
+ ...<%= h.changeCase.camel(module.name) %>Actions,
13
+ <% }); _%> };