@odata2ts/odata2ts 0.38.1 → 0.39.1
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 +29 -0
- package/lib/NamingModel.d.ts +3 -0
- package/lib/NamingModel.js.map +1 -1
- package/lib/data-model/DataModelDigestion.d.ts +14 -11
- package/lib/data-model/DataModelDigestion.js +50 -24
- package/lib/data-model/DataModelDigestion.js.map +1 -1
- package/lib/data-model/DataTypeModel.d.ts +2 -0
- package/lib/data-model/DataTypeModel.js.map +1 -1
- package/lib/data-model/NamingHelper.d.ts +1 -0
- package/lib/data-model/NamingHelper.js +6 -0
- package/lib/data-model/NamingHelper.js.map +1 -1
- package/lib/defaultConfig.js +9 -0
- package/lib/defaultConfig.js.map +1 -1
- package/lib/download/downloadMetadata.js +11 -2
- package/lib/download/downloadMetadata.js.map +1 -1
- package/lib/generator/QueryObjectGenerator.js +65 -10
- package/lib/generator/QueryObjectGenerator.js.map +1 -1
- package/lib/generator/ServiceGenerator.js +51 -24
- package/lib/generator/ServiceGenerator.js.map +1 -1
- package/lib/generator/import/ImportObjects.d.ts +7 -4
- package/lib/generator/import/ImportObjects.js +7 -4
- package/lib/generator/import/ImportObjects.js.map +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,32 @@
|
|
|
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.39.1](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.39.0...@odata2ts/odata2ts@0.39.1) (2024-12-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **odata2ts:** add Accept header for metadata downloads ([#340](https://github.com/odata2ts/odata2ts/issues/340)) ([dcdd997](https://github.com/odata2ts/odata2ts/commit/dcdd9975ee9f34bf0474c22372db39fcb80e9bae))
|
|
11
|
+
|
|
12
|
+
# [0.39.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.38.1...@odata2ts/odata2ts@0.39.0) (2024-10-28)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **generator:** add cast operations to base type services ([#327](https://github.com/odata2ts/odata2ts/issues/327)) ([df52284](https://github.com/odata2ts/odata2ts/commit/df522846e275c160266c02d5c5b49c8be995b3fb))
|
|
17
|
+
* **generator:** conversion of subtype by control info ([#331](https://github.com/odata2ts/odata2ts/issues/331)) ([a8a8a50](https://github.com/odata2ts/odata2ts/commit/a8a8a50c5a619cfe7e32bf6fa399e2f5b1f55ffa))
|
|
18
|
+
* **generator:** qobjects with casted subtype props ([#328](https://github.com/odata2ts/odata2ts/issues/328)) ([88eb9bd](https://github.com/odata2ts/odata2ts/commit/88eb9bdedf02fa4d74ebfc638f89aca583f1852d))
|
|
19
|
+
* **service:** subtype services ([#332](https://github.com/odata2ts/odata2ts/issues/332)) ([6918735](https://github.com/odata2ts/odata2ts/commit/691873557d21418561f017189fe896d544ffcba5))
|
|
20
|
+
* **service:** support no url encoding ([#326](https://github.com/odata2ts/odata2ts/issues/326)) ([304bc62](https://github.com/odata2ts/odata2ts/commit/304bc627199766f7a930bffe28e39bb24eea39b1))
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **service:** dedicated options parameter for all services
|
|
25
|
+
|
|
6
26
|
## [0.38.1](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.38.0...@odata2ts/odata2ts@0.38.1) (2024-09-19)
|
|
7
27
|
|
|
8
28
|
### Bug Fixes
|
|
9
29
|
|
|
10
30
|
* **generator:** api usage analysis must respect alias ([#317](https://github.com/odata2ts/odata2ts/issues/317)) ([5877161](https://github.com/odata2ts/odata2ts/commit/5877161317d09c5ded9b44ce4a7ecd0f65e65235))
|
|
31
|
+
|
|
11
32
|
* **generator:** set peer dependency of TS to >= 4.7 ([949d874](https://github.com/odata2ts/odata2ts/commit/949d8749828dda06a2072d4153556c53d0adb3cf))
|
|
12
33
|
|
|
13
34
|
# [0.38.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.37.0...@odata2ts/odata2ts@0.38.0) (2024-09-11)
|
|
@@ -15,12 +36,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
15
36
|
### Bug Fixes
|
|
16
37
|
|
|
17
38
|
* auto name clash resolution for v4 actions ([#315](https://github.com/odata2ts/odata2ts/issues/315)) ([3366843](https://github.com/odata2ts/odata2ts/commit/3366843dc227f9c8edd5b4660d63c564cc82f121))
|
|
39
|
+
|
|
18
40
|
* **generator:** add rimraf as dependency ([9f08ccd](https://github.com/odata2ts/odata2ts/commit/9f08ccd5fc68b1de381ea1cb711c6e667ca5be98))
|
|
41
|
+
|
|
19
42
|
* **generator:** use typeof when using enums as types ([baf784f](https://github.com/odata2ts/odata2ts/commit/baf784f76f119c2394ba4f1c3cd93359dc31171e))
|
|
20
43
|
|
|
21
44
|
### Features
|
|
22
45
|
|
|
23
46
|
* compile src & test folders as sanity check ([12607f0](https://github.com/odata2ts/odata2ts/commit/12607f04a4ec1142d750318cab5964f3d9a513c4))
|
|
47
|
+
|
|
24
48
|
* **generator:** allow for numeric enums ([#308](https://github.com/odata2ts/odata2ts/issues/308)) ([a5c36e6](https://github.com/odata2ts/odata2ts/commit/a5c36e6433bb5d793d5f970b12d6ebb8a4c5270d))
|
|
25
49
|
|
|
26
50
|
# [0.37.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.36.3...@odata2ts/odata2ts@0.37.0) (2024-08-25)
|
|
@@ -36,6 +60,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
36
60
|
### BREAKING CHANGES
|
|
37
61
|
|
|
38
62
|
* as there is no generated index file all file paths must be fixed.
|
|
63
|
+
|
|
39
64
|
* ESM tends to break stuff
|
|
40
65
|
|
|
41
66
|
## [0.36.3](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.36.2...@odata2ts/odata2ts@0.36.3) (2024-08-12)
|
|
@@ -61,9 +86,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
61
86
|
### Features
|
|
62
87
|
|
|
63
88
|
* **generator:** add ts-nocheck to each generated file by default ([#284](https://github.com/odata2ts/odata2ts/issues/284)) ([655a3ab](https://github.com/odata2ts/odata2ts/commit/655a3ab801c79e34841f35b1a72cf7d02064f3b8))
|
|
89
|
+
|
|
64
90
|
* **generator:** generate services based on API reference chain ([#275](https://github.com/odata2ts/odata2ts/issues/275)) ([8fd415b](https://github.com/odata2ts/odata2ts/commit/8fd415bd0a49144e14da08cd5e32d44e947c7f23))
|
|
91
|
+
|
|
65
92
|
* **generator:** support function overloads for different parameter sets ([#282](https://github.com/odata2ts/odata2ts/issues/282)) ([0b53271](https://github.com/odata2ts/odata2ts/commit/0b532710499d975155c21984a62707ecf4789439))
|
|
93
|
+
|
|
66
94
|
* **generator:** support type-only imports ([#290](https://github.com/odata2ts/odata2ts/issues/290)) ([dea381e](https://github.com/odata2ts/odata2ts/commit/dea381e7c31f84e03acbaafc15ede58aa9041c13))
|
|
95
|
+
|
|
67
96
|
* model files always get type checked (no [@ts-nocheck](https://github.com/ts-nocheck)) ([#288](https://github.com/odata2ts/odata2ts/issues/288)) ([43ca58b](https://github.com/odata2ts/odata2ts/commit/43ca58bf72bb8e783b80798eaa73d5fd19676627))
|
|
68
97
|
|
|
69
98
|
### BREAKING CHANGES
|
package/lib/NamingModel.d.ts
CHANGED
|
@@ -91,6 +91,9 @@ export interface QueryObjectNamingOptions extends NamingStrategyOption, Required
|
|
|
91
91
|
propNamingStrategy?: NamingStrategies;
|
|
92
92
|
idFunctions: RequiredNamingOptions;
|
|
93
93
|
operations?: OperationNamingOptions;
|
|
94
|
+
baseType: RequiredNamingOptions & {
|
|
95
|
+
applyQNaming?: boolean;
|
|
96
|
+
};
|
|
94
97
|
}
|
|
95
98
|
export interface OperationNamingOptions extends StandardNamingOptions {
|
|
96
99
|
/**
|
package/lib/NamingModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamingModel.js","sourceRoot":"","sources":["../src/NamingModel.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,6BAAS,CAAA;IACT,8CAA0B,CAAA;IAC1B,4CAAwB,CAAA;IACxB,kDAA8B,CAAA;IAC9B,4CAAwB,CAAA;AAC1B,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B","sourcesContent":["/**\r\n * The available naming strategies.\r\n */\r\nimport { PartialDeep } from \"type-fest\";\r\n\r\nexport enum NamingStrategies {\r\n NONE = \"\",\r\n PASCAL_CASE = \"pascalCase\",\r\n CAMEL_CASE = \"camelCase\",\r\n CONSTANT_CASE = \"constantCase\",\r\n SNAKE_CASE = \"snakeCase\",\r\n}\r\n\r\n/**\r\n * Based on an existing configuration (for example default settings) the user only specifies what needs\r\n * to be changed. Hence, all options are completely optional.\r\n */\r\nexport interface OverridableNamingOptions extends PartialDeep<NameSettings> {}\r\n\r\n/**\r\n * The required and optional name settings for the generator.\r\n */\r\nexport interface NameSettings {\r\n /**\r\n * Because multiple artefacts are generated out of the same entity, some name settings are required in order\r\n * to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,\r\n * so that you only need to override those settings you want to change.\r\n *\r\n * However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with\r\n * your own configuration. In this scenario this switch should be enabled to only have default values for\r\n * the required name settings.\r\n */\r\n minimalDefaults?: boolean;\r\n\r\n /**\r\n * Generation options for models, i.e. interfaces representing entity or complex types.\r\n */\r\n models: ModelNamingOptions;\r\n\r\n /**\r\n * Generation options for Query Objects.\r\n *\r\n * By default, prefix = \"Q\"\r\n */\r\n queryObjects: QueryObjectNamingOptions;\r\n\r\n services: ServiceNamingOptions;\r\n}\r\n\r\nexport interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\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 override the naming options here.\r\n * By default, prefix = \"Editable\"\r\n */\r\n editableModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Id\"\r\n */\r\n idModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * Operation parameter models are generated from function or action signatures.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Params\"\r\n */\r\n operationParamModels: EntityDerivedNamingOptions;\r\n}\r\n\r\nexport interface EntityDerivedNamingOptions extends RequiredNamingOptions {\r\n applyModelNaming?: boolean;\r\n}\r\n\r\nexport interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\r\n\r\n idFunctions: RequiredNamingOptions;\r\n\r\n operations?: OperationNamingOptions;\r\n}\r\n\r\nexport interface OperationNamingOptions extends StandardNamingOptions {\r\n /**\r\n * Naming options for actions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n action?: StandardNamingOptions;\r\n /**\r\n * Naming options for functions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n function?: StandardNamingOptions;\r\n}\r\n\r\nexport interface NamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface FileNamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface StandardNamingOptions {\r\n /**\r\n * Prefix all names, e.g. \"I\" => \"ITest\"\r\n */\r\n prefix?: string;\r\n /**\r\n * Suffix all names, e.g. \"model\" => \"TestModel\"\r\n */\r\n suffix?: string;\r\n}\r\n\r\nexport interface RequiredNamingOptions extends Required<StandardNamingOptions> {}\r\n\r\n/**\r\n * Naming options for generated service classes.\r\n * These options affect the main service as well as all services generated for each entity, complex and collection type.\r\n *\r\n * There exists one specialty about services: The file names are not configurable.\r\n * File names are determined by the name of their corresponding classes, so that service file name\r\n * and service class name always correspond.\r\n *\r\n * By default, suffix = Service and namingStrategy = PascalCase\r\n */\r\nexport interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * Controls the naming options for the main odata service.\r\n * By default, the base service naming options are applied.\r\n * But since this is the main entry point for users, it can be configured individually here.\r\n *\r\n * By default, applyServiceNaming = true\r\n */\r\n main?: NamingStrategyOption & StandardNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Name of the service responsible for entity collections.\r\n *\r\n * By default, suffix = Collection and applyServiceNaming = true\r\n */\r\n collection: RequiredNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Naming for getter method of another service.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Operations are functions and actions of the OData service and are represented as methods\r\n * of the generated service class. This setting controls the naming of the corresponding\r\n * function.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n operations?: NamingStrategyOption & OperationNamingOptions;\r\n\r\n /**\r\n * Naming options for private properties of service classes.\r\n *\r\n * By default, prefix = _\r\n */\r\n privateProps: NamingStrategyOption & RequiredNamingOptions;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"NamingModel.js","sourceRoot":"","sources":["../src/NamingModel.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,6BAAS,CAAA;IACT,8CAA0B,CAAA;IAC1B,4CAAwB,CAAA;IACxB,kDAA8B,CAAA;IAC9B,4CAAwB,CAAA;AAC1B,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B","sourcesContent":["/**\r\n * The available naming strategies.\r\n */\r\nimport { PartialDeep } from \"type-fest\";\r\n\r\nexport enum NamingStrategies {\r\n NONE = \"\",\r\n PASCAL_CASE = \"pascalCase\",\r\n CAMEL_CASE = \"camelCase\",\r\n CONSTANT_CASE = \"constantCase\",\r\n SNAKE_CASE = \"snakeCase\",\r\n}\r\n\r\n/**\r\n * Based on an existing configuration (for example default settings) the user only specifies what needs\r\n * to be changed. Hence, all options are completely optional.\r\n */\r\nexport interface OverridableNamingOptions extends PartialDeep<NameSettings> {}\r\n\r\n/**\r\n * The required and optional name settings for the generator.\r\n */\r\nexport interface NameSettings {\r\n /**\r\n * Because multiple artefacts are generated out of the same entity, some name settings are required in order\r\n * to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,\r\n * so that you only need to override those settings you want to change.\r\n *\r\n * However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with\r\n * your own configuration. In this scenario this switch should be enabled to only have default values for\r\n * the required name settings.\r\n */\r\n minimalDefaults?: boolean;\r\n\r\n /**\r\n * Generation options for models, i.e. interfaces representing entity or complex types.\r\n */\r\n models: ModelNamingOptions;\r\n\r\n /**\r\n * Generation options for Query Objects.\r\n *\r\n * By default, prefix = \"Q\"\r\n */\r\n queryObjects: QueryObjectNamingOptions;\r\n\r\n services: ServiceNamingOptions;\r\n}\r\n\r\nexport interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\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 override the naming options here.\r\n * By default, prefix = \"Editable\"\r\n */\r\n editableModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Id\"\r\n */\r\n idModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * Operation parameter models are generated from function or action signatures.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Params\"\r\n */\r\n operationParamModels: EntityDerivedNamingOptions;\r\n}\r\n\r\nexport interface EntityDerivedNamingOptions extends RequiredNamingOptions {\r\n applyModelNaming?: boolean;\r\n}\r\n\r\nexport interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\r\n\r\n idFunctions: RequiredNamingOptions;\r\n\r\n operations?: OperationNamingOptions;\r\n\r\n baseType: RequiredNamingOptions & { applyQNaming?: boolean };\r\n}\r\n\r\nexport interface OperationNamingOptions extends StandardNamingOptions {\r\n /**\r\n * Naming options for actions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n action?: StandardNamingOptions;\r\n /**\r\n * Naming options for functions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n function?: StandardNamingOptions;\r\n}\r\n\r\nexport interface NamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface FileNamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface StandardNamingOptions {\r\n /**\r\n * Prefix all names, e.g. \"I\" => \"ITest\"\r\n */\r\n prefix?: string;\r\n /**\r\n * Suffix all names, e.g. \"model\" => \"TestModel\"\r\n */\r\n suffix?: string;\r\n}\r\n\r\nexport interface RequiredNamingOptions extends Required<StandardNamingOptions> {}\r\n\r\n/**\r\n * Naming options for generated service classes.\r\n * These options affect the main service as well as all services generated for each entity, complex and collection type.\r\n *\r\n * There exists one specialty about services: The file names are not configurable.\r\n * File names are determined by the name of their corresponding classes, so that service file name\r\n * and service class name always correspond.\r\n *\r\n * By default, suffix = Service and namingStrategy = PascalCase\r\n */\r\nexport interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * Controls the naming options for the main odata service.\r\n * By default, the base service naming options are applied.\r\n * But since this is the main entry point for users, it can be configured individually here.\r\n *\r\n * By default, applyServiceNaming = true\r\n */\r\n main?: NamingStrategyOption & StandardNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Name of the service responsible for entity collections.\r\n *\r\n * By default, suffix = Collection and applyServiceNaming = true\r\n */\r\n collection: RequiredNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Naming for getter method of another service.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Operations are functions and actions of the OData service and are represented as methods\r\n * of the generated service class. This setting controls the naming of the corresponding\r\n * function.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n operations?: NamingStrategyOption & OperationNamingOptions;\r\n\r\n /**\r\n * Naming options for private properties of service classes.\r\n *\r\n * By default, prefix = _\r\n */\r\n privateProps: NamingStrategyOption & RequiredNamingOptions;\r\n}\r\n"]}
|
|
@@ -28,16 +28,6 @@ export declare abstract class Digester<S extends Schema<ET, CT>, ET extends Enti
|
|
|
28
28
|
* Reverse mapping from fqName to data type: EntityType, ComplexType, EnumType, or Primitive Type.
|
|
29
29
|
*/
|
|
30
30
|
private model2Type;
|
|
31
|
-
/**
|
|
32
|
-
* Stores models (ComplexType or EntityType) by fqName that have been referenced in the API
|
|
33
|
-
* as entry point or via navProp.
|
|
34
|
-
* For these models one or two services are generated.
|
|
35
|
-
*
|
|
36
|
-
* In this way unnecessary service generation is prevented. For example, complex types that
|
|
37
|
-
* are only referenced as response of an operation do not need a generated service.
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
private serviceModels;
|
|
41
31
|
protected constructor(version: ODataVersion, schemas: Array<S>, options: DigestionOptions, namingHelper: NamingHelper, converters?: MappedConverterChains);
|
|
42
32
|
private collectModelTypes;
|
|
43
33
|
private addModel2Type;
|
|
@@ -58,9 +48,21 @@ export declare abstract class Digester<S extends Schema<ET, CT>, ET extends Enti
|
|
|
58
48
|
private addEnum;
|
|
59
49
|
private addComplexType;
|
|
60
50
|
private addEntityType;
|
|
51
|
+
/**
|
|
52
|
+
* Check that models (ComplexType or EntityType) have been referenced in the API
|
|
53
|
+
* as entry point or via navProp or by virtue of being a base type or subtype of those.
|
|
54
|
+
* For these models one or two services are generated.
|
|
55
|
+
*
|
|
56
|
+
* In this way unnecessary service generation is prevented. For example, complex types that
|
|
57
|
+
* are only referenced as response of an operation do not need a generated service.
|
|
58
|
+
*
|
|
59
|
+
* @param ec
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
61
62
|
private analyzeModelUsage;
|
|
62
63
|
/**
|
|
63
|
-
* Check
|
|
64
|
+
* Check usage of model types within API.
|
|
65
|
+
*
|
|
64
66
|
* @param fqModelName
|
|
65
67
|
* @private
|
|
66
68
|
*/
|
|
@@ -69,4 +71,5 @@ export declare abstract class Digester<S extends Schema<ET, CT>, ET extends Enti
|
|
|
69
71
|
private postProcessKeys;
|
|
70
72
|
private collectBaseClassPropsAndKeys;
|
|
71
73
|
protected mapProp: (p: Property, entityPropConfig?: PropertyGenerationOptions | undefined) => PropertyModel;
|
|
74
|
+
private addSubtypes;
|
|
72
75
|
}
|
|
@@ -20,16 +20,6 @@ export class Digester {
|
|
|
20
20
|
* Reverse mapping from fqName to data type: EntityType, ComplexType, EnumType, or Primitive Type.
|
|
21
21
|
*/
|
|
22
22
|
this.model2Type = new Map();
|
|
23
|
-
/**
|
|
24
|
-
* Stores models (ComplexType or EntityType) by fqName that have been referenced in the API
|
|
25
|
-
* as entry point or via navProp.
|
|
26
|
-
* For these models one or two services are generated.
|
|
27
|
-
*
|
|
28
|
-
* In this way unnecessary service generation is prevented. For example, complex types that
|
|
29
|
-
* are only referenced as response of an operation do not need a generated service.
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
this.serviceModels = new Set();
|
|
33
23
|
this.mapProp = (p, entityPropConfig) => {
|
|
34
24
|
var _a, _b;
|
|
35
25
|
if (!p.$.Type) {
|
|
@@ -144,7 +134,6 @@ export class Digester {
|
|
|
144
134
|
}
|
|
145
135
|
digestEntityTypesAndOperations() {
|
|
146
136
|
this.schemas.forEach((schema) => {
|
|
147
|
-
var _a;
|
|
148
137
|
const ns = [schema.$.Namespace, schema.$.Alias];
|
|
149
138
|
// type definitions: alias for primitive types
|
|
150
139
|
this.addTypeDefinition(schema.$.Namespace, schema.TypeDefinition);
|
|
@@ -156,11 +145,13 @@ export class Digester {
|
|
|
156
145
|
this.addEntityType(ns, schema.EntityType);
|
|
157
146
|
// V4 only: function & action types
|
|
158
147
|
this.digestOperations(schema);
|
|
159
|
-
// mark each EntityType & ComplexType which is referencable from API
|
|
160
|
-
this.analyzeModelUsage(((_a = schema.EntityContainer) === null || _a === void 0 ? void 0 : _a.length) ? schema.EntityContainer[0] : undefined);
|
|
161
148
|
});
|
|
162
149
|
this.postProcessModel();
|
|
163
150
|
this.postProcessKeys();
|
|
151
|
+
this.schemas.forEach((schema) => {
|
|
152
|
+
var _a;
|
|
153
|
+
this.analyzeModelUsage(((_a = schema.EntityContainer) === null || _a === void 0 ? void 0 : _a.length) ? schema.EntityContainer[0] : undefined);
|
|
154
|
+
});
|
|
164
155
|
}
|
|
165
156
|
getBaseModel(entityConfig, model, namespace, name, fqName) {
|
|
166
157
|
var _a, _b;
|
|
@@ -197,7 +188,8 @@ export class Digester {
|
|
|
197
188
|
baseProps: [],
|
|
198
189
|
abstract: ifTrue(model.$.Abstract),
|
|
199
190
|
open: ifTrue(model.$.OpenType),
|
|
200
|
-
genMode: Modes.
|
|
191
|
+
genMode: Modes.qobjects,
|
|
192
|
+
subtypes: new Set(),
|
|
201
193
|
};
|
|
202
194
|
}
|
|
203
195
|
addTypeDefinition(ns, types) {
|
|
@@ -268,9 +260,20 @@ export class Digester {
|
|
|
268
260
|
fqName: baseModel.fqName,
|
|
269
261
|
modelName: this.namingHelper.getIdModelName(name),
|
|
270
262
|
qName: this.namingHelper.getQIdFunctionName(name),
|
|
271
|
-
}, generateId: !!keyNames.length, keyNames: keyNames, keys: [], getKeyUnion: () => keyNames.join(" | ") }));
|
|
263
|
+
}, generateId: !!keyNames.length, keyNames: keyNames, keys: [], getKeyUnion: () => keyNames.join(" | "), subtypes: new Set() }));
|
|
272
264
|
}
|
|
273
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Check that models (ComplexType or EntityType) have been referenced in the API
|
|
268
|
+
* as entry point or via navProp or by virtue of being a base type or subtype of those.
|
|
269
|
+
* For these models one or two services are generated.
|
|
270
|
+
*
|
|
271
|
+
* In this way unnecessary service generation is prevented. For example, complex types that
|
|
272
|
+
* are only referenced as response of an operation do not need a generated service.
|
|
273
|
+
*
|
|
274
|
+
* @param ec
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
274
277
|
analyzeModelUsage(ec) {
|
|
275
278
|
var _a, _b;
|
|
276
279
|
if ((_a = ec === null || ec === void 0 ? void 0 : ec.EntitySet) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -282,7 +285,8 @@ export class Digester {
|
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
/**
|
|
285
|
-
* Check
|
|
288
|
+
* Check usage of model types within API.
|
|
289
|
+
*
|
|
286
290
|
* @param fqModelName
|
|
287
291
|
* @private
|
|
288
292
|
*/
|
|
@@ -290,14 +294,19 @@ export class Digester {
|
|
|
290
294
|
var _a;
|
|
291
295
|
// to also resolve aliases the data model needs to be used
|
|
292
296
|
const model = (_a = this.dataModel.getEntityType(fqModelName)) !== null && _a !== void 0 ? _a : this.dataModel.getComplexType(fqModelName);
|
|
293
|
-
if (!(model === null || model === void 0 ? void 0 : model.fqName) ||
|
|
297
|
+
if (!(model === null || model === void 0 ? void 0 : model.fqName) || model.genMode === Modes.service) {
|
|
294
298
|
return;
|
|
295
299
|
}
|
|
296
|
-
|
|
300
|
+
model.genMode = Modes.service;
|
|
297
301
|
if (model) {
|
|
302
|
+
// respect base classes
|
|
298
303
|
if (model.baseClasses.length) {
|
|
299
304
|
this.analyze(model.baseClasses[0]);
|
|
300
305
|
}
|
|
306
|
+
// include subtypes since each base class can be cast to its subtypes
|
|
307
|
+
model.subtypes.forEach((subtype) => {
|
|
308
|
+
this.analyze(subtype);
|
|
309
|
+
});
|
|
301
310
|
model === null || model === void 0 ? void 0 : model.props.forEach((p) => {
|
|
302
311
|
if (p.dataType === "ComplexType" /* DataTypes.ComplexType */ || p.dataType === "ModelType" /* DataTypes.ModelType */) {
|
|
303
312
|
this.analyze(p.fqType);
|
|
@@ -309,19 +318,22 @@ export class Digester {
|
|
|
309
318
|
// complex types
|
|
310
319
|
const complexTypes = this.dataModel.getComplexTypes();
|
|
311
320
|
complexTypes.forEach((ct) => {
|
|
321
|
+
// build up set of subtypes for each complex type
|
|
322
|
+
this.addSubtypes(ct);
|
|
323
|
+
// get props & keys from base types
|
|
312
324
|
const [baseProps, _, baseAttributes] = this.collectBaseClassPropsAndKeys(ct, []);
|
|
313
325
|
const { open } = baseAttributes;
|
|
314
326
|
ct.baseProps = baseProps.map((bp) => (Object.assign({}, bp)));
|
|
315
327
|
if (open) {
|
|
316
328
|
ct.open = true;
|
|
317
329
|
}
|
|
318
|
-
if (!this.serviceModels.has(ct.fqName)) {
|
|
319
|
-
ct.genMode = Modes.qobjects;
|
|
320
|
-
}
|
|
321
330
|
});
|
|
322
331
|
// entity types
|
|
323
332
|
const entityTypes = this.dataModel.getEntityTypes();
|
|
324
333
|
entityTypes.forEach((et) => {
|
|
334
|
+
// build up set of subtypes for each entity type
|
|
335
|
+
this.addSubtypes(et);
|
|
336
|
+
// get props & keys from base types
|
|
325
337
|
const [baseProps, baseKeys, baseAttributes] = this.collectBaseClassPropsAndKeys(et, []);
|
|
326
338
|
const { fqIdName, idName, qIdName, open } = baseAttributes;
|
|
327
339
|
et.baseProps = baseProps.map((bp) => (Object.assign({}, bp)));
|
|
@@ -336,9 +348,6 @@ export class Digester {
|
|
|
336
348
|
if (open) {
|
|
337
349
|
et.open = open;
|
|
338
350
|
}
|
|
339
|
-
if (!this.serviceModels.has(et.fqName)) {
|
|
340
|
-
et.genMode = Modes.qobjects;
|
|
341
|
-
}
|
|
342
351
|
et.keyNames.unshift(...baseKeys.filter((bk) => !et.keyNames.includes(bk)));
|
|
343
352
|
});
|
|
344
353
|
}
|
|
@@ -400,6 +409,23 @@ export class Digester {
|
|
|
400
409
|
return [props, keys, { fqIdName, idName, qIdName, open }];
|
|
401
410
|
}, [[], [], { fqIdName: "", idName: "", qIdName: "", open: false }]);
|
|
402
411
|
}
|
|
412
|
+
addSubtypes(model, grandChildren = new Set()) {
|
|
413
|
+
if (!model.baseClasses.length) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
model.baseClasses.forEach((baseClass) => {
|
|
417
|
+
const baseType = this.dataModel.getModel(baseClass);
|
|
418
|
+
// add subtypes & base name for q-objects
|
|
419
|
+
baseType.subtypes.add(model.fqName);
|
|
420
|
+
if (!baseType.qBaseName) {
|
|
421
|
+
baseType.qBaseName = this.namingHelper.getQBaseName(baseType.name);
|
|
422
|
+
}
|
|
423
|
+
grandChildren.forEach((gc) => baseType.subtypes.add(gc));
|
|
424
|
+
// recursive
|
|
425
|
+
grandChildren.add(model.fqName);
|
|
426
|
+
this.addSubtypes(baseType, grandChildren);
|
|
427
|
+
});
|
|
428
|
+
}
|
|
403
429
|
}
|
|
404
430
|
Digester.EDM_PREFIX = "Edm.";
|
|
405
431
|
//# sourceMappingURL=DataModelDigestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataModelDigestion.js","sourceRoot":"","sources":["../../src/data-model/DataModelDigestion.ts"],"names":[],"mappings":";AAEA,OAAO,EAGL,KAAK,GAEN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAsB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAY9E,OAAO,EAAE,mBAAmB,EAAe,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAQ9D,SAAS,MAAM,CAAC,KAAyB;IACvC,OAAO,KAAK,KAAK,MAAM,CAAC;AAC1B,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,KAAK,KAAK,OAAO,CAAC;AAC3B,CAAC;AASD,MAAM,OAAgB,QAAQ;IAsB5B,YACY,OAAqB,EACrB,OAAiB,EACjB,OAAyB,EACzB,YAA0B,EACpC,UAAkC;QAJxB,YAAO,GAAP,OAAO,CAAc;QACrB,YAAO,GAAP,OAAO,C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oryFunctionModel.js\";\r\nimport {\r\n ComplexTypeGenerationOptions,\r\n EntityTypeGenerationOptions,\r\n Modes,\r\n PropertyGenerationOptions,\r\n} from \"../OptionModel.js\";\r\nimport { DataModel, NamespaceWithAlias, withNamespace } from \"./DataModel.js\";\r\nimport {\r\n ComplexType as ComplexModelType,\r\n DataTypes,\r\n EntityType as EntityModelType,\r\n ODataVersion,\r\n PropertyModel,\r\n} from \"./DataTypeModel.js\";\r\nimport { ComplexType, EntityType, EnumType, Property, Schema, TypeDefinition } from \"./edmx/ODataEdmxModelBase.js\";\r\nimport { EntityContainerV3, SchemaV3 } from \"./edmx/ODataEdmxModelV3.js\";\r\nimport { EntityContainerV4, SchemaV4 } from \"./edmx/ODataEdmxModelV4.js\";\r\nimport { NamingHelper } from \"./NamingHelper.js\";\r\nimport { ServiceConfigHelper, WithoutName } from \"./ServiceConfigHelper.js\";\r\nimport { NameClashValidator } from \"./validation/NameClashValidator.js\";\r\nimport { NameValidator } from \"./validation/NameValidator.js\";\r\nimport { NoopValidator } from \"./validation/NoopValidator.js\";\r\n\r\ntype CollectorTuple = [\r\n Array<PropertyModel>,\r\n Array<string>,\r\n { fqIdName: string; idName: string; qIdName: string; open: boolean },\r\n];\r\n\r\nfunction ifTrue(value: string | undefined): boolean {\r\n return value === \"true\";\r\n}\r\n\r\nfunction ifFalse(value: string | undefined): boolean {\r\n return value === \"false\";\r\n}\r\n\r\nexport interface TypeModel {\r\n outputType: string;\r\n qPath: string;\r\n qCollection: string;\r\n qParam: string | undefined;\r\n}\r\n\r\nexport abstract class Digester<S extends Schema<ET, CT>, ET extends EntityType, CT extends ComplexType> {\r\n protected static EDM_PREFIX = \"Edm.\";\r\n\r\n protected readonly dataModel: DataModel;\r\n protected readonly serviceConfigHelper: ServiceConfigHelper;\r\n protected readonly nameValidator: NameValidator;\r\n\r\n /**\r\n * Reverse mapping from fqName to data type: EntityType, ComplexType, EnumType, or Primitive Type.\r\n */\r\n private model2Type = new Map<string, DataTypes>();\r\n /**\r\n * Stores models (ComplexType or EntityType) by fqName that have been referenced in the API\r\n * as entry point or via navProp.\r\n * For these models one or two services are generated.\r\n *\r\n * In this way unnecessary service generation is prevented. For example, complex types that\r\n * are only referenced as response of an operation do not need a generated service.\r\n * @private\r\n */\r\n private serviceModels = new Set<string>();\r\n\r\n protected constructor(\r\n protected version: ODataVersion,\r\n protected schemas: Array<S>,\r\n protected options: DigestionOptions,\r\n protected namingHelper: NamingHelper,\r\n converters?: MappedConverterChains,\r\n ) {\r\n const namespaces = schemas.map<NamespaceWithAlias>((s) => [s.$.Namespace, s.$.Alias]);\r\n this.dataModel = new DataModel(namespaces, version, converters);\r\n this.serviceConfigHelper = new ServiceConfigHelper(options);\r\n this.nameValidator = options.bundledFileGeneration ? new NameClashValidator(options) : new NoopValidator();\r\n\r\n this.collectModelTypes(schemas);\r\n }\r\n\r\n private collectModelTypes(schemas: Array<S>) {\r\n schemas.forEach((schema) => {\r\n const { Namespace: ns, Alias: alias } = schema.$;\r\n\r\n schema.EnumType?.forEach((et) => {\r\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.EnumType);\r\n });\r\n schema.ComplexType?.forEach((ct) => {\r\n this.addModel2Type(ns, alias, ct.$.Name, DataTypes.ComplexType);\r\n });\r\n schema.EntityType?.forEach((et) => {\r\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.ModelType);\r\n });\r\n });\r\n }\r\n\r\n private addModel2Type(ns: string, alias: string | undefined, name: string, dt: DataTypes) {\r\n this.model2Type.set(withNamespace(ns, name), dt);\r\n if (alias) {\r\n this.model2Type.set(withNamespace(alias, name), dt);\r\n }\r\n }\r\n\r\n protected abstract getNavigationProps(entityType: ET | ComplexType): Array<Property>;\r\n\r\n protected abstract digestOperations(schema: SchemaV3 | SchemaV4): void;\r\n\r\n protected abstract digestEntityContainer(schema: SchemaV3 | SchemaV4): void;\r\n\r\n /**\r\n * Get essential infos about a given odata type from the version specific service variants.\r\n *\r\n * @param type\r\n * @return tuple of return type, query object, query collection object\r\n */\r\n protected abstract mapODataType(type: string): TypeModel;\r\n\r\n public async digest(): Promise<DataModel> {\r\n this.digestEntityTypesAndOperations();\r\n\r\n // delegate to version specific entity container digestion\r\n this.schemas.forEach((schema) => this.digestEntityContainer(schema));\r\n\r\n this.dataModel.setNameValidation(this.nameValidator.validate());\r\n return this.dataModel;\r\n }\r\n\r\n private digestEntityTypesAndOperations() {\r\n this.schemas.forEach((schema) => {\r\n const ns: NamespaceWithAlias = [schema.$.Namespace, schema.$.Alias];\r\n\r\n // type definitions: alias for primitive types\r\n this.addTypeDefinition(schema.$.Namespace, schema.TypeDefinition);\r\n\r\n // enums\r\n this.addEnum(ns, schema.EnumType);\r\n\r\n // complex types\r\n this.addComplexType(ns, schema.ComplexType);\r\n\r\n // entity types\r\n this.addEntityType(ns, schema.EntityType);\r\n\r\n // V4 only: function & action types\r\n this.digestOperations(schema);\r\n\r\n // mark each EntityType & ComplexType which is referencable from API\r\n this.analyzeModelUsage(schema.EntityContainer?.length ? schema.EntityContainer[0] : undefined);\r\n });\r\n\r\n this.postProcessModel();\r\n this.postProcessKeys();\r\n }\r\n\r\n private getBaseModel(\r\n entityConfig: WithoutName<EntityTypeGenerationOptions | ComplexTypeGenerationOptions> | undefined,\r\n model: ComplexType,\r\n namespace: string,\r\n name: string,\r\n fqName: string,\r\n ) {\r\n const odataName = model.$.Name;\r\n\r\n // map properties respecting the config\r\n const props = [...(model.Property ?? []), ...this.getNavigationProps(model)].map((p) => {\r\n const epConfig = entityConfig?.properties?.find((ep) => ep.name === p.$.Name);\r\n return this.mapProp(p, epConfig);\r\n });\r\n\r\n // support for base types, i.e. extends clause of interfaces\r\n const baseClasses = [];\r\n let finalBaseClass: string | undefined = undefined;\r\n if (model.$.BaseType) {\r\n baseClasses.push(model.$.BaseType);\r\n const [baseName, basePrefix] = this.namingHelper.getNameAndServicePrefix(model.$.BaseType);\r\n const baseConfig =\r\n this.serviceConfigHelper.findEntityTypeConfig([basePrefix!], baseName) ||\r\n this.serviceConfigHelper.findComplexTypeConfig([basePrefix!], baseName);\r\n finalBaseClass = baseConfig?.mappedName ?? baseName;\r\n }\r\n\r\n return {\r\n fqName,\r\n odataName,\r\n name,\r\n modelName: this.namingHelper.getModelName(name),\r\n qName: this.namingHelper.getQName(name),\r\n editableName: this.namingHelper.getEditableModelName(name),\r\n serviceName: this.namingHelper.getServiceName(name),\r\n serviceCollectionName: this.namingHelper.getCollectionServiceName(name),\r\n folderPath: this.namingHelper.getFolderPath(namespace, name),\r\n baseClasses,\r\n finalBaseClass,\r\n props,\r\n baseProps: [], // postprocess required\r\n abstract: ifTrue(model.$.Abstract),\r\n open: ifTrue(model.$.OpenType),\r\n genMode: Modes.service,\r\n } satisfies Partial<ComplexModelType>;\r\n }\r\n\r\n private addTypeDefinition(ns: string, types: Array<TypeDefinition> | undefined) {\r\n if (!types || !types.length) {\r\n return;\r\n }\r\n\r\n for (const t of types) {\r\n this.dataModel.addTypeDefinition(ns, t.$.Name, t.$.UnderlyingType);\r\n }\r\n }\r\n\r\n private addEnum(namespace: NamespaceWithAlias, models: Array<EnumType> | undefined) {\r\n if (!models || !models.length) {\r\n return;\r\n }\r\n\r\n for (const et of models) {\r\n const odataName = et.$.Name;\r\n const fqName = withNamespace(namespace[0], odataName);\r\n const config = this.serviceConfigHelper.findEnumTypeConfig(namespace, odataName);\r\n const enumName = this.nameValidator.addEnumType(fqName, config?.mappedName || odataName);\r\n const filePath = this.namingHelper.getFolderPath(namespace[0], enumName);\r\n this.dataModel.addEnum(namespace[0], odataName, {\r\n fqName,\r\n odataName,\r\n name: enumName,\r\n modelName: this.namingHelper.getEnumName(enumName),\r\n folderPath: filePath,\r\n members: et.Member?.length ? et.Member.map((m) => ({ name: m.$.Name, value: m.$.Value })) : [],\r\n });\r\n }\r\n }\r\n\r\n private addComplexType(namespace: NamespaceWithAlias, models: Array<ComplexType> | undefined) {\r\n if (!models || !models.length) {\r\n return;\r\n }\r\n\r\n for (const model of models) {\r\n const config = this.serviceConfigHelper.findComplexTypeConfig(namespace, model.$.Name);\r\n const fqName = withNamespace(namespace[0], model.$.Name);\r\n const name = this.nameValidator.addComplexType(fqName, config?.mappedName || model.$.Name);\r\n const baseModel = this.getBaseModel(config, model, namespace[0], name, fqName);\r\n this.dataModel.addComplexType(namespace[0], baseModel.odataName, baseModel);\r\n }\r\n }\r\n\r\n private addEntityType(namespace: NamespaceWithAlias, models: Array<ET> | undefined) {\r\n if (!models || !models.length) {\r\n return;\r\n }\r\n\r\n for (const model of models) {\r\n const entityConfig = this.serviceConfigHelper.findEntityTypeConfig(namespace, model.$.Name);\r\n const fqName = withNamespace(namespace[0], model.$.Name);\r\n const name = this.nameValidator.addEntityType(fqName, entityConfig?.mappedName || model.$.Name);\r\n const baseModel = this.getBaseModel(entityConfig, model, namespace[0], name, fqName);\r\n\r\n // key support: we add keys from this entity,\r\n // but not keys stemming from base classes (postprocess required)\r\n const keyNames: Array<string> = [];\r\n if (entityConfig?.keys?.length) {\r\n keyNames.push(...entityConfig.keys);\r\n } else {\r\n const entity = model as EntityType;\r\n if (entity.Key && entity.Key.length && entity.Key[0].PropertyRef.length) {\r\n const propNames = entity.Key[0].PropertyRef.map((key) => key.$.Name);\r\n keyNames.push(...propNames);\r\n }\r\n }\r\n\r\n this.dataModel.addEntityType(namespace[0], baseModel.odataName, {\r\n ...baseModel,\r\n id: {\r\n fqName: baseModel.fqName,\r\n modelName: this.namingHelper.getIdModelName(name),\r\n qName: this.namingHelper.getQIdFunctionName(name),\r\n },\r\n generateId: !!keyNames.length,\r\n keyNames: keyNames, // postprocess required to include key specs from base classes\r\n keys: [], // postprocess required to include props from base classes\r\n getKeyUnion: () => keyNames.join(\" | \"),\r\n });\r\n }\r\n }\r\n\r\n private analyzeModelUsage(ec: EntityContainerV3 | EntityContainerV4 | undefined) {\r\n if (ec?.EntitySet?.length) {\r\n ec.EntitySet.forEach((et) => this.analyze(et.$.EntityType));\r\n }\r\n const ec4 = ec as EntityContainerV4;\r\n if (ec4?.Singleton?.length) {\r\n ec4.Singleton.forEach((singleton) => this.analyze(singleton.$.Type));\r\n }\r\n }\r\n\r\n /**\r\n * Check\r\n * @param fqModelName\r\n * @private\r\n */\r\n private analyze(fqModelName: string) {\r\n // to also resolve aliases the data model needs to be used\r\n const model = this.dataModel.getEntityType(fqModelName) ?? this.dataModel.getComplexType(fqModelName);\r\n if (!model?.fqName || this.serviceModels.has(model.fqName)) {\r\n return;\r\n }\r\n\r\n this.serviceModels.add(model.fqName);\r\n\r\n if (model) {\r\n if (model.baseClasses.length) {\r\n this.analyze(model.baseClasses[0]);\r\n }\r\n model?.props.forEach((p) => {\r\n if (p.dataType === DataTypes.ComplexType || p.dataType === DataTypes.ModelType) {\r\n this.analyze(p.fqType);\r\n }\r\n });\r\n }\r\n }\r\n\r\n private postProcessModel() {\r\n // complex types\r\n const complexTypes = this.dataModel.getComplexTypes();\r\n complexTypes.forEach((ct) => {\r\n const [baseProps, _, baseAttributes] = this.collectBaseClassPropsAndKeys(ct, []);\r\n const { open } = baseAttributes;\r\n ct.baseProps = baseProps.map((bp) => ({ ...bp }));\r\n if (open) {\r\n ct.open = true;\r\n }\r\n if (!this.serviceModels.has(ct.fqName)) {\r\n ct.genMode = Modes.qobjects;\r\n }\r\n });\r\n // entity types\r\n const entityTypes = this.dataModel.getEntityTypes();\r\n entityTypes.forEach((et) => {\r\n const [baseProps, baseKeys, baseAttributes] = this.collectBaseClassPropsAndKeys(et, []);\r\n const { fqIdName, idName, qIdName, open } = baseAttributes;\r\n et.baseProps = baseProps.map((bp) => ({ ...bp }));\r\n\r\n if (!et.keyNames.length && idName) {\r\n et.id = {\r\n fqName: fqIdName,\r\n modelName: idName,\r\n qName: qIdName,\r\n };\r\n et.generateId = false;\r\n }\r\n if (open) {\r\n et.open = open;\r\n }\r\n if (!this.serviceModels.has(et.fqName)) {\r\n et.genMode = Modes.qobjects;\r\n }\r\n et.keyNames.unshift(...baseKeys.filter((bk) => !et.keyNames.includes(bk)));\r\n });\r\n }\r\n\r\n private postProcessKeys() {\r\n const entityTypes = this.dataModel.getEntityTypes();\r\n entityTypes.forEach((et) => {\r\n const isSingleKey = et.keyNames.length === 1;\r\n const props = [...et.baseProps, ...et.props];\r\n et.keys = et.keyNames.map((keyName) => {\r\n const prop = props.find((p) => p.odataName === keyName);\r\n if (!prop) {\r\n throw new Error(`Key with name [${keyName}] not found in props!`);\r\n }\r\n\r\n // automatically set key prop to managed, if this is the only key of the given entity\r\n if (prop.managed === undefined) {\r\n prop.managed = !this.options.disableAutoManagedKey && isSingleKey;\r\n }\r\n\r\n return prop;\r\n });\r\n });\r\n }\r\n\r\n private collectBaseClassPropsAndKeys(model: ComplexModelType, visitedModels: string[]): CollectorTuple {\r\n if (visitedModels.includes(model.fqName)) {\r\n throw new Error(`Cyclic inheritance detected for model ${model.fqName}!`);\r\n }\r\n visitedModels.push(model.fqName);\r\n return model.baseClasses.reduce(\r\n ([props, keys, attributes], bc) => {\r\n const baseModel = this.dataModel.getEntityType(bc) || this.dataModel.getComplexType(bc);\r\n if (!baseModel) {\r\n throw new Error(`BaseModel \"${bc}\" doesn't exist!`);\r\n }\r\n\r\n let { fqIdName, idName, qIdName, open } = attributes;\r\n\r\n // recursive\r\n if (baseModel.baseClasses.length) {\r\n const [parentProps, parentKeys, parentAttributes] = this.collectBaseClassPropsAndKeys(\r\n baseModel,\r\n visitedModels,\r\n );\r\n props.unshift(...parentProps);\r\n keys.unshift(...parentKeys);\r\n if (parentAttributes?.idName) {\r\n fqIdName = parentAttributes.fqIdName;\r\n idName = parentAttributes.idName;\r\n qIdName = parentAttributes.qIdName;\r\n }\r\n if (parentAttributes?.open) {\r\n open = true;\r\n }\r\n }\r\n\r\n props.push(...baseModel.props);\r\n const entityModel = baseModel as EntityModelType;\r\n if (entityModel.keyNames?.length) {\r\n keys.push(...entityModel.keyNames.filter((kn) => !keys.includes(kn)));\r\n fqIdName = entityModel.id.fqName;\r\n idName = entityModel.id.modelName;\r\n qIdName = entityModel.id.qName;\r\n }\r\n if (baseModel.open) {\r\n open = true;\r\n }\r\n return [props, keys, { fqIdName, idName, qIdName, open }];\r\n },\r\n [[], [], { fqIdName: \"\", idName: \"\", qIdName: \"\", open: false }] as CollectorTuple,\r\n );\r\n }\r\n\r\n protected mapProp = (p: Property, entityPropConfig?: PropertyGenerationOptions | undefined): PropertyModel => {\r\n if (!p.$.Type) {\r\n throw new Error(`No type information given for property [${p.$.Name}]!`);\r\n }\r\n\r\n const configProp = this.serviceConfigHelper.findPropConfigByName(p.$.Name);\r\n const modelName = this.namingHelper.getModelPropName(\r\n entityPropConfig?.mappedName || configProp?.mappedName || p.$.Name,\r\n );\r\n const isCollection = !!p.$.Type.match(/^Collection\\(/);\r\n let odataDataType = p.$.Type.replace(/^Collection\\(([^\\)]+)\\)/, \"$1\");\r\n\r\n // support for primitive type mapping\r\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\r\n const dt = this.dataModel.getPrimitiveType(odataDataType);\r\n if (dt !== undefined) {\r\n odataDataType = dt;\r\n }\r\n }\r\n\r\n let result: Pick<PropertyModel, \"dataType\" | \"type\" | \"typeModule\" | \"qPath\" | \"qParam\" | \"qObject\" | \"converters\">;\r\n\r\n // domain object known from service:\r\n // EntityType, ComplexType, EnumType\r\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\r\n const modelType = this.model2Type.get(odataDataType)!;\r\n const [dataTypeName, dataTypePrefix] = this.namingHelper.getNameAndServicePrefix(odataDataType);\r\n const dataTypeNamespace: NamespaceWithAlias = [dataTypePrefix!];\r\n if (!modelType) {\r\n throw new Error(\r\n `Couldn't determine model type (EntityType, ComplexType, etc) for property \"${p.$.Name}\"! Given data type: \"${odataDataType}\".`,\r\n );\r\n }\r\n\r\n // special handling for enums\r\n if (modelType === DataTypes.EnumType) {\r\n const enumConfig = this.serviceConfigHelper.findEnumTypeConfig(dataTypeNamespace, dataTypeName);\r\n result = {\r\n dataType: modelType,\r\n type: this.namingHelper.getEnumName(enumConfig?.mappedName ?? odataDataType),\r\n qPath: this.options.numericEnums ? \"QNumericEnumPath\" : \"QEnumPath\",\r\n qObject: isCollection\r\n ? this.options.numericEnums\r\n ? \"QNumericEnumCollection\"\r\n : \"QEnumCollection\"\r\n : undefined,\r\n qParam: this.options.numericEnums ? \"QNumericEnumParam\" : \"QEnumParam\",\r\n };\r\n }\r\n // handling of complex & entity types\r\n else {\r\n const entityConfig =\r\n modelType === DataTypes.ComplexType\r\n ? this.serviceConfigHelper.findComplexTypeConfig(dataTypeNamespace, dataTypeName)\r\n : this.serviceConfigHelper.findEntityTypeConfig(dataTypeNamespace, dataTypeName);\r\n const typeName = entityConfig?.mappedName ?? odataDataType;\r\n\r\n result = {\r\n dataType: modelType,\r\n type: this.namingHelper.getModelName(typeName),\r\n qPath: \"QEntityPath\",\r\n qObject: this.namingHelper.getQName(typeName),\r\n qParam: \"QComplexParam\",\r\n };\r\n }\r\n }\r\n // OData built-in data types\r\n else if (odataDataType.startsWith(Digester.EDM_PREFIX)) {\r\n const { outputType, qPath, qParam, qCollection } = this.mapODataType(odataDataType);\r\n const { to, toModule: typeModule, converters } = this.dataModel.getConverter(odataDataType) || {};\r\n\r\n const type = !to ? outputType : to.startsWith(Digester.EDM_PREFIX) ? this.mapODataType(to).outputType : to;\r\n\r\n result = {\r\n dataType: DataTypes.PrimitiveType,\r\n type,\r\n typeModule,\r\n qPath,\r\n qParam,\r\n qObject: isCollection ? qCollection : undefined,\r\n converters,\r\n };\r\n } else {\r\n throw new Error(\r\n `Unknown type [${odataDataType}]: Not 'Collection(...)', not OData type 'Edm.*', not starting with one of the namespaces!`,\r\n );\r\n }\r\n\r\n return {\r\n odataName: p.$.Name,\r\n name: modelName,\r\n odataType: p.$.Type,\r\n fqType: odataDataType,\r\n required: ifFalse(p.$.Nullable),\r\n isCollection: isCollection,\r\n managed: typeof entityPropConfig?.managed !== \"undefined\" ? entityPropConfig.managed : configProp?.managed,\r\n ...result,\r\n };\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,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AQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAEzD,YAAY;YACZ,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;;AAtgBgB,mBAAU,GAAG,MAAM,AAAT,CAAU","sourcesContent":["import { MappedConverterChains } from \"@odata2ts/converter-runtime\";\r\nimport type { DigestionOptions } from \"../FactoryFunctionModel.js\";\r\nimport {\r\n ComplexTypeGenerationOptions,\r\n EntityTypeGenerationOptions,\r\n Modes,\r\n PropertyGenerationOptions,\r\n} from \"../OptionModel.js\";\r\nimport { DataModel, NamespaceWithAlias, withNamespace } from \"./DataModel.js\";\r\nimport {\r\n ComplexType as ComplexModelType,\r\n DataTypes,\r\n EntityType as EntityModelType,\r\n ODataVersion,\r\n PropertyModel,\r\n} from \"./DataTypeModel.js\";\r\nimport { ComplexType, EntityType, EnumType, Property, Schema, TypeDefinition } from \"./edmx/ODataEdmxModelBase.js\";\r\nimport { EntityContainerV3, SchemaV3 } from \"./edmx/ODataEdmxModelV3.js\";\r\nimport { EntityContainerV4, SchemaV4 } from \"./edmx/ODataEdmxModelV4.js\";\r\nimport { NamingHelper } from \"./NamingHelper.js\";\r\nimport { ServiceConfigHelper, WithoutName } from \"./ServiceConfigHelper.js\";\r\nimport { NameClashValidator } from \"./validation/NameClashValidator.js\";\r\nimport { NameValidator } from \"./validation/NameValidator.js\";\r\nimport { NoopValidator } from \"./validation/NoopValidator.js\";\r\n\r\ntype CollectorTuple = [\r\n Array<PropertyModel>,\r\n Array<string>,\r\n { fqIdName: string; idName: string; qIdName: string; open: boolean },\r\n];\r\n\r\nfunction ifTrue(value: string | undefined): boolean {\r\n return value === \"true\";\r\n}\r\n\r\nfunction ifFalse(value: string | undefined): boolean {\r\n return value === \"false\";\r\n}\r\n\r\nexport interface TypeModel {\r\n outputType: string;\r\n qPath: string;\r\n qCollection: string;\r\n qParam: string | undefined;\r\n}\r\n\r\nexport abstract class Digester<S extends Schema<ET, CT>, ET extends EntityType, CT extends ComplexType> {\r\n protected static EDM_PREFIX = \"Edm.\";\r\n\r\n protected readonly dataModel: DataModel;\r\n protected readonly serviceConfigHelper: ServiceConfigHelper;\r\n protected readonly nameValidator: NameValidator;\r\n\r\n /**\r\n * Reverse mapping from fqName to data type: EntityType, ComplexType, EnumType, or Primitive Type.\r\n */\r\n private model2Type = new Map<string, DataTypes>();\r\n\r\n protected constructor(\r\n protected version: ODataVersion,\r\n protected schemas: Array<S>,\r\n protected options: DigestionOptions,\r\n protected namingHelper: NamingHelper,\r\n converters?: MappedConverterChains,\r\n ) {\r\n const namespaces = schemas.map<NamespaceWithAlias>((s) => [s.$.Namespace, s.$.Alias]);\r\n this.dataModel = new DataModel(namespaces, version, converters);\r\n this.serviceConfigHelper = new ServiceConfigHelper(options);\r\n this.nameValidator = options.bundledFileGeneration ? new NameClashValidator(options) : new NoopValidator();\r\n\r\n this.collectModelTypes(schemas);\r\n }\r\n\r\n private collectModelTypes(schemas: Array<S>) {\r\n schemas.forEach((schema) => {\r\n const { Namespace: ns, Alias: alias } = schema.$;\r\n\r\n schema.EnumType?.forEach((et) => {\r\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.EnumType);\r\n });\r\n schema.ComplexType?.forEach((ct) => {\r\n this.addModel2Type(ns, alias, ct.$.Name, DataTypes.ComplexType);\r\n });\r\n schema.EntityType?.forEach((et) => {\r\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.ModelType);\r\n });\r\n });\r\n }\r\n\r\n private addModel2Type(ns: string, alias: string | undefined, name: string, dt: DataTypes) {\r\n this.model2Type.set(withNamespace(ns, name), dt);\r\n if (alias) {\r\n this.model2Type.set(withNamespace(alias, name), dt);\r\n }\r\n }\r\n\r\n protected abstract getNavigationProps(entityType: ET | ComplexType): Array<Property>;\r\n\r\n protected abstract digestOperations(schema: SchemaV3 | SchemaV4): void;\r\n\r\n protected abstract digestEntityContainer(schema: SchemaV3 | SchemaV4): void;\r\n\r\n /**\r\n * Get essential infos about a given odata type from the version specific service variants.\r\n *\r\n * @param type\r\n * @return tuple of return type, query object, query collection object\r\n */\r\n protected abstract mapODataType(type: string): TypeModel;\r\n\r\n public async digest(): Promise<DataModel> {\r\n this.digestEntityTypesAndOperations();\r\n\r\n // delegate to version specific entity container digestion\r\n this.schemas.forEach((schema) => this.digestEntityContainer(schema));\r\n\r\n this.dataModel.setNameValidation(this.nameValidator.validate());\r\n return this.dataModel;\r\n }\r\n\r\n private digestEntityTypesAndOperations() {\r\n this.schemas.forEach((schema) => {\r\n const ns: NamespaceWithAlias = [schema.$.Namespace, schema.$.Alias];\r\n\r\n // type definitions: alias for primitive types\r\n this.addTypeDefinition(schema.$.Namespace, schema.TypeDefinition);\r\n\r\n // enums\r\n this.addEnum(ns, schema.EnumType);\r\n\r\n // complex types\r\n this.addComplexType(ns, schema.ComplexType);\r\n\r\n // entity types\r\n this.addEntityType(ns, schema.EntityType);\r\n\r\n // V4 only: function & action types\r\n this.digestOperations(schema);\r\n });\r\n\r\n this.postProcessModel();\r\n this.postProcessKeys();\r\n\r\n this.schemas.forEach((schema) => {\r\n this.analyzeModelUsage(schema.EntityContainer?.length ? schema.EntityContainer[0] : undefined);\r\n });\r\n }\r\n\r\n private getBaseModel(\r\n entityConfig: WithoutName<EntityTypeGenerationOptions | ComplexTypeGenerationOptions> | undefined,\r\n model: ComplexType,\r\n namespace: string,\r\n name: string,\r\n fqName: string,\r\n ) {\r\n const odataName = model.$.Name;\r\n\r\n // map properties respecting the config\r\n const props = [...(model.Property ?? []), ...this.getNavigationProps(model)].map((p) => {\r\n const epConfig = entityConfig?.properties?.find((ep) => ep.name === p.$.Name);\r\n return this.mapProp(p, epConfig);\r\n });\r\n\r\n // support for base types, i.e. extends clause of interfaces\r\n const baseClasses = [];\r\n let finalBaseClass: string | undefined = undefined;\r\n if (model.$.BaseType) {\r\n baseClasses.push(model.$.BaseType);\r\n const [baseName, basePrefix] = this.namingHelper.getNameAndServicePrefix(model.$.BaseType);\r\n const baseConfig =\r\n this.serviceConfigHelper.findEntityTypeConfig([basePrefix!], baseName) ||\r\n this.serviceConfigHelper.findComplexTypeConfig([basePrefix!], baseName);\r\n finalBaseClass = baseConfig?.mappedName ?? baseName;\r\n }\r\n\r\n return {\r\n fqName,\r\n odataName,\r\n name,\r\n modelName: this.namingHelper.getModelName(name),\r\n qName: this.namingHelper.getQName(name),\r\n editableName: this.namingHelper.getEditableModelName(name),\r\n serviceName: this.namingHelper.getServiceName(name),\r\n serviceCollectionName: this.namingHelper.getCollectionServiceName(name),\r\n folderPath: this.namingHelper.getFolderPath(namespace, name),\r\n baseClasses,\r\n finalBaseClass,\r\n props,\r\n baseProps: [], // postprocess required\r\n abstract: ifTrue(model.$.Abstract),\r\n open: ifTrue(model.$.OpenType),\r\n genMode: Modes.qobjects,\r\n subtypes: new Set(),\r\n } satisfies Partial<ComplexModelType>;\r\n }\r\n\r\n private addTypeDefinition(ns: string, types: Array<TypeDefinition> | undefined) {\r\n if (!types || !types.length) {\r\n return;\r\n }\r\n\r\n for (const t of types) {\r\n this.dataModel.addTypeDefinition(ns, t.$.Name, t.$.UnderlyingType);\r\n }\r\n }\r\n\r\n private addEnum(namespace: NamespaceWithAlias, models: Array<EnumType> | undefined) {\r\n if (!models || !models.length) {\r\n return;\r\n }\r\n\r\n for (const et of models) {\r\n const odataName = et.$.Name;\r\n const fqName = withNamespace(namespace[0], odataName);\r\n const config = this.serviceConfigHelper.findEnumTypeConfig(namespace, odataName);\r\n const enumName = this.nameValidator.addEnumType(fqName, config?.mappedName || odataName);\r\n const filePath = this.namingHelper.getFolderPath(namespace[0], enumName);\r\n this.dataModel.addEnum(namespace[0], odataName, {\r\n fqName,\r\n odataName,\r\n name: enumName,\r\n modelName: this.namingHelper.getEnumName(enumName),\r\n folderPath: filePath,\r\n members: et.Member?.length ? et.Member.map((m) => ({ name: m.$.Name, value: m.$.Value })) : [],\r\n });\r\n }\r\n }\r\n\r\n private addComplexType(namespace: NamespaceWithAlias, models: Array<ComplexType> | undefined) {\r\n if (!models || !models.length) {\r\n return;\r\n }\r\n\r\n for (const model of models) {\r\n const config = this.serviceConfigHelper.findComplexTypeConfig(namespace, model.$.Name);\r\n const fqName = withNamespace(namespace[0], model.$.Name);\r\n const name = this.nameValidator.addComplexType(fqName, config?.mappedName || model.$.Name);\r\n const baseModel = this.getBaseModel(config, model, namespace[0], name, fqName);\r\n this.dataModel.addComplexType(namespace[0], baseModel.odataName, baseModel);\r\n }\r\n }\r\n\r\n private addEntityType(namespace: NamespaceWithAlias, models: Array<ET> | undefined) {\r\n if (!models || !models.length) {\r\n return;\r\n }\r\n\r\n for (const model of models) {\r\n const entityConfig = this.serviceConfigHelper.findEntityTypeConfig(namespace, model.$.Name);\r\n const fqName = withNamespace(namespace[0], model.$.Name);\r\n const name = this.nameValidator.addEntityType(fqName, entityConfig?.mappedName || model.$.Name);\r\n const baseModel = this.getBaseModel(entityConfig, model, namespace[0], name, fqName);\r\n\r\n // key support: we add keys from this entity,\r\n // but not keys stemming from base classes (postprocess required)\r\n const keyNames: Array<string> = [];\r\n if (entityConfig?.keys?.length) {\r\n keyNames.push(...entityConfig.keys);\r\n } else {\r\n const entity = model as EntityType;\r\n if (entity.Key && entity.Key.length && entity.Key[0].PropertyRef.length) {\r\n const propNames = entity.Key[0].PropertyRef.map((key) => key.$.Name);\r\n keyNames.push(...propNames);\r\n }\r\n }\r\n\r\n this.dataModel.addEntityType(namespace[0], baseModel.odataName, {\r\n ...baseModel,\r\n id: {\r\n fqName: baseModel.fqName,\r\n modelName: this.namingHelper.getIdModelName(name),\r\n qName: this.namingHelper.getQIdFunctionName(name),\r\n },\r\n generateId: !!keyNames.length,\r\n keyNames: keyNames, // postprocess required to include key specs from base classes\r\n keys: [], // postprocess required to include props from base classes\r\n getKeyUnion: () => keyNames.join(\" | \"),\r\n subtypes: new Set(),\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Check that models (ComplexType or EntityType) have been referenced in the API\r\n * as entry point or via navProp or by virtue of being a base type or subtype of those.\r\n * For these models one or two services are generated.\r\n *\r\n * In this way unnecessary service generation is prevented. For example, complex types that\r\n * are only referenced as response of an operation do not need a generated service.\r\n *\r\n * @param ec\r\n * @private\r\n */\r\n private analyzeModelUsage(ec: EntityContainerV3 | EntityContainerV4 | undefined) {\r\n if (ec?.EntitySet?.length) {\r\n ec.EntitySet.forEach((et) => this.analyze(et.$.EntityType));\r\n }\r\n const ec4 = ec as EntityContainerV4;\r\n if (ec4?.Singleton?.length) {\r\n ec4.Singleton.forEach((singleton) => this.analyze(singleton.$.Type));\r\n }\r\n }\r\n\r\n /**\r\n * Check usage of model types within API.\r\n *\r\n * @param fqModelName\r\n * @private\r\n */\r\n private analyze(fqModelName: string) {\r\n // to also resolve aliases the data model needs to be used\r\n const model = this.dataModel.getEntityType(fqModelName) ?? this.dataModel.getComplexType(fqModelName);\r\n if (!model?.fqName || model.genMode === Modes.service) {\r\n return;\r\n }\r\n\r\n model.genMode = Modes.service;\r\n\r\n if (model) {\r\n // respect base classes\r\n if (model.baseClasses.length) {\r\n this.analyze(model.baseClasses[0]);\r\n }\r\n // include subtypes since each base class can be cast to its subtypes\r\n model.subtypes.forEach((subtype) => {\r\n this.analyze(subtype);\r\n });\r\n model?.props.forEach((p) => {\r\n if (p.dataType === DataTypes.ComplexType || p.dataType === DataTypes.ModelType) {\r\n this.analyze(p.fqType);\r\n }\r\n });\r\n }\r\n }\r\n\r\n private postProcessModel() {\r\n // complex types\r\n const complexTypes = this.dataModel.getComplexTypes();\r\n complexTypes.forEach((ct) => {\r\n // build up set of subtypes for each complex type\r\n this.addSubtypes(ct);\r\n\r\n // get props & keys from base types\r\n const [baseProps, _, baseAttributes] = this.collectBaseClassPropsAndKeys(ct, []);\r\n const { open } = baseAttributes;\r\n ct.baseProps = baseProps.map((bp) => ({ ...bp }));\r\n if (open) {\r\n ct.open = true;\r\n }\r\n });\r\n // entity types\r\n const entityTypes = this.dataModel.getEntityTypes();\r\n entityTypes.forEach((et) => {\r\n // build up set of subtypes for each entity type\r\n this.addSubtypes(et);\r\n\r\n // get props & keys from base types\r\n const [baseProps, baseKeys, baseAttributes] = this.collectBaseClassPropsAndKeys(et, []);\r\n const { fqIdName, idName, qIdName, open } = baseAttributes;\r\n et.baseProps = baseProps.map((bp) => ({ ...bp }));\r\n\r\n if (!et.keyNames.length && idName) {\r\n et.id = {\r\n fqName: fqIdName,\r\n modelName: idName,\r\n qName: qIdName,\r\n };\r\n et.generateId = false;\r\n }\r\n if (open) {\r\n et.open = open;\r\n }\r\n et.keyNames.unshift(...baseKeys.filter((bk) => !et.keyNames.includes(bk)));\r\n });\r\n }\r\n\r\n private postProcessKeys() {\r\n const entityTypes = this.dataModel.getEntityTypes();\r\n entityTypes.forEach((et) => {\r\n const isSingleKey = et.keyNames.length === 1;\r\n const props = [...et.baseProps, ...et.props];\r\n et.keys = et.keyNames.map((keyName) => {\r\n const prop = props.find((p) => p.odataName === keyName);\r\n if (!prop) {\r\n throw new Error(`Key with name [${keyName}] not found in props!`);\r\n }\r\n\r\n // automatically set key prop to managed, if this is the only key of the given entity\r\n if (prop.managed === undefined) {\r\n prop.managed = !this.options.disableAutoManagedKey && isSingleKey;\r\n }\r\n\r\n return prop;\r\n });\r\n });\r\n }\r\n\r\n private collectBaseClassPropsAndKeys(model: ComplexModelType, visitedModels: string[]): CollectorTuple {\r\n if (visitedModels.includes(model.fqName)) {\r\n throw new Error(`Cyclic inheritance detected for model ${model.fqName}!`);\r\n }\r\n visitedModels.push(model.fqName);\r\n return model.baseClasses.reduce(\r\n ([props, keys, attributes], bc) => {\r\n const baseModel = this.dataModel.getEntityType(bc) || this.dataModel.getComplexType(bc);\r\n if (!baseModel) {\r\n throw new Error(`BaseModel \"${bc}\" doesn't exist!`);\r\n }\r\n\r\n let { fqIdName, idName, qIdName, open } = attributes;\r\n\r\n // recursive\r\n if (baseModel.baseClasses.length) {\r\n const [parentProps, parentKeys, parentAttributes] = this.collectBaseClassPropsAndKeys(\r\n baseModel,\r\n visitedModels,\r\n );\r\n props.unshift(...parentProps);\r\n keys.unshift(...parentKeys);\r\n if (parentAttributes?.idName) {\r\n fqIdName = parentAttributes.fqIdName;\r\n idName = parentAttributes.idName;\r\n qIdName = parentAttributes.qIdName;\r\n }\r\n if (parentAttributes?.open) {\r\n open = true;\r\n }\r\n }\r\n\r\n props.push(...baseModel.props);\r\n const entityModel = baseModel as EntityModelType;\r\n if (entityModel.keyNames?.length) {\r\n keys.push(...entityModel.keyNames.filter((kn) => !keys.includes(kn)));\r\n fqIdName = entityModel.id.fqName;\r\n idName = entityModel.id.modelName;\r\n qIdName = entityModel.id.qName;\r\n }\r\n if (baseModel.open) {\r\n open = true;\r\n }\r\n return [props, keys, { fqIdName, idName, qIdName, open }];\r\n },\r\n [[], [], { fqIdName: \"\", idName: \"\", qIdName: \"\", open: false }] as CollectorTuple,\r\n );\r\n }\r\n\r\n protected mapProp = (p: Property, entityPropConfig?: PropertyGenerationOptions | undefined): PropertyModel => {\r\n if (!p.$.Type) {\r\n throw new Error(`No type information given for property [${p.$.Name}]!`);\r\n }\r\n\r\n const configProp = this.serviceConfigHelper.findPropConfigByName(p.$.Name);\r\n const modelName = this.namingHelper.getModelPropName(\r\n entityPropConfig?.mappedName || configProp?.mappedName || p.$.Name,\r\n );\r\n const isCollection = !!p.$.Type.match(/^Collection\\(/);\r\n let odataDataType = p.$.Type.replace(/^Collection\\(([^\\)]+)\\)/, \"$1\");\r\n\r\n // support for primitive type mapping\r\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\r\n const dt = this.dataModel.getPrimitiveType(odataDataType);\r\n if (dt !== undefined) {\r\n odataDataType = dt;\r\n }\r\n }\r\n\r\n let result: Pick<PropertyModel, \"dataType\" | \"type\" | \"typeModule\" | \"qPath\" | \"qParam\" | \"qObject\" | \"converters\">;\r\n\r\n // domain object known from service:\r\n // EntityType, ComplexType, EnumType\r\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\r\n const modelType = this.model2Type.get(odataDataType)!;\r\n const [dataTypeName, dataTypePrefix] = this.namingHelper.getNameAndServicePrefix(odataDataType);\r\n const dataTypeNamespace: NamespaceWithAlias = [dataTypePrefix!];\r\n if (!modelType) {\r\n throw new Error(\r\n `Couldn't determine model type (EntityType, ComplexType, etc) for property \"${p.$.Name}\"! Given data type: \"${odataDataType}\".`,\r\n );\r\n }\r\n\r\n // special handling for enums\r\n if (modelType === DataTypes.EnumType) {\r\n const enumConfig = this.serviceConfigHelper.findEnumTypeConfig(dataTypeNamespace, dataTypeName);\r\n result = {\r\n dataType: modelType,\r\n type: this.namingHelper.getEnumName(enumConfig?.mappedName ?? odataDataType),\r\n qPath: this.options.numericEnums ? \"QNumericEnumPath\" : \"QEnumPath\",\r\n qObject: isCollection\r\n ? this.options.numericEnums\r\n ? \"QNumericEnumCollection\"\r\n : \"QEnumCollection\"\r\n : undefined,\r\n qParam: this.options.numericEnums ? \"QNumericEnumParam\" : \"QEnumParam\",\r\n };\r\n }\r\n // handling of complex & entity types\r\n else {\r\n const entityConfig =\r\n modelType === DataTypes.ComplexType\r\n ? this.serviceConfigHelper.findComplexTypeConfig(dataTypeNamespace, dataTypeName)\r\n : this.serviceConfigHelper.findEntityTypeConfig(dataTypeNamespace, dataTypeName);\r\n const typeName = entityConfig?.mappedName ?? odataDataType;\r\n\r\n result = {\r\n dataType: modelType,\r\n type: this.namingHelper.getModelName(typeName),\r\n qPath: \"QEntityPath\",\r\n qObject: this.namingHelper.getQName(typeName),\r\n qParam: \"QComplexParam\",\r\n };\r\n }\r\n }\r\n // OData built-in data types\r\n else if (odataDataType.startsWith(Digester.EDM_PREFIX)) {\r\n const { outputType, qPath, qParam, qCollection } = this.mapODataType(odataDataType);\r\n const { to, toModule: typeModule, converters } = this.dataModel.getConverter(odataDataType) || {};\r\n\r\n const type = !to ? outputType : to.startsWith(Digester.EDM_PREFIX) ? this.mapODataType(to).outputType : to;\r\n\r\n result = {\r\n dataType: DataTypes.PrimitiveType,\r\n type,\r\n typeModule,\r\n qPath,\r\n qParam,\r\n qObject: isCollection ? qCollection : undefined,\r\n converters,\r\n };\r\n } else {\r\n throw new Error(\r\n `Unknown type [${odataDataType}]: Not 'Collection(...)', not OData type 'Edm.*', not starting with one of the namespaces!`,\r\n );\r\n }\r\n\r\n return {\r\n odataName: p.$.Name,\r\n name: modelName,\r\n odataType: p.$.Type,\r\n fqType: odataDataType,\r\n required: ifFalse(p.$.Nullable),\r\n isCollection: isCollection,\r\n managed: typeof entityPropConfig?.managed !== \"undefined\" ? entityPropConfig.managed : configProp?.managed,\r\n ...result,\r\n };\r\n };\r\n\r\n private addSubtypes(model: ComplexModelType, grandChildren = new Set<string>()) {\r\n if (!model.baseClasses.length) {\r\n return;\r\n }\r\n\r\n model.baseClasses.forEach((baseClass) => {\r\n const baseType = this.dataModel.getModel(baseClass) as ComplexModelType;\r\n\r\n // add subtypes & base name for q-objects\r\n baseType.subtypes.add(model.fqName);\r\n if (!baseType.qBaseName) {\r\n baseType.qBaseName = this.namingHelper.getQBaseName(baseType.name);\r\n }\r\n grandChildren.forEach((gc) => baseType.subtypes.add(gc));\r\n\r\n // recursive\r\n grandChildren.add(model.fqName);\r\n this.addSubtypes(baseType, grandChildren);\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -50,6 +50,7 @@ export interface ComplexType {
|
|
|
50
50
|
modelName: string;
|
|
51
51
|
editableName: string;
|
|
52
52
|
qName: string;
|
|
53
|
+
qBaseName?: string;
|
|
53
54
|
serviceName: string;
|
|
54
55
|
serviceCollectionName: string;
|
|
55
56
|
folderPath: string;
|
|
@@ -60,6 +61,7 @@ export interface ComplexType {
|
|
|
60
61
|
abstract: boolean;
|
|
61
62
|
open: boolean;
|
|
62
63
|
genMode: Modes;
|
|
64
|
+
subtypes: Set<string>;
|
|
63
65
|
}
|
|
64
66
|
export interface EnumType {
|
|
65
67
|
dataType: DataTypes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTypeModel.js","sourceRoot":"","sources":["../../src/data-model/DataTypeModel.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,0BAAU,CAAA;IACV,0BAAU,CAAA;AACZ,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import { ValueConverterImport } from \"@odata2ts/converter-runtime\";\r\nimport { Modes } from \"../OptionModel.js\";\r\n\r\nexport enum ODataVersion {\r\n V2 = \"2.0\",\r\n V4 = \"4.0\",\r\n}\r\n\r\nexport const enum DataTypes {\r\n PrimitiveType = \"PrimitiveType\",\r\n EnumType = \"EnumType\",\r\n ComplexType = \"ComplexType\",\r\n ModelType = \"ModelType\",\r\n}\r\n\r\nexport const enum OperationTypes {\r\n Function = \"Function\",\r\n Action = \"Action\",\r\n}\r\n\r\nexport interface PropertyModel {\r\n odataName: string;\r\n name: string;\r\n odataType: string;\r\n fqType: string;\r\n type: string;\r\n typeModule?: string;\r\n qObject?: string;\r\n qPath: string;\r\n qParam?: string;\r\n required: boolean;\r\n isCollection: boolean;\r\n dataType: DataTypes;\r\n converters?: Array<ValueConverterImport>;\r\n managed?: boolean;\r\n}\r\n\r\nexport type ModelType = EntityType | ComplexType | EnumType;\r\n\r\nexport interface EntityType extends ComplexType {\r\n id: {\r\n // fully qualified name of entity to which this id belongs (might have been inherited)\r\n fqName: string;\r\n // that's the name of the param model for the id function\r\n modelName: string;\r\n // that's the name of the id function which is a q-object\r\n qName: string;\r\n };\r\n generateId: boolean;\r\n keyNames: Array<string>;\r\n keys: Array<PropertyModel>;\r\n getKeyUnion(): string;\r\n}\r\n\r\nexport interface ComplexType {\r\n dataType: DataTypes;\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n modelName: string;\r\n editableName: string;\r\n qName: string;\r\n serviceName: string;\r\n serviceCollectionName: string;\r\n folderPath: string;\r\n props: Array<PropertyModel>;\r\n baseProps: Array<PropertyModel>;\r\n baseClasses: Array<string>;\r\n finalBaseClass: string | undefined;\r\n abstract: boolean;\r\n open: boolean;\r\n genMode: Modes;\r\n}\r\n\r\nexport interface EnumType {\r\n dataType: DataTypes;\r\n odataName: string;\r\n fqName: string;\r\n name: string;\r\n modelName: string;\r\n folderPath: string;\r\n members: Array<{ name: string; value: number }>;\r\n}\r\n\r\nexport interface OperationType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n qName: string;\r\n paramsModelName: string;\r\n type: OperationTypes;\r\n parameters: Array<PropertyModel>;\r\n returnType?: ReturnTypeModel;\r\n usePost?: boolean;\r\n overrides?: Array<Array<PropertyModel>>;\r\n}\r\n\r\nexport interface ReturnTypeModel extends PropertyModel {}\r\n\r\nexport type EntityContainerModel = {\r\n entitySets: { [name: string]: EntitySetType };\r\n singletons: { [name: string]: SingletonType };\r\n functions: { [name: string]: FunctionImportType };\r\n actions: { [name: string]: ActionImportType };\r\n};\r\n\r\nexport interface SingletonType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n entityType: EntityType;\r\n navPropBinding?: Array<NavPropBindingType>;\r\n}\r\n\r\nexport interface EntitySetType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n entityType: EntityType;\r\n navPropBinding?: Array<NavPropBindingType>;\r\n}\r\n\r\nexport interface NavPropBindingType {\r\n path: string;\r\n target: string;\r\n}\r\n\r\nexport interface ActionImportType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n operation: string;\r\n}\r\n\r\nexport interface FunctionImportType extends ActionImportType {\r\n entitySet: string;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"DataTypeModel.js","sourceRoot":"","sources":["../../src/data-model/DataTypeModel.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,0BAAU,CAAA;IACV,0BAAU,CAAA;AACZ,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import { ValueConverterImport } from \"@odata2ts/converter-runtime\";\r\nimport { Modes } from \"../OptionModel.js\";\r\n\r\nexport enum ODataVersion {\r\n V2 = \"2.0\",\r\n V4 = \"4.0\",\r\n}\r\n\r\nexport const enum DataTypes {\r\n PrimitiveType = \"PrimitiveType\",\r\n EnumType = \"EnumType\",\r\n ComplexType = \"ComplexType\",\r\n ModelType = \"ModelType\",\r\n}\r\n\r\nexport const enum OperationTypes {\r\n Function = \"Function\",\r\n Action = \"Action\",\r\n}\r\n\r\nexport interface PropertyModel {\r\n odataName: string;\r\n name: string;\r\n odataType: string;\r\n fqType: string;\r\n type: string;\r\n typeModule?: string;\r\n qObject?: string;\r\n qPath: string;\r\n qParam?: string;\r\n required: boolean;\r\n isCollection: boolean;\r\n dataType: DataTypes;\r\n converters?: Array<ValueConverterImport>;\r\n managed?: boolean;\r\n}\r\n\r\nexport type ModelType = EntityType | ComplexType | EnumType;\r\n\r\nexport interface EntityType extends ComplexType {\r\n id: {\r\n // fully qualified name of entity to which this id belongs (might have been inherited)\r\n fqName: string;\r\n // that's the name of the param model for the id function\r\n modelName: string;\r\n // that's the name of the id function which is a q-object\r\n qName: string;\r\n };\r\n generateId: boolean;\r\n keyNames: Array<string>;\r\n keys: Array<PropertyModel>;\r\n getKeyUnion(): string;\r\n}\r\n\r\nexport interface ComplexType {\r\n dataType: DataTypes;\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n modelName: string;\r\n editableName: string;\r\n qName: string;\r\n qBaseName?: string;\r\n serviceName: string;\r\n serviceCollectionName: string;\r\n folderPath: string;\r\n props: Array<PropertyModel>;\r\n baseProps: Array<PropertyModel>;\r\n baseClasses: Array<string>;\r\n finalBaseClass: string | undefined;\r\n abstract: boolean;\r\n open: boolean;\r\n genMode: Modes;\r\n subtypes: Set<string>;\r\n}\r\n\r\nexport interface EnumType {\r\n dataType: DataTypes;\r\n odataName: string;\r\n fqName: string;\r\n name: string;\r\n modelName: string;\r\n folderPath: string;\r\n members: Array<{ name: string; value: number }>;\r\n}\r\n\r\nexport interface OperationType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n qName: string;\r\n paramsModelName: string;\r\n type: OperationTypes;\r\n parameters: Array<PropertyModel>;\r\n returnType?: ReturnTypeModel;\r\n usePost?: boolean;\r\n overrides?: Array<Array<PropertyModel>>;\r\n}\r\n\r\nexport interface ReturnTypeModel extends PropertyModel {}\r\n\r\nexport type EntityContainerModel = {\r\n entitySets: { [name: string]: EntitySetType };\r\n singletons: { [name: string]: SingletonType };\r\n functions: { [name: string]: FunctionImportType };\r\n actions: { [name: string]: ActionImportType };\r\n};\r\n\r\nexport interface SingletonType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n entityType: EntityType;\r\n navPropBinding?: Array<NavPropBindingType>;\r\n}\r\n\r\nexport interface EntitySetType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n entityType: EntityType;\r\n navPropBinding?: Array<NavPropBindingType>;\r\n}\r\n\r\nexport interface NavPropBindingType {\r\n path: string;\r\n target: string;\r\n}\r\n\r\nexport interface ActionImportType {\r\n fqName: string;\r\n odataName: string;\r\n name: string;\r\n operation: string;\r\n}\r\n\r\nexport interface FunctionImportType extends ActionImportType {\r\n entitySet: string;\r\n}\r\n"]}
|
|
@@ -43,6 +43,7 @@ export declare class NamingHelper {
|
|
|
43
43
|
getIdModelName(name: string): string;
|
|
44
44
|
getOperationParamsModelName(operationName: string, boundEntity?: string): string;
|
|
45
45
|
getQName(name: string): string;
|
|
46
|
+
getQBaseName(name: string): string;
|
|
46
47
|
getQPropName(name: string): string;
|
|
47
48
|
getQIdFunctionName(name: string): string;
|
|
48
49
|
getQFunctionName(operationName: string, boundEntity?: string): string;
|
|
@@ -184,6 +184,12 @@ export class NamingHelper {
|
|
|
184
184
|
getQName(name) {
|
|
185
185
|
return this.getName(name, this.getQObjectNamingStrategy(), this.options.queryObjects);
|
|
186
186
|
}
|
|
187
|
+
getQBaseName(name) {
|
|
188
|
+
const opts = this.options.queryObjects;
|
|
189
|
+
const strategy = this.getQObjectNamingStrategy();
|
|
190
|
+
const result = this.getName(name, strategy, opts.baseType);
|
|
191
|
+
return opts.baseType.applyQNaming ? this.getName(result, strategy, opts) : result;
|
|
192
|
+
}
|
|
187
193
|
getQPropName(name) {
|
|
188
194
|
return this.getName(name, this.getQObjectPropNamingStrategy());
|
|
189
195
|
}
|