@hadss/turbo-trans-json-plugin 1.0.0-rc.0

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 (195) hide show
  1. package/LICENSE +177 -0
  2. package/README.md +253 -0
  3. package/dist/core/Types.d.ts +196 -0
  4. package/dist/core/Types.js +47 -0
  5. package/dist/core/analyzers/ClassAnalyzer.d.ts +23 -0
  6. package/dist/core/analyzers/ClassAnalyzer.js +480 -0
  7. package/dist/core/analyzers/CustomTypeAnalyzer.d.ts +21 -0
  8. package/dist/core/analyzers/CustomTypeAnalyzer.js +243 -0
  9. package/dist/core/analyzers/SendableMergeChecker.d.ts +9 -0
  10. package/dist/core/analyzers/SendableMergeChecker.js +100 -0
  11. package/dist/core/analyzers/SendableMergeabilityRegistry.d.ts +7 -0
  12. package/dist/core/analyzers/SendableMergeabilityRegistry.js +23 -0
  13. package/dist/core/constants/DecoratorConstants.d.ts +7 -0
  14. package/dist/core/constants/DecoratorConstants.js +13 -0
  15. package/dist/core/constants/PathConstants.d.ts +6 -0
  16. package/dist/core/constants/PathConstants.js +10 -0
  17. package/dist/core/constants/StringConstants.d.ts +83 -0
  18. package/dist/core/constants/StringConstants.js +87 -0
  19. package/dist/core/constants/index.d.ts +3 -0
  20. package/dist/core/constants/index.js +19 -0
  21. package/dist/core/handlers/BaseTypeHandler.d.ts +23 -0
  22. package/dist/core/handlers/BaseTypeHandler.js +57 -0
  23. package/dist/core/handlers/CustomClassHandler.d.ts +21 -0
  24. package/dist/core/handlers/CustomClassHandler.js +191 -0
  25. package/dist/core/handlers/DateHandler.d.ts +2 -0
  26. package/dist/core/handlers/DateHandler.js +60 -0
  27. package/dist/core/handlers/DecimalHandler.d.ts +2 -0
  28. package/dist/core/handlers/DecimalHandler.js +60 -0
  29. package/dist/core/handlers/EnumHandler.d.ts +2 -0
  30. package/dist/core/handlers/EnumHandler.js +89 -0
  31. package/dist/core/handlers/GenericContainerHandler.d.ts +2 -0
  32. package/dist/core/handlers/GenericContainerHandler.js +440 -0
  33. package/dist/core/handlers/GenericHandler.d.ts +18 -0
  34. package/dist/core/handlers/GenericHandler.js +92 -0
  35. package/dist/core/handlers/HandlerBootstrap.d.ts +2 -0
  36. package/dist/core/handlers/HandlerBootstrap.js +28 -0
  37. package/dist/core/handlers/ITypeHandler.d.ts +23 -0
  38. package/dist/core/handlers/ITypeHandler.js +8 -0
  39. package/dist/core/handlers/PrimitiveHandler.d.ts +2 -0
  40. package/dist/core/handlers/PrimitiveHandler.js +127 -0
  41. package/dist/core/handlers/TupleHandler.d.ts +2 -0
  42. package/dist/core/handlers/TupleHandler.js +98 -0
  43. package/dist/core/handlers/TypeHandlerRegistry.d.ts +20 -0
  44. package/dist/core/handlers/TypeHandlerRegistry.js +113 -0
  45. package/dist/core/handlers/UnionTypeHandler.d.ts +2 -0
  46. package/dist/core/handlers/UnionTypeHandler.js +263 -0
  47. package/dist/core/handlers/index.d.ts +2 -0
  48. package/dist/core/handlers/index.js +5 -0
  49. package/dist/core/import-rewrite/services/BuildProfileUpdater.d.ts +8 -0
  50. package/dist/core/import-rewrite/services/BuildProfileUpdater.js +92 -0
  51. package/dist/core/import-rewrite/services/ImportRewriteService.d.ts +9 -0
  52. package/dist/core/import-rewrite/services/ImportRewriteService.js +61 -0
  53. package/dist/core/import-rewrite/services/ImportTransformService.d.ts +15 -0
  54. package/dist/core/import-rewrite/services/ImportTransformService.js +109 -0
  55. package/dist/core/import-rewrite/strategies/ImportScanStrategy.d.ts +17 -0
  56. package/dist/core/import-rewrite/strategies/ImportScanStrategy.js +137 -0
  57. package/dist/core/import-rewrite/types/ImportRewriteTypes.d.ts +17 -0
  58. package/dist/core/import-rewrite/types/ImportRewriteTypes.js +2 -0
  59. package/dist/core/index.d.ts +9 -0
  60. package/dist/core/index.js +27 -0
  61. package/dist/core/interfaces/ITask.d.ts +7 -0
  62. package/dist/core/interfaces/ITask.js +2 -0
  63. package/dist/core/interfaces/ITaskContext.d.ts +11 -0
  64. package/dist/core/interfaces/ITaskContext.js +2 -0
  65. package/dist/core/interfaces/index.d.ts +2 -0
  66. package/dist/core/interfaces/index.js +2 -0
  67. package/dist/core/logger/Logger.d.ts +13 -0
  68. package/dist/core/logger/Logger.js +78 -0
  69. package/dist/core/services/CodeAnalysisService.d.ts +7 -0
  70. package/dist/core/services/CodeAnalysisService.js +43 -0
  71. package/dist/core/services/CodeGenerationEngine.d.ts +12 -0
  72. package/dist/core/services/CodeGenerationEngine.js +102 -0
  73. package/dist/core/services/CodeGenerationService/CodeGenerationService.d.ts +13 -0
  74. package/dist/core/services/CodeGenerationService/CodeGenerationService.js +110 -0
  75. package/dist/core/services/CodeGenerationService/generators/MergedSendableClassGenerator.d.ts +13 -0
  76. package/dist/core/services/CodeGenerationService/generators/MergedSendableClassGenerator.js +119 -0
  77. package/dist/core/services/CodeGenerationService/generators/OriginalClassGenerator.d.ts +21 -0
  78. package/dist/core/services/CodeGenerationService/generators/OriginalClassGenerator.js +224 -0
  79. package/dist/core/services/CodeGenerationService/generators/SendableClassGenerator.d.ts +24 -0
  80. package/dist/core/services/CodeGenerationService/generators/SendableClassGenerator.js +307 -0
  81. package/dist/core/services/CodeGenerationService/generators/SerializerGenerator.d.ts +28 -0
  82. package/dist/core/services/CodeGenerationService/generators/SerializerGenerator.js +259 -0
  83. package/dist/core/services/CodeGenerationService/generators/TempSerializerGenerator.d.ts +19 -0
  84. package/dist/core/services/CodeGenerationService/generators/TempSerializerGenerator.js +178 -0
  85. package/dist/core/services/CodeGenerationService/index.d.ts +1 -0
  86. package/dist/core/services/CodeGenerationService/index.js +5 -0
  87. package/dist/core/services/CodeGenerationService/shared/ImportManager.d.ts +27 -0
  88. package/dist/core/services/CodeGenerationService/shared/ImportManager.js +127 -0
  89. package/dist/core/template/HandlebarsTemplateEngine.d.ts +26 -0
  90. package/dist/core/template/HandlebarsTemplateEngine.js +226 -0
  91. package/dist/core/utils/ConfigManager.d.ts +10 -0
  92. package/dist/core/utils/ConfigManager.js +32 -0
  93. package/dist/core/utils/CustomError.d.ts +30 -0
  94. package/dist/core/utils/CustomError.js +37 -0
  95. package/dist/core/utils/DeepCopyUtil.d.ts +15 -0
  96. package/dist/core/utils/DeepCopyUtil.js +138 -0
  97. package/dist/core/utils/GenericTypeSubstitutionUtil.d.ts +9 -0
  98. package/dist/core/utils/GenericTypeSubstitutionUtil.js +68 -0
  99. package/dist/core/utils/SerializationPathUtil.d.ts +18 -0
  100. package/dist/core/utils/SerializationPathUtil.js +107 -0
  101. package/dist/core/utils/TsMorphUtil.d.ts +8 -0
  102. package/dist/core/utils/TsMorphUtil.js +34 -0
  103. package/dist/index.d.ts +4 -0
  104. package/dist/index.js +57 -0
  105. package/dist/json-plugin/JSONExecuteController.d.ts +13 -0
  106. package/dist/json-plugin/JSONExecuteController.js +103 -0
  107. package/dist/json-plugin/constants/TaskConstants.d.ts +7 -0
  108. package/dist/json-plugin/constants/TaskConstants.js +11 -0
  109. package/dist/json-plugin/interfaces/IModuleContext.d.ts +10 -0
  110. package/dist/json-plugin/interfaces/IModuleContext.js +2 -0
  111. package/dist/json-plugin/interfaces/ITargetContext.d.ts +8 -0
  112. package/dist/json-plugin/interfaces/ITargetContext.js +2 -0
  113. package/dist/json-plugin/interfaces/impl/ModuleContext.d.ts +12 -0
  114. package/dist/json-plugin/interfaces/impl/ModuleContext.js +24 -0
  115. package/dist/json-plugin/interfaces/impl/TargetContext.d.ts +23 -0
  116. package/dist/json-plugin/interfaces/impl/TargetContext.js +113 -0
  117. package/dist/json-plugin/tasks/BaseTask.d.ts +14 -0
  118. package/dist/json-plugin/tasks/BaseTask.js +53 -0
  119. package/dist/json-plugin/tasks/CleanTask.d.ts +8 -0
  120. package/dist/json-plugin/tasks/CleanTask.js +25 -0
  121. package/dist/json-plugin/tasks/CodeProcessingTask.d.ts +8 -0
  122. package/dist/json-plugin/tasks/CodeProcessingTask.js +26 -0
  123. package/dist/json-plugin/tasks/SyncTask.d.ts +8 -0
  124. package/dist/json-plugin/tasks/SyncTask.js +21 -0
  125. package/dist/json-plugin/tasks/WatchTask.d.ts +11 -0
  126. package/dist/json-plugin/tasks/WatchTask.js +102 -0
  127. package/package.json +46 -0
  128. package/src/core/Types.ts +356 -0
  129. package/src/core/analyzers/ClassAnalyzer.ts +824 -0
  130. package/src/core/analyzers/CustomTypeAnalyzer.ts +337 -0
  131. package/src/core/analyzers/SendableMergeChecker.ts +195 -0
  132. package/src/core/analyzers/SendableMergeabilityRegistry.ts +72 -0
  133. package/src/core/constants/DecoratorConstants.ts +27 -0
  134. package/src/core/constants/PathConstants.ts +31 -0
  135. package/src/core/constants/StringConstants.ts +152 -0
  136. package/src/core/constants/index.ts +21 -0
  137. package/src/core/handlers/BaseTypeHandler.ts +121 -0
  138. package/src/core/handlers/CustomClassHandler.ts +278 -0
  139. package/src/core/handlers/DateHandler.ts +75 -0
  140. package/src/core/handlers/DecimalHandler.ts +75 -0
  141. package/src/core/handlers/EnumHandler.ts +142 -0
  142. package/src/core/handlers/GenericContainerHandler.ts +621 -0
  143. package/src/core/handlers/GenericHandler.ts +130 -0
  144. package/src/core/handlers/HandlerBootstrap.ts +64 -0
  145. package/src/core/handlers/ITypeHandler.ts +133 -0
  146. package/src/core/handlers/PrimitiveHandler.ts +159 -0
  147. package/src/core/handlers/TupleHandler.ts +145 -0
  148. package/src/core/handlers/TypeHandlerRegistry.ts +236 -0
  149. package/src/core/handlers/UnionTypeHandler.ts +400 -0
  150. package/src/core/handlers/index.ts +18 -0
  151. package/src/core/import-rewrite/services/BuildProfileUpdater.ts +145 -0
  152. package/src/core/import-rewrite/services/ImportRewriteService.ts +129 -0
  153. package/src/core/import-rewrite/services/ImportTransformService.ts +200 -0
  154. package/src/core/import-rewrite/strategies/ImportScanStrategy.ts +303 -0
  155. package/src/core/import-rewrite/types/ImportRewriteTypes.ts +100 -0
  156. package/src/core/index.ts +31 -0
  157. package/src/core/interfaces/ITask.ts +23 -0
  158. package/src/core/interfaces/ITaskContext.ts +94 -0
  159. package/src/core/interfaces/index.ts +17 -0
  160. package/src/core/logger/Logger.ts +149 -0
  161. package/src/core/services/CodeAnalysisService.ts +67 -0
  162. package/src/core/services/CodeGenerationEngine.ts +181 -0
  163. package/src/core/services/CodeGenerationService/CodeGenerationService.ts +159 -0
  164. package/src/core/services/CodeGenerationService/generators/MergedSendableClassGenerator.ts +189 -0
  165. package/src/core/services/CodeGenerationService/generators/OriginalClassGenerator.ts +314 -0
  166. package/src/core/services/CodeGenerationService/generators/SendableClassGenerator.ts +421 -0
  167. package/src/core/services/CodeGenerationService/generators/SerializerGenerator.ts +392 -0
  168. package/src/core/services/CodeGenerationService/generators/TempSerializerGenerator.ts +277 -0
  169. package/src/core/services/CodeGenerationService/index.ts +16 -0
  170. package/src/core/services/CodeGenerationService/shared/ImportManager.ts +191 -0
  171. package/src/core/template/HandlebarsTemplateEngine.ts +282 -0
  172. package/src/core/utils/ConfigManager.ts +49 -0
  173. package/src/core/utils/CustomError.ts +51 -0
  174. package/src/core/utils/DeepCopyUtil.ts +185 -0
  175. package/src/core/utils/GenericTypeSubstitutionUtil.ts +136 -0
  176. package/src/core/utils/SerializationPathUtil.ts +142 -0
  177. package/src/core/utils/TsMorphUtil.ts +50 -0
  178. package/src/index.ts +81 -0
  179. package/src/json-plugin/JSONExecuteController.ts +134 -0
  180. package/src/json-plugin/constants/TaskConstants.ts +22 -0
  181. package/src/json-plugin/interfaces/IModuleContext.ts +27 -0
  182. package/src/json-plugin/interfaces/ITargetContext.ts +25 -0
  183. package/src/json-plugin/interfaces/impl/ModuleContext.ts +45 -0
  184. package/src/json-plugin/interfaces/impl/TargetContext.ts +196 -0
  185. package/src/json-plugin/tasks/BaseTask.ts +94 -0
  186. package/src/json-plugin/tasks/CleanTask.ts +36 -0
  187. package/src/json-plugin/tasks/CodeProcessingTask.ts +41 -0
  188. package/src/json-plugin/tasks/SyncTask.ts +33 -0
  189. package/src/json-plugin/tasks/WatchTask.ts +99 -0
  190. package/template/SerializerPerformanceTemplate.hbs +35 -0
  191. package/template/SerializerRegisterTemplate.hbs +10 -0
  192. package/template/SerializerStrictTemplate.hbs +89 -0
  193. package/template/SerializerTemplate.hbs +176 -0
  194. package/tsconfig.json +17 -0
  195. package/tslint.json +3 -0
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CustomTypeAnalyzer = void 0;
7
+ const __1 = require("..");
8
+ const SerializationPathUtil_1 = __importDefault(require("../utils/SerializationPathUtil"));
9
+ const TsMorphUtil_1 = require("../utils/TsMorphUtil");
10
+ class CustomTypeAnalyzer {
11
+ constructor() {
12
+ this.searchCache = new Map();
13
+ }
14
+ static getInstance() {
15
+ return this.INSTANCE;
16
+ }
17
+ findDefinition(targetName, sourceFile) {
18
+ const cacheKey = `${sourceFile.getFilePath()}:${targetName}`;
19
+ if (cacheKey && this.searchCache.has(cacheKey)) {
20
+ const cached = this.searchCache.get(cacheKey);
21
+ return cached !== undefined ? cached : null;
22
+ }
23
+ let result;
24
+ result = this.findInCurrentFile(targetName, sourceFile);
25
+ if (result) {
26
+ if (cacheKey) {
27
+ this.searchCache.set(cacheKey, result);
28
+ }
29
+ return result;
30
+ }
31
+ result = this.findInImports(targetName, sourceFile);
32
+ if (result) {
33
+ if (cacheKey) {
34
+ this.searchCache.set(cacheKey, result);
35
+ }
36
+ return result;
37
+ }
38
+ result = this.findInCrossModule(targetName, sourceFile);
39
+ if (result) {
40
+ if (cacheKey) {
41
+ this.searchCache.set(cacheKey, result);
42
+ }
43
+ return result;
44
+ }
45
+ if (cacheKey) {
46
+ this.searchCache.set(cacheKey, null);
47
+ }
48
+ return null;
49
+ }
50
+ findClassDeclFromClassName(className, sourceFile) {
51
+ const res = this.findDefinition(className, sourceFile);
52
+ if (res && res.typeKind === __1.TypeKind.CLASS) {
53
+ return res.details.classDecl;
54
+ }
55
+ if (res && res.typeKind === __1.TypeKind.INTERFACE) {
56
+ return res.details.interfaceDecl;
57
+ }
58
+ return null;
59
+ }
60
+ clearCache() {
61
+ this.searchCache.clear();
62
+ }
63
+ findInCurrentFile(targetName, sourceFile) {
64
+ const typeDetail = this.searchInSourceFile(targetName, sourceFile);
65
+ if (typeDetail) {
66
+ return {
67
+ typeName: targetName,
68
+ typeKind: typeDetail.kind,
69
+ importPath: '',
70
+ source: {
71
+ type: 'local',
72
+ sourceFilePath: sourceFile.getFilePath()
73
+ },
74
+ details: typeDetail
75
+ };
76
+ }
77
+ return null;
78
+ }
79
+ findInImports(targetName, sourceFile) {
80
+ const imports = sourceFile.getImportDeclarations();
81
+ for (const importDecl of imports) {
82
+ const namedImports = importDecl.getNamedImports();
83
+ const specifierValue = importDecl.getModuleSpecifierValue();
84
+ for (const namedImport of namedImports) {
85
+ const importName = namedImport.getName();
86
+ if (importName === targetName) {
87
+ const moduleSpecifier = importDecl.getModuleSpecifierValue();
88
+ const resolvedPath = this.resolveImportPath(moduleSpecifier, sourceFile);
89
+ if (resolvedPath && SerializationPathUtil_1.default.exist(resolvedPath)) {
90
+ const externalSourceFile = this.getOrLoadSourceFile(resolvedPath);
91
+ if (externalSourceFile) {
92
+ const typeDetail = this.searchInSourceFile(targetName, externalSourceFile);
93
+ if (typeDetail) {
94
+ return {
95
+ typeName: targetName,
96
+ typeKind: typeDetail.kind,
97
+ importPath: specifierValue,
98
+ source: {
99
+ type: 'imported',
100
+ sourceFilePath: externalSourceFile.getFilePath(),
101
+ originalImport: specifierValue
102
+ },
103
+ details: typeDetail
104
+ };
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return null;
112
+ }
113
+ findInCrossModule(targetName, sourceFile) {
114
+ return null;
115
+ }
116
+ searchInSourceFile(targetName, sourceFile) {
117
+ const classes = sourceFile.getClasses();
118
+ for (const classDecl of classes) {
119
+ if (classDecl.getName() === targetName) {
120
+ return this.parseClassDetails(classDecl);
121
+ }
122
+ }
123
+ const interfaces = sourceFile.getInterfaces();
124
+ for (const interfaceDecl of interfaces) {
125
+ if (interfaceDecl.getName() === targetName) {
126
+ return this.parseInterfaceDetails(interfaceDecl);
127
+ }
128
+ }
129
+ const enums = sourceFile.getEnums();
130
+ for (const enumDecl of enums) {
131
+ if (enumDecl.getName() === targetName) {
132
+ return this.parseEnumDetails(enumDecl);
133
+ }
134
+ }
135
+ const types = sourceFile.getTypeAliases();
136
+ for (const typeAliasDecl of types) {
137
+ if (typeAliasDecl.getName() === targetName) {
138
+ return this.parseTypeAliasDetails(typeAliasDecl);
139
+ }
140
+ }
141
+ return null;
142
+ }
143
+ parseEnumDetails(enumDecl) {
144
+ const members = [];
145
+ let valueType = 'number';
146
+ let numericValue = 0;
147
+ const enumMembers = enumDecl.getMembers();
148
+ for (const member of enumMembers) {
149
+ const memberName = member.getName();
150
+ let memberValue;
151
+ let literalValue;
152
+ const initializer = member.getInitializer();
153
+ if (initializer) {
154
+ const initText = initializer.getText().trim();
155
+ if (initText.startsWith('"') && initText.endsWith('"')) {
156
+ memberValue = initText.slice(1, -1);
157
+ literalValue = initText;
158
+ valueType = 'string';
159
+ }
160
+ else if (initText.startsWith("'") && initText.endsWith("'")) {
161
+ memberValue = initText.slice(1, -1);
162
+ literalValue = `"${memberValue}"`;
163
+ valueType = 'string';
164
+ }
165
+ else {
166
+ const numValue = parseInt(initText, 10);
167
+ if (!isNaN(numValue)) {
168
+ memberValue = numValue;
169
+ literalValue = numValue.toString();
170
+ numericValue = numValue + 1;
171
+ }
172
+ else {
173
+ memberValue = initText;
174
+ literalValue = `"${initText}"`;
175
+ valueType = 'string';
176
+ }
177
+ }
178
+ }
179
+ else {
180
+ memberValue = numericValue;
181
+ literalValue = numericValue.toString();
182
+ numericValue++;
183
+ }
184
+ members.push({
185
+ name: memberName,
186
+ value: memberValue,
187
+ literalValue
188
+ });
189
+ }
190
+ return { kind: __1.TypeKind.ENUM, valueType, members };
191
+ }
192
+ parseClassDetails(classDecl) {
193
+ return {
194
+ kind: __1.TypeKind.CLASS,
195
+ classDecl,
196
+ isGeneric: classDecl.getTypeParameters().length > 0
197
+ };
198
+ }
199
+ parseInterfaceDetails(interfaceDecl) {
200
+ return {
201
+ kind: __1.TypeKind.INTERFACE,
202
+ interfaceDecl,
203
+ isGeneric: interfaceDecl.getTypeParameters().length > 0
204
+ };
205
+ }
206
+ parseTypeAliasDetails(typeAliasDecl) {
207
+ const aliasedType = typeAliasDecl.getTypeNodeOrThrow().getText();
208
+ const actualTypeNode = typeAliasDecl.getTypeNodeOrThrow();
209
+ const { TypeHandlerRegistry } = require('../handlers/TypeHandlerRegistry');
210
+ const resolvedType = TypeHandlerRegistry.getInstance().parseType(actualTypeNode, {
211
+ depth: 0,
212
+ genericParams: []
213
+ });
214
+ return { kind: __1.TypeKind.TYPE, aliasedType, resolvedType };
215
+ }
216
+ resolveImportPath(moduleSpecifier, sourceFile) {
217
+ const currentFilePath = sourceFile.getFilePath();
218
+ const currentDir = SerializationPathUtil_1.default.dirname(currentFilePath);
219
+ if (moduleSpecifier.startsWith('./') || moduleSpecifier.startsWith('../')) {
220
+ const resolvedPath = SerializationPathUtil_1.default.pathResolve(currentDir, moduleSpecifier);
221
+ const extensions = ['.ets', '.d.ets'];
222
+ for (const ext of extensions) {
223
+ const fullPath = resolvedPath + ext;
224
+ if (SerializationPathUtil_1.default.exist(fullPath)) {
225
+ return fullPath;
226
+ }
227
+ }
228
+ }
229
+ return null;
230
+ }
231
+ getOrLoadSourceFile(filePath) {
232
+ const existingFile = TsMorphUtil_1.TsMorphUtil.getProject().getSourceFile(filePath);
233
+ if (existingFile) {
234
+ return existingFile;
235
+ }
236
+ if (SerializationPathUtil_1.default.exist(filePath)) {
237
+ return TsMorphUtil_1.TsMorphUtil.getProject().addSourceFileAtPath(filePath);
238
+ }
239
+ return null;
240
+ }
241
+ }
242
+ exports.CustomTypeAnalyzer = CustomTypeAnalyzer;
243
+ CustomTypeAnalyzer.INSTANCE = new CustomTypeAnalyzer();
@@ -0,0 +1,9 @@
1
+ import { ClassAnalysis } from '../Types';
2
+ export declare class SendableMergeChecker {
3
+ private static readonly TURBO_TRANS_DECORATORS;
4
+ private static readonly SENDABLE_PRIMITIVE_KINDS;
5
+ private static readonly SENDABLE_COLLECTION_KINDS;
6
+ static check(classAnalysis: ClassAnalysis): boolean;
7
+ private static getNonTurboTransDecorators;
8
+ private static isSendableType;
9
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SendableMergeChecker = void 0;
4
+ const Types_1 = require("../Types");
5
+ const constants_1 = require("../constants");
6
+ const Logger_1 = require("../logger/Logger");
7
+ const SendableMergeabilityRegistry_1 = require("./SendableMergeabilityRegistry");
8
+ class SendableMergeChecker {
9
+ static check(classAnalysis) {
10
+ const classDecorators = classAnalysis.originalClass?.getDecorators() || [];
11
+ const nonTurboTransDecorators = this.getNonTurboTransDecorators(classDecorators);
12
+ if (nonTurboTransDecorators.length > 0) {
13
+ Logger_1.Logger.debug(`${classAnalysis.className}类有其他装饰器`);
14
+ return false;
15
+ }
16
+ if (classAnalysis.generics.isGeneric) {
17
+ Logger_1.Logger.debug(`${classAnalysis.className}类有泛型参数`);
18
+ return false;
19
+ }
20
+ const invalidProperties = [];
21
+ for (const property of classAnalysis.properties) {
22
+ const propertyNode = classAnalysis.originalClass?.getProperty(property.name);
23
+ if (propertyNode) {
24
+ const propDecorators = propertyNode.getDecorators();
25
+ const nonTurboPropDecorators = this.getNonTurboTransDecorators(propDecorators);
26
+ if (nonTurboPropDecorators.length > 0) {
27
+ invalidProperties.push(`${property.name} (装饰器: ${nonTurboPropDecorators.join(', ')})`);
28
+ continue;
29
+ }
30
+ }
31
+ if (!this.isSendableType(property.type, classAnalysis)) {
32
+ invalidProperties.push(`${property.name} (类型: ${property.type.sourceText})`);
33
+ }
34
+ }
35
+ if (classAnalysis.originalClass) {
36
+ for (const method of classAnalysis.originalClass.getMethods()) {
37
+ const methodDecorators = method.getDecorators();
38
+ const nonTurboPropDecorators = this.getNonTurboTransDecorators(methodDecorators);
39
+ if (nonTurboPropDecorators.length > 0) {
40
+ invalidProperties.push(`${method.getName()} (装饰器: ${nonTurboPropDecorators.join(', ')})`);
41
+ }
42
+ }
43
+ }
44
+ if (invalidProperties.length > 0) {
45
+ Logger_1.Logger.debug(invalidProperties.join('\n'));
46
+ return false;
47
+ }
48
+ if (classAnalysis.inheritance.isInherited && classAnalysis.inheritance.baseClassAnalysis) {
49
+ Logger_1.Logger.debug(`${classAnalysis.className}的父类不可合并`);
50
+ return this.check(classAnalysis.inheritance.baseClassAnalysis);
51
+ }
52
+ return true;
53
+ }
54
+ static getNonTurboTransDecorators(decorators) {
55
+ return decorators
56
+ .map(d => d.getName())
57
+ .filter(name => !this.TURBO_TRANS_DECORATORS.has(name));
58
+ }
59
+ static isSendableType(typeStructure, contextClass) {
60
+ const { kind } = typeStructure;
61
+ if (this.SENDABLE_PRIMITIVE_KINDS.has(kind)) {
62
+ return true;
63
+ }
64
+ if (this.SENDABLE_COLLECTION_KINDS.has(kind)) {
65
+ return typeStructure.args.every(arg => this.isSendableType(arg, contextClass));
66
+ }
67
+ if (kind === Types_1.PropertyKind.OBJECT && typeStructure.classDetails) {
68
+ const classDetails = typeStructure.classDetails;
69
+ if (classDetails.classDecl.getDecorator('Sendable')) {
70
+ return true;
71
+ }
72
+ const className = classDetails.classDecl.getNameOrThrow();
73
+ const canMerge = SendableMergeabilityRegistry_1.SendableMergeabilityRegistry.canMerge(className);
74
+ if (canMerge === undefined) {
75
+ return false;
76
+ }
77
+ return canMerge;
78
+ }
79
+ if ((kind === Types_1.PropertyKind.UNION || kind === Types_1.PropertyKind.OPTIONAL || kind === Types_1.PropertyKind.NULLABLE) &&
80
+ typeStructure.unionDetails) {
81
+ return typeStructure.unionDetails.every(member => this.isSendableType(member, contextClass));
82
+ }
83
+ return false;
84
+ }
85
+ }
86
+ exports.SendableMergeChecker = SendableMergeChecker;
87
+ SendableMergeChecker.TURBO_TRANS_DECORATORS = new Set(constants_1.DecoratorConstants.SERIAL_DECORATORS);
88
+ SendableMergeChecker.SENDABLE_PRIMITIVE_KINDS = new Set([
89
+ Types_1.PropertyKind.STRING,
90
+ Types_1.PropertyKind.NUMBER,
91
+ Types_1.PropertyKind.BOOLEAN,
92
+ Types_1.PropertyKind.BIGINT,
93
+ Types_1.PropertyKind.NULL,
94
+ Types_1.PropertyKind.UNDEFINED,
95
+ ]);
96
+ SendableMergeChecker.SENDABLE_COLLECTION_KINDS = new Set([
97
+ Types_1.PropertyKind.COLLECTIONS_ARRAY,
98
+ Types_1.PropertyKind.COLLECTIONS_SET,
99
+ Types_1.PropertyKind.COLLECTIONS_MAP,
100
+ ]);
@@ -0,0 +1,7 @@
1
+ export declare class SendableMergeabilityRegistry {
2
+ private static mergeabilityMap;
3
+ static register(className: string, canMerge: boolean): void;
4
+ static canMerge(className: string): boolean | undefined;
5
+ static hasClass(className: string): boolean;
6
+ static clear(): void;
7
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SendableMergeabilityRegistry = void 0;
4
+ const __1 = require("..");
5
+ class SendableMergeabilityRegistry {
6
+ static register(className, canMerge) {
7
+ this.mergeabilityMap.set(className, canMerge);
8
+ __1.Logger.debug(`[SendableMergeabilityRegistry] 注册类合并性: ${className} -> ${canMerge}`);
9
+ }
10
+ static canMerge(className) {
11
+ return this.mergeabilityMap.get(className);
12
+ }
13
+ static hasClass(className) {
14
+ return this.mergeabilityMap.has(className);
15
+ }
16
+ static clear() {
17
+ const count = this.mergeabilityMap.size;
18
+ this.mergeabilityMap.clear();
19
+ __1.Logger.debug(`[SendableMergeabilityRegistry] 清空注册表,已移除 ${count} 个类的合并性信息`);
20
+ }
21
+ }
22
+ exports.SendableMergeabilityRegistry = SendableMergeabilityRegistry;
23
+ SendableMergeabilityRegistry.mergeabilityMap = new Map();
@@ -0,0 +1,7 @@
1
+ export declare class DecoratorConstants {
2
+ static readonly SERIALIZABLE = "Serializable";
3
+ static readonly SERIAL_NAME = "SerialName";
4
+ static readonly REQUIRED = "Required";
5
+ static readonly TRANSIENT = "Transient";
6
+ static readonly SERIAL_DECORATORS: string[];
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DecoratorConstants = void 0;
5
+ class DecoratorConstants {
6
+ }
7
+ exports.DecoratorConstants = DecoratorConstants;
8
+ _a = DecoratorConstants;
9
+ DecoratorConstants.SERIALIZABLE = 'Serializable';
10
+ DecoratorConstants.SERIAL_NAME = 'SerialName';
11
+ DecoratorConstants.REQUIRED = 'Required';
12
+ DecoratorConstants.TRANSIENT = 'Transient';
13
+ DecoratorConstants.SERIAL_DECORATORS = [_a.SERIALIZABLE, _a.SERIAL_NAME, _a.REQUIRED, _a.TRANSIENT];
@@ -0,0 +1,6 @@
1
+ export declare class PathConstants {
2
+ static readonly DEFAULT_SOURCE_ROOT = "./src/main";
3
+ static readonly GENERATED_ROOT = "./src/generated";
4
+ static readonly ETS_EXTENSIONS = ".ets";
5
+ static readonly DEFAULT_SCAN_DIRS: string[];
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PathConstants = void 0;
4
+ class PathConstants {
5
+ }
6
+ exports.PathConstants = PathConstants;
7
+ PathConstants.DEFAULT_SOURCE_ROOT = './src/main';
8
+ PathConstants.GENERATED_ROOT = './src/generated';
9
+ PathConstants.ETS_EXTENSIONS = '.ets';
10
+ PathConstants.DEFAULT_SCAN_DIRS = ['src/main/ets'];
@@ -0,0 +1,83 @@
1
+ export declare class StringConstants {
2
+ static readonly TYPE_BOOLEAN = "boolean";
3
+ static readonly TYPE_NUMBER = "number";
4
+ static readonly TYPE_STRING = "string";
5
+ static readonly TYPE_BIGINT = "bigint";
6
+ static readonly TYPE_NULL = "null";
7
+ static readonly TYPE_UNDEFINED = "undefined";
8
+ static readonly TYPE_ARRAY = "array";
9
+ static readonly TYPE_SET = "set";
10
+ static readonly TYPE_MAP = "map";
11
+ static readonly TYPE_UNION = "union";
12
+ static readonly TYPE_ENUM = "enum";
13
+ static readonly BOOLEAN_SERIALIZER = "BooleanSerializer";
14
+ static readonly NUMBER_SERIALIZER = "NumberSerializer";
15
+ static readonly STRING_SERIALIZER = "StringSerializer";
16
+ static readonly BIGINT_SERIALIZER = "BigintSerializer";
17
+ static readonly NULL_SERIALIZER = "NullSerializer";
18
+ static readonly UNDEFINED_SERIALIZER = "UndefinedSerializer";
19
+ static readonly ARRAY_SERIALIZER = "ArraySerializer";
20
+ static readonly COLLECTIONS_ARRAY_SERIALIZER = "CollectionsArraySerializer";
21
+ static readonly MAP_SERIALIZER = "MapSerializer";
22
+ static readonly COLLECTIONS_MAP_SERIALIZER = "CollectionsMapSerializer";
23
+ static readonly SET_SERIALIZER = "SetSerializer";
24
+ static readonly COLLECTIONS_SET_SERIALIZER = "CollectionsSetSerializer";
25
+ static readonly RECORD_SERIALIZER = "RecordSerializer";
26
+ static readonly UNION_TYPE_SERIALIZER = "UnionTypeSerializer";
27
+ static readonly OPTIONAL_SERIALIZER = "OptionalSerializer";
28
+ static readonly NULLABLE_SERIALIZER = "NullableSerializer";
29
+ static readonly ENUM_SERIALIZER = "EnumSerializer";
30
+ static readonly SERIALIZER = "Serializer";
31
+ static readonly SERIALIZER_FACTORY = "SerializerFactory";
32
+ static readonly ENCODE_BOOLEAN_ELEMENT = "encodeBooleanElement";
33
+ static readonly ENCODE_NUMBER_ELEMENT = "encodeNumberElement";
34
+ static readonly ENCODE_STRING_ELEMENT = "encodeStringElement";
35
+ static readonly ENCODE_BIGINT_ELEMENT = "encodeBigintElement";
36
+ static readonly ENCODE_NULL_ELEMENT = "encodeNullElement";
37
+ static readonly ENCODE_UNDEFINED_ELEMENT = "encodeUndefinedElement";
38
+ static readonly ENCODE_SERIALIZABLE_ELEMENT = "encodeSerializableElement";
39
+ static readonly DECODE_BOOLEAN = "decodeBoolean";
40
+ static readonly DECODE_NUMBER = "decodeNumber";
41
+ static readonly DECODE_STRING = "decodeString";
42
+ static readonly DECODE_BIGINT = "decodeBigint";
43
+ static readonly DECODE_NULL = "decodeNull";
44
+ static readonly DECODE_UNDEFINED = "decodeUndefined";
45
+ static readonly DESERIALIZABLE = "deserialize";
46
+ static readonly IMPORT_BUILD_CLASS_SERIAL_DESCRIPTOR = "buildClassSerialDescriptor";
47
+ static readonly IMPORT_DECODER = "Decoder";
48
+ static readonly IMPORT_ENCODER = "Encoder";
49
+ static readonly IMPORT_SERIAL_DESCRIPTOR = "SerialDescriptor";
50
+ static readonly IMPORT_SERIALIZER = "Serializer";
51
+ static readonly IMPORT_TJSON = "TJSON";
52
+ static readonly IMPORT_IT_SERIALIZABLE = "ITSerializable";
53
+ static readonly IMPORT_LANG = "lang";
54
+ static readonly BOOLEAN_WRAPPER = "Boolean";
55
+ static readonly NUMBER_WRAPPER = "Number";
56
+ static readonly STRING_WRAPPER = "String";
57
+ static readonly ARRAY_SUFFIX = "[]";
58
+ static readonly ARRAY_PREFIX = "array<";
59
+ static readonly DEFAULT_VALUE_FALSE = "false";
60
+ static readonly DEFAULT_VALUE_ZERO = "0";
61
+ static readonly DEFAULT_VALUE_EMPTY_STRING = "''";
62
+ static readonly DEFAULT_VALUE_ZERO_BIGINT = "0n";
63
+ static readonly DEFAULT_VALUE_UNDEFINED = "undefined";
64
+ static readonly TEMPLATE_ELEMENT_NAME = "element";
65
+ static readonly TEMPLATE_SENDABLE_ERROR_PREFIX = "Sendable support not enabled for";
66
+ static readonly FILE_OPERATION_EMPTY_STRING = "";
67
+ static readonly REGEX_IMPORT_STATEMENT: RegExp;
68
+ static readonly REGEX_SRC_MAIN_ETS: RegExp;
69
+ static readonly SEPARATOR_COMMA = ",";
70
+ static readonly SEPARATOR_COMMA_NEWLINE = ",\n";
71
+ static readonly SEPARATOR_NEWLINE = "\n";
72
+ static readonly SEPARATOR_COMMA_SPACE = ", ";
73
+ static readonly JOIN_ELEMENT_PREFIX = ",\n ";
74
+ static readonly CURLY_BRACE_START = "{";
75
+ static readonly PATH_RELATIVE_PREFIX = "./";
76
+ static readonly INSTANCE_SUFFIX = ".INSTANCE";
77
+ static readonly SERIALIZER_SUFFIX = "Serializer";
78
+ static readonly LOG_PREFIX_T_SERIALIZATION = "[TSerialization]";
79
+ static readonly LOG_MODULE_PREFIX_TEMPLATE = "[${module}]";
80
+ static readonly PLUGIN_ID = "turboTransJsonPlugin";
81
+ static readonly JSON_MODULE_SPECIFIER = "@hadss/hmserialization-json";
82
+ static readonly ARKTS_MODULE_SPECIFIER = "@kit.ArkTS";
83
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringConstants = void 0;
4
+ class StringConstants {
5
+ }
6
+ exports.StringConstants = StringConstants;
7
+ StringConstants.TYPE_BOOLEAN = 'boolean';
8
+ StringConstants.TYPE_NUMBER = 'number';
9
+ StringConstants.TYPE_STRING = 'string';
10
+ StringConstants.TYPE_BIGINT = 'bigint';
11
+ StringConstants.TYPE_NULL = 'null';
12
+ StringConstants.TYPE_UNDEFINED = 'undefined';
13
+ StringConstants.TYPE_ARRAY = 'array';
14
+ StringConstants.TYPE_SET = 'set';
15
+ StringConstants.TYPE_MAP = 'map';
16
+ StringConstants.TYPE_UNION = 'union';
17
+ StringConstants.TYPE_ENUM = 'enum';
18
+ StringConstants.BOOLEAN_SERIALIZER = 'BooleanSerializer';
19
+ StringConstants.NUMBER_SERIALIZER = 'NumberSerializer';
20
+ StringConstants.STRING_SERIALIZER = 'StringSerializer';
21
+ StringConstants.BIGINT_SERIALIZER = 'BigintSerializer';
22
+ StringConstants.NULL_SERIALIZER = 'NullSerializer';
23
+ StringConstants.UNDEFINED_SERIALIZER = 'UndefinedSerializer';
24
+ StringConstants.ARRAY_SERIALIZER = 'ArraySerializer';
25
+ StringConstants.COLLECTIONS_ARRAY_SERIALIZER = 'CollectionsArraySerializer';
26
+ StringConstants.MAP_SERIALIZER = 'MapSerializer';
27
+ StringConstants.COLLECTIONS_MAP_SERIALIZER = 'CollectionsMapSerializer';
28
+ StringConstants.SET_SERIALIZER = 'SetSerializer';
29
+ StringConstants.COLLECTIONS_SET_SERIALIZER = 'CollectionsSetSerializer';
30
+ StringConstants.RECORD_SERIALIZER = 'RecordSerializer';
31
+ StringConstants.UNION_TYPE_SERIALIZER = 'UnionTypeSerializer';
32
+ StringConstants.OPTIONAL_SERIALIZER = 'OptionalSerializer';
33
+ StringConstants.NULLABLE_SERIALIZER = 'NullableSerializer';
34
+ StringConstants.ENUM_SERIALIZER = 'EnumSerializer';
35
+ StringConstants.SERIALIZER = 'Serializer';
36
+ StringConstants.SERIALIZER_FACTORY = 'SerializerFactory';
37
+ StringConstants.ENCODE_BOOLEAN_ELEMENT = 'encodeBooleanElement';
38
+ StringConstants.ENCODE_NUMBER_ELEMENT = 'encodeNumberElement';
39
+ StringConstants.ENCODE_STRING_ELEMENT = 'encodeStringElement';
40
+ StringConstants.ENCODE_BIGINT_ELEMENT = 'encodeBigintElement';
41
+ StringConstants.ENCODE_NULL_ELEMENT = 'encodeNullElement';
42
+ StringConstants.ENCODE_UNDEFINED_ELEMENT = 'encodeUndefinedElement';
43
+ StringConstants.ENCODE_SERIALIZABLE_ELEMENT = 'encodeSerializableElement';
44
+ StringConstants.DECODE_BOOLEAN = 'decodeBoolean';
45
+ StringConstants.DECODE_NUMBER = 'decodeNumber';
46
+ StringConstants.DECODE_STRING = 'decodeString';
47
+ StringConstants.DECODE_BIGINT = 'decodeBigint';
48
+ StringConstants.DECODE_NULL = 'decodeNull';
49
+ StringConstants.DECODE_UNDEFINED = 'decodeUndefined';
50
+ StringConstants.DESERIALIZABLE = 'deserialize';
51
+ StringConstants.IMPORT_BUILD_CLASS_SERIAL_DESCRIPTOR = 'buildClassSerialDescriptor';
52
+ StringConstants.IMPORT_DECODER = 'Decoder';
53
+ StringConstants.IMPORT_ENCODER = 'Encoder';
54
+ StringConstants.IMPORT_SERIAL_DESCRIPTOR = 'SerialDescriptor';
55
+ StringConstants.IMPORT_SERIALIZER = 'Serializer';
56
+ StringConstants.IMPORT_TJSON = 'TJSON';
57
+ StringConstants.IMPORT_IT_SERIALIZABLE = 'ITSerializable';
58
+ StringConstants.IMPORT_LANG = 'lang';
59
+ StringConstants.BOOLEAN_WRAPPER = 'Boolean';
60
+ StringConstants.NUMBER_WRAPPER = 'Number';
61
+ StringConstants.STRING_WRAPPER = 'String';
62
+ StringConstants.ARRAY_SUFFIX = '[]';
63
+ StringConstants.ARRAY_PREFIX = 'array<';
64
+ StringConstants.DEFAULT_VALUE_FALSE = 'false';
65
+ StringConstants.DEFAULT_VALUE_ZERO = '0';
66
+ StringConstants.DEFAULT_VALUE_EMPTY_STRING = "''";
67
+ StringConstants.DEFAULT_VALUE_ZERO_BIGINT = '0n';
68
+ StringConstants.DEFAULT_VALUE_UNDEFINED = 'undefined';
69
+ StringConstants.TEMPLATE_ELEMENT_NAME = 'element';
70
+ StringConstants.TEMPLATE_SENDABLE_ERROR_PREFIX = 'Sendable support not enabled for';
71
+ StringConstants.FILE_OPERATION_EMPTY_STRING = '';
72
+ StringConstants.REGEX_IMPORT_STATEMENT = /import\s+({[^}]+}|\w+)\s+from\s+'([^']+)'/;
73
+ StringConstants.REGEX_SRC_MAIN_ETS = /\/src\/main\/ets\/(.*)\.ets$/;
74
+ StringConstants.SEPARATOR_COMMA = ',';
75
+ StringConstants.SEPARATOR_COMMA_NEWLINE = ',\n';
76
+ StringConstants.SEPARATOR_NEWLINE = '\n';
77
+ StringConstants.SEPARATOR_COMMA_SPACE = ', ';
78
+ StringConstants.JOIN_ELEMENT_PREFIX = ',\n ';
79
+ StringConstants.CURLY_BRACE_START = '{';
80
+ StringConstants.PATH_RELATIVE_PREFIX = './';
81
+ StringConstants.INSTANCE_SUFFIX = '.INSTANCE';
82
+ StringConstants.SERIALIZER_SUFFIX = 'Serializer';
83
+ StringConstants.LOG_PREFIX_T_SERIALIZATION = '[TSerialization]';
84
+ StringConstants.LOG_MODULE_PREFIX_TEMPLATE = '[${module}]';
85
+ StringConstants.PLUGIN_ID = 'turboTransJsonPlugin';
86
+ StringConstants.JSON_MODULE_SPECIFIER = '@hadss/hmserialization-json';
87
+ StringConstants.ARKTS_MODULE_SPECIFIER = '@kit.ArkTS';
@@ -0,0 +1,3 @@
1
+ export * from './StringConstants';
2
+ export * from './DecoratorConstants';
3
+ export * from './PathConstants';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./StringConstants"), exports);
18
+ __exportStar(require("./DecoratorConstants"), exports);
19
+ __exportStar(require("./PathConstants"), exports);
@@ -0,0 +1,23 @@
1
+ import { TypeNode } from 'ts-morph';
2
+ import { ITypeHandler, TypeContext, ConversionDirection } from './ITypeHandler';
3
+ import { PropertyKind, SerializerMetadata, TypeStructure } from '../Types';
4
+ export declare abstract class BaseTypeHandler implements ITypeHandler {
5
+ abstract readonly name: string;
6
+ abstract readonly kind: PropertyKind;
7
+ abstract readonly priority: number;
8
+ abstract matches(typeNode: TypeNode, context: TypeContext): boolean;
9
+ abstract parse(typeNode: TypeNode, context: TypeContext): TypeStructure;
10
+ abstract getSerializerMetadata(structure: TypeStructure, withParam?: string): SerializerMetadata;
11
+ abstract generateInstantiation(structure: TypeStructure): string;
12
+ abstract generateTypeDeclaration(structure: TypeStructure): string;
13
+ abstract generateTypeKey(structure: TypeStructure): string;
14
+ abstract generateSendableTypeDeclaration(structure: TypeStructure): string;
15
+ abstract generatePropertyConversion(structure: TypeStructure, sourceValue: string, direction: ConversionDirection): string;
16
+ protected getSerializerName(): string;
17
+ protected getTypeName(): string;
18
+ protected capitalize(str: string): string;
19
+ protected applyWithParam(withParam: string | undefined, defaultInstantiation: string, structure: TypeStructure): string;
20
+ protected containsGenericType(structure: TypeStructure): boolean;
21
+ protected generateTypeKeySerializers(structure: TypeStructure): string;
22
+ protected generateTypeKeys(structure: TypeStructure): string;
23
+ }