@abp/ng.schematics 10.5.0 → 10.6.0-rc.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 (259) hide show
  1. package/commands/ai-config/index.d.ts +3 -3
  2. package/commands/ai-config/index.js +88 -88
  3. package/commands/ai-config/index.js.map +1 -1
  4. package/commands/ai-config/model.d.ts +10 -10
  5. package/commands/ai-config/model.js +2 -2
  6. package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +6 -4
  7. package/commands/api/index.d.ts +2 -2
  8. package/commands/api/index.js +139 -138
  9. package/commands/api/index.js.map +1 -1
  10. package/commands/change-theme/index.d.ts +28 -28
  11. package/commands/change-theme/index.js +474 -473
  12. package/commands/change-theme/index.js.map +1 -1
  13. package/commands/change-theme/model.d.ts +5 -5
  14. package/commands/change-theme/model.js +2 -2
  15. package/commands/change-theme/style-map.d.ts +16 -16
  16. package/commands/change-theme/style-map.js +424 -424
  17. package/commands/change-theme/theme-options.enum.d.ts +6 -6
  18. package/commands/change-theme/theme-options.enum.js +11 -11
  19. package/commands/change-theme/theme-options.enum.js.map +1 -1
  20. package/commands/create-lib/index.d.ts +13 -13
  21. package/commands/create-lib/index.js +298 -298
  22. package/commands/create-lib/index.js.map +1 -1
  23. package/commands/create-lib/models/generate-lib-schema.d.ts +20 -20
  24. package/commands/create-lib/models/generate-lib-schema.js +8 -8
  25. package/commands/create-lib/models/generate-lib-schema.js.map +1 -1
  26. package/commands/create-lib/models/index.d.ts +1 -1
  27. package/commands/create-lib/models/index.js +4 -17
  28. package/commands/create-lib/models/index.js.map +1 -1
  29. package/commands/proxy-add/index.d.ts +2 -2
  30. package/commands/proxy-add/index.js +41 -41
  31. package/commands/proxy-add/index.js.map +1 -1
  32. package/commands/proxy-index/index.d.ts +5 -5
  33. package/commands/proxy-index/index.js +14 -14
  34. package/commands/proxy-index/index.js.map +1 -1
  35. package/commands/proxy-refresh/index.d.ts +3 -3
  36. package/commands/proxy-refresh/index.js +27 -27
  37. package/commands/proxy-refresh/index.js.map +1 -1
  38. package/commands/proxy-remove/index.d.ts +3 -3
  39. package/commands/proxy-remove/index.js +33 -33
  40. package/commands/proxy-remove/index.js.map +1 -1
  41. package/commands/ssr-add/index.d.ts +11 -11
  42. package/commands/ssr-add/index.js +360 -361
  43. package/commands/ssr-add/index.js.map +1 -1
  44. package/commands/ssr-add/server/index.d.ts +10 -10
  45. package/commands/ssr-add/server/index.js +209 -205
  46. package/commands/ssr-add/server/index.js.map +1 -1
  47. package/commands/ssr-add/server/index.ts +6 -2
  48. package/constants/api.d.ts +1 -1
  49. package/constants/api.js +4 -4
  50. package/constants/index.d.ts +4 -4
  51. package/constants/index.js +7 -20
  52. package/constants/index.js.map +1 -1
  53. package/constants/proxy.d.ts +4 -4
  54. package/constants/proxy.js +7 -7
  55. package/constants/symbols.d.ts +1 -1
  56. package/constants/symbols.js +4 -4
  57. package/constants/system-types.d.ts +1 -1
  58. package/constants/system-types.js +29 -29
  59. package/constants/volo.d.ts +5 -5
  60. package/constants/volo.js +34 -34
  61. package/enums/binding-source-id.d.ts +8 -7
  62. package/enums/binding-source-id.js +12 -11
  63. package/enums/binding-source-id.js.map +1 -1
  64. package/enums/exception.d.ts +17 -17
  65. package/enums/exception.js +2 -2
  66. package/enums/import-keyword.d.ts +4 -4
  67. package/enums/import-keyword.js +8 -8
  68. package/enums/import-keyword.js.map +1 -1
  69. package/enums/index.d.ts +5 -5
  70. package/enums/index.js +8 -21
  71. package/enums/index.js.map +1 -1
  72. package/enums/method-modifier.d.ts +6 -6
  73. package/enums/method-modifier.js +10 -10
  74. package/enums/method-modifier.js.map +1 -1
  75. package/enums/service-types.d.ts +6 -6
  76. package/enums/service-types.js +10 -10
  77. package/enums/service-types.js.map +1 -1
  78. package/index.d.ts +3 -3
  79. package/index.js +6 -19
  80. package/index.js.map +1 -1
  81. package/models/api-definition.d.ts +97 -93
  82. package/models/api-definition.js +2 -2
  83. package/models/generate-proxy-schema.d.ts +28 -28
  84. package/models/generate-proxy-schema.js +2 -2
  85. package/models/import.d.ts +11 -11
  86. package/models/import.js +13 -13
  87. package/models/index.d.ts +11 -11
  88. package/models/index.js +14 -27
  89. package/models/index.js.map +1 -1
  90. package/models/method.d.ts +36 -34
  91. package/models/method.js +73 -70
  92. package/models/method.js.map +1 -1
  93. package/models/model.d.ts +48 -48
  94. package/models/model.js +76 -76
  95. package/models/model.js.map +1 -1
  96. package/models/project.d.ts +5 -5
  97. package/models/project.js +2 -2
  98. package/models/proxy-config.d.ts +4 -4
  99. package/models/proxy-config.js +2 -2
  100. package/models/rule.d.ts +2 -2
  101. package/models/rule.js +2 -2
  102. package/models/service.d.ts +21 -21
  103. package/models/service.js +11 -11
  104. package/models/tree.d.ts +1 -1
  105. package/models/tree.js +2 -2
  106. package/models/util.d.ts +7 -7
  107. package/models/util.js +2 -2
  108. package/package.json +6 -6
  109. package/utils/angular/add-declaration-to-ng-module.d.ts +20 -20
  110. package/utils/angular/add-declaration-to-ng-module.js +45 -45
  111. package/utils/angular/add-declaration-to-ng-module.js.map +1 -1
  112. package/utils/angular/ast-utils.d.ts +106 -106
  113. package/utils/angular/ast-utils.js +518 -518
  114. package/utils/angular/ast-utils.js.map +1 -1
  115. package/utils/angular/change.d.ts +68 -68
  116. package/utils/angular/change.js +121 -121
  117. package/utils/angular/change.js.map +1 -1
  118. package/utils/angular/dependencies.d.ts +23 -23
  119. package/utils/angular/dependencies.js +56 -56
  120. package/utils/angular/dependencies.js.map +1 -1
  121. package/utils/angular/dependency.d.ts +96 -96
  122. package/utils/angular/dependency.js +123 -122
  123. package/utils/angular/dependency.js.map +1 -1
  124. package/utils/angular/eol.d.ts +8 -8
  125. package/utils/angular/eol.js +22 -23
  126. package/utils/angular/eol.js.map +1 -1
  127. package/utils/angular/find-module.d.ts +33 -33
  128. package/utils/angular/find-module.js +105 -105
  129. package/utils/angular/find-module.js.map +1 -1
  130. package/utils/angular/generate-from-files.d.ts +19 -19
  131. package/utils/angular/generate-from-files.js +48 -49
  132. package/utils/angular/generate-from-files.js.map +1 -1
  133. package/utils/angular/index.d.ts +15 -15
  134. package/utils/angular/index.js +18 -31
  135. package/utils/angular/index.js.map +1 -1
  136. package/utils/angular/json-file.d.ts +24 -24
  137. package/utils/angular/json-file.js +71 -71
  138. package/utils/angular/json-file.js.map +1 -1
  139. package/utils/angular/latest-versions/index.d.ts +28 -28
  140. package/utils/angular/latest-versions/index.js +31 -31
  141. package/utils/angular/ng-ast-utils.d.ts +12 -12
  142. package/utils/angular/ng-ast-utils.js +79 -79
  143. package/utils/angular/ng-ast-utils.js.map +1 -1
  144. package/utils/angular/parse-name.d.ts +13 -13
  145. package/utils/angular/parse-name.js +19 -20
  146. package/utils/angular/parse-name.js.map +1 -1
  147. package/utils/angular/paths.d.ts +8 -8
  148. package/utils/angular/paths.js +17 -18
  149. package/utils/angular/paths.js.map +1 -1
  150. package/utils/angular/project-targets.d.ts +11 -11
  151. package/utils/angular/project-targets.js +21 -22
  152. package/utils/angular/project-targets.js.map +1 -1
  153. package/utils/angular/standalone/app_component.d.ts +29 -29
  154. package/utils/angular/standalone/app_component.js +107 -107
  155. package/utils/angular/standalone/app_component.js.map +1 -1
  156. package/utils/angular/standalone/app_config.d.ts +23 -23
  157. package/utils/angular/standalone/app_config.js +89 -89
  158. package/utils/angular/standalone/app_config.js.map +1 -1
  159. package/utils/angular/standalone/code_block.d.ts +53 -53
  160. package/utils/angular/standalone/code_block.js +80 -79
  161. package/utils/angular/standalone/code_block.js.map +1 -1
  162. package/utils/angular/standalone/index.d.ts +9 -9
  163. package/utils/angular/standalone/index.js +13 -13
  164. package/utils/angular/standalone/rules.d.ts +45 -45
  165. package/utils/angular/standalone/rules.js +187 -188
  166. package/utils/angular/standalone/rules.js.map +1 -1
  167. package/utils/angular/standalone/util.d.ts +35 -35
  168. package/utils/angular/standalone/util.js +135 -135
  169. package/utils/angular/standalone/util.js.map +1 -1
  170. package/utils/angular/test/create-app-module.d.ts +9 -9
  171. package/utils/angular/test/create-app-module.js +14 -15
  172. package/utils/angular/test/create-app-module.js.map +1 -1
  173. package/utils/angular/test/get-file-content.d.ts +9 -9
  174. package/utils/angular/test/get-file-content.js +17 -18
  175. package/utils/angular/test/get-file-content.js.map +1 -1
  176. package/utils/angular/test/index.d.ts +9 -9
  177. package/utils/angular/test/index.js +12 -25
  178. package/utils/angular/test/index.js.map +1 -1
  179. package/utils/angular/validation.d.ts +10 -10
  180. package/utils/angular/validation.js +28 -28
  181. package/utils/angular/validation.js.map +1 -1
  182. package/utils/angular/workspace-models.d.ts +167 -167
  183. package/utils/angular/workspace-models.js +43 -43
  184. package/utils/angular/workspace-models.js.map +1 -1
  185. package/utils/angular/workspace.d.ts +65 -65
  186. package/utils/angular/workspace.js +135 -135
  187. package/utils/angular/workspace.js.map +1 -1
  188. package/utils/angular-schematic/generate-lib.d.ts +3 -3
  189. package/utils/angular-schematic/generate-lib.js +52 -53
  190. package/utils/angular-schematic/generate-lib.js.map +1 -1
  191. package/utils/angular-schematic/index.d.ts +1 -1
  192. package/utils/angular-schematic/index.js +4 -17
  193. package/utils/angular-schematic/index.js.map +1 -1
  194. package/utils/api.d.ts +2 -2
  195. package/utils/api.js +7 -8
  196. package/utils/api.js.map +1 -1
  197. package/utils/ast.d.ts +5 -5
  198. package/utils/ast.js +28 -28
  199. package/utils/ast.js.map +1 -1
  200. package/utils/barrel.d.ts +4 -4
  201. package/utils/barrel.js +86 -87
  202. package/utils/barrel.js.map +1 -1
  203. package/utils/common.d.ts +11 -11
  204. package/utils/common.js +78 -78
  205. package/utils/common.js.map +1 -1
  206. package/utils/enum.d.ts +18 -18
  207. package/utils/enum.js +39 -40
  208. package/utils/enum.js.map +1 -1
  209. package/utils/file.d.ts +2 -2
  210. package/utils/file.js +8 -9
  211. package/utils/file.js.map +1 -1
  212. package/utils/generics.d.ts +26 -26
  213. package/utils/generics.js +89 -89
  214. package/utils/generics.js.map +1 -1
  215. package/utils/import.d.ts +3 -3
  216. package/utils/import.js +10 -11
  217. package/utils/import.js.map +1 -1
  218. package/utils/index.d.ts +22 -22
  219. package/utils/index.js +25 -38
  220. package/utils/index.js.map +1 -1
  221. package/utils/methods.d.ts +4 -4
  222. package/utils/methods.js +31 -31
  223. package/utils/methods.js.map +1 -1
  224. package/utils/model.d.ts +14 -14
  225. package/utils/model.js +217 -211
  226. package/utils/model.js.map +1 -1
  227. package/utils/namespace.d.ts +1 -1
  228. package/utils/namespace.js +17 -18
  229. package/utils/namespace.js.map +1 -1
  230. package/utils/ng-module.d.ts +46 -46
  231. package/utils/ng-module.js +126 -125
  232. package/utils/ng-module.js.map +1 -1
  233. package/utils/path.d.ts +2 -2
  234. package/utils/path.js +35 -36
  235. package/utils/path.js.map +1 -1
  236. package/utils/rule.d.ts +4 -4
  237. package/utils/rule.js +32 -33
  238. package/utils/rule.js.map +1 -1
  239. package/utils/service.d.ts +8 -8
  240. package/utils/service.js +280 -171
  241. package/utils/service.js.map +1 -1
  242. package/utils/source.d.ts +13 -13
  243. package/utils/source.js +165 -165
  244. package/utils/source.js.map +1 -1
  245. package/utils/standalone.d.ts +59 -59
  246. package/utils/standalone.js +146 -145
  247. package/utils/standalone.js.map +1 -1
  248. package/utils/text.d.ts +10 -10
  249. package/utils/text.js +59 -59
  250. package/utils/text.js.map +1 -1
  251. package/utils/tree.d.ts +14 -14
  252. package/utils/tree.js +83 -83
  253. package/utils/tree.js.map +1 -1
  254. package/utils/type.d.ts +13 -13
  255. package/utils/type.js +112 -113
  256. package/utils/type.js.map +1 -1
  257. package/utils/workspace.d.ts +20 -20
  258. package/utils/workspace.js +113 -114
  259. package/utils/workspace.js.map +1 -1
package/utils/model.js CHANGED
@@ -1,212 +1,218 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveSelfGenericProps = exports.resolveAbpPackages = exports.parseBaseTypeWithGenericTypes = exports.createRefToImportReducerCreator = exports.createImportRefToInterfaceReducerCreator = exports.createImportRefsToModelReducer = void 0;
4
- const models_1 = require("../models");
5
- const generics_1 = require("./generics");
6
- const namespace_1 = require("./namespace");
7
- const path_1 = require("./path");
8
- const text_1 = require("./text");
9
- const tree_1 = require("./tree");
10
- const type_1 = require("./type");
11
- const constants_1 = require("../constants");
12
- // eslint-disable-next-line @typescript-eslint/no-var-requires
13
- const shouldQuote = require('should-quote');
14
- function createImportRefsToModelReducer(params) {
15
- const reduceImportRefsToInterfaces = createImportRefToInterfaceReducerCreator(params);
16
- const createRefToImportReducer = createRefToImportReducerCreator(params);
17
- const { solution, types } = params;
18
- return (models, importRefs) => {
19
- const enums = [];
20
- const interfaces = importRefs.reduce(reduceImportRefsToInterfaces, []);
21
- sortInterfaces(interfaces);
22
- interfaces.forEach(_interface => {
23
- if (constants_1.VOLO_REGEX.test(_interface.ref) || constants_1.VOLO_PACKAGE_PROXY_IMPORTS.has(_interface.ref))
24
- return;
25
- if (types[_interface.ref].isEnum) {
26
- if (!enums.includes(_interface.ref))
27
- enums.push(_interface.ref);
28
- return;
29
- }
30
- const index = models.findIndex(m => m.namespace === _interface.namespace);
31
- if (index > -1) {
32
- if (models[index].interfaces.some(i => i.identifier === _interface.identifier))
33
- return;
34
- models[index].interfaces.push(_interface);
35
- }
36
- else {
37
- const { namespace } = _interface;
38
- models.push(new models_1.Model({
39
- interfaces: [_interface],
40
- namespace,
41
- path: (0, path_1.relativePathToModel)(namespace, namespace),
42
- }));
43
- }
44
- });
45
- models.forEach(model => {
46
- const toBeImported = [];
47
- model.interfaces.forEach(_interface => {
48
- const { baseType } = types[_interface.ref];
49
- if (baseType && (0, namespace_1.parseNamespace)(solution, baseType) !== model.namespace) {
50
- const baseTypeWithGenericParams = parseBaseTypeWithGenericTypes(baseType);
51
- baseTypeWithGenericParams.forEach(t => {
52
- toBeImported.push({
53
- type: t,
54
- isEnum: false,
55
- });
56
- });
57
- }
58
- [..._interface.properties, ..._interface.generics].forEach(prop => {
59
- prop.refs.forEach(ref => {
60
- const propType = types[ref];
61
- if (!propType) {
62
- return;
63
- }
64
- if (propType.isEnum) {
65
- toBeImported.push({ type: ref, isEnum: true });
66
- }
67
- else if ((0, namespace_1.parseNamespace)(solution, ref) !== model.namespace) {
68
- toBeImported.push({ type: ref, isEnum: false });
69
- }
70
- });
71
- });
72
- });
73
- if (!toBeImported.length)
74
- return;
75
- const reduceRefToImport = createRefToImportReducer(model.namespace);
76
- reduceRefToImport(model.imports, toBeImported);
77
- });
78
- return models;
79
- };
80
- }
81
- exports.createImportRefsToModelReducer = createImportRefsToModelReducer;
82
- function sortInterfaces(interfaces) {
83
- interfaces.sort((a, b) => (a.identifier > b.identifier ? 1 : -1));
84
- }
85
- function createImportRefToInterfaceReducerCreator(params) {
86
- const { solution, types } = params;
87
- const parseType = (0, type_1.createTypeParser)(type_1.removeTypeModifiers);
88
- const simplifyType = (0, type_1.createTypeSimplifier)();
89
- const getIdentifier = (type) => (0, type_1.removeTypeModifiers)(simplifyType(type));
90
- const genericsCollector = new generics_1.GenericsCollector(getIdentifier);
91
- return reduceRefsToInterfaces;
92
- function reduceRefsToInterfaces(interfaces, ref) {
93
- const typeDef = types[ref];
94
- if (!typeDef)
95
- return interfaces;
96
- const namespace = (0, namespace_1.parseNamespace)(solution, ref);
97
- let { baseType: base, genericArguments } = typeDef;
98
- genericArguments = genericArguments || [];
99
- let identifier = getIdentifier(ref);
100
- identifier = (0, generics_1.replacePlaceholdersWithGenerics)(identifier, genericArguments, genericsCollector);
101
- if (base) {
102
- if ((0, type_1.extendsSelf)(ref, base)) {
103
- genericsCollector.collect((0, generics_1.extractGenerics)(base).generics, genericArguments);
104
- return reduceRefsToInterfaces(interfaces, (0, generics_1.generateRefWithPlaceholders)(base));
105
- }
106
- else {
107
- base = getIdentifier(base);
108
- }
109
- }
110
- const { generics } = genericsCollector;
111
- const _interface = new models_1.Interface({ identifier, base, namespace, ref, generics });
112
- genericsCollector.reset();
113
- typeDef.properties?.forEach(prop => {
114
- let name = prop.jsonName || (0, text_1.camel)(prop.name);
115
- name = shouldQuote(name) ? `'${name}'` : name;
116
- let type = simplifyType(prop.typeSimple);
117
- if (prop.typeSimple.includes('enum')) {
118
- type = simplifyType(prop.type);
119
- }
120
- if (prop.isNullable) {
121
- type = `${type} | null`;
122
- }
123
- const refs = parseType(prop.type).reduce((acc, r) => acc.concat((0, tree_1.parseGenerics)(r).toGenerics()), []);
124
- const property = new models_1.Property({ name, type, refs });
125
- property.setOptional(isOptionalProperty(prop));
126
- _interface.properties.push(property);
127
- });
128
- interfaces.push(_interface);
129
- return [..._interface.properties, ..._interface.generics]
130
- .reduce((refs, prop) => {
131
- prop.refs.forEach(type => {
132
- if (types[type]?.isEnum)
133
- return;
134
- if (interfaces.some(i => i.ref === type))
135
- return;
136
- refs.push(type);
137
- });
138
- return refs;
139
- }, [])
140
- .concat(base ? (0, tree_1.parseGenerics)(typeDef.baseType).toGenerics() : [])
141
- .reduce(reduceRefsToInterfaces, interfaces);
142
- }
143
- }
144
- exports.createImportRefToInterfaceReducerCreator = createImportRefToInterfaceReducerCreator;
145
- function createRefToImportReducerCreator(params) {
146
- const { solution } = params;
147
- return (namespace) => (0, type_1.createTypesToImportsReducer)(solution, namespace);
148
- }
149
- exports.createRefToImportReducerCreator = createRefToImportReducerCreator;
150
- function isOptionalProperty(prop) {
151
- return !prop.isRequired;
152
- }
153
- function parseBaseTypeWithGenericTypes(type) {
154
- const parsedTypeNode = (0, tree_1.parseGenerics)(type);
155
- const nodeToText = (node, acc = []) => {
156
- acc.push(node.data);
157
- if (node.children && node.children.length > 0) {
158
- node.children.forEach(child => {
159
- nodeToText(child, acc);
160
- });
161
- }
162
- return acc;
163
- };
164
- return nodeToText(parsedTypeNode);
165
- }
166
- exports.parseBaseTypeWithGenericTypes = parseBaseTypeWithGenericTypes;
167
- function resolveAbpPackages(models) {
168
- for (const model of models) {
169
- renamePropForTenant(model.interfaces);
170
- model.imports.forEach((imp, i) => {
171
- for (const ref of imp.refs) {
172
- const path = constants_1.VOLO_PACKAGE_PROXY_IMPORTS.get(ref);
173
- if (path) {
174
- model.imports[i] = new models_1.Import({ ...imp, path });
175
- }
176
- }
177
- });
178
- }
179
- }
180
- exports.resolveAbpPackages = resolveAbpPackages;
181
- function renamePropForTenant(interfaces) {
182
- for (const inters of interfaces) {
183
- for (const prop of inters.properties) {
184
- const isTenant = prop.name.toLocaleLowerCase().includes(constants_1.TENANT_KEY);
185
- const isSaasDto = prop.refs.filter(f => f.startsWith(constants_1.SAAS_NAMESPACE)).length > 0;
186
- if (isTenant && isSaasDto && !prop.type.startsWith('Saas')) {
187
- prop.type = 'Saas' + prop.type;
188
- }
189
- }
190
- }
191
- }
192
- function resolveSelfGenericProps(params) {
193
- const { types, solution } = params;
194
- if (!types || !solution) {
195
- return;
196
- }
197
- Object.keys(types)
198
- .filter(f => f.startsWith(solution))
199
- .forEach(key => {
200
- const type = types[key];
201
- if (type.genericArguments?.length) {
202
- type.properties?.map(prop => {
203
- if (prop.type.includes('<>')) {
204
- prop.type = prop.type.replace('<>', `<${type.genericArguments.join(', ')}>`);
205
- prop.typeSimple = prop.typeSimple.replace('<>', `<${type.genericArguments.join(', ')}>`);
206
- }
207
- });
208
- }
209
- });
210
- }
211
- exports.resolveSelfGenericProps = resolveSelfGenericProps;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createImportRefsToModelReducer = createImportRefsToModelReducer;
4
+ exports.createImportRefToInterfaceReducerCreator = createImportRefToInterfaceReducerCreator;
5
+ exports.createRefToImportReducerCreator = createRefToImportReducerCreator;
6
+ exports.parseBaseTypeWithGenericTypes = parseBaseTypeWithGenericTypes;
7
+ exports.resolveAbpPackages = resolveAbpPackages;
8
+ exports.resolveSelfGenericProps = resolveSelfGenericProps;
9
+ const models_1 = require("../models");
10
+ const generics_1 = require("./generics");
11
+ const namespace_1 = require("./namespace");
12
+ const path_1 = require("./path");
13
+ const text_1 = require("./text");
14
+ const tree_1 = require("./tree");
15
+ const type_1 = require("./type");
16
+ const constants_1 = require("../constants");
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18
+ const shouldQuote = require('should-quote');
19
+ function createImportRefsToModelReducer(params) {
20
+ const reduceImportRefsToInterfaces = createImportRefToInterfaceReducerCreator(params);
21
+ const createRefToImportReducer = createRefToImportReducerCreator(params);
22
+ const { solution, types } = params;
23
+ return (models, importRefs) => {
24
+ const enums = [];
25
+ const interfaces = importRefs.reduce(reduceImportRefsToInterfaces, []);
26
+ sortInterfaces(interfaces);
27
+ interfaces.forEach(_interface => {
28
+ if (constants_1.VOLO_REGEX.test(_interface.ref) || constants_1.VOLO_PACKAGE_PROXY_IMPORTS.has(_interface.ref))
29
+ return;
30
+ if (types[_interface.ref].isEnum) {
31
+ if (!enums.includes(_interface.ref))
32
+ enums.push(_interface.ref);
33
+ return;
34
+ }
35
+ const index = models.findIndex(m => m.namespace === _interface.namespace);
36
+ if (index > -1) {
37
+ if (models[index].interfaces.some(i => i.identifier === _interface.identifier))
38
+ return;
39
+ models[index].interfaces.push(_interface);
40
+ }
41
+ else {
42
+ const { namespace } = _interface;
43
+ models.push(new models_1.Model({
44
+ interfaces: [_interface],
45
+ namespace,
46
+ path: (0, path_1.relativePathToModel)(namespace, namespace),
47
+ }));
48
+ }
49
+ });
50
+ models.forEach(model => {
51
+ const toBeImported = [];
52
+ model.interfaces.forEach(_interface => {
53
+ const { baseType } = types[_interface.ref];
54
+ if (baseType && (0, namespace_1.parseNamespace)(solution, baseType) !== model.namespace) {
55
+ const baseTypeWithGenericParams = parseBaseTypeWithGenericTypes(baseType);
56
+ baseTypeWithGenericParams.forEach(t => {
57
+ // A generic argument of the base type (e.g. T in PagedResultDto<T>) may live in the
58
+ // same namespace as this model, which means it is generated into the same models.ts
59
+ // file. Importing it would produce an invalid self-import (`from './models'`), so we
60
+ // skip same-namespace types here, mirroring the property handling below. See #25080.
61
+ if ((0, namespace_1.parseNamespace)(solution, t) === model.namespace) {
62
+ return;
63
+ }
64
+ toBeImported.push({
65
+ type: t,
66
+ isEnum: false,
67
+ });
68
+ });
69
+ }
70
+ [..._interface.properties, ..._interface.generics].forEach(prop => {
71
+ prop.refs.forEach(ref => {
72
+ const propType = types[ref];
73
+ if (!propType) {
74
+ return;
75
+ }
76
+ if (propType.isEnum) {
77
+ toBeImported.push({ type: ref, isEnum: true });
78
+ }
79
+ else if ((0, namespace_1.parseNamespace)(solution, ref) !== model.namespace) {
80
+ toBeImported.push({ type: ref, isEnum: false });
81
+ }
82
+ });
83
+ });
84
+ });
85
+ if (!toBeImported.length)
86
+ return;
87
+ const reduceRefToImport = createRefToImportReducer(model.namespace);
88
+ reduceRefToImport(model.imports, toBeImported);
89
+ });
90
+ return models;
91
+ };
92
+ }
93
+ function sortInterfaces(interfaces) {
94
+ interfaces.sort((a, b) => (a.identifier > b.identifier ? 1 : -1));
95
+ }
96
+ function createImportRefToInterfaceReducerCreator(params) {
97
+ const { solution, types } = params;
98
+ const parseType = (0, type_1.createTypeParser)(type_1.removeTypeModifiers);
99
+ const simplifyType = (0, type_1.createTypeSimplifier)();
100
+ const getIdentifier = (type) => (0, type_1.removeTypeModifiers)(simplifyType(type));
101
+ const genericsCollector = new generics_1.GenericsCollector(getIdentifier);
102
+ return reduceRefsToInterfaces;
103
+ function reduceRefsToInterfaces(interfaces, ref) {
104
+ const typeDef = types[ref];
105
+ if (!typeDef)
106
+ return interfaces;
107
+ const namespace = (0, namespace_1.parseNamespace)(solution, ref);
108
+ let { baseType: base, genericArguments } = typeDef;
109
+ genericArguments = genericArguments || [];
110
+ let identifier = getIdentifier(ref);
111
+ identifier = (0, generics_1.replacePlaceholdersWithGenerics)(identifier, genericArguments, genericsCollector);
112
+ if (base) {
113
+ if ((0, type_1.extendsSelf)(ref, base)) {
114
+ genericsCollector.collect((0, generics_1.extractGenerics)(base).generics, genericArguments);
115
+ return reduceRefsToInterfaces(interfaces, (0, generics_1.generateRefWithPlaceholders)(base));
116
+ }
117
+ else {
118
+ base = getIdentifier(base);
119
+ }
120
+ }
121
+ const { generics } = genericsCollector;
122
+ const _interface = new models_1.Interface({ identifier, base, namespace, ref, generics });
123
+ genericsCollector.reset();
124
+ typeDef.properties?.forEach(prop => {
125
+ let name = prop.jsonName || (0, text_1.camel)(prop.name);
126
+ name = shouldQuote(name) ? `'${name}'` : name;
127
+ let type = simplifyType(prop.typeSimple);
128
+ if (prop.typeSimple.includes('enum')) {
129
+ type = simplifyType(prop.type);
130
+ }
131
+ if (prop.isNullable) {
132
+ type = `${type} | null`;
133
+ }
134
+ const refs = parseType(prop.type).reduce((acc, r) => acc.concat((0, tree_1.parseGenerics)(r).toGenerics()), []);
135
+ const property = new models_1.Property({ name, type, refs });
136
+ property.setOptional(isOptionalProperty(prop));
137
+ _interface.properties.push(property);
138
+ });
139
+ interfaces.push(_interface);
140
+ return [..._interface.properties, ..._interface.generics]
141
+ .reduce((refs, prop) => {
142
+ prop.refs.forEach(type => {
143
+ if (types[type]?.isEnum)
144
+ return;
145
+ if (interfaces.some(i => i.ref === type))
146
+ return;
147
+ refs.push(type);
148
+ });
149
+ return refs;
150
+ }, [])
151
+ .concat(base ? (0, tree_1.parseGenerics)(typeDef.baseType).toGenerics() : [])
152
+ .reduce(reduceRefsToInterfaces, interfaces);
153
+ }
154
+ }
155
+ function createRefToImportReducerCreator(params) {
156
+ const { solution } = params;
157
+ return (namespace) => (0, type_1.createTypesToImportsReducer)(solution, namespace);
158
+ }
159
+ function isOptionalProperty(prop) {
160
+ return !prop.isRequired;
161
+ }
162
+ function parseBaseTypeWithGenericTypes(type) {
163
+ const parsedTypeNode = (0, tree_1.parseGenerics)(type);
164
+ const nodeToText = (node, acc = []) => {
165
+ acc.push(node.data);
166
+ if (node.children && node.children.length > 0) {
167
+ node.children.forEach(child => {
168
+ nodeToText(child, acc);
169
+ });
170
+ }
171
+ return acc;
172
+ };
173
+ return nodeToText(parsedTypeNode);
174
+ }
175
+ function resolveAbpPackages(models) {
176
+ for (const model of models) {
177
+ renamePropForTenant(model.interfaces);
178
+ model.imports.forEach((imp, i) => {
179
+ for (const ref of imp.refs) {
180
+ const path = constants_1.VOLO_PACKAGE_PROXY_IMPORTS.get(ref);
181
+ if (path) {
182
+ model.imports[i] = new models_1.Import({ ...imp, path });
183
+ }
184
+ }
185
+ });
186
+ }
187
+ }
188
+ function renamePropForTenant(interfaces) {
189
+ for (const inters of interfaces) {
190
+ for (const prop of inters.properties) {
191
+ const isTenant = prop.name.toLocaleLowerCase().includes(constants_1.TENANT_KEY);
192
+ const isSaasDto = prop.refs.filter(f => f.startsWith(constants_1.SAAS_NAMESPACE)).length > 0;
193
+ if (isTenant && isSaasDto && !prop.type.startsWith('Saas')) {
194
+ prop.type = 'Saas' + prop.type;
195
+ }
196
+ }
197
+ }
198
+ }
199
+ function resolveSelfGenericProps(params) {
200
+ const { types, solution } = params;
201
+ if (!types || !solution) {
202
+ return;
203
+ }
204
+ Object.keys(types)
205
+ .filter(f => f.startsWith(solution))
206
+ .forEach(key => {
207
+ const type = types[key];
208
+ if (type.genericArguments?.length) {
209
+ type.properties?.map(prop => {
210
+ if (prop.type.includes('<>')) {
211
+ prop.type = prop.type.replace('<>', `<${type.genericArguments.join(', ')}>`);
212
+ prop.typeSimple = prop.typeSimple.replace('<>', `<${type.genericArguments.join(', ')}>`);
213
+ }
214
+ });
215
+ }
216
+ });
217
+ }
212
218
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../packages/schematics/src/utils/model.ts"],"names":[],"mappings":";;;AAAA,sCAAgG;AAChG,yCAKoB;AACpB,2CAA6C;AAC7C,iCAA6C;AAC7C,iCAA+B;AAC/B,iCAAiD;AACjD,iCAMgB;AAChB,4CAAkG;AAElG,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAU5C,SAAgB,8BAA8B,CAAC,MAA4B;IACzE,MAAM,4BAA4B,GAAG,wCAAwC,CAAC,MAAM,CAAC,CAAC;IACtF,MAAM,wBAAwB,GAAG,+BAA+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AC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,uBAAuB,CAAC,MAAqC;IAC3E,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACnC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SACnC,OAAO,CAAC,GAAG,CAAC,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;YAClC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;gBAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,gBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAC9E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CACvC,IAAI,EACJ,IAAI,IAAI,CAAC,gBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACzC,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- export declare function parseNamespace(solution: string, type: string): string;
1
+ export declare function parseNamespace(solution: string, type: string): string;
@@ -1,19 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseNamespace = void 0;
4
- const type_1 = require("./type");
5
- function parseNamespace(solution, type) {
6
- const parseType = (0, type_1.createTypeParser)(type_1.removeGenerics);
7
- let namespace = parseType(type)[0].split('.').slice(0, -1).join('.');
8
- if (solution === namespace)
9
- return '';
10
- solution.split('.').reduceRight((acc, part) => {
11
- acc = `${part}\\.${acc}`;
12
- const regex = new RegExp(`^${acc}(Controllers\\.)?`);
13
- namespace = namespace.replace(regex, '');
14
- return acc;
15
- }, '');
16
- return namespace;
17
- }
18
- exports.parseNamespace = parseNamespace;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseNamespace = parseNamespace;
4
+ const type_1 = require("./type");
5
+ function parseNamespace(solution, type) {
6
+ const parseType = (0, type_1.createTypeParser)(type_1.removeGenerics);
7
+ let namespace = parseType(type)[0].split('.').slice(0, -1).join('.');
8
+ if (solution === namespace)
9
+ return '';
10
+ solution.split('.').reduceRight((acc, part) => {
11
+ acc = `${part}\\.${acc}`;
12
+ const regex = new RegExp(`^${acc}(Controllers\\.)?`);
13
+ namespace = namespace.replace(regex, '');
14
+ return acc;
15
+ }, '');
16
+ return namespace;
17
+ }
19
18
  //# sourceMappingURL=namespace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../../packages/schematics/src/utils/namespace.ts"],"names":[],"mappings":";;;AAAA,iCAA0D;AAE1D,SAAgB,cAAc,CAAC,QAAgB,EAAE,IAAY;IAC3D,MAAM,SAAS,GAAG,IAAA,uBAAgB,EAAC,qBAAc,CAAC,CAAC;IACnD,IAAI,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAErE,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAEtC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAC5C,GAAG,GAAG,GAAG,IAAI,MAAM,GAAG,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,mBAAmB,CAAC,CAAC;QACrD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,SAAS,CAAC;AACnB,CAAC;AAdD,wCAcC"}
1
+ {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../../packages/schematics/src/utils/namespace.ts"],"names":[],"mappings":";;AAEA,wCAcC;AAhBD,iCAA0D;AAE1D,SAAgB,cAAc,CAAC,QAAgB,EAAE,IAAY;IAC3D,MAAM,SAAS,GAAG,IAAA,uBAAgB,EAAC,qBAAc,CAAC,CAAC;IACnD,IAAI,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAErE,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAEtC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAC5C,GAAG,GAAG,GAAG,IAAI,MAAM,GAAG,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,mBAAmB,CAAC,CAAC;QACrD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,46 +1,46 @@
1
- import { Tree, UpdateRecorder } from '@angular-devkit/schematics';
2
- import * as ts from 'typescript';
3
- import { Path } from '@angular-devkit/core';
4
- /**
5
- * Checks whether a specific import or provider exists in the specified metadata
6
- * array (`imports`, `providers`, etc.) of the `NgModule` decorator in the AppModule.
7
- *
8
- * This function locates the AppModule file of the given Angular project,
9
- * parses its AST, and inspects the specified metadata array to determine
10
- * if it includes an element matching the provided string (e.g., `CommonModule`, `HttpClientModule`).
11
- *
12
- * @param host - The virtual file system tree used by Angular schematics.
13
- * @param projectName - The name of the Angular project.
14
- * @param metadataFn - The name (string) to match against the elements of the metadata array.
15
- * @param metadataName - The metadata field to search in (e.g., 'imports', 'providers'). Defaults to 'imports'.
16
- * @returns A promise that resolves to `true` if the metadata function is found, or `false` otherwise.
17
- * @throws SchematicsException if the AppModule file or expected metadata is not found or malformed.
18
- */
19
- export declare const hasImportInNgModule: (host: Tree, projectName: string, metadataFn: string, metadataName?: string) => Promise<boolean>;
20
- /**
21
- * Attempts to locate the path of the `AppRoutingModule` file that is imported
22
- * within the root AppModule file of an Angular application.
23
- *
24
- * This function reads the AppModule file (resolved from the main file path),
25
- * parses its AST, and searches for an import declaration that imports
26
- * `AppRoutingModule`. Once found, it resolves the import path to a normalized
27
- * file path relative to the workspace root.
28
- *
29
- * @param tree - The virtual file system tree used by Angular schematics.
30
- * @param mainFilePath - The path to the main entry file of the Angular application (typically `main.ts`).
31
- * @returns A normalized workspace-relative path to the AppRoutingModule file if found, or `null` otherwise.
32
- * @throws If the route file path is resolved but the file does not exist in the tree.
33
- */
34
- export declare function findAppRoutesModulePath(tree: Tree, mainFilePath: string): Promise<Path | null>;
35
- /**
36
- * Cleans up empty or invalid expressions (e.g., extra commas) from the `imports` and `providers`
37
- * arrays in the NgModule decorator of an Angular module file.
38
- *
39
- * This function parses the source file's AST, locates the `NgModule` decorator, and processes
40
- * the `imports` and `providers` metadata fields. If these fields contain array literals with
41
- * empty slots (such as trailing or double commas), they are removed and the array is rewritten.
42
- *
43
- * @param source - The TypeScript source file containing the Angular module.
44
- * @param recorder - The recorder used to apply changes to the source file.
45
- */
46
- export declare function cleanEmptyExprFromModule(source: ts.SourceFile, recorder: UpdateRecorder): void;
1
+ import { Tree, UpdateRecorder } from '@angular-devkit/schematics';
2
+ import * as ts from 'typescript';
3
+ import { Path } from '@angular-devkit/core';
4
+ /**
5
+ * Checks whether a specific import or provider exists in the specified metadata
6
+ * array (`imports`, `providers`, etc.) of the `NgModule` decorator in the AppModule.
7
+ *
8
+ * This function locates the AppModule file of the given Angular project,
9
+ * parses its AST, and inspects the specified metadata array to determine
10
+ * if it includes an element matching the provided string (e.g., `CommonModule`, `HttpClientModule`).
11
+ *
12
+ * @param host - The virtual file system tree used by Angular schematics.
13
+ * @param projectName - The name of the Angular project.
14
+ * @param metadataFn - The name (string) to match against the elements of the metadata array.
15
+ * @param metadataName - The metadata field to search in (e.g., 'imports', 'providers'). Defaults to 'imports'.
16
+ * @returns A promise that resolves to `true` if the metadata function is found, or `false` otherwise.
17
+ * @throws SchematicsException if the AppModule file or expected metadata is not found or malformed.
18
+ */
19
+ export declare const hasImportInNgModule: (host: Tree, projectName: string, metadataFn: string, metadataName?: string) => Promise<boolean>;
20
+ /**
21
+ * Attempts to locate the path of the `AppRoutingModule` file that is imported
22
+ * within the root AppModule file of an Angular application.
23
+ *
24
+ * This function reads the AppModule file (resolved from the main file path),
25
+ * parses its AST, and searches for an import declaration that imports
26
+ * `AppRoutingModule`. Once found, it resolves the import path to a normalized
27
+ * file path relative to the workspace root.
28
+ *
29
+ * @param tree - The virtual file system tree used by Angular schematics.
30
+ * @param mainFilePath - The path to the main entry file of the Angular application (typically `main.ts`).
31
+ * @returns A normalized workspace-relative path to the AppRoutingModule file if found, or `null` otherwise.
32
+ * @throws If the route file path is resolved but the file does not exist in the tree.
33
+ */
34
+ export declare function findAppRoutesModulePath(tree: Tree, mainFilePath: string): Promise<Path | null>;
35
+ /**
36
+ * Cleans up empty or invalid expressions (e.g., extra commas) from the `imports` and `providers`
37
+ * arrays in the NgModule decorator of an Angular module file.
38
+ *
39
+ * This function parses the source file's AST, locates the `NgModule` decorator, and processes
40
+ * the `imports` and `providers` metadata fields. If these fields contain array literals with
41
+ * empty slots (such as trailing or double commas), they are removed and the array is rewritten.
42
+ *
43
+ * @param source - The TypeScript source file containing the Angular module.
44
+ * @param recorder - The recorder used to apply changes to the source file.
45
+ */
46
+ export declare function cleanEmptyExprFromModule(source: ts.SourceFile, recorder: UpdateRecorder): void;