@rxap/open-api 16.0.0-dev.3 → 16.0.0-dev.4

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 (58) hide show
  1. package/CHANGELOG.md +643 -0
  2. package/README.md +8 -33
  3. package/esm2022/index.mjs +1 -1
  4. package/esm2022/lib/error.mjs +1 -1
  5. package/esm2022/lib/open-api-config.service.mjs +23 -24
  6. package/esm2022/lib/open-api-http-response.error.mjs +7 -7
  7. package/esm2022/lib/open-api.meta-data.mjs +1 -1
  8. package/esm2022/lib/open-api.mjs +1 -1
  9. package/esm2022/lib/schema-validation.mixin.mjs +21 -13
  10. package/esm2022/lib/tokens.mjs +1 -1
  11. package/esm2022/lib/utilities.mjs +1 -1
  12. package/esm2022/remote-method/index.mjs +4 -0
  13. package/esm2022/remote-method/lib/error.mjs +1 -1
  14. package/esm2022/remote-method/lib/open-api-remote-method.loader.mjs +7 -8
  15. package/esm2022/remote-method/lib/open-api.remote-method.mjs +67 -54
  16. package/esm2022/remote-method/rxap-open-api-remote-method.mjs +2 -2
  17. package/esm2022/rxap-open-api.mjs +1 -1
  18. package/fesm2022/rxap-open-api-remote-method.mjs +65 -51
  19. package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
  20. package/fesm2022/rxap-open-api.mjs +42 -33
  21. package/fesm2022/rxap-open-api.mjs.map +1 -1
  22. package/lib/open-api-config.service.d.ts +6 -6
  23. package/lib/open-api-http-response.error.d.ts +1 -1
  24. package/lib/schema-validation.mixin.d.ts +2 -2
  25. package/package.json +45 -52
  26. package/remote-method/index.d.ts +3 -5
  27. package/remote-method/lib/open-api.remote-method.d.ts +5 -6
  28. package/LICENSE +0 -21
  29. package/collection.json +0 -15
  30. package/esm2022/remote-method/public_api.mjs +0 -4
  31. package/migration.json +0 -4
  32. package/remote-method/public_api.d.ts +0 -3
  33. package/src/schematics/ng-add/index.d.ts +0 -2
  34. package/src/schematics/ng-add/index.js +0 -8
  35. package/src/schematics/ng-add/index.js.map +0 -1
  36. package/src/schematics/ng-add/schema.json +0 -7
  37. package/src/schematics/open-api/coerce-open-api-project.d.ts +0 -5
  38. package/src/schematics/open-api/coerce-open-api-project.js +0 -53
  39. package/src/schematics/open-api/coerce-open-api-project.js.map +0 -1
  40. package/src/schematics/open-api/const.d.ts +0 -4
  41. package/src/schematics/open-api/const.js +0 -8
  42. package/src/schematics/open-api/const.js.map +0 -1
  43. package/src/schematics/open-api/create-directive.d.ts +0 -2
  44. package/src/schematics/open-api/create-directive.js +0 -308
  45. package/src/schematics/open-api/create-directive.js.map +0 -1
  46. package/src/schematics/open-api/generate-openapi-provider.d.ts +0 -3
  47. package/src/schematics/open-api/generate-openapi-provider.js +0 -41
  48. package/src/schematics/open-api/generate-openapi-provider.js.map +0 -1
  49. package/src/schematics/open-api/generate-remote-method.d.ts +0 -3
  50. package/src/schematics/open-api/generate-remote-method.js +0 -173
  51. package/src/schematics/open-api/generate-remote-method.js.map +0 -1
  52. package/src/schematics/open-api/index.d.ts +0 -3
  53. package/src/schematics/open-api/index.js +0 -93
  54. package/src/schematics/open-api/index.js.map +0 -1
  55. package/src/schematics/open-api/options.d.ts +0 -14
  56. package/src/schematics/open-api/options.js +0 -3
  57. package/src/schematics/open-api/options.js.map +0 -1
  58. package/src/schematics/open-api/schema.json +0 -116
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "open-api-ng-add",
4
- "type": "object",
5
- "properties": {},
6
- "required": []
7
- }
@@ -1,5 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- /**
3
- * @deprecated use function from the @rxap/schematics-utilities package
4
- */
5
- export declare function CoerceOpenApiProject(project: string, prefix: string, directory?: string): Rule;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CoerceOpenApiProject = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
6
- /**
7
- * @deprecated use function from the @rxap/schematics-utilities package
8
- */
9
- function CoerceOpenApiProject(project, prefix, directory) {
10
- return (host) => {
11
- const angularJson = (0, schematics_utilities_1.GetAngularJson)(host);
12
- const projectName = `${directory ? directory.split('/').join('-') + '-' : ''}${project}`;
13
- if (!angularJson.projects.hasOwnProperty(projectName)) {
14
- const defaultProject = angularJson.projects[angularJson.defaultProject];
15
- const defaultProjectPrefix = prefix !== null && prefix !== void 0 ? prefix : defaultProject.prefix;
16
- return (0, schematics_1.chain)([
17
- (0, schematics_1.externalSchematic)('@nx/angular', 'library', {
18
- name: project,
19
- importPath: `@${defaultProjectPrefix}/${projectName}`,
20
- prefix,
21
- directory,
22
- }),
23
- (tree) => {
24
- var _a, _b, _c, _d;
25
- const baseTsconfig = JSON.parse((_b = (_a = tree.read('/tsconfig.base.json')) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '{}');
26
- const paths = (_d = (_c = baseTsconfig === null || baseTsconfig === void 0 ? void 0 : baseTsconfig.compilerOptions) === null || _c === void 0 ? void 0 : _c.paths) !== null && _d !== void 0 ? _d : {};
27
- if (Object.keys(paths).length) {
28
- for (const key of Object.keys(paths)) {
29
- if (directory) {
30
- if (key.match(new RegExp(`\/${directory.split('/').join('-')}-${project}$`))) {
31
- delete paths[key];
32
- paths[key + '/*'] = [
33
- `libs/${directory}/${project}/src/lib/*`,
34
- ];
35
- }
36
- }
37
- else {
38
- if (key.match(new RegExp(`\/${project}$`))) {
39
- delete paths[key];
40
- paths[key + '/*'] = [`libs/${project}/src/lib/*`];
41
- }
42
- }
43
- }
44
- tree.overwrite('/tsconfig.base.json', JSON.stringify(baseTsconfig, undefined, 2));
45
- }
46
- },
47
- ]);
48
- }
49
- return (0, schematics_1.noop)();
50
- };
51
- }
52
- exports.CoerceOpenApiProject = CoerceOpenApiProject;
53
- //# sourceMappingURL=coerce-open-api-project.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coerce-open-api-project.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/coerce-open-api-project.ts"],"names":[],"mappings":";;;AAAA,2DAMoC;AACpC,qEAAuE;AAEvE;;GAEG;AACH,SAAgB,oBAAoB,CAClC,OAAe,EACf,MAAc,EACd,SAAkB;IAElB,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,WAAW,GAAG,IAAA,qCAAc,EAAC,IAAI,CAAQ,CAAC;QAEhD,MAAM,WAAW,GAAG,GAClB,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EACrD,GAAG,OAAO,EAAE,CAAC;QAEb,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YACrD,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;YACxE,MAAM,oBAAoB,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,cAAc,CAAC,MAAM,CAAC;YAC7D,OAAO,IAAA,kBAAK,EAAC;gBACX,IAAA,8BAAiB,EAAC,aAAa,EAAE,SAAS,EAAE;oBAC1C,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,IAAI,oBAAoB,IAAI,WAAW,EAAE;oBACrD,MAAM;oBACN,SAAS;iBACV,CAAC;gBACF,CAAC,IAAI,EAAE,EAAE;;oBACP,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAC7B,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,0CAAE,QAAQ,EAAE,mCAAI,IAAI,CACrD,CAAC;oBAEF,MAAM,KAAK,GAAG,MAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,eAAe,0CAAE,KAAK,mCAAI,EAAE,CAAC;oBAEzD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;wBAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;4BACpC,IAAI,SAAS,EAAE;gCACb,IACE,GAAG,CAAC,KAAK,CACP,IAAI,MAAM,CACR,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAClD,CACF,EACD;oCACA,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;oCAClB,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG;wCAClB,QAAQ,SAAS,IAAI,OAAO,YAAY;qCACzC,CAAC;iCACH;6BACF;iCAAM;gCACL,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE;oCAC1C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;oCAClB,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,OAAO,YAAY,CAAC,CAAC;iCACnD;6BACF;yBACF;wBAED,IAAI,CAAC,SAAS,CACZ,qBAAqB,EACrB,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC,CAC3C,CAAC;qBACH;gBACH,CAAC;aACF,CAAC,CAAC;SACJ;QAED,OAAO,IAAA,iBAAI,GAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AA/DD,oDA+DC"}
@@ -1,4 +0,0 @@
1
- export declare const DATA_SOURCE_BASE_PATH = "data-sources";
2
- export declare const DATA_SOURCE_FILE_SUFFIX = "data-source";
3
- export declare const REMOTE_METHOD_BASE_PATH = "remote-methods";
4
- export declare const REMOTE_METHOD_FILE_SUFFIX = "remote-method";
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REMOTE_METHOD_FILE_SUFFIX = exports.REMOTE_METHOD_BASE_PATH = exports.DATA_SOURCE_FILE_SUFFIX = exports.DATA_SOURCE_BASE_PATH = void 0;
4
- exports.DATA_SOURCE_BASE_PATH = 'data-sources';
5
- exports.DATA_SOURCE_FILE_SUFFIX = 'data-source';
6
- exports.REMOTE_METHOD_BASE_PATH = 'remote-methods';
7
- exports.REMOTE_METHOD_FILE_SUFFIX = 'remote-method';
8
- //# sourceMappingURL=const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAO,cAAc,CAAC;AAC3C,QAAA,uBAAuB,GAAK,aAAa,CAAC;AAC1C,QAAA,uBAAuB,GAAK,gBAAgB,CAAC;AAC7C,QAAA,yBAAyB,GAAG,eAAe,CAAC"}
@@ -1,2 +0,0 @@
1
- import { CreateDirectiveOptions } from './options';
2
- export declare function CreateDirective({ filePath, sourceFile, name, prefix, parametersType, returnType, template, collection, withoutParameters }: CreateDirectiveOptions): void;
@@ -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,GAAG,CAAC,CAAC,CAAC;IAE7D,MAAM,gBAAgB,GACd,UAAU,CAAC,QAAQ,CA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B,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/schematics/open-api/generate-openapi-provider.ts"],"names":[],"mappings":";;;AAAA,uCAGkB;AAClB,+BAA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 -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