@mxpicture/gcp-functions-generator 1.1.49 → 1.1.51
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/4testing/templates/template.medication.d.ts.map +1 -1
- package/dist/4testing/templates/template.medication.js +5 -1
- package/dist/4testing/templates/template.medication.js.map +1 -1
- package/dist/common/CodeCollector.d.ts +11 -0
- package/dist/common/CodeCollector.d.ts.map +1 -0
- package/dist/common/CodeCollector.js +29 -0
- package/dist/common/CodeCollector.js.map +1 -0
- package/dist/common/generator.common.d.ts.map +1 -1
- package/dist/common/generator.common.js +3 -1
- package/dist/common/generator.common.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/generator/Generator.d.ts +9 -7
- package/dist/generator/Generator.d.ts.map +1 -1
- package/dist/generator/Generator.js +19 -29
- package/dist/generator/Generator.js.map +1 -1
- package/dist/generator/GeneratorAnnotations.d.ts +4 -2
- package/dist/generator/GeneratorAnnotations.d.ts.map +1 -1
- package/dist/generator/GeneratorAnnotations.js +22 -30
- package/dist/generator/GeneratorAnnotations.js.map +1 -1
- package/dist/generator/GeneratorBackend.d.ts +3 -2
- package/dist/generator/GeneratorBackend.d.ts.map +1 -1
- package/dist/generator/GeneratorBackend.js +23 -60
- package/dist/generator/GeneratorBackend.js.map +1 -1
- package/dist/generator/GeneratorDoc.d.ts +8 -6
- package/dist/generator/GeneratorDoc.d.ts.map +1 -1
- package/dist/generator/GeneratorDoc.js +29 -43
- package/dist/generator/GeneratorDoc.js.map +1 -1
- package/dist/generator/GeneratorEnum.d.ts +6 -4
- package/dist/generator/GeneratorEnum.d.ts.map +1 -1
- package/dist/generator/GeneratorEnum.js +11 -12
- package/dist/generator/GeneratorEnum.js.map +1 -1
- package/dist/generator/GeneratorFrontend.d.ts +4 -2
- package/dist/generator/GeneratorFrontend.d.ts.map +1 -1
- package/dist/generator/GeneratorFrontend.js +33 -48
- package/dist/generator/GeneratorFrontend.js.map +1 -1
- package/dist/generator/GeneratorRoutes.d.ts +6 -4
- package/dist/generator/GeneratorRoutes.d.ts.map +1 -1
- package/dist/generator/GeneratorRoutes.js +24 -38
- package/dist/generator/GeneratorRoutes.js.map +1 -1
- package/dist/generator/GeneratorZod.d.ts +4 -2
- package/dist/generator/GeneratorZod.d.ts.map +1 -1
- package/dist/generator/GeneratorZod.js +9 -20
- package/dist/generator/GeneratorZod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.medication.d.ts","sourceRoot":"","sources":["../../../src/4testing/templates/template.medication.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,+
|
|
1
|
+
{"version":3,"file":"template.medication.d.ts","sourceRoot":"","sources":["../../../src/4testing/templates/template.medication.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,+DAkFnB,CAAC"}
|
|
@@ -12,6 +12,8 @@ export const medication = decorator("Medication")
|
|
|
12
12
|
responseType: "{test:boolean}",
|
|
13
13
|
},
|
|
14
14
|
})
|
|
15
|
+
.register("reg_head_basename")
|
|
16
|
+
.register("reg_head_static", "static_head_value")
|
|
15
17
|
.properties({
|
|
16
18
|
id: decoString()
|
|
17
19
|
.key()
|
|
@@ -53,7 +55,9 @@ export const medication = decorator("Medication")
|
|
|
53
55
|
.sortable()
|
|
54
56
|
.filterable()
|
|
55
57
|
.default(0)
|
|
56
|
-
.sideEffects()
|
|
58
|
+
.sideEffects()
|
|
59
|
+
.register("reg_prop_propertyKey")
|
|
60
|
+
.register("reg_prop_static", "static_prop_value"),
|
|
57
61
|
orderMail: decoString()
|
|
58
62
|
.title("Order Mail")
|
|
59
63
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.medication.js","sourceRoot":"","sources":["../../../src/4testing/templates/template.medication.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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I,EAAE,UAAU,EAAE;SACf,KAAK,CAAC,MAAM,CAAC;SACb,QAAQ,EAAE;SACV,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,UAAU,EAAE;SACZ,OAAO,CAAC,CAAC,CAAC;IACb,KAAK,EAAE,UAAU,EAAE;SAChB,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,UAAU,EAAE;SACZ,OAAO,CAAC,CAAC,CAAC;SACV,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"template.medication.js","sourceRoot":"","sources":["../../../src/4testing/templates/template.medication.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,QAAQ,EACR,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,eAAe,CAC/B,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC;KAC9C,KAAK,CAAC,YAAY,CAAC;KACnB,SAAS,CAAC,QAAQ,CAAC;KACnB,IAAI,EAAE;KACN,UAAU,EAAE;KACZ,MAAM,CAAC;IACN,SAAS,EAAE;QACT,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,gBAAgB;KAC/B;CACF,CAAC;KACD,QAAQ,CAAC,mBAAmB,CAAC;KAC7B,QAAQ,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;KAChD,UAAU,CAAC;IACV,EAAE,EAAE,UAAU,EAAE;SACb,GAAG,EAAE;SACL,KAAK,CAAC,YAAY,CAAC;SACnB,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACzB,UAAU,EAAE,QAAQ,EAAE;SACnB,QAAQ,EA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,UAAU,EAAE;SAC5B,KAAK,CAAC,qBAAqB,CAAC;SAC5B,QAAQ,EAAE;SACV,OAAO,EAAE;IACZ,QAAQ,EAAE,QAAQ,EAAE;SACjB,KAAK,CAAC,WAAW,CAAC;SAClB,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC;IACnC,YAAY,EAAE,UAAU,EAAE;SACvB,KAAK,CAAC,eAAe,CAAC;SACtB,GAAG,CAAC,CAAC,CAAC;SACN,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,CAAC,CAAC;CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecoImport } from "@mxpicture/gcp-functions-common/types";
|
|
2
|
+
export declare class CodeCollector {
|
|
3
|
+
protected _code: string[];
|
|
4
|
+
protected _imports: DecoImport[];
|
|
5
|
+
constructor();
|
|
6
|
+
get code(): string[];
|
|
7
|
+
get imports(): DecoImport[];
|
|
8
|
+
addCode(...lines: string[]): this;
|
|
9
|
+
addImport(...imps: DecoImport[]): this;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CodeCollector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeCollector.d.ts","sourceRoot":"","sources":["../../src/common/CodeCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,qBAAa,aAAa;IACxB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,CAAM;IAC/B,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAM;;IAItC,IAAW,IAAI,IAAI,MAAM,EAAE,CAE1B;IAED,IAAW,OAAO,IAAI,UAAU,EAAE,CAEjC;IAEM,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI;CAe9C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class CodeCollector {
|
|
2
|
+
_code = [];
|
|
3
|
+
_imports = [];
|
|
4
|
+
constructor() { }
|
|
5
|
+
get code() {
|
|
6
|
+
return structuredClone(this._code);
|
|
7
|
+
}
|
|
8
|
+
get imports() {
|
|
9
|
+
return structuredClone(this._imports);
|
|
10
|
+
}
|
|
11
|
+
addCode(...lines) {
|
|
12
|
+
this._code.push(...lines);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
addImport(...imps) {
|
|
16
|
+
for (const imp of imps) {
|
|
17
|
+
let found = this._imports.find((i) => i.path === imp.path && i.isType === imp.isType);
|
|
18
|
+
if (!found) {
|
|
19
|
+
found = { path: imp.path, isType: imp.isType, props: [] };
|
|
20
|
+
this._imports.push(found);
|
|
21
|
+
}
|
|
22
|
+
for (const prop of imp.props)
|
|
23
|
+
if (!found.props.includes(prop))
|
|
24
|
+
found.props.push(prop);
|
|
25
|
+
}
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=CodeCollector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeCollector.js","sourceRoot":"","sources":["../../src/common/CodeCollector.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IACd,KAAK,GAAa,EAAE,CAAC;IACrB,QAAQ,GAAiB,EAAE,CAAC;IAEtC,gBAAsB,CAAC;IAEvB,IAAW,IAAI;QACb,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAEM,OAAO,CAAC,GAAG,KAAe;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAC1B,OAAO,IAAI,C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BlE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,KACf,OAAO,CAAC,aAAa,GAAG,IAAI,CAEzB,CAAC;AAEP;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,aAAa,KAClB,OAAO,CAAC,cAAc,GAAG,IAAI,CAY/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,cAAc,EAAE,CAOjE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,iBAAiB,EACzB,KAAK,YAAY,kBA4BlB,CAAC;AAUF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAClB,MAAM,QAAQ,EACd,KAAK,SAAS,EACd,KAAK,YAAY,KAChB,OAAO,CAAC,mBAAmB,CAK7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GACnB,OAAO,QAAQ,EAAE,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,KAChB,OAAO,CAAC,mBAAmB,EAAE,CAC4B,CAAC"}
|
|
@@ -69,7 +69,9 @@ export const createGenerators = async () => {
|
|
|
69
69
|
const files = await readGeneratorFiles();
|
|
70
70
|
const promises = files.map(createGenerator);
|
|
71
71
|
const entries = await Promise.all(promises);
|
|
72
|
-
|
|
72
|
+
const filtered = entries.filter((entry) => !!entry);
|
|
73
|
+
filtered.sort((a, b) => a.gen.order - b.gen.order);
|
|
74
|
+
return filtered;
|
|
73
75
|
};
|
|
74
76
|
/**
|
|
75
77
|
* Orchestrates the full code generation pipeline.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.common.js","sourceRoot":"","sources":["../../src/common/generator.common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAuB,MAAM,2BAA2B,CAAC;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,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/dist/common/index.js
CHANGED
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { DecoFile, DecoImport } from "@mxpicture/gcp-functions-common/types";
|
|
|
2
2
|
import { DecoFileType, DecoFileExtension, DecoTargetType, DecoNames, Decorator } from "@mxpicture/gcp-functions-common/decorator";
|
|
3
3
|
import { Collector } from "../common/Collector.js";
|
|
4
4
|
import { GeneratorEnv } from "../common/types.common.js";
|
|
5
|
+
import { CodeCollector } from "../common/CodeCollector.js";
|
|
6
|
+
import { Registry } from "@mxpicture/gcp-functions-common/helper";
|
|
5
7
|
/**
|
|
6
8
|
* Base structure shared by all generator outputs, containing imports and code lines.
|
|
7
9
|
*/
|
|
@@ -12,7 +14,7 @@ export interface GeneratorBase {
|
|
|
12
14
|
/**
|
|
13
15
|
* Generator output for a single decorator header, including a name identifier.
|
|
14
16
|
*/
|
|
15
|
-
export interface
|
|
17
|
+
export interface GeneratorHeader extends GeneratorBase {
|
|
16
18
|
name: string;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
@@ -60,6 +62,7 @@ export declare const importsToCodeAsync: (imports: DecoImport[]) => Promise<stri
|
|
|
60
62
|
* formatting, and writing to disk.
|
|
61
63
|
*/
|
|
62
64
|
export declare abstract class Generator {
|
|
65
|
+
readonly order: number;
|
|
63
66
|
readonly type: DecoFileType;
|
|
64
67
|
readonly ext: DecoFileExtension;
|
|
65
68
|
readonly targetType: DecoTargetType;
|
|
@@ -68,13 +71,15 @@ export declare abstract class Generator {
|
|
|
68
71
|
/**
|
|
69
72
|
* Creates a new generator.
|
|
70
73
|
*
|
|
74
|
+
* @param order - Execution order generators.
|
|
71
75
|
* @param type - The decorator file type this generator produces.
|
|
72
76
|
* @param ext - The output file extension.
|
|
73
77
|
* @param targetType - The target package (common, backend, frontend).
|
|
74
78
|
* @param collector - The shared collector for cross-generator lookups.
|
|
75
79
|
* @param useAdditionalImports - Whether to include additional imports from the decorator.
|
|
76
80
|
*/
|
|
77
|
-
constructor(type: DecoFileType, ext: DecoFileExtension, targetType: DecoTargetType, collector: Collector, useAdditionalImports?: boolean);
|
|
81
|
+
constructor(order: number, type: DecoFileType, ext: DecoFileExtension, targetType: DecoTargetType, collector: Collector, useAdditionalImports?: boolean);
|
|
82
|
+
get registry(): Registry;
|
|
78
83
|
/**
|
|
79
84
|
* Processes a decorator file by running all its headers through the generator.
|
|
80
85
|
*
|
|
@@ -119,12 +124,9 @@ export declare abstract class Generator {
|
|
|
119
124
|
* @returns The resolved import path.
|
|
120
125
|
*/
|
|
121
126
|
importBackend(fileType: DecoFileType): string;
|
|
122
|
-
protected
|
|
123
|
-
protected addImport(res: GeneratorResultFile, imp: DecoImport): void;
|
|
124
|
-
protected addImports(res: GeneratorResultFile, imports: DecoImport[]): void;
|
|
125
|
-
protected processHeader(curretItem: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv): Promise<(GeneratorCode & {
|
|
127
|
+
protected processHeader(curretItem: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv): Promise<(GeneratorHeader & {
|
|
126
128
|
inputFilePath: string;
|
|
127
129
|
}) | null>;
|
|
128
|
-
protected abstract runHeader(current: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv): Promise<
|
|
130
|
+
protected abstract runHeader(current: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv, result: CodeCollector): Promise<string | null>;
|
|
129
131
|
}
|
|
130
132
|
//# sourceMappingURL=Generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Generator.d.ts","sourceRoot":"","sources":["../../src/generator/Generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,uCA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,EACtB,GAAG,EAAE,YAAY,GAChB,OAAO,CAAC,CAAC,eAAe,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAwBhE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAC1B,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,iBAAiB,EACtB,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAC1B"}
|
|
@@ -5,6 +5,8 @@ import { directories } from "../common/Directories.js";
|
|
|
5
5
|
import { decoBackendNamesAsync, decoFrontendNamesAsync, decoNamesAsync, } from "../decorator/deco.names.js";
|
|
6
6
|
import { formatCode, formatJson } from "@mxpicture/build-api/code";
|
|
7
7
|
import { toFilename } from "../common/file.common.js";
|
|
8
|
+
import { CodeCollector } from "../common/CodeCollector.js";
|
|
9
|
+
import { Registry } from "@mxpicture/gcp-functions-common/helper";
|
|
8
10
|
const importToCode = (imp) => imp.props.length > 0
|
|
9
11
|
? `import ${imp.isType ? "type " : ""}{ ${[...imp.props].join(", ")} } from "${imp.path}"`
|
|
10
12
|
: null;
|
|
@@ -32,6 +34,7 @@ export const importsToCodeAsync = async (imports) => (await Promise.all(imports.
|
|
|
32
34
|
* formatting, and writing to disk.
|
|
33
35
|
*/
|
|
34
36
|
export class Generator {
|
|
37
|
+
order;
|
|
35
38
|
type;
|
|
36
39
|
ext;
|
|
37
40
|
targetType;
|
|
@@ -40,19 +43,24 @@ export class Generator {
|
|
|
40
43
|
/**
|
|
41
44
|
* Creates a new generator.
|
|
42
45
|
*
|
|
46
|
+
* @param order - Execution order generators.
|
|
43
47
|
* @param type - The decorator file type this generator produces.
|
|
44
48
|
* @param ext - The output file extension.
|
|
45
49
|
* @param targetType - The target package (common, backend, frontend).
|
|
46
50
|
* @param collector - The shared collector for cross-generator lookups.
|
|
47
51
|
* @param useAdditionalImports - Whether to include additional imports from the decorator.
|
|
48
52
|
*/
|
|
49
|
-
constructor(type, ext, targetType, collector, useAdditionalImports = false) {
|
|
53
|
+
constructor(order, type, ext, targetType, collector, useAdditionalImports = false) {
|
|
54
|
+
this.order = order;
|
|
50
55
|
this.type = type;
|
|
51
56
|
this.ext = ext;
|
|
52
57
|
this.targetType = targetType;
|
|
53
58
|
this.collector = collector;
|
|
54
59
|
this.useAdditionalImports = useAdditionalImports;
|
|
55
60
|
}
|
|
61
|
+
get registry() {
|
|
62
|
+
return Registry.instance();
|
|
63
|
+
}
|
|
56
64
|
/**
|
|
57
65
|
* Processes a decorator file by running all its headers through the generator.
|
|
58
66
|
*
|
|
@@ -64,6 +72,7 @@ export class Generator {
|
|
|
64
72
|
async run(file, env) {
|
|
65
73
|
let result = null;
|
|
66
74
|
const runHeaders = {};
|
|
75
|
+
const resultsCollector = new CodeCollector();
|
|
67
76
|
for (const decorator of file.decorators) {
|
|
68
77
|
const extr = decorator.extractRaw();
|
|
69
78
|
const names = this.targetType === DecoTargetType.backend
|
|
@@ -98,11 +107,13 @@ export class Generator {
|
|
|
98
107
|
type: this.type,
|
|
99
108
|
};
|
|
100
109
|
}
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
resultsCollector.addCode(...interfaceResult.code);
|
|
111
|
+
resultsCollector.addImport(...interfaceResult.imports);
|
|
103
112
|
}
|
|
104
113
|
if (!result)
|
|
105
114
|
throw new Error(`Generator ${this.type}, file ${file.templateRepoFilePath}: no headers provided`);
|
|
115
|
+
result.code = resultsCollector.code;
|
|
116
|
+
result.imports = resultsCollector.imports;
|
|
106
117
|
result.importsCode = await importsToCodeAsync(result.imports);
|
|
107
118
|
return result;
|
|
108
119
|
}
|
|
@@ -166,39 +177,18 @@ export class Generator {
|
|
|
166
177
|
importBackend(fileType) {
|
|
167
178
|
return this.resolveImport(DecoTargetType.backend, fileType);
|
|
168
179
|
}
|
|
169
|
-
addCode(res, code) {
|
|
170
|
-
if (res.code.length > 0)
|
|
171
|
-
res.code.push("");
|
|
172
|
-
res.code.push(...code);
|
|
173
|
-
}
|
|
174
|
-
addImport(res, imp) {
|
|
175
|
-
let foundImp = res.imports.find((i) => i.path === imp.path && i.isType === imp.isType);
|
|
176
|
-
if (!foundImp) {
|
|
177
|
-
foundImp = {
|
|
178
|
-
...imp,
|
|
179
|
-
props: [],
|
|
180
|
-
};
|
|
181
|
-
res.imports.push(foundImp);
|
|
182
|
-
}
|
|
183
|
-
for (const prop of imp.props)
|
|
184
|
-
if (!foundImp.props.find((p) => p === prop))
|
|
185
|
-
foundImp.props.push(prop);
|
|
186
|
-
}
|
|
187
|
-
addImports(res, imports) {
|
|
188
|
-
for (const imp of imports)
|
|
189
|
-
this.addImport(res, imp);
|
|
190
|
-
}
|
|
191
180
|
async processHeader(curretItem, all, env) {
|
|
192
181
|
const { decorator, names } = curretItem;
|
|
193
182
|
const raw = decorator.extractRaw();
|
|
194
183
|
this.collector.add(names.basename, this.targetType, {
|
|
195
184
|
names: names,
|
|
196
185
|
});
|
|
197
|
-
const result =
|
|
198
|
-
|
|
199
|
-
|
|
186
|
+
const result = new CodeCollector();
|
|
187
|
+
const name = await this.runHeader(curretItem, all, env, result);
|
|
188
|
+
if (!name)
|
|
189
|
+
return null;
|
|
200
190
|
return {
|
|
201
|
-
name
|
|
191
|
+
name,
|
|
202
192
|
inputFilePath: raw.inputFilePath,
|
|
203
193
|
code: [...result.code],
|
|
204
194
|
imports: this.useAdditionalImports &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Generator.js","sourceRoot":"","sources":["../../src/generator/Generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAEL,iBAAiB,EACjB,cAAc,GAGf,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAA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U,EAAE,CAAC;QAEnC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE;YAClD,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAEvB,OAAO;YACL,IAAI;YACJ,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;YACtB,OAAO,EACL,IAAI,CAAC,oBAAoB;gBACzB,GAAG,CAAC,iBAAiB;gBACrB,GAAG,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;gBAC9B,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,iBAAiB,CAAC;gBAC/C,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;SAC1B,CAAC;IACJ,CAAC;CAQF"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Generator,
|
|
1
|
+
import { Generator, GeneratorRunItem, GeneratorRunItems } from "./Generator.js";
|
|
2
|
+
import { CodeCollector } from "../common/CodeCollector.js";
|
|
3
|
+
import { GeneratorEnv } from "../common/types.common.js";
|
|
2
4
|
/**
|
|
3
5
|
* Generator that produces annotation metadata and initial-value factory functions.
|
|
4
6
|
*
|
|
@@ -8,7 +10,7 @@ import { Generator, GeneratorCode, GeneratorRunItem } from "./Generator.js";
|
|
|
8
10
|
*/
|
|
9
11
|
export declare class GeneratorAnnotations extends Generator {
|
|
10
12
|
constructor();
|
|
11
|
-
protected runHeader(current: GeneratorRunItem): Promise<
|
|
13
|
+
protected runHeader(current: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv, result: CodeCollector): Promise<string | null>;
|
|
12
14
|
}
|
|
13
15
|
declare const _default: GeneratorAnnotations;
|
|
14
16
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorAnnotations.d.ts","sourceRoot":"","sources":["../../src/generator/GeneratorAnnotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"GeneratorAnnotations.d.ts","sourceRoot":"","sources":["../../src/generator/GeneratorAnnotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAQhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AASzD;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;;cAWxB,SAAS,CAChC,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,iBAAiB,EACtB,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CA4G1B;;AAED,wBAA0C"}
|
|
@@ -16,38 +16,30 @@ const dateFormatRegex = /\"dateFormat\": \"([a-zA-Z][a-zA-Z0-9]*)\"/;
|
|
|
16
16
|
*/
|
|
17
17
|
export class GeneratorAnnotations extends Generator {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(DecoFileType.annotations, DecoFileExtension.ts, DecoTargetType.common, Collector.instance());
|
|
19
|
+
super(20, DecoFileType.annotations, DecoFileExtension.ts, DecoTargetType.common, Collector.instance());
|
|
20
20
|
}
|
|
21
|
-
async runHeader(current) {
|
|
21
|
+
async runHeader(current, all, env, result) {
|
|
22
22
|
const names = current.names;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
path: this.importCommon(DecoFileType.doc),
|
|
38
|
-
props: [names.doc],
|
|
39
|
-
isType: true,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
name: current.decorator.name,
|
|
43
|
-
};
|
|
23
|
+
result.addImport({
|
|
24
|
+
path: "@mxpicture/gcp-functions-common/types",
|
|
25
|
+
props: ["AnnotationsHeader"],
|
|
26
|
+
isType: true,
|
|
27
|
+
}, {
|
|
28
|
+
path: "@mxpicture/gcp-functions-common/helper",
|
|
29
|
+
props: ["annoDocInitial"],
|
|
30
|
+
isType: false,
|
|
31
|
+
}, {
|
|
32
|
+
path: this.importCommon(DecoFileType.doc),
|
|
33
|
+
props: [names.doc],
|
|
34
|
+
isType: true,
|
|
35
|
+
});
|
|
44
36
|
const importDecoProps = new Set();
|
|
45
37
|
const importDecoTypeProps = new Set();
|
|
46
38
|
const header = current.decorator.extractAnnotations();
|
|
47
39
|
const json = await formatJsonStringify(JSON.stringify(header));
|
|
48
40
|
const lines = json.split("\n");
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
result.addCode("", `export const ${names.initialFunc} = (): Partial<${names.doc}> => annoDocInitial(${names.annotations}.properties);`, "");
|
|
42
|
+
result.addCode(`export const ${names.annotations}: AnnotationsHeader = `);
|
|
51
43
|
// replace enums and types
|
|
52
44
|
for (let line of lines) {
|
|
53
45
|
// type
|
|
@@ -85,22 +77,22 @@ export class GeneratorAnnotations extends Generator {
|
|
|
85
77
|
line = line.replace(subHeaderNameRegex, `subHeader: ${match[1]}`);
|
|
86
78
|
match = line.match(subHeaderNameRegex);
|
|
87
79
|
}
|
|
88
|
-
|
|
80
|
+
result.addCode(line);
|
|
89
81
|
}
|
|
90
|
-
|
|
82
|
+
result.addCode(";");
|
|
91
83
|
if (importDecoTypeProps.size > 0)
|
|
92
|
-
|
|
84
|
+
result.addImport({
|
|
93
85
|
path: "@mxpicture/gcp-functions-common/decorator",
|
|
94
86
|
props: [...importDecoTypeProps],
|
|
95
87
|
isType: true,
|
|
96
88
|
});
|
|
97
89
|
if (importDecoProps.size > 0)
|
|
98
|
-
|
|
90
|
+
result.addImport({
|
|
99
91
|
path: "@mxpicture/gcp-functions-common/decorator",
|
|
100
92
|
props: [...importDecoProps],
|
|
101
93
|
isType: false,
|
|
102
94
|
});
|
|
103
|
-
return
|
|
95
|
+
return current.decorator.name;
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
98
|
export default new GeneratorAnnotations();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorAnnotations.js","sourceRoot":"","sources":["../../src/generator/GeneratorAnnotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"GeneratorAnnotations.js","sourceRoot":"","sources":["../../src/generator/GeneratorAnnotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuC,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,2CAA2C,CAAC;AAInD,MAAM,SAAS,GAAG,sCAAsC,CAAC;AACzD,MAAM,aAAa,GACjB,+DAA+D,CAAC;AAClE,MAAM,gBAAgB,GAAG,6CAA6C,CAAC;AACvE,MAAM,kBAAkB,GAAG,+CAA+C,CAAC;AAC3E,MAAM,eAAe,GAAG,4CAA4C,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACjD;QACE,KAAK,CACH,EAAE,EACF,YAAY,CAAC,WAAW,EACxB,iBAAiB,CAAC,EAAE,EACpB,cAAc,CAAC,MAAM,EACrB,SAAS,CAAC,QAAQ,EA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2
|
+
import { Generator, GeneratorRunItem, GeneratorRunItems } from "./Generator.js";
|
|
3
3
|
import { GeneratorEnv } from "../common/types.common.js";
|
|
4
4
|
import { AnnotationsProperty, DecoImport, DecoPropertyBase } from "@mxpicture/gcp-functions-common/types";
|
|
5
|
+
import { CodeCollector } from "../common/CodeCollector.js";
|
|
5
6
|
/**
|
|
6
7
|
* Generator that produces backend-specific code including API classes, stores, functions, and factory helpers.
|
|
7
8
|
*
|
|
@@ -11,7 +12,7 @@ import { AnnotationsProperty, DecoImport, DecoPropertyBase } from "@mxpicture/gc
|
|
|
11
12
|
*/
|
|
12
13
|
export declare class GeneratorBackend extends Generator {
|
|
13
14
|
constructor();
|
|
14
|
-
protected runHeader(current: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv): Promise<
|
|
15
|
+
protected runHeader(current: GeneratorRunItem, all: GeneratorRunItems, env: GeneratorEnv, result: CodeCollector): Promise<string | null>;
|
|
15
16
|
protected buildConstants(virtualKeysName: string, virtuals: AnnotationsProperty<DecoPropertyBase>[], datePathsName: string, datePaths: string[], sideEffectsName: string, sideEffects: AnnotationsProperty<DecoPropertyBase>[]): {
|
|
16
17
|
code: string[];
|
|
17
18
|
imports: DecoImport[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorBackend.d.ts","sourceRoot":"","sources":["../../src/generator/GeneratorBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,SAAS,EACT,aAAa,EACd,MAAM,2CAA2C,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"GeneratorBackend.d.ts","sourceRoot":"","sources":["../../src/generator/GeneratorBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,SAAS,EACT,aAAa,EACd,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIhF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC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