@itwin/ecschema2ts 4.0.0-dev.8 → 4.0.0-dev.81
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/lib/cjs/ecschema2ts.d.ts +130 -130
- package/lib/cjs/ecschema2ts.js +546 -546
- package/lib/cjs/ecschema2ts.js.map +1 -1
- package/lib/cjs/ecschema2ts_cli.d.ts +1 -1
- package/lib/cjs/ecschema2ts_cli.js +61 -61
- package/lib/cjs/ecschema2ts_io.d.ts +26 -26
- package/lib/cjs/ecschema2ts_io.js +272 -272
- package/lib/cjs/ecschema2ts_io.js.map +1 -1
- package/package.json +14 -14
package/lib/cjs/ecschema2ts.d.ts
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
import { Schema } from "@itwin/ecschema-metadata";
|
|
2
|
-
/**
|
|
3
|
-
* @beta
|
|
4
|
-
*/
|
|
5
|
-
export declare class ECSchemaToTs {
|
|
6
|
-
private _tsBentleyModuleNames;
|
|
7
|
-
private _tsBentleyModuleResolvedConflictNames;
|
|
8
|
-
private _schema?;
|
|
9
|
-
private _schemaItemList;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Given the schema, the function will converted it to typescript strings
|
|
13
|
-
* @param schema The schema to be converted to typescript strings
|
|
14
|
-
*/
|
|
15
|
-
convertSchemaToTs(schema: Schema): {
|
|
16
|
-
schemaTsString: string;
|
|
17
|
-
elemTsString: string;
|
|
18
|
-
propsTsString: string;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* The function will push all the base classes to be the first ones in the schema item list.
|
|
22
|
-
* For example, if class A extends base class B and base class C, B and C will be on the first of the list and then A at the end.
|
|
23
|
-
* If B extends C, then B will be first and C will be next in the list and then A at the end.
|
|
24
|
-
* If B and C does not depend on each other, the order of B and C will not be important.
|
|
25
|
-
* The arrangement is to make sure that base class will be converted first and then, derived classes and so on
|
|
26
|
-
*/
|
|
27
|
-
private dependencyToFront;
|
|
28
|
-
/**
|
|
29
|
-
* The function converts the schema meta data to typescript Schema class
|
|
30
|
-
*/
|
|
31
|
-
private convertSchemaToTsClass;
|
|
32
|
-
/**
|
|
33
|
-
* The function converts the schema item to respective typescript classes
|
|
34
|
-
*/
|
|
35
|
-
private convertElemToTsClasses;
|
|
36
|
-
/**
|
|
37
|
-
* The function converts the schema item properties to respective typescript props interfaces
|
|
38
|
-
*/
|
|
39
|
-
private convertPropsToTsInterfaces;
|
|
40
|
-
/**
|
|
41
|
-
* Convert mixin or struct class or entity class to respective typescript interface
|
|
42
|
-
* @param ecClass Schema mixin or struct or entity to be converted typescript interface
|
|
43
|
-
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
44
|
-
*/
|
|
45
|
-
private convertECClassPropsToTsInterface;
|
|
46
|
-
/**
|
|
47
|
-
* Convert schema enumeration to typescript enumeration
|
|
48
|
-
* @param ecEnum Schema enumeration to be converted to typescript enumeration
|
|
49
|
-
*/
|
|
50
|
-
private convertEnumToTs;
|
|
51
|
-
/**
|
|
52
|
-
* Convert schema entity to typescript entity class. The typescript class will implement respective props
|
|
53
|
-
* typescript interface if the schema entity class has properties
|
|
54
|
-
* @param ecClass Schema class to be converted to typescript class
|
|
55
|
-
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
56
|
-
*/
|
|
57
|
-
private convertEntityToTs;
|
|
58
|
-
/**
|
|
59
|
-
* Convert class properties to typescript member declaration
|
|
60
|
-
* @param ecClass The schema class that has the properties to be converted to typescript member variables
|
|
61
|
-
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
62
|
-
*/
|
|
63
|
-
private convertPropsToTsVars;
|
|
64
|
-
/**
|
|
65
|
-
* Convert schema extended type to typescript type
|
|
66
|
-
* @param typeName Schema extended type to be converted to typescript type
|
|
67
|
-
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
68
|
-
*/
|
|
69
|
-
private convertExtendedTypeNameToTsType;
|
|
70
|
-
/**
|
|
71
|
-
* Convert schema primitive type to typescript type
|
|
72
|
-
* @param type Schema primitive type to be converted to typescript type
|
|
73
|
-
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
74
|
-
*/
|
|
75
|
-
private convertPrimitiveTypeToTsType;
|
|
76
|
-
/**
|
|
77
|
-
* Convert schema description to typescript comment
|
|
78
|
-
* @param description Schema description to be converted to typescript comment
|
|
79
|
-
*/
|
|
80
|
-
private convertDescriptionToTsComment;
|
|
81
|
-
/**
|
|
82
|
-
* Convert all modules needed for the converted schema types to typescript import statements
|
|
83
|
-
* @param classNameToModule Modules to be converted to typescript imports statement
|
|
84
|
-
*/
|
|
85
|
-
private convertImportToTsImport;
|
|
86
|
-
/**
|
|
87
|
-
* Traverse the inheritance tree to retrieve first base classes that have properties
|
|
88
|
-
* @param ecClass Schema class to be traverse
|
|
89
|
-
*/
|
|
90
|
-
private getBaseClassWithProps;
|
|
91
|
-
/**
|
|
92
|
-
* Traverse the inheritance tree to retrieve base classes of a schema class
|
|
93
|
-
* @param ecClass Schema class to be traverse
|
|
94
|
-
*/
|
|
95
|
-
private getAllBaseClasses;
|
|
96
|
-
/**
|
|
97
|
-
* Traverse the inheritance tree horizontally and vertically of a schema class
|
|
98
|
-
* @param ecClass Schema class to be traverse
|
|
99
|
-
* @param visited Set of classes that are already visited
|
|
100
|
-
* @param shouldTraverseDown Lambda to determine if it should traverse more vertically
|
|
101
|
-
*/
|
|
102
|
-
private traverseBaseClass;
|
|
103
|
-
/**
|
|
104
|
-
* Add required typescript class that is to be imported from a required module during Schema conversion to typescript. If there is naming conflict
|
|
105
|
-
* it will resolve it by appending prefix name with class name, for example: import { element as BisCoreElement } from "BisCoreElement";
|
|
106
|
-
* @param classNameToModule Typescript modules that is needed for the conversion. It maps typescript class with the required modules
|
|
107
|
-
* @param refModule Typescript module that the typescrip class comes from
|
|
108
|
-
* @param className Required Typescript class for the conversion
|
|
109
|
-
*/
|
|
110
|
-
private addImportClass;
|
|
111
|
-
/**
|
|
112
|
-
* Add appropriate typescript props interface to the classNameToModule and return the corresponding typescript base props interface
|
|
113
|
-
* @param classNameToModule Typescript modules that is needed for the conversion. It maps typescript class with the required modules
|
|
114
|
-
* @param baseECClass Base class of ecClass that has properties. Its name will be used to derived typescript base props interface
|
|
115
|
-
* @param ecClass ECClass to be converted to Typescript
|
|
116
|
-
*/
|
|
117
|
-
private addImportBasePropsClass;
|
|
118
|
-
/**
|
|
119
|
-
* Add appropriate typescript base class to the classNameToModule and return the corresponding typescript base class
|
|
120
|
-
* @param classNameToModule Typescript modules that is needed for the conversion. It maps typescript class with the required modules
|
|
121
|
-
* @param baseECClass Base class of ecClass
|
|
122
|
-
* @param ecClass ECClass to be converted to Typescript
|
|
123
|
-
*/
|
|
124
|
-
private addImportBaseClass;
|
|
125
|
-
/**
|
|
126
|
-
* Lower the first character of the property name
|
|
127
|
-
* @param propName Property name
|
|
128
|
-
*/
|
|
129
|
-
private lowerPropertyName;
|
|
130
|
-
}
|
|
1
|
+
import { Schema } from "@itwin/ecschema-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* @beta
|
|
4
|
+
*/
|
|
5
|
+
export declare class ECSchemaToTs {
|
|
6
|
+
private _tsBentleyModuleNames;
|
|
7
|
+
private _tsBentleyModuleResolvedConflictNames;
|
|
8
|
+
private _schema?;
|
|
9
|
+
private _schemaItemList;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Given the schema, the function will converted it to typescript strings
|
|
13
|
+
* @param schema The schema to be converted to typescript strings
|
|
14
|
+
*/
|
|
15
|
+
convertSchemaToTs(schema: Schema): {
|
|
16
|
+
schemaTsString: string;
|
|
17
|
+
elemTsString: string;
|
|
18
|
+
propsTsString: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The function will push all the base classes to be the first ones in the schema item list.
|
|
22
|
+
* For example, if class A extends base class B and base class C, B and C will be on the first of the list and then A at the end.
|
|
23
|
+
* If B extends C, then B will be first and C will be next in the list and then A at the end.
|
|
24
|
+
* If B and C does not depend on each other, the order of B and C will not be important.
|
|
25
|
+
* The arrangement is to make sure that base class will be converted first and then, derived classes and so on
|
|
26
|
+
*/
|
|
27
|
+
private dependencyToFront;
|
|
28
|
+
/**
|
|
29
|
+
* The function converts the schema meta data to typescript Schema class
|
|
30
|
+
*/
|
|
31
|
+
private convertSchemaToTsClass;
|
|
32
|
+
/**
|
|
33
|
+
* The function converts the schema item to respective typescript classes
|
|
34
|
+
*/
|
|
35
|
+
private convertElemToTsClasses;
|
|
36
|
+
/**
|
|
37
|
+
* The function converts the schema item properties to respective typescript props interfaces
|
|
38
|
+
*/
|
|
39
|
+
private convertPropsToTsInterfaces;
|
|
40
|
+
/**
|
|
41
|
+
* Convert mixin or struct class or entity class to respective typescript interface
|
|
42
|
+
* @param ecClass Schema mixin or struct or entity to be converted typescript interface
|
|
43
|
+
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
44
|
+
*/
|
|
45
|
+
private convertECClassPropsToTsInterface;
|
|
46
|
+
/**
|
|
47
|
+
* Convert schema enumeration to typescript enumeration
|
|
48
|
+
* @param ecEnum Schema enumeration to be converted to typescript enumeration
|
|
49
|
+
*/
|
|
50
|
+
private convertEnumToTs;
|
|
51
|
+
/**
|
|
52
|
+
* Convert schema entity to typescript entity class. The typescript class will implement respective props
|
|
53
|
+
* typescript interface if the schema entity class has properties
|
|
54
|
+
* @param ecClass Schema class to be converted to typescript class
|
|
55
|
+
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
56
|
+
*/
|
|
57
|
+
private convertEntityToTs;
|
|
58
|
+
/**
|
|
59
|
+
* Convert class properties to typescript member declaration
|
|
60
|
+
* @param ecClass The schema class that has the properties to be converted to typescript member variables
|
|
61
|
+
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
62
|
+
*/
|
|
63
|
+
private convertPropsToTsVars;
|
|
64
|
+
/**
|
|
65
|
+
* Convert schema extended type to typescript type
|
|
66
|
+
* @param typeName Schema extended type to be converted to typescript type
|
|
67
|
+
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
68
|
+
*/
|
|
69
|
+
private convertExtendedTypeNameToTsType;
|
|
70
|
+
/**
|
|
71
|
+
* Convert schema primitive type to typescript type
|
|
72
|
+
* @param type Schema primitive type to be converted to typescript type
|
|
73
|
+
* @param classNameToModule Typescrip modules to be updated after the conversion
|
|
74
|
+
*/
|
|
75
|
+
private convertPrimitiveTypeToTsType;
|
|
76
|
+
/**
|
|
77
|
+
* Convert schema description to typescript comment
|
|
78
|
+
* @param description Schema description to be converted to typescript comment
|
|
79
|
+
*/
|
|
80
|
+
private convertDescriptionToTsComment;
|
|
81
|
+
/**
|
|
82
|
+
* Convert all modules needed for the converted schema types to typescript import statements
|
|
83
|
+
* @param classNameToModule Modules to be converted to typescript imports statement
|
|
84
|
+
*/
|
|
85
|
+
private convertImportToTsImport;
|
|
86
|
+
/**
|
|
87
|
+
* Traverse the inheritance tree to retrieve first base classes that have properties
|
|
88
|
+
* @param ecClass Schema class to be traverse
|
|
89
|
+
*/
|
|
90
|
+
private getBaseClassWithProps;
|
|
91
|
+
/**
|
|
92
|
+
* Traverse the inheritance tree to retrieve base classes of a schema class
|
|
93
|
+
* @param ecClass Schema class to be traverse
|
|
94
|
+
*/
|
|
95
|
+
private getAllBaseClasses;
|
|
96
|
+
/**
|
|
97
|
+
* Traverse the inheritance tree horizontally and vertically of a schema class
|
|
98
|
+
* @param ecClass Schema class to be traverse
|
|
99
|
+
* @param visited Set of classes that are already visited
|
|
100
|
+
* @param shouldTraverseDown Lambda to determine if it should traverse more vertically
|
|
101
|
+
*/
|
|
102
|
+
private traverseBaseClass;
|
|
103
|
+
/**
|
|
104
|
+
* Add required typescript class that is to be imported from a required module during Schema conversion to typescript. If there is naming conflict
|
|
105
|
+
* it will resolve it by appending prefix name with class name, for example: import { element as BisCoreElement } from "BisCoreElement";
|
|
106
|
+
* @param classNameToModule Typescript modules that is needed for the conversion. It maps typescript class with the required modules
|
|
107
|
+
* @param refModule Typescript module that the typescrip class comes from
|
|
108
|
+
* @param className Required Typescript class for the conversion
|
|
109
|
+
*/
|
|
110
|
+
private addImportClass;
|
|
111
|
+
/**
|
|
112
|
+
* Add appropriate typescript props interface to the classNameToModule and return the corresponding typescript base props interface
|
|
113
|
+
* @param classNameToModule Typescript modules that is needed for the conversion. It maps typescript class with the required modules
|
|
114
|
+
* @param baseECClass Base class of ecClass that has properties. Its name will be used to derived typescript base props interface
|
|
115
|
+
* @param ecClass ECClass to be converted to Typescript
|
|
116
|
+
*/
|
|
117
|
+
private addImportBasePropsClass;
|
|
118
|
+
/**
|
|
119
|
+
* Add appropriate typescript base class to the classNameToModule and return the corresponding typescript base class
|
|
120
|
+
* @param classNameToModule Typescript modules that is needed for the conversion. It maps typescript class with the required modules
|
|
121
|
+
* @param baseECClass Base class of ecClass
|
|
122
|
+
* @param ecClass ECClass to be converted to Typescript
|
|
123
|
+
*/
|
|
124
|
+
private addImportBaseClass;
|
|
125
|
+
/**
|
|
126
|
+
* Lower the first character of the property name
|
|
127
|
+
* @param propName Property name
|
|
128
|
+
*/
|
|
129
|
+
private lowerPropertyName;
|
|
130
|
+
}
|
|
131
131
|
//# sourceMappingURL=ecschema2ts.d.ts.map
|