@rxap/open-api 16.0.0-dev.2 → 16.0.0-dev.20

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 (89) hide show
  1. package/CHANGELOG.md +738 -0
  2. package/LICENSE +621 -21
  3. package/LICENSE.md +621 -0
  4. package/README.md +8 -33
  5. package/data-source/index.d.ts +5 -0
  6. package/data-source/lib/error.d.ts +4 -0
  7. package/data-source/lib/open-api-data-source.loader.d.ts +12 -0
  8. package/data-source/lib/open-api.data-source.d.ts +40 -0
  9. package/data-source/table/index.d.ts +4 -0
  10. package/data-source/table/lib/error.d.ts +4 -0
  11. package/data-source/table/lib/open-api-table.data-source.d.ts +29 -0
  12. package/data-source/table/lib/to-open-api-table-data-source.pipe.d.ts +17 -0
  13. package/data-source/table/lib/tokens.d.ts +2 -0
  14. package/esm2022/data-source/index.mjs +6 -0
  15. package/esm2022/data-source/lib/error.mjs +8 -0
  16. package/esm2022/data-source/lib/open-api-data-source.loader.mjs +36 -0
  17. package/esm2022/data-source/lib/open-api.data-source.mjs +154 -0
  18. package/esm2022/data-source/rxap-open-api-data-source.mjs +5 -0
  19. package/esm2022/data-source/table/index.mjs +5 -0
  20. package/esm2022/data-source/table/lib/error.mjs +8 -0
  21. package/esm2022/data-source/table/lib/open-api-table.data-source.mjs +131 -0
  22. package/esm2022/data-source/table/lib/to-open-api-table-data-source.pipe.mjs +29 -0
  23. package/esm2022/data-source/table/lib/tokens.mjs +3 -0
  24. package/esm2022/data-source/table/rxap-open-api-data-source-table.mjs +5 -0
  25. package/esm2022/index.mjs +2 -1
  26. package/esm2022/lib/error.mjs +1 -1
  27. package/esm2022/lib/open-api-config.service.mjs +41 -33
  28. package/esm2022/lib/open-api-http-response.error.mjs +7 -7
  29. package/esm2022/lib/open-api-init.mjs +27 -0
  30. package/esm2022/lib/open-api.meta-data.mjs +1 -1
  31. package/esm2022/lib/open-api.mjs +1 -1
  32. package/esm2022/lib/schema-validation.mixin.mjs +31 -16
  33. package/esm2022/lib/tokens.mjs +9 -3
  34. package/esm2022/lib/utilities.mjs +1 -1
  35. package/esm2022/remote-method/index.mjs +5 -0
  36. package/esm2022/remote-method/lib/error.mjs +1 -1
  37. package/esm2022/remote-method/lib/get-page-adapter.factory.mjs +60 -0
  38. package/esm2022/remote-method/lib/open-api-remote-method.loader.mjs +7 -8
  39. package/esm2022/remote-method/lib/open-api.remote-method.mjs +67 -54
  40. package/esm2022/remote-method/rxap-open-api-remote-method.mjs +2 -2
  41. package/esm2022/rxap-open-api.mjs +1 -1
  42. package/fesm2022/rxap-open-api-data-source-table.mjs +172 -0
  43. package/fesm2022/rxap-open-api-data-source-table.mjs.map +1 -0
  44. package/fesm2022/rxap-open-api-data-source.mjs +198 -0
  45. package/fesm2022/rxap-open-api-data-source.mjs.map +1 -0
  46. package/fesm2022/rxap-open-api-remote-method.mjs +126 -53
  47. package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
  48. package/fesm2022/rxap-open-api.mjs +107 -50
  49. package/fesm2022/rxap-open-api.mjs.map +1 -1
  50. package/index.d.ts +1 -0
  51. package/lib/open-api-config.service.d.ts +9 -7
  52. package/lib/open-api-http-response.error.d.ts +1 -1
  53. package/lib/open-api-init.d.ts +6 -0
  54. package/lib/schema-validation.mixin.d.ts +4 -4
  55. package/package.json +80 -56
  56. package/remote-method/index.d.ts +4 -5
  57. package/remote-method/lib/get-page-adapter.factory.d.ts +29 -0
  58. package/remote-method/lib/open-api.remote-method.d.ts +5 -6
  59. package/theme.css +1 -0
  60. package/collection.json +0 -15
  61. package/esm2022/remote-method/public_api.mjs +0 -4
  62. package/migration.json +0 -4
  63. package/remote-method/public_api.d.ts +0 -3
  64. package/src/schematics/ng-add/index.d.ts +0 -2
  65. package/src/schematics/ng-add/index.js +0 -8
  66. package/src/schematics/ng-add/index.js.map +0 -1
  67. package/src/schematics/ng-add/schema.json +0 -7
  68. package/src/schematics/open-api/coerce-open-api-project.d.ts +0 -5
  69. package/src/schematics/open-api/coerce-open-api-project.js +0 -53
  70. package/src/schematics/open-api/coerce-open-api-project.js.map +0 -1
  71. package/src/schematics/open-api/const.d.ts +0 -4
  72. package/src/schematics/open-api/const.js +0 -8
  73. package/src/schematics/open-api/const.js.map +0 -1
  74. package/src/schematics/open-api/create-directive.d.ts +0 -2
  75. package/src/schematics/open-api/create-directive.js +0 -308
  76. package/src/schematics/open-api/create-directive.js.map +0 -1
  77. package/src/schematics/open-api/generate-openapi-provider.d.ts +0 -3
  78. package/src/schematics/open-api/generate-openapi-provider.js +0 -41
  79. package/src/schematics/open-api/generate-openapi-provider.js.map +0 -1
  80. package/src/schematics/open-api/generate-remote-method.d.ts +0 -3
  81. package/src/schematics/open-api/generate-remote-method.js +0 -173
  82. package/src/schematics/open-api/generate-remote-method.js.map +0 -1
  83. package/src/schematics/open-api/index.d.ts +0 -3
  84. package/src/schematics/open-api/index.js +0 -93
  85. package/src/schematics/open-api/index.js.map +0 -1
  86. package/src/schematics/open-api/options.d.ts +0 -14
  87. package/src/schematics/open-api/options.js +0 -3
  88. package/src/schematics/open-api/options.js.map +0 -1
  89. package/src/schematics/open-api/schema.json +0 -116
@@ -1,308 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreateDirective = void 0;
4
- const ts_morph_1 = require("ts-morph");
5
- const core_1 = require("@angular-devkit/core");
6
- function AssertImportSpecifierStructureArray(obj) {
7
- if (!obj || !Array.isArray(obj)) {
8
- throw new Error('Should be a array of OptionalKind<ImportSpecifierStructure>');
9
- }
10
- }
11
- const { classify, camelize } = core_1.strings;
12
- function CreateDirective({ filePath, sourceFile, name, prefix, parametersType, returnType, template, collection, withoutParameters }) {
13
- const remoteMethodName = classify([name, 'remote-method'].join('-'));
14
- if (!sourceFile.getClass(remoteMethodName)) {
15
- console.warn(`A remote method class with the name '${remoteMethodName}' is not declared in the file '${filePath}'.`);
16
- return;
17
- }
18
- const directiveNameParts = [remoteMethodName];
19
- if (template) {
20
- directiveNameParts.push('template');
21
- }
22
- if (collection) {
23
- directiveNameParts.push('collection');
24
- }
25
- directiveNameParts.push('directive');
26
- const directiveName = classify(directiveNameParts.join('-'));
27
- const classDeclaration = sourceFile.getClass(directiveName);
28
- if (classDeclaration) {
29
- console.warn(`A class with name '${directiveName}' already exists in the file '${filePath}'!`);
30
- return;
31
- }
32
- // region build selector
33
- const selectorFragments = [prefix, name];
34
- if (collection) {
35
- selectorFragments.push('collection');
36
- }
37
- selectorFragments.push('remote-method');
38
- const selector = camelize(selectorFragments.join('-'));
39
- // endregion
40
- const ctorsParameters = [
41
- {
42
- name: 'remoteMethodLoader',
43
- type: 'RemoteMethodLoader',
44
- decorators: [
45
- {
46
- name: 'Inject',
47
- arguments: ['RemoteMethodLoader']
48
- }
49
- ]
50
- },
51
- {
52
- name: 'injector',
53
- type: 'Injector',
54
- decorators: [
55
- {
56
- name: 'Inject',
57
- arguments: ['INJECTOR']
58
- }
59
- ]
60
- },
61
- {
62
- name: 'remoteMethod',
63
- type: remoteMethodName,
64
- decorators: [
65
- {
66
- name: 'Inject',
67
- arguments: [remoteMethodName]
68
- }
69
- ]
70
- }
71
- ];
72
- let ctorsSupperCallParameters = ['remoteMethodLoader', 'injector'].join(', ');
73
- let directiveClassExtends;
74
- const remoteMethodDirectiveImportStructure = {
75
- namedImports: [],
76
- moduleSpecifier: '@rxap/remote-method/directive'
77
- };
78
- const remoteMethodImportStructure = {
79
- namedImports: [{ name: 'RemoteMethodLoader' }],
80
- moduleSpecifier: '@rxap/remote-method'
81
- };
82
- const angularCoreImportStructure = {
83
- namedImports: [
84
- { name: 'Inject' },
85
- { name: 'Directive' },
86
- { name: 'NgModule' },
87
- { name: 'INJECTOR' },
88
- { name: 'Injector' }
89
- ],
90
- moduleSpecifier: '@angular/core'
91
- };
92
- const directiveClassProperties = [];
93
- const directiveClassSetAccessors = [];
94
- const ctorsStatements = [];
95
- const importStructure = [
96
- angularCoreImportStructure,
97
- remoteMethodImportStructure,
98
- remoteMethodDirectiveImportStructure
99
- ];
100
- AssertImportSpecifierStructureArray(angularCoreImportStructure.namedImports);
101
- AssertImportSpecifierStructureArray(remoteMethodImportStructure.namedImports);
102
- AssertImportSpecifierStructureArray(remoteMethodDirectiveImportStructure.namedImports);
103
- if (template) {
104
- if (parametersType === 'void' || withoutParameters) {
105
- ctorsStatements.push('this.withoutParameters = true;');
106
- }
107
- angularCoreImportStructure.namedImports.push({ name: 'TemplateRef' });
108
- ctorsSupperCallParameters = [
109
- 'template',
110
- 'remoteMethodLoader',
111
- 'injector',
112
- 'viewContainerRef',
113
- 'cdr'
114
- ].join(', ');
115
- directiveClassProperties.push({
116
- name: 'parameters',
117
- hasQuestionToken: true,
118
- scope: ts_morph_1.Scope.Public,
119
- type: parametersType,
120
- leadingTrivia: '// tslint:disable-next-line:no-input-rename',
121
- hasOverrideKeyword: true,
122
- decorators: [
123
- {
124
- name: 'Input',
125
- arguments: [
126
- (writer) => writer.quote(camelize([selector, 'Parameters'].join('-')))
127
- ]
128
- }
129
- ]
130
- });
131
- if (collection) {
132
- ctorsSupperCallParameters = [
133
- ctorsSupperCallParameters,
134
- 'differs',
135
- 'zone'
136
- ].join(', ');
137
- directiveClassExtends = `RemoteMethodTemplateCollectionDirective<${returnType}, ${parametersType}>`;
138
- remoteMethodDirectiveImportStructure.namedImports.push({
139
- name: 'RemoteMethodTemplateCollectionDirective'
140
- });
141
- ctorsParameters.push({
142
- name: 'template',
143
- type: `TemplateRef<RemoteMethodTemplateCollectionDirectiveContext<${returnType}>>`,
144
- decorators: [
145
- {
146
- name: 'Inject',
147
- arguments: ['TemplateRef']
148
- }
149
- ]
150
- }, {
151
- name: 'differs',
152
- type: 'IterableDiffers',
153
- decorators: [
154
- {
155
- name: 'Inject',
156
- arguments: ['IterableDiffers']
157
- }
158
- ]
159
- }, {
160
- name: 'zone',
161
- type: 'NgZone',
162
- decorators: [
163
- {
164
- name: 'Inject',
165
- arguments: ['NgZone']
166
- }
167
- ]
168
- });
169
- remoteMethodDirectiveImportStructure.namedImports.push({ name: 'RemoteMethodTemplateCollectionDirectiveContext' }, { name: 'RemoteMethodTemplateCollectionDirectiveErrorContext' });
170
- directiveClassProperties.push({
171
- name: 'errorTemplate',
172
- hasQuestionToken: true,
173
- hasOverrideKeyword: true,
174
- leadingTrivia: '// tslint:disable-next-line:no-input-rename',
175
- scope: ts_morph_1.Scope.Public,
176
- type: `TemplateRef<RemoteMethodTemplateCollectionDirectiveErrorContext>`,
177
- decorators: [
178
- {
179
- name: 'Input',
180
- arguments: [
181
- (writer) => writer.quote(camelize([selector, 'Error'].join('-')))
182
- ]
183
- }
184
- ]
185
- }, {
186
- name: 'emptyTemplate',
187
- leadingTrivia: '// tslint:disable-next-line:no-input-rename',
188
- hasQuestionToken: true,
189
- scope: ts_morph_1.Scope.Public,
190
- type: 'TemplateRef<void>',
191
- decorators: [
192
- {
193
- name: 'Input',
194
- arguments: [
195
- (writer) => writer.quote(camelize([selector, 'Empty'].join('-')))
196
- ]
197
- }
198
- ]
199
- });
200
- angularCoreImportStructure.namedImports.push({ name: 'IterableDiffers' }, { name: 'NgZone' });
201
- }
202
- else {
203
- directiveClassExtends = `RemoteMethodTemplateDirective<${returnType}, ${parametersType}>`;
204
- remoteMethodDirectiveImportStructure.namedImports.push({
205
- name: 'RemoteMethodTemplateDirective'
206
- });
207
- ctorsParameters.push({
208
- name: 'template',
209
- type: `TemplateRef<RemoteMethodTemplateDirectiveContext<${returnType}>>`,
210
- decorators: [
211
- {
212
- name: 'Inject',
213
- arguments: ['TemplateRef']
214
- }
215
- ]
216
- });
217
- remoteMethodDirectiveImportStructure.namedImports.push({ name: 'RemoteMethodTemplateDirectiveContext' }, { name: 'RemoteMethodTemplateDirectiveErrorContext' });
218
- directiveClassProperties.push({
219
- name: 'errorTemplate',
220
- hasQuestionToken: true,
221
- hasOverrideKeyword: true,
222
- type: `TemplateRef<RemoteMethodTemplateDirectiveErrorContext>`,
223
- leadingTrivia: '// tslint:disable-next-line:no-input-rename',
224
- scope: ts_morph_1.Scope.Public,
225
- decorators: [
226
- {
227
- name: 'Input',
228
- arguments: [
229
- (writer) => writer.quote(camelize([selector, 'Error'].join('-')))
230
- ]
231
- }
232
- ]
233
- });
234
- }
235
- ctorsParameters.push({
236
- name: 'viewContainerRef',
237
- type: 'ViewContainerRef',
238
- decorators: [
239
- {
240
- name: 'Inject',
241
- arguments: ['ViewContainerRef']
242
- }
243
- ]
244
- }, {
245
- name: 'cdr',
246
- type: 'ChangeDetectorRef',
247
- decorators: [
248
- {
249
- name: 'Inject',
250
- arguments: ['ChangeDetectorRef']
251
- }
252
- ]
253
- });
254
- angularCoreImportStructure.namedImports.push({ name: 'ChangeDetectorRef' }, { name: 'ViewContainerRef' }, { name: 'Input' });
255
- }
256
- else {
257
- directiveClassExtends = `RemoteMethodDirective<${returnType}, ${parametersType}>`;
258
- remoteMethodDirectiveImportStructure.namedImports.push({
259
- name: 'RemoteMethodDirective'
260
- });
261
- }
262
- const directiveClassStructure = {
263
- name: directiveName,
264
- decorators: [
265
- {
266
- name: 'Directive',
267
- arguments: ts_morph_1.Writers.object({
268
- selector: (writer) => writer.quote(`[${selector}]`),
269
- exportAs: (writer) => writer.quote(selector)
270
- })
271
- }
272
- ],
273
- extends: directiveClassExtends,
274
- ctors: [
275
- {
276
- parameters: ctorsParameters,
277
- statements: [
278
- `super(${ctorsSupperCallParameters});`,
279
- 'this.remoteMethodOrIdOrToken = remoteMethod;',
280
- ...ctorsStatements
281
- ]
282
- }
283
- ],
284
- setAccessors: directiveClassSetAccessors,
285
- properties: directiveClassProperties,
286
- isExported: true
287
- };
288
- const directiveModuleClassStructure = {
289
- name: directiveName + 'Module',
290
- decorators: [
291
- {
292
- name: 'NgModule',
293
- arguments: [
294
- ts_morph_1.Writers.object({
295
- declarations: `[ ${directiveName} ]`,
296
- exports: `[ ${directiveName} ]`
297
- })
298
- ]
299
- }
300
- ],
301
- isExported: true
302
- };
303
- sourceFile.addClass(directiveClassStructure);
304
- sourceFile.addClass(directiveModuleClassStructure);
305
- sourceFile.addImportDeclarations(importStructure);
306
- }
307
- exports.CreateDirective = CreateDirective;
308
- //# sourceMappingURL=create-directive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-directive.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/create-directive.ts"],"names":[],"mappings":";;;AAAA,uCAWkB;AAClB,+CAA+C;AAG/C,SAAS,mCAAmC,CAC1C,GAAQ;IAER,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC/B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;KACH;AACH,CAAC;AAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAO,CAAC;AAEvC,SAAgB,eAAe,CAAC,EACE,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,EACM;IACvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,CAAE,IAAI,EAAE,eAAe,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAC1C,OAAO,CAAC,IAAI,CACV,wCAAwC,gBAAgB,kCAAkC,QAAQ,IAAI,CACvG,CAAC;QACF,OAAO;KACR;IAED,MAAM,kBAAkB,GAAG,CAAE,gBAAgB,CAAE,CAAC;IAEhD,IAAI,QAAQ,EAAE;QACZ,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACrC;IAED,IAAI,UAAU,EAAE;QACd,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACvC;IAED,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAErC,MAAM,aAAa,GAAG,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAA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AAU,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;IACnD,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;AACpD,CAAC;AA5XD,0CA4XC"}
@@ -1,3 +0,0 @@
1
- import { Project } from 'ts-morph';
2
- import { OpenApiSchema } from './schema';
3
- export declare function GenerateOpenapiProvider(project: Project, operatorIdList: string[], options: OpenApiSchema): void;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GenerateOpenapiProvider = void 0;
4
- const ts_morph_1 = require("ts-morph");
5
- const path_1 = require("path");
6
- const core_1 = require("@angular-devkit/core");
7
- const const_1 = require("./const");
8
- const { dasherize, classify } = core_1.strings;
9
- function GenerateOpenapiProvider(project, operatorIdList, options) {
10
- const sourceFile = project.createSourceFile('open-api-providers.ts');
11
- const providerList = [];
12
- sourceFile.addImportDeclaration({
13
- moduleSpecifier: '@angular/core',
14
- namedImports: ['Provider']
15
- });
16
- for (const operationId of operatorIdList) {
17
- if (!options.skipRemoteMethod) {
18
- const name = [operationId, const_1.REMOTE_METHOD_FILE_SUFFIX].join('.');
19
- const moduleSpecifier = './' + (0, path_1.join)(const_1.REMOTE_METHOD_BASE_PATH, dasherize(name));
20
- const className = classify(name.replace(/\./g, '-'));
21
- sourceFile.addImportDeclaration({
22
- moduleSpecifier,
23
- namedImports: [className]
24
- });
25
- providerList.push(className);
26
- }
27
- }
28
- sourceFile.addVariableStatement({
29
- declarationKind: ts_morph_1.VariableDeclarationKind.Const,
30
- isExported: true,
31
- declarations: [
32
- {
33
- name: 'OPEN_API_PROVIDERS',
34
- type: 'Provider[]',
35
- initializer: `[${providerList.join(', ')}]`,
36
- }
37
- ]
38
- });
39
- }
40
- exports.GenerateOpenapiProvider = GenerateOpenapiProvider;
41
- //# sourceMappingURL=generate-openapi-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-openapi-provider.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src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,GAAG;aAC5C;SACF;KACF,CAAC,CAAC;AAEL,CAAC;AA5CD,0DA4CC"}
@@ -1,3 +0,0 @@
1
- import { GenerateParameter } from '@rxap/schematics-open-api';
2
- import { OpenApiSchemaBase } from './schema';
3
- export declare function GenerateRemoteMethod(parameter: GenerateParameter<OpenApiSchemaBase>): Promise<void>;
@@ -1,173 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GenerateRemoteMethod = void 0;
4
- const tslib_1 = require("tslib");
5
- const schematics_open_api_1 = require("@rxap/schematics-open-api");
6
- const path_1 = require("path");
7
- const ts_morph_1 = require("ts-morph");
8
- const core_1 = require("@angular-devkit/core");
9
- const create_directive_1 = require("./create-directive");
10
- const const_1 = require("./const");
11
- const { dasherize, classify } = core_1.strings;
12
- function GenerateRemoteMethod(parameter) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- const operationId = parameter.operationId;
15
- const name = [operationId, const_1.REMOTE_METHOD_FILE_SUFFIX].join('.');
16
- const fileName = (0, path_1.join)(const_1.REMOTE_METHOD_BASE_PATH, dasherize(name) + '.ts');
17
- const sourceFile = parameter.project.createSourceFile(fileName);
18
- const importStructures = [
19
- {
20
- moduleSpecifier: '@rxap/open-api/remote-method',
21
- namedImports: [
22
- { name: 'RxapOpenApiRemoteMethod' },
23
- { name: 'OpenApiRemoteMethodParameter' }
24
- ]
25
- },
26
- {
27
- moduleSpecifier: '@angular/core',
28
- namedImports: [{ name: 'Injectable' }]
29
- }
30
- ];
31
- switch (parameter.options.transport) {
32
- case 'amplify':
33
- importStructures.push({
34
- moduleSpecifier: '@rxap/amplify-open-api',
35
- namedImports: [{ name: 'AmplifyOpenApiRemoteMethod' }]
36
- });
37
- break;
38
- default:
39
- importStructures.push({
40
- moduleSpecifier: '@rxap/open-api/remote-method',
41
- namedImports: [{ name: 'OpenApiRemoteMethod' }]
42
- });
43
- break;
44
- }
45
- const responseType = (0, schematics_open_api_1.GetResponseType)(parameter);
46
- const parameterType = (0, schematics_open_api_1.GetParameterType)(parameter);
47
- const requestBodyType = (0, schematics_open_api_1.GetRequestBodyType)(parameter);
48
- if (!['void', 'any'].includes(responseType)) {
49
- importStructures.push({
50
- moduleSpecifier: `../responses/${dasherize(responseType.replace(/Response$/, ''))}.response`,
51
- namedImports: [{ name: responseType }]
52
- });
53
- }
54
- if (!['void', 'any'].includes(parameterType)) {
55
- importStructures.push({
56
- moduleSpecifier: `../parameters/${dasherize(parameterType.replace(/Parameter$/, ''))}.parameter`,
57
- namedImports: [{ name: parameterType }]
58
- });
59
- }
60
- if (!['void', 'any'].includes(requestBodyType)) {
61
- importStructures.push({
62
- moduleSpecifier: `../request-bodies/${dasherize(requestBodyType.replace(/RequestBody$/, ''))}.request-body`,
63
- namedImports: [{ name: requestBodyType }]
64
- });
65
- }
66
- const callMethodParameters = [];
67
- const withoutParametersAndRequestBody = parameterType === 'void' && requestBodyType === 'void';
68
- if (!withoutParametersAndRequestBody) {
69
- callMethodParameters.push({
70
- name: 'parameters',
71
- type: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`
72
- });
73
- }
74
- const classStructure = {
75
- name: classify(name.replace(/\./g, '-')),
76
- decorators: [
77
- {
78
- name: 'Injectable',
79
- arguments: ts_morph_1.Writers.object({
80
- providedIn: (writer) => writer.quote('root')
81
- })
82
- },
83
- {
84
- name: 'RxapOpenApiRemoteMethod',
85
- arguments: parameter.options.inline ? (writer) => ts_morph_1.Writers.object({
86
- serverId: parameter.options.serverId ? w => w.quote(parameter.options.serverId) : 'undefined',
87
- operationId: w => w.quote(parameter.operationId),
88
- operation: w => w.quote(JSON.stringify((0, schematics_open_api_1.GenerateParameterToOperationObjectWithMetadata)(parameter)).replace(/[\n\r\\]+/g, ''))
89
- })(writer) : w => w.quote(operationId)
90
- }
91
- ],
92
- methods: [
93
- {
94
- name: 'call',
95
- parameters: callMethodParameters,
96
- scope: ts_morph_1.Scope.Public,
97
- returnType: `Promise<${responseType}>`,
98
- hasOverrideKeyword: true,
99
- statements: [
100
- `return super.call(${withoutParametersAndRequestBody ? '' : 'parameters'});`
101
- ]
102
- }
103
- ],
104
- extends: (writer) => {
105
- switch (parameter.options.transport) {
106
- case 'amplify':
107
- writer.write('AmplifyOpenApiRemoteMethod');
108
- break;
109
- default:
110
- writer.write('OpenApiRemoteMethod');
111
- break;
112
- }
113
- writer.write('<');
114
- writer.write(responseType);
115
- writer.write(', ');
116
- writer.write(parameterType);
117
- writer.write(', ');
118
- writer.write(requestBodyType);
119
- writer.write('>');
120
- },
121
- isExported: true
122
- };
123
- sourceFile.addClass(classStructure);
124
- const withoutParameters = (0, schematics_open_api_1.IsWithoutParameters)(parameter);
125
- if (!parameter.options.skipDirectives) {
126
- if ((0, schematics_open_api_1.IsCollectionResponse)(parameter)) {
127
- importStructures.push({
128
- moduleSpecifier: '@rxap/utilities',
129
- namedImports: [{ name: 'ArrayElement' }]
130
- });
131
- (0, create_directive_1.CreateDirective)({
132
- filePath: fileName,
133
- name: operationId,
134
- prefix: parameter.options.prefix,
135
- parametersType: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`,
136
- returnType: `ArrayElement<${responseType}>`,
137
- template: true,
138
- collection: true,
139
- sourceFile,
140
- withoutParameters
141
- });
142
- }
143
- (0, create_directive_1.CreateDirective)({
144
- filePath: fileName,
145
- name: operationId,
146
- prefix: parameter.options.prefix,
147
- parametersType: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`,
148
- returnType: responseType,
149
- template: true,
150
- collection: false,
151
- sourceFile,
152
- withoutParameters
153
- });
154
- (0, create_directive_1.CreateDirective)({
155
- filePath: fileName,
156
- name: operationId,
157
- prefix: parameter.options.prefix,
158
- parametersType: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`,
159
- returnType: responseType,
160
- template: false,
161
- collection: false,
162
- sourceFile,
163
- withoutParameters
164
- });
165
- }
166
- sourceFile.addImportDeclarations(importStructures);
167
- sourceFile.organizeImports({
168
- ensureNewLineAtEndOfFile: true
169
- });
170
- });
171
- }
172
- exports.GenerateRemoteMethod = GenerateRemoteMethod;
173
- //# sourceMappingURL=generate-remote-method.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-remote-method.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/generate-remote-method.ts"],"names":[],"mappings":";;;;AAAA,mEAQmC;AAEnC,+BAA4B;AAC5B,uCAOkB;AAClB,+CAA+C;AAC/C,yDAAqD;AACrD,mCAGiB;AAEjB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,cAAO,CAAC;AAExC,SAAsB,oBAAoB,CACxC,SAA+C;;QAE/C,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,IAAI,GAAO,CAAE,WAAW,EAAE,iCAAyB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtE,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,+BAAuB,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAExE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEhE,MAAM,gBAAgB,GAAoD;YACxE;gBACE,eAAe,EAAE,8BAA8B;gBAC/C,YAAY,EAAK;oBACf,EAAE,IAAI,EAAE,yBAAyB,EAAE;oBACnC,EAAE,IAAI,EAAE,8BAA8B,EAAE;iBACzC;aACF;YACD;gBACE,eAAe,EAAE,eAAe;gBAChC,YAAY,EAAK,CAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAE;aAC5C;SACF,CAAC;QAEF,QAAQ,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE;YACnC,KAAK,SAAS;gBACZ,gBAAgB,CAAC,IAAI,CAAC;oBACpB,eAAe,EAAE,wBAAwB;oBACzC,YAAY,EAAK,CAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,CAAE;iBAC5D,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C,eAAe,CAAC;YACzB,wBAAwB,EAAE,IAAI;SAC/B,CAAC,CAAC;IACL,CAAC;CAAA;AA1LD,oDA0LC"}
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { OpenApiSchema } from './schema';
3
- export default function (options: OpenApiSchema): Rule;
@@ -1,93 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const path_1 = require("path");
6
- const ts_morph_1 = require("ts-morph");
7
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
8
- const schematics_open_api_1 = require("@rxap/schematics-open-api");
9
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
10
- const generate_remote_method_1 = require("./generate-remote-method");
11
- const const_1 = require("./const");
12
- const coerce_open_api_project_1 = require("./coerce-open-api-project");
13
- const generate_openapi_provider_1 = require("./generate-openapi-provider");
14
- function GetOperationIdList(openapi) {
15
- const operationIdList = [];
16
- for (const [_, methods] of Object.entries(openapi.paths)) {
17
- if (methods) {
18
- for (const method of Object.keys(methods).filter(schematics_open_api_1.IsHttpMethod)) {
19
- const operation = methods[method];
20
- if ((0, schematics_open_api_1.IsOperationObject)(operation)) {
21
- if ((0, schematics_open_api_1.IgnoreOperation)(['hidden'])(operation)) {
22
- console.log(`Ignore operation '${operation.operationId}'`);
23
- }
24
- else {
25
- if ((0, schematics_open_api_1.HasOperationId)(operation)) {
26
- operationIdList.push(operation.operationId);
27
- }
28
- }
29
- }
30
- }
31
- }
32
- }
33
- return operationIdList;
34
- }
35
- function default_1(options) {
36
- return (host) => tslib_1.__awaiter(this, void 0, void 0, function* () {
37
- var _a, _b;
38
- const openapi = yield (0, schematics_open_api_1.LoadOpenApiConfig)(host, options);
39
- const project = new ts_morph_1.Project({
40
- manipulationSettings: {
41
- indentationText: ts_morph_1.IndentationText.TwoSpaces,
42
- quoteKind: ts_morph_1.QuoteKind.Single,
43
- useTrailingCommas: true
44
- },
45
- useInMemoryFileSystem: true
46
- });
47
- if (!options.project) {
48
- options.project = 'open-api';
49
- }
50
- if (options.directory) {
51
- options.directory = options.directory.split('/').map(item => (0, schematics_utilities_1.dasherize)(item)).join('/');
52
- }
53
- const projectName = `${options.directory ? options.directory.split('/').join('-') + '-' : ''}${options.project}`;
54
- const projectBasePath = (0, schematics_utilities_1.HasProject)(host, projectName) ? (0, schematics_utilities_1.GetProjectSourceRoot)(host, projectName) : `libs/${options.directory ? options.directory + '/' : ''}${options.project}/src`;
55
- const basePath = (0, path_1.join)(projectBasePath, 'lib');
56
- options.prefix = (_b = (_a = options.prefix) !== null && _a !== void 0 ? _a : ((0, schematics_utilities_1.HasProject)(host, projectName) ? (0, schematics_utilities_1.GetProjectPrefix)(host, projectName) : (0, schematics_utilities_1.GetDefaultPrefix)(host))) !== null && _b !== void 0 ? _b : 'rxap';
57
- if (!options.debug) {
58
- // TODO : reset the hack after the schematic execution is finished
59
- console.debug = function () { };
60
- }
61
- const generatorFunctionList = [];
62
- const clearPathList = [];
63
- if (!options.skipRemoteMethod) {
64
- generatorFunctionList.push(generate_remote_method_1.GenerateRemoteMethod);
65
- clearPathList.push(const_1.REMOTE_METHOD_BASE_PATH);
66
- }
67
- return (0, schematics_1.chain)([
68
- (0, schematics_open_api_1.ClearOperation)([
69
- schematics_open_api_1.COMPONENTS_BASE_PATH,
70
- schematics_open_api_1.PARAMETER_BASE_PATH,
71
- schematics_open_api_1.RESPONSE_BASE_PATH,
72
- schematics_open_api_1.REQUEST_BODY_BASE_PATH,
73
- ...clearPathList,
74
- ], basePath),
75
- (0, coerce_open_api_project_1.CoerceOpenApiProject)(options.project, options.prefix, options.directory),
76
- () => tslib_1.__awaiter(this, void 0, void 0, function* () { yield (0, schematics_open_api_1.GenerateOperation)(openapi, project, options, generatorFunctionList); }),
77
- () => options.skipProvider ? (0, schematics_1.noop)() : (0, generate_openapi_provider_1.GenerateOpenapiProvider)(project, GetOperationIdList(openapi), options),
78
- (0, schematics_ts_morph_1.ApplyTsMorphProject)(project, basePath),
79
- (0, schematics_ts_morph_1.FixMissingImports)(),
80
- (tree) => {
81
- const indexFile = (0, path_1.join)(projectBasePath, 'index.ts');
82
- if (options.export) {
83
- (0, schematics_utilities_1.CoerceFile)(tree, indexFile, (0, schematics_open_api_1.GenerateIndexExports)(project));
84
- }
85
- else {
86
- (0, schematics_utilities_1.CoerceFile)(tree, indexFile, 'export {};');
87
- }
88
- },
89
- ]);
90
- });
91
- }
92
- exports.default = default_1;
93
- //# sourceMappingURL=index.js.map