@iyio/protogen-runtime 0.7.50 → 0.8.1

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 (156) hide show
  1. package/package.json +13 -17
  2. package/src/index.d.ts +13 -13
  3. package/src/index.js +13 -16
  4. package/src/index.js.map +1 -1
  5. package/src/lib/default-plugins.js +35 -39
  6. package/src/lib/default-plugins.js.map +1 -1
  7. package/src/lib/plugins/actionPlugin.js +20 -23
  8. package/src/lib/plugins/actionPlugin.js.map +1 -1
  9. package/src/lib/plugins/assignPlugin.js +8 -11
  10. package/src/lib/plugins/assignPlugin.js.map +1 -1
  11. package/src/lib/plugins/autoPackageIndexPlugin.js +11 -14
  12. package/src/lib/plugins/autoPackageIndexPlugin.js.map +1 -1
  13. package/src/lib/plugins/callablePlugin.js +19 -22
  14. package/src/lib/plugins/callablePlugin.js.map +1 -1
  15. package/src/lib/plugins/examplePlugin.js +15 -18
  16. package/src/lib/plugins/examplePlugin.js.map +1 -1
  17. package/src/lib/plugins/fileReader.js +6 -10
  18. package/src/lib/plugins/fileReader.js.map +1 -1
  19. package/src/lib/plugins/fileWriter.js +28 -32
  20. package/src/lib/plugins/fileWriter.js.map +1 -1
  21. package/src/lib/plugins/functionPlugin.js +20 -23
  22. package/src/lib/plugins/functionPlugin.js.map +1 -1
  23. package/src/lib/plugins/markdownParser.js +3 -7
  24. package/src/lib/plugins/markdownParser.js.map +1 -1
  25. package/src/lib/plugins/nxLibraryTemplate.js +5 -9
  26. package/src/lib/plugins/nxLibraryTemplate.js.map +1 -1
  27. package/src/lib/plugins/packagePlugin.js +9 -12
  28. package/src/lib/plugins/packagePlugin.js.map +1 -1
  29. package/src/lib/plugins/paramPlugin.js +14 -17
  30. package/src/lib/plugins/paramPlugin.js.map +1 -1
  31. package/src/lib/plugins/reactCompPlugin.js +24 -27
  32. package/src/lib/plugins/reactCompPlugin.js.map +1 -1
  33. package/src/lib/plugins/sqlMigrationCdkTemplate.js +1 -5
  34. package/src/lib/plugins/sqlMigrationCdkTemplate.js.map +1 -1
  35. package/src/lib/plugins/sqlMigrationsPlugin.js +37 -40
  36. package/src/lib/plugins/sqlMigrationsPlugin.js.map +1 -1
  37. package/src/lib/plugins/sqlTablePlugin.js +16 -19
  38. package/src/lib/plugins/sqlTablePlugin.js.map +1 -1
  39. package/src/lib/plugins/tableCdkTemplate.js +1 -5
  40. package/src/lib/plugins/tableCdkTemplate.js.map +1 -1
  41. package/src/lib/plugins/tablePlugin.js +18 -21
  42. package/src/lib/plugins/tablePlugin.js.map +1 -1
  43. package/src/lib/plugins/tsConfigPathsPlugin.js +9 -12
  44. package/src/lib/plugins/tsConfigPathsPlugin.js.map +1 -1
  45. package/src/lib/plugins/tsExternalExecutor.js +1 -4
  46. package/src/lib/plugins/tsExternalExecutor.js.map +1 -1
  47. package/src/lib/plugins/tsProtoNodePlugin.js +16 -19
  48. package/src/lib/plugins/tsProtoNodePlugin.js.map +1 -1
  49. package/src/lib/plugins/zodPlugin.js +49 -52
  50. package/src/lib/plugins/zodPlugin.js.map +1 -1
  51. package/src/lib/protogen-cli-entry.js +4 -6
  52. package/src/lib/protogen-cli-entry.js.map +1 -1
  53. package/src/lib/protogen-runtime.js +14 -20
  54. package/src/lib/protogen-runtime.js.map +1 -1
  55. package/src/lib/protogen-table-generator.d.ts +2 -2
  56. package/src/lib/protogen-table-generator.js +18 -22
  57. package/src/lib/protogen-table-generator.js.map +1 -1
  58. package/src/lib/runProtogenCliAsync.js +9 -13
  59. package/src/lib/runProtogenCliAsync.js.map +1 -1
  60. package/src/lib/sharedTsConfig.js +7 -11
  61. package/src/lib/sharedTsConfig.js.map +1 -1
  62. package/src/lib/test-plugins/echo-generator.js +5 -7
  63. package/src/lib/test-plugins/echo-generator.js.map +1 -1
  64. package/src/package.json +1 -4
  65. package/tsconfig.tsbuildinfo +1 -0
  66. package/esm/package.json +0 -3
  67. package/esm/src/index.d.ts +0 -13
  68. package/esm/src/index.js +0 -14
  69. package/esm/src/index.js.map +0 -1
  70. package/esm/src/lib/default-plugins.d.ts +0 -2
  71. package/esm/src/lib/default-plugins.js +0 -151
  72. package/esm/src/lib/default-plugins.js.map +0 -1
  73. package/esm/src/lib/plugins/actionPlugin.d.ts +0 -40
  74. package/esm/src/lib/plugins/actionPlugin.js +0 -95
  75. package/esm/src/lib/plugins/actionPlugin.js.map +0 -1
  76. package/esm/src/lib/plugins/assignPlugin.d.ts +0 -20
  77. package/esm/src/lib/plugins/assignPlugin.js +0 -50
  78. package/esm/src/lib/plugins/assignPlugin.js.map +0 -1
  79. package/esm/src/lib/plugins/autoPackageIndexPlugin.d.ts +0 -14
  80. package/esm/src/lib/plugins/autoPackageIndexPlugin.js +0 -56
  81. package/esm/src/lib/plugins/autoPackageIndexPlugin.js.map +0 -1
  82. package/esm/src/lib/plugins/callablePlugin.d.ts +0 -40
  83. package/esm/src/lib/plugins/callablePlugin.js +0 -85
  84. package/esm/src/lib/plugins/callablePlugin.js.map +0 -1
  85. package/esm/src/lib/plugins/examplePlugin.d.ts +0 -26
  86. package/esm/src/lib/plugins/examplePlugin.js +0 -63
  87. package/esm/src/lib/plugins/examplePlugin.js.map +0 -1
  88. package/esm/src/lib/plugins/fileReader.d.ts +0 -2
  89. package/esm/src/lib/plugins/fileReader.js +0 -20
  90. package/esm/src/lib/plugins/fileReader.js.map +0 -1
  91. package/esm/src/lib/plugins/fileWriter.d.ts +0 -2
  92. package/esm/src/lib/plugins/fileWriter.js +0 -131
  93. package/esm/src/lib/plugins/fileWriter.js.map +0 -1
  94. package/esm/src/lib/plugins/functionPlugin.d.ts +0 -26
  95. package/esm/src/lib/plugins/functionPlugin.js +0 -110
  96. package/esm/src/lib/plugins/functionPlugin.js.map +0 -1
  97. package/esm/src/lib/plugins/markdownParser.d.ts +0 -2
  98. package/esm/src/lib/plugins/markdownParser.js +0 -14
  99. package/esm/src/lib/plugins/markdownParser.js.map +0 -1
  100. package/esm/src/lib/plugins/nxLibraryTemplate.d.ts +0 -7
  101. package/esm/src/lib/plugins/nxLibraryTemplate.js +0 -160
  102. package/esm/src/lib/plugins/nxLibraryTemplate.js.map +0 -1
  103. package/esm/src/lib/plugins/packagePlugin.d.ts +0 -14
  104. package/esm/src/lib/plugins/packagePlugin.js +0 -40
  105. package/esm/src/lib/plugins/packagePlugin.js.map +0 -1
  106. package/esm/src/lib/plugins/paramPlugin.d.ts +0 -20
  107. package/esm/src/lib/plugins/paramPlugin.js +0 -77
  108. package/esm/src/lib/plugins/paramPlugin.js.map +0 -1
  109. package/esm/src/lib/plugins/reactCompPlugin.d.ts +0 -32
  110. package/esm/src/lib/plugins/reactCompPlugin.js +0 -165
  111. package/esm/src/lib/plugins/reactCompPlugin.js.map +0 -1
  112. package/esm/src/lib/plugins/sqlMigrationCdkTemplate.d.ts +0 -5
  113. package/esm/src/lib/plugins/sqlMigrationCdkTemplate.js +0 -43
  114. package/esm/src/lib/plugins/sqlMigrationCdkTemplate.js.map +0 -1
  115. package/esm/src/lib/plugins/sqlMigrationsPlugin.d.ts +0 -39
  116. package/esm/src/lib/plugins/sqlMigrationsPlugin.js +0 -138
  117. package/esm/src/lib/plugins/sqlMigrationsPlugin.js.map +0 -1
  118. package/esm/src/lib/plugins/sqlTablePlugin.d.ts +0 -64
  119. package/esm/src/lib/plugins/sqlTablePlugin.js +0 -208
  120. package/esm/src/lib/plugins/sqlTablePlugin.js.map +0 -1
  121. package/esm/src/lib/plugins/tableCdkTemplate.d.ts +0 -5
  122. package/esm/src/lib/plugins/tableCdkTemplate.js +0 -44
  123. package/esm/src/lib/plugins/tableCdkTemplate.js.map +0 -1
  124. package/esm/src/lib/plugins/tablePlugin.d.ts +0 -67
  125. package/esm/src/lib/plugins/tablePlugin.js +0 -67
  126. package/esm/src/lib/plugins/tablePlugin.js.map +0 -1
  127. package/esm/src/lib/plugins/tsConfigPathsPlugin.d.ts +0 -14
  128. package/esm/src/lib/plugins/tsConfigPathsPlugin.js +0 -51
  129. package/esm/src/lib/plugins/tsConfigPathsPlugin.js.map +0 -1
  130. package/esm/src/lib/plugins/tsExternalExecutor.d.ts +0 -2
  131. package/esm/src/lib/plugins/tsExternalExecutor.js +0 -55
  132. package/esm/src/lib/plugins/tsExternalExecutor.js.map +0 -1
  133. package/esm/src/lib/plugins/tsProtoNodePlugin.d.ts +0 -44
  134. package/esm/src/lib/plugins/tsProtoNodePlugin.js +0 -53
  135. package/esm/src/lib/plugins/tsProtoNodePlugin.js.map +0 -1
  136. package/esm/src/lib/plugins/zodPlugin.d.ts +0 -39
  137. package/esm/src/lib/plugins/zodPlugin.js +0 -545
  138. package/esm/src/lib/plugins/zodPlugin.js.map +0 -1
  139. package/esm/src/lib/protogen-cli-entry.d.ts +0 -1
  140. package/esm/src/lib/protogen-cli-entry.js +0 -5
  141. package/esm/src/lib/protogen-cli-entry.js.map +0 -1
  142. package/esm/src/lib/protogen-runtime.d.ts +0 -5
  143. package/esm/src/lib/protogen-runtime.js +0 -67
  144. package/esm/src/lib/protogen-runtime.js.map +0 -1
  145. package/esm/src/lib/protogen-table-generator.d.ts +0 -44
  146. package/esm/src/lib/protogen-table-generator.js +0 -199
  147. package/esm/src/lib/protogen-table-generator.js.map +0 -1
  148. package/esm/src/lib/runProtogenCliAsync.d.ts +0 -12
  149. package/esm/src/lib/runProtogenCliAsync.js +0 -128
  150. package/esm/src/lib/runProtogenCliAsync.js.map +0 -1
  151. package/esm/src/lib/sharedTsConfig.d.ts +0 -18
  152. package/esm/src/lib/sharedTsConfig.js +0 -12
  153. package/esm/src/lib/sharedTsConfig.js.map +0 -1
  154. package/esm/src/lib/test-plugins/echo-generator.d.ts +0 -1
  155. package/esm/src/lib/test-plugins/echo-generator.js +0 -11
  156. package/esm/src/lib/test-plugins/echo-generator.js.map +0 -1
@@ -1,50 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tablePlugin = void 0;
4
- const zod_1 = require("zod");
5
- const protogen_table_generator_1 = require("../protogen-table-generator");
6
- const sharedTsConfig_1 = require("../sharedTsConfig");
7
- const tableCdkTemplate_1 = require("./tableCdkTemplate");
8
- const TablePluginConfig = zod_1.z.object({
9
- tablePath: zod_1.z.string().optional(),
1
+ import { z } from "zod";
2
+ import { generateProtoTable } from "../protogen-table-generator.js";
3
+ import { SharedTsPluginConfigScheme } from "../sharedTsConfig.js";
4
+ import { tableCdkTemplate } from "./tableCdkTemplate.js";
5
+ const TablePluginConfig = z.object({
6
+ tablePath: z.string().optional(),
10
7
  /**
11
8
  * @default "tables.ts"
12
9
  */
13
- tableFilename: zod_1.z.string().optional(),
10
+ tableFilename: z.string().optional(),
14
11
  /**
15
12
  * @default "tables-index.ts"
16
13
  */
17
- tableIndexFilename: zod_1.z.string().optional(),
14
+ tableIndexFilename: z.string().optional(),
18
15
  /**
19
16
  * @default "tables"
20
17
  */
21
- tablePackage: zod_1.z.string().optional(),
18
+ tablePackage: z.string().optional(),
22
19
  /**
23
20
  * If true the tableIdParam of generated tables will be populated and a table-params file will be generated.
24
21
  */
25
- tableUseParamIds: zod_1.z.boolean().optional(),
22
+ tableUseParamIds: z.boolean().optional(),
26
23
  /**
27
24
  * @default '@iyio/common'
28
25
  */
29
- dataTableDescriptionPackage: zod_1.z.string().optional(),
26
+ dataTableDescriptionPackage: z.string().optional(),
30
27
  /**
31
28
  * @default 'allTables'
32
29
  */
33
- allTableArrayName: zod_1.z.string().optional(),
30
+ allTableArrayName: z.string().optional(),
34
31
  /**
35
32
  * If defined a CDK construct file will be generated that can be used to deploy the
36
33
  * tables
37
34
  */
38
- tableCdkConstructFile: zod_1.z.string().optional(),
35
+ tableCdkConstructFile: z.string().optional(),
39
36
  /**
40
37
  * @default "Tbls"
41
38
  */
42
- tableCdkConstructClassName: zod_1.z.string().optional(),
43
- }).merge(sharedTsConfig_1.SharedTsPluginConfigScheme);
44
- exports.tablePlugin = {
39
+ tableCdkConstructClassName: z.string().optional(),
40
+ }).merge(SharedTsPluginConfigScheme);
41
+ export const tablePlugin = {
45
42
  configScheme: TablePluginConfig,
46
43
  generate: async (context, { tablePath, tablePackage = 'tables', tableFilename = 'tables.ts', tableIndexFilename = 'tables-index.ts', tableUseParamIds, dataTableDescriptionPackage = '@iyio/common', allTableArrayName = 'allTables', tableCdkConstructClassName = 'Tbls', tableCdkConstructFile = context.libStyle === 'nx' ? `packages/cdk/src/${tableCdkConstructClassName}.ts` : undefined, ...tsConfig }) => {
47
- const result = await (0, protogen_table_generator_1.generateProtoTable)(context, {
44
+ const result = await generateProtoTable(context, {
48
45
  pluginName: 'tablePlugin',
49
46
  supportedTypes: ['table'],
50
47
  tablePath,
@@ -62,7 +59,7 @@ exports.tablePlugin = {
62
59
  if (tableCdkConstructFile && tableCdkConstructClassName) {
63
60
  context.outputs.push({
64
61
  path: tableCdkConstructFile,
65
- content: (0, tableCdkTemplate_1.tableCdkTemplate)(tableCdkConstructClassName, result.tableInfos, context.importMap)
62
+ content: tableCdkTemplate(tableCdkConstructClassName, result.tableInfos, context.importMap)
66
63
  });
67
64
  }
68
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tablePlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tablePlugin.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AACxB,0EAAiE;AACjE,sDAA+D;AAC/D,yDAAsD;AAEtD,MAAM,iBAAiB,GAAC,OAAC,CAAC,MAAM,CAChC;IACI,SAAS,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE/B;;OAEG;IACH,aAAa,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEnC;;OAEG;IACH,kBAAkB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAGxC;;OAEG;IACH,YAAY,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAElC;;OAEG;IACH,gBAAgB,EAAC,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAEvC;;OAEG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AAM,WAAW,GACxB;IACI,YAAY,EAAC,iBAAiB;IAE9B,QAAQ,EAAC,KAAK,EAAE,OAAO,EAAC,EACpB,SAAS,EACT,YAAY,GAAC,QAAQ,EACrB,aAAa,GAAC,WAAW,EACzB,kBAAkB,GAAC,iBAAiB,EACpC,gBAAgB,EAChB,2BAA2B,GAAC,cAAc,EAC1C,iBAAiB,GAAC,WAAW,EAC7B,0BAA0B,GAAC,MAAM,EACjC,qBAAqB,GAAC,OAAO,CAAC,QAAQ,KAAG,IAAI,CAAA,CAAC,CAAA,oBAAoB,0BAA0B,KAAK,CAAA,CAAC,CAAA,SAAS,EAC3G,GAAG,QAAQ,EACd,EAAC,EAAE;QAEA,MAAM,MAAM,GAAC,MAAM,kBAAkB,CAAC,OAAO,EAAC;YAC1C,UAAU,EAAC,aAAa;YACxB,cAAc,EAAC,CAAC,OAAO,CAAC;YACxB,SAAS;YACT,YAAY;YACZ,aAAa;YACb,kBAAkB;YAClB,gBAAgB;YAChB,2BAA2B;YAC3B,iBAAiB;YACjB,GAAG,QAAQ;SACd,CAAC,CAAA;QAEF,IAAG,CAAC,MAAM,EAAC,CAAC;YACR,OAAO;QACX,CAAC;QAED,IAAG,qBAAqB,IAAI,0BAA0B,EAAC,CAAC;YACpD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;gBACjB,IAAI,EAAC,qBAAqB;gBAC1B,OAAO,EAAC,gBAAgB,CAAC,0BAA0B,EAAC,MAAM,CAAC,UAAU,EAAC,OAAO,CAAC,SAAS,CAAC;aAC3F,CAAC,CAAA;QACN,CAAC;IACL,CAAC;CACJ,CAAA"}
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsConfigPlugin = void 0;
4
- const node_common_1 = require("@iyio/node-common");
5
- const promises_1 = require("fs/promises");
6
- const zod_1 = require("zod");
7
- const TsConfigPluginConfig = zod_1.z.object({
1
+ import { pathExistsAsync } from "@iyio/node-common";
2
+ import { readFile, writeFile } from "fs/promises";
3
+ import { z } from "zod";
4
+ const TsConfigPluginConfig = z.object({
8
5
  /**
9
6
  * @default "tsconfig.json"
10
7
  */
11
- tsConfigPath: zod_1.z.string().optional(),
8
+ tsConfigPath: z.string().optional(),
12
9
  });
13
- exports.tsConfigPlugin = {
10
+ export const tsConfigPlugin = {
14
11
  configScheme: TsConfigPluginConfig,
15
12
  output: async ({ packagePaths, log, dryRun }, { tsConfigPath = 'tsconfig.json', }) => {
16
13
  if (dryRun) {
17
14
  log('### DRY RUN');
18
15
  }
19
- if (!(0, node_common_1.pathExistsAsync)(tsConfigPath)) {
16
+ if (!pathExistsAsync(tsConfigPath)) {
20
17
  throw new Error(`tsconfig not found at ${tsConfigPath}`);
21
18
  }
22
- const config = JSON.parse((await (0, promises_1.readFile)(tsConfigPath)).toString());
19
+ const config = JSON.parse((await readFile(tsConfigPath)).toString());
23
20
  if (!config.compilerOptions) {
24
21
  config.compilerOptions = {};
25
22
  }
@@ -47,7 +44,7 @@ exports.tsConfigPlugin = {
47
44
  }
48
45
  log(`write merged - ${tsConfigPath}`);
49
46
  if (added && !dryRun) {
50
- await (0, promises_1.writeFile)(tsConfigPath, JSON.stringify(config, null, 4));
47
+ await writeFile(tsConfigPath, JSON.stringify(config, null, 4));
51
48
  }
52
49
  }
53
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tsConfigPathsPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tsConfigPathsPlugin.ts"],"names":[],"mappings":";;;AAAA,mDAAoD;AAEpD,0CAAkD;AAClD,6BAAwB;AAExB,MAAM,oBAAoB,GAAC,OAAC,CAAC,MAAM,CACnC;IACI;;OAEG;IACH,YAAY,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAA;AAEW,QAAA,cAAc,GAC3B;IACI,YAAY,EAAC,oBAAoB;IACjC,MAAM,EAAC,KAAK,EAAE,EACV,YAAY,EACZ,GAAG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C,QAAQ,CAAC,IAAI,CAAC,EAAC,CAAC;oBACpB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnB,CAAC;YACL,CAAC;QACL,CAAC;QAED,GAAG,CAAC,kBAAkB,YAAY,EAAE,CAAC,CAAC;QACtC,IAAG,KAAK,IAAI,CAAC,MAAM,EAAC,CAAC;YACjB,MAAM,IAAA,oBAAS,EAAC,YAAY,EAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;IAEL,CAAC;CACJ,CAAA"}
1
+ {"version":3,"file":"tsConfigPathsPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tsConfigPathsPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,oBAAoB,GAAC,CAAC,CAAC,MAAM,CACnC;IACI;;OAEG;IACH,YAAY,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAC3B;IACI,YAAY,EAAC,oBAAoB;IACjC,MAAM,EAAC,KAAK,EAAE,EACV,YAAY,EACZ,GAAG,EACH,MAAM,EACT,EAAC,EACE,YAAY,GAAC,eAAe,GAC/B,EAAC,EAAE;QAEA,IAAG,MAAM,EAAC,CAAC;YACP,GAAG,CAAC,aAAa,CAAC,CAAC;QACvB,CAAC;QAED,IAAG,CAAC,eAAe,CAAC,YAAY,CAAC,EAAC,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAA;QAC5D,CAAC;QAED,MAAM,MAAM,GAAC,IAAI,CAAC,KAAK,CAAC,CAAC,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C;IAEL,CAAC;CACJ,CAAA"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsExternalExecutor = void 0;
4
- exports.tsExternalExecutor = {
1
+ export const tsExternalExecutor = {
5
2
  // beforeAll:async (ctx)=>{
6
3
  // //
7
4
  // },
@@ -1 +1 @@
1
- {"version":3,"file":"tsExternalExecutor.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tsExternalExecutor.ts"],"names":[],"mappings":";;;AAGa,QAAA,kBAAkB,GAAqB;AAEhD,2BAA2B;AAC3B,SAAS;AACT,KAAK;AACL,uBAAuB;AAEvB,cAAc;AACd,gBAAgB;AAChB,aAAa;AAEb,+BAA+B;AAC/B,yEAAyE;AAEzE,+BAA+B;AAC/B,2CAA2C;AAC3C,8BAA8B;AAC9B,YAAY;AACZ,kBAAkB;AAClB,QAAQ;AAER,mBAAmB;AACnB,kBAAkB;AAClB,QAAQ;AAER,0DAA0D;AAE1D,iEAAiE;AAGjE,wCAAwC;AACxC,kBAAkB;AAClB,QAAQ;AAER,uDAAuD;AACvD,gDAAgD;AAChD,kBAAkB;AAClB,QAAQ;AAGR,uCAAuC;AACvC,4BAA4B;AAC5B,QAAQ;AAER,wDAAwD;AAExD,iDAAiD;AACjD,oDAAoD;AACpD,qDAAqD;AACrD,wDAAwD;AAExD,wBAAwB;AACxB,qHAAqH;AACrH,sBAAsB;AACtB,UAAU;AAEV,gEAAgE;AAChE,yBAAyB;AACzB,2BAA2B;AAC3B,kCAAkC;AAClC,QAAQ;AACR,4BAA4B;AAC5B,mCAAmC;AACnC,QAAQ;AACR,mBAAmB;AAEnB,KAAK;AACL,oBAAoB;AACpB,SAAS;AACT,IAAI;CACP,CAAA"}
1
+ {"version":3,"file":"tsExternalExecutor.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tsExternalExecutor.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAqB;AAEhD,2BAA2B;AAC3B,SAAS;AACT,KAAK;AACL,uBAAuB;AAEvB,cAAc;AACd,gBAAgB;AAChB,aAAa;AAEb,+BAA+B;AAC/B,yEAAyE;AAEzE,+BAA+B;AAC/B,2CAA2C;AAC3C,8BAA8B;AAC9B,YAAY;AACZ,kBAAkB;AAClB,QAAQ;AAER,mBAAmB;AACnB,kBAAkB;AAClB,QAAQ;AAER,0DAA0D;AAE1D,iEAAiE;AAGjE,wCAAwC;AACxC,kBAAkB;AAClB,QAAQ;AAER,uDAAuD;AACvD,gDAAgD;AAChD,kBAAkB;AAClB,QAAQ;AAGR,uCAAuC;AACvC,4BAA4B;AAC5B,QAAQ;AAER,wDAAwD;AAExD,iDAAiD;AACjD,oDAAoD;AACpD,qDAAqD;AACrD,wDAAwD;AAExD,wBAAwB;AACxB,qHAAqH;AACrH,sBAAsB;AACtB,UAAU;AAEV,gEAAgE;AAChE,yBAAyB;AACzB,2BAA2B;AAC3B,kCAAkC;AAClC,QAAQ;AACR,4BAA4B;AAC5B,mCAAmC;AACnC,QAAQ;AACR,mBAAmB;AAEnB,KAAK;AACL,oBAAoB;AACpB,SAAS;AACT,IAAI;CACP,CAAA"}
@@ -1,54 +1,51 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsProtoNodePlugin = void 0;
4
- const common_1 = require("@iyio/common");
5
- const protogen_1 = require("@iyio/protogen");
6
- const zod_1 = require("zod");
7
- const TsProtoNodePluginConfig = zod_1.z.object({
1
+ import { deepClone, joinPaths } from "@iyio/common";
2
+ import { getProtoPluginPackAndPath, protoCreateNodeAddressMap, protoGenerateTsIndex, protoRemoveDisplayChildren } from "@iyio/protogen";
3
+ import { z } from "zod";
4
+ const TsProtoNodePluginConfig = z.object({
8
5
  /**
9
6
  * @default .tsProtoNodePackage
10
7
  */
11
- tsProtoNodePath: zod_1.z.string().optional(),
8
+ tsProtoNodePath: z.string().optional(),
12
9
  /**
13
10
  * @default "proto-nodes"
14
11
  */
15
- tsProtoNodePackage: zod_1.z.string().optional(),
12
+ tsProtoNodePackage: z.string().optional(),
16
13
  /**
17
14
  * @default "protoNodes.ts"
18
15
  */
19
- tsProtoNodeFilename: zod_1.z.string().optional(),
16
+ tsProtoNodeFilename: z.string().optional(),
20
17
  /**
21
18
  * @default "protoNodes-index.ts"
22
19
  */
23
- tsProtoNodeIndexFilename: zod_1.z.string().optional(),
20
+ tsProtoNodeIndexFilename: z.string().optional(),
24
21
  /**
25
22
  * @default "protoNodes"
26
23
  */
27
- tsProtoNodeExportName: zod_1.z.string().optional(),
24
+ tsProtoNodeExportName: z.string().optional(),
28
25
  /**
29
26
  * @default false
30
27
  */
31
- tsProtoNodeMinify: zod_1.z.boolean().optional(),
28
+ tsProtoNodeMinify: z.boolean().optional(),
32
29
  });
33
- exports.tsProtoNodePlugin = {
30
+ export const tsProtoNodePlugin = {
34
31
  configScheme: TsProtoNodePluginConfig,
35
32
  generate: async ({ importMap, outputs, tab, log, nodes, namespace, libStyle, packagePaths }, { tsProtoNodePackage = 'proto-nodes', tsProtoNodePath = tsProtoNodePackage, tsProtoNodeFilename = 'protoNodes.ts', tsProtoNodeExportName = 'protoNodes', tsProtoNodeIndexFilename = 'protoNodes-index', tsProtoNodeMinify = false, }) => {
36
- const { path, packageName } = (0, protogen_1.getProtoPluginPackAndPath)(namespace, tsProtoNodePackage, tsProtoNodePath, libStyle, { packagePaths, indexFilename: tsProtoNodeIndexFilename });
33
+ const { path, packageName } = getProtoPluginPackAndPath(namespace, tsProtoNodePackage, tsProtoNodePath, libStyle, { packagePaths, indexFilename: tsProtoNodeIndexFilename });
37
34
  log(`${nodes.length} node(s)`);
38
35
  importMap[tsProtoNodeExportName] = packageName;
39
36
  outputs.push({
40
- path: (0, common_1.joinPaths)(path, tsProtoNodeFilename),
37
+ path: joinPaths(path, tsProtoNodeFilename),
41
38
  content: `import { ProtoAddressMap } from '@iyio/protogen';
42
39
 
43
- export const ${tsProtoNodeExportName}=${JSON.stringify((0, protogen_1.protoCreateNodeAddressMap)((0, protogen_1.protoRemoveDisplayChildren)((0, common_1.deepClone)(nodes, 1000))), null, tsProtoNodeMinify ? 0 : tab.length)} satisfies ProtoAddressMap;`,
40
+ export const ${tsProtoNodeExportName}=${JSON.stringify(protoCreateNodeAddressMap(protoRemoveDisplayChildren(deepClone(nodes, 1000))), null, tsProtoNodeMinify ? 0 : tab.length)} satisfies ProtoAddressMap;`,
44
41
  });
45
42
  outputs.push({
46
- path: (0, common_1.joinPaths)(path, tsProtoNodeIndexFilename),
43
+ path: joinPaths(path, tsProtoNodeIndexFilename),
47
44
  content: '',
48
45
  isPackageIndex: true,
49
46
  generator: {
50
47
  root: path,
51
- generator: protogen_1.protoGenerateTsIndex
48
+ generator: protoGenerateTsIndex
52
49
  }
53
50
  });
54
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tsProtoNodePlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tsProtoNodePlugin.ts"],"names":[],"mappings":";;;AAAA,yCAAoD;AACpD,6CAAyK;AACzK,6BAAwB;AAExB,MAAM,uBAAuB,GAAC,OAAC,CAAC,MAAM,CACtC;IACI;;OAEG;IACH,eAAe,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAErC;;OAEG;IACH,kBAAkB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAExC;;OAEG;IACH,mBAAmB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEzC;;OAEG;IACH,wBAAwB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE9C;;OAEG;IACH,qBAAqB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE3C;;OAEG;IACH,iBAAiB,EAAC,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAA;AAEW,QAAA,iBAAiB,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AAA;IAEN,CAAC;CACJ,CAAA"}
1
+ {"version":3,"file":"tsProtoNodePlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/tsProtoNodePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAmC,yBAAyB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AACzK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,uBAAuB,GAAC,CAAC,CAAC,MAAM,CACtC;IACI;;OAEG;IACH,eAAe,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAErC;;OAEG;IACH,kBAAkB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAExC;;OAEG;IACH,mBAAmB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEzC;;OAEG;IACH,wBAAwB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE9C;;OAEG;IACH,qBAAqB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE3C;;OAEG;IACH,iBAAiB,EAAC,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAC9B;IACI,YAAY,EAAC,uBAAuB;IACpC,QAAQ,EAAC,KAAK,EAAE,EACZ,SAAS,EACT,OAAO,EACP,GAAG,EACH,GAAG,EACH,KAAK,EACL,SAAS,EACT,QAAQ,EACR,YAAY,EACf,EAAC,EACE,kBAAkB,GAAC,aAAa,EAChC,eAAe,GAAC,kBAAkB,EAClC,mBAAmB,GAAC,eAAe,EACnC,qBAAqB,GAAC,YAAY,EAClC,wBAAwB,GAAC,kBAAkB,EAC3C,iBAAiB,GAAC,KAAK,GAC1B,EAAC,EAAE;QAEA,MAAM,EAAC,IAAI,EAAC,WAAW,EAAC,GAAC,yBAAyB,CAC9C,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,EAAC,YAAY,EAAC,aAAa,EAAC,wBAAwB,EAAC,CACxD,CAAC;QAEF,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC;QAE/B,SAAS,CAAC,qBAAqB,CAAC,GAAC,WAAW,CAAC;QAE7C,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAC,SAAS,CAAC,IAAI,EAAC,mBAAmB,CAAC;YACxC,OAAO,EACnB;;eAEe,qBAAqB,IAAI,IAAI,CAAC,SAAS,CAClD,yBAAyB,CAAC,0BAA0B,CAAC,SAAS,CAAC,KAAK,EAAC,IAAI,CAAC,CAAC,CAAC,EAChF,IAAI,EAAC,iBAAiB,CAAA,CAAC,CAAA,CAAC,CAAA,CAAC,CAAA,GAAG,CAAC,MAAM,CAAC,6BAA6B;SACxD,CAAC,CAAA;QAEF,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAC,SAAS,CAAC,IAAI,EAAC,wBAAwB,CAAC;YAC7C,OAAO,EAAC,EAAE;YACV,cAAc,EAAC,IAAI;YACnB,SAAS,EAAC;gBACN,IAAI,EAAC,IAAI;gBACT,SAAS,EAAC,oBAAoB;aACjC;SACJ,CAAC,CAAA;IAEN,CAAC;CACJ,CAAA"}
@@ -1,35 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zodPlugin = void 0;
4
- const common_1 = require("@iyio/common");
5
- const protogen_1 = require("@iyio/protogen");
6
- const zod_1 = require("zod");
7
- const sharedTsConfig_1 = require("../sharedTsConfig");
8
- const ZodPluginConfig = zod_1.z.object({
1
+ import { asArray, getObjKeyCount, joinPaths } from "@iyio/common";
2
+ import { getProtoAutoDeleteComment, getProtoPluginPackAndPath, protoChildrenToArray, protoFormatTsComment, protoGenerateTsIndex, protoGetChildrenByName, protoGetFullNodeComment, protoGetFullNodeTsComment, protoTsBuiltTypes, protoTsNumTypes, protoTsTypeMap } from "@iyio/protogen";
3
+ import { z } from "zod";
4
+ import { SharedTsPluginConfigScheme, getTsSchemeName } from "../sharedTsConfig.js";
5
+ const ZodPluginConfig = z.object({
9
6
  /**
10
7
  * @default .zodPackage
11
8
  */
12
- zodPath: zod_1.z.string().optional(),
9
+ zodPath: z.string().optional(),
13
10
  /**
14
11
  * @default "types-index.ts"
15
12
  */
16
- zodIndexFilename: zod_1.z.string().optional(),
13
+ zodIndexFilename: z.string().optional(),
17
14
  /**
18
15
  * @default "types"
19
16
  */
20
- zodPackage: zod_1.z.string().optional(),
17
+ zodPackage: z.string().optional(),
21
18
  /**
22
19
  * A comma separated list of properties that should be converted as long strings.
23
20
  */
24
- longStringProps: zod_1.z.string().optional(),
25
- }).merge(sharedTsConfig_1.SharedTsPluginConfigScheme);
26
- exports.zodPlugin = {
21
+ longStringProps: z.string().optional(),
22
+ }).merge(SharedTsPluginConfigScheme);
23
+ export const zodPlugin = {
27
24
  configScheme: ZodPluginConfig,
28
25
  generate: async ({ log, nodes, outputs, importMap, tab, packagePaths, namespace, libStyle, }, { zodPackage = 'types', zodIndexFilename = 'types-index.ts', zodPath, longStringProps, ...tsConfig }) => {
29
- const { path, packageName } = (0, protogen_1.getProtoPluginPackAndPath)(namespace, zodPackage, zodPath, libStyle, { packagePaths, indexFilename: zodIndexFilename });
26
+ const { path, packageName } = getProtoPluginPackAndPath(namespace, zodPackage, zodPath, libStyle, { packagePaths, indexFilename: zodIndexFilename });
30
27
  const autoLong = longStringProps ? longStringProps.split(',').map(s => s.trim()) : [];
31
28
  log(`zodPlugin. node count = ${nodes.length}`);
32
- const getFullName = (name) => (0, sharedTsConfig_1.getTsSchemeName)(name, tsConfig);
29
+ const getFullName = (name) => getTsSchemeName(name, tsConfig);
33
30
  const useCustomTypes = [];
34
31
  for (const node of nodes) {
35
32
  const schemeOut = [];
@@ -105,12 +102,12 @@ exports.zodPlugin = {
105
102
  }
106
103
  }
107
104
  outputs.push({
108
- path: (0, common_1.joinPaths)(path, zodIndexFilename),
105
+ path: joinPaths(path, zodIndexFilename),
109
106
  content: '',
110
107
  isPackageIndex: true,
111
108
  generator: {
112
109
  root: path,
113
- generator: protogen_1.protoGenerateTsIndex
110
+ generator: protoGenerateTsIndex
114
111
  }
115
112
  });
116
113
  }
@@ -131,15 +128,15 @@ const addOutputs = (node, path, pathSuffix, append, outputs, out, imports, impor
131
128
  for (const path in im) {
132
129
  out.unshift(`import${importAsTypes ? ' type' : ''} { ${im[path]?.join(', ')} } from '${path}';`);
133
130
  }
134
- out.unshift((0, protogen_1.getProtoAutoDeleteComment)([node.name]), `// this file was auto generated by @iyio/protogen - https://github.com/iyioio/common/tree/main/packages/protogen`, ...append);
131
+ out.unshift(getProtoAutoDeleteComment([node.name]), `// this file was auto generated by @iyio/protogen - https://github.com/iyioio/common/tree/main/packages/protogen`, ...append);
135
132
  outputs.push({
136
- path: (0, common_1.joinPaths)(path, node.name + pathSuffix + '.ts'),
133
+ path: joinPaths(path, node.name + pathSuffix + '.ts'),
137
134
  content: out.join('\n'),
138
135
  });
139
136
  };
140
137
  const addEnum = (node, schemeOut, typeOut, tab, getFullName) => {
141
138
  const fullName = getFullName(node.name);
142
- const comment = (0, protogen_1.protoGetFullNodeTsComment)(node, '');
139
+ const comment = protoGetFullNodeTsComment(node, '');
143
140
  typeOut.push('');
144
141
  if (comment) {
145
142
  typeOut.push(comment);
@@ -157,7 +154,7 @@ const addEnum = (node, schemeOut, typeOut, tab, getFullName) => {
157
154
  }
158
155
  }
159
156
  typeOut.push('}');
160
- const schemeComment = (0, protogen_1.protoGetFullNodeComment)(node, '');
157
+ const schemeComment = protoGetFullNodeComment(node, '');
161
158
  let schemeDesc = '';
162
159
  if (schemeComment) {
163
160
  schemeDesc = `.describe(${JSON.stringify(schemeComment)})`;
@@ -167,7 +164,7 @@ const addEnum = (node, schemeOut, typeOut, tab, getFullName) => {
167
164
  };
168
165
  const addUnion = (node, schemeOut, typeOut, tab, getFullName) => {
169
166
  const fullName = getFullName(node.name);
170
- const comment = (0, protogen_1.protoGetFullNodeTsComment)(node, '');
167
+ const comment = protoGetFullNodeTsComment(node, '');
171
168
  schemeOut.push('');
172
169
  schemeOut.push(`export const ${fullName}=z.enum([`);
173
170
  typeOut.push('');
@@ -207,7 +204,7 @@ const addUnion = (node, schemeOut, typeOut, tab, getFullName) => {
207
204
  typeOut.push(comment);
208
205
  }
209
206
  typeOut.push(`export const all${node.name}Ary:${node.name}[]=unionAry as any;`);
210
- const schemeComment = (0, protogen_1.protoGetFullNodeComment)(node, '');
207
+ const schemeComment = protoGetFullNodeComment(node, '');
211
208
  if (schemeComment) {
212
209
  schemeOut.push(`]).describe(${JSON.stringify(schemeComment)});`);
213
210
  }
@@ -226,7 +223,7 @@ const addAlias = (node, out, tab) => {
226
223
  if (!child || child.isContent || child.special) {
227
224
  continue;
228
225
  }
229
- const aliases = (0, protogen_1.protoGetChildrenByName)(child, 'alias', false);
226
+ const aliases = protoGetChildrenByName(child, 'alias', false);
230
227
  if (aliases.length) {
231
228
  hasAlias = true;
232
229
  for (const a of aliases) {
@@ -259,7 +256,7 @@ const addAlias = (node, out, tab) => {
259
256
  return null;
260
257
  };
261
258
  const addArray = (node, out, tab) => {
262
- const comment = (0, protogen_1.protoGetFullNodeTsComment)(node, '');
259
+ const comment = protoGetFullNodeTsComment(node, '');
263
260
  out.push('');
264
261
  if (comment) {
265
262
  out.push(comment);
@@ -278,7 +275,7 @@ const addArray = (node, out, tab) => {
278
275
  return node.name + 'Ary';
279
276
  };
280
277
  const addMap = (node, out, tab) => {
281
- const comment = (0, protogen_1.protoGetFullNodeTsComment)(node, '');
278
+ const comment = protoGetFullNodeTsComment(node, '');
282
279
  out.push('');
283
280
  if (comment) {
284
281
  out.push(comment);
@@ -298,7 +295,7 @@ const addMap = (node, out, tab) => {
298
295
  };
299
296
  const addInterface = (node, schemeOut, typeOut, tab, autoLong, getFullName, useCustomTypes, schemeImports, typeImports, propFilter) => {
300
297
  const fullName = getFullName(node.name);
301
- const children = (0, protogen_1.protoChildrenToArray)(node.children);
298
+ const children = protoChildrenToArray(node.children);
302
299
  const hasCustoms = children.some(c => !isBuiltInType(c.type)) ? true : false;
303
300
  schemeOut.push('');
304
301
  if (hasCustoms) {
@@ -307,7 +304,7 @@ const addInterface = (node, schemeOut, typeOut, tab, autoLong, getFullName, useC
307
304
  else {
308
305
  schemeOut.push(`export const ${fullName}=z.object({`);
309
306
  }
310
- const imports = (0, protogen_1.protoGetChildrenByName)(node, '$import', false);
307
+ const imports = protoGetChildrenByName(node, '$import', false);
311
308
  for (const imp of imports) {
312
309
  if (imp.value?.trim()) {
313
310
  typeOut.push(`import type ${imp.value?.trim()};`);
@@ -315,9 +312,9 @@ const addInterface = (node, schemeOut, typeOut, tab, autoLong, getFullName, useC
315
312
  }
316
313
  typeOut.push('');
317
314
  if (node.comment) {
318
- typeOut.push((0, protogen_1.protoFormatTsComment)(node.comment, ''));
315
+ typeOut.push(protoFormatTsComment(node.comment, ''));
319
316
  }
320
- zod_1.z.object({}).passthrough();
317
+ z.object({}).passthrough();
321
318
  const interfaceIndex = typeOut.length;
322
319
  const ext = node.types.map(t => /^_(\w+)_$/.exec(t.type)).filter(m => m).map(m => m?.[0] ?? '');
323
320
  typeOut.push(`export interface ${node.name}${ext.length ? ` extends ${ext.join(', ')}` : ''}`);
@@ -330,7 +327,7 @@ const addInterface = (node, schemeOut, typeOut, tab, autoLong, getFullName, useC
330
327
  if (prop.special || prop.isContent || (propFilter && !propFilter(prop))) {
331
328
  continue;
332
329
  }
333
- const propType = protogen_1.protoTsTypeMap[prop.type] ?? prop.type ?? 'string';
330
+ const propType = protoTsTypeMap[prop.type] ?? prop.type ?? 'string';
334
331
  const isBuiltIn = isBuiltInType(propType);
335
332
  const isStringRecord = prop.types[0]?.mapType === 'string';
336
333
  const isArray = prop.types[0]?.isArray;
@@ -339,7 +336,7 @@ const addInterface = (node, schemeOut, typeOut, tab, autoLong, getFullName, useC
339
336
  typeImports[propType] = `./${propType}`;
340
337
  schemeImports[propType + 'Scheme'] = `./${propType}Scheme`;
341
338
  }
342
- const tsLine = `${prop.comment ? (0, protogen_1.protoFormatTsComment)(prop.comment, tab) + '\n' : ''}${tab}${prop.name}${prop.optional ? '?' : ''}:${isStringRecord ? `Record<${prop.types[0]?.mapType},${propType}>` : propType}${isArray ? '[]' : ''};`;
339
+ const tsLine = `${prop.comment ? protoFormatTsComment(prop.comment, tab) + '\n' : ''}${tab}${prop.name}${prop.optional ? '?' : ''}:${isStringRecord ? `Record<${prop.types[0]?.mapType},${propType}>` : propType}${isArray ? '[]' : ''};`;
343
340
  typeRefs.push(tsLine);
344
341
  lazyProps.push(`${tab}${prop.name}:z.lazy(()=>${isStringRecord ?
345
342
  `z.record(${getFullName(propType)})` :
@@ -354,7 +351,7 @@ const addInterface = (node, schemeOut, typeOut, tab, autoLong, getFullName, useC
354
351
  schemeOut.push(`${tab}${prop.name}:${customType || (isStringRecord ?
355
352
  `z.record(z.${propType}()${getFormatCalls(prop, propType, autoLong)})` :
356
353
  `z.${propType}()${getFormatCalls(prop, propType, autoLong)}`)}${isArray ? '.array()' : ''}${prop.optional ? '.optional()' : ''}${getDescribeCall(prop)},`);
357
- typeOut.push(`${prop.comment ? (0, protogen_1.protoFormatTsComment)(prop.comment, tab) + '\n' : ''}${tab}${prop.name}${prop.optional ? '?' : ''}:${customTypeTs || (isStringRecord ?
354
+ typeOut.push(`${prop.comment ? protoFormatTsComment(prop.comment, tab) + '\n' : ''}${tab}${prop.name}${prop.optional ? '?' : ''}:${customTypeTs || (isStringRecord ?
358
355
  `Record<string,${propType}>` :
359
356
  propType)}${isArray ? '[]' : ''};`);
360
357
  }
@@ -398,7 +395,7 @@ const getRealCustomTypeTs = (type) => {
398
395
  }
399
396
  };
400
397
  const isBuiltInType = (type) => {
401
- return protogen_1.protoTsBuiltTypes.includes(type) || customBuiltIns.includes(type);
398
+ return protoTsBuiltTypes.includes(type) || customBuiltIns.includes(type);
402
399
  };
403
400
  const getFormatCalls = (prop, propType, autoLong) => {
404
401
  let call = '';
@@ -406,7 +403,7 @@ const getFormatCalls = (prop, propType, autoLong) => {
406
403
  if (!att) {
407
404
  return;
408
405
  }
409
- type = (0, common_1.asArray)(type);
406
+ type = asArray(type);
410
407
  if (!type.includes(propType)) {
411
408
  return;
412
409
  }
@@ -442,8 +439,8 @@ const getFormatCalls = (prop, propType, autoLong) => {
442
439
  if (prop.type === 'int' && !attChildren['int']) {
443
440
  call += '.int()';
444
441
  }
445
- add(['string', ...protogen_1.protoTsNumTypes], 'min', attChildren['min'], att => parseNum(att.value));
446
- add(['string', ...protogen_1.protoTsNumTypes], 'max', attChildren['max'], att => parseNum(att.value));
442
+ add(['string', ...protoTsNumTypes], 'min', attChildren['min'], att => parseNum(att.value));
443
+ add(['string', ...protoTsNumTypes], 'max', attChildren['max'], att => parseNum(att.value));
447
444
  add(['string'], 'length', attChildren['length'], att => parseNum(att.value));
448
445
  add(['string'], 'endsWith', attChildren['endsWith'], att => att.value);
449
446
  add(['string'], 'startsWith', attChildren['startsWith'], att => att.value);
@@ -474,19 +471,19 @@ const getFormatCalls = (prop, propType, autoLong) => {
474
471
  message: att.children?.['message']?.value,
475
472
  })
476
473
  });
477
- add(protogen_1.protoTsNumTypes, 'gte', attChildren['gte'], att => parseNum(att.value));
478
- add(protogen_1.protoTsNumTypes, 'gt', attChildren['gt'], att => parseNum(att.value));
479
- add(protogen_1.protoTsNumTypes, 'lte', attChildren['lte'], att => parseNum(att.value));
480
- add(protogen_1.protoTsNumTypes, 'lt', attChildren['lt'], att => parseNum(att.value));
481
- add(protogen_1.protoTsNumTypes, 'multipleOf', attChildren['multipleOf'], att => parseNum(att.value));
482
- add(protogen_1.protoTsNumTypes, 'step', attChildren['step'], att => parseNum(att.value));
483
- add(protogen_1.protoTsNumTypes, 'int', attChildren['int']);
484
- add(protogen_1.protoTsNumTypes, 'positive', attChildren['positive']);
485
- add(protogen_1.protoTsNumTypes, 'negative', attChildren['negative']);
486
- add(protogen_1.protoTsNumTypes, 'nonpositive', attChildren['notPositive']);
487
- add(protogen_1.protoTsNumTypes, 'nonnegative', attChildren['notNegative']);
488
- add(protogen_1.protoTsNumTypes, 'finite', attChildren['finite']);
489
- add(protogen_1.protoTsNumTypes, 'safe', attChildren['safe']);
474
+ add(protoTsNumTypes, 'gte', attChildren['gte'], att => parseNum(att.value));
475
+ add(protoTsNumTypes, 'gt', attChildren['gt'], att => parseNum(att.value));
476
+ add(protoTsNumTypes, 'lte', attChildren['lte'], att => parseNum(att.value));
477
+ add(protoTsNumTypes, 'lt', attChildren['lt'], att => parseNum(att.value));
478
+ add(protoTsNumTypes, 'multipleOf', attChildren['multipleOf'], att => parseNum(att.value));
479
+ add(protoTsNumTypes, 'step', attChildren['step'], att => parseNum(att.value));
480
+ add(protoTsNumTypes, 'int', attChildren['int']);
481
+ add(protoTsNumTypes, 'positive', attChildren['positive']);
482
+ add(protoTsNumTypes, 'negative', attChildren['negative']);
483
+ add(protoTsNumTypes, 'nonpositive', attChildren['notPositive']);
484
+ add(protoTsNumTypes, 'nonnegative', attChildren['notNegative']);
485
+ add(protoTsNumTypes, 'finite', attChildren['finite']);
486
+ add(protoTsNumTypes, 'safe', attChildren['safe']);
490
487
  add('date', 'min', attChildren['min'], att => `new Date(${JSON.stringify(att.value)})`, { rawValue: true });
491
488
  add('date', 'max', attChildren['max'], att => `new Date(${JSON.stringify(att.value)})`, { rawValue: true });
492
489
  return call;
@@ -514,7 +511,7 @@ const parseObj = (obj) => {
514
511
  obj[e] = value;
515
512
  }
516
513
  }
517
- return (0, common_1.getObjKeyCount)(obj) ? JSON.stringify(obj) : null;
514
+ return getObjKeyCount(obj) ? JSON.stringify(obj) : null;
518
515
  };
519
516
  const paseRegex = (att) => {
520
517
  if (!att.value) {