@rxap/ts-morph 1.6.1-dev.0 → 1.7.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/lib/add-provider-to-array.d.ts +9 -0
- package/src/lib/add-provider-to-array.js +9 -0
- package/src/lib/add-provider-to-array.js.map +1 -1
- package/src/lib/angular/add-route.d.ts +29 -0
- package/src/lib/angular/add-route.js +13 -0
- package/src/lib/angular/add-route.js.map +1 -1
- package/src/lib/angular/build-route-object.d.ts +31 -0
- package/src/lib/angular/build-route-object.js +6 -0
- package/src/lib/angular/build-route-object.js.map +1 -1
- package/src/lib/angular/coerce-app-config-provider.d.ts +10 -0
- package/src/lib/angular/coerce-app-config-provider.js +7 -0
- package/src/lib/angular/coerce-app-config-provider.js.map +1 -1
- package/src/lib/angular/coerce-app-navigation.d.ts +25 -0
- package/src/lib/angular/coerce-app-navigation.js +7 -0
- package/src/lib/angular/coerce-app-navigation.js.map +1 -1
- package/src/lib/angular/coerce-app-routes.d.ts +8 -0
- package/src/lib/angular/coerce-app-routes.js +8 -0
- package/src/lib/angular/coerce-app-routes.js.map +1 -1
- package/src/lib/angular/coerce-component-import.d.ts +8 -0
- package/src/lib/angular/coerce-component-import.js +8 -0
- package/src/lib/angular/coerce-component-import.js.map +1 -1
- package/src/lib/angular/coerce-component-input.d.ts +12 -0
- package/src/lib/angular/coerce-component-input.js +10 -0
- package/src/lib/angular/coerce-component-input.js.map +1 -1
- package/src/lib/angular/coerce-component.d.ts +30 -2
- package/src/lib/angular/coerce-component.js +10 -0
- package/src/lib/angular/coerce-component.js.map +1 -1
- package/src/lib/angular/coerce-data-source-class.d.ts +26 -0
- package/src/lib/angular/coerce-data-source-class.js +8 -0
- package/src/lib/angular/coerce-data-source-class.js.map +1 -1
- package/src/lib/angular/coerce-layout-routes.d.ts +24 -0
- package/src/lib/angular/coerce-layout-routes.js +9 -0
- package/src/lib/angular/coerce-layout-routes.js.map +1 -1
- package/src/lib/angular/coerce-module-provider.d.ts +8 -0
- package/src/lib/angular/coerce-module-provider.js +8 -0
- package/src/lib/angular/coerce-module-provider.js.map +1 -1
- package/src/lib/angular/coerce-route-guard.d.ts +8 -0
- package/src/lib/angular/coerce-route-guard.js +8 -0
- package/src/lib/angular/coerce-route-guard.js.map +1 -1
- package/src/lib/angular/coerce-routes.d.ts +17 -0
- package/src/lib/angular/coerce-routes.js +8 -0
- package/src/lib/angular/coerce-routes.js.map +1 -1
- package/src/lib/angular/coerce-stories.d.ts +19 -0
- package/src/lib/angular/coerce-stories.js +7 -0
- package/src/lib/angular/coerce-stories.js.map +1 -1
- package/src/lib/angular/coerce-token-export.d.ts +20 -0
- package/src/lib/angular/coerce-token-export.js +8 -0
- package/src/lib/angular/coerce-token-export.js.map +1 -1
- package/src/lib/angular/find-parent-route.d.ts +35 -0
- package/src/lib/angular/find-parent-route.js +35 -0
- package/src/lib/angular/find-parent-route.js.map +1 -1
- package/src/lib/angular/get-component-class.d.ts +7 -0
- package/src/lib/angular/get-component-class.js +7 -0
- package/src/lib/angular/get-component-class.js.map +1 -1
- package/src/lib/angular/get-component-decorator-object.d.ts +6 -0
- package/src/lib/angular/get-component-decorator-object.js +6 -0
- package/src/lib/angular/get-component-decorator-object.js.map +1 -1
- package/src/lib/angular/remove-component-import.d.ts +7 -0
- package/src/lib/angular/remove-component-import.js +7 -0
- package/src/lib/angular/remove-component-import.js.map +1 -1
- package/src/lib/angular/remove-route.d.ts +22 -0
- package/src/lib/angular/remove-route.js +7 -0
- package/src/lib/angular/remove-route.js.map +1 -1
- package/src/lib/coerce-accessor-declaration.d.ts +18 -0
- package/src/lib/coerce-accessor-declaration.js +18 -0
- package/src/lib/coerce-accessor-declaration.js.map +1 -1
- package/src/lib/coerce-array-element.d.ts +24 -0
- package/src/lib/coerce-array-element.js +24 -0
- package/src/lib/coerce-array-element.js.map +1 -1
- package/src/lib/coerce-class-constructor.d.ts +7 -0
- package/src/lib/coerce-class-constructor.js +7 -0
- package/src/lib/coerce-class-constructor.js.map +1 -1
- package/src/lib/coerce-class-method.d.ts +9 -0
- package/src/lib/coerce-class-method.js +9 -0
- package/src/lib/coerce-class-method.js.map +1 -1
- package/src/lib/coerce-class-property.d.ts +10 -0
- package/src/lib/coerce-class-property.js +10 -0
- package/src/lib/coerce-class-property.js.map +1 -1
- package/src/lib/coerce-class.d.ts +9 -0
- package/src/lib/coerce-class.js +9 -0
- package/src/lib/coerce-class.js.map +1 -1
- package/src/lib/coerce-decorator.d.ts +10 -0
- package/src/lib/coerce-decorator.js +10 -0
- package/src/lib/coerce-decorator.js.map +1 -1
- package/src/lib/coerce-default-class-export.d.ts +5 -0
- package/src/lib/coerce-default-class-export.js +5 -0
- package/src/lib/coerce-default-class-export.js.map +1 -1
- package/src/lib/coerce-default-export.d.ts +5 -0
- package/src/lib/coerce-default-export.js +5 -0
- package/src/lib/coerce-default-export.js.map +1 -1
- package/src/lib/coerce-dependency-injection.d.ts +26 -0
- package/src/lib/coerce-dependency-injection.js +8 -0
- package/src/lib/coerce-dependency-injection.js.map +1 -1
- package/src/lib/coerce-function.d.ts +9 -0
- package/src/lib/coerce-function.js +9 -0
- package/src/lib/coerce-function.js.map +1 -1
- package/src/lib/coerce-imports.d.ts +8 -0
- package/src/lib/coerce-imports.js +8 -0
- package/src/lib/coerce-imports.js.map +1 -1
- package/src/lib/coerce-interface.d.ts +9 -0
- package/src/lib/coerce-interface.js +9 -0
- package/src/lib/coerce-interface.js.map +1 -1
- package/src/lib/coerce-mapping-class-method.d.ts +22 -0
- package/src/lib/coerce-mapping-class-method.js +7 -0
- package/src/lib/coerce-mapping-class-method.js.map +1 -1
- package/src/lib/coerce-property-assignment.d.ts +10 -0
- package/src/lib/coerce-property-assignment.js +10 -0
- package/src/lib/coerce-property-assignment.js.map +1 -1
- package/src/lib/coerce-property-declaration.d.ts +9 -0
- package/src/lib/coerce-property-declaration.js.map +1 -1
- package/src/lib/coerce-source-file.d.ts +9 -0
- package/src/lib/coerce-source-file.js +9 -0
- package/src/lib/coerce-source-file.js.map +1 -1
- package/src/lib/coerce-statements.d.ts +8 -0
- package/src/lib/coerce-statements.js +8 -0
- package/src/lib/coerce-statements.js.map +1 -1
- package/src/lib/coerce-variable-declaration.d.ts +10 -0
- package/src/lib/coerce-variable-declaration.js +10 -0
- package/src/lib/coerce-variable-declaration.js.map +1 -1
- package/src/lib/create-project.d.ts +6 -0
- package/src/lib/create-project.js +6 -0
- package/src/lib/create-project.js.map +1 -1
- package/src/lib/data-property.d.ts +39 -1
- package/src/lib/data-property.js +23 -0
- package/src/lib/data-property.js.map +1 -1
- package/src/lib/find-function.d.ts +6 -0
- package/src/lib/find-function.js +6 -0
- package/src/lib/find-function.js.map +1 -1
- package/src/lib/get-class-decorator-arguments.js +7 -0
- package/src/lib/get-class-decorator-arguments.js.map +1 -1
- package/src/lib/get-class.d.ts +9 -0
- package/src/lib/get-class.js +9 -0
- package/src/lib/get-class.js.map +1 -1
- package/src/lib/get-coerce-array-literal-form-object-literal.d.ts +17 -0
- package/src/lib/get-coerce-array-literal-form-object-literal.js +17 -0
- package/src/lib/get-coerce-array-literal-form-object-literal.js.map +1 -1
- package/src/lib/identifier.d.ts +12 -0
- package/src/lib/identifier.js +6 -0
- package/src/lib/identifier.js.map +1 -1
- package/src/lib/nest/add-to-global-health-endpoint.d.ts +6 -0
- package/src/lib/nest/add-to-global-health-endpoint.js +6 -0
- package/src/lib/nest/add-to-global-health-endpoint.js.map +1 -1
- package/src/lib/nest/coerce-app-guard-provider.d.ts +6 -0
- package/src/lib/nest/coerce-app-guard-provider.js +6 -0
- package/src/lib/nest/coerce-app-guard-provider.js.map +1 -1
- package/src/lib/nest/coerce-dto-class.d.ts +30 -0
- package/src/lib/nest/coerce-dto-class.js +6 -0
- package/src/lib/nest/coerce-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-health-controller.d.ts +7 -0
- package/src/lib/nest/coerce-health-controller.js +7 -0
- package/src/lib/nest/coerce-health-controller.js.map +1 -1
- package/src/lib/nest/coerce-health-endpoint.d.ts +7 -0
- package/src/lib/nest/coerce-health-endpoint.js +7 -0
- package/src/lib/nest/coerce-health-endpoint.js.map +1 -1
- package/src/lib/nest/coerce-health-indicator.d.ts +7 -0
- package/src/lib/nest/coerce-health-indicator.js +7 -0
- package/src/lib/nest/coerce-health-indicator.js.map +1 -1
- package/src/lib/nest/coerce-health-module.d.ts +6 -0
- package/src/lib/nest/coerce-health-module.js +6 -0
- package/src/lib/nest/coerce-health-module.js.map +1 -1
- package/src/lib/nest/coerce-nest-app-config.d.ts +25 -0
- package/src/lib/nest/coerce-nest-app-config.js +7 -0
- package/src/lib/nest/coerce-nest-app-config.js.map +1 -1
- package/src/lib/nest/coerce-nest-app-controller.d.ts +9 -0
- package/src/lib/nest/coerce-nest-app-controller.js +9 -0
- package/src/lib/nest/coerce-nest-app-controller.js.map +1 -1
- package/src/lib/nest/coerce-nest-app-module.d.ts +7 -0
- package/src/lib/nest/coerce-nest-app-module.js +7 -0
- package/src/lib/nest/coerce-nest-app-module.js.map +1 -1
- package/src/lib/nest/coerce-nest-cache-module-import.d.ts +10 -0
- package/src/lib/nest/coerce-nest-cache-module-import.js +7 -0
- package/src/lib/nest/coerce-nest-cache-module-import.js.map +1 -1
- package/src/lib/nest/coerce-nest-config-module-import.d.ts +10 -0
- package/src/lib/nest/coerce-nest-config-module-import.js +7 -0
- package/src/lib/nest/coerce-nest-config-module-import.js.map +1 -1
- package/src/lib/nest/coerce-nest-controller.d.ts +14 -0
- package/src/lib/nest/coerce-nest-controller.js +8 -0
- package/src/lib/nest/coerce-nest-controller.js.map +1 -1
- package/src/lib/nest/coerce-nest-environment-module.d.ts +6 -0
- package/src/lib/nest/coerce-nest-environment-module.js +6 -0
- package/src/lib/nest/coerce-nest-environment-module.js.map +1 -1
- package/src/lib/nest/coerce-nest-environment-provider.d.ts +6 -0
- package/src/lib/nest/coerce-nest-environment-provider.js +6 -0
- package/src/lib/nest/coerce-nest-environment-provider.js.map +1 -1
- package/src/lib/nest/coerce-nest-module-controller.d.ts +19 -0
- package/src/lib/nest/coerce-nest-module-controller.js +7 -0
- package/src/lib/nest/coerce-nest-module-controller.js.map +1 -1
- package/src/lib/nest/coerce-nest-module-import.d.ts +21 -0
- package/src/lib/nest/coerce-nest-module-import.js +6 -0
- package/src/lib/nest/coerce-nest-module-import.js.map +1 -1
- package/src/lib/nest/coerce-nest-module-provider.d.ts +18 -0
- package/src/lib/nest/coerce-nest-module-provider.js +6 -0
- package/src/lib/nest/coerce-nest-module-provider.js.map +1 -1
- package/src/lib/nest/coerce-nest-module.d.ts +14 -0
- package/src/lib/nest/coerce-nest-module.js +8 -0
- package/src/lib/nest/coerce-nest-module.js.map +1 -1
- package/src/lib/nest/coerce-nest-operation.d.ts +108 -0
- package/src/lib/nest/coerce-nest-operation.js +9 -0
- package/src/lib/nest/coerce-nest-operation.js.map +1 -1
- package/src/lib/nest/coerce-nest-provider-to-array.d.ts +8 -0
- package/src/lib/nest/coerce-nest-provider-to-array.js +8 -0
- package/src/lib/nest/coerce-nest-provider-to-array.js.map +1 -1
- package/src/lib/nest/coerce-nest-throttler-module-import.d.ts +10 -0
- package/src/lib/nest/coerce-nest-throttler-module-import.js +7 -0
- package/src/lib/nest/coerce-nest-throttler-module-import.js.map +1 -1
- package/src/lib/nest/dto-class-property.d.ts +10 -1
- package/src/lib/nest/dto-class-property.js +6 -0
- package/src/lib/nest/dto-class-property.js.map +1 -1
- package/src/lib/nest/find-nest-module-source-file.d.ts +7 -0
- package/src/lib/nest/find-nest-module-source-file.js +7 -0
- package/src/lib/nest/find-nest-module-source-file.js.map +1 -1
- package/src/lib/nest/get-controller-class.d.ts +7 -0
- package/src/lib/nest/get-controller-class.js +7 -0
- package/src/lib/nest/get-controller-class.js.map +1 -1
- package/src/lib/nest/get-nest-module-metadata.d.ts +6 -0
- package/src/lib/nest/get-nest-module-metadata.js +6 -0
- package/src/lib/nest/get-nest-module-metadata.js.map +1 -1
- package/src/lib/nest/has-nest-module-class.d.ts +6 -0
- package/src/lib/nest/has-nest-module-class.js +6 -0
- package/src/lib/nest/has-nest-module-class.js.map +1 -1
- package/src/lib/nest/has-nest-module-import.d.ts +10 -0
- package/src/lib/nest/has-nest-module-import.js +7 -0
- package/src/lib/nest/has-nest-module-import.js.map +1 -1
- package/src/lib/nest/is-nest-module-class.d.ts +6 -0
- package/src/lib/nest/is-nest-module-class.js +6 -0
- package/src/lib/nest/is-nest-module-class.js.map +1 -1
- package/src/lib/nest/nest-provider-object.d.ts +24 -0
- package/src/lib/nest/operation-id-utilities.d.ts +12 -0
- package/src/lib/nest/operation-id-utilities.js +12 -0
- package/src/lib/nest/operation-id-utilities.js.map +1 -1
- package/src/lib/nest/remove-nest-module-import.d.ts +9 -0
- package/src/lib/nest/remove-nest-module-import.js +6 -0
- package/src/lib/nest/remove-nest-module-import.js.map +1 -1
- package/src/lib/nest/remove-nest-module-provider.d.ts +9 -0
- package/src/lib/nest/remove-nest-module-provider.js +6 -0
- package/src/lib/nest/remove-nest-module-provider.js.map +1 -1
- package/src/lib/nest/remove-nest-provider-to-array.d.ts +7 -0
- package/src/lib/nest/remove-nest-provider-to-array.js +7 -0
- package/src/lib/nest/remove-nest-provider-to-array.js.map +1 -1
- package/src/lib/overwrite-options.d.ts +6 -0
- package/src/lib/provider-object.d.ts +26 -0
- package/src/lib/to-mapping-object.d.ts +14 -0
- package/src/lib/to-mapping-object.js +8 -0
- package/src/lib/to-mapping-object.js.map +1 -1
- package/src/lib/type-import.d.ts +57 -0
- package/src/lib/type-import.js +35 -0
- package/src/lib/type-import.js.map +1 -1
- package/src/lib/upstream-options.d.ts +18 -0
- package/src/lib/upstream-options.js +18 -0
- package/src/lib/upstream-options.js.map +1 -1
- package/src/lib/write-type.d.ts +6 -0
- package/src/lib/write-type.js +9 -0
- package/src/lib/write-type.js.map +1 -1
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { InterfaceDeclarationStructure, OptionalKind, SourceFile } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces an interface declaration in a source file.
|
|
4
|
+
* If the interface exists, it returns it. Otherwise, it creates it.
|
|
5
|
+
*
|
|
6
|
+
* @param sourceFile - The source file to look in or add to.
|
|
7
|
+
* @param interfaceName - The name of the interface.
|
|
8
|
+
* @param structure - Optional structure to apply to the interface if it is created.
|
|
9
|
+
* @returns The existing or created interface declaration.
|
|
10
|
+
*/
|
|
2
11
|
export declare function CoerceInterface(sourceFile: SourceFile, interfaceName: string, structure?: Omit<OptionalKind<InterfaceDeclarationStructure>, 'name'>): import("ts-morph").InterfaceDeclaration;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceInterface = CoerceInterface;
|
|
4
|
+
/**
|
|
5
|
+
* Coerces an interface declaration in a source file.
|
|
6
|
+
* If the interface exists, it returns it. Otherwise, it creates it.
|
|
7
|
+
*
|
|
8
|
+
* @param sourceFile - The source file to look in or add to.
|
|
9
|
+
* @param interfaceName - The name of the interface.
|
|
10
|
+
* @param structure - Optional structure to apply to the interface if it is created.
|
|
11
|
+
* @returns The existing or created interface declaration.
|
|
12
|
+
*/
|
|
4
13
|
function CoerceInterface(sourceFile, interfaceName, structure = {}) {
|
|
5
14
|
let interfaceDeclaration = sourceFile.getInterface(interfaceName);
|
|
6
15
|
if (!interfaceDeclaration) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-interface.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-interface.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-interface.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-interface.ts"],"names":[],"mappings":";;AAeA,0CAaC;AAtBD;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC7B,UAAsB,EACtB,aAAqB,EACrB,YAAuE,EAAE;IAEzE,IAAI,oBAAoB,GAAG,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAClE,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,oBAAoB,GAAG,UAAU,CAAC,YAAY,iCACzC,SAAS,KACZ,IAAI,EAAE,aAAa,IACnB,CAAC;IACL,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import { ClassDeclaration, SourceFile } from 'ts-morph';
|
|
2
2
|
import { ToMappingObjectOptions } from './to-mapping-object';
|
|
3
3
|
export interface CoerceMappingClassMethodOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The type of the input parameter for the mapping method.
|
|
6
|
+
*/
|
|
4
7
|
parameterType: string;
|
|
8
|
+
/**
|
|
9
|
+
* The mapping definition. Can be true (direct mapping) or a record defining the mapping structure.
|
|
10
|
+
*/
|
|
5
11
|
mapping: boolean | Record<string, any>;
|
|
12
|
+
/**
|
|
13
|
+
* Options for generating the mapping object.
|
|
14
|
+
*/
|
|
6
15
|
mappingOptions?: ToMappingObjectOptions;
|
|
16
|
+
/**
|
|
17
|
+
* The name of the method to generate.
|
|
18
|
+
*/
|
|
7
19
|
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* The return type of the method.
|
|
22
|
+
*/
|
|
8
23
|
returnType: string;
|
|
9
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Coerces a class method that maps an input to an output object.
|
|
27
|
+
*
|
|
28
|
+
* @param sourceFile - The source file containing the class.
|
|
29
|
+
* @param classDeclaration - The class declaration to add the method to.
|
|
30
|
+
* @param options - Options for generating the mapping method.
|
|
31
|
+
*/
|
|
10
32
|
export declare function CoerceMappingClassMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, options: CoerceMappingClassMethodOptions): void;
|
|
@@ -3,6 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CoerceMappingClassMethod = CoerceMappingClassMethod;
|
|
4
4
|
const coerce_class_method_1 = require("./coerce-class-method");
|
|
5
5
|
const to_mapping_object_1 = require("./to-mapping-object");
|
|
6
|
+
/**
|
|
7
|
+
* Coerces a class method that maps an input to an output object.
|
|
8
|
+
*
|
|
9
|
+
* @param sourceFile - The source file containing the class.
|
|
10
|
+
* @param classDeclaration - The class declaration to add the method to.
|
|
11
|
+
* @param options - Options for generating the mapping method.
|
|
12
|
+
*/
|
|
6
13
|
function CoerceMappingClassMethod(sourceFile, classDeclaration, options) {
|
|
7
14
|
var _a;
|
|
8
15
|
const { parameterType, name, mapping, returnType, mappingOptions = {} } = options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-mapping-class-method.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-mapping-class-method.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-mapping-class-method.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-mapping-class-method.ts"],"names":[],"mappings":";;AAwCA,4DAwBC;AA5DD,+DAA0D;AAC1D,2DAG6B;AAyB7B;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,UAAsB,EACtB,gBAAkC,EAClC,OAAwC;;IAExC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAClF,MAAA,cAAc,CAAC,YAAY,oCAA3B,cAAc,CAAC,YAAY,GAAK,OAAO,EAAC;IACxC,MAAM,EAAE,YAAY,EAAE,GAAG,cAAc,CAAC;IACxC,IAAA,uCAAiB,EAAC,gBAAgB,EAAE,IAAI,EAAE;QACxC,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,aAAa;aACpB;SACF;QACD,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAE,UAAW,YAAa,GAAG,CAAE,CAAC,CAAC,CAAC;YAC/D,CAAC,CAAC,EAAE;gBACF,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACnB,IAAA,mCAAe,EAAC,OAAc,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnD,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { ObjectLiteralExpression, OptionalKind, PropertyAssignment, PropertyAssignmentStructure, WriterFunction } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces a property assignment in an object literal expression.
|
|
4
|
+
* If the property exists, it returns it. Otherwise, it adds it.
|
|
5
|
+
*
|
|
6
|
+
* @param node - The object literal expression.
|
|
7
|
+
* @param name - The name of the property.
|
|
8
|
+
* @param initializer - The initializer for the property.
|
|
9
|
+
* @param structure - Optional structure to apply to the property assignment.
|
|
10
|
+
* @returns The existing or created property assignment.
|
|
11
|
+
*/
|
|
2
12
|
export declare function CoercePropertyAssignment(node: ObjectLiteralExpression, name: string, initializer: string | WriterFunction, structure?: Omit<OptionalKind<PropertyAssignmentStructure>, 'name' | 'initializer'>): PropertyAssignment;
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoercePropertyAssignment = CoercePropertyAssignment;
|
|
4
4
|
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
/**
|
|
6
|
+
* Coerces a property assignment in an object literal expression.
|
|
7
|
+
* If the property exists, it returns it. Otherwise, it adds it.
|
|
8
|
+
*
|
|
9
|
+
* @param node - The object literal expression.
|
|
10
|
+
* @param name - The name of the property.
|
|
11
|
+
* @param initializer - The initializer for the property.
|
|
12
|
+
* @param structure - Optional structure to apply to the property assignment.
|
|
13
|
+
* @returns The existing or created property assignment.
|
|
14
|
+
*/
|
|
5
15
|
function CoercePropertyAssignment(node, name, initializer, structure = {}) {
|
|
6
16
|
let property = node.getProperty(name);
|
|
7
17
|
if (!property) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-property-assignment.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-property-assignment.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-property-assignment.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-property-assignment.ts"],"names":[],"mappings":";;AAyBA,4DAeC;AAxCD,uCAakB;AAElB;;;;;;;;;GASG;AACH,SAAgB,wBAAwB,CACtC,IAA6B,EAC7B,IAAY,EACZ,WAAoC,EACpC,YAAqF,EAAE;IAEvF,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,YAAY,IAAI,8BAA8B,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { ClassLikeDeclarationBase, PropertyDeclaration, PropertyDeclarationStructure, PropertySignature, TypeElementMemberedNode } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces a property declaration in a class or interface.
|
|
4
|
+
* If the property exists, it returns it. Otherwise, it adds it.
|
|
5
|
+
*
|
|
6
|
+
* @param typeElementMemberedNode - The type element membered node (e.g. Interface).
|
|
7
|
+
* @param name - The name of the property.
|
|
8
|
+
* @param structure - Optional structure to apply to the property.
|
|
9
|
+
* @returns The existing or created property signature.
|
|
10
|
+
*/
|
|
2
11
|
export declare function CoercePropertyDeclaration(typeElementMemberedNode: TypeElementMemberedNode, name: string, structure?: Partial<PropertyDeclarationStructure>): PropertySignature;
|
|
3
12
|
export declare function CoercePropertyDeclaration(classLikeDeclarationBase: ClassLikeDeclarationBase, name: string, structure?: Partial<PropertyDeclarationStructure>): PropertyDeclaration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-property-declaration.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-property-declaration.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-property-declaration.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-property-declaration.ts"],"names":[],"mappings":";;AA6BA,8DAWC;AAXD,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,CAAC;QACd,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,QAAQ,CAAC,GAAG,CAAC,SAAgB,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { Project, SourceFile } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces a source file in a project.
|
|
4
|
+
* If the file exists, it returns it. Otherwise, it creates it.
|
|
5
|
+
*
|
|
6
|
+
* @param project - The ts-morph project.
|
|
7
|
+
* @param fileNameOrPath - The file name or path.
|
|
8
|
+
* @param content - Optional initial content for the file.
|
|
9
|
+
* @returns The existing or created source file.
|
|
10
|
+
*/
|
|
2
11
|
export declare function CoerceSourceFile(project: Project, fileNameOrPath: string, content?: string): SourceFile;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceSourceFile = CoerceSourceFile;
|
|
4
|
+
/**
|
|
5
|
+
* Coerces a source file in a project.
|
|
6
|
+
* If the file exists, it returns it. Otherwise, it creates it.
|
|
7
|
+
*
|
|
8
|
+
* @param project - The ts-morph project.
|
|
9
|
+
* @param fileNameOrPath - The file name or path.
|
|
10
|
+
* @param content - Optional initial content for the file.
|
|
11
|
+
* @returns The existing or created source file.
|
|
12
|
+
*/
|
|
4
13
|
function CoerceSourceFile(project, fileNameOrPath, content) {
|
|
5
14
|
let sourceFile = project.getSourceFile(fileNameOrPath);
|
|
6
15
|
if (!sourceFile) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-source-file.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-source-file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-source-file.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-source-file.ts"],"names":[],"mappings":";;AAcA,4CAcC;AAvBD;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAC9B,OAAgB,EAChB,cAAsB,EACtB,OAAgB;IAGhB,IAAI,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAEvD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,UAAU,CAAC;AAEpB,CAAC"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { StatementedNode, StatementStructures, WriterFunction } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces statements in a statemented node (like a function or method body).
|
|
4
|
+
* Can optionally overwrite existing statements.
|
|
5
|
+
*
|
|
6
|
+
* @param node - The node to add statements to.
|
|
7
|
+
* @param statements - The statements to add.
|
|
8
|
+
* @param overwrite - If true, removes existing statements before adding new ones.
|
|
9
|
+
*/
|
|
2
10
|
export declare function CoerceStatements(node: StatementedNode, statements: (string | WriterFunction | StatementStructures)[] | string | WriterFunction, overwrite?: boolean): void;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceStatements = CoerceStatements;
|
|
4
|
+
/**
|
|
5
|
+
* Coerces statements in a statemented node (like a function or method body).
|
|
6
|
+
* Can optionally overwrite existing statements.
|
|
7
|
+
*
|
|
8
|
+
* @param node - The node to add statements to.
|
|
9
|
+
* @param statements - The statements to add.
|
|
10
|
+
* @param overwrite - If true, removes existing statements before adding new ones.
|
|
11
|
+
*/
|
|
4
12
|
function CoerceStatements(node, statements, overwrite = false) {
|
|
5
13
|
if (overwrite) {
|
|
6
14
|
const length = node.getStatements().length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-statements.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-statements.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-statements.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-statements.ts"],"names":[],"mappings":";;AAcA,4CAcC;AAtBD;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC9B,IAAqB,EACrB,UAAuF,EACvF,SAAS,GAAG,KAAK;IAEjB,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC;QAC3C,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { OptionalKind, SourceFile, VariableDeclaration, VariableDeclarationStructure, VariableStatementStructure } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces a variable declaration in a source file.
|
|
4
|
+
* If the variable statement exists, it returns the declaration. Otherwise, it creates it.
|
|
5
|
+
*
|
|
6
|
+
* @param sourceFile - The source file to look in or add to.
|
|
7
|
+
* @param name - The name of the variable.
|
|
8
|
+
* @param defaultDeclaration - Default structure for the variable declaration.
|
|
9
|
+
* @param variableStatementStructure - Optional structure for the variable statement (e.g. export, const).
|
|
10
|
+
* @returns The existing or created variable declaration.
|
|
11
|
+
*/
|
|
2
12
|
export declare function CoerceVariableDeclaration(sourceFile: SourceFile, name: string, defaultDeclaration?: Omit<OptionalKind<VariableDeclarationStructure>, 'name'>, variableStatementStructure?: Partial<Omit<OptionalKind<VariableStatementStructure>, 'declarations'>>): VariableDeclaration;
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceVariableDeclaration = CoerceVariableDeclaration;
|
|
4
4
|
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
/**
|
|
6
|
+
* Coerces a variable declaration in a source file.
|
|
7
|
+
* If the variable statement exists, it returns the declaration. Otherwise, it creates it.
|
|
8
|
+
*
|
|
9
|
+
* @param sourceFile - The source file to look in or add to.
|
|
10
|
+
* @param name - The name of the variable.
|
|
11
|
+
* @param defaultDeclaration - Default structure for the variable declaration.
|
|
12
|
+
* @param variableStatementStructure - Optional structure for the variable statement (e.g. export, const).
|
|
13
|
+
* @returns The existing or created variable declaration.
|
|
14
|
+
*/
|
|
5
15
|
function CoerceVariableDeclaration(sourceFile, name, defaultDeclaration = {}, variableStatementStructure) {
|
|
6
16
|
var _a, _b;
|
|
7
17
|
const declaration = Object.assign(Object.assign({}, defaultDeclaration), { name });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-variable-declaration.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-variable-declaration.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"coerce-variable-declaration.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-variable-declaration.ts"],"names":[],"mappings":";;AAmBA,8DAiCC;AApDD,uCAOkB;AAElB;;;;;;;;;GASG;AACH,SAAgB,yBAAyB,CACvC,UAAsB,EACtB,IAAY,EACZ,qBAA+E,EAAE,EACjF,0BAAoG;;IAGpG,MAAM,WAAW,mCACZ,kBAAkB,KACrB,IAAI,GACL,CAAC;IAEF,IAAI,iBAAiB,GAAG,UAAU,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,0BAA0B,aAA1B,0BAA0B,cAA1B,0BAA0B,IAA1B,0BAA0B,GAAK;YAC7B,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,kCAAuB,CAAC,KAAK;SAC/C,EAAC;QACF,MAAA,0BAA0B,CAAC,UAAU,oCAArC,0BAA0B,CAAC,UAAU,GAAK,IAAI,EAAC;QAC/C,MAAA,0BAA0B,CAAC,eAAe,oCAA1C,0BAA0B,CAAC,eAAe,GAAK,kCAAuB,CAAC,KAAK,EAAC;QAC7E,iBAAiB,GAAG,UAAU,CAAC,oBAAoB,iCAC9C,0BAA0B,KAC7B,YAAY,EAAE,CAAE,WAAW,CAAE,IAC7B,CAAC;IACL,CAAC;IAED,IAAI,mBAAmB,GAAG,iBAAiB,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC;IAEjE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,mBAAmB,GAAG,iBAAiB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { Project, ProjectOptions } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new ts-morph Project with default settings for Angular/RxAP development.
|
|
4
|
+
*
|
|
5
|
+
* @param options - Optional project options to override defaults.
|
|
6
|
+
* @returns A new ts-morph Project instance.
|
|
7
|
+
*/
|
|
2
8
|
export declare function CreateProject(options?: ProjectOptions): Project;
|
|
@@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CreateProject = CreateProject;
|
|
4
4
|
const utilities_1 = require("@rxap/utilities");
|
|
5
5
|
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new ts-morph Project with default settings for Angular/RxAP development.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Optional project options to override defaults.
|
|
10
|
+
* @returns A new ts-morph Project instance.
|
|
11
|
+
*/
|
|
6
12
|
function CreateProject(options = {}) {
|
|
7
13
|
return new ts_morph_1.Project((0, utilities_1.deepMerge)({
|
|
8
14
|
manipulationSettings: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/create-project.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/create-project.ts"],"names":[],"mappings":";;AAeA,sCAUC;AAzBD,+CAA4C;AAC5C,uCAMkB;AAElB;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,UAA0B,EAAE;IACxD,OAAO,IAAI,kBAAO,CAAC,IAAA,qBAAS,EAAC;QAC3B,oBAAoB,EAAE;YACpB,eAAe,EAAE,0BAAe,CAAC,SAAS;YAC1C,SAAS,EAAE,oBAAS,CAAC,MAAM;YAC3B,WAAW,EAAE,sBAAW,CAAC,QAAQ;YACjC,iBAAiB,EAAE,IAAI;SACxB;QACD,qBAAqB,EAAE,IAAI;KAC5B,EAAE,OAAO,CAAC,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -2,13 +2,28 @@ import { Normalized } from '@rxap/utilities';
|
|
|
2
2
|
import { OptionalKind, PropertySignatureStructure, SourceFile } from 'ts-morph';
|
|
3
3
|
import { NormalizedTypeImport, TypeImport, TypeName } from './type-import';
|
|
4
4
|
export interface DataProperty {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the property.
|
|
7
|
+
*/
|
|
5
8
|
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The type of the property. Can be a string, type name enum, or TypeImport.
|
|
11
|
+
*/
|
|
6
12
|
type?: TypeImport | TypeName;
|
|
13
|
+
/**
|
|
14
|
+
* If true, the property is an array of the specified type.
|
|
15
|
+
*/
|
|
7
16
|
isArray?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* If true, the property is optional (?).
|
|
19
|
+
*/
|
|
8
20
|
isOptional?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The original source property name (e.g. from an upstream API).
|
|
23
|
+
*/
|
|
9
24
|
source?: string | null;
|
|
10
25
|
/**
|
|
11
|
-
* If set the property is an object with the given members
|
|
26
|
+
* If set, the property is an object with the given members (nested structure).
|
|
12
27
|
*/
|
|
13
28
|
memberList?: Array<string | DataProperty>;
|
|
14
29
|
}
|
|
@@ -17,6 +32,29 @@ export interface NormalizedDataProperty extends Readonly<Normalized<Omit<DataPro
|
|
|
17
32
|
source: string | null;
|
|
18
33
|
memberList: Array<NormalizedDataProperty>;
|
|
19
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes a data property definition into a standardized format.
|
|
37
|
+
* Used for generating properties in DTOs or interfaces.
|
|
38
|
+
*
|
|
39
|
+
* @param property - The property definition (string or object).
|
|
40
|
+
* @param defaultType - Default type to use if not specified.
|
|
41
|
+
* @param isArray - Whether the property is an array.
|
|
42
|
+
* @returns The normalized data property.
|
|
43
|
+
*/
|
|
20
44
|
export declare function NormalizeDataProperty(property: TypeName | Readonly<DataProperty>, defaultType?: TypeImport | TypeName, isArray?: boolean): NormalizedDataProperty;
|
|
45
|
+
/**
|
|
46
|
+
* Normalizes a list of data properties.
|
|
47
|
+
*
|
|
48
|
+
* @param propertyList - The list of properties to normalize.
|
|
49
|
+
* @param defaultType - Default type for properties.
|
|
50
|
+
* @returns An array of normalized data properties.
|
|
51
|
+
*/
|
|
21
52
|
export declare function NormalizeDataPropertyList(propertyList?: Array<string | DataProperty>, defaultType?: TypeImport | TypeName): Array<NormalizedDataProperty>;
|
|
53
|
+
/**
|
|
54
|
+
* Converts a normalized data property to a PropertySignatureStructure for ts-morph.
|
|
55
|
+
*
|
|
56
|
+
* @param property - The data property.
|
|
57
|
+
* @param sourceFile - The source file (used for resolving imports).
|
|
58
|
+
* @returns The property signature structure.
|
|
59
|
+
*/
|
|
22
60
|
export declare function NormalizeDataPropertyToPropertySignatureStructure(property: DataProperty, sourceFile: SourceFile): OptionalKind<PropertySignatureStructure>;
|
package/src/lib/data-property.js
CHANGED
|
@@ -32,6 +32,15 @@ const notAllowedInVariableNames = [
|
|
|
32
32
|
" ", "!", "\"", "#", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/",
|
|
33
33
|
":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "`", "{", "|", "}", "~"
|
|
34
34
|
];
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes a data property definition into a standardized format.
|
|
37
|
+
* Used for generating properties in DTOs or interfaces.
|
|
38
|
+
*
|
|
39
|
+
* @param property - The property definition (string or object).
|
|
40
|
+
* @param defaultType - Default type to use if not specified.
|
|
41
|
+
* @param isArray - Whether the property is an array.
|
|
42
|
+
* @returns The normalized data property.
|
|
43
|
+
*/
|
|
35
44
|
function NormalizeDataProperty(property, defaultType = 'unknown', isArray = false) {
|
|
36
45
|
var _a, _b, _c, _d, _e, _f;
|
|
37
46
|
let name;
|
|
@@ -93,10 +102,24 @@ function NormalizeDataProperty(property, defaultType = 'unknown', isArray = fals
|
|
|
93
102
|
memberList,
|
|
94
103
|
});
|
|
95
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Normalizes a list of data properties.
|
|
107
|
+
*
|
|
108
|
+
* @param propertyList - The list of properties to normalize.
|
|
109
|
+
* @param defaultType - Default type for properties.
|
|
110
|
+
* @returns An array of normalized data properties.
|
|
111
|
+
*/
|
|
96
112
|
function NormalizeDataPropertyList(propertyList, defaultType = 'unknown') {
|
|
97
113
|
var _a;
|
|
98
114
|
return (_a = propertyList === null || propertyList === void 0 ? void 0 : propertyList.map(property => NormalizeDataProperty(property, defaultType))) !== null && _a !== void 0 ? _a : [];
|
|
99
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Converts a normalized data property to a PropertySignatureStructure for ts-morph.
|
|
118
|
+
*
|
|
119
|
+
* @param property - The data property.
|
|
120
|
+
* @param sourceFile - The source file (used for resolving imports).
|
|
121
|
+
* @returns The property signature structure.
|
|
122
|
+
*/
|
|
100
123
|
function NormalizeDataPropertyToPropertySignatureStructure(property, sourceFile) {
|
|
101
124
|
return {
|
|
102
125
|
type: (0, write_type_1.WriteType)(property, sourceFile),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-property.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/data-property.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"data-property.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/data-property.ts"],"names":[],"mappings":";;AAyFA,sDAyDC;AASD,8DAEC;AASD,8GAQC;AA9KD,+CAGyB;AAMzB,+CAMuB;AACvB,6CAAyC;AAmCzC,SAAS,SAAS,CAAC,IAAY;IAC7B,QAAQ,IAAI,EAAE,CAAC;QACb,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;IACN,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,yBAAyB,GAAG;IAChC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAC1E,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CAChF,CAAC;AAGF;;;;;;;;GAQG;AACH,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,UAAU,GAAkC,EAAE,CAAC;IACnD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,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,IAAI,IAAI,CAAC,CAAC,uCAAuC;IACtE,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QACrB,IAAI,GAAG,MAAA,QAAQ,CAAC,IAAI,mCAAI,IAAI,CAAC;QAC7B,OAAO,GAAG,MAAA,QAAQ,CAAC,OAAO,mCAAI,OAAO,CAAC;QACtC,UAAU,GAAG,MAAA,QAAQ,CAAC,UAAU,mCAAI,UAAU,CAAC;QAC/C,MAAM,GAAG,MAAA,QAAQ,CAAC,MAAM,mCAAI,MAAM,CAAC;QACnC,UAAU,GAAG,yBAAyB,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,aAAJ,IAAI,cAAJ,IAAI,IAAJ,IAAI,GAAK,WAAW,EAAC;IACrB,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE,CAAC;QAChF,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;IACD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,MAAM,sBAAsB,GAAG,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,0CAAG,CAAC,EAAE,MAAM,mCAAI,CAAC,CAAC;QAClE,MAAM,6BAA6B,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACzE,IAAI,GAAG,IAAA,oBAAQ,EAAC,6BAA6B,CAAC,CAAC;QAC/C,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,IAAI,EAAE,IAAA,iCAAmB,EAAC,IAAI,CAAC;QAC/B,OAAO;QACP,UAAU;QACV,MAAM;QACN,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,YAA2C,EAAE,cAAqC,SAAS;;IACnI,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;AAED;;;;;;GAMG;AACH,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"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type FindFunction<Node> = (node: Node) => boolean;
|
|
2
2
|
export type FindFunctionFactory<CompareTo, Node> = (compareTo: CompareTo) => FindFunction<Node>;
|
|
3
|
+
/**
|
|
4
|
+
* Factory function to create a find function that searches by name.
|
|
5
|
+
*
|
|
6
|
+
* @param compareTo - Object containing the name to compare against.
|
|
7
|
+
* @returns A function that returns true if the node's name matches.
|
|
8
|
+
*/
|
|
3
9
|
export declare function FindByNameFunction<CompareTo extends {
|
|
4
10
|
name: string;
|
|
5
11
|
}, Node extends {
|
package/src/lib/find-function.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FindByNameFunction = FindByNameFunction;
|
|
4
|
+
/**
|
|
5
|
+
* Factory function to create a find function that searches by name.
|
|
6
|
+
*
|
|
7
|
+
* @param compareTo - Object containing the name to compare against.
|
|
8
|
+
* @returns A function that returns true if the node's name matches.
|
|
9
|
+
*/
|
|
4
10
|
function FindByNameFunction(compareTo) {
|
|
5
11
|
return node => { var _a; return ((_a = node.getName()) === null || _a === void 0 ? void 0 : _a.trim()) === compareTo.name; };
|
|
6
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-function.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/find-function.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"find-function.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/find-function.ts"],"names":[],"mappings":";;AAUA,gDAKC;AAXD;;;;;GAKG;AACH,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"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetClassDecoratorArguments = GetClassDecoratorArguments;
|
|
4
|
+
/**
|
|
5
|
+
* Gets the arguments of a class decorator.
|
|
6
|
+
*
|
|
7
|
+
* @param classDeclaration - The class declaration to get the decorator from.
|
|
8
|
+
* @param findFunction - A function to find the decorator or the name of the decorator.
|
|
9
|
+
* @returns An array of arguments (Nodes).
|
|
10
|
+
*/
|
|
4
11
|
function GetClassDecoratorArguments(classDeclaration, nameOrFindFunction) {
|
|
5
12
|
var _a;
|
|
6
13
|
let decorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-class-decorator-arguments.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/get-class-decorator-arguments.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-class-decorator-arguments.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/get-class-decorator-arguments.ts"],"names":[],"mappings":";;AAqBA,gEAcC;AArBD;;;;;;GAMG;AACH,SAAgB,0BAA0B,CACxC,gBAAkC,EAClC,kBAAkE;;IAElE,IAAI,SAAgC,CAAC;IAErC,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QAC3C,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAChE,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,EAAE,mCAAI,EAAE,CAAC;AAEzC,CAAC"}
|
package/src/lib/get-class.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { ClassDeclaration, SourceFile } from 'ts-morph';
|
|
2
2
|
import { FindFunction } from './find-function';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a class declaration from a source file.
|
|
5
|
+
* If nameOrFindFunction is provided, it searches for a matching class.
|
|
6
|
+
* If not provided, it returns the single class in the file (throws if 0 or >1).
|
|
7
|
+
*
|
|
8
|
+
* @param sourceFile - The source file to search.
|
|
9
|
+
* @param nameOrFindFunction - The name of the class or a find function.
|
|
10
|
+
* @returns The class declaration.
|
|
11
|
+
*/
|
|
3
12
|
export declare function GetClass(sourceFile: SourceFile, nameOrFindFunction?: string | FindFunction<ClassDeclaration>): ClassDeclaration;
|
package/src/lib/get-class.js
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetClass = GetClass;
|
|
4
4
|
const find_function_1 = require("./find-function");
|
|
5
|
+
/**
|
|
6
|
+
* Gets a class declaration from a source file.
|
|
7
|
+
* If nameOrFindFunction is provided, it searches for a matching class.
|
|
8
|
+
* If not provided, it returns the single class in the file (throws if 0 or >1).
|
|
9
|
+
*
|
|
10
|
+
* @param sourceFile - The source file to search.
|
|
11
|
+
* @param nameOrFindFunction - The name of the class or a find function.
|
|
12
|
+
* @returns The class declaration.
|
|
13
|
+
*/
|
|
5
14
|
function GetClass(sourceFile, nameOrFindFunction) {
|
|
6
15
|
if (nameOrFindFunction) {
|
|
7
16
|
let findFunction;
|
package/src/lib/get-class.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-class.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/get-class.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-class.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/get-class.ts"],"names":[],"mappings":";;AAkBA,4BA0BC;AAxCD,mDAGyB;AAEzB;;;;;;;;GAQG;AACH,SAAgB,QAAQ,CAAC,UAAsB,EAAE,kBAA4D;IAE3G,IAAI,kBAAkB,EAAE,CAAC;QACvB,IAAI,YAA4C,CAAC;QAEjD,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;YAC3C,YAAY,GAAG,IAAA,kCAAkB,EAAwB,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACzF,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,kBAAkB,CAAC;QACpC,CAAC;QAED,OAAO,UAAU,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,oBAAoB,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC;IAErD,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,uCAAwC,UAAU,CAAC,WAAW,EAAG,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,8CAA+C,UAAU,CAAC,WAAW,EAAG,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAEjC,CAAC"}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import { ArrayLiteralExpression, ObjectLiteralExpression } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Gets an array literal expression from a property assignment in an object literal.
|
|
4
|
+
* Returns null if the property does not exist.
|
|
5
|
+
* Throws if the property is not an array literal assignment.
|
|
6
|
+
*
|
|
7
|
+
* @param objectLiteral - The object literal expression.
|
|
8
|
+
* @param propertyKey - The name of the property.
|
|
9
|
+
* @returns The array literal expression or null.
|
|
10
|
+
*/
|
|
2
11
|
export declare function GetArrayLiteralFromObjectLiteral(objectLiteral: ObjectLiteralExpression, propertyKey: string): ArrayLiteralExpression | null;
|
|
12
|
+
/**
|
|
13
|
+
* Gets or creates an array literal expression from a property assignment in an object literal.
|
|
14
|
+
* If the property does not exist, it creates it with an empty array initializer.
|
|
15
|
+
*
|
|
16
|
+
* @param objectLiteral - The object literal expression.
|
|
17
|
+
* @param propertyKey - The name of the property.
|
|
18
|
+
* @returns The array literal expression.
|
|
19
|
+
*/
|
|
3
20
|
export declare function GetCoerceArrayLiteralFromObjectLiteral(objectLiteral: ObjectLiteralExpression, propertyKey: string): ArrayLiteralExpression;
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetArrayLiteralFromObjectLiteral = GetArrayLiteralFromObjectLiteral;
|
|
4
4
|
exports.GetCoerceArrayLiteralFromObjectLiteral = GetCoerceArrayLiteralFromObjectLiteral;
|
|
5
5
|
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
/**
|
|
7
|
+
* Gets an array literal expression from a property assignment in an object literal.
|
|
8
|
+
* Returns null if the property does not exist.
|
|
9
|
+
* Throws if the property is not an array literal assignment.
|
|
10
|
+
*
|
|
11
|
+
* @param objectLiteral - The object literal expression.
|
|
12
|
+
* @param propertyKey - The name of the property.
|
|
13
|
+
* @returns The array literal expression or null.
|
|
14
|
+
*/
|
|
6
15
|
function GetArrayLiteralFromObjectLiteral(objectLiteral, propertyKey) {
|
|
7
16
|
const arrayLiteralAssignment = objectLiteral.getProperty(propertyKey);
|
|
8
17
|
if (!arrayLiteralAssignment) {
|
|
@@ -20,6 +29,14 @@ function GetArrayLiteralFromObjectLiteral(objectLiteral, propertyKey) {
|
|
|
20
29
|
}
|
|
21
30
|
return arrayLiteral;
|
|
22
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets or creates an array literal expression from a property assignment in an object literal.
|
|
34
|
+
* If the property does not exist, it creates it with an empty array initializer.
|
|
35
|
+
*
|
|
36
|
+
* @param objectLiteral - The object literal expression.
|
|
37
|
+
* @param propertyKey - The name of the property.
|
|
38
|
+
* @returns The array literal expression.
|
|
39
|
+
*/
|
|
23
40
|
function GetCoerceArrayLiteralFromObjectLiteral(objectLiteral, propertyKey) {
|
|
24
41
|
let arrayLiteralAssignment = objectLiteral.getProperty(propertyKey);
|
|
25
42
|
if (!arrayLiteralAssignment) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-coerce-array-literal-form-object-literal.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/get-coerce-array-literal-form-object-literal.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-coerce-array-literal-form-object-literal.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/get-coerce-array-literal-form-object-literal.ts"],"names":[],"mappings":";;AAgBA,4EA2BC;AAUD,wFA8BC;AAnFD,uCAKkB;AAElB;;;;;;;;GAQG;AACH,SAAgB,gCAAgC,CAC9C,aAAsC,EACtC,WAAmB;IAGnB,MAAM,sBAAsB,GAAG,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtE,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,CAAC,sBAAsB,CAAC,MAAM,CAAC,qBAAU,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,YAAY,GAAG,sBAAsB,CAAC,cAAc,EAAE,CAAC;IAE7D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,qBAAU,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,YAAY,CAAC;AAEtB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,sCAAsC,CACpD,aAAsC,EACtC,WAAmB;IAGnB,IAAI,sBAAsB,GAAG,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAEpE,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,sBAAsB,GAAG,aAAa,CAAC,qBAAqB,CAAC;YAC3D,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,CAAC,sBAAsB,CAAC,MAAM,CAAC,qBAAU,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,YAAY,GAAG,sBAAsB,CAAC,cAAc,EAAE,CAAC;IAE7D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,qBAAU,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,YAAY,CAAC;AAEtB,CAAC"}
|
package/src/lib/identifier.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { DataProperty, NormalizedDataProperty } from './data-property';
|
|
2
2
|
export interface IdentifierOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The property definition used as the identifier.
|
|
5
|
+
*/
|
|
3
6
|
property: DataProperty;
|
|
7
|
+
/**
|
|
8
|
+
* The source of the identifier (e.g. database column name).
|
|
9
|
+
*/
|
|
4
10
|
source?: string;
|
|
5
11
|
}
|
|
6
12
|
export interface NormalizedIdentifierOptions {
|
|
7
13
|
property: NormalizedDataProperty;
|
|
8
14
|
source: string | null;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Normalizes identifier options for accordion or similar components.
|
|
18
|
+
*
|
|
19
|
+
* @param identifier - The identifier options to normalize.
|
|
20
|
+
* @returns The normalized identifier options or null.
|
|
21
|
+
*/
|
|
10
22
|
export declare function NormalizeAccordionIdentifier(identifier?: IdentifierOptions): NormalizedIdentifierOptions | null;
|
package/src/lib/identifier.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NormalizeAccordionIdentifier = NormalizeAccordionIdentifier;
|
|
4
4
|
const data_property_1 = require("./data-property");
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes identifier options for accordion or similar components.
|
|
7
|
+
*
|
|
8
|
+
* @param identifier - The identifier options to normalize.
|
|
9
|
+
* @returns The normalized identifier options or null.
|
|
10
|
+
*/
|
|
5
11
|
function NormalizeAccordionIdentifier(identifier) {
|
|
6
12
|
var _a;
|
|
7
13
|
if (!identifier || Object.keys(identifier).length === 0 || Object.keys(identifier.property).length === 0 || identifier.property.name === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/identifier.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/identifier.ts"],"names":[],"mappings":";;AA4BA,oEAQC;AApCD,mDAIyB;AAkBzB;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,UAA8B;;IACzE,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACnJ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,IAAA,qCAAqB,EAAC,UAAU,CAAC,QAAQ,CAAC;QACpD,MAAM,EAAE,MAAA,UAAU,CAAC,MAAM,mCAAI,IAAI;KAClC,CAAC;AACJ,CAAC"}
|