@powerhousedao/codegen 4.1.0-dev.1 → 4.1.0-dev.100

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/README.md +0 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js +10 -0
  7. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +17 -0
  8. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/schema.esm.t +16 -0
  9. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +2 -2
  10. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +8 -2
  11. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +69 -54
  12. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +93 -0
  13. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +10 -5
  14. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +6 -7
  15. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +20 -8
  16. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +19 -26
  17. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t +3 -3
  18. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +1 -1
  19. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +2 -2
  20. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/error.esm.t +6 -10
  21. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +52 -27
  22. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +21 -20
  23. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +64 -51
  24. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +4 -10
  25. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +39 -28
  26. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +138 -223
  27. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +95 -72
  28. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +10 -0
  29. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +7 -71
  30. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.esm.t +5 -10
  31. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +12 -0
  32. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +103 -18
  33. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/hooks.esm.t +16 -0
  34. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +5 -12
  35. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +28 -15
  36. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js +8 -10
  37. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +5 -4
  38. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +5 -9
  39. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js +11 -15
  40. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.inject.esm.t +12 -0
  41. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.esm.t +8 -6
  42. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_call.esm.t +1 -1
  43. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_import.esm.t +1 -1
  44. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +6 -5
  45. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +6 -13
  46. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js +11 -15
  47. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.inject.esm.t +12 -0
  48. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +8 -9
  49. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_call.esm.t +2 -2
  50. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_import.esm.t +1 -1
  51. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t +2 -2
  52. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/schema.esm.t +10 -2
  53. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +5 -36
  54. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js +9 -11
  55. package/dist/src/codegen/generate.d.ts +33 -0
  56. package/dist/src/codegen/generate.d.ts.map +1 -0
  57. package/dist/src/codegen/generate.js +202 -0
  58. package/dist/src/codegen/generate.js.map +1 -0
  59. package/dist/src/codegen/graphql.d.ts +7 -3
  60. package/dist/src/codegen/graphql.d.ts.map +1 -1
  61. package/dist/src/codegen/graphql.js +29 -6
  62. package/dist/src/codegen/graphql.js.map +1 -1
  63. package/dist/src/codegen/hygen.d.ts +19 -11
  64. package/dist/src/codegen/hygen.d.ts.map +1 -1
  65. package/dist/src/codegen/hygen.js +71 -19
  66. package/dist/src/codegen/hygen.js.map +1 -1
  67. package/dist/src/codegen/index.d.ts +6 -33
  68. package/dist/src/codegen/index.d.ts.map +1 -1
  69. package/dist/src/codegen/index.js +6 -172
  70. package/dist/src/codegen/index.js.map +1 -1
  71. package/dist/src/codegen/types.d.ts +9 -0
  72. package/dist/src/codegen/types.d.ts.map +1 -0
  73. package/dist/src/codegen/types.js +2 -0
  74. package/dist/src/codegen/types.js.map +1 -0
  75. package/dist/src/codegen/utils.d.ts +5 -2
  76. package/dist/src/codegen/utils.d.ts.map +1 -1
  77. package/dist/src/codegen/utils.js +42 -4
  78. package/dist/src/codegen/utils.js.map +1 -1
  79. package/dist/src/create-lib/checkout-project.d.ts +13 -0
  80. package/dist/src/create-lib/checkout-project.d.ts.map +1 -0
  81. package/dist/src/create-lib/checkout-project.js +47 -0
  82. package/dist/src/create-lib/checkout-project.js.map +1 -0
  83. package/dist/src/create-lib/create-project.d.ts +9 -5
  84. package/dist/src/create-lib/create-project.d.ts.map +1 -1
  85. package/dist/src/create-lib/create-project.js +37 -30
  86. package/dist/src/create-lib/create-project.js.map +1 -1
  87. package/dist/src/create-lib/feature-flags.d.ts +4 -0
  88. package/dist/src/create-lib/feature-flags.d.ts.map +1 -0
  89. package/dist/src/create-lib/feature-flags.js +4 -0
  90. package/dist/src/create-lib/feature-flags.js.map +1 -0
  91. package/dist/src/create-lib/index.d.ts +1 -0
  92. package/dist/src/create-lib/index.d.ts.map +1 -1
  93. package/dist/src/create-lib/index.js +1 -0
  94. package/dist/src/create-lib/index.js.map +1 -1
  95. package/dist/src/{utils/package-manager.d.ts → create-lib/utils.d.ts} +3 -1
  96. package/dist/src/create-lib/utils.d.ts.map +1 -0
  97. package/dist/src/{utils/package-manager.js → create-lib/utils.js} +12 -1
  98. package/dist/src/create-lib/utils.js.map +1 -0
  99. package/dist/src/index.d.ts +5 -0
  100. package/dist/src/index.d.ts.map +1 -0
  101. package/dist/src/index.js +5 -0
  102. package/dist/src/index.js.map +1 -0
  103. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +9 -0
  104. package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +1 -0
  105. package/dist/src/ts-morph-generator/core/FileGenerator.js +9 -0
  106. package/dist/src/ts-morph-generator/core/FileGenerator.js.map +1 -0
  107. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +38 -0
  108. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -0
  109. package/dist/src/ts-morph-generator/core/GenerationContext.js +2 -0
  110. package/dist/src/ts-morph-generator/core/GenerationContext.js.map +1 -0
  111. package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts +12 -0
  112. package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts.map +1 -0
  113. package/dist/src/ts-morph-generator/core/ReducerGenerator.js +140 -0
  114. package/dist/src/ts-morph-generator/core/ReducerGenerator.js.map +1 -0
  115. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +19 -0
  116. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -0
  117. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js +113 -0
  118. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js.map +1 -0
  119. package/dist/src/ts-morph-generator/index.d.ts +4 -0
  120. package/dist/src/ts-morph-generator/index.d.ts.map +1 -0
  121. package/dist/src/ts-morph-generator/index.js +4 -0
  122. package/dist/src/ts-morph-generator/index.js.map +1 -0
  123. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +13 -0
  124. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -0
  125. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js +45 -0
  126. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js.map +1 -0
  127. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +14 -0
  128. package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +1 -0
  129. package/dist/src/ts-morph-generator/utilities/ImportManager.js +40 -0
  130. package/dist/src/ts-morph-generator/utilities/ImportManager.js.map +1 -0
  131. package/dist/src/ts-morph-generator/utilities/index.d.ts +3 -0
  132. package/dist/src/ts-morph-generator/utilities/index.d.ts.map +1 -0
  133. package/dist/src/ts-morph-generator/utilities/index.js +3 -0
  134. package/dist/src/ts-morph-generator/utilities/index.js.map +1 -0
  135. package/dist/src/utils/index.d.ts +0 -1
  136. package/dist/src/utils/index.d.ts.map +1 -1
  137. package/dist/src/utils/index.js +0 -1
  138. package/dist/src/utils/index.js.map +1 -1
  139. package/dist/src/utils/validation.d.ts +6 -6
  140. package/dist/src/utils/validation.d.ts.map +1 -1
  141. package/dist/src/utils/validation.js +2 -2
  142. package/dist/src/utils/validation.js.map +1 -1
  143. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  144. package/package.json +26 -27
  145. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.d.ts +0 -25
  146. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.d.ts.map +0 -1
  147. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js.map +0 -1
  148. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/object.esm.t +0 -49
  149. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customReducers.esm.t +0 -20
  150. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts +0 -24
  151. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts.map +0 -1
  152. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js.map +0 -1
  153. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t +0 -37
  154. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.d.ts +0 -22
  155. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.d.ts.map +0 -1
  156. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js.map +0 -1
  157. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EditorContainer.esm.t +0 -124
  158. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FileItemsGrid.esm.t +0 -44
  159. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderItemsGrid.esm.t +0 -96
  160. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/hooks/useSelectedFolderChildren.esm.t +0 -35
  161. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/hooks/useTransformedNodes.esm.t +0 -35
  162. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/types/css.d.esm.t +0 -8
  163. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.d.ts +0 -20
  164. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.d.ts.map +0 -1
  165. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js.map +0 -1
  166. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.d.ts +0 -14
  167. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.d.ts.map +0 -1
  168. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js.map +0 -1
  169. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.d.ts +0 -20
  170. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.d.ts.map +0 -1
  171. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js.map +0 -1
  172. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.d.ts +0 -20
  173. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.d.ts.map +0 -1
  174. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js.map +0 -1
  175. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.d.ts +0 -16
  176. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.d.ts.map +0 -1
  177. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js.map +0 -1
  178. package/dist/src/utils/package-manager.d.ts.map +0 -1
  179. package/dist/src/utils/package-manager.js.map +0 -1
  180. package/dist/tsconfig.hygen.tsbuildinfo +0 -1
@@ -1,11 +1,10 @@
1
- import { parseArgs, promptDirectories } from "#utils/cli";
2
- import { getPackageManager } from "#utils/package-manager";
3
- import { execSync } from "child_process";
1
+ import { parseArgs, promptDirectories } from "@powerhousedao/codegen";
4
2
  import enquirer from "enquirer";
5
3
  import fs from "node:fs";
6
4
  import path from "path";
5
+ import { featureFlags } from "./feature-flags.js";
6
+ import { envPackageManager, runCmd } from "./utils.js";
7
7
  const BOILERPLATE_REPO = "https://github.com/powerhouse-inc/document-model-boilerplate.git";
8
- const envPackageManager = getPackageManager(process.env.npm_config_user_agent);
9
8
  const defaultDirectories = {
10
9
  documentModelsDir: "./document-models",
11
10
  editorsDir: "./editors",
@@ -13,12 +12,14 @@ const defaultDirectories = {
13
12
  export const createCommandSpec = {
14
13
  "--name": String,
15
14
  "--project-name": "--name",
16
- "--version": String,
15
+ "--branch": String,
16
+ "--tag": String,
17
17
  "--interactive": Boolean,
18
18
  "--dev": Boolean,
19
19
  "--staging": Boolean,
20
20
  "-p": "--name",
21
- "-v": "--version",
21
+ "-b": "--branch",
22
+ "-t": "--tag",
22
23
  "--package-manager": String,
23
24
  };
24
25
  const { prompt } = enquirer;
@@ -32,7 +33,7 @@ function buildPackageJson(appPath, projectName) {
32
33
  };
33
34
  fs.writeFileSync(path.join(appPath, "package.json"), JSON.stringify(newPackage, null, 2), "utf8");
34
35
  }
35
- function buildPowerhouseConfig(appPath, documentModelsDir, editorsDir) {
36
+ function buildPowerhouseConfig(appPath, documentModelsDir, editorsDir, vetraDriveUrl) {
36
37
  const filePath = path.join(appPath, "powerhouse.config.json");
37
38
  const packageJson = JSON.parse(fs.readFileSync(filePath, "utf-8"));
38
39
  const newPackage = {
@@ -40,6 +41,14 @@ function buildPowerhouseConfig(appPath, documentModelsDir, editorsDir) {
40
41
  documentModelsDir,
41
42
  editorsDir,
42
43
  };
44
+ // Add vetra configuration if vetraDriveUrl is provided
45
+ if (vetraDriveUrl) {
46
+ const driveId = vetraDriveUrl.split("/").pop();
47
+ newPackage.vetra = {
48
+ driveId: driveId ?? "",
49
+ driveUrl: vetraDriveUrl,
50
+ };
51
+ }
43
52
  fs.writeFileSync(filePath, JSON.stringify(newPackage, null, 2), "utf8");
44
53
  }
45
54
  function buildIndex(appPath, documentModelsDir, editorsDir) {
@@ -53,17 +62,9 @@ export const documentModels = Object.values(documentModelsExports);
53
62
  export const editors = Object.values(editorsExports);
54
63
  `, "utf8");
55
64
  }
56
- function runCmd(command) {
57
- try {
58
- execSync(command, { stdio: "inherit" });
59
- }
60
- catch (error) {
61
- console.log("\x1b[31m", error, "\x1b[0m");
62
- }
63
- }
64
- export function parseVersion(args) {
65
- if (args.version) {
66
- return args.version;
65
+ export function parseTag(args) {
66
+ if (args.tag) {
67
+ return args.tag;
67
68
  }
68
69
  if (args.dev) {
69
70
  return "dev";
@@ -75,9 +76,9 @@ export function parseVersion(args) {
75
76
  return "main";
76
77
  }
77
78
  }
78
- function parseVersionArgs(args) {
79
- return parseVersion({
80
- version: args["--version"],
79
+ function parseTagArgs(args) {
80
+ return parseTag({
81
+ tag: args["--tag"],
81
82
  dev: args["--dev"],
82
83
  staging: args["--staging"],
83
84
  });
@@ -87,7 +88,8 @@ export function initCli() {
87
88
  const options = {
88
89
  name: args["--name"] ?? args._.shift(),
89
90
  interactive: args["--interactive"] ?? false,
90
- version: parseVersionArgs(args),
91
+ tag: parseTagArgs(args),
92
+ branch: args["--branch"],
91
93
  };
92
94
  return createProject(options);
93
95
  }
@@ -110,9 +112,13 @@ export async function createProject(options) {
110
112
  }
111
113
  projectName = result.projectName;
112
114
  }
113
- const { documentModelsDir, editorsDir, } = options.interactive
114
- ? await promptDirectories(defaultDirectories)
115
- : defaultDirectories;
115
+ let documentModelsDir = defaultDirectories.documentModelsDir;
116
+ let editorsDir = defaultDirectories.editorsDir;
117
+ if (featureFlags.allowCustomDirectories && options.interactive) {
118
+ const result = await promptDirectories(defaultDirectories);
119
+ documentModelsDir = result.documentModelsDir;
120
+ editorsDir = result.editorsDir;
121
+ }
116
122
  const appPath = path.join(process.cwd(), projectName);
117
123
  try {
118
124
  fs.mkdirSync(appPath);
@@ -126,19 +132,20 @@ export async function createProject(options) {
126
132
  }
127
133
  process.exit(1);
128
134
  }
129
- handleCreateProject(projectName, documentModelsDir, editorsDir, options.version, options.packageManager);
135
+ handleCreateProject(projectName, documentModelsDir, editorsDir, options.tag, options.branch, options.packageManager, options.vetraDriveUrl);
130
136
  }
131
- function handleCreateProject(projectName, documentModelsDir, editorsDir, version = "main", packageManager) {
137
+ function handleCreateProject(projectName, documentModelsDir, editorsDir, tag = "main", branch, packageManager, vetraDriveUrl) {
138
+ branch = branch ?? tag;
132
139
  packageManager = packageManager ?? envPackageManager;
133
140
  try {
134
141
  console.log("\x1b[33m", "Downloading the project structure...", "\x1b[0m");
135
- runCmd(`git clone --depth 1 -b ${version} ${BOILERPLATE_REPO} ${projectName}`);
142
+ runCmd(`git clone --depth 1 -b ${branch} ${BOILERPLATE_REPO} ${projectName}`);
136
143
  const appPath = path.join(process.cwd(), projectName);
137
144
  process.chdir(appPath);
138
145
  console.log("\x1b[34m", `Installing dependencies with ${packageManager}...`, "\x1b[0m");
139
146
  runCmd(`${packageManager} install --loglevel error`);
140
147
  fs.rmSync(path.join(appPath, "./.git"), { recursive: true });
141
- runCmd(`git init -b ${version}`);
148
+ runCmd(`git init -b ${tag}`);
142
149
  try {
143
150
  fs.mkdirSync(path.join(appPath, documentModelsDir));
144
151
  fs.writeFileSync(path.join(appPath, documentModelsDir, "index.ts"), "");
@@ -151,7 +158,7 @@ function handleCreateProject(projectName, documentModelsDir, editorsDir, version
151
158
  }
152
159
  }
153
160
  buildPackageJson(appPath, projectName);
154
- buildPowerhouseConfig(appPath, documentModelsDir, editorsDir);
161
+ buildPowerhouseConfig(appPath, documentModelsDir, editorsDir, vetraDriveUrl);
155
162
  buildIndex(appPath, documentModelsDir, editorsDir);
156
163
  console.log("\x1b[32m", "The installation is done!", "\x1b[0m");
157
164
  console.log();
@@ -1 +1 @@
1
- {"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../../src/create-lib/create-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,gBAAgB,GACpB,kEAAkE,CAAC;AAErE,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAE/E,MAAM,kBAAkB,GAAG;IACzB,iBAAiB,EAAE,mBAAmB;IACtC,UAAU,EAAE,WAAW;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,MAAM;IAChB,gBAAgB,EAAE,QAAQ;IAC1B,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,OAAO;IACxB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,WAAW;IACjB,mBAAmB,EAAE,MAAM;CACnB,CAAC;AASX,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;AAE5B,SAAS,gBAAgB,CAAC,OAAe,EAAE,WAAmB;IAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CACtC,CAAC;IACzB,MAAM,UAAU,GAAG;QACjB,GAAG,WAAW;QACd,IAAI,EAAE,WAA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{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/create-lib/feature-flags.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAEf,CAAC"}
@@ -0,0 +1,4 @@
1
+ export const featureFlags = {
2
+ allowCustomDirectories: process.env.ALLOW_CUSTOM_DIRECTORIES === "true",
3
+ };
4
+ //# sourceMappingURL=feature-flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../../src/create-lib/feature-flags.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,sBAAsB,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,KAAK,MAAM;CAC/D,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from "./checkout-project.js";
1
2
  export * from "./create-project.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create-lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create-lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from "./checkout-project.js";
1
2
  export * from "./create-project.js";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/create-lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/create-lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  declare const packageManagers: readonly ["npm", "yarn", "pnpm", "bun"];
2
2
  export type PackageManager = (typeof packageManagers)[number];
3
3
  export declare function getPackageManager(userAgent?: string): PackageManager;
4
+ export declare const envPackageManager: "npm" | "yarn" | "pnpm" | "bun";
5
+ export declare function runCmd(command: string): void;
4
6
  export {};
5
- //# sourceMappingURL=package-manager.d.ts.map
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/create-lib/utils.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,eAAe,yCAA0C,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAcpE;AAED,eAAO,MAAM,iBAAiB,iCAE7B,CAAC;AAEF,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,QAOrC"}
@@ -1,3 +1,4 @@
1
+ import { execSync } from "child_process";
1
2
  const packageManagers = ["npm", "yarn", "pnpm", "bun"];
2
3
  const defaultPackageManager = "npm";
3
4
  export function getPackageManager(userAgent) {
@@ -14,4 +15,14 @@ export function getPackageManager(userAgent) {
14
15
  return defaultPackageManager;
15
16
  }
16
17
  }
17
- //# sourceMappingURL=package-manager.js.map
18
+ export const envPackageManager = getPackageManager(process.env.npm_config_user_agent);
19
+ export function runCmd(command) {
20
+ try {
21
+ execSync(command, { stdio: "inherit" });
22
+ }
23
+ catch (error) {
24
+ console.log("\x1b[31m", error, "\x1b[0m");
25
+ throw error;
26
+ }
27
+ }
28
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/create-lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAChE,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAIpC,MAAM,UAAU,iBAAiB,CAAC,SAAkB;IAClD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,eAAe,CAAC,QAAQ,CAAC,IAAsB,CAAC,EAAE,CAAC;QACrD,OAAO,IAAsB,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAO,qBAAqB,CAAC;IAC/B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAChD,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAClC,CAAC;AAEF,MAAM,UAAU,MAAM,CAAC,OAAe;IACpC,IAAI,CAAC;QACH,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./codegen/index.js";
2
+ export * from "./create-lib/index.js";
3
+ export * from "./ts-morph-generator/index.js";
4
+ export * from "./utils/index.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./codegen/index.js";
2
+ export * from "./create-lib/index.js";
3
+ export * from "./ts-morph-generator/index.js";
4
+ export * from "./utils/index.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { DirectoryManager, ImportManager } from "@powerhousedao/codegen";
2
+ import type { GenerationContext } from "./GenerationContext.js";
3
+ export declare abstract class FileGenerator {
4
+ protected importManager: ImportManager;
5
+ protected directoryManager: DirectoryManager;
6
+ constructor(importManager: ImportManager, directoryManager: DirectoryManager);
7
+ abstract generate(context: GenerationContext): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=FileGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileGenerator.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/FileGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,8BAAsB,aAAa;IAE/B,SAAS,CAAC,aAAa,EAAE,aAAa;IACtC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB;gBADlC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB;IAG9C,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAC7D"}
@@ -0,0 +1,9 @@
1
+ export class FileGenerator {
2
+ importManager;
3
+ directoryManager;
4
+ constructor(importManager, directoryManager) {
5
+ this.importManager = importManager;
6
+ this.directoryManager = directoryManager;
7
+ }
8
+ }
9
+ //# sourceMappingURL=FileGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileGenerator.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/FileGenerator.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,aAAa;IAErB;IACA;IAFZ,YACY,aAA4B,EAC5B,gBAAkC;QADlC,kBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAkB;IAC3C,CAAC;CAGL"}
@@ -0,0 +1,38 @@
1
+ import type { DocumentModelGlobalState, ModuleSpecification, OperationErrorSpecification } from "document-model";
2
+ import type { Project } from "ts-morph";
3
+ export type CodegenOperation = {
4
+ id: string;
5
+ name: string | null;
6
+ description: string | null;
7
+ examples: {
8
+ id: string;
9
+ value: string;
10
+ }[];
11
+ reducer: string | null;
12
+ schema: string | null;
13
+ template: string | null;
14
+ hasInput: boolean;
15
+ hasAttachment: boolean | undefined;
16
+ scope: string;
17
+ state: string;
18
+ errors?: OperationErrorSpecification[];
19
+ };
20
+ export interface GenerationContext {
21
+ rootDir: string;
22
+ docModel: DocumentModelGlobalState;
23
+ module: ModuleSpecification;
24
+ project: Project;
25
+ operations: CodegenOperation[];
26
+ forceUpdate: boolean;
27
+ }
28
+ export type PHProjectDirectories = {
29
+ documentModelDir?: string;
30
+ editorsDir?: string;
31
+ processorsDir?: string;
32
+ subgraphsDir?: string;
33
+ };
34
+ export type CodeGeneratorOptions = {
35
+ directories?: PHProjectDirectories;
36
+ forceUpdate?: boolean;
37
+ };
38
+ //# sourceMappingURL=GenerationContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerationContext.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/GenerationContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,2BAA2B,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GenerationContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerationContext.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/GenerationContext.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { FileGenerator } from "./FileGenerator.js";
2
+ import type { GenerationContext } from "./GenerationContext.js";
3
+ export declare class ReducerGenerator extends FileGenerator {
4
+ generate(context: GenerationContext): Promise<void>;
5
+ private static getDefaultReducerCode;
6
+ private addErrorImports;
7
+ private getOutputPath;
8
+ private createReducerObject;
9
+ private addReducerMethod;
10
+ private setReducerMethodCode;
11
+ }
12
+ //# sourceMappingURL=ReducerGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReducerGenerator.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/ReducerGenerator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,qBAAa,gBAAiB,SAAQ,aAAa;IAC3C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCzD,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAOpC,OAAO,CAAC,eAAe;IAyEvB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,mBAAmB;IAsC3B,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,oBAAoB;CAK7B"}
@@ -0,0 +1,140 @@
1
+ import { camelCase, paramCase, pascalCase } from "change-case";
2
+ import { SyntaxKind, VariableDeclarationKind } from "ts-morph";
3
+ import { FileGenerator } from "./FileGenerator.js";
4
+ export class ReducerGenerator extends FileGenerator {
5
+ async generate(context) {
6
+ // Skip if no actions to generate
7
+ if (context.operations.length === 0)
8
+ return;
9
+ const filePath = this.getOutputPath(context);
10
+ const sourceFile = await this.directoryManager.createSourceFile(context.project, filePath);
11
+ // Reducer-specific import logic
12
+ const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
13
+ const typeImportPath = `../../gen/${paramCase(context.module.name)}/operations.js`;
14
+ // Import management (shared utility)
15
+ this.importManager.addTypeImport(sourceFile, typeImportName, typeImportPath);
16
+ // AST logic (specific to reducers)
17
+ this.createReducerObject(sourceFile, typeImportName, context.operations, context.forceUpdate);
18
+ // Detect and import error classes used in the actual reducer code (after generation)
19
+ this.addErrorImports(sourceFile, context);
20
+ await sourceFile.save();
21
+ }
22
+ static getDefaultReducerCode(methodName) {
23
+ return [
24
+ `// TODO: Implement "${methodName}" reducer`,
25
+ `throw new Error('Reducer "${methodName}" not yet implemented');`,
26
+ ];
27
+ }
28
+ addErrorImports(sourceFile, context) {
29
+ // Collect all errors from all operations
30
+ const allErrors = [];
31
+ context.operations.forEach((operation) => {
32
+ if (Array.isArray(operation.errors)) {
33
+ operation.errors
34
+ .filter((error) => error.name)
35
+ .forEach((error) => {
36
+ // Deduplicate errors by name
37
+ if (!allErrors.find((e) => e.name === error.name)) {
38
+ allErrors.push(error);
39
+ }
40
+ });
41
+ }
42
+ });
43
+ if (allErrors.length === 0)
44
+ return;
45
+ // Analyze the actual source file content to find which errors are used
46
+ const sourceFileContent = sourceFile.getFullText();
47
+ const usedErrors = new Set();
48
+ allErrors.forEach((error) => {
49
+ // Check if error class name is mentioned anywhere in the source file
50
+ // Look for patterns like "new ErrorName" or "throw ErrorName" or "ErrorName("
51
+ const errorPattern = new RegExp(`\\b${error.name}\\b`, "g");
52
+ if (errorPattern.test(sourceFileContent)) {
53
+ usedErrors.add(error.name);
54
+ }
55
+ });
56
+ // Add imports for used errors (only if they're not already imported)
57
+ if (usedErrors.size > 0) {
58
+ const errorImportPath = `../../gen/${paramCase(context.module.name)}/error.js`;
59
+ const errorClassNames = Array.from(usedErrors);
60
+ // Check if imports already exist to avoid duplicates
61
+ const existingImports = sourceFile.getImportDeclarations();
62
+ const existingErrorImport = existingImports.find((importDecl) => importDecl.getModuleSpecifierValue() === errorImportPath);
63
+ if (existingErrorImport) {
64
+ // Get already imported error names
65
+ const existingNamedImports = existingErrorImport
66
+ .getNamedImports()
67
+ .map((namedImport) => namedImport.getName());
68
+ // Only import errors that aren't already imported
69
+ const newErrorsToImport = errorClassNames.filter((errorName) => !existingNamedImports.includes(errorName));
70
+ if (newErrorsToImport.length > 0) {
71
+ // Add new named imports to existing import declaration
72
+ existingErrorImport.addNamedImports(newErrorsToImport);
73
+ }
74
+ }
75
+ else {
76
+ // Create new import declaration
77
+ this.importManager.addNamedImports(sourceFile, errorClassNames, errorImportPath);
78
+ }
79
+ }
80
+ }
81
+ getOutputPath(context) {
82
+ return this.directoryManager.getReducerPath(context.rootDir, context.docModel.name, context.module.name);
83
+ }
84
+ createReducerObject(sourceFile, typeName, operations, forceUpdate = false) {
85
+ let reducerVar = sourceFile.getVariableDeclaration("reducer");
86
+ if (!reducerVar) {
87
+ sourceFile.addVariableStatement({
88
+ declarationKind: VariableDeclarationKind.Const,
89
+ isExported: true,
90
+ declarations: [
91
+ {
92
+ name: "reducer",
93
+ type: typeName,
94
+ initializer: "{}",
95
+ },
96
+ ],
97
+ });
98
+ reducerVar = sourceFile.getVariableDeclarationOrThrow("reducer");
99
+ }
100
+ else {
101
+ // Ensure correct type
102
+ const typeNode = reducerVar.getTypeNode();
103
+ if (!typeNode || typeNode.getText() !== typeName) {
104
+ reducerVar.setType(typeName);
105
+ }
106
+ }
107
+ const initializer = reducerVar.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
108
+ for (const operation of operations) {
109
+ this.addReducerMethod(initializer, operation, forceUpdate);
110
+ }
111
+ }
112
+ addReducerMethod(objectLiteral, operation, forceUpdate = false) {
113
+ const actionName = camelCase(operation.name ?? "");
114
+ if (!actionName)
115
+ return;
116
+ const methodName = `${actionName}Operation`;
117
+ const reducerCode = operation.reducer?.trim();
118
+ const existingReducer = objectLiteral
119
+ .getProperty(methodName)
120
+ ?.asKind(SyntaxKind.MethodDeclaration);
121
+ // if reducer already exists but forceUpdate is true, update it
122
+ if (existingReducer) {
123
+ if (forceUpdate && reducerCode) {
124
+ existingReducer.setBodyText("");
125
+ this.setReducerMethodCode(existingReducer, reducerCode);
126
+ }
127
+ return;
128
+ }
129
+ // if reducer doesn't exist, create it and set the code with the default code if no code is provided
130
+ const method = objectLiteral.addMethod({
131
+ name: methodName,
132
+ parameters: [{ name: "state" }, { name: "action" }],
133
+ });
134
+ this.setReducerMethodCode(method, reducerCode);
135
+ }
136
+ setReducerMethodCode(reducer, code) {
137
+ reducer.addStatements(code ? [code] : ReducerGenerator.getDefaultReducerCode(reducer.getName()));
138
+ }
139
+ }
140
+ //# sourceMappingURL=ReducerGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReducerGenerator.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/ReducerGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO/D,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IACjD,KAAK,CAAC,QAAQ,CAAC,OAA0B;QACvC,iCAAiC;QACjC,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAE5C,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAC7D,OAAO,CAAC,OAAO,EACf,QAAQ,CACT,CAAC;QAEF,gCAAgC;QAChC,MAAM,cAAc,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;QAC1G,MAAM,cAAc,GAAG,aAAa,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,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AAC,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAC1E,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import type { DocumentModelGlobalState } from "document-model";
2
+ import type { CodeGeneratorOptions } from "./GenerationContext.js";
3
+ export declare class TSMorphCodeGenerator {
4
+ private rootDir;
5
+ private docModels;
6
+ private project;
7
+ private generators;
8
+ private directories;
9
+ private forceUpdate;
10
+ constructor(rootDir: string, docModels: DocumentModelGlobalState[], options?: CodeGeneratorOptions);
11
+ private setupGenerators;
12
+ generateReducers(): Promise<void>;
13
+ generateAll(): Promise<void>;
14
+ private generateFileType;
15
+ private setupProject;
16
+ private createGenerationContext;
17
+ private ensureDirectoryExists;
18
+ }
19
+ //# sourceMappingURL=TSMorphCodeGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TSMorphCodeGenerator.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,wBAAwB,CAAC;AAGhC,qBAAa,oBAAoB;IAY7B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,SAAS;IAZnB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,WAAW,CAKjB;IACF,OAAO,CAAC,WAAW,CAAS;gBAGlB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,wBAAwB,EAAE,EAC7C,OAAO,GAAE,oBAA8D;IAYzE,OAAO,CAAC,eAAe;IAYjB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAMpB,gBAAgB;YAwBhB,YAAY;IAiC1B,OAAO,CAAC,uBAAuB;YAuBjB,qBAAqB;CAQpC"}