@odata2ts/odata2ts 0.23.0 → 0.24.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 +14 -0
- package/README.md +74 -74
- 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 +63 -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 +85 -85
- package/lib/data-model/DataModel.js +134 -134
- package/lib/data-model/DataModelDigestion.d.ts +44 -44
- package/lib/data-model/DataModelDigestion.js +274 -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 +200 -200
- package/lib/data-model/DataModelDigestionV4.d.ts +3 -3
- package/lib/data-model/DataModelDigestionV4.js +195 -195
- 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 +55 -55
- package/lib/data-model/NamingHelper.js +214 -214
- 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 +80 -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/ImportContainer.js.map +1 -1
- 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/ServiceGenerator.js.map +1 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.24.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.23.1...@odata2ts/odata2ts@0.24.0) (2023-06-14)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **odata2ts:** generate comments for model properties ([#173](https://github.com/odata2ts/odata2ts/issues/173)) ([b218297](https://github.com/odata2ts/odata2ts/commit/b2182974637499060d7d0c8d358da17ca03608e0))
|
|
11
|
+
|
|
12
|
+
## [0.23.1](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.23.0...@odata2ts/odata2ts@0.23.1) (2023-06-10)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @odata2ts/odata2ts
|
|
15
|
+
|
|
6
16
|
# [0.23.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.22.0...@odata2ts/odata2ts@0.23.0) (2023-06-03)
|
|
7
17
|
|
|
8
18
|
### Features
|
|
@@ -18,7 +28,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
18
28
|
### BREAKING CHANGES
|
|
19
29
|
|
|
20
30
|
* **odata2ts:** Changed defaults for properties representing related services: no prefix anymore, just the name of the property as function (previously, prefix `navTo`).
|
|
31
|
+
|
|
21
32
|
Removed `get` method of EntitySetServices: use property directly instead.
|
|
33
|
+
|
|
22
34
|
Removed the following naming options regarding generated services: `serviceResolverFunction`, `publicProps`
|
|
23
35
|
|
|
24
36
|
# [0.21.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.20.3...@odata2ts/odata2ts@0.21.0) (2023-04-20)
|
|
@@ -32,7 +44,9 @@ Removed the following naming options regarding generated services: `serviceResol
|
|
|
32
44
|
### Bug Fixes
|
|
33
45
|
|
|
34
46
|
* **odata2ts:** add empty array as type for empty params ([#154](https://github.com/odata2ts/odata2ts/issues/154)) ([fbdd000](https://github.com/odata2ts/odata2ts/commit/fbdd0005d46d7d402d8039bec3ea4aecdb593b88))
|
|
47
|
+
|
|
35
48
|
* prevent idModel and qIdFunction from baseclass to be overwritten in digester which breaks multiple inheritance ([#150](https://github.com/odata2ts/odata2ts/issues/150)) ([e17038e](https://github.com/odata2ts/odata2ts/commit/e17038ee0e924101f9dd6ed97e10da5847cb8857))
|
|
49
|
+
|
|
36
50
|
* Reorder models and qobjects by inheritance (base types first) ([#151](https://github.com/odata2ts/odata2ts/issues/151)) ([7d456fe](https://github.com/odata2ts/odata2ts/commit/7d456fe3fd28b246721a170cd878d04c3dbc2d80))
|
|
37
51
|
|
|
38
52
|
## [0.20.2](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.20.1...@odata2ts/odata2ts@0.20.2) (2023-04-13)
|
package/README.md
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
[](https://www.npmjs.com/package/@odata2ts/odata2ts)
|
|
2
|
-
|
|
3
|
-
# odata2ts
|
|
4
|
-
|
|
5
|
-
The basic idea of `odata2ts` is to leverage the readily available metadata of any OData service
|
|
6
|
-
to generate different sorts of typed artefacts which you use in your TypeScript code.
|
|
7
|
-
This package `@odata2ts/odata2ts` realizes the generation process.
|
|
8
|
-
|
|
9
|
-
The generator is supposed to be used with a TypeScript based configuration file.
|
|
10
|
-
Then it's able to handle the generation for multiple OData services.
|
|
11
|
-
|
|
12
|
-
It comes with powerful configuration options. Some highlights:
|
|
13
|
-
- generation of TypeScript files or compiled JS / DTS files
|
|
14
|
-
- name or rename stuff
|
|
15
|
-
- naming of pretty much any aspect of the generated artefacts
|
|
16
|
-
- e.g. all types should be prefixed with an "I", Person => IPerson
|
|
17
|
-
- consistent casing (as in "camelCase" or "PascalCase") even for property names of entity types
|
|
18
|
-
- use type converters
|
|
19
|
-
|
|
20
|
-
See the [generator documentation](https://odata2ts.github.io/docs/generator/setup-and-usage) for more information.
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
npm install --save-dev @odata2ts/odata2ts
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Implicit Dependencies
|
|
29
|
-
Most of the generated artefacts depend on other libraries. `odata2ts` lists them as peer dependencies.
|
|
30
|
-
|
|
31
|
-
Depending on your use case, you will need to add runtime dependencies matching the mentioned peer dependencies.
|
|
32
|
-
See the [Getting Started Guide](https://odata2ts.github.io/docs/category/getting-started/) of the documentation
|
|
33
|
-
for guidance.
|
|
34
|
-
|
|
35
|
-
## Documentation
|
|
36
|
-
[Generator Documentation](https://odata2ts.github.io/docs/generator/setup-and-usage)
|
|
37
|
-
|
|
38
|
-
Main documentation for the odata2ts eco system:
|
|
39
|
-
[https://odata2ts.github.io](https://odata2ts.github.io/)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Examples
|
|
43
|
-
See [example packages](https://github.com/odata2ts/odata2ts/tree/main/examples) for examples of how to integrate `odata2ts`.
|
|
44
|
-
|
|
45
|
-
## Tests
|
|
46
|
-
See folder [test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/test)
|
|
47
|
-
for unit tests.
|
|
48
|
-
|
|
49
|
-
See folder [int-test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/int-test) for integration
|
|
50
|
-
tests of the CLI.
|
|
51
|
-
|
|
52
|
-
Each example package serves as integration test of the generator.
|
|
53
|
-
|
|
54
|
-
## Support, Feedback, Contributing
|
|
55
|
-
This project is open to feature requests, suggestions, bug reports, usage questions etc.
|
|
56
|
-
via [GitHub issues](https://github.com/odata2ts/odata2ts/issues).
|
|
57
|
-
|
|
58
|
-
Contributions and feedback are encouraged and always welcome.
|
|
59
|
-
|
|
60
|
-
See the [contribution guidelines](https://github.com/odata2ts/odata2ts/blob/main/CONTRIBUTING.md) for further information.
|
|
61
|
-
|
|
62
|
-
## Spirit
|
|
63
|
-
This project and this module have been created and are maintained in the following spirit:
|
|
64
|
-
|
|
65
|
-
* adhere to the **OData specification** as much as possible
|
|
66
|
-
* support any OData service implementation which conforms to the spec
|
|
67
|
-
* allow to work around faulty implementations if possible
|
|
68
|
-
* stability matters
|
|
69
|
-
* exercise Test Driven Development
|
|
70
|
-
* bomb the place with unit tests (code coverage > 95%)
|
|
71
|
-
* ensure that assumptions & understanding are correct by creating integration tests
|
|
72
|
-
|
|
73
|
-
## License
|
|
74
|
-
MIT - see [License](./LICENSE).
|
|
1
|
+
[](https://www.npmjs.com/package/@odata2ts/odata2ts)
|
|
2
|
+
|
|
3
|
+
# odata2ts
|
|
4
|
+
|
|
5
|
+
The basic idea of `odata2ts` is to leverage the readily available metadata of any OData service
|
|
6
|
+
to generate different sorts of typed artefacts which you use in your TypeScript code.
|
|
7
|
+
This package `@odata2ts/odata2ts` realizes the generation process.
|
|
8
|
+
|
|
9
|
+
The generator is supposed to be used with a TypeScript based configuration file.
|
|
10
|
+
Then it's able to handle the generation for multiple OData services.
|
|
11
|
+
|
|
12
|
+
It comes with powerful configuration options. Some highlights:
|
|
13
|
+
- generation of TypeScript files or compiled JS / DTS files
|
|
14
|
+
- name or rename stuff
|
|
15
|
+
- naming of pretty much any aspect of the generated artefacts
|
|
16
|
+
- e.g. all types should be prefixed with an "I", Person => IPerson
|
|
17
|
+
- consistent casing (as in "camelCase" or "PascalCase") even for property names of entity types
|
|
18
|
+
- use type converters
|
|
19
|
+
|
|
20
|
+
See the [generator documentation](https://odata2ts.github.io/docs/generator/setup-and-usage) for more information.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm install --save-dev @odata2ts/odata2ts
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Implicit Dependencies
|
|
29
|
+
Most of the generated artefacts depend on other libraries. `odata2ts` lists them as peer dependencies.
|
|
30
|
+
|
|
31
|
+
Depending on your use case, you will need to add runtime dependencies matching the mentioned peer dependencies.
|
|
32
|
+
See the [Getting Started Guide](https://odata2ts.github.io/docs/category/getting-started/) of the documentation
|
|
33
|
+
for guidance.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
[Generator Documentation](https://odata2ts.github.io/docs/generator/setup-and-usage)
|
|
37
|
+
|
|
38
|
+
Main documentation for the odata2ts eco system:
|
|
39
|
+
[https://odata2ts.github.io](https://odata2ts.github.io/)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
See [example packages](https://github.com/odata2ts/odata2ts/tree/main/examples) for examples of how to integrate `odata2ts`.
|
|
44
|
+
|
|
45
|
+
## Tests
|
|
46
|
+
See folder [test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/test)
|
|
47
|
+
for unit tests.
|
|
48
|
+
|
|
49
|
+
See folder [int-test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/int-test) for integration
|
|
50
|
+
tests of the CLI.
|
|
51
|
+
|
|
52
|
+
Each example package serves as integration test of the generator.
|
|
53
|
+
|
|
54
|
+
## Support, Feedback, Contributing
|
|
55
|
+
This project is open to feature requests, suggestions, bug reports, usage questions etc.
|
|
56
|
+
via [GitHub issues](https://github.com/odata2ts/odata2ts/issues).
|
|
57
|
+
|
|
58
|
+
Contributions and feedback are encouraged and always welcome.
|
|
59
|
+
|
|
60
|
+
See the [contribution guidelines](https://github.com/odata2ts/odata2ts/blob/main/CONTRIBUTING.md) for further information.
|
|
61
|
+
|
|
62
|
+
## Spirit
|
|
63
|
+
This project and this module have been created and are maintained in the following spirit:
|
|
64
|
+
|
|
65
|
+
* adhere to the **OData specification** as much as possible
|
|
66
|
+
* support any OData service implementation which conforms to the spec
|
|
67
|
+
* allow to work around faulty implementations if possible
|
|
68
|
+
* stability matters
|
|
69
|
+
* exercise Test Driven Development
|
|
70
|
+
* bomb the place with unit tests (code coverage > 95%)
|
|
71
|
+
* ensure that assumptions & understanding are correct by creating integration tests
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
MIT - see [License](./LICENSE).
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ODataVersions } from "@odata2ts/odata-core";
|
|
2
|
-
import { SourceFile } from "ts-morph";
|
|
3
|
-
import { DataModel } from "./data-model/DataModel";
|
|
4
|
-
import { Schema } from "./data-model/edmx/ODataEdmxModelBase";
|
|
5
|
-
import { NamingHelper } from "./data-model/NamingHelper";
|
|
6
|
-
import { RunOptions } from "./OptionModel";
|
|
7
|
-
export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName" | "v2ModelsWithExtraResultsWrapping" | "skipEditableModels">;
|
|
8
|
-
/**
|
|
9
|
-
* Takes an EdmxSchema plus the run options and creates a DataModel.
|
|
10
|
-
*/
|
|
11
|
-
export type DigesterFunction<S extends Schema<any, any>> = (schema: S, options: DigestionOptions, namingHelper: NamingHelper) => Promise<DataModel>;
|
|
12
|
-
export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "v2ModelsWithExtraResultsWrapping">;
|
|
13
|
-
export type EntityBasedGeneratorFunction = (dataModel: DataModel, sourceFile: SourceFile, version: ODataVersions, options: GeneratorFunctionOptions, namingHelper: NamingHelper) => void;
|
|
1
|
+
import { ODataVersions } from "@odata2ts/odata-core";
|
|
2
|
+
import { SourceFile } from "ts-morph";
|
|
3
|
+
import { DataModel } from "./data-model/DataModel";
|
|
4
|
+
import { Schema } from "./data-model/edmx/ODataEdmxModelBase";
|
|
5
|
+
import { NamingHelper } from "./data-model/NamingHelper";
|
|
6
|
+
import { RunOptions } from "./OptionModel";
|
|
7
|
+
export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName" | "v2ModelsWithExtraResultsWrapping" | "skipEditableModels" | "skipComments">;
|
|
8
|
+
/**
|
|
9
|
+
* Takes an EdmxSchema plus the run options and creates a DataModel.
|
|
10
|
+
*/
|
|
11
|
+
export type DigesterFunction<S extends Schema<any, any>> = (schema: S, options: DigestionOptions, namingHelper: NamingHelper) => Promise<DataModel>;
|
|
12
|
+
export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "skipComments" | "v2ModelsWithExtraResultsWrapping">;
|
|
13
|
+
export type EntityBasedGeneratorFunction = (dataModel: DataModel, sourceFile: SourceFile, version: ODataVersions, options: GeneratorFunctionOptions, namingHelper: NamingHelper) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=FactoryFunctionModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"./data-model/DataModel\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { RunOptions } from \"./OptionModel\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n | \"converters\"\r\n | \"disableAutoManagedKey\"\r\n | \"propertiesByName\"\r\n | \"entitiesByName\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"skipEditableModels\"\r\n>;\r\n\r\n/**\r\n * Takes an EdmxSchema plus the run options and creates a DataModel.\r\n */\r\nexport type DigesterFunction<S extends Schema<any, any>> = (\r\n schema: S,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper\r\n) => Promise<DataModel>;\r\n\r\nexport type GeneratorFunctionOptions = Pick<\r\n RunOptions,\r\n \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\" | \"v2ModelsWithExtraResultsWrapping\"\r\n>;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n dataModel: DataModel,\r\n sourceFile: SourceFile,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper\r\n) => void;\r\n"]}
|
|
1
|
+
{"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"./data-model/DataModel\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { RunOptions } from \"./OptionModel\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n | \"converters\"\r\n | \"disableAutoManagedKey\"\r\n | \"propertiesByName\"\r\n | \"entitiesByName\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"skipEditableModels\"\r\n | \"skipComments\"\r\n>;\r\n\r\n/**\r\n * Takes an EdmxSchema plus the run options and creates a DataModel.\r\n */\r\nexport type DigesterFunction<S extends Schema<any, any>> = (\r\n schema: S,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper\r\n) => Promise<DataModel>;\r\n\r\nexport type GeneratorFunctionOptions = Pick<\r\n RunOptions,\r\n \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\" | \"skipComments\" | \"v2ModelsWithExtraResultsWrapping\"\r\n>;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n dataModel: DataModel,\r\n sourceFile: SourceFile,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper\r\n) => void;\r\n"]}
|
package/lib/NamingModel.d.ts
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The available naming strategies.
|
|
3
|
-
*/
|
|
4
|
-
import { PartialDeep } from "type-fest";
|
|
5
|
-
export declare enum NamingStrategies {
|
|
6
|
-
NONE = "",
|
|
7
|
-
PASCAL_CASE = "pascalCase",
|
|
8
|
-
CAMEL_CASE = "camelCase",
|
|
9
|
-
CONSTANT_CASE = "constantCase",
|
|
10
|
-
SNAKE_CASE = "snakeCase"
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Based on an existing configuration (for example default settings) the user only specifies what needs
|
|
14
|
-
* to be changed. Hence, all options are completely optional.
|
|
15
|
-
*/
|
|
16
|
-
export interface OverridableNamingOptions extends PartialDeep<NameSettings> {
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The required and optional name settings for the generator.
|
|
20
|
-
*/
|
|
21
|
-
export interface NameSettings {
|
|
22
|
-
/**
|
|
23
|
-
* Because multiple artefacts are generated out of the same entity, some name settings are required in order
|
|
24
|
-
* to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,
|
|
25
|
-
* so that you only need to override those settings you want to change.
|
|
26
|
-
*
|
|
27
|
-
* However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with
|
|
28
|
-
* your own configuration. In this scenario this switch should be enabled to only have default values for
|
|
29
|
-
* the required name settings.
|
|
30
|
-
*/
|
|
31
|
-
minimalDefaults?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Generation options for models, i.e. interfaces representing entity or complex types.
|
|
34
|
-
*/
|
|
35
|
-
models: ModelNamingOptions;
|
|
36
|
-
/**
|
|
37
|
-
* Generation options for Query Objects.
|
|
38
|
-
*
|
|
39
|
-
* By default, prefix = "Q"
|
|
40
|
-
*/
|
|
41
|
-
queryObjects: QueryObjectNamingOptions;
|
|
42
|
-
services: ServiceNamingOptions;
|
|
43
|
-
}
|
|
44
|
-
export interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {
|
|
45
|
-
/**
|
|
46
|
-
* All generated models are bundled into one file.
|
|
47
|
-
* This option specifies the formatting of the file name.
|
|
48
|
-
*/
|
|
49
|
-
fileName: FileNamingStrategyOption & RequiredNamingOptions;
|
|
50
|
-
/**
|
|
51
|
-
* Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.
|
|
52
|
-
* By default, camel-case.
|
|
53
|
-
*/
|
|
54
|
-
propNamingStrategy?: NamingStrategies;
|
|
55
|
-
/**
|
|
56
|
-
* For each model an editable version is generated which represents the model definition for
|
|
57
|
-
* create, update and patch actions.
|
|
58
|
-
*
|
|
59
|
-
* You can override the naming options here.
|
|
60
|
-
* By default, prefix = "Editable"
|
|
61
|
-
*/
|
|
62
|
-
editableModels: EntityDerivedNamingOptions;
|
|
63
|
-
/**
|
|
64
|
-
* ID models are generated from entity id parameters.
|
|
65
|
-
*
|
|
66
|
-
* You can configure the naming options here.
|
|
67
|
-
* By default, suffix = "Id"
|
|
68
|
-
*/
|
|
69
|
-
idModels: EntityDerivedNamingOptions;
|
|
70
|
-
/**
|
|
71
|
-
* Operation parameter models are generated from function or action signatures.
|
|
72
|
-
*
|
|
73
|
-
* You can configure the naming options here.
|
|
74
|
-
* By default, suffix = "Params"
|
|
75
|
-
*/
|
|
76
|
-
operationParamModels: EntityDerivedNamingOptions;
|
|
77
|
-
}
|
|
78
|
-
export interface EntityDerivedNamingOptions extends RequiredNamingOptions {
|
|
79
|
-
applyModelNaming?: boolean;
|
|
80
|
-
}
|
|
81
|
-
export interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
|
|
82
|
-
/**
|
|
83
|
-
* All generated models are bundled into one file.
|
|
84
|
-
* This option specifies the formatting of the file name.
|
|
85
|
-
*/
|
|
86
|
-
fileName: FileNamingStrategyOption & RequiredNamingOptions;
|
|
87
|
-
/**
|
|
88
|
-
* Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.
|
|
89
|
-
* By default, camel-case.
|
|
90
|
-
*/
|
|
91
|
-
propNamingStrategy?: NamingStrategies;
|
|
92
|
-
idFunctions: RequiredNamingOptions;
|
|
93
|
-
operations?: OperationNamingOptions;
|
|
94
|
-
}
|
|
95
|
-
export interface OperationNamingOptions extends StandardNamingOptions {
|
|
96
|
-
/**
|
|
97
|
-
* Naming options for actions only.
|
|
98
|
-
* When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
|
|
99
|
-
*/
|
|
100
|
-
action?: StandardNamingOptions;
|
|
101
|
-
/**
|
|
102
|
-
* Naming options for functions only.
|
|
103
|
-
* When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
|
|
104
|
-
*/
|
|
105
|
-
function?: StandardNamingOptions;
|
|
106
|
-
}
|
|
107
|
-
export interface NamingStrategyOption {
|
|
108
|
-
/**
|
|
109
|
-
* Choose a specific strategy to format names: pascal-case, camel-case, etc.
|
|
110
|
-
* Defaults to pascal-case.
|
|
111
|
-
*/
|
|
112
|
-
namingStrategy?: NamingStrategies;
|
|
113
|
-
}
|
|
114
|
-
export interface FileNamingStrategyOption {
|
|
115
|
-
/**
|
|
116
|
-
* Choose a specific strategy to format names: pascal-case, camel-case, etc.
|
|
117
|
-
* Defaults to pascal-case.
|
|
118
|
-
*/
|
|
119
|
-
namingStrategy?: NamingStrategies;
|
|
120
|
-
}
|
|
121
|
-
export interface StandardNamingOptions {
|
|
122
|
-
/**
|
|
123
|
-
* Prefix all names, e.g. "I" => "ITest"
|
|
124
|
-
*/
|
|
125
|
-
prefix?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Suffix all names, e.g. "model" => "TestModel"
|
|
128
|
-
*/
|
|
129
|
-
suffix?: string;
|
|
130
|
-
}
|
|
131
|
-
export interface RequiredNamingOptions extends Required<StandardNamingOptions> {
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Naming options for generated service classes.
|
|
135
|
-
* These options affect the main service as well as all services generated for each entity, complex and collection type.
|
|
136
|
-
*
|
|
137
|
-
* There exists one specialty about services: The file names are not configurable.
|
|
138
|
-
* File names are determined by the name of their corresponding classes, so that service file name
|
|
139
|
-
* and service class name always correspond.
|
|
140
|
-
*
|
|
141
|
-
* By default, suffix = Service and namingStrategy = PascalCase
|
|
142
|
-
*/
|
|
143
|
-
export interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
|
|
144
|
-
/**
|
|
145
|
-
* Controls the naming options for the main odata service.
|
|
146
|
-
* By default, the base service naming options are applied.
|
|
147
|
-
* But since this is the main entry point for users, it can be configured individually here.
|
|
148
|
-
*
|
|
149
|
-
* By default, applyServiceNaming = true
|
|
150
|
-
*/
|
|
151
|
-
main?: NamingStrategyOption & StandardNamingOptions & {
|
|
152
|
-
applyServiceNaming?: boolean;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Name of the service responsible for entity collections.
|
|
156
|
-
*
|
|
157
|
-
* By default, suffix = Collection and applyServiceNaming = true
|
|
158
|
-
*/
|
|
159
|
-
collection: RequiredNamingOptions & {
|
|
160
|
-
applyServiceNaming?: boolean;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Naming for getter method of another service.
|
|
164
|
-
*
|
|
165
|
-
* By default, namingStrategy = camelCase
|
|
166
|
-
*/
|
|
167
|
-
relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;
|
|
168
|
-
/**
|
|
169
|
-
* Operations are functions and actions of the OData service and are represented as methods
|
|
170
|
-
* of the generated service class. This setting controls the naming of the corresponding
|
|
171
|
-
* function.
|
|
172
|
-
*
|
|
173
|
-
* By default, namingStrategy = camelCase
|
|
174
|
-
*/
|
|
175
|
-
operations?: NamingStrategyOption & OperationNamingOptions;
|
|
176
|
-
/**
|
|
177
|
-
* Naming options for private properties of service classes.
|
|
178
|
-
*
|
|
179
|
-
* By default, prefix = _
|
|
180
|
-
*/
|
|
181
|
-
privateProps: NamingStrategyOption & RequiredNamingOptions;
|
|
182
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The available naming strategies.
|
|
3
|
+
*/
|
|
4
|
+
import { PartialDeep } from "type-fest";
|
|
5
|
+
export declare enum NamingStrategies {
|
|
6
|
+
NONE = "",
|
|
7
|
+
PASCAL_CASE = "pascalCase",
|
|
8
|
+
CAMEL_CASE = "camelCase",
|
|
9
|
+
CONSTANT_CASE = "constantCase",
|
|
10
|
+
SNAKE_CASE = "snakeCase"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Based on an existing configuration (for example default settings) the user only specifies what needs
|
|
14
|
+
* to be changed. Hence, all options are completely optional.
|
|
15
|
+
*/
|
|
16
|
+
export interface OverridableNamingOptions extends PartialDeep<NameSettings> {
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The required and optional name settings for the generator.
|
|
20
|
+
*/
|
|
21
|
+
export interface NameSettings {
|
|
22
|
+
/**
|
|
23
|
+
* Because multiple artefacts are generated out of the same entity, some name settings are required in order
|
|
24
|
+
* to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,
|
|
25
|
+
* so that you only need to override those settings you want to change.
|
|
26
|
+
*
|
|
27
|
+
* However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with
|
|
28
|
+
* your own configuration. In this scenario this switch should be enabled to only have default values for
|
|
29
|
+
* the required name settings.
|
|
30
|
+
*/
|
|
31
|
+
minimalDefaults?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Generation options for models, i.e. interfaces representing entity or complex types.
|
|
34
|
+
*/
|
|
35
|
+
models: ModelNamingOptions;
|
|
36
|
+
/**
|
|
37
|
+
* Generation options for Query Objects.
|
|
38
|
+
*
|
|
39
|
+
* By default, prefix = "Q"
|
|
40
|
+
*/
|
|
41
|
+
queryObjects: QueryObjectNamingOptions;
|
|
42
|
+
services: ServiceNamingOptions;
|
|
43
|
+
}
|
|
44
|
+
export interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {
|
|
45
|
+
/**
|
|
46
|
+
* All generated models are bundled into one file.
|
|
47
|
+
* This option specifies the formatting of the file name.
|
|
48
|
+
*/
|
|
49
|
+
fileName: FileNamingStrategyOption & RequiredNamingOptions;
|
|
50
|
+
/**
|
|
51
|
+
* Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.
|
|
52
|
+
* By default, camel-case.
|
|
53
|
+
*/
|
|
54
|
+
propNamingStrategy?: NamingStrategies;
|
|
55
|
+
/**
|
|
56
|
+
* For each model an editable version is generated which represents the model definition for
|
|
57
|
+
* create, update and patch actions.
|
|
58
|
+
*
|
|
59
|
+
* You can override the naming options here.
|
|
60
|
+
* By default, prefix = "Editable"
|
|
61
|
+
*/
|
|
62
|
+
editableModels: EntityDerivedNamingOptions;
|
|
63
|
+
/**
|
|
64
|
+
* ID models are generated from entity id parameters.
|
|
65
|
+
*
|
|
66
|
+
* You can configure the naming options here.
|
|
67
|
+
* By default, suffix = "Id"
|
|
68
|
+
*/
|
|
69
|
+
idModels: EntityDerivedNamingOptions;
|
|
70
|
+
/**
|
|
71
|
+
* Operation parameter models are generated from function or action signatures.
|
|
72
|
+
*
|
|
73
|
+
* You can configure the naming options here.
|
|
74
|
+
* By default, suffix = "Params"
|
|
75
|
+
*/
|
|
76
|
+
operationParamModels: EntityDerivedNamingOptions;
|
|
77
|
+
}
|
|
78
|
+
export interface EntityDerivedNamingOptions extends RequiredNamingOptions {
|
|
79
|
+
applyModelNaming?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
|
|
82
|
+
/**
|
|
83
|
+
* All generated models are bundled into one file.
|
|
84
|
+
* This option specifies the formatting of the file name.
|
|
85
|
+
*/
|
|
86
|
+
fileName: FileNamingStrategyOption & RequiredNamingOptions;
|
|
87
|
+
/**
|
|
88
|
+
* Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.
|
|
89
|
+
* By default, camel-case.
|
|
90
|
+
*/
|
|
91
|
+
propNamingStrategy?: NamingStrategies;
|
|
92
|
+
idFunctions: RequiredNamingOptions;
|
|
93
|
+
operations?: OperationNamingOptions;
|
|
94
|
+
}
|
|
95
|
+
export interface OperationNamingOptions extends StandardNamingOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Naming options for actions only.
|
|
98
|
+
* When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
|
|
99
|
+
*/
|
|
100
|
+
action?: StandardNamingOptions;
|
|
101
|
+
/**
|
|
102
|
+
* Naming options for functions only.
|
|
103
|
+
* When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
|
|
104
|
+
*/
|
|
105
|
+
function?: StandardNamingOptions;
|
|
106
|
+
}
|
|
107
|
+
export interface NamingStrategyOption {
|
|
108
|
+
/**
|
|
109
|
+
* Choose a specific strategy to format names: pascal-case, camel-case, etc.
|
|
110
|
+
* Defaults to pascal-case.
|
|
111
|
+
*/
|
|
112
|
+
namingStrategy?: NamingStrategies;
|
|
113
|
+
}
|
|
114
|
+
export interface FileNamingStrategyOption {
|
|
115
|
+
/**
|
|
116
|
+
* Choose a specific strategy to format names: pascal-case, camel-case, etc.
|
|
117
|
+
* Defaults to pascal-case.
|
|
118
|
+
*/
|
|
119
|
+
namingStrategy?: NamingStrategies;
|
|
120
|
+
}
|
|
121
|
+
export interface StandardNamingOptions {
|
|
122
|
+
/**
|
|
123
|
+
* Prefix all names, e.g. "I" => "ITest"
|
|
124
|
+
*/
|
|
125
|
+
prefix?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Suffix all names, e.g. "model" => "TestModel"
|
|
128
|
+
*/
|
|
129
|
+
suffix?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface RequiredNamingOptions extends Required<StandardNamingOptions> {
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Naming options for generated service classes.
|
|
135
|
+
* These options affect the main service as well as all services generated for each entity, complex and collection type.
|
|
136
|
+
*
|
|
137
|
+
* There exists one specialty about services: The file names are not configurable.
|
|
138
|
+
* File names are determined by the name of their corresponding classes, so that service file name
|
|
139
|
+
* and service class name always correspond.
|
|
140
|
+
*
|
|
141
|
+
* By default, suffix = Service and namingStrategy = PascalCase
|
|
142
|
+
*/
|
|
143
|
+
export interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
|
|
144
|
+
/**
|
|
145
|
+
* Controls the naming options for the main odata service.
|
|
146
|
+
* By default, the base service naming options are applied.
|
|
147
|
+
* But since this is the main entry point for users, it can be configured individually here.
|
|
148
|
+
*
|
|
149
|
+
* By default, applyServiceNaming = true
|
|
150
|
+
*/
|
|
151
|
+
main?: NamingStrategyOption & StandardNamingOptions & {
|
|
152
|
+
applyServiceNaming?: boolean;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Name of the service responsible for entity collections.
|
|
156
|
+
*
|
|
157
|
+
* By default, suffix = Collection and applyServiceNaming = true
|
|
158
|
+
*/
|
|
159
|
+
collection: RequiredNamingOptions & {
|
|
160
|
+
applyServiceNaming?: boolean;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Naming for getter method of another service.
|
|
164
|
+
*
|
|
165
|
+
* By default, namingStrategy = camelCase
|
|
166
|
+
*/
|
|
167
|
+
relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;
|
|
168
|
+
/**
|
|
169
|
+
* Operations are functions and actions of the OData service and are represented as methods
|
|
170
|
+
* of the generated service class. This setting controls the naming of the corresponding
|
|
171
|
+
* function.
|
|
172
|
+
*
|
|
173
|
+
* By default, namingStrategy = camelCase
|
|
174
|
+
*/
|
|
175
|
+
operations?: NamingStrategyOption & OperationNamingOptions;
|
|
176
|
+
/**
|
|
177
|
+
* Naming options for private properties of service classes.
|
|
178
|
+
*
|
|
179
|
+
* By default, prefix = _
|
|
180
|
+
*/
|
|
181
|
+
privateProps: NamingStrategyOption & RequiredNamingOptions;
|
|
182
|
+
}
|
package/lib/NamingModel.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NamingStrategies = void 0;
|
|
4
|
-
var NamingStrategies;
|
|
5
|
-
(function (NamingStrategies) {
|
|
6
|
-
NamingStrategies["NONE"] = "";
|
|
7
|
-
NamingStrategies["PASCAL_CASE"] = "pascalCase";
|
|
8
|
-
NamingStrategies["CAMEL_CASE"] = "camelCase";
|
|
9
|
-
NamingStrategies["CONSTANT_CASE"] = "constantCase";
|
|
10
|
-
NamingStrategies["SNAKE_CASE"] = "snakeCase";
|
|
11
|
-
})(NamingStrategies
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NamingStrategies = void 0;
|
|
4
|
+
var NamingStrategies;
|
|
5
|
+
(function (NamingStrategies) {
|
|
6
|
+
NamingStrategies["NONE"] = "";
|
|
7
|
+
NamingStrategies["PASCAL_CASE"] = "pascalCase";
|
|
8
|
+
NamingStrategies["CAMEL_CASE"] = "camelCase";
|
|
9
|
+
NamingStrategies["CONSTANT_CASE"] = "constantCase";
|
|
10
|
+
NamingStrategies["SNAKE_CASE"] = "snakeCase";
|
|
11
|
+
})(NamingStrategies || (exports.NamingStrategies = NamingStrategies = {}));
|
|
12
12
|
//# sourceMappingURL=NamingModel.js.map
|