@odata2ts/odata2ts 0.23.1 → 0.25.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 +22 -0
- package/lib/FactoryFunctionModel.d.ts +13 -13
- package/lib/FactoryFunctionModel.js +2 -2
- package/lib/FactoryFunctionModel.js.map +1 -1
- package/lib/NamingModel.d.ts +182 -182
- package/lib/NamingModel.js +11 -11
- package/lib/NamingModel.js.map +1 -1
- package/lib/OptionModel.d.ts +228 -223
- package/lib/OptionModel.js +23 -23
- package/lib/OptionModel.js.map +1 -1
- package/lib/app.d.ts +8 -8
- package/lib/app.js +67 -63
- package/lib/app.js.map +1 -1
- package/lib/cli.d.ts +3 -3
- package/lib/cli.js +153 -153
- package/lib/data-model/DataModel.d.ts +88 -85
- package/lib/data-model/DataModel.js +141 -134
- package/lib/data-model/DataModel.js.map +1 -1
- package/lib/data-model/DataModelDigestion.d.ts +48 -44
- package/lib/data-model/DataModelDigestion.js +299 -274
- package/lib/data-model/DataModelDigestion.js.map +1 -1
- package/lib/data-model/DataModelDigestionV2.d.ts +10 -10
- package/lib/data-model/DataModelDigestionV2.js +210 -200
- package/lib/data-model/DataModelDigestionV2.js.map +1 -1
- package/lib/data-model/DataModelDigestionV4.d.ts +3 -3
- package/lib/data-model/DataModelDigestionV4.js +197 -195
- package/lib/data-model/DataModelDigestionV4.js.map +1 -1
- package/lib/data-model/DataTypeModel.d.ts +102 -102
- package/lib/data-model/DataTypeModel.js +8 -8
- package/lib/data-model/DataTypeModel.js.map +1 -1
- package/lib/data-model/NamingHelper.d.ts +57 -55
- package/lib/data-model/NamingHelper.js +231 -214
- package/lib/data-model/NamingHelper.js.map +1 -1
- package/lib/data-model/ServiceConfigHelper.d.ts +21 -21
- package/lib/data-model/ServiceConfigHelper.js +113 -113
- package/lib/data-model/edmx/ODataEdmxModelBase.d.ts +92 -80
- package/lib/data-model/edmx/ODataEdmxModelBase.js +2 -2
- package/lib/data-model/edmx/ODataEdmxModelBase.js.map +1 -1
- package/lib/data-model/edmx/ODataEdmxModelV3.d.ts +63 -63
- package/lib/data-model/edmx/ODataEdmxModelV3.js +2 -2
- package/lib/data-model/edmx/ODataEdmxModelV4.d.ts +67 -67
- package/lib/data-model/edmx/ODataEdmxModelV4.js +2 -2
- package/lib/defaultConfig.d.ts +9 -9
- package/lib/defaultConfig.js +165 -164
- package/lib/defaultConfig.js.map +1 -1
- package/lib/evaluateConfig.d.ts +25 -25
- package/lib/evaluateConfig.js +82 -82
- package/lib/generator/ImportContainer.d.ts +16 -16
- package/lib/generator/ImportContainer.js +91 -91
- package/lib/generator/ModelGenerator.d.ts +2 -2
- package/lib/generator/ModelGenerator.js +211 -183
- package/lib/generator/ModelGenerator.js.map +1 -1
- package/lib/generator/QueryObjectGenerator.d.ts +2 -2
- package/lib/generator/QueryObjectGenerator.js +239 -239
- package/lib/generator/ServiceGenerator.d.ts +8 -8
- package/lib/generator/ServiceGenerator.js +422 -422
- package/lib/generator/index.d.ts +3 -3
- package/lib/generator/index.js +9 -9
- package/lib/index.d.ts +3 -3
- package/lib/index.js +6 -6
- package/lib/project/ProjectManager.d.ts +30 -30
- package/lib/project/ProjectManager.js +177 -175
- package/lib/project/ProjectManager.js.map +1 -1
- package/lib/project/formatter/BaseFormatter.d.ts +49 -49
- package/lib/project/formatter/BaseFormatter.js +30 -30
- package/lib/project/formatter/FileFormatter.d.ts +16 -16
- package/lib/project/formatter/FileFormatter.js +2 -2
- package/lib/project/formatter/NoopFormatter.d.ts +29 -29
- package/lib/project/formatter/NoopFormatter.js +42 -42
- package/lib/project/formatter/PrettierFormatter.d.ts +46 -46
- package/lib/project/formatter/PrettierFormatter.js +92 -92
- package/lib/project/formatter/index.d.ts +2 -2
- package/lib/project/formatter/index.js +14 -14
- package/lib/project/logger/logFilePath.d.ts +1 -1
- package/lib/project/logger/logFilePath.js +12 -12
- package/lib/run-cli.d.ts +2 -2
- package/lib/run-cli.js +6 -6
- package/package.json +27 -28
package/lib/OptionModel.d.ts
CHANGED
|
@@ -1,223 +1,228 @@
|
|
|
1
|
-
import { TypeConverterConfig } from "@odata2ts/converter-runtime";
|
|
2
|
-
import { NameSettings, OverridableNamingOptions } from "./NamingModel";
|
|
3
|
-
/**
|
|
4
|
-
* Generation mode, by default "all".
|
|
5
|
-
*/
|
|
6
|
-
export declare enum Modes {
|
|
7
|
-
models = 0,
|
|
8
|
-
qobjects = 1,
|
|
9
|
-
service = 2,
|
|
10
|
-
all = 3
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.
|
|
14
|
-
*/
|
|
15
|
-
export declare enum EmitModes {
|
|
16
|
-
ts = "ts",
|
|
17
|
-
js = "js",
|
|
18
|
-
dts = "dts",
|
|
19
|
-
js_dts = "js_dts"
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Config options for CLI.
|
|
23
|
-
*/
|
|
24
|
-
export interface CliOptions {
|
|
25
|
-
/**
|
|
26
|
-
* The source file to use. Must be an EDMX compliant XML file.
|
|
27
|
-
*
|
|
28
|
-
* If not specified, at least one service must be configured in config file.
|
|
29
|
-
*/
|
|
30
|
-
source?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Specifies the output directory for the generated stuff.
|
|
33
|
-
*
|
|
34
|
-
* If not specified, at least one service must be configured in config file.
|
|
35
|
-
*/
|
|
36
|
-
output?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Only generates the specified services.
|
|
39
|
-
* Relies on an existing config file where these service names are maintained.
|
|
40
|
-
*/
|
|
41
|
-
services?: Array<string>;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies what to generate:
|
|
44
|
-
* - {@code Modes.models} will only generate TS interfaces
|
|
45
|
-
* - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions
|
|
46
|
-
* - {@code Modes.service} will generate one main OData service client and one per each entity
|
|
47
|
-
* - {@code Modes.all} the same as {@code Modes.service}
|
|
48
|
-
*
|
|
49
|
-
* QObjects will also generate models, and generating the service client will also generate models and QObjects.
|
|
50
|
-
* Defaults to {@code Modes.all}
|
|
51
|
-
*/
|
|
52
|
-
mode?: Modes;
|
|
53
|
-
/**
|
|
54
|
-
* Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.
|
|
55
|
-
* Defaults to {@code EmitModes.js_dts}
|
|
56
|
-
*/
|
|
57
|
-
emitMode?: EmitModes;
|
|
58
|
-
/**
|
|
59
|
-
* Uses prettier with your local configuration to pretty print TypeScript files.
|
|
60
|
-
* Only applies if mode is set to {@code EmitModes.ts}.
|
|
61
|
-
*/
|
|
62
|
-
prettier?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* When compiling TypeScript to JS, "tsconfig.json" is used by default to add compilerOptions.
|
|
65
|
-
* This option allows to specify an alternative file.
|
|
66
|
-
*
|
|
67
|
-
* Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.
|
|
68
|
-
*/
|
|
69
|
-
tsconfig?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Verbose debugging information.
|
|
72
|
-
*/
|
|
73
|
-
debug?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Overrides the service name found in the source file.
|
|
76
|
-
*
|
|
77
|
-
* The service name is the basis for all file names and the name of the main OData client service
|
|
78
|
-
* that serves as entry point for the user.
|
|
79
|
-
*/
|
|
80
|
-
serviceName?: string;
|
|
81
|
-
/**
|
|
82
|
-
* odata2ts will automatically decide if a key prop is managed on the server side.
|
|
83
|
-
* If managed, the property will not be editable (create, update, patch).
|
|
84
|
-
* The following rule applies:
|
|
85
|
-
* If a property is the only key prop of an entity, then the prop is deemed to be managed;
|
|
86
|
-
* in ony other case the prop is unmanaged.
|
|
87
|
-
*/
|
|
88
|
-
disableAutoManagedKey?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* By default, odata2ts doesn't change param, operation, property or model names.
|
|
91
|
-
* The generated models and their properties are named exactly as advertised by the server.
|
|
92
|
-
*
|
|
93
|
-
* By allowing odata2ts to change these names, certain predefined formatting strategies are used:
|
|
94
|
-
* Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.
|
|
95
|
-
*
|
|
96
|
-
* The naming configuration allows to control this and other naming related settings.
|
|
97
|
-
* Note: Even if renaming is disabled, model prefixing / suffing still applies.
|
|
98
|
-
*/
|
|
99
|
-
allowRenaming?: boolean;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Available options for the actual generation run.
|
|
103
|
-
* Every property is required, except the overriding service name.
|
|
104
|
-
*/
|
|
105
|
-
export interface RunOptions extends Required<Omit<ServiceGenerationOptions, "serviceName">> {
|
|
106
|
-
serviceName?: string;
|
|
107
|
-
naming: NameSettings;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Available options for configuration files, i.e. odata2ts.config.ts.
|
|
111
|
-
*/
|
|
112
|
-
export interface ConfigFileOptions extends Omit<CliOptions, "source" | "output" | "services"> {
|
|
113
|
-
services?: {
|
|
114
|
-
[serviceName: string]: ServiceGenerationOptions;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Specify which converters to use by their package name, e.g. "@odata2ts/converter-v2-to-v4".
|
|
118
|
-
* Each converter knows which data type to map.
|
|
119
|
-
*
|
|
120
|
-
* To only use specific converters, the object syntax must be used, where supported converters
|
|
121
|
-
* must be listed by their ids.
|
|
122
|
-
*/
|
|
123
|
-
converters?: Array<string | TypeConverterConfig>;
|
|
124
|
-
/**
|
|
125
|
-
* For each model an editable version is generated which represents the model definition for
|
|
126
|
-
* create, update and patch actions.
|
|
127
|
-
*
|
|
128
|
-
* You can skip the generation altogether, not generating editable model variants,
|
|
129
|
-
* if the generation mode is {@code Mode.model} or {@code Mode.qobject}.
|
|
130
|
-
*/
|
|
131
|
-
skipEditableModels?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* ID models are generated from entity id parameters.
|
|
134
|
-
* The generation for one entity entails one model interface representing the id parameters and
|
|
135
|
-
* one QId function which allows to format the parameters for URL usage and to parse parameters
|
|
136
|
-
* from a URL string.
|
|
137
|
-
*
|
|
138
|
-
* You can skip the generation altogether, not generating models and QId objects, if the
|
|
139
|
-
* generation mode is {@code Mode.model} or {@code Mode.qobject}.
|
|
140
|
-
*/
|
|
141
|
-
skipIdModels?: boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Operations are functions and actions of the OData service.
|
|
144
|
-
* The generation for one operation entails one parameter model interface
|
|
145
|
-
* and one QFunction / QAction class.
|
|
146
|
-
*
|
|
147
|
-
* You can skip the generation altogether, neither generating model nor query object,
|
|
148
|
-
* if the generation mode is {@code Mode.model} or {@code Mode.qobject}.
|
|
149
|
-
*/
|
|
150
|
-
skipOperations?: boolean;
|
|
151
|
-
/**
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* to
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
*
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*/
|
|
222
|
-
|
|
223
|
-
|
|
1
|
+
import { TypeConverterConfig } from "@odata2ts/converter-runtime";
|
|
2
|
+
import { NameSettings, OverridableNamingOptions } from "./NamingModel";
|
|
3
|
+
/**
|
|
4
|
+
* Generation mode, by default "all".
|
|
5
|
+
*/
|
|
6
|
+
export declare enum Modes {
|
|
7
|
+
models = 0,
|
|
8
|
+
qobjects = 1,
|
|
9
|
+
service = 2,
|
|
10
|
+
all = 3
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.
|
|
14
|
+
*/
|
|
15
|
+
export declare enum EmitModes {
|
|
16
|
+
ts = "ts",
|
|
17
|
+
js = "js",
|
|
18
|
+
dts = "dts",
|
|
19
|
+
js_dts = "js_dts"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Config options for CLI.
|
|
23
|
+
*/
|
|
24
|
+
export interface CliOptions {
|
|
25
|
+
/**
|
|
26
|
+
* The source file to use. Must be an EDMX compliant XML file.
|
|
27
|
+
*
|
|
28
|
+
* If not specified, at least one service must be configured in config file.
|
|
29
|
+
*/
|
|
30
|
+
source?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the output directory for the generated stuff.
|
|
33
|
+
*
|
|
34
|
+
* If not specified, at least one service must be configured in config file.
|
|
35
|
+
*/
|
|
36
|
+
output?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Only generates the specified services.
|
|
39
|
+
* Relies on an existing config file where these service names are maintained.
|
|
40
|
+
*/
|
|
41
|
+
services?: Array<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies what to generate:
|
|
44
|
+
* - {@code Modes.models} will only generate TS interfaces
|
|
45
|
+
* - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions
|
|
46
|
+
* - {@code Modes.service} will generate one main OData service client and one per each entity
|
|
47
|
+
* - {@code Modes.all} the same as {@code Modes.service}
|
|
48
|
+
*
|
|
49
|
+
* QObjects will also generate models, and generating the service client will also generate models and QObjects.
|
|
50
|
+
* Defaults to {@code Modes.all}
|
|
51
|
+
*/
|
|
52
|
+
mode?: Modes;
|
|
53
|
+
/**
|
|
54
|
+
* Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.
|
|
55
|
+
* Defaults to {@code EmitModes.js_dts}
|
|
56
|
+
*/
|
|
57
|
+
emitMode?: EmitModes;
|
|
58
|
+
/**
|
|
59
|
+
* Uses prettier with your local configuration to pretty print TypeScript files.
|
|
60
|
+
* Only applies if mode is set to {@code EmitModes.ts}.
|
|
61
|
+
*/
|
|
62
|
+
prettier?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When compiling TypeScript to JS, "tsconfig.json" is used by default to add compilerOptions.
|
|
65
|
+
* This option allows to specify an alternative file.
|
|
66
|
+
*
|
|
67
|
+
* Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.
|
|
68
|
+
*/
|
|
69
|
+
tsconfig?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Verbose debugging information.
|
|
72
|
+
*/
|
|
73
|
+
debug?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Overrides the service name found in the source file.
|
|
76
|
+
*
|
|
77
|
+
* The service name is the basis for all file names and the name of the main OData client service
|
|
78
|
+
* that serves as entry point for the user.
|
|
79
|
+
*/
|
|
80
|
+
serviceName?: string;
|
|
81
|
+
/**
|
|
82
|
+
* odata2ts will automatically decide if a key prop is managed on the server side.
|
|
83
|
+
* If managed, the property will not be editable (create, update, patch).
|
|
84
|
+
* The following rule applies:
|
|
85
|
+
* If a property is the only key prop of an entity, then the prop is deemed to be managed;
|
|
86
|
+
* in ony other case the prop is unmanaged.
|
|
87
|
+
*/
|
|
88
|
+
disableAutoManagedKey?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* By default, odata2ts doesn't change param, operation, property or model names.
|
|
91
|
+
* The generated models and their properties are named exactly as advertised by the server.
|
|
92
|
+
*
|
|
93
|
+
* By allowing odata2ts to change these names, certain predefined formatting strategies are used:
|
|
94
|
+
* Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.
|
|
95
|
+
*
|
|
96
|
+
* The naming configuration allows to control this and other naming related settings.
|
|
97
|
+
* Note: Even if renaming is disabled, model prefixing / suffing still applies.
|
|
98
|
+
*/
|
|
99
|
+
allowRenaming?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Available options for the actual generation run.
|
|
103
|
+
* Every property is required, except the overriding service name.
|
|
104
|
+
*/
|
|
105
|
+
export interface RunOptions extends Required<Omit<ServiceGenerationOptions, "serviceName">> {
|
|
106
|
+
serviceName?: string;
|
|
107
|
+
naming: NameSettings;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Available options for configuration files, i.e. odata2ts.config.ts.
|
|
111
|
+
*/
|
|
112
|
+
export interface ConfigFileOptions extends Omit<CliOptions, "source" | "output" | "services"> {
|
|
113
|
+
services?: {
|
|
114
|
+
[serviceName: string]: ServiceGenerationOptions;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Specify which converters to use by their package name, e.g. "@odata2ts/converter-v2-to-v4".
|
|
118
|
+
* Each converter knows which data type to map.
|
|
119
|
+
*
|
|
120
|
+
* To only use specific converters, the object syntax must be used, where supported converters
|
|
121
|
+
* must be listed by their ids.
|
|
122
|
+
*/
|
|
123
|
+
converters?: Array<string | TypeConverterConfig>;
|
|
124
|
+
/**
|
|
125
|
+
* For each model an editable version is generated which represents the model definition for
|
|
126
|
+
* create, update and patch actions.
|
|
127
|
+
*
|
|
128
|
+
* You can skip the generation altogether, not generating editable model variants,
|
|
129
|
+
* if the generation mode is {@code Mode.model} or {@code Mode.qobject}.
|
|
130
|
+
*/
|
|
131
|
+
skipEditableModels?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* ID models are generated from entity id parameters.
|
|
134
|
+
* The generation for one entity entails one model interface representing the id parameters and
|
|
135
|
+
* one QId function which allows to format the parameters for URL usage and to parse parameters
|
|
136
|
+
* from a URL string.
|
|
137
|
+
*
|
|
138
|
+
* You can skip the generation altogether, not generating models and QId objects, if the
|
|
139
|
+
* generation mode is {@code Mode.model} or {@code Mode.qobject}.
|
|
140
|
+
*/
|
|
141
|
+
skipIdModels?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Operations are functions and actions of the OData service.
|
|
144
|
+
* The generation for one operation entails one parameter model interface
|
|
145
|
+
* and one QFunction / QAction class.
|
|
146
|
+
*
|
|
147
|
+
* You can skip the generation altogether, neither generating model nor query object,
|
|
148
|
+
* if the generation mode is {@code Mode.model} or {@code Mode.qobject}.
|
|
149
|
+
*/
|
|
150
|
+
skipOperations?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Model properties have explaining comments by default.
|
|
153
|
+
* With this option you can turn that off.
|
|
154
|
+
*/
|
|
155
|
+
skipComments?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* The naming options regarding the generated artefacts.
|
|
158
|
+
*/
|
|
159
|
+
naming?: OverridableNamingOptions;
|
|
160
|
+
/**
|
|
161
|
+
* Some OData V2 services generate an extra wrapping for entity collection attributes:
|
|
162
|
+
* <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities
|
|
163
|
+
* an object with the property "results" is wrapped around the entity collection.
|
|
164
|
+
*
|
|
165
|
+
* If you're using the odata client then there's a build-in workaround in place which transforms
|
|
166
|
+
* the results to remove this extra mapping. However, if you're only interested in the types, then
|
|
167
|
+
* the generated models will not match that extra wrapping.
|
|
168
|
+
*
|
|
169
|
+
* Setting this configuration option to <code>true</code> (default: false) will add this extra
|
|
170
|
+
* wrapping to the generated models. But this option is only valid if the generation mode is set
|
|
171
|
+
* to <code>models</code>; it is ignored otherwise.
|
|
172
|
+
*/
|
|
173
|
+
v2ModelsWithExtraResultsWrapping?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Custom generation options which are dependent on a specific odata service.
|
|
177
|
+
*/
|
|
178
|
+
export interface ServiceGenerationOptions extends Required<Pick<CliOptions, "source" | "output">>, Omit<ConfigFileOptions, "services"> {
|
|
179
|
+
/**
|
|
180
|
+
* Configure generation process for EntityTypes and ComplexTypes including their keys and properties.
|
|
181
|
+
*/
|
|
182
|
+
entitiesByName?: Array<EntityGenerationOptions>;
|
|
183
|
+
/**
|
|
184
|
+
* Configure generation process for individual properties based on their name.
|
|
185
|
+
*/
|
|
186
|
+
propertiesByName?: Array<PropertyGenerationOptions>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Configuration options for EntityTypes and ComplexTypes.
|
|
190
|
+
* This config applies if the name matches the name of an EntityType or ComplexType as it is specified
|
|
191
|
+
* in the metadata (e.g. in EDMX <EntityType name="Test" ...)
|
|
192
|
+
*/
|
|
193
|
+
export interface EntityGenerationOptions {
|
|
194
|
+
/**
|
|
195
|
+
* Name of the EntityType or ComplexType, e.g. "Person".
|
|
196
|
+
* Must match exactly or can be a regular expression.
|
|
197
|
+
*/
|
|
198
|
+
name: string | RegExp;
|
|
199
|
+
/**
|
|
200
|
+
* Use a different name.
|
|
201
|
+
* If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).
|
|
202
|
+
*/
|
|
203
|
+
mappedName?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Overwrite the key specification by naming the props by their EDMX name.
|
|
206
|
+
*/
|
|
207
|
+
keys?: Array<string>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* All configuration options for properties of models.
|
|
211
|
+
*/
|
|
212
|
+
export interface PropertyGenerationOptions {
|
|
213
|
+
/**
|
|
214
|
+
* Name of the property to match.
|
|
215
|
+
* Must match exactly or can be a regular expression.
|
|
216
|
+
*/
|
|
217
|
+
name: string | RegExp;
|
|
218
|
+
/**
|
|
219
|
+
* Use a different name.
|
|
220
|
+
* If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).
|
|
221
|
+
*/
|
|
222
|
+
mappedName?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Managed attributes - i.e. managed by the server - cannot be created or updated.
|
|
225
|
+
* Hence, they are left out of the editable model versions.
|
|
226
|
+
*/
|
|
227
|
+
managed?: boolean;
|
|
228
|
+
}
|
package/lib/OptionModel.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmitModes = exports.Modes = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Generation mode, by default "all".
|
|
6
|
-
*/
|
|
7
|
-
var Modes;
|
|
8
|
-
(function (Modes) {
|
|
9
|
-
Modes[Modes["models"] = 0] = "models";
|
|
10
|
-
Modes[Modes["qobjects"] = 1] = "qobjects";
|
|
11
|
-
Modes[Modes["service"] = 2] = "service";
|
|
12
|
-
Modes[Modes["all"] = 3] = "all";
|
|
13
|
-
})(Modes
|
|
14
|
-
/**
|
|
15
|
-
* What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.
|
|
16
|
-
*/
|
|
17
|
-
var EmitModes;
|
|
18
|
-
(function (EmitModes) {
|
|
19
|
-
EmitModes["ts"] = "ts";
|
|
20
|
-
EmitModes["js"] = "js";
|
|
21
|
-
EmitModes["dts"] = "dts";
|
|
22
|
-
EmitModes["js_dts"] = "js_dts";
|
|
23
|
-
})(EmitModes
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmitModes = exports.Modes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generation mode, by default "all".
|
|
6
|
+
*/
|
|
7
|
+
var Modes;
|
|
8
|
+
(function (Modes) {
|
|
9
|
+
Modes[Modes["models"] = 0] = "models";
|
|
10
|
+
Modes[Modes["qobjects"] = 1] = "qobjects";
|
|
11
|
+
Modes[Modes["service"] = 2] = "service";
|
|
12
|
+
Modes[Modes["all"] = 3] = "all";
|
|
13
|
+
})(Modes || (exports.Modes = Modes = {}));
|
|
14
|
+
/**
|
|
15
|
+
* What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.
|
|
16
|
+
*/
|
|
17
|
+
var EmitModes;
|
|
18
|
+
(function (EmitModes) {
|
|
19
|
+
EmitModes["ts"] = "ts";
|
|
20
|
+
EmitModes["js"] = "js";
|
|
21
|
+
EmitModes["dts"] = "dts";
|
|
22
|
+
EmitModes["js_dts"] = "js_dts";
|
|
23
|
+
})(EmitModes || (exports.EmitModes = EmitModes = {}));
|
|
24
24
|
//# sourceMappingURL=OptionModel.js.map
|
package/lib/OptionModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,GAAL,aAAK,KAAL,aAAK,QAKhB;AAED;;GAEG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\n\r\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel\";\r\n\r\n/**\r\n * Generation mode, by default \"all\".\r\n */\r\nexport enum Modes {\r\n models,\r\n qobjects,\r\n service,\r\n all,\r\n}\r\n\r\n/**\r\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\r\n */\r\nexport enum EmitModes {\r\n ts = \"ts\",\r\n js = \"js\",\r\n dts = \"dts\",\r\n js_dts = \"js_dts\",\r\n}\r\n\r\n/**\r\n * Config options for CLI.\r\n */\r\nexport interface CliOptions {\r\n /**\r\n * The source file to use. Must be an EDMX compliant XML file.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions extends Required<Omit<ServiceGenerationOptions, \"serviceName\">> {\r\n serviceName?: string;\r\n naming: NameSettings;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"source\" | \"output\" | \"services\"> {\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n\r\n /**\r\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\r\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\r\n * an object with the property \"results\" is wrapped around the entity collection.\r\n *\r\n * If you're using the odata client then there's a build-in workaround in place which transforms\r\n * the results to remove this extra mapping. However, if you're only interested in the types, then\r\n * the generated models will not match that extra wrapping.\r\n *\r\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\r\n * wrapping to the generated models. But this option is only valid if the generation mode is set\r\n * to <code>models</code>; it is ignored otherwise.\r\n */\r\n v2ModelsWithExtraResultsWrapping?: boolean;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for EntityTypes and ComplexTypes including their keys and properties.\r\n */\r\n entitiesByName?: Array<EntityGenerationOptions>;\r\n /**\r\n * Configure generation process for individual properties based on their name.\r\n */\r\n propertiesByName?: Array<PropertyGenerationOptions>;\r\n}\r\n\r\n/**\r\n * Configuration options for EntityTypes and ComplexTypes.\r\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\r\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\r\n */\r\nexport interface EntityGenerationOptions {\r\n /**\r\n * Name of the EntityType or ComplexType, e.g. \"Person\".\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Overwrite the key specification by naming the props by their EDMX name.\r\n */\r\n keys?: Array<string>;\r\n /**\r\n * Configuration of individual properties.\r\n */\r\n // properties?: Array<PropertyGenerationOptions>;\r\n\r\n // converter: string | Array<string>\r\n\r\n /**\r\n * Whether the generated service should allow for querying this model.\r\n * True by default.\r\n */\r\n // queryable?: boolean;\r\n /**\r\n * Whether the generated service should allow for creating new models (POST).\r\n * True by default.\r\n */\r\n // creatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for updates (PUT).\r\n * True by default.\r\n */\r\n // updatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for partial updates (PATCH).\r\n * True by default.\r\n */\r\n // patchable?: boolean;\r\n /**\r\n * Whether the generated service should allow for deletion.\r\n * True by default.\r\n */\r\n // deletable?: boolean;\r\n}\r\n\r\n/**\r\n * All configuration options for properties of models.\r\n */\r\nexport interface PropertyGenerationOptions {\r\n /**\r\n * Name of the property to match.\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\r\n * Hence, they are left out of the editable model versions.\r\n */\r\n managed?: boolean;\r\n\r\n /**\r\n * TODO\r\n *\r\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\r\n * as well it's i\r\n * and their ids, e.g. \"timeToDurationConverter\".\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n // converters?: Array<Required<TypeConverterConfig>>;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB;AAED;;GAEG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\n\r\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel\";\r\n\r\n/**\r\n * Generation mode, by default \"all\".\r\n */\r\nexport enum Modes {\r\n models,\r\n qobjects,\r\n service,\r\n all,\r\n}\r\n\r\n/**\r\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\r\n */\r\nexport enum EmitModes {\r\n ts = \"ts\",\r\n js = \"js\",\r\n dts = \"dts\",\r\n js_dts = \"js_dts\",\r\n}\r\n\r\n/**\r\n * Config options for CLI.\r\n */\r\nexport interface CliOptions {\r\n /**\r\n * The source file to use. Must be an EDMX compliant XML file.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions extends Required<Omit<ServiceGenerationOptions, \"serviceName\">> {\r\n serviceName?: string;\r\n naming: NameSettings;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"source\" | \"output\" | \"services\"> {\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n /**\r\n * Model properties have explaining comments by default.\r\n * With this option you can turn that off.\r\n */\r\n skipComments?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n\r\n /**\r\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\r\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\r\n * an object with the property \"results\" is wrapped around the entity collection.\r\n *\r\n * If you're using the odata client then there's a build-in workaround in place which transforms\r\n * the results to remove this extra mapping. However, if you're only interested in the types, then\r\n * the generated models will not match that extra wrapping.\r\n *\r\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\r\n * wrapping to the generated models. But this option is only valid if the generation mode is set\r\n * to <code>models</code>; it is ignored otherwise.\r\n */\r\n v2ModelsWithExtraResultsWrapping?: boolean;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for EntityTypes and ComplexTypes including their keys and properties.\r\n */\r\n entitiesByName?: Array<EntityGenerationOptions>;\r\n /**\r\n * Configure generation process for individual properties based on their name.\r\n */\r\n propertiesByName?: Array<PropertyGenerationOptions>;\r\n}\r\n\r\n/**\r\n * Configuration options for EntityTypes and ComplexTypes.\r\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\r\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\r\n */\r\nexport interface EntityGenerationOptions {\r\n /**\r\n * Name of the EntityType or ComplexType, e.g. \"Person\".\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Overwrite the key specification by naming the props by their EDMX name.\r\n */\r\n keys?: Array<string>;\r\n /**\r\n * Configuration of individual properties.\r\n */\r\n // properties?: Array<PropertyGenerationOptions>;\r\n\r\n // converter: string | Array<string>\r\n\r\n /**\r\n * Whether the generated service should allow for querying this model.\r\n * True by default.\r\n */\r\n // queryable?: boolean;\r\n /**\r\n * Whether the generated service should allow for creating new models (POST).\r\n * True by default.\r\n */\r\n // creatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for updates (PUT).\r\n * True by default.\r\n */\r\n // updatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for partial updates (PATCH).\r\n * True by default.\r\n */\r\n // patchable?: boolean;\r\n /**\r\n * Whether the generated service should allow for deletion.\r\n * True by default.\r\n */\r\n // deletable?: boolean;\r\n}\r\n\r\n/**\r\n * All configuration options for properties of models.\r\n */\r\nexport interface PropertyGenerationOptions {\r\n /**\r\n * Name of the property to match.\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\r\n * Hence, they are left out of the editable model versions.\r\n */\r\n managed?: boolean;\r\n\r\n /**\r\n * TODO\r\n *\r\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\r\n * as well it's i\r\n * and their ids, e.g. \"timeToDurationConverter\".\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n // converters?: Array<Required<TypeConverterConfig>>;\r\n}\r\n"]}
|
package/lib/app.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ODataEdmxModelBase } from "./data-model/edmx/ODataEdmxModelBase";
|
|
2
|
-
import { RunOptions } from "./OptionModel";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param metadataJson metadata of a given OData service already parsed as JSON
|
|
6
|
-
* @param options further options
|
|
7
|
-
*/
|
|
8
|
-
export declare function runApp(metadataJson: ODataEdmxModelBase<any>, options: RunOptions): Promise<void>;
|
|
1
|
+
import { ODataEdmxModelBase } from "./data-model/edmx/ODataEdmxModelBase";
|
|
2
|
+
import { RunOptions } from "./OptionModel";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param metadataJson metadata of a given OData service already parsed as JSON
|
|
6
|
+
* @param options further options
|
|
7
|
+
*/
|
|
8
|
+
export declare function runApp(metadataJson: ODataEdmxModelBase<any>, options: RunOptions): Promise<void>;
|