@sap-ux/adp-tooling 0.12.39 → 0.12.41
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/base/change-utils.d.ts +2 -2
- package/dist/base/change-utils.js +6 -7
- package/dist/prompts/add-component-usages/index.js +1 -1
- package/dist/prompts/add-new-model/index.js +1 -1
- package/dist/types.d.ts +101 -20
- package/dist/writer/changes/writers/annotations-writer.js +11 -11
- package/dist/writer/changes/writers/component-usages-writer.d.ts +2 -2
- package/dist/writer/changes/writers/component-usages-writer.js +15 -17
- package/dist/writer/changes/writers/data-source-writer.js +2 -2
- package/dist/writer/changes/writers/inbound-writer.js +1 -1
- package/dist/writer/changes/writers/new-model-writer.d.ts +1 -1
- package/dist/writer/changes/writers/new-model-writer.js +18 -16
- package/package.json +4 -4
|
@@ -13,12 +13,12 @@ interface InboundChange extends ManifestChangeProperties {
|
|
|
13
13
|
*
|
|
14
14
|
* @param {string} projectPath - The root path of the project.
|
|
15
15
|
* @param {number} timestamp - The timestamp of the change.
|
|
16
|
-
* @param {AnnotationsData}
|
|
16
|
+
* @param {AnnotationsData} annotation - The annotation data.
|
|
17
17
|
* @param {ManifestChangeProperties} change - The annotation data change that will be written.
|
|
18
18
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
19
19
|
* @returns {void}
|
|
20
20
|
*/
|
|
21
|
-
export declare function writeAnnotationChange(projectPath: string, timestamp: number,
|
|
21
|
+
export declare function writeAnnotationChange(projectPath: string, timestamp: number, annotation: AnnotationsData['annotation'], change: ManifestChangeProperties, fs: Editor): void;
|
|
22
22
|
/**
|
|
23
23
|
* Writes a given change object to a file within a specified folder in the project's 'changes' directory.
|
|
24
24
|
* If an additional subdirectory is specified, the change file is written there.
|
|
@@ -12,27 +12,26 @@ const project_access_1 = require("@sap-ux/project-access");
|
|
|
12
12
|
*
|
|
13
13
|
* @param {string} projectPath - The root path of the project.
|
|
14
14
|
* @param {number} timestamp - The timestamp of the change.
|
|
15
|
-
* @param {AnnotationsData}
|
|
15
|
+
* @param {AnnotationsData} annotation - The annotation data.
|
|
16
16
|
* @param {ManifestChangeProperties} change - The annotation data change that will be written.
|
|
17
17
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
18
18
|
* @returns {void}
|
|
19
19
|
*/
|
|
20
|
-
function writeAnnotationChange(projectPath, timestamp,
|
|
20
|
+
function writeAnnotationChange(projectPath, timestamp, annotation, change, fs) {
|
|
21
21
|
try {
|
|
22
|
-
const { fileName, answers } = data;
|
|
23
22
|
const changeFileName = `id_${timestamp}_addAnnotationsToOData.change`;
|
|
24
23
|
const changesFolderPath = path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
|
|
25
24
|
const changeFilePath = path_1.default.join(changesFolderPath, project_access_1.DirName.Manifest, changeFileName);
|
|
26
25
|
const annotationsFolderPath = path_1.default.join(changesFolderPath, project_access_1.DirName.Annotations);
|
|
27
26
|
writeChangeToFile(changeFilePath, change, fs);
|
|
28
|
-
if (!
|
|
27
|
+
if (!annotation.filePath) {
|
|
29
28
|
const annotationsTemplate = path_1.default.join(__dirname, '..', '..', 'templates', 'changes', "annotation.xml" /* TemplateFileName.Annotation */);
|
|
30
|
-
fs.copy(annotationsTemplate, path_1.default.join(annotationsFolderPath, fileName ?? ''));
|
|
29
|
+
fs.copy(annotationsTemplate, path_1.default.join(annotationsFolderPath, annotation.fileName ?? ''));
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
33
|
-
const selectedDir = path_1.default.dirname(
|
|
32
|
+
const selectedDir = path_1.default.dirname(annotation.filePath);
|
|
34
33
|
if (selectedDir !== annotationsFolderPath) {
|
|
35
|
-
fs.copy(
|
|
34
|
+
fs.copy(annotation.filePath, path_1.default.join(annotationsFolderPath, annotation.fileName ?? ''));
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
}
|
|
@@ -100,7 +100,7 @@ function getPrompts(basePath, layer) {
|
|
|
100
100
|
return [
|
|
101
101
|
{
|
|
102
102
|
type: 'input',
|
|
103
|
-
name: `
|
|
103
|
+
name: `usageId`,
|
|
104
104
|
message: (0, i18n_1.t)('prompts.component.usageIdLabel'),
|
|
105
105
|
validate: (value) => validatePromptId(value, componentUsageChangeFiles, isCustomerBase),
|
|
106
106
|
default: isCustomerBase ? "customer." /* NamespacePrefix.CUSTOMER */ : "" /* NamespacePrefix.EMPTY */,
|
|
@@ -83,7 +83,7 @@ function validatePromptODataName(value, answers, isCustomerBase, changeFiles) {
|
|
|
83
83
|
if ((0, project_input_validator_1.hasContentDuplication)(value, 'dataSource', changeFiles)) {
|
|
84
84
|
return (0, i18n_1.t)('validators.errorDuplicatedValueOData');
|
|
85
85
|
}
|
|
86
|
-
if (value === answers.dataSourceName) {
|
|
86
|
+
if (answers.addAnnotationMode && value === answers.dataSourceName) {
|
|
87
87
|
return (0, i18n_1.t)('validators.errorDuplicateNamesOData');
|
|
88
88
|
}
|
|
89
89
|
return true;
|
package/dist/types.d.ts
CHANGED
|
@@ -252,42 +252,96 @@ export declare const enum ChangeType {
|
|
|
252
252
|
*/
|
|
253
253
|
export type GeneratorData<T extends ChangeType> = T extends ChangeType.ADD_ANNOTATIONS_TO_ODATA ? AnnotationsData : T extends ChangeType.ADD_COMPONENT_USAGES ? ComponentUsagesData : T extends ChangeType.ADD_LIBRARY_REFERENCE ? ComponentUsagesData : T extends ChangeType.ADD_NEW_MODEL ? NewModelData : T extends ChangeType.CHANGE_DATA_SOURCE ? DataSourceData : T extends ChangeType.CHANGE_INBOUND ? InboundData : never;
|
|
254
254
|
export interface AnnotationsData {
|
|
255
|
-
fileName?: string;
|
|
256
255
|
variant: DescriptorVariant;
|
|
257
|
-
|
|
256
|
+
annotation: {
|
|
257
|
+
/** Optional name of the annotation file. */
|
|
258
|
+
fileName?: string;
|
|
259
|
+
/** Data source associated with the annotation. */
|
|
260
|
+
dataSource: string;
|
|
261
|
+
/** Optional path to the annotation file. */
|
|
262
|
+
filePath?: string;
|
|
263
|
+
};
|
|
258
264
|
}
|
|
259
265
|
export declare const enum AnnotationFileSelectType {
|
|
260
266
|
ExistingFile = 1,
|
|
261
267
|
NewEmptyFile = 2
|
|
262
268
|
}
|
|
263
|
-
export interface
|
|
269
|
+
export interface ComponentUsagesDataBase {
|
|
264
270
|
variant: DescriptorVariant;
|
|
265
|
-
|
|
271
|
+
component: {
|
|
272
|
+
/** Indicates whether the component is loaded lazily. */
|
|
273
|
+
isLazy: string;
|
|
274
|
+
/** Unique ID for the component usage. */
|
|
275
|
+
usageId: string;
|
|
276
|
+
/** Name of the component. */
|
|
277
|
+
name: string;
|
|
278
|
+
/** Serialized data specific to the component. */
|
|
279
|
+
data: string;
|
|
280
|
+
/** Settings related to the component. */
|
|
281
|
+
settings: string;
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export interface ComponentUsagesDataWithLibrary extends ComponentUsagesDataBase {
|
|
285
|
+
library: {
|
|
286
|
+
/** Reference to the component's library. */
|
|
287
|
+
reference: string;
|
|
288
|
+
/** Optional flag indicating if the library reference is lazy. */
|
|
289
|
+
referenceIsLazy: string;
|
|
290
|
+
};
|
|
266
291
|
}
|
|
267
|
-
export
|
|
292
|
+
export type ComponentUsagesData = ComponentUsagesDataBase | ComponentUsagesDataWithLibrary;
|
|
293
|
+
export type AddComponentUsageAnswersWithoutLibrary = {
|
|
294
|
+
/** Indicates whether a library reference should be added */
|
|
295
|
+
shouldAddLibrary: false;
|
|
296
|
+
};
|
|
297
|
+
export type addComponentUsageAnswersWithLibrary = {
|
|
298
|
+
/** Indicates whether a library reference should be added */
|
|
299
|
+
shouldAddLibrary: true;
|
|
300
|
+
/** Reference to the component's library. */
|
|
301
|
+
library: string;
|
|
302
|
+
/** Indicates whether the library reference is loaded lazily. */
|
|
303
|
+
libraryIsLazy: string;
|
|
304
|
+
};
|
|
305
|
+
export type AddComponentUsageAnswersBase = {
|
|
268
306
|
/** Indicates whether the component is loaded lazily. */
|
|
269
307
|
isLazy: string;
|
|
270
308
|
/** Unique ID for the component usage. */
|
|
271
|
-
|
|
309
|
+
usageId: string;
|
|
272
310
|
/** Name of the component. */
|
|
273
311
|
name: string;
|
|
274
312
|
/** Serialized data specific to the component. */
|
|
275
313
|
data: string;
|
|
276
314
|
/** Settings related to the component. */
|
|
277
315
|
settings: string;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
library?: string;
|
|
282
|
-
/** Indicates whether the library reference is loaded lazily. */
|
|
283
|
-
libraryIsLazy?: string;
|
|
284
|
-
}
|
|
285
|
-
export interface NewModelData {
|
|
316
|
+
};
|
|
317
|
+
export type AddComponentUsageAnswers = AddComponentUsageAnswersBase & (AddComponentUsageAnswersWithoutLibrary | addComponentUsageAnswersWithLibrary);
|
|
318
|
+
export interface NewModelDataBase {
|
|
286
319
|
variant: DescriptorVariant;
|
|
287
|
-
|
|
320
|
+
service: {
|
|
321
|
+
/** Name of the OData service. */
|
|
322
|
+
name: string;
|
|
323
|
+
/** URI of the OData service. */
|
|
324
|
+
uri: string;
|
|
325
|
+
/** Name of the OData service model. */
|
|
326
|
+
modelName: string;
|
|
327
|
+
/** Version of OData used. */
|
|
328
|
+
version: string;
|
|
329
|
+
/** Settings for the OData service model. */
|
|
330
|
+
modelSettings?: string;
|
|
331
|
+
};
|
|
288
332
|
}
|
|
289
|
-
export interface
|
|
290
|
-
|
|
333
|
+
export interface NewModelDataWithAnnotations extends NewModelDataBase {
|
|
334
|
+
annotation: {
|
|
335
|
+
/** Name of the OData annotation data source. */
|
|
336
|
+
dataSourceName: string;
|
|
337
|
+
/** Optional URI of the OData annotation data source. */
|
|
338
|
+
dataSourceURI?: string;
|
|
339
|
+
/** Optional settings for the OData annotation. */
|
|
340
|
+
settings?: string;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
export type NewModelData = NewModelDataBase | NewModelDataWithAnnotations;
|
|
344
|
+
export interface NewModelAnswersBase {
|
|
291
345
|
/** Name of the OData service. */
|
|
292
346
|
name: string;
|
|
293
347
|
/** URI of the OData service. */
|
|
@@ -298,6 +352,9 @@ export interface NewModelAnswers {
|
|
|
298
352
|
version: string;
|
|
299
353
|
/** Settings for the OData service model. */
|
|
300
354
|
modelSettings: string;
|
|
355
|
+
}
|
|
356
|
+
export interface NewModelAnswersWithAnnotations extends NewModelAnswersBase {
|
|
357
|
+
addAnnotationMode: true;
|
|
301
358
|
/** Name of the OData annotation data source. */
|
|
302
359
|
dataSourceName: string;
|
|
303
360
|
/** Optional URI of the OData annotation data source. */
|
|
@@ -305,12 +362,28 @@ export interface NewModelAnswers {
|
|
|
305
362
|
/** Optional settings for the OData annotation. */
|
|
306
363
|
annotationSettings?: string;
|
|
307
364
|
}
|
|
365
|
+
export interface NewModelAnswersWithoutAnnotations extends NewModelAnswersBase {
|
|
366
|
+
addAnnotationMode: false;
|
|
367
|
+
}
|
|
368
|
+
export type NewModelAnswers = NewModelAnswersBase & (NewModelAnswersWithAnnotations | NewModelAnswersWithoutAnnotations);
|
|
308
369
|
export interface DataSourceData {
|
|
309
370
|
variant: DescriptorVariant;
|
|
310
371
|
dataSources: Record<string, ManifestNamespace.DataSource>;
|
|
311
|
-
|
|
372
|
+
service: {
|
|
373
|
+
/** Data source identifier. */
|
|
374
|
+
id: string;
|
|
375
|
+
/** URI of the data source. */
|
|
376
|
+
uri: string;
|
|
377
|
+
/** Optional maximum age for the data source cache. */
|
|
378
|
+
maxAge?: number;
|
|
379
|
+
/** URI for the OData annotation source. */
|
|
380
|
+
annotationUri?: string;
|
|
381
|
+
};
|
|
312
382
|
}
|
|
313
|
-
export
|
|
383
|
+
export type RequireAtLeastOne<T> = {
|
|
384
|
+
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
|
|
385
|
+
}[keyof T];
|
|
386
|
+
export interface InboundChangeAnswersBase {
|
|
314
387
|
/** Title associated with the inbound navigation data. */
|
|
315
388
|
title: string;
|
|
316
389
|
/** Subtitle associated with the inbound navigation data. */
|
|
@@ -318,11 +391,19 @@ export interface InboundChangeAnswers {
|
|
|
318
391
|
/** Icon associated with the inbound navigation data. */
|
|
319
392
|
icon: string;
|
|
320
393
|
}
|
|
394
|
+
export type InboundChangeAnswers = RequireAtLeastOne<InboundChangeAnswersBase>;
|
|
321
395
|
export interface InboundData {
|
|
322
396
|
/** Identifier for the inbound navigation data. */
|
|
323
397
|
inboundId: string;
|
|
324
398
|
variant: DescriptorVariant;
|
|
325
|
-
|
|
399
|
+
flp: RequireAtLeastOne<{
|
|
400
|
+
/** Title associated with the inbound navigation data. */
|
|
401
|
+
title: string;
|
|
402
|
+
/** Subtitle associated with the inbound navigation data. */
|
|
403
|
+
subtitle: string;
|
|
404
|
+
/** Icon associated with the inbound navigation data. */
|
|
405
|
+
icon: string;
|
|
406
|
+
}>;
|
|
326
407
|
}
|
|
327
408
|
export interface InboundContent {
|
|
328
409
|
inboundId: string;
|
|
@@ -47,13 +47,13 @@ class AnnotationsWriter {
|
|
|
47
47
|
* @returns {object} The constructed content object for the annotation change.
|
|
48
48
|
*/
|
|
49
49
|
constructContent(data) {
|
|
50
|
-
const { variant: { layer },
|
|
50
|
+
const { variant: { layer }, annotation: { dataSource, fileName } } = data;
|
|
51
51
|
const annotationFileNameWithoutExtension = fileName?.toLocaleLowerCase().replace('.xml', '');
|
|
52
52
|
const annotationNameSpace = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */
|
|
53
53
|
? `customer.annotation.${annotationFileNameWithoutExtension}`
|
|
54
54
|
: `annotation.${annotationFileNameWithoutExtension}`;
|
|
55
55
|
return {
|
|
56
|
-
dataSourceId: `${
|
|
56
|
+
dataSourceId: `${dataSource}`,
|
|
57
57
|
annotations: [annotationNameSpace],
|
|
58
58
|
annotationsInsertPosition: 'END',
|
|
59
59
|
dataSource: {
|
|
@@ -70,8 +70,8 @@ class AnnotationsWriter {
|
|
|
70
70
|
* @param {AnnotationsData} data - The answers object containing user choices.
|
|
71
71
|
* @returns {string | undefined} The determined filename for the annotation file.
|
|
72
72
|
*/
|
|
73
|
-
getAnnotationFileName({
|
|
74
|
-
return
|
|
73
|
+
getAnnotationFileName({ annotation }) {
|
|
74
|
+
return annotation.filePath ? path_1.default.basename(annotation.filePath) : `annotation_${Date.now()}.xml`;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Writes the annotation change to the project based on the provided data.
|
|
@@ -80,17 +80,17 @@ class AnnotationsWriter {
|
|
|
80
80
|
* @returns {Promise<void>} A promise that resolves when the change writing process is completed.
|
|
81
81
|
*/
|
|
82
82
|
async write(data) {
|
|
83
|
-
const { variant } = data;
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
?
|
|
88
|
-
: path_1.default.join(this.projectPath,
|
|
83
|
+
const { variant, annotation } = data;
|
|
84
|
+
annotation.fileName = annotation.fileName ?? this.getAnnotationFileName(data);
|
|
85
|
+
if (annotation.filePath) {
|
|
86
|
+
annotation.filePath = (0, path_1.isAbsolute)(annotation.filePath)
|
|
87
|
+
? annotation.filePath
|
|
88
|
+
: path_1.default.join(this.projectPath, annotation.filePath);
|
|
89
89
|
}
|
|
90
90
|
const content = this.constructContent(data);
|
|
91
91
|
const timestamp = Date.now();
|
|
92
92
|
const change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */);
|
|
93
|
-
(0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data, change, this.fs);
|
|
93
|
+
(0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data.annotation, change, this.fs);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
exports.AnnotationsWriter = AnnotationsWriter;
|
|
@@ -21,8 +21,8 @@ export declare class ComponentUsagesWriter implements IWriter<ComponentUsagesDat
|
|
|
21
21
|
/**
|
|
22
22
|
* Constructs the content for an library reference change based on provided data.
|
|
23
23
|
*
|
|
24
|
-
* @param {ComponentUsagesData}
|
|
25
|
-
* @returns {object
|
|
24
|
+
* @param {ComponentUsagesData} library - The answers object containing information needed to construct the content property.
|
|
25
|
+
* @returns {object} The constructed content object for the library reference change.
|
|
26
26
|
*/
|
|
27
27
|
private constructLibContent;
|
|
28
28
|
/**
|
|
@@ -23,10 +23,10 @@ class ComponentUsagesWriter {
|
|
|
23
23
|
* @param {ComponentUsagesData} data - The answers object containing information needed to construct the content property.
|
|
24
24
|
* @returns {object} The constructed content object for the component usages change.
|
|
25
25
|
*/
|
|
26
|
-
constructContent({
|
|
27
|
-
const { data,
|
|
26
|
+
constructContent({ component }) {
|
|
27
|
+
const { data, usageId, settings, isLazy, name } = component;
|
|
28
28
|
const componentUsages = {
|
|
29
|
-
[
|
|
29
|
+
[usageId]: {
|
|
30
30
|
name,
|
|
31
31
|
lazy: isLazy === 'true',
|
|
32
32
|
settings: (0, change_utils_1.parseStringToObject)(settings),
|
|
@@ -40,17 +40,15 @@ class ComponentUsagesWriter {
|
|
|
40
40
|
/**
|
|
41
41
|
* Constructs the content for an library reference change based on provided data.
|
|
42
42
|
*
|
|
43
|
-
* @param {ComponentUsagesData}
|
|
44
|
-
* @returns {object
|
|
43
|
+
* @param {ComponentUsagesData} library - The answers object containing information needed to construct the content property.
|
|
44
|
+
* @returns {object} The constructed content object for the library reference change.
|
|
45
45
|
*/
|
|
46
|
-
constructLibContent({
|
|
47
|
-
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
46
|
+
constructLibContent({ library }) {
|
|
47
|
+
const { reference, referenceIsLazy } = library;
|
|
50
48
|
return {
|
|
51
49
|
libraries: {
|
|
52
|
-
[
|
|
53
|
-
lazy:
|
|
50
|
+
[reference]: {
|
|
51
|
+
lazy: referenceIsLazy === 'true'
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
};
|
|
@@ -63,16 +61,16 @@ class ComponentUsagesWriter {
|
|
|
63
61
|
*/
|
|
64
62
|
async write(data) {
|
|
65
63
|
const componentUsagesContent = this.constructContent(data);
|
|
66
|
-
const libRefContent = this.constructLibContent(data);
|
|
67
64
|
const timestamp = Date.now();
|
|
68
|
-
const shouldAddLibRef = libRefContent !== undefined;
|
|
69
65
|
const compUsagesChange = (0, change_utils_1.getChange)(data.variant, timestamp, componentUsagesContent, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */);
|
|
70
66
|
(0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, `id_${timestamp}_addComponentUsages.change`, this.fs, project_access_1.DirName.Manifest);
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
const refLibChange = (0, change_utils_1.getChange)(data.variant, libTimestamp, libRefContent, "appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */);
|
|
74
|
-
(0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, `id_${libTimestamp}_addLibraries.change`, this.fs, project_access_1.DirName.Manifest);
|
|
67
|
+
if (!('library' in data)) {
|
|
68
|
+
return;
|
|
75
69
|
}
|
|
70
|
+
const libRefContent = this.constructLibContent(data);
|
|
71
|
+
const libTimestamp = timestamp + 1;
|
|
72
|
+
const refLibChange = (0, change_utils_1.getChange)(data.variant, libTimestamp, libRefContent, "appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */);
|
|
73
|
+
(0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, `id_${libTimestamp}_addLibraries.change`, this.fs, project_access_1.DirName.Manifest);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
exports.ComponentUsagesWriter = ComponentUsagesWriter;
|
|
@@ -52,8 +52,8 @@ class DataSourceWriter {
|
|
|
52
52
|
* @returns {Promise<void>} A promise that resolves when the change writing process is completed.
|
|
53
53
|
*/
|
|
54
54
|
async write(data) {
|
|
55
|
-
const { variant, dataSources,
|
|
56
|
-
const { id, uri, maxAge, annotationUri } =
|
|
55
|
+
const { variant, dataSources, service } = data;
|
|
56
|
+
const { id, uri, maxAge, annotationUri } = service;
|
|
57
57
|
const annotationId = dataSources[id].settings?.annotations?.[0];
|
|
58
58
|
const timestamp = Date.now();
|
|
59
59
|
const content = this.constructContent(id, uri, maxAge);
|
|
@@ -39,7 +39,7 @@ class InboundWriter {
|
|
|
39
39
|
* @returns {void}
|
|
40
40
|
*/
|
|
41
41
|
getEnhancedContent(data, content) {
|
|
42
|
-
const { icon, title, subtitle } = data.
|
|
42
|
+
const { icon, title, subtitle } = data.flp;
|
|
43
43
|
if (title) {
|
|
44
44
|
content.entityPropertyChange.push({
|
|
45
45
|
propertyPath: 'title',
|
|
@@ -14,7 +14,7 @@ export declare class NewModelWriter implements IWriter<NewModelData> {
|
|
|
14
14
|
/**
|
|
15
15
|
* Constructs the content for an new model change based on provided data.
|
|
16
16
|
*
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {NewModelData} data - The answers object containing information needed to construct the content property.
|
|
18
18
|
* @returns {object} The constructed content object for the new model change.
|
|
19
19
|
*/
|
|
20
20
|
private constructContent;
|
|
@@ -20,37 +20,39 @@ class NewModelWriter {
|
|
|
20
20
|
/**
|
|
21
21
|
* Constructs the content for an new model change based on provided data.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {NewModelData} data - The answers object containing information needed to construct the content property.
|
|
24
24
|
* @returns {object} The constructed content object for the new model change.
|
|
25
25
|
*/
|
|
26
|
-
constructContent(
|
|
26
|
+
constructContent(data) {
|
|
27
|
+
const { service } = data;
|
|
27
28
|
const content = {
|
|
28
29
|
dataSource: {
|
|
29
|
-
[name]: {
|
|
30
|
-
uri,
|
|
30
|
+
[service.name]: {
|
|
31
|
+
uri: service.uri,
|
|
31
32
|
type: 'OData',
|
|
32
33
|
settings: {
|
|
33
|
-
odataVersion: version
|
|
34
|
+
odataVersion: service.version
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
model: {
|
|
38
|
-
[modelName]: {
|
|
39
|
-
dataSource: name
|
|
39
|
+
[service.modelName]: {
|
|
40
|
+
dataSource: service.name
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
if (modelSettings && modelSettings.length !== 0) {
|
|
44
|
-
content.model[modelName].settings = (0, change_utils_1.parseStringToObject)(modelSettings);
|
|
44
|
+
if (service.modelSettings && service.modelSettings.length !== 0) {
|
|
45
|
+
content.model[service.modelName].settings = (0, change_utils_1.parseStringToObject)(service.modelSettings);
|
|
45
46
|
}
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
content.dataSource[
|
|
49
|
-
|
|
47
|
+
if ('annotation' in data) {
|
|
48
|
+
const { annotation } = data;
|
|
49
|
+
content.dataSource[service.name].settings.annotations = [`${annotation.dataSourceName}`];
|
|
50
|
+
content.dataSource[annotation.dataSourceName] = {
|
|
51
|
+
uri: annotation.dataSourceURI,
|
|
50
52
|
type: 'ODataAnnotation'
|
|
51
53
|
};
|
|
52
|
-
if (
|
|
53
|
-
content.dataSource[dataSourceName].settings = (0, change_utils_1.parseStringToObject)(
|
|
54
|
+
if (annotation.settings && annotation.settings.length !== 0) {
|
|
55
|
+
content.dataSource[annotation.dataSourceName].settings = (0, change_utils_1.parseStringToObject)(annotation.settings);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
return content;
|
|
@@ -63,7 +65,7 @@ class NewModelWriter {
|
|
|
63
65
|
*/
|
|
64
66
|
async write(data) {
|
|
65
67
|
const timestamp = Date.now();
|
|
66
|
-
const content = this.constructContent(data
|
|
68
|
+
const content = this.constructContent(data);
|
|
67
69
|
const change = (0, change_utils_1.getChange)(data.variant, timestamp, content, "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */);
|
|
68
70
|
(0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${timestamp}_addNewModel.change`, this.fs, project_access_1.DirName.Manifest);
|
|
69
71
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.12.
|
|
12
|
+
"version": "0.12.41",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
33
|
"sanitize-filename": "1.6.3",
|
|
34
34
|
"uuid": "10.0.0",
|
|
35
|
-
"@sap-ux/axios-extension": "1.16.
|
|
36
|
-
"@sap-ux/btp-utils": "0.15.
|
|
35
|
+
"@sap-ux/axios-extension": "1.16.5",
|
|
36
|
+
"@sap-ux/btp-utils": "0.15.2",
|
|
37
37
|
"@sap-ux/inquirer-common": "0.4.6",
|
|
38
38
|
"@sap-ux/logger": "0.6.0",
|
|
39
39
|
"@sap-ux/project-access": "1.26.8",
|
|
40
40
|
"@sap-ux/project-input-validator": "0.3.3",
|
|
41
|
-
"@sap-ux/system-access": "0.5.
|
|
41
|
+
"@sap-ux/system-access": "0.5.10",
|
|
42
42
|
"@sap-ux/ui5-config": "0.24.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|