@sap-ux/fiori-app-sub-generator 0.0.2
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/LICENSE +201 -0
- package/generators/app/index.d.ts +3 -0
- package/generators/app/index.js +5 -0
- package/generators/app-headless/index.d.ts +34 -0
- package/generators/app-headless/index.js +75 -0
- package/generators/app-headless/transforms.d.ts +9 -0
- package/generators/app-headless/transforms.js +208 -0
- package/generators/fiori-app-generator/end.d.ts +49 -0
- package/generators/fiori-app-generator/end.js +105 -0
- package/generators/fiori-app-generator/fioriAppGenerator.d.ts +45 -0
- package/generators/fiori-app-generator/fioriAppGenerator.js +319 -0
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.d.ts +94 -0
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.js +3 -0
- package/generators/fiori-app-generator/index.d.ts +3 -0
- package/generators/fiori-app-generator/index.js +19 -0
- package/generators/fiori-app-generator/install.d.ts +34 -0
- package/generators/fiori-app-generator/install.js +80 -0
- package/generators/fiori-app-generator/prompting.d.ts +84 -0
- package/generators/fiori-app-generator/prompting.js +303 -0
- package/generators/fiori-app-generator/subgenHelpers.d.ts +43 -0
- package/generators/fiori-app-generator/subgenHelpers.js +71 -0
- package/generators/fiori-app-generator/transforms.d.ts +38 -0
- package/generators/fiori-app-generator/transforms.js +278 -0
- package/generators/fiori-app-generator/writing.d.ts +27 -0
- package/generators/fiori-app-generator/writing.js +94 -0
- package/generators/index.d.ts +6 -0
- package/generators/index.js +22 -0
- package/generators/translations/fioriAppSubGenerator.i18n.json +119 -0
- package/generators/types/common.d.ts +46 -0
- package/generators/types/common.js +3 -0
- package/generators/types/constants.d.ts +60 -0
- package/generators/types/constants.js +98 -0
- package/generators/types/external.d.ts +261 -0
- package/generators/types/external.js +88 -0
- package/generators/types/index.d.ts +7 -0
- package/generators/types/index.js +23 -0
- package/generators/types/state.d.ts +149 -0
- package/generators/types/state.js +35 -0
- package/generators/types/telemetryEvents.d.ts +61 -0
- package/generators/types/telemetryEvents.js +3 -0
- package/generators/types/yeomanUiStepConfig.d.ts +13 -0
- package/generators/types/yeomanUiStepConfig.js +3 -0
- package/generators/utils/appWizardCache.d.ts +40 -0
- package/generators/utils/appWizardCache.js +72 -0
- package/generators/utils/command-runner.d.ts +30 -0
- package/generators/utils/command-runner.js +88 -0
- package/generators/utils/common.d.ts +147 -0
- package/generators/utils/common.js +286 -0
- package/generators/utils/eventHooks.d.ts +29 -0
- package/generators/utils/eventHooks.js +48 -0
- package/generators/utils/i18n.d.ts +16 -0
- package/generators/utils/i18n.js +54 -0
- package/generators/utils/index.d.ts +9 -0
- package/generators/utils/index.js +25 -0
- package/generators/utils/sapuxLayer.d.ts +15 -0
- package/generators/utils/sapuxLayer.js +24 -0
- package/generators/utils/stepsHelper.d.ts +47 -0
- package/generators/utils/stepsHelper.js +161 -0
- package/generators/utils/telemetry.d.ts +16 -0
- package/generators/utils/telemetry.js +41 -0
- package/package.json +84 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { TelemetryEvent, TelemetryMeasurements, TelemetryProperties } from '@sap-ux/telemetry';
|
|
2
|
+
import type { DatasourceType } from '@sap-ux/odata-service-inquirer';
|
|
3
|
+
export type EventName = 'GENERATION_SUCCESS' | 'GENERATION_INSTALL_FAIL' | 'GENERATION_WRITING_FAIL';
|
|
4
|
+
export type LaunchSource = 'Headless' | 'CapServiceAdaptor' | 'MtaLaunchAdaptor' | 'LCAPServiceAdaptor' | 'ServiceCenterAdaptor';
|
|
5
|
+
export type TelemetrySapSystemType = 'SCP' | 'CF' | 'ABAP';
|
|
6
|
+
export type TelemetryBusinessHubType = 'BusinessAcceleratorHub' | 'BusinessHubEnterprise';
|
|
7
|
+
export interface AppGenEventProperties extends TelemetryProperties {
|
|
8
|
+
Template: string;
|
|
9
|
+
DataSource: DatasourceType;
|
|
10
|
+
UI5Version: string;
|
|
11
|
+
Theme: string;
|
|
12
|
+
AppGenVersion: string;
|
|
13
|
+
/**
|
|
14
|
+
* Use enum in app-generator/common
|
|
15
|
+
*/
|
|
16
|
+
AppGenSourceType: DatasourceType;
|
|
17
|
+
/**
|
|
18
|
+
* Use enum in app-generator/common
|
|
19
|
+
*/
|
|
20
|
+
AppGenSapSystemType: TelemetrySapSystemType;
|
|
21
|
+
EnableEslint: boolean;
|
|
22
|
+
EnableCodeAssist: boolean;
|
|
23
|
+
AppGenLaunchSource: LaunchSource;
|
|
24
|
+
/**
|
|
25
|
+
* Version of the module which launches the generator
|
|
26
|
+
*/
|
|
27
|
+
AppGenLaunchSourceVersion: string;
|
|
28
|
+
installFailure: boolean;
|
|
29
|
+
ToolsId: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AppGenEventMeasurements extends TelemetryMeasurements {
|
|
32
|
+
GenerationTime: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Telemetry event generated on successful completion
|
|
36
|
+
* of Fiori project generation
|
|
37
|
+
*/
|
|
38
|
+
export interface AppGenSuccessEvent extends TelemetryEvent {
|
|
39
|
+
eventName: 'GENERATION_SUCCESS';
|
|
40
|
+
properties: AppGenEventProperties;
|
|
41
|
+
measurements: AppGenEventMeasurements;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Telemetry event generated on failure of running npm install
|
|
45
|
+
* during Fiori project generation
|
|
46
|
+
*/
|
|
47
|
+
export interface AppGenInstallFailEvent extends TelemetryEvent {
|
|
48
|
+
eventName: 'GENERATION_INSTALL_FAIL';
|
|
49
|
+
properties: AppGenEventProperties;
|
|
50
|
+
measurements: AppGenEventMeasurements;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Telemetry event generated on failure of writing
|
|
54
|
+
* project files to file system during Fiori project generation
|
|
55
|
+
*/
|
|
56
|
+
export interface AppGenWritingFailEvent extends TelemetryEvent {
|
|
57
|
+
eventName: 'GENERATION_WRITING_FAIL';
|
|
58
|
+
properties: AppGenEventProperties;
|
|
59
|
+
measurements: AppGenEventMeasurements;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=telemetryEvents.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Prompts as YeomanUiSteps, IPrompt as YeomanUiStep } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
export interface YeomanUiStepConfig {
|
|
3
|
+
activeSteps: YeomanUiSteps;
|
|
4
|
+
dependentMap: {
|
|
5
|
+
[key: string]: YeomanUiStep[];
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface FioriStep extends YeomanUiStep {
|
|
9
|
+
key: string;
|
|
10
|
+
order: number;
|
|
11
|
+
dependency?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=yeomanUiStepConfig.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ILogWrapper } from '@sap-ux/fiori-generator-shared';
|
|
2
|
+
import type { State } from '../types';
|
|
3
|
+
import type { AppWizard } from '@sap-devx/yeoman-ui-types';
|
|
4
|
+
declare const FIORI_CACHE = "$fiori-cache";
|
|
5
|
+
export type AppWizardCache = AppWizard & {
|
|
6
|
+
[FIORI_CACHE]?: Partial<State>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Initialize the cache object in the appWizard object. N.B. this will update the passed reference.
|
|
10
|
+
*
|
|
11
|
+
* @param logger
|
|
12
|
+
* @param appWizard
|
|
13
|
+
*/
|
|
14
|
+
export declare function initAppWizardCache(logger: ILogWrapper, appWizard?: AppWizardCache): void;
|
|
15
|
+
/**
|
|
16
|
+
* Adds the specificed partial state to the app wizard cache. N.B. this will update the passed app wizard reference.
|
|
17
|
+
*
|
|
18
|
+
* @param appWizard
|
|
19
|
+
* @param state
|
|
20
|
+
* @param logger
|
|
21
|
+
*/
|
|
22
|
+
export declare function addToCache(appWizard: AppWizardCache | undefined, state: Partial<State>, logger: ILogWrapper): void;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the cached state from the app wizard object based on the specified key where the key is a propert of the State type.
|
|
25
|
+
*
|
|
26
|
+
* @param appWizard
|
|
27
|
+
* @param stateKey
|
|
28
|
+
* @param logger
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export declare function getFromCache<T>(appWizard: AppWizardCache | undefined, stateKey: keyof State, logger: ILogWrapper): T | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Deletes the cache object from the app wizard object. N.B. this will update the passed app wizard reference.
|
|
34
|
+
*
|
|
35
|
+
* @param appWizard
|
|
36
|
+
* @param logger
|
|
37
|
+
*/
|
|
38
|
+
export declare function deleteCache(appWizard: AppWizardCache | undefined, logger: ILogWrapper): void;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=appWizardCache.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initAppWizardCache = initAppWizardCache;
|
|
4
|
+
exports.addToCache = addToCache;
|
|
5
|
+
exports.getFromCache = getFromCache;
|
|
6
|
+
exports.deleteCache = deleteCache;
|
|
7
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
8
|
+
const i18n_1 = require("./i18n");
|
|
9
|
+
const FIORI_CACHE = '$fiori-cache';
|
|
10
|
+
const hostEnv = (0, fiori_generator_shared_1.getHostEnvironment)();
|
|
11
|
+
/**
|
|
12
|
+
* Initialize the cache object in the appWizard object. N.B. this will update the passed reference.
|
|
13
|
+
*
|
|
14
|
+
* @param logger
|
|
15
|
+
* @param appWizard
|
|
16
|
+
*/
|
|
17
|
+
function initAppWizardCache(logger, appWizard) {
|
|
18
|
+
if (appWizard && !appWizard[FIORI_CACHE]) {
|
|
19
|
+
appWizard[FIORI_CACHE] = {};
|
|
20
|
+
logger.debug('AppWizard based cache initialized.');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds the specificed partial state to the app wizard cache. N.B. this will update the passed app wizard reference.
|
|
25
|
+
*
|
|
26
|
+
* @param appWizard
|
|
27
|
+
* @param state
|
|
28
|
+
* @param logger
|
|
29
|
+
*/
|
|
30
|
+
function addToCache(appWizard, state, logger) {
|
|
31
|
+
logIfCacheMissing(appWizard, logger);
|
|
32
|
+
if (appWizard?.[FIORI_CACHE]) {
|
|
33
|
+
Object.assign(appWizard[FIORI_CACHE], state);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the cached state from the app wizard object based on the specified key where the key is a propert of the State type.
|
|
38
|
+
*
|
|
39
|
+
* @param appWizard
|
|
40
|
+
* @param stateKey
|
|
41
|
+
* @param logger
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
function getFromCache(appWizard, stateKey, logger) {
|
|
45
|
+
logIfCacheMissing(appWizard, logger);
|
|
46
|
+
return appWizard?.[FIORI_CACHE]?.[stateKey];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Deletes the cache object from the app wizard object. N.B. this will update the passed app wizard reference.
|
|
50
|
+
*
|
|
51
|
+
* @param appWizard
|
|
52
|
+
* @param logger
|
|
53
|
+
*/
|
|
54
|
+
function deleteCache(appWizard, logger) {
|
|
55
|
+
logIfCacheMissing(appWizard, logger);
|
|
56
|
+
if (appWizard?.[FIORI_CACHE]) {
|
|
57
|
+
delete appWizard[FIORI_CACHE];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Logs a warning message if the cache object is missing from the app wizard object.
|
|
62
|
+
*
|
|
63
|
+
* @param appWizard
|
|
64
|
+
* @param logger
|
|
65
|
+
*/
|
|
66
|
+
function logIfCacheMissing(appWizard, logger) {
|
|
67
|
+
// YUI cache only available in vscode
|
|
68
|
+
if (hostEnv === fiori_generator_shared_1.hostEnvironment.vscode && !appWizard?.[FIORI_CACHE]) {
|
|
69
|
+
logger.info((0, i18n_1.t)('logMessages.warningCachingNotSupported'));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=appWizardCache.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
|
|
2
|
+
import type { SpawnOptionsWithoutStdio } from 'child_process';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class CommandRunner {
|
|
7
|
+
private readonly log;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param log
|
|
11
|
+
*/
|
|
12
|
+
constructor(log: ILogWrapper);
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param prefix
|
|
16
|
+
* @param {...any} args
|
|
17
|
+
*/
|
|
18
|
+
formatLog(prefix?: string, ...args: string[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* Runs a command.
|
|
21
|
+
*
|
|
22
|
+
* @param cmd
|
|
23
|
+
* @param args
|
|
24
|
+
* @param opts
|
|
25
|
+
* @param enableLog
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
run(cmd: string, args?: string[], opts?: SpawnOptionsWithoutStdio, enableLog?: boolean): Promise<string | void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=command-runner.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandRunner = void 0;
|
|
4
|
+
const i18n_1 = require("./i18n");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class CommandRunner {
|
|
10
|
+
log;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param log
|
|
14
|
+
*/
|
|
15
|
+
constructor(log) {
|
|
16
|
+
this.log = log;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param prefix
|
|
21
|
+
* @param {...any} args
|
|
22
|
+
*/
|
|
23
|
+
formatLog(prefix, ...args) {
|
|
24
|
+
const out = args
|
|
25
|
+
.map((a) => a.toString().trim())
|
|
26
|
+
.join(' ')
|
|
27
|
+
.trim();
|
|
28
|
+
this.log?.info(prefix ? prefix + out : out);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Runs a command.
|
|
32
|
+
*
|
|
33
|
+
* @param cmd
|
|
34
|
+
* @param args
|
|
35
|
+
* @param opts
|
|
36
|
+
* @param enableLog
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
run(cmd, args = [], opts = {}, enableLog = false) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const optsLocal = { ...opts };
|
|
42
|
+
const stack = [];
|
|
43
|
+
const command = `\`${cmd} ${args.join(' ')}\``;
|
|
44
|
+
if (process.platform === 'win32') {
|
|
45
|
+
optsLocal.shell = true;
|
|
46
|
+
}
|
|
47
|
+
const spawnedCmd = (0, child_process_1.spawn)(cmd, args, optsLocal);
|
|
48
|
+
let response;
|
|
49
|
+
if (enableLog) {
|
|
50
|
+
this.formatLog('Running: ', command);
|
|
51
|
+
}
|
|
52
|
+
spawnedCmd.stdout.on('data', (data) => {
|
|
53
|
+
if (enableLog) {
|
|
54
|
+
this.formatLog(undefined, data);
|
|
55
|
+
}
|
|
56
|
+
stack.push(data.toString());
|
|
57
|
+
response = data.toString();
|
|
58
|
+
});
|
|
59
|
+
spawnedCmd.stderr.on('data', (data) => {
|
|
60
|
+
if (enableLog) {
|
|
61
|
+
this.formatLog(undefined, data);
|
|
62
|
+
}
|
|
63
|
+
stack.push(data.toString());
|
|
64
|
+
});
|
|
65
|
+
spawnedCmd.on('error', (error) => {
|
|
66
|
+
reject(new Error(`${(0, i18n_1.t)('error.commandFailed')}: ${error.message}`));
|
|
67
|
+
});
|
|
68
|
+
spawnedCmd.on('close', (errorCode, signal) => {
|
|
69
|
+
if (signal) {
|
|
70
|
+
const signalCode = -1;
|
|
71
|
+
if (enableLog) {
|
|
72
|
+
this.formatLog((0, i18n_1.t)('logMessages.commandFailedWithError', { command, signalCode }));
|
|
73
|
+
}
|
|
74
|
+
return reject(new Error((0, i18n_1.t)('logMessages.commandErrorCodeWithStack', { command, signalCode, stack: stack.join(', ') })));
|
|
75
|
+
}
|
|
76
|
+
if (errorCode !== 0) {
|
|
77
|
+
if (enableLog) {
|
|
78
|
+
this.formatLog((0, i18n_1.t)('logMessages.commandFailedWithError', { command, errorCode }));
|
|
79
|
+
}
|
|
80
|
+
return reject(new Error((0, i18n_1.t)('logMessages.commandErrorCodeWithStack', { command, errorCode, stack: stack.join(', ') })));
|
|
81
|
+
}
|
|
82
|
+
resolve(response);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.CommandRunner = CommandRunner;
|
|
88
|
+
//# sourceMappingURL=command-runner.js.map
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Annotations } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { CapRuntime, CapService } from '@sap-ux/cap-config-writer';
|
|
3
|
+
import type { Logger } from '@sap-ux/logger';
|
|
4
|
+
import { DatasourceType, OdataVersion } from '@sap-ux/odata-service-inquirer';
|
|
5
|
+
import type { CdsAnnotationsInfo, EdmxAnnotationsInfo } from '@sap-ux/odata-service-writer';
|
|
6
|
+
import type { CapProjectType, CdsUi5PluginInfo, CdsVersionInfo } from '@sap-ux/project-access';
|
|
7
|
+
import type { Editor } from 'mem-fs-editor';
|
|
8
|
+
import type { GenerateLaunchConfigOptions, Service } from '../types';
|
|
9
|
+
import { ApiHubType } from '../types';
|
|
10
|
+
import { type Floorplan } from '../types/external';
|
|
11
|
+
/**
|
|
12
|
+
* Parse the specified edmx string for validitiy and return the ODataVersion of the specified edmx string.
|
|
13
|
+
*
|
|
14
|
+
* @param edmx
|
|
15
|
+
* @returns ODataVersion, odata version
|
|
16
|
+
* @throws Error, if invalid edmx
|
|
17
|
+
*/
|
|
18
|
+
export declare function getODataVersion(edmx: string): OdataVersion;
|
|
19
|
+
/**
|
|
20
|
+
* Get AppId from provided namespace and name.
|
|
21
|
+
*
|
|
22
|
+
* @param name
|
|
23
|
+
* @param namespace
|
|
24
|
+
* @returns AppId
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAppId(name: string, namespace?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a value suitable for use as a semantic object for navigation intents.
|
|
29
|
+
* Removes specific characters that would break the navigation.
|
|
30
|
+
*
|
|
31
|
+
* @param appId
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare const getSemanticObject: (appId: string) => string;
|
|
35
|
+
export declare const getFlpId: (appId: string, action?: string | undefined) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Builds the sap-client parameter for the URL.
|
|
38
|
+
* If sapClient is not provided, returns an empty string.
|
|
39
|
+
*
|
|
40
|
+
* @param sapClient
|
|
41
|
+
* @returns sap-client parameter
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildSapClientParam(sapClient: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* If a floorplan only supports single odata version, get that version.
|
|
46
|
+
* Otherwise returns undefined, indicating multiple versions are supported.
|
|
47
|
+
*
|
|
48
|
+
* @param floorplan a floorplan value
|
|
49
|
+
* @returns - array of supported odata versions or undefined if all are supported
|
|
50
|
+
*/
|
|
51
|
+
export declare function getRequiredOdataVersion(floorplan: Floorplan): OdataVersion | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the min supported version of UI5 for the floorplan and odata version specified.
|
|
54
|
+
*
|
|
55
|
+
* @param version - odata version
|
|
56
|
+
* @param floorplan - floorplan value
|
|
57
|
+
* @returns min supported version
|
|
58
|
+
*/
|
|
59
|
+
export declare function getMinSupportedUI5Version(version: OdataVersion, floorplan: Floorplan): string;
|
|
60
|
+
/**
|
|
61
|
+
* Generates a v4 uuid. While not strictly necessary to wrap uuid it means we can enforce
|
|
62
|
+
* additional options or change implementation easily in future.
|
|
63
|
+
*
|
|
64
|
+
* @returns a uuid v4 string
|
|
65
|
+
*/
|
|
66
|
+
export declare function generateToolsId(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Retrieves information related to cds version and checks if the CAP UI5 plugin is enabled.
|
|
69
|
+
*
|
|
70
|
+
* @param capProjectPath The path to the CAP project.
|
|
71
|
+
* @param fs The file system editor.
|
|
72
|
+
* @param cdsVersionInfo If provided will be used instead of parsing the package.json file to determine the cds version.
|
|
73
|
+
* @returns A promise that resolves to an object containing cdsinformation,
|
|
74
|
+
* or `undefined` if the CAP UI5 plugin is not enabled.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getCdsUi5PluginInfo(capProjectPath: string, fs: Editor, cdsVersionInfo?: CdsVersionInfo): Promise<CdsUi5PluginInfo | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Returns CDS annotations information.
|
|
79
|
+
*
|
|
80
|
+
* @param {CapService} capService - The CAP service object containing information about the service.
|
|
81
|
+
* @param {string} projectName - The name of the project, which is the module name.
|
|
82
|
+
* @returns {Promise<CdsAnnotationsInfo>} A promise that resolves to an object containing CDS annotations information.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getCdsAnnotations(capService: CapService, projectName: string): Promise<CdsAnnotationsInfo | undefined>;
|
|
85
|
+
/**
|
|
86
|
+
* Determine if the specified connected system is hosted on BTP.
|
|
87
|
+
* If a backend system uses service keys, or a destination is an ABAP environment on BTP, then it is considered to be hosted on BTP.
|
|
88
|
+
*
|
|
89
|
+
* @param connectedSystem - The connected system object.
|
|
90
|
+
* @returns {boolean} `true` if the connected system is hosted on BTP, otherwise `false`.
|
|
91
|
+
*/
|
|
92
|
+
export declare function isBTPHosted(connectedSystem?: Service['connectedSystem']): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves the data source label.
|
|
95
|
+
*
|
|
96
|
+
* @param {DatasourceType} source - The data source type (`DatasourceType.sapSystem` or `DatasourceType.businessHub`).
|
|
97
|
+
* @param scp
|
|
98
|
+
* @param {ApiHubType} apiHubType - The API hub type for business hubs.
|
|
99
|
+
* @returns {string} The formatted data source label.
|
|
100
|
+
*/
|
|
101
|
+
export declare function getReadMeDataSourceLabel(source: DatasourceType, scp?: boolean, apiHubType?: ApiHubType): string;
|
|
102
|
+
/**
|
|
103
|
+
* Generates the launch text for the application based on the CAP service information and project details.
|
|
104
|
+
*
|
|
105
|
+
* @param {CapServiceCdsInfo} capService - The CAP (Cloud Application Programming) service information.
|
|
106
|
+
* @param {string} name - The name of the project.
|
|
107
|
+
* @param {boolean} useNpmWorkspaceAppRef - For CAP projects, indicates whether (root CAP project) npm workspaces app ref should be used when launching.
|
|
108
|
+
* @param {string} namespace - The namespace of the project.
|
|
109
|
+
* @returns {string} The launch text for the application. If CAP service information is provided, it returns a custom launch text based on the CAP service type,
|
|
110
|
+
* project name, and optionally the application ID if NPM workspaces or CDS UI5 plugin is enabled.
|
|
111
|
+
* If CAP service information is not available, it returns a default launch text.
|
|
112
|
+
*/
|
|
113
|
+
export declare function getLaunchText(capService: Service['capService'], name: string, useNpmWorkspaceAppRef: boolean, namespace?: string): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* Generates the launch configuration for a project based on the provided options.
|
|
116
|
+
*
|
|
117
|
+
* @param {GenerateLaunchConfigOptions} options - An object containing configuration options for the project.
|
|
118
|
+
* @param {OdataVersion} options.odataVersion - The version of the OData service (e.g. v2 or v4) used by the project.
|
|
119
|
+
* @param {DatasourceType} options.source - The type of data source the project uses (e.g. metadata file or OData source URL).
|
|
120
|
+
* @param {string} options.sapClientParam - The SAP client parameter.
|
|
121
|
+
* @param {string} options.targetFolder - The file path to the project where the launch configuration should be created.
|
|
122
|
+
* @param {string} options.projectName - The name of the project.
|
|
123
|
+
* @param {string} options.appId - The application ID for the project.
|
|
124
|
+
* @param {Editor} fs - The file system editor.
|
|
125
|
+
* @param {any} vscode - The Visual Studio Code object.
|
|
126
|
+
* @param {Logger} [log] - An optional logger instance.
|
|
127
|
+
* @param {boolean} [writeToAppOnly] - A flag indicating whether to write the configuration only to the app folder.
|
|
128
|
+
* @returns {void}
|
|
129
|
+
*/
|
|
130
|
+
export declare function generateLaunchConfig(options: GenerateLaunchConfigOptions, fs: Editor, vscode?: any, log?: Logger, writeToAppOnly?: boolean): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Convert between the CAPProjectType project type from the `@sap-ux/project-access' package and the CAP Runtime type from the `@sap-ux/odata-service-inquirer' package.
|
|
133
|
+
*
|
|
134
|
+
* @param {CapRuntime} capRuntime - The CAP runtime type. Default is 'Node.js'.
|
|
135
|
+
* @returns {CapProjectType} The CAP project type.
|
|
136
|
+
*/
|
|
137
|
+
export declare function convertCapRuntimeToCapProjectType(capRuntime?: CapRuntime): CapProjectType;
|
|
138
|
+
/**
|
|
139
|
+
* Get the annotations for the project based on the provided CAP service or transforms the annotations to the correct type otherwise.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} projectName - The name of the project for which annotations are being retrieved.
|
|
142
|
+
* @param {Annotations} annotations - The EDMX annotations object containing technical name and XML definitions.
|
|
143
|
+
* @param {CapService} capService - The CAP service instance used to retrieve CDS annotations.
|
|
144
|
+
* @returns {Promise<CdsAnnotationsInfo | EdmxAnnotationsInfo>} A promise that resolves to either CDS annotations info or EDMX annotations info.
|
|
145
|
+
*/
|
|
146
|
+
export declare function getAnnotations(projectName: string, annotations?: Annotations, capService?: CapService): Promise<CdsAnnotationsInfo | EdmxAnnotationsInfo | undefined>;
|
|
147
|
+
//# sourceMappingURL=common.d.ts.map
|