@odata2ts/odata2ts 0.20.3 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.21.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.20.3...@odata2ts/odata2ts@0.21.0) (2023-04-20)
7
+
8
+ ### Features
9
+
10
+ * option for extra-results-wrapping for V2 services and model generation only ([#155](https://github.com/odata2ts/odata2ts/issues/155)) ([795a04c](https://github.com/odata2ts/odata2ts/commit/795a04c42b9e2485975b85b70bc72772bd4bf25a))
11
+
6
12
  ## [0.20.3](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.20.2...@odata2ts/odata2ts@0.20.3) (2023-04-18)
7
13
 
8
14
  ### Bug Fixes
@@ -4,10 +4,10 @@ import { DataModel } from "./data-model/DataModel";
4
4
  import { Schema } from "./data-model/edmx/ODataEdmxModelBase";
5
5
  import { NamingHelper } from "./data-model/NamingHelper";
6
6
  import { RunOptions } from "./OptionModel";
7
- export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName">;
7
+ export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName" | "v2ModelsWithExtraResultsWrapping" | "skipEditableModels">;
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: S, options: DigestionOptions, namingHelper: NamingHelper) => Promise<DataModel>;
12
- export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations">;
12
+ export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "v2ModelsWithExtraResultsWrapping">;
13
13
  export type EntityBasedGeneratorFunction = (dataModel: DataModel, sourceFile: SourceFile, version: ODataVersions, options: GeneratorFunctionOptions, namingHelper: NamingHelper) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"./data-model/DataModel\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { RunOptions } from \"./OptionModel\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n \"converters\" | \"disableAutoManagedKey\" | \"propertiesByName\" | \"entitiesByName\"\r\n>;\r\n\r\n/**\r\n * Takes an EdmxSchema plus the run options and creates a DataModel.\r\n */\r\nexport type DigesterFunction<S extends Schema<any, any>> = (\r\n schema: S,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper\r\n) => Promise<DataModel>;\r\n\r\nexport type GeneratorFunctionOptions = Pick<RunOptions, \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\">;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n dataModel: DataModel,\r\n sourceFile: SourceFile,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper\r\n) => void;\r\n"]}
1
+ {"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"./data-model/DataModel\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { RunOptions } from \"./OptionModel\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n | \"converters\"\r\n | \"disableAutoManagedKey\"\r\n | \"propertiesByName\"\r\n | \"entitiesByName\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"skipEditableModels\"\r\n>;\r\n\r\n/**\r\n * Takes an EdmxSchema plus the run options and creates a DataModel.\r\n */\r\nexport type DigesterFunction<S extends Schema<any, any>> = (\r\n schema: S,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper\r\n) => Promise<DataModel>;\r\n\r\nexport type GeneratorFunctionOptions = Pick<\r\n RunOptions,\r\n \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\" | \"v2ModelsWithExtraResultsWrapping\"\r\n>;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n dataModel: DataModel,\r\n sourceFile: SourceFile,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper\r\n) => void;\r\n"]}
@@ -152,6 +152,20 @@ export interface ConfigFileOptions extends Omit<CliOptions, "source" | "output"
152
152
  * The naming options regarding the generated artefacts.
153
153
  */
154
154
  naming?: OverridableNamingOptions;
155
+ /**
156
+ * Some OData V2 services generate an extra wrapping for entity collection attributes:
157
+ * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities
158
+ * an object with the property "results" is wrapped around the entity collection.
159
+ *
160
+ * If you're using the odata client then there's a build-in workaround in place which transforms
161
+ * the results to remove this extra mapping. However, if you're only interested in the types, then
162
+ * the generated models will not match that extra wrapping.
163
+ *
164
+ * Setting this configuration option to <code>true</code> (default: false) will add this extra
165
+ * wrapping to the generated models. But this option is only valid if the generation mode is set
166
+ * to <code>models</code>; it is ignored otherwise.
167
+ */
168
+ v2ModelsWithExtraResultsWrapping?: boolean;
155
169
  }
156
170
  /**
157
171
  * Custom generation options which are dependent on a specific odata service.
@@ -1 +1 @@
1
- {"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,GAAL,aAAK,KAAL,aAAK,QAKhB;AAED;;GAEG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\n\r\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel\";\r\n\r\n/**\r\n * Generation mode, by default \"all\".\r\n */\r\nexport enum Modes {\r\n models,\r\n qobjects,\r\n service,\r\n all,\r\n}\r\n\r\n/**\r\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\r\n */\r\nexport enum EmitModes {\r\n ts = \"ts\",\r\n js = \"js\",\r\n dts = \"dts\",\r\n js_dts = \"js_dts\",\r\n}\r\n\r\n/**\r\n * Config options for CLI.\r\n */\r\nexport interface CliOptions {\r\n /**\r\n * The source file to use. Must be an EDMX compliant XML file.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions extends Required<Omit<ServiceGenerationOptions, \"serviceName\">> {\r\n serviceName?: string;\r\n naming: NameSettings;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"source\" | \"output\" | \"services\"> {\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for EntityTypes and ComplexTypes including their keys and properties.\r\n */\r\n entitiesByName?: Array<EntityGenerationOptions>;\r\n /**\r\n * Configure generation process for individual properties based on their name.\r\n */\r\n propertiesByName?: Array<PropertyGenerationOptions>;\r\n}\r\n\r\n/**\r\n * Configuration options for EntityTypes and ComplexTypes.\r\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\r\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\r\n */\r\nexport interface EntityGenerationOptions {\r\n /**\r\n * Name of the EntityType or ComplexType, e.g. \"Person\".\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Overwrite the key specification by naming the props by their EDMX name.\r\n */\r\n keys?: Array<string>;\r\n /**\r\n * Configuration of individual properties.\r\n */\r\n // properties?: Array<PropertyGenerationOptions>;\r\n\r\n // converter: string | Array<string>\r\n\r\n /**\r\n * Whether the generated service should allow for querying this model.\r\n * True by default.\r\n */\r\n // queryable?: boolean;\r\n /**\r\n * Whether the generated service should allow for creating new models (POST).\r\n * True by default.\r\n */\r\n // creatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for updates (PUT).\r\n * True by default.\r\n */\r\n // updatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for partial updates (PATCH).\r\n * True by default.\r\n */\r\n // patchable?: boolean;\r\n /**\r\n * Whether the generated service should allow for deletion.\r\n * True by default.\r\n */\r\n // deletable?: boolean;\r\n}\r\n\r\n/**\r\n * All configuration options for properties of models.\r\n */\r\nexport interface PropertyGenerationOptions {\r\n /**\r\n * Name of the property to match.\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\r\n * Hence, they are left out of the editable model versions.\r\n */\r\n managed?: boolean;\r\n\r\n /**\r\n * TODO\r\n *\r\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\r\n * as well it's i\r\n * and their ids, e.g. \"timeToDurationConverter\".\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n // converters?: Array<Required<TypeConverterConfig>>;\r\n}\r\n"]}
1
+ {"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,GAAL,aAAK,KAAL,aAAK,QAKhB;AAED;;GAEG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sBAAS,CAAA;IACT,sBAAS,CAAA;IACT,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\n\r\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel\";\r\n\r\n/**\r\n * Generation mode, by default \"all\".\r\n */\r\nexport enum Modes {\r\n models,\r\n qobjects,\r\n service,\r\n all,\r\n}\r\n\r\n/**\r\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\r\n */\r\nexport enum EmitModes {\r\n ts = \"ts\",\r\n js = \"js\",\r\n dts = \"dts\",\r\n js_dts = \"js_dts\",\r\n}\r\n\r\n/**\r\n * Config options for CLI.\r\n */\r\nexport interface CliOptions {\r\n /**\r\n * The source file to use. Must be an EDMX compliant XML file.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions extends Required<Omit<ServiceGenerationOptions, \"serviceName\">> {\r\n serviceName?: string;\r\n naming: NameSettings;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"source\" | \"output\" | \"services\"> {\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n\r\n /**\r\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\r\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\r\n * an object with the property \"results\" is wrapped around the entity collection.\r\n *\r\n * If you're using the odata client then there's a build-in workaround in place which transforms\r\n * the results to remove this extra mapping. However, if you're only interested in the types, then\r\n * the generated models will not match that extra wrapping.\r\n *\r\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\r\n * wrapping to the generated models. But this option is only valid if the generation mode is set\r\n * to <code>models</code>; it is ignored otherwise.\r\n */\r\n v2ModelsWithExtraResultsWrapping?: boolean;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for EntityTypes and ComplexTypes including their keys and properties.\r\n */\r\n entitiesByName?: Array<EntityGenerationOptions>;\r\n /**\r\n * Configure generation process for individual properties based on their name.\r\n */\r\n propertiesByName?: Array<PropertyGenerationOptions>;\r\n}\r\n\r\n/**\r\n * Configuration options for EntityTypes and ComplexTypes.\r\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\r\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\r\n */\r\nexport interface EntityGenerationOptions {\r\n /**\r\n * Name of the EntityType or ComplexType, e.g. \"Person\".\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Overwrite the key specification by naming the props by their EDMX name.\r\n */\r\n keys?: Array<string>;\r\n /**\r\n * Configuration of individual properties.\r\n */\r\n // properties?: Array<PropertyGenerationOptions>;\r\n\r\n // converter: string | Array<string>\r\n\r\n /**\r\n * Whether the generated service should allow for querying this model.\r\n * True by default.\r\n */\r\n // queryable?: boolean;\r\n /**\r\n * Whether the generated service should allow for creating new models (POST).\r\n * True by default.\r\n */\r\n // creatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for updates (PUT).\r\n * True by default.\r\n */\r\n // updatable?: boolean;\r\n /**\r\n * Whether the generated service should allow for partial updates (PATCH).\r\n * True by default.\r\n */\r\n // patchable?: boolean;\r\n /**\r\n * Whether the generated service should allow for deletion.\r\n * True by default.\r\n */\r\n // deletable?: boolean;\r\n}\r\n\r\n/**\r\n * All configuration options for properties of models.\r\n */\r\nexport interface PropertyGenerationOptions {\r\n /**\r\n * Name of the property to match.\r\n * Must match exactly or can be a regular expression.\r\n */\r\n name: string | RegExp;\r\n /**\r\n * Use a different name.\r\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\r\n */\r\n mappedName?: string;\r\n /**\r\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\r\n * Hence, they are left out of the editable model versions.\r\n */\r\n managed?: boolean;\r\n\r\n /**\r\n * TODO\r\n *\r\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\r\n * as well it's i\r\n * and their ids, e.g. \"timeToDurationConverter\".\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n // converters?: Array<Required<TypeConverterConfig>>;\r\n}\r\n"]}
@@ -20,6 +20,7 @@ const defaultConfig = {
20
20
  skipOperations: false,
21
21
  disableAutoManagedKey: false,
22
22
  allowRenaming: false,
23
+ v2ModelsWithExtraResultsWrapping: false,
23
24
  naming: {
24
25
  models: {
25
26
  namingStrategy: NamingModel_1.NamingStrategies.PASCAL_CASE,
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConfig.js","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAElC,+CAA+D;AAC/D,+CAA6D;AAE7D;;GAEG;AACH,MAAM,aAAa,GAA0C;IAC3D,IAAI,EAAE,mBAAK,CAAC,GAAG;IACf,QAAQ,EAAE,uBAAS,CAAC,MAAM;IAC1B,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,eAAe;IACzB,UAAU,EAAE,EAAE;IACd,kBAAkB,EAAE,KAAK;IACzB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,KAAK;IACrB,qBAAqB,EAAE,KAAK;IAC5B,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,cAAc,EAAE,8BAAgB,CAAC,WAAW;YAC5C,kBAAkB,EAAE,8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\n\r\nimport { NameSettings, NamingStrategies } from \"./NamingModel\";\r\nimport { EmitModes, Modes, RunOptions } from \"./OptionModel\";\r\n\r\n/**\r\n * The default configuration.\r\n */\r\nconst defaultConfig: Omit<RunOptions, \"source\" | \"output\"> = {\r\n mode: Modes.all,\r\n emitMode: EmitModes.js_dts,\r\n debug: false,\r\n prettier: false,\r\n tsconfig: \"tsconfig.json\",\r\n converters: [],\r\n skipEditableModels: false,\r\n skipIdModels: false,\r\n skipOperations: false,\r\n disableAutoManagedKey: false,\r\n allowRenaming: false,\r\n naming: {\r\n models: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n propNamingStrategy: NamingStrategies.CAMEL_CASE,\r\n editableModels: {\r\n prefix: \"Editable\",\r\n suffix: \"\",\r\n applyModelNaming: true,\r\n },\r\n idModels: {\r\n prefix: \"\",\r\n suffix: \"Id\",\r\n applyModelNaming: true,\r\n },\r\n operationParamModels: {\r\n prefix: \"\",\r\n suffix: \"Params\",\r\n applyModelNaming: true,\r\n },\r\n fileName: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n prefix: \"\",\r\n suffix: \"Model\",\r\n },\r\n },\r\n queryObjects: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n propNamingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"Q\",\r\n suffix: \"\",\r\n idFunctions: {\r\n prefix: \"\",\r\n suffix: \"Id\",\r\n },\r\n fileName: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n prefix: \"Q\",\r\n suffix: \"\",\r\n },\r\n },\r\n services: {\r\n prefix: \"\",\r\n suffix: \"Service\",\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n main: {\r\n applyServiceNaming: true,\r\n },\r\n collection: {\r\n prefix: \"\",\r\n suffix: \"Collection\",\r\n applyServiceNaming: true,\r\n },\r\n serviceResolverFunction: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"create\",\r\n suffix: \"serviceResolver\",\r\n },\r\n operations: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n },\r\n relatedServiceGetter: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"navTo\",\r\n suffix: \"\",\r\n },\r\n privateProps: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"_\",\r\n suffix: \"\",\r\n },\r\n publicProps: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n },\r\n },\r\n },\r\n propertiesByName: [],\r\n entitiesByName: [],\r\n};\r\n\r\nconst { models, queryObjects, services } = defaultConfig.naming;\r\nconst minimalNamingConfig: NameSettings = {\r\n models: {\r\n fileName: {\r\n prefix: models.fileName.prefix,\r\n suffix: models.fileName.suffix,\r\n },\r\n idModels: {\r\n applyModelNaming: true,\r\n prefix: models.idModels.prefix,\r\n suffix: models.idModels.suffix,\r\n },\r\n editableModels: {\r\n applyModelNaming: true,\r\n prefix: models.editableModels.prefix,\r\n suffix: models.editableModels.suffix,\r\n },\r\n operationParamModels: {\r\n applyModelNaming: true,\r\n prefix: models.operationParamModels.prefix,\r\n suffix: models.operationParamModels.suffix,\r\n },\r\n },\r\n queryObjects: {\r\n prefix: queryObjects.prefix,\r\n suffix: queryObjects.suffix,\r\n fileName: {\r\n prefix: queryObjects.fileName.prefix,\r\n suffix: queryObjects.fileName.suffix,\r\n },\r\n idFunctions: {\r\n prefix: queryObjects.idFunctions.prefix,\r\n suffix: queryObjects.idFunctions.suffix,\r\n },\r\n },\r\n services: {\r\n prefix: services.prefix,\r\n suffix: services.suffix,\r\n main: {\r\n applyServiceNaming: true,\r\n },\r\n collection: {\r\n applyServiceNaming: true,\r\n prefix: services.collection.prefix,\r\n suffix: services.collection.suffix,\r\n },\r\n privateProps: {\r\n prefix: services.privateProps.prefix,\r\n suffix: services.privateProps.suffix,\r\n },\r\n relatedServiceGetter: {\r\n prefix: services.relatedServiceGetter.prefix,\r\n suffix: services.relatedServiceGetter.suffix,\r\n },\r\n serviceResolverFunction: {\r\n prefix: services.serviceResolverFunction.prefix,\r\n suffix: services.serviceResolverFunction.suffix,\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Creates a defensive copy of the default config.\r\n */\r\nexport function getDefaultConfig(): Omit<RunOptions, \"source\" | \"output\"> {\r\n return deepmerge(defaultConfig, {});\r\n}\r\n\r\n/**\r\n * Creates a defensive copy of the minimal config: minimal in respect to naming.\r\n */\r\nexport function getMinimalConfig(): Omit<RunOptions, \"source\" | \"output\"> {\r\n const { naming, ...passThrough } = defaultConfig;\r\n return deepmerge(passThrough, { naming: minimalNamingConfig });\r\n}\r\n"]}
1
+ {"version":3,"file":"defaultConfig.js","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAElC,+CAA+D;AAC/D,+CAA6D;AAE7D;;GAEG;AACH,MAAM,aAAa,GAA0C;IAC3D,IAAI,EAAE,mBAAK,CAAC,GAAG;IACf,QAAQ,EAAE,uBAAS,CAAC,MAAM;IAC1B,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,eAAe;IACzB,UAAU,EAAE,EAAE;IACd,kBAAkB,EAAE,KAAK;IACzB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,KAAK;IACrB,qBAAqB,EAAE,KAAK;IAC5B,aAAa,EAAE,KAAK;IACpB,gCAAgC,EAAE,KAAK;IACvC,MAAM,EAAE;QACN,MAAM,EAAE;YACN,cAAc,EAAE,8BAAgB,CAAC,WAAW;YAC5C,kBAAkB,EAAE,8BAAgB,CAAC,UAAU;YAC/C,cAAc,EAAE;gBACd,MAAM,EAAE,UAAU;gBAClB,MAAM,EAAE,EAAE;gBACV,gBAAgB,EAAE,IAAI;aACvB;YACD,QAAQ,EAAE;gBACR,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,IAAI;gBACZ,gBAAgB,EAAE,IAAI;aACvB;YACD,oBAAoB,EAAE;gBACpB,MAAM,EA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I,EAAE;YACJ,kBAAkB,EAAE,IAAI;SACzB;QACD,UAAU,EAAE;YACV,kBAAkB,EAAE,IAAI;YACxB,MAAM,EAAE,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;QACD,uBAAuB,EAAE;YACvB,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,MAAM;YAC/C,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,MAAM;SAChD;KACF;CACF,CAAC;AAEF;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,mBAAS,EAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAFD,4CAEC;AAED;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,EAAE,MAAM,KAAqB,aAAa,EAA7B,WAAW,kBAAK,aAAa,EAA1C,UAA0B,CAAgB,CAAC;IACjD,OAAO,IAAA,mBAAS,EAAC,WAAW,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACjE,CAAC;AAHD,4CAGC","sourcesContent":["import deepmerge from \"deepmerge\";\r\n\r\nimport { NameSettings, NamingStrategies } from \"./NamingModel\";\r\nimport { EmitModes, Modes, RunOptions } from \"./OptionModel\";\r\n\r\n/**\r\n * The default configuration.\r\n */\r\nconst defaultConfig: Omit<RunOptions, \"source\" | \"output\"> = {\r\n mode: Modes.all,\r\n emitMode: EmitModes.js_dts,\r\n debug: false,\r\n prettier: false,\r\n tsconfig: \"tsconfig.json\",\r\n converters: [],\r\n skipEditableModels: false,\r\n skipIdModels: false,\r\n skipOperations: false,\r\n disableAutoManagedKey: false,\r\n allowRenaming: false,\r\n v2ModelsWithExtraResultsWrapping: false,\r\n naming: {\r\n models: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n propNamingStrategy: NamingStrategies.CAMEL_CASE,\r\n editableModels: {\r\n prefix: \"Editable\",\r\n suffix: \"\",\r\n applyModelNaming: true,\r\n },\r\n idModels: {\r\n prefix: \"\",\r\n suffix: \"Id\",\r\n applyModelNaming: true,\r\n },\r\n operationParamModels: {\r\n prefix: \"\",\r\n suffix: \"Params\",\r\n applyModelNaming: true,\r\n },\r\n fileName: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n prefix: \"\",\r\n suffix: \"Model\",\r\n },\r\n },\r\n queryObjects: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n propNamingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"Q\",\r\n suffix: \"\",\r\n idFunctions: {\r\n prefix: \"\",\r\n suffix: \"Id\",\r\n },\r\n fileName: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n prefix: \"Q\",\r\n suffix: \"\",\r\n },\r\n },\r\n services: {\r\n prefix: \"\",\r\n suffix: \"Service\",\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n main: {\r\n applyServiceNaming: true,\r\n },\r\n collection: {\r\n prefix: \"\",\r\n suffix: \"Collection\",\r\n applyServiceNaming: true,\r\n },\r\n serviceResolverFunction: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"create\",\r\n suffix: \"serviceResolver\",\r\n },\r\n operations: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n },\r\n relatedServiceGetter: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"navTo\",\r\n suffix: \"\",\r\n },\r\n privateProps: {\r\n namingStrategy: NamingStrategies.CAMEL_CASE,\r\n prefix: \"_\",\r\n suffix: \"\",\r\n },\r\n publicProps: {\r\n namingStrategy: NamingStrategies.PASCAL_CASE,\r\n },\r\n },\r\n },\r\n propertiesByName: [],\r\n entitiesByName: [],\r\n};\r\n\r\nconst { models, queryObjects, services } = defaultConfig.naming;\r\nconst minimalNamingConfig: NameSettings = {\r\n models: {\r\n fileName: {\r\n prefix: models.fileName.prefix,\r\n suffix: models.fileName.suffix,\r\n },\r\n idModels: {\r\n applyModelNaming: true,\r\n prefix: models.idModels.prefix,\r\n suffix: models.idModels.suffix,\r\n },\r\n editableModels: {\r\n applyModelNaming: true,\r\n prefix: models.editableModels.prefix,\r\n suffix: models.editableModels.suffix,\r\n },\r\n operationParamModels: {\r\n applyModelNaming: true,\r\n prefix: models.operationParamModels.prefix,\r\n suffix: models.operationParamModels.suffix,\r\n },\r\n },\r\n queryObjects: {\r\n prefix: queryObjects.prefix,\r\n suffix: queryObjects.suffix,\r\n fileName: {\r\n prefix: queryObjects.fileName.prefix,\r\n suffix: queryObjects.fileName.suffix,\r\n },\r\n idFunctions: {\r\n prefix: queryObjects.idFunctions.prefix,\r\n suffix: queryObjects.idFunctions.suffix,\r\n },\r\n },\r\n services: {\r\n prefix: services.prefix,\r\n suffix: services.suffix,\r\n main: {\r\n applyServiceNaming: true,\r\n },\r\n collection: {\r\n applyServiceNaming: true,\r\n prefix: services.collection.prefix,\r\n suffix: services.collection.suffix,\r\n },\r\n privateProps: {\r\n prefix: services.privateProps.prefix,\r\n suffix: services.privateProps.suffix,\r\n },\r\n relatedServiceGetter: {\r\n prefix: services.relatedServiceGetter.prefix,\r\n suffix: services.relatedServiceGetter.suffix,\r\n },\r\n serviceResolverFunction: {\r\n prefix: services.serviceResolverFunction.prefix,\r\n suffix: services.serviceResolverFunction.suffix,\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * Creates a defensive copy of the default config.\r\n */\r\nexport function getDefaultConfig(): Omit<RunOptions, \"source\" | \"output\"> {\r\n return deepmerge(defaultConfig, {});\r\n}\r\n\r\n/**\r\n * Creates a defensive copy of the minimal config: minimal in respect to naming.\r\n */\r\nexport function getMinimalConfig(): Omit<RunOptions, \"source\" | \"output\"> {\r\n const { naming, ...passThrough } = defaultConfig;\r\n return deepmerge(passThrough, { naming: minimalNamingConfig });\r\n}\r\n"]}
@@ -47,7 +47,7 @@ function evaluateConfigOptions(cliOpts, configOpts) {
47
47
  throw new Error("No services were configured in config file, so options --source and --output must be specified!");
48
48
  }
49
49
  const merged = deepmerge_1.default.all([defaultConfig, confBaseOpts, cliOpts]);
50
- return [safeGuardSkippingOptions(merged)];
50
+ return [safeGuardOptions(merged)];
51
51
  }
52
52
  // Either services are specified or we use all configured services
53
53
  const servicesToUse = (cliServices === null || cliServices === void 0 ? void 0 : cliServices.length) ? cliServices : Object.keys(confServices);
@@ -59,20 +59,25 @@ function evaluateConfigOptions(cliOpts, configOpts) {
59
59
  }
60
60
  const serviceDefault = ((_a = service.naming) === null || _a === void 0 ? void 0 : _a.minimalDefaults) && !((_b = configOpts === null || configOpts === void 0 ? void 0 : configOpts.naming) === null || _b === void 0 ? void 0 : _b.minimalDefaults) ? (0, defaultConfig_1.getMinimalConfig)() : defaultConfig;
61
61
  const merged = deepmerge_1.default.all([serviceDefault, confBaseOpts, service, cliBaseOpts]);
62
- return safeGuardSkippingOptions(merged);
62
+ return safeGuardOptions(merged);
63
63
  });
64
64
  }
65
65
  exports.evaluateConfigOptions = evaluateConfigOptions;
66
66
  /**
67
- * Make sure that skipping options are deactivated for service generation.
67
+ * Make sure that some options are only active if in correct mode.
68
68
  * @param options
69
69
  */
70
- function safeGuardSkippingOptions(options) {
70
+ function safeGuardOptions(options) {
71
+ // skip options are not valid for service generation
71
72
  if (options.mode === OptionModel_1.Modes.service || options.mode === OptionModel_1.Modes.all) {
72
73
  options.skipEditableModels = false;
73
74
  options.skipIdModels = false;
74
75
  options.skipOperations = false;
75
76
  }
77
+ // special option which is only valid for model generation
78
+ if (options.mode !== OptionModel_1.Modes.models) {
79
+ options.v2ModelsWithExtraResultsWrapping = false;
80
+ }
76
81
  return options;
77
82
  }
78
83
  //# sourceMappingURL=evaluateConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateConfig.js","sourceRoot":"","sources":["../src/evaluateConfig.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAElC,mDAAqE;AACrE,+CAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,qBAAqB,CACnC,OAAmB,EACnB,UAAyC;;IAEzC,MAAM,aAAa,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,0CAAE,eAAe,EAAC,CAAC,CAAC,IAAA,gCAAgB,GAAE,CAAC,CAAC,CAAC,IAAA,gCAAgB,GAAE,CAAC;IACpG,iBAAiB;IACjB,IAAI,CAAC,UAAU,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;SACpG;QACD,OAAO,CAAC,IAAA,mBAAS,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;KAC5C;IAED,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAqB,OAAO,EAAvB,WAAW,kBAAK,OAAO,EAAnE,gCAAyD,CAAU,CAAC;IAC1E,MAAM,EAAE,QAAQ,EAAE,YAAY,KAAsB,UAAU,EAA3B,YAAY,kBAAK,UAAU,EAAxD,YAA2C,CAAa,CAAC;IAE/D,+CAA+C;IAC/C,iEAAiE;IACjE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE;QACvC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE;YACtB,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAC;SACH;QACD,MAAM,MAAM,GAAG,mBAAS,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,YAAY,E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AACjB,CAAC","sourcesContent":["import deepmerge from \"deepmerge\";\r\n\r\nimport { getDefaultConfig, getMinimalConfig } from \"./defaultConfig\";\r\nimport { CliOptions, ConfigFileOptions, Modes, RunOptions } from \"./OptionModel\";\r\n\r\n/**\r\n * Provides default values and evaluates the various config file and CLI options.\r\n * This function always returns a list of RunOptions,\r\n * whereby each item represents one generation run / one service.\r\n *\r\n * Configurations are merged in the following order (last one wins):\r\n * - default values\r\n * - config file: base settings\r\n * - config file: service specific settings\r\n * - CLI options\r\n *\r\n * If the CLI options specify source and output, then the service config is completely ignored and only the\r\n * base settings are applied from the config file.\r\n *\r\n * If the CLI options do not specify source and output, but do specify services, then these services must\r\n * exist in the config file and each service must supply values for source and output as a minimum.\r\n *\r\n * If the CLI options neither entail source nor services, then at least one service must be configured in the\r\n * config file. All configured services are returned.\r\n *\r\n * @param cliOpts CLI passed options\r\n * @param configOpts config file options\r\n */\r\nexport function evaluateConfigOptions(\r\n cliOpts: CliOptions,\r\n configOpts: ConfigFileOptions | undefined\r\n): Array<RunOptions> {\r\n const defaultConfig = configOpts?.naming?.minimalDefaults ? getMinimalConfig() : getDefaultConfig();\r\n // No config file\r\n if (!configOpts) {\r\n if (!cliOpts.source || !cliOpts.output) {\r\n throw new Error(\"Without any configuration file options --source and --output must be specified!\");\r\n }\r\n return [deepmerge(defaultConfig, cliOpts)];\r\n }\r\n\r\n const { services: cliServices, source, output, ...cliBaseOpts } = cliOpts;\r\n const { services: confServices, ...confBaseOpts } = configOpts;\r\n\r\n // No configurations of services in config file\r\n // or CLI opts specify source and output => ignore service config\r\n if ((source && output) || !confServices) {\r\n if (!source || !output) {\r\n throw new Error(\r\n \"No services were configured in config file, so options --source and --output must be specified!\"\r\n );\r\n }\r\n const merged = deepmerge.all([defaultConfig, confBaseOpts, cliOpts]) as RunOptions;\r\n return [safeGuardSkippingOptions(merged)];\r\n }\r\n\r\n // Either services are specified or we use all configured services\r\n const servicesToUse = cliServices?.length ? cliServices : Object.keys(confServices);\r\n return servicesToUse.map((s) => {\r\n const service = confServices[s];\r\n if (!service) {\r\n throw new Error(`Specified service \"${s}\" doesn't exist in configuration!`);\r\n }\r\n const serviceDefault =\r\n service.naming?.minimalDefaults && !configOpts?.naming?.minimalDefaults ? getMinimalConfig() : defaultConfig;\r\n const merged = deepmerge.all([serviceDefault, confBaseOpts, service, cliBaseOpts]) as RunOptions;\r\n return safeGuardSkippingOptions(merged);\r\n });\r\n}\r\n\r\n/**\r\n * Make sure that skipping options are deactivated for service generation.\r\n * @param options\r\n */\r\nfunction safeGuardSkippingOptions(options: RunOptions): RunOptions {\r\n if (options.mode === Modes.service || options.mode === Modes.all) {\r\n options.skipEditableModels = false;\r\n options.skipIdModels = false;\r\n options.skipOperations = false;\r\n }\r\n\r\n return options;\r\n}\r\n"]}
1
+ {"version":3,"file":"evaluateConfig.js","sourceRoot":"","sources":["../src/evaluateConfig.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAElC,mDAAqE;AACrE,+CAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,qBAAqB,CACnC,OAAmB,EACnB,UAAyC;;IAEzC,MAAM,aAAa,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,0CAAE,eAAe,EAAC,CAAC,CAAC,IAAA,gCAAgB,GAAE,CAAC,CAAC,CAAC,IAAA,gCAAgB,GAAE,CAAC;IACpG,iBAAiB;IACjB,IAAI,CAAC,UAAU,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;SACpG;QACD,OAAO,CAAC,IAAA,mBAAS,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;KAC5C;IAED,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAqB,OAAO,EAAvB,WAAW,kBAAK,OA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G,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC;AAxCD,sDAwCC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CAAC,OAAmB;IAC3C,oDAAoD;IACpD,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAK,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAK,CAAC,GAAG,EAAE;QAChE,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC;QACnC,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC;QAC7B,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC;KAChC;IACD,0DAA0D;IAC1D,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAK,CAAC,MAAM,EAAE;QACjC,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC;KAClD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import deepmerge from \"deepmerge\";\r\n\r\nimport { getDefaultConfig, getMinimalConfig } from \"./defaultConfig\";\r\nimport { CliOptions, ConfigFileOptions, Modes, RunOptions } from \"./OptionModel\";\r\n\r\n/**\r\n * Provides default values and evaluates the various config file and CLI options.\r\n * This function always returns a list of RunOptions,\r\n * whereby each item represents one generation run / one service.\r\n *\r\n * Configurations are merged in the following order (last one wins):\r\n * - default values\r\n * - config file: base settings\r\n * - config file: service specific settings\r\n * - CLI options\r\n *\r\n * If the CLI options specify source and output, then the service config is completely ignored and only the\r\n * base settings are applied from the config file.\r\n *\r\n * If the CLI options do not specify source and output, but do specify services, then these services must\r\n * exist in the config file and each service must supply values for source and output as a minimum.\r\n *\r\n * If the CLI options neither entail source nor services, then at least one service must be configured in the\r\n * config file. All configured services are returned.\r\n *\r\n * @param cliOpts CLI passed options\r\n * @param configOpts config file options\r\n */\r\nexport function evaluateConfigOptions(\r\n cliOpts: CliOptions,\r\n configOpts: ConfigFileOptions | undefined\r\n): Array<RunOptions> {\r\n const defaultConfig = configOpts?.naming?.minimalDefaults ? getMinimalConfig() : getDefaultConfig();\r\n // No config file\r\n if (!configOpts) {\r\n if (!cliOpts.source || !cliOpts.output) {\r\n throw new Error(\"Without any configuration file options --source and --output must be specified!\");\r\n }\r\n return [deepmerge(defaultConfig, cliOpts)];\r\n }\r\n\r\n const { services: cliServices, source, output, ...cliBaseOpts } = cliOpts;\r\n const { services: confServices, ...confBaseOpts } = configOpts;\r\n\r\n // No configurations of services in config file\r\n // or CLI opts specify source and output => ignore service config\r\n if ((source && output) || !confServices) {\r\n if (!source || !output) {\r\n throw new Error(\r\n \"No services were configured in config file, so options --source and --output must be specified!\"\r\n );\r\n }\r\n const merged = deepmerge.all([defaultConfig, confBaseOpts, cliOpts]) as RunOptions;\r\n return [safeGuardOptions(merged)];\r\n }\r\n\r\n // Either services are specified or we use all configured services\r\n const servicesToUse = cliServices?.length ? cliServices : Object.keys(confServices);\r\n return servicesToUse.map((s) => {\r\n const service = confServices[s];\r\n if (!service) {\r\n throw new Error(`Specified service \"${s}\" doesn't exist in configuration!`);\r\n }\r\n const serviceDefault =\r\n service.naming?.minimalDefaults && !configOpts?.naming?.minimalDefaults ? getMinimalConfig() : defaultConfig;\r\n const merged = deepmerge.all([serviceDefault, confBaseOpts, service, cliBaseOpts]) as RunOptions;\r\n return safeGuardOptions(merged);\r\n });\r\n}\r\n\r\n/**\r\n * Make sure that some options are only active if in correct mode.\r\n * @param options\r\n */\r\nfunction safeGuardOptions(options: RunOptions): RunOptions {\r\n // skip options are not valid for service generation\r\n if (options.mode === Modes.service || options.mode === Modes.all) {\r\n options.skipEditableModels = false;\r\n options.skipIdModels = false;\r\n options.skipOperations = false;\r\n }\r\n // special option which is only valid for model generation\r\n if (options.mode !== Modes.models) {\r\n options.v2ModelsWithExtraResultsWrapping = false;\r\n }\r\n\r\n return options;\r\n}\r\n"]}
@@ -84,7 +84,13 @@ class ModelGenerator {
84
84
  }
85
85
  // Collections
86
86
  if (prop.isCollection) {
87
- return `Array<${prop.type}>` + suffix;
87
+ const type = `Array<${prop.type}>`;
88
+ if (this.dataModel.isV2() && this.options.v2ModelsWithExtraResultsWrapping) {
89
+ return `{ results: ${type} }` + suffix;
90
+ }
91
+ else {
92
+ return type + suffix;
93
+ }
88
94
  }
89
95
  // primitive, enum & complex types
90
96
  return prop.type + (prop.required ? "" : " | null") + suffix;
@@ -1 +1 @@
1
- {"version":3,"file":"ModelGenerator.js","sourceRoot":"","sources":["../../src/generator/ModelGenerator.ts"],"names":[],"mappings":";;;AAOA,uDAAoD;AAE7C,MAAM,cAAc,GAAiC,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;IACpH,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC5F,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,MAAM,cAAc;IAGlB,YACU,SAAoB,EACpB,UAAsB,EACtB,OAAsB,EACtB,OAAiC,EACjC,YAA0B;QAJ1B,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;QACtB,YAAO,GAAP,OAAO,CAAe;QACtB,YAAO,GAAP,OAAO,CAA0B;QACjC,iBAAY,GAAZ,YAAY,CAAc;IACjC,CAAC;IAEG,QAAQ;QACb,IAAI,CAAC,eAAe,GAAG,IAAI,iCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAChC,IAAI,CAAC,8BAA8B,EAAE,CAAC;SACvC;IACH,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC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C3B,IAAI,EAAE,SAAS,CAAC,eAAe;YAC/B,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACzC,OAAO;oBACL,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;oBACzB,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ;iBAC9B,CAAC;YACJ,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"../data-model/DataModel\";\r\nimport { ComplexType, DataTypes, ModelType, OperationType, PropertyModel } from \"../data-model/DataTypeModel\";\r\nimport { NamingHelper } from \"../data-model/NamingHelper\";\r\nimport { EntityBasedGeneratorFunction, GeneratorFunctionOptions } from \"../FactoryFunctionModel\";\r\nimport { ImportContainer } from \"./ImportContainer\";\r\n\r\nexport const generateModels: EntityBasedGeneratorFunction = (dataModel, sourceFile, version, options, namingHelper) => {\r\n const generator = new ModelGenerator(dataModel, sourceFile, version, options, namingHelper);\r\n return generator.generate();\r\n};\r\n\r\nconst DEFERRED_CONTENT = \"DeferredContent\";\r\n\r\nclass ModelGenerator {\r\n private importContainer!: ImportContainer;\r\n\r\n constructor(\r\n private dataModel: DataModel,\r\n private sourceFile: SourceFile,\r\n private version: ODataVersions,\r\n private options: GeneratorFunctionOptions,\r\n private namingHelper: NamingHelper\r\n ) {}\r\n\r\n public generate(): void {\r\n this.importContainer = new ImportContainer(this.namingHelper.getFileNames());\r\n\r\n this.generateEnums();\r\n this.generateModels();\r\n if (!this.options.skipOperations) {\r\n this.generateUnboundOperationParams();\r\n }\r\n }\r\n\r\n private generateEnums() {\r\n this.dataModel.getEnums().forEach((et) => {\r\n this.sourceFile.addEnum({\r\n name: et.name,\r\n isExported: true,\r\n members: et.members.map((mem) => ({ name: mem, initializer: `\"${mem}\"` })),\r\n });\r\n });\r\n }\r\n\r\n private generateModels() {\r\n this.dataModel.getModels().forEach((model) => {\r\n this.generateModel(model);\r\n if (!this.options.skipIdModels) {\r\n this.generateIdModel(model);\r\n }\r\n if (!this.options.skipEditableModels) {\r\n this.generateEditableModel(model);\r\n }\r\n if (!this.options.skipOperations) {\r\n this.generateBoundOperationParams(model.name);\r\n }\r\n });\r\n this.dataModel.getComplexTypes().forEach((model) => {\r\n this.generateModel(model);\r\n if (!this.options.skipEditableModels) {\r\n this.generateEditableModel(model);\r\n }\r\n });\r\n\r\n this.sourceFile.addImportDeclarations(this.importContainer.getImportDeclarations());\r\n }\r\n\r\n private generateModel(model: ComplexType) {\r\n this.sourceFile.addInterface({\r\n name: model.name,\r\n isExported: true,\r\n properties: model.props.map((p) => {\r\n const isEntity = p.dataType == DataTypes.ModelType;\r\n return {\r\n name: p.name,\r\n type: this.getPropType(p),\r\n // props for entities or entity collections are not added in V4 if not explicitly expanded\r\n hasQuestionToken: this.dataModel.isV4() && isEntity,\r\n };\r\n }),\r\n extends: model.baseClasses,\r\n });\r\n }\r\n\r\n private getPropType(prop: PropertyModel): string {\r\n const isEntity = prop.dataType == DataTypes.ModelType;\r\n\r\n // V2 entity special: deferred content\r\n let suffix = \"\";\r\n if (isEntity && this.dataModel.isV2()) {\r\n this.importContainer.addFromCore(DEFERRED_CONTENT);\r\n suffix = ` | ${DEFERRED_CONTENT}`;\r\n }\r\n // custom types which require type imports => possible via converters\r\n else if (prop.typeModule) {\r\n this.importContainer.addCustomType(prop.typeModule, prop.type);\r\n }\r\n\r\n // Collections\r\n if (prop.isCollection) {\r\n return `Array<${prop.type}>` + suffix;\r\n }\r\n\r\n // primitive, enum & complex types\r\n return prop.type + (prop.required ? \"\" : \" | null\") + suffix;\r\n }\r\n\r\n private generateIdModel(model: ModelType) {\r\n if (!model.generateId) {\r\n return;\r\n }\r\n const singleType = model.keys.length === 1 ? `${model.keys[0].type} | ` : \"\";\r\n const keyTypes = model.keys.map((keyProp) => `${keyProp.name}: ${this.getPropType(keyProp)}`).join(\",\");\r\n const type = `${singleType}{${keyTypes}}`;\r\n\r\n this.sourceFile.addTypeAlias({\r\n name: model.idModelName,\r\n isExported: true,\r\n type,\r\n });\r\n }\r\n\r\n private generateEditableModel(model: ComplexType) {\r\n const entityTypes = [DataTypes.ModelType, DataTypes.ComplexType];\r\n const allProps = [...model.baseProps, ...model.props].filter((p) => !p.managed);\r\n\r\n const requiredProps = allProps\r\n .filter((p) => p.required && !entityTypes.includes(p.dataType))\r\n .map((p) => `\"${p.name}\"`)\r\n .join(\" | \");\r\n const optionalProps = allProps\r\n .filter((p) => !p.required && !entityTypes.includes(p.dataType))\r\n .map((p) => `\"${p.name}\"`)\r\n .join(\" | \");\r\n const complexProps = allProps.filter((p) => p.dataType === DataTypes.ComplexType);\r\n\r\n const extendsClause = [\r\n requiredProps ? `Pick<${model.name}, ${requiredProps}>` : null,\r\n optionalProps ? `Partial<Pick<${model.name}, ${optionalProps}>>` : null,\r\n ].filter((e): e is string => !!e);\r\n\r\n this.sourceFile.addInterface({\r\n name: model.editableName,\r\n isExported: true,\r\n extends: extendsClause,\r\n properties: !complexProps\r\n ? undefined\r\n : complexProps.map((p) => {\r\n return {\r\n name: p.name,\r\n type: this.getEditablePropType(p),\r\n // optional props don't need to be specified in editable model\r\n // also, entities would require deep insert func => we make it optional for now\r\n hasQuestionToken: !p.required || p.dataType === DataTypes.ModelType,\r\n };\r\n }),\r\n });\r\n }\r\n\r\n private getEditablePropType(prop: PropertyModel): string {\r\n const type =\r\n prop.dataType === DataTypes.ModelType\r\n ? this.dataModel.getModel(prop.type).editableName\r\n : prop.dataType === DataTypes.ComplexType\r\n ? this.dataModel.getComplexType(prop.type).editableName\r\n : prop.type;\r\n\r\n // Collections\r\n if (prop.isCollection) {\r\n return `Array<${type}>`;\r\n }\r\n\r\n // primitive, enum & complex types\r\n return type + (prop.required ? \"\" : \" | null\");\r\n }\r\n\r\n private generateUnboundOperationParams() {\r\n this.dataModel.getUnboundOperationTypes().forEach((operation) => {\r\n this.generateOperationParams(operation);\r\n });\r\n }\r\n\r\n private generateBoundOperationParams(entityName: string) {\r\n this.dataModel.getOperationTypeByEntityOrCollectionBinding(entityName).forEach((operation) => {\r\n this.generateOperationParams(operation);\r\n });\r\n }\r\n\r\n private generateOperationParams(operation: OperationType) {\r\n if (!operation.parameters.length) {\r\n return;\r\n }\r\n this.sourceFile.addInterface({\r\n name: operation.paramsModelName,\r\n isExported: true,\r\n properties: operation.parameters.map((p) => {\r\n return {\r\n name: p.name,\r\n type: this.getPropType(p),\r\n hasQuestionToken: !p.required,\r\n };\r\n }),\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ModelGenerator.js","sourceRoot":"","sources":["../../src/generator/ModelGenerator.ts"],"names":[],"mappings":";;;AAOA,uDAAoD;AAE7C,MAAM,cAAc,GAAiC,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;IACpH,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC5F,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,MAAM,cAAc;IAGlB,YACU,SAAoB,EACpB,UAAsB,EACtB,OAAsB,EACtB,OAAiC,EACjC,YAA0B;QAJ1B,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;QACtB,YAAO,GAAP,OAAO,CAAe;QACtB,YAAO,GAAP,OAAO,CAA0B;QACjC,iBAAY,GAAZ,YAAY,CAAc;IACjC,CAAC;IAEG,QAAQ;QACb,IAAI,CAAC,eAAe,GAAG,IAAI,iCAAe,CAAC,IAAI,CAAC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E;YAC9D,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,4BAA4B,CAAC,UAAkB;QACrD,IAAI,CAAC,SAAS,CAAC,2CAA2C,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3F,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,uBAAuB,CAAC,SAAwB;QACtD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE;YAChC,OAAO;SACR;QACD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YAC3B,IAAI,EAAE,SAAS,CAAC,eAAe;YAC/B,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACzC,OAAO;oBACL,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;oBACzB,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ;iBAC9B,CAAC;YACJ,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"../data-model/DataModel\";\r\nimport { ComplexType, DataTypes, ModelType, OperationType, PropertyModel } from \"../data-model/DataTypeModel\";\r\nimport { NamingHelper } from \"../data-model/NamingHelper\";\r\nimport { EntityBasedGeneratorFunction, GeneratorFunctionOptions } from \"../FactoryFunctionModel\";\r\nimport { ImportContainer } from \"./ImportContainer\";\r\n\r\nexport const generateModels: EntityBasedGeneratorFunction = (dataModel, sourceFile, version, options, namingHelper) => {\r\n const generator = new ModelGenerator(dataModel, sourceFile, version, options, namingHelper);\r\n return generator.generate();\r\n};\r\n\r\nconst DEFERRED_CONTENT = \"DeferredContent\";\r\n\r\nclass ModelGenerator {\r\n private importContainer!: ImportContainer;\r\n\r\n constructor(\r\n private dataModel: DataModel,\r\n private sourceFile: SourceFile,\r\n private version: ODataVersions,\r\n private options: GeneratorFunctionOptions,\r\n private namingHelper: NamingHelper\r\n ) {}\r\n\r\n public generate(): void {\r\n this.importContainer = new ImportContainer(this.namingHelper.getFileNames());\r\n\r\n this.generateEnums();\r\n this.generateModels();\r\n if (!this.options.skipOperations) {\r\n this.generateUnboundOperationParams();\r\n }\r\n }\r\n\r\n private generateEnums() {\r\n this.dataModel.getEnums().forEach((et) => {\r\n this.sourceFile.addEnum({\r\n name: et.name,\r\n isExported: true,\r\n members: et.members.map((mem) => ({ name: mem, initializer: `\"${mem}\"` })),\r\n });\r\n });\r\n }\r\n\r\n private generateModels() {\r\n this.dataModel.getModels().forEach((model) => {\r\n this.generateModel(model);\r\n if (!this.options.skipIdModels) {\r\n this.generateIdModel(model);\r\n }\r\n if (!this.options.skipEditableModels) {\r\n this.generateEditableModel(model);\r\n }\r\n if (!this.options.skipOperations) {\r\n this.generateBoundOperationParams(model.name);\r\n }\r\n });\r\n this.dataModel.getComplexTypes().forEach((model) => {\r\n this.generateModel(model);\r\n if (!this.options.skipEditableModels) {\r\n this.generateEditableModel(model);\r\n }\r\n });\r\n\r\n this.sourceFile.addImportDeclarations(this.importContainer.getImportDeclarations());\r\n }\r\n\r\n private generateModel(model: ComplexType) {\r\n this.sourceFile.addInterface({\r\n name: model.name,\r\n isExported: true,\r\n properties: model.props.map((p) => {\r\n const isEntity = p.dataType == DataTypes.ModelType;\r\n return {\r\n name: p.name,\r\n type: this.getPropType(p),\r\n // props for entities or entity collections are not added in V4 if not explicitly expanded\r\n hasQuestionToken: this.dataModel.isV4() && isEntity,\r\n };\r\n }),\r\n extends: model.baseClasses,\r\n });\r\n }\r\n\r\n private getPropType(prop: PropertyModel): string {\r\n const isEntity = prop.dataType == DataTypes.ModelType;\r\n\r\n // V2 entity special: deferred content\r\n let suffix = \"\";\r\n if (isEntity && this.dataModel.isV2()) {\r\n this.importContainer.addFromCore(DEFERRED_CONTENT);\r\n suffix = ` | ${DEFERRED_CONTENT}`;\r\n }\r\n // custom types which require type imports => possible via converters\r\n else if (prop.typeModule) {\r\n this.importContainer.addCustomType(prop.typeModule, prop.type);\r\n }\r\n\r\n // Collections\r\n if (prop.isCollection) {\r\n const type = `Array<${prop.type}>`;\r\n if (this.dataModel.isV2() && this.options.v2ModelsWithExtraResultsWrapping) {\r\n return `{ results: ${type} }` + suffix;\r\n } else {\r\n return type + suffix;\r\n }\r\n }\r\n\r\n // primitive, enum & complex types\r\n return prop.type + (prop.required ? \"\" : \" | null\") + suffix;\r\n }\r\n\r\n private generateIdModel(model: ModelType) {\r\n if (!model.generateId) {\r\n return;\r\n }\r\n const singleType = model.keys.length === 1 ? `${model.keys[0].type} | ` : \"\";\r\n const keyTypes = model.keys.map((keyProp) => `${keyProp.name}: ${this.getPropType(keyProp)}`).join(\",\");\r\n const type = `${singleType}{${keyTypes}}`;\r\n\r\n this.sourceFile.addTypeAlias({\r\n name: model.idModelName,\r\n isExported: true,\r\n type,\r\n });\r\n }\r\n\r\n private generateEditableModel(model: ComplexType) {\r\n const entityTypes = [DataTypes.ModelType, DataTypes.ComplexType];\r\n const allProps = [...model.baseProps, ...model.props].filter((p) => !p.managed);\r\n\r\n const requiredProps = allProps\r\n .filter((p) => p.required && !entityTypes.includes(p.dataType))\r\n .map((p) => `\"${p.name}\"`)\r\n .join(\" | \");\r\n const optionalProps = allProps\r\n .filter((p) => !p.required && !entityTypes.includes(p.dataType))\r\n .map((p) => `\"${p.name}\"`)\r\n .join(\" | \");\r\n const complexProps = allProps.filter((p) => p.dataType === DataTypes.ComplexType);\r\n\r\n const extendsClause = [\r\n requiredProps ? `Pick<${model.name}, ${requiredProps}>` : null,\r\n optionalProps ? `Partial<Pick<${model.name}, ${optionalProps}>>` : null,\r\n ].filter((e): e is string => !!e);\r\n\r\n this.sourceFile.addInterface({\r\n name: model.editableName,\r\n isExported: true,\r\n extends: extendsClause,\r\n properties: !complexProps\r\n ? undefined\r\n : complexProps.map((p) => {\r\n return {\r\n name: p.name,\r\n type: this.getEditablePropType(p),\r\n // optional props don't need to be specified in editable model\r\n // also, entities would require deep insert func => we make it optional for now\r\n hasQuestionToken: !p.required || p.dataType === DataTypes.ModelType,\r\n };\r\n }),\r\n });\r\n }\r\n\r\n private getEditablePropType(prop: PropertyModel): string {\r\n const type =\r\n prop.dataType === DataTypes.ModelType\r\n ? this.dataModel.getModel(prop.type).editableName\r\n : prop.dataType === DataTypes.ComplexType\r\n ? this.dataModel.getComplexType(prop.type).editableName\r\n : prop.type;\r\n\r\n // Collections\r\n if (prop.isCollection) {\r\n return `Array<${type}>`;\r\n }\r\n\r\n // primitive, enum & complex types\r\n return type + (prop.required ? \"\" : \" | null\");\r\n }\r\n\r\n private generateUnboundOperationParams() {\r\n this.dataModel.getUnboundOperationTypes().forEach((operation) => {\r\n this.generateOperationParams(operation);\r\n });\r\n }\r\n\r\n private generateBoundOperationParams(entityName: string) {\r\n this.dataModel.getOperationTypeByEntityOrCollectionBinding(entityName).forEach((operation) => {\r\n this.generateOperationParams(operation);\r\n });\r\n }\r\n\r\n private generateOperationParams(operation: OperationType) {\r\n if (!operation.parameters.length) {\r\n return;\r\n }\r\n this.sourceFile.addInterface({\r\n name: operation.paramsModelName,\r\n isExported: true,\r\n properties: operation.parameters.map((p) => {\r\n return {\r\n name: p.name,\r\n type: this.getPropType(p),\r\n hasQuestionToken: !p.required,\r\n };\r\n }),\r\n });\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odata2ts/odata2ts",
3
- "version": "0.20.3",
3
+ "version": "0.21.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -87,6 +87,6 @@
87
87
  "typescript": "^4.9.4"
88
88
  },
89
89
  "types": "./lib/index.d.ts",
90
- "gitHead": "b75ce4575da23cb486a5026dd3256c33e82bb485",
90
+ "gitHead": "f58b15c1d3239f3a16f56aec2811fa4071b0789e",
91
91
  "readme": "README.md"
92
92
  }