@sap-cloud-sdk/generator 4.1.3-20251119144655.0 → 4.1.3-20251122014251.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/batch/file.d.ts +2 -1
- package/dist/batch/file.js +2 -2
- package/dist/batch/file.js.map +1 -1
- package/dist/batch/imports.d.ts +2 -1
- package/dist/batch/imports.js +2 -2
- package/dist/batch/imports.js.map +1 -1
- package/dist/complex-type/file.d.ts +2 -1
- package/dist/complex-type/file.js +2 -2
- package/dist/complex-type/file.js.map +1 -1
- package/dist/complex-type/imports.d.ts +2 -1
- package/dist/complex-type/imports.js +3 -3
- package/dist/complex-type/imports.js.map +1 -1
- package/dist/entity/file.d.ts +2 -1
- package/dist/entity/file.js +3 -3
- package/dist/entity/file.js.map +1 -1
- package/dist/entity/imports.d.ts +3 -2
- package/dist/entity/imports.js +15 -11
- package/dist/entity/imports.js.map +1 -1
- package/dist/generator-without-ts-morph/entity-api/file.d.ts +2 -1
- package/dist/generator-without-ts-morph/entity-api/file.js +18 -12
- package/dist/generator-without-ts-morph/entity-api/file.js.map +1 -1
- package/dist/generator-without-ts-morph/entity-api/imports.d.ts +3 -3
- package/dist/generator-without-ts-morph/entity-api/imports.js +14 -8
- package/dist/generator-without-ts-morph/entity-api/imports.js.map +1 -1
- package/dist/generator-without-ts-morph/request-builder/file.d.ts +2 -1
- package/dist/generator-without-ts-morph/request-builder/file.js +2 -2
- package/dist/generator-without-ts-morph/request-builder/file.js.map +1 -1
- package/dist/generator-without-ts-morph/request-builder/imports.d.ts +6 -2
- package/dist/generator-without-ts-morph/request-builder/imports.js +21 -7
- package/dist/generator-without-ts-morph/request-builder/imports.js.map +1 -1
- package/dist/generator-without-ts-morph/service/file.d.ts +3 -3
- package/dist/generator-without-ts-morph/service/file.js +14 -8
- package/dist/generator-without-ts-morph/service/file.js.map +1 -1
- package/dist/generator.js +22 -17
- package/dist/generator.js.map +1 -1
- package/dist/imports.d.ts +3 -2
- package/dist/imports.js +12 -8
- package/dist/imports.js.map +1 -1
- package/dist/operations/file.d.ts +2 -1
- package/dist/operations/file.js +2 -2
- package/dist/operations/file.js.map +1 -1
- package/dist/operations/import.d.ts +2 -1
- package/dist/operations/import.js +13 -8
- package/dist/operations/import.js.map +1 -1
- package/dist/options/options.d.ts +7 -1
- package/dist/service/index-file.d.ts +2 -1
- package/dist/service/index-file.js +16 -10
- package/dist/service/index-file.js.map +1 -1
- package/dist/service/package-json.d.ts +3 -1
- package/dist/service/package-json.js +3 -1
- package/dist/service/package-json.js.map +1 -1
- package/package.json +7 -7
package/dist/batch/file.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VdmServiceMetadata } from '../vdm-types';
|
|
2
2
|
import type { SourceFileStructure } from 'ts-morph';
|
|
3
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
|
-
export declare function batchSourceFile(service: VdmServiceMetadata): SourceFileStructure;
|
|
7
|
+
export declare function batchSourceFile(service: VdmServiceMetadata, options?: CreateFileOptions): SourceFileStructure;
|
package/dist/batch/file.js
CHANGED
|
@@ -8,11 +8,11 @@ const type_1 = require("./type");
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
function batchSourceFile(service) {
|
|
11
|
+
function batchSourceFile(service, options) {
|
|
12
12
|
return {
|
|
13
13
|
kind: ts_morph_1.StructureKind.SourceFile,
|
|
14
14
|
statements: [
|
|
15
|
-
...(0, imports_1.importBatchDeclarations)(service),
|
|
15
|
+
...(0, imports_1.importBatchDeclarations)(service, options),
|
|
16
16
|
(0, function_1.batchFunction)(service),
|
|
17
17
|
(0, function_1.changesetFunction)(service),
|
|
18
18
|
`export const default${service.className}Path = '${service.serviceOptions.basePath}';`,
|
package/dist/batch/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/batch/file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/batch/file.ts"],"names":[],"mappings":";;AAWA,0CAeC;AA1BD,uCAAyC;AACzC,yCAA8D;AAC9D,uCAAoD;AACpD,iCAA2D;AAK3D;;GAEG;AACH,SAAgB,eAAe,CAC7B,OAA2B,EAC3B,OAA2B;IAE3B,OAAO;QACL,IAAI,EAAE,wBAAa,CAAC,UAAU;QAC9B,UAAU,EAAE;YACV,GAAG,IAAA,iCAAuB,EAAC,OAAO,EAAE,OAAO,CAAC;YAC5C,IAAA,wBAAa,EAAC,OAAO,CAAC;YACtB,IAAA,4BAAiB,EAAC,OAAO,CAAC;YAC1B,uBAAuB,OAAO,CAAC,SAAS,WAAW,OAAO,CAAC,cAAc,CAAC,QAAQ,IAAI;YACtF,IAAA,sBAAe,EAAC,OAAO,CAAC;YACxB,IAAA,uBAAgB,EAAC,OAAO,CAAC;SAC1B;KACqB,CAAC;AAC3B,CAAC"}
|
package/dist/batch/imports.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ImportDeclarationStructure } from 'ts-morph';
|
|
2
2
|
import type { VdmServiceMetadata } from '../vdm-types';
|
|
3
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
|
-
export declare function importBatchDeclarations(service: VdmServiceMetadata): ImportDeclarationStructure[];
|
|
7
|
+
export declare function importBatchDeclarations(service: VdmServiceMetadata, options?: CreateFileOptions): ImportDeclarationStructure[];
|
package/dist/batch/imports.js
CHANGED
|
@@ -7,7 +7,7 @@ const imports_1 = require("../imports");
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
function importBatchDeclarations(service) {
|
|
10
|
+
function importBatchDeclarations(service, options) {
|
|
11
11
|
return [
|
|
12
12
|
(0, imports_1.odataImportDeclarationTsMorph)([
|
|
13
13
|
'CreateRequestBuilder',
|
|
@@ -27,7 +27,7 @@ function importBatchDeclarations(service) {
|
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
kind: ts_morph_1.StructureKind.ImportDeclaration,
|
|
30
|
-
moduleSpecifier: './index',
|
|
30
|
+
moduleSpecifier: options?.generateESM ? './index.js' : './index',
|
|
31
31
|
namedImports: getNamedImports(service)
|
|
32
32
|
}
|
|
33
33
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/batch/imports.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/batch/imports.ts"],"names":[],"mappings":";;AAUA,0DA8BC;AAxCD,uCAAyC;AACzC,8CAA6C;AAC7C,wCAA2D;AAK3D;;GAEG;AACH,SAAgB,uBAAuB,CACrC,OAA2B,EAC3B,OAA2B;IAE3B,OAAO;QACL,IAAA,uCAA6B,EAC3B;YACE,sBAAsB;YACtB,sBAAsB;YACtB,eAAe;YACf,sBAAsB;YACtB,wBAAwB;YACxB,0BAA0B;YAC1B,sBAAsB;YACtB,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACjE,gBAAgB;SACjB,EACD,OAAO,CAAC,YAAY,CACrB;QACD;YACE,IAAI,EAAE,wBAAa,CAAC,iBAAiB;YACrC,eAAe,EAAE,qBAAqB;YACtC,YAAY,EAAE,CAAC,kCAAkC,CAAC;SACnD;QACD;YACE,IAAI,EAAE,wBAAa,CAAC,iBAAiB;YACrC,eAAe,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;YAChE,YAAY,EAAE,eAAe,CAAC,OAAO,CAAC;SACvC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,OAA2B;IAClD,MAAM,iCAAiC,GAAG,OAAO,CAAC,UAAU;SACzD,MAAM,CACL,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,kBAAkB,KAAK,cAAc,CACrE;SACA,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAEzD,OAAO,IAAA,aAAM,EAAC;QACZ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACzC,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;QACpD,GAAG,iCAAiC;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { VdmComplexType } from '../vdm-types';
|
|
2
2
|
import type { ODataVersion } from '@sap-cloud-sdk/util';
|
|
3
3
|
import type { SourceFileStructure } from 'ts-morph';
|
|
4
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
|
-
export declare function complexTypeSourceFile(complexType: VdmComplexType, oDataVersion: ODataVersion): SourceFileStructure;
|
|
8
|
+
export declare function complexTypeSourceFile(complexType: VdmComplexType, oDataVersion: ODataVersion, options?: CreateFileOptions): SourceFileStructure;
|
|
@@ -9,11 +9,11 @@ const namespace_1 = require("./namespace");
|
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
function complexTypeSourceFile(complexType, oDataVersion) {
|
|
12
|
+
function complexTypeSourceFile(complexType, oDataVersion, options) {
|
|
13
13
|
return {
|
|
14
14
|
kind: ts_morph_1.StructureKind.SourceFile,
|
|
15
15
|
statements: [
|
|
16
|
-
...(0, imports_1.importDeclarations)(complexType, oDataVersion),
|
|
16
|
+
...(0, imports_1.importDeclarations)(complexType, oDataVersion, options),
|
|
17
17
|
(0, interface_1.complexTypeInterface)(complexType),
|
|
18
18
|
(0, field_type_class_1.fieldTypeClass)(complexType),
|
|
19
19
|
(0, namespace_1.complexTypeNamespace)(complexType)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/complex-type/file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/complex-type/file.ts"],"names":[],"mappings":";;AAaA,sDAcC;AA3BD,uCAAyC;AACzC,yDAAoD;AACpD,uCAA+C;AAC/C,2CAAmD;AACnD,2CAAmD;AAMnD;;GAEG;AACH,SAAgB,qBAAqB,CACnC,WAA2B,EAC3B,YAA0B,EAC1B,OAA2B;IAE3B,OAAO;QACL,IAAI,EAAE,wBAAa,CAAC,UAAU;QAC9B,UAAU,EAAE;YACV,GAAG,IAAA,4BAAkB,EAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC;YACzD,IAAA,gCAAoB,EAAC,WAAW,CAAC;YACjC,IAAA,iCAAc,EAAC,WAAW,CAAC;YAC3B,IAAA,gCAAoB,EAAC,WAAW,CAAC;SAClC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ImportDeclarationStructure } from 'ts-morph';
|
|
2
2
|
import type { ODataVersion } from '@sap-cloud-sdk/util';
|
|
3
3
|
import type { VdmComplexType } from '../vdm-types';
|
|
4
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
|
-
export declare function importDeclarations(complexType: VdmComplexType, oDataVersion: ODataVersion): ImportDeclarationStructure[];
|
|
8
|
+
export declare function importDeclarations(complexType: VdmComplexType, oDataVersion: ODataVersion, options?: CreateFileOptions): ImportDeclarationStructure[];
|
|
@@ -5,10 +5,10 @@ const imports_1 = require("../imports");
|
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
function importDeclarations(complexType, oDataVersion) {
|
|
8
|
+
function importDeclarations(complexType, oDataVersion, options) {
|
|
9
9
|
return [
|
|
10
|
-
...(0, imports_1.complexTypeImportDeclarations)(complexType.properties),
|
|
11
|
-
...(0, imports_1.enumTypeImportDeclarations)(complexType.properties),
|
|
10
|
+
...(0, imports_1.complexTypeImportDeclarations)(complexType.properties, options),
|
|
11
|
+
...(0, imports_1.enumTypeImportDeclarations)(complexType.properties, options),
|
|
12
12
|
(0, imports_1.odataImportDeclarationTsMorph)([
|
|
13
13
|
'DefaultDeSerializers',
|
|
14
14
|
'DeSerializers',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/complex-type/imports.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/complex-type/imports.ts"],"names":[],"mappings":";;AAaA,gDA0BC;AAvCD,wCAIoB;AAMpB;;GAEG;AACH,SAAgB,kBAAkB,CAChC,WAA2B,EAC3B,YAA0B,EAC1B,OAA2B;IAE3B,OAAO;QACL,GAAG,IAAA,uCAA6B,EAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC;QACjE,GAAG,IAAA,oCAA0B,EAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC;QAC9D,IAAA,uCAA6B,EAC3B;YACE,sBAAsB;YACtB,eAAe;YACf,QAAQ;YACR,kBAAkB;YAClB,oBAAoB;YACpB,kBAAkB;YAClB,cAAc;YACd,cAAc;YACd,cAAc;YACd,uBAAuB;YACvB,kBAAkB;YAClB,GAAG,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE,CAAC,IAAI,EAAE,EACR,YAAY,CACb;KACF,CAAC;AACJ,CAAC"}
|
package/dist/entity/file.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VdmEntity, VdmServiceMetadata } from '../vdm-types';
|
|
2
2
|
import type { SourceFileStructure } from 'ts-morph';
|
|
3
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
|
-
export declare function entitySourceFile(entity: VdmEntity, service: VdmServiceMetadata): SourceFileStructure;
|
|
7
|
+
export declare function entitySourceFile(entity: VdmEntity, service: VdmServiceMetadata, options?: CreateFileOptions): SourceFileStructure;
|
package/dist/entity/file.js
CHANGED
|
@@ -9,12 +9,12 @@ const interface_1 = require("./interface");
|
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
function entitySourceFile(entity, service) {
|
|
12
|
+
function entitySourceFile(entity, service, options) {
|
|
13
13
|
return {
|
|
14
14
|
kind: ts_morph_1.StructureKind.SourceFile,
|
|
15
15
|
statements: [
|
|
16
|
-
...(0, imports_1.entityImportDeclarations)(entity, service, service.oDataVersion),
|
|
17
|
-
...(0, imports_1.otherEntityImports)(entity, service),
|
|
16
|
+
...(0, imports_1.entityImportDeclarations)(entity, service, service.oDataVersion, options),
|
|
17
|
+
...(0, imports_1.otherEntityImports)(entity, service, options),
|
|
18
18
|
(0, class_1.entityClass)(entity, service),
|
|
19
19
|
(0, interface_1.entityTypeInterface)(entity, service),
|
|
20
20
|
...entity.operations.map(operation => (0, operations_1.parametersInterface)(operation))
|
package/dist/entity/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/entity/file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/entity/file.ts"],"names":[],"mappings":";;AAYA,4CAoBC;AAhCD,uCAAyC;AACzC,8CAAoD;AACpD,mCAAsC;AACtC,uCAAyE;AACzE,2CAAkD;AAKlD;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,MAAiB,EACjB,OAA2B,EAC3B,OAA2B;IAE3B,OAAO;QACL,IAAI,EAAE,wBAAa,CAAC,UAAU;QAC9B,UAAU,EAAE;YACV,GAAG,IAAA,kCAAwB,EACzB,MAAM,EACN,OAAO,EACP,OAAO,CAAC,YAAY,EACpB,OAAO,CACR;YACD,GAAG,IAAA,4BAAkB,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;YAC/C,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,CAAC;YAC5B,IAAA,+BAAmB,EAAC,MAAM,EAAE,OAAO,CAAC;YACpC,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,IAAA,gCAAmB,EAAC,SAAS,CAAC,CAAC;SACtE;KACF,CAAC;AACJ,CAAC"}
|
package/dist/entity/imports.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ImportDeclarationStructure } from 'ts-morph';
|
|
2
2
|
import type { ODataVersion } from '@sap-cloud-sdk/util';
|
|
3
3
|
import type { VdmEntity, VdmServiceMetadata } from '../vdm-types';
|
|
4
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
|
-
export declare function entityImportDeclarations(entity: VdmEntity, service: VdmServiceMetadata, oDataVersion: ODataVersion): ImportDeclarationStructure[];
|
|
8
|
+
export declare function entityImportDeclarations(entity: VdmEntity, service: VdmServiceMetadata, oDataVersion: ODataVersion, options?: CreateFileOptions): ImportDeclarationStructure[];
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
*/
|
|
11
|
-
export declare function otherEntityImports(entity: VdmEntity, service: VdmServiceMetadata): ImportDeclarationStructure[];
|
|
12
|
+
export declare function otherEntityImports(entity: VdmEntity, service: VdmServiceMetadata, options?: CreateFileOptions): ImportDeclarationStructure[];
|
package/dist/entity/imports.js
CHANGED
|
@@ -8,37 +8,41 @@ const operations_1 = require("../operations");
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
function entityImportDeclarations(entity, service, oDataVersion) {
|
|
11
|
+
function entityImportDeclarations(entity, service, oDataVersion, options) {
|
|
12
12
|
if (oDataVersion === 'v4') {
|
|
13
13
|
return (0, imports_1.mergeImportDeclarations)([
|
|
14
14
|
(0, imports_1.odataImportDeclarationTsMorph)(['Entity', 'DefaultDeSerializers', 'DeSerializers', 'DeserializedType'], oDataVersion),
|
|
15
|
-
...(0, imports_1.complexTypeImportDeclarations)(entity.properties),
|
|
15
|
+
...(0, imports_1.complexTypeImportDeclarations)(entity.properties, options),
|
|
16
16
|
{
|
|
17
17
|
namedImports: [`${entity.className}Api`],
|
|
18
|
-
moduleSpecifier:
|
|
18
|
+
moduleSpecifier: options?.generateESM
|
|
19
|
+
? `./${entity.className}Api.js`
|
|
20
|
+
: `./${entity.className}Api`,
|
|
19
21
|
kind: ts_morph_1.StructureKind.ImportDeclaration,
|
|
20
22
|
isTypeOnly: true
|
|
21
23
|
},
|
|
22
24
|
...(0, operations_1.operationDeclarations)(service, entity.operations),
|
|
23
|
-
...(0, imports_1.enumTypeImportDeclarations)(entity.properties)
|
|
25
|
+
...(0, imports_1.enumTypeImportDeclarations)(entity.properties, options)
|
|
24
26
|
]);
|
|
25
27
|
}
|
|
26
28
|
return [
|
|
27
29
|
(0, imports_1.odataImportDeclarationTsMorph)(['Entity', 'DefaultDeSerializers', 'DeSerializers', 'DeserializedType'], oDataVersion),
|
|
28
|
-
...(0, imports_1.complexTypeImportDeclarations)(entity.properties),
|
|
30
|
+
...(0, imports_1.complexTypeImportDeclarations)(entity.properties, options),
|
|
29
31
|
{
|
|
30
32
|
namedImports: [`${entity.className}Api`],
|
|
31
|
-
moduleSpecifier:
|
|
33
|
+
moduleSpecifier: options?.generateESM
|
|
34
|
+
? `./${entity.className}Api.js`
|
|
35
|
+
: `./${entity.className}Api`,
|
|
32
36
|
kind: ts_morph_1.StructureKind.ImportDeclaration,
|
|
33
37
|
isTypeOnly: true
|
|
34
38
|
},
|
|
35
|
-
...(0, imports_1.enumTypeImportDeclarations)(entity.properties)
|
|
39
|
+
...(0, imports_1.enumTypeImportDeclarations)(entity.properties, options)
|
|
36
40
|
];
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
43
|
* @internal
|
|
40
44
|
*/
|
|
41
|
-
function otherEntityImports(entity, service) {
|
|
45
|
+
function otherEntityImports(entity, service, options) {
|
|
42
46
|
return Array.from(new Set(entity.navigationProperties.map(n => n.to)))
|
|
43
47
|
.map(to => {
|
|
44
48
|
const matchedEntity = service.entities.find(e => e.entitySetName === to);
|
|
@@ -48,13 +52,13 @@ function otherEntityImports(entity, service) {
|
|
|
48
52
|
return matchedEntity.className;
|
|
49
53
|
})
|
|
50
54
|
.filter(name => name !== entity.className)
|
|
51
|
-
.map(name => otherEntityImport(name));
|
|
55
|
+
.map(name => otherEntityImport(name, options));
|
|
52
56
|
}
|
|
53
|
-
function otherEntityImport(name) {
|
|
57
|
+
function otherEntityImport(name, options) {
|
|
54
58
|
return {
|
|
55
59
|
kind: ts_morph_1.StructureKind.ImportDeclaration,
|
|
56
60
|
namedImports: [name, `${name}Type`],
|
|
57
|
-
moduleSpecifier: `./${name}`
|
|
61
|
+
moduleSpecifier: options?.generateESM ? `./${name}.js` : `./${name}`
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
64
|
//# sourceMappingURL=imports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/entity/imports.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/entity/imports.ts"],"names":[],"mappings":";;AAgBA,4DA0CC;AAID,gDAmBC;AAjFD,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1
1
|
import type { VdmEntity, VdmServiceMetadata } from '../../vdm-types';
|
|
2
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
2
3
|
/**
|
|
3
4
|
* @internal
|
|
4
5
|
*/
|
|
5
|
-
export declare function entityApiFile(entity: VdmEntity, service: VdmServiceMetadata): string;
|
|
6
|
+
export declare function entityApiFile(entity: VdmEntity, service: VdmServiceMetadata, options?: CreateFileOptions): string;
|
|
@@ -9,8 +9,8 @@ const class_1 = require("./class");
|
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
function entityApiFile(entity, service) {
|
|
13
|
-
const imports = (0, internal_1.serializeImports)(getImports(entity, service));
|
|
12
|
+
function entityApiFile(entity, service, options) {
|
|
13
|
+
const imports = (0, internal_1.serializeImports)(getImports(entity, service, options));
|
|
14
14
|
const content = (0, class_1.classContent)(entity, service);
|
|
15
15
|
return [imports, content].join(util_1.unixEOL);
|
|
16
16
|
}
|
|
@@ -23,21 +23,25 @@ function entityApiFile(entity, service) {
|
|
|
23
23
|
// content
|
|
24
24
|
// ].join(unixEOL);
|
|
25
25
|
// }
|
|
26
|
-
function getImports(entity, service) {
|
|
26
|
+
function getImports(entity, service, options) {
|
|
27
27
|
return [
|
|
28
28
|
{
|
|
29
29
|
names: [`${entity.className}`],
|
|
30
|
-
moduleIdentifier:
|
|
30
|
+
moduleIdentifier: options?.generateESM
|
|
31
|
+
? `./${entity.className}.js`
|
|
32
|
+
: `./${entity.className}`,
|
|
31
33
|
typeOnly: false
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
36
|
names: [`${entity.className}RequestBuilder`],
|
|
35
|
-
moduleIdentifier:
|
|
37
|
+
moduleIdentifier: options?.generateESM
|
|
38
|
+
? `./${entity.className}RequestBuilder.js`
|
|
39
|
+
: `./${entity.className}RequestBuilder`,
|
|
36
40
|
typeOnly: false
|
|
37
41
|
},
|
|
38
|
-
...otherEntityApiImports(entity, service),
|
|
39
|
-
...(0, imports_2.complexTypeImports)(entity.properties),
|
|
40
|
-
...(0, imports_2.enumTypeImports)(entity.properties),
|
|
42
|
+
...otherEntityApiImports(entity, service, options),
|
|
43
|
+
...(0, imports_2.complexTypeImports)(entity.properties, options),
|
|
44
|
+
...(0, imports_2.enumTypeImports)(entity.properties, options),
|
|
41
45
|
(0, imports_2.odataImport)([
|
|
42
46
|
'CustomField',
|
|
43
47
|
'defaultDeSerializers',
|
|
@@ -54,7 +58,7 @@ function getImports(entity, service) {
|
|
|
54
58
|
], service.oDataVersion)
|
|
55
59
|
];
|
|
56
60
|
}
|
|
57
|
-
function otherEntityApiImports(entity, service) {
|
|
61
|
+
function otherEntityApiImports(entity, service, options) {
|
|
58
62
|
return Array.from(new Set(entity.navigationProperties.map(n => n.to)))
|
|
59
63
|
.map(to => {
|
|
60
64
|
const matchedEntity = service.entities.find(e => e.entitySetName === to);
|
|
@@ -64,13 +68,15 @@ function otherEntityApiImports(entity, service) {
|
|
|
64
68
|
return matchedEntity.className;
|
|
65
69
|
})
|
|
66
70
|
.filter(name => name !== entity.className)
|
|
67
|
-
.flatMap(name => otherEntityImports(name));
|
|
71
|
+
.flatMap(name => otherEntityImports(name, options));
|
|
68
72
|
}
|
|
69
|
-
function otherEntityImports(name) {
|
|
73
|
+
function otherEntityImports(name, options) {
|
|
70
74
|
return [
|
|
71
75
|
{
|
|
72
76
|
names: [`${name}Api`],
|
|
73
|
-
moduleIdentifier:
|
|
77
|
+
moduleIdentifier: options?.generateESM
|
|
78
|
+
? `./${name}Api.js`
|
|
79
|
+
: `./${name}Api`
|
|
74
80
|
}
|
|
75
81
|
];
|
|
76
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/entity-api/file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/entity-api/file.ts"],"names":[],"mappings":";;AA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B,CACzB,IAAY,EACZ,OAA2B;IAE3B,OAAO;QACL;YACE,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC;YACrB,gBAAgB,EAAE,OAAO,EAAE,WAAW;gBACpC,CAAC,CAAC,KAAK,IAAI,QAAQ;gBACnB,CAAC,CAAC,KAAK,IAAI,KAAK;SACnB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ODataVersion } from '@sap-cloud-sdk/util';
|
|
2
|
-
import type { Import } from '@sap-cloud-sdk/generator-common/internal';
|
|
2
|
+
import type { Import, CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
3
3
|
import type { VdmMappedEdmType, VdmProperty } from '../../vdm-types';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -8,7 +8,7 @@ export declare function odataImport(namedImports: string[], odataVersion: ODataV
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export declare function complexTypeImports(properties: VdmProperty[]): Import[];
|
|
11
|
+
export declare function complexTypeImports(properties: VdmProperty[], options?: CreateFileOptions): Import[];
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
@@ -16,7 +16,7 @@ export declare function externalImports(properties: VdmMappedEdmType[]): Import[
|
|
|
16
16
|
/**
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
|
-
export declare function enumTypeImports(properties: VdmProperty[]): Import[];
|
|
19
|
+
export declare function enumTypeImports(properties: VdmProperty[], options?: CreateFileOptions): Import[];
|
|
20
20
|
/**
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
@@ -22,15 +22,17 @@ function odataImport(namedImports, odataVersion) {
|
|
|
22
22
|
/**
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
function complexTypeImports(properties) {
|
|
25
|
+
function complexTypeImports(properties, options) {
|
|
26
26
|
return mergeImports(properties
|
|
27
27
|
.filter(prop => prop.isComplex)
|
|
28
|
-
.map(prop => complexTypeImport(prop)));
|
|
28
|
+
.map(prop => complexTypeImport(prop, options)));
|
|
29
29
|
}
|
|
30
|
-
function complexTypeImport(prop) {
|
|
30
|
+
function complexTypeImport(prop, options) {
|
|
31
31
|
return {
|
|
32
32
|
names: [prop.jsType, ...(prop.isCollection ? [] : [prop.fieldType])],
|
|
33
|
-
moduleIdentifier:
|
|
33
|
+
moduleIdentifier: options?.generateESM
|
|
34
|
+
? `./${prop.jsType}.js`
|
|
35
|
+
: `./${prop.jsType}`,
|
|
34
36
|
typeOnly: false
|
|
35
37
|
};
|
|
36
38
|
}
|
|
@@ -51,12 +53,16 @@ function externalImport(properties, moduleIdentifier, names) {
|
|
|
51
53
|
/**
|
|
52
54
|
* @internal
|
|
53
55
|
*/
|
|
54
|
-
function enumTypeImports(properties) {
|
|
55
|
-
return mergeImports(properties
|
|
56
|
+
function enumTypeImports(properties, options) {
|
|
57
|
+
return mergeImports(properties
|
|
58
|
+
.filter(prop => prop.isEnum)
|
|
59
|
+
.map(prop => enumTypeImport(prop, options)));
|
|
56
60
|
}
|
|
57
|
-
function enumTypeImport(prop) {
|
|
61
|
+
function enumTypeImport(prop, options) {
|
|
58
62
|
return {
|
|
59
|
-
moduleIdentifier:
|
|
63
|
+
moduleIdentifier: options?.generateESM
|
|
64
|
+
? `./${prop.jsType}.js`
|
|
65
|
+
: `./${prop.jsType}`,
|
|
60
66
|
names: [prop.jsType],
|
|
61
67
|
typeOnly: false
|
|
62
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/entity-api/imports.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/entity-api/imports.ts"],"names":[],"mappings":";;AAYA,kCAYC;AAKD,gDASC;AAkBD,0CAMC;AAkBD,0CASC;AAkBD,oCAuBC;AAlID,8CA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BAAoB,CAAC,KAAK,GAAG;gBAC3B,GAAG,oBAAoB,CAAC,KAAK;gBAC7B,GAAG,IAAI,CAAC,KAAK;aACd,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAc,CAAC;SACjB,GAAG,CAAC,QAAQ,CAAC,EAAE;QACd,QAAQ,CAAC,KAAK,GAAG,IAAA,aAAM,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;SACD,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VdmEntity } from '../../vdm-types';
|
|
2
2
|
import type { ODataVersion } from '@sap-cloud-sdk/util';
|
|
3
|
+
import type { CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
|
-
export declare function requestBuilderSourceFile(entity: VdmEntity, oDataVersion: ODataVersion): string;
|
|
7
|
+
export declare function requestBuilderSourceFile(entity: VdmEntity, oDataVersion: ODataVersion, options?: CreateFileOptions): string;
|
|
@@ -8,8 +8,8 @@ const imports_1 = require("./imports");
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
function requestBuilderSourceFile(entity, oDataVersion) {
|
|
12
|
-
const imports = (0, internal_1.serializeImports)((0, imports_1.requestBuilderImportDeclarations)(entity, oDataVersion));
|
|
11
|
+
function requestBuilderSourceFile(entity, oDataVersion, options) {
|
|
12
|
+
const imports = (0, internal_1.serializeImports)((0, imports_1.requestBuilderImportDeclarations)(entity, oDataVersion, options));
|
|
13
13
|
const content = (0, class_1.requestBuilderClass)(entity);
|
|
14
14
|
return [imports, content].join(util_1.unixEOL);
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/request-builder/file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/request-builder/file.ts"],"names":[],"mappings":";;AAWA,4DAUC;AArBD,uEAA4E;AAC5E,8CAA8C;AAC9C,mCAA8C;AAC9C,uCAA6D;AAK7D;;GAEG;AACH,SAAgB,wBAAwB,CACtC,MAAiB,EACjB,YAA0B,EAC1B,OAA2B;IAE3B,MAAM,OAAO,GAAG,IAAA,2BAAgB,EAC9B,IAAA,0CAAgC,EAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,CAChE,CAAC;IACF,MAAM,OAAO,GAAG,IAAA,2BAAmB,EAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,cAAO,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { Import } from '@sap-cloud-sdk/generator-common/internal';
|
|
1
|
+
import type { Import, CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
2
2
|
import type { ODataVersion } from '@sap-cloud-sdk/util';
|
|
3
3
|
import type { VdmEntity } from '../../vdm-types';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare function requestBuilderImportDeclarations(entity: VdmEntity, oDataVersion: ODataVersion): Import[];
|
|
7
|
+
export declare function requestBuilderImportDeclarations(entity: VdmEntity, oDataVersion: ODataVersion, options?: CreateFileOptions): Import[];
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function requestBuilderImports(entity: VdmEntity): string[];
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requestBuilderImportDeclarations = requestBuilderImportDeclarations;
|
|
4
|
+
exports.requestBuilderImports = requestBuilderImports;
|
|
4
5
|
const util_1 = require("@sap-cloud-sdk/util");
|
|
5
6
|
const imports_1 = require("../../imports");
|
|
6
7
|
const imports_2 = require("../imports");
|
|
7
8
|
/**
|
|
8
9
|
* @internal
|
|
9
10
|
*/
|
|
10
|
-
function requestBuilderImportDeclarations(entity, oDataVersion) {
|
|
11
|
+
function requestBuilderImportDeclarations(entity, oDataVersion, options) {
|
|
11
12
|
return [
|
|
12
13
|
...(0, imports_2.externalImportDeclarations)(entity.keys),
|
|
13
14
|
(0, imports_2.odataImportDeclaration)([
|
|
@@ -16,10 +17,13 @@ function requestBuilderImportDeclarations(entity, oDataVersion) {
|
|
|
16
17
|
'RequestBuilder',
|
|
17
18
|
...(0, imports_1.propertyTypeImportNames)(entity.keys)
|
|
18
19
|
].sort(), oDataVersion),
|
|
19
|
-
entityImportDeclaration(entity),
|
|
20
|
-
...entityKeyImportDeclaration(entity.keys)
|
|
20
|
+
entityImportDeclaration(entity, options),
|
|
21
|
+
...entityKeyImportDeclaration(entity.keys, options)
|
|
21
22
|
];
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
23
27
|
function requestBuilderImports(entity) {
|
|
24
28
|
const imports = [
|
|
25
29
|
'DefaultDeSerializers',
|
|
@@ -40,18 +44,28 @@ function requestBuilderImports(entity) {
|
|
|
40
44
|
}
|
|
41
45
|
return imports;
|
|
42
46
|
}
|
|
43
|
-
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
function entityImportDeclaration(entity, options) {
|
|
51
|
+
const generateESM = options?.generateESM;
|
|
44
52
|
return {
|
|
45
53
|
names: [entity.className],
|
|
46
|
-
moduleIdentifier:
|
|
54
|
+
moduleIdentifier: generateESM
|
|
55
|
+
? `./${entity.className}.js`
|
|
56
|
+
: `./${entity.className}`
|
|
47
57
|
};
|
|
48
58
|
}
|
|
49
|
-
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
function entityKeyImportDeclaration(properties, options) {
|
|
63
|
+
const generateESM = options?.generateESM;
|
|
50
64
|
return (0, util_1.unique)(properties
|
|
51
65
|
.filter(property => property.isEnum)
|
|
52
66
|
.map(property => property.jsType)).map(type => ({
|
|
53
67
|
names: [type],
|
|
54
|
-
moduleIdentifier: `./${type}`
|
|
68
|
+
moduleIdentifier: generateESM ? `./${type}.js` : `./${type}`
|
|
55
69
|
}));
|
|
56
70
|
}
|
|
57
71
|
//# sourceMappingURL=imports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/request-builder/imports.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../src/generator-without-ts-morph/request-builder/imports.ts"],"names":[],"mappings":";;AAaA,4EAmBC;AAKD,sDAwBC;AA7DD,8CAA6C;AAC7C,2CAAwD;AACxD,wCAAgF;AAQhF;;GAEG;AACH,SAAgB,gCAAgC,CAC9C,MAAiB,EACjB,YAA0B,EAC1B,OAA2B;IAE3B,OAAO;QACL,GAAG,IAAA,oCAA0B,EAAC,MAAM,CAAC,IAAI,CAAC;QAC1C,IAAA,gCAAsB,EACpB;YACE,GAAG,qBAAqB,CAAC,MAAM,CAAC;YAChC,kBAAkB;YAClB,gBAAgB;YAChB,GAAG,IAAA,iCAAuB,EAAC,MAAM,CAAC,IAAI,CAAC;SACxC,CAAC,IAAI,EAAE,EACR,YAAY,CACb;QACD,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC;QACxC,GAAG,0BAA0B,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;KACpD,CAAC;AACJ,CAAC;AAED;;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KAAK,EAAE,CAAC,IAAI,CAAC;QACb,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;KAC7D,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { VdmServiceMetadata } from '../../vdm-types';
|
|
2
|
-
import type { Import } from '@sap-cloud-sdk/generator-common/internal';
|
|
2
|
+
import type { Import, CreateFileOptions } from '@sap-cloud-sdk/generator-common/internal';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
export declare function serviceFile(service: VdmServiceMetadata): string;
|
|
6
|
+
export declare function serviceFile(service: VdmServiceMetadata, options?: CreateFileOptions): string;
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
export declare function imports(service: VdmServiceMetadata): Import[];
|
|
10
|
+
export declare function imports(service: VdmServiceMetadata, options?: CreateFileOptions): Import[];
|