@rxap/schematics-open-api 16.0.0-dev.1 → 16.0.0-dev.11

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 (84) hide show
  1. package/CHANGELOG.md +105 -188
  2. package/{LICENSE → LICENSE.md} +3 -12
  3. package/README.md +7 -6
  4. package/collection.json +9 -0
  5. package/package.json +56 -31
  6. package/src/index.d.ts +3 -4
  7. package/src/index.js +3 -6
  8. package/src/index.js.map +1 -1
  9. package/src/lib/clear-operation.js +2 -6
  10. package/src/lib/clear-operation.js.map +1 -1
  11. package/src/lib/config.js.map +1 -1
  12. package/src/lib/generate-components.d.ts +1 -1
  13. package/src/lib/generate-components.js +12 -14
  14. package/src/lib/generate-components.js.map +1 -1
  15. package/src/lib/generate-index-exports.js +1 -1
  16. package/src/lib/generate-index-exports.js.map +1 -1
  17. package/src/lib/generate-operation.d.ts +1 -1
  18. package/src/lib/generate-operation.js +16 -21
  19. package/src/lib/generate-operation.js.map +1 -1
  20. package/src/lib/generate-parameters.d.ts +1 -1
  21. package/src/lib/generate-parameters.js +52 -51
  22. package/src/lib/generate-parameters.js.map +1 -1
  23. package/src/lib/generate-request-body.d.ts +1 -1
  24. package/src/lib/generate-request-body.js +15 -14
  25. package/src/lib/generate-request-body.js.map +1 -1
  26. package/src/lib/generate-response.d.ts +1 -1
  27. package/src/lib/generate-response.js +15 -14
  28. package/src/lib/generate-response.js.map +1 -1
  29. package/src/lib/load-open-api-config.js.map +1 -1
  30. package/src/lib/types.d.ts +1 -1
  31. package/src/lib/types.js.map +1 -1
  32. package/src/lib/utilities/any-schema-object.js +1 -1
  33. package/src/lib/utilities/any-schema-object.js.map +1 -1
  34. package/src/lib/utilities/get-parameter-type.js.map +1 -1
  35. package/src/lib/utilities/get-reqeust-body.js +2 -2
  36. package/src/lib/utilities/get-reqeust-body.js.map +1 -1
  37. package/src/lib/utilities/get-request-body-type.js.map +1 -1
  38. package/src/lib/utilities/get-response-type.js.map +1 -1
  39. package/src/lib/utilities/get-response.js +5 -6
  40. package/src/lib/utilities/get-response.js.map +1 -1
  41. package/src/lib/utilities/has-operation-paramters.js.map +1 -1
  42. package/src/lib/utilities/has-operation-request-body.js.map +1 -1
  43. package/src/lib/utilities/http-request.js +3 -1
  44. package/src/lib/utilities/http-request.js.map +1 -1
  45. package/src/lib/utilities/ignore-operation.js.map +1 -1
  46. package/src/lib/utilities/is-collection-response.js.map +1 -1
  47. package/src/lib/utilities/is-http-method.js.map +1 -1
  48. package/src/lib/utilities/is-open-api-schema-from-path.js +2 -1
  49. package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
  50. package/src/lib/utilities/is-operation-object.js +1 -1
  51. package/src/lib/utilities/is-operation-object.js.map +1 -1
  52. package/src/lib/utilities/is-reference-object.js +1 -1
  53. package/src/lib/utilities/is-reference-object.js.map +1 -1
  54. package/src/lib/utilities/is-without-parameters.js.map +1 -1
  55. package/src/schematics/generate/const.d.ts +5 -0
  56. package/src/schematics/generate/const.js +9 -0
  57. package/src/schematics/generate/const.js.map +1 -0
  58. package/src/schematics/generate/create-directive.d.ts +2 -0
  59. package/src/schematics/generate/create-directive.js +293 -0
  60. package/src/schematics/generate/create-directive.js.map +1 -0
  61. package/src/schematics/generate/generate-data-source.d.ts +2 -0
  62. package/src/schematics/generate/generate-data-source.js +74 -0
  63. package/src/schematics/generate/generate-data-source.js.map +1 -0
  64. package/src/schematics/generate/generate-openapi-provider.d.ts +3 -0
  65. package/src/schematics/generate/generate-openapi-provider.js +41 -0
  66. package/src/schematics/generate/generate-openapi-provider.js.map +1 -0
  67. package/src/schematics/generate/generate-operation-command.d.ts +3 -0
  68. package/src/schematics/generate/generate-operation-command.js +119 -0
  69. package/src/schematics/generate/generate-operation-command.js.map +1 -0
  70. package/src/schematics/generate/generate-remote-method.d.ts +3 -0
  71. package/src/schematics/generate/generate-remote-method.js +173 -0
  72. package/src/schematics/generate/generate-remote-method.js.map +1 -0
  73. package/src/schematics/generate/index.d.ts +3 -0
  74. package/src/schematics/generate/index.js +112 -0
  75. package/src/schematics/generate/index.js.map +1 -0
  76. package/src/schematics/generate/options.d.ts +14 -0
  77. package/src/schematics/generate/options.js +3 -0
  78. package/src/schematics/generate/options.js.map +1 -0
  79. package/src/schematics/generate/schema.d.ts +25 -0
  80. package/src/schematics/generate/schema.json +132 -0
  81. package/migration.json +0 -4
  82. package/src/lib/coerce-open-api-project.d.ts +0 -2
  83. package/src/lib/coerce-open-api-project.js +0 -48
  84. package/src/lib/coerce-open-api-project.js.map +0 -1
@@ -0,0 +1,132 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "open-api",
4
+ "type": "object",
5
+ "description": "",
6
+ "properties": {},
7
+ "oneOf": [
8
+ {
9
+ "properties": {
10
+ "path": {
11
+ "type": "string",
12
+ "description": "The path to the openapi config",
13
+ "format": "path"
14
+ },
15
+ "project": {
16
+ "type": "string",
17
+ "description": "The target project where the data sources and remote methods should be generated.",
18
+ "default": "open-api"
19
+ },
20
+ "directory": {
21
+ "type": "string",
22
+ "description": "A directory where the library is placed."
23
+ },
24
+ "prefix": {
25
+ "type": "string"
26
+ },
27
+ "transport": {
28
+ "type": "string",
29
+ "enum": [
30
+ "amplify"
31
+ ]
32
+ },
33
+ "export": {
34
+ "type": "boolean",
35
+ "description": "If true the index.ts of the select project will replaced with export statement for each generate file",
36
+ "default": false
37
+ },
38
+ "inline": {
39
+ "type": "boolean",
40
+ "default": true
41
+ },
42
+ "skipRemoteMethod": {
43
+ "type": "boolean",
44
+ "default": false
45
+ },
46
+ "skipDataSource": {
47
+ "type": "boolean",
48
+ "default": false
49
+ },
50
+ "skipProvider": {
51
+ "type": "boolean",
52
+ "default": false
53
+ },
54
+ "skipDirectives": {
55
+ "type": "boolean",
56
+ "default": false
57
+ },
58
+ "skipCommand": {
59
+ "type": "boolean",
60
+ "default": false
61
+ },
62
+ "serverId": {
63
+ "type": "string"
64
+ }
65
+ },
66
+ "required": [
67
+ "path"
68
+ ]
69
+ },
70
+ {
71
+ "properties": {
72
+ "url": {
73
+ "type": "string",
74
+ "description": "The url to the openapi config"
75
+ },
76
+ "project": {
77
+ "type": "string",
78
+ "description": "The target project where the data sources and remote methods should be generated.",
79
+ "default": "open-api"
80
+ },
81
+ "directory": {
82
+ "type": "string",
83
+ "description": "A directory where the library is placed."
84
+ },
85
+ "prefix": {
86
+ "type": "string"
87
+ },
88
+ "transport": {
89
+ "type": "string",
90
+ "enum": [
91
+ "amplify"
92
+ ]
93
+ },
94
+ "export": {
95
+ "type": "boolean",
96
+ "description": "If true the index.ts of the select project will replaced with export statement for each generate file",
97
+ "default": false
98
+ },
99
+ "skipCommand": {
100
+ "type": "boolean",
101
+ "default": false
102
+ },
103
+ "skipDataSource": {
104
+ "type": "boolean",
105
+ "default": false
106
+ },
107
+ "inline": {
108
+ "type": "boolean",
109
+ "default": true
110
+ },
111
+ "skipRemoteMethod": {
112
+ "type": "boolean",
113
+ "default": false
114
+ },
115
+ "skipProvider": {
116
+ "type": "boolean",
117
+ "default": false
118
+ },
119
+ "skipDirectives": {
120
+ "type": "boolean",
121
+ "default": false
122
+ },
123
+ "serverId": {
124
+ "type": "string"
125
+ }
126
+ },
127
+ "required": [
128
+ "url"
129
+ ]
130
+ }
131
+ ]
132
+ }
package/migration.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "schematics": {},
3
- "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json"
4
- }
@@ -1,2 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- export declare function CoerceOpenApiProject(project: string, prefix: string, directory?: string): Rule;
@@ -1,48 +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
- function CoerceOpenApiProject(project, prefix, directory) {
7
- return (host) => {
8
- const angularJson = (0, schematics_utilities_1.GetAngularJson)(host);
9
- const projectName = `${directory ? directory.split('/').join('-') + '-' : ''}${project}`;
10
- if (!angularJson.projects.hasOwnProperty(projectName)) {
11
- const defaultProject = angularJson.projects[angularJson.defaultProject];
12
- const defaultProjectPrefix = prefix !== null && prefix !== void 0 ? prefix : defaultProject.prefix;
13
- return (0, schematics_1.chain)([
14
- (0, schematics_1.externalSchematic)('@nrwl/angular', 'library', {
15
- name: project,
16
- importPath: `@${defaultProjectPrefix}/${projectName}`,
17
- prefix,
18
- directory,
19
- }),
20
- (tree) => {
21
- var _a, _b, _c, _d;
22
- const baseTsconfig = JSON.parse((_b = (_a = tree.read('/tsconfig.base.json')) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '{}');
23
- 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 : {};
24
- if (Object.keys(paths).length) {
25
- for (const key of Object.keys(paths)) {
26
- if (directory) {
27
- if (key.match(new RegExp(`\/${directory.split('/').join('-')}-${project}$`))) {
28
- delete paths[key];
29
- paths[key + '/*'] = [`libs/${directory}/${project}/src/lib/*`];
30
- }
31
- }
32
- else {
33
- if (key.match(new RegExp(`\/${project}$`))) {
34
- delete paths[key];
35
- paths[key + '/*'] = [`libs/${project}/src/lib/*`];
36
- }
37
- }
38
- }
39
- tree.overwrite('/tsconfig.base.json', JSON.stringify(baseTsconfig, undefined, 2));
40
- }
41
- },
42
- ]);
43
- }
44
- return (0, schematics_1.noop)();
45
- };
46
- }
47
- exports.CoerceOpenApiProject = CoerceOpenApiProject;
48
- //# 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/lib/coerce-open-api-project.ts"],"names":[],"mappings":";;;AAAA,2DAAwF;AACxF,qEAA4D;AAE5D,SAAgB,oBAAoB,CAAC,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