@sap/adp-common
Version:
common logic for all yeoman generators
473 lines (472 loc) • 11.5 kB
TypeScript
import Generator = require("yeoman-generator");
import { FlpConfigurationType, InputChoice } from "../enums";
import type { AdpProjectData, DescriptorVariant } from "@sap-ux/adp-tooling";
import { AuthenticationType } from "@sap-ux/store";
export interface ServiceResponseResult {
status: number;
statusText: string;
data: string;
isSuccess: boolean;
}
export interface Resource {
name: string;
type: string;
parameters: any;
}
export interface GeneratorPage {
name: string;
description: string;
}
export interface GeneratorOpts {
appWizard?: {
setHeaderTitle?(title: string, tooltip: string): void;
};
}
export interface PageLabel {
name: string;
description: string;
}
export interface AbapApp {
namespace: string;
i18nGuid: string;
projectname: string;
applicationtitle: string;
layer: string;
baseapp: BaseApp;
destination: string;
appVariantId: string;
ui5version: string;
ui5destination: string;
ui5VersionPath: string;
isRunningInBAS: boolean;
isCloudProject: boolean;
flp?: {
flpTitle: string;
flpSubtitle: string;
};
}
export interface BaseApp {
id: string;
}
export interface AdpConfig {
sourceSystem?: string;
client?: string;
componentname: string;
appvariant: string;
layer: string;
isOVPApp: boolean;
isFioriElement: boolean;
environment: string;
ui5Version: string;
cfSpace?: string;
cfOrganization?: string;
cfApiUrl?: string;
}
export interface DestinationBase {
name: string;
url: string;
proxyType?: string;
}
export interface DescriptorChange {
changeType: string;
content: ResourceModel;
texts?: I18nModel;
}
export interface ResourceModel {
modelId: string;
bundleUrl?: string;
supportedLocales?: string[];
fallbackLocale?: string;
}
export interface I18nModel {
i18n: string;
}
export interface Prompt {
type: string;
name: string;
message: string | (() => string);
choices?: (answers?: Generator.Answers) => Promise<ChoiceOption[] | string[]>;
validate?: (value: string, answers?: Generator.Answers, isInternalMode?: boolean) => Promise<string | boolean>;
when?: (answers?: Generator.Answers) => boolean;
guiOptions?: GuiOpions;
store?: boolean;
default?: ((answers?: Generator.Answers) => string) | boolean;
mask?: string;
guiType?: string;
}
export interface GuiOpions {
type?: string;
mandatory?: boolean;
hint?: string;
applyDefaultWhenDirty?: boolean;
breadcrumb?: string | boolean;
}
export interface ChoiceOption {
name: string;
value: any;
}
export interface AppInfo {
id: string;
title: string;
}
export interface YamlModule {
name: string;
type: string;
path?: string;
requires?: any;
parameters?: any;
"build-parameters"?: any;
}
export interface Yaml {
"_schema-version": string;
"ID": string;
"version": string;
resources?: any[];
modules?: MTAModule[];
}
export interface DestinationUI5Configs {
destinationsConfigSAPUI5: DestinationConfig;
destinationsConfigSAPUI5Snapshot?: DestinationConfig;
}
export interface UI5Version {
versionName: {
version: string;
support: string;
lts: boolean;
};
}
export interface DestinationConfig {
name: string;
url: string;
proxyType?: string;
}
export interface DestinationUI5Configs {
destinationsConfigSAPUI5: DestinationConfig;
destinationsConfigSAPUI5Snapshot?: DestinationConfig;
}
export interface UI5Version {
versionName: {
version: string;
support: string;
lts: boolean;
};
}
export interface MTAModule {
name: string;
parameters: any;
path: string;
requires: MTARequire[];
type: string;
}
export interface MTARequire {
name: string;
}
export interface AdpProjectResourceModel {
key: string;
path: string;
content?: string;
}
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 {
sourceSystem?: string;
componentname: string;
appvariant: string;
layer: string;
isOVPApp: boolean;
isFioriElement: boolean;
environment: string;
ui5Version: string;
}
export interface AppdescrVariantManifest extends DescriptorVariant {
fileName: string;
fileType: string;
version: string;
content: AppdescrVariantContent[];
}
export interface AppdescrVariantContent {
changeType: string;
content: Record<string, unknown>;
texts?: string;
}
export interface GuiOpions {
type?: string;
mandatory?: boolean;
hint?: string;
applyDefaultWhenDirty?: boolean;
}
export interface Project extends AdpProjectData {
authenticationType?: AuthenticationType;
client?: string | null;
cfSpace?: string;
cfOrganization?: string;
cfApiUrl?: string;
}
export interface DataSource {
[key: string]: {
uri: string;
type: string;
settings?: {
odataVersion: string;
localUri: string;
annotations?: string[];
};
};
}
export interface KeyValue<T> {
[key: string]: T;
}
export declare type ODataAnnotation = KeyValue<string>;
export declare type ODataServiceWithURI = KeyValue<string>;
export interface DataSourcesWithAnnotations {
[key: string]: string | undefined;
}
export interface ODataTargetSource {
dataSourceName: string;
uri: string;
annotations: string[];
}
export interface ChangeDataSourceODataAnswers {
targetODataSource: string;
oDataSourceURI: string;
maxAge: number;
oDataAnnotationSourceURI: string;
}
export declare type PopertyValueType = "boolean" | "number" | "string" | "binding" | "object";
export interface InboundChangeAnswers {
inboundId: string;
title?: PopertyValueType;
subTitle?: PopertyValueType;
icon?: PopertyValueType;
}
export interface Credentials {
username: string;
password: string;
}
export declare type DataSourceAddOData = {
[key: string]: any;
};
export interface DestinationConfiguration {
Name: string;
WebIDEUsage: string;
Authentication: string;
}
export interface MappedDestination {
name: string;
authenticated: boolean;
}
export interface DeploymentData {
isDeployed: boolean;
isUndeploymentSupported?: boolean;
transport?: string;
package?: string;
}
export interface ChangeFile {
fileName: string;
namespace: string;
layer: string;
fileType: string;
creation: string;
packageName: string;
reference: string;
support: {
generator: string;
};
changeType: string;
content: any;
}
export interface FlpConfigurationAnswers {
flpInboundId: string;
flpConfigurationType: FlpConfigurationType;
flpTitle: string;
flpSubtitle?: string;
flpParametersSemanticObject?: string;
flpParametersAction?: string;
flpParameterString?: string;
}
export interface DeployConfigAnswers {
sapui5ABAPRepository: string;
deployConfigDescription?: string;
packageInputChoice: InputChoice;
packageManual?: string;
packageAutoComplete?: string;
transportInputChoice: InputChoice;
transportFromList?: string;
transportManual: any;
}
export interface AllAppResults {
projectRoot: string;
manifestPath: string;
}
export declare type FolderKey = "projectRoots" | "subWebappRoots" | "manifestAppDescRoots";
export declare type AppFolders = Record<FolderKey, Set<string>>;
export declare const folderKeys: FolderKey[];
export interface WorkspaceFolder {
uri: {
scheme: string;
fsPath: string;
} | undefined;
name: string;
index: number;
}
export interface ToolsSupport {
id: string;
version: string;
toolsId: string;
}
export interface UI5Yaml {
metadata: Metadata;
customConfiguration: AdpCustomConfiguration;
server: Server;
}
export interface UI5DeployYaml {
metadata: {
name: string;
};
type: string;
builder: {
customTasks: [UI5DeployYamlTask];
};
}
export interface UI5DeployYamlApp {
name: string;
description?: string;
package: string;
transport?: string;
}
export interface UI5DeployYamlTaskConfiguration {
target: {
destination?: string;
url?: string;
client?: string;
};
app: UI5DeployYamlApp;
}
export interface UI5DeployYamlTask {
name: string;
afterTask: string;
configuration: UI5DeployYamlTaskConfiguration;
}
export interface AdpCustomConfiguration {
adp: {
environment: string;
cfApiUrl?: string;
cfOrganization?: string;
cfSpace?: string;
};
}
export interface Metadata {
name: string;
}
export interface Server {
customMiddleware: CustomMiddleware[];
}
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;
authenticationType?: AuthenticationType;
};
};
}
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;
};
}
export interface SystemDetails {
url: string;
client: string;
username?: string;
password?: string;
authenticationType?: string;
}
export interface Package {
name: string;
main?: string;
dependencies?: {
[dependencyName: string]: string;
};
devDependencies?: {
[dependencyName: string]: string;
};
scripts?: {
[scriptName: string]: string;
};
version?: string;
}