@odata2ts/odata2ts 0.40.1 → 0.40.2
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 +25 -0
- package/lib/FactoryFunctionModel.d.ts +2 -2
- package/lib/FactoryFunctionModel.js.map +1 -1
- package/lib/OptionModel.d.ts +8 -0
- package/lib/OptionModel.js.map +1 -1
- package/lib/data-model/DataModelDigestion.js +23 -5
- package/lib/data-model/DataModelDigestion.js.map +1 -1
- package/lib/data-model/QueryObjectTypes.d.ts +13 -0
- package/lib/data-model/QueryObjectTypes.js +15 -0
- package/lib/data-model/QueryObjectTypes.js.map +1 -0
- package/lib/defaultConfig.js +1 -0
- package/lib/defaultConfig.js.map +1 -1
- package/lib/generator/ImportContainer.d.ts +3 -0
- package/lib/generator/ImportContainer.js +11 -0
- package/lib/generator/ImportContainer.js.map +1 -1
- package/lib/generator/QueryObjectGenerator.js +58 -38
- package/lib/generator/QueryObjectGenerator.js.map +1 -1
- package/lib/generator/ServiceGenerator.js +1 -1
- package/lib/generator/ServiceGenerator.js.map +1 -1
- package/lib/generator/import/ImportObjects.d.ts +0 -6
- package/lib/generator/import/ImportObjects.js +0 -6
- package/lib/generator/import/ImportObjects.js.map +1 -1
- package/lib/project/ProjectManager.js +2 -2
- package/lib/project/ProjectManager.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,31 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
13
13
|
* @odata2ts/odata-query-objects bumped from ^0.28.0 to ^0.28.1
|
|
14
14
|
* @odata2ts/odata-service bumped from ^0.23.0 to ^0.23.1
|
|
15
15
|
|
|
16
|
+
## [0.40.2](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts-v0.40.1...@odata2ts/odata2ts-v0.40.2) (2026-07-03)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **odata2ts:** allow for native in-operator (V4 only) ([b7ddbf0](https://github.com/odata2ts/odata2ts/commit/b7ddbf0f87c9ed20f8c52611988a3f133bce5b2f))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **odata2ts:** fix subclass import for unbundled generation ([#378](https://github.com/odata2ts/odata2ts/issues/378)) ([537db36](https://github.com/odata2ts/odata2ts/commit/537db369e04b972ab473b0ef2cf4c8d8d858120a))
|
|
27
|
+
* **odata2ts:** properly check for bundled file generation ([#376](https://github.com/odata2ts/odata2ts/issues/376)) ([3e09fc8](https://github.com/odata2ts/odata2ts/commit/3e09fc8aace4f3dc599d1eabdebb52142c1bc779))
|
|
28
|
+
* restrict-expand ([#379](https://github.com/odata2ts/odata2ts/issues/379)) ([8624b2d](https://github.com/odata2ts/odata2ts/commit/8624b2d80e6f91f5ce0dcedf53a2e22a20713de3))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
* The following workspace dependencies were updated
|
|
34
|
+
* devDependencies
|
|
35
|
+
* @odata2ts/odata-query-objects bumped from ^0.28.1 to ^0.28.2
|
|
36
|
+
* @odata2ts/odata-service bumped from ^0.23.1 to ^0.23.2
|
|
37
|
+
* peerDependencies
|
|
38
|
+
* @odata2ts/odata-query-objects bumped from ^0.28.1 to ^0.28.2
|
|
39
|
+
* @odata2ts/odata-service bumped from ^0.23.1 to ^0.23.2
|
|
40
|
+
|
|
16
41
|
## [0.40.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts-v0.39.2...@odata2ts/odata2ts-v0.40.0) (2025-11-01)
|
|
17
42
|
|
|
18
43
|
|
|
@@ -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" | "enumType">;
|
|
7
|
+
export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "byTypeAndName" | "v2ModelsWithExtraResultsWrapping" | "v4BigNumberAsString" | "skipEditableModels" | "skipComments" | "skipIdModels" | "disableAutomaticNameClashResolution" | "bundledFileGeneration" | "enumType" | "enableNativeInOperator">;
|
|
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" | "enumType">;
|
|
12
|
+
export type GeneratorFunctionOptions = Pick<RunOptions, "bundledFileGeneration" | "skipEditableModels" | "skipIdModels" | "skipOperations" | "skipComments" | "v2ModelsWithExtraResultsWrapping" | "enumType" | "enableNativeInOperator">;
|
|
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\";\nimport { DataModel } from \"./data-model/DataModel.js\";\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase.js\";\nimport { NamingHelper } from \"./data-model/NamingHelper.js\";\nimport { RunOptions } from \"./OptionModel.js\";\nimport { ProjectManager } from \"./project/ProjectManager.js\";\n\nexport type DigestionOptions = Pick<\n RunOptions,\n | \"converters\"\n | \"disableAutoManagedKey\"\n | \"propertiesByName\"\n | \"byTypeAndName\"\n | \"v2ModelsWithExtraResultsWrapping\"\n | \"v4BigNumberAsString\"\n | \"skipEditableModels\"\n | \"skipComments\"\n | \"disableAutomaticNameClashResolution\"\n | \"bundledFileGeneration\"\n | \"enumType\"\n>;\n\n/**\n * Takes an EdmxSchema plus the run options and creates a DataModel.\n */\nexport type DigesterFunction<S extends Schema<any, any>> = (\n schema: Array<S>,\n options: DigestionOptions,\n namingHelper: NamingHelper,\n) => Promise<DataModel>;\n\nexport type GeneratorFunctionOptions = Pick<\n RunOptions,\n | \"skipEditableModels\"\n | \"skipIdModels\"\n | \"skipOperations\"\n | \"skipComments\"\n | \"v2ModelsWithExtraResultsWrapping\"\n | \"enumType\"\n>;\n\nexport type EntityBasedGeneratorFunction = (\n project: ProjectManager,\n dataModel: DataModel,\n version: ODataVersions,\n options: GeneratorFunctionOptions,\n namingHelper: NamingHelper,\n) => Promise<void>;\n"]}
|
|
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 | \"skipIdModels\"\r\n | \"disableAutomaticNameClashResolution\"\r\n | \"bundledFileGeneration\"\r\n | \"enumType\"\r\n | \"enableNativeInOperator\"\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 | \"bundledFileGeneration\"\r\n | \"skipEditableModels\"\r\n | \"skipIdModels\"\r\n | \"skipOperations\"\r\n | \"skipComments\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"enumType\"\r\n | \"enableNativeInOperator\"\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
|
@@ -258,6 +258,14 @@ export interface ConfigFileOptions extends Omit<CliOptions, "sourceUrl" | "sourc
|
|
|
258
258
|
* With this option you can also generate numeric enums or a simple string union type.
|
|
259
259
|
*/
|
|
260
260
|
enumType?: "string" | "numeric" | "string-union";
|
|
261
|
+
/**
|
|
262
|
+
* By default, odata2ts emulates the in operator by rolling it out as a series of equals-or-expressions.
|
|
263
|
+
* This allows for maximum compatibility with all V4 services, as well as V2 services.
|
|
264
|
+
*
|
|
265
|
+
* Setting this value to true will instead use the native in operator, resulting in smaller queries
|
|
266
|
+
* on V4 services that support it.
|
|
267
|
+
*/
|
|
268
|
+
enableNativeInOperator?: boolean;
|
|
261
269
|
}
|
|
262
270
|
/**
|
|
263
271
|
* 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\";\nimport { AxiosRequestConfig } from \"axios\";\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel.js\";\nimport { TypeModel } from \"./TypeModel.js\";\n\n/**\n * Generation mode, by default \"all\".\n */\nexport enum Modes {\n models,\n qobjects,\n service,\n all,\n}\n\n/**\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\n */\nexport enum EmitModes {\n ts = \"ts\",\n js = \"js\",\n dts = \"dts\",\n js_dts = \"js_dts\",\n}\n\n/**\n * Config options for CLI.\n */\nexport interface CliOptions {\n /**\n * The URL to the root of your OData service. The URL might end in a slash or not, it might also end\n * in $metadata, but we usually add this for you.\n *\n * Specifying the URL is a convenience feature to download the metadata file from the given URL.\n * You can configure this request via `sourceConfig` option.\n *\n * The `source` option must still be specified as it is used to store the downloaded file on your disk.\n * By default, the file is used once it has been downloaded.\n */\n sourceUrl?: string;\n /**\n * Downloads the metadata file and overwrites the existing one, if any.\n *\n * Only takes effect, if option `sourceUrl` is specified.\n */\n refreshFile?: boolean;\n /**\n * The source is the file to use (must be an EDMX compliant XML file) or the URL to the\n * metadata (ROOT_SERVICE/$metadata).\n *\n * If not specified, at least one service must be configured in config file.\n */\n source?: string;\n /**\n * Specifies the output directory for the generated stuff.\n *\n * If not specified, at least one service must be configured in config file.\n */\n output?: string;\n /**\n * Only generates the specified services.\n * Relies on an existing config file where these service names are maintained.\n */\n services?: Array<string>;\n /**\n * Specifies what to generate:\n * - {@code Modes.models} will only generate TS interfaces\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\n * - {@code Modes.service} will generate one main OData service client and one per each entity\n * - {@code Modes.all} the same as {@code Modes.service}\n *\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\n * Defaults to {@code Modes.all}\n */\n mode?: Modes;\n /**\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\n * Defaults to {@code EmitModes.js_dts}\n */\n emitMode?: EmitModes;\n /**\n * Uses prettier with your local configuration to pretty print TypeScript files.\n * Only applies if mode is set to {@code EmitModes.ts}.\n */\n prettier?: boolean;\n /**\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\n * This option allows to specify an alternative file.\n *\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\n */\n tsconfig?: string;\n /**\n * Verbose debugging information.\n */\n debug?: boolean;\n /**\n * Overrides the service name found in the source file.\n *\n * The service name is the basis for all file names and the name of the main OData client service\n * that serves as entry point for the user.\n */\n serviceName?: string;\n /**\n * odata2ts will automatically decide if a key prop is managed on the server side.\n * If managed, the property will not be editable (create, update, patch).\n * The following rule applies:\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\n * in ony other case the prop is unmanaged.\n */\n disableAutoManagedKey?: boolean;\n /**\n * By default, odata2ts doesn't change param, operation, property or model names.\n * The generated models and their properties are named exactly as advertised by the server.\n *\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\n *\n * The naming configuration allows to control this and other naming related settings.\n * Note: Even if renaming is disabled, model prefixing / suffixing still applies.\n */\n allowRenaming?: boolean;\n}\n\n/**\n * Configuration options of the request to retrieve the metadata.\n * Only takes effect if `source` is a URL.\n */\nexport interface UrlSourceConfiguration {\n /**\n * Basic auth credentials: the username.\n * Only takes effect if `password` has also been set.\n */\n username?: string;\n /**\n * Basic auth credentials: the password.\n * Only takes effect if `username` has also been set.\n */\n password?: string;\n /**\n * Custom request configuration.\n * URL and method `GET` are set by default, but can be overwritten.\n */\n custom?: AxiosRequestConfig;\n}\n\n/**\n * Available options for configuration files, i.e. odata2ts.config.ts.\n */\nexport interface ConfigFileOptions extends Omit<CliOptions, \"sourceUrl\" | \"source\" | \"output\" | \"services\"> {\n /**\n * Configuration options of the request to retrieve the metadata.\n * Only takes effect if `sourceUrl` is a URL.\n */\n sourceUrlConfig?: UrlSourceConfiguration;\n\n /**\n * Configuration of each service.\n *\n * @example { services: { trippin: { source: \"...\", ... } }}\n */\n services?: { [serviceName: string]: ServiceGenerationOptions };\n\n /**\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\n * Each converter knows which data type to map.\n *\n * To only use specific converters, the object syntax must be used, where supported converters\n * must be listed by their ids.\n */\n converters?: Array<string | TypeConverterConfig>;\n\n /**\n * For each model an editable version is generated which represents the model definition for\n * create, update and patch actions.\n *\n * You can skip the generation altogether, not generating editable model variants,\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipEditableModels?: boolean;\n\n /**\n * ID models are generated from entity id parameters.\n * The generation for one entity entails one model interface representing the id parameters and\n * one QId function which allows to format the parameters for URL usage and to parse parameters\n * from a URL string.\n *\n * You can skip the generation altogether, not generating models and QId objects, if the\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipIdModels?: boolean;\n /**\n * Operations are functions and actions of the OData service.\n * The generation for one operation entails one parameter model interface\n * and one QFunction / QAction class.\n *\n * You can skip the generation altogether, neither generating model nor query object,\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipOperations?: boolean;\n /**\n * Model properties have explaining comments by default.\n * With this option you can turn that off.\n */\n skipComments?: boolean;\n /**\n * With OData you can read, update and delete data on a primitive property (`Edm.*`).\n * Usually, you wouldn't do that, but go for a bigger request, fetching more relevant information in one go.\n *\n * There's one exception: Handling `Edm.Stream´ properties and Media entities. Services for stream / media\n * stuff are generated regardless of this setting.\n */\n enablePrimitivePropertyServices?: boolean;\n\n /**\n * The naming options regarding the generated artefacts.\n */\n naming?: OverridableNamingOptions;\n\n /**\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\n * an object with the property \"results\" is wrapped around the entity collection.\n *\n * If you're using the odata client then there's a build-in workaround in place which transforms\n * the results to remove this extra mapping. However, if you're only interested in the types, then\n * the generated models will not match that extra wrapping.\n *\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\n * wrapping to the generated models. But this option is only valid if the generation mode is set\n * to <code>models</code>; it is ignored otherwise.\n */\n v2ModelsWithExtraResultsWrapping?: boolean;\n /**\n * Numbers of type `Edm.Int64` and `Edm.Decimal` are represented as `number` in V4.\n * However, these numbers might not fit into JS' number type, which might result in precision loss.\n *\n * OData offers a special IEEE754 format option to get those types as `string` instead to prevent any\n * precision loss. So if you're handling very large or very small numbers (JS roughly supports 15 digits),\n * then you should use this option and, probably, also an appropriate converter (see available converters).\n *\n * Activating this option affects the type generation and will use `string` for both mentioned types.\n * All requests are executed with the \"accept\" header set to \"application/json;IEEE754Compatible=true\".\n * Additionally, when sending data the very same value will be set for the \"content-type\" header.\n */\n v4BigNumberAsString?: boolean;\n /**\n * OData allows for namespaces so any entity is unique by virtue of it's name within a namespace.\n * odata2ts works with these fully qualified names internally, but only uses the plain name when generating\n * stuff. This might lead to name clashes (same name in different namespaces).\n *\n * odata2ts employs a simple, automatic resolution strategy: Adding a counter at the end of the name.\n * Set this property to true in order to disable this automatism.\n */\n disableAutomaticNameClashResolution?: boolean;\n /**\n * By default, odata2ts generates a folder structure with individual files per entity.\n * This allows for handling and scaling the generation process for large data structures.\n *\n * However, especially UI5 has problems with recursive structures, which are absolutely valid within\n * OData. Here the solution is to generate only one file per type to circumvent cyclic imports.\n * To enable this behaviour set this option to true.\n */\n bundledFileGeneration?: boolean;\n /**\n * By default, odata2ts generates string enums.\n * With this option you can also generate numeric enums or a simple string union type.\n */\n enumType?: \"string\" | \"numeric\" | \"string-union\";\n}\n\n/**\n * Custom generation options which are dependent on a specific odata service.\n */\nexport interface ServiceGenerationOptions\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\n Pick<CliOptions, \"sourceUrl\" | \"refreshFile\">,\n Omit<ConfigFileOptions, \"services\"> {\n /**\n * Configure generation process for individual properties based on their name.\n */\n propertiesByName?: Array<PropertyGenerationOptions>;\n /**\n * Rename any EntityType, ComplexType, EnumType, Function or Action.\n *\n * You must match the simple name (e.g. \"Person\") or the fully qualified name\n * (e.g. \"Trippin.Person\") exactly. Alternatively, you can rename a bunch of types\n * by using regular expressions.\n *\n * By providing additional type information via the \"type\" attribute you get even more options which only apply\n * to the given type.\n */\n byTypeAndName?: Array<ComplexTypeGenerationOptions | EntityTypeGenerationOptions | GenericTypeGenerationOptions>;\n}\n\n/**\n * Available options for the actual generation run.\n * Every property is required, except the overriding service name.\n */\nexport interface RunOptions\n extends Required<Omit<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\">>,\n Pick<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\"> {\n naming: NameSettings;\n}\n\nexport interface RenameOptions {\n /**\n * Matcher for the name of any EntityType, ComplexType, EnumType, Function or Action\n * as it is stated in the EDMX model, e.g. \"Person\". As OData supports namespaces\n * you can also use the fully qualified name (including the namespace) to address any model,\n * e.g. \"Trippin.Person\". You can also match properties by their name.\n *\n * If the name is specified as plain string, it must match either the name or the fully qualified name\n * exactly (case-sensitive).\n *\n * Alternatively, a regular expression can be used which is always applied to the fully qualified name\n * (e.g. Trippin.Person). The regular expression must match the whole string\n * (e.g. `/Person/` won't do, `/.*\\.Person/` would work).\n *\n * To make regular expressions useful, captured groups are also supported in combination with\n * the `mappedName` attribute.\n */\n name: string | RegExp;\n\n /**\n * If specified, this attribute value is used as final name for the matched name as it will\n * appear in the generated typescript.\n *\n * When using a regular expression for matching the name, then captured groups can be referenced\n * as usual via $1, $2, etc. For example:\n * - name: /Trippin\\.(.+)/\n * - mappedName: \"T_$1\"\n * The result would be \"T_Person\".\n */\n mappedName?: string;\n}\n\nexport type TypeBasedGenerationOptions =\n | GenericTypeGenerationOptions\n | ComplexTypeGenerationOptions\n | EntityTypeGenerationOptions;\n\nexport interface GenericTypeGenerationOptions extends RenameOptions {\n type:\n | TypeModel.Any\n | TypeModel.EnumType\n | TypeModel.OperationType\n | TypeModel.OperationImportType\n | TypeModel.Singleton\n | TypeModel.EntitySet;\n}\n\nexport interface ComplexTypeGenerationOptions extends RenameOptions {\n type: TypeModel.ComplexType;\n\n /**\n * Configuration of individual properties.\n */\n properties?: Array<PropertyGenerationOptions>;\n\n // converter: string | Array<string>\n}\n\n/**\n * Configuration options for EntityTypes and ComplexTypes.\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\n */\nexport interface EntityTypeGenerationOptions extends Omit<ComplexTypeGenerationOptions, \"type\"> {\n type: TypeModel.EntityType;\n\n /**\n * Overwrite the key specification by naming the props by their EDMX name.\n */\n keys?: Array<string>;\n\n /**\n * Whether the generated service should allow for querying this model.\n * True by default.\n */\n // queryable?: boolean;\n /**\n * Whether the generated service should allow for creating new models (POST).\n * True by default.\n */\n // creatable?: boolean;\n /**\n * Whether the generated service should allow for updates (PUT).\n * True by default.\n */\n // updatable?: boolean;\n /**\n * Whether the generated service should allow for partial updates (PATCH).\n * True by default.\n */\n // patchable?: boolean;\n /**\n * Whether the generated service should allow for deletion.\n * True by default.\n */\n // deletable?: boolean;\n}\n\n/**\n * All configuration options for properties of models.\n */\nexport interface PropertyGenerationOptions extends RenameOptions {\n /**\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\n * Hence, they are left out of the editable model versions.\n */\n managed?: boolean;\n\n /**\n * TODO\n *\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\n * as well it's i\n * and their ids, e.g. \"timeToDurationConverter\".\n *\n * To only use specific converters, the object syntax must be used, where supported converters\n * must be listed by their ids.\n */\n // converters?: Array<Required<TypeConverterConfig>>;\n}\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\";\nimport { AxiosRequestConfig } from \"axios\";\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel.js\";\nimport { TypeModel } from \"./TypeModel.js\";\n\n/**\n * Generation mode, by default \"all\".\n */\nexport enum Modes {\n models,\n qobjects,\n service,\n all,\n}\n\n/**\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\n */\nexport enum EmitModes {\n ts = \"ts\",\n js = \"js\",\n dts = \"dts\",\n js_dts = \"js_dts\",\n}\n\n/**\n * Config options for CLI.\n */\nexport interface CliOptions {\n /**\n * The URL to the root of your OData service. The URL might end in a slash or not, it might also end\n * in $metadata, but we usually add this for you.\n *\n * Specifying the URL is a convenience feature to download the metadata file from the given URL.\n * You can configure this request via `sourceConfig` option.\n *\n * The `source` option must still be specified as it is used to store the downloaded file on your disk.\n * By default, the file is used once it has been downloaded.\n */\n sourceUrl?: string;\n /**\n * Downloads the metadata file and overwrites the existing one, if any.\n *\n * Only takes effect, if option `sourceUrl` is specified.\n */\n refreshFile?: boolean;\n /**\n * The source is the file to use (must be an EDMX compliant XML file) or the URL to the\n * metadata (ROOT_SERVICE/$metadata).\n *\n * If not specified, at least one service must be configured in config file.\n */\n source?: string;\n /**\n * Specifies the output directory for the generated stuff.\n *\n * If not specified, at least one service must be configured in config file.\n */\n output?: string;\n /**\n * Only generates the specified services.\n * Relies on an existing config file where these service names are maintained.\n */\n services?: Array<string>;\n /**\n * Specifies what to generate:\n * - {@code Modes.models} will only generate TS interfaces\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\n * - {@code Modes.service} will generate one main OData service client and one per each entity\n * - {@code Modes.all} the same as {@code Modes.service}\n *\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\n * Defaults to {@code Modes.all}\n */\n mode?: Modes;\n /**\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\n * Defaults to {@code EmitModes.js_dts}\n */\n emitMode?: EmitModes;\n /**\n * Uses prettier with your local configuration to pretty print TypeScript files.\n * Only applies if mode is set to {@code EmitModes.ts}.\n */\n prettier?: boolean;\n /**\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\n * This option allows to specify an alternative file.\n *\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\n */\n tsconfig?: string;\n /**\n * Verbose debugging information.\n */\n debug?: boolean;\n /**\n * Overrides the service name found in the source file.\n *\n * The service name is the basis for all file names and the name of the main OData client service\n * that serves as entry point for the user.\n */\n serviceName?: string;\n /**\n * odata2ts will automatically decide if a key prop is managed on the server side.\n * If managed, the property will not be editable (create, update, patch).\n * The following rule applies:\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\n * in ony other case the prop is unmanaged.\n */\n disableAutoManagedKey?: boolean;\n /**\n * By default, odata2ts doesn't change param, operation, property or model names.\n * The generated models and their properties are named exactly as advertised by the server.\n *\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\n *\n * The naming configuration allows to control this and other naming related settings.\n * Note: Even if renaming is disabled, model prefixing / suffixing still applies.\n */\n allowRenaming?: boolean;\n}\n\n/**\n * Configuration options of the request to retrieve the metadata.\n * Only takes effect if `source` is a URL.\n */\nexport interface UrlSourceConfiguration {\n /**\n * Basic auth credentials: the username.\n * Only takes effect if `password` has also been set.\n */\n username?: string;\n /**\n * Basic auth credentials: the password.\n * Only takes effect if `username` has also been set.\n */\n password?: string;\n /**\n * Custom request configuration.\n * URL and method `GET` are set by default, but can be overwritten.\n */\n custom?: AxiosRequestConfig;\n}\n\n/**\n * Available options for configuration files, i.e. odata2ts.config.ts.\n */\nexport interface ConfigFileOptions extends Omit<CliOptions, \"sourceUrl\" | \"source\" | \"output\" | \"services\"> {\n /**\n * Configuration options of the request to retrieve the metadata.\n * Only takes effect if `sourceUrl` is a URL.\n */\n sourceUrlConfig?: UrlSourceConfiguration;\n\n /**\n * Configuration of each service.\n *\n * @example { services: { trippin: { source: \"...\", ... } }}\n */\n services?: { [serviceName: string]: ServiceGenerationOptions };\n\n /**\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\n * Each converter knows which data type to map.\n *\n * To only use specific converters, the object syntax must be used, where supported converters\n * must be listed by their ids.\n */\n converters?: Array<string | TypeConverterConfig>;\n\n /**\n * For each model an editable version is generated which represents the model definition for\n * create, update and patch actions.\n *\n * You can skip the generation altogether, not generating editable model variants,\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipEditableModels?: boolean;\n\n /**\n * ID models are generated from entity id parameters.\n * The generation for one entity entails one model interface representing the id parameters and\n * one QId function which allows to format the parameters for URL usage and to parse parameters\n * from a URL string.\n *\n * You can skip the generation altogether, not generating models and QId objects, if the\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipIdModels?: boolean;\n /**\n * Operations are functions and actions of the OData service.\n * The generation for one operation entails one parameter model interface\n * and one QFunction / QAction class.\n *\n * You can skip the generation altogether, neither generating model nor query object,\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipOperations?: boolean;\n /**\n * Model properties have explaining comments by default.\n * With this option you can turn that off.\n */\n skipComments?: boolean;\n /**\n * With OData you can read, update and delete data on a primitive property (`Edm.*`).\n * Usually, you wouldn't do that, but go for a bigger request, fetching more relevant information in one go.\n *\n * There's one exception: Handling `Edm.Stream´ properties and Media entities. Services for stream / media\n * stuff are generated regardless of this setting.\n */\n enablePrimitivePropertyServices?: boolean;\n\n /**\n * The naming options regarding the generated artefacts.\n */\n naming?: OverridableNamingOptions;\n\n /**\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\n * an object with the property \"results\" is wrapped around the entity collection.\n *\n * If you're using the odata client then there's a build-in workaround in place which transforms\n * the results to remove this extra mapping. However, if you're only interested in the types, then\n * the generated models will not match that extra wrapping.\n *\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\n * wrapping to the generated models. But this option is only valid if the generation mode is set\n * to <code>models</code>; it is ignored otherwise.\n */\n v2ModelsWithExtraResultsWrapping?: boolean;\n /**\n * Numbers of type `Edm.Int64` and `Edm.Decimal` are represented as `number` in V4.\n * However, these numbers might not fit into JS' number type, which might result in precision loss.\n *\n * OData offers a special IEEE754 format option to get those types as `string` instead to prevent any\n * precision loss. So if you're handling very large or very small numbers (JS roughly supports 15 digits),\n * then you should use this option and, probably, also an appropriate converter (see available converters).\n *\n * Activating this option affects the type generation and will use `string` for both mentioned types.\n * All requests are executed with the \"accept\" header set to \"application/json;IEEE754Compatible=true\".\n * Additionally, when sending data the very same value will be set for the \"content-type\" header.\n */\n v4BigNumberAsString?: boolean;\n /**\n * OData allows for namespaces so any entity is unique by virtue of it's name within a namespace.\n * odata2ts works with these fully qualified names internally, but only uses the plain name when generating\n * stuff. This might lead to name clashes (same name in different namespaces).\n *\n * odata2ts employs a simple, automatic resolution strategy: Adding a counter at the end of the name.\n * Set this property to true in order to disable this automatism.\n */\n disableAutomaticNameClashResolution?: boolean;\n /**\n * By default, odata2ts generates a folder structure with individual files per entity.\n * This allows for handling and scaling the generation process for large data structures.\n *\n * However, especially UI5 has problems with recursive structures, which are absolutely valid within\n * OData. Here the solution is to generate only one file per type to circumvent cyclic imports.\n * To enable this behaviour set this option to true.\n */\n bundledFileGeneration?: boolean;\n /**\n * By default, odata2ts generates string enums.\n * With this option you can also generate numeric enums or a simple string union type.\n */\n enumType?: \"string\" | \"numeric\" | \"string-union\";\n /**\n * By default, odata2ts emulates the in operator by rolling it out as a series of equals-or-expressions.\n * This allows for maximum compatibility with all V4 services, as well as V2 services.\n * \n * Setting this value to true will instead use the native in operator, resulting in smaller queries\n * on V4 services that support it.\n */\n enableNativeInOperator?: boolean;\n}\n\n/**\n * Custom generation options which are dependent on a specific odata service.\n */\nexport interface ServiceGenerationOptions\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\n Pick<CliOptions, \"sourceUrl\" | \"refreshFile\">,\n Omit<ConfigFileOptions, \"services\"> {\n /**\n * Configure generation process for individual properties based on their name.\n */\n propertiesByName?: Array<PropertyGenerationOptions>;\n /**\n * Rename any EntityType, ComplexType, EnumType, Function or Action.\n *\n * You must match the simple name (e.g. \"Person\") or the fully qualified name\n * (e.g. \"Trippin.Person\") exactly. Alternatively, you can rename a bunch of types\n * by using regular expressions.\n *\n * By providing additional type information via the \"type\" attribute you get even more options which only apply\n * to the given type.\n */\n byTypeAndName?: Array<ComplexTypeGenerationOptions | EntityTypeGenerationOptions | GenericTypeGenerationOptions>;\n}\n\n/**\n * Available options for the actual generation run.\n * Every property is required, except the overriding service name.\n */\nexport interface RunOptions\n extends Required<Omit<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\">>,\n Pick<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\"> {\n naming: NameSettings;\n}\n\nexport interface RenameOptions {\n /**\n * Matcher for the name of any EntityType, ComplexType, EnumType, Function or Action\n * as it is stated in the EDMX model, e.g. \"Person\". As OData supports namespaces\n * you can also use the fully qualified name (including the namespace) to address any model,\n * e.g. \"Trippin.Person\". You can also match properties by their name.\n *\n * If the name is specified as plain string, it must match either the name or the fully qualified name\n * exactly (case-sensitive).\n *\n * Alternatively, a regular expression can be used which is always applied to the fully qualified name\n * (e.g. Trippin.Person). The regular expression must match the whole string\n * (e.g. `/Person/` won't do, `/.*\\.Person/` would work).\n *\n * To make regular expressions useful, captured groups are also supported in combination with\n * the `mappedName` attribute.\n */\n name: string | RegExp;\n\n /**\n * If specified, this attribute value is used as final name for the matched name as it will\n * appear in the generated typescript.\n *\n * When using a regular expression for matching the name, then captured groups can be referenced\n * as usual via $1, $2, etc. For example:\n * - name: /Trippin\\.(.+)/\n * - mappedName: \"T_$1\"\n * The result would be \"T_Person\".\n */\n mappedName?: string;\n}\n\nexport type TypeBasedGenerationOptions =\n | GenericTypeGenerationOptions\n | ComplexTypeGenerationOptions\n | EntityTypeGenerationOptions;\n\nexport interface GenericTypeGenerationOptions extends RenameOptions {\n type:\n | TypeModel.Any\n | TypeModel.EnumType\n | TypeModel.OperationType\n | TypeModel.OperationImportType\n | TypeModel.Singleton\n | TypeModel.EntitySet;\n}\n\nexport interface ComplexTypeGenerationOptions extends RenameOptions {\n type: TypeModel.ComplexType;\n\n /**\n * Configuration of individual properties.\n */\n properties?: Array<PropertyGenerationOptions>;\n\n // converter: string | Array<string>\n}\n\n/**\n * Configuration options for EntityTypes and ComplexTypes.\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\n */\nexport interface EntityTypeGenerationOptions extends Omit<ComplexTypeGenerationOptions, \"type\"> {\n type: TypeModel.EntityType;\n\n /**\n * Overwrite the key specification by naming the props by their EDMX name.\n */\n keys?: Array<string>;\n\n /**\n * Whether the generated service should allow for querying this model.\n * True by default.\n */\n // queryable?: boolean;\n /**\n * Whether the generated service should allow for creating new models (POST).\n * True by default.\n */\n // creatable?: boolean;\n /**\n * Whether the generated service should allow for updates (PUT).\n * True by default.\n */\n // updatable?: boolean;\n /**\n * Whether the generated service should allow for partial updates (PATCH).\n * True by default.\n */\n // patchable?: boolean;\n /**\n * Whether the generated service should allow for deletion.\n * True by default.\n */\n // deletable?: boolean;\n}\n\n/**\n * All configuration options for properties of models.\n */\nexport interface PropertyGenerationOptions extends RenameOptions {\n /**\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\n * Hence, they are left out of the editable model versions.\n */\n managed?: boolean;\n\n /**\n * TODO\n *\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\n * as well it's i\n * and their ids, e.g. \"timeToDurationConverter\".\n *\n * To only use specific converters, the object syntax must be used, where supported converters\n * must be listed by their ids.\n */\n // converters?: Array<Required<TypeConverterConfig>>;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { Modes, } from "../OptionModel.js";
|
|
3
3
|
import { DataModel, withNamespace } from "./DataModel.js";
|
|
4
|
+
import { QueryObjectTypes } from "./QueryObjectTypes.js";
|
|
4
5
|
import { ServiceConfigHelper } from "./ServiceConfigHelper.js";
|
|
5
6
|
import { NameClashValidator } from "./validation/NameClashValidator.js";
|
|
6
7
|
import { NoopValidator } from "./validation/NoopValidator.js";
|
|
@@ -43,6 +44,7 @@ export class Digester {
|
|
|
43
44
|
const modelType = this.model2Type.get(odataDataType);
|
|
44
45
|
const [dataTypeName, dataTypePrefix] = this.namingHelper.getNameAndServicePrefix(odataDataType);
|
|
45
46
|
const dataTypeNamespace = [dataTypePrefix];
|
|
47
|
+
const isComplexType = modelType === "ComplexType" /* DataTypes.ComplexType */;
|
|
46
48
|
if (!modelType) {
|
|
47
49
|
throw new Error(`Couldn't determine model type (EntityType, ComplexType, etc) for property "${p.$.Name}"! Given data type: "${odataDataType}".`);
|
|
48
50
|
}
|
|
@@ -53,21 +55,37 @@ export class Digester {
|
|
|
53
55
|
result = {
|
|
54
56
|
dataType: modelType,
|
|
55
57
|
type: this.namingHelper.getEnumName((_a = enumConfig === null || enumConfig === void 0 ? void 0 : enumConfig.mappedName) !== null && _a !== void 0 ? _a : odataDataType),
|
|
56
|
-
qPath:
|
|
57
|
-
|
|
58
|
+
qPath: isCollection
|
|
59
|
+
? isNumericEnum
|
|
60
|
+
? QueryObjectTypes.QNumericEnumCollectionPath
|
|
61
|
+
: QueryObjectTypes.QEnumCollectionPath
|
|
62
|
+
: isNumericEnum
|
|
63
|
+
? QueryObjectTypes.QNumericEnumPath
|
|
64
|
+
: QueryObjectTypes.QEnumPath,
|
|
65
|
+
qObject: isCollection
|
|
66
|
+
? isNumericEnum
|
|
67
|
+
? QueryObjectTypes.QNumericEnumCollection
|
|
68
|
+
: QueryObjectTypes.QEnumCollection
|
|
69
|
+
: undefined,
|
|
58
70
|
qParam: isNumericEnum ? "QNumericEnumParam" : "QEnumParam",
|
|
59
71
|
};
|
|
60
72
|
}
|
|
61
73
|
// handling of complex & entity types
|
|
62
74
|
else {
|
|
63
|
-
const entityConfig =
|
|
75
|
+
const entityConfig = isComplexType
|
|
64
76
|
? this.serviceConfigHelper.findComplexTypeConfig(dataTypeNamespace, dataTypeName)
|
|
65
77
|
: this.serviceConfigHelper.findEntityTypeConfig(dataTypeNamespace, dataTypeName);
|
|
66
78
|
const typeName = (_b = entityConfig === null || entityConfig === void 0 ? void 0 : entityConfig.mappedName) !== null && _b !== void 0 ? _b : odataDataType;
|
|
67
79
|
result = {
|
|
68
80
|
dataType: modelType,
|
|
69
81
|
type: this.namingHelper.getModelName(typeName),
|
|
70
|
-
qPath:
|
|
82
|
+
qPath: isCollection
|
|
83
|
+
? isComplexType
|
|
84
|
+
? QueryObjectTypes.QComplexCollectionPath
|
|
85
|
+
: QueryObjectTypes.QEntityCollectionPath
|
|
86
|
+
: isComplexType
|
|
87
|
+
? QueryObjectTypes.QComplexPath
|
|
88
|
+
: QueryObjectTypes.QEntityPath,
|
|
71
89
|
qObject: this.namingHelper.getQName(typeName),
|
|
72
90
|
qParam: "QComplexParam",
|
|
73
91
|
};
|
|
@@ -82,7 +100,7 @@ export class Digester {
|
|
|
82
100
|
dataType: "PrimitiveType" /* DataTypes.PrimitiveType */,
|
|
83
101
|
type,
|
|
84
102
|
typeModule,
|
|
85
|
-
qPath,
|
|
103
|
+
qPath: isCollection ? QueryObjectTypes.QCollectionPath : qPath,
|
|
86
104
|
qParam,
|
|
87
105
|
qObject: isCollection ? qCollection : undefined,
|
|
88
106
|
converters,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataModelDigestion.js","sourceRoot":"","sources":["../../src/data-model/DataModelDigestion.ts"],"names":[],"mappings":";AAEA,OAAO,EAGL,KAAK,GAEN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAsB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAY9E,OAAO,EAAE,mBAAmB,EAAe,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAQ9D,SAAS,MAAM,CAAC,KAAyB;IACvC,OAAO,KAAK,KAAK,MAAM,CAAC;AAC1B,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,KAAK,KAAK,OAAO,CAAC;AAC3B,CAAC;AASD,MAAM,OAAgB,QAAQ;IAY5B,YACY,OAAqB,EACrB,OAAiB,EACjB,OAAyB,EACzB,YAA0B,EACpC,UAAkC;QAJxB,YAAO,GAAP,OAAO,CAAc;QACrB,YAAO,GAAP,OAAO,CAAU;QACjB,YAAO,GAAP,OAAO,CAAkB;QACzB,iBAAY,GAAZ,YAAY,CAAc;QATtC;;WAEG;QACK,eAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;QAsYxC,YAAO,GAAG,CAAC,CAA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AW,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAqB,CAAC;YAExE,yCAAyC;YACzC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;gBACvB,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aACpE;YACD,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAEzD,YAAY;YACZ,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;;AAngBgB,mBAAU,GAAG,MAAM,AAAT,CAAU","sourcesContent":["import { MappedConverterChains } from \"@odata2ts/converter-runtime\";\nimport type { DigestionOptions } from \"../FactoryFunctionModel.js\";\nimport {\n ComplexTypeGenerationOptions,\n EntityTypeGenerationOptions,\n Modes,\n PropertyGenerationOptions,\n} from \"../OptionModel.js\";\nimport { DataModel, NamespaceWithAlias, withNamespace } from \"./DataModel.js\";\nimport {\n ComplexType as ComplexModelType,\n DataTypes,\n EntityType as EntityModelType,\n ODataVersion,\n PropertyModel,\n} from \"./DataTypeModel.js\";\nimport { ComplexType, EntityType, EnumType, Property, Schema, TypeDefinition } from \"./edmx/ODataEdmxModelBase.js\";\nimport { EntityContainerV3, SchemaV3 } from \"./edmx/ODataEdmxModelV3.js\";\nimport { EntityContainerV4, SchemaV4 } from \"./edmx/ODataEdmxModelV4.js\";\nimport { NamingHelper } from \"./NamingHelper.js\";\nimport { ServiceConfigHelper, WithoutName } from \"./ServiceConfigHelper.js\";\nimport { NameClashValidator } from \"./validation/NameClashValidator.js\";\nimport { NameValidator } from \"./validation/NameValidator.js\";\nimport { NoopValidator } from \"./validation/NoopValidator.js\";\n\ntype CollectorTuple = [\n Array<PropertyModel>,\n Array<string>,\n { fqIdName: string; idName: string; qIdName: string; open: boolean },\n];\n\nfunction ifTrue(value: string | undefined): boolean {\n return value === \"true\";\n}\n\nfunction ifFalse(value: string | undefined): boolean {\n return value === \"false\";\n}\n\nexport interface TypeModel {\n outputType: string;\n qPath: string;\n qCollection: string;\n qParam: string | undefined;\n}\n\nexport abstract class Digester<S extends Schema<ET, CT>, ET extends EntityType, CT extends ComplexType> {\n protected static EDM_PREFIX = \"Edm.\";\n\n protected readonly dataModel: DataModel;\n protected readonly serviceConfigHelper: ServiceConfigHelper;\n protected readonly nameValidator: NameValidator;\n\n /**\n * Reverse mapping from fqName to data type: EntityType, ComplexType, EnumType, or Primitive Type.\n */\n private model2Type = new Map<string, DataTypes>();\n\n protected constructor(\n protected version: ODataVersion,\n protected schemas: Array<S>,\n protected options: DigestionOptions,\n protected namingHelper: NamingHelper,\n converters?: MappedConverterChains,\n ) {\n const namespaces = schemas.map<NamespaceWithAlias>((s) => [s.$.Namespace, s.$.Alias]);\n this.dataModel = new DataModel(namespaces, version, converters);\n this.serviceConfigHelper = new ServiceConfigHelper(options);\n this.nameValidator = options.bundledFileGeneration ? new NameClashValidator(options) : new NoopValidator();\n\n this.collectModelTypes(schemas);\n }\n\n private collectModelTypes(schemas: Array<S>) {\n schemas.forEach((schema) => {\n const { Namespace: ns, Alias: alias } = schema.$;\n\n schema.EnumType?.forEach((et) => {\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.EnumType);\n });\n schema.ComplexType?.forEach((ct) => {\n this.addModel2Type(ns, alias, ct.$.Name, DataTypes.ComplexType);\n });\n schema.EntityType?.forEach((et) => {\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.ModelType);\n });\n });\n }\n\n private addModel2Type(ns: string, alias: string | undefined, name: string, dt: DataTypes) {\n this.model2Type.set(withNamespace(ns, name), dt);\n if (alias) {\n this.model2Type.set(withNamespace(alias, name), dt);\n }\n }\n\n protected abstract getNavigationProps(entityType: ET | ComplexType): Array<Property>;\n\n protected abstract digestOperations(schema: SchemaV3 | SchemaV4): void;\n\n protected abstract digestEntityContainer(schema: SchemaV3 | SchemaV4): void;\n\n /**\n * Get essential infos about a given odata type from the version specific service variants.\n *\n * @param type\n * @return tuple of return type, query object, query collection object\n */\n protected abstract mapODataType(type: string): TypeModel;\n\n public async digest(): Promise<DataModel> {\n this.digestEntityTypesAndOperations();\n\n // delegate to version specific entity container digestion\n this.schemas.forEach((schema) => this.digestEntityContainer(schema));\n\n this.dataModel.setNameValidation(this.nameValidator.validate());\n return this.dataModel;\n }\n\n private digestEntityTypesAndOperations() {\n this.schemas.forEach((schema) => {\n const ns: NamespaceWithAlias = [schema.$.Namespace, schema.$.Alias];\n\n // type definitions: alias for primitive types\n this.addTypeDefinition(schema.$.Namespace, schema.TypeDefinition);\n\n // enums\n this.addEnum(ns, schema.EnumType);\n\n // complex types\n this.addComplexType(ns, schema.ComplexType);\n\n // entity types\n this.addEntityType(ns, schema.EntityType);\n\n // V4 only: function & action types\n this.digestOperations(schema);\n });\n\n this.postProcessModel();\n this.postProcessKeys();\n\n this.schemas.forEach((schema) => {\n this.analyzeModelUsage(schema.EntityContainer?.length ? schema.EntityContainer[0] : undefined);\n });\n }\n\n private getBaseModel(\n entityConfig: WithoutName<EntityTypeGenerationOptions | ComplexTypeGenerationOptions> | undefined,\n model: ComplexType,\n namespace: string,\n name: string,\n fqName: string,\n ) {\n const odataName = model.$.Name;\n\n // map properties respecting the config\n const props = [...(model.Property ?? []), ...this.getNavigationProps(model)].map((p) => {\n const epConfig = entityConfig?.properties?.find((ep) => ep.name === p.$.Name);\n return this.mapProp(p, epConfig);\n });\n\n // support for base types, i.e. extends clause of interfaces\n const baseClasses = [];\n let finalBaseClass: string | undefined = undefined;\n if (model.$.BaseType) {\n baseClasses.push(model.$.BaseType);\n const [baseName, basePrefix] = this.namingHelper.getNameAndServicePrefix(model.$.BaseType);\n const baseConfig =\n this.serviceConfigHelper.findEntityTypeConfig([basePrefix!], baseName) ||\n this.serviceConfigHelper.findComplexTypeConfig([basePrefix!], baseName);\n finalBaseClass = baseConfig?.mappedName ?? baseName;\n }\n\n return {\n fqName,\n odataName,\n name,\n modelName: this.namingHelper.getModelName(name),\n qName: this.namingHelper.getQName(name),\n editableName: this.namingHelper.getEditableModelName(name),\n serviceName: this.namingHelper.getServiceName(name),\n serviceCollectionName: this.namingHelper.getCollectionServiceName(name),\n folderPath: this.namingHelper.getFolderPath(namespace, name),\n baseClasses,\n finalBaseClass,\n props,\n baseProps: [], // postprocess required\n abstract: ifTrue(model.$.Abstract),\n open: ifTrue(model.$.OpenType),\n genMode: Modes.qobjects,\n subtypes: new Set(),\n } satisfies Partial<ComplexModelType>;\n }\n\n private addTypeDefinition(ns: string, types: Array<TypeDefinition> | undefined) {\n if (!types || !types.length) {\n return;\n }\n\n for (const t of types) {\n this.dataModel.addTypeDefinition(ns, t.$.Name, t.$.UnderlyingType);\n }\n }\n\n private addEnum(namespace: NamespaceWithAlias, models: Array<EnumType> | undefined) {\n if (!models || !models.length) {\n return;\n }\n\n for (const et of models) {\n const odataName = et.$.Name;\n const fqName = withNamespace(namespace[0], odataName);\n const config = this.serviceConfigHelper.findEnumTypeConfig(namespace, odataName);\n const enumName = this.nameValidator.addEnumType(fqName, config?.mappedName || odataName);\n const filePath = this.namingHelper.getFolderPath(namespace[0], enumName);\n this.dataModel.addEnum(namespace[0], odataName, {\n fqName,\n odataName,\n name: enumName,\n modelName: this.namingHelper.getEnumName(enumName),\n folderPath: filePath,\n members: et.Member?.length ? et.Member.map((m) => ({ name: m.$.Name, value: m.$.Value })) : [],\n });\n }\n }\n\n private addComplexType(namespace: NamespaceWithAlias, models: Array<ComplexType> | undefined) {\n if (!models || !models.length) {\n return;\n }\n\n for (const model of models) {\n const config = this.serviceConfigHelper.findComplexTypeConfig(namespace, model.$.Name);\n const fqName = withNamespace(namespace[0], model.$.Name);\n const name = this.nameValidator.addComplexType(fqName, config?.mappedName || model.$.Name);\n const baseModel = this.getBaseModel(config, model, namespace[0], name, fqName);\n this.dataModel.addComplexType(namespace[0], baseModel.odataName, baseModel);\n }\n }\n\n private addEntityType(namespace: NamespaceWithAlias, models: Array<ET> | undefined) {\n if (!models || !models.length) {\n return;\n }\n\n for (const model of models) {\n const entityConfig = this.serviceConfigHelper.findEntityTypeConfig(namespace, model.$.Name);\n const fqName = withNamespace(namespace[0], model.$.Name);\n const name = this.nameValidator.addEntityType(fqName, entityConfig?.mappedName || model.$.Name);\n const baseModel = this.getBaseModel(entityConfig, model, namespace[0], name, fqName);\n\n // key support: we add keys from this entity,\n // but not keys stemming from base classes (postprocess required)\n const keyNames: Array<string> = [];\n if (entityConfig?.keys?.length) {\n keyNames.push(...entityConfig.keys);\n } else {\n const entity = model as EntityType;\n if (entity.Key && entity.Key.length && entity.Key[0].PropertyRef.length) {\n const propNames = entity.Key[0].PropertyRef.map((key) => key.$.Name);\n keyNames.push(...propNames);\n }\n }\n\n this.dataModel.addEntityType(namespace[0], baseModel.odataName, {\n ...baseModel,\n id: {\n fqName: baseModel.fqName,\n modelName: this.namingHelper.getIdModelName(name),\n qName: this.namingHelper.getQIdFunctionName(name),\n },\n generateId: !!keyNames.length,\n keyNames: keyNames, // postprocess required to include key specs from base classes\n keys: [], // postprocess required to include props from base classes\n getKeyUnion: () => keyNames.join(\" | \"),\n subtypes: new Set(),\n });\n }\n }\n\n /**\n * Check that models (ComplexType or EntityType) have been referenced in the API\n * as entry point or via navProp or by virtue of being a base type or subtype of those.\n * For these models one or two services are generated.\n *\n * In this way unnecessary service generation is prevented. For example, complex types that\n * are only referenced as response of an operation do not need a generated service.\n *\n * @param ec\n * @private\n */\n private analyzeModelUsage(ec: EntityContainerV3 | EntityContainerV4 | undefined) {\n if (ec?.EntitySet?.length) {\n ec.EntitySet.forEach((et) => this.analyze(et.$.EntityType));\n }\n const ec4 = ec as EntityContainerV4;\n if (ec4?.Singleton?.length) {\n ec4.Singleton.forEach((singleton) => this.analyze(singleton.$.Type));\n }\n }\n\n /**\n * Check usage of model types within API.\n *\n * @param fqModelName\n * @private\n */\n private analyze(fqModelName: string) {\n // to also resolve aliases the data model needs to be used\n const model = this.dataModel.getEntityType(fqModelName) ?? this.dataModel.getComplexType(fqModelName);\n if (!model?.fqName || model.genMode === Modes.service) {\n return;\n }\n\n model.genMode = Modes.service;\n\n if (model) {\n // respect base classes\n if (model.baseClasses.length) {\n this.analyze(model.baseClasses[0]);\n }\n // include subtypes since each base class can be cast to its subtypes\n model.subtypes.forEach((subtype) => {\n this.analyze(subtype);\n });\n model?.props.forEach((p) => {\n if (p.dataType === DataTypes.ComplexType || p.dataType === DataTypes.ModelType) {\n this.analyze(p.fqType);\n }\n });\n }\n }\n\n private postProcessModel() {\n // complex types\n const complexTypes = this.dataModel.getComplexTypes();\n complexTypes.forEach((ct) => {\n // build up set of subtypes for each complex type\n this.addSubtypes(ct);\n\n // get props & keys from base types\n const [baseProps, _, baseAttributes] = this.collectBaseClassPropsAndKeys(ct, []);\n const { open } = baseAttributes;\n ct.baseProps = baseProps.map((bp) => ({ ...bp }));\n if (open) {\n ct.open = true;\n }\n });\n // entity types\n const entityTypes = this.dataModel.getEntityTypes();\n entityTypes.forEach((et) => {\n // build up set of subtypes for each entity type\n this.addSubtypes(et);\n\n // get props & keys from base types\n const [baseProps, baseKeys, baseAttributes] = this.collectBaseClassPropsAndKeys(et, []);\n const { fqIdName, idName, qIdName, open } = baseAttributes;\n et.baseProps = baseProps.map((bp) => ({ ...bp }));\n\n if (!et.keyNames.length && idName) {\n et.id = {\n fqName: fqIdName,\n modelName: idName,\n qName: qIdName,\n };\n et.generateId = false;\n }\n if (open) {\n et.open = open;\n }\n et.keyNames.unshift(...baseKeys.filter((bk) => !et.keyNames.includes(bk)));\n });\n }\n\n private postProcessKeys() {\n const entityTypes = this.dataModel.getEntityTypes();\n entityTypes.forEach((et) => {\n const isSingleKey = et.keyNames.length === 1;\n const props = [...et.baseProps, ...et.props];\n et.keys = et.keyNames.map((keyName) => {\n const prop = props.find((p) => p.odataName === keyName);\n if (!prop) {\n throw new Error(`Key with name [${keyName}] not found in props!`);\n }\n\n // automatically set key prop to managed, if this is the only key of the given entity\n if (prop.managed === undefined) {\n prop.managed = !this.options.disableAutoManagedKey && isSingleKey;\n }\n\n return prop;\n });\n });\n }\n\n private collectBaseClassPropsAndKeys(model: ComplexModelType, visitedModels: string[]): CollectorTuple {\n if (visitedModels.includes(model.fqName)) {\n throw new Error(`Cyclic inheritance detected for model ${model.fqName}!`);\n }\n visitedModels.push(model.fqName);\n return model.baseClasses.reduce(\n ([props, keys, attributes], bc) => {\n const baseModel = this.dataModel.getEntityType(bc) || this.dataModel.getComplexType(bc);\n if (!baseModel) {\n throw new Error(`BaseModel \"${bc}\" doesn't exist!`);\n }\n\n let { fqIdName, idName, qIdName, open } = attributes;\n\n // recursive\n if (baseModel.baseClasses.length) {\n const [parentProps, parentKeys, parentAttributes] = this.collectBaseClassPropsAndKeys(\n baseModel,\n visitedModels,\n );\n props.unshift(...parentProps);\n keys.unshift(...parentKeys);\n if (parentAttributes?.idName) {\n fqIdName = parentAttributes.fqIdName;\n idName = parentAttributes.idName;\n qIdName = parentAttributes.qIdName;\n }\n if (parentAttributes?.open) {\n open = true;\n }\n }\n\n props.push(...baseModel.props);\n const entityModel = baseModel as EntityModelType;\n if (entityModel.keyNames?.length) {\n keys.push(...entityModel.keyNames.filter((kn) => !keys.includes(kn)));\n fqIdName = entityModel.id.fqName;\n idName = entityModel.id.modelName;\n qIdName = entityModel.id.qName;\n }\n if (baseModel.open) {\n open = true;\n }\n return [props, keys, { fqIdName, idName, qIdName, open }];\n },\n [[], [], { fqIdName: \"\", idName: \"\", qIdName: \"\", open: false }] as CollectorTuple,\n );\n }\n\n protected mapProp = (p: Property, entityPropConfig?: PropertyGenerationOptions | undefined): PropertyModel => {\n if (!p.$.Type) {\n throw new Error(`No type information given for property [${p.$.Name}]!`);\n }\n\n const configProp = this.serviceConfigHelper.findPropConfigByName(p.$.Name);\n const modelName = this.namingHelper.getModelPropName(\n entityPropConfig?.mappedName || configProp?.mappedName || p.$.Name,\n );\n const isCollection = !!p.$.Type.match(/^Collection\\(/);\n let odataDataType = p.$.Type.replace(/^Collection\\(([^\\)]+)\\)/, \"$1\");\n\n // support for primitive type mapping\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\n const dt = this.dataModel.getPrimitiveType(odataDataType);\n if (dt !== undefined) {\n odataDataType = dt;\n }\n }\n\n let result: Pick<PropertyModel, \"dataType\" | \"type\" | \"typeModule\" | \"qPath\" | \"qParam\" | \"qObject\" | \"converters\">;\n\n // domain object known from service:\n // EntityType, ComplexType, EnumType\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\n const modelType = this.model2Type.get(odataDataType)!;\n const [dataTypeName, dataTypePrefix] = this.namingHelper.getNameAndServicePrefix(odataDataType);\n const dataTypeNamespace: NamespaceWithAlias = [dataTypePrefix!];\n if (!modelType) {\n throw new Error(\n `Couldn't determine model type (EntityType, ComplexType, etc) for property \"${p.$.Name}\"! Given data type: \"${odataDataType}\".`,\n );\n }\n\n // special handling for enums\n if (modelType === DataTypes.EnumType) {\n const isNumericEnum = this.options.enumType === \"numeric\";\n const enumConfig = this.serviceConfigHelper.findEnumTypeConfig(dataTypeNamespace, dataTypeName);\n result = {\n dataType: modelType,\n type: this.namingHelper.getEnumName(enumConfig?.mappedName ?? odataDataType),\n qPath: isNumericEnum ? \"QNumericEnumPath\" : \"QEnumPath\",\n qObject: isCollection ? (isNumericEnum ? \"QNumericEnumCollection\" : \"QEnumCollection\") : undefined,\n qParam: isNumericEnum ? \"QNumericEnumParam\" : \"QEnumParam\",\n };\n }\n // handling of complex & entity types\n else {\n const entityConfig =\n modelType === DataTypes.ComplexType\n ? this.serviceConfigHelper.findComplexTypeConfig(dataTypeNamespace, dataTypeName)\n : this.serviceConfigHelper.findEntityTypeConfig(dataTypeNamespace, dataTypeName);\n const typeName = entityConfig?.mappedName ?? odataDataType;\n\n result = {\n dataType: modelType,\n type: this.namingHelper.getModelName(typeName),\n qPath: \"QEntityPath\",\n qObject: this.namingHelper.getQName(typeName),\n qParam: \"QComplexParam\",\n };\n }\n }\n // OData built-in data types\n else if (odataDataType.startsWith(Digester.EDM_PREFIX)) {\n const { outputType, qPath, qParam, qCollection } = this.mapODataType(odataDataType);\n const { to, toModule: typeModule, converters } = this.dataModel.getConverter(odataDataType) || {};\n\n const type = !to ? outputType : to.startsWith(Digester.EDM_PREFIX) ? this.mapODataType(to).outputType : to;\n\n result = {\n dataType: DataTypes.PrimitiveType,\n type,\n typeModule,\n qPath,\n qParam,\n qObject: isCollection ? qCollection : undefined,\n converters,\n };\n } else {\n throw new Error(\n `Unknown type [${odataDataType}]: Not 'Collection(...)', not OData type 'Edm.*', not starting with one of the namespaces!`,\n );\n }\n\n return {\n odataName: p.$.Name,\n name: modelName,\n odataType: p.$.Type,\n fqType: odataDataType,\n required: ifFalse(p.$.Nullable),\n isCollection: isCollection,\n managed: typeof entityPropConfig?.managed !== \"undefined\" ? entityPropConfig.managed : configProp?.managed,\n ...result,\n };\n };\n\n private addSubtypes(model: ComplexModelType, grandChildren = new Set<string>()) {\n if (!model.baseClasses.length) {\n return;\n }\n\n model.baseClasses.forEach((baseClass) => {\n const baseType = this.dataModel.getModel(baseClass) as ComplexModelType;\n\n // add subtypes & base name for q-objects\n baseType.subtypes.add(model.fqName);\n if (!baseType.qBaseName) {\n baseType.qBaseName = this.namingHelper.getQBaseName(baseType.name);\n }\n grandChildren.forEach((gc) => baseType.subtypes.add(gc));\n\n // recursive\n grandChildren.add(model.fqName);\n this.addSubtypes(baseType, grandChildren);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataModelDigestion.js","sourceRoot":"","sources":["../../src/data-model/Data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AAG,EAAU;QAC5E,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE;YAC7B,OAAO;SACR;QAED,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAqB,CAAC;YAExE,yCAAyC;YACzC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;gBACvB,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aACpE;YACD,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAEzD,YAAY;YACZ,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;;AAnhBgB,mBAAU,GAAG,MAAM,AAAT,CAAU","sourcesContent":["import { MappedConverterChains } from \"@odata2ts/converter-runtime\";\nimport type { DigestionOptions } from \"../FactoryFunctionModel.js\";\nimport {\n ComplexTypeGenerationOptions,\n EntityTypeGenerationOptions,\n Modes,\n PropertyGenerationOptions,\n} from \"../OptionModel.js\";\nimport { DataModel, NamespaceWithAlias, withNamespace } from \"./DataModel.js\";\nimport {\n ComplexType as ComplexModelType,\n DataTypes,\n EntityType as EntityModelType,\n ODataVersion,\n PropertyModel,\n} from \"./DataTypeModel.js\";\nimport { ComplexType, EntityType, EnumType, Property, Schema, TypeDefinition } from \"./edmx/ODataEdmxModelBase.js\";\nimport { EntityContainerV3, SchemaV3 } from \"./edmx/ODataEdmxModelV3.js\";\nimport { EntityContainerV4, SchemaV4 } from \"./edmx/ODataEdmxModelV4.js\";\nimport { NamingHelper } from \"./NamingHelper.js\";\nimport { QueryObjectTypes } from \"./QueryObjectTypes.js\";\nimport { ServiceConfigHelper, WithoutName } from \"./ServiceConfigHelper.js\";\nimport { NameClashValidator } from \"./validation/NameClashValidator.js\";\nimport { NameValidator } from \"./validation/NameValidator.js\";\nimport { NoopValidator } from \"./validation/NoopValidator.js\";\n\ntype CollectorTuple = [\n Array<PropertyModel>,\n Array<string>,\n { fqIdName: string; idName: string; qIdName: string; open: boolean },\n];\n\nfunction ifTrue(value: string | undefined): boolean {\n return value === \"true\";\n}\n\nfunction ifFalse(value: string | undefined): boolean {\n return value === \"false\";\n}\n\nexport interface TypeModel {\n outputType: string;\n qPath: string;\n qCollection: string;\n qParam: string | undefined;\n}\n\nexport abstract class Digester<S extends Schema<ET, CT>, ET extends EntityType, CT extends ComplexType> {\n protected static EDM_PREFIX = \"Edm.\";\n\n protected readonly dataModel: DataModel;\n protected readonly serviceConfigHelper: ServiceConfigHelper;\n protected readonly nameValidator: NameValidator;\n\n /**\n * Reverse mapping from fqName to data type: EntityType, ComplexType, EnumType, or Primitive Type.\n */\n private model2Type = new Map<string, DataTypes>();\n\n protected constructor(\n protected version: ODataVersion,\n protected schemas: Array<S>,\n protected options: DigestionOptions,\n protected namingHelper: NamingHelper,\n converters?: MappedConverterChains,\n ) {\n const namespaces = schemas.map<NamespaceWithAlias>((s) => [s.$.Namespace, s.$.Alias]);\n this.dataModel = new DataModel(namespaces, version, converters);\n this.serviceConfigHelper = new ServiceConfigHelper(options);\n this.nameValidator = options.bundledFileGeneration ? new NameClashValidator(options) : new NoopValidator();\n\n this.collectModelTypes(schemas);\n }\n\n private collectModelTypes(schemas: Array<S>) {\n schemas.forEach((schema) => {\n const { Namespace: ns, Alias: alias } = schema.$;\n\n schema.EnumType?.forEach((et) => {\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.EnumType);\n });\n schema.ComplexType?.forEach((ct) => {\n this.addModel2Type(ns, alias, ct.$.Name, DataTypes.ComplexType);\n });\n schema.EntityType?.forEach((et) => {\n this.addModel2Type(ns, alias, et.$.Name, DataTypes.ModelType);\n });\n });\n }\n\n private addModel2Type(ns: string, alias: string | undefined, name: string, dt: DataTypes) {\n this.model2Type.set(withNamespace(ns, name), dt);\n if (alias) {\n this.model2Type.set(withNamespace(alias, name), dt);\n }\n }\n\n protected abstract getNavigationProps(entityType: ET | ComplexType): Array<Property>;\n\n protected abstract digestOperations(schema: SchemaV3 | SchemaV4): void;\n\n protected abstract digestEntityContainer(schema: SchemaV3 | SchemaV4): void;\n\n /**\n * Get essential infos about a given odata type from the version specific service variants.\n *\n * @param type\n * @return tuple of return type, query object, query collection object\n */\n protected abstract mapODataType(type: string): TypeModel;\n\n public async digest(): Promise<DataModel> {\n this.digestEntityTypesAndOperations();\n\n // delegate to version specific entity container digestion\n this.schemas.forEach((schema) => this.digestEntityContainer(schema));\n\n this.dataModel.setNameValidation(this.nameValidator.validate());\n return this.dataModel;\n }\n\n private digestEntityTypesAndOperations() {\n this.schemas.forEach((schema) => {\n const ns: NamespaceWithAlias = [schema.$.Namespace, schema.$.Alias];\n\n // type definitions: alias for primitive types\n this.addTypeDefinition(schema.$.Namespace, schema.TypeDefinition);\n\n // enums\n this.addEnum(ns, schema.EnumType);\n\n // complex types\n this.addComplexType(ns, schema.ComplexType);\n\n // entity types\n this.addEntityType(ns, schema.EntityType);\n\n // V4 only: function & action types\n this.digestOperations(schema);\n });\n\n this.postProcessModel();\n this.postProcessKeys();\n\n this.schemas.forEach((schema) => {\n this.analyzeModelUsage(schema.EntityContainer?.length ? schema.EntityContainer[0] : undefined);\n });\n }\n\n private getBaseModel(\n entityConfig: WithoutName<EntityTypeGenerationOptions | ComplexTypeGenerationOptions> | undefined,\n model: ComplexType,\n namespace: string,\n name: string,\n fqName: string,\n ) {\n const odataName = model.$.Name;\n\n // map properties respecting the config\n const props = [...(model.Property ?? []), ...this.getNavigationProps(model)].map((p) => {\n const epConfig = entityConfig?.properties?.find((ep) => ep.name === p.$.Name);\n return this.mapProp(p, epConfig);\n });\n\n // support for base types, i.e. extends clause of interfaces\n const baseClasses = [];\n let finalBaseClass: string | undefined = undefined;\n if (model.$.BaseType) {\n baseClasses.push(model.$.BaseType);\n const [baseName, basePrefix] = this.namingHelper.getNameAndServicePrefix(model.$.BaseType);\n const baseConfig =\n this.serviceConfigHelper.findEntityTypeConfig([basePrefix!], baseName) ||\n this.serviceConfigHelper.findComplexTypeConfig([basePrefix!], baseName);\n finalBaseClass = baseConfig?.mappedName ?? baseName;\n }\n\n return {\n fqName,\n odataName,\n name,\n modelName: this.namingHelper.getModelName(name),\n qName: this.namingHelper.getQName(name),\n editableName: this.namingHelper.getEditableModelName(name),\n serviceName: this.namingHelper.getServiceName(name),\n serviceCollectionName: this.namingHelper.getCollectionServiceName(name),\n folderPath: this.namingHelper.getFolderPath(namespace, name),\n baseClasses,\n finalBaseClass,\n props,\n baseProps: [], // postprocess required\n abstract: ifTrue(model.$.Abstract),\n open: ifTrue(model.$.OpenType),\n genMode: Modes.qobjects,\n subtypes: new Set(),\n } satisfies Partial<ComplexModelType>;\n }\n\n private addTypeDefinition(ns: string, types: Array<TypeDefinition> | undefined) {\n if (!types || !types.length) {\n return;\n }\n\n for (const t of types) {\n this.dataModel.addTypeDefinition(ns, t.$.Name, t.$.UnderlyingType);\n }\n }\n\n private addEnum(namespace: NamespaceWithAlias, models: Array<EnumType> | undefined) {\n if (!models || !models.length) {\n return;\n }\n\n for (const et of models) {\n const odataName = et.$.Name;\n const fqName = withNamespace(namespace[0], odataName);\n const config = this.serviceConfigHelper.findEnumTypeConfig(namespace, odataName);\n const enumName = this.nameValidator.addEnumType(fqName, config?.mappedName || odataName);\n const filePath = this.namingHelper.getFolderPath(namespace[0], enumName);\n this.dataModel.addEnum(namespace[0], odataName, {\n fqName,\n odataName,\n name: enumName,\n modelName: this.namingHelper.getEnumName(enumName),\n folderPath: filePath,\n members: et.Member?.length ? et.Member.map((m) => ({ name: m.$.Name, value: m.$.Value })) : [],\n });\n }\n }\n\n private addComplexType(namespace: NamespaceWithAlias, models: Array<ComplexType> | undefined) {\n if (!models || !models.length) {\n return;\n }\n\n for (const model of models) {\n const config = this.serviceConfigHelper.findComplexTypeConfig(namespace, model.$.Name);\n const fqName = withNamespace(namespace[0], model.$.Name);\n const name = this.nameValidator.addComplexType(fqName, config?.mappedName || model.$.Name);\n const baseModel = this.getBaseModel(config, model, namespace[0], name, fqName);\n this.dataModel.addComplexType(namespace[0], baseModel.odataName, baseModel);\n }\n }\n\n private addEntityType(namespace: NamespaceWithAlias, models: Array<ET> | undefined) {\n if (!models || !models.length) {\n return;\n }\n\n for (const model of models) {\n const entityConfig = this.serviceConfigHelper.findEntityTypeConfig(namespace, model.$.Name);\n const fqName = withNamespace(namespace[0], model.$.Name);\n const name = this.nameValidator.addEntityType(fqName, entityConfig?.mappedName || model.$.Name);\n const baseModel = this.getBaseModel(entityConfig, model, namespace[0], name, fqName);\n\n // key support: we add keys from this entity,\n // but not keys stemming from base classes (postprocess required)\n const keyNames: Array<string> = [];\n if (entityConfig?.keys?.length) {\n keyNames.push(...entityConfig.keys);\n } else {\n const entity = model as EntityType;\n if (entity.Key && entity.Key.length && entity.Key[0].PropertyRef.length) {\n const propNames = entity.Key[0].PropertyRef.map((key) => key.$.Name);\n keyNames.push(...propNames);\n }\n }\n\n this.dataModel.addEntityType(namespace[0], baseModel.odataName, {\n ...baseModel,\n id: {\n fqName: baseModel.fqName,\n modelName: this.namingHelper.getIdModelName(name),\n qName: this.namingHelper.getQIdFunctionName(name),\n },\n generateId: !!keyNames.length,\n keyNames: keyNames, // postprocess required to include key specs from base classes\n keys: [], // postprocess required to include props from base classes\n getKeyUnion: () => keyNames.join(\" | \"),\n subtypes: new Set(),\n });\n }\n }\n\n /**\n * Check that models (ComplexType or EntityType) have been referenced in the API\n * as entry point or via navProp or by virtue of being a base type or subtype of those.\n * For these models one or two services are generated.\n *\n * In this way unnecessary service generation is prevented. For example, complex types that\n * are only referenced as response of an operation do not need a generated service.\n *\n * @param ec\n * @private\n */\n private analyzeModelUsage(ec: EntityContainerV3 | EntityContainerV4 | undefined) {\n if (ec?.EntitySet?.length) {\n ec.EntitySet.forEach((et) => this.analyze(et.$.EntityType));\n }\n const ec4 = ec as EntityContainerV4;\n if (ec4?.Singleton?.length) {\n ec4.Singleton.forEach((singleton) => this.analyze(singleton.$.Type));\n }\n }\n\n /**\n * Check usage of model types within API.\n *\n * @param fqModelName\n * @private\n */\n private analyze(fqModelName: string) {\n // to also resolve aliases the data model needs to be used\n const model = this.dataModel.getEntityType(fqModelName) ?? this.dataModel.getComplexType(fqModelName);\n if (!model?.fqName || model.genMode === Modes.service) {\n return;\n }\n\n model.genMode = Modes.service;\n\n if (model) {\n // respect base classes\n if (model.baseClasses.length) {\n this.analyze(model.baseClasses[0]);\n }\n // include subtypes since each base class can be cast to its subtypes\n model.subtypes.forEach((subtype) => {\n this.analyze(subtype);\n });\n model?.props.forEach((p) => {\n if (p.dataType === DataTypes.ComplexType || p.dataType === DataTypes.ModelType) {\n this.analyze(p.fqType);\n }\n });\n }\n }\n\n private postProcessModel() {\n // complex types\n const complexTypes = this.dataModel.getComplexTypes();\n complexTypes.forEach((ct) => {\n // build up set of subtypes for each complex type\n this.addSubtypes(ct);\n\n // get props & keys from base types\n const [baseProps, _, baseAttributes] = this.collectBaseClassPropsAndKeys(ct, []);\n const { open } = baseAttributes;\n ct.baseProps = baseProps.map((bp) => ({ ...bp }));\n if (open) {\n ct.open = true;\n }\n });\n // entity types\n const entityTypes = this.dataModel.getEntityTypes();\n entityTypes.forEach((et) => {\n // build up set of subtypes for each entity type\n this.addSubtypes(et);\n\n // get props & keys from base types\n const [baseProps, baseKeys, baseAttributes] = this.collectBaseClassPropsAndKeys(et, []);\n const { fqIdName, idName, qIdName, open } = baseAttributes;\n et.baseProps = baseProps.map((bp) => ({ ...bp }));\n\n if (!et.keyNames.length && idName) {\n et.id = {\n fqName: fqIdName,\n modelName: idName,\n qName: qIdName,\n };\n et.generateId = false;\n }\n if (open) {\n et.open = open;\n }\n et.keyNames.unshift(...baseKeys.filter((bk) => !et.keyNames.includes(bk)));\n });\n }\n\n private postProcessKeys() {\n const entityTypes = this.dataModel.getEntityTypes();\n entityTypes.forEach((et) => {\n const isSingleKey = et.keyNames.length === 1;\n const props = [...et.baseProps, ...et.props];\n et.keys = et.keyNames.map((keyName) => {\n const prop = props.find((p) => p.odataName === keyName);\n if (!prop) {\n throw new Error(`Key with name [${keyName}] not found in props!`);\n }\n\n // automatically set key prop to managed, if this is the only key of the given entity\n if (prop.managed === undefined) {\n prop.managed = !this.options.disableAutoManagedKey && isSingleKey;\n }\n\n return prop;\n });\n });\n }\n\n private collectBaseClassPropsAndKeys(model: ComplexModelType, visitedModels: string[]): CollectorTuple {\n if (visitedModels.includes(model.fqName)) {\n throw new Error(`Cyclic inheritance detected for model ${model.fqName}!`);\n }\n visitedModels.push(model.fqName);\n return model.baseClasses.reduce(\n ([props, keys, attributes], bc) => {\n const baseModel = this.dataModel.getEntityType(bc) || this.dataModel.getComplexType(bc);\n if (!baseModel) {\n throw new Error(`BaseModel \"${bc}\" doesn't exist!`);\n }\n\n let { fqIdName, idName, qIdName, open } = attributes;\n\n // recursive\n if (baseModel.baseClasses.length) {\n const [parentProps, parentKeys, parentAttributes] = this.collectBaseClassPropsAndKeys(\n baseModel,\n visitedModels,\n );\n props.unshift(...parentProps);\n keys.unshift(...parentKeys);\n if (parentAttributes?.idName) {\n fqIdName = parentAttributes.fqIdName;\n idName = parentAttributes.idName;\n qIdName = parentAttributes.qIdName;\n }\n if (parentAttributes?.open) {\n open = true;\n }\n }\n\n props.push(...baseModel.props);\n const entityModel = baseModel as EntityModelType;\n if (entityModel.keyNames?.length) {\n keys.push(...entityModel.keyNames.filter((kn) => !keys.includes(kn)));\n fqIdName = entityModel.id.fqName;\n idName = entityModel.id.modelName;\n qIdName = entityModel.id.qName;\n }\n if (baseModel.open) {\n open = true;\n }\n return [props, keys, { fqIdName, idName, qIdName, open }];\n },\n [[], [], { fqIdName: \"\", idName: \"\", qIdName: \"\", open: false }] as CollectorTuple,\n );\n }\n\n protected mapProp = (p: Property, entityPropConfig?: PropertyGenerationOptions | undefined): PropertyModel => {\n if (!p.$.Type) {\n throw new Error(`No type information given for property [${p.$.Name}]!`);\n }\n\n const configProp = this.serviceConfigHelper.findPropConfigByName(p.$.Name);\n const modelName = this.namingHelper.getModelPropName(\n entityPropConfig?.mappedName || configProp?.mappedName || p.$.Name,\n );\n const isCollection = !!p.$.Type.match(/^Collection\\(/);\n let odataDataType = p.$.Type.replace(/^Collection\\(([^\\)]+)\\)/, \"$1\");\n\n // support for primitive type mapping\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\n const dt = this.dataModel.getPrimitiveType(odataDataType);\n if (dt !== undefined) {\n odataDataType = dt;\n }\n }\n\n let result: Pick<PropertyModel, \"dataType\" | \"type\" | \"typeModule\" | \"qPath\" | \"qParam\" | \"qObject\" | \"converters\">;\n\n // domain object known from service:\n // EntityType, ComplexType, EnumType\n if (this.namingHelper.includesServicePrefix(odataDataType)) {\n const modelType = this.model2Type.get(odataDataType)!;\n const [dataTypeName, dataTypePrefix] = this.namingHelper.getNameAndServicePrefix(odataDataType);\n const dataTypeNamespace: NamespaceWithAlias = [dataTypePrefix!];\n const isComplexType = modelType === DataTypes.ComplexType;\n if (!modelType) {\n throw new Error(\n `Couldn't determine model type (EntityType, ComplexType, etc) for property \"${p.$.Name}\"! Given data type: \"${odataDataType}\".`,\n );\n }\n\n // special handling for enums\n if (modelType === DataTypes.EnumType) {\n const isNumericEnum = this.options.enumType === \"numeric\";\n const enumConfig = this.serviceConfigHelper.findEnumTypeConfig(dataTypeNamespace, dataTypeName);\n result = {\n dataType: modelType,\n type: this.namingHelper.getEnumName(enumConfig?.mappedName ?? odataDataType),\n qPath: isCollection\n ? isNumericEnum\n ? QueryObjectTypes.QNumericEnumCollectionPath\n : QueryObjectTypes.QEnumCollectionPath\n : isNumericEnum\n ? QueryObjectTypes.QNumericEnumPath\n : QueryObjectTypes.QEnumPath,\n qObject: isCollection\n ? isNumericEnum\n ? QueryObjectTypes.QNumericEnumCollection\n : QueryObjectTypes.QEnumCollection\n : undefined,\n qParam: isNumericEnum ? \"QNumericEnumParam\" : \"QEnumParam\",\n };\n }\n // handling of complex & entity types\n else {\n const entityConfig = isComplexType\n ? this.serviceConfigHelper.findComplexTypeConfig(dataTypeNamespace, dataTypeName)\n : this.serviceConfigHelper.findEntityTypeConfig(dataTypeNamespace, dataTypeName);\n const typeName = entityConfig?.mappedName ?? odataDataType;\n\n result = {\n dataType: modelType,\n type: this.namingHelper.getModelName(typeName),\n qPath: isCollection\n ? isComplexType\n ? QueryObjectTypes.QComplexCollectionPath\n : QueryObjectTypes.QEntityCollectionPath\n : isComplexType\n ? QueryObjectTypes.QComplexPath\n : QueryObjectTypes.QEntityPath,\n qObject: this.namingHelper.getQName(typeName),\n qParam: \"QComplexParam\",\n };\n }\n }\n // OData built-in data types\n else if (odataDataType.startsWith(Digester.EDM_PREFIX)) {\n const { outputType, qPath, qParam, qCollection } = this.mapODataType(odataDataType);\n const { to, toModule: typeModule, converters } = this.dataModel.getConverter(odataDataType) || {};\n\n const type = !to ? outputType : to.startsWith(Digester.EDM_PREFIX) ? this.mapODataType(to).outputType : to;\n\n result = {\n dataType: DataTypes.PrimitiveType,\n type,\n typeModule,\n qPath: isCollection ? QueryObjectTypes.QCollectionPath : qPath,\n qParam,\n qObject: isCollection ? qCollection : undefined,\n converters,\n };\n } else {\n throw new Error(\n `Unknown type [${odataDataType}]: Not 'Collection(...)', not OData type 'Edm.*', not starting with one of the namespaces!`,\n );\n }\n\n return {\n odataName: p.$.Name,\n name: modelName,\n odataType: p.$.Type,\n fqType: odataDataType,\n required: ifFalse(p.$.Nullable),\n isCollection: isCollection,\n managed: typeof entityPropConfig?.managed !== \"undefined\" ? entityPropConfig.managed : configProp?.managed,\n ...result,\n };\n };\n\n private addSubtypes(model: ComplexModelType, grandChildren = new Set<string>()) {\n if (!model.baseClasses.length) {\n return;\n }\n\n model.baseClasses.forEach((baseClass) => {\n const baseType = this.dataModel.getModel(baseClass) as ComplexModelType;\n\n // add subtypes & base name for q-objects\n baseType.subtypes.add(model.fqName);\n if (!baseType.qBaseName) {\n baseType.qBaseName = this.namingHelper.getQBaseName(baseType.name);\n }\n grandChildren.forEach((gc) => baseType.subtypes.add(gc));\n\n // recursive\n grandChildren.add(model.fqName);\n this.addSubtypes(baseType, grandChildren);\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum QueryObjectTypes {
|
|
2
|
+
QEnumCollection = "QEnumCollection",
|
|
3
|
+
QNumericEnumCollection = "QNumericEnumCollection",
|
|
4
|
+
QEnumPath = "QEnumPath",
|
|
5
|
+
QEnumCollectionPath = "QEnumCollectionPath",
|
|
6
|
+
QNumericEnumPath = "QNumericEnumPath",
|
|
7
|
+
QNumericEnumCollectionPath = "QNumericEnumCollectionPath",
|
|
8
|
+
QCollectionPath = "QCollectionPath",
|
|
9
|
+
QComplexPath = "QComplexPath",
|
|
10
|
+
QEntityPath = "QEntityPath",
|
|
11
|
+
QComplexCollectionPath = "QComplexCollectionPath",
|
|
12
|
+
QEntityCollectionPath = "QEntityCollectionPath"
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var QueryObjectTypes;
|
|
2
|
+
(function (QueryObjectTypes) {
|
|
3
|
+
QueryObjectTypes["QEnumCollection"] = "QEnumCollection";
|
|
4
|
+
QueryObjectTypes["QNumericEnumCollection"] = "QNumericEnumCollection";
|
|
5
|
+
QueryObjectTypes["QEnumPath"] = "QEnumPath";
|
|
6
|
+
QueryObjectTypes["QEnumCollectionPath"] = "QEnumCollectionPath";
|
|
7
|
+
QueryObjectTypes["QNumericEnumPath"] = "QNumericEnumPath";
|
|
8
|
+
QueryObjectTypes["QNumericEnumCollectionPath"] = "QNumericEnumCollectionPath";
|
|
9
|
+
QueryObjectTypes["QCollectionPath"] = "QCollectionPath";
|
|
10
|
+
QueryObjectTypes["QComplexPath"] = "QComplexPath";
|
|
11
|
+
QueryObjectTypes["QEntityPath"] = "QEntityPath";
|
|
12
|
+
QueryObjectTypes["QComplexCollectionPath"] = "QComplexCollectionPath";
|
|
13
|
+
QueryObjectTypes["QEntityCollectionPath"] = "QEntityCollectionPath";
|
|
14
|
+
})(QueryObjectTypes || (QueryObjectTypes = {}));
|
|
15
|
+
//# sourceMappingURL=QueryObjectTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryObjectTypes.js","sourceRoot":"","sources":["../../src/data-model/QueryObjectTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,uDAAmC,CAAA;IACnC,qEAAiD,CAAA;IACjD,2CAAuB,CAAA;IACvB,+DAA2C,CAAA;IAC3C,yDAAqC,CAAA;IACrC,6EAAyD,CAAA;IACzD,uDAAmC,CAAA;IACnC,iDAA6B,CAAA;IAC7B,+CAA2B,CAAA;IAC3B,qEAAiD,CAAA;IACjD,mEAA+C,CAAA;AACjD,CAAC,EAZW,gBAAgB,KAAhB,gBAAgB,QAY3B","sourcesContent":["export enum QueryObjectTypes {\n QEnumCollection = \"QEnumCollection\",\n QNumericEnumCollection = \"QNumericEnumCollection\",\n QEnumPath = \"QEnumPath\",\n QEnumCollectionPath = \"QEnumCollectionPath\",\n QNumericEnumPath = \"QNumericEnumPath\",\n QNumericEnumCollectionPath = \"QNumericEnumCollectionPath\",\n QCollectionPath = \"QCollectionPath\",\n QComplexPath = \"QComplexPath\",\n QEntityPath = \"QEntityPath\",\n QComplexCollectionPath = \"QComplexCollectionPath\",\n QEntityCollectionPath = \"QEntityCollectionPath\",\n}\n"]}
|
package/lib/defaultConfig.js
CHANGED
package/lib/defaultConfig.js.map
CHANGED
|
@@ -1 +1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,QAAQ,CAAC,UAAU,CAAC,MAAM;YAClC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM;SACnC;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM;YACpC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM;SACrC;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,MAAM;YAC5C,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,MAAM;SAC7C;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,SAAS,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,EAAE,MAAM,KAAqB,aAAa,EAA7B,WAAW,UAAK,aAAa,EAA1C,UAA0B,CAAgB,CAAC;IACjD,OAAO,SAAS,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import deepmerge from \"deepmerge\";\nimport { NameSettings, NamingStrategies } from \"./NamingModel.js\";\nimport { EmitModes, Modes, RunOptions } from \"./OptionModel.js\";\n\nexport type DefaultConfiguration = Omit<RunOptions, \"sourceUrl\" | \"source\" | \"output\" | \"serviceName\">;\n/**\n * The default configuration.\n */\nconst defaultConfig: DefaultConfiguration = {\n sourceUrlConfig: {},\n refreshFile: false,\n mode: Modes.all,\n emitMode: EmitModes.js_dts,\n debug: false,\n prettier: false,\n tsconfig: \"tsconfig.json\",\n converters: [],\n skipEditableModels: false,\n skipIdModels: false,\n skipOperations: false,\n skipComments: false,\n enablePrimitivePropertyServices: false,\n disableAutoManagedKey: false,\n allowRenaming: false,\n v2ModelsWithExtraResultsWrapping: false,\n v4BigNumberAsString: false,\n disableAutomaticNameClashResolution: false,\n bundledFileGeneration: true,\n enumType: \"string\",\n naming: {\n models: {\n namingStrategy: NamingStrategies.PASCAL_CASE,\n propNamingStrategy: NamingStrategies.CAMEL_CASE,\n editableModels: {\n prefix: \"Editable\",\n suffix: \"\",\n applyModelNaming: true,\n },\n idModels: {\n prefix: \"\",\n suffix: \"Id\",\n applyModelNaming: true,\n },\n operationParamModels: {\n prefix: \"\",\n suffix: \"Params\",\n applyModelNaming: true,\n },\n fileName: {\n namingStrategy: NamingStrategies.PASCAL_CASE,\n prefix: \"\",\n suffix: \"Model\",\n },\n },\n queryObjects: {\n namingStrategy: NamingStrategies.PASCAL_CASE,\n propNamingStrategy: NamingStrategies.CAMEL_CASE,\n prefix: \"Q\",\n suffix: \"\",\n idFunctions: {\n prefix: \"\",\n suffix: \"Id\",\n },\n fileName: {\n namingStrategy: NamingStrategies.PASCAL_CASE,\n prefix: \"Q\",\n suffix: \"\",\n },\n baseType: {\n applyQNaming: true,\n prefix: \"\",\n suffix: \"BaseType\",\n },\n },\n services: {\n prefix: \"\",\n suffix: \"Service\",\n namingStrategy: NamingStrategies.PASCAL_CASE,\n main: {\n applyServiceNaming: true,\n },\n collection: {\n prefix: \"\",\n suffix: \"Collection\",\n applyServiceNaming: true,\n },\n operations: {\n namingStrategy: NamingStrategies.CAMEL_CASE,\n },\n relatedServiceGetter: {\n namingStrategy: NamingStrategies.CAMEL_CASE,\n prefix: \"\",\n suffix: \"\",\n },\n privateProps: {\n namingStrategy: NamingStrategies.CAMEL_CASE,\n prefix: \"_\",\n suffix: \"\",\n },\n },\n },\n propertiesByName: [],\n byTypeAndName: [],\n enableNativeInOperator: false\n};\n\nconst { models, queryObjects, services } = defaultConfig.naming;\nconst minimalNamingConfig: NameSettings = {\n models: {\n fileName: {\n prefix: models.fileName.prefix,\n suffix: models.fileName.suffix,\n },\n idModels: {\n applyModelNaming: true,\n prefix: models.idModels.prefix,\n suffix: models.idModels.suffix,\n },\n editableModels: {\n applyModelNaming: true,\n prefix: models.editableModels.prefix,\n suffix: models.editableModels.suffix,\n },\n operationParamModels: {\n applyModelNaming: true,\n prefix: models.operationParamModels.prefix,\n suffix: models.operationParamModels.suffix,\n },\n },\n queryObjects: {\n prefix: queryObjects.prefix,\n suffix: queryObjects.suffix,\n fileName: {\n prefix: queryObjects.fileName.prefix,\n suffix: queryObjects.fileName.suffix,\n },\n idFunctions: {\n prefix: queryObjects.idFunctions.prefix,\n suffix: queryObjects.idFunctions.suffix,\n },\n baseType: {\n prefix: queryObjects.baseType.prefix,\n suffix: queryObjects.baseType.suffix,\n },\n },\n services: {\n prefix: services.prefix,\n suffix: services.suffix,\n main: {\n applyServiceNaming: true,\n },\n collection: {\n applyServiceNaming: true,\n prefix: services.collection.prefix,\n suffix: services.collection.suffix,\n },\n privateProps: {\n prefix: services.privateProps.prefix,\n suffix: services.privateProps.suffix,\n },\n relatedServiceGetter: {\n prefix: services.relatedServiceGetter.prefix,\n suffix: services.relatedServiceGetter.suffix,\n },\n },\n};\n\n/**\n * Creates a defensive copy of the default config.\n */\nexport function getDefaultConfig(): DefaultConfiguration {\n return deepmerge(defaultConfig, {});\n}\n\n/**\n * Creates a defensive copy of the minimal config: minimal in respect to naming.\n */\nexport function getMinimalConfig(): DefaultConfiguration {\n const { naming, ...passThrough } = defaultConfig;\n return deepmerge(passThrough, { naming: minimalNamingConfig });\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ODataVersions } from "@odata2ts/odata-core";
|
|
2
2
|
import { ImportDeclarationStructure, OptionalKind } from "ts-morph";
|
|
3
3
|
import { DataModel } from "../data-model/DataModel.js";
|
|
4
|
+
import { ComplexType } from "../data-model/DataTypeModel.js";
|
|
4
5
|
import { ClientApiImports, CoreImports, QueryObjectImports, ServiceImports } from "./import/ImportObjects.js";
|
|
5
6
|
/**
|
|
6
7
|
* Handles all the import statements for a given file.
|
|
@@ -31,6 +32,7 @@ export declare class ImportContainer {
|
|
|
31
32
|
service: string;
|
|
32
33
|
}, bundledFileGeneration: boolean, reservedNames: Array<string> | undefined);
|
|
33
34
|
addCoreLib(odataVersion: ODataVersions, coreLib: CoreImports): string;
|
|
35
|
+
addFromMainQObject(name: string, isTypeOnly?: boolean): string;
|
|
34
36
|
private addFromQObject;
|
|
35
37
|
addQObject(qObject: QueryObjectImports | string): string;
|
|
36
38
|
addQObjectType(qObject: string): string;
|
|
@@ -41,6 +43,7 @@ export declare class ImportContainer {
|
|
|
41
43
|
private isDifferentFile;
|
|
42
44
|
private addGeneratedImport;
|
|
43
45
|
addGeneratedModel(fqName: string, name: string, isTypeOnly?: boolean): string;
|
|
46
|
+
addGeneratedQBaseObject(model: ComplexType, isTypeOnly?: boolean): string;
|
|
44
47
|
addGeneratedQObject(fqName: string, name: string, isTypeOnly?: boolean): string;
|
|
45
48
|
addGeneratedService(fqName: string, name: string): string;
|
|
46
49
|
private createImportDecl;
|
|
@@ -44,6 +44,9 @@ export class ImportContainer {
|
|
|
44
44
|
this.libs.core.typeOnly.set(name, importName);
|
|
45
45
|
return importName;
|
|
46
46
|
}
|
|
47
|
+
addFromMainQObject(name, isTypeOnly = false) {
|
|
48
|
+
return this.addGeneratedImport("", this.mainFileNames.qObject, name, isTypeOnly);
|
|
49
|
+
}
|
|
47
50
|
addFromQObject(name, typeOnlyImport = false) {
|
|
48
51
|
const importName = this.importedNameValidator.validateName(LIB_MODULES.qObject, name);
|
|
49
52
|
const imports = this.libs.qObject;
|
|
@@ -133,6 +136,14 @@ export class ImportContainer {
|
|
|
133
136
|
return this.addGeneratedImport(folderPath, modelName, name, isTypeOnly);
|
|
134
137
|
}
|
|
135
138
|
}
|
|
139
|
+
addGeneratedQBaseObject(model, isTypeOnly = false) {
|
|
140
|
+
if (!model.qBaseName) {
|
|
141
|
+
throw new Error(`Model ${model.fqName} has no base type!`);
|
|
142
|
+
}
|
|
143
|
+
return this.bundledFileGeneration
|
|
144
|
+
? this.addGeneratedImport("", this.mainFileNames.qObject, model.qBaseName, isTypeOnly)
|
|
145
|
+
: this.addGeneratedImport(model.folderPath, model.qBaseName, model.qBaseName, isTypeOnly);
|
|
146
|
+
}
|
|
136
147
|
addGeneratedQObject(fqName, name, isTypeOnly = false) {
|
|
137
148
|
if (this.bundledFileGeneration) {
|
|
138
149
|
return this.addGeneratedImport("", this.mainFileNames.qObject, name, isTypeOnly);
|