@powerhousedao/codegen 4.1.0-dev.8 → 4.1.0-dev.80
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/README.md +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js +10 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +17 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/schema.esm.t +16 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +8 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +69 -54
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +93 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +9 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +6 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +20 -8
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +19 -26
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/error.esm.t +6 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +52 -27
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +21 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +64 -51
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +48 -26
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +213 -218
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +96 -67
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +2 -73
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.esm.t +8 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +12 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +87 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/hooks.esm.t +16 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +4 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +28 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js +8 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +5 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +5 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js +13 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.esm.t +8 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_call.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_import.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +6 -5
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +7 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js +13 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +8 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_call.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_import.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/schema.esm.t +10 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +5 -36
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js +9 -11
- package/dist/src/codegen/generate.d.ts +30 -0
- package/dist/src/codegen/generate.d.ts.map +1 -0
- package/dist/src/codegen/generate.js +199 -0
- package/dist/src/codegen/generate.js.map +1 -0
- package/dist/src/codegen/graphql.d.ts +2 -2
- package/dist/src/codegen/graphql.d.ts.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 +15 -10
- package/dist/src/codegen/hygen.d.ts.map +1 -1
- package/dist/src/codegen/hygen.js +47 -17
- package/dist/src/codegen/hygen.js.map +1 -1
- package/dist/src/codegen/index.d.ts +6 -32
- package/dist/src/codegen/index.d.ts.map +1 -1
- package/dist/src/codegen/index.js +6 -182
- package/dist/src/codegen/index.js.map +1 -1
- package/dist/src/codegen/types.d.ts +9 -0
- package/dist/src/codegen/types.d.ts.map +1 -0
- package/dist/src/codegen/types.js +2 -0
- package/dist/src/codegen/types.js.map +1 -0
- package/dist/src/codegen/utils.d.ts +5 -2
- package/dist/src/codegen/utils.d.ts.map +1 -1
- package/dist/src/codegen/utils.js +42 -4
- package/dist/src/codegen/utils.js.map +1 -1
- package/dist/src/create-lib/create-project.d.ts.map +1 -1
- package/dist/src/create-lib/create-project.js +17 -2
- package/dist/src/create-lib/create-project.js.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +2 -3
- package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/FileGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +18 -8
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts +12 -0
- package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts.map +1 -0
- package/dist/src/ts-morph-generator/core/ReducerGenerator.js +140 -0
- package/dist/src/ts-morph-generator/core/ReducerGenerator.js.map +1 -0
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +4 -3
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js +11 -10
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/index.d.ts +2 -2
- package/dist/src/ts-morph-generator/index.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/index.js +2 -2
- package/dist/src/ts-morph-generator/index.js.map +1 -1
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +2 -2
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +1 -1
- package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/validation.d.ts +6 -6
- package/dist/src/utils/validation.d.ts.map +1 -1
- package/dist/src/utils/validation.js +2 -2
- package/dist/src/utils/validation.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +25 -27
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.d.ts +0 -25
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/object.esm.t +0 -49
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts +0 -23
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t +0 -37
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.d.ts +0 -22
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EditorContainer.esm.t +0 -124
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FileItemsGrid.esm.t +0 -44
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderItemsGrid.esm.t +0 -96
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/hooks/useSelectedFolderChildren.esm.t +0 -35
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/hooks/useTransformedNodes.esm.t +0 -35
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/types/css.d.esm.t +0 -8
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.d.ts +0 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.d.ts +0 -14
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.d.ts +0 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.d.ts +0 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.d.ts +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js.map +0 -1
- package/dist/src/ts-morph-generator/core/index.d.ts +0 -4
- package/dist/src/ts-morph-generator/core/index.d.ts.map +0 -1
- package/dist/src/ts-morph-generator/core/index.js +0 -4
- package/dist/src/ts-morph-generator/core/index.js.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.d.ts +0 -9
- package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.d.ts.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.js +0 -69
- package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.js.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/index.d.ts +0 -2
- package/dist/src/ts-morph-generator/file-generators/index.d.ts.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/index.js +0 -2
- package/dist/src/ts-morph-generator/file-generators/index.js.map +0 -1
- package/dist/src/utils/package-manager.d.ts +0 -5
- package/dist/src/utils/package-manager.d.ts.map +0 -1
- package/dist/src/utils/package-manager.js +0 -17
- package/dist/src/utils/package-manager.js.map +0 -1
- package/dist/tsconfig.hygen.tsbuildinfo +0 -1
|
@@ -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" }, { name: "dispatch" }],
|
|
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,CAA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U,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;SAC1E,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;IAEO,oBAAoB,CAAC,OAA0B,EAAE,IAAa;QACpE,OAAO,CAAC,aAAa,CACnB,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAC1E,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { DocumentModelGlobalState } from "document-model";
|
|
2
|
+
import type { CodeGeneratorOptions } from "./GenerationContext.js";
|
|
3
3
|
export declare class TSMorphCodeGenerator {
|
|
4
4
|
private rootDir;
|
|
5
5
|
private docModels;
|
|
6
6
|
private project;
|
|
7
7
|
private generators;
|
|
8
8
|
private directories;
|
|
9
|
-
|
|
9
|
+
private forceUpdate;
|
|
10
|
+
constructor(rootDir: string, docModels: DocumentModelGlobalState[], options?: CodeGeneratorOptions);
|
|
10
11
|
private setupGenerators;
|
|
11
12
|
generateReducers(): Promise<void>;
|
|
12
13
|
generateAll(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TSMorphCodeGenerator.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { DirectoryManager, ImportManager } from "@powerhousedao/codegen";
|
|
1
2
|
import fs from "fs/promises";
|
|
2
3
|
import { Project } from "ts-morph";
|
|
3
|
-
import { ReducerGenerator } from "
|
|
4
|
-
import { DirectoryManager } from "../utilities/DirectoryManager.js";
|
|
5
|
-
import { ImportManager } from "../utilities/ImportManager.js";
|
|
4
|
+
import { ReducerGenerator } from "./ReducerGenerator.js";
|
|
6
5
|
export class TSMorphCodeGenerator {
|
|
7
6
|
rootDir;
|
|
8
7
|
docModels;
|
|
@@ -14,13 +13,15 @@ export class TSMorphCodeGenerator {
|
|
|
14
13
|
processorsDir: "processors",
|
|
15
14
|
subgraphsDir: "subgraphs",
|
|
16
15
|
};
|
|
17
|
-
|
|
16
|
+
forceUpdate = false;
|
|
17
|
+
constructor(rootDir, docModels, options = { directories: {}, forceUpdate: false }) {
|
|
18
18
|
this.rootDir = rootDir;
|
|
19
19
|
this.docModels = docModels;
|
|
20
20
|
this.directories = {
|
|
21
21
|
...this.directories,
|
|
22
22
|
...options.directories,
|
|
23
23
|
};
|
|
24
|
+
this.forceUpdate = options.forceUpdate ?? false;
|
|
24
25
|
this.setupGenerators();
|
|
25
26
|
}
|
|
26
27
|
setupGenerators() {
|
|
@@ -48,7 +49,7 @@ export class TSMorphCodeGenerator {
|
|
|
48
49
|
for (const docModel of this.docModels) {
|
|
49
50
|
const latestSpec = docModel.specifications[docModel.specifications.length - 1];
|
|
50
51
|
for (const module of latestSpec.modules) {
|
|
51
|
-
const context = this.createGenerationContext(docModel, module);
|
|
52
|
+
const context = this.createGenerationContext(docModel, module, this.forceUpdate);
|
|
52
53
|
await generator.generate(context);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -82,21 +83,21 @@ export class TSMorphCodeGenerator {
|
|
|
82
83
|
this.project.addSourceFilesAtPaths(sourcePaths);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
createGenerationContext(docModel, module) {
|
|
86
|
-
const
|
|
87
|
-
|
|
86
|
+
createGenerationContext(docModel, module, forceUpdate = false) {
|
|
87
|
+
const operations = module.operations.map((op) => ({
|
|
88
|
+
...op,
|
|
88
89
|
hasInput: op.schema !== null,
|
|
89
90
|
hasAttachment: op.schema?.includes(": Attachment"),
|
|
90
91
|
scope: op.scope || "global",
|
|
91
92
|
state: op.scope === "global" ? "" : op.scope,
|
|
92
|
-
errors: op.errors,
|
|
93
93
|
}));
|
|
94
94
|
return {
|
|
95
95
|
rootDir: this.rootDir,
|
|
96
96
|
docModel,
|
|
97
97
|
module,
|
|
98
98
|
project: this.project,
|
|
99
|
-
|
|
99
|
+
operations,
|
|
100
|
+
forceUpdate,
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
async ensureDirectoryExists(dirPath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TSMorphCodeGenerator.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TSMorphCodeGenerator.js","sourceRoot":"","sources":["../../../../src/ts-morph-generator/core/TSMorphCode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AM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACpE,GAAG,EAAE;YACL,QAAQ,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI;YAC5B,aAAa,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;YAClD,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,QAAQ;YAC3B,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;SAC7C,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ;YACR,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU;YACV,WAAW;SACZ,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,OAAe;QACjD,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,+BAA+B,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;YAC7D,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./core/
|
|
2
|
-
export
|
|
1
|
+
export * from "./core/GenerationContext.js";
|
|
2
|
+
export { TSMorphCodeGenerator } from "./core/TSMorphCodeGenerator.js";
|
|
3
3
|
export * from "./utilities/index.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ts-morph-generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ts-morph-generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./core/
|
|
2
|
-
export
|
|
1
|
+
export * from "./core/GenerationContext.js";
|
|
2
|
+
export { TSMorphCodeGenerator } from "./core/TSMorphCodeGenerator.js";
|
|
3
3
|
export * from "./utilities/index.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ts-morph-generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ts-morph-generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Project, SourceFile } from "ts-morph";
|
|
2
|
+
import type { PHProjectDirectories } from "@powerhousedao/codegen";
|
|
3
3
|
export declare class DirectoryManager {
|
|
4
4
|
private directories;
|
|
5
5
|
constructor(directories?: PHProjectDirectories);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectoryManager.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/utilities/DirectoryManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DirectoryManager.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/utilities/DirectoryManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,WAAW,CAKjB;gBAEU,WAAW,GAAE,oBAAyB;IAM5C,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlD,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM;IAWT,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM;IAWT,gBAAgB,CACd,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,MAAM;IAWT,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAUrD,gBAAgB,CACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC;CAOvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportManager.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/utilities/ImportManager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ImportManager.d.ts","sourceRoot":"","sources":["../../../../src/ts-morph-generator/utilities/ImportManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,aAAa;IACxB,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAazD,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ3E,eAAe,CACb,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,GACX,IAAI;IAOP,OAAO,CAAC,YAAY;CAkBrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
package/dist/src/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DocumentModelGlobalState } from "document-model";
|
|
2
2
|
/**
|
|
3
|
-
* Validation result for
|
|
3
|
+
* Validation result for DocumentModelGlobalState code generation requirements
|
|
4
4
|
*/
|
|
5
5
|
export interface DocumentModelStateValidationResult {
|
|
6
|
-
/** Whether the
|
|
6
|
+
/** Whether the DocumentModelGlobalState is valid for code generation */
|
|
7
7
|
isValid: boolean;
|
|
8
8
|
/** Array of validation error messages if validation fails */
|
|
9
9
|
errors: string[];
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Validates that a
|
|
12
|
+
* Validates that a DocumentModelGlobalState has all required properties for successful code generation.
|
|
13
13
|
*
|
|
14
|
-
* @param documentModelState - The
|
|
14
|
+
* @param documentModelState - The DocumentModelGlobalState to validate
|
|
15
15
|
* @returns Validation result with isValid flag and error messages
|
|
16
16
|
*/
|
|
17
|
-
export declare function validateDocumentModelState(documentModelState:
|
|
17
|
+
export declare function validateDocumentModelState(documentModelState: DocumentModelGlobalState): DocumentModelStateValidationResult;
|
|
18
18
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,wBAAwB,GAC3C,kCAAkC,CAsMpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Validates that a
|
|
2
|
+
* Validates that a DocumentModelGlobalState has all required properties for successful code generation.
|
|
3
3
|
*
|
|
4
|
-
* @param documentModelState - The
|
|
4
|
+
* @param documentModelState - The DocumentModelGlobalState to validate
|
|
5
5
|
* @returns Validation result with isValid flag and error messages
|
|
6
6
|
*/
|
|
7
7
|
export function validateDocumentModelState(documentModelState) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,kBAA4C;IAE5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,yCAAyC;IACzC,IACE,CAAC,kBAAkB,CAAC,EAAE;QACtB,OAAO,kBAAkB,CAAC,EAAE,KAAK,QAAQ;QACzC,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EACnC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;IAED,IACE,CAAC,kBAAkB,CAAC,IAAI;QACxB,OAAO,kBAAkB,CAAC,IAAI,KAAK,QAAQ;QAC3C,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EACrC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IAC5E,CAAC;IAED,IACE,CAAC,kBAAkB,CAAC,SAAS;QAC7B,OAAO,kBAAkB,CAAC,SAAS,KAAK,QAAQ;QAChD,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,EAC1C,CAAC;QACD,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;IACJ,CAAC;IAED,gCAAgC;IAChC,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC;QACjD,kBAAkB,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAC9C,CAAC;QACD,MAAM,CAAC,IAAI,CACT,qEAAqE,CACtE,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACpC,CAAC;IAED,yDAAyD;IACzD,MAAM,UAAU,GACd,kBAAkB,CAAC,cAAc,CAC/B,kBAAkB,CAAC,cAAc,C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