@sap/adp-common
Advanced tools
Comparing version 1.1.51 to 1.1.52
@@ -6,3 +6,4 @@ export declare enum ChangeTypes { | ||
CHANGE_DATA_SOURCE = "appdescr_app_changeDataSource", | ||
ADD_COMPONENT_USAGE_LIBRARY_REFERENCE = "appdescr_ui5_addLibraries" | ||
ADD_COMPONENT_USAGE_LIBRARY_REFERENCE = "appdescr_ui5_addLibraries", | ||
ADD_INBOUND_CHANGE = "appdescr_app_changeInbound" | ||
} |
@@ -11,3 +11,4 @@ "use strict"; | ||
ChangeTypes["ADD_COMPONENT_USAGE_LIBRARY_REFERENCE"] = "appdescr_ui5_addLibraries"; | ||
ChangeTypes["ADD_INBOUND_CHANGE"] = "appdescr_app_changeInbound"; | ||
})(ChangeTypes = exports.ChangeTypes || (exports.ChangeTypes = {})); | ||
//# sourceMappingURL=ChangeTypes.js.map |
@@ -6,3 +6,4 @@ export declare enum GeneratorTypes { | ||
CHANGE_DATA_SOURCE = 3, | ||
CREATION = 4 | ||
CREATION = 4, | ||
CHANGE_INBOUND = 5 | ||
} |
@@ -11,3 +11,4 @@ "use strict"; | ||
GeneratorTypes[GeneratorTypes["CREATION"] = 4] = "CREATION"; | ||
GeneratorTypes[GeneratorTypes["CHANGE_INBOUND"] = 5] = "CHANGE_INBOUND"; | ||
})(GeneratorTypes = exports.GeneratorTypes || (exports.GeneratorTypes = {})); | ||
//# sourceMappingURL=GeneratorTypes.js.map |
@@ -5,1 +5,4 @@ export { ApplicationType } from "./ApplicationType"; | ||
export { GeneratorTypes } from "./GeneratorTypes"; | ||
export { EnvironmentType } from "./EnvironmentType"; | ||
export { FlpConfigurationType } from "./FlpConfigurationType"; | ||
export { ProjectType } from "./ProjectType"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GeneratorTypes = exports.ChangeTypes = exports.AnnotationFileSelectType = exports.ApplicationType = void 0; | ||
exports.ProjectType = exports.FlpConfigurationType = exports.EnvironmentType = exports.GeneratorTypes = exports.ChangeTypes = exports.AnnotationFileSelectType = exports.ApplicationType = void 0; | ||
var ApplicationType_1 = require("./ApplicationType"); | ||
@@ -12,2 +12,8 @@ Object.defineProperty(exports, "ApplicationType", { enumerable: true, get: function () { return ApplicationType_1.ApplicationType; } }); | ||
Object.defineProperty(exports, "GeneratorTypes", { enumerable: true, get: function () { return GeneratorTypes_1.GeneratorTypes; } }); | ||
var EnvironmentType_1 = require("./EnvironmentType"); | ||
Object.defineProperty(exports, "EnvironmentType", { enumerable: true, get: function () { return EnvironmentType_1.EnvironmentType; } }); | ||
var FlpConfigurationType_1 = require("./FlpConfigurationType"); | ||
Object.defineProperty(exports, "FlpConfigurationType", { enumerable: true, get: function () { return FlpConfigurationType_1.FlpConfigurationType; } }); | ||
var ProjectType_1 = require("./ProjectType"); | ||
Object.defineProperty(exports, "ProjectType", { enumerable: true, get: function () { return ProjectType_1.ProjectType; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -9,2 +9,4 @@ export declare const Messages: { | ||
CLOUD_FOUNDRY: string; | ||
S4HANA_CLOUD: string; | ||
DESTINATION: string; | ||
ORGANIZATION: string; | ||
@@ -25,2 +27,27 @@ ENDPOINT_API: string; | ||
CONFIGURATION_STEP: string; | ||
/** | ||
* FLP Configuration | ||
*/ | ||
FLP_CONFIGURATION_TYPE_LABEL: (flpConfigurationType: string) => string; | ||
FLP_CONFIGURATION: string; | ||
FLP_ADD_NEW_TILE: string; | ||
FLP_REPLACE_EXISTING_TILE: string; | ||
DEPLOY_CONFIG_LABEL: string; | ||
FLP_CONFIGURATION_STEP: string; | ||
FLP_CONFIGURATION_STEP_DESCRIPTION: string; | ||
DEPLOY_CONFIG_STET: string; | ||
DEPLOY_CONFIG_STEP_DESCRIPTION: string; | ||
FLP_TITLE_INFO: string; | ||
FLP_SUBTITLE_INFO: string; | ||
FLP_ICON_INFO: string; | ||
FLP_TITLE_LABEL: string; | ||
FLP_SUBTITLE_LABEL: string; | ||
FLP_ACTION_LABEL: string; | ||
FLP_ICON_LABEL: string; | ||
FLP_PARAMETERS: string; | ||
FLP_PARAMETERS_INFO: (fioriID: string) => string; | ||
SAPUI5_ABAP_REPOSITORY_LABEL: string; | ||
DEPLOY_CONFIG_DESCRIPTION_LABEL: string; | ||
DEPLOY_CONFIG_PACKAGE_LABEL: string; | ||
DEPLOY_CONFIG_TRANSPORT_REQUEST_LABEL: string; | ||
PROJECT_NAME_INTERNAL_PROMPT_LABEL: string; | ||
@@ -36,2 +63,5 @@ PROJECT_NAME_EXTERNAL_PROMPT_LABEL: string; | ||
SYSTEM_PROMPT_LABEL: string; | ||
PROJECT_TYPE_LABEL: string; | ||
PROJECT_TYPE: string; | ||
PROJECT_TYPE_INFO_LABEL: (projectType: string) => string; | ||
SYSTEM_CLIENT_PROMPT_LABEL: string; | ||
@@ -82,2 +112,8 @@ SYSTEM_CLIENT_MANDATORY_ERROR: string; | ||
BUSINESS_SOLUTION_LABEL: string; | ||
INBOUND_ID_LABEL: string; | ||
SEMANTIC_OBJECT_LABEL: string; | ||
PROPERTY_PATH_LABEL: string; | ||
PARAMETER_NAME_LABEL: string; | ||
PROPERTY_VALUE_TYPE_LABEL: string; | ||
PROPERTY_VALUE_LABEL: string; | ||
CANNOT_RECIEVE_TOKEN_ERROR_MSG: string; | ||
@@ -120,2 +156,3 @@ LOGIN_FAILED_MSG: string; | ||
NOT_ABAP_SYSTEM: string; | ||
ADVANCED_MODE_WARNING_TEXT: string; | ||
SAFE_MODE_INFO: string; | ||
@@ -135,2 +172,7 @@ SAFE_MODE_LABEL: string; | ||
PROJECT_NAME_TOOLTIP: (isInternalMode: boolean, isCfMode: boolean) => string; | ||
INBOUND_ID_TOOLTIP: string; | ||
PROPERTY_PATH_TOOLTIP: string; | ||
PARAMETER_PATH_TOOLTIP: string; | ||
PROPERTY_VALUE_TYPE_TOOLTIP: string; | ||
PROPERTY_VALUE_TOOLTIP: string; | ||
TARGET_ENV_TOOLTIP: string; | ||
@@ -237,2 +279,6 @@ APPLICATION_TITLE_TOOLTIP: string; | ||
ERROR_INPUT_INVALID_VALUE: (input: string) => string; | ||
ERROR_BINDING_IS_IN_INCORRECT_FORMAT: string; | ||
ERROR_OBJECT_IS_IN_INCORRECT_FORMAT: string; | ||
ERROR_NUMBER_IS_IN_INCORRECT_FORMAT: string; | ||
ERROR_BOOLEAN_IS_IN_INCORRECT_FORMAT: string; | ||
ERROR_DUPLICATED_VALUE: (component: string) => string; | ||
@@ -243,4 +289,9 @@ ERROR_EXISTING_ANNOTATION_FILE: string; | ||
ERROR_INVALID_VALUE_FOR_SPECIAL_CHARACTERS: (input: string) => string; | ||
ERROR_SEMANTIC_OBJECT_INVALID_CHARACTERS_ERROR_MESSAGE: (input: string) => string; | ||
CANNOT_LOAD_SYSTEMS: string; | ||
DUPLICATE_NAME_VALIDATION_ERROR: (input1: string, input2: string) => string; | ||
ERROR_FLP_MISSING_PROPERTY: string; | ||
ERROR_INVALID_FLP_PRIORITY: string; | ||
INVALID_SAPUI5_ABAP_REPOSITORY: string; | ||
ERROR_INVALID_FLP_PARAMS: string; | ||
}; |
@@ -13,2 +13,4 @@ "use strict"; | ||
CLOUD_FOUNDRY: "CF", | ||
S4HANA_CLOUD: "S4HANACLOUD", | ||
DESTINATION: "Destination", | ||
ORGANIZATION: "Organization", | ||
@@ -29,2 +31,31 @@ ENDPOINT_API: "CF API endpoint URL", | ||
CONFIGURATION_STEP: "Adaptation Project - Configuration", | ||
/** | ||
* FLP Configuration | ||
*/ | ||
FLP_CONFIGURATION_TYPE_LABEL: (flpConfigurationType) => `Selected FLP Configuration type is: ${flpConfigurationType}`, | ||
FLP_CONFIGURATION: "FLP configuration", | ||
FLP_ADD_NEW_TILE: "Add new tile", | ||
FLP_REPLACE_EXISTING_TILE: "Replace the existing app tile", | ||
DEPLOY_CONFIG_LABEL: "Add Deployment configuration?", | ||
FLP_CONFIGURATION_STEP: "Fiori Launchpad Configuration", | ||
FLP_CONFIGURATION_STEP_DESCRIPTION: "Configure Fiori Launchpad Settings", | ||
DEPLOY_CONFIG_STET: "Deployment Configuration", | ||
DEPLOY_CONFIG_STEP_DESCRIPTION: "Configure Deployment Settings", | ||
// FLP Info | ||
FLP_TITLE_INFO: "Enter title for your FLP configuration", | ||
FLP_SUBTITLE_INFO: "Enter subtitle for your FLP configuration", | ||
FLP_ICON_INFO: "Enter icon path for your FLP configuration", | ||
// FLP Labels | ||
FLP_TITLE_LABEL: "Title", | ||
FLP_SUBTITLE_LABEL: "Subtitle", | ||
FLP_ACTION_LABEL: "Action", | ||
FLP_ICON_LABEL: "Icon", | ||
FLP_PARAMETERS: "Parameters", | ||
FLP_PARAMETERS_INFO: (fioriID) => `Original application target mapping and the default parameters can be found in Fiori reference library under Implementation Information -> Configuration -> Target Mapping(s) | ||
https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/${fioriID ? `index.html?appId=${fioriID}&releaseGroupTextCombined=SC` : "#/home"}`, | ||
// Deploy config Labels | ||
SAPUI5_ABAP_REPOSITORY_LABEL: "SAPUI5 ABAP Repository", | ||
DEPLOY_CONFIG_DESCRIPTION_LABEL: "Deployment description", | ||
DEPLOY_CONFIG_PACKAGE_LABEL: "Package", | ||
DEPLOY_CONFIG_TRANSPORT_REQUEST_LABEL: "Transport request", | ||
PROJECT_NAME_INTERNAL_PROMPT_LABEL: "Project Name", | ||
@@ -40,2 +71,5 @@ PROJECT_NAME_EXTERNAL_PROMPT_LABEL: "Project Name", | ||
SYSTEM_PROMPT_LABEL: "Select System", | ||
PROJECT_TYPE_LABEL: "Select Project Type", | ||
PROJECT_TYPE: "Project Type", | ||
PROJECT_TYPE_INFO_LABEL: (projectType) => `The only available project type from the selected system is: ${projectType}.`, | ||
SYSTEM_CLIENT_PROMPT_LABEL: "System client", | ||
@@ -86,2 +120,8 @@ SYSTEM_CLIENT_MANDATORY_ERROR: "System client can contain only digits.", | ||
BUSINESS_SOLUTION_LABEL: "Enter a unique name for the business solution of the project", | ||
INBOUND_ID_LABEL: "Inbound ID", | ||
SEMANTIC_OBJECT_LABEL: "Semantic Object", | ||
PROPERTY_PATH_LABEL: "Property Path", | ||
PARAMETER_NAME_LABEL: "Parameter Name", | ||
PROPERTY_VALUE_TYPE_LABEL: "Property Value Type", | ||
PROPERTY_VALUE_LABEL: "Property Value", | ||
CANNOT_RECIEVE_TOKEN_ERROR_MSG: "Cannot receive token.", | ||
@@ -124,2 +164,3 @@ LOGIN_FAILED_MSG: "Login failed.", | ||
NOT_ABAP_SYSTEM: "The system that you have selected is not an ABAP On-Premise system. Adaptation Project is supported only on such systems, so please choose ABAP On-Premise system.", | ||
ADVANCED_MODE_WARNING_TEXT: "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.", | ||
SAFE_MODE_INFO: "Safe Mode provides less freestyle capabilities, but allows your project to stay fully compatible with future upgrades of the source application. You will be able to turn it off later during development, if needed.", | ||
@@ -145,2 +186,7 @@ SAFE_MODE_LABEL: "Enable Safe Mode?", | ||
}, | ||
INBOUND_ID_TOOLTIP: "Enter the Id of the inbound that you want to change", | ||
PROPERTY_PATH_TOOLTIP: "Enter the path of the property of the inbound that you want to change", | ||
PARAMETER_PATH_TOOLTIP: "Enter the name of the parameter", | ||
PROPERTY_VALUE_TYPE_TOOLTIP: "Select the type of the value you want to enter", | ||
PROPERTY_VALUE_TOOLTIP: "Enter the value of the property that you want to set", | ||
TARGET_ENV_TOOLTIP: "Select the target environment for your Adaptation Project", | ||
@@ -247,2 +293,6 @@ APPLICATION_TITLE_TOOLTIP: "Enter an application title for your application variant", | ||
ERROR_INPUT_INVALID_VALUE: (input) => `Invalid ${input}`, | ||
ERROR_BINDING_IS_IN_INCORRECT_FORMAT: "Binding is in inccorect format (e.g. {{value}} )", | ||
ERROR_OBJECT_IS_IN_INCORRECT_FORMAT: 'Object is in incorrect format (e.g. { "key": "value" } )', | ||
ERROR_NUMBER_IS_IN_INCORRECT_FORMAT: "Number is in inccorect format (e.g. 5 )", | ||
ERROR_BOOLEAN_IS_IN_INCORRECT_FORMAT: "Boolean is in inccorect format (e.g. false | true )", | ||
ERROR_DUPLICATED_VALUE: (component) => `${component} with the same name was already added to the project`, | ||
@@ -253,5 +303,10 @@ ERROR_EXISTING_ANNOTATION_FILE: "There is already an annotation file with the same name, please choose another file or rename the file and select it again", | ||
ERROR_INVALID_VALUE_FOR_SPECIAL_CHARACTERS: (input) => `${input} must contain only Latin alphanumeric characters or the following symbols: "-","_","$" and "."`, | ||
ERROR_SEMANTIC_OBJECT_INVALID_CHARACTERS_ERROR_MESSAGE: (input) => `${input} must contain only Latin alphanumeric characters or the following symbols: "_" and "."`, | ||
CANNOT_LOAD_SYSTEMS: "Cannot load systems!", | ||
DUPLICATE_NAME_VALIDATION_ERROR: (input1, input2) => `${input1} must be different from ${input2}` | ||
DUPLICATE_NAME_VALIDATION_ERROR: (input1, input2) => `${input1} must be different from ${input2}`, | ||
ERROR_FLP_MISSING_PROPERTY: "You have to enter value for at least one property to be changed.", | ||
ERROR_INVALID_FLP_PRIORITY: "Invalid Priority. Priority should contains only digits.", | ||
INVALID_SAPUI5_ABAP_REPOSITORY: "SAPUI5 ABAP Repository name cannot contain more than 15 characters and should contain only alphanumerical characters and '_'", | ||
ERROR_INVALID_FLP_PARAMS: "The key+value set has been entered incorrectly." | ||
}; | ||
//# sourceMappingURL=messages.js.map |
import Generator = require("yeoman-generator"); | ||
import { AnnotationFileSelectType } from "../enums/AnnotationFileSelectType"; | ||
import { FlpConfigurationType } from "../enums"; | ||
export interface ServiceResponseResult { | ||
@@ -34,2 +35,8 @@ status: number; | ||
ui5VersionPath: string; | ||
isRunningInBAS: boolean; | ||
isCloudProject: boolean; | ||
flp?: { | ||
flpTitle: string; | ||
flpSubtitle: string; | ||
}; | ||
} | ||
@@ -157,2 +164,47 @@ export interface BaseApp { | ||
} | ||
export interface InboundChangeContent { | ||
inboundId: string; | ||
entityPropertyChange: InboundChangeEntityPropertyChange[]; | ||
} | ||
export interface InboundChangeContentAddInboundId { | ||
inbound: { | ||
[inboundId: string]: AddInboundModel; | ||
}; | ||
} | ||
export interface AddInboundModel { | ||
semanticObject: string; | ||
action: string; | ||
title: string; | ||
subTitle?: string; | ||
signature: AddInboundSignitureModel; | ||
} | ||
export interface AddInboundSignitureModel { | ||
parameters: InboundParameters; | ||
additionalParameters: string; | ||
} | ||
export interface InboundParameters { | ||
[key: string]: any; | ||
"sap-appvar-id"?: any; | ||
"sap-priority"?: any; | ||
} | ||
export interface InboundChangeEntityPropertyChange { | ||
propertyPath: string; | ||
operation: string; | ||
propertyValue: any; | ||
} | ||
export interface InboundChange { | ||
inbound: { | ||
[key: string]: { | ||
semanticObject: string; | ||
action: string; | ||
icon: string; | ||
title: string; | ||
subTitle: string; | ||
signature: { | ||
parameters: any; | ||
additionalParameters: "allowed"; | ||
}; | ||
}; | ||
}; | ||
} | ||
export interface AdpConfig { | ||
@@ -238,2 +290,10 @@ sourceSystem?: string; | ||
} | ||
export declare type PopertyValueType = "boolean" | "number" | "string" | "binding" | "object"; | ||
export interface InboundChangeAnswers { | ||
inboundId: string; | ||
title?: PopertyValueType; | ||
subTitle?: PopertyValueType; | ||
icon?: PopertyValueType; | ||
isInSafeMode?: boolean; | ||
} | ||
export interface SubCredentials { | ||
@@ -331,2 +391,11 @@ username: string; | ||
} | ||
export interface FlpConfigurationAnswers { | ||
flpInboundId: string; | ||
flpConfigurationType: FlpConfigurationType; | ||
flpTitle: string; | ||
flpSubtitle?: string; | ||
flpParametersSemanticObject?: string; | ||
flpParametersAction?: string; | ||
flpParameterString?: string; | ||
} | ||
export interface ChangeDataSourceContent { | ||
@@ -368,2 +437,6 @@ dataSourceId: string; | ||
environment: string; | ||
safeMode: boolean; | ||
cfApiUrl?: string; | ||
cfOrganization?: string; | ||
cfSpace?: string; | ||
}; | ||
@@ -375,8 +448,47 @@ } | ||
export interface Server { | ||
customMiddleware: CustomMiddleWare[]; | ||
customMiddleware: CustomMiddleware[]; | ||
} | ||
export interface CustomMiddleWare { | ||
name: string; | ||
configuration: any; | ||
export interface CustomMiddleware { | ||
name: "fiori-tools-preview" | "fiori-tools-proxy"; | ||
afterMiddleware: string; | ||
} | ||
export interface MiddlewaresConfigurations { | ||
fioriPreviewConfig: FioriToolsPreviewConfiguration; | ||
fioriProxyConfig: FioriToolsProxyConfiguration; | ||
} | ||
export interface FioriToolsPreview extends CustomMiddleware { | ||
configuration: FioriToolsPreviewConfiguration; | ||
} | ||
export interface FioriToolsPreviewConfiguration { | ||
adp: { | ||
ignoreCertErrors: boolean; | ||
target: { | ||
destination: string; | ||
url: string; | ||
client: string; | ||
}; | ||
}; | ||
} | ||
export interface FioriToolsProxy extends CustomMiddleware { | ||
configuration: FioriToolsProxyConfiguration; | ||
} | ||
export interface FioriToolsProxyConfiguration { | ||
ignoreCertErrors: false; | ||
backend: { | ||
path: string; | ||
url: string; | ||
destination: string; | ||
client: string; | ||
}; | ||
ui5: { | ||
version: string; | ||
url: string; | ||
path: { | ||
[key: string]: string; | ||
}; | ||
}; | ||
options: { | ||
secure: boolean; | ||
xfwd: boolean; | ||
}; | ||
} |
@@ -27,4 +27,2 @@ export interface ProjectSettingsDestination { | ||
getSettings(): Promise<ProjectSettings>; | ||
setSettings(settings: ProjectSettings): Promise<void>; | ||
validateFileExists(configJsonPath: string): Promise<void>; | ||
} |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -38,6 +15,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = __importStar(require("fs-extra")); | ||
const path = __importStar(require("path")); | ||
const Workspace_1 = __importDefault(require("./Workspace")); | ||
const EnvironmentUtils_1 = require("./EnvironmentUtils"); | ||
const Workspace_1 = __importDefault(require("./Workspace")); | ||
class Configuration { | ||
@@ -52,4 +27,2 @@ constructor(projectPath) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const configJsonPath = EnvironmentUtils_1.EnvironmentUtils.isRunningInBAS() ? path.join(this.projectPath, ".adp", "config.json") : path.join(this.projectPath, "ui5.yaml"); | ||
yield this.validateFileExists(configJsonPath); | ||
const isInternalUsage = yield EnvironmentUtils_1.EnvironmentUtils.isInternalUsage(); | ||
@@ -65,4 +38,4 @@ const projectData = Workspace_1.default.project(this.projectPath); | ||
cfSpace: projectData === null || projectData === void 0 ? void 0 : projectData.cfSpace, | ||
isInternalUsage: isInternalUsage, | ||
sourceSystem: projectData.sourceSystem | ||
sourceSystem: projectData.sourceSystem, | ||
isInternalUsage | ||
}; | ||
@@ -72,18 +45,4 @@ return result; | ||
} | ||
setSettings(settings) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const configJsonPath = path.join(this.projectPath, ".adp", "config.json"); | ||
yield this.validateFileExists(configJsonPath); | ||
fs.writeFileSync(configJsonPath, JSON.stringify(settings, null, 4)); | ||
}); | ||
} | ||
validateFileExists(configJsonPath) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!(yield fs.pathExists(configJsonPath))) { | ||
throw new Error(`Unable to find configuration file at ${configJsonPath}!`); | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = Configuration; | ||
//# sourceMappingURL=Configuration.js.map |
@@ -54,4 +54,7 @@ "use strict"; | ||
} | ||
case "S4HANACLOUD": { | ||
return yield manifestABAP.get(projectData); | ||
} | ||
default: | ||
throw new Error("Incorrect enviromnent"); | ||
throw new Error("Incorrect environment"); | ||
} | ||
@@ -58,0 +61,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const versionPattern = /^[1-9]\.[0-9]{1,3}\.[0-9]{1,2}\.*/; | ||
const versionPattern = /^[1-9]\.\d{1,3}\.\d{1,2}\.*/; | ||
this.detectedVersion = !!(versionResponse === null || versionResponse === void 0 ? void 0 : versionResponse.data) && versionPattern.test(versionResponse === null || versionResponse === void 0 ? void 0 : versionResponse.data); | ||
@@ -247,3 +247,4 @@ this.systemVersion = this.detectedVersion ? versionResponse.data : undefined; | ||
// we should use the latest public version instead | ||
if (!this.isInternal && version.includes("snapshot")) { | ||
// in case S4HANACLOUD end is selected we are using the latest public version | ||
if (!version || (!this.isInternal && version.includes("snapshot"))) { | ||
return this.getLatestPublicVersion(); | ||
@@ -250,0 +251,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { AdpConfig, Project, AppdescrVariantManifest, ABAPConnectionManager, FDCService, UI5Yaml } from "../models"; | ||
import { AdpConfig, Project, AppdescrVariantManifest, ABAPConnectionManager, FDCService, UI5Yaml, CustomMiddleware, FioriToolsPreview, FioriToolsProxy } from "../models"; | ||
export default class Workspace { | ||
@@ -7,8 +7,24 @@ static project(projectPath: string): Project; | ||
static getAdpConfig(projectPath: string): AdpConfig; | ||
static writeAdpConfig(projectPath: string, config: AdpConfig): void; | ||
static updateAdpConfigSafeMode(projectPath: string): void; | ||
static getUI5Yaml(projectPath: string): UI5Yaml; | ||
static writeUI5Yaml(projectPath: string, data: UI5Yaml): void; | ||
static updateSafeMode(projectPath: string): void; | ||
static archive(folder: string, archive: string): Promise<void>; | ||
static deleteFile(folder: string, file: string): void; | ||
private static getConfigBAS; | ||
private static getConfigVSCODE; | ||
static isCloudProject(projectPath: string): boolean; | ||
private static getOldConfigBAS; | ||
private static checkUI5YamlExists; | ||
private static showErrorWithLink; | ||
private static getConfig; | ||
static updateYamlProperty(projectPath: string, propertyPath: string[], newValue: any): void; | ||
private static getMiddlewaresConfigurations; | ||
static isValidUI5Yaml(projectPath: string): boolean; | ||
private static assertProperties; | ||
static findMiddleware<T extends CustomMiddleware>(middlewareList: CustomMiddleware[], typeGuard: (middleware: CustomMiddleware) => middleware is T): T; | ||
static isFioriToolsPreview(middleware: CustomMiddleware): middleware is FioriToolsPreview; | ||
static isFioriToolsProxy(middleware: CustomMiddleware): middleware is FioriToolsProxy; | ||
private static parseFile; | ||
private static propertiesExist; | ||
static checkConfigExists(projectPath: string): boolean; | ||
} |
@@ -36,2 +36,3 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
const path = __importStar(require("path")); | ||
const yaml = __importStar(require("js-yaml")); | ||
@@ -42,11 +43,13 @@ const path_1 = require("path"); | ||
const EnvironmentUtils_1 = require("./EnvironmentUtils"); | ||
const vscode_1 = require("../vscode"); | ||
class Workspace { | ||
static project(projectPath) { | ||
try { | ||
const configExists = this.checkConfigExists(projectPath); | ||
const variant = this.getManifestAppdescrFile(projectPath); | ||
if (EnvironmentUtils_1.EnvironmentUtils.isRunningInBAS()) { | ||
return this.getConfigBAS(variant, projectPath); | ||
if (EnvironmentUtils_1.EnvironmentUtils.isRunningInBAS() && configExists) { | ||
return this.getOldConfigBAS(variant, projectPath); | ||
} | ||
else { | ||
return this.getConfigVSCODE(variant, projectPath); | ||
return this.getConfig(variant, projectPath); | ||
} | ||
@@ -65,7 +68,7 @@ } | ||
const isLogged = yield fdcService.isLoggedIn(); | ||
return Promise.resolve(!isLogged || isLoggedInToDifferentSource); | ||
return !isLogged || isLoggedInToDifferentSource; | ||
} | ||
case messages_1.Messages.ABAP: { | ||
yield connectionManager.getSystems(); | ||
return Promise.resolve(yield connectionManager.getSystemRequiresAuthentication(projectData.sourceSystem)); | ||
return yield connectionManager.getSystemRequiresAuthentication(projectData.sourceSystem); | ||
} | ||
@@ -87,2 +90,11 @@ default: | ||
} | ||
static writeAdpConfig(projectPath, config) { | ||
const configJsonPath = path.join(projectPath, ".adp", "config.json"); | ||
(0, fs_1.writeFileSync)(configJsonPath, JSON.stringify(config, null, 4)); | ||
} | ||
static updateAdpConfigSafeMode(projectPath) { | ||
const config = this.getAdpConfig(projectPath); | ||
config.safeMode = false; | ||
this.writeAdpConfig(projectPath, config); | ||
} | ||
static getUI5Yaml(projectPath) { | ||
@@ -93,2 +105,16 @@ const ui5yamlPath = (0, path_1.resolve)(projectPath, "ui5.yaml"); | ||
} | ||
static writeUI5Yaml(projectPath, data) { | ||
const updatedYaml = yaml.dump(data); | ||
const ui5yamlPath = (0, path_1.resolve)(projectPath, "ui5.yaml"); | ||
(0, fs_1.writeFileSync)(ui5yamlPath, updatedYaml, "utf8"); | ||
} | ||
static updateSafeMode(projectPath) { | ||
const configExists = Workspace.checkConfigExists(projectPath); | ||
if (configExists) { | ||
Workspace.updateAdpConfigSafeMode(projectPath); | ||
} | ||
else { | ||
Workspace.updateYamlProperty(projectPath, ["customConfiguration", "adp", "safeMode"], false); | ||
} | ||
} | ||
static archive(folder, archive) { | ||
@@ -115,6 +141,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
static getConfigBAS(variant, projectPath) { | ||
if (!(0, fs_1.existsSync)((0, path_1.resolve)(projectPath, ".adp", "config.json"))) { | ||
throw new Error("Missing config.json!"); | ||
} | ||
static isCloudProject(projectPath) { | ||
const parsedManifest = this.getManifestAppdescrFile(projectPath); | ||
return parsedManifest.content.some((change) => change.changeType === "appdescr_app_removeAllInboundsExceptOne"); | ||
} | ||
static getOldConfigBAS(variant, projectPath) { | ||
const config = this.getAdpConfig(projectPath); | ||
@@ -139,10 +166,29 @@ return { | ||
} | ||
static getConfigVSCODE(variant, projectPath) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; | ||
static checkUI5YamlExists(projectPath) { | ||
if (!(0, fs_1.existsSync)((0, path_1.resolve)(projectPath, "ui5.yaml"))) { | ||
throw new Error("Missing ui5.yaml!"); | ||
} | ||
const ui5yaml = this.getUI5Yaml(projectPath); | ||
const fioriToolsPreviewfilteredResult = ui5yaml.server.customMiddleware.filter((customerMiddleware) => customerMiddleware.name === "fiori-tools-preview"); | ||
const fioriToolsProxyFilteredResult = ui5yaml.server.customMiddleware.filter((customerMiddleware) => customerMiddleware.name === "fiori-tools-proxy"); | ||
} | ||
static showErrorWithLink(property) { | ||
const vscode = vscode_1.ModuleResolver.resolve("vscode"); | ||
const documentation = "Documentation"; | ||
vscode.window | ||
.showErrorMessage(`The ui5.yaml of your adaptation project does not include a ${property} property and will not function properly without it. Please refer to the documentation how to add it.`, documentation) | ||
.then((selection) => { | ||
if (selection === documentation) { | ||
vscode.env.openExternal(vscode.Uri.parse("https://example.com")); | ||
} | ||
}); | ||
} | ||
static getConfig(variant, projectPath) { | ||
this.checkUI5YamlExists(projectPath); | ||
const { server: { customMiddleware }, customConfiguration } = this.getUI5Yaml(projectPath); | ||
const { fioriPreviewConfig, fioriProxyConfig } = this.getMiddlewaresConfigurations(customMiddleware); | ||
const isRunningInBAS = EnvironmentUtils_1.EnvironmentUtils.isRunningInBAS(); | ||
if (!this.propertiesExist(fioriPreviewConfig, fioriProxyConfig)) { | ||
throw new Error(`Invalid ui5.yaml configuration for project ${projectPath.split("/").pop()}`); | ||
} | ||
const [{ client, destination, url }, { version }] = [fioriPreviewConfig.adp.target, fioriProxyConfig.ui5]; | ||
const { environment, safeMode } = customConfiguration.adp; | ||
const sourceSystem = isRunningInBAS ? destination : url; | ||
return { | ||
@@ -154,17 +200,98 @@ path: projectPath, | ||
layer: variant.layer, | ||
environment: messages_1.Messages.ABAP, | ||
sourceSystem: (_d = (_c = (_b = (_a = fioriToolsPreviewfilteredResult[0]) === null || _a === void 0 ? void 0 : _a.configuration) === null || _b === void 0 ? void 0 : _b.adp) === null || _c === void 0 ? void 0 : _c.target) === null || _d === void 0 ? void 0 : _d.url, | ||
client: (_h = (_g = (_f = (_e = fioriToolsPreviewfilteredResult[0]) === null || _e === void 0 ? void 0 : _e.configuration) === null || _f === void 0 ? void 0 : _f.adp) === null || _g === void 0 ? void 0 : _g.target) === null || _h === void 0 ? void 0 : _h.client, | ||
environment: environment !== null && environment !== void 0 ? environment : messages_1.Messages.ABAP, | ||
sourceSystem, | ||
client, | ||
applicationIdx: variant.reference, | ||
reference: variant.reference, | ||
id: variant.id, | ||
ui5Version: (_l = (_k = (_j = fioriToolsProxyFilteredResult[0]) === null || _j === void 0 ? void 0 : _j.configuration) === null || _k === void 0 ? void 0 : _k.ui5) === null || _l === void 0 ? void 0 : _l.version, | ||
safeMode: true | ||
ui5Version: version, | ||
safeMode | ||
}; | ||
} | ||
static updateYamlProperty(projectPath, propertyPath, newValue) { | ||
try { | ||
const data = this.getUI5Yaml(projectPath); | ||
let current = data; | ||
for (let i = 0; i < propertyPath.length - 1; i++) { | ||
if (!(propertyPath[i] in current)) { | ||
throw new Error(`Property path not found: ${propertyPath.slice(0, i + 1).join(".")}`); | ||
} | ||
current = current[propertyPath[i]]; | ||
} | ||
const propertyName = propertyPath[propertyPath.length - 1]; | ||
if (!(propertyName in current)) { | ||
throw new Error(`Property path not found: ${propertyPath.join(".")}`); | ||
} | ||
current[propertyName] = newValue; | ||
this.writeUI5Yaml(projectPath, data); | ||
} | ||
catch (e) { | ||
const vscode = vscode_1.ModuleResolver.resolve("vscode"); | ||
vscode.window.showErrorMessage(`Cannot update ui5.yaml file. ${e.message}`); | ||
} | ||
} | ||
static getMiddlewaresConfigurations(customMiddleware) { | ||
const fioriPreviewConfig = this.findMiddleware(customMiddleware, this.isFioriToolsPreview).configuration; | ||
const fioriProxyConfig = this.findMiddleware(customMiddleware, this.isFioriToolsProxy).configuration; | ||
return { | ||
fioriPreviewConfig, | ||
fioriProxyConfig | ||
}; | ||
} | ||
static isValidUI5Yaml(projectPath) { | ||
const isRunningInBAS = EnvironmentUtils_1.EnvironmentUtils.isRunningInBAS(); | ||
if (isRunningInBAS && this.checkConfigExists(projectPath)) { | ||
return true; | ||
} | ||
this.checkUI5YamlExists(projectPath); | ||
const { server: { customMiddleware } } = this.getUI5Yaml(projectPath); | ||
const { fioriPreviewConfig, fioriProxyConfig } = this.getMiddlewaresConfigurations(customMiddleware); | ||
return this.propertiesExist(fioriPreviewConfig, fioriProxyConfig); | ||
} | ||
static assertProperties(properties, target) { | ||
for (const property of properties) { | ||
const value = target[property]; | ||
if (value === null || value === undefined) { | ||
this.showErrorWithLink(property); | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
static findMiddleware(middlewareList, typeGuard) { | ||
const middleware = middlewareList.find(typeGuard); | ||
if (!middleware) { | ||
throw new Error(`Middleware was not found in ui5.yaml configuration.`); | ||
} | ||
return middleware; | ||
} | ||
static isFioriToolsPreview(middleware) { | ||
return middleware.name === "fiori-tools-preview"; | ||
} | ||
static isFioriToolsProxy(middleware) { | ||
return middleware.name === "fiori-tools-proxy"; | ||
} | ||
static parseFile(projectPath, filePath) { | ||
return JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(projectPath, filePath), "utf-8")); | ||
} | ||
static propertiesExist(fioriPreviewConfig, fioriProxyConfig) { | ||
const adpPropertyExists = this.assertProperties(["adp"], fioriPreviewConfig); | ||
const targetPropertyExists = this.assertProperties(["target"], fioriPreviewConfig.adp); | ||
const ui5PropertyExists = this.assertProperties(["ui5"], fioriProxyConfig); | ||
const ui5PropertiesPropertyExist = this.assertProperties(["version", "path", "url"], fioriProxyConfig.ui5); | ||
if (!adpPropertyExists || !targetPropertyExists || !ui5PropertyExists || !ui5PropertiesPropertyExist) { | ||
return false; | ||
} | ||
if (EnvironmentUtils_1.EnvironmentUtils.isRunningInBAS()) { | ||
return this.assertProperties(["destination"], fioriPreviewConfig.adp.target); | ||
} | ||
else { | ||
return this.assertProperties(["url", "client"], fioriPreviewConfig.adp.target); | ||
} | ||
} | ||
static checkConfigExists(projectPath) { | ||
return (0, fs_1.existsSync)((0, path_1.resolve)(projectPath, ".adp", "config.json")); | ||
} | ||
} | ||
exports.default = Workspace; | ||
//# sourceMappingURL=Workspace.js.map |
{ | ||
"name": "@sap/adp-common", | ||
"version": "1.1.51", | ||
"version": "1.1.52", | ||
"description": "common logic for all yeoman generators", | ||
@@ -65,7 +65,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@sap-ux/axios-extension": "0.11.1", | ||
"@sap-ux/axios-extension": "1.7.3", | ||
"@sap-devx/feature-toggle-node": "2.0.1", | ||
"@sap/cf-tools": "0.8.1", | ||
"adm-zip": "0.5.9", | ||
"axios": "1.4.0", | ||
"axios": "1.6.3", | ||
"fast-xml-parser": "4.2.5", | ||
@@ -72,0 +72,0 @@ "js-yaml": "4.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
173957
101
2684
6
+ Added@sap-ux/axios-extension@1.7.3(transitive)
+ Added@sap-ux/btp-utils@0.12.1(transitive)
+ Added@sap-ux/logger@0.4.0(transitive)
+ Added@xmldom/xmldom@0.8.10(transitive)
+ Addedaxios@1.6.01.6.3(transitive)
+ Addedfast-xml-parser@4.2.7(transitive)
+ Addedqs@6.7.3(transitive)
+ Addedwinston@3.7.2(transitive)
+ Addedwinston-transport@4.5.0(transitive)
+ Addedxpath@0.0.33(transitive)
- Removed@sap-ux/axios-extension@0.11.1(transitive)
- Removed@sap-ux/btp-utils@0.11.2(transitive)
- Removed@sap-ux/logger@0.3.1(transitive)
- Removed@xmldom/xmldom@0.8.4(transitive)
- Removedaxios@0.24.01.4.0(transitive)
- Removedfast-xml-parser@3.12.20(transitive)
- Removednimn-date-parser@1.0.0(transitive)
- Removednimn_schema_builder@1.1.0(transitive)
- Removednimnjs@1.3.2(transitive)
- Removedqs@6.7.0(transitive)
- Removedwinston@3.3.3(transitive)
- Removedwinston-transport@4.4.1(transitive)
- Removedxpath@0.0.32(transitive)
Updatedaxios@1.6.3