@rxap/ts-morph 1.1.0-dev.0 → 1.1.0-dev.10
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 +90 -0
- package/README.md +1 -1
- package/package.json +4 -4
- package/src/index.d.ts +11 -0
- package/src/index.js +11 -0
- package/src/index.js.map +1 -1
- package/src/lib/angular/coerce-component-import.d.ts +11 -0
- package/src/lib/angular/coerce-component-import.js +31 -0
- package/src/lib/angular/coerce-component-import.js.map +1 -0
- package/src/lib/angular/coerce-component-input.d.ts +18 -0
- package/src/lib/angular/coerce-component-input.js +67 -0
- package/src/lib/angular/coerce-component-input.js.map +1 -0
- package/src/lib/angular/coerce-component.d.ts +2 -2
- package/src/lib/angular/coerce-component.js +33 -20
- package/src/lib/angular/coerce-component.js.map +1 -1
- package/src/lib/angular/get-component-class.d.ts +2 -0
- package/src/lib/angular/get-component-class.js +12 -0
- package/src/lib/angular/get-component-class.js.map +1 -0
- package/src/lib/angular/get-component-decorator-object.d.ts +2 -0
- package/src/lib/angular/get-component-decorator-object.js +19 -0
- package/src/lib/angular/get-component-decorator-object.js.map +1 -0
- package/src/lib/coerce-accessor-declaration.d.ts +19 -0
- package/src/lib/coerce-accessor-declaration.js +38 -0
- package/src/lib/coerce-accessor-declaration.js.map +1 -0
- package/src/lib/coerce-array-element.d.ts +2 -1
- package/src/lib/coerce-array-element.js +14 -2
- package/src/lib/coerce-array-element.js.map +1 -1
- package/src/lib/coerce-class-property.d.ts +3 -0
- package/src/lib/coerce-class-property.js +3 -0
- package/src/lib/coerce-class-property.js.map +1 -1
- package/src/lib/coerce-decorator.js +5 -0
- package/src/lib/coerce-decorator.js.map +1 -1
- package/src/lib/coerce-default-class-export.d.ts +2 -0
- package/src/lib/coerce-default-class-export.js +27 -0
- package/src/lib/coerce-default-class-export.js.map +1 -0
- package/src/lib/coerce-property-declaration.d.ts +3 -0
- package/src/lib/coerce-property-declaration.js +13 -0
- package/src/lib/coerce-property-declaration.js.map +1 -0
- package/src/lib/data-property.d.ts +18 -0
- package/src/lib/data-property.js +82 -0
- package/src/lib/data-property.js.map +1 -0
- package/src/lib/find-function.js +1 -1
- package/src/lib/find-function.js.map +1 -1
- package/src/lib/has-constructor-parameter.d.ts +10 -0
- package/src/lib/has-constructor-parameter.js +17 -0
- package/src/lib/has-constructor-parameter.js.map +1 -0
- package/src/lib/nest/coerce-nest-operation.d.ts +6 -5
- package/src/lib/nest/coerce-nest-operation.js +30 -26
- package/src/lib/nest/coerce-nest-operation.js.map +1 -1
- package/src/lib/nest/operation-id-utilities.d.ts +4 -4
- package/src/lib/nest/operation-id-utilities.js +11 -11
- package/src/lib/nest/operation-id-utilities.js.map +1 -1
- package/src/lib/type-import.d.ts +13 -1
- package/src/lib/type-import.js +56 -1
- package/src/lib/type-import.js.map +1 -1
- package/src/lib/upstream-options.d.ts +45 -0
- package/src/lib/upstream-options.js +54 -0
- package/src/lib/upstream-options.js.map +1 -0
- package/src/lib/write-type.d.ts +18 -0
- package/src/lib/write-type.js +74 -0
- package/src/lib/write-type.js.map +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoerceArrayElement = exports.FindArrayElementByObjectProperty = void 0;
|
|
3
|
+
exports.CoerceArrayElement = exports.DefaultFindExistingElement = exports.FindArrayElementByObjectProperty = void 0;
|
|
4
4
|
const ts_morph_1 = require("ts-morph");
|
|
5
5
|
function FindArrayElementByObjectProperty(property, value) {
|
|
6
6
|
return (e) => {
|
|
@@ -17,7 +17,19 @@ function FindArrayElementByObjectProperty(property, value) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
exports.FindArrayElementByObjectProperty = FindArrayElementByObjectProperty;
|
|
20
|
-
function
|
|
20
|
+
function DefaultFindExistingElement(element) {
|
|
21
|
+
return (e) => e.getText().trim() === element;
|
|
22
|
+
}
|
|
23
|
+
exports.DefaultFindExistingElement = DefaultFindExistingElement;
|
|
24
|
+
function CoerceArrayElement(array, element, findExisting, insertAt) {
|
|
25
|
+
if (!findExisting) {
|
|
26
|
+
if (typeof element === 'string') {
|
|
27
|
+
findExisting = DefaultFindExistingElement(element);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new Error('The findExisting function is required or the element must be a string!');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
21
33
|
for (const e of array.getElements()) {
|
|
22
34
|
if (findExisting(e)) {
|
|
23
35
|
return e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-array-element.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-array-element.ts"],"names":[],"mappings":";;;AAAA,uCAOkB;AAElB,SAAgB,gCAAgC,CAAC,QAAgB,EAAE,KAAa;IAC9E,OAAO,CAAC,CAAa,EAAE,EAAE;QACvB,IAAI,CAAC,YAAY,kCAAuB,EAAE;YACxC,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,YAAY,6BAAkB,EAAE;gBACxC,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,qBAAU,CAAC,aAAa,CAAC,CAAC;gBAC3D,IAAI,CAAC,EAAE;oBACL,OAAO,CAAC,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC;iBACrC;aACF;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAbD,4EAaC;AAED,SAAgB,kBAAkB,CAChC,KAA6B,EAC7B,
|
|
1
|
+
{"version":3,"file":"coerce-array-element.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-array-element.ts"],"names":[],"mappings":";;;AAAA,uCAOkB;AAElB,SAAgB,gCAAgC,CAAC,QAAgB,EAAE,KAAa;IAC9E,OAAO,CAAC,CAAa,EAAE,EAAE;QACvB,IAAI,CAAC,YAA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ationStructure } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated instead use the CoercePropertyDeclaration function from @rxap/ts-morph
|
|
4
|
+
*/
|
|
2
5
|
export declare function CoerceClassProperty(classDeclaration: ClassDeclaration, propertyName: string, propertyStructure: Omit<OptionalKind<PropertyDeclarationStructure>, 'name'>): PropertyDeclaration;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceClassProperty = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated instead use the CoercePropertyDeclaration function from @rxap/ts-morph
|
|
6
|
+
*/
|
|
4
7
|
function CoerceClassProperty(classDeclaration, propertyName, propertyStructure) {
|
|
5
8
|
let propertyDeclaration = classDeclaration.getProperty(propertyName);
|
|
6
9
|
if (!propertyDeclaration) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-class-property.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-class-property.ts"],"names":[],"mappings":";;;AAOA,SAAgB,mBAAmB,CACjC,gBAAkC,EAClC,YAAoB,EACpB,iBAA2E;IAG3E,IAAI,mBAAmB,GAAG,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAErE,IAAI,CAAC,mBAAmB,EAAE;QACxB,mBAAmB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC,kCAClD,iBAAiB,KACpB,IAAI,EAAE,YAAY,IAClB,CAAC;KACJ;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAhBD,kDAgBC"}
|
|
1
|
+
{"version":3,"file":"coerce-class-property.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-class-property.ts"],"names":[],"mappings":";;;AAOA;;GAEG;AACH,SAAgB,mBAAmB,CACjC,gBAAkC,EAClC,YAAoB,EACpB,iBAA2E;IAG3E,IAAI,mBAAmB,GAAG,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAErE,IAAI,CAAC,mBAAmB,EAAE;QACxB,mBAAmB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC,kCAClD,iBAAiB,KACpB,IAAI,EAAE,YAAY,IAClB,CAAC;KACJ;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAhBD,kDAgBC"}
|
|
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CoerceDecorator = void 0;
|
|
4
4
|
const find_function_1 = require("./find-function");
|
|
5
5
|
function CoerceDecorator(decoratableNode, name, structure = {}, compareTo = find_function_1.FindByNameFunction) {
|
|
6
|
+
const match = name.match(/(.+)<(.+)>/);
|
|
7
|
+
if (match) {
|
|
8
|
+
name = match[1];
|
|
9
|
+
structure.typeArguments = match[2].split(',');
|
|
10
|
+
}
|
|
6
11
|
let decorator = decoratableNode.getDecorator(compareTo(Object.assign(Object.assign({}, structure), { name })));
|
|
7
12
|
if (!decorator) {
|
|
8
13
|
decorator = decoratableNode.addDecorator({ name });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-decorator.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-decorator.ts"],"names":[],"mappings":";;;AAMA,mDAGyB;AAEzB,SAAgB,eAAe,CAC7B,eAAgC,EAChC,IAAY,EACZ,YAAqE,EAAE,EACvE,YAA4F,kCAAkB;IAE9G,IAAI,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,SAAS,iCACjD,SAAS,KACZ,IAAI,IACJ,CAAC,CAAC;IACJ,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;KAC1B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"coerce-decorator.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-decorator.ts"],"names":[],"mappings":";;;AAMA,mDAGyB;AAEzB,SAAgB,eAAe,CAC7B,eAAgC,EAChC,IAAY,EACZ,YAAqE,EAAE,EACvE,YAA4F,kCAAkB;IAE9G,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACvC,IAAI,KAAK,EAAE;QACT,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAChB,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAC/C;IACD,IAAI,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,SAAS,iCACjD,SAAS,KACZ,IAAI,IACJ,CAAC,CAAC;IACJ,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;KAC1B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AApBD,0CAoBC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceDefaultClassExport = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
function CoerceDefaultClassExport(sourceFileOrClassDeclaration, standalone = false) {
|
|
6
|
+
const classDeclaration = sourceFileOrClassDeclaration instanceof ts_morph_1.SourceFile ? sourceFileOrClassDeclaration.getClasses().filter(cd => !cd.isDefaultExport())[0] : sourceFileOrClassDeclaration;
|
|
7
|
+
const sourceFile = sourceFileOrClassDeclaration instanceof ts_morph_1.SourceFile ? sourceFileOrClassDeclaration : sourceFileOrClassDeclaration.getSourceFile();
|
|
8
|
+
if (!ts_morph_1.ClassDeclaration) {
|
|
9
|
+
throw new Error('No class declaration');
|
|
10
|
+
}
|
|
11
|
+
if (standalone) {
|
|
12
|
+
console.log('standalone', sourceFile.getExportAssignments().map(ed => ed.getExpression().getText()));
|
|
13
|
+
if (!sourceFile.getExportAssignments().some(ed => ed.getExpression().getText() === classDeclaration.getName())) {
|
|
14
|
+
sourceFile.addExportAssignment({
|
|
15
|
+
isExportEquals: false,
|
|
16
|
+
expression: classDeclaration.getName(),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (!sourceFile.getClasses().some(cd => cd.isDefaultExport() && cd.getName() === classDeclaration.getName())) {
|
|
22
|
+
classDeclaration.setIsDefaultExport(true);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CoerceDefaultClassExport = CoerceDefaultClassExport;
|
|
27
|
+
//# sourceMappingURL=coerce-default-class-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerce-default-class-export.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-default-class-export.ts"],"names":[],"mappings":";;;AAAA,uCAGkB;AAElB,SAAgB,wBAAwB,CAAC,4BAA2D,EAAE,UAAU,GAAG,KAAK;IAEtH,MAAM,gBAAgB,GAAG,4BAA4B,YAAY,qBAAU,CAAC,CAAC,CAAC,4BAA4B,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC;IAC9L,MAAM,UAAU,GAAG,4BAA4B,YAAY,qBAAU,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,4BAA4B,CAAC,aAAa,EAAE,CAAC;IAEpJ,IAAI,CAAC,2BAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IAED,IAAI,UAAU,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,oBAAoB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACrG,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE;YAC9G,UAAU,CAAC,mBAAmB,CAAC;gBAC7B,cAAc,EAAE,KAAK;gBACrB,UAAU,EAAE,gBAAgB,CAAC,OAAO,EAAG;aACxC,CAAC,CAAC;SACJ;KACF;SAAM;QACL,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE;YAC5G,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;SAC3C;KACF;AAEH,CAAC;AAvBD,4DAuBC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ClassLikeDeclarationBase, PropertyDeclaration, PropertyDeclarationStructure, PropertySignature, TypeElementMemberedNode } from 'ts-morph';
|
|
2
|
+
export declare function CoercePropertyDeclaration(typeElementMemberedNode: TypeElementMemberedNode, name: string, structure?: Partial<PropertyDeclarationStructure>): PropertySignature;
|
|
3
|
+
export declare function CoercePropertyDeclaration(classLikeDeclarationBase: ClassLikeDeclarationBase, name: string, structure?: Partial<PropertyDeclarationStructure>): PropertyDeclaration;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoercePropertyDeclaration = void 0;
|
|
4
|
+
function CoercePropertyDeclaration(node, name, structure = {}) {
|
|
5
|
+
let property = node.getProperty(name);
|
|
6
|
+
if (!property) {
|
|
7
|
+
property = node.addProperty({ name });
|
|
8
|
+
property.set(structure);
|
|
9
|
+
}
|
|
10
|
+
return property;
|
|
11
|
+
}
|
|
12
|
+
exports.CoercePropertyDeclaration = CoercePropertyDeclaration;
|
|
13
|
+
//# sourceMappingURL=coerce-property-declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerce-property-declaration.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-property-declaration.ts"],"names":[],"mappings":";;;AAoBA,SAAgB,yBAAyB,CACvC,IAAwD,EACxD,IAAY,EACZ,YAA+H,EAAE;IAEjI,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,QAAQ,CAAC,GAAG,CAAC,SAAgB,CAAC,CAAC;KAChC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAXD,8DAWC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypeImport, TypeName } from '@rxap/ts-morph';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
import { OptionalKind, PropertySignatureStructure, SourceFile } from 'ts-morph';
|
|
4
|
+
import { NormalizedTypeImport } from './type-import';
|
|
5
|
+
export interface DataProperty {
|
|
6
|
+
name: string;
|
|
7
|
+
type?: TypeImport | TypeName;
|
|
8
|
+
isArray?: boolean;
|
|
9
|
+
isOptional?: boolean;
|
|
10
|
+
source?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface NormalizedDataProperty extends Readonly<Normalized<DataProperty>> {
|
|
13
|
+
type: NormalizedTypeImport;
|
|
14
|
+
source: string | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function NormalizeDataProperty(property: TypeName | Readonly<DataProperty>, defaultType?: TypeImport | TypeName, isArray?: boolean): NormalizedDataProperty;
|
|
17
|
+
export declare function NormalizeDataPropertyList(propertyList?: Array<string | DataProperty>, defaultType?: string): Array<NormalizedDataProperty>;
|
|
18
|
+
export declare function NormalizeDataPropertyToPropertySignatureStructure(property: DataProperty, sourceFile: SourceFile): OptionalKind<PropertySignatureStructure>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeDataPropertyToPropertySignatureStructure = exports.NormalizeDataPropertyList = exports.NormalizeDataProperty = void 0;
|
|
4
|
+
const type_import_1 = require("./type-import");
|
|
5
|
+
const write_type_1 = require("./write-type");
|
|
6
|
+
function guessType(name) {
|
|
7
|
+
switch (name) {
|
|
8
|
+
case 'uuid':
|
|
9
|
+
case 'name':
|
|
10
|
+
return 'string';
|
|
11
|
+
case 'icon':
|
|
12
|
+
return {
|
|
13
|
+
name: 'IconConfig',
|
|
14
|
+
moduleSpecifier: '@rxap/utilities',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (name.match(/Uuid$/)) {
|
|
18
|
+
return 'string';
|
|
19
|
+
}
|
|
20
|
+
if (name.match(/Name$/)) {
|
|
21
|
+
return 'string';
|
|
22
|
+
}
|
|
23
|
+
if (name.match(/^(is|has)[A-Z]/)) {
|
|
24
|
+
return 'boolean';
|
|
25
|
+
}
|
|
26
|
+
return 'unknown';
|
|
27
|
+
}
|
|
28
|
+
function NormalizeDataProperty(property, defaultType = 'unknown', isArray = false) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
let name;
|
|
31
|
+
let type = 'unknown';
|
|
32
|
+
let isOptional = false;
|
|
33
|
+
let source = null;
|
|
34
|
+
if (typeof property === 'string') {
|
|
35
|
+
// name:type
|
|
36
|
+
// username:string
|
|
37
|
+
const fragments = property.split(':');
|
|
38
|
+
name = fragments[0];
|
|
39
|
+
type = fragments[1] || type; // convert an empty string to undefined
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
name = property.name;
|
|
43
|
+
type = (_a = property.type) !== null && _a !== void 0 ? _a : type;
|
|
44
|
+
isArray = (_b = property.isArray) !== null && _b !== void 0 ? _b : isArray;
|
|
45
|
+
isOptional = (_c = property.isOptional) !== null && _c !== void 0 ? _c : isOptional;
|
|
46
|
+
source = (_d = property.source) !== null && _d !== void 0 ? _d : source;
|
|
47
|
+
}
|
|
48
|
+
if (name.endsWith('[]')) {
|
|
49
|
+
isArray = true;
|
|
50
|
+
name = name.slice(0, -2);
|
|
51
|
+
}
|
|
52
|
+
if (name.startsWith('Array<') && name.endsWith('>')) {
|
|
53
|
+
isArray = true;
|
|
54
|
+
name = name.slice(6, -1);
|
|
55
|
+
}
|
|
56
|
+
type !== null && type !== void 0 ? type : (type = defaultType);
|
|
57
|
+
if (type === 'unknown') {
|
|
58
|
+
type = guessType(name);
|
|
59
|
+
}
|
|
60
|
+
name = name.replace(/\.\?/g, '.').split('.').join('.?');
|
|
61
|
+
return Object.freeze({
|
|
62
|
+
name,
|
|
63
|
+
type: (0, type_import_1.NormalizeTypeImport)(type),
|
|
64
|
+
isArray,
|
|
65
|
+
isOptional,
|
|
66
|
+
source,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.NormalizeDataProperty = NormalizeDataProperty;
|
|
70
|
+
function NormalizeDataPropertyList(propertyList, defaultType = 'unknown') {
|
|
71
|
+
var _a;
|
|
72
|
+
return (_a = propertyList === null || propertyList === void 0 ? void 0 : propertyList.map(property => NormalizeDataProperty(property, defaultType))) !== null && _a !== void 0 ? _a : [];
|
|
73
|
+
}
|
|
74
|
+
exports.NormalizeDataPropertyList = NormalizeDataPropertyList;
|
|
75
|
+
function NormalizeDataPropertyToPropertySignatureStructure(property, sourceFile) {
|
|
76
|
+
return {
|
|
77
|
+
type: (0, write_type_1.WriteType)(property, sourceFile),
|
|
78
|
+
name: property.name,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.NormalizeDataPropertyToPropertySignatureStructure = NormalizeDataPropertyToPropertySignatureStructure;
|
|
82
|
+
//# sourceMappingURL=data-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-property.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/data-property.ts"],"names":[],"mappings":";;;AAUA,+CAGuB;AACvB,6CAAyC;AAezC,SAAS,SAAS,CAAC,IAAY;IAC7B,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,YAAY;gBAClB,eAAe,EAAE,iBAAiB;aACnC,CAAC;KACL;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;QACvB,OAAO,QAAQ,CAAC;KACjB;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;QACvB,OAAO,QAAQ,CAAC;KACjB;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE;QAChC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,qBAAqB,CAAC,QAA2C,EAAE,cAAqC,SAAS,EAAE,OAAO,GAAG,KAAK;;IAChJ,IAAI,IAAY,CAAC;IACjB,IAAI,IAAI,GAAwB,SAAS,CAAC;IAC1C,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,YAAY;QACZ,kBAAkB;QAClB,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,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WAAW,GAAG,SAAS;;IAC5G,OAAO,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,mCAAI,EAAE,CAAC;AAC3F,CAAC;AAFD,8DAEC;AAED,SAAgB,iDAAiD,CAC/D,QAAsB,EACtB,UAAsB;IAEtB,OAAO;QACL,IAAI,EAAE,IAAA,sBAAS,EAAC,QAAQ,EAAE,UAAU,CAAC;QACrC,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAC;AACJ,CAAC;AARD,8GAQC"}
|
package/src/lib/find-function.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FindByNameFunction = void 0;
|
|
4
4
|
function FindByNameFunction(compareTo) {
|
|
5
|
-
return node => node.getName() === compareTo.name;
|
|
5
|
+
return node => { var _a; return ((_a = node.getName()) === null || _a === void 0 ? void 0 : _a.trim()) === compareTo.name; };
|
|
6
6
|
}
|
|
7
7
|
exports.FindByNameFunction = FindByNameFunction;
|
|
8
8
|
//# sourceMappingURL=find-function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-function.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/find-function.ts"],"names":[],"mappings":";;;AAIA,SAAgB,kBAAkB,CAGhC,SAAoB;IACpB,OAAO,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"find-function.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/find-function.ts"],"names":[],"mappings":";;;AAIA,SAAgB,kBAAkB,CAGhC,SAAoB;IACpB,OAAO,IAAI,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,IAAI,CAAC,OAAO,EAAE,0CAAE,IAAI,EAAE,MAAK,SAAS,CAAC,IAAI,CAAA,EAAA,CAAC;AAC3D,CAAC;AALD,gDAKC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClassDeclaration } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a constructor parameter with the given name exists in a class.
|
|
4
|
+
*
|
|
5
|
+
* @param {ClassDeclaration} classDeclaration - The class declaration to check.
|
|
6
|
+
* @param {string} parameterName - The name of the constructor parameter.
|
|
7
|
+
* @param {boolean} isAlsoClassMember - Optional. Determines if only constructor parameter that are also class members are checked. Default is false.
|
|
8
|
+
* @returns {boolean} - True if a constructor parameter with the given name exists, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HasConstructorParameter(classDeclaration: ClassDeclaration, parameterName: string, isAlsoClassMember?: boolean): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HasConstructorParameter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a constructor parameter with the given name exists in a class.
|
|
6
|
+
*
|
|
7
|
+
* @param {ClassDeclaration} classDeclaration - The class declaration to check.
|
|
8
|
+
* @param {string} parameterName - The name of the constructor parameter.
|
|
9
|
+
* @param {boolean} isAlsoClassMember - Optional. Determines if only constructor parameter that are also class members are checked. Default is false.
|
|
10
|
+
* @returns {boolean} - True if a constructor parameter with the given name exists, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
function HasConstructorParameter(classDeclaration, parameterName, isAlsoClassMember = false) {
|
|
13
|
+
return classDeclaration.getConstructors().some(cotr => cotr.getParameters()
|
|
14
|
+
.some(param => (!isAlsoClassMember || !!param.getScope()) && param.getName() === parameterName));
|
|
15
|
+
}
|
|
16
|
+
exports.HasConstructorParameter = HasConstructorParameter;
|
|
17
|
+
//# sourceMappingURL=has-constructor-parameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-constructor-parameter.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/has-constructor-parameter.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CACrC,gBAAkC,EAClC,aAAqB,EACrB,iBAAiB,GAAG,KAAK;IAEzB,OAAO,gBAAgB,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;SACxE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,KAAK,aAAa,CAAC,CAAC,CAAC;AACrG,CAAC;AAPD,0DAOC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ClassDeclaration, DecoratorStructure, MethodDeclaration, OptionalKind, SourceFile, StatementStructures, WriterFunction } from 'ts-morph';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { DataProperty } from '../data-property';
|
|
3
|
+
import { TypeImport } from '../type-import';
|
|
4
|
+
export interface OperationParameter extends DataProperty {
|
|
5
|
+
type?: string | WriterFunction | TypeImport;
|
|
6
|
+
pipeList?: Array<string | WriterFunction | TypeImport>;
|
|
6
7
|
defaultValue?: string | WriterFunction;
|
|
8
|
+
hasQuestionToken?: boolean;
|
|
7
9
|
required?: boolean;
|
|
8
|
-
isArray?: boolean;
|
|
9
10
|
/**
|
|
10
11
|
* (optional) the method parameter name. If not defined the name property will be used
|
|
11
12
|
*/
|
|
@@ -7,8 +7,9 @@ const coerce_class_method_1 = require("../coerce-class-method");
|
|
|
7
7
|
const coerce_decorator_1 = require("../coerce-decorator");
|
|
8
8
|
const coerce_imports_1 = require("../coerce-imports");
|
|
9
9
|
const coerce_statements_1 = require("../coerce-statements");
|
|
10
|
+
const write_type_1 = require("../write-type");
|
|
10
11
|
const get_controller_class_1 = require("./get-controller-class");
|
|
11
|
-
function buildMethodQueryParameters(queryList,
|
|
12
|
+
function buildMethodQueryParameters(queryList, sourceFile) {
|
|
12
13
|
if (queryList.length) {
|
|
13
14
|
return queryList.map(query => {
|
|
14
15
|
var _a, _b;
|
|
@@ -16,7 +17,7 @@ function buildMethodQueryParameters(queryList, importStructures) {
|
|
|
16
17
|
undefined) {
|
|
17
18
|
return query;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
20
21
|
namedImports: ['DefaultValuePipe'],
|
|
21
22
|
moduleSpecifier: '@nestjs/common',
|
|
22
23
|
});
|
|
@@ -35,35 +36,38 @@ function buildMethodQueryParameters(queryList, importStructures) {
|
|
|
35
36
|
w.write(')');
|
|
36
37
|
});
|
|
37
38
|
return Object.assign(Object.assign({}, query), { pipeList });
|
|
38
|
-
}).map(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
}).map(({ alias, name, type, hasQuestionToken, required, defaultValue, pipeList = [], isArray, }) => ({
|
|
40
|
+
name: alias !== null && alias !== void 0 ? alias : name,
|
|
41
|
+
type: (0, write_type_1.WriteType)({ type: type !== null && type !== void 0 ? type : 'unknown', isArray: isArray }, sourceFile),
|
|
42
|
+
hasQuestionToken: hasQuestionToken !== null && hasQuestionToken !== void 0 ? hasQuestionToken : (!required && defaultValue === undefined),
|
|
43
|
+
decorators: [
|
|
44
|
+
{
|
|
45
|
+
name: 'Query',
|
|
46
|
+
arguments: [
|
|
47
|
+
w => w.quote(name),
|
|
48
|
+
...pipeList.map(pipe => {
|
|
49
|
+
if (typeof pipe === 'string') {
|
|
50
|
+
return pipe;
|
|
51
|
+
}
|
|
52
|
+
if (typeof pipe === 'function') {
|
|
53
|
+
return pipe;
|
|
54
|
+
}
|
|
55
|
+
return (0, write_type_1.WriteType)(pipe, sourceFile);
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
}));
|
|
57
61
|
}
|
|
58
62
|
return [];
|
|
59
63
|
}
|
|
60
|
-
function buildMethodParamParameters(paramList) {
|
|
64
|
+
function buildMethodParamParameters(paramList, sourceFile) {
|
|
61
65
|
if (paramList.length) {
|
|
62
66
|
return paramList.map(param => {
|
|
63
|
-
var _a;
|
|
67
|
+
var _a, _b;
|
|
64
68
|
return ({
|
|
65
69
|
name: (_a = param.alias) !== null && _a !== void 0 ? _a : param.name,
|
|
66
|
-
type: param.type,
|
|
70
|
+
type: (0, write_type_1.WriteType)({ type: (_b = param.type) !== null && _b !== void 0 ? _b : 'unknown', isArray: param.isArray }, sourceFile),
|
|
67
71
|
decorators: [
|
|
68
72
|
{
|
|
69
73
|
name: 'Param',
|
|
@@ -208,8 +212,8 @@ function CoerceNestOperation(sourceFile, options) {
|
|
|
208
212
|
scope: ts_morph_1.Scope.Public,
|
|
209
213
|
isAsync,
|
|
210
214
|
parameters: [
|
|
211
|
-
...buildMethodQueryParameters(queryList,
|
|
212
|
-
...buildMethodParamParameters(paramList),
|
|
215
|
+
...buildMethodQueryParameters(queryList, sourceFile),
|
|
216
|
+
...buildMethodParamParameters(paramList, sourceFile),
|
|
213
217
|
...buildMethodBodyParameters(body),
|
|
214
218
|
].sort((a, b) => {
|
|
215
219
|
if (a.hasQuestionToken && b.hasQuestionToken) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-nest-operation.js","sourceRoot":"","sources":["../../../../../../packages/ts-morph/src/lib/nest/coerce-nest-operation.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AACzB,uCAckB;AAClB,gEAA2D;AAC3D,0DAAsD;AACtD,sDAAkD;AAClD,4DAAwD;
|
|
1
|
+
{"version":3,"file":"coerce-nest-operation.js","sourceRoot":"","sources":["../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UAAU,CAAC,CAAC,CAAC,CAAC;iBACf;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;iBACxE;gBACD,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,iBAAiB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;SAC7C;KACF;IAED,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC7B,IAAA,kCAAe,EAAC,iBAAiB,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAA,kCAAe,EAAC,iBAAiB,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAK,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SAC3F,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAK,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC3D,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACvD,IAAA,oCAAgB,EACd,iBAAiB,EACjB,UAAU,CACX,CAAC;IAEF,IAAA,8BAAa,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAE5C,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAE3E,OAAO,iBAAiB,CAAC;AAE3B,CAAC;AAzJD,kDAyJC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function
|
|
1
|
+
export declare function OperationIdToRemoteMethodClassName(operationId: string): string;
|
|
2
|
+
export declare function OperationIdToCommandClassName(operationId: string): string;
|
|
3
3
|
export declare function OperationIdToResponseClassName(operationId: string): string;
|
|
4
4
|
export declare function OperationIdToParameterClassName(operationId: string): string;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function OperationIdToClassRemoteMethodImportPath(operationId: string, scope?: string | null): string;
|
|
6
6
|
export declare function OperationIdToRequestBodyClassName(operationId: string): string;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function OperationIdToCommandClassImportPath(operationId: string, scope?: string | null, isService?: boolean): string;
|
|
8
8
|
export declare function OpenApiResponseClassImportPath(response: string, serverId: string, scope?: string | null): string;
|
|
9
9
|
export declare function OperationIdToResponseClassImportPath(operationId: string, scope?: string | null): string;
|
|
10
10
|
export declare function OperationIdToParameterClassImportPath(operationId: string, scope?: string | null): string;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OperationIdToRequestBodyClassImportPath = exports.OperationIdToParameterClassImportPath = exports.OperationIdToResponseClassImportPath = exports.OpenApiResponseClassImportPath = exports.
|
|
3
|
+
exports.OperationIdToRequestBodyClassImportPath = exports.OperationIdToParameterClassImportPath = exports.OperationIdToResponseClassImportPath = exports.OpenApiResponseClassImportPath = exports.OperationIdToCommandClassImportPath = exports.OperationIdToRequestBodyClassName = exports.OperationIdToClassRemoteMethodImportPath = exports.OperationIdToParameterClassName = exports.OperationIdToResponseClassName = exports.OperationIdToCommandClassName = exports.OperationIdToRemoteMethodClassName = void 0;
|
|
4
4
|
const utilities_1 = require("@rxap/utilities");
|
|
5
|
-
function
|
|
5
|
+
function OperationIdToRemoteMethodClassName(operationId) {
|
|
6
6
|
const [id] = operationId.split('@');
|
|
7
7
|
return (0, utilities_1.classify)(id) + 'RemoteMethod';
|
|
8
8
|
}
|
|
9
|
-
exports.
|
|
10
|
-
function
|
|
9
|
+
exports.OperationIdToRemoteMethodClassName = OperationIdToRemoteMethodClassName;
|
|
10
|
+
function OperationIdToCommandClassName(operationId) {
|
|
11
11
|
const [id] = operationId.split('@');
|
|
12
12
|
return (0, utilities_1.classify)(id) + 'Command';
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
14
|
+
exports.OperationIdToCommandClassName = OperationIdToCommandClassName;
|
|
15
15
|
function OperationIdToResponseClassName(operationId) {
|
|
16
16
|
const [id] = operationId.split('@');
|
|
17
17
|
return (0, utilities_1.classify)(id) + 'Response';
|
|
@@ -22,7 +22,7 @@ function OperationIdToParameterClassName(operationId) {
|
|
|
22
22
|
return (0, utilities_1.classify)(id) + 'Parameter';
|
|
23
23
|
}
|
|
24
24
|
exports.OperationIdToParameterClassName = OperationIdToParameterClassName;
|
|
25
|
-
function
|
|
25
|
+
function OperationIdToClassRemoteMethodImportPath(operationId, scope) {
|
|
26
26
|
const [id, serverId = 'legacy'] = operationId.split('@');
|
|
27
27
|
if (scope) {
|
|
28
28
|
return `${scope}/open-api-${(0, utilities_1.dasherize)(serverId)}/remote-methods/${(0, utilities_1.dasherize)(id)}.remote-method`;
|
|
@@ -31,22 +31,22 @@ function OperationIdToClassImportPath(operationId, scope) {
|
|
|
31
31
|
return `open-api-${(0, utilities_1.dasherize)(serverId)}/remote-methods/${(0, utilities_1.dasherize)(id)}.remote-method`;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
exports.
|
|
34
|
+
exports.OperationIdToClassRemoteMethodImportPath = OperationIdToClassRemoteMethodImportPath;
|
|
35
35
|
function OperationIdToRequestBodyClassName(operationId) {
|
|
36
36
|
const [id] = operationId.split('@');
|
|
37
37
|
return (0, utilities_1.classify)(id) + 'RequestBody';
|
|
38
38
|
}
|
|
39
39
|
exports.OperationIdToRequestBodyClassName = OperationIdToRequestBodyClassName;
|
|
40
|
-
function
|
|
40
|
+
function OperationIdToCommandClassImportPath(operationId, scope, isService = false) {
|
|
41
41
|
const [id, serverId = 'legacy'] = operationId.split('@');
|
|
42
42
|
if (scope) {
|
|
43
|
-
return `${scope}
|
|
43
|
+
return `${scope}/${isService ? 'service-' : ''}open-api-${(0, utilities_1.dasherize)(serverId)}/commands/${(0, utilities_1.dasherize)(id)}.command`;
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
return
|
|
46
|
+
return `${isService ? 'service-' : ''}open-api-${(0, utilities_1.dasherize)(serverId)}/commands/${(0, utilities_1.dasherize)(id)}.command`;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
exports.
|
|
49
|
+
exports.OperationIdToCommandClassImportPath = OperationIdToCommandClassImportPath;
|
|
50
50
|
function OpenApiResponseClassImportPath(response, serverId, scope) {
|
|
51
51
|
if (scope) {
|
|
52
52
|
return `${scope}/open-api-${(0, utilities_1.dasherize)(serverId)}/responses/${(0, utilities_1.dasherize)(response)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-id-utilities.js","sourceRoot":"","sources":["../../../../../../packages/ts-morph/src/lib/nest/operation-id-utilities.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AAGzB,SAAgB,
|
|
1
|
+
{"version":3,"file":"operation-id-utilities.js","sourceRoot":"","sources":["../../../../../../packages/ts-morph/src/lib/nest/operation-id-utilities.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AAGzB,SAAgB,kCAAkC,CAAC,WAAmB;IACpE,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,oBAAQ,EAAC,EAAE,CAAC,GAAG,cAAc,CAAC;AACvC,CAAC;AAHD,gFAGC;AAED,SAAgB,6BAA6B,CAAC,WAAmB;IAC/D,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,oBAAQ,EAAC,EAAE,CAAC,GAAG,SAAS,CAAC;AAClC,CAAC;AAHD,sEAGC;AAGD,SAAgB,8BAA8B,CAAC,WAAmB;IAChE,MAAM,CAAE,EAAE,CAAE,GA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,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,KAAK,EAAE;QACT,OAAO,GAAI,KAAM,aAAc,IAAA,qBAAS,EAAC,QAAQ,CAAE,eAAgB,IAAA,qBAAS,EAAC,EAAE,CAAE,YAAY,CAAC;KAC/F;SAAM;QACL,OAAO,YAAa,IAAA,qBAAS,EAAC,QAAQ,CAAE,eAAgB,IAAA,qBAAS,EAAC,EAAE,CAAE,YAAY,CAAC;KACpF;AACH,CAAC;AAPD,sFAOC;AAED,SAAgB,uCAAuC,CAAC,WAAmB,EAAE,KAAqB;IAChG,MAAM,CAAE,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,KAAK,EAAE;QACT,OAAO,GAAI,KAAM,aAAc,IAAA,qBAAS,EAAC,QAAQ,CAAE,mBAAoB,IAAA,qBAAS,EAAC,EAAE,CAAE,eAAe,CAAC;KACtG;SAAM;QACL,OAAO,YAAa,IAAA,qBAAS,EAAC,QAAQ,CAAE,mBAAoB,IAAA,qBAAS,EAAC,EAAE,CAAE,eAAe,CAAC;KAC3F;AACH,CAAC;AAPD,0FAOC"}
|
package/src/lib/type-import.d.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { ImportDeclarationStructure, OptionalKind } from 'ts-morph';
|
|
2
|
+
export type TypeName = string | '<self>' | '<deferred>' | 'unknown' | 'string' | 'number' | 'boolean' | 'any';
|
|
2
3
|
export interface TypeImport {
|
|
3
|
-
name:
|
|
4
|
+
name: TypeName;
|
|
4
5
|
moduleSpecifier?: string | null;
|
|
5
6
|
namedImport?: string | null;
|
|
6
7
|
namespaceImport?: string | null;
|
|
7
8
|
isTypeOnly?: boolean | null;
|
|
8
9
|
defaultImport?: string | null;
|
|
9
10
|
}
|
|
11
|
+
export declare function IsTypeImport(value: any): value is TypeImport;
|
|
10
12
|
export declare function RequiresTypeImport(typeImport: TypeImport): boolean;
|
|
11
13
|
export declare function TypeImportToImportStructure(typeImport: TypeImport): OptionalKind<ImportDeclarationStructure>;
|
|
14
|
+
export interface NormalizedTypeImport {
|
|
15
|
+
name: string | '<self>' | '<deferred>';
|
|
16
|
+
moduleSpecifier: string | null;
|
|
17
|
+
namedImport: string | null;
|
|
18
|
+
namespaceImport: string | null;
|
|
19
|
+
isTypeOnly: boolean | null;
|
|
20
|
+
defaultImport: string | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function NormalizeTypeImport(typeImport?: Readonly<TypeImport> | string, defaultType?: TypeImport | string): NormalizedTypeImport;
|
|
23
|
+
export declare function NormalizeTypeImportList(typeImportList?: Array<TypeImport | string>, defaultType?: string): NormalizedTypeImport[];
|