@odata2ts/odata2ts 0.23.1 → 0.25.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/FactoryFunctionModel.d.ts +13 -13
  3. package/lib/FactoryFunctionModel.js +2 -2
  4. package/lib/FactoryFunctionModel.js.map +1 -1
  5. package/lib/NamingModel.d.ts +182 -182
  6. package/lib/NamingModel.js +11 -11
  7. package/lib/NamingModel.js.map +1 -1
  8. package/lib/OptionModel.d.ts +228 -223
  9. package/lib/OptionModel.js +23 -23
  10. package/lib/OptionModel.js.map +1 -1
  11. package/lib/app.d.ts +8 -8
  12. package/lib/app.js +67 -63
  13. package/lib/app.js.map +1 -1
  14. package/lib/cli.d.ts +3 -3
  15. package/lib/cli.js +153 -153
  16. package/lib/data-model/DataModel.d.ts +88 -85
  17. package/lib/data-model/DataModel.js +141 -134
  18. package/lib/data-model/DataModel.js.map +1 -1
  19. package/lib/data-model/DataModelDigestion.d.ts +48 -44
  20. package/lib/data-model/DataModelDigestion.js +299 -274
  21. package/lib/data-model/DataModelDigestion.js.map +1 -1
  22. package/lib/data-model/DataModelDigestionV2.d.ts +10 -10
  23. package/lib/data-model/DataModelDigestionV2.js +210 -200
  24. package/lib/data-model/DataModelDigestionV2.js.map +1 -1
  25. package/lib/data-model/DataModelDigestionV4.d.ts +3 -3
  26. package/lib/data-model/DataModelDigestionV4.js +197 -195
  27. package/lib/data-model/DataModelDigestionV4.js.map +1 -1
  28. package/lib/data-model/DataTypeModel.d.ts +102 -102
  29. package/lib/data-model/DataTypeModel.js +8 -8
  30. package/lib/data-model/DataTypeModel.js.map +1 -1
  31. package/lib/data-model/NamingHelper.d.ts +57 -55
  32. package/lib/data-model/NamingHelper.js +231 -214
  33. package/lib/data-model/NamingHelper.js.map +1 -1
  34. package/lib/data-model/ServiceConfigHelper.d.ts +21 -21
  35. package/lib/data-model/ServiceConfigHelper.js +113 -113
  36. package/lib/data-model/edmx/ODataEdmxModelBase.d.ts +92 -80
  37. package/lib/data-model/edmx/ODataEdmxModelBase.js +2 -2
  38. package/lib/data-model/edmx/ODataEdmxModelBase.js.map +1 -1
  39. package/lib/data-model/edmx/ODataEdmxModelV3.d.ts +63 -63
  40. package/lib/data-model/edmx/ODataEdmxModelV3.js +2 -2
  41. package/lib/data-model/edmx/ODataEdmxModelV4.d.ts +67 -67
  42. package/lib/data-model/edmx/ODataEdmxModelV4.js +2 -2
  43. package/lib/defaultConfig.d.ts +9 -9
  44. package/lib/defaultConfig.js +165 -164
  45. package/lib/defaultConfig.js.map +1 -1
  46. package/lib/evaluateConfig.d.ts +25 -25
  47. package/lib/evaluateConfig.js +82 -82
  48. package/lib/generator/ImportContainer.d.ts +16 -16
  49. package/lib/generator/ImportContainer.js +91 -91
  50. package/lib/generator/ModelGenerator.d.ts +2 -2
  51. package/lib/generator/ModelGenerator.js +211 -183
  52. package/lib/generator/ModelGenerator.js.map +1 -1
  53. package/lib/generator/QueryObjectGenerator.d.ts +2 -2
  54. package/lib/generator/QueryObjectGenerator.js +239 -239
  55. package/lib/generator/ServiceGenerator.d.ts +8 -8
  56. package/lib/generator/ServiceGenerator.js +422 -422
  57. package/lib/generator/index.d.ts +3 -3
  58. package/lib/generator/index.js +9 -9
  59. package/lib/index.d.ts +3 -3
  60. package/lib/index.js +6 -6
  61. package/lib/project/ProjectManager.d.ts +30 -30
  62. package/lib/project/ProjectManager.js +177 -175
  63. package/lib/project/ProjectManager.js.map +1 -1
  64. package/lib/project/formatter/BaseFormatter.d.ts +49 -49
  65. package/lib/project/formatter/BaseFormatter.js +30 -30
  66. package/lib/project/formatter/FileFormatter.d.ts +16 -16
  67. package/lib/project/formatter/FileFormatter.js +2 -2
  68. package/lib/project/formatter/NoopFormatter.d.ts +29 -29
  69. package/lib/project/formatter/NoopFormatter.js +42 -42
  70. package/lib/project/formatter/PrettierFormatter.d.ts +46 -46
  71. package/lib/project/formatter/PrettierFormatter.js +92 -92
  72. package/lib/project/formatter/index.d.ts +2 -2
  73. package/lib/project/formatter/index.js +14 -14
  74. package/lib/project/logger/logFilePath.d.ts +1 -1
  75. package/lib/project/logger/logFilePath.js +12 -12
  76. package/lib/run-cli.d.ts +2 -2
  77. package/lib/run-cli.js +6 -6
  78. package/package.json +27 -28
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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.25.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.24.0...@odata2ts/odata2ts@0.25.0) (2023-07-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **odata2ts:** use qualified name for bound operations ([#182](https://github.com/odata2ts/odata2ts/issues/182)) ([120c9b8](https://github.com/odata2ts/odata2ts/commit/120c9b807ac209a8eb82b389bc7c21d7df7fe876))
11
+
12
+ ### Features
13
+
14
+ * **odata2ts:** support for multiple namespaces by merging ([#175](https://github.com/odata2ts/odata2ts/issues/175)) ([db8fd61](https://github.com/odata2ts/odata2ts/commit/db8fd6165c57ceb9e04488789a62f2a5467ecc68))
15
+ * **odata2ts:** support schema alias ([#181](https://github.com/odata2ts/odata2ts/issues/181)) ([e0c04a8](https://github.com/odata2ts/odata2ts/commit/e0c04a83e32d99187652966bb9cc32f36ead3df2))
16
+ * **odata2ts:** support TypeDefinition elements ([#183](https://github.com/odata2ts/odata2ts/issues/183)) ([d77d2cb](https://github.com/odata2ts/odata2ts/commit/d77d2cbf17383dab50d35bb7374e08a83d264db2))
17
+
18
+ # [0.24.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.23.1...@odata2ts/odata2ts@0.24.0) (2023-06-14)
19
+
20
+ ### Features
21
+
22
+ * **odata2ts:** generate comments for model properties ([#173](https://github.com/odata2ts/odata2ts/issues/173)) ([b218297](https://github.com/odata2ts/odata2ts/commit/b2182974637499060d7d0c8d358da17ca03608e0))
23
+
6
24
  ## [0.23.1](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.23.0...@odata2ts/odata2ts@0.23.1) (2023-06-10)
7
25
 
8
26
  **Note:** Version bump only for package @odata2ts/odata2ts
@@ -22,7 +40,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
22
40
  ### BREAKING CHANGES
23
41
 
24
42
  * **odata2ts:** Changed defaults for properties representing related services: no prefix anymore, just the name of the property as function (previously, prefix `navTo`).
43
+
25
44
  Removed `get` method of EntitySetServices: use property directly instead.
45
+
26
46
  Removed the following naming options regarding generated services: `serviceResolverFunction`, `publicProps`
27
47
 
28
48
  # [0.21.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.20.3...@odata2ts/odata2ts@0.21.0) (2023-04-20)
@@ -36,7 +56,9 @@ Removed the following naming options regarding generated services: `serviceResol
36
56
  ### Bug Fixes
37
57
 
38
58
  * **odata2ts:** add empty array as type for empty params ([#154](https://github.com/odata2ts/odata2ts/issues/154)) ([fbdd000](https://github.com/odata2ts/odata2ts/commit/fbdd0005d46d7d402d8039bec3ea4aecdb593b88))
59
+
39
60
  * prevent idModel and qIdFunction from baseclass to be overwritten in digester which breaks multiple inheritance ([#150](https://github.com/odata2ts/odata2ts/issues/150)) ([e17038e](https://github.com/odata2ts/odata2ts/commit/e17038ee0e924101f9dd6ed97e10da5847cb8857))
61
+
40
62
  * Reorder models and qobjects by inheritance (base types first) ([#151](https://github.com/odata2ts/odata2ts/issues/151)) ([7d456fe](https://github.com/odata2ts/odata2ts/commit/7d456fe3fd28b246721a170cd878d04c3dbc2d80))
41
63
 
42
64
  ## [0.20.2](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.20.1...@odata2ts/odata2ts@0.20.2) (2023-04-13)
@@ -1,13 +1,13 @@
1
- import { ODataVersions } from "@odata2ts/odata-core";
2
- import { SourceFile } from "ts-morph";
3
- import { DataModel } from "./data-model/DataModel";
4
- import { Schema } from "./data-model/edmx/ODataEdmxModelBase";
5
- import { NamingHelper } from "./data-model/NamingHelper";
6
- import { RunOptions } from "./OptionModel";
7
- export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName" | "v2ModelsWithExtraResultsWrapping" | "skipEditableModels">;
8
- /**
9
- * Takes an EdmxSchema plus the run options and creates a DataModel.
10
- */
11
- export type DigesterFunction<S extends Schema<any, any>> = (schema: S, options: DigestionOptions, namingHelper: NamingHelper) => Promise<DataModel>;
12
- export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "v2ModelsWithExtraResultsWrapping">;
13
- export type EntityBasedGeneratorFunction = (dataModel: DataModel, sourceFile: SourceFile, version: ODataVersions, options: GeneratorFunctionOptions, namingHelper: NamingHelper) => void;
1
+ import { ODataVersions } from "@odata2ts/odata-core";
2
+ import { SourceFile } from "ts-morph";
3
+ import { DataModel } from "./data-model/DataModel";
4
+ import { Schema } from "./data-model/edmx/ODataEdmxModelBase";
5
+ import { NamingHelper } from "./data-model/NamingHelper";
6
+ import { RunOptions } from "./OptionModel";
7
+ export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName" | "v2ModelsWithExtraResultsWrapping" | "skipEditableModels" | "skipComments">;
8
+ /**
9
+ * Takes an EdmxSchema plus the run options and creates a DataModel.
10
+ */
11
+ export type DigesterFunction<S extends Schema<any, any>> = (schema: Array<S>, options: DigestionOptions, namingHelper: NamingHelper) => Promise<DataModel>;
12
+ export type GeneratorFunctionOptions = Pick<RunOptions, "skipEditableModels" | "skipIdModels" | "skipOperations" | "skipComments" | "v2ModelsWithExtraResultsWrapping">;
13
+ export type EntityBasedGeneratorFunction = (dataModel: DataModel, sourceFile: SourceFile, version: ODataVersions, options: GeneratorFunctionOptions, namingHelper: NamingHelper) => void;
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=FactoryFunctionModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"./data-model/DataModel\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { RunOptions } from \"./OptionModel\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n | \"converters\"\r\n | \"disableAutoManagedKey\"\r\n | \"propertiesByName\"\r\n | \"entitiesByName\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"skipEditableModels\"\r\n>;\r\n\r\n/**\r\n * Takes an EdmxSchema plus the run options and creates a DataModel.\r\n */\r\nexport type DigesterFunction<S extends Schema<any, any>> = (\r\n schema: S,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper\r\n) => Promise<DataModel>;\r\n\r\nexport type GeneratorFunctionOptions = Pick<\r\n RunOptions,\r\n \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\" | \"v2ModelsWithExtraResultsWrapping\"\r\n>;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n dataModel: DataModel,\r\n sourceFile: SourceFile,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper\r\n) => void;\r\n"]}
1
+ {"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { SourceFile } from \"ts-morph\";\r\n\r\nimport { DataModel } from \"./data-model/DataModel\";\r\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { RunOptions } from \"./OptionModel\";\r\n\r\nexport type DigestionOptions = Pick<\r\n RunOptions,\r\n | \"converters\"\r\n | \"disableAutoManagedKey\"\r\n | \"propertiesByName\"\r\n | \"entitiesByName\"\r\n | \"v2ModelsWithExtraResultsWrapping\"\r\n | \"skipEditableModels\"\r\n | \"skipComments\"\r\n>;\r\n\r\n/**\r\n * Takes an EdmxSchema plus the run options and creates a DataModel.\r\n */\r\nexport type DigesterFunction<S extends Schema<any, any>> = (\r\n schema: Array<S>,\r\n options: DigestionOptions,\r\n namingHelper: NamingHelper\r\n) => Promise<DataModel>;\r\n\r\nexport type GeneratorFunctionOptions = Pick<\r\n RunOptions,\r\n \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\" | \"skipComments\" | \"v2ModelsWithExtraResultsWrapping\"\r\n>;\r\n\r\nexport type EntityBasedGeneratorFunction = (\r\n dataModel: DataModel,\r\n sourceFile: SourceFile,\r\n version: ODataVersions,\r\n options: GeneratorFunctionOptions,\r\n namingHelper: NamingHelper\r\n) => void;\r\n"]}
@@ -1,182 +1,182 @@
1
- /**
2
- * The available naming strategies.
3
- */
4
- import { PartialDeep } from "type-fest";
5
- export declare enum NamingStrategies {
6
- NONE = "",
7
- PASCAL_CASE = "pascalCase",
8
- CAMEL_CASE = "camelCase",
9
- CONSTANT_CASE = "constantCase",
10
- SNAKE_CASE = "snakeCase"
11
- }
12
- /**
13
- * Based on an existing configuration (for example default settings) the user only specifies what needs
14
- * to be changed. Hence, all options are completely optional.
15
- */
16
- export interface OverridableNamingOptions extends PartialDeep<NameSettings> {
17
- }
18
- /**
19
- * The required and optional name settings for the generator.
20
- */
21
- export interface NameSettings {
22
- /**
23
- * Because multiple artefacts are generated out of the same entity, some name settings are required in order
24
- * to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,
25
- * so that you only need to override those settings you want to change.
26
- *
27
- * However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with
28
- * your own configuration. In this scenario this switch should be enabled to only have default values for
29
- * the required name settings.
30
- */
31
- minimalDefaults?: boolean;
32
- /**
33
- * Generation options for models, i.e. interfaces representing entity or complex types.
34
- */
35
- models: ModelNamingOptions;
36
- /**
37
- * Generation options for Query Objects.
38
- *
39
- * By default, prefix = "Q"
40
- */
41
- queryObjects: QueryObjectNamingOptions;
42
- services: ServiceNamingOptions;
43
- }
44
- export interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {
45
- /**
46
- * All generated models are bundled into one file.
47
- * This option specifies the formatting of the file name.
48
- */
49
- fileName: FileNamingStrategyOption & RequiredNamingOptions;
50
- /**
51
- * Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.
52
- * By default, camel-case.
53
- */
54
- propNamingStrategy?: NamingStrategies;
55
- /**
56
- * For each model an editable version is generated which represents the model definition for
57
- * create, update and patch actions.
58
- *
59
- * You can override the naming options here.
60
- * By default, prefix = "Editable"
61
- */
62
- editableModels: EntityDerivedNamingOptions;
63
- /**
64
- * ID models are generated from entity id parameters.
65
- *
66
- * You can configure the naming options here.
67
- * By default, suffix = "Id"
68
- */
69
- idModels: EntityDerivedNamingOptions;
70
- /**
71
- * Operation parameter models are generated from function or action signatures.
72
- *
73
- * You can configure the naming options here.
74
- * By default, suffix = "Params"
75
- */
76
- operationParamModels: EntityDerivedNamingOptions;
77
- }
78
- export interface EntityDerivedNamingOptions extends RequiredNamingOptions {
79
- applyModelNaming?: boolean;
80
- }
81
- export interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
82
- /**
83
- * All generated models are bundled into one file.
84
- * This option specifies the formatting of the file name.
85
- */
86
- fileName: FileNamingStrategyOption & RequiredNamingOptions;
87
- /**
88
- * Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.
89
- * By default, camel-case.
90
- */
91
- propNamingStrategy?: NamingStrategies;
92
- idFunctions: RequiredNamingOptions;
93
- operations?: OperationNamingOptions;
94
- }
95
- export interface OperationNamingOptions extends StandardNamingOptions {
96
- /**
97
- * Naming options for actions only.
98
- * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
99
- */
100
- action?: StandardNamingOptions;
101
- /**
102
- * Naming options for functions only.
103
- * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
104
- */
105
- function?: StandardNamingOptions;
106
- }
107
- export interface NamingStrategyOption {
108
- /**
109
- * Choose a specific strategy to format names: pascal-case, camel-case, etc.
110
- * Defaults to pascal-case.
111
- */
112
- namingStrategy?: NamingStrategies;
113
- }
114
- export interface FileNamingStrategyOption {
115
- /**
116
- * Choose a specific strategy to format names: pascal-case, camel-case, etc.
117
- * Defaults to pascal-case.
118
- */
119
- namingStrategy?: NamingStrategies;
120
- }
121
- export interface StandardNamingOptions {
122
- /**
123
- * Prefix all names, e.g. "I" => "ITest"
124
- */
125
- prefix?: string;
126
- /**
127
- * Suffix all names, e.g. "model" => "TestModel"
128
- */
129
- suffix?: string;
130
- }
131
- export interface RequiredNamingOptions extends Required<StandardNamingOptions> {
132
- }
133
- /**
134
- * Naming options for generated service classes.
135
- * These options affect the main service as well as all services generated for each entity, complex and collection type.
136
- *
137
- * There exists one specialty about services: The file names are not configurable.
138
- * File names are determined by the name of their corresponding classes, so that service file name
139
- * and service class name always correspond.
140
- *
141
- * By default, suffix = Service and namingStrategy = PascalCase
142
- */
143
- export interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
144
- /**
145
- * Controls the naming options for the main odata service.
146
- * By default, the base service naming options are applied.
147
- * But since this is the main entry point for users, it can be configured individually here.
148
- *
149
- * By default, applyServiceNaming = true
150
- */
151
- main?: NamingStrategyOption & StandardNamingOptions & {
152
- applyServiceNaming?: boolean;
153
- };
154
- /**
155
- * Name of the service responsible for entity collections.
156
- *
157
- * By default, suffix = Collection and applyServiceNaming = true
158
- */
159
- collection: RequiredNamingOptions & {
160
- applyServiceNaming?: boolean;
161
- };
162
- /**
163
- * Naming for getter method of another service.
164
- *
165
- * By default, namingStrategy = camelCase
166
- */
167
- relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;
168
- /**
169
- * Operations are functions and actions of the OData service and are represented as methods
170
- * of the generated service class. This setting controls the naming of the corresponding
171
- * function.
172
- *
173
- * By default, namingStrategy = camelCase
174
- */
175
- operations?: NamingStrategyOption & OperationNamingOptions;
176
- /**
177
- * Naming options for private properties of service classes.
178
- *
179
- * By default, prefix = _
180
- */
181
- privateProps: NamingStrategyOption & RequiredNamingOptions;
182
- }
1
+ /**
2
+ * The available naming strategies.
3
+ */
4
+ import { PartialDeep } from "type-fest";
5
+ export declare enum NamingStrategies {
6
+ NONE = "",
7
+ PASCAL_CASE = "pascalCase",
8
+ CAMEL_CASE = "camelCase",
9
+ CONSTANT_CASE = "constantCase",
10
+ SNAKE_CASE = "snakeCase"
11
+ }
12
+ /**
13
+ * Based on an existing configuration (for example default settings) the user only specifies what needs
14
+ * to be changed. Hence, all options are completely optional.
15
+ */
16
+ export interface OverridableNamingOptions extends PartialDeep<NameSettings> {
17
+ }
18
+ /**
19
+ * The required and optional name settings for the generator.
20
+ */
21
+ export interface NameSettings {
22
+ /**
23
+ * Because multiple artefacts are generated out of the same entity, some name settings are required in order
24
+ * to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,
25
+ * so that you only need to override those settings you want to change.
26
+ *
27
+ * However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with
28
+ * your own configuration. In this scenario this switch should be enabled to only have default values for
29
+ * the required name settings.
30
+ */
31
+ minimalDefaults?: boolean;
32
+ /**
33
+ * Generation options for models, i.e. interfaces representing entity or complex types.
34
+ */
35
+ models: ModelNamingOptions;
36
+ /**
37
+ * Generation options for Query Objects.
38
+ *
39
+ * By default, prefix = "Q"
40
+ */
41
+ queryObjects: QueryObjectNamingOptions;
42
+ services: ServiceNamingOptions;
43
+ }
44
+ export interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {
45
+ /**
46
+ * All generated models are bundled into one file.
47
+ * This option specifies the formatting of the file name.
48
+ */
49
+ fileName: FileNamingStrategyOption & RequiredNamingOptions;
50
+ /**
51
+ * Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.
52
+ * By default, camel-case.
53
+ */
54
+ propNamingStrategy?: NamingStrategies;
55
+ /**
56
+ * For each model an editable version is generated which represents the model definition for
57
+ * create, update and patch actions.
58
+ *
59
+ * You can override the naming options here.
60
+ * By default, prefix = "Editable"
61
+ */
62
+ editableModels: EntityDerivedNamingOptions;
63
+ /**
64
+ * ID models are generated from entity id parameters.
65
+ *
66
+ * You can configure the naming options here.
67
+ * By default, suffix = "Id"
68
+ */
69
+ idModels: EntityDerivedNamingOptions;
70
+ /**
71
+ * Operation parameter models are generated from function or action signatures.
72
+ *
73
+ * You can configure the naming options here.
74
+ * By default, suffix = "Params"
75
+ */
76
+ operationParamModels: EntityDerivedNamingOptions;
77
+ }
78
+ export interface EntityDerivedNamingOptions extends RequiredNamingOptions {
79
+ applyModelNaming?: boolean;
80
+ }
81
+ export interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
82
+ /**
83
+ * All generated models are bundled into one file.
84
+ * This option specifies the formatting of the file name.
85
+ */
86
+ fileName: FileNamingStrategyOption & RequiredNamingOptions;
87
+ /**
88
+ * Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.
89
+ * By default, camel-case.
90
+ */
91
+ propNamingStrategy?: NamingStrategies;
92
+ idFunctions: RequiredNamingOptions;
93
+ operations?: OperationNamingOptions;
94
+ }
95
+ export interface OperationNamingOptions extends StandardNamingOptions {
96
+ /**
97
+ * Naming options for actions only.
98
+ * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
99
+ */
100
+ action?: StandardNamingOptions;
101
+ /**
102
+ * Naming options for functions only.
103
+ * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.
104
+ */
105
+ function?: StandardNamingOptions;
106
+ }
107
+ export interface NamingStrategyOption {
108
+ /**
109
+ * Choose a specific strategy to format names: pascal-case, camel-case, etc.
110
+ * Defaults to pascal-case.
111
+ */
112
+ namingStrategy?: NamingStrategies;
113
+ }
114
+ export interface FileNamingStrategyOption {
115
+ /**
116
+ * Choose a specific strategy to format names: pascal-case, camel-case, etc.
117
+ * Defaults to pascal-case.
118
+ */
119
+ namingStrategy?: NamingStrategies;
120
+ }
121
+ export interface StandardNamingOptions {
122
+ /**
123
+ * Prefix all names, e.g. "I" => "ITest"
124
+ */
125
+ prefix?: string;
126
+ /**
127
+ * Suffix all names, e.g. "model" => "TestModel"
128
+ */
129
+ suffix?: string;
130
+ }
131
+ export interface RequiredNamingOptions extends Required<StandardNamingOptions> {
132
+ }
133
+ /**
134
+ * Naming options for generated service classes.
135
+ * These options affect the main service as well as all services generated for each entity, complex and collection type.
136
+ *
137
+ * There exists one specialty about services: The file names are not configurable.
138
+ * File names are determined by the name of their corresponding classes, so that service file name
139
+ * and service class name always correspond.
140
+ *
141
+ * By default, suffix = Service and namingStrategy = PascalCase
142
+ */
143
+ export interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {
144
+ /**
145
+ * Controls the naming options for the main odata service.
146
+ * By default, the base service naming options are applied.
147
+ * But since this is the main entry point for users, it can be configured individually here.
148
+ *
149
+ * By default, applyServiceNaming = true
150
+ */
151
+ main?: NamingStrategyOption & StandardNamingOptions & {
152
+ applyServiceNaming?: boolean;
153
+ };
154
+ /**
155
+ * Name of the service responsible for entity collections.
156
+ *
157
+ * By default, suffix = Collection and applyServiceNaming = true
158
+ */
159
+ collection: RequiredNamingOptions & {
160
+ applyServiceNaming?: boolean;
161
+ };
162
+ /**
163
+ * Naming for getter method of another service.
164
+ *
165
+ * By default, namingStrategy = camelCase
166
+ */
167
+ relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;
168
+ /**
169
+ * Operations are functions and actions of the OData service and are represented as methods
170
+ * of the generated service class. This setting controls the naming of the corresponding
171
+ * function.
172
+ *
173
+ * By default, namingStrategy = camelCase
174
+ */
175
+ operations?: NamingStrategyOption & OperationNamingOptions;
176
+ /**
177
+ * Naming options for private properties of service classes.
178
+ *
179
+ * By default, prefix = _
180
+ */
181
+ privateProps: NamingStrategyOption & RequiredNamingOptions;
182
+ }
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NamingStrategies = void 0;
4
- var NamingStrategies;
5
- (function (NamingStrategies) {
6
- NamingStrategies["NONE"] = "";
7
- NamingStrategies["PASCAL_CASE"] = "pascalCase";
8
- NamingStrategies["CAMEL_CASE"] = "camelCase";
9
- NamingStrategies["CONSTANT_CASE"] = "constantCase";
10
- NamingStrategies["SNAKE_CASE"] = "snakeCase";
11
- })(NamingStrategies = exports.NamingStrategies || (exports.NamingStrategies = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NamingStrategies = void 0;
4
+ var NamingStrategies;
5
+ (function (NamingStrategies) {
6
+ NamingStrategies["NONE"] = "";
7
+ NamingStrategies["PASCAL_CASE"] = "pascalCase";
8
+ NamingStrategies["CAMEL_CASE"] = "camelCase";
9
+ NamingStrategies["CONSTANT_CASE"] = "constantCase";
10
+ NamingStrategies["SNAKE_CASE"] = "snakeCase";
11
+ })(NamingStrategies || (exports.NamingStrategies = NamingStrategies = {}));
12
12
  //# sourceMappingURL=NamingModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NamingModel.js","sourceRoot":"","sources":["../src/NamingModel.ts"],"names":[],"mappings":";;;AAKA,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,6BAAS,CAAA;IACT,8CAA0B,CAAA;IAC1B,4CAAwB,CAAA;IACxB,kDAA8B,CAAA;IAC9B,4CAAwB,CAAA;AAC1B,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B","sourcesContent":["/**\r\n * The available naming strategies.\r\n */\r\nimport { PartialDeep } from \"type-fest\";\r\n\r\nexport enum NamingStrategies {\r\n NONE = \"\",\r\n PASCAL_CASE = \"pascalCase\",\r\n CAMEL_CASE = \"camelCase\",\r\n CONSTANT_CASE = \"constantCase\",\r\n SNAKE_CASE = \"snakeCase\",\r\n}\r\n\r\n/**\r\n * Based on an existing configuration (for example default settings) the user only specifies what needs\r\n * to be changed. Hence, all options are completely optional.\r\n */\r\nexport interface OverridableNamingOptions extends PartialDeep<NameSettings> {}\r\n\r\n/**\r\n * The required and optional name settings for the generator.\r\n */\r\nexport interface NameSettings {\r\n /**\r\n * Because multiple artefacts are generated out of the same entity, some name settings are required in order\r\n * to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,\r\n * so that you only need to override those settings you want to change.\r\n *\r\n * However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with\r\n * your own configuration. In this scenario this switch should be enabled to only have default values for\r\n * the required name settings.\r\n */\r\n minimalDefaults?: boolean;\r\n\r\n /**\r\n * Generation options for models, i.e. interfaces representing entity or complex types.\r\n */\r\n models: ModelNamingOptions;\r\n\r\n /**\r\n * Generation options for Query Objects.\r\n *\r\n * By default, prefix = \"Q\"\r\n */\r\n queryObjects: QueryObjectNamingOptions;\r\n\r\n services: ServiceNamingOptions;\r\n}\r\n\r\nexport interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can override the naming options here.\r\n * By default, prefix = \"Editable\"\r\n */\r\n editableModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Id\"\r\n */\r\n idModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * Operation parameter models are generated from function or action signatures.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Params\"\r\n */\r\n operationParamModels: EntityDerivedNamingOptions;\r\n}\r\n\r\nexport interface EntityDerivedNamingOptions extends RequiredNamingOptions {\r\n applyModelNaming?: boolean;\r\n}\r\n\r\nexport interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\r\n\r\n idFunctions: RequiredNamingOptions;\r\n\r\n operations?: OperationNamingOptions;\r\n}\r\n\r\nexport interface OperationNamingOptions extends StandardNamingOptions {\r\n /**\r\n * Naming options for actions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n action?: StandardNamingOptions;\r\n /**\r\n * Naming options for functions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n function?: StandardNamingOptions;\r\n}\r\n\r\nexport interface NamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface FileNamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface StandardNamingOptions {\r\n /**\r\n * Prefix all names, e.g. \"I\" => \"ITest\"\r\n */\r\n prefix?: string;\r\n /**\r\n * Suffix all names, e.g. \"model\" => \"TestModel\"\r\n */\r\n suffix?: string;\r\n}\r\n\r\nexport interface RequiredNamingOptions extends Required<StandardNamingOptions> {}\r\n\r\n/**\r\n * Naming options for generated service classes.\r\n * These options affect the main service as well as all services generated for each entity, complex and collection type.\r\n *\r\n * There exists one specialty about services: The file names are not configurable.\r\n * File names are determined by the name of their corresponding classes, so that service file name\r\n * and service class name always correspond.\r\n *\r\n * By default, suffix = Service and namingStrategy = PascalCase\r\n */\r\nexport interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * Controls the naming options for the main odata service.\r\n * By default, the base service naming options are applied.\r\n * But since this is the main entry point for users, it can be configured individually here.\r\n *\r\n * By default, applyServiceNaming = true\r\n */\r\n main?: NamingStrategyOption & StandardNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Name of the service responsible for entity collections.\r\n *\r\n * By default, suffix = Collection and applyServiceNaming = true\r\n */\r\n collection: RequiredNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Naming for getter method of another service.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Operations are functions and actions of the OData service and are represented as methods\r\n * of the generated service class. This setting controls the naming of the corresponding\r\n * function.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n operations?: NamingStrategyOption & OperationNamingOptions;\r\n\r\n /**\r\n * Naming options for private properties of service classes.\r\n *\r\n * By default, prefix = _\r\n */\r\n privateProps: NamingStrategyOption & RequiredNamingOptions;\r\n}\r\n"]}
1
+ {"version":3,"file":"NamingModel.js","sourceRoot":"","sources":["../src/NamingModel.ts"],"names":[],"mappings":";;;AAKA,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,6BAAS,CAAA;IACT,8CAA0B,CAAA;IAC1B,4CAAwB,CAAA;IACxB,kDAA8B,CAAA;IAC9B,4CAAwB,CAAA;AAC1B,CAAC,EANW,gBAAgB,gCAAhB,gBAAgB,QAM3B","sourcesContent":["/**\r\n * The available naming strategies.\r\n */\r\nimport { PartialDeep } from \"type-fest\";\r\n\r\nexport enum NamingStrategies {\r\n NONE = \"\",\r\n PASCAL_CASE = \"pascalCase\",\r\n CAMEL_CASE = \"camelCase\",\r\n CONSTANT_CASE = \"constantCase\",\r\n SNAKE_CASE = \"snakeCase\",\r\n}\r\n\r\n/**\r\n * Based on an existing configuration (for example default settings) the user only specifies what needs\r\n * to be changed. Hence, all options are completely optional.\r\n */\r\nexport interface OverridableNamingOptions extends PartialDeep<NameSettings> {}\r\n\r\n/**\r\n * The required and optional name settings for the generator.\r\n */\r\nexport interface NameSettings {\r\n /**\r\n * Because multiple artefacts are generated out of the same entity, some name settings are required in order\r\n * to differentiate those artefacts. Out-of-the-box odata2ts provides you with sensible default settings,\r\n * so that you only need to override those settings you want to change.\r\n *\r\n * However, sometimes it makes more sense to start from scratch, so that the defaults don't interfere with\r\n * your own configuration. In this scenario this switch should be enabled to only have default values for\r\n * the required name settings.\r\n */\r\n minimalDefaults?: boolean;\r\n\r\n /**\r\n * Generation options for models, i.e. interfaces representing entity or complex types.\r\n */\r\n models: ModelNamingOptions;\r\n\r\n /**\r\n * Generation options for Query Objects.\r\n *\r\n * By default, prefix = \"Q\"\r\n */\r\n queryObjects: QueryObjectNamingOptions;\r\n\r\n services: ServiceNamingOptions;\r\n}\r\n\r\nexport interface ModelNamingOptions extends NamingStrategyOption, StandardNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of models: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can override the naming options here.\r\n * By default, prefix = \"Editable\"\r\n */\r\n editableModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Id\"\r\n */\r\n idModels: EntityDerivedNamingOptions;\r\n\r\n /**\r\n * Operation parameter models are generated from function or action signatures.\r\n *\r\n * You can configure the naming options here.\r\n * By default, suffix = \"Params\"\r\n */\r\n operationParamModels: EntityDerivedNamingOptions;\r\n}\r\n\r\nexport interface EntityDerivedNamingOptions extends RequiredNamingOptions {\r\n applyModelNaming?: boolean;\r\n}\r\n\r\nexport interface QueryObjectNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * All generated models are bundled into one file.\r\n * This option specifies the formatting of the file name.\r\n */\r\n fileName: FileNamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Choose a specific strategy to format property names of query objects: pascal-case, camel-case, etc.\r\n * By default, camel-case.\r\n */\r\n propNamingStrategy?: NamingStrategies;\r\n\r\n idFunctions: RequiredNamingOptions;\r\n\r\n operations?: OperationNamingOptions;\r\n}\r\n\r\nexport interface OperationNamingOptions extends StandardNamingOptions {\r\n /**\r\n * Naming options for actions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n action?: StandardNamingOptions;\r\n /**\r\n * Naming options for functions only.\r\n * When this configuration is provided, the parent configuration regarding suffix and prefix is ignored.\r\n */\r\n function?: StandardNamingOptions;\r\n}\r\n\r\nexport interface NamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface FileNamingStrategyOption {\r\n /**\r\n * Choose a specific strategy to format names: pascal-case, camel-case, etc.\r\n * Defaults to pascal-case.\r\n */\r\n namingStrategy?: NamingStrategies;\r\n}\r\n\r\nexport interface StandardNamingOptions {\r\n /**\r\n * Prefix all names, e.g. \"I\" => \"ITest\"\r\n */\r\n prefix?: string;\r\n /**\r\n * Suffix all names, e.g. \"model\" => \"TestModel\"\r\n */\r\n suffix?: string;\r\n}\r\n\r\nexport interface RequiredNamingOptions extends Required<StandardNamingOptions> {}\r\n\r\n/**\r\n * Naming options for generated service classes.\r\n * These options affect the main service as well as all services generated for each entity, complex and collection type.\r\n *\r\n * There exists one specialty about services: The file names are not configurable.\r\n * File names are determined by the name of their corresponding classes, so that service file name\r\n * and service class name always correspond.\r\n *\r\n * By default, suffix = Service and namingStrategy = PascalCase\r\n */\r\nexport interface ServiceNamingOptions extends NamingStrategyOption, RequiredNamingOptions {\r\n /**\r\n * Controls the naming options for the main odata service.\r\n * By default, the base service naming options are applied.\r\n * But since this is the main entry point for users, it can be configured individually here.\r\n *\r\n * By default, applyServiceNaming = true\r\n */\r\n main?: NamingStrategyOption & StandardNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Name of the service responsible for entity collections.\r\n *\r\n * By default, suffix = Collection and applyServiceNaming = true\r\n */\r\n collection: RequiredNamingOptions & { applyServiceNaming?: boolean };\r\n\r\n /**\r\n * Naming for getter method of another service.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n relatedServiceGetter: NamingStrategyOption & RequiredNamingOptions;\r\n\r\n /**\r\n * Operations are functions and actions of the OData service and are represented as methods\r\n * of the generated service class. This setting controls the naming of the corresponding\r\n * function.\r\n *\r\n * By default, namingStrategy = camelCase\r\n */\r\n operations?: NamingStrategyOption & OperationNamingOptions;\r\n\r\n /**\r\n * Naming options for private properties of service classes.\r\n *\r\n * By default, prefix = _\r\n */\r\n privateProps: NamingStrategyOption & RequiredNamingOptions;\r\n}\r\n"]}