@iyio/protogen-runtime 0.0.11 → 0.0.13

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 (123) hide show
  1. package/esm/src/lib/default-plugins.js +42 -0
  2. package/esm/src/lib/default-plugins.js.map +1 -1
  3. package/esm/src/lib/plugins/actionPlugin.d.ts +40 -0
  4. package/esm/src/lib/plugins/actionPlugin.js +97 -0
  5. package/esm/src/lib/plugins/actionPlugin.js.map +1 -0
  6. package/esm/src/lib/plugins/assignPlugin.d.ts +20 -0
  7. package/esm/src/lib/plugins/assignPlugin.js +52 -0
  8. package/esm/src/lib/plugins/assignPlugin.js.map +1 -0
  9. package/esm/src/lib/plugins/autoPackageIndexPlugin.js +10 -0
  10. package/esm/src/lib/plugins/autoPackageIndexPlugin.js.map +1 -1
  11. package/esm/src/lib/plugins/bucketCdkTemplate.js +4 -2
  12. package/esm/src/lib/plugins/bucketCdkTemplate.js.map +1 -1
  13. package/esm/src/lib/plugins/bucketPlugin.js +16 -4
  14. package/esm/src/lib/plugins/bucketPlugin.js.map +1 -1
  15. package/esm/src/lib/plugins/callablePlugin.d.ts +40 -0
  16. package/esm/src/lib/plugins/callablePlugin.js +86 -0
  17. package/esm/src/lib/plugins/callablePlugin.js.map +1 -0
  18. package/esm/src/lib/plugins/examplePlugin.js +1 -2
  19. package/esm/src/lib/plugins/examplePlugin.js.map +1 -1
  20. package/esm/src/lib/plugins/fileWriter.js +3 -2
  21. package/esm/src/lib/plugins/fileWriter.js.map +1 -1
  22. package/esm/src/lib/plugins/functionPlugin.js +37 -8
  23. package/esm/src/lib/plugins/functionPlugin.js.map +1 -1
  24. package/esm/src/lib/plugins/nextJsAppPlugin.js +14 -5
  25. package/esm/src/lib/plugins/nextJsAppPlugin.js.map +1 -1
  26. package/esm/src/lib/plugins/nextJsAppTemplate.js +18 -0
  27. package/esm/src/lib/plugins/nextJsAppTemplate.js.map +1 -1
  28. package/esm/src/lib/plugins/nextJsPagePlugin.d.ts +15 -0
  29. package/esm/src/lib/plugins/nextJsPagePlugin.js +65 -0
  30. package/esm/src/lib/plugins/nextJsPagePlugin.js.map +1 -0
  31. package/esm/src/lib/plugins/reactCompPlugin.js +1 -1
  32. package/esm/src/lib/plugins/reactCompPlugin.js.map +1 -1
  33. package/esm/src/lib/plugins/serverFnCdkTemplate.d.ts +2 -1
  34. package/esm/src/lib/plugins/serverFnCdkTemplate.js +10 -3
  35. package/esm/src/lib/plugins/serverFnCdkTemplate.js.map +1 -1
  36. package/esm/src/lib/plugins/serverFnPlugin.d.ts +6 -0
  37. package/esm/src/lib/plugins/serverFnPlugin.js +87 -23
  38. package/esm/src/lib/plugins/serverFnPlugin.js.map +1 -1
  39. package/esm/src/lib/plugins/sqlMigrationCdkTemplate.d.ts +5 -0
  40. package/esm/src/lib/plugins/sqlMigrationCdkTemplate.js +40 -0
  41. package/esm/src/lib/plugins/sqlMigrationCdkTemplate.js.map +1 -0
  42. package/esm/src/lib/plugins/sqlMigrationsPlugin.d.ts +39 -0
  43. package/esm/src/lib/plugins/sqlMigrationsPlugin.js +114 -0
  44. package/esm/src/lib/plugins/sqlMigrationsPlugin.js.map +1 -0
  45. package/esm/src/lib/plugins/sqlTablePlugin.d.ts +64 -0
  46. package/esm/src/lib/plugins/sqlTablePlugin.js +162 -0
  47. package/esm/src/lib/plugins/sqlTablePlugin.js.map +1 -0
  48. package/esm/src/lib/plugins/tablePlugin.js +16 -134
  49. package/esm/src/lib/plugins/tablePlugin.js.map +1 -1
  50. package/esm/src/lib/plugins/tsProtoNodePlugin.js +1 -1
  51. package/esm/src/lib/plugins/tsProtoNodePlugin.js.map +1 -1
  52. package/esm/src/lib/plugins/userPoolPlugin.js +16 -1
  53. package/esm/src/lib/plugins/userPoolPlugin.js.map +1 -1
  54. package/esm/src/lib/plugins/zodPlugin.d.ts +3 -0
  55. package/esm/src/lib/plugins/zodPlugin.js +151 -33
  56. package/esm/src/lib/plugins/zodPlugin.js.map +1 -1
  57. package/esm/src/lib/protogen-table-generator.d.ts +39 -0
  58. package/esm/src/lib/protogen-table-generator.js +181 -0
  59. package/esm/src/lib/protogen-table-generator.js.map +1 -0
  60. package/esm/src/lib/runProtogenCliAsync.js +5 -0
  61. package/esm/src/lib/runProtogenCliAsync.js.map +1 -1
  62. package/package.json +18 -10
  63. package/src/lib/default-plugins.js +42 -0
  64. package/src/lib/default-plugins.js.map +1 -1
  65. package/src/lib/plugins/actionPlugin.d.ts +40 -0
  66. package/src/lib/plugins/actionPlugin.js +100 -0
  67. package/src/lib/plugins/actionPlugin.js.map +1 -0
  68. package/src/lib/plugins/assignPlugin.d.ts +20 -0
  69. package/src/lib/plugins/assignPlugin.js +55 -0
  70. package/src/lib/plugins/assignPlugin.js.map +1 -0
  71. package/src/lib/plugins/autoPackageIndexPlugin.js +10 -0
  72. package/src/lib/plugins/autoPackageIndexPlugin.js.map +1 -1
  73. package/src/lib/plugins/bucketCdkTemplate.js +4 -2
  74. package/src/lib/plugins/bucketCdkTemplate.js.map +1 -1
  75. package/src/lib/plugins/bucketPlugin.js +15 -3
  76. package/src/lib/plugins/bucketPlugin.js.map +1 -1
  77. package/src/lib/plugins/callablePlugin.d.ts +40 -0
  78. package/src/lib/plugins/callablePlugin.js +89 -0
  79. package/src/lib/plugins/callablePlugin.js.map +1 -0
  80. package/src/lib/plugins/examplePlugin.js +1 -2
  81. package/src/lib/plugins/examplePlugin.js.map +1 -1
  82. package/src/lib/plugins/fileWriter.js +3 -2
  83. package/src/lib/plugins/fileWriter.js.map +1 -1
  84. package/src/lib/plugins/functionPlugin.js +36 -7
  85. package/src/lib/plugins/functionPlugin.js.map +1 -1
  86. package/src/lib/plugins/nextJsAppPlugin.js +13 -4
  87. package/src/lib/plugins/nextJsAppPlugin.js.map +1 -1
  88. package/src/lib/plugins/nextJsAppTemplate.js +18 -0
  89. package/src/lib/plugins/nextJsAppTemplate.js.map +1 -1
  90. package/src/lib/plugins/nextJsPagePlugin.d.ts +15 -0
  91. package/src/lib/plugins/nextJsPagePlugin.js +68 -0
  92. package/src/lib/plugins/nextJsPagePlugin.js.map +1 -0
  93. package/src/lib/plugins/reactCompPlugin.js +1 -1
  94. package/src/lib/plugins/reactCompPlugin.js.map +1 -1
  95. package/src/lib/plugins/serverFnCdkTemplate.d.ts +2 -1
  96. package/src/lib/plugins/serverFnCdkTemplate.js +10 -3
  97. package/src/lib/plugins/serverFnCdkTemplate.js.map +1 -1
  98. package/src/lib/plugins/serverFnPlugin.d.ts +6 -0
  99. package/src/lib/plugins/serverFnPlugin.js +85 -21
  100. package/src/lib/plugins/serverFnPlugin.js.map +1 -1
  101. package/src/lib/plugins/sqlMigrationCdkTemplate.d.ts +5 -0
  102. package/src/lib/plugins/sqlMigrationCdkTemplate.js +44 -0
  103. package/src/lib/plugins/sqlMigrationCdkTemplate.js.map +1 -0
  104. package/src/lib/plugins/sqlMigrationsPlugin.d.ts +39 -0
  105. package/src/lib/plugins/sqlMigrationsPlugin.js +117 -0
  106. package/src/lib/plugins/sqlMigrationsPlugin.js.map +1 -0
  107. package/src/lib/plugins/sqlTablePlugin.d.ts +64 -0
  108. package/src/lib/plugins/sqlTablePlugin.js +165 -0
  109. package/src/lib/plugins/sqlTablePlugin.js.map +1 -0
  110. package/src/lib/plugins/tablePlugin.js +15 -133
  111. package/src/lib/plugins/tablePlugin.js.map +1 -1
  112. package/src/lib/plugins/tsProtoNodePlugin.js +1 -1
  113. package/src/lib/plugins/tsProtoNodePlugin.js.map +1 -1
  114. package/src/lib/plugins/userPoolPlugin.js +16 -1
  115. package/src/lib/plugins/userPoolPlugin.js.map +1 -1
  116. package/src/lib/plugins/zodPlugin.d.ts +3 -0
  117. package/src/lib/plugins/zodPlugin.js +149 -31
  118. package/src/lib/plugins/zodPlugin.js.map +1 -1
  119. package/src/lib/protogen-table-generator.d.ts +39 -0
  120. package/src/lib/protogen-table-generator.js +185 -0
  121. package/src/lib/protogen-table-generator.js.map +1 -0
  122. package/src/lib/runProtogenCliAsync.js +5 -0
  123. package/src/lib/runProtogenCliAsync.js.map +1 -1
@@ -1,13 +1,9 @@
1
1
  import { __awaiter, __rest } from "tslib";
2
- import { joinPaths, notWordRegex } from "@iyio/common";
3
- import { addTsImport, getProtoPluginPackAndPath, protoAddContextParam, protoFormatTsComment, protoGenerateTsIndex, protoGetChildren, protoGetChildrenByName, protoGetParamName, protoPrependTsImports } from "@iyio/protogen";
4
2
  import { z } from "zod";
5
- import { SharedTsPluginConfigScheme, getTsSchemeName } from "../sharedTsConfig";
3
+ import { generateProtoTable } from "../protogen-table-generator";
4
+ import { SharedTsPluginConfigScheme } from "../sharedTsConfig";
6
5
  import { tableCdkTemplate } from "./tableCdkTemplate";
7
6
  const TablePluginConfig = z.object({
8
- /**
9
- * @default .tablePackage
10
- */
11
7
  tablePath: z.string().optional(),
12
8
  /**
13
9
  * @default "tables.ts"
@@ -45,136 +41,22 @@ const TablePluginConfig = z.object({
45
41
  }).merge(SharedTsPluginConfigScheme);
46
42
  export const tablePlugin = {
47
43
  configScheme: TablePluginConfig,
48
- generate: ({ log, nodes, outputs, importMap, tab, packagePaths, namespace, libStyle, paramPackage, paramMap }, _a) => __awaiter(void 0, void 0, void 0, function* () {
49
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
50
- var { tablePath, tablePackage = 'tables', tableFilename = 'tables.ts', tableIndexFilename = 'tables-index.ts', tableUseParamIds, dataTableDescriptionPackage = '@iyio/common', allTableArrayName = 'allTables', tableCdkConstructClassName = 'Tbls', tableCdkConstructFile = libStyle === 'nx' ? `packages/cdk/src/${tableCdkConstructClassName}.ts` : undefined } = _a, tsConfig = __rest(_a, ["tablePath", "tablePackage", "tableFilename", "tableIndexFilename", "tableUseParamIds", "dataTableDescriptionPackage", "allTableArrayName", "tableCdkConstructClassName", "tableCdkConstructFile"]);
51
- const { path, packageName } = getProtoPluginPackAndPath(namespace, tablePackage, tablePath, libStyle, { packagePaths, indexFilename: tableIndexFilename });
52
- const imports = [];
53
- const localImportMap = {};
54
- const addImport = (im, packageName) => {
55
- addTsImport(im, packageName, imports, importMap);
56
- };
57
- const supported = nodes.filter(node => node.types.some(t => t.type === 'table'));
58
- if (supported.length) {
59
- addImport('DataTableDescription', dataTableDescriptionPackage);
60
- addImport('DataTableIndex', dataTableDescriptionPackage);
61
- }
62
- log(`${supported.length} supported node(s)`);
63
- const out = [];
64
- const tableNames = [];
65
- const tableInfos = [];
66
- for (const node of supported) {
67
- const name = node.name;
68
- const paramName = protoGetParamName(name + 'Table');
69
- importMap[name + 'Table'] = packageName;
70
- importMap[name + 'TableIndexMap'] = packageName;
71
- tableNames.push(name + 'Table');
72
- tableInfos.push({ name: name + 'Table', paramName });
73
- log(`table - ${name}Table`);
74
- const props = protoGetChildren(node, false);
75
- out.push('');
76
- if (node.comment) {
77
- out.push(protoFormatTsComment(node.comment, ''));
78
- }
79
- addImport(name);
80
- out.push(`export const ${name}Table:DataTableDescription<${name}>={`);
81
- out.push(`${tab}name:${JSON.stringify(name)},`);
82
- const primary = props.find(n => { var _a; return (_a = n.children) === null || _a === void 0 ? void 0 : _a['primaryKey']; });
83
- out.push(`${tab}primaryKey:${primary ? JSON.stringify(primary.name) : '"id"'},`);
84
- if (tableUseParamIds) {
85
- protoAddContextParam(name + 'Table', paramPackage, paramMap, importMap);
86
- addImport(paramName, paramPackage);
87
- out.push(`${tab}tableIdParam:${paramName},`);
88
- }
89
- const config = (_d = (_c = (_b = node.children) === null || _b === void 0 ? void 0 : _b['$table']) === null || _c === void 0 ? void 0 : _c.children) !== null && _d !== void 0 ? _d : {};
90
- let configValue;
91
- configValue = (_f = (_e = config['scheme']) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : getTsSchemeName(name, tsConfig);
92
- if (importMap[configValue]) {
93
- addImport(configValue);
94
- out.push(`${tab}scheme:${configValue},`);
95
- }
96
- if (configValue = (_g = config['mountPath']) === null || _g === void 0 ? void 0 : _g.value) {
97
- out.push(`${tab}mountPath:${JSON.stringify(configValue)},`);
98
- }
99
- if (configValue = (_h = config['isReadonly']) === null || _h === void 0 ? void 0 : _h.value) {
100
- out.push(`${tab}isReadonly:${JSON.stringify(Boolean(configValue))},`);
101
- }
102
- if (configValue = (_k = (_j = config['watchable']) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.replace(notWordRegex, '')) {
103
- out.push(`${tab}watchable:${JSON.stringify(Boolean(configValue))},`);
104
- }
105
- if (configValue = (_m = (_l = config['defaultOrderProp']) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m.replace(notWordRegex, '')) {
106
- out.push(`${tab}defaultOrderProp:${JSON.stringify(configValue)},`);
107
- }
108
- if (configValue = (_p = (_o = config['defaultOrderDesc']) === null || _o === void 0 ? void 0 : _o.value) === null || _p === void 0 ? void 0 : _p.replace(notWordRegex, '')) {
109
- out.push(`${tab}defaultOrderDesc:${JSON.stringify(Boolean(configValue))},`);
110
- }
111
- if (configValue = (_s = (_r = (_q = config['ttlProp']) === null || _q === void 0 ? void 0 : _q.value) === null || _r === void 0 ? void 0 : _r.replace(notWordRegex, '')) !== null && _s !== void 0 ? _s : (_t = props.find(p => p.name === 'ttl')) === null || _t === void 0 ? void 0 : _t.name) {
112
- out.push(`${tab}ttlProp:${JSON.stringify(configValue)},`);
113
- }
114
- if (configValue = (_v = (_u = config['updateVersionProp']) === null || _u === void 0 ? void 0 : _u.value) !== null && _v !== void 0 ? _v : (_w = props.find(p => p.name === 'uv')) === null || _w === void 0 ? void 0 : _w.name) {
115
- out.push(`${tab}updateVersionProp:${JSON.stringify(configValue)},`);
116
- }
117
- const indexes = protoGetChildrenByName((_x = node.children) === null || _x === void 0 ? void 0 : _x['$table'], 'index', false);
118
- const indexOut = [];
119
- if (indexes.length) {
120
- out.push(`${tab}indexes:[`);
121
- for (let i = 0; i < indexes.length; i++) {
122
- const index = indexes[i];
123
- const indexName = index.value || 'index' + i;
124
- indexOut.push(`${tab}${JSON.stringify(indexName)}:${name}Table.indexes?.[${i}] as DataTableIndex,`);
125
- out.push(`${tab}${tab}{`);
126
- out.push(`${tab}${tab}${tab}name:${JSON.stringify(indexName)},`);
127
- const primaryProp = (_0 = (_z = (_y = index.children) === null || _y === void 0 ? void 0 : _y['primary']) === null || _z === void 0 ? void 0 : _z.value) === null || _0 === void 0 ? void 0 : _0.replace(notWordRegex, '');
128
- out.push(`${tab}${tab}${tab}primary:${JSON.stringify(primaryProp !== null && primaryProp !== void 0 ? primaryProp : indexName)},`);
129
- const sortProp = (_3 = (_2 = (_1 = index.children) === null || _1 === void 0 ? void 0 : _1['sort']) === null || _2 === void 0 ? void 0 : _2.value) === null || _3 === void 0 ? void 0 : _3.replace(notWordRegex, '');
130
- if (sortProp) {
131
- out.push(`${tab}${tab}${tab}sort:${JSON.stringify(sortProp)},`);
132
- }
133
- if ((_4 = index.children) === null || _4 === void 0 ? void 0 : _4['includeAll']) {
134
- out.push(`${tab}${tab}${tab}includeAll:true,`);
135
- }
136
- const includeProps = protoGetChildren((_5 = index.children) === null || _5 === void 0 ? void 0 : _5['include'], false);
137
- if (includeProps.length) {
138
- out.push(`${tab}${tab}${tab}include:[`);
139
- for (const incProp of includeProps) {
140
- out.push(`${tab}${tab}${tab}${tab}${JSON.stringify(incProp.name)},`);
141
- }
142
- out.push(`${tab}${tab}${tab}],`);
143
- }
144
- out.push(`${tab}${tab}},`);
145
- }
146
- out.push(`${tab}],`);
147
- }
148
- out.push('}');
149
- out.push(`export const ${name}TableIndexMap={`);
150
- out.push(...indexOut);
151
- out.push('}');
152
- }
153
- importMap[allTableArrayName] = packageName;
154
- out.push(`export const ${allTableArrayName}=[${tableNames.join(',')}] as const`);
155
- out.push(`Object.freeze(${allTableArrayName})`);
156
- if (imports.length) {
157
- protoPrependTsImports(imports, importMap, out, localImportMap);
44
+ generate: (context, _a) => __awaiter(void 0, void 0, void 0, function* () {
45
+ var { 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 } = _a, tsConfig = __rest(_a, ["tablePath", "tablePackage", "tableFilename", "tableIndexFilename", "tableUseParamIds", "dataTableDescriptionPackage", "allTableArrayName", "tableCdkConstructClassName", "tableCdkConstructFile"]);
46
+ const result = yield generateProtoTable(context, Object.assign({ pluginName: 'tablePlugin', supportedTypes: ['table'], tablePath,
47
+ tablePackage,
48
+ tableFilename,
49
+ tableIndexFilename,
50
+ tableUseParamIds,
51
+ dataTableDescriptionPackage,
52
+ allTableArrayName }, tsConfig));
53
+ if (!result) {
54
+ return;
158
55
  }
159
- out.splice(0, 0, `// this file was autogenerated by @iyio/protogen - https://github.com/iyioio/common/packages/protogen`);
160
- out.splice(1, 0, `// generator = tablePlugin`);
161
- outputs.push({
162
- path: joinPaths(path, tableFilename),
163
- content: out.join('\n'),
164
- });
165
- outputs.push({
166
- path: joinPaths(path, tableIndexFilename),
167
- content: '',
168
- isPackageIndex: true,
169
- generator: {
170
- root: path,
171
- generator: protoGenerateTsIndex
172
- }
173
- });
174
- if (tableCdkConstructFile) {
175
- outputs.push({
56
+ if (tableCdkConstructFile && tableCdkConstructClassName) {
57
+ context.outputs.push({
176
58
  path: tableCdkConstructFile,
177
- content: tableCdkTemplate(tableCdkConstructClassName, tableInfos, importMap)
59
+ content: tableCdkTemplate(tableCdkConstructClassName, result.tableInfos, context.importMap)
178
60
  });
179
61
  }
180
62
  })
@@ -1 +1 @@
1
- {"version":3,"file":"tablePlugin.js","sourceRoot":"","sources":["../../../../../../../packages/protogen-runtime/src/lib/plugins/tablePlugin.ts"],"names":[],"mappings":";AAAA,OAAO,EAAW,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAChE,OAA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Y,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,OAE9G,EADM,QAAQ,cAVS,mMAWvB,CADc;QAGX,MAAM,MAAM,GAAC,MAAM,kBAAkB,CAAC,OAAO,kBACzC,UAAU,EAAC,aAAa,EACxB,cAAc,EAAC,CAAC,OAAO,CAAC,EACxB,SAAS;YACT,YAAY;YACZ,aAAa;YACb,kBAAkB;YAClB,gBAAgB;YAChB,2BAA2B;YAC3B,iBAAiB,IACd,QAAQ,EACb,CAAA;QAEF,IAAG,CAAC,MAAM,EAAC;YACP,OAAO;SACV;QAED,IAAG,qBAAqB,IAAI,0BAA0B,EAAC;YACnD,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;SACL;IACL,CAAC,CAAA;CACJ,CAAA"}
@@ -38,7 +38,7 @@ export const tsProtoNodePlugin = {
38
38
  path: joinPaths(path, tsProtoNodeFilename),
39
39
  content: `import { ProtoAddressMap } from '@iyio/protogen';
40
40
 
41
- export const ${tsProtoNodeExportName}=${JSON.stringify(protoCreateNodeAddressMap(protoRemoveDisplayChildren(deepClone(nodes))), null, tsProtoNodeMinify ? 0 : tab.length)} satisfies ProtoAddressMap;`,
41
+ export const ${tsProtoNodeExportName}=${JSON.stringify(protoCreateNodeAddressMap(protoRemoveDisplayChildren(deepClone(nodes, 1000))), null, tsProtoNodeMinify ? 0 : tab.length)} satisfies ProtoAddressMap;`,
42
42
  });
43
43
  outputs.push({
44
44
  path: joinPaths(path, tsProtoNodeIndexFilename),
@@ -1 +1 @@
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,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,oBAAoB,EAAmC,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,CAAO,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,CAAC,CAAC,CAAC,EAC3E,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,CAAA;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,C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AC;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,CAAA;CACJ,CAAA"}
@@ -32,7 +32,7 @@ export const userPoolPlugin = {
32
32
  //userPoolPath=userPoolPackage,
33
33
  //userPoolIndexFilename='user-pool-index.ts',
34
34
  userPoolCdkConstructClassName = 'UsrPool', userPoolCdkConstructFile = libStyle === 'nx' ? `packages/cdk/src/${userPoolCdkConstructClassName}.ts` : undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
35
- var _a, _b, _c, _d;
35
+ var _a, _b, _c, _d, _e, _f;
36
36
  const supported = nodes.filter(n => supportedTypes.some(t => n.types.some(nt => nt.type === t)));
37
37
  log(`${supported.length} supported node(s)`);
38
38
  if (!supported.length) {
@@ -41,11 +41,26 @@ export const userPoolPlugin = {
41
41
  if (userPoolCdkConstructFile) {
42
42
  const access = (_b = (_a = supported[0]) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b['$access'];
43
43
  const anon = (_d = (_c = supported[0]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d['$anon-access'];
44
+ const triggersNode = (_f = (_e = supported[0]) === null || _e === void 0 ? void 0 : _e.children) === null || _f === void 0 ? void 0 : _f['$userPoolTriggers'];
45
+ const triggers = triggersNode ? {} : undefined;
46
+ if ((triggersNode === null || triggersNode === void 0 ? void 0 : triggersNode.children) && triggers) {
47
+ for (const name in triggersNode.children) {
48
+ const tNode = triggersNode.children[name];
49
+ if (!tNode) {
50
+ continue;
51
+ }
52
+ if (!nodes.find(n => n.name === tNode.type)) {
53
+ throw new Error(`No type found for trigger. trigger:${name}, type:${tNode.type}`);
54
+ }
55
+ triggers[name] = tNode.type;
56
+ }
57
+ }
44
58
  outputs.push({
45
59
  path: userPoolCdkConstructFile,
46
60
  content: userPoolCdkTemplate(userPoolCdkConstructClassName, {
47
61
  authorizedAccessRequests: access ? protoNodeChildrenToAccessRequests(access) : undefined,
48
62
  unauthorizedAccessRequests: anon ? protoNodeChildrenToAccessRequests(anon) : undefined,
63
+ triggers
49
64
  })
50
65
  });
51
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"userPoolPlugin.js","sourceRoot":"","sources":["../../../../../../../packages/protogen-runtime/src/lib/plugins/userPoolPlugin.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iCAAiC,EAAmC,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,cAAc,GAAC,CAAC,UAAU,CAAC,CAAC;AAElC,MAAM,oBAAoB,GAAC,CAAC,CAAC,MAAM,CACnC;IACI;;OAEG;IACH,YAAY,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAElC;;OAEG;IACH,eAAe,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAErC;;OAEG;IACH,qBAAqB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE3C;;OAEG;IACJ,6BAA6B,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,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AS;oBACnF,0BAA0B,EAAC,IAAI,CAAA,CAAC,CAAA,iCAAiC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAA,SAAS;iBACpF,CAAC;aACL,CAAC,CAAA;SACL;QAED,gGAAgG;IACpG,CAAC,CAAA;CACJ,CAAA"}
1
+ {"version":3,"file":"userPoolPlugin.js","sourceRoot":"","sources":["../../../../../../../packages/protogen-runtime/src/lib/plugins/userPoolPlugin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iCAAiC,EAAmC,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,cAAc,GAAC,CAAC,UAAU,CAAC,CAAC;AAElC,MAAM,oBAAoB,GAAC,CAAC,CAAC,MAAM,CACnC;IACI;;OAEG;IACH,YAAY,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAElC;;OAEG;IACH,eAAe,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAErC;;OAEG;IACH,qBAAqB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE3C;;OAEG;IACJ,6BAA6B,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAElD;;OAEG;IACH,wBAAwB,EAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAC3B;IACI,YAAY,EAAC,oBAAoB;IACjC,QAAQ,EAAC,CAAO,EACZ,OAAO,EACP,GAAG,EACH,KAAK,EACL,QAAQ,GACX,EAAC;IACE,8BAA8B;IAC9B,+BAA+B;IAC/B,6CAA6C;IAC7C,6BAA6B,GAAC,SAAS,EACvC,wBAAwB,GAAC,QAAQ,KAAG,IAAI,CAAA,CAAC,CAAA,oBAAoB,6BAA6B,KAAK,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AAsC,IAAI,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;qBACrF;oBACD,QAAQ,CAAC,IAAI,CAAC,GAAC,KAAK,CAAC,IAAI,CAAC;iBAC7B;aACJ;YAED,OAAO,CAAC,IAAI,CAAC;gBACT,IAAI,EAAC,wBAAwB;gBAC7B,OAAO,EAAC,mBAAmB,CAAC,6BAA6B,EAAC;oBACtD,wBAAwB,EAAC,MAAM,CAAA,CAAC,CAAA,iCAAiC,CAAC,MAAM,CAAC,CAAA,CAAC,CAAA,SAAS;oBACnF,0BAA0B,EAAC,IAAI,CAAA,CAAC,CAAA,iCAAiC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAA,SAAS;oBACjF,QAAQ;iBACX,CAAC;aACL,CAAC,CAAA;SACL;QAED,gGAAgG;IACpG,CAAC,CAAA;CACJ,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { ProtoPipelineConfigurablePlugin } from "@iyio/protogen";
2
2
  import { z } from "zod";
3
3
  declare const ZodPluginConfig: z.ZodObject<{
4
+ longStringProps: z.ZodOptional<z.ZodString>;
4
5
  zodPath: z.ZodOptional<z.ZodString>;
5
6
  zodFilename: z.ZodOptional<z.ZodString>;
6
7
  zodIndexFilename: z.ZodOptional<z.ZodString>;
@@ -8,6 +9,7 @@ declare const ZodPluginConfig: z.ZodObject<{
8
9
  tsSchemePrefix: z.ZodOptional<z.ZodString>;
9
10
  tsSchemeSuffix: z.ZodOptional<z.ZodString>;
10
11
  }, "strip", z.ZodTypeAny, {
12
+ longStringProps?: string | undefined;
11
13
  zodPath?: string | undefined;
12
14
  zodFilename?: string | undefined;
13
15
  zodIndexFilename?: string | undefined;
@@ -15,6 +17,7 @@ declare const ZodPluginConfig: z.ZodObject<{
15
17
  tsSchemePrefix?: string | undefined;
16
18
  tsSchemeSuffix?: string | undefined;
17
19
  }, {
20
+ longStringProps?: string | undefined;
18
21
  zodPath?: string | undefined;
19
22
  zodFilename?: string | undefined;
20
23
  zodIndexFilename?: string | undefined;
@@ -1,8 +1,8 @@
1
1
  import { __awaiter, __rest } from "tslib";
2
2
  import { asArray, getObjKeyCount, joinPaths } from "@iyio/common";
3
- import { getProtoPluginPackAndPath, protoChildrenToArray, protoFormatTsComment, protoGenerateTsIndex, protoTsBuiltTypes, protoTsNumTypes, protoTsTypeMap } from "@iyio/protogen";
3
+ import { getProtoPluginPackAndPath, protoChildrenToArray, protoFormatTsComment, protoGenerateTsIndex, protoGetChildrenByName, protoTsBuiltTypes, protoTsNumTypes, protoTsTypeMap } from "@iyio/protogen";
4
4
  import { z } from "zod";
5
- import { getTsSchemeName, SharedTsPluginConfigScheme } from "../sharedTsConfig";
5
+ import { SharedTsPluginConfigScheme, getTsSchemeName } from "../sharedTsConfig";
6
6
  const ZodPluginConfig = z.object({
7
7
  /**
8
8
  * @default .zodPackage
@@ -20,12 +20,18 @@ const ZodPluginConfig = z.object({
20
20
  * @default "types"
21
21
  */
22
22
  zodPackage: z.string().optional(),
23
+ /**
24
+ * A comma separated list of properties that should be converted as long strings.
25
+ */
26
+ longStringProps: z.string().optional(),
23
27
  }).merge(SharedTsPluginConfigScheme);
24
28
  export const zodPlugin = {
25
29
  configScheme: ZodPluginConfig,
26
30
  generate: ({ log, nodes, outputs, importMap, tab, packagePaths, namespace, libStyle, }, _a) => __awaiter(void 0, void 0, void 0, function* () {
27
- var { zodFilename = 'types.ts', zodPackage = 'types', zodIndexFilename = 'types-index.ts', zodPath } = _a, tsConfig = __rest(_a, ["zodFilename", "zodPackage", "zodIndexFilename", "zodPath"]);
31
+ var _b, _c;
32
+ var { zodFilename = 'types.ts', zodPackage = 'types', zodIndexFilename = 'types-index.ts', zodPath, longStringProps } = _a, tsConfig = __rest(_a, ["zodFilename", "zodPackage", "zodIndexFilename", "zodPath", "longStringProps"]);
28
33
  const { path, packageName } = getProtoPluginPackAndPath(namespace, zodPackage, zodPath, libStyle, { packagePaths, indexFilename: zodIndexFilename });
34
+ const autoLong = longStringProps ? longStringProps.split(',').map(s => s.trim()) : [];
29
35
  log(`zodPlugin. node count = ${nodes.length}`);
30
36
  const getFullName = (name) => getTsSchemeName(name, tsConfig);
31
37
  const out = [];
@@ -34,30 +40,66 @@ export const zodPlugin = {
34
40
  out.push(`// generator = zodPlugin`);
35
41
  out.push(`import { z } from 'zod';`);
36
42
  for (const node of nodes) {
37
- let added = true;
38
- switch (node.type) {
39
- case 'union':
40
- addUnion(node, out, tab, getFullName);
41
- break;
42
- case 'enum':
43
- addEnum(node, out, tab, getFullName);
44
- break;
45
- case 'entity':
46
- case 'struct':
47
- case 'interface':
48
- case 'class':
49
- case 'type':
50
- addInterface(node, out, tab, getFullName, useCustomTypes);
51
- break;
52
- default:
53
- added = false;
54
- break;
43
+ let anyAdded = false;
44
+ for (const nodeType of node.types) {
45
+ let added = true;
46
+ let nodeName = node.name;
47
+ switch (nodeType.type) {
48
+ case 'union':
49
+ addUnion(node, out, tab, getFullName);
50
+ break;
51
+ case 'enum':
52
+ addEnum(node, out, tab, getFullName);
53
+ break;
54
+ case 'array':
55
+ nodeName = addArray(node, out, tab);
56
+ break;
57
+ case 'map':
58
+ nodeName = addMap(node, out, tab);
59
+ break;
60
+ case 'function':
61
+ nodeName = node.name + 'FunctionArgs';
62
+ addInterface(Object.assign(Object.assign({}, (_c = (_b = node.children) === null || _b === void 0 ? void 0 : _b['args']) !== null && _c !== void 0 ? _c : {
63
+ name: 'args',
64
+ type: '',
65
+ address: '',
66
+ types: []
67
+ }), { name: nodeName }), out, tab, autoLong, getFullName, useCustomTypes);
68
+ break;
69
+ case 'serverFn':
70
+ nodeName = 'invoke' + node.name + 'FunctionArgs';
71
+ addInterface(Object.assign(Object.assign({}, node), { name: nodeName }), out, tab, autoLong, getFullName, useCustomTypes, prop => prop.name === 'input');
72
+ break;
73
+ case 'entity':
74
+ case 'struct':
75
+ case 'interface':
76
+ case 'class':
77
+ case 'event':
78
+ case 'type':
79
+ addInterface(node, out, tab, autoLong, getFullName, useCustomTypes);
80
+ break;
81
+ default:
82
+ added = false;
83
+ break;
84
+ }
85
+ if (added) {
86
+ anyAdded = true;
87
+ if (importMap[nodeName] === packageName) {
88
+ throw new Error(`Export conflict. ${nodeName} already exported from ${packageName}`);
89
+ }
90
+ importMap[nodeName] = packageName;
91
+ const fullName = getFullName(nodeName);
92
+ if (fullName !== nodeName) {
93
+ importMap[fullName] = packageName;
94
+ }
95
+ }
55
96
  }
56
- if (added) {
57
- importMap[node.name] = packageName;
58
- const fullName = getFullName(node.name);
59
- if (fullName !== node.name) {
60
- importMap[fullName] = packageName;
97
+ if (anyAdded) {
98
+ const names = addAlias(node, out, tab);
99
+ if (names) {
100
+ for (const name of names) {
101
+ importMap[name] = packageName;
102
+ }
61
103
  }
62
104
  }
63
105
  }
@@ -111,7 +153,81 @@ const addUnion = (node, out, tab, getFullName) => {
111
153
  out.push(`]);`);
112
154
  out.push(`export type ${node.name}=z.infer<typeof ${fullName}>;`);
113
155
  };
114
- const addInterface = (node, out, tab, getFullName, useCustomTypes) => {
156
+ const addAlias = (node, out, tab) => {
157
+ var _a;
158
+ let hasAlias = false;
159
+ const toAlias = {};
160
+ const fromAlias = {};
161
+ const aliasList = [];
162
+ if (node.children) {
163
+ for (const name in node.children) {
164
+ const child = node.children[name];
165
+ if (child.isContent || child.special) {
166
+ continue;
167
+ }
168
+ const aliases = protoGetChildrenByName(child, 'alias', false);
169
+ if (aliases.length) {
170
+ hasAlias = true;
171
+ for (const a of aliases) {
172
+ const alias = (_a = a.value) !== null && _a !== void 0 ? _a : '';
173
+ if (aliasList.includes(alias)) {
174
+ throw new Error(`Alias (${alias}) already included for type (${node.name})`);
175
+ }
176
+ aliasList.push(alias);
177
+ let record = toAlias[child.name];
178
+ if (!record) {
179
+ record = { default: alias, all: [] };
180
+ toAlias[child.name] = record;
181
+ }
182
+ record.all.push(alias);
183
+ record = fromAlias[alias];
184
+ if (!record) {
185
+ record = { default: child.name, all: [] };
186
+ fromAlias[alias] = record;
187
+ }
188
+ record.all.push(child.name);
189
+ }
190
+ }
191
+ }
192
+ }
193
+ if (hasAlias) {
194
+ out.push(`export const ${node.name}ToAlias=${JSON.stringify(toAlias, null, tab)}`);
195
+ out.push(`export const ${node.name}FromAlias=${JSON.stringify(fromAlias, null, tab)}`);
196
+ return [`${node.name}ToAlias`, `${node.name}FromAlias`];
197
+ }
198
+ return null;
199
+ };
200
+ const addArray = (node, out, tab) => {
201
+ out.push('');
202
+ out.push(`export const ${node.name}Ary=[`);
203
+ if (node.children) {
204
+ for (const name in node.children) {
205
+ const child = node.children[name];
206
+ if (child.isContent || child.special) {
207
+ continue;
208
+ }
209
+ out.push(`${tab}${JSON.stringify(child.name)},`);
210
+ }
211
+ }
212
+ out.push(`];`);
213
+ return node.name + 'Ary';
214
+ };
215
+ const addMap = (node, out, tab) => {
216
+ out.push('');
217
+ out.push(`export const ${node.name}Map={`);
218
+ if (node.children) {
219
+ for (const name in node.children) {
220
+ const child = node.children[name];
221
+ if (child.isContent || child.special) {
222
+ continue;
223
+ }
224
+ out.push(`${tab}${JSON.stringify(child.name)}:${JSON.stringify(child.value || child.name)},`);
225
+ }
226
+ }
227
+ out.push(`};`);
228
+ return node.name + 'Map';
229
+ };
230
+ const addInterface = (node, out, tab, autoLong, getFullName, useCustomTypes, propFilter) => {
115
231
  var _a, _b, _c, _d, _e;
116
232
  const fullName = getFullName(node.name);
117
233
  const children = protoChildrenToArray(node.children);
@@ -127,21 +243,21 @@ const addInterface = (node, out, tab, getFullName, useCustomTypes) => {
127
243
  const lazyProps = [];
128
244
  if (node.children) {
129
245
  for (const prop of children) {
130
- if (prop.special || prop.isContent) {
246
+ if (prop.special || prop.isContent || (propFilter && !propFilter(prop))) {
131
247
  continue;
132
248
  }
133
249
  const propType = (_b = (_a = protoTsTypeMap[prop.type]) !== null && _a !== void 0 ? _a : prop.type) !== null && _b !== void 0 ? _b : 'string';
134
250
  const isBuiltIn = isBuiltInType(propType);
135
251
  if (!isBuiltIn) {
136
252
  interfaceProps.push(`${prop.comment ? protoFormatTsComment(prop.comment, tab) + '\n' : ''}${tab}${prop.name}${prop.optional ? '?' : ''}:${propType}${((_c = prop.types[0]) === null || _c === void 0 ? void 0 : _c.isArray) ? '[]' : ''};`);
137
- lazyProps.push(`${tab}${prop.name}:z.lazy(()=>${getFullName(propType)})${((_d = prop.types[0]) === null || _d === void 0 ? void 0 : _d.isArray) ? '.array()' : ''}${getFormatCalls(prop, propType)}${prop.optional ? '.optional()' : ''},`);
253
+ lazyProps.push(`${tab}${prop.name}:z.lazy(()=>${getFullName(propType)})${((_d = prop.types[0]) === null || _d === void 0 ? void 0 : _d.isArray) ? '.array()' : ''}${getFormatCalls(prop, propType, autoLong)}${prop.optional ? '.optional()' : ''},`);
138
254
  continue;
139
255
  }
140
256
  const customType = getRealCustomType(propType);
141
257
  if (customType && !useCustomTypes.includes(propType)) {
142
258
  useCustomTypes.push(propType);
143
259
  }
144
- out.push(`${prop.comment ? protoFormatTsComment(prop.comment, tab) + '\n' : ''}${tab}${prop.name}:${customType || `z.${propType}()${getFormatCalls(prop, propType)}`}${((_e = prop.types[0]) === null || _e === void 0 ? void 0 : _e.isArray) ? '.array()' : ''}${prop.optional ? '.optional()' : ''},`);
260
+ out.push(`${prop.comment ? protoFormatTsComment(prop.comment, tab) + '\n' : ''}${tab}${prop.name}:${customType || `z.${propType}()${getFormatCalls(prop, propType, autoLong)}`}${((_e = prop.types[0]) === null || _e === void 0 ? void 0 : _e.isArray) ? '.array()' : ''}${prop.optional ? '.optional()' : ''},`);
145
261
  }
146
262
  }
147
263
  out.push('});');
@@ -167,9 +283,10 @@ const addInterface = (node, out, tab, getFullName, useCustomTypes) => {
167
283
  out.push(`export type ${node.name}=z.infer<typeof ${hasCustoms ? '__base__' : ''}${fullName}>;`);
168
284
  }
169
285
  };
170
- const customBuiltIns = ['stringMap', 'numberMap', 'booleanMap', 'dateMap', 'bigIntMap'];
286
+ const customBuiltIns = ['map', 'stringMap', 'numberMap', 'booleanMap', 'dateMap', 'bigIntMap'];
171
287
  const getRealCustomType = (type) => {
172
288
  switch (type) {
289
+ case 'map': return 'z.record(z.any())';
173
290
  case 'stringMap': return 'z.record(z.string())';
174
291
  case 'numberMap': return 'z.record(z.number())';
175
292
  case 'booleanMap': return 'z.record(z.boolean())';
@@ -181,7 +298,7 @@ const getRealCustomType = (type) => {
181
298
  const isBuiltInType = (type) => {
182
299
  return protoTsBuiltTypes.includes(type) || customBuiltIns.includes(type);
183
300
  };
184
- const getFormatCalls = (prop, propType) => {
301
+ const getFormatCalls = (prop, propType, autoLong) => {
185
302
  var _a, _b, _c;
186
303
  let call = '';
187
304
  const add = (type, name, att, getValue, { defaultValue, hasMessage = true, rawValue, option } = {}) => {
@@ -215,10 +332,11 @@ const getFormatCalls = (prop, propType) => {
215
332
  if (!noAutoLength &&
216
333
  propType === 'string' &&
217
334
  !attChildren['max'] &&
335
+ !autoLong.includes(prop.name) &&
218
336
  !parseBool((_c = attChildren['long']) === null || _c === void 0 ? void 0 : _c.value, false)) {
219
337
  call += '.max(255)';
220
338
  }
221
- if (propType === 'number' && !attChildren['int']) {
339
+ if (prop.type === 'int' && !attChildren['int']) {
222
340
  call += '.int()';
223
341
  }
224
342
  add(['string', ...protoTsNumTypes], 'min', attChildren['min'], att => parseNum(att.value));