@sap-ux/odata-service-writer 0.32.2 → 1.0.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.
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { NamespaceAlias, OdataService, EdmxAnnotationsInfo, EdmxOdataService, CdsAnnotationsInfo } from '../types';
2
+ import type { NamespaceAlias, OdataService, EdmxAnnotationsInfo, EdmxOdataService, CdsAnnotationsInfo } from '../types.js';
3
3
  /**
4
4
  * Updates cds files with the provided annotations.
5
5
  * This function takes cds annotations and an Editor instance,
@@ -1,20 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateCdsFilesWithAnnotations = updateCdsFilesWithAnnotations;
7
- exports.removeAnnotationsFromCDSFiles = removeAnnotationsFromCDSFiles;
8
- exports.writeLocalServiceAnnotationXMLFiles = writeLocalServiceAnnotationXMLFiles;
9
- exports.writeMetadata = writeMetadata;
10
- exports.removeRemoteServiceAnnotationXmlFiles = removeRemoteServiceAnnotationXmlFiles;
11
- exports.writeRemoteServiceAnnotationXmlFiles = writeRemoteServiceAnnotationXmlFiles;
12
- exports.getAnnotationNamespaces = getAnnotationNamespaces;
13
- const node_path_1 = require("node:path");
14
- const fast_xml_parser_1 = require("fast-xml-parser");
15
- const i18n_1 = require("../i18n");
16
- const prettify_xml_1 = __importDefault(require("prettify-xml"));
17
- const project_access_1 = require("@sap-ux/project-access");
1
+ import { join, normalize, posix } from 'node:path';
2
+ import { XMLParser } from 'fast-xml-parser';
3
+ import { t } from '../i18n.js';
4
+ import prettifyXml from 'prettify-xml';
5
+ import { getWebappPath, DirName } from '@sap-ux/project-access';
18
6
  /**
19
7
  * Updates the cds index or service file with the provided annotations.
20
8
  * This function takes an Editor instance and cds annotations
@@ -25,12 +13,12 @@ const project_access_1 = require("@sap-ux/project-access");
25
13
  * @returns {Promise<void>} A promise that resolves when the cds files have been updated.
26
14
  */
27
15
  async function updateCdsIndexOrServiceFile(fs, annotations) {
28
- const dirPath = (0, node_path_1.join)(annotations.projectName, project_access_1.DirName.Annotations);
29
- const annotationPath = (0, node_path_1.normalize)(dirPath).split(/[\\/]/g).join(node_path_1.posix.sep);
16
+ const dirPath = join(annotations.projectName, DirName.Annotations);
17
+ const annotationPath = normalize(dirPath).split(/[\\/]/g).join(posix.sep);
30
18
  const annotationConfig = `\nusing from './${annotationPath}';`;
31
19
  // get index and service file paths
32
- const indexFilePath = (0, node_path_1.join)(annotations.projectPath, annotations.appPath ?? '', 'index.cds');
33
- const serviceFilePath = (0, node_path_1.join)(annotations.projectPath, annotations.appPath ?? '', 'services.cds');
20
+ const indexFilePath = join(annotations.projectPath, annotations.appPath ?? '', 'index.cds');
21
+ const serviceFilePath = join(annotations.projectPath, annotations.appPath ?? '', 'services.cds');
34
22
  // extend index or service file with annotation config
35
23
  if (indexFilePath && fs.exists(indexFilePath)) {
36
24
  fs.append(indexFilePath, annotationConfig);
@@ -51,11 +39,11 @@ async function updateCdsIndexOrServiceFile(fs, annotations) {
51
39
  * @param {Editor} fs - The memfs editor instance
52
40
  * @returns {Promise<void>} A promise that resolves when the cds files have been updated.
53
41
  */
54
- async function updateCdsFilesWithAnnotations(annotations, fs) {
42
+ export async function updateCdsFilesWithAnnotations(annotations, fs) {
55
43
  if (Array.isArray(annotations)) {
56
44
  for (const annotationName in annotations) {
57
45
  const annotation = annotations[annotationName];
58
- const annotationCdsPath = (0, node_path_1.join)(annotation.projectPath, annotation.appPath ?? '', annotation.projectName, 'annotations.cds');
46
+ const annotationCdsPath = join(annotation.projectPath, annotation.appPath ?? '', annotation.projectName, 'annotations.cds');
59
47
  // write into annotations.cds file
60
48
  if (fs.exists(annotationCdsPath)) {
61
49
  fs.append(annotationCdsPath, annotation.cdsFileContents);
@@ -67,7 +55,7 @@ async function updateCdsFilesWithAnnotations(annotations, fs) {
67
55
  }
68
56
  }
69
57
  else {
70
- const annotationCdsPath = (0, node_path_1.join)(annotations.projectPath, annotations.appPath ?? '', annotations.projectName, 'annotations.cds');
58
+ const annotationCdsPath = join(annotations.projectPath, annotations.appPath ?? '', annotations.projectName, 'annotations.cds');
71
59
  // write into annotations.cds file
72
60
  fs.write(annotationCdsPath, annotations.cdsFileContents);
73
61
  await updateCdsIndexOrServiceFile(fs, annotations);
@@ -83,12 +71,12 @@ async function updateCdsFilesWithAnnotations(annotations, fs) {
83
71
  * @returns {Promise<void>} A promise that resolves when the cds files have been updated.
84
72
  */
85
73
  async function removeCdsIndexOrServiceFile(fs, annotations) {
86
- const dirPath = (0, node_path_1.join)(annotations.projectName, project_access_1.DirName.Annotations);
87
- const annotationPath = (0, node_path_1.normalize)(dirPath).split(/[\\/]/g).join(node_path_1.posix.sep);
74
+ const dirPath = join(annotations.projectName, DirName.Annotations);
75
+ const annotationPath = normalize(dirPath).split(/[\\/]/g).join(posix.sep);
88
76
  const annotationConfig = `\nusing from './${annotationPath}';`;
89
77
  // Get index and service file paths
90
- const indexFilePath = (0, node_path_1.join)(annotations.projectPath, annotations.appPath ?? '', 'index.cds');
91
- const serviceFilePath = (0, node_path_1.join)(annotations.projectPath, annotations.appPath ?? '', 'services.cds');
78
+ const indexFilePath = join(annotations.projectPath, annotations.appPath ?? '', 'index.cds');
79
+ const serviceFilePath = join(annotations.projectPath, annotations.appPath ?? '', 'services.cds');
92
80
  // Remove annotation config from index or service file
93
81
  if (indexFilePath && fs.exists(indexFilePath)) {
94
82
  // Read old annotations content and replace it with empty string
@@ -112,11 +100,11 @@ async function removeCdsIndexOrServiceFile(fs, annotations) {
112
100
  * @param {Editor} fs - The memfs editor instance
113
101
  * @returns {Promise<void>} A promise that resolves when the cds files have been updated.
114
102
  */
115
- async function removeAnnotationsFromCDSFiles(annotations, fs) {
103
+ export async function removeAnnotationsFromCDSFiles(annotations, fs) {
116
104
  if (Array.isArray(annotations)) {
117
105
  for (const annotationName in annotations) {
118
106
  const annotation = annotations[annotationName];
119
- const annotationCdsPath = (0, node_path_1.join)(annotation.projectPath, annotation.appPath ?? '', annotation.projectName, 'annotations.cds');
107
+ const annotationCdsPath = join(annotation.projectPath, annotation.appPath ?? '', annotation.projectName, 'annotations.cds');
120
108
  // Remove from annotations.cds file
121
109
  if (fs.exists(annotationCdsPath)) {
122
110
  // Read old annotations content and replace it with empty string
@@ -128,7 +116,7 @@ async function removeAnnotationsFromCDSFiles(annotations, fs) {
128
116
  }
129
117
  }
130
118
  else {
131
- const annotationCdsPath = (0, node_path_1.join)(annotations.projectPath, annotations.appPath ?? '', annotations.projectName, 'annotations.cds');
119
+ const annotationCdsPath = join(annotations.projectPath, annotations.appPath ?? '', annotations.projectName, 'annotations.cds');
132
120
  // Write into annotations.cds file
133
121
  if (fs.exists(annotationCdsPath)) {
134
122
  // Read old annotations content and replace it with empty string
@@ -147,13 +135,13 @@ async function removeAnnotationsFromCDSFiles(annotations, fs) {
147
135
  * @param {string} templateRoot - path to the file templates
148
136
  * @param {OdataService} service - the OData service instance with EDMX type
149
137
  */
150
- async function writeLocalServiceAnnotationXMLFiles(fs, webappPath, templateRoot, service) {
138
+ export async function writeLocalServiceAnnotationXMLFiles(fs, webappPath, templateRoot, service) {
151
139
  // Write metadata.xml file
152
140
  await writeMetadata(fs, webappPath, service);
153
141
  // Adds local annotations to datasources section of manifest.json and writes the annotations file
154
142
  if (service.localAnnotationsName) {
155
143
  const namespaces = getAnnotationNamespaces(service);
156
- fs.copyTpl((0, node_path_1.join)(templateRoot, 'add', 'annotation.xml'), (0, node_path_1.join)(webappPath, project_access_1.DirName.Annotations, `${service.localAnnotationsName}.xml`), { ...service, namespaces });
144
+ fs.copyTpl(join(templateRoot, 'add', 'annotation.xml'), join(webappPath, DirName.Annotations, `${service.localAnnotationsName}.xml`), { ...service, namespaces });
157
145
  }
158
146
  }
159
147
  /**
@@ -163,10 +151,10 @@ async function writeLocalServiceAnnotationXMLFiles(fs, webappPath, templateRoot,
163
151
  * @param {string} webappPath - the webapp path of an existing UI5 application
164
152
  * @param {OdataService} service - the OData service instance with EDMX type
165
153
  */
166
- async function writeMetadata(fs, webappPath, service) {
154
+ export async function writeMetadata(fs, webappPath, service) {
167
155
  if (service.metadata) {
168
156
  // mainService should be used in case there is no name defined for service
169
- fs.write((0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, service.name ?? 'mainService', 'metadata.xml'), (0, prettify_xml_1.default)(service.metadata, { indent: 4 }));
157
+ fs.write(join(webappPath, DirName.LocalService, service.name ?? 'mainService', 'metadata.xml'), prettifyXml(service.metadata, { indent: 4 }));
170
158
  }
171
159
  }
172
160
  /**
@@ -177,20 +165,20 @@ async function writeMetadata(fs, webappPath, service) {
177
165
  * @param {string} serviceName - Name of The OData service.
178
166
  * @param {OdataService} edmxAnnotations - The OData service annotations.
179
167
  */
180
- async function removeRemoteServiceAnnotationXmlFiles(fs, basePath, serviceName, edmxAnnotations) {
181
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
168
+ export async function removeRemoteServiceAnnotationXmlFiles(fs, basePath, serviceName, edmxAnnotations) {
169
+ const webappPath = await getWebappPath(basePath, fs);
182
170
  // Write annotation xml if annotations are provided and service type is EDMX
183
171
  if (Array.isArray(edmxAnnotations)) {
184
172
  for (const annotationName in edmxAnnotations) {
185
173
  const annotation = edmxAnnotations[annotationName];
186
- const pathToAnnotationFile = (0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, serviceName, `${annotation.technicalName}.xml`);
174
+ const pathToAnnotationFile = join(webappPath, DirName.LocalService, serviceName, `${annotation.technicalName}.xml`);
187
175
  if (fs.exists(pathToAnnotationFile)) {
188
176
  fs.delete(pathToAnnotationFile);
189
177
  }
190
178
  }
191
179
  }
192
180
  else if (edmxAnnotations?.xml) {
193
- const pathToAnnotationFile = (0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, serviceName, `${edmxAnnotations.technicalName}.xml`);
181
+ const pathToAnnotationFile = join(webappPath, DirName.LocalService, serviceName, `${edmxAnnotations.technicalName}.xml`);
194
182
  if (fs.exists(pathToAnnotationFile)) {
195
183
  fs.delete(pathToAnnotationFile);
196
184
  }
@@ -204,19 +192,19 @@ async function removeRemoteServiceAnnotationXmlFiles(fs, basePath, serviceName,
204
192
  * @param {string} serviceName - Name of The OData service.
205
193
  * @param {OdataService} edmxAnnotations - The OData service annotations.
206
194
  */
207
- async function writeRemoteServiceAnnotationXmlFiles(fs, basePath, serviceName, edmxAnnotations) {
208
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
195
+ export async function writeRemoteServiceAnnotationXmlFiles(fs, basePath, serviceName, edmxAnnotations) {
196
+ const webappPath = await getWebappPath(basePath, fs);
209
197
  // Write annotation xml if annotations are provided and service type is EDMX
210
198
  if (Array.isArray(edmxAnnotations)) {
211
199
  for (const annotationName in edmxAnnotations) {
212
200
  const annotation = edmxAnnotations[annotationName];
213
201
  if (annotation?.xml) {
214
- fs.write((0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, serviceName, `${annotation.name}.xml`), (0, prettify_xml_1.default)(annotation.xml, { indent: 4 }));
202
+ fs.write(join(webappPath, DirName.LocalService, serviceName, `${annotation.name}.xml`), prettifyXml(annotation.xml, { indent: 4 }));
215
203
  }
216
204
  }
217
205
  }
218
206
  else if (edmxAnnotations?.xml) {
219
- fs.write((0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, serviceName, `${edmxAnnotations.name}.xml`), (0, prettify_xml_1.default)(edmxAnnotations.xml, { indent: 4 }));
207
+ fs.write(join(webappPath, DirName.LocalService, serviceName, `${edmxAnnotations.name}.xml`), prettifyXml(edmxAnnotations.xml, { indent: 4 }));
220
208
  }
221
209
  }
222
210
  /**
@@ -249,7 +237,7 @@ function getAnnotationNamespacesForSingleAnnotation(edmxAnnotation, schemaNamesp
249
237
  * @param {string} service.annotations - OData service annotations xml
250
238
  * @returns A reference to the namspaces array
251
239
  */
252
- function getAnnotationNamespaces({ metadata, annotations }) {
240
+ export function getAnnotationNamespaces({ metadata, annotations }) {
253
241
  // Enhance service with annotations namespaces
254
242
  let schemaNamespaces = metadata ? getNamespaces(metadata) : [];
255
243
  if (Array.isArray(annotations)) {
@@ -278,11 +266,11 @@ function xmlToJson(xml) {
278
266
  parseAttributeValue: true
279
267
  };
280
268
  try {
281
- const parser = new fast_xml_parser_1.XMLParser(options);
269
+ const parser = new XMLParser(options);
282
270
  return parser.parse(xml, true);
283
271
  }
284
272
  catch (error) {
285
- throw new Error((0, i18n_1.t)('error.unparseableXML', { error }));
273
+ throw new Error(t('error.unparseableXML', { error }));
286
274
  }
287
275
  }
288
276
  /**
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_DATASOURCE_NAME = void 0;
4
- exports.DEFAULT_DATASOURCE_NAME = 'mainService';
1
+ export const DEFAULT_DATASOURCE_NAME = 'mainService';
5
2
  //# sourceMappingURL=constants.js.map
@@ -1,4 +1,4 @@
1
- import type { OdataService } from '../types';
1
+ import type { OdataService } from '../types.js';
2
2
  import type { Editor } from 'mem-fs-editor';
3
3
  /**
4
4
  * Enhances the provided OData service object with path, name and model information.
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enhanceData = enhanceData;
4
- const node_path_1 = require("node:path");
5
- const types_1 = require("../types");
6
- const constants_1 = require("./constants");
7
- const project_access_1 = require("@sap-ux/project-access");
8
- const ui5_config_1 = require("@sap-ux/ui5-config");
1
+ import { join } from 'node:path';
2
+ import { ServiceType } from '../types.js';
3
+ import { DEFAULT_DATASOURCE_NAME } from './constants.js';
4
+ import { FileName, getWebappPath } from '@sap-ux/project-access';
5
+ import { UI5Config } from '@sap-ux/ui5-config';
9
6
  /**
10
7
  * Sets the default path for a given service.
11
8
  * If the service path is not defined, it sets the path to '/'.
@@ -47,7 +44,7 @@ function generateUniqueServiceName(dataSources, serviceName) {
47
44
  * @param {boolean} update - whether the service update is running
48
45
  */
49
46
  async function setDefaultServiceName(basePath, service, fs, update) {
50
- const manifestPath = (0, node_path_1.join)(await (0, project_access_1.getWebappPath)(basePath, fs), project_access_1.FileName.Manifest);
47
+ const manifestPath = join(await getWebappPath(basePath, fs), FileName.Manifest);
51
48
  const manifest = fs.readJSON(manifestPath);
52
49
  // Check if manifest has already any dataSources defined, DEFAULT_DATASOURCE_NAME should be used for the first service
53
50
  const dataSources = manifest?.['sap.app']?.dataSources;
@@ -55,7 +52,7 @@ async function setDefaultServiceName(basePath, service, fs, update) {
55
52
  // Filter out ODataAnnotation dataSources and keep only OData ones
56
53
  const oDataSources = Object.values(dataSources).filter((dataSource) => dataSource.type === 'OData');
57
54
  if (oDataSources.length === 0) {
58
- service.name = constants_1.DEFAULT_DATASOURCE_NAME;
55
+ service.name = DEFAULT_DATASOURCE_NAME;
59
56
  }
60
57
  else if (service.name && !update) {
61
58
  service.name = generateUniqueServiceName(dataSources, service.name);
@@ -63,7 +60,7 @@ async function setDefaultServiceName(basePath, service, fs, update) {
63
60
  }
64
61
  else {
65
62
  // No existing dataSources - no existing services, use default name
66
- service.name = constants_1.DEFAULT_DATASOURCE_NAME;
63
+ service.name = DEFAULT_DATASOURCE_NAME;
67
64
  }
68
65
  }
69
66
  /**
@@ -77,18 +74,19 @@ async function setDefaultServiceName(basePath, service, fs, update) {
77
74
  * @param {boolean} update - whether the service update is running (if true, makes sure that '' model is updated for the mainService)
78
75
  */
79
76
  async function setDefaultServiceModel(basePath, service, fs, update) {
80
- const manifestPath = (0, node_path_1.join)(await (0, project_access_1.getWebappPath)(basePath, fs), 'manifest.json');
77
+ const manifestPath = join(await getWebappPath(basePath, fs), 'manifest.json');
81
78
  const manifest = fs.readJSON(manifestPath);
82
79
  if (!service.model) {
83
80
  // Check if manifest has already any dataSource models defined, empty string '' should be used for the first service
84
81
  const models = manifest?.['sap.ui5']?.models;
85
82
  if (models) {
86
83
  // Filter dataSource models by dataSource property
87
- const servicesModels = Object.values(models).filter((model) => model.dataSource);
84
+ const modelValues = Object.values(models);
85
+ const servicesModels = modelValues.filter((model) => model.dataSource);
88
86
  if (servicesModels.length === 0 ||
89
87
  (update &&
90
- servicesModels.find((serviceModel) => serviceModel.dataSource === constants_1.DEFAULT_DATASOURCE_NAME) &&
91
- service.name === constants_1.DEFAULT_DATASOURCE_NAME)) {
88
+ servicesModels.find((serviceModel) => serviceModel.dataSource === DEFAULT_DATASOURCE_NAME) &&
89
+ service.name === DEFAULT_DATASOURCE_NAME)) {
92
90
  service.model = '';
93
91
  }
94
92
  else if (service.name) {
@@ -204,12 +202,12 @@ async function setDefaultPreviewSettings(basePath, service, fs, update = false)
204
202
  ...previewSettings,
205
203
  ...service.previewSettings
206
204
  };
207
- const ui5Yamlpath = (0, node_path_1.join)(basePath, project_access_1.FileName.Ui5Yaml);
205
+ const ui5Yamlpath = join(basePath, FileName.Ui5Yaml);
208
206
  if (!fs.exists(ui5Yamlpath)) {
209
207
  return;
210
208
  }
211
209
  const yamlContents = fs.read(ui5Yamlpath);
212
- const ui5Config = await ui5_config_1.UI5Config.newInstance(yamlContents);
210
+ const ui5Config = await UI5Config.newInstance(yamlContents);
213
211
  const backends = ui5Config.getBackendConfigsFromFioriToolsProxyMiddleware();
214
212
  if (update) {
215
213
  preserveExistingBackendConfig(service, backends, explicitPreviewPath);
@@ -227,20 +225,20 @@ async function setDefaultPreviewSettings(basePath, service, fs, update = false)
227
225
  * @param {Editor} fs - the memfs editor instance
228
226
  * @param {boolean} update - whether the service update is running (if true, skips unique service name generation and makes sure that '' model is updated for the mainService)
229
227
  */
230
- async function enhanceData(basePath, service, fs, update = false) {
228
+ export async function enhanceData(basePath, service, fs, update = false) {
231
229
  if (!update) {
232
230
  setDefaultServicePath(service);
233
231
  }
234
232
  await setDefaultServiceName(basePath, service, fs, update);
235
233
  await setDefaultServiceModel(basePath, service, fs, update);
236
234
  // set service type to EDMX if not defined
237
- service.type = service.type ?? types_1.ServiceType.EDMX;
235
+ service.type = service.type ?? ServiceType.EDMX;
238
236
  /**
239
237
  * In the manifest annotation names are used to add annotations to the manifest.json.
240
238
  * For CAP projects, annotations are added to the annotations.cds file instead of the manifest.json.
241
239
  * If the service type is EDMX, this function sets the default annotation names to be included in the manifest.json.
242
240
  */
243
- if (service.type === types_1.ServiceType.EDMX) {
241
+ if (service.type === ServiceType.EDMX) {
244
242
  setDefaultAnnotationsName(service);
245
243
  }
246
244
  // enhance preview settings with service configuration
@@ -1,7 +1,7 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { ConvertedMetadata, RawSchema } from '@sap-ux/vocabularies-types';
3
3
  import type { ExternalService, ExternalServiceReference } from '@sap-ux/axios-extension';
4
- import type { ExternalServiceCollectionOptions } from '../types';
4
+ import type { ExternalServiceCollectionOptions } from '../types.js';
5
5
  /**
6
6
  * Writes service metadata for external service references to the local service folder.
7
7
  *
@@ -1,17 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeExternalServiceMetadata = writeExternalServiceMetadata;
7
- exports.getExternalServiceReferences = getExternalServiceReferences;
8
- const node_path_1 = require("node:path");
9
- const posix_1 = require("node:path/posix");
10
- const prettify_xml_1 = __importDefault(require("prettify-xml"));
11
- const annotation_converter_1 = require("@sap-ux/annotation-converter");
12
- const edmx_parser_1 = require("@sap-ux/edmx-parser");
13
- const project_access_1 = require("@sap-ux/project-access");
14
- const constants_1 = require("./constants");
1
+ import { join } from 'node:path';
2
+ import { join as joinPosix } from 'node:path/posix';
3
+ import prettifyXml from 'prettify-xml';
4
+ import { convert } from '@sap-ux/annotation-converter';
5
+ import { parse } from '@sap-ux/edmx-parser';
6
+ import { DirName } from '@sap-ux/project-access';
7
+ import { DEFAULT_DATASOURCE_NAME } from './constants.js';
15
8
  const INDENT_SIZE = 4;
16
9
  /**
17
10
  * Writes service metadata for external service references to the local service folder.
@@ -22,18 +15,18 @@ const INDENT_SIZE = 4;
22
15
  * @param serviceName - Name of the service, defaults to 'mainService'
23
16
  * @param servicePath - Service path of the service
24
17
  */
25
- function writeExternalServiceMetadata(fs, webappPath, externalServices, serviceName = constants_1.DEFAULT_DATASOURCE_NAME, servicePath) {
18
+ export function writeExternalServiceMetadata(fs, webappPath, externalServices, serviceName = DEFAULT_DATASOURCE_NAME, servicePath) {
26
19
  if (!externalServices.length || !servicePath) {
27
20
  return;
28
21
  }
29
22
  const processedServices = new Set();
30
23
  for (const reference of externalServices) {
31
24
  const relativeServicePath = getServiceRoot(servicePath, reference.path);
32
- const filePathSegments = [webappPath, project_access_1.DirName.LocalService, serviceName, relativeServicePath];
25
+ const filePathSegments = [webappPath, DirName.LocalService, serviceName, relativeServicePath];
33
26
  const servicePathWithoutParameters = reference.path.split(';')[0];
34
27
  if (reference.entityData && !processedServices.has(servicePathWithoutParameters)) {
35
28
  for (const entitySetData of reference.entityData) {
36
- const entityDataPath = (0, node_path_1.join)(...filePathSegments, `${entitySetData.entitySetName}.json`);
29
+ const entityDataPath = join(...filePathSegments, `${entitySetData.entitySetName}.json`);
37
30
  fs.write(entityDataPath, JSON.stringify(entitySetData.items, undefined, INDENT_SIZE));
38
31
  }
39
32
  processedServices.add(servicePathWithoutParameters);
@@ -42,9 +35,9 @@ function writeExternalServiceMetadata(fs, webappPath, externalServices, serviceN
42
35
  filePathSegments.push(reference.target);
43
36
  }
44
37
  filePathSegments.push('metadata.xml');
45
- const path = (0, node_path_1.join)(...filePathSegments);
38
+ const path = join(...filePathSegments);
46
39
  if (reference.metadata) {
47
- fs.write(path, (0, prettify_xml_1.default)(reference.metadata, { indent: INDENT_SIZE }));
40
+ fs.write(path, prettifyXml(reference.metadata, { indent: INDENT_SIZE }));
48
41
  }
49
42
  }
50
43
  }
@@ -61,7 +54,7 @@ function getServiceRoot(mainServicePath, pathWithParameters) {
61
54
  let prefix = '/';
62
55
  let currentSegment = segments.shift();
63
56
  while (currentSegment !== undefined) {
64
- const next = (0, posix_1.join)(prefix, currentSegment);
57
+ const next = joinPosix(prefix, currentSegment);
65
58
  if (!mainServicePath.startsWith(next)) {
66
59
  break;
67
60
  }
@@ -102,7 +95,7 @@ function getOptions(options) {
102
95
  * To disable the collection of a specific type, set its value to `false`.
103
96
  * @returns External service references found in the files.
104
97
  */
105
- function getExternalServiceReferences(serviceRootPath, metadata, annotations = [], options) {
98
+ export function getExternalServiceReferences(serviceRootPath, metadata, annotations = [], options) {
106
99
  const finalOptions = getOptions(options);
107
100
  if (!metadata) {
108
101
  return [];
@@ -110,7 +103,7 @@ function getExternalServiceReferences(serviceRootPath, metadata, annotations = [
110
103
  const files = [metadata, ...annotations.map((annotationFile) => annotationFile.Definitions)];
111
104
  const references = [];
112
105
  for (const data of files) {
113
- const schema = typeof data === 'string' ? (0, annotation_converter_1.convert)((0, edmx_parser_1.parse)(data)) : data;
106
+ const schema = typeof data === 'string' ? convert(parse(data)) : data;
114
107
  for (const annotationLists of Object.values(schema.annotations)) {
115
108
  for (const annotationList of annotationLists) {
116
109
  const target = annotationList.target.replace(schema.namespace + '.', '');
@@ -1,4 +1,4 @@
1
- export * from './defaults';
2
- export * from './annotations';
3
- export * from './external-services';
1
+ export * from './defaults.js';
2
+ export * from './annotations.js';
3
+ export * from './external-services.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,20 +1,4 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./defaults"), exports);
18
- __exportStar(require("./annotations"), exports);
19
- __exportStar(require("./external-services"), exports);
1
+ export * from './defaults.js';
2
+ export * from './annotations.js';
3
+ export * from './external-services.js';
20
4
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { OdataService } from '../types';
2
+ import type { OdataService } from '../types.js';
3
3
  /**
4
4
  * Internal function that deletes service from the manifest.json based on the given service data.
5
5
  *
@@ -1,15 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deleteServiceFromManifest = deleteServiceFromManifest;
7
- exports.updateManifest = updateManifest;
8
- const node_path_1 = require("node:path");
9
- const i18n_1 = require("../i18n");
10
- const project_access_1 = require("@sap-ux/project-access");
11
- const types_1 = require("../types");
12
- const semver_1 = __importDefault(require("semver"));
1
+ import { dirname, join, sep } from 'node:path';
2
+ import { t } from '../i18n.js';
3
+ import { DirName, getMinimumUI5Version, getWebappPath } from '@sap-ux/project-access';
4
+ import { OdataVersion } from '../types.js';
5
+ import semVer from 'semver';
13
6
  /**
14
7
  * Extracts the OData version string to write to manifest.json from raw EDMX metadata.
15
8
  * Only returns a value when the EDMX declares Version="4.01".
@@ -46,10 +39,10 @@ function enhanceManifestDatasources(fs, webappPath, dataSourceUpdateSettings) {
46
39
  // Derive the manifest odataVersion: for v4 services, check EDMX metadata first (to detect 4.01),
47
40
  // then fall back to the passed service version enum.
48
41
  let odataVersionToWrite;
49
- if (serviceVersion === types_1.OdataVersion.v4) {
42
+ if (serviceVersion === OdataVersion.v4) {
50
43
  odataVersionToWrite = (serviceMetadata && getOdataVersionFromMetadata(serviceMetadata)) || '4.0';
51
44
  }
52
- else if (serviceVersion === types_1.OdataVersion.v2) {
45
+ else if (serviceVersion === OdataVersion.v2) {
53
46
  odataVersionToWrite = '2.0';
54
47
  }
55
48
  if (odataVersionToWrite) {
@@ -76,7 +69,7 @@ function enhanceManifestDatasources(fs, webappPath, dataSourceUpdateSettings) {
76
69
  function enhanceManifestModels(serviceName, serviceVersion, serviceModel, includeSynchronizationMode, manifest) {
77
70
  const models = manifest?.['sap.ui5']?.models ?? {};
78
71
  let modelSettings = {};
79
- if (serviceVersion === types_1.OdataVersion.v4) {
72
+ if (serviceVersion === OdataVersion.v4) {
80
73
  if (includeSynchronizationMode) {
81
74
  modelSettings['synchronizationMode'] = 'None';
82
75
  }
@@ -123,7 +116,7 @@ function enhanceManifestModels(serviceName, serviceVersion, serviceModel, includ
123
116
  function getModelSettings(minUI5Version) {
124
117
  let includeSynchronizationMode = false;
125
118
  if (minUI5Version) {
126
- includeSynchronizationMode = semver_1.default.satisfies(minUI5Version, '<=1.110');
119
+ includeSynchronizationMode = semVer.satisfies(minUI5Version, '<=1.110');
127
120
  }
128
121
  return { includeSynchronizationMode };
129
122
  }
@@ -193,8 +186,8 @@ function removeUnusedAnnotations(fs, webappPath, dataSources, serviceName, creat
193
186
  !createdAnnotations.includes(name)) {
194
187
  const oldAnnotationPath = dataSource.settings?.localUri;
195
188
  // Delete old annotation files
196
- if (oldAnnotationPath && fs.exists((0, node_path_1.join)(webappPath, oldAnnotationPath))) {
197
- fs.delete((0, node_path_1.join)(webappPath, oldAnnotationPath));
189
+ if (oldAnnotationPath && fs.exists(join(webappPath, oldAnnotationPath))) {
190
+ fs.delete(join(webappPath, oldAnnotationPath));
198
191
  }
199
192
  // Delete old annotation dataSource netry
200
193
  delete dataSources[name];
@@ -254,7 +247,7 @@ function addRemoteAnnotationDataSources(fs, webappPath, dataSources, serviceName
254
247
  * @param {boolean} forceServiceUpdate - if true, checks and updates service annotations
255
248
  */
256
249
  function enhanceManifest(service, manifest, webappPath, fs, forceServiceUpdate) {
257
- const minimumUi5Version = (0, project_access_1.getMinimumUI5Version)(manifest);
250
+ const minimumUi5Version = getMinimumUI5Version(manifest);
258
251
  // Enhance model settings for service
259
252
  const serviceSettings = Object.assign(service, getModelSettings(minimumUi5Version));
260
253
  if (serviceSettings.name && serviceSettings.path && serviceSettings.model !== undefined) {
@@ -288,12 +281,12 @@ function convertSingleService(webappPath, dataSourceKey, dataSource, fs) {
288
281
  const localUri = settings.localUri;
289
282
  // -> ["localService", "metadata.xml"]
290
283
  const localUriParts = localUri ? localUri.split('/') : undefined;
291
- if (localUriParts?.[0] === project_access_1.DirName.LocalService && localUriParts.length === 2) {
284
+ if (localUriParts?.[0] === DirName.LocalService && localUriParts.length === 2) {
292
285
  const localFileName = localUriParts[localUriParts.length - 1];
293
- settings.localUri = `${project_access_1.DirName.LocalService}/${dataSourceKey}/${localFileName}`;
286
+ settings.localUri = `${DirName.LocalService}/${dataSourceKey}/${localFileName}`;
294
287
  // move related files to service folder
295
- const fromFilePath = (0, node_path_1.join)(webappPath, localUriParts.join(node_path_1.sep));
296
- const toFilePath = (0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, dataSourceKey, localFileName);
288
+ const fromFilePath = join(webappPath, localUriParts.join(sep));
289
+ const toFilePath = join(webappPath, DirName.LocalService, dataSourceKey, localFileName);
297
290
  if (fs.exists(fromFilePath)) {
298
291
  fs.move(fromFilePath, toFilePath);
299
292
  }
@@ -337,7 +330,7 @@ async function addMultipleServiceSupportToManifest(webappPath, manifest, fs) {
337
330
  function removeFileForDataSource(fs, manifestPath, dataSource) {
338
331
  const serviceSettings = dataSource.settings ?? {};
339
332
  if (serviceSettings?.localUri) {
340
- const localUriPath = (0, node_path_1.join)((0, node_path_1.dirname)(manifestPath), serviceSettings?.localUri);
333
+ const localUriPath = join(dirname(manifestPath), serviceSettings?.localUri);
341
334
  if (fs.exists(localUriPath)) {
342
335
  // delete the local data source file
343
336
  fs.delete(localUriPath);
@@ -374,16 +367,16 @@ function removeAnnotations(fs, manifestPath, annotations, dataSources) {
374
367
  * @param service - name of the OData service instance
375
368
  * @param fs - the memfs editor instance
376
369
  */
377
- function deleteServiceFromManifest(basePath, service, fs) {
370
+ export function deleteServiceFromManifest(basePath, service, fs) {
378
371
  const serviceName = service.name ?? 'mainService';
379
- const manifestPath = (0, node_path_1.join)(basePath, 'webapp', 'manifest.json');
372
+ const manifestPath = join(basePath, 'webapp', 'manifest.json');
380
373
  // Get component app id
381
374
  const manifest = fs.readJSON(manifestPath);
382
375
  const appProp = 'sap.app';
383
376
  const appid = manifest?.[appProp]?.id;
384
377
  // Throw if required property is not found manifest.json
385
378
  if (!appid) {
386
- throw new Error((0, i18n_1.t)('error.requiredProjectPropertyNotFound', { property: `'${appProp}'.id`, path: manifestPath }));
379
+ throw new Error(t('error.requiredProjectPropertyNotFound', { property: `'${appProp}'.id`, path: manifestPath }));
387
380
  }
388
381
  const dataSources = manifest?.[appProp]?.dataSources;
389
382
  if (dataSources?.[serviceName]) {
@@ -419,10 +412,10 @@ function deleteServiceFromManifest(basePath, service, fs) {
419
412
  * @param {Editor} fs - the memfs editor instance
420
413
  * @param {boolean} forceServiceUpdate - if true, checks and updates service annotations
421
414
  */
422
- async function updateManifest(basePath, service, fs, forceServiceUpdate = false) {
415
+ export async function updateManifest(basePath, service, fs, forceServiceUpdate = false) {
423
416
  // Update manifest.json
424
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
425
- const manifestPath = (0, node_path_1.join)(webappPath, 'manifest.json');
417
+ const webappPath = await getWebappPath(basePath, fs);
418
+ const manifestPath = join(webappPath, 'manifest.json');
426
419
  // Get component app id
427
420
  const manifest = fs.readJSON(manifestPath);
428
421
  const appProp = 'sap.app';
@@ -430,11 +423,11 @@ async function updateManifest(basePath, service, fs, forceServiceUpdate = false)
430
423
  const dataSources = manifest[appProp]?.dataSources ?? {};
431
424
  // Throw if required property is not found manifest.json
432
425
  if (!appid) {
433
- throw new Error((0, i18n_1.t)('error.requiredProjectPropertyNotFound', { property: `'${appProp}'.id`, path: manifestPath }));
426
+ throw new Error(t('error.requiredProjectPropertyNotFound', { property: `'${appProp}'.id`, path: manifestPath }));
434
427
  }
435
428
  // Throw if only update is required and service is not found in manifest.json
436
429
  if (forceServiceUpdate && service.name && !dataSources?.[service.name]) {
437
- throw new Error((0, i18n_1.t)('error.requiredProjectPropertyNotFound', {
430
+ throw new Error(t('error.requiredProjectPropertyNotFound', {
438
431
  property: `'${appProp}.dataSources.${service.name}'`,
439
432
  path: manifestPath
440
433
  }));
@@ -443,7 +436,7 @@ async function updateManifest(basePath, service, fs, forceServiceUpdate = false)
443
436
  if (!forceServiceUpdate &&
444
437
  service.path &&
445
438
  Object.values(dataSources).find((dataSource) => dataSource.uri === service.path)) {
446
- throw new Error((0, i18n_1.t)('error.requiredServiceAlreadyExists', {
439
+ throw new Error(t('error.requiredServiceAlreadyExists', {
447
440
  uri: service.path
448
441
  }));
449
442
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updatePackageJson = updatePackageJson;
4
- const project_access_1 = require("@sap-ux/project-access");
1
+ import { hasUI5CliV3 } from '@sap-ux/project-access';
5
2
  /**
6
3
  * Update the package.json with the required middlewares.
7
4
  *
@@ -9,10 +6,10 @@ const project_access_1 = require("@sap-ux/project-access");
9
6
  * @param fs - the memfs editor instance
10
7
  * @param addMockServer true if the mocksever middleware needs to be added as well
11
8
  */
12
- function updatePackageJson(path, fs, addMockServer) {
9
+ export function updatePackageJson(path, fs, addMockServer) {
13
10
  const packageJson = JSON.parse(fs.read(path));
14
11
  packageJson.devDependencies = packageJson.devDependencies ?? {};
15
- if (!(0, project_access_1.hasUI5CliV3)(packageJson.devDependencies)) {
12
+ if (!hasUI5CliV3(packageJson.devDependencies)) {
16
13
  packageJson.ui5 = packageJson.ui5 ?? {};
17
14
  packageJson.ui5.dependencies = packageJson.ui5.dependencies ?? [];
18
15
  if (!packageJson.ui5.dependencies.includes('@sap/ux-ui5-tooling')) {
package/dist/delete.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { OdataService, ProjectPaths } from './types';
2
+ import type { OdataService, ProjectPaths } from './types.js';
3
3
  /**
4
4
  * Internal function that deletes service from the manifest.json and ui5-*.yaml files based on the given service data.
5
5
  *
package/dist/delete.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteServiceData = deleteServiceData;
4
- const ui5_config_1 = require("@sap-ux/ui5-config");
5
- const manifest_1 = require("./data/manifest");
6
- const annotations_1 = require("./data/annotations");
1
+ import { UI5Config } from '@sap-ux/ui5-config';
2
+ import { deleteServiceFromManifest } from './data/manifest.js';
3
+ import { removeRemoteServiceAnnotationXmlFiles } from './data/annotations.js';
7
4
  /**
8
5
  * Returns all paths of the EDMX service annotations.
9
6
  *
@@ -33,22 +30,22 @@ function getEDMXAnnotationPaths(edmxAnnotations) {
33
30
  * @param service - name of the OData service instance
34
31
  * @param fs - the memfs editor instance
35
32
  */
36
- async function deleteServiceData(basePath, paths, service, fs) {
37
- (0, manifest_1.deleteServiceFromManifest)(basePath, service, fs);
33
+ export async function deleteServiceData(basePath, paths, service, fs) {
34
+ deleteServiceFromManifest(basePath, service, fs);
38
35
  if (service.path && service.name) {
39
36
  let ui5Config;
40
37
  let ui5LocalConfig;
41
38
  let ui5MockConfig;
42
39
  // Delete service data from manifest.json
43
40
  if (paths.ui5Yaml) {
44
- ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5Yaml));
41
+ ui5Config = await UI5Config.newInstance(fs.read(paths.ui5Yaml));
45
42
  // Delete service backend from fiori-tools-proxy middleware config
46
43
  ui5Config.removeBackendFromFioriToolsProxyMiddleware(service.path);
47
44
  fs.write(paths.ui5Yaml, ui5Config.toString());
48
45
  }
49
46
  const serviceAnnotationPaths = getEDMXAnnotationPaths(service.annotations);
50
47
  if (paths.ui5LocalYaml) {
51
- ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
48
+ ui5LocalConfig = await UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
52
49
  // Delete service backend from fiori-tools-proxy middleware config
53
50
  ui5LocalConfig.removeBackendFromFioriToolsProxyMiddleware(service.path);
54
51
  // Delete service from mockserver middleware config
@@ -56,14 +53,14 @@ async function deleteServiceData(basePath, paths, service, fs) {
56
53
  fs.write(paths.ui5LocalYaml, ui5LocalConfig.toString());
57
54
  }
58
55
  if (paths.ui5MockYaml) {
59
- ui5MockConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5MockYaml));
56
+ ui5MockConfig = await UI5Config.newInstance(fs.read(paths.ui5MockYaml));
60
57
  // Delete service backend from fiori-tools-proxy middleware config
61
58
  ui5MockConfig.removeBackendFromFioriToolsProxyMiddleware(service.path);
62
59
  // Delete service from mockserver config
63
60
  ui5MockConfig.removeServiceFromMockServerMiddleware(service.path, serviceAnnotationPaths);
64
61
  fs.write(paths.ui5MockYaml, ui5MockConfig.toString());
65
62
  }
66
- await (0, annotations_1.removeRemoteServiceAnnotationXmlFiles)(fs, basePath, service.name, service.annotations);
63
+ await removeRemoteServiceAnnotationXmlFiles(fs, basePath, service.name, service.annotations);
67
64
  }
68
65
  }
69
66
  //# sourceMappingURL=delete.js.map
package/dist/i18n.js CHANGED
@@ -1,23 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.i18n = void 0;
7
- exports.initI18n = initI18n;
8
- exports.t = t;
9
- const i18next_1 = __importDefault(require("i18next"));
10
- const odata_service_writer_i18n_json_1 = __importDefault(require("./translations/odata-service-writer.i18n.json"));
1
+ import i18next from 'i18next';
2
+ import translations from './translations/odata-service-writer.i18n.json' with { type: 'json' };
11
3
  const NS = 'odata-service-writer';
12
- exports.i18n = i18next_1.default.createInstance();
4
+ export const i18n = i18next.createInstance();
13
5
  /**
14
6
  * Initialize i18next with the translations for this module.
15
7
  */
16
- async function initI18n() {
17
- await exports.i18n.init({
8
+ export async function initI18n() {
9
+ await i18n.init({
18
10
  resources: {
19
11
  en: {
20
- [NS]: odata_service_writer_i18n_json_1.default
12
+ [NS]: translations
21
13
  }
22
14
  },
23
15
  lng: 'en',
@@ -34,8 +26,8 @@ async function initI18n() {
34
26
  * @param options additional options
35
27
  * @returns {string} localized string stored for the given key
36
28
  */
37
- function t(key, options) {
38
- return exports.i18n.t(key, options);
29
+ export function t(key, options) {
30
+ return i18n.t(key, options);
39
31
  }
40
32
  initI18n().catch(() => {
41
33
  // Ignore any errors since the write will still work
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { OdataService } from './types';
2
+ import type { OdataService } from './types.js';
3
3
  /**
4
4
  * Writes the odata service related data and files to an existing UI5 project specified by the base path.
5
5
  *
@@ -48,6 +48,6 @@ export declare function update(basePath: string, service: OdataService, fs?: Edi
48
48
  * @returns {Promise<Editor>} the updated memfs editor instance
49
49
  */
50
50
  export declare function remove(basePath: string, service: OdataService, fs?: Editor): Promise<Editor>;
51
- export { OdataVersion, OdataService, ServiceType, EdmxAnnotationsInfo, CdsAnnotationsInfo, ExternalServiceCollectionOptions, NamespaceAlias } from './types';
52
- export { getExternalServiceReferences, getAnnotationNamespaces, writeExternalServiceMetadata } from './data';
51
+ export { OdataVersion, type OdataService, ServiceType, type EdmxAnnotationsInfo, type CdsAnnotationsInfo, type ExternalServiceCollectionOptions, type NamespaceAlias } from './types.js';
52
+ export { getExternalServiceReferences, getAnnotationNamespaces, writeExternalServiceMetadata } from './data/index.js';
53
53
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,19 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeExternalServiceMetadata = exports.getAnnotationNamespaces = exports.getExternalServiceReferences = exports.ServiceType = exports.OdataVersion = void 0;
4
- exports.generate = generate;
5
- exports.update = update;
6
- exports.remove = remove;
7
- const node_path_1 = require("node:path");
8
- const mem_fs_1 = require("mem-fs");
9
- const mem_fs_editor_1 = require("mem-fs-editor");
10
- const update_1 = require("./update");
11
- const data_1 = require("./data");
12
- const i18n_1 = require("./i18n");
13
- const types_1 = require("./types");
14
- const delete_1 = require("./delete");
15
- const project_access_1 = require("@sap-ux/project-access");
16
- const manifest_1 = require("./data/manifest");
1
+ import { dirname, join, sep } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { create as createStorage } from 'mem-fs';
4
+ const __dirname = dirname(fileURLToPath(import.meta.url));
5
+ import { create } from 'mem-fs-editor';
6
+ import { addServicesData, updateServicesData } from './update.js';
7
+ import { enhanceData, removeAnnotationsFromCDSFiles, updateCdsFilesWithAnnotations } from './data/index.js';
8
+ import { t } from './i18n.js';
9
+ import { ServiceType } from './types.js';
10
+ import { deleteServiceData } from './delete.js';
11
+ import { getWebappPath } from '@sap-ux/project-access';
12
+ import { updateManifest } from './data/manifest.js';
17
13
  /**
18
14
  * Ensures the existence of the given files in the provided base path. If a file in the provided list does not exit, an error would be thrown.
19
15
  *
@@ -23,8 +19,8 @@ const manifest_1 = require("./data/manifest");
23
19
  */
24
20
  function ensureExists(basePath, files, fs) {
25
21
  files.forEach((path) => {
26
- if (!fs.exists((0, node_path_1.join)(basePath, path))) {
27
- throw new Error((0, i18n_1.t)('error.requiredProjectFileNotFound', { path }));
22
+ if (!fs.exists(join(basePath, path))) {
23
+ throw new Error(t('error.requiredProjectFileNotFound', { path }));
28
24
  }
29
25
  });
30
26
  }
@@ -37,20 +33,20 @@ function ensureExists(basePath, files, fs) {
37
33
  */
38
34
  async function findProjectFiles(basePath, fs) {
39
35
  const files = {};
40
- const parts = basePath.split(node_path_1.sep);
36
+ const parts = basePath.split(sep);
41
37
  while (parts.length > 0 && (!files.packageJson || !files.ui5Yaml || !files.ui5LocalYaml || !files.ui5MockYaml)) {
42
- const path = parts.join(node_path_1.sep);
43
- if (!files.packageJson && fs.exists((0, node_path_1.join)(path, 'package.json'))) {
44
- files.packageJson = (0, node_path_1.join)(path, 'package.json');
38
+ const path = parts.join(sep);
39
+ if (!files.packageJson && fs.exists(join(path, 'package.json'))) {
40
+ files.packageJson = join(path, 'package.json');
45
41
  }
46
- if (!files.ui5Yaml && fs.exists((0, node_path_1.join)(path, 'ui5.yaml'))) {
47
- files.ui5Yaml = (0, node_path_1.join)(path, 'ui5.yaml');
42
+ if (!files.ui5Yaml && fs.exists(join(path, 'ui5.yaml'))) {
43
+ files.ui5Yaml = join(path, 'ui5.yaml');
48
44
  }
49
- if (!files.ui5LocalYaml && fs.exists((0, node_path_1.join)(path, 'ui5-local.yaml'))) {
50
- files.ui5LocalYaml = (0, node_path_1.join)(path, 'ui5-local.yaml');
45
+ if (!files.ui5LocalYaml && fs.exists(join(path, 'ui5-local.yaml'))) {
46
+ files.ui5LocalYaml = join(path, 'ui5-local.yaml');
51
47
  }
52
- if (!files.ui5MockYaml && fs.exists((0, node_path_1.join)(path, 'ui5-mock.yaml'))) {
53
- files.ui5MockYaml = (0, node_path_1.join)(path, 'ui5-mock.yaml');
48
+ if (!files.ui5MockYaml && fs.exists(join(path, 'ui5-mock.yaml'))) {
49
+ files.ui5MockYaml = join(path, 'ui5-mock.yaml');
54
50
  }
55
51
  parts.pop();
56
52
  }
@@ -65,26 +61,26 @@ async function findProjectFiles(basePath, fs) {
65
61
  * @throws {Error} - if required UI5 project files are not found
66
62
  * @returns {Promise<Editor>} the updated memfs editor instance
67
63
  */
68
- async function generate(basePath, service, fs) {
64
+ export async function generate(basePath, service, fs) {
69
65
  if (!fs) {
70
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
66
+ fs = create(createStorage());
71
67
  }
72
68
  const paths = await findProjectFiles(basePath, fs);
73
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
69
+ const webappPath = await getWebappPath(basePath, fs);
74
70
  ensureExists(webappPath, ['manifest.json'], fs);
75
- await (0, data_1.enhanceData)(basePath, service, fs);
71
+ await enhanceData(basePath, service, fs);
76
72
  // Set isServiceTypeEdmx true if service is EDMX
77
- const isServiceTypeEdmx = service.type === types_1.ServiceType.EDMX;
73
+ const isServiceTypeEdmx = service.type === ServiceType.EDMX;
78
74
  // Prepare template folder for manifest and xml updates
79
- const templateRoot = (0, node_path_1.join)(__dirname, '../templates');
80
- await (0, manifest_1.updateManifest)(basePath, service, fs);
75
+ const templateRoot = join(__dirname, '../templates');
76
+ await updateManifest(basePath, service, fs);
81
77
  // Dont add backend and mockserver middlewares if service type is CDS
82
78
  if (isServiceTypeEdmx) {
83
- await (0, update_1.addServicesData)(basePath, paths, templateRoot, service, fs);
79
+ await addServicesData(basePath, paths, templateRoot, service, fs);
84
80
  }
85
81
  else if (!isServiceTypeEdmx && service.annotations) {
86
82
  // Update cds files with annotations only if service type is CDS and annotations are provided
87
- await (0, data_1.updateCdsFilesWithAnnotations)(service.annotations, fs);
83
+ await updateCdsFilesWithAnnotations(service.annotations, fs);
88
84
  }
89
85
  return fs;
90
86
  }
@@ -98,20 +94,20 @@ async function generate(basePath, service, fs) {
98
94
  * @throws {Error} - if required UI5 project files are not found
99
95
  * @returns {Promise<Editor>} the updated memfs editor instance
100
96
  */
101
- async function update(basePath, service, fs, updateMiddlewares = true) {
97
+ export async function update(basePath, service, fs, updateMiddlewares = true) {
102
98
  if (!fs) {
103
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
99
+ fs = create(createStorage());
104
100
  }
105
101
  const paths = await findProjectFiles(basePath, fs);
106
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
102
+ const webappPath = await getWebappPath(basePath, fs);
107
103
  ensureExists(webappPath, ['manifest.json'], fs);
108
- await (0, data_1.enhanceData)(basePath, service, fs, true);
104
+ await enhanceData(basePath, service, fs, true);
109
105
  // Set isServiceTypeEdmx true if service is EDMX
110
- const isServiceTypeEdmx = service.type === types_1.ServiceType.EDMX;
111
- await (0, manifest_1.updateManifest)(basePath, service, fs, true);
106
+ const isServiceTypeEdmx = service.type === ServiceType.EDMX;
107
+ await updateManifest(basePath, service, fs, true);
112
108
  // Dont extend/update backend and mockserver middlewares if service type is CDS
113
109
  if (isServiceTypeEdmx) {
114
- await (0, update_1.updateServicesData)(basePath, paths, service, fs, updateMiddlewares);
110
+ await updateServicesData(basePath, paths, service, fs, updateMiddlewares);
115
111
  }
116
112
  return fs;
117
113
  }
@@ -141,27 +137,22 @@ async function update(basePath, service, fs, updateMiddlewares = true) {
141
137
  * @throws {Error} - if required UI5 project files are not found
142
138
  * @returns {Promise<Editor>} the updated memfs editor instance
143
139
  */
144
- async function remove(basePath, service, fs) {
140
+ export async function remove(basePath, service, fs) {
145
141
  if (!fs) {
146
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
142
+ fs = create(createStorage());
147
143
  }
148
144
  const paths = await findProjectFiles(basePath, fs);
149
- const isServiceTypeEdmx = service.type === types_1.ServiceType.EDMX;
145
+ const isServiceTypeEdmx = service.type === ServiceType.EDMX;
150
146
  // Remove service related data and files from manifest, middlewares for EDMX services
151
147
  if (isServiceTypeEdmx) {
152
- await (0, delete_1.deleteServiceData)(basePath, paths, service, fs);
148
+ await deleteServiceData(basePath, paths, service, fs);
153
149
  }
154
150
  else {
155
151
  // Remove annotations from CDS files based on annotations info
156
- await (0, data_1.removeAnnotationsFromCDSFiles)(service.annotations, fs);
152
+ await removeAnnotationsFromCDSFiles(service.annotations, fs);
157
153
  }
158
154
  return fs;
159
155
  }
160
- var types_2 = require("./types");
161
- Object.defineProperty(exports, "OdataVersion", { enumerable: true, get: function () { return types_2.OdataVersion; } });
162
- Object.defineProperty(exports, "ServiceType", { enumerable: true, get: function () { return types_2.ServiceType; } });
163
- var data_2 = require("./data");
164
- Object.defineProperty(exports, "getExternalServiceReferences", { enumerable: true, get: function () { return data_2.getExternalServiceReferences; } });
165
- Object.defineProperty(exports, "getAnnotationNamespaces", { enumerable: true, get: function () { return data_2.getAnnotationNamespaces; } });
166
- Object.defineProperty(exports, "writeExternalServiceMetadata", { enumerable: true, get: function () { return data_2.writeExternalServiceMetadata; } });
156
+ export { OdataVersion, ServiceType } from './types.js';
157
+ export { getExternalServiceReferences, getAnnotationNamespaces, writeExternalServiceMetadata } from './data/index.js';
167
158
  //# sourceMappingURL=index.js.map
package/dist/types.js CHANGED
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ServiceType = exports.OdataVersion = void 0;
4
- var OdataVersion;
1
+ export var OdataVersion;
5
2
  (function (OdataVersion) {
6
3
  OdataVersion["v2"] = "2";
7
4
  OdataVersion["v4"] = "4";
8
- })(OdataVersion || (exports.OdataVersion = OdataVersion = {}));
9
- var ServiceType;
5
+ })(OdataVersion || (OdataVersion = {}));
6
+ export var ServiceType;
10
7
  (function (ServiceType) {
11
8
  ServiceType["EDMX"] = "edmx";
12
9
  ServiceType["CDS"] = "cds";
13
- })(ServiceType || (exports.ServiceType = ServiceType = {}));
10
+ })(ServiceType || (ServiceType = {}));
14
11
  //# sourceMappingURL=types.js.map
package/dist/update.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { EdmxOdataService, ProjectPaths } from './types';
2
+ import type { EdmxOdataService, ProjectPaths } from './types.js';
3
3
  /**
4
4
  * Adds services data to ui5-*.yaml files.
5
5
  * Mockserver configuration for services and annotations are written using dataSources from manifest.json.
package/dist/update.js CHANGED
@@ -1,14 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addServicesData = addServicesData;
4
- exports.updateServicesData = updateServicesData;
5
- const node_path_1 = require("node:path");
6
- const project_access_1 = require("@sap-ux/project-access");
7
- const ui5_config_1 = require("@sap-ux/ui5-config");
8
- const mockserver_config_writer_1 = require("@sap-ux/mockserver-config-writer");
9
- const annotations_1 = require("./data/annotations");
10
- const package_1 = require("./data/package");
11
- const data_1 = require("./data");
1
+ import { dirname, join } from 'node:path';
2
+ import { FileName, getWebappPath } from '@sap-ux/project-access';
3
+ import { UI5Config, YAMLError, yamlErrorCode } from '@sap-ux/ui5-config';
4
+ import { generateMockserverConfig } from '@sap-ux/mockserver-config-writer';
5
+ import { writeLocalServiceAnnotationXMLFiles, writeMetadata, writeRemoteServiceAnnotationXmlFiles } from './data/annotations.js';
6
+ import { updatePackageJson } from './data/package.js';
7
+ import { writeExternalServiceMetadata } from './data/index.js';
12
8
  /**
13
9
  * Generates mockserver middleware config for ui5-local.yaml file based on ui5-mock.yaml.
14
10
  *
@@ -20,8 +16,8 @@ const data_1 = require("./data");
20
16
  */
21
17
  async function generateMockserverMiddlewareBasedOnUi5MockYaml(fs, ui5YamlPath, ui5LocalConfigPath, ui5LocalConfig) {
22
18
  // Update ui5-local.yaml with mockserver middleware from ui5-mock.yaml
23
- const ui5MockYamlPath = (0, node_path_1.join)((0, node_path_1.dirname)(ui5YamlPath), project_access_1.FileName.Ui5MockYaml);
24
- const ui5MockYamlConfig = await ui5_config_1.UI5Config.newInstance(fs.read(ui5MockYamlPath));
19
+ const ui5MockYamlPath = join(dirname(ui5YamlPath), FileName.Ui5MockYaml);
20
+ const ui5MockYamlConfig = await UI5Config.newInstance(fs.read(ui5MockYamlPath));
25
21
  const mockserverMiddlewareFromUi5Mock = ui5MockYamlConfig.findCustomMiddleware('sap-fe-mockserver');
26
22
  if (ui5LocalConfigPath && fs.exists(ui5LocalConfigPath) && ui5LocalConfig && mockserverMiddlewareFromUi5Mock) {
27
23
  ui5LocalConfig.updateCustomMiddleware(mockserverMiddlewareFromUi5Mock);
@@ -47,7 +43,7 @@ function extendBackendMiddleware(fs, service, ui5Config, ui5ConfigPath, update =
47
43
  ui5Config.addBackendToFioriToolsProxyMiddleware(service.previewSettings, service.ignoreCertError);
48
44
  }
49
45
  catch (error) {
50
- if ((error instanceof ui5_config_1.YAMLError && error.code === ui5_config_1.yamlErrorCode.nodeNotFound) ||
46
+ if ((error instanceof YAMLError && error.code === yamlErrorCode.nodeNotFound) ||
51
47
  error.message === 'Could not find fiori-tools-proxy') {
52
48
  // Middleware is missing, add it along with the service backend
53
49
  ui5Config.addFioriToolsProxyMiddleware({
@@ -74,10 +70,10 @@ async function updateUI5YamlConfigs(fs, service, paths) {
74
70
  let ui5Config;
75
71
  let ui5LocalConfig;
76
72
  if (paths.ui5Yaml) {
77
- ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5Yaml));
73
+ ui5Config = await UI5Config.newInstance(fs.read(paths.ui5Yaml));
78
74
  extendBackendMiddleware(fs, service, ui5Config, paths.ui5Yaml);
79
75
  if (paths.ui5LocalYaml) {
80
- ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
76
+ ui5LocalConfig = await UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
81
77
  extendBackendMiddleware(fs, service, ui5LocalConfig, paths.ui5LocalYaml);
82
78
  }
83
79
  }
@@ -103,10 +99,10 @@ async function generateAndUpdateMockserverConfig(basePath, paths, service, webap
103
99
  [service.name]: true
104
100
  };
105
101
  }
106
- await (0, mockserver_config_writer_1.generateMockserverConfig)(basePath, config, fs);
102
+ await generateMockserverConfig(basePath, config, fs);
107
103
  await generateMockserverMiddlewareBasedOnUi5MockYaml(fs, paths.ui5Yaml, paths.ui5LocalYaml, ui5LocalConfig);
108
104
  if (paths.ui5MockYaml) {
109
- const ui5MockConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5MockYaml));
105
+ const ui5MockConfig = await UI5Config.newInstance(fs.read(paths.ui5MockYaml));
110
106
  extendBackendMiddleware(fs, service, ui5MockConfig, paths.ui5MockYaml);
111
107
  }
112
108
  }
@@ -121,24 +117,24 @@ async function generateAndUpdateMockserverConfig(basePath, paths, service, webap
121
117
  * @param {EdmxOdataService} service - the OData service instance
122
118
  * @param {Editor} fs - the memfs editor instance
123
119
  */
124
- async function addServicesData(basePath, paths, templateRoot, service, fs) {
120
+ export async function addServicesData(basePath, paths, templateRoot, service, fs) {
125
121
  const { ui5Config, ui5LocalConfig } = await updateUI5YamlConfigs(fs, service, paths);
126
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
122
+ const webappPath = await getWebappPath(basePath, fs);
127
123
  if (service.metadata) {
128
124
  if (paths.ui5Yaml && ui5Config) {
129
125
  await generateAndUpdateMockserverConfig(basePath, paths, service, webappPath, ui5LocalConfig, fs);
130
126
  }
131
- await (0, annotations_1.writeLocalServiceAnnotationXMLFiles)(fs, webappPath, templateRoot, service);
127
+ await writeLocalServiceAnnotationXMLFiles(fs, webappPath, templateRoot, service);
132
128
  }
133
129
  if (paths.packageJson && paths.ui5Yaml) {
134
- (0, package_1.updatePackageJson)(paths.packageJson, fs, !!service.metadata);
130
+ updatePackageJson(paths.packageJson, fs, !!service.metadata);
135
131
  }
136
132
  if (paths.ui5LocalYaml && ui5LocalConfig) {
137
133
  fs.write(paths.ui5LocalYaml, ui5LocalConfig.toString());
138
134
  }
139
- await (0, annotations_1.writeRemoteServiceAnnotationXmlFiles)(fs, basePath, service.name ?? 'mainService', service.annotations);
135
+ await writeRemoteServiceAnnotationXmlFiles(fs, basePath, service.name ?? 'mainService', service.annotations);
140
136
  if (service.externalServices && webappPath) {
141
- (0, data_1.writeExternalServiceMetadata)(fs, webappPath, service.externalServices, service.name, service.path);
137
+ writeExternalServiceMetadata(fs, webappPath, service.externalServices, service.name, service.path);
142
138
  }
143
139
  }
144
140
  /**
@@ -151,18 +147,18 @@ async function addServicesData(basePath, paths, templateRoot, service, fs) {
151
147
  * @param {Editor} fs - the memfs editor instance
152
148
  * @param {boolean} updateMiddlewares - whether the YAML files for the service (mock-server and fiori-tools-proxy middlewares) should be updated
153
149
  */
154
- async function updateServicesData(basePath, paths, service, fs, updateMiddlewares) {
150
+ export async function updateServicesData(basePath, paths, service, fs, updateMiddlewares) {
155
151
  let ui5Config;
156
152
  let ui5LocalConfig;
157
153
  if (updateMiddlewares) {
158
154
  if (paths.ui5Yaml) {
159
- ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5Yaml));
155
+ ui5Config = await UI5Config.newInstance(fs.read(paths.ui5Yaml));
160
156
  // Update ui5.yaml with backend middleware
161
157
  extendBackendMiddleware(fs, service, ui5Config, paths.ui5Yaml, true);
162
158
  }
163
159
  // Update ui5-local.yaml with backend middleware
164
160
  if (paths.ui5LocalYaml) {
165
- ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
161
+ ui5LocalConfig = await UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
166
162
  extendBackendMiddleware(fs, service, ui5LocalConfig, paths.ui5LocalYaml, true);
167
163
  }
168
164
  }
@@ -173,9 +169,9 @@ async function updateServicesData(basePath, paths, service, fs, updateMiddleware
173
169
  fs.write(paths.ui5LocalYaml, ui5LocalConfig.toString());
174
170
  }
175
171
  // Write new annotations files
176
- await (0, annotations_1.writeRemoteServiceAnnotationXmlFiles)(fs, basePath, service.name ?? 'mainService', service.annotations);
172
+ await writeRemoteServiceAnnotationXmlFiles(fs, basePath, service.name ?? 'mainService', service.annotations);
177
173
  if (service.externalServices && webappPath) {
178
- (0, data_1.writeExternalServiceMetadata)(fs, webappPath, service.externalServices, service.name, service.path);
174
+ writeExternalServiceMetadata(fs, webappPath, service.externalServices, service.name, service.path);
179
175
  }
180
176
  }
181
177
  /**
@@ -194,7 +190,7 @@ async function updateMetadata(basePath, paths, service, ui5Config, ui5LocalConfi
194
190
  if (!service.metadata) {
195
191
  return undefined;
196
192
  }
197
- const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
193
+ const webappPath = await getWebappPath(basePath, fs);
198
194
  // Generate mockserver only when ui5-mock.yaml already exists
199
195
  if (paths.ui5MockYaml && paths.ui5Yaml && ui5Config && updateMiddlewares) {
200
196
  const config = {
@@ -214,17 +210,17 @@ async function updateMetadata(basePath, paths, service, ui5Config, ui5LocalConfi
214
210
  };
215
211
  }
216
212
  // Regenerate mockserver middleware for ui5-mock.yaml by overwriting
217
- await (0, mockserver_config_writer_1.generateMockserverConfig)(basePath, config, fs);
213
+ await generateMockserverConfig(basePath, config, fs);
218
214
  // Update ui5-local.yaml with mockserver middleware from updated ui5-mock.yaml
219
215
  await generateMockserverMiddlewareBasedOnUi5MockYaml(fs, paths.ui5Yaml, paths.ui5LocalYaml, ui5LocalConfig);
220
216
  // Update ui5-mock.yaml with backend middleware
221
217
  if (paths.ui5MockYaml) {
222
- const ui5MockConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5MockYaml));
218
+ const ui5MockConfig = await UI5Config.newInstance(fs.read(paths.ui5MockYaml));
223
219
  extendBackendMiddleware(fs, service, ui5MockConfig, paths.ui5MockYaml, true);
224
220
  }
225
221
  }
226
222
  // Write metadata.xml file
227
- await (0, annotations_1.writeMetadata)(fs, webappPath, service);
223
+ await writeMetadata(fs, webappPath, service);
228
224
  return webappPath;
229
225
  }
230
226
  //# sourceMappingURL=update.js.map
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/odata-service-writer",
3
3
  "description": "Writer module allowing to add an OData service to a UI5 project.",
4
+ "type": "module",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -9,7 +10,7 @@
9
10
  "bugs": {
10
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-service-writer"
11
12
  },
12
- "version": "0.32.2",
13
+ "version": "1.0.0",
13
14
  "license": "Apache-2.0",
14
15
  "main": "dist/index.js",
15
16
  "files": [
@@ -29,9 +30,9 @@
29
30
  "mem-fs-editor": "9.4.0",
30
31
  "prettify-xml": "1.2.0",
31
32
  "semver": "7.7.4",
32
- "@sap-ux/mockserver-config-writer": "0.10.2",
33
- "@sap-ux/project-access": "1.38.1",
34
- "@sap-ux/ui5-config": "0.31.1"
33
+ "@sap-ux/mockserver-config-writer": "1.0.0",
34
+ "@sap-ux/project-access": "2.0.0",
35
+ "@sap-ux/ui5-config": "1.0.0"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@sap-ux/vocabularies-types": "0.15.0",
@@ -42,7 +43,7 @@
42
43
  "@types/semver": "7.7.1",
43
44
  "fs-extra": "11.3.4",
44
45
  "lodash": "4.18.1",
45
- "@sap-ux/axios-extension": "1.26.0"
46
+ "@sap-ux/axios-extension": "2.0.0"
46
47
  },
47
48
  "engines": {
48
49
  "node": ">=22.x"
@@ -54,8 +55,8 @@
54
55
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
55
56
  "lint": "eslint",
56
57
  "lint:fix": "eslint --fix",
57
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
58
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
58
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
59
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
59
60
  "link": "pnpm link --global",
60
61
  "unlink": "pnpm unlink --global"
61
62
  }