@rxap/schematic-nestjs 0.0.2-dev.0
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 +8 -0
- package/GETSTARTED.md +0 -0
- package/GUIDES.md +0 -0
- package/README.md +21 -0
- package/collection.json +74 -0
- package/package.json +67 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -0
- package/src/schematics/crud/index.d.ts +3 -0
- package/src/schematics/crud/index.js +49 -0
- package/src/schematics/crud/index.js.map +1 -0
- package/src/schematics/crud/schema.d.ts +7 -0
- package/src/schematics/crud/schema.js +3 -0
- package/src/schematics/crud/schema.js.map +1 -0
- package/src/schematics/crud/schema.json +17 -0
- package/src/schematics/crud-init/index.d.ts +3 -0
- package/src/schematics/crud-init/index.js +14 -0
- package/src/schematics/crud-init/index.js.map +1 -0
- package/src/schematics/crud-init/schema.d.ts +4 -0
- package/src/schematics/crud-init/schema.js +3 -0
- package/src/schematics/crud-init/schema.js.map +1 -0
- package/src/schematics/crud-init/schema.json +18 -0
- package/src/schematics/crud-service/add-module-export.d.ts +4 -0
- package/src/schematics/crud-service/add-module-export.js +29 -0
- package/src/schematics/crud-service/add-module-export.js.map +1 -0
- package/src/schematics/crud-service/add-module-provider.d.ts +4 -0
- package/src/schematics/crud-service/add-module-provider.js +29 -0
- package/src/schematics/crud-service/add-module-provider.js.map +1 -0
- package/src/schematics/crud-service/coerce-class-method.d.ts +2 -0
- package/src/schematics/crud-service/coerce-class-method.js +10 -0
- package/src/schematics/crud-service/coerce-class-method.js.map +1 -0
- package/src/schematics/crud-service/coerce-class-property.d.ts +2 -0
- package/src/schematics/crud-service/coerce-class-property.js +10 -0
- package/src/schematics/crud-service/coerce-class-property.js.map +1 -0
- package/src/schematics/crud-service/coerce-collection-enum.d.ts +4 -0
- package/src/schematics/crud-service/coerce-collection-enum.js +29 -0
- package/src/schematics/crud-service/coerce-collection-enum.js.map +1 -0
- package/src/schematics/crud-service/coerce-module-class.d.ts +2 -0
- package/src/schematics/crud-service/coerce-module-class.js +32 -0
- package/src/schematics/crud-service/coerce-module-class.js.map +1 -0
- package/src/schematics/crud-service/coerce-source-file-rule.d.ts +11 -0
- package/src/schematics/crud-service/coerce-source-file-rule.js +29 -0
- package/src/schematics/crud-service/coerce-source-file-rule.js.map +1 -0
- package/src/schematics/crud-service/crud-class/create-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/create-method.js +69 -0
- package/src/schematics/crud-service/crud-class/create-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/delete-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/delete-method.js +46 -0
- package/src/schematics/crud-service/crud-class/delete-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/exists-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/exists-method.js +46 -0
- package/src/schematics/crud-service/crud-class/exists-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/find-in-group-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/find-in-group-method.js +37 -0
- package/src/schematics/crud-service/crud-class/find-in-group-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/find-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/find-method.js +46 -0
- package/src/schematics/crud-service/crud-class/find-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/get-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/get-method.js +52 -0
- package/src/schematics/crud-service/crud-class/get-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/update-field-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/update-field-method.js +68 -0
- package/src/schematics/crud-service/crud-class/update-field-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/update-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/update-method.js +59 -0
- package/src/schematics/crud-service/crud-class/update-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class.d.ts +3 -0
- package/src/schematics/crud-service/crud-class.js +125 -0
- package/src/schematics/crud-service/crud-class.js.map +1 -0
- package/src/schematics/crud-service/dto-class/create-dto-class.d.ts +3 -0
- package/src/schematics/crud-service/dto-class/create-dto-class.js +26 -0
- package/src/schematics/crud-service/dto-class/create-dto-class.js.map +1 -0
- package/src/schematics/crud-service/dto-class/dto-class.d.ts +3 -0
- package/src/schematics/crud-service/dto-class/dto-class.js +133 -0
- package/src/schematics/crud-service/dto-class/dto-class.js.map +1 -0
- package/src/schematics/crud-service/dto-class/update-dto-class.d.ts +3 -0
- package/src/schematics/crud-service/dto-class/update-dto-class.js +28 -0
- package/src/schematics/crud-service/dto-class/update-dto-class.js.map +1 -0
- package/src/schematics/crud-service/index.d.ts +3 -0
- package/src/schematics/crud-service/index.js +215 -0
- package/src/schematics/crud-service/index.js.map +1 -0
- package/src/schematics/crud-service/options.d.ts +11 -0
- package/src/schematics/crud-service/options.js +3 -0
- package/src/schematics/crud-service/options.js.map +1 -0
- package/src/schematics/crud-service/schema.d.ts +53 -0
- package/src/schematics/crud-service/schema.js +3 -0
- package/src/schematics/crud-service/schema.js.map +1 -0
- package/src/schematics/crud-service/schema.json +57 -0
- package/src/schematics/feature-microservice/index.d.ts +11 -0
- package/src/schematics/feature-microservice/index.js +65 -0
- package/src/schematics/feature-microservice/index.js.map +1 -0
- package/src/schematics/feature-microservice/schema.d.ts +15 -0
- package/src/schematics/feature-microservice/schema.json +69 -0
- package/src/schematics/frontend-microservice/index.d.ts +11 -0
- package/src/schematics/frontend-microservice/index.js +61 -0
- package/src/schematics/frontend-microservice/index.js.map +1 -0
- package/src/schematics/frontend-microservice/schema.d.ts +16 -0
- package/src/schematics/frontend-microservice/schema.json +75 -0
- package/src/schematics/health-indicator/add-health-endpoint.d.ts +2 -0
- package/src/schematics/health-indicator/add-health-endpoint.js +58 -0
- package/src/schematics/health-indicator/add-health-endpoint.js.map +1 -0
- package/src/schematics/health-indicator/add-health-indicator.d.ts +2 -0
- package/src/schematics/health-indicator/add-health-indicator.js +61 -0
- package/src/schematics/health-indicator/add-health-indicator.js.map +1 -0
- package/src/schematics/health-indicator/add-to-global-health-endpoint.d.ts +2 -0
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js +54 -0
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js.map +1 -0
- package/src/schematics/health-indicator/coerce-health-controller.d.ts +2 -0
- package/src/schematics/health-indicator/coerce-health-controller.js +25 -0
- package/src/schematics/health-indicator/coerce-health-controller.js.map +1 -0
- package/src/schematics/health-indicator/coerce-health-module.d.ts +2 -0
- package/src/schematics/health-indicator/coerce-health-module.js +48 -0
- package/src/schematics/health-indicator/coerce-health-module.js.map +1 -0
- package/src/schematics/health-indicator/index.d.ts +3 -0
- package/src/schematics/health-indicator/index.js +29 -0
- package/src/schematics/health-indicator/index.js.map +1 -0
- package/src/schematics/health-indicator/schema.d.ts +4 -0
- package/src/schematics/health-indicator/schema.json +29 -0
- package/src/schematics/health-indicator-init/index.d.ts +3 -0
- package/src/schematics/health-indicator-init/index.js +23 -0
- package/src/schematics/health-indicator-init/index.js.map +1 -0
- package/src/schematics/health-indicator-init/schema.d.ts +3 -0
- package/src/schematics/health-indicator-init/schema.json +19 -0
- package/src/schematics/init/files/Dockerfile.template +24 -0
- package/src/schematics/init/files/healthcheck.js.template +35 -0
- package/src/schematics/init/files/main.ts.template +77 -0
- package/src/schematics/init/index.d.ts +6 -0
- package/src/schematics/init/index.js +463 -0
- package/src/schematics/init/index.js.map +1 -0
- package/src/schematics/init/schema.d.ts +23 -0
- package/src/schematics/init/schema.json +103 -0
- package/src/schematics/jwt/index.d.ts +2 -0
- package/src/schematics/jwt/index.js +46 -0
- package/src/schematics/jwt/index.js.map +1 -0
- package/src/schematics/jwt/schema.d.ts +3 -0
- package/src/schematics/jwt/schema.json +15 -0
- package/src/schematics/microservice/index.d.ts +12 -0
- package/src/schematics/microservice/index.js +117 -0
- package/src/schematics/microservice/index.js.map +1 -0
- package/src/schematics/microservice/schema.d.ts +15 -0
- package/src/schematics/microservice/schema.json +69 -0
- package/src/schematics/open-api/index.d.ts +2 -0
- package/src/schematics/open-api/index.js +39 -0
- package/src/schematics/open-api/index.js.map +1 -0
- package/src/schematics/open-api/schema.d.ts +3 -0
- package/src/schematics/open-api/schema.json +15 -0
- package/src/schematics/sentry/index.d.ts +3 -0
- package/src/schematics/sentry/index.js +129 -0
- package/src/schematics/sentry/index.js.map +1 -0
- package/src/schematics/sentry/schema.d.ts +5 -0
- package/src/schematics/sentry/schema.json +27 -0
- package/src/schematics/swagger/files/environments/environment.swagger.ts.template +7 -0
- package/src/schematics/swagger/files/swagger.ts.template +19 -0
- package/src/schematics/swagger/index.d.ts +3 -0
- package/src/schematics/swagger/index.js +88 -0
- package/src/schematics/swagger/index.js.map +1 -0
- package/src/schematics/swagger/schema.d.ts +4 -0
- package/src/schematics/swagger/schema.json +19 -0
- package/src/schematics/validator/index.d.ts +3 -0
- package/src/schematics/validator/index.js +15 -0
- package/src/schematics/validator/index.js.map +1 -0
- package/src/schematics/validator/schema.d.ts +3 -0
- package/src/schematics/validator/schema.json +19 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Path } from '@angular-devkit/core';
|
|
2
|
+
export interface CrudServiceSchema {
|
|
3
|
+
collection2: string[];
|
|
4
|
+
project: string;
|
|
5
|
+
/**
|
|
6
|
+
* The name of the service.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The path to create the service.
|
|
11
|
+
*/
|
|
12
|
+
path?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The path to insert the service declaration.
|
|
15
|
+
*/
|
|
16
|
+
module?: Path;
|
|
17
|
+
/**
|
|
18
|
+
* Directive to insert declaration in module.
|
|
19
|
+
*/
|
|
20
|
+
skipImport?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Metadata name affected by declaration insertion.
|
|
23
|
+
*/
|
|
24
|
+
metadata?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Nest element type name
|
|
27
|
+
*/
|
|
28
|
+
type?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Application language.
|
|
31
|
+
*/
|
|
32
|
+
language?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The source root path
|
|
35
|
+
*/
|
|
36
|
+
sourceRoot?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies if a spec file is generated.
|
|
39
|
+
*/
|
|
40
|
+
spec?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Flag to indicate if a directory is created.
|
|
43
|
+
*/
|
|
44
|
+
flat?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The name/id of the private document
|
|
47
|
+
*/
|
|
48
|
+
private?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the crud service class should be overwritten
|
|
51
|
+
*/
|
|
52
|
+
overwrite?: boolean;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "crud-service",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the service.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use for the service?"
|
|
15
|
+
},
|
|
16
|
+
"path": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"format": "path",
|
|
19
|
+
"description": "The path to create the service."
|
|
20
|
+
},
|
|
21
|
+
"language": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Nest service language (ts/js)."
|
|
24
|
+
},
|
|
25
|
+
"sourceRoot": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Nest service source root directory."
|
|
28
|
+
},
|
|
29
|
+
"project": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "",
|
|
32
|
+
"default": "crud"
|
|
33
|
+
},
|
|
34
|
+
"flat": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"default": false,
|
|
37
|
+
"description": "Flag to indicate if a directory is created."
|
|
38
|
+
},
|
|
39
|
+
"spec": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": true,
|
|
42
|
+
"description": "Specifies if a spec file is generated."
|
|
43
|
+
},
|
|
44
|
+
"collection2": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"overwrite": {
|
|
51
|
+
"type": "boolean"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"required": [
|
|
55
|
+
"name"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FeatureMicroserviceOptions } from './schema';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
export interface NormalizedFeatureMicroserviceOptions extends Readonly<Normalized<FeatureMicroserviceOptions>> {
|
|
4
|
+
directory: string;
|
|
5
|
+
apiPrefix: string;
|
|
6
|
+
imageSuffix: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function NormalizeFeatureMicroserviceOptions(options: Readonly<FeatureMicroserviceOptions>): NormalizedFeatureMicroserviceOptions;
|
|
11
|
+
export default function (options: FeatureMicroserviceOptions): () => import("@angular-devkit/schematics").Rule;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeFeatureMicroserviceOptions = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
7
|
+
const init_1 = require("../init");
|
|
8
|
+
function NormalizeFeatureMicroserviceOptions(options) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
10
|
+
const feature = (0, schematics_utilities_1.dasherize)(options.feature);
|
|
11
|
+
const directory = (_a = options.directory) !== null && _a !== void 0 ? _a : ['service', 'feature'].join('/');
|
|
12
|
+
const prefix = directory.split('/').filter(Boolean).map(schematics_utilities_1.dasherize).join('-');
|
|
13
|
+
const name = feature;
|
|
14
|
+
return Object.seal({
|
|
15
|
+
name,
|
|
16
|
+
dsn: (_b = options.dsn) !== null && _b !== void 0 ? _b : null,
|
|
17
|
+
directory,
|
|
18
|
+
imageRegistry: (_c = options.imageRegistry) !== null && _c !== void 0 ? _c : null,
|
|
19
|
+
imageName: (_d = options.imageName) !== null && _d !== void 0 ? _d : null,
|
|
20
|
+
imageSuffix: (_e = options.imageSuffix) !== null && _e !== void 0 ? _e : `/${['service', 'feature', feature].join('/')}`,
|
|
21
|
+
apiPrefix: (_f = options.apiPrefix) !== null && _f !== void 0 ? _f : ['api', 'feature', feature].join('/'),
|
|
22
|
+
randomPort: (_g = options.randomPort) !== null && _g !== void 0 ? _g : true,
|
|
23
|
+
port: (_h = options.port) !== null && _h !== void 0 ? _h : null,
|
|
24
|
+
apiConfigurationFile: (_j = options.apiConfigurationFile) !== null && _j !== void 0 ? _j : null,
|
|
25
|
+
feature,
|
|
26
|
+
projectName: [prefix, name].join('-'),
|
|
27
|
+
overwrite: (_k = options.overwrite) !== null && _k !== void 0 ? _k : false,
|
|
28
|
+
openApi: (_l = options.openApi) !== null && _l !== void 0 ? _l : false,
|
|
29
|
+
jwt: (_m = options.jwt) !== null && _m !== void 0 ? _m : false,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.NormalizeFeatureMicroserviceOptions = NormalizeFeatureMicroserviceOptions;
|
|
33
|
+
function default_1(options) {
|
|
34
|
+
const normalizedOptions = NormalizeFeatureMicroserviceOptions(options);
|
|
35
|
+
const { name, dsn, directory, imageRegistry, imageName, imageSuffix, apiPrefix, projectName, port, apiConfigurationFile, randomPort, overwrite, openApi, jwt, } = normalizedOptions;
|
|
36
|
+
console.log(`Generate feature microservice '${options.feature}' ...`);
|
|
37
|
+
return function () {
|
|
38
|
+
return (0, schematics_1.chain)([
|
|
39
|
+
() => console.log(`Execute microservice schematic for '${name}' ...`),
|
|
40
|
+
(0, schematics_utilities_1.ExecuteSchematic)('microservice', {
|
|
41
|
+
name,
|
|
42
|
+
dsn,
|
|
43
|
+
directory,
|
|
44
|
+
imageRegistry,
|
|
45
|
+
imageName,
|
|
46
|
+
imageSuffix,
|
|
47
|
+
apiPrefix,
|
|
48
|
+
port,
|
|
49
|
+
randomPort,
|
|
50
|
+
apiConfigurationFile,
|
|
51
|
+
overwrite,
|
|
52
|
+
openApi,
|
|
53
|
+
jwt,
|
|
54
|
+
}),
|
|
55
|
+
() => console.log(`Coerce nest module and controller '${name}' ...`),
|
|
56
|
+
(0, schematics_ts_morph_1.CoerceNestController)({
|
|
57
|
+
name: options.feature,
|
|
58
|
+
project: projectName,
|
|
59
|
+
}),
|
|
60
|
+
(0, init_1.CleanUp)({ project: projectName }),
|
|
61
|
+
]);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
exports.default = default_1;
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/feature-microservice/index.ts"],"names":[],"mappings":";;;AACA,2DAAmD;AACnD,qEAGoC;AAEpC,mEAAiE;AACjE,kCAAkC;AAUlC,SAAgB,mCAAmC,CAAC,OAA6C;;IAE/F,MAAM,OAAO,GAAG,IAAA,gCAAS,EAAC,OAAO,CAAC,OAAO,CAAC,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K;KAC1B,CAAC,CAAC;AACL,CAAC;AAxBD,kFAwBC;AAED,mBAAyB,OAAmC;IAC1D,MAAM,iBAAiB,GAAG,mCAAmC,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,EACJ,IAAI,EACJ,GAAG,EACH,SAAS,EACT,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,WAAW,EACX,IAAI,EACJ,oBAAoB,EACpB,UAAU,EACV,SAAS,EACT,OAAO,EACP,GAAG,GACJ,GAAG,iBAAiB,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,kCAAmC,OAAO,CAAC,OAAQ,OAAO,CAAC,CAAC;IACxE,OAAO;QACL,OAAO,IAAA,kBAAK,EAAC;YACX,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,uCAAwC,IAAK,OAAO,CAAC;YACvE,IAAA,uCAAgB,EAAC,cAAc,EAAE;gBAC/B,IAAI;gBACJ,GAAG;gBACH,SAAS;gBACT,aAAa;gBACb,SAAS;gBACT,WAAW;gBACX,SAAS;gBACT,IAAI;gBACJ,UAAU;gBACV,oBAAoB;gBACpB,SAAS;gBACT,OAAO;gBACP,GAAG;aACJ,CAAC;YACF,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,sCAAuC,IAAK,OAAO,CAAC;YACtE,IAAA,0CAAoB,EAAC;gBACnB,IAAI,EAAE,OAAO,CAAC,OAAO;gBACrB,OAAO,EAAE,WAAW;aACrB,CAAC;YACF,IAAA,cAAO,EAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;SAClC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA7CD,4BA6CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface FeatureMicroserviceOptions {
|
|
2
|
+
feature: string;
|
|
3
|
+
dsn?: string;
|
|
4
|
+
directory: string;
|
|
5
|
+
imageRegistry?: string;
|
|
6
|
+
imageName?: string;
|
|
7
|
+
imageSuffix?: string;
|
|
8
|
+
apiPrefix?: string;
|
|
9
|
+
port?: number;
|
|
10
|
+
randomPort?: boolean;
|
|
11
|
+
apiConfigurationFile?: string;
|
|
12
|
+
overwrite: boolean;
|
|
13
|
+
openApi: boolean;
|
|
14
|
+
jwt: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "feature-microservice",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"feature": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The feature of the frontend project",
|
|
9
|
+
"x-prompt": "For which feature of the frontend should the microservice be created?"
|
|
10
|
+
},
|
|
11
|
+
"dsn": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Default sentry dsn"
|
|
14
|
+
},
|
|
15
|
+
"directory": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The directory to create the microservice in"
|
|
18
|
+
},
|
|
19
|
+
"imageRegistry": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The image registry to use",
|
|
22
|
+
"default": "registry.gitlab.com"
|
|
23
|
+
},
|
|
24
|
+
"imageName": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "The image name to use",
|
|
27
|
+
"default": "service"
|
|
28
|
+
},
|
|
29
|
+
"imageSuffix": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "The image suffix to use"
|
|
32
|
+
},
|
|
33
|
+
"apiPrefix": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "The api prefix to use"
|
|
36
|
+
},
|
|
37
|
+
"port": {
|
|
38
|
+
"type": "number",
|
|
39
|
+
"description": "The port to use"
|
|
40
|
+
},
|
|
41
|
+
"randomPort": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Use a random port between 3000 and 4000"
|
|
44
|
+
},
|
|
45
|
+
"apiConfigurationFile": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "The api configuration file to use"
|
|
48
|
+
},
|
|
49
|
+
"overwrite": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"default": false,
|
|
52
|
+
"description": "Whether to overwrite existing files"
|
|
53
|
+
},
|
|
54
|
+
"jwt": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"default": false,
|
|
57
|
+
"description": "Whether the application should use jwt"
|
|
58
|
+
},
|
|
59
|
+
"openApi": {
|
|
60
|
+
"alias": "open-api",
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"default": false,
|
|
63
|
+
"description": "Whether the application should use openApi as client"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"required": [
|
|
67
|
+
"feature"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Normalized } from '@rxap/utilities';
|
|
2
|
+
import { FrontendMicroserviceOptions } from './schema';
|
|
3
|
+
export interface NormalizedFrontendMicroserviceOptions extends Readonly<Normalized<FrontendMicroserviceOptions>> {
|
|
4
|
+
directory: string;
|
|
5
|
+
apiPrefix: string;
|
|
6
|
+
imageSuffix: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function NormalizeFrontendMicroserviceOptions(options: Readonly<FrontendMicroserviceOptions>): NormalizedFrontendMicroserviceOptions;
|
|
11
|
+
export default function (options: FrontendMicroserviceOptions): () => import("@angular-devkit/schematics").Rule;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeFrontendMicroserviceOptions = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
+
const init_1 = require("../init");
|
|
7
|
+
function NormalizeFrontendMicroserviceOptions(options) {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9
|
+
const frontend = (0, schematics_utilities_1.dasherize)(options.frontend);
|
|
10
|
+
const feature = (0, schematics_utilities_1.dasherize)(options.feature);
|
|
11
|
+
const directory = (_a = options.directory) !== null && _a !== void 0 ? _a : ['service', 'app', frontend].join('/');
|
|
12
|
+
const prefix = directory.split('/').filter(Boolean).map(schematics_utilities_1.dasherize).join('-');
|
|
13
|
+
const name = feature;
|
|
14
|
+
return Object.seal({
|
|
15
|
+
name,
|
|
16
|
+
dsn: (_b = options.dsn) !== null && _b !== void 0 ? _b : null,
|
|
17
|
+
directory,
|
|
18
|
+
imageRegistry: (_c = options.imageRegistry) !== null && _c !== void 0 ? _c : null,
|
|
19
|
+
imageName: (_d = options.imageName) !== null && _d !== void 0 ? _d : null,
|
|
20
|
+
imageSuffix: (_e = options.imageSuffix) !== null && _e !== void 0 ? _e : `/${['service', 'app', frontend, feature].join('/')}`,
|
|
21
|
+
apiPrefix: (_f = options.apiPrefix) !== null && _f !== void 0 ? _f : ['api', 'app', frontend, feature].join('/'),
|
|
22
|
+
randomPort: (_g = options.randomPort) !== null && _g !== void 0 ? _g : true,
|
|
23
|
+
port: (_h = options.port) !== null && _h !== void 0 ? _h : null,
|
|
24
|
+
apiConfigurationFile: (_j = options.apiConfigurationFile) !== null && _j !== void 0 ? _j : null,
|
|
25
|
+
feature,
|
|
26
|
+
frontend,
|
|
27
|
+
projectName: [prefix, name].join('-'),
|
|
28
|
+
overwrite: (_k = options.overwrite) !== null && _k !== void 0 ? _k : false,
|
|
29
|
+
openApi: (_l = options.openApi) !== null && _l !== void 0 ? _l : false,
|
|
30
|
+
jwt: (_m = options.jwt) !== null && _m !== void 0 ? _m : false,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.NormalizeFrontendMicroserviceOptions = NormalizeFrontendMicroserviceOptions;
|
|
34
|
+
function default_1(options) {
|
|
35
|
+
const normalizedOptions = NormalizeFrontendMicroserviceOptions(options);
|
|
36
|
+
const { name, dsn, directory, imageRegistry, imageName, imageSuffix, apiPrefix, projectName, port, apiConfigurationFile, randomPort, overwrite, openApi, jwt, } = normalizedOptions;
|
|
37
|
+
console.log(`Generate frontend microservice '${options.frontend}' for feature '${options.feature}' ...`);
|
|
38
|
+
return function () {
|
|
39
|
+
return (0, schematics_1.chain)([
|
|
40
|
+
() => console.log(`Execute microservice schematic for '${name}' ...`),
|
|
41
|
+
(0, schematics_utilities_1.ExecuteSchematic)('microservice', {
|
|
42
|
+
name,
|
|
43
|
+
dsn,
|
|
44
|
+
directory,
|
|
45
|
+
imageRegistry,
|
|
46
|
+
imageName,
|
|
47
|
+
imageSuffix,
|
|
48
|
+
apiPrefix,
|
|
49
|
+
port,
|
|
50
|
+
randomPort,
|
|
51
|
+
apiConfigurationFile,
|
|
52
|
+
overwrite,
|
|
53
|
+
openApi,
|
|
54
|
+
jwt,
|
|
55
|
+
}),
|
|
56
|
+
(0, init_1.CleanUp)({ project: projectName }),
|
|
57
|
+
]);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.default = default_1;
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/frontend-microservice/index.ts"],"names":[],"mappings":";;;AAAA,2DAAmD;AACnD,qEAGoC;AAGpC,kCAAkC;AAUlC,SAAgB,oCAAoC,CAAC,OAA8C;;IAEjG,MAAM,QAAQ,GAAG,IAAA,gCAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAA,gCAAS,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,CAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChF,MAAM,MAAM,GAAG,S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O,CAAC,CAAC;IACxE,MAAM,EACJ,IAAI,EACJ,GAAG,EACH,SAAS,EACT,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,WAAW,EACX,IAAI,EACJ,oBAAoB,EACpB,UAAU,EACV,SAAS,EACT,OAAO,EACP,GAAG,GACJ,GAAG,iBAAiB,CAAC;IACtB,OAAO,CAAC,GAAG,CACT,mCAAoC,OAAO,CAAC,QAAS,kBAAmB,OAAO,CAAC,OAAQ,OAAO,CAChG,CAAC;IACF,OAAO;QACL,OAAO,IAAA,kBAAK,EAAC;YACX,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,uCAAwC,IAAK,OAAO,CAAC;YACvE,IAAA,uCAAgB,EAAC,cAAc,EAAE;gBAC/B,IAAI;gBACJ,GAAG;gBACH,SAAS;gBACT,aAAa;gBACb,SAAS;gBACT,WAAW;gBACX,SAAS;gBACT,IAAI;gBACJ,UAAU;gBACV,oBAAoB;gBACpB,SAAS;gBACT,OAAO;gBACP,GAAG;aACJ,CAAC;YACF,IAAA,cAAO,EAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;SAClC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA1CD,4BA0CC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface FrontendMicroserviceOptions {
|
|
2
|
+
frontend: string;
|
|
3
|
+
feature: string;
|
|
4
|
+
dsn?: string;
|
|
5
|
+
directory: string;
|
|
6
|
+
imageRegistry?: string;
|
|
7
|
+
imageName?: string;
|
|
8
|
+
imageSuffix?: string;
|
|
9
|
+
apiPrefix?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
randomPort?: boolean;
|
|
12
|
+
apiConfigurationFile?: string;
|
|
13
|
+
overwrite: boolean;
|
|
14
|
+
openApi: boolean;
|
|
15
|
+
jwt: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "frontend-microservice",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"frontend": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of frontend project",
|
|
9
|
+
"x-prompt": "For which frontend project should the microservice be created?"
|
|
10
|
+
},
|
|
11
|
+
"feature": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The feature of the frontend project",
|
|
14
|
+
"x-prompt": "For which feature of the frontend should the microservice be created?"
|
|
15
|
+
},
|
|
16
|
+
"dsn": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Default sentry dsn"
|
|
19
|
+
},
|
|
20
|
+
"directory": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The directory to create the microservice in"
|
|
23
|
+
},
|
|
24
|
+
"imageRegistry": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "The image registry to use",
|
|
27
|
+
"default": "registry.gitlab.com"
|
|
28
|
+
},
|
|
29
|
+
"imageName": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "The image name to use",
|
|
32
|
+
"default": "service"
|
|
33
|
+
},
|
|
34
|
+
"imageSuffix": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "The image suffix to use"
|
|
37
|
+
},
|
|
38
|
+
"apiPrefix": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "The api prefix to use"
|
|
41
|
+
},
|
|
42
|
+
"port": {
|
|
43
|
+
"type": "number",
|
|
44
|
+
"description": "The port to use"
|
|
45
|
+
},
|
|
46
|
+
"randomPort": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "Use a random port between 3000 and 4000"
|
|
49
|
+
},
|
|
50
|
+
"apiConfigurationFile": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "The api configuration file to use"
|
|
53
|
+
},
|
|
54
|
+
"overwrite": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"default": false,
|
|
57
|
+
"description": "Whether to overwrite existing files"
|
|
58
|
+
},
|
|
59
|
+
"jwt": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"default": false,
|
|
62
|
+
"description": "Whether the application should use jwt"
|
|
63
|
+
},
|
|
64
|
+
"openApi": {
|
|
65
|
+
"alias": "open-api",
|
|
66
|
+
"type": "boolean",
|
|
67
|
+
"default": false,
|
|
68
|
+
"description": "Whether the application should use openApi as client"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": [
|
|
72
|
+
"frontend",
|
|
73
|
+
"feature"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddHealthEndpoint = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
const core_1 = require("@angular-devkit/core");
|
|
6
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
7
|
+
const { dasherize, classify, camelize, decamelize } = core_1.strings;
|
|
8
|
+
function AddHealthEndpoint(sourceFile, name) {
|
|
9
|
+
const classDeclaration = sourceFile.getClass('HealthController');
|
|
10
|
+
if (!classDeclaration) {
|
|
11
|
+
throw new Error('FATAL: could not find the HealthController class!');
|
|
12
|
+
}
|
|
13
|
+
const healthIndicatorClass = `${classify(name)}HealthIndicator`;
|
|
14
|
+
classDeclaration.addMethod({
|
|
15
|
+
name: camelize(name),
|
|
16
|
+
returnType: 'Promise<HealthCheckResult>',
|
|
17
|
+
statements: [
|
|
18
|
+
w => {
|
|
19
|
+
w.writeLine('return this.health.check([');
|
|
20
|
+
w.writeLine(`async () => this.${camelize(healthIndicatorClass)}.isHealthy(),`);
|
|
21
|
+
w.write(']);');
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
scope: ts_morph_1.Scope.Public,
|
|
25
|
+
decorators: [
|
|
26
|
+
{
|
|
27
|
+
name: 'Get',
|
|
28
|
+
arguments: [w => w.quote(dasherize(name))],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'HealthCheck',
|
|
32
|
+
arguments: [],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
sourceFile.addImportDeclarations([
|
|
37
|
+
{
|
|
38
|
+
moduleSpecifier: '@nestjs/terminus',
|
|
39
|
+
namedImports: ['HealthCheck', 'HealthCheckResult'],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
moduleSpecifier: '@nestjs/common',
|
|
43
|
+
namedImports: ['Get'],
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
(0, schematics_ts_morph_1.AddDependencyInjection)(sourceFile, {
|
|
47
|
+
parameterName: camelize(healthIndicatorClass),
|
|
48
|
+
injectionToken: healthIndicatorClass,
|
|
49
|
+
scope: ts_morph_1.Scope.Private,
|
|
50
|
+
}, [
|
|
51
|
+
{
|
|
52
|
+
moduleSpecifier: `./${dasherize(name)}.health-indicator`,
|
|
53
|
+
namedImports: [healthIndicatorClass],
|
|
54
|
+
},
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
exports.AddHealthEndpoint = AddHealthEndpoint;
|
|
58
|
+
//# sourceMappingURL=add-health-endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-health-endpoint.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/health-indicator/add-health-endpoint.ts"],"names":[],"mappings":";;;AAAA,uCAGkB;AAClB,+CAA+C;AAC/C,mEAAmE;AAEnE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,cAAO,CAAC;AAE9D,SAAgB,iBAAiB,CAC/B,UAAsB,EACtB,IAAY;IAGZ,MAAM,gBAAgB,GAAG,UAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEjE,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAA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;AAEJ,CAAC;AA9DD,8CA8DC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddHealthIndicator = void 0;
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
const core_1 = require("@angular-devkit/core");
|
|
7
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
8
|
+
const { dasherize, classify } = core_1.strings;
|
|
9
|
+
function AddHealthIndicator(project, name) {
|
|
10
|
+
const indicatorSourceFile = project.createSourceFile(`/app/health/${dasherize(name)}.health-indicator.ts`);
|
|
11
|
+
const indicatorClassName = (0, schematics_utilities_1.CoerceSuffix)(classify(name), 'HealthIndicator');
|
|
12
|
+
indicatorSourceFile.addClass({
|
|
13
|
+
name: indicatorClassName,
|
|
14
|
+
isExported: true,
|
|
15
|
+
decorators: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Injectable',
|
|
18
|
+
arguments: [],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
extends: 'HealthIndicator',
|
|
22
|
+
ctors: [
|
|
23
|
+
{
|
|
24
|
+
parameters: [],
|
|
25
|
+
statements: 'super();',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
methods: [
|
|
29
|
+
{
|
|
30
|
+
name: 'isHealthy',
|
|
31
|
+
isAsync: true,
|
|
32
|
+
scope: ts_morph_1.Scope.Public,
|
|
33
|
+
returnType: 'Promise<HealthIndicatorResult>',
|
|
34
|
+
statements: [
|
|
35
|
+
`throw new HealthCheckError('Not yet implemented!', this.getStatus('${dasherize(name)}', false))`,
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
indicatorSourceFile.addImportDeclarations([
|
|
41
|
+
{
|
|
42
|
+
namedImports: ['Injectable'],
|
|
43
|
+
moduleSpecifier: '@nestjs/common',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
namedImports: ['HealthCheckError', 'HealthIndicator', 'HealthIndicatorResult'],
|
|
47
|
+
moduleSpecifier: '@nestjs/terminus',
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
const moduleSourceFile = (0, schematics_ts_morph_1.FindNestModuleSourceFile)(project, '/app/health');
|
|
51
|
+
if (moduleSourceFile) {
|
|
52
|
+
(0, schematics_ts_morph_1.AddNestModuleProvider)(moduleSourceFile, indicatorClassName, [
|
|
53
|
+
{
|
|
54
|
+
namedImports: [indicatorClassName],
|
|
55
|
+
moduleSpecifier: `./${dasherize(name)}.health-indicator`,
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.AddHealthIndicator = AddHealthIndicator;
|
|
61
|
+
//# sourceMappingURL=add-health-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-health-indicator.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/health-indicator/add-health-indicator.ts"],"names":[],"mappings":";;;AAAA,qEAA0D;AAC1D,uCAGkB;AAClB,+CAA+C;AAC/C,mEAGmC;AAEnC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,cAAO,CAAC;AAExC,SAAgB,kBAAkB,CAAC,OAAgB,EAAE,IAAY;IAC/D,MAAM,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAgB,SAAS,CAAC,IAAI,CAAE,sBAAsB,CAAC,CAAC;IAE7G,MAAM,kBAAkB,GAAG,IAAA,mCAAY,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAE3E,mBAAmB,CAAC,QAAQ,CAAC;QAC3B,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,YAAY;gBAClB,SAA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