@sap-ux/adp-tooling 0.11.5 → 0.11.7
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/README.md +6 -1
- package/dist/base/abap.d.ts +13 -0
- package/dist/base/abap.js +51 -0
- package/dist/base/change-utils.d.ts +6 -9
- package/dist/base/change-utils.js +10 -13
- package/dist/i18n.d.ts +16 -0
- package/dist/i18n.js +57 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -1
- package/dist/prompts/change-data-source/index.d.ts +11 -0
- package/dist/prompts/change-data-source/index.js +60 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.js +6 -0
- package/dist/translations/adp-tooling.i18n.json +20 -0
- package/dist/types.d.ts +19 -18
- package/dist/writer/changes/writers/annotations-writer.js +1 -1
- package/dist/writer/changes/writers/component-usages-writer.js +2 -2
- package/dist/writer/changes/writers/data-source-writer.js +13 -10
- package/dist/writer/changes/writers/inbound-writer.js +1 -1
- package/dist/writer/changes/writers/new-model-writer.js +1 -1
- package/package.json +14 -10
package/README.md
CHANGED
|
@@ -8,7 +8,12 @@ A module containing different tooling modules helpful when working with SAP UI5
|
|
|
8
8
|
The submodule preview contains functionality allowing to preview adaptation projects. It is not a standalone UI5 middleware but designed to be integrated into the `@sap-ux/preview-middleware.`.
|
|
9
9
|
|
|
10
10
|
### writer
|
|
11
|
-
The submodule writer contains functionality to generate the core project structure of an
|
|
11
|
+
The submodule writer contains functionality to generate the core project structure of an SAPUI5 adaptation project. It is not a standalone generator but designed to be integrated into `@sap-ux/create` or any kind of yeoman generator.
|
|
12
|
+
|
|
13
|
+
### prompts
|
|
14
|
+
The submodule contains prompting functionality for SAPUI5 adaptation project generators. It is not a standalone module but designed to be integrated into `@sap-ux/create` or any kind of yeoman generator.
|
|
15
|
+
#### change-data-source
|
|
16
|
+
Provides prompting for creating a manifest change file for replacing OData Sources.
|
|
12
17
|
|
|
13
18
|
### base
|
|
14
19
|
The submodule contains functionality required in different scenarios, e.g. prompting for generation or when initializing the preview.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Manifest } from '@sap-ux/project-access';
|
|
2
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
|
+
import type { AdpPreviewConfig } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Get the application manifest.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} appId - The application id.
|
|
8
|
+
* @param {AdpPreviewConfig} adpConfig - The ADP configuration.
|
|
9
|
+
* @param {ToolsLogger} logger - The logger.
|
|
10
|
+
* @returns {Promise<Manifest>} The manifest.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getManifest(appId: string, adpConfig: AdpPreviewConfig, logger: ToolsLogger): Promise<Manifest>;
|
|
13
|
+
//# sourceMappingURL=abap.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getManifest = void 0;
|
|
13
|
+
const system_access_1 = require("@sap-ux/system-access");
|
|
14
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
15
|
+
/**
|
|
16
|
+
* Get the application manifest.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} appId - The application id.
|
|
19
|
+
* @param {AdpPreviewConfig} adpConfig - The ADP configuration.
|
|
20
|
+
* @param {ToolsLogger} logger - The logger.
|
|
21
|
+
* @returns {Promise<Manifest>} The manifest.
|
|
22
|
+
*/
|
|
23
|
+
function getManifest(appId, adpConfig, logger) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const provider = yield (0, system_access_1.createAbapServiceProvider)(adpConfig.target, {
|
|
27
|
+
ignoreCertErrors: (_a = adpConfig.ignoreCertErrors) !== null && _a !== void 0 ? _a : false
|
|
28
|
+
}, true, logger);
|
|
29
|
+
const appInfo = (yield provider.getAppIndex().getAppInfo(appId))[appId];
|
|
30
|
+
const manifestUrl = (_b = appInfo.manifestUrl) !== null && _b !== void 0 ? _b : appInfo.manifest;
|
|
31
|
+
if (!manifestUrl) {
|
|
32
|
+
throw new Error('Manifest URL not found');
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const response = yield provider.get(manifestUrl);
|
|
36
|
+
return JSON.parse(response.data);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if ((0, axios_extension_1.isAxiosError)(error)) {
|
|
40
|
+
logger.error('Manifest fetching failed');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
logger.error('Manifest parsing error: Manifest is not in expected format.');
|
|
44
|
+
}
|
|
45
|
+
logger.debug(error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.getManifest = getManifest;
|
|
51
|
+
//# sourceMappingURL=abap.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnnotationsData, ChangeType, DescriptorVariant, InboundContent, ManifestChangeProperties, PropertyValueType } from '../types';
|
|
3
|
+
export type ChangeMetadata = Pick<DescriptorVariant, 'reference' | 'layer' | 'namespace'>;
|
|
3
4
|
type InboundChangeData = {
|
|
4
5
|
filePath: string;
|
|
5
6
|
changeWithInboundId: InboundChange | undefined;
|
|
@@ -75,16 +76,12 @@ export declare function findChangeWithInboundId(projectPath: string, inboundId:
|
|
|
75
76
|
/**
|
|
76
77
|
* Constructs a generic change object based on provided parameters.
|
|
77
78
|
*
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
80
|
-
* @param data.timestamp - The timestamp.
|
|
79
|
+
* @param {DescriptorVariant} variant - The app descriptor variant.
|
|
80
|
+
* @param {number} timestamp - The timestamp.
|
|
81
81
|
* @param {object} content - The content of the change to be applied.
|
|
82
82
|
* @param {ChangeType} changeType - The type of the change.
|
|
83
|
-
* @returns An object representing the change
|
|
83
|
+
* @returns - An object representing the change
|
|
84
84
|
*/
|
|
85
|
-
export declare function
|
|
86
|
-
projectData: AdpProjectData;
|
|
87
|
-
timestamp: number;
|
|
88
|
-
}, content: object, changeType: ChangeType): ManifestChangeProperties;
|
|
85
|
+
export declare function getChange({ reference, layer, namespace }: ChangeMetadata, timestamp: number, content: object, changeType: ChangeType): ManifestChangeProperties;
|
|
89
86
|
export {};
|
|
90
87
|
//# sourceMappingURL=change-utils.d.ts.map
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getChange = exports.findChangeWithInboundId = exports.getParsedPropertyValue = exports.parseStringToObject = exports.writeChangeToFile = exports.writeChangeToFolder = exports.writeAnnotationChange = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const project_access_1 = require("@sap-ux/project-access");
|
|
@@ -161,28 +161,25 @@ exports.findChangeWithInboundId = findChangeWithInboundId;
|
|
|
161
161
|
/**
|
|
162
162
|
* Constructs a generic change object based on provided parameters.
|
|
163
163
|
*
|
|
164
|
-
* @param
|
|
165
|
-
* @param
|
|
166
|
-
* @param data.timestamp - The timestamp.
|
|
164
|
+
* @param {DescriptorVariant} variant - The app descriptor variant.
|
|
165
|
+
* @param {number} timestamp - The timestamp.
|
|
167
166
|
* @param {object} content - The content of the change to be applied.
|
|
168
167
|
* @param {ChangeType} changeType - The type of the change.
|
|
169
|
-
* @returns An object representing the change
|
|
168
|
+
* @returns - An object representing the change
|
|
170
169
|
*/
|
|
171
|
-
function
|
|
172
|
-
const { projectData, timestamp } = data;
|
|
173
|
-
const fileName = `id_${timestamp}`;
|
|
170
|
+
function getChange({ reference, layer, namespace }, timestamp, content, changeType) {
|
|
174
171
|
return {
|
|
175
|
-
fileName
|
|
176
|
-
namespace: path_1.default.posix.join(
|
|
177
|
-
layer
|
|
172
|
+
fileName: `id_${timestamp}`,
|
|
173
|
+
namespace: path_1.default.posix.join(namespace, project_access_1.DirName.Changes),
|
|
174
|
+
layer,
|
|
178
175
|
fileType: 'change',
|
|
179
176
|
creation: new Date(timestamp).toISOString(),
|
|
180
177
|
packageName: '$TMP',
|
|
181
|
-
reference
|
|
178
|
+
reference,
|
|
182
179
|
support: { generator: '@sap-ux/adp-tooling' },
|
|
183
180
|
changeType,
|
|
184
181
|
content
|
|
185
182
|
};
|
|
186
183
|
}
|
|
187
|
-
exports.
|
|
184
|
+
exports.getChange = getChange;
|
|
188
185
|
//# sourceMappingURL=change-utils.js.map
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TOptions } from 'i18next';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize i18next with the translations for this module.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Promise<void>} A promise that resolves when the i18n initialization is completed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function initI18n(): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} key - The i18n key.
|
|
12
|
+
* @param {TOptions} options - Additional options.
|
|
13
|
+
* @returns {string} Localized string stored for the given key.
|
|
14
|
+
*/
|
|
15
|
+
export declare function t(key: string, options?: TOptions): string;
|
|
16
|
+
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.t = exports.initI18n = void 0;
|
|
16
|
+
const i18next_1 = __importDefault(require("i18next"));
|
|
17
|
+
const adp_tooling_i18n_json_1 = __importDefault(require("./translations/adp-tooling.i18n.json"));
|
|
18
|
+
const adpI18nNamespace = 'adp-tooling';
|
|
19
|
+
/**
|
|
20
|
+
* Initialize i18next with the translations for this module.
|
|
21
|
+
*
|
|
22
|
+
* @returns {Promise<void>} A promise that resolves when the i18n initialization is completed.
|
|
23
|
+
*/
|
|
24
|
+
function initI18n() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
yield i18next_1.default.init({
|
|
27
|
+
resources: {
|
|
28
|
+
en: {
|
|
29
|
+
[adpI18nNamespace]: adp_tooling_i18n_json_1.default
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
lng: 'en',
|
|
33
|
+
fallbackLng: 'en',
|
|
34
|
+
defaultNS: adpI18nNamespace,
|
|
35
|
+
ns: [adpI18nNamespace]
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.initI18n = initI18n;
|
|
40
|
+
/**
|
|
41
|
+
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} key - The i18n key.
|
|
44
|
+
* @param {TOptions} options - Additional options.
|
|
45
|
+
* @returns {string} Localized string stored for the given key.
|
|
46
|
+
*/
|
|
47
|
+
function t(key, options) {
|
|
48
|
+
if (!(options === null || options === void 0 ? void 0 : options.ns)) {
|
|
49
|
+
options = Object.assign(options !== null && options !== void 0 ? options : {}, { ns: adpI18nNamespace });
|
|
50
|
+
}
|
|
51
|
+
return i18next_1.default.t(key, options);
|
|
52
|
+
}
|
|
53
|
+
exports.t = t;
|
|
54
|
+
initI18n().catch(() => {
|
|
55
|
+
// Needed for lint
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
+
export * from './prompts';
|
|
2
3
|
export * from './preview/adp-preview';
|
|
3
4
|
export { generate, migrate } from './writer';
|
|
4
5
|
export { generateChange } from './writer/editors';
|
|
5
6
|
export { promptGeneratorInput, PromptDefaults } from './base/prompt';
|
|
7
|
+
export { getManifest } from './base/abap';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.promptGeneratorInput = exports.generateChange = exports.migrate = exports.generate = void 0;
|
|
17
|
+
exports.getManifest = exports.promptGeneratorInput = exports.generateChange = exports.migrate = exports.generate = void 0;
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./prompts"), exports);
|
|
19
20
|
__exportStar(require("./preview/adp-preview"), exports);
|
|
20
21
|
var writer_1 = require("./writer");
|
|
21
22
|
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return writer_1.generate; } });
|
|
@@ -24,4 +25,6 @@ var editors_1 = require("./writer/editors");
|
|
|
24
25
|
Object.defineProperty(exports, "generateChange", { enumerable: true, get: function () { return editors_1.generateChange; } });
|
|
25
26
|
var prompt_1 = require("./base/prompt");
|
|
26
27
|
Object.defineProperty(exports, "promptGeneratorInput", { enumerable: true, get: function () { return prompt_1.promptGeneratorInput; } });
|
|
28
|
+
var abap_1 = require("./base/abap");
|
|
29
|
+
Object.defineProperty(exports, "getManifest", { enumerable: true, get: function () { return abap_1.getManifest; } });
|
|
27
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { YUIQuestion } from '@sap-ux/inquirer-common';
|
|
2
|
+
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
3
|
+
import type { ChangeDataSourceAnswers } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Gets the prompts for changing the data source.
|
|
6
|
+
*
|
|
7
|
+
* @param {Record<string, ManifestNamespace.DataSource>} dataSources - Data sources from the manifest.
|
|
8
|
+
* @returns {YUIQuestion<ChangeDataSourceAnswers>[]} The questions/prompts.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPrompts(dataSources: Record<string, ManifestNamespace.DataSource>): YUIQuestion<ChangeDataSourceAnswers>[];
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPrompts = void 0;
|
|
4
|
+
const i18n_1 = require("../../i18n");
|
|
5
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
6
|
+
const helper_1 = require("../../base/helper");
|
|
7
|
+
/**
|
|
8
|
+
* Gets the prompts for changing the data source.
|
|
9
|
+
*
|
|
10
|
+
* @param {Record<string, ManifestNamespace.DataSource>} dataSources - Data sources from the manifest.
|
|
11
|
+
* @returns {YUIQuestion<ChangeDataSourceAnswers>[]} The questions/prompts.
|
|
12
|
+
*/
|
|
13
|
+
function getPrompts(dataSources) {
|
|
14
|
+
const dataSourceIds = Object.keys((0, project_access_1.filterDataSourcesByType)(dataSources, 'OData'));
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
type: 'list',
|
|
18
|
+
name: 'id',
|
|
19
|
+
message: (0, i18n_1.t)('prompts.oDataSourceLabel'),
|
|
20
|
+
choices: dataSourceIds,
|
|
21
|
+
default: dataSourceIds[0],
|
|
22
|
+
store: false,
|
|
23
|
+
guiOptions: {
|
|
24
|
+
mandatory: true,
|
|
25
|
+
hint: (0, i18n_1.t)('prompts.oDataSourceTooltip')
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'input',
|
|
30
|
+
name: 'uri',
|
|
31
|
+
message: (0, i18n_1.t)('prompts.oDataSourceURILabel'),
|
|
32
|
+
guiOptions: {
|
|
33
|
+
mandatory: true,
|
|
34
|
+
hint: (0, i18n_1.t)('prompts.oDataSourceURITooltip')
|
|
35
|
+
},
|
|
36
|
+
validate: helper_1.isNotEmptyString,
|
|
37
|
+
when: !!dataSourceIds.length,
|
|
38
|
+
store: false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'number',
|
|
42
|
+
name: 'maxAge',
|
|
43
|
+
message: (0, i18n_1.t)('prompts.maxAgeLabel'),
|
|
44
|
+
guiOptions: {
|
|
45
|
+
hint: (0, i18n_1.t)('prompts.maxAgeTooltip')
|
|
46
|
+
},
|
|
47
|
+
when: (answers) => answers.uri !== ''
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'input',
|
|
51
|
+
name: 'annotationUri',
|
|
52
|
+
message: (0, i18n_1.t)('prompts.oDataAnnotationSourceURILabel'),
|
|
53
|
+
guiOptions: {
|
|
54
|
+
hint: (0, i18n_1.t)('prompts.oDataAnnotationSourceURITooltip')
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
exports.getPrompts = getPrompts;
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPromptsForChangeDataSource = void 0;
|
|
4
|
+
var change_data_source_1 = require("./change-data-source");
|
|
5
|
+
Object.defineProperty(exports, "getPromptsForChangeDataSource", { enumerable: true, get: function () { return change_data_source_1.getPrompts; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"prompts": {
|
|
3
|
+
"oDataSourceLabel": "Target OData Service",
|
|
4
|
+
"oDataSourceTooltip": "Select the OData service you want to replace",
|
|
5
|
+
"oDataSourceURILabel": "OData Source URI",
|
|
6
|
+
"oDataSourceURITooltip": "Enter the URI for the new OData source",
|
|
7
|
+
"maxAgeLabel": "New maxAge",
|
|
8
|
+
"maxAgeTooltip": "(Optional) Enter the time in seconds it takes for a cached response of the service to expire.",
|
|
9
|
+
"oDataAnnotationSourceURILabel": "OData Annotation Data Source URI",
|
|
10
|
+
"oDataAnnotationSourceURITooltip": "Server side annotations have been detected for the selected OData service. If needed, enter new annotation data source URI for the changed service",
|
|
11
|
+
"oDataURIInfoLabel": "Have in mind that common OData Service path prefixes are '{{- v2Prefix}}' or '{{- v4Prefix}}'",
|
|
12
|
+
"isInSafeModeLabel": "Making manifest changes is not upgrade safe and the project will be set in advanced mode. Please continue if you are sure you want to have your project in advanced mode.",
|
|
13
|
+
"oDataURIV2InfoLabel": "Have in mind that you are trying to replace OData {{versionOne}} Service with OData {{versionTwo}} Service"
|
|
14
|
+
},
|
|
15
|
+
"validators": {
|
|
16
|
+
"manifestContainsNoODataServices": "Manifest contains no OData Services.",
|
|
17
|
+
"inputCannotBeEmpty": "{{input}} cannot be empty.",
|
|
18
|
+
"inpuCannotHaveSpaces": "{{input}} cannot contain spaces."
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UI5FlexLayer } from '@sap-ux/project-access';
|
|
1
|
+
import type { UI5FlexLayer, ManifestNamespace } from '@sap-ux/project-access';
|
|
2
2
|
import type { DestinationAbapTarget, UrlAbapTarget } from '@sap-ux/system-access';
|
|
3
3
|
import type { Adp, BspApp } from '@sap-ux/ui5-config';
|
|
4
4
|
import type { OperationsType } from '@sap-ux/axios-extension';
|
|
@@ -293,22 +293,9 @@ export interface NewModelData {
|
|
|
293
293
|
addAnnotationMode: boolean;
|
|
294
294
|
}
|
|
295
295
|
export interface DataSourceData {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
/** Data source identifier. */
|
|
300
|
-
name: string;
|
|
301
|
-
/** URI of the data source. */
|
|
302
|
-
uri: string;
|
|
303
|
-
/** Optional maximum age for the data source cache. */
|
|
304
|
-
maxAge?: number;
|
|
305
|
-
/** URI for the OData annotation source. */
|
|
306
|
-
annotationUri: string;
|
|
307
|
-
};
|
|
308
|
-
/** Dictionary mapping data source keys to their values. */
|
|
309
|
-
dataSourcesDictionary: {
|
|
310
|
-
[key: string]: string;
|
|
311
|
-
};
|
|
296
|
+
variant: DescriptorVariant;
|
|
297
|
+
dataSources: Record<string, ManifestNamespace.DataSource>;
|
|
298
|
+
answers: ChangeDataSourceAnswers;
|
|
312
299
|
}
|
|
313
300
|
export interface InboundData {
|
|
314
301
|
projectData: AdpProjectData;
|
|
@@ -348,7 +335,7 @@ export interface AdpProjectData {
|
|
|
348
335
|
namespace: string;
|
|
349
336
|
ui5Version: string;
|
|
350
337
|
name: string;
|
|
351
|
-
layer:
|
|
338
|
+
layer: UI5FlexLayer;
|
|
352
339
|
environment: string;
|
|
353
340
|
safeMode: boolean;
|
|
354
341
|
sourceSystem: string;
|
|
@@ -356,6 +343,20 @@ export interface AdpProjectData {
|
|
|
356
343
|
reference: string;
|
|
357
344
|
id: string;
|
|
358
345
|
}
|
|
346
|
+
export interface ChangeDataSourceAnswers {
|
|
347
|
+
/** Data Source identifier */
|
|
348
|
+
id: string;
|
|
349
|
+
/** Data Source URI */
|
|
350
|
+
uri: string;
|
|
351
|
+
/** Data Source Max Age */
|
|
352
|
+
maxAge?: number;
|
|
353
|
+
/** Data Source Annotation URI */
|
|
354
|
+
annotationUri?: string;
|
|
355
|
+
}
|
|
356
|
+
export type DataSource = ManifestNamespace.DataSource & {
|
|
357
|
+
dataSourceName: string;
|
|
358
|
+
annotations: string[];
|
|
359
|
+
};
|
|
359
360
|
export interface CustomConfig {
|
|
360
361
|
adp: {
|
|
361
362
|
safeMode: boolean;
|
|
@@ -70,7 +70,7 @@ class AnnotationsWriter {
|
|
|
70
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
71
|
data.annotation.fileName = this.getAnnotationFileName(data);
|
|
72
72
|
const content = this.constructContent(data);
|
|
73
|
-
const change = (0, change_utils_1.
|
|
73
|
+
const change = (0, change_utils_1.getChange)(data.projectData, data.timestamp, content, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */);
|
|
74
74
|
(0, change_utils_1.writeAnnotationChange)(this.projectPath, data, change, this.fs);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
@@ -74,11 +74,11 @@ class ComponentUsagesWriter {
|
|
|
74
74
|
const componentUsagesContent = this.constructContent(data);
|
|
75
75
|
const libRefContent = this.constructLibContent(data);
|
|
76
76
|
const shouldAddLibRef = libRefContent !== undefined;
|
|
77
|
-
const compUsagesChange = (0, change_utils_1.
|
|
77
|
+
const compUsagesChange = (0, change_utils_1.getChange)(data.projectData, data.timestamp, componentUsagesContent, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */);
|
|
78
78
|
(0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, `id_${data.timestamp}_addComponentUsages.change`, this.fs, project_access_1.DirName.Manifest);
|
|
79
79
|
if (shouldAddLibRef) {
|
|
80
80
|
data.timestamp += 1;
|
|
81
|
-
const refLibChange = (0, change_utils_1.
|
|
81
|
+
const refLibChange = (0, change_utils_1.getChange)(data.projectData, data.timestamp, libRefContent, "appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */);
|
|
82
82
|
(0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, `id_${data.timestamp}_addLibraries.change`, this.fs, project_access_1.DirName.Manifest);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -59,17 +59,20 @@ class DataSourceWriter {
|
|
|
59
59
|
* @returns {Promise<void>} A promise that resolves when the change writing process is completed.
|
|
60
60
|
*/
|
|
61
61
|
write(data) {
|
|
62
|
+
var _a, _b;
|
|
62
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const {
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
64
|
+
const { variant, dataSources, answers } = data;
|
|
65
|
+
const { id, uri, maxAge, annotationUri } = answers;
|
|
66
|
+
const annotationId = (_b = (_a = dataSources[id].settings) === null || _a === void 0 ? void 0 : _a.annotations) === null || _b === void 0 ? void 0 : _b[0];
|
|
67
|
+
const timestamp = Date.now();
|
|
68
|
+
const content = this.constructContent(id, uri, maxAge);
|
|
69
|
+
const change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
|
|
70
|
+
(0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${timestamp}_changeDataSource.change`, this.fs, project_access_1.DirName.Manifest);
|
|
71
|
+
if (annotationId && annotationUri) {
|
|
72
|
+
const annotationContent = this.constructContent(annotationId, annotationUri);
|
|
73
|
+
const annotationTs = timestamp + 1;
|
|
74
|
+
const annotationChange = (0, change_utils_1.getChange)(variant, annotationTs, annotationContent, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
|
|
75
|
+
(0, change_utils_1.writeChangeToFolder)(this.projectPath, annotationChange, `id_${annotationTs}_changeDataSource.change`, this.fs, project_access_1.DirName.Manifest);
|
|
73
76
|
}
|
|
74
77
|
});
|
|
75
78
|
}
|
|
@@ -96,7 +96,7 @@ class InboundWriter {
|
|
|
96
96
|
const { changeWithInboundId, filePath } = (0, change_utils_1.findChangeWithInboundId)(this.projectPath, answers.inboundId);
|
|
97
97
|
if (!changeWithInboundId) {
|
|
98
98
|
const content = this.constructContent(answers);
|
|
99
|
-
const change = (0, change_utils_1.
|
|
99
|
+
const change = (0, change_utils_1.getChange)(data.projectData, data.timestamp, content, "appdescr_app_changeInbound" /* ChangeType.CHANGE_INBOUND */);
|
|
100
100
|
(0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_changeInbound.change`, this.fs, project_access_1.DirName.Manifest);
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
@@ -71,7 +71,7 @@ class NewModelWriter {
|
|
|
71
71
|
write(data) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
const content = this.constructContent(data);
|
|
74
|
-
const change = (0, change_utils_1.
|
|
74
|
+
const change = (0, change_utils_1.getChange)(data.projectData, data.timestamp, content, "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */);
|
|
75
75
|
(0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_addNewModel.change`, this.fs, project_access_1.DirName.Manifest);
|
|
76
76
|
});
|
|
77
77
|
}
|
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.11.
|
|
12
|
+
"version": "0.11.7",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -23,29 +23,33 @@
|
|
|
23
23
|
"!dist/**/*.map"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
26
|
+
"adm-zip": "0.5.10",
|
|
27
27
|
"ejs": "3.1.10",
|
|
28
|
+
"i18next": "23.11.2",
|
|
29
|
+
"inquirer": "8.2.6",
|
|
28
30
|
"mem-fs": "2.1.0",
|
|
29
31
|
"mem-fs-editor": "9.4.0",
|
|
30
32
|
"prompts": "2.4.2",
|
|
31
|
-
"
|
|
32
|
-
"@sap-ux/axios-extension": "1.14.
|
|
33
|
-
"@sap-ux/
|
|
33
|
+
"sanitize-filename": "1.6.3",
|
|
34
|
+
"@sap-ux/axios-extension": "1.14.2",
|
|
35
|
+
"@sap-ux/btp-utils": "0.14.4",
|
|
36
|
+
"@sap-ux/inquirer-common": "0.3.1",
|
|
34
37
|
"@sap-ux/logger": "0.5.1",
|
|
35
|
-
"@sap-ux/
|
|
36
|
-
"@sap-ux/
|
|
37
|
-
"@sap-ux/
|
|
38
|
+
"@sap-ux/project-access": "1.22.3",
|
|
39
|
+
"@sap-ux/system-access": "0.4.5",
|
|
40
|
+
"@sap-ux/ui5-config": "0.22.10"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|
|
43
|
+
"@types/adm-zip": "0.5.5",
|
|
40
44
|
"@types/ejs": "3.1.2",
|
|
41
45
|
"@types/express": "4.17.21",
|
|
46
|
+
"@types/inquirer": "8.2.6",
|
|
42
47
|
"@types/mem-fs": "1.1.2",
|
|
43
48
|
"@types/mem-fs-editor": "7.0.1",
|
|
44
49
|
"@types/prompts": "2.4.4",
|
|
45
50
|
"@types/supertest": "2.0.12",
|
|
46
|
-
"@types/adm-zip": "0.5.5",
|
|
47
|
-
"express": "4.19.2",
|
|
48
51
|
"dotenv": "16.3.1",
|
|
52
|
+
"express": "4.19.2",
|
|
49
53
|
"nock": "13.4.0",
|
|
50
54
|
"rimraf": "5.0.5",
|
|
51
55
|
"supertest": "6.3.3",
|