@rxap/ts-morph 1.1.0-dev.0 → 1.1.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/package.json +4 -4
  4. package/src/index.d.ts +11 -0
  5. package/src/index.js +11 -0
  6. package/src/index.js.map +1 -1
  7. package/src/lib/angular/coerce-component-import.d.ts +11 -0
  8. package/src/lib/angular/coerce-component-import.js +31 -0
  9. package/src/lib/angular/coerce-component-import.js.map +1 -0
  10. package/src/lib/angular/coerce-component-input.d.ts +18 -0
  11. package/src/lib/angular/coerce-component-input.js +67 -0
  12. package/src/lib/angular/coerce-component-input.js.map +1 -0
  13. package/src/lib/angular/coerce-component.d.ts +2 -2
  14. package/src/lib/angular/coerce-component.js +33 -20
  15. package/src/lib/angular/coerce-component.js.map +1 -1
  16. package/src/lib/angular/get-component-class.d.ts +2 -0
  17. package/src/lib/angular/get-component-class.js +12 -0
  18. package/src/lib/angular/get-component-class.js.map +1 -0
  19. package/src/lib/angular/get-component-decorator-object.d.ts +2 -0
  20. package/src/lib/angular/get-component-decorator-object.js +19 -0
  21. package/src/lib/angular/get-component-decorator-object.js.map +1 -0
  22. package/src/lib/coerce-accessor-declaration.d.ts +19 -0
  23. package/src/lib/coerce-accessor-declaration.js +38 -0
  24. package/src/lib/coerce-accessor-declaration.js.map +1 -0
  25. package/src/lib/coerce-array-element.d.ts +2 -1
  26. package/src/lib/coerce-array-element.js +14 -2
  27. package/src/lib/coerce-array-element.js.map +1 -1
  28. package/src/lib/coerce-class-property.d.ts +3 -0
  29. package/src/lib/coerce-class-property.js +3 -0
  30. package/src/lib/coerce-class-property.js.map +1 -1
  31. package/src/lib/coerce-default-class-export.d.ts +2 -0
  32. package/src/lib/coerce-default-class-export.js +27 -0
  33. package/src/lib/coerce-default-class-export.js.map +1 -0
  34. package/src/lib/coerce-property-declaration.d.ts +3 -0
  35. package/src/lib/coerce-property-declaration.js +13 -0
  36. package/src/lib/coerce-property-declaration.js.map +1 -0
  37. package/src/lib/data-property.d.ts +15 -0
  38. package/src/lib/data-property.js +63 -0
  39. package/src/lib/data-property.js.map +1 -0
  40. package/src/lib/has-constructor-parameter.d.ts +10 -0
  41. package/src/lib/has-constructor-parameter.js +17 -0
  42. package/src/lib/has-constructor-parameter.js.map +1 -0
  43. package/src/lib/nest/operation-id-utilities.d.ts +4 -4
  44. package/src/lib/nest/operation-id-utilities.js +9 -9
  45. package/src/lib/nest/operation-id-utilities.js.map +1 -1
  46. package/src/lib/type-import.d.ts +11 -0
  47. package/src/lib/type-import.js +46 -1
  48. package/src/lib/type-import.js.map +1 -1
  49. package/src/lib/upstream-options.d.ts +43 -0
  50. package/src/lib/upstream-options.js +53 -0
  51. package/src/lib/upstream-options.js.map +1 -0
  52. package/src/lib/write-type.d.ts +18 -0
  53. package/src/lib/write-type.js +74 -0
  54. package/src/lib/write-type.js.map +1 -0
@@ -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"}
@@ -0,0 +1,2 @@
1
+ import { ClassDeclaration, SourceFile } from 'ts-morph';
2
+ export declare function CoerceDefaultClassExport(sourceFileOrClassDeclaration: SourceFile | ClassDeclaration, standalone?: boolean): void;
@@ -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,15 @@
1
+ import { TypeImport } 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?: string | TypeImport;
8
+ isArray?: boolean;
9
+ }
10
+ export interface NormalizedDataProperty extends Readonly<Normalized<DataProperty>> {
11
+ type: NormalizedTypeImport;
12
+ }
13
+ export declare function NormalizeDataProperty(property: string | Readonly<DataProperty>, defaultType?: string): NormalizedDataProperty;
14
+ export declare function NormalizeDataPropertyList(propertyList?: Array<string | DataProperty>, defaultType?: string): ReadonlyArray<NormalizedDataProperty>;
15
+ export declare function NormalizeDataPropertyToPropertySignatureStructure(property: DataProperty, sourceFile: SourceFile): OptionalKind<PropertySignatureStructure>;
@@ -0,0 +1,63 @@
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
+ }
12
+ if (name.match(/^(is|has)[A-Z]/)) {
13
+ return 'boolean';
14
+ }
15
+ return 'unknown';
16
+ }
17
+ function NormalizeDataProperty(property, defaultType = 'unknown') {
18
+ var _a, _b;
19
+ let name;
20
+ let type = 'unknown';
21
+ let isArray = false;
22
+ if (typeof property === 'string') {
23
+ // name:type
24
+ // username:string
25
+ const fragments = property.split(':');
26
+ name = fragments[0];
27
+ type = fragments[1] || guessType(name); // convert an empty string to undefined
28
+ }
29
+ else {
30
+ name = property.name;
31
+ type = (_a = property.type) !== null && _a !== void 0 ? _a : guessType(name);
32
+ isArray = (_b = property.isArray) !== null && _b !== void 0 ? _b : isArray;
33
+ }
34
+ if (name.endsWith('[]')) {
35
+ isArray = true;
36
+ name = name.slice(0, -2);
37
+ }
38
+ if (name.startsWith('Array<') && name.endsWith('>')) {
39
+ isArray = true;
40
+ name = name.slice(6, -1);
41
+ }
42
+ type !== null && type !== void 0 ? type : (type = defaultType);
43
+ name = name.replace(/\.\?/g, '.').split('.').join('.?');
44
+ return Object.freeze({
45
+ name,
46
+ type: (0, type_import_1.NormalizeTypeImport)(type),
47
+ isArray,
48
+ });
49
+ }
50
+ exports.NormalizeDataProperty = NormalizeDataProperty;
51
+ function NormalizeDataPropertyList(propertyList, defaultType = 'unknown') {
52
+ var _a;
53
+ return Object.freeze((_a = propertyList === null || propertyList === void 0 ? void 0 : propertyList.map(property => NormalizeDataProperty(property, defaultType))) !== null && _a !== void 0 ? _a : []);
54
+ }
55
+ exports.NormalizeDataPropertyList = NormalizeDataPropertyList;
56
+ function NormalizeDataPropertyToPropertySignatureStructure(property, sourceFile) {
57
+ return {
58
+ type: (0, write_type_1.WriteType)(property, sourceFile),
59
+ name: property.name,
60
+ };
61
+ }
62
+ exports.NormalizeDataPropertyToPropertySignatureStructure = NormalizeDataPropertyToPropertySignatureStructure;
63
+ //# 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":";;;AAOA,+CAGuB;AACvB,6CAAyC;AAYzC,SAAS,SAAS,CAAC,IAAY;IAC7B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;IACD,IAAI,aAAJ,IAAI,cAAJ,IAAI,IAAJ,IAAI,GAAK,WAAW,EAAC;IACrB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,IAAI,EAAE,IAAA,iCAAmB,EAAC,IAAI,CAAC;QAC/B,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AA9BD,sDA8BC;AAED,SAAgB,yBAAyB,CAAC,YAA2C,EAAE,WAAW,GAAG,SAAS;;IAC5G,OAAO,MAAM,CAAC,MAAM,CAAC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC;AAC1G,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"}
@@ -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,10 +1,10 @@
1
- export declare function OperationIdToClassName(operationId: string): string;
2
- export declare function ServiceOperationIdToClassName(operationId: string): string;
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 OperationIdToClassImportPath(operationId: string, scope?: string | null): string;
5
+ export declare function OperationIdToClassRemoteMethodImportPath(operationId: string, scope?: string | null): string;
6
6
  export declare function OperationIdToRequestBodyClassName(operationId: string): string;
7
- export declare function ServiceOperationIdToClassImportPath(operationId: string, scope?: string | null): string;
7
+ export declare function OperationIdToCommandClassImportPath(operationId: string, scope?: string | null): 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.ServiceOperationIdToClassImportPath = exports.OperationIdToRequestBodyClassName = exports.OperationIdToClassImportPath = exports.OperationIdToParameterClassName = exports.OperationIdToResponseClassName = exports.ServiceOperationIdToClassName = exports.OperationIdToClassName = void 0;
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 OperationIdToClassName(operationId) {
5
+ function OperationIdToRemoteMethodClassName(operationId) {
6
6
  const [id] = operationId.split('@');
7
7
  return (0, utilities_1.classify)(id) + 'RemoteMethod';
8
8
  }
9
- exports.OperationIdToClassName = OperationIdToClassName;
10
- function ServiceOperationIdToClassName(operationId) {
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.ServiceOperationIdToClassName = ServiceOperationIdToClassName;
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 OperationIdToClassImportPath(operationId, scope) {
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,13 +31,13 @@ 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.OperationIdToClassImportPath = OperationIdToClassImportPath;
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 ServiceOperationIdToClassImportPath(operationId, scope) {
40
+ function OperationIdToCommandClassImportPath(operationId, scope) {
41
41
  const [id, serverId = 'legacy'] = operationId.split('@');
42
42
  if (scope) {
43
43
  return `${scope}/service-open-api-${(0, utilities_1.dasherize)(serverId)}/commands/${(0, utilities_1.dasherize)(id)}.command`;
@@ -46,7 +46,7 @@ function ServiceOperationIdToClassImportPath(operationId, scope) {
46
46
  return `service-open-api-${(0, utilities_1.dasherize)(serverId)}/commands/${(0, utilities_1.dasherize)(id)}.command`;
47
47
  }
48
48
  }
49
- exports.ServiceOperationIdToClassImportPath = ServiceOperationIdToClassImportPath;
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,sBAAsB,CAAC,WAAmB;IACxD,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,wDAGC;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,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,oBAAQ,EAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AACnC,CAAC;AAHD,wEAGC;AAED,SAAgB,+BAA+B,CAAC,WAAmB;IACjE,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,oBAA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AAqB;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"}
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,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAA,oBAAQ,EAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AACnC,CAAC;AAHD,wEAGC;AAED,SAAgB,+BAA+B,CAAC,WAAmB;IACjE,MAAM,CAAE,EAAE,CAAE,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;I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,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"}
@@ -7,5 +7,16 @@ export interface TypeImport {
7
7
  isTypeOnly?: boolean | null;
8
8
  defaultImport?: string | null;
9
9
  }
10
+ export declare function IsTypeImport(value: any): value is TypeImport;
10
11
  export declare function RequiresTypeImport(typeImport: TypeImport): boolean;
11
12
  export declare function TypeImportToImportStructure(typeImport: TypeImport): OptionalKind<ImportDeclarationStructure>;
13
+ export interface NormalizedTypeImport {
14
+ name: string;
15
+ moduleSpecifier: string | null;
16
+ namedImport: string | null;
17
+ namespaceImport: string | null;
18
+ isTypeOnly: boolean | null;
19
+ defaultImport: string | null;
20
+ }
21
+ export declare function NormalizeTypeImport(typeImport?: Readonly<TypeImport> | string): NormalizedTypeImport;
22
+ export declare function NormalizeTypeImportList(typeImportList?: TypeImport[]): NormalizedTypeImport[];
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeImportToImportStructure = exports.RequiresTypeImport = void 0;
3
+ exports.NormalizeTypeImportList = exports.NormalizeTypeImport = exports.TypeImportToImportStructure = exports.RequiresTypeImport = exports.IsTypeImport = void 0;
4
+ function IsTypeImport(value) {
5
+ return typeof value === 'object' && typeof value.name === 'string';
6
+ }
7
+ exports.IsTypeImport = IsTypeImport;
4
8
  function RequiresTypeImport(typeImport) {
5
9
  return !!typeImport.moduleSpecifier;
6
10
  }
@@ -27,4 +31,45 @@ function TypeImportToImportStructure(typeImport) {
27
31
  return structure;
28
32
  }
29
33
  exports.TypeImportToImportStructure = TypeImportToImportStructure;
34
+ function NormalizeTypeImport(typeImport) {
35
+ var _a, _b, _c, _d, _e;
36
+ let name;
37
+ let moduleSpecifier = null;
38
+ let namedImport = null;
39
+ let namespaceImport = null;
40
+ let isTypeOnly = false;
41
+ let defaultImport = null;
42
+ if (!typeImport) {
43
+ name = 'unknown';
44
+ }
45
+ else if (typeof typeImport === 'string') {
46
+ // name:moduleSpecifier:namedImport
47
+ // IconConfig:@rxap/utilities
48
+ const fragments = typeImport.split(':');
49
+ name = fragments[0] || 'unknown';
50
+ moduleSpecifier = fragments[1] || null; // use || instead of ?? because the moduleSpecifier can be an empty string
51
+ namedImport = fragments[2] || null; // use || instead of ?? because the namedImport can be an empty string
52
+ }
53
+ else {
54
+ name = typeImport.name;
55
+ moduleSpecifier = (_a = typeImport.moduleSpecifier) !== null && _a !== void 0 ? _a : moduleSpecifier;
56
+ namedImport = (_b = typeImport.namedImport) !== null && _b !== void 0 ? _b : namedImport;
57
+ namespaceImport = (_c = typeImport.namespaceImport) !== null && _c !== void 0 ? _c : namespaceImport;
58
+ isTypeOnly = (_d = typeImport.isTypeOnly) !== null && _d !== void 0 ? _d : isTypeOnly;
59
+ defaultImport = (_e = typeImport.defaultImport) !== null && _e !== void 0 ? _e : defaultImport;
60
+ }
61
+ return ({
62
+ name,
63
+ moduleSpecifier,
64
+ namedImport,
65
+ namespaceImport,
66
+ isTypeOnly,
67
+ defaultImport,
68
+ });
69
+ }
70
+ exports.NormalizeTypeImport = NormalizeTypeImport;
71
+ function NormalizeTypeImportList(typeImportList = []) {
72
+ return typeImportList.map(NormalizeTypeImport);
73
+ }
74
+ exports.NormalizeTypeImportList = NormalizeTypeImportList;
30
75
  //# sourceMappingURL=type-import.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-import.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/type-import.ts"],"names":[],"mappings":";;;AAcA,SAAgB,kBAAkB,CAAC,UAAsB;IACvD,OAAO,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC;AACtC,CAAC;AAFD,gDAEC;AAED,SAAgB,2BAA2B,CAAC,UAAsB;IAChE,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;IACD,MAAM,SAAS,GAA6C;QAC1D,eAAe,EAAE,UAAU,CAAC,eAAe;KAC5C,CAAC;IACF,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,UAAU,CAAC,eAAe,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE;QACvF,SAAS,CAAC,YAAY,GAAG,CAAE,UAAU,CAAC,IAAI,CAAE,CAAC;KAC9C;IACD,IAAI,UAAU,CAAC,WAAW,EAAE;QAC1B,SAAS,CAAC,YAAY,GAAG,CAAE,UAAU,CAAC,WAAW,CAAE,CAAC;KACrD;IACD,IAAI,UAAU,CAAC,eAAe,EAAE;QAC9B,SAAS,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;KACxD;IACD,IAAI,UAAU,CAAC,aAAa,EAAE;QAC5B,SAAS,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;KACpD;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AApBD,kEAoBC"}
1
+ {"version":3,"file":"type-import.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/type-import.ts"],"names":[],"mappings":";;;AAcA,SAAgB,YAAY,CAAC,KAAU;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACrE,CAAC;AAFD,oCAEC;AAED,SAAgB,kBAAkB,CAAC,UAAsB;IACvD,OAAO,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC;AACtC,CAAC;AAFD,gDAEC;A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,SAAS,CAAC;QACjC,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,0EAA0E;QAClH,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,sEAAsE;KAC3G;SAAM;QACL,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACvB,eAAe,GAAG,MAAA,UAAU,CAAC,eAAe,mCAAI,eAAe,CAAC;QAChE,WAAW,GAAG,MAAA,UAAU,CAAC,WAAW,mCAAI,WAAW,CAAC;QACpD,eAAe,GAAG,MAAA,UAAU,CAAC,eAAe,mCAAI,eAAe,CAAC;QAChE,UAAU,GAAG,MAAA,UAAU,CAAC,UAAU,mCAAI,UAAU,CAAC;QACjD,aAAa,GAAG,MAAA,UAAU,CAAC,aAAa,mCAAI,aAAa,CAAC;KAC3D;IACD,OAAO,CAAC;QACN,IAAI;QACJ,eAAe;QACf,WAAW;QACX,eAAe;QACf,UAAU;QACV,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAhCD,kDAgCC;AAED,SAAgB,uBAAuB,CAAC,iBAA+B,EAAE;IACvE,OAAO,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACjD,CAAC;AAFD,0DAEC"}
@@ -0,0 +1,43 @@
1
+ import { Normalized } from '@rxap/utilities';
2
+ export declare enum UpstreamOptionsKinds {
3
+ OPEN_API = "open-api"
4
+ }
5
+ export type UpstreamOptions = OpenApiUpstreamOptions | BaseUpstreamOptions;
6
+ export type NormalizedUpstreamOptions = NormalizedOpenApiUpstreamOptions | NormalizedBaseUpstreamOptions;
7
+ export interface BaseUpstreamOptions {
8
+ kind: UpstreamOptionsKinds;
9
+ }
10
+ export interface NormalizedBaseUpstreamOptions extends Readonly<Normalized<BaseUpstreamOptions>> {
11
+ kind: UpstreamOptionsKinds;
12
+ }
13
+ export declare function NormalizeBaseUpstreamOptions(options: BaseUpstreamOptions): NormalizedBaseUpstreamOptions;
14
+ export interface CommandMapper {
15
+ pageIndex?: string;
16
+ pageSize?: string;
17
+ sortBy?: string;
18
+ sortDirection?: string;
19
+ list?: string;
20
+ total?: string;
21
+ filter?: {
22
+ eq: string;
23
+ join: string;
24
+ };
25
+ }
26
+ export interface NormalizedCommandMapper extends Readonly<Normalized<CommandMapper>> {
27
+ filter: {
28
+ eq: string;
29
+ join: string;
30
+ } | null;
31
+ }
32
+ export declare function NormalizeCommandMapper(mapper?: CommandMapper | null): NormalizedCommandMapper | null;
33
+ export interface OpenApiUpstreamOptions extends BaseUpstreamOptions {
34
+ operationId: string;
35
+ scope?: string;
36
+ mapper?: CommandMapper;
37
+ }
38
+ export interface NormalizedOpenApiUpstreamOptions extends Readonly<Normalized<OpenApiUpstreamOptions>> {
39
+ kind: UpstreamOptionsKinds.OPEN_API;
40
+ }
41
+ export declare function NormalizeOpenApiUpstreamOptions(options: OpenApiUpstreamOptions): NormalizedOpenApiUpstreamOptions;
42
+ export declare function IsNormalizedOpenApiUpstreamOptions(options: NormalizedUpstreamOptions): options is NormalizedOpenApiUpstreamOptions;
43
+ export declare function NormalizeUpstreamOptions(options?: UpstreamOptions): NormalizedUpstreamOptions | null;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NormalizeUpstreamOptions = exports.IsNormalizedOpenApiUpstreamOptions = exports.NormalizeOpenApiUpstreamOptions = exports.NormalizeCommandMapper = exports.NormalizeBaseUpstreamOptions = exports.UpstreamOptionsKinds = void 0;
4
+ var UpstreamOptionsKinds;
5
+ (function (UpstreamOptionsKinds) {
6
+ UpstreamOptionsKinds["OPEN_API"] = "open-api";
7
+ })(UpstreamOptionsKinds || (exports.UpstreamOptionsKinds = UpstreamOptionsKinds = {}));
8
+ function NormalizeBaseUpstreamOptions(options) {
9
+ return Object.freeze({
10
+ kind: options.kind,
11
+ });
12
+ }
13
+ exports.NormalizeBaseUpstreamOptions = NormalizeBaseUpstreamOptions;
14
+ function NormalizeCommandMapper(mapper) {
15
+ var _a, _b, _c, _d, _e, _f, _g;
16
+ if (!mapper || Object.keys(mapper).length === 0) {
17
+ return null;
18
+ }
19
+ return Object.freeze({
20
+ pageIndex: (_a = mapper.pageIndex) !== null && _a !== void 0 ? _a : null,
21
+ pageSize: (_b = mapper.pageSize) !== null && _b !== void 0 ? _b : null,
22
+ sortBy: (_c = mapper.sortBy) !== null && _c !== void 0 ? _c : null,
23
+ list: (_d = mapper.list) !== null && _d !== void 0 ? _d : null,
24
+ total: (_e = mapper.total) !== null && _e !== void 0 ? _e : null,
25
+ sortDirection: (_f = mapper.sortDirection) !== null && _f !== void 0 ? _f : null,
26
+ filter: mapper.filter && Object.keys((_g = mapper.filter) !== null && _g !== void 0 ? _g : {}).length ? {
27
+ eq: mapper.filter.eq,
28
+ join: mapper.filter.join,
29
+ } : null,
30
+ });
31
+ }
32
+ exports.NormalizeCommandMapper = NormalizeCommandMapper;
33
+ function NormalizeOpenApiUpstreamOptions(options) {
34
+ var _a;
35
+ return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseUpstreamOptions(options)), { kind: UpstreamOptionsKinds.OPEN_API, operationId: options.operationId, mapper: NormalizeCommandMapper(options.mapper), scope: (_a = options.scope) !== null && _a !== void 0 ? _a : null }));
36
+ }
37
+ exports.NormalizeOpenApiUpstreamOptions = NormalizeOpenApiUpstreamOptions;
38
+ function IsNormalizedOpenApiUpstreamOptions(options) {
39
+ return options.kind === UpstreamOptionsKinds.OPEN_API;
40
+ }
41
+ exports.IsNormalizedOpenApiUpstreamOptions = IsNormalizedOpenApiUpstreamOptions;
42
+ // endregion
43
+ function NormalizeUpstreamOptions(options) {
44
+ if (!options || Object.keys(options).length === 0) {
45
+ return null;
46
+ }
47
+ switch (options.kind) {
48
+ case UpstreamOptionsKinds.OPEN_API:
49
+ return NormalizeOpenApiUpstreamOptions(options);
50
+ }
51
+ }
52
+ exports.NormalizeUpstreamOptions = NormalizeUpstreamOptions;
53
+ //# sourceMappingURL=upstream-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-options.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/upstream-options.ts"],"names":[],"mappings":";;;AAEA,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC9B,6CAAqB,CAAA;AACvB,CAAC,EAFW,oBAAoB,oCAApB,oBAAoB,QAE/B;AAgBD,SAAgB,4BAA4B,CAAC,OAA4B;IACvE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAJD,oEAIC;AA0BD,SAAgB,sBAAsB,CAAC,MAA6B;;IAClE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/C,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,MAAA,MAAM,CAAC,SAAS,mCAAI,IAAI;QACnC,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI;QACjC,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,IAAI;QAC7B,IAAI,EAAE,MAAA,MAAM,CAAC,IAAI,mCAAI,IAAI;QACzB,KAAK,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,IAAI;QAC3B,aAAa,EAAE,MAAA,MAAM,CAAC,aAAa,mCAAI,IAAI;QAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAA,MAAM,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjE,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;YACpB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;SACzB,CAAC,CAAC,CAAC,IAAI;KACT,CAAC,CAAC;AACL,CAAC;AAhBD,wDAgBC;AAgBD,SAAgB,+BAA+B,CAAC,OAA+B;;IAC7E,OAAO,MAAM,CAAC,MAAM,iCACf,4BAA4B,CAAC,OAAO,CAAC,KACxC,IAAI,EAAE,oBAAoB,CAAC,QAAQ,EACnC,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,EAC9C,KAAK,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,IAC5B,CAAC;AACL,CAAC;AARD,0EAQC;AAED,SAAgB,kCAAkC,CAAC,OAAkC;IACnF,OAAO,OAAO,CAAC,IAAI,KAAK,oBAAoB,CAAC,QAAQ,CAAC;AACxD,CAAC;AAFD,gFAEC;AAED,YAAY;AAEZ,SAAgB,wBAAwB,CAAC,OAAyB;IAChE,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACjD,OAAO,IAAI,CAAC;KACb;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,oBAAoB,CAAC,QAAQ;YAChC,OAAO,+BAA+B,CAAC,OAAiC,CAAC,CAAC;KAC7E;AACH,CAAC;AARD,4DAQC"}
@@ -0,0 +1,18 @@
1
+ import { CodeBlockWriter, SourceFile, WriterFunction } from 'ts-morph';
2
+ import { TypeImport } from './type-import';
3
+ export type WriteType = string | TypeImport | WriterFunction;
4
+ export interface WriteTypeOptions {
5
+ isArray?: boolean | null;
6
+ type: WriteType;
7
+ }
8
+ export declare function IsWriteTypeOptions(value: any): value is WriteTypeOptions;
9
+ /**
10
+ * Uses the CodeBlockWriter to write the type to the AST thereby the value of the property type is evaluated
11
+ * to determine the value that should be written to the AST
12
+ * @param type
13
+ * @param w
14
+ * @constructor
15
+ */
16
+ export declare function WriteStringType(type: string, w: CodeBlockWriter): void;
17
+ export declare function WriteType(type: WriteType, sourceFile: SourceFile): WriterFunction;
18
+ export declare function WriteType(property: WriteTypeOptions, sourceFile: SourceFile): WriterFunction;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriteType = exports.WriteStringType = exports.IsWriteTypeOptions = void 0;
4
+ const coerce_imports_1 = require("./coerce-imports");
5
+ const type_import_1 = require("./type-import");
6
+ function IsWriteTypeOptions(value) {
7
+ return value && typeof value === 'object' && value.type;
8
+ }
9
+ exports.IsWriteTypeOptions = IsWriteTypeOptions;
10
+ /**
11
+ * Uses the CodeBlockWriter to write the type to the AST thereby the value of the property type is evaluated
12
+ * to determine the value that should be written to the AST
13
+ * @param type
14
+ * @param w
15
+ * @constructor
16
+ */
17
+ function WriteStringType(type, w) {
18
+ switch (type) {
19
+ case 'date':
20
+ w.write('Date');
21
+ break;
22
+ case 'uuid':
23
+ w.write('string');
24
+ break;
25
+ default:
26
+ w.write(type);
27
+ break;
28
+ }
29
+ }
30
+ exports.WriteStringType = WriteStringType;
31
+ function WriteType(propertyOrType, sourceFile) {
32
+ var _a;
33
+ let isArray = false;
34
+ let type;
35
+ if (IsWriteTypeOptions(propertyOrType)) {
36
+ isArray = (_a = propertyOrType.isArray) !== null && _a !== void 0 ? _a : isArray;
37
+ type = propertyOrType.type;
38
+ }
39
+ else {
40
+ type = propertyOrType;
41
+ }
42
+ if ((0, type_import_1.IsTypeImport)(type)) {
43
+ if (sourceFile) {
44
+ if ((0, type_import_1.RequiresTypeImport)(type)) {
45
+ (0, coerce_imports_1.CoerceImports)(sourceFile, (0, type_import_1.TypeImportToImportStructure)(type));
46
+ }
47
+ }
48
+ else {
49
+ console.warn('WriteType :: No source file provided to coerce imports');
50
+ }
51
+ }
52
+ return (w) => {
53
+ if (isArray) {
54
+ w.write('Array<');
55
+ }
56
+ if (typeof type === 'string') {
57
+ WriteStringType(type, w);
58
+ }
59
+ else if (typeof type === 'function') {
60
+ type(w);
61
+ }
62
+ else if ((0, type_import_1.IsTypeImport)(type)) {
63
+ WriteStringType(type.name, w);
64
+ }
65
+ else {
66
+ throw new Error('Invalid type');
67
+ }
68
+ if (isArray) {
69
+ w.write('>');
70
+ }
71
+ };
72
+ }
73
+ exports.WriteType = WriteType;
74
+ //# sourceMappingURL=write-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-type.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/write-type.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAMjD,+CAKuB;AASvB,SAAgB,kBAAkB,CAAC,KAAU;IAC3C,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC;AAC1D,CAAC;AAFD,gDAEC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,CAAkB;IAC9D,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChB,MAAM;QACR,KAAK,MAAM;YACT,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAClB,MAAM;QACR;YACE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACd,MAAM;KACT;AACH,CAAC;AAZD,0CAYC;AAID,SAAgB,SAAS,CAAC,cAA4C,EAAE,UAAsB;;IAC5F,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,IAAe,CAAC;IACpB,IAAI,kBAAkB,CAAC,cAAc,CAAC,EAAE;QACtC,OAAO,GAAG,MAAA,cAAc,CAAC,OAAO,mCAAI,OAAO,CAAC;QAC5C,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;KAC5B;SAAM;QACL,IAAI,GAAG,cAAc,CAAC;KACvB;IACD,IAAI,IAAA,0BAAY,EAAC,IAAI,CAAC,EAAE;QACtB,IAAI,UAAU,EAAE;YACd,IAAI,IAAA,gCAAkB,EAAC,IAAI,CAAC,EAAE;gBAC5B,IAAA,8BAAa,EAAC,UAAU,EAAE,IAAA,yCAA2B,EAAC,IAAI,CA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