@sap-ux/repo-app-import-sub-generator 0.1.1 → 0.1.3
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.
|
@@ -7,7 +7,7 @@ const i18n_1 = require("../utils/i18n");
|
|
|
7
7
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
8
8
|
const prompt_state_1 = require("./prompt-state");
|
|
9
9
|
const prompt_helpers_1 = require("./prompt-helpers");
|
|
10
|
-
const
|
|
10
|
+
const validators_1 = require("../utils/validators");
|
|
11
11
|
/**
|
|
12
12
|
* Gets the target folder selection prompt.
|
|
13
13
|
*
|
|
@@ -75,29 +75,7 @@ async function getPrompts(appRootPath, quickDeployedAppConfig) {
|
|
|
75
75
|
},
|
|
76
76
|
message: (0, i18n_1.t)('prompts.appSelection.message'),
|
|
77
77
|
choices: () => (appList.length ? (0, prompt_helpers_1.formatAppChoices)(appList) : []),
|
|
78
|
-
validate: async (answers) =>
|
|
79
|
-
// Quick deploy config exists but no apps found
|
|
80
|
-
if (quickDeployedAppConfig?.appId && appList.length === 0) {
|
|
81
|
-
return (0, i18n_1.t)('error.quickDeployedAppDownloadErrors.noAppsFound', {
|
|
82
|
-
appId: quickDeployedAppConfig.appId
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
// No apps available at all
|
|
86
|
-
if (appList.length === 0) {
|
|
87
|
-
return (0, i18n_1.t)('prompts.appSelection.noAppsDeployed');
|
|
88
|
-
}
|
|
89
|
-
// Valid app selected, try to download
|
|
90
|
-
if (answers?.appId) {
|
|
91
|
-
try {
|
|
92
|
-
await (0, download_utils_1.downloadApp)(answers.repoName);
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
return (0, i18n_1.t)('error.appDownloadErrors.appDownloadFailure', { error: error.message });
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
78
|
+
validate: async (answers) => (0, validators_1.validateAppSelection)(answers, appList, quickDeployedAppConfig)
|
|
101
79
|
}
|
|
102
80
|
];
|
|
103
81
|
const targetFolderPrompts = getTargetFolderPrompt(appRootPath, quickDeployedAppConfig?.appId);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"appConfigGenError": "Error generating application configuration: {{- error}}",
|
|
10
10
|
"endPhase": "Error in end phase: {{- error}}",
|
|
11
11
|
"errorProcessingJsonFile": "Error processing JSON file: {{- error}}",
|
|
12
|
+
"noAppsDeployed": "No applications deployed to this system can be downloaded.",
|
|
12
13
|
"validationErrors": {
|
|
13
14
|
"invalidMetadataPackage": "Invalid or missing package in metadata",
|
|
14
15
|
"invalidServiceName": "Invalid or missing serviceName in serviceBindingDetails",
|
|
@@ -37,9 +38,6 @@
|
|
|
37
38
|
"sapAppNotDefined": "Error: sap.app not defined in the manifest file",
|
|
38
39
|
"sourceTemplateNotSupported": "Error: Source template not supported",
|
|
39
40
|
"invalidManifestStructureError": "Invalid manifest structure: 'sap.ui5' or 'sap.app' are missing."
|
|
40
|
-
},
|
|
41
|
-
"quickDeployedAppDownloadErrors": {
|
|
42
|
-
"noAppsFound": "No application with id {{ appId }} found in the system. Please check if the application is deployed correctly or select another app"
|
|
43
41
|
}
|
|
44
42
|
},
|
|
45
43
|
"warn": {
|
|
@@ -49,8 +47,7 @@
|
|
|
49
47
|
"appSelection": {
|
|
50
48
|
"message": "App",
|
|
51
49
|
"hint": "Select the app to download",
|
|
52
|
-
"breadcrumb": "App"
|
|
53
|
-
"noAppsDeployed": "No applications deployed to this system can be downloaded. {{- help}}"
|
|
50
|
+
"breadcrumb": "App"
|
|
54
51
|
},
|
|
55
52
|
"targetPath": {
|
|
56
53
|
"message": "Project folder path",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppIndex } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { ValidationLink } from '@sap-ux/inquirer-common';
|
|
3
|
+
import type { AppInfo, QuickDeployedAppConfig, QfaJsonConfig } from '../app/types';
|
|
2
4
|
/**
|
|
3
5
|
* Validates the entire app configuration.
|
|
4
6
|
*
|
|
@@ -14,4 +16,13 @@ export declare const validateQfaJsonFile: (config: QfaJsonConfig) => boolean;
|
|
|
14
16
|
* @returns {boolean} - Returns true if the prompt state is valid, false otherwise.
|
|
15
17
|
*/
|
|
16
18
|
export declare const isValidPromptState: (targetFolder: string, appId?: string) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Validates the app selection and handles app download if applicable.
|
|
21
|
+
*
|
|
22
|
+
* @param answers - The selected app information.
|
|
23
|
+
* @param appList - The list of available apps.
|
|
24
|
+
* @param quickDeployedAppConfig - The quick deployed app configuration.
|
|
25
|
+
* @returns A promise resolving to a boolean or a validation error message.
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateAppSelection(answers: AppInfo, appList: AppIndex, quickDeployedAppConfig?: QuickDeployedAppConfig): Promise<string | boolean | ValidationLink>;
|
|
17
28
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -3,10 +3,13 @@ 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.isValidPromptState = exports.validateQfaJsonFile = void 0;
|
|
6
|
+
exports.validateAppSelection = exports.isValidPromptState = exports.validateQfaJsonFile = void 0;
|
|
7
7
|
const i18n_1 = require("../utils/i18n");
|
|
8
8
|
const logger_1 = __importDefault(require("../utils/logger"));
|
|
9
9
|
const prompt_state_1 = require("../prompts/prompt-state");
|
|
10
|
+
const guided_answers_helper_1 = require("@sap-ux/guided-answers-helper");
|
|
11
|
+
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
12
|
+
const download_utils_1 = require("../utils/download-utils");
|
|
10
13
|
/**
|
|
11
14
|
* Validates the metadata section of the app configuration.
|
|
12
15
|
*
|
|
@@ -91,4 +94,42 @@ const isValidPromptState = (targetFolder, appId) => {
|
|
|
91
94
|
return !!(prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider && appId && targetFolder);
|
|
92
95
|
};
|
|
93
96
|
exports.isValidPromptState = isValidPromptState;
|
|
97
|
+
/**
|
|
98
|
+
* Generates a help link for the "App Not Found" error.
|
|
99
|
+
*
|
|
100
|
+
* @returns {Promise<ValidationLink>} - A promise resolving to a validation link for the error.
|
|
101
|
+
*/
|
|
102
|
+
async function generateAppNotFoundHelpLink() {
|
|
103
|
+
return inquirer_common_1.ErrorHandler.getHelpLink(guided_answers_helper_1.HELP_NODES.ADT_APP_NOT_FOUND_ERROR, inquirer_common_1.ERROR_TYPE.INTERNAL_SERVER_ERROR, (0, i18n_1.t)('error.noAppsDeployed'));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Validates the app selection and handles app download if applicable.
|
|
107
|
+
*
|
|
108
|
+
* @param answers - The selected app information.
|
|
109
|
+
* @param appList - The list of available apps.
|
|
110
|
+
* @param quickDeployedAppConfig - The quick deployed app configuration.
|
|
111
|
+
* @returns A promise resolving to a boolean or a validation error message.
|
|
112
|
+
*/
|
|
113
|
+
async function validateAppSelection(answers, appList, quickDeployedAppConfig) {
|
|
114
|
+
// Quick deploy config exists but no apps found
|
|
115
|
+
if (quickDeployedAppConfig?.appId && appList.length === 0) {
|
|
116
|
+
return await generateAppNotFoundHelpLink();
|
|
117
|
+
}
|
|
118
|
+
// No apps available at all
|
|
119
|
+
if (appList.length === 0) {
|
|
120
|
+
return await generateAppNotFoundHelpLink();
|
|
121
|
+
}
|
|
122
|
+
// Valid app selected, try to download
|
|
123
|
+
if (answers?.appId) {
|
|
124
|
+
try {
|
|
125
|
+
await (0, download_utils_1.downloadApp)(answers.repoName);
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
return (0, i18n_1.t)('error.appDownloadErrors.appDownloadFailure', { error: error.message });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
exports.validateAppSelection = validateAppSelection;
|
|
94
135
|
//# sourceMappingURL=validators.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/repo-app-import-sub-generator",
|
|
3
3
|
"description": "Generator to download LROP Fiori applications deployed from an ABAP repository.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -26,19 +26,20 @@
|
|
|
26
26
|
"yeoman-generator": "5.10.0",
|
|
27
27
|
"@sap-ux/feature-toggle": "0.2.3",
|
|
28
28
|
"@sap-ux/fiori-generator-shared": "0.10.2",
|
|
29
|
-
"@sap-ux/inquirer-common": "0.6.
|
|
29
|
+
"@sap-ux/inquirer-common": "0.6.36",
|
|
30
30
|
"@sap-ux/project-access": "1.29.18",
|
|
31
|
-
"@sap-ux/odata-service-inquirer": "2.2.
|
|
31
|
+
"@sap-ux/odata-service-inquirer": "2.2.36",
|
|
32
32
|
"@sap-ux/fiori-elements-writer": "2.1.40",
|
|
33
33
|
"@sap-ux/logger": "0.6.0",
|
|
34
|
-
"@sap-ux/project-input-validator": "0.5.
|
|
34
|
+
"@sap-ux/project-input-validator": "0.5.1",
|
|
35
35
|
"@sap-ux/launch-config": "0.8.1",
|
|
36
36
|
"@sap-ux/fiori-tools-settings": "0.1.0",
|
|
37
37
|
"@sap-ux/abap-deploy-config-writer": "0.0.103",
|
|
38
38
|
"@sap-ux/btp-utils": "1.0.3",
|
|
39
39
|
"@sap-ux/ui5-info": "0.9.1",
|
|
40
40
|
"@sap-ux/axios-extension": "1.20.0",
|
|
41
|
-
"@sap-ux/store": "1.0.0"
|
|
41
|
+
"@sap-ux/store": "1.0.0",
|
|
42
|
+
"@sap-ux/guided-answers-helper": "0.2.2"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@jest/types": "29.6.3",
|