@rxap/schematics-ts-morph 16.0.0-dev.32 → 16.0.0-dev.35
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 +20 -0
- package/README.md +1 -1
- package/package.json +4 -4
- package/src/lib/angular/coerce-form-table-action.d.ts +9 -1
- package/src/lib/angular/coerce-form-table-action.js +84 -19
- package/src/lib/angular/coerce-form-table-action.js.map +1 -1
- package/src/lib/angular/coerce-navigation-table-action.d.ts +1 -0
- package/src/lib/angular/coerce-navigation-table-action.js +22 -12
- package/src/lib/angular/coerce-navigation-table-action.js.map +1 -1
- package/src/lib/angular/coerce-open-api-table-action.js +16 -38
- package/src/lib/angular/coerce-open-api-table-action.js.map +1 -1
- package/src/lib/nest/operation-id-utilities.d.ts +33 -0
- package/src/lib/nest/operation-id-utilities.js +33 -0
- package/src/lib/nest/operation-id-utilities.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.35](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.0.0-dev.34...@rxap/schematics-ts-morph@16.0.0-dev.35) (2023-11-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- support relativeTo parameter ([0f1e690](https://gitlab.com/rxap/packages/commit/0f1e690f74802761efee09fa73ffb8036b3cefcd))
|
|
11
|
+
|
|
12
|
+
# [16.0.0-dev.34](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.0.0-dev.33...@rxap/schematics-ts-morph@16.0.0-dev.34) (2023-11-17)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- add utility function ([19e3337](https://gitlab.com/rxap/packages/commit/19e3337837b0222cda49dafdc675eb0010fc9d6a))
|
|
17
|
+
- support custom form component ([6c1a9b7](https://gitlab.com/rxap/packages/commit/6c1a9b7e996aa5bac073a5867b30819748230a84))
|
|
18
|
+
- use ToMappingObject function ([8d39cb3](https://gitlab.com/rxap/packages/commit/8d39cb3a1998b36d95d6247f3077f2d1e7ac0ab3))
|
|
19
|
+
|
|
20
|
+
# [16.0.0-dev.33](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.0.0-dev.32...@rxap/schematics-ts-morph@16.0.0-dev.33) (2023-11-17)
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
- use correct var check name ([2ea373e](https://gitlab.com/rxap/packages/commit/2ea373e4ecede80d06a727f6b71e5438aef1798c))
|
|
25
|
+
|
|
6
26
|
# [16.0.0-dev.32](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.0.0-dev.31...@rxap/schematics-ts-morph@16.0.0-dev.32) (2023-11-17)
|
|
7
27
|
|
|
8
28
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -17,5 +17,5 @@ yarn add @rxap/schematics-ts-morph
|
|
|
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/schematics-utilities@^16.0.0-dev.21 @rxap/ts-morph@^0.1.0-dev.
|
|
20
|
+
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/schematics-utilities@^16.0.0-dev.21 @rxap/ts-morph@^0.1.0-dev.19 @rxap/utilities@^16.0.0-dev.23 @rxap/workspace-ts-morph@^0.1.0-dev.12 ts-morph@^18.0.0 tslib@2.6.2
|
|
21
21
|
```
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "16.0.0-dev.
|
|
2
|
+
"version": "16.0.0-dev.35",
|
|
3
3
|
"name": "@rxap/schematics-ts-morph",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"dependencies": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@angular-devkit/core": "^16.1.4",
|
|
14
14
|
"@angular-devkit/schematics": "^16.1.4",
|
|
15
15
|
"@rxap/schematics-utilities": "^16.0.0-dev.21",
|
|
16
|
-
"@rxap/ts-morph": "^0.1.0-dev.
|
|
16
|
+
"@rxap/ts-morph": "^0.1.0-dev.19",
|
|
17
17
|
"@rxap/utilities": "^16.0.0-dev.23",
|
|
18
18
|
"@rxap/workspace-ts-morph": "^0.1.0-dev.12",
|
|
19
19
|
"ts-morph": "^18.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"package": "@rxap/ts-morph",
|
|
48
|
-
"version": "0.1.0-dev.
|
|
48
|
+
"version": "0.1.0-dev.19"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"package": "@rxap/utilities",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"directory": "packages/schematic/ts-morph"
|
|
68
68
|
},
|
|
69
69
|
"type": "commonjs",
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "eae9d8105fc9ecfdf80101d147d1947b99d68fb8",
|
|
71
71
|
"main": "./src/index.js",
|
|
72
72
|
"types": "./src/index.d.ts"
|
|
73
73
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { CoerceTableActionOptions } from './coerce-table-action';
|
|
2
|
+
export interface LoadFromTableActionOptions {
|
|
3
|
+
operationId: string;
|
|
4
|
+
scope?: string | null;
|
|
5
|
+
body: boolean | Record<string, any>;
|
|
6
|
+
parameters: boolean | Record<string, any>;
|
|
7
|
+
}
|
|
2
8
|
export interface CoerceFormTableActionOptions extends CoerceTableActionOptions {
|
|
3
|
-
|
|
9
|
+
loadFrom?: LoadFromTableActionOptions | null;
|
|
10
|
+
formInitial?: Record<string, any> | null;
|
|
4
11
|
scope?: string | null;
|
|
12
|
+
formComponent: string;
|
|
5
13
|
}
|
|
6
14
|
export declare function CoerceFormTableActionRule(options: CoerceFormTableActionOptions): import("@angular-devkit/schematics").Rule;
|
|
@@ -2,33 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceFormTableActionRule = void 0;
|
|
4
4
|
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
6
|
+
const utilities_1 = require("@rxap/utilities");
|
|
7
|
+
const ts_morph_2 = require("ts-morph");
|
|
6
8
|
const coerce_class_constructor_1 = require("../coerce-class-constructor");
|
|
7
9
|
const operation_id_utilities_1 = require("../nest/operation-id-utilities");
|
|
8
10
|
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
9
11
|
const coerce_parameter_declaration_1 = require("../ts-morph/coerce-parameter-declaration");
|
|
10
12
|
const coerce_table_action_1 = require("./coerce-table-action");
|
|
13
|
+
const toMappingObjectOptions = {
|
|
14
|
+
aliasFnc: (key, value) => {
|
|
15
|
+
if (['rowId', '_rowId', '__rowId'].includes(value)) {
|
|
16
|
+
return '__rowId';
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
11
21
|
function CoerceFormTableActionRule(options) {
|
|
12
|
-
let { type,
|
|
22
|
+
let { type, loadFrom, tableName, tsMorphTransform, scope, formInitial, formComponent, } = options;
|
|
13
23
|
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => ({}));
|
|
14
24
|
return (0, coerce_table_action_1.CoerceTableActionRule)(Object.assign(Object.assign({}, options), { tsMorphTransform: (project, sourceFile, classDeclaration) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const tableInterfaceName = `I${(0, schematics_utilities_1.classify)(tableName)}`;
|
|
15
27
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
16
28
|
moduleSpecifier: '@angular/core',
|
|
17
29
|
namedImports: ['ChangeDetectorRef', 'Inject', 'INJECTOR', 'Injector'],
|
|
18
30
|
});
|
|
19
|
-
const openFormWindowMethod = `Open${(0, schematics_utilities_1.classify)(
|
|
31
|
+
const openFormWindowMethod = `Open${(0, schematics_utilities_1.classify)(formComponent)}WindowMethod`;
|
|
20
32
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
21
|
-
moduleSpecifier: `../../${
|
|
33
|
+
moduleSpecifier: `../../${(0, utilities_1.dasherize)(formComponent)}/open-${(0, utilities_1.dasherize)(formComponent)}-window.method`,
|
|
22
34
|
namedImports: [openFormWindowMethod],
|
|
23
35
|
});
|
|
24
36
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
25
37
|
namedImports: ['firstValueFrom'],
|
|
26
38
|
moduleSpecifier: 'rxjs',
|
|
27
39
|
});
|
|
28
|
-
if (
|
|
40
|
+
if (loadFrom === null || loadFrom === void 0 ? void 0 : loadFrom.operationId) {
|
|
29
41
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
30
|
-
moduleSpecifier: (0, operation_id_utilities_1.OperationIdToClassImportPath)(
|
|
31
|
-
namedImports: [(0, operation_id_utilities_1.OperationIdToClassName)(
|
|
42
|
+
moduleSpecifier: (0, operation_id_utilities_1.OperationIdToClassImportPath)(loadFrom.operationId, (_a = loadFrom.scope) !== null && _a !== void 0 ? _a : scope),
|
|
43
|
+
namedImports: [(0, operation_id_utilities_1.OperationIdToClassName)(loadFrom.operationId)],
|
|
44
|
+
});
|
|
45
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
46
|
+
moduleSpecifier: (0, ts_morph_1.OperationIdToResponseClassImportPath)(loadFrom.operationId, (_b = loadFrom.scope) !== null && _b !== void 0 ? _b : scope),
|
|
47
|
+
namedImports: [(0, ts_morph_1.OperationIdToResponseClassName)(loadFrom.operationId)],
|
|
32
48
|
});
|
|
33
49
|
}
|
|
34
50
|
const [constructorDeclaration] = (0, coerce_class_constructor_1.CoerceClassConstructor)(classDeclaration);
|
|
@@ -36,7 +52,7 @@ function CoerceFormTableActionRule(options) {
|
|
|
36
52
|
name: 'openFormWindow',
|
|
37
53
|
type: openFormWindowMethod,
|
|
38
54
|
isReadonly: true,
|
|
39
|
-
scope:
|
|
55
|
+
scope: ts_morph_2.Scope.Private,
|
|
40
56
|
decorators: [
|
|
41
57
|
{
|
|
42
58
|
name: 'Inject',
|
|
@@ -47,7 +63,7 @@ function CoerceFormTableActionRule(options) {
|
|
|
47
63
|
(0, coerce_parameter_declaration_1.CoerceParameterDeclaration)(constructorDeclaration, 'injector').set({
|
|
48
64
|
type: 'Injector',
|
|
49
65
|
isReadonly: true,
|
|
50
|
-
scope:
|
|
66
|
+
scope: ts_morph_2.Scope.Private,
|
|
51
67
|
decorators: [
|
|
52
68
|
{
|
|
53
69
|
name: 'Inject',
|
|
@@ -58,28 +74,77 @@ function CoerceFormTableActionRule(options) {
|
|
|
58
74
|
(0, coerce_parameter_declaration_1.CoerceParameterDeclaration)(constructorDeclaration, 'cdr').set({
|
|
59
75
|
type: 'ChangeDetectorRef',
|
|
60
76
|
isReadonly: true,
|
|
61
|
-
scope:
|
|
77
|
+
scope: ts_morph_2.Scope.Private,
|
|
62
78
|
});
|
|
63
|
-
if (
|
|
79
|
+
if (loadFrom === null || loadFrom === void 0 ? void 0 : loadFrom.operationId) {
|
|
64
80
|
(0, coerce_parameter_declaration_1.CoerceParameterDeclaration)(constructorDeclaration, 'getInitial').set({
|
|
65
81
|
isReadonly: true,
|
|
66
|
-
scope:
|
|
67
|
-
type: (0, operation_id_utilities_1.OperationIdToClassName)(
|
|
82
|
+
scope: ts_morph_2.Scope.Private,
|
|
83
|
+
type: (0, operation_id_utilities_1.OperationIdToClassName)(loadFrom.operationId),
|
|
68
84
|
});
|
|
69
85
|
}
|
|
70
86
|
const statements = [];
|
|
71
87
|
statements.push(`console.log(\`action row type: ${type}\`, parameters);`);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
statements.push(`const { __rowId: rowId } = parameters;`);
|
|
89
|
+
if (loadFrom === null || loadFrom === void 0 ? void 0 : loadFrom.operationId) {
|
|
90
|
+
if (loadFrom.body) {
|
|
91
|
+
(0, ts_morph_1.CoerceMappingClassMethod)(sourceFile, classDeclaration, {
|
|
92
|
+
name: 'getBody',
|
|
93
|
+
parameterType: tableInterfaceName,
|
|
94
|
+
returnType: (0, ts_morph_1.OperationIdToRequestBodyClassName)(loadFrom.operationId),
|
|
95
|
+
mapping: loadFrom.body,
|
|
96
|
+
mappingOptions: toMappingObjectOptions,
|
|
97
|
+
});
|
|
98
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
99
|
+
namedImports: [(0, ts_morph_1.OperationIdToRequestBodyClassName)(loadFrom.operationId)],
|
|
100
|
+
moduleSpecifier: (0, ts_morph_1.OperationIdToRequestBodyClassImportPath)(loadFrom.operationId, scope),
|
|
101
|
+
});
|
|
102
|
+
statements.push(`const requestBody = this.getBody(parameters);`);
|
|
103
|
+
}
|
|
104
|
+
if (loadFrom.parameters) {
|
|
105
|
+
(0, ts_morph_1.CoerceMappingClassMethod)(sourceFile, classDeclaration, {
|
|
106
|
+
name: 'getParameters',
|
|
107
|
+
parameterType: tableInterfaceName,
|
|
108
|
+
returnType: (0, ts_morph_1.OperationIdToParameterClassName)(loadFrom.operationId),
|
|
109
|
+
mapping: loadFrom.parameters,
|
|
110
|
+
mappingOptions: toMappingObjectOptions,
|
|
111
|
+
});
|
|
112
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
113
|
+
namedImports: [(0, ts_morph_1.OperationIdToParameterClassName)(loadFrom.operationId)],
|
|
114
|
+
moduleSpecifier: (0, ts_morph_1.OperationIdToParameterClassImportPath)(loadFrom.operationId, scope),
|
|
115
|
+
});
|
|
116
|
+
statements.push(`const requestParameters = this.getParameters(parameters);`);
|
|
117
|
+
}
|
|
118
|
+
if (loadFrom.body && loadFrom.parameters) {
|
|
119
|
+
statements.push(`const initial = await this.getInitial.call({ parameters: requestParameters, requestBody });`);
|
|
120
|
+
}
|
|
121
|
+
else if (loadFrom.body) {
|
|
122
|
+
statements.push(`const initial = await this.getInitial.call({ requestBody });`);
|
|
123
|
+
}
|
|
124
|
+
else if (loadFrom.parameters) {
|
|
125
|
+
statements.push(`const initial = await this.getInitial.call({ parameters: requestParameters });`);
|
|
126
|
+
}
|
|
76
127
|
}
|
|
77
128
|
else {
|
|
78
129
|
statements.push(`const initial = parameters;`);
|
|
79
130
|
}
|
|
80
131
|
statements.push(`this.cdr.markForCheck();`);
|
|
81
|
-
|
|
82
|
-
|
|
132
|
+
if (formInitial) {
|
|
133
|
+
(0, ts_morph_1.CoerceMappingClassMethod)(sourceFile, classDeclaration, {
|
|
134
|
+
name: 'toInitial',
|
|
135
|
+
parameterType: (loadFrom === null || loadFrom === void 0 ? void 0 : loadFrom.operationId) ? (0, ts_morph_1.OperationIdToResponseClassName)(loadFrom.operationId) :
|
|
136
|
+
tableInterfaceName,
|
|
137
|
+
mapping: formInitial,
|
|
138
|
+
mappingOptions: toMappingObjectOptions,
|
|
139
|
+
// TODO : use the form interface as return type
|
|
140
|
+
returnType: 'any',
|
|
141
|
+
});
|
|
142
|
+
statements.push(`return firstValueFrom(this.openFormWindow.call(this.toInitial(initial), {injector: this.injector, context: { rowId }}));`);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
statements.push(`return firstValueFrom(this.openFormWindow.call(initial, {injector: this.injector, context: { rowId }}));`);
|
|
146
|
+
}
|
|
147
|
+
return Object.assign({ statements, isAsync: true, scope: ts_morph_2.Scope.Public, returnType: 'Promise<any>' }, tsMorphTransform(project, sourceFile, classDeclaration));
|
|
83
148
|
} }));
|
|
84
149
|
}
|
|
85
150
|
exports.CoerceFormTableActionRule = CoerceFormTableActionRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-form-table-action.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-form-table-action.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,uCAIkB;AAClB,0EAAqE;AACrE,2EAGwC;AACxC,+DAA2D;AAC3D,2FAAsF;AACtF,+DAG+B;
|
|
1
|
+
{"version":3,"file":"coerce-form-table-action.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-form-table-action.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,6CASwB;AACxB,+CAA4C;AAC5C,uCAIkB;AAClB,0EAAqE;AACrE,2EAGwC;AACxC,+DAA2D;AAC3D,2FAAsF;AACtF,+DAG+B;AAgB/B,MAAM,sBAAsB,GAA2B;IACrD,QAAQ,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;QACvC,IAAI,CAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YACpD,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF,SAAgB,yBAAyB,CAAC,OAAqC;IAC7E,IAAI,EACF,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,aAAa,GACd,GAAG,OAAO,CAAC;IACZ,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,IAAhB,gBAAgB,GAAK,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAC;IAEhC,OAAO,IAAA,2CAAqB,kCACvB,OAAO,KACV,gBAAgB,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE;;YAE1D,MAAM,kBAAkB,GAAG,IAAK,IAAA,+BAAQ,EAAC,SAAS,CAAE,EAAE,CAAC;YAEvD,IAAA,8BAAa,EAAC,UAAU,EAAE;gBACxB,eAA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,IAAI,EAAE;oBACxB,UAAU,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;iBACjF;qBAAM,IAAI,QAAQ,CAAC,UAAU,EAAE;oBAC9B,UAAU,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;iBACnG;aACF;iBAAM;gBACL,UAAU,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;aAChD;YACD,UAAU,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC5C,IAAI,WAAW,EAAE;gBACf,IAAA,mCAAwB,EAAC,UAAU,EAAE,gBAAgB,EAAE;oBACrD,IAAI,EAAE,WAAW;oBACjB,aAAa,EAAE,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,EAAC,CAAC,CAAC,IAAA,yCAA8B,EAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;wBAC9E,kBAAkB;oBACjC,OAAO,EAAE,WAAW;oBACpB,cAAc,EAAE,sBAAsB;oBACtC,+CAA+C;oBAC/C,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;gBACH,UAAU,CAAC,IAAI,CACb,0HAA0H,CAAC,CAAC;aAC/H;iBAAM;gBACL,UAAU,CAAC,IAAI,CACb,0GAA0G,CAAC,CAAC;aAC/G;YAED,uBACE,UAAU,EACV,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,gBAAK,CAAC,MAAM,EACnB,UAAU,EAAE,cAAc,IACvB,gBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAC3D;QACJ,CAAC,IACD,CAAC;AAEL,CAAC;AAtJD,8DAsJC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CoerceTableActionOptions } from './coerce-table-action';
|
|
2
2
|
export interface CoerceLinkTableActionRuleOptions extends CoerceTableActionOptions {
|
|
3
3
|
route?: string | null;
|
|
4
|
+
relativeTo?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare function CoerceNavigationTableActionRule(options: CoerceLinkTableActionRuleOptions): import("@angular-devkit/schematics").Rule;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceNavigationTableActionRule = void 0;
|
|
4
|
-
const coerce_table_action_1 = require("./coerce-table-action");
|
|
5
|
-
const coerce_class_constructor_1 = require("../coerce-class-constructor");
|
|
6
4
|
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
const
|
|
5
|
+
const coerce_class_constructor_1 = require("../coerce-class-constructor");
|
|
8
6
|
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
7
|
+
const coerce_parameter_declaration_1 = require("../ts-morph/coerce-parameter-declaration");
|
|
8
|
+
const coerce_table_action_1 = require("./coerce-table-action");
|
|
9
9
|
function extractAllProperties(route) {
|
|
10
10
|
const match = route.match(/\{\{([^}]+)}}/g);
|
|
11
11
|
if (!match) {
|
|
@@ -24,12 +24,12 @@ function buildDynamicRoute(route) {
|
|
|
24
24
|
return route;
|
|
25
25
|
}
|
|
26
26
|
function CoerceNavigationTableActionRule(options) {
|
|
27
|
-
let { tsMorphTransform, tableName, type, route, } = options;
|
|
27
|
+
let { tsMorphTransform, tableName, type, route, relativeTo, } = options;
|
|
28
28
|
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => ({}));
|
|
29
29
|
route !== null && route !== void 0 ? route : (route = '{{uuid}}');
|
|
30
30
|
return (0, coerce_table_action_1.CoerceTableActionRule)(Object.assign(Object.assign({}, options), { tsMorphTransform: (project, sourceFile, classDeclaration) => {
|
|
31
31
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
32
|
-
namedImports: ['Router'
|
|
32
|
+
namedImports: ['Router'],
|
|
33
33
|
moduleSpecifier: '@angular/router',
|
|
34
34
|
});
|
|
35
35
|
const [constructorDeclaration] = (0, coerce_class_constructor_1.CoerceClassConstructor)(classDeclaration);
|
|
@@ -39,23 +39,33 @@ function CoerceNavigationTableActionRule(options) {
|
|
|
39
39
|
isReadonly: true,
|
|
40
40
|
scope: ts_morph_1.Scope.Private,
|
|
41
41
|
});
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
if (relativeTo) {
|
|
43
|
+
(0, coerce_parameter_declaration_1.CoerceParameterDeclaration)(constructorDeclaration, 'route').set({
|
|
44
|
+
type: 'ActivatedRoute',
|
|
45
|
+
isReadonly: true,
|
|
46
|
+
scope: ts_morph_1.Scope.Private,
|
|
47
|
+
});
|
|
48
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
49
|
+
namedImports: ['ActivatedRoute'],
|
|
50
|
+
moduleSpecifier: '@angular/router',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
47
53
|
const properties = extractAllProperties(route);
|
|
48
54
|
const statements = [];
|
|
49
55
|
statements.push(`console.log(\`action row type: ${type}\`, parameters);`);
|
|
56
|
+
let routeValue = route;
|
|
50
57
|
if (properties.length) {
|
|
51
58
|
statements.push(`const { ${properties.join(', ')} } = parameters;`);
|
|
52
59
|
for (const property of properties) {
|
|
53
60
|
statements.push(`if (!${property}) { throw new Error('The table action ${type} is called with a row object that does not have the property ${property}.'); }`);
|
|
54
61
|
}
|
|
55
|
-
|
|
62
|
+
routeValue = buildDynamicRoute(route);
|
|
63
|
+
}
|
|
64
|
+
if (relativeTo) {
|
|
65
|
+
statements.push(`return this.router.navigate([ '${routeValue}' ], { relativeTo: this.route } );`);
|
|
56
66
|
}
|
|
57
67
|
else {
|
|
58
|
-
statements.push(`return this.router.navigate([ '${
|
|
68
|
+
statements.push(`return this.router.navigate([ '${routeValue}' ]);`);
|
|
59
69
|
}
|
|
60
70
|
return Object.assign({ statements, scope: ts_morph_1.Scope.Public, returnType: 'Promise<any>' }, tsMorphTransform(project, sourceFile, classDeclaration));
|
|
61
71
|
} }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-navigation-table-action.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-navigation-table-action.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"coerce-navigation-table-action.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-navigation-table-action.ts"],"names":[],"mappings":";;;AAAA,uCAIkB;AAClB,0EAAqE;AACrE,+DAA2D;AAC3D,2FAAsF;AACtF,+DAG+B;AAO/B,SAAS,oBAAoB,CAAC,KAAa;IACzC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAC;KACX;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACtB,OAAO,KAAK,CAAC;KACd;IACD,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;QACjC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAM,QAAS,IAAI,EAAE,MAAO,QAAS,GAAG,CAAC,CAAC;KACjE;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,+BAA+B,CAAC,OAAyC;IACvF,IAAI,EACF,gBAAgB,EAChB,SAAS,EACT,IAAI,EACJ,KAAK,EACL,UAAU,GACX,GAAG,OAAO,CAAC;IACZ,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,IAAhB,gBAAgB,GAAK,GAAG,EAAE,CAAC,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CAAC,IAAI,CAAE,kBAAkB,CAAC,CAAC;gBACtE,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;oBACjC,UAAU,CAAC,IAAI,CAAC,QAAS,QAAS,yCAA0C,IAAK,gEAAiE,QAAS,QAAQ,CAAC,CAAC;iBACtK;gBACD,UAAU,GAAG,iBAAiB,CAAC,KAAM,CAAC,CAAC;aACxC;YACD,IAAI,UAAU,EAAE;gBACd,UAAU,CAAC,IAAI,CAAC,kCAAmC,UAAW,oCAAoC,CAAC,CAAC;aACrG;iBAAM;gBACL,UAAU,CAAC,IAAI,CAAC,kCAAmC,UAAW,OAAO,CAAC,CAAC;aACxE;YAED,uBACE,UAAU,EACV,KAAK,EAAE,gBAAK,CAAC,MAAM,EACnB,UAAU,EAAE,cAAc,IACvB,gBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAC3D;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AAhED,0EAgEC"}
|
|
@@ -9,18 +9,14 @@ const operation_id_utilities_1 = require("../nest/operation-id-utilities");
|
|
|
9
9
|
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
10
10
|
const coerce_parameter_declaration_1 = require("../ts-morph/coerce-parameter-declaration");
|
|
11
11
|
const coerce_table_action_1 = require("./coerce-table-action");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (const [key, value] of Object.entries(input)) {
|
|
12
|
+
const toMappingObjectOptions = {
|
|
13
|
+
aliasFnc: (key, value) => {
|
|
15
14
|
if (['rowId', '_rowId', '__rowId'].includes(value)) {
|
|
16
|
-
|
|
15
|
+
return '__rowId';
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return mapping;
|
|
23
|
-
}
|
|
17
|
+
return value;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
24
20
|
function CoerceOpenApiTableActionRule(options) {
|
|
25
21
|
let { tsMorphTransform, operationId, body, parameters, type, scope, tableName, } = options;
|
|
26
22
|
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => ({}));
|
|
@@ -38,21 +34,12 @@ function CoerceOpenApiTableActionRule(options) {
|
|
|
38
34
|
const statements = [`console.log(\`action row type: ${type}\`, parameters);`];
|
|
39
35
|
const tableInterfaceName = `I${(0, schematics_utilities_1.classify)(tableName)}`;
|
|
40
36
|
if (body) {
|
|
41
|
-
(0, ts_morph_1.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
type: tableInterfaceName,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
37
|
+
(0, ts_morph_1.CoerceMappingClassMethod)(sourceFile, classDeclaration, {
|
|
38
|
+
name: 'getBody',
|
|
39
|
+
parameterType: tableInterfaceName,
|
|
40
|
+
mapping: body,
|
|
48
41
|
returnType: (0, operation_id_utilities_1.OperationIdToRequestBodyClassName)(operationId),
|
|
49
|
-
|
|
50
|
-
w => {
|
|
51
|
-
w.write('return ');
|
|
52
|
-
ts_morph_2.Writers.object(toMappingObject(parameters))(w);
|
|
53
|
-
w.write(';');
|
|
54
|
-
},
|
|
55
|
-
],
|
|
42
|
+
mappingOptions: toMappingObjectOptions,
|
|
56
43
|
});
|
|
57
44
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
58
45
|
namedImports: [(0, operation_id_utilities_1.OperationIdToRequestBodyClassName)(operationId)],
|
|
@@ -61,21 +48,12 @@ function CoerceOpenApiTableActionRule(options) {
|
|
|
61
48
|
statements.push(`const requestBody = this.getBody(parameters);`);
|
|
62
49
|
}
|
|
63
50
|
if (parameters) {
|
|
64
|
-
(0, ts_morph_1.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
type: tableInterfaceName,
|
|
69
|
-
},
|
|
70
|
-
],
|
|
51
|
+
(0, ts_morph_1.CoerceMappingClassMethod)(sourceFile, classDeclaration, {
|
|
52
|
+
name: 'getParameters',
|
|
53
|
+
parameterType: tableInterfaceName,
|
|
54
|
+
mapping: parameters,
|
|
71
55
|
returnType: (0, operation_id_utilities_1.OperationIdToParameterClassName)(operationId),
|
|
72
|
-
|
|
73
|
-
w => {
|
|
74
|
-
w.write('return ');
|
|
75
|
-
ts_morph_2.Writers.object(toMappingObject(parameters))(w);
|
|
76
|
-
w.write(';');
|
|
77
|
-
},
|
|
78
|
-
],
|
|
56
|
+
mappingOptions: toMappingObjectOptions,
|
|
79
57
|
});
|
|
80
58
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
81
59
|
namedImports: [(0, operation_id_utilities_1.OperationIdToParameterClassName)(operationId)],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-open-api-table-action.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-open-api-table-action.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"coerce-open-api-table-action.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-open-api-table-action.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,6CAGwB;AACxB,uCAAiC;AACjC,0EAAqE;AACrE,2EAOwC;AACxC,+DAA2D;AAC3D,2FAAsF;AACtF,+DAG+B;AAS/B,MAAM,sBAAsB,GAA2B;IACrD,QAAQ,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;QACvC,IAAI,CAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YACpD,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF,SAAgB,4BAA4B,CAAC,OAA4C;IACvF,IAAI,EACF,gBAAgB,EAChB,WAAW,EACX,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,KAAK,EACL,SAAS,GACV,GAAG,OAAO,CAAC;IACZ,gBAAgB,aAAhB,gBAA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,CAAC,CAAC;gBACH,UAAU,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;aAClE;YACD,IAAI,UAAU,EAAE;gBACd,IAAA,mCAAwB,EAAC,UAAU,EAAE,gBAAgB,EAAE;oBACrD,IAAI,EAAE,eAAe;oBACrB,aAAa,EAAE,kBAAkB;oBACjC,OAAO,EAAE,UAAU;oBACnB,UAAU,EAAE,IAAA,wDAA+B,EAAC,WAAW,CAAC;oBACxD,cAAc,EAAE,sBAAsB;iBACvC,CAAC,CAAC;gBACH,IAAA,8BAAa,EAAC,UAAU,EAAE;oBACxB,YAAY,EAAE,CAAE,IAAA,wDAA+B,EAAC,WAAW,CAAC,CAAE;oBAC9D,eAAe,EAAE,IAAA,8DAAqC,EAAC,WAAW,EAAE,KAAK,CAAC;iBAC3E,CAAC,CAAC;gBACH,UAAU,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;aAC9E;YAED,IAAI,IAAI,IAAI,UAAU,EAAE;gBACtB,UAAU,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;aAC7F;iBAAM,IAAI,IAAI,EAAE;gBACf,UAAU,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;aAC9D;iBAAM,IAAI,UAAU,EAAE;gBACrB,UAAU,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;aAChF;YAED,uBACE,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,cAAc,IACvB,gBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAC3D;QACJ,CAAC,IACD,CAAC;AAEL,CAAC;AAhFD,oEAgFC"}
|
|
@@ -1,13 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
3
|
+
*/
|
|
1
4
|
export declare function OperationIdToClassName(operationId: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
7
|
+
*/
|
|
2
8
|
export declare function ServiceOperationIdToClassName(operationId: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
11
|
+
*/
|
|
3
12
|
export declare function OperationIdToResponseClassName(operationId: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
15
|
+
*/
|
|
4
16
|
export declare function OperationIdToParameterClassName(operationId: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
19
|
+
*/
|
|
5
20
|
export declare function OperationIdToClassImportPath(operationId: string, scope?: string | null): string;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
23
|
+
*/
|
|
6
24
|
export declare function OperationIdToRequestBodyClassName(operationId: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
27
|
+
*/
|
|
7
28
|
export declare function ServiceOperationIdToClassImportPath(operationId: string, scope?: string | null): string;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
31
|
+
*/
|
|
8
32
|
export declare function OpenApiResponseClassImportPath(response: string, serverId: string, scope?: string | null): string;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
35
|
+
*/
|
|
9
36
|
export declare function OperationIdToResponseClassImportPath(operationId: string, scope?: string | null): string;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
39
|
+
*/
|
|
10
40
|
export declare function OperationIdToParameterClassImportPath(operationId: string, scope?: string | null): string;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
43
|
+
*/
|
|
11
44
|
export declare function OperationIdToRequestBodyClassImportPath(operationId: string, scope?: string | null): string;
|
|
12
45
|
export declare function buildOperationId(options: {
|
|
13
46
|
project: string;
|
|
@@ -3,26 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildOperationId = exports.OperationIdToRequestBodyClassImportPath = exports.OperationIdToParameterClassImportPath = exports.OperationIdToResponseClassImportPath = exports.OpenApiResponseClassImportPath = exports.ServiceOperationIdToClassImportPath = exports.OperationIdToRequestBodyClassName = exports.OperationIdToClassImportPath = exports.OperationIdToParameterClassName = exports.OperationIdToResponseClassName = exports.ServiceOperationIdToClassName = exports.OperationIdToClassName = void 0;
|
|
4
4
|
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
5
|
const project_utilities_1 = require("./project-utilities");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
8
|
+
*/
|
|
6
9
|
function OperationIdToClassName(operationId) {
|
|
7
10
|
const [id] = operationId.split('@');
|
|
8
11
|
return (0, schematics_utilities_1.classify)(id) + 'RemoteMethod';
|
|
9
12
|
}
|
|
10
13
|
exports.OperationIdToClassName = OperationIdToClassName;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
16
|
+
*/
|
|
11
17
|
function ServiceOperationIdToClassName(operationId) {
|
|
12
18
|
const [id] = operationId.split('@');
|
|
13
19
|
return (0, schematics_utilities_1.classify)(id) + 'Command';
|
|
14
20
|
}
|
|
15
21
|
exports.ServiceOperationIdToClassName = ServiceOperationIdToClassName;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
24
|
+
*/
|
|
16
25
|
function OperationIdToResponseClassName(operationId) {
|
|
17
26
|
const [id] = operationId.split('@');
|
|
18
27
|
return (0, schematics_utilities_1.classify)(id) + 'Response';
|
|
19
28
|
}
|
|
20
29
|
exports.OperationIdToResponseClassName = OperationIdToResponseClassName;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
32
|
+
*/
|
|
21
33
|
function OperationIdToParameterClassName(operationId) {
|
|
22
34
|
const [id] = operationId.split('@');
|
|
23
35
|
return (0, schematics_utilities_1.classify)(id) + 'Parameter';
|
|
24
36
|
}
|
|
25
37
|
exports.OperationIdToParameterClassName = OperationIdToParameterClassName;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
40
|
+
*/
|
|
26
41
|
function OperationIdToClassImportPath(operationId, scope) {
|
|
27
42
|
let [id, serverId] = operationId.split('@');
|
|
28
43
|
serverId !== null && serverId !== void 0 ? serverId : (serverId = 'legacy');
|
|
@@ -34,11 +49,17 @@ function OperationIdToClassImportPath(operationId, scope) {
|
|
|
34
49
|
}
|
|
35
50
|
}
|
|
36
51
|
exports.OperationIdToClassImportPath = OperationIdToClassImportPath;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
54
|
+
*/
|
|
37
55
|
function OperationIdToRequestBodyClassName(operationId) {
|
|
38
56
|
const [id] = operationId.split('@');
|
|
39
57
|
return (0, schematics_utilities_1.classify)(id) + 'RequestBody';
|
|
40
58
|
}
|
|
41
59
|
exports.OperationIdToRequestBodyClassName = OperationIdToRequestBodyClassName;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
62
|
+
*/
|
|
42
63
|
function ServiceOperationIdToClassImportPath(operationId, scope) {
|
|
43
64
|
let [id, serverId] = operationId.split('@');
|
|
44
65
|
serverId !== null && serverId !== void 0 ? serverId : (serverId = 'legacy');
|
|
@@ -50,6 +71,9 @@ function ServiceOperationIdToClassImportPath(operationId, scope) {
|
|
|
50
71
|
}
|
|
51
72
|
}
|
|
52
73
|
exports.ServiceOperationIdToClassImportPath = ServiceOperationIdToClassImportPath;
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
76
|
+
*/
|
|
53
77
|
function OpenApiResponseClassImportPath(response, serverId, scope) {
|
|
54
78
|
if (scope) {
|
|
55
79
|
return `${scope}/open-api-${(0, schematics_utilities_1.dasherize)(serverId)}/responses/${(0, schematics_utilities_1.dasherize)(response)
|
|
@@ -61,6 +85,9 @@ function OpenApiResponseClassImportPath(response, serverId, scope) {
|
|
|
61
85
|
}
|
|
62
86
|
}
|
|
63
87
|
exports.OpenApiResponseClassImportPath = OpenApiResponseClassImportPath;
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
90
|
+
*/
|
|
64
91
|
function OperationIdToResponseClassImportPath(operationId, scope) {
|
|
65
92
|
let [id, serverId] = operationId.split('@');
|
|
66
93
|
serverId !== null && serverId !== void 0 ? serverId : (serverId = 'legacy');
|
|
@@ -72,6 +99,9 @@ function OperationIdToResponseClassImportPath(operationId, scope) {
|
|
|
72
99
|
}
|
|
73
100
|
}
|
|
74
101
|
exports.OperationIdToResponseClassImportPath = OperationIdToResponseClassImportPath;
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
104
|
+
*/
|
|
75
105
|
function OperationIdToParameterClassImportPath(operationId, scope) {
|
|
76
106
|
let [id, serverId] = operationId.split('@');
|
|
77
107
|
serverId !== null && serverId !== void 0 ? serverId : (serverId = 'legacy');
|
|
@@ -83,6 +113,9 @@ function OperationIdToParameterClassImportPath(operationId, scope) {
|
|
|
83
113
|
}
|
|
84
114
|
}
|
|
85
115
|
exports.OperationIdToParameterClassImportPath = OperationIdToParameterClassImportPath;
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated import from @rxap/ts-morph instead
|
|
118
|
+
*/
|
|
86
119
|
function OperationIdToRequestBodyClassImportPath(operationId, scope) {
|
|
87
120
|
let [id, serverId] = operationId.split('@');
|
|
88
121
|
serverId !== null && serverId !== void 0 ? serverId : (serverId = 'legacy');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-id-utilities.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/operation-id-utilities.ts"],"names":[],"mappings":";;;AAAA,qEAGoC;AACpC,2DAA2D;AAE3D,SAAgB,sBAAsB,CAAC,WAAmB;IACxD,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,+BAAQ,EAAC,EAAE,CAAC,GAAG,cAAc,CAAC;AACvC,CAAC;AAHD,wDAGC;AAED,SAAgB,6BAA6B,CAAC,WAAmB;IAC/D,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,+BAAQ,EAAC,EAAE,CAAC,GAAG,SAAS,CAAC;AAClC,CAAC;AAHD,sEAGC;
|
|
1
|
+
{"version":3,"file":"operation-id-utilities.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/operation-id-utilities.ts"],"names":[],"mappings":";;;AAAA,qEAGoC;AACpC,2DAA2D;AAE3D;;GAEG;AACH,SAAgB,sBAAsB,CAAC,WAAmB;IACxD,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,+BAAQ,EAAC,EAAE,CAAC,GAAG,cAAc,CAAC;AACvC,CAAC;AAHD,wDAGC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAAC,WAAmB;IAC/D,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,+BAAQ,EAAC,EAAE,CAAC,GAAG,SAAS,CAAC;AAClC,CAAC;AAHD,sEAGC;AAED;;GAEG;AACH,SAAgB,8BAA8B,CAAC,WAAmB;IAChE,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,+BAAQ,EAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AACnC,CAAC;AAHD,wEAGC;AAED;;GAEG;AACH,SAAgB,+BAA+B,CAAC,WAAmB;IACjE,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,G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