@odata2ts/odata2ts 0.37.0 → 0.38.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 +13 -0
- package/lib/FactoryFunctionModel.d.ts +2 -2
- package/lib/FactoryFunctionModel.js.map +1 -1
- package/lib/OptionModel.d.ts +5 -0
- package/lib/OptionModel.js.map +1 -1
- package/lib/data-model/DataModelDigestion.js +9 -5
- package/lib/data-model/DataModelDigestion.js.map +1 -1
- package/lib/data-model/DataModelDigestionV4.js +2 -2
- package/lib/data-model/DataModelDigestionV4.js.map +1 -1
- package/lib/data-model/DataTypeModel.d.ts +4 -1
- package/lib/data-model/DataTypeModel.js.map +1 -1
- package/lib/data-model/validation/NameClashValidator.d.ts +3 -2
- package/lib/data-model/validation/NameClashValidator.js +6 -4
- package/lib/data-model/validation/NameClashValidator.js.map +1 -1
- package/lib/data-model/validation/NameValidator.d.ts +4 -3
- package/lib/data-model/validation/NameValidator.js.map +1 -1
- package/lib/data-model/validation/NoopValidator.d.ts +3 -2
- package/lib/data-model/validation/NoopValidator.js +4 -4
- package/lib/data-model/validation/NoopValidator.js.map +1 -1
- package/lib/defaultConfig.js +1 -0
- package/lib/defaultConfig.js.map +1 -1
- package/lib/generator/ImportContainer.d.ts +1 -1
- package/lib/generator/ImportContainer.js +23 -5
- package/lib/generator/ImportContainer.js.map +1 -1
- package/lib/generator/ModelGenerator.js +5 -1
- package/lib/generator/ModelGenerator.js.map +1 -1
- package/lib/generator/QueryObjectGenerator.js +17 -3
- package/lib/generator/QueryObjectGenerator.js.map +1 -1
- package/lib/generator/ServiceGenerator.d.ts +1 -1
- package/lib/generator/ServiceGenerator.js +13 -12
- package/lib/generator/ServiceGenerator.js.map +1 -1
- package/lib/generator/import/ImportObjects.d.ts +3 -1
- package/lib/generator/import/ImportObjects.js +3 -1
- package/lib/generator/import/ImportObjects.js.map +1 -1
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.38.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.37.0...@odata2ts/odata2ts@0.38.0) (2024-09-11)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* auto name clash resolution for v4 actions ([#315](https://github.com/odata2ts/odata2ts/issues/315)) ([3366843](https://github.com/odata2ts/odata2ts/commit/3366843dc227f9c8edd5b4660d63c564cc82f121))
|
|
11
|
+
* **generator:** add rimraf as dependency ([9f08ccd](https://github.com/odata2ts/odata2ts/commit/9f08ccd5fc68b1de381ea1cb711c6e667ca5be98))
|
|
12
|
+
* **generator:** use typeof when using enums as types ([baf784f](https://github.com/odata2ts/odata2ts/commit/baf784f76f119c2394ba4f1c3cd93359dc31171e))
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* compile src & test folders as sanity check ([12607f0](https://github.com/odata2ts/odata2ts/commit/12607f04a4ec1142d750318cab5964f3d9a513c4))
|
|
17
|
+
* **generator:** allow for numeric enums ([#308](https://github.com/odata2ts/odata2ts/issues/308)) ([a5c36e6](https://github.com/odata2ts/odata2ts/commit/a5c36e6433bb5d793d5f970b12d6ebb8a4c5270d))
|
|
18
|
+
|
|
6
19
|
# [0.37.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.36.3...@odata2ts/odata2ts@0.37.0) (2024-08-25)
|
|
7
20
|
|
|
8
21
|
### Code Refactoring
|
|
@@ -4,10 +4,10 @@ import { Schema } from "./data-model/edmx/ODataEdmxModelBase.js";
|
|
|
4
4
|
import { NamingHelper } from "./data-model/NamingHelper.js";
|
|
5
5
|
import { RunOptions } from "./OptionModel.js";
|
|
6
6
|
import { ProjectManager } from "./project/ProjectManager.js";
|
|
7
|
-
export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "byTypeAndName" | "v2ModelsWithExtraResultsWrapping" | "v4BigNumberAsString" | "skipEditableModels" | "skipComments" | "disableAutomaticNameClashResolution" | "bundledFileGeneration">;
|
|
7
|
+
export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "byTypeAndName" | "v2ModelsWithExtraResultsWrapping" | "v4BigNumberAsString" | "skipEditableModels" | "skipComments" | "disableAutomaticNameClashResolution" | "bundledFileGeneration" | "numericEnums">;
|
|
8
8
|
/**
|
|
9
9
|
* Takes an EdmxSchema plus the run options and creates a DataModel.
|
|
10
10
|
*/
|
|
11
11
|
export type DigesterFunction<S extends Schema<any, any>> = (schema: Array<S>, options: DigestionOptions, namingHelper: NamingHelper) => Promise<DataModel>;
|
|
12
|
-
export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "skipComments" | "v2ModelsWithExtraResultsWrapping">;
|
|
12
|
+
export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "skipComments" | "v2ModelsWithExtraResultsWrapping" | "numericEnums">;
|
|
13
13
|
export type EntityBasedGeneratorFunction = (project: ProjectManager, dataModel: DataModel, version: ODataVersions, options: GeneratorFunctionOptions, namingHelper: NamingHelper) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\
|
|
1
|
+
{"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { DataModel } from \"./data-model/DataModel.js\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase.js\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper.js\";\r\nimport { RunOptions } from \"./OptionModel.js\";\r\nimport { ProjectManager } from \"./project/ProjectManager.js\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n | \"converters\"\r\n | \"disableAutoManagedKey\"\r\n | \"propertiesByName\"\r\n | \"byTypeAndName\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"v4BigNumberAsString\"\r\n | \"skipEditableModels\"\r\n | \"skipComments\"\r\n | \"disableAutomaticNameClashResolution\"\r\n | \"bundledFileGeneration\"\r\n | \"numericEnums\"\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: Array<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\"\r\n | \"skipIdModels\"\r\n | \"skipOperations\"\r\n | \"skipComments\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"numericEnums\"\r\n>;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n project: ProjectManager,\r\n dataModel: DataModel,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper,\r\n) => Promise<void>;\r\n"]}
|
package/lib/OptionModel.d.ts
CHANGED
|
@@ -253,6 +253,11 @@ export interface ConfigFileOptions extends Omit<CliOptions, "sourceUrl" | "sourc
|
|
|
253
253
|
* To enable this behaviour set this option to true.
|
|
254
254
|
*/
|
|
255
255
|
bundledFileGeneration?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* If enabled, odata2ts will generate numeric enums instead of string enums.
|
|
258
|
+
* This
|
|
259
|
+
*/
|
|
260
|
+
numericEnums?: boolean;
|
|
256
261
|
}
|
|
257
262
|
/**
|
|
258
263
|
* Custom generation options which are dependent on a specific odata service.
|
package/lib/OptionModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAN,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,KAAL,KAAK,QAKhB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\nimport { AxiosRequestConfig } from \"axios\";\r\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel.js\";\r\nimport { TypeModel } from \"./TypeModel.js\";\r\n\r\n/**\r\n * Generation mode, by default \"all\".\r\n */\r\nexport enum Modes {\r\n models,\r\n qobjects,\r\n service,\r\n all,\r\n}\r\n\r\n/**\r\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\r\n */\r\nexport enum EmitModes {\r\n ts = \"ts\",\r\n js = \"js\",\r\n dts = \"dts\",\r\n js_dts = \"js_dts\",\r\n}\r\n\r\n/**\r\n * Config options for CLI.\r\n */\r\nexport interface CliOptions {\r\n /**\r\n * The URL to the root of your OData service. The URL might end in a slash or not, it might also end\r\n * in $metadata, but we usually add this for you.\r\n *\r\n * Specifying the URL is a convenience feature to download the metadata file from the given URL.\r\n * You can configure this request via `sourceConfig` option.\r\n *\r\n * The `source` option must still be specified as it is used to store the downloaded file on your disk.\r\n * By default, the file is used once it has been downloaded.\r\n */\r\n sourceUrl?: string;\r\n /**\r\n * Downloads the metadata file and overwrites the existing one, if any.\r\n *\r\n * Only takes effect, if option `sourceUrl` is specified.\r\n */\r\n refreshFile?: boolean;\r\n /**\r\n * The source is the file to use (must be an EDMX compliant XML file) or the URL to the\r\n * metadata (ROOT_SERVICE/$metadata).\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffixing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Configuration options of the request to retrieve the metadata.\r\n * Only takes effect if `source` is a URL.\r\n */\r\nexport interface UrlSourceConfiguration {\r\n /**\r\n * Basic auth credentials: the username.\r\n * Only takes effect if `password` has also been set.\r\n */\r\n username?: string;\r\n /**\r\n * Basic auth credentials: the password.\r\n * Only takes effect if `username` has also been set.\r\n */\r\n password?: string;\r\n /**\r\n * Custom request configuration.\r\n * URL and method `GET` are set by default, but can be overwritten.\r\n */\r\n custom?: AxiosRequestConfig;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"sourceUrl\" | \"source\" | \"output\" | \"services\"> {\r\n /**\r\n * Configuration options of the request to retrieve the metadata.\r\n * Only takes effect if `sourceUrl` is a URL.\r\n */\r\n sourceUrlConfig?: UrlSourceConfiguration;\r\n\r\n /**\r\n * Configuration of each service.\r\n *\r\n * @example { services: { trippin: { source: \"...\", ... } }}\r\n */\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n /**\r\n * Model properties have explaining comments by default.\r\n * With this option you can turn that off.\r\n */\r\n skipComments?: boolean;\r\n /**\r\n * With OData you can read, update and delete data on a primitive property (`Edm.*`).\r\n * Usually, you wouldn't do that, but go for a bigger request, fetching more relevant information in one go.\r\n *\r\n * There's one exception: Handling `Edm.Stream´ properties and Media entities. Services for stream / media\r\n * stuff are generated regardless of this setting.\r\n */\r\n enablePrimitivePropertyServices?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n\r\n /**\r\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\r\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\r\n * an object with the property \"results\" is wrapped around the entity collection.\r\n *\r\n * If you're using the odata client then there's a build-in workaround in place which transforms\r\n * the results to remove this extra mapping. However, if you're only interested in the types, then\r\n * the generated models will not match that extra wrapping.\r\n *\r\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\r\n * wrapping to the generated models. But this option is only valid if the generation mode is set\r\n * to <code>models</code>; it is ignored otherwise.\r\n */\r\n v2ModelsWithExtraResultsWrapping?: boolean;\r\n /**\r\n * Numbers of type `Edm.Int64` and `Edm.Decimal` are represented as `number` in V4.\r\n * However, these numbers might not fit into JS' number type, which might result in precision loss.\r\n *\r\n * OData offers a special IEEE754 format option to get those types as `string` instead to prevent any\r\n * precision loss. So if you're handling very large or very small numbers (JS roughly supports 15 digits),\r\n * then you should use this option and, probably, also an appropriate converter (see available converters).\r\n *\r\n * Activating this option affects the type generation and will use `string` for both mentioned types.\r\n * All requests are executed with the \"accept\" header set to \"application/json;IEEE754Compatible=true\".\r\n * Additionally, when sending data the very same value will be set for the \"content-type\" header.\r\n */\r\n v4BigNumberAsString?: boolean;\r\n /**\r\n * OData allows for namespaces so any entity is unique by virtue of it's name within a namespace.\r\n * odata2ts works with these fully qualified names internally, but only uses the plain name when generating\r\n * stuff. This might lead to name clashes (same name in different namespaces).\r\n *\r\n * odata2ts employs a simple, automatic resolution strategy: Adding a counter at the end of the name.\r\n * Set this property to true in order to disable this automatism.\r\n */\r\n disableAutomaticNameClashResolution?: boolean;\r\n /**\r\n * By default, odata2ts generates a folder structure with individual files per entity.\r\n * This allows for handling and scaling the generation process for large data structures.\r\n *\r\n * However, especially UI5 has problems with recursive structures, which are absolutely valid within\r\n * OData. Here the solution is to generate only one file per type to circumvent cyclic imports.\r\n * To enable this behaviour set this option to true.\r\n */\r\n bundledFileGeneration?: boolean;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Pick<CliOptions, \"sourceUrl\" | \"refreshFile\">,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for individual properties based on their name.\r\n */\r\n propertiesByName?: Array<PropertyGenerationOptions>;\r\n /**\r\n * Rename any EntityType, ComplexType, EnumType, Function or Action.\r\n *\r\n * You must match the simple name (e.g. \"Person\") or the fully qualified name\r\n * (e.g. \"Trippin.Person\") exactly. Alternatively, you can rename a bunch of types\r\n * by using regular expressions.\r\n *\r\n * By providing additional type information via the \"type\" attribute you get even more options which only apply\r\n * to the given type.\r\n */\r\n byTypeAndName?: Array<ComplexTypeGenerationOptions | EntityTypeGenerationOptions | GenericTypeGenerationOptions>;\r\n}\r\n\r\n/**\r\n * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions\r\n extends Required<Omit<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\">>,\r\n Pick<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\"> {\r\n naming: NameSettings;\r\n}\r\n\r\nexport interface RenameOptions {\r\n /**\r\n * Matcher for the name of any EntityType, ComplexType, EnumType, Function or Action\r\n * as it is stated in the EDMX model, e.g. \"Person\". As OData supports namespaces\r\n * you can also use the fully qualified name (including the namespace) to address any model,\r\n * e.g. \"Trippin.Person\". You can also match properties by their name.\r\n *\r\n * If the name is specified as plain string, it must match either the name or the fully qualified name\r\n * exactly (case-sensitive).\r\n *\r\n * Alternatively, a regular expression can be used which is always applied to the fully qualified name\r\n * (e.g. Trippin.Person). The regular expression must match the whole string\r\n * (e.g. `/Person/` won't do, `/.*\\.Person/` would work).\r\n *\r\n * To make regular expressions useful, captured groups are also supported in combination with\r\n * the `mappedName` attribute.\r\n */\r\n name: string | RegExp;\r\n\r\n /**\r\n * If specified, this attribute value is used as final name for the matched name as it will\r\n * appear in the generated typescript.\r\n *\r\n * When using a regular expression for matching the name, then captured groups can be referenced\r\n * as usual via $1, $2, etc. For example:\r\n * - name: /Trippin\\.(.+)/\r\n * - mappedName: \"T_$1\"\r\n * The result would be \"T_Person\".\r\n */\r\n mappedName?: string;\r\n}\r\n\r\nexport type TypeBasedGenerationOptions =\r\n | GenericTypeGenerationOptions\r\n | ComplexTypeGenerationOptions\r\n | EntityTypeGenerationOptions;\r\n\r\nexport interface GenericTypeGenerationOptions extends RenameOptions {\r\n type:\r\n | TypeModel.Any\r\n | TypeModel.EnumType\r\n | TypeModel.OperationType\r\n | TypeModel.OperationImportType\r\n | TypeModel.Singleton\r\n | TypeModel.EntitySet;\r\n}\r\n\r\nexport interface ComplexTypeGenerationOptions extends RenameOptions {\r\n type: TypeModel.ComplexType;\r\n\r\n /**\r\n * Configuration of individual properties.\r\n */\r\n properties?: Array<PropertyGenerationOptions>;\r\n\r\n // converter: string | Array<string>\r\n}\r\n\r\n/**\r\n * Configuration options for EntityTypes and ComplexTypes.\r\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\r\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\r\n */\r\nexport interface EntityTypeGenerationOptions extends Omit<ComplexTypeGenerationOptions, \"type\"> {\r\n type: TypeModel.EntityType;\r\n\r\n /**\r\n * Overwrite the key specification by naming the props by their EDMX name.\r\n */\r\n keys?: Array<string>;\r\n\r\n /**\r\n * Whether the generated service should allow for querying this model.\r\n * True by default.\r\n */\r\n // queryable?: boolean;\r\n /**\r\n * Whether the generated service should allow for creating new models (POST).\r\n * True by default.\r\n */\r\n // creatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for updates (PUT).\r\n * True by default.\r\n */\r\n // updatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for partial updates (PATCH).\r\n * True by default.\r\n */\r\n // patchable?: boolean;\r\n /**\r\n * Whether the generated service should allow for deletion.\r\n * True by default.\r\n */\r\n // deletable?: boolean;\r\n}\r\n\r\n/**\r\n * All configuration options for properties of models.\r\n */\r\nexport interface PropertyGenerationOptions extends RenameOptions {\r\n /**\r\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\r\n * Hence, they are left out of the editable model versions.\r\n */\r\n managed?: boolean;\r\n\r\n /**\r\n * TODO\r\n *\r\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\r\n * as well it's i\r\n * and their ids, e.g. \"timeToDurationConverter\".\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n // converters?: Array<Required<TypeConverterConfig>>;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAN,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,KAAL,KAAK,QAKhB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\nimport { AxiosRequestConfig } from \"axios\";\r\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel.js\";\r\nimport { TypeModel } from \"./TypeModel.js\";\r\n\r\n/**\r\n * Generation mode, by default \"all\".\r\n */\r\nexport enum Modes {\r\n models,\r\n qobjects,\r\n service,\r\n all,\r\n}\r\n\r\n/**\r\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\r\n */\r\nexport enum EmitModes {\r\n ts = \"ts\",\r\n js = \"js\",\r\n dts = \"dts\",\r\n js_dts = \"js_dts\",\r\n}\r\n\r\n/**\r\n * Config options for CLI.\r\n */\r\nexport interface CliOptions {\r\n /**\r\n * The URL to the root of your OData service. The URL might end in a slash or not, it might also end\r\n * in $metadata, but we usually add this for you.\r\n *\r\n * Specifying the URL is a convenience feature to download the metadata file from the given URL.\r\n * You can configure this request via `sourceConfig` option.\r\n *\r\n * The `source` option must still be specified as it is used to store the downloaded file on your disk.\r\n * By default, the file is used once it has been downloaded.\r\n */\r\n sourceUrl?: string;\r\n /**\r\n * Downloads the metadata file and overwrites the existing one, if any.\r\n *\r\n * Only takes effect, if option `sourceUrl` is specified.\r\n */\r\n refreshFile?: boolean;\r\n /**\r\n * The source is the file to use (must be an EDMX compliant XML file) or the URL to the\r\n * metadata (ROOT_SERVICE/$metadata).\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffixing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Configuration options of the request to retrieve the metadata.\r\n * Only takes effect if `source` is a URL.\r\n */\r\nexport interface UrlSourceConfiguration {\r\n /**\r\n * Basic auth credentials: the username.\r\n * Only takes effect if `password` has also been set.\r\n */\r\n username?: string;\r\n /**\r\n * Basic auth credentials: the password.\r\n * Only takes effect if `username` has also been set.\r\n */\r\n password?: string;\r\n /**\r\n * Custom request configuration.\r\n * URL and method `GET` are set by default, but can be overwritten.\r\n */\r\n custom?: AxiosRequestConfig;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"sourceUrl\" | \"source\" | \"output\" | \"services\"> {\r\n /**\r\n * Configuration options of the request to retrieve the metadata.\r\n * Only takes effect if `sourceUrl` is a URL.\r\n */\r\n sourceUrlConfig?: UrlSourceConfiguration;\r\n\r\n /**\r\n * Configuration of each service.\r\n *\r\n * @example { services: { trippin: { source: \"...\", ... } }}\r\n */\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n /**\r\n * Model properties have explaining comments by default.\r\n * With this option you can turn that off.\r\n */\r\n skipComments?: boolean;\r\n /**\r\n * With OData you can read, update and delete data on a primitive property (`Edm.*`).\r\n * Usually, you wouldn't do that, but go for a bigger request, fetching more relevant information in one go.\r\n *\r\n * There's one exception: Handling `Edm.Stream´ properties and Media entities. Services for stream / media\r\n * stuff are generated regardless of this setting.\r\n */\r\n enablePrimitivePropertyServices?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n\r\n /**\r\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\r\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\r\n * an object with the property \"results\" is wrapped around the entity collection.\r\n *\r\n * If you're using the odata client then there's a build-in workaround in place which transforms\r\n * the results to remove this extra mapping. However, if you're only interested in the types, then\r\n * the generated models will not match that extra wrapping.\r\n *\r\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\r\n * wrapping to the generated models. But this option is only valid if the generation mode is set\r\n * to <code>models</code>; it is ignored otherwise.\r\n */\r\n v2ModelsWithExtraResultsWrapping?: boolean;\r\n /**\r\n * Numbers of type `Edm.Int64` and `Edm.Decimal` are represented as `number` in V4.\r\n * However, these numbers might not fit into JS' number type, which might result in precision loss.\r\n *\r\n * OData offers a special IEEE754 format option to get those types as `string` instead to prevent any\r\n * precision loss. So if you're handling very large or very small numbers (JS roughly supports 15 digits),\r\n * then you should use this option and, probably, also an appropriate converter (see available converters).\r\n *\r\n * Activating this option affects the type generation and will use `string` for both mentioned types.\r\n * All requests are executed with the \"accept\" header set to \"application/json;IEEE754Compatible=true\".\r\n * Additionally, when sending data the very same value will be set for the \"content-type\" header.\r\n */\r\n v4BigNumberAsString?: boolean;\r\n /**\r\n * OData allows for namespaces so any entity is unique by virtue of it's name within a namespace.\r\n * odata2ts works with these fully qualified names internally, but only uses the plain name when generating\r\n * stuff. This might lead to name clashes (same name in different namespaces).\r\n *\r\n * odata2ts employs a simple, automatic resolution strategy: Adding a counter at the end of the name.\r\n * Set this property to true in order to disable this automatism.\r\n */\r\n disableAutomaticNameClashResolution?: boolean;\r\n /**\r\n * By default, odata2ts generates a folder structure with individual files per entity.\r\n * This allows for handling and scaling the generation process for large data structures.\r\n *\r\n * However, especially UI5 has problems with recursive structures, which are absolutely valid within\r\n * OData. Here the solution is to generate only one file per type to circumvent cyclic imports.\r\n * To enable this behaviour set this option to true.\r\n */\r\n bundledFileGeneration?: boolean;\r\n /**\r\n * If enabled, odata2ts will generate numeric enums instead of string enums.\r\n * This\r\n */\r\n numericEnums?: boolean;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Pick<CliOptions, \"sourceUrl\" | \"refreshFile\">,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for individual properties based on their name.\r\n */\r\n propertiesByName?: Array<PropertyGenerationOptions>;\r\n /**\r\n * Rename any EntityType, ComplexType, EnumType, Function or Action.\r\n *\r\n * You must match the simple name (e.g. \"Person\") or the fully qualified name\r\n * (e.g. \"Trippin.Person\") exactly. Alternatively, you can rename a bunch of types\r\n * by using regular expressions.\r\n *\r\n * By providing additional type information via the \"type\" attribute you get even more options which only apply\r\n * to the given type.\r\n */\r\n byTypeAndName?: Array<ComplexTypeGenerationOptions | EntityTypeGenerationOptions | GenericTypeGenerationOptions>;\r\n}\r\n\r\n/**\r\n * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions\r\n extends Required<Omit<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\">>,\r\n Pick<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\"> {\r\n naming: NameSettings;\r\n}\r\n\r\nexport interface RenameOptions {\r\n /**\r\n * Matcher for the name of any EntityType, ComplexType, EnumType, Function or Action\r\n * as it is stated in the EDMX model, e.g. \"Person\". As OData supports namespaces\r\n * you can also use the fully qualified name (including the namespace) to address any model,\r\n * e.g. \"Trippin.Person\". You can also match properties by their name.\r\n *\r\n * If the name is specified as plain string, it must match either the name or the fully qualified name\r\n * exactly (case-sensitive).\r\n *\r\n * Alternatively, a regular expression can be used which is always applied to the fully qualified name\r\n * (e.g. Trippin.Person). The regular expression must match the whole string\r\n * (e.g. `/Person/` won't do, `/.*\\.Person/` would work).\r\n *\r\n * To make regular expressions useful, captured groups are also supported in combination with\r\n * the `mappedName` attribute.\r\n */\r\n name: string | RegExp;\r\n\r\n /**\r\n * If specified, this attribute value is used as final name for the matched name as it will\r\n * appear in the generated typescript.\r\n *\r\n * When using a regular expression for matching the name, then captured groups can be referenced\r\n * as usual via $1, $2, etc. For example:\r\n * - name: /Trippin\\.(.+)/\r\n * - mappedName: \"T_$1\"\r\n * The result would be \"T_Person\".\r\n */\r\n mappedName?: string;\r\n}\r\n\r\nexport type TypeBasedGenerationOptions =\r\n | GenericTypeGenerationOptions\r\n | ComplexTypeGenerationOptions\r\n | EntityTypeGenerationOptions;\r\n\r\nexport interface GenericTypeGenerationOptions extends RenameOptions {\r\n type:\r\n | TypeModel.Any\r\n | TypeModel.EnumType\r\n | TypeModel.OperationType\r\n | TypeModel.OperationImportType\r\n | TypeModel.Singleton\r\n | TypeModel.EntitySet;\r\n}\r\n\r\nexport interface ComplexTypeGenerationOptions extends RenameOptions {\r\n type: TypeModel.ComplexType;\r\n\r\n /**\r\n * Configuration of individual properties.\r\n */\r\n properties?: Array<PropertyGenerationOptions>;\r\n\r\n // converter: string | Array<string>\r\n}\r\n\r\n/**\r\n * Configuration options for EntityTypes and ComplexTypes.\r\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\r\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\r\n */\r\nexport interface EntityTypeGenerationOptions extends Omit<ComplexTypeGenerationOptions, \"type\"> {\r\n type: TypeModel.EntityType;\r\n\r\n /**\r\n * Overwrite the key specification by naming the props by their EDMX name.\r\n */\r\n keys?: Array<string>;\r\n\r\n /**\r\n * Whether the generated service should allow for querying this model.\r\n * True by default.\r\n */\r\n // queryable?: boolean;\r\n /**\r\n * Whether the generated service should allow for creating new models (POST).\r\n * True by default.\r\n */\r\n // creatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for updates (PUT).\r\n * True by default.\r\n */\r\n // updatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for partial updates (PATCH).\r\n * True by default.\r\n */\r\n // patchable?: boolean;\r\n /**\r\n * Whether the generated service should allow for deletion.\r\n * True by default.\r\n */\r\n // deletable?: boolean;\r\n}\r\n\r\n/**\r\n * All configuration options for properties of models.\r\n */\r\nexport interface PropertyGenerationOptions extends RenameOptions {\r\n /**\r\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\r\n * Hence, they are left out of the editable model versions.\r\n */\r\n managed?: boolean;\r\n\r\n /**\r\n * TODO\r\n *\r\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\r\n * as well it's i\r\n * and their ids, e.g. \"timeToDurationConverter\".\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n // converters?: Array<Required<TypeConverterConfig>>;\r\n}\r\n"]}
|
|
@@ -62,9 +62,13 @@ export class Digester {
|
|
|
62
62
|
result = {
|
|
63
63
|
dataType: modelType,
|
|
64
64
|
type: this.namingHelper.getEnumName((_a = enumConfig === null || enumConfig === void 0 ? void 0 : enumConfig.mappedName) !== null && _a !== void 0 ? _a : odataDataType),
|
|
65
|
-
qPath: "QEnumPath",
|
|
66
|
-
qObject: isCollection
|
|
67
|
-
|
|
65
|
+
qPath: this.options.numericEnums ? "QNumericEnumPath" : "QEnumPath",
|
|
66
|
+
qObject: isCollection
|
|
67
|
+
? this.options.numericEnums
|
|
68
|
+
? "QNumericEnumCollection"
|
|
69
|
+
: "QEnumCollection"
|
|
70
|
+
: undefined,
|
|
71
|
+
qParam: this.options.numericEnums ? "QNumericEnumParam" : "QEnumParam",
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
74
|
// handling of complex & entity types
|
|
@@ -105,7 +109,7 @@ export class Digester {
|
|
|
105
109
|
const namespaces = schemas.map((s) => [s.$.Namespace, s.$.Alias]);
|
|
106
110
|
this.dataModel = new DataModel(namespaces, version, converters);
|
|
107
111
|
this.serviceConfigHelper = new ServiceConfigHelper(options);
|
|
108
|
-
this.nameValidator =
|
|
112
|
+
this.nameValidator = options.bundledFileGeneration ? new NameClashValidator(options) : new NoopValidator();
|
|
109
113
|
this.collectModelTypes(schemas);
|
|
110
114
|
}
|
|
111
115
|
collectModelTypes(schemas) {
|
|
@@ -220,7 +224,7 @@ export class Digester {
|
|
|
220
224
|
name: enumName,
|
|
221
225
|
modelName: this.namingHelper.getEnumName(enumName),
|
|
222
226
|
folderPath: filePath,
|
|
223
|
-
members: ((_a = et.Member) === null || _a === void 0 ? void 0 : _a.length) ? et.Member.map((m) => m.$.Name) : [],
|
|
227
|
+
members: ((_a = et.Member) === null || _a === void 0 ? void 0 : _a.length) ? et.Member.map((m) => ({ name: m.$.Name, value: m.$.Value })) : [],
|
|
224
228
|
});
|
|
225
229
|
}
|
|
226
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataModelDigestion.js","sourceRoot":"","sources":["../../src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AAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAmB,CACnF,CAAC;IACJ,CAAC;;AA1XgB,mBAAU,GAAG,MAAM,AAAT,CAAU","sourcesContent":["import { MappedConverterChains } from \"@odata2ts/converter-runtime\";\r\n\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 * 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 = this.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 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) => m.$.Name) : [],\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 private analyze(fqModelName: string) {\r\n if (this.serviceModels.has(fqModelName)) {\r\n return;\r\n }\r\n\r\n this.serviceModels.add(fqModelName);\r\n const model = this.dataModel.getEntityType(fqModelName) ?? this.dataModel.getComplexType(fqModelName);\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: \"QEnumPath\",\r\n qObject: isCollection ? \"QEnumCollection\" : undefined,\r\n qParam: \"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,"file":"DataModelDigestion.js","sourceRoot":"","sources":["../../src/data-model/DataModelD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aAChC;YACD,IAAI,SAAS,CAAC,IAAI,EAAE;gBAClB,IAAI,GAAG,IAAI,CAAC;aACb;YACD,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC,EACD,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAmB,CACnF,CAAC;IACJ,CAAC;;AA1XgB,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 * 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 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 private analyze(fqModelName: string) {\r\n if (this.serviceModels.has(fqModelName)) {\r\n return;\r\n }\r\n\r\n this.serviceModels.add(fqModelName);\r\n const model = this.dataModel.getEntityType(fqModelName) ?? this.dataModel.getComplexType(fqModelName);\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"]}
|
|
@@ -207,8 +207,8 @@ class DigesterV4 extends Digester {
|
|
|
207
207
|
const bindingProp = isBound ? params.shift() : undefined;
|
|
208
208
|
const bindingEntityName = bindingProp ? (_d = this.dataModel.getModel(bindingProp.fqType)) === null || _d === void 0 ? void 0 : _d.name : undefined;
|
|
209
209
|
const opName = bindingEntityName
|
|
210
|
-
? this.nameValidator.addBoundOperationType(bindingEntityName, fqName, (opConfig === null || opConfig === void 0 ? void 0 : opConfig.mappedName) || odataName)
|
|
211
|
-
: this.nameValidator.addUnboundOperationType(fqName, (opConfig === null || opConfig === void 0 ? void 0 : opConfig.mappedName) || odataName);
|
|
210
|
+
? this.nameValidator.addBoundOperationType(bindingEntityName, fqName, (opConfig === null || opConfig === void 0 ? void 0 : opConfig.mappedName) || odataName, type)
|
|
211
|
+
: this.nameValidator.addUnboundOperationType(fqName, (opConfig === null || opConfig === void 0 ? void 0 : opConfig.mappedName) || odataName, type);
|
|
212
212
|
const name = type === "Function" /* OperationTypes.Function */
|
|
213
213
|
? this.namingHelper.getFunctionName(opName)
|
|
214
214
|
: this.namingHelper.getActionName(opName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataModelDigestionV4.js","sourceRoot":"","sources":["../../src/data-model/DataModelDigestionV4.ts"],"names":[],"mappings":";AAAA,OAAO,EAAyB,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,YAAY,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";\r\nimport { ODataTypesV4, ODataVersions } from \"@odata2ts/odata-core\";\r\n\r\nimport { DigesterFunction, DigestionOptions } from \"../FactoryFunctionModel.js\";\r\nimport { NamespaceWithAlias, withNamespace } from \"./DataModel.js\";\r\nimport { Digester, TypeModel } from \"./DataModelDigestion.js\";\r\nimport { ODataVersion, OperationType, OperationTypes, PropertyModel } from \"./DataTypeModel.js\";\r\nimport { ComplexType, Property } from \"./edmx/ODataEdmxModelBase.js\";\r\nimport { ComplexTypeV4, EntityTypeV4, Operation, SchemaV4 } from \"./edmx/ODataEdmxModelV4.js\";\r\nimport { NamingHelper } from \"./NamingHelper.js\";\r\n\r\nexport const digest: DigesterFunction<SchemaV4> = async (schemas, options, namingHelper) => {\r\n const converters = await loadConverters(ODataVersions.V4, options.converters);\r\n\r\n const digester = new DigesterV4(schemas, options, namingHelper, converters);\r\n return digester.digest();\r\n};\r\n\r\nclass DigesterV4 extends Digester<SchemaV4, EntityTypeV4, ComplexTypeV4> {\r\n constructor(\r\n schemas: Array<SchemaV4>,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper,\r\n converters?: MappedConverterChains\r\n ) {\r\n super(ODataVersion.V4, schemas, options, namingHelper, converters);\r\n }\r\n\r\n protected getNavigationProps(entityType: ComplexType | EntityTypeV4): Array<Property> {\r\n return (entityType as EntityTypeV4).NavigationProperty || [];\r\n }\r\n\r\n protected digestOperations(schema: SchemaV4) {\r\n const nsWithAlias: NamespaceWithAlias = [schema.$.Namespace, schema.$.Alias];\r\n // functions & actions\r\n this.addOperations(nsWithAlias, schema.Function, OperationTypes.Function);\r\n this.addOperations(nsWithAlias, schema.Action, OperationTypes.Action);\r\n }\r\n\r\n protected digestEntityContainer(schema: SchemaV4) {\r\n if (schema.EntityContainer && schema.EntityContainer.length) {\r\n const container = schema.EntityContainer[0];\r\n\r\n const ecName = container.$.Name;\r\n\r\n container.ActionImport?.forEach((actionImport) => {\r\n const odataName = actionImport.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const opConfig = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const opName = this.nameValidator.addOperationImportType(fqName, opConfig?.mappedName || odataName);\r\n\r\n this.dataModel.addAction(fqName, {\r\n fqName,\r\n name: this.namingHelper.getActionName(opName),\r\n odataName: actionImport.$.Name,\r\n operation: actionImport.$.Action,\r\n });\r\n });\r\n\r\n container.FunctionImport?.forEach((funcImport) => {\r\n const odataName = funcImport.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const opConfig = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const opName = this.nameValidator.addOperationImportType(fqName, opConfig?.mappedName || odataName);\r\n\r\n this.dataModel.addFunction(fqName, {\r\n fqName,\r\n odataName,\r\n name: this.namingHelper.getFunctionName(opName),\r\n operation: funcImport.$.Function,\r\n entitySet: funcImport.$.EntitySet,\r\n });\r\n });\r\n\r\n container.Singleton?.forEach((singleton) => {\r\n const odataName = singleton.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const singletonConfig = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const name = this.nameValidator.addSingleton(\r\n withNamespace(fqName, odataName),\r\n singletonConfig?.mappedName || odataName\r\n );\r\n const navPropBindings = singleton.NavigationPropertyBinding || [];\r\n const entityType = this.dataModel.getEntityType(singleton.$.Type);\r\n if (!entityType) {\r\n throw new Error(`Entity type \"${singleton.$.Type}\" not found!`);\r\n }\r\n\r\n this.dataModel.addSingleton(fqName, {\r\n fqName,\r\n odataName,\r\n name,\r\n entityType,\r\n navPropBinding: navPropBindings.map((binding) => ({\r\n path: this.namingHelper.stripServicePrefix(binding.$.Path),\r\n target: binding.$.Target,\r\n })),\r\n });\r\n });\r\n\r\n container.EntitySet?.forEach((entitySet) => {\r\n const odataName = entitySet.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const config = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const name = this.nameValidator.addEntitySet(fqName, config?.mappedName || odataName);\r\n const navPropBindings = entitySet.NavigationPropertyBinding || [];\r\n const entityType = this.dataModel.getEntityType(entitySet.$.EntityType);\r\n if (!entityType) {\r\n throw new Error(`Entity type \"${entitySet.$.EntityType}\" not found!`);\r\n }\r\n\r\n this.dataModel.addEntitySet(fqName, {\r\n fqName,\r\n odataName,\r\n name,\r\n entityType,\r\n navPropBinding: navPropBindings.map((binding) => ({\r\n path: this.namingHelper.stripServicePrefix(binding.$.Path),\r\n target: binding.$.Target,\r\n })),\r\n });\r\n });\r\n }\r\n }\r\n\r\n protected mapODataType(type: string): TypeModel {\r\n switch (type) {\r\n case ODataTypesV4.Boolean:\r\n return {\r\n outputType: \"boolean\",\r\n qPath: \"QBooleanPath\",\r\n qCollection: \"QBooleanCollection\",\r\n qParam: \"QBooleanParam\",\r\n };\r\n case ODataTypesV4.Int64:\r\n case ODataTypesV4.Decimal:\r\n if (this.options.v4BigNumberAsString) {\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QBigNumberPath\",\r\n qCollection: \"QBigNumberCollection\",\r\n qParam: \"QBigNumberParam\",\r\n };\r\n }\r\n // yes, intentional fall through!\r\n case ODataTypesV4.Byte:\r\n case ODataTypesV4.SByte:\r\n case ODataTypesV4.Int16:\r\n case ODataTypesV4.Int32:\r\n case ODataTypesV4.Single:\r\n case ODataTypesV4.Double:\r\n return {\r\n outputType: \"number\",\r\n qPath: \"QNumberPath\",\r\n qCollection: \"QNumberCollection\",\r\n qParam: \"QNumberParam\",\r\n };\r\n case ODataTypesV4.String:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QStringPath\",\r\n qCollection: \"QStringCollection\",\r\n qParam: \"QStringParam\",\r\n };\r\n case ODataTypesV4.Date:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QDatePath\",\r\n qCollection: \"QDateCollection\",\r\n qParam: \"QDateParam\",\r\n };\r\n case ODataTypesV4.TimeOfDay:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QTimeOfDayPath\",\r\n qCollection: \"QTimeOfDayCollection\",\r\n qParam: \"QTimeOfDayParam\",\r\n };\r\n case ODataTypesV4.DateTimeOffset:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QDateTimeOffsetPath\",\r\n qCollection: \"QDateTimeOffsetCollection\",\r\n qParam: \"QDateTimeOffsetParam\",\r\n };\r\n // case ODataTypesV4.Duration:\r\n // return {\r\n // outputType: \"string\",\r\n // qPath: \"QDurationPath\",\r\n // qCollection: \"QDurationCollection\",\r\n // qParam: \"QDurationParam\",\r\n // };\r\n case ODataTypesV4.Binary:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QBinaryPath\",\r\n qCollection: \"QBinaryCollection\",\r\n qParam: \"QBinaryParam\",\r\n };\r\n case ODataTypesV4.Guid:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QGuidPath\",\r\n qCollection: \"QGuidCollection\",\r\n qParam: \"QGuidParam\",\r\n };\r\n default:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QStringPath\",\r\n qCollection: \"QStringCollection\",\r\n qParam: undefined,\r\n };\r\n }\r\n }\r\n\r\n private addOperations(ns: NamespaceWithAlias, operations: Array<Operation> | undefined, type: OperationTypes) {\r\n const [namespace] = ns;\r\n if (!operations || !operations.length) {\r\n return;\r\n }\r\n\r\n operations.forEach((op) => {\r\n const odataName = op.$.Name;\r\n const isBound = op.$.IsBound === \"true\";\r\n const fqName = withNamespace(namespace, odataName);\r\n const opConfig = this.serviceConfigHelper.findOperationTypeConfig(ns, odataName);\r\n const params: Array<PropertyModel> = op.Parameter?.map((p) => this.mapProp(p)) ?? [];\r\n const returnType: PropertyModel | undefined = op.ReturnType?.map((rt) => {\r\n return this.mapProp({ ...rt, $: { Name: \"NO_NAME_BECAUSE_RETURN_TYPE\", ...rt.$ } });\r\n })[0];\r\n\r\n if (isBound && !params.length) {\r\n throw new Error(`IllegalState: Operation '${odataName}' is bound, but has no parameters!`);\r\n }\r\n\r\n const bindingProp = isBound ? params.shift() : undefined;\r\n const bindingEntityName = bindingProp ? this.dataModel.getModel(bindingProp!.fqType)?.name : undefined;\r\n\r\n const opName = bindingEntityName\r\n ? this.nameValidator.addBoundOperationType(bindingEntityName, fqName, opConfig?.mappedName || odataName)\r\n : this.nameValidator.addUnboundOperationType(fqName, opConfig?.mappedName || odataName);\r\n\r\n const name =\r\n type === OperationTypes.Function\r\n ? this.namingHelper.getFunctionName(opName)\r\n : this.namingHelper.getActionName(opName);\r\n const qName =\r\n type === OperationTypes.Function\r\n ? this.namingHelper.getQFunctionName(opName, bindingEntityName)\r\n : this.namingHelper.getQActionName(opName, bindingEntityName);\r\n const opType: OperationType = {\r\n fqName,\r\n odataName: isBound ? fqName : odataName,\r\n name,\r\n qName,\r\n paramsModelName: this.namingHelper.getOperationParamsModelName(opName, bindingEntityName),\r\n type,\r\n parameters: params,\r\n returnType,\r\n };\r\n\r\n if (bindingProp) {\r\n this.dataModel.addBoundOperationType(namespace, bindingProp, opType);\r\n } else {\r\n this.dataModel.addUnboundOperationType(namespace, opType);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"DataModelDigestionV4.js","sourceRoot":"","sources":["../../src/data-model/DataModelDigestionV4.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAyB,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAsB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAa,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAgD,MAAM,oBAAoB,CAAC;AAKhG,MAAM,CAAC,MAAM,MAAM,GAA+B,CAAO,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;IACzF,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9E,MAAM,QAAQ,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CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC9C,MAAM,KAAK,GACT,IAAI,6CAA4B;gBAC9B,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAC/D,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YAClE,MAAM,MAAM,GAAkB;gBAC5B,MAAM;gBACN,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACvC,IAAI;gBACJ,KAAK;gBACL,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,2BAA2B,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBACzF,IAAI;gBACJ,UAAU,EAAE,MAAM;gBAClB,UAAU;aACX,CAAC;YAEF,IAAI,WAAW,EAAE;gBACf,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;aACtE;iBAAM;gBACL,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { loadConverters, MappedConverterChains } from \"@odata2ts/converter-runtime\";\r\nimport { ODataTypesV4, ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { DigesterFunction, DigestionOptions } from \"../FactoryFunctionModel.js\";\r\nimport { NamespaceWithAlias, withNamespace } from \"./DataModel.js\";\r\nimport { Digester, TypeModel } from \"./DataModelDigestion.js\";\r\nimport { ODataVersion, OperationType, OperationTypes, PropertyModel } from \"./DataTypeModel.js\";\r\nimport { ComplexType, Property } from \"./edmx/ODataEdmxModelBase.js\";\r\nimport { ComplexTypeV4, EntityTypeV4, Operation, SchemaV4 } from \"./edmx/ODataEdmxModelV4.js\";\r\nimport { NamingHelper } from \"./NamingHelper.js\";\r\n\r\nexport const digest: DigesterFunction<SchemaV4> = async (schemas, options, namingHelper) => {\r\n const converters = await loadConverters(ODataVersions.V4, options.converters);\r\n\r\n const digester = new DigesterV4(schemas, options, namingHelper, converters);\r\n return digester.digest();\r\n};\r\n\r\nclass DigesterV4 extends Digester<SchemaV4, EntityTypeV4, ComplexTypeV4> {\r\n constructor(\r\n schemas: Array<SchemaV4>,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper,\r\n converters?: MappedConverterChains,\r\n ) {\r\n super(ODataVersion.V4, schemas, options, namingHelper, converters);\r\n }\r\n\r\n protected getNavigationProps(entityType: ComplexType | EntityTypeV4): Array<Property> {\r\n return (entityType as EntityTypeV4).NavigationProperty || [];\r\n }\r\n\r\n protected digestOperations(schema: SchemaV4) {\r\n const nsWithAlias: NamespaceWithAlias = [schema.$.Namespace, schema.$.Alias];\r\n // functions & actions\r\n this.addOperations(nsWithAlias, schema.Function, OperationTypes.Function);\r\n this.addOperations(nsWithAlias, schema.Action, OperationTypes.Action);\r\n }\r\n\r\n protected digestEntityContainer(schema: SchemaV4) {\r\n if (schema.EntityContainer && schema.EntityContainer.length) {\r\n const container = schema.EntityContainer[0];\r\n\r\n const ecName = container.$.Name;\r\n\r\n container.ActionImport?.forEach((actionImport) => {\r\n const odataName = actionImport.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const opConfig = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const opName = this.nameValidator.addOperationImportType(fqName, opConfig?.mappedName || odataName);\r\n\r\n this.dataModel.addAction(fqName, {\r\n fqName,\r\n name: this.namingHelper.getActionName(opName),\r\n odataName: actionImport.$.Name,\r\n operation: actionImport.$.Action,\r\n });\r\n });\r\n\r\n container.FunctionImport?.forEach((funcImport) => {\r\n const odataName = funcImport.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const opConfig = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const opName = this.nameValidator.addOperationImportType(fqName, opConfig?.mappedName || odataName);\r\n\r\n this.dataModel.addFunction(fqName, {\r\n fqName,\r\n odataName,\r\n name: this.namingHelper.getFunctionName(opName),\r\n operation: funcImport.$.Function,\r\n entitySet: funcImport.$.EntitySet,\r\n });\r\n });\r\n\r\n container.Singleton?.forEach((singleton) => {\r\n const odataName = singleton.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const singletonConfig = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const name = this.nameValidator.addSingleton(\r\n withNamespace(fqName, odataName),\r\n singletonConfig?.mappedName || odataName,\r\n );\r\n const navPropBindings = singleton.NavigationPropertyBinding || [];\r\n const entityType = this.dataModel.getEntityType(singleton.$.Type);\r\n if (!entityType) {\r\n throw new Error(`Entity type \"${singleton.$.Type}\" not found!`);\r\n }\r\n\r\n this.dataModel.addSingleton(fqName, {\r\n fqName,\r\n odataName,\r\n name,\r\n entityType,\r\n navPropBinding: navPropBindings.map((binding) => ({\r\n path: this.namingHelper.stripServicePrefix(binding.$.Path),\r\n target: binding.$.Target,\r\n })),\r\n });\r\n });\r\n\r\n container.EntitySet?.forEach((entitySet) => {\r\n const odataName = entitySet.$.Name;\r\n const fqName = withNamespace(ecName, odataName);\r\n const config = this.serviceConfigHelper.findOperationImportConfig(ecName, odataName);\r\n const name = this.nameValidator.addEntitySet(fqName, config?.mappedName || odataName);\r\n const navPropBindings = entitySet.NavigationPropertyBinding || [];\r\n const entityType = this.dataModel.getEntityType(entitySet.$.EntityType);\r\n if (!entityType) {\r\n throw new Error(`Entity type \"${entitySet.$.EntityType}\" not found!`);\r\n }\r\n\r\n this.dataModel.addEntitySet(fqName, {\r\n fqName,\r\n odataName,\r\n name,\r\n entityType,\r\n navPropBinding: navPropBindings.map((binding) => ({\r\n path: this.namingHelper.stripServicePrefix(binding.$.Path),\r\n target: binding.$.Target,\r\n })),\r\n });\r\n });\r\n }\r\n }\r\n\r\n protected mapODataType(type: string): TypeModel {\r\n switch (type) {\r\n case ODataTypesV4.Boolean:\r\n return {\r\n outputType: \"boolean\",\r\n qPath: \"QBooleanPath\",\r\n qCollection: \"QBooleanCollection\",\r\n qParam: \"QBooleanParam\",\r\n };\r\n case ODataTypesV4.Int64:\r\n case ODataTypesV4.Decimal:\r\n if (this.options.v4BigNumberAsString) {\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QBigNumberPath\",\r\n qCollection: \"QBigNumberCollection\",\r\n qParam: \"QBigNumberParam\",\r\n };\r\n }\r\n // yes, intentional fall through!\r\n case ODataTypesV4.Byte:\r\n case ODataTypesV4.SByte:\r\n case ODataTypesV4.Int16:\r\n case ODataTypesV4.Int32:\r\n case ODataTypesV4.Single:\r\n case ODataTypesV4.Double:\r\n return {\r\n outputType: \"number\",\r\n qPath: \"QNumberPath\",\r\n qCollection: \"QNumberCollection\",\r\n qParam: \"QNumberParam\",\r\n };\r\n case ODataTypesV4.String:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QStringPath\",\r\n qCollection: \"QStringCollection\",\r\n qParam: \"QStringParam\",\r\n };\r\n case ODataTypesV4.Date:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QDatePath\",\r\n qCollection: \"QDateCollection\",\r\n qParam: \"QDateParam\",\r\n };\r\n case ODataTypesV4.TimeOfDay:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QTimeOfDayPath\",\r\n qCollection: \"QTimeOfDayCollection\",\r\n qParam: \"QTimeOfDayParam\",\r\n };\r\n case ODataTypesV4.DateTimeOffset:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QDateTimeOffsetPath\",\r\n qCollection: \"QDateTimeOffsetCollection\",\r\n qParam: \"QDateTimeOffsetParam\",\r\n };\r\n // case ODataTypesV4.Duration:\r\n // return {\r\n // outputType: \"string\",\r\n // qPath: \"QDurationPath\",\r\n // qCollection: \"QDurationCollection\",\r\n // qParam: \"QDurationParam\",\r\n // };\r\n case ODataTypesV4.Binary:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QBinaryPath\",\r\n qCollection: \"QBinaryCollection\",\r\n qParam: \"QBinaryParam\",\r\n };\r\n case ODataTypesV4.Guid:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QGuidPath\",\r\n qCollection: \"QGuidCollection\",\r\n qParam: \"QGuidParam\",\r\n };\r\n default:\r\n return {\r\n outputType: \"string\",\r\n qPath: \"QStringPath\",\r\n qCollection: \"QStringCollection\",\r\n qParam: undefined,\r\n };\r\n }\r\n }\r\n\r\n private addOperations(ns: NamespaceWithAlias, operations: Array<Operation> | undefined, type: OperationTypes) {\r\n const [namespace] = ns;\r\n if (!operations || !operations.length) {\r\n return;\r\n }\r\n\r\n operations.forEach((op) => {\r\n const odataName = op.$.Name;\r\n const isBound = op.$.IsBound === \"true\";\r\n const fqName = withNamespace(namespace, odataName);\r\n const opConfig = this.serviceConfigHelper.findOperationTypeConfig(ns, odataName);\r\n const params: Array<PropertyModel> = op.Parameter?.map((p) => this.mapProp(p)) ?? [];\r\n const returnType: PropertyModel | undefined = op.ReturnType?.map((rt) => {\r\n return this.mapProp({ ...rt, $: { Name: \"NO_NAME_BECAUSE_RETURN_TYPE\", ...rt.$ } });\r\n })[0];\r\n\r\n if (isBound && !params.length) {\r\n throw new Error(`IllegalState: Operation '${odataName}' is bound, but has no parameters!`);\r\n }\r\n\r\n const bindingProp = isBound ? params.shift() : undefined;\r\n const bindingEntityName = bindingProp ? this.dataModel.getModel(bindingProp!.fqType)?.name : undefined;\r\n\r\n const opName = bindingEntityName\r\n ? this.nameValidator.addBoundOperationType(bindingEntityName, fqName, opConfig?.mappedName || odataName, type)\r\n : this.nameValidator.addUnboundOperationType(fqName, opConfig?.mappedName || odataName, type);\r\n\r\n const name =\r\n type === OperationTypes.Function\r\n ? this.namingHelper.getFunctionName(opName)\r\n : this.namingHelper.getActionName(opName);\r\n const qName =\r\n type === OperationTypes.Function\r\n ? this.namingHelper.getQFunctionName(opName, bindingEntityName)\r\n : this.namingHelper.getQActionName(opName, bindingEntityName);\r\n const opType: OperationType = {\r\n fqName,\r\n odataName: isBound ? fqName : odataName,\r\n name,\r\n qName,\r\n paramsModelName: this.namingHelper.getOperationParamsModelName(opName, bindingEntityName),\r\n type,\r\n parameters: params,\r\n returnType,\r\n };\r\n\r\n if (bindingProp) {\r\n this.dataModel.addBoundOperationType(namespace, bindingProp, opType);\r\n } else {\r\n this.dataModel.addUnboundOperationType(namespace, opType);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTypeModel.js","sourceRoot":"","sources":["../../src/data-model/DataTypeModel.ts"],"names":[],"mappings":"
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import { ConfigFileOptions } from "../../OptionModel.js";
|
|
2
|
+
import { OperationTypes } from "../DataTypeModel.js";
|
|
2
3
|
import { NameValidator, ValidationError } from "./NameValidator.js";
|
|
3
4
|
export interface NameValidatorOptions extends Pick<ConfigFileOptions, "disableAutomaticNameClashResolution" | "bundledFileGeneration"> {
|
|
4
5
|
}
|
|
@@ -14,8 +15,8 @@ export declare class NameClashValidator implements NameValidator {
|
|
|
14
15
|
addEntityType(fqName: string, name: string): string;
|
|
15
16
|
addComplexType(fqName: string, name: string): string;
|
|
16
17
|
addEnumType(fqName: string, name: string): string;
|
|
17
|
-
addUnboundOperationType(fqName: string, name: string): string;
|
|
18
|
-
addBoundOperationType(bindingName: string, fqName: string, name: string): string;
|
|
18
|
+
addUnboundOperationType(fqName: string, name: string, operationType: OperationTypes): string;
|
|
19
|
+
addBoundOperationType(bindingName: string, fqName: string, name: string, operationType: OperationTypes): string;
|
|
19
20
|
addOperationImportType(fqName: string, name: string): string;
|
|
20
21
|
addEntitySet(fqName: string, name: string): string;
|
|
21
22
|
addSingleton(fqName: string, name: string): string;
|
|
@@ -54,11 +54,12 @@ export class NameClashValidator {
|
|
|
54
54
|
addEnumType(fqName, name) {
|
|
55
55
|
return this.addToTypes(fqName, name, TypeModel.EnumType);
|
|
56
56
|
}
|
|
57
|
-
addUnboundOperationType(fqName, name) {
|
|
57
|
+
addUnboundOperationType(fqName, name, operationType) {
|
|
58
58
|
const validationObject = { type: TypeModel.OperationType, fqName };
|
|
59
|
+
const isAction = operationType === "Action" /* OperationTypes.Action */;
|
|
59
60
|
const hit = this.store.get(name);
|
|
60
61
|
// to support function overloads: allow multiple operation definitions with same fully qualified name
|
|
61
|
-
if (hit && hit.fqName !== fqName) {
|
|
62
|
+
if (hit && (isAction || hit.fqName !== fqName)) {
|
|
62
63
|
return this.addToError(name, hit, validationObject);
|
|
63
64
|
}
|
|
64
65
|
else {
|
|
@@ -66,12 +67,13 @@ export class NameClashValidator {
|
|
|
66
67
|
return name;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
addBoundOperationType(bindingName, fqName, name) {
|
|
70
|
+
addBoundOperationType(bindingName, fqName, name, operationType) {
|
|
70
71
|
const nameWithBinding = `${bindingName}_${name}`;
|
|
71
72
|
const validationObject = { type: TypeModel.OperationType, fqName };
|
|
73
|
+
const isAction = operationType === "Action" /* OperationTypes.Action */;
|
|
72
74
|
const hit = this.store.get(nameWithBinding);
|
|
73
75
|
// to support function overloads: allow multiple operation definitions with same fully qualified name
|
|
74
|
-
if (hit && hit.fqName !== fqName) {
|
|
76
|
+
if (hit && (isAction || hit.fqName !== fqName)) {
|
|
75
77
|
return this.addToError(name, hit, validationObject);
|
|
76
78
|
}
|
|
77
79
|
else {
|