@powerhousedao/codegen 5.0.3 → 5.0.5
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.
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/actions.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +3 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/customUtils.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-models.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-schema.esm.t +56 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-type.esm.t +6 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +110 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/hooks.esm.t +49 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +12 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +66 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.esm.t +4 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/module.esm.t +22 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +23 -23
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +16 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/root-utils.esm.t +11 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootActions.esm.t +13 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +6 -26
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/src-index.esm.t +5 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +16 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +31 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +10 -5
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +13 -18
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +15 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +99 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +21 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +4 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +26 -29
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveContents.esm.t +23 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +5 -126
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EmptyState.esm.t +19 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Files.esm.t +29 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Folders.esm.t +28 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/NavigationBreadcrumbs.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +2 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +5 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editors.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +26 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/lib.esm.t +4 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/module.esm.t +15 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/edit-name.esm.t +78 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +7 -104
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editors.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +74 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/lib.esm.t +4 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/module.esm.t +16 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/utils.js +46 -0
- package/dist/src/codegen/__tests__/config.d.ts +2 -0
- package/dist/src/codegen/__tests__/config.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/config.js +2 -0
- package/dist/src/codegen/__tests__/config.js.map +1 -0
- package/dist/src/codegen/__tests__/constants.d.ts +16 -0
- package/dist/src/codegen/__tests__/constants.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/constants.js +16 -0
- package/dist/src/codegen/__tests__/constants.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts +2 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js +9 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts +3 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js +33 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts +2 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js +23 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts +2 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.js +23 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.js +206 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.js +153 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-editor.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-editor.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-editor.test.js +112 -0
- package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.js +192 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.js +143 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.js.map +1 -0
- package/dist/src/codegen/__tests__/global-setup.d.ts +2 -0
- package/dist/src/codegen/__tests__/global-setup.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/global-setup.js +21 -0
- package/dist/src/codegen/__tests__/global-setup.js.map +1 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.js +72 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.js.map +1 -0
- package/dist/src/codegen/__tests__/utils.d.ts +7 -0
- package/dist/src/codegen/__tests__/utils.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/utils.js +52 -0
- package/dist/src/codegen/__tests__/utils.js.map +1 -0
- package/dist/src/codegen/generate.d.ts +12 -2
- package/dist/src/codegen/generate.d.ts.map +1 -1
- package/dist/src/codegen/generate.js +26 -11
- package/dist/src/codegen/generate.js.map +1 -1
- package/dist/src/codegen/graphql.js +1 -1
- package/dist/src/codegen/graphql.js.map +1 -1
- package/dist/src/codegen/hygen.d.ts +19 -10
- package/dist/src/codegen/hygen.d.ts.map +1 -1
- package/dist/src/codegen/hygen.js +62 -16
- package/dist/src/codegen/hygen.js.map +1 -1
- package/dist/src/create-lib/checkout-project.d.ts +13 -0
- package/dist/src/create-lib/checkout-project.d.ts.map +1 -0
- package/dist/src/create-lib/checkout-project.js +47 -0
- package/dist/src/create-lib/checkout-project.js.map +1 -0
- package/dist/src/create-lib/create-project.d.ts +9 -5
- package/dist/src/create-lib/create-project.d.ts.map +1 -1
- package/dist/src/create-lib/create-project.js +37 -45
- package/dist/src/create-lib/create-project.js.map +1 -1
- package/dist/src/create-lib/feature-flags.d.ts +4 -0
- package/dist/src/create-lib/feature-flags.d.ts.map +1 -0
- package/dist/src/create-lib/feature-flags.js +4 -0
- package/dist/src/create-lib/feature-flags.js.map +1 -0
- package/dist/src/create-lib/index.d.ts +1 -0
- package/dist/src/create-lib/index.d.ts.map +1 -1
- package/dist/src/create-lib/index.js +1 -0
- package/dist/src/create-lib/index.js.map +1 -1
- package/dist/src/create-lib/utils.d.ts +7 -0
- package/dist/src/create-lib/utils.d.ts.map +1 -0
- package/dist/src/create-lib/utils.js +28 -0
- package/dist/src/create-lib/utils.js.map +1 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts +2 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts.map +1 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +491 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js.map +1 -0
- package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +3 -1
- package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/FileGenerator.js +3 -1
- package/dist/src/ts-morph-generator/core/FileGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +1 -0
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/ReducerGenerator.js +14 -7
- package/dist/src/ts-morph-generator/core/ReducerGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +2 -1
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js +10 -3
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts +5 -0
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts.map +1 -0
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.js +10 -0
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.js.map +1 -0
- package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +1 -0
- package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/ImportManager.js +13 -3
- package/dist/src/ts-morph-generator/utilities/ImportManager.js.map +1 -1
- package/dist/src/ts-morph-generator/utilities/index.d.ts +1 -0
- package/dist/src/ts-morph-generator/utilities/index.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/index.js +1 -0
- package/dist/src/ts-morph-generator/utilities/index.js.map +1 -1
- package/dist/src/utils/validation.d.ts.map +1 -1
- package/dist/src/utils/validation.js +3 -4
- package/dist/src/utils/validation.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +16 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +13 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.inject_export.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.esm.t +0 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/lib.inject_export.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/hooks.esm.t +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +0 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/lib.inject_export.esm.t +0 -7
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import { DeclarationManager, DirectoryManager, ImportManager, } from "@powerhousedao/codegen";
|
|
2
|
+
import { camelCase, paramCase, pascalCase } from "change-case";
|
|
3
|
+
import { Project } from "ts-morph";
|
|
4
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
5
|
+
import { ReducerGenerator } from "../core/ReducerGenerator.js";
|
|
6
|
+
function makeVariableAndTypeNamesFromContext(context) {
|
|
7
|
+
const typeImportPath = `${context.packageName}/document-models/${paramCase(context.docModel.name)}`;
|
|
8
|
+
const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
9
|
+
const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
10
|
+
return { typeImportPath, typeImportName, operationHandlersObjectName };
|
|
11
|
+
}
|
|
12
|
+
// Custom DirectoryManager for testing that works with in-memory file system
|
|
13
|
+
class TestDirectoryManager extends DirectoryManager {
|
|
14
|
+
async ensureExists(dirPath) {
|
|
15
|
+
// Skip directory creation for in-memory file system
|
|
16
|
+
}
|
|
17
|
+
async createSourceFile(project, filePath) {
|
|
18
|
+
// Check if file already exists and return it, otherwise create new one
|
|
19
|
+
const existing = project.getSourceFile(filePath);
|
|
20
|
+
if (existing) {
|
|
21
|
+
return existing;
|
|
22
|
+
}
|
|
23
|
+
return project.createSourceFile(filePath);
|
|
24
|
+
}
|
|
25
|
+
getReducerPath(rootDir, docModelName, moduleName) {
|
|
26
|
+
// Use the same logic as the real DirectoryManager
|
|
27
|
+
return super.getReducerPath(rootDir, docModelName, moduleName);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
describe("ReducerGenerator Integration", () => {
|
|
31
|
+
let generator;
|
|
32
|
+
let project;
|
|
33
|
+
let importManager;
|
|
34
|
+
let directoryManager;
|
|
35
|
+
let declarationManager;
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
// Use real instances with in-memory file system
|
|
38
|
+
project = new Project({ useInMemoryFileSystem: true });
|
|
39
|
+
importManager = new ImportManager();
|
|
40
|
+
directoryManager = new TestDirectoryManager();
|
|
41
|
+
declarationManager = new DeclarationManager();
|
|
42
|
+
generator = new ReducerGenerator(importManager, directoryManager, declarationManager);
|
|
43
|
+
});
|
|
44
|
+
describe("generate", () => {
|
|
45
|
+
it("should create a complete reducer file with proper AST structure", async () => {
|
|
46
|
+
const operations = [
|
|
47
|
+
{
|
|
48
|
+
id: "1",
|
|
49
|
+
name: "SET_TEST_VALUE",
|
|
50
|
+
description: null,
|
|
51
|
+
errors: [],
|
|
52
|
+
examples: [],
|
|
53
|
+
reducer: null,
|
|
54
|
+
schema: null,
|
|
55
|
+
template: null,
|
|
56
|
+
scope: "global",
|
|
57
|
+
hasInput: true,
|
|
58
|
+
hasAttachment: false,
|
|
59
|
+
state: "",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "2",
|
|
63
|
+
name: "DELETE_ITEM",
|
|
64
|
+
description: null,
|
|
65
|
+
errors: [],
|
|
66
|
+
examples: [],
|
|
67
|
+
reducer: null,
|
|
68
|
+
schema: null,
|
|
69
|
+
template: null,
|
|
70
|
+
scope: "global",
|
|
71
|
+
hasInput: false,
|
|
72
|
+
hasAttachment: false,
|
|
73
|
+
state: "",
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
const context = {
|
|
77
|
+
rootDir: "/test",
|
|
78
|
+
packageName: "test",
|
|
79
|
+
docModel: { name: "TestDoc" },
|
|
80
|
+
module: { name: "testModule" },
|
|
81
|
+
project,
|
|
82
|
+
operations,
|
|
83
|
+
forceUpdate: false,
|
|
84
|
+
};
|
|
85
|
+
await generator.generate(context);
|
|
86
|
+
// Get the generated file
|
|
87
|
+
const expectedPath = "/test/document-model/test-doc/src/reducers/test-module.ts";
|
|
88
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
89
|
+
const typeImportPath = `${context.packageName}/document-models/${paramCase(context.docModel.name)}`;
|
|
90
|
+
const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
91
|
+
expect(sourceFile).toBeDefined();
|
|
92
|
+
const content = sourceFile.getFullText();
|
|
93
|
+
// Check type import
|
|
94
|
+
expect(content).toContain(`import type { TestDocTestModuleOperations } from "${typeImportPath}";`);
|
|
95
|
+
// Check reducer variable declaration
|
|
96
|
+
expect(content).toContain(`export const ${operationHandlersObjectName}: TestDocTestModuleOperations = {`);
|
|
97
|
+
// Check generated methods
|
|
98
|
+
expect(content).toContain("setTestValueOperation(state, action) {");
|
|
99
|
+
expect(content).toContain('// TODO: Implement "setTestValueOperation" reducer');
|
|
100
|
+
expect(content).toContain("throw new Error('Reducer \"setTestValueOperation\" not yet implemented');");
|
|
101
|
+
expect(content).toContain("deleteItemOperation(state, action) {");
|
|
102
|
+
expect(content).toContain('// TODO: Implement "deleteItemOperation" reducer');
|
|
103
|
+
expect(content).toContain("throw new Error('Reducer \"deleteItemOperation\" not yet implemented');");
|
|
104
|
+
});
|
|
105
|
+
it("should handle existing reducer file and add new methods", async () => {
|
|
106
|
+
// First, create a file with one method
|
|
107
|
+
const initialOperations = [
|
|
108
|
+
{
|
|
109
|
+
id: "1",
|
|
110
|
+
name: "SET_VALUE",
|
|
111
|
+
description: null,
|
|
112
|
+
errors: [],
|
|
113
|
+
examples: [],
|
|
114
|
+
reducer: null,
|
|
115
|
+
schema: null,
|
|
116
|
+
template: null,
|
|
117
|
+
scope: "global",
|
|
118
|
+
hasInput: true,
|
|
119
|
+
hasAttachment: false,
|
|
120
|
+
state: "",
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
const context = {
|
|
124
|
+
rootDir: "/test",
|
|
125
|
+
packageName: "test",
|
|
126
|
+
docModel: { name: "MyDoc" },
|
|
127
|
+
module: { name: "myModule" },
|
|
128
|
+
project,
|
|
129
|
+
operations: initialOperations,
|
|
130
|
+
forceUpdate: false,
|
|
131
|
+
};
|
|
132
|
+
await generator.generate(context);
|
|
133
|
+
// Now add more operations
|
|
134
|
+
const newOperations = [
|
|
135
|
+
...initialOperations,
|
|
136
|
+
{
|
|
137
|
+
id: "2",
|
|
138
|
+
name: "DELETE_VALUE",
|
|
139
|
+
description: null,
|
|
140
|
+
errors: [],
|
|
141
|
+
examples: [],
|
|
142
|
+
reducer: null,
|
|
143
|
+
schema: null,
|
|
144
|
+
template: null,
|
|
145
|
+
scope: "global",
|
|
146
|
+
hasInput: false,
|
|
147
|
+
hasAttachment: false,
|
|
148
|
+
state: "",
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
const updatedContext = {
|
|
152
|
+
...context,
|
|
153
|
+
operations: newOperations,
|
|
154
|
+
};
|
|
155
|
+
await generator.generate(updatedContext);
|
|
156
|
+
const expectedPath = "/test/document-model/my-doc/src/reducers/my-module.ts";
|
|
157
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
158
|
+
const content = sourceFile.getFullText();
|
|
159
|
+
// Should have both methods
|
|
160
|
+
expect(content).toContain("setValueOperation(state, action) {");
|
|
161
|
+
expect(content).toContain("deleteValueOperation(state, action) {");
|
|
162
|
+
// Should only have one import and one reducer declaration
|
|
163
|
+
const importMatches = content.match(/import type/g);
|
|
164
|
+
expect(importMatches).toHaveLength(1);
|
|
165
|
+
const { typeImportName, operationHandlersObjectName } = makeVariableAndTypeNamesFromContext(context);
|
|
166
|
+
const reducerMatches = content.match(`export const ${operationHandlersObjectName}: ${typeImportName} = {`);
|
|
167
|
+
expect(reducerMatches).toHaveLength(1);
|
|
168
|
+
});
|
|
169
|
+
it("should update existing reducer type when different", async () => {
|
|
170
|
+
const context = {
|
|
171
|
+
rootDir: "/test",
|
|
172
|
+
packageName: "test",
|
|
173
|
+
docModel: { name: "TestDoc" },
|
|
174
|
+
module: { name: "firstModule" },
|
|
175
|
+
project,
|
|
176
|
+
operations: [
|
|
177
|
+
{
|
|
178
|
+
id: "1",
|
|
179
|
+
name: "SET_VALUE",
|
|
180
|
+
description: null,
|
|
181
|
+
errors: [],
|
|
182
|
+
examples: [],
|
|
183
|
+
reducer: null,
|
|
184
|
+
schema: null,
|
|
185
|
+
template: null,
|
|
186
|
+
scope: "global",
|
|
187
|
+
hasInput: true,
|
|
188
|
+
hasAttachment: false,
|
|
189
|
+
state: "",
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
forceUpdate: false,
|
|
193
|
+
};
|
|
194
|
+
// Generate first time
|
|
195
|
+
await generator.generate(context);
|
|
196
|
+
const filePath = "/test/document-model/test-doc/src/reducers/first-module.ts";
|
|
197
|
+
let sourceFile = project.getSourceFile(filePath);
|
|
198
|
+
let content = sourceFile.getFullText();
|
|
199
|
+
const typeImportPath = `${context.packageName}/document-models/${paramCase(context.docModel.name)}`;
|
|
200
|
+
const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
201
|
+
const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
202
|
+
expect(content).toContain(`import type { ${typeImportName} } from "${typeImportPath}";`);
|
|
203
|
+
expect(content).toContain(`export const ${operationHandlersObjectName}: ${typeImportName} = {`);
|
|
204
|
+
// Manually change the reducer variable type to simulate an outdated file
|
|
205
|
+
const reducerVar = sourceFile.getVariableDeclaration(operationHandlersObjectName);
|
|
206
|
+
reducerVar.setType(`Old${typeImportName}`);
|
|
207
|
+
// Generate again - should update the type
|
|
208
|
+
await generator.generate(context);
|
|
209
|
+
sourceFile = project.getSourceFile(filePath);
|
|
210
|
+
content = sourceFile.getFullText();
|
|
211
|
+
// Should have the correct type now
|
|
212
|
+
expect(content).toContain(operationHandlersObjectName);
|
|
213
|
+
expect(content).not.toContain(`Old${typeImportName}`);
|
|
214
|
+
});
|
|
215
|
+
it("should skip generation when no operations provided", async () => {
|
|
216
|
+
const context = {
|
|
217
|
+
rootDir: "/test",
|
|
218
|
+
packageName: "test",
|
|
219
|
+
docModel: { name: "TestDoc" },
|
|
220
|
+
module: { name: "emptyModule" },
|
|
221
|
+
project,
|
|
222
|
+
operations: [], // No operations
|
|
223
|
+
forceUpdate: false,
|
|
224
|
+
};
|
|
225
|
+
await generator.generate(context);
|
|
226
|
+
// Should not create any files
|
|
227
|
+
const expectedPath = "/test/document-model/test-doc/src/reducers/empty-module.ts";
|
|
228
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
229
|
+
expect(sourceFile).toBeUndefined();
|
|
230
|
+
});
|
|
231
|
+
it("should handle special characters and case conversion correctly", async () => {
|
|
232
|
+
const operations = [
|
|
233
|
+
{
|
|
234
|
+
id: "1",
|
|
235
|
+
name: "SET_SPECIAL_VALUE",
|
|
236
|
+
description: null,
|
|
237
|
+
errors: [],
|
|
238
|
+
examples: [],
|
|
239
|
+
reducer: null,
|
|
240
|
+
schema: null,
|
|
241
|
+
template: null,
|
|
242
|
+
scope: "global",
|
|
243
|
+
hasInput: true,
|
|
244
|
+
hasAttachment: false,
|
|
245
|
+
state: "",
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
const context = {
|
|
249
|
+
rootDir: "/test",
|
|
250
|
+
packageName: "test",
|
|
251
|
+
docModel: { name: "test_doc_name" },
|
|
252
|
+
module: { name: "test_module_name" },
|
|
253
|
+
project,
|
|
254
|
+
operations,
|
|
255
|
+
forceUpdate: false,
|
|
256
|
+
};
|
|
257
|
+
await generator.generate(context);
|
|
258
|
+
const { typeImportPath, typeImportName, operationHandlersObjectName } = makeVariableAndTypeNamesFromContext(context);
|
|
259
|
+
const expectedPath = "/test/document-model/test-doc-name/src/reducers/test-module-name.ts";
|
|
260
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
261
|
+
const content = sourceFile.getFullText();
|
|
262
|
+
// Check PascalCase type name
|
|
263
|
+
expect(content).toContain(typeImportName);
|
|
264
|
+
// Check param-case import path
|
|
265
|
+
expect(content).toContain(`import type { ${typeImportName} } from "${typeImportPath}";`);
|
|
266
|
+
// Check camelCase method name
|
|
267
|
+
expect(content).toContain("setSpecialValueOperation(state, action)");
|
|
268
|
+
});
|
|
269
|
+
it("should skip operations with null or empty names", async () => {
|
|
270
|
+
const operations = [
|
|
271
|
+
{
|
|
272
|
+
id: "1",
|
|
273
|
+
name: "VALID_ACTION",
|
|
274
|
+
description: null,
|
|
275
|
+
errors: [],
|
|
276
|
+
examples: [],
|
|
277
|
+
reducer: null,
|
|
278
|
+
schema: null,
|
|
279
|
+
template: null,
|
|
280
|
+
scope: "global",
|
|
281
|
+
hasInput: true,
|
|
282
|
+
hasAttachment: false,
|
|
283
|
+
state: "",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: "2",
|
|
287
|
+
name: null, // Should be skipped
|
|
288
|
+
description: null,
|
|
289
|
+
errors: [],
|
|
290
|
+
examples: [],
|
|
291
|
+
reducer: null,
|
|
292
|
+
schema: null,
|
|
293
|
+
template: null,
|
|
294
|
+
scope: "global",
|
|
295
|
+
hasInput: false,
|
|
296
|
+
hasAttachment: false,
|
|
297
|
+
state: "",
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: "3",
|
|
301
|
+
name: "", // Should be skipped
|
|
302
|
+
description: null,
|
|
303
|
+
errors: [],
|
|
304
|
+
examples: [],
|
|
305
|
+
reducer: null,
|
|
306
|
+
schema: null,
|
|
307
|
+
template: null,
|
|
308
|
+
scope: "global",
|
|
309
|
+
hasInput: false,
|
|
310
|
+
hasAttachment: false,
|
|
311
|
+
state: "",
|
|
312
|
+
},
|
|
313
|
+
];
|
|
314
|
+
const context = {
|
|
315
|
+
rootDir: "/test",
|
|
316
|
+
packageName: "test",
|
|
317
|
+
docModel: { name: "TestDoc" },
|
|
318
|
+
module: { name: "testModule" },
|
|
319
|
+
project,
|
|
320
|
+
operations,
|
|
321
|
+
forceUpdate: false,
|
|
322
|
+
};
|
|
323
|
+
await generator.generate(context);
|
|
324
|
+
const expectedPath = "/test/document-model/test-doc/src/reducers/test-module.ts";
|
|
325
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
326
|
+
const content = sourceFile.getFullText();
|
|
327
|
+
// Should only have the valid operation method
|
|
328
|
+
expect(content).toContain("validActionOperation(state, action)");
|
|
329
|
+
// Should not have methods for null/empty names
|
|
330
|
+
const methodMatches = content.match(/Operation\(state, action\)/g);
|
|
331
|
+
expect(methodMatches).toHaveLength(1); // Only one method
|
|
332
|
+
});
|
|
333
|
+
it("should generate custom reducer code when provided", async () => {
|
|
334
|
+
const operations = [
|
|
335
|
+
{
|
|
336
|
+
id: "1",
|
|
337
|
+
name: "SET_VALUE",
|
|
338
|
+
description: null,
|
|
339
|
+
errors: [],
|
|
340
|
+
examples: [],
|
|
341
|
+
reducer: "state.value = action.input.value;\nreturn state;",
|
|
342
|
+
schema: null,
|
|
343
|
+
template: null,
|
|
344
|
+
scope: "global",
|
|
345
|
+
hasInput: true,
|
|
346
|
+
hasAttachment: false,
|
|
347
|
+
state: "",
|
|
348
|
+
},
|
|
349
|
+
];
|
|
350
|
+
const context = {
|
|
351
|
+
rootDir: "/test",
|
|
352
|
+
packageName: "test",
|
|
353
|
+
docModel: { name: "TestDoc" },
|
|
354
|
+
module: { name: "testModule" },
|
|
355
|
+
project,
|
|
356
|
+
operations,
|
|
357
|
+
forceUpdate: false,
|
|
358
|
+
};
|
|
359
|
+
await generator.generate(context);
|
|
360
|
+
const expectedPath = "/test/document-model/test-doc/src/reducers/test-module.ts";
|
|
361
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
362
|
+
const content = sourceFile.getFullText();
|
|
363
|
+
// Should contain custom reducer code instead of TODO
|
|
364
|
+
expect(content).toContain("state.value = action.input.value;");
|
|
365
|
+
expect(content).toContain("return state;");
|
|
366
|
+
expect(content).not.toContain('// TODO: Implement "setValueOperation" reducer');
|
|
367
|
+
expect(content).not.toContain("throw new Error");
|
|
368
|
+
});
|
|
369
|
+
it("should update existing reducer when forceUpdate is true", async () => {
|
|
370
|
+
// First, create a reducer with default implementation
|
|
371
|
+
const initialOperations = [
|
|
372
|
+
{
|
|
373
|
+
id: "1",
|
|
374
|
+
name: "SET_VALUE",
|
|
375
|
+
description: null,
|
|
376
|
+
errors: [],
|
|
377
|
+
examples: [],
|
|
378
|
+
reducer: null,
|
|
379
|
+
schema: null,
|
|
380
|
+
template: null,
|
|
381
|
+
scope: "global",
|
|
382
|
+
hasInput: true,
|
|
383
|
+
hasAttachment: false,
|
|
384
|
+
state: "",
|
|
385
|
+
},
|
|
386
|
+
];
|
|
387
|
+
const context = {
|
|
388
|
+
rootDir: "/test",
|
|
389
|
+
packageName: "test",
|
|
390
|
+
docModel: { name: "TestDoc" },
|
|
391
|
+
module: { name: "testModule" },
|
|
392
|
+
project,
|
|
393
|
+
operations: initialOperations,
|
|
394
|
+
forceUpdate: false,
|
|
395
|
+
};
|
|
396
|
+
await generator.generate(context);
|
|
397
|
+
const expectedPath = "/test/document-model/test-doc/src/reducers/test-module.ts";
|
|
398
|
+
let sourceFile = project.getSourceFile(expectedPath);
|
|
399
|
+
let content = sourceFile.getFullText();
|
|
400
|
+
// Should have default TODO implementation
|
|
401
|
+
expect(content).toContain('// TODO: Implement "setValueOperation" reducer');
|
|
402
|
+
// Now update with custom reducer code and forceUpdate = true
|
|
403
|
+
const updatedOperations = [
|
|
404
|
+
{
|
|
405
|
+
id: "1",
|
|
406
|
+
name: "SET_VALUE",
|
|
407
|
+
description: null,
|
|
408
|
+
errors: [],
|
|
409
|
+
examples: [],
|
|
410
|
+
reducer: "state.customValue = action.input.value;\nreturn state;",
|
|
411
|
+
schema: null,
|
|
412
|
+
template: null,
|
|
413
|
+
scope: "global",
|
|
414
|
+
hasInput: true,
|
|
415
|
+
hasAttachment: false,
|
|
416
|
+
state: "",
|
|
417
|
+
},
|
|
418
|
+
];
|
|
419
|
+
const updatedContext = {
|
|
420
|
+
...context,
|
|
421
|
+
operations: updatedOperations,
|
|
422
|
+
forceUpdate: true,
|
|
423
|
+
};
|
|
424
|
+
await generator.generate(updatedContext);
|
|
425
|
+
sourceFile = project.getSourceFile(expectedPath);
|
|
426
|
+
content = sourceFile.getFullText();
|
|
427
|
+
// Should now have custom implementation
|
|
428
|
+
expect(content).toContain("state.customValue = action.input.value;");
|
|
429
|
+
expect(content).not.toContain('// TODO: Implement "setValueOperation" reducer');
|
|
430
|
+
});
|
|
431
|
+
it("should not update existing reducer when forceUpdate is false", async () => {
|
|
432
|
+
// First, create a reducer with default implementation
|
|
433
|
+
const initialOperations = [
|
|
434
|
+
{
|
|
435
|
+
id: "1",
|
|
436
|
+
name: "SET_VALUE",
|
|
437
|
+
description: null,
|
|
438
|
+
errors: [],
|
|
439
|
+
examples: [],
|
|
440
|
+
reducer: null,
|
|
441
|
+
schema: null,
|
|
442
|
+
template: null,
|
|
443
|
+
scope: "global",
|
|
444
|
+
hasInput: true,
|
|
445
|
+
hasAttachment: false,
|
|
446
|
+
state: "",
|
|
447
|
+
},
|
|
448
|
+
];
|
|
449
|
+
const context = {
|
|
450
|
+
rootDir: "/test",
|
|
451
|
+
packageName: "test",
|
|
452
|
+
docModel: { name: "TestDoc" },
|
|
453
|
+
module: { name: "testModule" },
|
|
454
|
+
project,
|
|
455
|
+
operations: initialOperations,
|
|
456
|
+
forceUpdate: false,
|
|
457
|
+
};
|
|
458
|
+
await generator.generate(context);
|
|
459
|
+
// Now try to update with custom reducer code but forceUpdate = false
|
|
460
|
+
const updatedOperations = [
|
|
461
|
+
{
|
|
462
|
+
id: "1",
|
|
463
|
+
name: "SET_VALUE",
|
|
464
|
+
description: null,
|
|
465
|
+
errors: [],
|
|
466
|
+
examples: [],
|
|
467
|
+
reducer: "state.customValue = action.input.value;\nreturn state;",
|
|
468
|
+
schema: null,
|
|
469
|
+
template: null,
|
|
470
|
+
scope: "global",
|
|
471
|
+
hasInput: true,
|
|
472
|
+
hasAttachment: false,
|
|
473
|
+
state: "",
|
|
474
|
+
},
|
|
475
|
+
];
|
|
476
|
+
const updatedContext = {
|
|
477
|
+
...context,
|
|
478
|
+
operations: updatedOperations,
|
|
479
|
+
forceUpdate: false,
|
|
480
|
+
};
|
|
481
|
+
await generator.generate(updatedContext);
|
|
482
|
+
const expectedPath = "/test/document-model/test-doc/src/reducers/test-module.ts";
|
|
483
|
+
const sourceFile = project.getSourceFile(expectedPath);
|
|
484
|
+
const content = sourceFile.getFullText();
|
|
485
|
+
// Should still have original TODO implementation
|
|
486
|
+
expect(content).toContain('// TODO: Implement "setValueOperation" reducer');
|
|
487
|
+
expect(content).not.toContain("state.customValue = action.input.value;");
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
});
|
|
491
|
+
//# sourceMappingURL=ReducerGenerator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReducerGenerator.test.js","sourceRoot":"","sources":["../../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AAc,CAAC,CAAC;YAEzC,MAAM,YAAY,GAChB,2DAA2D,CAAC;YAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACvD,MAAM,OAAO,GAAG,UAAW,CAAC,WAAW,EAAE,CAAC;YAE1C,iDAAiD;YACjD,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CACvB,gDAAgD,CACjD,CAAC;YACF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { DirectoryManager, ImportManager } from "@powerhousedao/codegen";
|
|
2
|
+
import type { DeclarationManager } from "../utilities/DeclarationManager.js";
|
|
2
3
|
import type { GenerationContext } from "./GenerationContext.js";
|
|
3
4
|
export declare abstract class FileGenerator {
|
|
4
5
|
protected importManager: ImportManager;
|
|
5
6
|
protected directoryManager: DirectoryManager;
|
|
6
|
-
|
|
7
|
+
protected declarationManager: DeclarationManager;
|
|
8
|
+
constructor(importManager: ImportManager, directoryManager: DirectoryManager, declarationManager: DeclarationManager);
|
|
7
9
|
abstract generate(context: GenerationContext): Promise<void>;
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=FileGenerator.d.ts.map
|
|
@@ -1 +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;
|
|
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,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,8BAAsB,aAAa;IAE/B,SAAS,CAAC,aAAa,EAAE,aAAa;IACtC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB;IAC5C,SAAS,CAAC,kBAAkB,EAAE,kBAAkB;gBAFtC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB;IAGlD,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAC7D"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export class FileGenerator {
|
|
2
2
|
importManager;
|
|
3
3
|
directoryManager;
|
|
4
|
-
|
|
4
|
+
declarationManager;
|
|
5
|
+
constructor(importManager, directoryManager, declarationManager) {
|
|
5
6
|
this.importManager = importManager;
|
|
6
7
|
this.directoryManager = directoryManager;
|
|
8
|
+
this.declarationManager = declarationManager;
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=FileGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileGenerator.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/FileGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileGenerator.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/FileGenerator.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,aAAa;IAErB;IACA;IACA;IAHZ,YACY,aAA4B,EAC5B,gBAAkC,EAClC,kBAAsC;QAFtC,kBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC/C,CAAC;CAGL"}
|
|
@@ -1 +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"}
|
|
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,WAAW,EAAE,MAAM,CAAC;IACpB,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"}
|
|
@@ -1 +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;
|
|
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;IAgCzD,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAOpC,OAAO,CAAC,eAAe;IAyEvB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,mBAAmB;IAkD3B,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,oBAAoB;CAK7B"}
|
|
@@ -8,13 +8,14 @@ export class ReducerGenerator extends FileGenerator {
|
|
|
8
8
|
return;
|
|
9
9
|
const filePath = this.getOutputPath(context);
|
|
10
10
|
const sourceFile = await this.directoryManager.createSourceFile(context.project, filePath);
|
|
11
|
+
const packageName = context.packageName;
|
|
11
12
|
// Reducer-specific import logic
|
|
12
13
|
const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
13
|
-
const typeImportPath =
|
|
14
|
+
const typeImportPath = `${packageName}/document-models/${paramCase(context.docModel.name)}`;
|
|
14
15
|
// Import management (shared utility)
|
|
15
|
-
this.importManager.
|
|
16
|
+
this.importManager.replaceImportByName(sourceFile, typeImportName, typeImportPath, true);
|
|
16
17
|
// AST logic (specific to reducers)
|
|
17
|
-
this.createReducerObject(sourceFile, typeImportName, context
|
|
18
|
+
this.createReducerObject(sourceFile, typeImportName, context);
|
|
18
19
|
// Detect and import error classes used in the actual reducer code (after generation)
|
|
19
20
|
this.addErrorImports(sourceFile, context);
|
|
20
21
|
await sourceFile.save();
|
|
@@ -81,21 +82,27 @@ export class ReducerGenerator extends FileGenerator {
|
|
|
81
82
|
getOutputPath(context) {
|
|
82
83
|
return this.directoryManager.getReducerPath(context.rootDir, context.docModel.name, context.module.name);
|
|
83
84
|
}
|
|
84
|
-
createReducerObject(sourceFile, typeName,
|
|
85
|
-
|
|
85
|
+
createReducerObject(sourceFile, typeName, context) {
|
|
86
|
+
const { operations, forceUpdate } = context;
|
|
87
|
+
const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
|
|
88
|
+
const legacyReducerVar = sourceFile.getVariableDeclaration("reducer");
|
|
89
|
+
if (legacyReducerVar) {
|
|
90
|
+
this.declarationManager.renameVariable(sourceFile, "reducer", operationHandlersObjectName);
|
|
91
|
+
}
|
|
92
|
+
let reducerVar = sourceFile.getVariableDeclaration(operationHandlersObjectName);
|
|
86
93
|
if (!reducerVar) {
|
|
87
94
|
sourceFile.addVariableStatement({
|
|
88
95
|
declarationKind: VariableDeclarationKind.Const,
|
|
89
96
|
isExported: true,
|
|
90
97
|
declarations: [
|
|
91
98
|
{
|
|
92
|
-
name:
|
|
99
|
+
name: operationHandlersObjectName,
|
|
93
100
|
type: typeName,
|
|
94
101
|
initializer: "{}",
|
|
95
102
|
},
|
|
96
103
|
],
|
|
97
104
|
});
|
|
98
|
-
reducerVar = sourceFile.getVariableDeclarationOrThrow(
|
|
105
|
+
reducerVar = sourceFile.getVariableDeclarationOrThrow(operationHandlersObjectName);
|
|
99
106
|
}
|
|
100
107
|
else {
|
|
101
108
|
// Ensure correct type
|