@sap-ux/adp-tooling 0.19.11 → 1.0.1
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/abap/client.d.ts +1 -1
- package/dist/abap/client.js +8 -13
- package/dist/abap/config.js +5 -8
- package/dist/abap/index.d.ts +3 -3
- package/dist/abap/index.js +3 -19
- package/dist/abap/provider.js +5 -8
- package/dist/base/abap/manifest-service.d.ts +1 -1
- package/dist/base/abap/manifest-service.js +9 -18
- package/dist/base/cf.js +8 -11
- package/dist/base/change-utils.d.ts +1 -1
- package/dist/base/change-utils.js +49 -62
- package/dist/base/constants/index.js +12 -15
- package/dist/base/credentials.d.ts +2 -2
- package/dist/base/credentials.js +6 -9
- package/dist/base/helper.d.ts +1 -1
- package/dist/base/helper.js +40 -57
- package/dist/base/project-builder.js +3 -6
- package/dist/base/prompt.d.ts +1 -1
- package/dist/base/prompt.js +19 -25
- package/dist/btp/api.d.ts +1 -1
- package/dist/btp/api.js +10 -18
- package/dist/btp/index.d.ts +1 -1
- package/dist/btp/index.js +1 -17
- package/dist/cf/app/discovery.d.ts +1 -1
- package/dist/cf/app/discovery.js +11 -18
- package/dist/cf/app/html5-repo.d.ts +1 -1
- package/dist/cf/app/html5-repo.js +24 -32
- package/dist/cf/app/index.d.ts +2 -2
- package/dist/cf/app/index.js +2 -18
- package/dist/cf/core/auth.d.ts +1 -1
- package/dist/cf/core/auth.js +4 -8
- package/dist/cf/core/config.d.ts +1 -1
- package/dist/cf/core/config.js +9 -15
- package/dist/cf/core/index.d.ts +2 -2
- package/dist/cf/core/index.js +2 -18
- package/dist/cf/deploy.d.ts +1 -1
- package/dist/cf/deploy.js +33 -44
- package/dist/cf/index.d.ts +6 -6
- package/dist/cf/index.js +6 -22
- package/dist/cf/project/index.d.ts +3 -3
- package/dist/cf/project/index.js +3 -19
- package/dist/cf/project/mta.d.ts +1 -1
- package/dist/cf/project/mta.js +23 -66
- package/dist/cf/project/yaml-loader.d.ts +1 -1
- package/dist/cf/project/yaml-loader.js +8 -16
- package/dist/cf/project/yaml.d.ts +2 -2
- package/dist/cf/project/yaml.js +28 -72
- package/dist/cf/services/api.d.ts +1 -1
- package/dist/cf/services/api.js +46 -93
- package/dist/cf/services/cli.d.ts +1 -1
- package/dist/cf/services/cli.js +31 -42
- package/dist/cf/services/destinations.js +12 -48
- package/dist/cf/services/index.d.ts +5 -5
- package/dist/cf/services/index.js +5 -21
- package/dist/cf/services/manifest.d.ts +1 -1
- package/dist/cf/services/manifest.js +9 -13
- package/dist/cf/services/ssh.js +14 -22
- package/dist/cf/utils/index.d.ts +1 -1
- package/dist/cf/utils/index.js +1 -17
- package/dist/cf/utils/validation.d.ts +1 -1
- package/dist/cf/utils/validation.js +12 -18
- package/dist/common/flp-parameters.d.ts +1 -1
- package/dist/common/flp-parameters.js +1 -4
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -17
- package/dist/i18n.js +8 -16
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -46
- package/dist/preview/adp-preview.d.ts +1 -1
- package/dist/preview/adp-preview.js +41 -39
- package/dist/preview/change-handler.d.ts +1 -1
- package/dist/preview/change-handler.js +51 -59
- package/dist/preview/descriptor-change-handler.d.ts +1 -1
- package/dist/preview/descriptor-change-handler.js +18 -21
- package/dist/preview/ovp-routes-handler.js +11 -13
- package/dist/preview/routes-handler.js +36 -71
- package/dist/preview/utils.d.ts +1 -1
- package/dist/preview/utils.js +5 -8
- package/dist/prompts/add-annotations-to-odata/index.d.ts +1 -1
- package/dist/prompts/add-annotations-to-odata/index.js +24 -26
- package/dist/prompts/add-component-usages/index.d.ts +1 -1
- package/dist/prompts/add-component-usages/index.js +41 -43
- package/dist/prompts/add-new-model/index.d.ts +1 -1
- package/dist/prompts/add-new-model/index.js +75 -80
- package/dist/prompts/change-data-source/index.d.ts +1 -1
- package/dist/prompts/change-data-source/index.js +19 -22
- package/dist/prompts/change-inbound/index.d.ts +1 -1
- package/dist/prompts/change-inbound/index.js +11 -14
- package/dist/prompts/index.d.ts +5 -5
- package/dist/prompts/index.js +5 -15
- package/dist/source/applications.d.ts +2 -2
- package/dist/source/applications.js +7 -11
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.js +3 -19
- package/dist/source/manifest.d.ts +1 -1
- package/dist/source/manifest.js +15 -25
- package/dist/source/systems.d.ts +1 -1
- package/dist/source/systems.js +20 -27
- package/dist/types.d.ts +1 -1
- package/dist/types.js +64 -17
- package/dist/ui5/fetch.d.ts +1 -1
- package/dist/ui5/fetch.js +8 -12
- package/dist/ui5/format.d.ts +1 -1
- package/dist/ui5/format.js +17 -29
- package/dist/ui5/index.d.ts +4 -4
- package/dist/ui5/index.js +4 -20
- package/dist/ui5/network.d.ts +1 -1
- package/dist/ui5/network.js +1 -4
- package/dist/ui5/validator.js +14 -20
- package/dist/ui5/version-info.d.ts +1 -1
- package/dist/ui5/version-info.js +25 -36
- package/dist/writer/cf.d.ts +1 -1
- package/dist/writer/cf.js +35 -43
- package/dist/writer/changes/writer-factory.d.ts +2 -2
- package/dist/writer/changes/writer-factory.js +10 -13
- package/dist/writer/changes/writers/annotations-writer.d.ts +1 -1
- package/dist/writer/changes/writers/annotations-writer.js +11 -46
- package/dist/writer/changes/writers/component-usages-writer.d.ts +1 -1
- package/dist/writer/changes/writers/component-usages-writer.js +9 -12
- package/dist/writer/changes/writers/data-source-writer.d.ts +1 -1
- package/dist/writer/changes/writers/data-source-writer.js +7 -10
- package/dist/writer/changes/writers/inbound-writer.d.ts +1 -1
- package/dist/writer/changes/writers/inbound-writer.js +10 -13
- package/dist/writer/changes/writers/index.d.ts +5 -5
- package/dist/writer/changes/writers/index.js +5 -21
- package/dist/writer/changes/writers/new-model-writer.d.ts +1 -1
- package/dist/writer/changes/writers/new-model-writer.js +16 -20
- package/dist/writer/editors.d.ts +1 -1
- package/dist/writer/editors.js +6 -9
- package/dist/writer/i18n/index.d.ts +1 -1
- package/dist/writer/i18n/index.js +13 -17
- package/dist/writer/i18n/key-user-translations.js +9 -14
- package/dist/writer/inbound-navigation.d.ts +1 -1
- package/dist/writer/inbound-navigation.js +18 -27
- package/dist/writer/index.d.ts +1 -1
- package/dist/writer/index.js +36 -37
- package/dist/writer/manifest/descriptor-content.d.ts +2 -2
- package/dist/writer/manifest/descriptor-content.js +9 -15
- package/dist/writer/manifest/index.d.ts +1 -1
- package/dist/writer/manifest/index.js +1 -17
- package/dist/writer/options.d.ts +1 -1
- package/dist/writer/options.js +16 -27
- package/dist/writer/project-utils.d.ts +1 -1
- package/dist/writer/project-utils.js +49 -57
- package/dist/writer/writer-config.d.ts +2 -2
- package/dist/writer/writer-config.js +25 -30
- package/package.json +19 -17
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const project_builder_1 = require("../../base/project-builder");
|
|
7
|
-
const i18n_1 = require("../../i18n");
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { runBuild } from '../../base/project-builder.js';
|
|
4
|
+
import { t } from '../../i18n.js';
|
|
8
5
|
/** Default build output folder used by CF ADP projects. */
|
|
9
6
|
const CF_BUILD_PATH = 'dist';
|
|
10
7
|
/**
|
|
@@ -15,7 +12,7 @@ const CF_BUILD_PATH = 'dist';
|
|
|
15
12
|
* The build is triggered automatically during initialization so that the `dist/` folder
|
|
16
13
|
* contains the latest merged manifest before it is read.
|
|
17
14
|
*/
|
|
18
|
-
class ManifestServiceCF {
|
|
15
|
+
export class ManifestServiceCF {
|
|
19
16
|
logger;
|
|
20
17
|
manifest;
|
|
21
18
|
/**
|
|
@@ -37,10 +34,10 @@ class ManifestServiceCF {
|
|
|
37
34
|
static async init(projectPath, logger) {
|
|
38
35
|
const service = new ManifestServiceCF(logger);
|
|
39
36
|
logger.debug('Triggering project build to generate dist folder');
|
|
40
|
-
await
|
|
41
|
-
const manifestPath =
|
|
37
|
+
await runBuild(projectPath);
|
|
38
|
+
const manifestPath = join(projectPath, CF_BUILD_PATH, 'manifest.json');
|
|
42
39
|
logger.debug(`Reading manifest from '${manifestPath}'`);
|
|
43
|
-
const manifestContent =
|
|
40
|
+
const manifestContent = readFileSync(manifestPath, 'utf-8');
|
|
44
41
|
service.manifest = JSON.parse(manifestContent);
|
|
45
42
|
logger.debug('Manifest successfully read from dist folder');
|
|
46
43
|
return service;
|
|
@@ -75,10 +72,9 @@ class ManifestServiceCF {
|
|
|
75
72
|
* @throws Error indicating metadata fetching is not supported for CF projects.
|
|
76
73
|
*/
|
|
77
74
|
async getDataSourceMetadata(_dataSourceId) {
|
|
78
|
-
const message =
|
|
75
|
+
const message = t('error.metadataFetchingNotSupportedForCF');
|
|
79
76
|
this.logger.warn(message);
|
|
80
77
|
throw new Error(message);
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
|
-
exports.ManifestServiceCF = ManifestServiceCF;
|
|
84
80
|
//# sourceMappingURL=manifest.js.map
|
package/dist/cf/services/ssh.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_TUNNEL_APP_NAME = void 0;
|
|
7
|
-
exports.ensureTunnelAppExists = ensureTunnelAppExists;
|
|
8
|
-
exports.enableSshAndRestart = enableSshAndRestart;
|
|
9
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const cli_1 = require("./cli");
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { checkAppExists, pushApp, enableSsh, restartApp } from './cli.js';
|
|
13
5
|
/**
|
|
14
6
|
* Default CF app name used for SSH tunneling to the connectivity proxy.
|
|
15
7
|
*/
|
|
16
|
-
|
|
8
|
+
export const DEFAULT_TUNNEL_APP_NAME = 'adp-ssh-tunnel-app';
|
|
17
9
|
/**
|
|
18
10
|
* Ensure a tunnel app exists in CF. If not found, deploy a minimal no-route app
|
|
19
11
|
* using the binary_buildpack with minimum memory so it can serve as an SSH target.
|
|
@@ -21,16 +13,16 @@ exports.DEFAULT_TUNNEL_APP_NAME = 'adp-ssh-tunnel-app';
|
|
|
21
13
|
* @param appName - CF app name.
|
|
22
14
|
* @param logger - Logger instance.
|
|
23
15
|
*/
|
|
24
|
-
async function ensureTunnelAppExists(appName, logger) {
|
|
25
|
-
if (await
|
|
16
|
+
export async function ensureTunnelAppExists(appName, logger) {
|
|
17
|
+
if (await checkAppExists(appName)) {
|
|
26
18
|
logger.info(`Tunnel app "${appName}" already exists.`);
|
|
27
19
|
return;
|
|
28
20
|
}
|
|
29
21
|
logger.debug(`Tunnel app "${appName}" not found. Deploying minimal app...`);
|
|
30
|
-
const tmpDir =
|
|
31
|
-
|
|
22
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'adp-tunnel-'));
|
|
23
|
+
fs.writeFileSync(path.join(tmpDir, '.keep'), '');
|
|
32
24
|
try {
|
|
33
|
-
await
|
|
25
|
+
await pushApp(appName, tmpDir, [
|
|
34
26
|
'--no-route',
|
|
35
27
|
'-m',
|
|
36
28
|
'64M',
|
|
@@ -46,7 +38,7 @@ async function ensureTunnelAppExists(appName, logger) {
|
|
|
46
38
|
logger.info(`Tunnel app "${appName}" deployed successfully.`);
|
|
47
39
|
}
|
|
48
40
|
finally {
|
|
49
|
-
|
|
41
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
44
|
/**
|
|
@@ -55,10 +47,10 @@ async function ensureTunnelAppExists(appName, logger) {
|
|
|
55
47
|
* @param appName - CF app name.
|
|
56
48
|
* @param logger - Logger instance.
|
|
57
49
|
*/
|
|
58
|
-
async function enableSshAndRestart(appName, logger) {
|
|
50
|
+
export async function enableSshAndRestart(appName, logger) {
|
|
59
51
|
logger.info(`Enabling SSH on "${appName}"...`);
|
|
60
|
-
await
|
|
52
|
+
await enableSsh(appName);
|
|
61
53
|
logger.info(`Restarting "${appName}"...`);
|
|
62
|
-
await
|
|
54
|
+
await restartApp(appName);
|
|
63
55
|
}
|
|
64
56
|
//# sourceMappingURL=ssh.js.map
|
package/dist/cf/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './validation';
|
|
1
|
+
export * from './validation.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cf/utils/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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("./validation"), exports);
|
|
1
|
+
export * from './validation.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type AdmZip from 'adm-zip';
|
|
2
2
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
3
|
import type { Manifest } from '@sap-ux/project-access';
|
|
4
|
-
import type { ServiceKeys, XsApp } from '../../types';
|
|
4
|
+
import type { ServiceKeys, XsApp } from '../../types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Validate the smart template application.
|
|
7
7
|
*
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.validateSmartTemplateApplication = validateSmartTemplateApplication;
|
|
4
|
-
exports.extractJsonFromZip = extractJsonFromZip;
|
|
5
|
-
exports.extractXSApp = extractXSApp;
|
|
6
|
-
exports.validateODataEndpoints = validateODataEndpoints;
|
|
7
|
-
const i18n_1 = require("../../i18n");
|
|
8
|
-
const manifest_1 = require("../../source/manifest");
|
|
1
|
+
import { t } from '../../i18n.js';
|
|
2
|
+
import { getApplicationType, isSupportedAppTypeForAdp } from '../../source/manifest.js';
|
|
9
3
|
/**
|
|
10
4
|
* Normalize the xs-app route regex.
|
|
11
5
|
*
|
|
@@ -21,13 +15,13 @@ function normalizeRouteRegex(value) {
|
|
|
21
15
|
* @param {Manifest} manifest - The manifest.
|
|
22
16
|
* @returns {Promise<void>} The messages.
|
|
23
17
|
*/
|
|
24
|
-
async function validateSmartTemplateApplication(manifest) {
|
|
25
|
-
const appType =
|
|
26
|
-
if (!
|
|
27
|
-
throw new Error(
|
|
18
|
+
export async function validateSmartTemplateApplication(manifest) {
|
|
19
|
+
const appType = getApplicationType(manifest);
|
|
20
|
+
if (!isSupportedAppTypeForAdp(appType)) {
|
|
21
|
+
throw new Error(t('error.adpDoesNotSupportSelectedApplication'));
|
|
28
22
|
}
|
|
29
23
|
if (manifest['sap.ui5']?.flexEnabled === false) {
|
|
30
|
-
throw new Error(
|
|
24
|
+
throw new Error(t('error.appDoesNotSupportFlexibility'));
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
@@ -38,13 +32,13 @@ async function validateSmartTemplateApplication(manifest) {
|
|
|
38
32
|
* @param {string} errorKey - The i18n error key for parsing failures.
|
|
39
33
|
* @returns {T | undefined} The parsed JSON object.
|
|
40
34
|
*/
|
|
41
|
-
function extractJsonFromZip(zipEntries, fileName, errorKey) {
|
|
35
|
+
export function extractJsonFromZip(zipEntries, fileName, errorKey) {
|
|
42
36
|
const entry = zipEntries.find((item) => item.entryName.endsWith(fileName));
|
|
43
37
|
try {
|
|
44
38
|
return JSON.parse(entry?.getData().toString('utf8') ?? '');
|
|
45
39
|
}
|
|
46
40
|
catch (e) {
|
|
47
|
-
throw new Error(
|
|
41
|
+
throw new Error(t(errorKey, { error: e.message }));
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
44
|
/**
|
|
@@ -53,7 +47,7 @@ function extractJsonFromZip(zipEntries, fileName, errorKey) {
|
|
|
53
47
|
* @param {AdmZip.IZipEntry[]} zipEntries - The zip entries.
|
|
54
48
|
* @returns {XsApp | undefined} The xs-app.json.
|
|
55
49
|
*/
|
|
56
|
-
function extractXSApp(zipEntries) {
|
|
50
|
+
export function extractXSApp(zipEntries) {
|
|
57
51
|
return extractJsonFromZip(zipEntries, 'xs-app.json', 'error.failedToParseXsAppJson');
|
|
58
52
|
}
|
|
59
53
|
/**
|
|
@@ -95,7 +89,7 @@ function matchRoutesAndDatasources(dataSources, routes, serviceKeyEndpoints) {
|
|
|
95
89
|
* @param {ToolsLogger} logger - The logger.
|
|
96
90
|
* @returns {Promise<string[]>} The messages.
|
|
97
91
|
*/
|
|
98
|
-
async function validateODataEndpoints(zipEntries, serviceKeys, logger) {
|
|
92
|
+
export async function validateODataEndpoints(zipEntries, serviceKeys, logger) {
|
|
99
93
|
const messages = [];
|
|
100
94
|
let xsApp;
|
|
101
95
|
try {
|
|
@@ -128,7 +122,7 @@ async function validateODataEndpoints(zipEntries, serviceKeys, logger) {
|
|
|
128
122
|
if (messages.length > 0) {
|
|
129
123
|
const errorMessages = messages.join('\n');
|
|
130
124
|
logger?.error(`OData endpoints validation failed:\n${errorMessages}`);
|
|
131
|
-
throw new Error(
|
|
125
|
+
throw new Error(t('error.oDataEndpointsValidationFailed'));
|
|
132
126
|
}
|
|
133
127
|
}
|
|
134
128
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseParameters = parseParameters;
|
|
4
1
|
const defaultParamCheck = { shouldApply: false, value: undefined };
|
|
5
2
|
const rules = {
|
|
6
3
|
isEmptyParam: (paramString) => {
|
|
@@ -50,7 +47,7 @@ const genericErrorMessage = (error) => `Value cannot be parsed: ${error}! Please
|
|
|
50
47
|
* @param {string} paramString - parameters string
|
|
51
48
|
* @returns {Parameter} parsed parameters string object
|
|
52
49
|
*/
|
|
53
|
-
function parseParameters(paramString) {
|
|
50
|
+
export function parseParameters(paramString) {
|
|
54
51
|
let result = {};
|
|
55
52
|
const modifiedParamString = addMissingAmpersands(paramString);
|
|
56
53
|
const params = modifiedParamString
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './flp-parameters';
|
|
1
|
+
export * from './flp-parameters.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/common/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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("./flp-parameters"), exports);
|
|
1
|
+
export * from './flp-parameters.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/i18n.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 adp_tooling_i18n_json_1 = __importDefault(require("./translations/adp-tooling.i18n.json"));
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import translations from './translations/adp-tooling.i18n.json' with { type: 'json' };
|
|
11
3
|
const adpI18nNamespace = 'adp-tooling';
|
|
12
|
-
|
|
4
|
+
export const i18n = i18next.createInstance();
|
|
13
5
|
/**
|
|
14
6
|
* Initialize i18next with the translations for this module.
|
|
15
7
|
*
|
|
16
8
|
* @returns {Promise<void>} A promise that resolves when the i18n initialization is completed.
|
|
17
9
|
*/
|
|
18
|
-
async function initI18n() {
|
|
19
|
-
await
|
|
10
|
+
export async function initI18n() {
|
|
11
|
+
await i18n.init({
|
|
20
12
|
resources: {
|
|
21
13
|
en: {
|
|
22
|
-
[adpI18nNamespace]:
|
|
14
|
+
[adpI18nNamespace]: translations
|
|
23
15
|
}
|
|
24
16
|
},
|
|
25
17
|
lng: 'en',
|
|
@@ -36,11 +28,11 @@ async function initI18n() {
|
|
|
36
28
|
* @param {TOptions} options - Additional options.
|
|
37
29
|
* @returns {string} Localized string stored for the given key.
|
|
38
30
|
*/
|
|
39
|
-
function t(key, options) {
|
|
31
|
+
export function t(key, options) {
|
|
40
32
|
if (!options?.ns) {
|
|
41
33
|
options = Object.assign(options ?? {}, { ns: adpI18nNamespace });
|
|
42
34
|
}
|
|
43
|
-
return
|
|
35
|
+
return i18n.t(key, options);
|
|
44
36
|
}
|
|
45
37
|
initI18n().catch(() => {
|
|
46
38
|
// Needed for lint
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './prompts';
|
|
3
|
-
export * from './common';
|
|
4
|
-
export * from './abap';
|
|
5
|
-
export * from './source';
|
|
6
|
-
export * from './ui5';
|
|
7
|
-
export * from './base/cf';
|
|
8
|
-
export * from './cf';
|
|
9
|
-
export * from './btp';
|
|
10
|
-
export * from './base/helper';
|
|
11
|
-
export * from './base/credentials';
|
|
12
|
-
export * from './base/constants';
|
|
13
|
-
export * from './base/project-builder';
|
|
14
|
-
export * from './base/abap/manifest-service';
|
|
15
|
-
export { writeKeyUserChanges } from './base/change-utils';
|
|
16
|
-
export { promptGeneratorInput, PromptDefaults } from './base/prompt';
|
|
17
|
-
export * from './preview/adp-preview';
|
|
18
|
-
export * from './writer/cf';
|
|
19
|
-
export * from './writer/manifest';
|
|
20
|
-
export * from './writer/writer-config';
|
|
21
|
-
export { generate, migrate } from './writer';
|
|
22
|
-
export { generateChange } from './writer/editors';
|
|
23
|
-
export { generateInboundConfig } from './writer/inbound-navigation';
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './prompts/index.js';
|
|
3
|
+
export * from './common/index.js';
|
|
4
|
+
export * from './abap/index.js';
|
|
5
|
+
export * from './source/index.js';
|
|
6
|
+
export * from './ui5/index.js';
|
|
7
|
+
export * from './base/cf.js';
|
|
8
|
+
export * from './cf/index.js';
|
|
9
|
+
export * from './btp/index.js';
|
|
10
|
+
export * from './base/helper.js';
|
|
11
|
+
export * from './base/credentials.js';
|
|
12
|
+
export * from './base/constants/index.js';
|
|
13
|
+
export * from './base/project-builder.js';
|
|
14
|
+
export * from './base/abap/manifest-service.js';
|
|
15
|
+
export { writeKeyUserChanges } from './base/change-utils.js';
|
|
16
|
+
export { promptGeneratorInput, type PromptDefaults } from './base/prompt.js';
|
|
17
|
+
export * from './preview/adp-preview.js';
|
|
18
|
+
export * from './writer/cf.js';
|
|
19
|
+
export * from './writer/manifest/index.js';
|
|
20
|
+
export * from './writer/writer-config.js';
|
|
21
|
+
export { generate, migrate } from './writer/index.js';
|
|
22
|
+
export { generateChange } from './writer/editors.js';
|
|
23
|
+
export { generateInboundConfig } from './writer/inbound-navigation.js';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,47 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
__exportStar(require("./base/cf"), exports);
|
|
25
|
-
__exportStar(require("./cf"), exports);
|
|
26
|
-
__exportStar(require("./btp"), exports);
|
|
27
|
-
__exportStar(require("./base/helper"), exports);
|
|
28
|
-
__exportStar(require("./base/credentials"), exports);
|
|
29
|
-
__exportStar(require("./base/constants"), exports);
|
|
30
|
-
__exportStar(require("./base/project-builder"), exports);
|
|
31
|
-
__exportStar(require("./base/abap/manifest-service"), exports);
|
|
32
|
-
var change_utils_1 = require("./base/change-utils");
|
|
33
|
-
Object.defineProperty(exports, "writeKeyUserChanges", { enumerable: true, get: function () { return change_utils_1.writeKeyUserChanges; } });
|
|
34
|
-
var prompt_1 = require("./base/prompt");
|
|
35
|
-
Object.defineProperty(exports, "promptGeneratorInput", { enumerable: true, get: function () { return prompt_1.promptGeneratorInput; } });
|
|
36
|
-
__exportStar(require("./preview/adp-preview"), exports);
|
|
37
|
-
__exportStar(require("./writer/cf"), exports);
|
|
38
|
-
__exportStar(require("./writer/manifest"), exports);
|
|
39
|
-
__exportStar(require("./writer/writer-config"), exports);
|
|
40
|
-
var writer_1 = require("./writer");
|
|
41
|
-
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return writer_1.generate; } });
|
|
42
|
-
Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return writer_1.migrate; } });
|
|
43
|
-
var editors_1 = require("./writer/editors");
|
|
44
|
-
Object.defineProperty(exports, "generateChange", { enumerable: true, get: function () { return editors_1.generateChange; } });
|
|
45
|
-
var inbound_navigation_1 = require("./writer/inbound-navigation");
|
|
46
|
-
Object.defineProperty(exports, "generateInboundConfig", { enumerable: true, get: function () { return inbound_navigation_1.generateInboundConfig; } });
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './prompts/index.js';
|
|
3
|
+
export * from './common/index.js';
|
|
4
|
+
export * from './abap/index.js';
|
|
5
|
+
export * from './source/index.js';
|
|
6
|
+
export * from './ui5/index.js';
|
|
7
|
+
export * from './base/cf.js';
|
|
8
|
+
export * from './cf/index.js';
|
|
9
|
+
export * from './btp/index.js';
|
|
10
|
+
export * from './base/helper.js';
|
|
11
|
+
export * from './base/credentials.js';
|
|
12
|
+
export * from './base/constants/index.js';
|
|
13
|
+
export * from './base/project-builder.js';
|
|
14
|
+
export * from './base/abap/manifest-service.js';
|
|
15
|
+
export { writeKeyUserChanges } from './base/change-utils.js';
|
|
16
|
+
export { promptGeneratorInput } from './base/prompt.js';
|
|
17
|
+
export * from './preview/adp-preview.js';
|
|
18
|
+
export * from './writer/cf.js';
|
|
19
|
+
export * from './writer/manifest/index.js';
|
|
20
|
+
export * from './writer/writer-config.js';
|
|
21
|
+
export { generate, migrate } from './writer/index.js';
|
|
22
|
+
export { generateChange } from './writer/editors.js';
|
|
23
|
+
export { generateInboundConfig } from './writer/inbound-navigation.js';
|
|
47
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,7 +4,7 @@ import type { NextFunction, Request, Response, Router } from 'express';
|
|
|
4
4
|
import type { Logger, ToolsLogger } from '@sap-ux/logger';
|
|
5
5
|
import type { UI5FlexLayer } from '@sap-ux/project-access';
|
|
6
6
|
import type { AbapServiceProvider, AdaptationProjectType, MergedAppDescriptor } from '@sap-ux/axios-extension';
|
|
7
|
-
import type { AdpPreviewConfig, CommonChangeProperties, DescriptorVariant, OperationType, CommonAdditionalChangeInfoProperties } from '../types';
|
|
7
|
+
import type { AdpPreviewConfig, CommonChangeProperties, DescriptorVariant, OperationType, CommonAdditionalChangeInfoProperties } from '../types.js';
|
|
8
8
|
import type { Editor } from 'mem-fs-editor';
|
|
9
9
|
declare global {
|
|
10
10
|
var __SAP_UX_MANIFEST_SYNC_REQUIRED__: boolean | undefined;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import ZipFile from 'adm-zip';
|
|
2
|
+
import { createAbapServiceProvider } from '@sap-ux/system-access';
|
|
3
|
+
import RoutesHandler from './routes-handler.js';
|
|
4
|
+
import OvpRoutesHandler from './ovp-routes-handler.js';
|
|
5
|
+
import { addAnnotationFile, addXmlFragment, isAddAnnotationChange, isAddXMLChange, isCodeExtChange, addControllerExtension, moduleNameContentMap, tryFixChange, isV4DescriptorChange } from './change-handler.js';
|
|
6
|
+
import { addCustomFragment } from './descriptor-change-handler.js';
|
|
7
|
+
import { getExistingAdpProjectType } from '../base/helper.js';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
export var ApiRoutes;
|
|
10
|
+
(function (ApiRoutes) {
|
|
11
|
+
ApiRoutes["FRAGMENT"] = "/adp/api/fragment";
|
|
12
|
+
ApiRoutes["CONTROLLER"] = "/adp/api/controller";
|
|
13
|
+
ApiRoutes["CODE_EXT"] = "/adp/api/code_ext";
|
|
14
|
+
ApiRoutes["ANNOTATION"] = "/adp/api/annotation";
|
|
15
|
+
ApiRoutes["OVP_DATA_SOURCES"] = "/adp/api/ovp/datasources";
|
|
16
|
+
ApiRoutes["OVP_METAMODEL"] = "/adp/api/ovp/metamodel";
|
|
17
|
+
})(ApiRoutes || (ApiRoutes = {}));
|
|
15
18
|
/**
|
|
16
19
|
* Instance of an adaptation project handling requests and data transformation.
|
|
17
20
|
*/
|
|
18
|
-
class AdpPreview {
|
|
21
|
+
export class AdpPreview {
|
|
19
22
|
config;
|
|
20
23
|
project;
|
|
21
24
|
util;
|
|
@@ -111,13 +114,13 @@ class AdpPreview {
|
|
|
111
114
|
return this.initCfBuildMode(descriptorVariant);
|
|
112
115
|
}
|
|
113
116
|
this.descriptorVariantId = descriptorVariant.id;
|
|
114
|
-
this.provider = await
|
|
115
|
-
this.routesHandler = new
|
|
116
|
-
this.ovpRoutesHandler = new
|
|
117
|
+
this.provider = await createAbapServiceProvider(this.config.target, { ignoreCertErrors: this.config.ignoreCertErrors }, true, this.logger);
|
|
118
|
+
this.routesHandler = new RoutesHandler(this.project, this.util, this.provider, this.logger);
|
|
119
|
+
this.ovpRoutesHandler = new OvpRoutesHandler(this.provider, this.logger);
|
|
117
120
|
this.lrep = this.provider.getLayeredRepository();
|
|
118
121
|
// fetch a merged descriptor from the backend
|
|
119
122
|
await this.lrep.getCsrfToken();
|
|
120
|
-
this.projectTypeValue = await
|
|
123
|
+
this.projectTypeValue = await getExistingAdpProjectType(path.resolve());
|
|
121
124
|
await this.sync();
|
|
122
125
|
return descriptorVariant.layer;
|
|
123
126
|
}
|
|
@@ -130,7 +133,7 @@ class AdpPreview {
|
|
|
130
133
|
async initCfBuildMode(descriptorVariant) {
|
|
131
134
|
this.descriptorVariantId = descriptorVariant.id;
|
|
132
135
|
this.projectTypeValue = undefined;
|
|
133
|
-
this.routesHandler = new
|
|
136
|
+
this.routesHandler = new RoutesHandler(this.project, this.util, {}, this.logger);
|
|
134
137
|
return descriptorVariant.layer;
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
@@ -147,7 +150,7 @@ class AdpPreview {
|
|
|
147
150
|
if (!this.lrep || !this.descriptorVariantId) {
|
|
148
151
|
throw new Error('Not initialized');
|
|
149
152
|
}
|
|
150
|
-
const zip = new
|
|
153
|
+
const zip = new ZipFile();
|
|
151
154
|
const files = await this.project.byGlob('**/*.*');
|
|
152
155
|
for (const file of files) {
|
|
153
156
|
zip.addFile(file.getPath().substring(1), await file.getBuffer());
|
|
@@ -212,14 +215,14 @@ class AdpPreview {
|
|
|
212
215
|
* @returns {void} A promise that resolves when the APIs have been added.
|
|
213
216
|
*/
|
|
214
217
|
addApis(router) {
|
|
215
|
-
router.get(
|
|
216
|
-
router.get(
|
|
217
|
-
router.post(
|
|
218
|
-
router.get(
|
|
219
|
-
router.get(
|
|
218
|
+
router.get(ApiRoutes.FRAGMENT, this.routesHandler.handleReadAllFragments);
|
|
219
|
+
router.get(ApiRoutes.CONTROLLER, this.routesHandler.handleReadAllControllers);
|
|
220
|
+
router.post(ApiRoutes.CONTROLLER, this.routesHandler.handleWriteControllerExt);
|
|
221
|
+
router.get(ApiRoutes.CODE_EXT, this.routesHandler.handleGetControllerExtensionData);
|
|
222
|
+
router.get(ApiRoutes.ANNOTATION, this.routesHandler.handleGetAllAnnotationFilesMappedByDataSource);
|
|
220
223
|
if (this.ovpRoutesHandler) {
|
|
221
|
-
router.get(
|
|
222
|
-
router.post(
|
|
224
|
+
router.get(ApiRoutes.OVP_DATA_SOURCES, this.ovpRoutesHandler.handleGetDataSources);
|
|
225
|
+
router.post(ApiRoutes.OVP_METAMODEL, this.ovpRoutesHandler.handleGetMetaModel);
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
/**
|
|
@@ -235,22 +238,22 @@ class AdpPreview {
|
|
|
235
238
|
async onChangeRequest(type, change, fs, logger, additionalChangeInfo) {
|
|
236
239
|
switch (type) {
|
|
237
240
|
case 'read':
|
|
238
|
-
if (
|
|
239
|
-
|
|
241
|
+
if (moduleNameContentMap[change.changeType] && !change.moduleName) {
|
|
242
|
+
tryFixChange(change, logger);
|
|
240
243
|
}
|
|
241
244
|
break;
|
|
242
245
|
case 'write':
|
|
243
|
-
if (
|
|
244
|
-
|
|
246
|
+
if (isAddXMLChange(change)) {
|
|
247
|
+
addXmlFragment(this.util.getProject().getSourcePath(), change, fs, logger, additionalChangeInfo);
|
|
245
248
|
}
|
|
246
|
-
if (
|
|
247
|
-
await
|
|
249
|
+
if (isCodeExtChange(change)) {
|
|
250
|
+
await addControllerExtension(this.util.getProject().getRootPath(), this.util.getProject().getSourcePath(), change, fs, logger);
|
|
248
251
|
}
|
|
249
|
-
if (
|
|
250
|
-
await
|
|
252
|
+
if (isAddAnnotationChange(change)) {
|
|
253
|
+
await addAnnotationFile(this.util.getProject().getSourcePath(), this.util.getProject().getRootPath(), change, fs, logger, this.provider);
|
|
251
254
|
}
|
|
252
|
-
if (
|
|
253
|
-
|
|
255
|
+
if (isV4DescriptorChange(change)) {
|
|
256
|
+
addCustomFragment(this.util.getProject().getSourcePath(), change, fs, logger);
|
|
254
257
|
}
|
|
255
258
|
break;
|
|
256
259
|
default:
|
|
@@ -259,5 +262,4 @@ class AdpPreview {
|
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
264
|
}
|
|
262
|
-
exports.AdpPreview = AdpPreview;
|
|
263
265
|
//# sourceMappingURL=adp-preview.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { AddXMLChange, CommonChangeProperties, CodeExtChange, AnnotationFileChange, CommonAdditionalChangeInfoProperties, AppDescriptorV4Change } from '../types';
|
|
2
|
+
import type { AddXMLChange, CommonChangeProperties, CodeExtChange, AnnotationFileChange, CommonAdditionalChangeInfoProperties, AppDescriptorV4Change } from '../types.js';
|
|
3
3
|
import type { Logger } from '@sap-ux/logger';
|
|
4
4
|
import type { AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
5
5
|
interface FragmentTemplateConfig<T = {
|