@odata2ts/odata2ts 0.29.1 → 0.31.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 (42) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +81 -81
  3. package/lib/FactoryFunctionModel.d.ts +1 -1
  4. package/lib/FactoryFunctionModel.js.map +1 -1
  5. package/lib/OptionModel.d.ts +54 -4
  6. package/lib/OptionModel.js.map +1 -1
  7. package/lib/app.js +1 -8
  8. package/lib/app.js.map +1 -1
  9. package/lib/data-model/DataModel.d.ts +48 -37
  10. package/lib/data-model/DataModel.js +130 -61
  11. package/lib/data-model/DataModel.js.map +1 -1
  12. package/lib/data-model/DataModelDigestion.d.ts +2 -3
  13. package/lib/data-model/DataModelDigestion.js +74 -96
  14. package/lib/data-model/DataModelDigestion.js.map +1 -1
  15. package/lib/data-model/DataModelDigestionV2.d.ts +1 -1
  16. package/lib/data-model/DataModelDigestionV2.js +30 -15
  17. package/lib/data-model/DataModelDigestionV2.js.map +1 -1
  18. package/lib/data-model/DataModelDigestionV4.js +65 -43
  19. package/lib/data-model/DataModelDigestionV4.js.map +1 -1
  20. package/lib/data-model/DataTypeModel.d.ts +10 -1
  21. package/lib/data-model/DataTypeModel.js.map +1 -1
  22. package/lib/data-model/NamingHelper.d.ts +6 -6
  23. package/lib/data-model/NamingHelper.js +14 -7
  24. package/lib/data-model/NamingHelper.js.map +1 -1
  25. package/lib/data-model/ServiceConfigHelper.d.ts +12 -3
  26. package/lib/data-model/ServiceConfigHelper.js +73 -11
  27. package/lib/data-model/ServiceConfigHelper.js.map +1 -1
  28. package/lib/defaultConfig.js +1 -0
  29. package/lib/defaultConfig.js.map +1 -1
  30. package/lib/generator/ImportContainer.d.ts +0 -1
  31. package/lib/generator/ImportContainer.js +2 -17
  32. package/lib/generator/ImportContainer.js.map +1 -1
  33. package/lib/generator/ModelGenerator.js +9 -6
  34. package/lib/generator/ModelGenerator.js.map +1 -1
  35. package/lib/generator/QueryObjectGenerator.js +12 -6
  36. package/lib/generator/QueryObjectGenerator.js.map +1 -1
  37. package/lib/generator/ServiceGenerator.js +19 -27
  38. package/lib/generator/ServiceGenerator.js.map +1 -1
  39. package/lib/project/ProjectManager.d.ts +0 -5
  40. package/lib/project/ProjectManager.js +1 -21
  41. package/lib/project/ProjectManager.js.map +1 -1
  42. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
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.31.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.30.0...@odata2ts/odata2ts@0.31.0) (2023-10-29)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **build:** run unit tests of examples ([#232](https://github.com/odata2ts/odata2ts/issues/232)) ([9e70481](https://github.com/odata2ts/odata2ts/commit/9e70481aec5fad29c63b93586ba73b1ea4e9d414))
11
+
12
+ ### Features
13
+
14
+ * **generator:** allow for renaming of operations ([#231](https://github.com/odata2ts/odata2ts/issues/231)) ([8bff901](https://github.com/odata2ts/odata2ts/commit/8bff901c71522e9b7d48f49908e515e7812766f0))
15
+ * **generator:** entity config supporting namespaces ([#226](https://github.com/odata2ts/odata2ts/issues/226)) ([ff52dc0](https://github.com/odata2ts/odata2ts/commit/ff52dc0f4b9aa0f255d3ec75506657c3f26709bc))
16
+
17
+ ### BREAKING CHANGES
18
+
19
+ * **generator:** regular expressions must now match against the fully qualified name (e.g. "Trippin.Person") instead of the simple name (e.g. "Person").
20
+
21
+ When matching exactly by name, you can use the simple name as before or the fully qualified name (alias is also supported).
22
+
23
+ # [0.30.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.29.1...@odata2ts/odata2ts@0.30.0) (2023-10-05)
24
+
25
+ ### Features
26
+
27
+ * one file for all services ([#223](https://github.com/odata2ts/odata2ts/issues/223)) ([f48bf5a](https://github.com/odata2ts/odata2ts/commit/f48bf5ab36aa09ddc7760cc078d952c79b7a2185))
28
+
6
29
  ## [0.29.1](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.29.0...@odata2ts/odata2ts@0.29.1) (2023-09-13)
7
30
 
8
31
  **Note:** Version bump only for package @odata2ts/odata2ts
package/README.md CHANGED
@@ -1,81 +1,81 @@
1
- [![npm (scoped)](https://img.shields.io/npm/v/@odata2ts/odata2ts?style=for-the-badge)](https://www.npmjs.com/package/@odata2ts/odata2ts)
2
-
3
- # odata2ts
4
-
5
- The basic idea of `odata2ts` is to leverage the readily available metadata of any OData service
6
- to generate different sorts of typed artefacts which you use in your TypeScript code.
7
- This package (`@odata2ts/odata2ts`) realizes the generation process.
8
-
9
- The generator is supposed to be used with a TypeScript based configuration file.
10
- Then it's able to handle the generation for multiple OData services.
11
-
12
- It comes with powerful configuration options. Some highlights:
13
-
14
- - generation of TypeScript files or compiled JS / DTS files
15
- - name or rename stuff
16
- - naming of pretty much any aspect of the generated artefacts
17
- - e.g. all types should be prefixed with an "I", Person => IPerson
18
- - consistent casing (as in "camelCase" or "PascalCase") even for property names of entity types
19
- - use type converters
20
-
21
- See the [generator documentation](https://odata2ts.github.io/docs/generator/setup-and-usage) for more information.
22
-
23
- ## Installation
24
-
25
- ```
26
- npm install --save-dev @odata2ts/odata2ts
27
- ```
28
-
29
- ### Implicit Dependencies
30
-
31
- Most of the generated artefacts depend on other libraries. `odata2ts` lists them as peer dependencies.
32
-
33
- Depending on your use case, you will need to add runtime dependencies matching the mentioned peer dependencies.
34
- See the [Getting Started Guide](https://odata2ts.github.io/docs/category/getting-started/) of the documentation
35
- for guidance.
36
-
37
- ## Documentation
38
-
39
- [Generator Documentation](https://odata2ts.github.io/docs/generator/setup-and-usage)
40
-
41
- Main documentation for the odata2ts eco system:
42
- [https://odata2ts.github.io](https://odata2ts.github.io/)
43
-
44
- ## Examples
45
-
46
- See [example packages](https://github.com/odata2ts/odata2ts/tree/main/examples) for examples of how to integrate `odata2ts`.
47
-
48
- ## Tests
49
-
50
- See folder [test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/test)
51
- for unit tests.
52
-
53
- See folder [int-test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/int-test) for integration
54
- tests of the CLI.
55
-
56
- Each example package serves as integration test of the generator.
57
-
58
- ## Support, Feedback, Contributing
59
-
60
- This project is open to feature requests, suggestions, bug reports, usage questions etc.
61
- via [GitHub issues](https://github.com/odata2ts/odata2ts/issues).
62
-
63
- Contributions and feedback are encouraged and always welcome.
64
-
65
- See the [contribution guidelines](https://github.com/odata2ts/odata2ts/blob/main/CONTRIBUTING.md) for further information.
66
-
67
- ## Spirit
68
-
69
- This project and this module have been created and are maintained in the following spirit:
70
-
71
- - adhere to the **OData specification** as much as possible
72
- - support any OData service implementation which conforms to the spec
73
- - allow to work around faulty implementations if possible
74
- - stability matters
75
- - exercise Test Driven Development
76
- - bomb the place with unit tests (code coverage > 95%)
77
- - ensure that assumptions & understanding are correct by creating integration tests
78
-
79
- ## License
80
-
81
- MIT - see [License](./LICENSE).
1
+ [![npm (scoped)](https://img.shields.io/npm/v/@odata2ts/odata2ts?style=for-the-badge)](https://www.npmjs.com/package/@odata2ts/odata2ts)
2
+
3
+ # odata2ts
4
+
5
+ The basic idea of `odata2ts` is to leverage the readily available metadata of any OData service
6
+ to generate different sorts of typed artefacts which you use in your TypeScript code.
7
+ This package (`@odata2ts/odata2ts`) realizes the generation process.
8
+
9
+ The generator is supposed to be used with a TypeScript based configuration file.
10
+ Then it's able to handle the generation for multiple OData services.
11
+
12
+ It comes with powerful configuration options. Some highlights:
13
+
14
+ - generation of TypeScript files or compiled JS / DTS files
15
+ - name or rename stuff
16
+ - naming of pretty much any aspect of the generated artefacts
17
+ - e.g. all types should be prefixed with an "I", Person => IPerson
18
+ - consistent casing (as in "camelCase" or "PascalCase") even for property names of entity types
19
+ - use type converters
20
+
21
+ See the [generator documentation](https://odata2ts.github.io/docs/generator/setup-and-usage) for more information.
22
+
23
+ ## Installation
24
+
25
+ ```
26
+ npm install --save-dev @odata2ts/odata2ts
27
+ ```
28
+
29
+ ### Implicit Dependencies
30
+
31
+ Most of the generated artefacts depend on other libraries. `odata2ts` lists them as peer dependencies.
32
+
33
+ Depending on your use case, you will need to add runtime dependencies matching the mentioned peer dependencies.
34
+ See the [Getting Started Guide](https://odata2ts.github.io/docs/category/getting-started/) of the documentation
35
+ for guidance.
36
+
37
+ ## Documentation
38
+
39
+ [Generator Documentation](https://odata2ts.github.io/docs/generator/setup-and-usage)
40
+
41
+ Main documentation for the odata2ts eco system:
42
+ [https://odata2ts.github.io](https://odata2ts.github.io/)
43
+
44
+ ## Examples
45
+
46
+ See [example packages](https://github.com/odata2ts/odata2ts/tree/main/examples) for examples of how to integrate `odata2ts`.
47
+
48
+ ## Tests
49
+
50
+ See folder [test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/test)
51
+ for unit tests.
52
+
53
+ See folder [int-test](https://github.com/odata2ts/odata2ts/tree/main/packages/odata2ts/int-test) for integration
54
+ tests of the CLI.
55
+
56
+ Each example package serves as integration test of the generator.
57
+
58
+ ## Support, Feedback, Contributing
59
+
60
+ This project is open to feature requests, suggestions, bug reports, usage questions etc.
61
+ via [GitHub issues](https://github.com/odata2ts/odata2ts/issues).
62
+
63
+ Contributions and feedback are encouraged and always welcome.
64
+
65
+ See the [contribution guidelines](https://github.com/odata2ts/odata2ts/blob/main/CONTRIBUTING.md) for further information.
66
+
67
+ ## Spirit
68
+
69
+ This project and this module have been created and are maintained in the following spirit:
70
+
71
+ - adhere to the **OData specification** as much as possible
72
+ - support any OData service implementation which conforms to the spec
73
+ - allow to work around faulty implementations if possible
74
+ - stability matters
75
+ - exercise Test Driven Development
76
+ - bomb the place with unit tests (code coverage > 95%)
77
+ - ensure that assumptions & understanding are correct by creating integration tests
78
+
79
+ ## License
80
+
81
+ MIT - see [License](./LICENSE).
@@ -4,7 +4,7 @@ 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" | "v2ModelsWithExtraResultsWrapping" | "v4BigNumberAsString" | "skipEditableModels" | "skipComments">;
7
+ export type DigestionOptions = Pick<RunOptions, "converters" | "disableAutoManagedKey" | "propertiesByName" | "entitiesByName" | "operationsByName" | "v2ModelsWithExtraResultsWrapping" | "v4BigNumberAsString" | "skipEditableModels" | "skipComments">;
8
8
  /**
9
9
  * Takes an EdmxSchema plus the run options and creates a DataModel.
10
10
  */
@@ -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 | \"v4BigNumberAsString\"\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
+ {"version":3,"file":"FactoryFunctionModel.js","sourceRoot":"","sources":["../src/FactoryFunctionModel.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\nimport { SourceFile } from \"ts-morph\";\n\nimport { DataModel } from \"./data-model/DataModel\";\nimport { Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\nimport { NamingHelper } from \"./data-model/NamingHelper\";\nimport { RunOptions } from \"./OptionModel\";\n\nexport type DigestionOptions = Pick<\n RunOptions,\n | \"converters\"\n | \"disableAutoManagedKey\"\n | \"propertiesByName\"\n | \"entitiesByName\"\n | \"operationsByName\"\n | \"v2ModelsWithExtraResultsWrapping\"\n | \"v4BigNumberAsString\"\n | \"skipEditableModels\"\n | \"skipComments\"\n>;\n\n/**\n * Takes an EdmxSchema plus the run options and creates a DataModel.\n */\nexport type DigesterFunction<S extends Schema<any, any>> = (\n schema: Array<S>,\n options: DigestionOptions,\n namingHelper: NamingHelper\n) => Promise<DataModel>;\n\nexport type GeneratorFunctionOptions = Pick<\n RunOptions,\n \"skipEditableModels\" | \"skipIdModels\" | \"skipOperations\" | \"skipComments\" | \"v2ModelsWithExtraResultsWrapping\"\n>;\n\nexport type EntityBasedGeneratorFunction = (\n dataModel: DataModel,\n sourceFile: SourceFile,\n version: ODataVersions,\n options: GeneratorFunctionOptions,\n namingHelper: NamingHelper\n) => void;\n"]}
@@ -247,6 +247,10 @@ export interface ServiceGenerationOptions extends Required<Pick<CliOptions, "sou
247
247
  * Configure generation process for individual properties based on their name.
248
248
  */
249
249
  propertiesByName?: Array<PropertyGenerationOptions>;
250
+ /**
251
+ * Configure generation process for individual function or actions by matching their name.
252
+ */
253
+ operationsByName?: Array<OperationGenerationOptions>;
250
254
  }
251
255
  /**
252
256
  * Available options for the actual generation run.
@@ -262,13 +266,30 @@ export interface RunOptions extends Required<Omit<ServiceGenerationOptions, "ser
262
266
  */
263
267
  export interface EntityGenerationOptions {
264
268
  /**
265
- * Name of the EntityType or ComplexType, e.g. "Person".
266
- * Must match exactly or can be a regular expression.
269
+ * Matches the name of the EntityType or ComplexType as it is stated in the EDMX model, e.g. "Person".
270
+ * You can also address the fully qualified name including the namespace (annotated at the schema element), e.g.
271
+ * "Trippin.Person".
272
+ *
273
+ * If the name is specified as plain string, it must match either the name or the fully qualified name
274
+ * exactly (case-sensitive).
275
+ *
276
+ * Alternatively, a regular expression can be used which is always applied to the fully qualified name
277
+ * (e.g. Trippin.Person). The regular expression must match the whole string
278
+ * (e.g. `/Person/` won't do, `/.*\.Person/` would work).
279
+ *
280
+ * To make regular expressions useful, captured groups are also supported. Works in combination with
281
+ * the `mappedName` attribute.
267
282
  */
268
283
  name: string | RegExp;
269
284
  /**
270
- * Use a different name.
271
- * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).
285
+ * If specified, this attribute value is used as name for the matched entity, complex or enum type as it will
286
+ * appear in the generated typescript.
287
+ *
288
+ * When using a regular expression for matching the name, then captured groups can be referenced
289
+ * as usual via $1, $2, etc. For example:
290
+ * - name: /Trippin\.(.+)/
291
+ * - mappedName: "T_$1"
292
+ * - result: "T_Person"
272
293
  */
273
294
  mappedName?: string;
274
295
  /**
@@ -300,3 +321,32 @@ export interface PropertyGenerationOptions {
300
321
  */
301
322
  managed?: boolean;
302
323
  }
324
+ export interface OperationGenerationOptions {
325
+ /**
326
+ * Matches the name of the function or action as it is stated in the EDMX model, e.g. "Person".
327
+ * You can also address the fully qualified name including the namespace (annotated at the schema element), e.g.
328
+ * "Trippin.Person".
329
+ *
330
+ * If the name is specified as plain string, it must match either the name or the fully qualified name
331
+ * exactly (case-sensitive).
332
+ *
333
+ * Alternatively, a regular expression can be used which is always applied to the fully qualified name
334
+ * (e.g. Trippin.Person). The regular expression must match the whole string
335
+ * (e.g. `/Person/` won't do, `/.*\.Person/` would work).
336
+ *
337
+ * To make regular expressions useful, captured groups are also supported. Works in combination with
338
+ * the `mappedName` attribute.
339
+ */
340
+ name: string | RegExp;
341
+ /**
342
+ * If specified, this attribute value is used as name for the matched operation as it will
343
+ * appear in the generated typescript.
344
+ *
345
+ * When using a regular expression for matching the name, then captured groups can be referenced
346
+ * as usual via $1, $2, etc. For example:
347
+ * - name: /Trippin\.(.+)/
348
+ * - mappedName: "T_$1"
349
+ * - result: "T_Person"
350
+ */
351
+ mappedName?: string;
352
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"OptionModel.js","sourceRoot":"","sources":["../src/OptionModel.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,qBAAL,KAAK,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,yBAAT,SAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\r\nimport { AxiosRequestConfig } from \"axios\";\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 URL to the root of your OData service. The URL might end in a slash or not, it might also end\r\n * in $metadata, but we usually add this for you.\r\n *\r\n * Specifying the URL is a convenience feature to download the metadata file from the given URL.\r\n * You can configure this request via `sourceConfig` option.\r\n *\r\n * The `source` option must still be specified as it is used to store the downloaded file on your disk.\r\n * By default, the file is used once it has been downloaded.\r\n */\r\n sourceUrl?: string;\r\n /**\r\n * Downloads the metadata file and overwrites the existing one, if any.\r\n *\r\n * Only takes effect, if option `sourceUrl` is specified.\r\n */\r\n refreshFile?: boolean;\r\n /**\r\n * The source is the file to use (must be an EDMX compliant XML file) or the URL to the\r\n * metadata (ROOT_SERVICE/$metadata).\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n source?: string;\r\n /**\r\n * Specifies the output directory for the generated stuff.\r\n *\r\n * If not specified, at least one service must be configured in config file.\r\n */\r\n output?: string;\r\n /**\r\n * Only generates the specified services.\r\n * Relies on an existing config file where these service names are maintained.\r\n */\r\n services?: Array<string>;\r\n /**\r\n * Specifies what to generate:\r\n * - {@code Modes.models} will only generate TS interfaces\r\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\r\n * - {@code Modes.service} will generate one main OData service client and one per each entity\r\n * - {@code Modes.all} the same as {@code Modes.service}\r\n *\r\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\r\n * Defaults to {@code Modes.all}\r\n */\r\n mode?: Modes;\r\n /**\r\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\r\n * Defaults to {@code EmitModes.js_dts}\r\n */\r\n emitMode?: EmitModes;\r\n /**\r\n * Uses prettier with your local configuration to pretty print TypeScript files.\r\n * Only applies if mode is set to {@code EmitModes.ts}.\r\n */\r\n prettier?: boolean;\r\n /**\r\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\r\n * This option allows to specify an alternative file.\r\n *\r\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\r\n */\r\n tsconfig?: string;\r\n /**\r\n * Verbose debugging information.\r\n */\r\n debug?: boolean;\r\n /**\r\n * Overrides the service name found in the source file.\r\n *\r\n * The service name is the basis for all file names and the name of the main OData client service\r\n * that serves as entry point for the user.\r\n */\r\n serviceName?: string;\r\n /**\r\n * odata2ts will automatically decide if a key prop is managed on the server side.\r\n * If managed, the property will not be editable (create, update, patch).\r\n * The following rule applies:\r\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\r\n * in ony other case the prop is unmanaged.\r\n */\r\n disableAutoManagedKey?: boolean;\r\n /**\r\n * By default, odata2ts doesn't change param, operation, property or model names.\r\n * The generated models and their properties are named exactly as advertised by the server.\r\n *\r\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\r\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\r\n *\r\n * The naming configuration allows to control this and other naming related settings.\r\n * Note: Even if renaming is disabled, model prefixing / suffixing still applies.\r\n */\r\n allowRenaming?: boolean;\r\n}\r\n\r\n/**\r\n * Configuration options of the request to retrieve the metadata.\r\n * Only takes effect if `source` is a URL.\r\n */\r\nexport interface UrlSourceConfiguration {\r\n /**\r\n * Basic auth credentials: the username.\r\n * Only takes effect if `password` has also been set.\r\n */\r\n username?: string;\r\n /**\r\n * Basic auth credentials: the password.\r\n * Only takes effect if `username` has also been set.\r\n */\r\n password?: string;\r\n /**\r\n * Custom request configuration.\r\n * URL and method `GET` are set by default, but can be overwritten.\r\n */\r\n custom?: AxiosRequestConfig;\r\n}\r\n\r\n/**\r\n * Available options for configuration files, i.e. odata2ts.config.ts.\r\n */\r\nexport interface ConfigFileOptions extends Omit<CliOptions, \"sourceUrl\" | \"source\" | \"output\" | \"services\"> {\r\n /**\r\n * Configuration options of the request to retrieve the metadata.\r\n * Only takes effect if `sourceUrl` is a URL.\r\n */\r\n sourceUrlConfig?: UrlSourceConfiguration;\r\n\r\n /**\r\n * Configuration of each service.\r\n *\r\n * @example { services: { trippin: { source: \"...\", ... } }}\r\n */\r\n services?: { [serviceName: string]: ServiceGenerationOptions };\r\n\r\n /**\r\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\r\n * Each converter knows which data type to map.\r\n *\r\n * To only use specific converters, the object syntax must be used, where supported converters\r\n * must be listed by their ids.\r\n */\r\n converters?: Array<string | TypeConverterConfig>;\r\n\r\n /**\r\n * For each model an editable version is generated which represents the model definition for\r\n * create, update and patch actions.\r\n *\r\n * You can skip the generation altogether, not generating editable model variants,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipEditableModels?: boolean;\r\n\r\n /**\r\n * ID models are generated from entity id parameters.\r\n * The generation for one entity entails one model interface representing the id parameters and\r\n * one QId function which allows to format the parameters for URL usage and to parse parameters\r\n * from a URL string.\r\n *\r\n * You can skip the generation altogether, not generating models and QId objects, if the\r\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipIdModels?: boolean;\r\n /**\r\n * Operations are functions and actions of the OData service.\r\n * The generation for one operation entails one parameter model interface\r\n * and one QFunction / QAction class.\r\n *\r\n * You can skip the generation altogether, neither generating model nor query object,\r\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\r\n */\r\n skipOperations?: boolean;\r\n /**\r\n * Model properties have explaining comments by default.\r\n * With this option you can turn that off.\r\n */\r\n skipComments?: boolean;\r\n /**\r\n * With OData you can read, update and delete data on a primitive property (`Edm.*`).\r\n * Usually, you wouldn't do that, but go for a bigger request, fetching more relevant information in one go.\r\n *\r\n * There's one exception: Handling `Edm.Stream´ properties and Media entities. Services for stream / media\r\n * stuff are generated regardless of this setting.\r\n */\r\n enablePrimitivePropertyServices?: boolean;\r\n\r\n /**\r\n * The naming options regarding the generated artefacts.\r\n */\r\n naming?: OverridableNamingOptions;\r\n\r\n /**\r\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\r\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\r\n * an object with the property \"results\" is wrapped around the entity collection.\r\n *\r\n * If you're using the odata client then there's a build-in workaround in place which transforms\r\n * the results to remove this extra mapping. However, if you're only interested in the types, then\r\n * the generated models will not match that extra wrapping.\r\n *\r\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\r\n * wrapping to the generated models. But this option is only valid if the generation mode is set\r\n * to <code>models</code>; it is ignored otherwise.\r\n */\r\n v2ModelsWithExtraResultsWrapping?: boolean;\r\n /**\r\n * Numbers of type `Edm.Int64` and `Edm.Decimal` are represented as `number` in V4.\r\n * However, these numbers might not fit into JS' number type, which might result in precision loss.\r\n *\r\n * OData offers a special IEEE754 format option to get those types as `string` instead to prevent any\r\n * precision loss. So if you're handling very large or very small numbers (JS roughly supports 15 digits),\r\n * then you should use this option and, probably, also an appropriate converter (see available converters).\r\n *\r\n * Activating this option affects the type generation and will use `string` for both mentioned types.\r\n * All requests are executed with the \"accept\" header set to \"application/json;IEEE754Compatible=true\".\r\n * Additionally, when sending data the very same value will be set for the \"content-type\" header.\r\n */\r\n v4BigNumberAsString?: boolean;\r\n}\r\n\r\n/**\r\n * Custom generation options which are dependent on a specific odata service.\r\n */\r\nexport interface ServiceGenerationOptions\r\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\r\n Pick<CliOptions, \"sourceUrl\" | \"refreshFile\">,\r\n Omit<ConfigFileOptions, \"services\"> {\r\n /**\r\n * Configure generation process for 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 * Available options for the actual generation run.\r\n * Every property is required, except the overriding service name.\r\n */\r\nexport interface RunOptions\r\n extends Required<Omit<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\">>,\r\n Pick<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\"> {\r\n naming: NameSettings;\r\n}\r\n\r\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":";;;AAKA;;GAEG;AACH,IAAY,KAKX;AALD,WAAY,KAAK;IACf,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,+BAAG,CAAA;AACL,CAAC,EALW,KAAK,qBAAL,KAAK,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,yBAAT,SAAS,QAKpB","sourcesContent":["import { TypeConverterConfig } from \"@odata2ts/converter-runtime\";\nimport { AxiosRequestConfig } from \"axios\";\n\nimport { NameSettings, OverridableNamingOptions } from \"./NamingModel\";\n\n/**\n * Generation mode, by default \"all\".\n */\nexport enum Modes {\n models,\n qobjects,\n service,\n all,\n}\n\n/**\n * What kind of stuff to emit: Either raw TS or TS that has been compiled to JS / DTS.\n */\nexport enum EmitModes {\n ts = \"ts\",\n js = \"js\",\n dts = \"dts\",\n js_dts = \"js_dts\",\n}\n\n/**\n * Config options for CLI.\n */\nexport interface CliOptions {\n /**\n * The URL to the root of your OData service. The URL might end in a slash or not, it might also end\n * in $metadata, but we usually add this for you.\n *\n * Specifying the URL is a convenience feature to download the metadata file from the given URL.\n * You can configure this request via `sourceConfig` option.\n *\n * The `source` option must still be specified as it is used to store the downloaded file on your disk.\n * By default, the file is used once it has been downloaded.\n */\n sourceUrl?: string;\n /**\n * Downloads the metadata file and overwrites the existing one, if any.\n *\n * Only takes effect, if option `sourceUrl` is specified.\n */\n refreshFile?: boolean;\n /**\n * The source is the file to use (must be an EDMX compliant XML file) or the URL to the\n * metadata (ROOT_SERVICE/$metadata).\n *\n * If not specified, at least one service must be configured in config file.\n */\n source?: string;\n /**\n * Specifies the output directory for the generated stuff.\n *\n * If not specified, at least one service must be configured in config file.\n */\n output?: string;\n /**\n * Only generates the specified services.\n * Relies on an existing config file where these service names are maintained.\n */\n services?: Array<string>;\n /**\n * Specifies what to generate:\n * - {@code Modes.models} will only generate TS interfaces\n * - {@code Modes.qobjects} will generate functional units used in QueryBuilder and for functions and actions\n * - {@code Modes.service} will generate one main OData service client and one per each entity\n * - {@code Modes.all} the same as {@code Modes.service}\n *\n * QObjects will also generate models, and generating the service client will also generate models and QObjects.\n * Defaults to {@code Modes.all}\n */\n mode?: Modes;\n /**\n * Specifies the type of the output files: TypeScript, JS, DTS only, JS with DTS.\n * Defaults to {@code EmitModes.js_dts}\n */\n emitMode?: EmitModes;\n /**\n * Uses prettier with your local configuration to pretty print TypeScript files.\n * Only applies if mode is set to {@code EmitModes.ts}.\n */\n prettier?: boolean;\n /**\n * When compiling TypeScript to JS, \"tsconfig.json\" is used by default to add compilerOptions.\n * This option allows to specify an alternative file.\n *\n * Only takes effect, when mode is set to anything else than {@code EmitModes.ts}.\n */\n tsconfig?: string;\n /**\n * Verbose debugging information.\n */\n debug?: boolean;\n /**\n * Overrides the service name found in the source file.\n *\n * The service name is the basis for all file names and the name of the main OData client service\n * that serves as entry point for the user.\n */\n serviceName?: string;\n /**\n * odata2ts will automatically decide if a key prop is managed on the server side.\n * If managed, the property will not be editable (create, update, patch).\n * The following rule applies:\n * If a property is the only key prop of an entity, then the prop is deemed to be managed;\n * in ony other case the prop is unmanaged.\n */\n disableAutoManagedKey?: boolean;\n /**\n * By default, odata2ts doesn't change param, operation, property or model names.\n * The generated models and their properties are named exactly as advertised by the server.\n *\n * By allowing odata2ts to change these names, certain predefined formatting strategies are used:\n * Model / class names are formatted with PascalCase; property, param, and operation names with camelCase.\n *\n * The naming configuration allows to control this and other naming related settings.\n * Note: Even if renaming is disabled, model prefixing / suffixing still applies.\n */\n allowRenaming?: boolean;\n}\n\n/**\n * Configuration options of the request to retrieve the metadata.\n * Only takes effect if `source` is a URL.\n */\nexport interface UrlSourceConfiguration {\n /**\n * Basic auth credentials: the username.\n * Only takes effect if `password` has also been set.\n */\n username?: string;\n /**\n * Basic auth credentials: the password.\n * Only takes effect if `username` has also been set.\n */\n password?: string;\n /**\n * Custom request configuration.\n * URL and method `GET` are set by default, but can be overwritten.\n */\n custom?: AxiosRequestConfig;\n}\n\n/**\n * Available options for configuration files, i.e. odata2ts.config.ts.\n */\nexport interface ConfigFileOptions extends Omit<CliOptions, \"sourceUrl\" | \"source\" | \"output\" | \"services\"> {\n /**\n * Configuration options of the request to retrieve the metadata.\n * Only takes effect if `sourceUrl` is a URL.\n */\n sourceUrlConfig?: UrlSourceConfiguration;\n\n /**\n * Configuration of each service.\n *\n * @example { services: { trippin: { source: \"...\", ... } }}\n */\n services?: { [serviceName: string]: ServiceGenerationOptions };\n\n /**\n * Specify which converters to use by their package name, e.g. \"@odata2ts/converter-v2-to-v4\".\n * Each converter knows which data type to map.\n *\n * To only use specific converters, the object syntax must be used, where supported converters\n * must be listed by their ids.\n */\n converters?: Array<string | TypeConverterConfig>;\n\n /**\n * For each model an editable version is generated which represents the model definition for\n * create, update and patch actions.\n *\n * You can skip the generation altogether, not generating editable model variants,\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipEditableModels?: boolean;\n\n /**\n * ID models are generated from entity id parameters.\n * The generation for one entity entails one model interface representing the id parameters and\n * one QId function which allows to format the parameters for URL usage and to parse parameters\n * from a URL string.\n *\n * You can skip the generation altogether, not generating models and QId objects, if the\n * generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipIdModels?: boolean;\n /**\n * Operations are functions and actions of the OData service.\n * The generation for one operation entails one parameter model interface\n * and one QFunction / QAction class.\n *\n * You can skip the generation altogether, neither generating model nor query object,\n * if the generation mode is {@code Mode.model} or {@code Mode.qobject}.\n */\n skipOperations?: boolean;\n /**\n * Model properties have explaining comments by default.\n * With this option you can turn that off.\n */\n skipComments?: boolean;\n /**\n * With OData you can read, update and delete data on a primitive property (`Edm.*`).\n * Usually, you wouldn't do that, but go for a bigger request, fetching more relevant information in one go.\n *\n * There's one exception: Handling `Edm.Stream´ properties and Media entities. Services for stream / media\n * stuff are generated regardless of this setting.\n */\n enablePrimitivePropertyServices?: boolean;\n\n /**\n * The naming options regarding the generated artefacts.\n */\n naming?: OverridableNamingOptions;\n\n /**\n * Some OData V2 services generate an extra wrapping for entity collection attributes:\n * <code>trips: {results: [...]}</code>. So instead of directly returning an array of entities\n * an object with the property \"results\" is wrapped around the entity collection.\n *\n * If you're using the odata client then there's a build-in workaround in place which transforms\n * the results to remove this extra mapping. However, if you're only interested in the types, then\n * the generated models will not match that extra wrapping.\n *\n * Setting this configuration option to <code>true</code> (default: false) will add this extra\n * wrapping to the generated models. But this option is only valid if the generation mode is set\n * to <code>models</code>; it is ignored otherwise.\n */\n v2ModelsWithExtraResultsWrapping?: boolean;\n /**\n * Numbers of type `Edm.Int64` and `Edm.Decimal` are represented as `number` in V4.\n * However, these numbers might not fit into JS' number type, which might result in precision loss.\n *\n * OData offers a special IEEE754 format option to get those types as `string` instead to prevent any\n * precision loss. So if you're handling very large or very small numbers (JS roughly supports 15 digits),\n * then you should use this option and, probably, also an appropriate converter (see available converters).\n *\n * Activating this option affects the type generation and will use `string` for both mentioned types.\n * All requests are executed with the \"accept\" header set to \"application/json;IEEE754Compatible=true\".\n * Additionally, when sending data the very same value will be set for the \"content-type\" header.\n */\n v4BigNumberAsString?: boolean;\n}\n\n/**\n * Custom generation options which are dependent on a specific odata service.\n */\nexport interface ServiceGenerationOptions\n extends Required<Pick<CliOptions, \"source\" | \"output\">>,\n Pick<CliOptions, \"sourceUrl\" | \"refreshFile\">,\n Omit<ConfigFileOptions, \"services\"> {\n /**\n * Configure generation process for EntityTypes and ComplexTypes including their keys and properties.\n */\n entitiesByName?: Array<EntityGenerationOptions>;\n /**\n * Configure generation process for individual properties based on their name.\n */\n propertiesByName?: Array<PropertyGenerationOptions>;\n /**\n * Configure generation process for individual function or actions by matching their name.\n */\n operationsByName?: Array<OperationGenerationOptions>;\n}\n\n/**\n * Available options for the actual generation run.\n * Every property is required, except the overriding service name.\n */\nexport interface RunOptions\n extends Required<Omit<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\">>,\n Pick<ServiceGenerationOptions, \"serviceName\" | \"sourceUrl\" | \"sourceUrlConfig\" | \"refreshFile\"> {\n naming: NameSettings;\n}\n\n/**\n * Configuration options for EntityTypes and ComplexTypes.\n * This config applies if the name matches the name of an EntityType or ComplexType as it is specified\n * in the metadata (e.g. in EDMX <EntityType name=\"Test\" ...)\n */\nexport interface EntityGenerationOptions {\n /**\n * Matches the name of the EntityType or ComplexType as it is stated in the EDMX model, e.g. \"Person\".\n * You can also address the fully qualified name including the namespace (annotated at the schema element), e.g.\n * \"Trippin.Person\".\n *\n * If the name is specified as plain string, it must match either the name or the fully qualified name\n * exactly (case-sensitive).\n *\n * Alternatively, a regular expression can be used which is always applied to the fully qualified name\n * (e.g. Trippin.Person). The regular expression must match the whole string\n * (e.g. `/Person/` won't do, `/.*\\.Person/` would work).\n *\n * To make regular expressions useful, captured groups are also supported. Works in combination with\n * the `mappedName` attribute.\n */\n name: string | RegExp;\n /**\n * If specified, this attribute value is used as name for the matched entity, complex or enum type as it will\n * appear in the generated typescript.\n *\n * When using a regular expression for matching the name, then captured groups can be referenced\n * as usual via $1, $2, etc. For example:\n * - name: /Trippin\\.(.+)/\n * - mappedName: \"T_$1\"\n * - result: \"T_Person\"\n */\n mappedName?: string;\n /**\n * Overwrite the key specification by naming the props by their EDMX name.\n */\n keys?: Array<string>;\n /**\n * Configuration of individual properties.\n */\n properties?: Array<PropertyGenerationOptions>;\n\n // converter: string | Array<string>\n\n /**\n * Whether the generated service should allow for querying this model.\n * True by default.\n */\n // queryable?: boolean;\n /**\n * Whether the generated service should allow for creating new models (POST).\n * True by default.\n */\n // creatable?: boolean;\n /**\n * Whether the generated service should allow for updates (PUT).\n * True by default.\n */\n // updatable?: boolean;\n /**\n * Whether the generated service should allow for partial updates (PATCH).\n * True by default.\n */\n // patchable?: boolean;\n /**\n * Whether the generated service should allow for deletion.\n * True by default.\n */\n // deletable?: boolean;\n}\n\n/**\n * All configuration options for properties of models.\n */\nexport interface PropertyGenerationOptions {\n /**\n * Name of the property to match.\n * Must match exactly or can be a regular expression.\n */\n name: string | RegExp;\n /**\n * Use a different name.\n * If name is a regular expression, mappedName allows to specify captured groups (via $1, $2, ...).\n */\n mappedName?: string;\n /**\n * Managed attributes - i.e. managed by the server - cannot be created or updated.\n * Hence, they are left out of the editable model versions.\n */\n managed?: boolean;\n\n /**\n * TODO\n *\n * Each converter must specify its package name, e.g. \"@odata2ts/converter-v2-to-v4\",\n * as well it's i\n * and their ids, e.g. \"timeToDurationConverter\".\n *\n * To only use specific converters, the object syntax must be used, where supported converters\n * must be listed by their ids.\n */\n // converters?: Array<Required<TypeConverterConfig>>;\n}\n\nexport interface OperationGenerationOptions {\n /**\n * Matches the name of the function or action as it is stated in the EDMX model, e.g. \"Person\".\n * You can also address the fully qualified name including the namespace (annotated at the schema element), e.g.\n * \"Trippin.Person\".\n *\n * If the name is specified as plain string, it must match either the name or the fully qualified name\n * exactly (case-sensitive).\n *\n * Alternatively, a regular expression can be used which is always applied to the fully qualified name\n * (e.g. Trippin.Person). The regular expression must match the whole string\n * (e.g. `/Person/` won't do, `/.*\\.Person/` would work).\n *\n * To make regular expressions useful, captured groups are also supported. Works in combination with\n * the `mappedName` attribute.\n */\n name: string | RegExp;\n\n /**\n * If specified, this attribute value is used as name for the matched operation as it will\n * appear in the generated typescript.\n *\n * When using a regular expression for matching the name, then captured groups can be referenced\n * as usual via $1, $2, etc. For example:\n * - name: /Trippin\\.(.+)/\n * - mappedName: \"T_$1\"\n * - result: \"T_Person\"\n */\n mappedName?: string;\n}\n"]}
package/lib/app.js CHANGED
@@ -29,13 +29,7 @@ function runApp(metadataJson, options) {
29
29
  const schemas = dataService.Schema;
30
30
  const detectedSchema = schemas.find((schema) => { var _a; return schema.$.Namespace && ((_a = schema.EntityType) === null || _a === void 0 ? void 0 : _a.length); }) || schemas[0];
31
31
  const serviceName = options.serviceName || detectedSchema.$.Namespace;
32
- const namespaces = [];
33
- schemas.forEach((schema) => {
34
- namespaces.push(schema.$.Namespace);
35
- if (schema.$.Alias) {
36
- namespaces.push(schema.$.Alias);
37
- }
38
- });
32
+ const namespaces = schemas.map((schema) => [schema.$.Namespace, schema.$.Alias]);
39
33
  // encapsulate the whole naming logic
40
34
  const namingHelper = new NamingHelper_1.NamingHelper(options, serviceName, namespaces);
41
35
  // parse model information from edmx into something we can really work with
@@ -58,7 +52,6 @@ function runApp(metadataJson, options) {
58
52
  }
59
53
  // Generate Individual OData-Service
60
54
  if (isServiceGen(options.mode)) {
61
- yield project.cleanServiceDir();
62
55
  yield (0, generator_1.generateServices)(dataModel, project, version, namingHelper, options);
63
56
  }
64
57
  yield project.writeFiles();
package/lib/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"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","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\r\n\r\nimport { digest as digestV2 } from \"./data-model/DataModelDigestionV2\";\r\nimport { digest as digestV4 } from \"./data-model/DataModelDigestionV4\";\r\nimport { ODataEdmxModelBase, Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\r\nimport { SchemaV3 } from \"./data-model/edmx/ODataEdmxModelV3\";\r\nimport { SchemaV4 } from \"./data-model/edmx/ODataEdmxModelV4\";\r\nimport { NamingHelper } from \"./data-model/NamingHelper\";\r\nimport { generateModels, generateQueryObjects, generateServices } from \"./generator\";\r\nimport { Modes, RunOptions } from \"./OptionModel\";\r\nimport { createProjectManager } from \"./project/ProjectManager\";\r\n\r\nfunction isQObjectGen(mode: Modes) {\r\n return [Modes.qobjects, Modes.service, Modes.all].includes(mode);\r\n}\r\n\r\nfunction isServiceGen(mode: Modes) {\r\n return [Modes.service, Modes.all].includes(mode);\r\n}\r\n\r\n/**\r\n *\r\n * @param metadataJson metadata of a given OData service already parsed as JSON\r\n * @param options further options\r\n */\r\nexport async function runApp(metadataJson: ODataEdmxModelBase<any>, options: RunOptions): Promise<void> {\r\n // determine edmx edmxVersion attribute\r\n const edmxVersion = metadataJson[\"edmx:Edmx\"].$.Version;\r\n const version = edmxVersion === \"1.0\" ? ODataVersions.V2 : ODataVersions.V4;\r\n\r\n const dataService = metadataJson[\"edmx:Edmx\"][\"edmx:DataServices\"][0];\r\n const schemas = dataService.Schema as Array<SchemaV3 | SchemaV4>;\r\n\r\n const detectedSchema = schemas.find((schema) => schema.$.Namespace && schema.EntityType?.length) || schemas[0];\r\n const serviceName = options.serviceName || detectedSchema.$.Namespace;\r\n\r\n const namespaces: Array<string> = [];\r\n schemas.forEach((schema) => {\r\n namespaces.push(schema.$.Namespace);\r\n if (schema.$.Alias) {\r\n namespaces.push(schema.$.Alias);\r\n }\r\n });\r\n\r\n // encapsulate the whole naming logic\r\n const namingHelper = new NamingHelper(options, serviceName, namespaces);\r\n // parse model information from edmx into something we can really work with\r\n // => that stuff is called dataModel!\r\n const dataModel =\r\n version === ODataVersions.V2\r\n ? await digestV2(dataService.Schema as Array<SchemaV3>, options, namingHelper)\r\n : await digestV4(dataService.Schema as Array<SchemaV4>, options, namingHelper);\r\n // handling the overall generation project\r\n const project = await createProjectManager(\r\n namingHelper.getFileNames(),\r\n options.output,\r\n options.emitMode,\r\n options.prettier,\r\n options.tsconfig\r\n );\r\n\r\n // Generate Model Interfaces\r\n // supported edmx types: EntityType, ComplexType, EnumType\r\n const modelsFile = await project.createModelFile();\r\n generateModels(dataModel, modelsFile, version, options, namingHelper);\r\n\r\n // Generate Query Objects\r\n // supported edmx types: EntityType, ComplexType\r\n // supported edmx prop types: primitive types, enum types, primitive collection (incl enum types), entity collection, entity object, complex object\r\n if (isQObjectGen(options.mode)) {\r\n const qFile = await project.createQObjectFile();\r\n generateQueryObjects(dataModel, qFile, version, options, namingHelper);\r\n }\r\n\r\n // Generate Individual OData-Service\r\n if (isServiceGen(options.mode)) {\r\n await project.cleanServiceDir();\r\n await generateServices(dataModel, project, version, namingHelper, options);\r\n }\r\n\r\n await project.writeFiles();\r\n}\r\n"]}
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"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","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\n\nimport { NamespaceWithAlias } from \"./data-model/DataModel\";\nimport { digest as digestV2 } from \"./data-model/DataModelDigestionV2\";\nimport { digest as digestV4 } from \"./data-model/DataModelDigestionV4\";\nimport { ODataEdmxModelBase, Schema } from \"./data-model/edmx/ODataEdmxModelBase\";\nimport { SchemaV3 } from \"./data-model/edmx/ODataEdmxModelV3\";\nimport { SchemaV4 } from \"./data-model/edmx/ODataEdmxModelV4\";\nimport { NamingHelper } from \"./data-model/NamingHelper\";\nimport { generateModels, generateQueryObjects, generateServices } from \"./generator\";\nimport { Modes, RunOptions } from \"./OptionModel\";\nimport { createProjectManager } from \"./project/ProjectManager\";\n\nfunction isQObjectGen(mode: Modes) {\n return [Modes.qobjects, Modes.service, Modes.all].includes(mode);\n}\n\nfunction isServiceGen(mode: Modes) {\n return [Modes.service, Modes.all].includes(mode);\n}\n\n/**\n *\n * @param metadataJson metadata of a given OData service already parsed as JSON\n * @param options further options\n */\nexport async function runApp(metadataJson: ODataEdmxModelBase<any>, options: RunOptions): Promise<void> {\n // determine edmx edmxVersion attribute\n const edmxVersion = metadataJson[\"edmx:Edmx\"].$.Version;\n const version = edmxVersion === \"1.0\" ? ODataVersions.V2 : ODataVersions.V4;\n\n const dataService = metadataJson[\"edmx:Edmx\"][\"edmx:DataServices\"][0];\n const schemas = dataService.Schema as Array<SchemaV3 | SchemaV4>;\n\n const detectedSchema = schemas.find((schema) => schema.$.Namespace && schema.EntityType?.length) || schemas[0];\n const serviceName = options.serviceName || detectedSchema.$.Namespace;\n\n const namespaces = schemas.map<NamespaceWithAlias>((schema) => [schema.$.Namespace, schema.$.Alias]);\n\n // encapsulate the whole naming logic\n const namingHelper = new NamingHelper(options, serviceName, namespaces);\n // parse model information from edmx into something we can really work with\n // => that stuff is called dataModel!\n const dataModel =\n version === ODataVersions.V2\n ? await digestV2(dataService.Schema as Array<SchemaV3>, options, namingHelper)\n : await digestV4(dataService.Schema as Array<SchemaV4>, options, namingHelper);\n // handling the overall generation project\n const project = await createProjectManager(\n namingHelper.getFileNames(),\n options.output,\n options.emitMode,\n options.prettier,\n options.tsconfig\n );\n\n // Generate Model Interfaces\n // supported edmx types: EntityType, ComplexType, EnumType\n const modelsFile = await project.createModelFile();\n generateModels(dataModel, modelsFile, version, options, namingHelper);\n\n // Generate Query Objects\n // supported edmx types: EntityType, ComplexType\n // supported edmx prop types: primitive types, enum types, primitive collection (incl enum types), entity collection, entity object, complex object\n if (isQObjectGen(options.mode)) {\n const qFile = await project.createQObjectFile();\n generateQueryObjects(dataModel, qFile, version, options, namingHelper);\n }\n\n // Generate Individual OData-Service\n if (isServiceGen(options.mode)) {\n await generateServices(dataModel, project, version, namingHelper, options);\n }\n\n await project.writeFiles();\n}\n"]}
@@ -1,21 +1,42 @@
1
1
  import { MappedConverterChains } from "@odata2ts/converter-runtime";
2
2
  import { ODataTypesV2, ODataTypesV4 } from "@odata2ts/odata-core";
3
- import { ActionImportType, ComplexType, EntityContainerModel, EntitySetType, EnumType, FunctionImportType, ModelType, ODataVersion, OperationType, SingletonType } from "./DataTypeModel";
3
+ import { ActionImportType, ComplexType, EntityContainerModel, EntitySetType, EnumType, FunctionImportType, ModelType, ODataVersion, OperationType, PropertyModel, SingletonType } from "./DataTypeModel";
4
4
  export interface ProjectFiles {
5
5
  model: string;
6
6
  qObject: string;
7
7
  service: string;
8
8
  }
9
+ /**
10
+ * Each namespace is represented as tuple: 1. the namespace 2. the alias, if any.
11
+ */
12
+ export type NamespaceWithAlias = [string, string?];
13
+ export declare function withNamespace(ns: string, name: string): string;
9
14
  export declare class DataModel {
10
15
  private version;
11
16
  private readonly converters;
12
- private modelTypes;
13
- private complexTypes;
14
- private enumTypes;
15
- private operationTypes;
17
+ private models;
18
+ /**
19
+ * Stores unbound operations by their fully qualified name.
20
+ * @private
21
+ */
22
+ private unboundOperationTypes;
23
+ /**
24
+ * Stores operations bound to an entity type by the fully qualified name of the binding entity, e.g.
25
+ * "Trippin.Person".
26
+ * @private
27
+ */
28
+ private entityBoundOperationTypes;
29
+ /**
30
+ * Stores operations bound to an entity collection by the fully qualified name of the binding entity, e.g.
31
+ * "Trippin.Person".
32
+ * @private
33
+ */
34
+ private entityCollectionBoundOperationTypes;
35
+ private readonly namespace2Alias;
16
36
  private typeDefinitions;
37
+ private aliases;
17
38
  private container;
18
- constructor(version: ODataVersion, converters?: MappedConverterChains);
39
+ constructor(namespaces: Array<NamespaceWithAlias>, version: ODataVersion, converters?: MappedConverterChains);
19
40
  /**
20
41
  * OData version: 2.0 or 4.0.
21
42
  * @returns
@@ -23,66 +44,56 @@ export declare class DataModel {
23
44
  getODataVersion(): ODataVersion;
24
45
  isV2(): boolean;
25
46
  isV4(): boolean;
26
- addTypeDefinition(name: string, type: string): void;
27
- getPrimitiveType(name: string): string | undefined;
28
- addModel(name: string, model: ModelType): void;
47
+ private retrieveType;
48
+ private addAlias;
49
+ addTypeDefinition(namespace: string, name: string, type: string): void;
50
+ getPrimitiveType(fqName: string): string | undefined;
51
+ getModel(fqName: string): ModelType | ComplexType | EnumType | undefined;
52
+ addEntityType(namespace: string, name: string, model: Omit<ModelType, "dataType">): void;
29
53
  /**
30
- * Get a specific model by its name.
54
+ * Get a specific model by its fully qualified name.
31
55
  *
32
- * @param modelName the final model name that is generated
56
+ * @param fqName the fully qualified name of the entity
33
57
  * @returns the model type
34
58
  */
35
- getModel(modelName: string): ModelType;
59
+ getEntityType(fqName: string): ModelType;
36
60
  /**
37
61
  * Retrieve all known EntityType models from the EDMX model.
38
62
  *
39
63
  * @returns list of model types
40
64
  */
41
- getModels(): ModelType[];
65
+ getEntityTypes(): ModelType[];
66
+ addComplexType(namespace: string, name: string, model: Omit<ComplexType, "dataType">): void;
42
67
  /**
43
- * Set all model entity types
68
+ * Get a specific model by its fully qualified name.
44
69
  *
45
- * @param models new model types
46
- */
47
- setModels(models: {
48
- [name: string]: ModelType;
49
- }): void;
50
- addComplexType(name: string, model: ComplexType): void;
51
- /**
52
- * Get a specific model by its name.
53
- *
54
- * @param name the final model name that is generated
70
+ * @param fqName the final model name that is generated
55
71
  * @returns the model type
56
72
  */
57
- getComplexType(name: string): ComplexType;
73
+ getComplexType(fqName: string): ComplexType;
58
74
  /**
59
75
  * Retrieve all known ComplexType models from the EDMX model.
60
76
  *
61
77
  * @returns list of model types
62
78
  */
63
79
  getComplexTypes(): ComplexType[];
64
- /**
65
- * Set all complex types
66
- *
67
- * @param models new complex types
68
- */
69
- setComplexTypes(complexTypes: {
70
- [name: string]: ComplexType;
71
- }): void;
72
- addEnum(name: string, type: EnumType): void;
80
+ addEnum(namespace: string, name: string, type: Omit<EnumType, "dataType">): void;
73
81
  /**
74
82
  * Get list of all known enums, i.e. EnumType nodes from the EDMX model.
75
83
  * @returns list of enum types
76
84
  */
77
85
  getEnums(): EnumType[];
78
- addOperationType(binding: string, operationType: OperationType): void;
86
+ addUnboundOperationType(namespace: string, operationType: OperationType): void;
79
87
  getUnboundOperationTypes(): Array<OperationType>;
80
- getOperationTypeByBinding(binding: string): Array<OperationType>;
81
- getOperationTypeByEntityOrCollectionBinding(binding: string): Array<OperationType>;
88
+ getUnboundOperationType(fqOpName: string): OperationType | undefined;
89
+ addBoundOperationType(namespace: string, bindingProp: PropertyModel, operationType: OperationType): void;
90
+ getEntityTypeOperations(fqEntityName: string): Array<OperationType>;
91
+ getEntitySetOperations(fqEntityName: string): Array<OperationType>;
82
92
  addAction(name: string, action: ActionImportType): void;
83
93
  addFunction(name: string, func: FunctionImportType): void;
84
94
  addSingleton(name: string, singleton: SingletonType): void;
85
95
  addEntitySet(name: string, entitySet: EntitySetType): void;
86
96
  getEntityContainer(): EntityContainerModel;
87
97
  getConverter(dataType: ODataTypesV2 | ODataTypesV4 | string): import("@odata2ts/converter-runtime").ValueConverterChain | undefined;
98
+ private sortModelsByInheritance;
88
99
  }