@mxpicture/gcp-functions-generator 1.1.92 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/4testing/templates/template.example.d.ts +4 -3
  2. package/dist/4testing/templates/template.example.d.ts.map +1 -1
  3. package/dist/4testing/templates/template.example.js.map +1 -1
  4. package/dist/4testing/templates/template.medication.d.ts +2 -1
  5. package/dist/4testing/templates/template.medication.d.ts.map +1 -1
  6. package/dist/4testing/templates/template.medication.js.map +1 -1
  7. package/dist/4testing/templates/template.settings.d.ts +2 -1
  8. package/dist/4testing/templates/template.settings.d.ts.map +1 -1
  9. package/dist/4testing/templates/template.settings.js.map +1 -1
  10. package/dist/4testing/utils.d.ts +1 -1
  11. package/dist/4testing/utils.d.ts.map +1 -1
  12. package/dist/4testing/utils.js +24 -2
  13. package/dist/4testing/utils.js.map +1 -1
  14. package/dist/common/file.common.d.ts +11 -2
  15. package/dist/common/file.common.d.ts.map +1 -1
  16. package/dist/common/file.common.js +44 -8
  17. package/dist/common/file.common.js.map +1 -1
  18. package/dist/common/index.d.ts +1 -6
  19. package/dist/common/index.d.ts.map +1 -1
  20. package/dist/common/index.js +1 -6
  21. package/dist/common/index.js.map +1 -1
  22. package/dist/common/job.common.d.ts +1 -1
  23. package/dist/common/job.common.d.ts.map +1 -1
  24. package/dist/common/resolve.common.d.ts +17 -0
  25. package/dist/common/resolve.common.d.ts.map +1 -0
  26. package/dist/common/resolve.common.js +46 -0
  27. package/dist/common/resolve.common.js.map +1 -0
  28. package/dist/common/types.common.d.ts +42 -2
  29. package/dist/common/types.common.d.ts.map +1 -1
  30. package/dist/decorator/DecoExtractor.d.ts +22 -0
  31. package/dist/decorator/DecoExtractor.d.ts.map +1 -0
  32. package/dist/{common/Extractor.js → decorator/DecoExtractor.js} +2 -23
  33. package/dist/decorator/DecoExtractor.js.map +1 -0
  34. package/dist/decorator/deco.names.d.ts +4 -3
  35. package/dist/decorator/deco.names.d.ts.map +1 -1
  36. package/dist/decorator/deco.names.js +6 -6
  37. package/dist/decorator/deco.names.js.map +1 -1
  38. package/dist/decorator/index.d.ts +1 -1
  39. package/dist/decorator/index.d.ts.map +1 -1
  40. package/dist/decorator/index.js +1 -1
  41. package/dist/decorator/index.js.map +1 -1
  42. package/dist/exports.gen.json +1357 -0
  43. package/dist/generator/Generator.d.ts +20 -106
  44. package/dist/generator/Generator.d.ts.map +1 -1
  45. package/dist/generator/Generator.js +84 -169
  46. package/dist/generator/Generator.js.map +1 -1
  47. package/dist/generator/GeneratorAnnotations.d.ts +3 -4
  48. package/dist/generator/GeneratorAnnotations.d.ts.map +1 -1
  49. package/dist/generator/GeneratorAnnotations.js +20 -46
  50. package/dist/generator/GeneratorAnnotations.js.map +1 -1
  51. package/dist/generator/GeneratorBackend.d.ts +11 -30
  52. package/dist/generator/GeneratorBackend.d.ts.map +1 -1
  53. package/dist/generator/GeneratorBackend.js +68 -177
  54. package/dist/generator/GeneratorBackend.js.map +1 -1
  55. package/dist/generator/GeneratorDoc.d.ts +8 -9
  56. package/dist/generator/GeneratorDoc.d.ts.map +1 -1
  57. package/dist/generator/GeneratorDoc.js +34 -35
  58. package/dist/generator/GeneratorDoc.js.map +1 -1
  59. package/dist/generator/GeneratorEnum.d.ts +6 -7
  60. package/dist/generator/GeneratorEnum.d.ts.map +1 -1
  61. package/dist/generator/GeneratorEnum.js +26 -15
  62. package/dist/generator/GeneratorEnum.js.map +1 -1
  63. package/dist/generator/GeneratorFrontend.d.ts +5 -6
  64. package/dist/generator/GeneratorFrontend.d.ts.map +1 -1
  65. package/dist/generator/GeneratorFrontend.js +28 -48
  66. package/dist/generator/GeneratorFrontend.js.map +1 -1
  67. package/dist/generator/GeneratorRoutes.d.ts +6 -7
  68. package/dist/generator/GeneratorRoutes.d.ts.map +1 -1
  69. package/dist/generator/GeneratorRoutes.js +26 -31
  70. package/dist/generator/GeneratorRoutes.js.map +1 -1
  71. package/dist/generator/GeneratorZod.d.ts +9 -10
  72. package/dist/generator/GeneratorZod.d.ts.map +1 -1
  73. package/dist/generator/GeneratorZod.js +29 -25
  74. package/dist/generator/GeneratorZod.js.map +1 -1
  75. package/dist/run/GeneratorBarrel.d.ts +11 -0
  76. package/dist/run/GeneratorBarrel.d.ts.map +1 -0
  77. package/dist/run/GeneratorBarrel.js +22 -0
  78. package/dist/run/GeneratorBarrel.js.map +1 -0
  79. package/dist/run/GeneratorBase.d.ts +6 -0
  80. package/dist/run/GeneratorBase.d.ts.map +1 -0
  81. package/dist/run/GeneratorBase.js +4 -0
  82. package/dist/run/GeneratorBase.js.map +1 -0
  83. package/dist/run/GeneratorBaseFile.d.ts +16 -0
  84. package/dist/run/GeneratorBaseFile.d.ts.map +1 -0
  85. package/dist/run/GeneratorBaseFile.js +36 -0
  86. package/dist/run/GeneratorBaseFile.js.map +1 -0
  87. package/dist/run/GeneratorDirectory.d.ts +18 -0
  88. package/dist/run/GeneratorDirectory.d.ts.map +1 -0
  89. package/dist/run/GeneratorDirectory.js +42 -0
  90. package/dist/run/GeneratorDirectory.js.map +1 -0
  91. package/dist/run/GeneratorFile.d.ts +12 -0
  92. package/dist/run/GeneratorFile.d.ts.map +1 -0
  93. package/dist/run/GeneratorFile.js +31 -0
  94. package/dist/run/GeneratorFile.js.map +1 -0
  95. package/dist/run/GeneratorFs.d.ts +27 -0
  96. package/dist/run/GeneratorFs.d.ts.map +1 -0
  97. package/dist/run/GeneratorFs.js +81 -0
  98. package/dist/run/GeneratorFs.js.map +1 -0
  99. package/dist/run/GeneratorPackage.d.ts +21 -0
  100. package/dist/run/GeneratorPackage.d.ts.map +1 -0
  101. package/dist/run/GeneratorPackage.js +57 -0
  102. package/dist/run/GeneratorPackage.js.map +1 -0
  103. package/dist/run/GeneratorRun.d.ts +27 -0
  104. package/dist/run/GeneratorRun.d.ts.map +1 -0
  105. package/dist/run/GeneratorRun.js +60 -0
  106. package/dist/run/GeneratorRun.js.map +1 -0
  107. package/dist/run/GeneratorTemplate.d.ts +10 -0
  108. package/dist/run/GeneratorTemplate.d.ts.map +1 -0
  109. package/dist/run/GeneratorTemplate.js +27 -0
  110. package/dist/run/GeneratorTemplate.js.map +1 -0
  111. package/dist/run/index.d.ts +10 -0
  112. package/dist/run/index.d.ts.map +1 -0
  113. package/dist/run/index.js +11 -0
  114. package/dist/run/index.js.map +1 -0
  115. package/package.json +7 -6
  116. package/dist/common/Barrel.d.ts +0 -75
  117. package/dist/common/Barrel.d.ts.map +0 -1
  118. package/dist/common/Barrel.js +0 -119
  119. package/dist/common/Barrel.js.map +0 -1
  120. package/dist/common/CodeCollector.d.ts +0 -11
  121. package/dist/common/CodeCollector.d.ts.map +0 -1
  122. package/dist/common/CodeCollector.js +0 -29
  123. package/dist/common/CodeCollector.js.map +0 -1
  124. package/dist/common/Collector.d.ts +0 -70
  125. package/dist/common/Collector.d.ts.map +0 -1
  126. package/dist/common/Collector.js +0 -77
  127. package/dist/common/Collector.js.map +0 -1
  128. package/dist/common/Directories.d.ts +0 -60
  129. package/dist/common/Directories.d.ts.map +0 -1
  130. package/dist/common/Directories.js +0 -76
  131. package/dist/common/Directories.js.map +0 -1
  132. package/dist/common/Extractor.d.ts +0 -36
  133. package/dist/common/Extractor.d.ts.map +0 -1
  134. package/dist/common/Extractor.js.map +0 -1
  135. package/dist/common/generator.common.d.ts +0 -80
  136. package/dist/common/generator.common.d.ts.map +0 -1
  137. package/dist/common/generator.common.js +0 -138
  138. package/dist/common/generator.common.js.map +0 -1
  139. package/dist/decorator/deco.imports.d.ts +0 -31
  140. package/dist/decorator/deco.imports.d.ts.map +0 -1
  141. package/dist/decorator/deco.imports.js +0 -71
  142. package/dist/decorator/deco.imports.js.map +0 -1
@@ -0,0 +1,11 @@
1
+ // This file is auto-generated by build-cli. Do not edit manually.
2
+ export * from "./GeneratorBarrel.js";
3
+ export * from "./GeneratorBase.js";
4
+ export * from "./GeneratorBaseFile.js";
5
+ export * from "./GeneratorDirectory.js";
6
+ export * from "./GeneratorFile.js";
7
+ export * from "./GeneratorFs.js";
8
+ export * from "./GeneratorPackage.js";
9
+ export * from "./GeneratorRun.js";
10
+ export * from "./GeneratorTemplate.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxpicture/gcp-functions-generator",
3
- "version": "1.1.92",
3
+ "version": "1.2.2",
4
4
  "description": "Tools for google cloud functions",
5
5
  "type": "module",
6
6
  "author": "MXPicture",
@@ -13,7 +13,8 @@
13
13
  "./common": "./dist/common/index.js",
14
14
  "./package.json": "./package.json",
15
15
  "./decorator": "./dist/decorator/index.js",
16
- "./generator": "./dist/generator/index.js"
16
+ "./generator": "./dist/generator/index.js",
17
+ "./run": "./dist/run/index.js"
17
18
  },
18
19
  "files": [
19
20
  "dist"
@@ -35,10 +36,10 @@
35
36
  },
36
37
  "dependencies": {
37
38
  "@google-cloud/scheduler": "^5.3.1",
38
- "@mxpicture/build-api": "^0.2.60",
39
- "@mxpicture/gcp-functions-backend": "^1.1.92",
40
- "@mxpicture/gcp-functions-common": "^1.1.92",
41
- "@mxpicture/gcp-functions-frontend": "^1.1.92",
39
+ "@mxpicture/build-api": "^0.3.24",
40
+ "@mxpicture/gcp-functions-backend": "^1.2.2",
41
+ "@mxpicture/gcp-functions-common": "^1.2.2",
42
+ "@mxpicture/gcp-functions-frontend": "^1.2.2",
42
43
  "google-auth-library": "^10.6.2",
43
44
  "googleapis": "^171.4.0",
44
45
  "json5": "^2.2.3"
@@ -1,75 +0,0 @@
1
- import { DecoTargetType } from "@mxpicture/gcp-functions-common/decorator";
2
- /**
3
- * Represents the result of creating a barrel (index) file for a directory.
4
- */
5
- export interface BarrelResult {
6
- /** Absolute path to the directory containing the barrel file. */
7
- dirPath: string;
8
- /** Absolute path to the generated barrel file. */
9
- barrelFilePath: string;
10
- /** Array of export statements to write into the barrel file. */
11
- exportsCode: string[];
12
- }
13
- /**
14
- * Groups files in the same directory that share a common barrel file.
15
- */
16
- export interface BarrelFileGroup {
17
- /** Absolute path to the directory. */
18
- dirPath: string;
19
- /** Name of the barrel file (typically `index.ts`). */
20
- barrelFilename: string;
21
- /** File names within the directory to re-export. */
22
- filenames: string[];
23
- }
24
- /**
25
- * Manages generation of barrel (index) files that re-export modules from a directory.
26
- *
27
- * @remarks
28
- * Uses a singleton-per-target-type pattern via {@link Barrel.instance}.
29
- * All created instances are tracked in {@link Barrel.instances}.
30
- */
31
- export declare class Barrel {
32
- readonly targetType: DecoTargetType;
33
- /** When `true`, skips updating `package.json` exports during barrel generation. */
34
- static ignorePackageJson: boolean;
35
- /** All barrel instances created so far, one per {@link DecoTargetType}. */
36
- static instances: Barrel[];
37
- protected filePaths: string[];
38
- /**
39
- * Retrieves or creates the singleton barrel instance for a given target type.
40
- *
41
- * @param targetType - The decorator target type to get the barrel for.
42
- * @returns The existing or newly created {@link Barrel} instance.
43
- */
44
- static instance(targetType: DecoTargetType): Barrel;
45
- protected constructor(targetType: DecoTargetType);
46
- /**
47
- * Registers file paths to be included in the barrel output.
48
- *
49
- * @param filePaths - One or more absolute file paths to add.
50
- */
51
- add(...filePaths: string[]): void;
52
- /**
53
- * Creates barrel results by grouping registered file paths by directory.
54
- *
55
- * @returns An array of {@link BarrelResult} objects, one per directory.
56
- */
57
- create(): BarrelResult[];
58
- /**
59
- * Writes barrel files to disk, formatting the code before writing.
60
- *
61
- * @param results - The barrel results to write.
62
- */
63
- write(results: BarrelResult[]): Promise<void>;
64
- /**
65
- * Updates the target `package.json` exports map to include the generated barrel paths.
66
- *
67
- * @remarks
68
- * Skipped when {@link Barrel.ignorePackageJson} is `true`.
69
- *
70
- * @param results - The barrel results whose paths should be added to `package.json`.
71
- */
72
- ensurePackageBarrels(results: BarrelResult[]): Promise<void>;
73
- protected groupPaths(filePaths: string[]): BarrelFileGroup[];
74
- }
75
- //# sourceMappingURL=Barrel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Barrel.d.ts","sourceRoot":"","sources":["../../src/common/Barrel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAG3E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;GAMG;AACH,qBAAa,MAAM;aAwBqB,UAAU,EAAE,cAAc;IAvBhE,mFAAmF;IACnF,OAAc,iBAAiB,EAAE,OAAO,CAAS;IACjD,2EAA2E;IAC3E,OAAc,SAAS,EAAE,MAAM,EAAE,CAAM;IACvC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;IAEnC;;;;;OAKG;WACW,QAAQ,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;IAW1D,SAAS,aAA6B,UAAU,EAAE,cAAc;IAEhE;;;;OAIG;IACI,GAAG,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAIxC;;;;OAIG;IACI,MAAM,IAAI,YAAY,EAAE;IAU/B;;;;OAIG;IACU,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1D;;;;;;;OAOG;IACU,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBzE,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE;CAsB7D"}
@@ -1,119 +0,0 @@
1
- import { basename, dirname, join } from "node:path";
2
- import { mkdir, writeFile, readFile } from "node:fs/promises";
3
- import { directories } from "./Directories.js";
4
- import { formatCode } from "@mxpicture/build-api/code";
5
- /**
6
- * Manages generation of barrel (index) files that re-export modules from a directory.
7
- *
8
- * @remarks
9
- * Uses a singleton-per-target-type pattern via {@link Barrel.instance}.
10
- * All created instances are tracked in {@link Barrel.instances}.
11
- */
12
- export class Barrel {
13
- targetType;
14
- /** When `true`, skips updating `package.json` exports during barrel generation. */
15
- static ignorePackageJson = false;
16
- /** All barrel instances created so far, one per {@link DecoTargetType}. */
17
- static instances = [];
18
- filePaths = [];
19
- /**
20
- * Retrieves or creates the singleton barrel instance for a given target type.
21
- *
22
- * @param targetType - The decorator target type to get the barrel for.
23
- * @returns The existing or newly created {@link Barrel} instance.
24
- */
25
- static instance(targetType) {
26
- let found = this.instances.find((barrel) => barrel.targetType === targetType);
27
- if (!found) {
28
- found = new Barrel(targetType);
29
- this.instances.push(found);
30
- }
31
- return found;
32
- }
33
- constructor(targetType) {
34
- this.targetType = targetType;
35
- }
36
- /**
37
- * Registers file paths to be included in the barrel output.
38
- *
39
- * @param filePaths - One or more absolute file paths to add.
40
- */
41
- add(...filePaths) {
42
- this.filePaths.push(...filePaths);
43
- }
44
- /**
45
- * Creates barrel results by grouping registered file paths by directory.
46
- *
47
- * @returns An array of {@link BarrelResult} objects, one per directory.
48
- */
49
- create() {
50
- return this.groupPaths(this.filePaths).map((group) => ({
51
- dirPath: group.dirPath,
52
- barrelFilePath: join(group.dirPath, group.barrelFilename),
53
- exportsCode: group.filenames.map((fielname) => `export * from "./${fielname}";`),
54
- }));
55
- }
56
- /**
57
- * Writes barrel files to disk, formatting the code before writing.
58
- *
59
- * @param results - The barrel results to write.
60
- */
61
- async write(results) {
62
- const promises = [];
63
- for (const result of results) {
64
- promises.push((async () => {
65
- const code = await formatCode(result.exportsCode.join("\n"));
66
- await mkdir(result.dirPath, { recursive: true });
67
- return writeFile(result.barrelFilePath, code);
68
- })());
69
- }
70
- await Promise.all(promises);
71
- }
72
- /**
73
- * Updates the target `package.json` exports map to include the generated barrel paths.
74
- *
75
- * @remarks
76
- * Skipped when {@link Barrel.ignorePackageJson} is `true`.
77
- *
78
- * @param results - The barrel results whose paths should be added to `package.json`.
79
- */
80
- async ensurePackageBarrels(results) {
81
- if (Barrel.ignorePackageJson) {
82
- console.log("ensurePackageBarrels ignored");
83
- return;
84
- }
85
- const filePath = directories.targetPackageJson(this.targetType);
86
- const raw = await readFile(filePath, "utf8");
87
- const pkg = JSON.parse(raw);
88
- for (const result of results) {
89
- const parts = result.barrelFilePath.split("/src/");
90
- if (parts.length < 2)
91
- continue;
92
- const indexPath = `./src/${parts[parts.length - 1]}`;
93
- const expPath = dirname(`./${parts[parts.length - 1]}`);
94
- if (!pkg.exports)
95
- pkg.exports = {};
96
- pkg.exports[expPath] = indexPath;
97
- }
98
- await writeFile(filePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
99
- }
100
- groupPaths(filePaths) {
101
- const groups = [];
102
- for (const filePath of filePaths) {
103
- const dirPath = dirname(filePath);
104
- const filename = basename(filePath);
105
- let group = groups.find((g) => g.dirPath === dirPath);
106
- if (!group) {
107
- group = {
108
- dirPath,
109
- filenames: [],
110
- barrelFilename: "index.ts",
111
- };
112
- groups.push(group);
113
- }
114
- group.filenames.push(filename.replace(/\.ts$/, ".js"));
115
- }
116
- return groups;
117
- }
118
- }
119
- //# sourceMappingURL=Barrel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"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AAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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,CAAC;IACd,CAAC;IAEM,SAAS,CAAC,GAAG,IAAkB;QACpC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,CACtD,CAAC;YACF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,KAAK,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;gBAC1D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;YAED,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK;gBAC1B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,70 +0,0 @@
1
- import { DecoNames, DecoTargetType } from "@mxpicture/gcp-functions-common/decorator";
2
- /**
3
- * Identifies a collected item by its base name and target type.
4
- */
5
- export interface CollectorKey {
6
- basename: string;
7
- targetType: DecoTargetType;
8
- }
9
- /**
10
- * Data associated with a collected decorator, primarily its resolved names.
11
- */
12
- export interface CollectorData {
13
- names: DecoNames;
14
- }
15
- /**
16
- * A single entry in the collector, pairing a key with its data.
17
- */
18
- export interface CollectorItem {
19
- key: CollectorKey;
20
- data: CollectorData;
21
- }
22
- /**
23
- * Collects and indexes decorator metadata by base name and target type.
24
- *
25
- * @remarks
26
- * Acts as a shared registry across generators so that later generators
27
- * (e.g. Zod) can reference names resolved by earlier generators (e.g. Doc).
28
- * Use {@link Collector.instance} for the global singleton.
29
- */
30
- export declare class Collector {
31
- protected items: CollectorItem[];
32
- /**
33
- * Returns the global singleton instance of the collector.
34
- *
35
- * @returns The shared {@link Collector} instance.
36
- */
37
- static instance(): Collector;
38
- constructor();
39
- /**
40
- * Adds a decorator entry if one with the same base name and target type does not already exist.
41
- *
42
- * @param basename - The base name of the decorator.
43
- * @param targetType - The target type (e.g. common, backend, frontend).
44
- * @param data - The decorator metadata to store.
45
- */
46
- add(basename: string, targetType: DecoTargetType, data: CollectorData): void;
47
- /**
48
- * Finds a collector item by exact base name and target type.
49
- *
50
- * @param basename - The base name to search for.
51
- * @param targetType - The target type to match.
52
- * @returns The matching item, or `null` if not found.
53
- */
54
- find(basename: string, targetType: DecoTargetType): CollectorItem | null;
55
- /**
56
- * Searches for collector items where the name matches the base name or any named property.
57
- *
58
- * @param name - The name to search across all decorator name properties.
59
- * @returns An array of matching {@link CollectorItem} entries.
60
- */
61
- findGeneric(name: string): CollectorItem[];
62
- /**
63
- * Returns the first matching collector item for the given name.
64
- *
65
- * @param name - The name to search for.
66
- * @returns The first matching item, or `null` if none found.
67
- */
68
- findFirst(name: string): CollectorItem | null;
69
- }
70
- //# sourceMappingURL=Collector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Collector.d.ts","sourceRoot":"","sources":["../../src/common/Collector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,cAAc,EACf,MAAM,2CAA2C,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;CACrB;AAID;;;;;;;GAOG;AACH,qBAAa,SAAS;IACpB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,CAAM;IAEtC;;;;OAIG;WACW,QAAQ,IAAI,SAAS;;IAOnC;;;;;;OAMG;IACI,GAAG,CACR,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,cAAc,EAC1B,IAAI,EAAE,aAAa,GAClB,IAAI;IAKP;;;;;;OAMG;IACI,IAAI,CACT,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,cAAc,GACzB,aAAa,GAAG,IAAI;IASvB;;;;;OAKG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE;IAcjD;;;;;OAKG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;CAIrD"}
@@ -1,77 +0,0 @@
1
- import { decoNamesProperties, } from "@mxpicture/gcp-functions-common/decorator";
2
- let __instance = null;
3
- /**
4
- * Collects and indexes decorator metadata by base name and target type.
5
- *
6
- * @remarks
7
- * Acts as a shared registry across generators so that later generators
8
- * (e.g. Zod) can reference names resolved by earlier generators (e.g. Doc).
9
- * Use {@link Collector.instance} for the global singleton.
10
- */
11
- export class Collector {
12
- items = [];
13
- /**
14
- * Returns the global singleton instance of the collector.
15
- *
16
- * @returns The shared {@link Collector} instance.
17
- */
18
- static instance() {
19
- if (!__instance)
20
- __instance = new Collector();
21
- return __instance;
22
- }
23
- constructor() { }
24
- /**
25
- * Adds a decorator entry if one with the same base name and target type does not already exist.
26
- *
27
- * @param basename - The base name of the decorator.
28
- * @param targetType - The target type (e.g. common, backend, frontend).
29
- * @param data - The decorator metadata to store.
30
- */
31
- add(basename, targetType, data) {
32
- if (this.find(basename, targetType))
33
- return;
34
- this.items.push({ key: { basename, targetType }, data: { ...data } });
35
- }
36
- /**
37
- * Finds a collector item by exact base name and target type.
38
- *
39
- * @param basename - The base name to search for.
40
- * @param targetType - The target type to match.
41
- * @returns The matching item, or `null` if not found.
42
- */
43
- find(basename, targetType) {
44
- return (this.items.find((item) => item.key.basename === basename && item.key.targetType === targetType) ?? null);
45
- }
46
- /**
47
- * Searches for collector items where the name matches the base name or any named property.
48
- *
49
- * @param name - The name to search across all decorator name properties.
50
- * @returns An array of matching {@link CollectorItem} entries.
51
- */
52
- findGeneric(name) {
53
- const results = [];
54
- for (const item of this.items) {
55
- if (item.key.basename === name)
56
- results.push(item);
57
- for (const prop of decoNamesProperties) {
58
- if (item.data.names[prop] === name) {
59
- results.push(item);
60
- break;
61
- }
62
- }
63
- }
64
- return results;
65
- }
66
- /**
67
- * Returns the first matching collector item for the given name.
68
- *
69
- * @param name - The name to search for.
70
- * @returns The first matching item, or `null` if none found.
71
- */
72
- findFirst(name) {
73
- const results = this.findGeneric(name);
74
- return results.length > 0 ? results[0] : null;
75
- }
76
- }
77
- //# sourceMappingURL=Collector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Collector.js","sourceRoot":"","sources":["../../src/common/Collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,GAEpB,MAAM,2CAA2C,CAAC;AAyBnD,IAAI,UAAU,GAAqB,IAAI,CAAC;AAExC;;;;;;;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nB,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,IAAY;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,CAAC;CACF"}
@@ -1,60 +0,0 @@
1
- import { DecoFileType, DecoTargetType } from "@mxpicture/gcp-functions-common/decorator";
2
- /**
3
- * Parameters used by {@link DirectoriesResolver} to identify a target/file type pair.
4
- */
5
- export interface DirectoriesResolverParams {
6
- targetType: DecoTargetType;
7
- fileType: DecoFileType;
8
- }
9
- /**
10
- * Resolves an import path between two target/file type pairs.
11
- *
12
- * @param imp - The import target parameters (e.g. `common/doc`).
13
- * @param current - The current file's parameters used as the resolution base.
14
- * @returns The resolved import path string.
15
- */
16
- export type DirectoriesResolver = (imp: DirectoriesResolverParams, // e.g ${TargetType}/${DecoFileType} --> common/doc,
17
- current: DirectoriesResolverParams) => string;
18
- /**
19
- * Configuration parameters for the directories manager.
20
- */
21
- export interface DirectoriesParams {
22
- /** Current working directory used as the base for resolving paths. */
23
- cwd: string;
24
- /** Relative path from `cwd` to the templates directory. */
25
- templatesDir: string;
26
- /** Relative path from `cwd` to the code generation target directory. */
27
- targetDir: string;
28
- /** Callback that resolves import paths between target/file type pairs. */
29
- importResolver: DirectoriesResolver;
30
- }
31
- declare class Directories {
32
- protected _params: DirectoriesParams | null;
33
- constructor();
34
- setup(params: DirectoriesParams): void;
35
- get templatesDir(): string;
36
- targetDir(targetType: DecoTargetType): string;
37
- targetBasePath(targetType: DecoTargetType): string;
38
- toTargetPath(type: DecoFileType, filename: string, targetType: DecoTargetType): string;
39
- targetPackageJson(targetType: DecoTargetType): string;
40
- templatesPathRead(): Promise<string[]>;
41
- resolveImport(imp: {
42
- targetType: DecoTargetType;
43
- fileType: DecoFileType;
44
- } | string, currentFile: {
45
- targetType: DecoTargetType;
46
- fileType: DecoFileType;
47
- } | string): string;
48
- splitResolverPath(path: string): DirectoriesResolverParams;
49
- concatResolverPath(params: DirectoriesResolverParams): string;
50
- protected get params(): DirectoriesParams;
51
- }
52
- /**
53
- * Singleton instance of the directories manager.
54
- *
55
- * @remarks
56
- * Must be configured via `directories.setup(params)` before use.
57
- */
58
- export declare const directories: Directories;
59
- export {};
60
- //# sourceMappingURL=Directories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Directories.d.ts","sourceRoot":"","sources":["../../src/common/Directories.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,cAAc,EAGf,MAAM,2CAA2C,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,GAAG,EAAE,yBAAyB,EAAE,oDAAoD;AACpF,OAAO,EAAE,yBAAyB,KAC/B,MAAM,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,cAAc,EAAE,mBAAmB,CAAC;CACrC;AAQD,cAAM,WAAW;IACf,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAQ;;IAI5C,KAAK,CAAC,MAAM,EAAE,iBAAiB;IAStC,IAAW,YAAY,IAAI,MAAM,CAEhC;IAEM,SAAS,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;IAI7C,cAAc,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;IAIlD,YAAY,CACjB,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,cAAc;IAKrB,iBAAiB,CAAC,UAAU,EAAE,cAAc;IAItC,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAM5C,aAAa,CAClB,GAAG,EAAE;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,GAAG,MAAM,EACpE,WAAW,EACP;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,GACtD,MAAM,GACT,MAAM;IASF,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB;IAkB1D,kBAAkB,CAAC,MAAM,EAAE,yBAAyB,GAAG,MAAM;IAIpE,SAAS,KAAK,MAAM,IAAI,iBAAiB,CAGxC;CACF;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,aAAa,CAAC"}
@@ -1,76 +0,0 @@
1
- import { join, resolve } from "node:path";
2
- import { readdir } from "node:fs/promises";
3
- import { guardDecoFileType, guardDecoTargetType, } from "@mxpicture/gcp-functions-common/decorator";
4
- import { isTemplateFile } from "./file.common.js";
5
- let __instance = null;
6
- const instance = () => {
7
- if (!__instance)
8
- __instance = new Directories();
9
- return __instance;
10
- };
11
- class Directories {
12
- _params = null;
13
- constructor() { }
14
- setup(params) {
15
- this._params = {
16
- cwd: params.cwd,
17
- templatesDir: resolve(params.cwd, params.templatesDir),
18
- targetDir: resolve(params.cwd, params.targetDir),
19
- importResolver: params.importResolver,
20
- };
21
- }
22
- get templatesDir() {
23
- return this.params.templatesDir;
24
- }
25
- targetDir(targetType) {
26
- return `${this.targetBasePath(targetType)}/src`;
27
- }
28
- targetBasePath(targetType) {
29
- return join(this.params.targetDir, targetType);
30
- }
31
- toTargetPath(type, filename, targetType) {
32
- return join(this.targetDir(targetType), type, filename);
33
- }
34
- targetPackageJson(targetType) {
35
- return `${this.targetBasePath(targetType)}/package.json`;
36
- }
37
- async templatesPathRead() {
38
- return (await readdir(this.templatesDir))
39
- .filter(isTemplateFile)
40
- .map((name) => join(this.templatesDir, name));
41
- }
42
- resolveImport(imp, currentFile) {
43
- return this.params.importResolver(typeof imp === "string" ? this.splitResolverPath(imp) : imp, typeof currentFile === "string"
44
- ? this.splitResolverPath(currentFile)
45
- : currentFile);
46
- }
47
- splitResolverPath(path) {
48
- const parts = path.split("/");
49
- if (parts.length !== 2)
50
- throw new Error(`${path} does not fit the pattern {TargetType}/{DecoFileType}`);
51
- const [_targetType, _fileType] = parts;
52
- const fileType = guardDecoFileType(_fileType);
53
- if (!fileType)
54
- throw new Error(`${path}: fileType ${_fileType} invalid`);
55
- const targetType = guardDecoTargetType(_targetType);
56
- if (!targetType)
57
- throw new Error(`${path}: targetType ${_targetType} invalid`);
58
- return { targetType, fileType };
59
- }
60
- concatResolverPath(params) {
61
- return `${params.targetType}/${params.fileType}`;
62
- }
63
- get params() {
64
- if (!this._params)
65
- throw new Error("Directories: setup needed!");
66
- return this._params;
67
- }
68
- }
69
- /**
70
- * Singleton instance of the directories manager.
71
- *
72
- * @remarks
73
- * Must be configured via `directories.setup(params)` before use.
74
- */
75
- export const directories = instance();
76
- //# sourceMappingURL=Directories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Directories.js","sourceRoot":"","sources":["../../src/common/Directories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAGL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAoClD,IAAI,UAAU,GAAuB,IAAI,CAAC;AAC1C,MAAM,QAAQ,GAAG,GAAgB,EAAE;IACjC,IAAI,CAAC,UAAU;QAAE,UAAU,GAAG,IAAI,WAAW,EA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CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,EAAE,CAAC"}
@@ -1,36 +0,0 @@
1
- import { DecoFile } from "@mxpicture/gcp-functions-common/types";
2
- /**
3
- * Creates {@link Extractor} instances for the given template file paths.
4
- *
5
- * @param filePaths - Absolute paths to template files.
6
- * @returns A promise resolving to an array of extractors.
7
- */
8
- export declare const createExtractors: (filePaths: string[]) => Promise<Extractor[]>;
9
- /**
10
- * Creates extractors for the given file paths and runs them all.
11
- *
12
- * @param filePaths - Absolute paths to template files.
13
- * @returns A promise resolving to the extracted decorator files.
14
- */
15
- export declare const runExtractors: (filePaths: string[]) => Promise<DecoFile[]>;
16
- /**
17
- * Dynamically imports a template file and extracts its {@link Decorator} instances.
18
- */
19
- export declare class Extractor {
20
- readonly filePath: string;
21
- readonly rootDir: string;
22
- /**
23
- * Creates a new extractor.
24
- *
25
- * @param filePath - Absolute path to the template file.
26
- * @param rootDir - Workspace root directory used to compute relative paths.
27
- */
28
- constructor(filePath: string, rootDir: string);
29
- /**
30
- * Imports the template file and extracts all {@link Decorator} exports.
31
- *
32
- * @returns A {@link DecoFile} containing the template path and its decorators.
33
- */
34
- run(): Promise<DecoFile>;
35
- }
36
- //# sourceMappingURL=Extractor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Extractor.d.ts","sourceRoot":"","sources":["../../src/common/Extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAMjE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,WAAW,MAAM,EAAE,KAClB,OAAO,CAAC,SAAS,EAAE,CAGrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EAAE,KAClB,OAAO,CAAC,QAAQ,EAAE,CAGpB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;aAQF,QAAQ,EAAE,MAAM;aAChB,OAAO,EAAE,MAAM;IARjC;;;;;OAKG;gBAEe,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM;IAGjC;;;;OAIG;IACU,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;CActC"}