@rxap/schematics-open-api 16.0.0-dev.11 → 16.0.0-dev.13
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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/package.json +8 -8
- package/src/index.js +26 -29
- package/src/index.js.map +1 -1
- package/src/lib/clear-operation.js +5 -9
- package/src/lib/clear-operation.js.map +1 -1
- package/src/lib/config.js +7 -10
- package/src/lib/config.js.map +1 -1
- package/src/lib/generate-components.js +8 -9
- package/src/lib/generate-components.js.map +1 -1
- package/src/lib/generate-index-exports.js +3 -7
- package/src/lib/generate-index-exports.js.map +1 -1
- package/src/lib/generate-operation.js +24 -26
- package/src/lib/generate-operation.js.map +1 -1
- package/src/lib/generate-parameters.js +16 -18
- package/src/lib/generate-parameters.js.map +1 -1
- package/src/lib/generate-request-body.js +13 -14
- package/src/lib/generate-request-body.js.map +1 -1
- package/src/lib/generate-response.js +13 -14
- package/src/lib/generate-response.js.map +1 -1
- package/src/lib/load-open-api-config.js +16 -23
- package/src/lib/load-open-api-config.js.map +1 -1
- package/src/lib/types.js +3 -9
- package/src/lib/types.js.map +1 -1
- package/src/lib/utilities/any-schema-object.js +1 -5
- package/src/lib/utilities/any-schema-object.js.map +1 -1
- package/src/lib/utilities/get-parameter-type.js +4 -8
- package/src/lib/utilities/get-parameter-type.js.map +1 -1
- package/src/lib/utilities/get-reqeust-body.js +6 -10
- package/src/lib/utilities/get-reqeust-body.js.map +1 -1
- package/src/lib/utilities/get-request-body-type.js +8 -12
- package/src/lib/utilities/get-request-body-type.js.map +1 -1
- package/src/lib/utilities/get-response-type.js +8 -12
- package/src/lib/utilities/get-response-type.js.map +1 -1
- package/src/lib/utilities/get-response.js +3 -7
- package/src/lib/utilities/get-response.js.map +1 -1
- package/src/lib/utilities/has-operation-paramters.js +1 -5
- package/src/lib/utilities/has-operation-paramters.js.map +1 -1
- package/src/lib/utilities/has-operation-request-body.js +1 -5
- package/src/lib/utilities/has-operation-request-body.js.map +1 -1
- package/src/lib/utilities/http-request.js +3 -7
- package/src/lib/utilities/http-request.js.map +1 -1
- package/src/lib/utilities/ignore-operation.js +2 -7
- package/src/lib/utilities/ignore-operation.js.map +1 -1
- package/src/lib/utilities/is-collection-response.js +7 -11
- package/src/lib/utilities/is-collection-response.js.map +1 -1
- package/src/lib/utilities/is-http-method.js +1 -5
- package/src/lib/utilities/is-http-method.js.map +1 -1
- package/src/lib/utilities/is-open-api-schema-from-path.js +3 -7
- package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
- package/src/lib/utilities/is-operation-object.js +1 -5
- package/src/lib/utilities/is-operation-object.js.map +1 -1
- package/src/lib/utilities/is-reference-object.js +1 -5
- package/src/lib/utilities/is-reference-object.js.map +1 -1
- package/src/lib/utilities/is-without-parameters.js +1 -5
- package/src/lib/utilities/is-without-parameters.js.map +1 -1
- package/src/schematics/generate/const.js +5 -8
- package/src/schematics/generate/const.js.map +1 -1
- package/src/schematics/generate/create-directive.js +10 -14
- package/src/schematics/generate/create-directive.js.map +1 -1
- package/src/schematics/generate/generate-data-source.js +13 -17
- package/src/schematics/generate/generate-data-source.js.map +1 -1
- package/src/schematics/generate/generate-openapi-provider.js +9 -13
- package/src/schematics/generate/generate-openapi-provider.js.map +1 -1
- package/src/schematics/generate/generate-operation-command.js +105 -112
- package/src/schematics/generate/generate-operation-command.js.map +1 -1
- package/src/schematics/generate/generate-remote-method.js +27 -31
- package/src/schematics/generate/generate-remote-method.js.map +1 -1
- package/src/schematics/generate/index.js +41 -43
- package/src/schematics/generate/index.js.map +1 -1
- package/src/schematics/generate/options.js +1 -2
- package/src/schematics/generate/schema.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [16.0.0-dev.13](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@16.0.0-dev.12...@rxap/schematics-open-api@16.0.0-dev.13) (2023-08-16)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- change from commonjs to es2022 ([fd0f2ba](https://gitlab.com/rxap/packages/commit/fd0f2bae24eae7c854e96f630076cd5598c30be6))
|
|
11
|
+
|
|
12
|
+
# [16.0.0-dev.12](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@16.0.0-dev.11...@rxap/schematics-open-api@16.0.0-dev.12) (2023-08-06)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- set inline option to true if not defined ([b5b5614](https://gitlab.com/rxap/packages/commit/b5b5614f7ff89ceabab4f0e30f3ca173cbd4665c))
|
|
17
|
+
|
|
6
18
|
# [16.0.0-dev.11](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@16.0.0-dev.10...@rxap/schematics-open-api@16.0.0-dev.11) (2023-08-05)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -17,5 +17,5 @@ yarn add @rxap/schematics-open-api
|
|
|
17
17
|
```
|
|
18
18
|
**Install peer dependencies:**
|
|
19
19
|
```bash
|
|
20
|
-
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/json-schema-to-typescript@^16.0.0-dev.5 @rxap/schematics-ts-morph@^16.0.0-dev.
|
|
20
|
+
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/json-schema-to-typescript@^16.0.0-dev.5 @rxap/schematics-ts-morph@^16.0.0-dev.8 @rxap/schematics-utilities@^16.0.0-dev.7 @rxap/utilities@^16.0.0-dev.6 ts-morph@^18.0.0
|
|
21
21
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/schematics-open-api",
|
|
3
|
-
"version": "16.0.0-dev.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "16.0.0-dev.13",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@apidevtools/json-schema-ref-parser": "9.0.9",
|
|
7
7
|
"ignore": "^5.2.4",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"@angular-devkit/core": "^16.1.4",
|
|
15
15
|
"@angular-devkit/schematics": "^16.1.4",
|
|
16
16
|
"@rxap/json-schema-to-typescript": "^16.0.0-dev.5",
|
|
17
|
-
"@rxap/schematics-ts-morph": "^16.0.0-dev.
|
|
17
|
+
"@rxap/schematics-ts-morph": "^16.0.0-dev.8",
|
|
18
18
|
"@rxap/schematics-utilities": "^16.0.0-dev.7",
|
|
19
19
|
"@rxap/utilities": "^16.0.0-dev.6",
|
|
20
20
|
"ts-morph": "^18.0.0",
|
|
21
|
-
"@rxap/node-utilities": "1.1.0-dev.
|
|
22
|
-
"@rxap/workspace-ts-morph": "0.0
|
|
23
|
-
"@rxap/workspace-utilities": "0.1.0-dev.
|
|
21
|
+
"@rxap/node-utilities": "1.1.0-dev.2",
|
|
22
|
+
"@rxap/workspace-ts-morph": "0.1.0-dev.1",
|
|
23
|
+
"@rxap/workspace-utilities": "0.1.0-dev.4"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"package": "@rxap/schematics-ts-morph",
|
|
59
|
-
"version": "16.0.0-dev.
|
|
59
|
+
"version": "16.0.0-dev.8"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"package": "@rxap/schematics-utilities",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "bbab80e59acbe435a02e69c9fec022780cf4640d",
|
|
72
72
|
"main": "./src/index.js",
|
|
73
73
|
"types": "./src/index.d.ts"
|
|
74
74
|
}
|
package/src/index.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
tslib_1.__exportStar(require("./lib/utilities/is-operation-object"), exports);
|
|
28
|
-
tslib_1.__exportStar(require("./lib/utilities/is-reference-object"), exports);
|
|
29
|
-
tslib_1.__exportStar(require("./lib/utilities/is-without-parameters"), exports);
|
|
1
|
+
export * from './lib/clear-operation';
|
|
2
|
+
export * from './lib/config';
|
|
3
|
+
export * from './lib/generate-components';
|
|
4
|
+
export * from './lib/generate-index-exports';
|
|
5
|
+
export * from './lib/generate-operation';
|
|
6
|
+
export * from './lib/generate-parameters';
|
|
7
|
+
export * from './lib/generate-request-body';
|
|
8
|
+
export * from './lib/generate-response';
|
|
9
|
+
export * from './lib/load-open-api-config';
|
|
10
|
+
export * from './lib/types';
|
|
11
|
+
export * from './lib/utilities/any-schema-object';
|
|
12
|
+
export * from './lib/utilities/get-parameter-type';
|
|
13
|
+
export * from './lib/utilities/get-reqeust-body';
|
|
14
|
+
export * from './lib/utilities/get-request-body-type';
|
|
15
|
+
export * from './lib/utilities/get-response-type';
|
|
16
|
+
export * from './lib/utilities/get-response';
|
|
17
|
+
export * from './lib/utilities/has-operation-paramters';
|
|
18
|
+
export * from './lib/utilities/has-operation-request-body';
|
|
19
|
+
export * from './lib/utilities/http-request';
|
|
20
|
+
export * from './lib/utilities/ignore-operation';
|
|
21
|
+
export * from './lib/utilities/is-collection-response';
|
|
22
|
+
export * from './lib/utilities/is-http-method';
|
|
23
|
+
export * from './lib/utilities/is-open-api-schema-from-path';
|
|
24
|
+
export * from './lib/utilities/is-operation-object';
|
|
25
|
+
export * from './lib/utilities/is-reference-object';
|
|
26
|
+
export * from './lib/utilities/is-without-parameters';
|
|
30
27
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematic/open-api/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematic/open-api/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
function ClearOperation(pathList, basePath = '') {
|
|
1
|
+
import { DeleteDirectory } from '@rxap/schematics-utilities';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
export function ClearOperation(pathList, basePath = '') {
|
|
7
4
|
return tree => {
|
|
8
5
|
console.debug(`clear operation for base path '${basePath}' with pathList '${pathList}'`);
|
|
9
6
|
for (const path of pathList) {
|
|
10
|
-
const fullPath =
|
|
11
|
-
|
|
7
|
+
const fullPath = join(basePath, path);
|
|
8
|
+
DeleteDirectory(tree, tree.getDir(fullPath));
|
|
12
9
|
}
|
|
13
10
|
};
|
|
14
11
|
}
|
|
15
|
-
exports.ClearOperation = ClearOperation;
|
|
16
12
|
//# sourceMappingURL=clear-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/clear-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clear-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/clear-operation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,cAAc,CAC5B,QAAkB,EAClB,QAAQ,GAAG,EAAE;IAEb,OAAO,IAAI,CAAC,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,kCAAmC,QAAS,oBAAqB,QAAS,GAAG,CAAC,CAAC;QAC7F,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC9C;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/src/lib/config.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.RESPONSE_FILE_SUFFIX = 'response';
|
|
9
|
-
exports.REQUEST_BODY_FILE_SUFFIX = 'request-body';
|
|
10
|
-
exports.REQUEST_BODY_BASE_PATH = 'request-bodies';
|
|
1
|
+
export const COMPONENTS_BASE_PATH = 'components';
|
|
2
|
+
export const PARAMETER_BASE_PATH = 'parameters';
|
|
3
|
+
export const PARAMETER_FILE_SUFFIX = 'parameter';
|
|
4
|
+
export const RESPONSE_BASE_PATH = 'responses';
|
|
5
|
+
export const RESPONSE_FILE_SUFFIX = 'response';
|
|
6
|
+
export const REQUEST_BODY_FILE_SUFFIX = 'request-body';
|
|
7
|
+
export const REQUEST_BODY_BASE_PATH = 'request-bodies';
|
|
11
8
|
//# sourceMappingURL=config.js.map
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAChD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GenerateComponents = void 0;
|
|
4
|
-
const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
|
|
5
|
-
const config_1 = require("./config");
|
|
1
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
2
|
+
import { COMPONENTS_BASE_PATH } from './config';
|
|
6
3
|
function executeInterfaceBuild(components, project, schema, name) {
|
|
7
|
-
const generator = new
|
|
8
|
-
|
|
4
|
+
const generator = new TypescriptInterfaceGenerator({
|
|
5
|
+
...schema,
|
|
6
|
+
components,
|
|
7
|
+
}, {
|
|
8
|
+
basePath: COMPONENTS_BASE_PATH,
|
|
9
9
|
addImports: true,
|
|
10
10
|
}, project);
|
|
11
11
|
console.debug(`Generate component interface for: ${name}`);
|
|
@@ -16,12 +16,11 @@ function executeInterfaceBuild(components, project, schema, name) {
|
|
|
16
16
|
console.error(`Failed to generate response interface for: ${name}`, error.message);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function GenerateComponents(components, project) {
|
|
19
|
+
export function GenerateComponents(components, project) {
|
|
20
20
|
if (components.schemas) {
|
|
21
21
|
for (const [name, schema] of Object.entries(components.schemas)) {
|
|
22
22
|
executeInterfaceBuild(components, project, schema, name);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
exports.GenerateComponents = GenerateComponents;
|
|
27
26
|
//# sourceMappingURL=generate-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAI/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,SAAS,qBAAqB,CAC5B,UAAsC,EACtC,OAAgB,EAChB,MAAW,EACX,IAAY;IAGZ,MAAM,SAAS,GAAG,IAAI,4BAA4B,CAChD;QACE,GAAG,MAAM;QACT,UAAU;KACX,EACD;QACE,QAAQ,EAAE,oBAAoB;QAC9B,UAAU,EAAE,IAAI;KACjB,EACD,OAAO,CACR,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,qCAAsC,IAAK,EAAE,CAAC,CAAC;IAE7D,IAAI;QAEF,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAE3B;IAAC,OAAO,KAAU,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,8CAA+C,IAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;KACtF;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,UAAsC,EACtC,OAAgB;IAGhB,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,KAAK,MAAM,CAAE,IAAI,EAAE,MAAM,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACjE,qBAAqB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;SAC1D;KACF;AAEH,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GenerateIndexExports = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
function GenerateIndexExports(project) {
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
export function GenerateIndexExports(project) {
|
|
6
3
|
const exports = [];
|
|
7
4
|
for (const sourceFile of project.getSourceFiles()) {
|
|
8
5
|
sourceFile.getDirectoryPath();
|
|
9
|
-
exports.push(`export * from '.${
|
|
6
|
+
exports.push(`export * from '.${join('/lib', sourceFile.getDirectoryPath(), sourceFile.getBaseNameWithoutExtension())}';`);
|
|
10
7
|
}
|
|
11
8
|
return exports.join('\n');
|
|
12
9
|
}
|
|
13
|
-
exports.GenerateIndexExports = GenerateIndexExports;
|
|
14
10
|
//# sourceMappingURL=generate-index-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IAEnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE;QAEjD,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,mBAAoB,IAAI,CACnC,MAAM,EACN,UAAU,CAAC,gBAAgB,EAAE,EAC7B,UAAU,CAAC,2BAA2B,EAAE,CACxC,IAAI,CAAC,CAAC;KAET;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5B,CAAC"}
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const ignore_operation_1 = require("./utilities/ignore-operation");
|
|
10
|
-
const is_http_method_1 = require("./utilities/is-http-method");
|
|
11
|
-
const is_operation_object_1 = require("./utilities/is-operation-object");
|
|
1
|
+
import { GenerateComponents } from './generate-components';
|
|
2
|
+
import { GenerateParameters } from './generate-parameters';
|
|
3
|
+
import { GenerateRequestBody } from './generate-request-body';
|
|
4
|
+
import { GenerateResponse } from './generate-response';
|
|
5
|
+
import { HasOperationId, } from './types';
|
|
6
|
+
import { IgnoreOperation } from './utilities/ignore-operation';
|
|
7
|
+
import { IsHttpMethod } from './utilities/is-http-method';
|
|
8
|
+
import { IsOperationObject } from './utilities/is-operation-object';
|
|
12
9
|
function executeGenerator(project, options, path, method, generatorFunction, components, operation) {
|
|
13
10
|
try {
|
|
14
|
-
const parameters =
|
|
11
|
+
const parameters = {
|
|
12
|
+
...operation,
|
|
13
|
+
components,
|
|
15
14
|
method,
|
|
16
15
|
path,
|
|
17
16
|
project,
|
|
18
|
-
options
|
|
17
|
+
options,
|
|
18
|
+
};
|
|
19
19
|
generatorFunction(parameters);
|
|
20
20
|
}
|
|
21
21
|
catch (e) {
|
|
22
|
-
console.error(`Failed to generate [${generatorFunction
|
|
22
|
+
console.error(`Failed to generate [${generatorFunction?.name}] for operation: ${operation.operationId}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(0, generate_components_1.GenerateComponents)(components, project);
|
|
25
|
+
export function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
26
|
+
const components = openapi.components ?? openapi.definitions ?? {};
|
|
27
|
+
GenerateComponents(components, project);
|
|
29
28
|
for (const [path, methods] of Object.entries(openapi.paths)) {
|
|
30
29
|
if (methods) {
|
|
31
|
-
for (const method of Object.keys(methods).filter(
|
|
30
|
+
for (const method of Object.keys(methods).filter(IsHttpMethod)) {
|
|
32
31
|
const operation = methods[method];
|
|
33
|
-
if (
|
|
34
|
-
if (
|
|
32
|
+
if (IsOperationObject(operation)) {
|
|
33
|
+
if (IgnoreOperation(['hidden'])(operation)) {
|
|
35
34
|
console.log(`Ignore operation '${operation.operationId}'`);
|
|
36
35
|
}
|
|
37
36
|
else {
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
if (HasOperationId(operation)) {
|
|
38
|
+
GenerateParameters(operation, project, components);
|
|
39
|
+
GenerateRequestBody(operation, project, components);
|
|
40
|
+
GenerateResponse(operation, project, components);
|
|
42
41
|
for (const generatorFunction of generatorFunctionList) {
|
|
43
42
|
executeGenerator(project, options, path, method, generatorFunction, components, operation);
|
|
44
43
|
}
|
|
@@ -52,5 +51,4 @@ function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
exports.GenerateOperation = GenerateOperation;
|
|
56
54
|
//# sourceMappingURL=generate-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAGL,cAAc,GAGf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,SAAS,gBAAgB,CACvB,OAAgB,EAChB,OAAgB,EAChB,IAAY,EACZ,MAAc,EACd,iBAA6C,EAC7C,UAAsC,EACtC,SAA0B;IAE1B,IAAI;QACF,MAAM,UAAU,GAA+B;YAC7C,GAAG,SAAS;YACZ,UAAU;YACV,MAAM;YACN,IAAI;YACJ,OAAO;YACP,OAAO;SACR,CAAC;QACF,iBAAiB,CAAC,UAAU,CAAC,CAAC;KAC/B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK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6BAAM;4BACL,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;yBAC3D;qBAEF;iBAEF;aAEF;SAEF;KAEF;AAEH,CAAC"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const config_1 = require("./config");
|
|
6
|
-
const is_reference_object_1 = require("./utilities/is-reference-object");
|
|
7
|
-
function GenerateParameters(operation, project, components) {
|
|
8
|
-
var _a;
|
|
1
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
2
|
+
import { PARAMETER_BASE_PATH, PARAMETER_FILE_SUFFIX, } from './config';
|
|
3
|
+
import { IsReferenceObject } from './utilities/is-reference-object';
|
|
4
|
+
export function GenerateParameters(operation, project, components) {
|
|
9
5
|
if (operation.parameters && operation.parameters.length && operation.operationId) {
|
|
10
6
|
const operationId = operation.operationId;
|
|
11
7
|
const properties = {};
|
|
12
8
|
const required = [];
|
|
13
|
-
const parameters = operation.parameters.filter(param => !
|
|
14
|
-
for (const parameter of operation.parameters.filter(param =>
|
|
15
|
-
if (
|
|
9
|
+
const parameters = operation.parameters.filter(param => !IsReferenceObject(param) && param.in !== 'header');
|
|
10
|
+
for (const parameter of operation.parameters.filter(param => IsReferenceObject(param))) {
|
|
11
|
+
if (IsReferenceObject(parameter)) {
|
|
16
12
|
const ref = parameter.$ref;
|
|
17
13
|
const segments = ref.split('/');
|
|
18
14
|
const hashTag = segments.shift();
|
|
@@ -35,14 +31,14 @@ function GenerateParameters(operation, project, components) {
|
|
|
35
31
|
parameters.push(component[name]);
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
|
-
if (parameters.some(parameter =>
|
|
34
|
+
if (parameters.some(parameter => IsReferenceObject(parameter))) {
|
|
39
35
|
throw new Error('Reference object are not supported in the parameter definition!');
|
|
40
36
|
}
|
|
41
37
|
for (const parameter of parameters) {
|
|
42
|
-
if (
|
|
38
|
+
if (IsReferenceObject(parameter)) {
|
|
43
39
|
throw new Error('FATAL: Reference object are not supported in the parameter definition!');
|
|
44
40
|
}
|
|
45
|
-
properties[parameter.name] =
|
|
41
|
+
properties[parameter.name] = parameter.schema ?? { type: 'any' };
|
|
46
42
|
if (parameter.required) {
|
|
47
43
|
required.push(parameter.name);
|
|
48
44
|
}
|
|
@@ -52,9 +48,12 @@ function GenerateParameters(operation, project, components) {
|
|
|
52
48
|
properties: properties,
|
|
53
49
|
required,
|
|
54
50
|
};
|
|
55
|
-
const generator = new
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
const generator = new TypescriptInterfaceGenerator({
|
|
52
|
+
...parametersSchema,
|
|
53
|
+
components,
|
|
54
|
+
}, {
|
|
55
|
+
suffix: PARAMETER_FILE_SUFFIX,
|
|
56
|
+
basePath: PARAMETER_BASE_PATH,
|
|
58
57
|
addImports: true,
|
|
59
58
|
}, project);
|
|
60
59
|
console.debug(`Generate parameter interface for: ${operationId}`);
|
|
@@ -66,5 +65,4 @@ function GenerateParameters(operation, project, components) {
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
exports.GenerateParameters = GenerateParameters;
|
|
70
68
|
//# sourceMappingURL=generate-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,UAAU,kBAAkB,CAChC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IA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pE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,+CAAgD,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SAC9F;KAEF;AAEH,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function GenerateRequestBody(operation, project, components) {
|
|
9
|
-
const requestBodySchema = (0, get_reqeust_body_1.GetRequestBody)(operation);
|
|
10
|
-
if (requestBodySchema && !(0, any_schema_object_1.IsAnySchemaObject)(requestBodySchema) && operation.operationId) {
|
|
1
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
2
|
+
import { REQUEST_BODY_BASE_PATH, REQUEST_BODY_FILE_SUFFIX, } from './config';
|
|
3
|
+
import { IsAnySchemaObject } from './utilities/any-schema-object';
|
|
4
|
+
import { GetRequestBody } from './utilities/get-reqeust-body';
|
|
5
|
+
export function GenerateRequestBody(operation, project, components) {
|
|
6
|
+
const requestBodySchema = GetRequestBody(operation);
|
|
7
|
+
if (requestBodySchema && !IsAnySchemaObject(requestBodySchema) && operation.operationId) {
|
|
11
8
|
const operationId = operation.operationId;
|
|
12
|
-
const generator = new
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const generator = new TypescriptInterfaceGenerator({
|
|
10
|
+
...requestBodySchema,
|
|
11
|
+
components,
|
|
12
|
+
}, {
|
|
13
|
+
suffix: REQUEST_BODY_FILE_SUFFIX,
|
|
14
|
+
basePath: REQUEST_BODY_BASE_PATH,
|
|
15
15
|
addImports: true,
|
|
16
16
|
}, project);
|
|
17
17
|
console.debug(`Generate request body interface for: ${operationId}`);
|
|
@@ -23,5 +23,4 @@ function GenerateRequestBody(operation, project, components) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
exports.GenerateRequestBody = GenerateRequestBody;
|
|
27
26
|
//# sourceMappingURL=generate-request-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-request-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,UAAU,mBAAmB,CACjC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IAGtC,MAAM,iBAAiB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAEpD,IAAI,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE;QACvF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAI,4BAA4B,CAChD;YACE,GAAG,iBAAiB;YACpB,UAAU;SACX,EACD;YACE,MAAM,EAAE,wBAAwB;YAChC,QAAQ,EAAE,sBAAsB;YAChC,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,wCAAyC,WAAY,EAAE,CAAC,CAAC;QAEvE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,kDAAmD,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SACjG;KAEF;AAEH,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function GenerateResponse(operation, project, components) {
|
|
9
|
-
const response = (0, get_response_1.GetResponse)(operation);
|
|
10
|
-
if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response) && operation.operationId) {
|
|
1
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
2
|
+
import { RESPONSE_BASE_PATH, RESPONSE_FILE_SUFFIX, } from './config';
|
|
3
|
+
import { IsAnySchemaObject } from './utilities/any-schema-object';
|
|
4
|
+
import { GetResponse } from './utilities/get-response';
|
|
5
|
+
export function GenerateResponse(operation, project, components) {
|
|
6
|
+
const response = GetResponse(operation);
|
|
7
|
+
if (response && !IsAnySchemaObject(response) && operation.operationId) {
|
|
11
8
|
const operationId = operation.operationId;
|
|
12
|
-
const generator = new
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const generator = new TypescriptInterfaceGenerator({
|
|
10
|
+
...response,
|
|
11
|
+
components,
|
|
12
|
+
}, {
|
|
13
|
+
suffix: RESPONSE_FILE_SUFFIX,
|
|
14
|
+
basePath: RESPONSE_BASE_PATH,
|
|
15
15
|
addImports: true,
|
|
16
16
|
}, project);
|
|
17
17
|
console.debug(`Generate response interface for: ${operationId}`);
|
|
@@ -23,5 +23,4 @@ function GenerateResponse(operation, project, components) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
exports.GenerateResponse = GenerateResponse;
|
|
27
26
|
//# sourceMappingURL=generate-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAC9B,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IAGtC,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE;QACrE,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAI,4BAA4B,CAChD;YACE,GAAG,QAAQ;YACX,UAAU;SACX,EACD;YACE,MAAM,EAAE,oBAAoB;YAC5B,QAAQ,EAAE,kBAAkB;YAC5B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,oCAAqC,WAAY,EAAE,CAAC,CAAC;QAEnE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,8CAA+C,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SAC7F;KAEF;AAEH,CAAC"}
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
-
let openapi;
|
|
10
|
-
if ((0, is_open_api_schema_from_path_1.IsOpenApiSchemaFromPath)(options)) {
|
|
11
|
-
if (!host.exists(options.path)) {
|
|
12
|
-
throw new Error('Could not find openapi file.');
|
|
13
|
-
}
|
|
14
|
-
openapi = JSON.parse(host.read(options.path).toString('utf-8'));
|
|
1
|
+
import { IsOpenApiSchemaFromPath } from './utilities/is-open-api-schema-from-path';
|
|
2
|
+
import { HttpRequest } from './utilities/http-request';
|
|
3
|
+
export async function LoadOpenApiConfig(host, options) {
|
|
4
|
+
let openapi;
|
|
5
|
+
if (IsOpenApiSchemaFromPath(options)) {
|
|
6
|
+
if (!host.exists(options.path)) {
|
|
7
|
+
throw new Error('Could not find openapi file.');
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
9
|
+
openapi = JSON.parse(host.read(options.path).toString('utf-8'));
|
|
10
|
+
}
|
|
11
|
+
else if (options.url) {
|
|
12
|
+
openapi = await HttpRequest(options.url);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
throw new Error('Either the path or url must be defined');
|
|
16
|
+
}
|
|
17
|
+
return openapi;
|
|
24
18
|
}
|
|
25
|
-
exports.LoadOpenApiConfig = LoadOpenApiConfig;
|
|
26
19
|
//# sourceMappingURL=load-open-api-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAKvD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAU,EAAE,OAAsB;IACxE,IAAI,OAA2B,CAAC;IAChC,IAAI,uBAAuB,CAAC,OAAO,CAAC,EAAE;QAEpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACjD;QAED,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAElE;SAAM,IAAI,OAAO,CAAC,GAAG,EAAE;QAEtB,OAAO,GAAG,MAAM,WAAW,CAAqB,OAAO,CAAC,GAAG,CAAC,CAAC;KAE9D;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC3D;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|