import { ToolsLogger, type Logger } from '@sap-ux/logger'; import type { App, DefaultFlpPath, DefaultIntent, FlpConfig, Intent, CompleteTestConfig, MiddlewareConfig, RtaConfig, TestConfig, Ui5Version } from '../types/index.js'; import { type Manifest, type UI5FlexLayer } from '@sap-ux/project-access'; import { type Editor } from 'mem-fs-editor'; import type { MergedAppDescriptor } from '@sap-ux/axios-extension'; export interface CustomConnector { applyConnector: string; writeConnector: string; custom: boolean; } export interface SandboxAppConfig { tiles: { semanticObject: string; action: string; rootPath: string; }[]; rootIntent?: string; beforeFlpStart: string; afterFlpStart: string; restricted: { flexibilityServices: (CustomConnector | FlexConnector)[]; }; } export interface FlexConnector { connector: string; layers: string[]; url?: string; } type TestTemplateConfig = { id: string; framework: TestConfig['framework']; basePath: string; initPath: string; theme: string; }; export type PreviewUrls = { path: string; type: 'preview' | 'editor' | 'test'; }; /** * Internal structure used to fill the sandbox.html template */ export interface TemplateConfig { basePath: string; baseUrl: string; apps: Record; ui5: { /** * Comma-separated list of UI5 libraries to preload. * * @remarks Not rendered in sandbox2.ejs — the Sandbox 2.0 bootstrap manages its own library loading. */ libs: string; theme: string; /** * Flexibility service connector configuration. * * @remarks Rendered in sandbox.ejs as `data-sap-ui-flexibilityServices` for sandbox 1. * Not used by sandbox 2 — `generateSandboxAppConfig` calls `getFlexSettings()` independently * to populate `restricted.flexibilityServices` in the fioriSandboxAppConfig.json endpoint. */ flex: (CustomConnector | FlexConnector)[]; bootstrapOptions: string; resources: Record; /** * Major version of the UI5 framework being used. * * @remarks Mutated per request in flpGetHandler based on the resolved UI5 version. * Used by sandbox2.ejs to conditionally include SandboxBootTask.js (major 1) or * data-sap-ui-boot-manifest (major 2). */ versionMajor: number; }; init?: string; flexSettings?: { [key: string]: unknown; layer: UI5FlexLayer; developerMode: boolean; pluginScript?: string; }; features?: { feature: string; isEnabled: boolean; }[]; locateReuseLibsScript?: boolean; enhancedHomePage?: boolean; enableCardGenerator?: boolean; /** Disables UI2 personalization writes to the ABAP backend during ADP preview (ushell uses wrong adapter in sandbox 1). */ disableAppVariantStorage?: boolean; } /** * Static settings */ export declare const PREVIEW_URL: { readonly client: { readonly path: "/preview/client"; readonly getUrl: (basePath: string) => string; readonly local: string; readonly ns: "open.ux.preview.client"; }; readonly api: "/preview/api"; }; export declare const CARD_GENERATOR_DEFAULT: { readonly previewGeneratorSandbox: "/test/flpCardGeneratorSandbox.html"; readonly cardsStore: "/cards/store"; readonly i18nStore: "/editor/i18n"; }; /** * Default theme */ export declare const DEFAULT_THEME = "sap_horizon"; /** * Default path for mounting the local FLP. */ export declare const DEFAULT_PATH: DefaultFlpPath; /** * Default intent */ export declare const DEFAULT_INTENT: Readonly; /** * Type guard for FlexConnector. * * @param connector - the connector to check * @returns true if the connector is a FlexConnector, false otherwise */ export declare function isFlexConnector(connector: FlexConnector | CustomConnector): connector is FlexConnector; /** * Default configuration for the FLP. * * @param config partial configuration * @returns a full configuration with default values */ export declare function getFlpConfigWithDefaults(config?: Partial): FlpConfig; /** * The developer mode is only supported for adaptation projects, therefore, notify the user if it is wrongly configured and then disable it. * * @param config configurations from the ui5.yaml * @param logger logger instance */ export declare function sanitizeConfig(config: MiddlewareConfig, logger: ToolsLogger): void; /** * Sanitize the deprecated RTA configuration. * * @param deprecatedRtaConfig deprecated RTA configuration * @param logger logger instance * @returns sanitized RTA configuration */ export declare function sanitizeRtaConfig(deprecatedRtaConfig: MiddlewareConfig['rta'], logger?: Logger): RtaConfig | undefined; /** * Add an application to the local FLP preview. * * @param templateConfig configuration for the preview * @param manifest manifest of the additional target app * @param app configuration for the preview * @param logger logger instance */ export declare function addApp(templateConfig: TemplateConfig, manifest: Partial, app: App, logger: Logger): Promise; /** * Get the application name based on the manifest and app configuration. * * @param manifest - The application manifest. * @param intent - The app configuration. * @returns The application name. */ export declare function getAppName(manifest: Partial, intent?: Intent): string; /** * Remaps all relative resource-root URLs in a TemplateConfig so they are correct * relative to a different HTML page path (e.g. an editor path vs the FLP path). * * Only the entries that are derived from `basePath` are updated: * - the preview-client namespace (`open.ux.preview.client`) * - the primary application namespace (keyed by `appId`) * * Additional applications configured via `flpConfig.apps` use absolute `target` * values and therefore do not need remapping. * * @param config - cloned TemplateConfig already built for the FLP path * @param newPagePath - the path of the HTML page that will serve the resources (e.g. `editor.path`) * @param appId - the `sap.app.id` used as resource-root key for the primary application */ export declare function remapResourcesForPath(config: TemplateConfig, newPagePath: string, appId: string): void; /** * Creates the configuration object for the sandbox.html template. * * @param config FLP configuration * @param manifest application manifest * @param resources additional resources * @param isAdp whether this is an adaptation project * @param isCap whether this is a CAP project * @param logger optional logger instance * @returns configuration object for the sandbox.html template */ export declare function createFlpTemplateConfig(config: FlpConfig, manifest: Partial, resources?: Record, isAdp?: boolean, isCap?: boolean, logger?: Logger): TemplateConfig; /** * Creates the configuration object for the test template. * * @param config test configuration * @param id application id * @param theme theme to be used * @returns configuration object for the test template */ export declare function createTestTemplateConfig(config: CompleteTestConfig, id: string, theme: string): TestTemplateConfig; /** * Generates the fioriSandboxAppConfig.json content for Sandbox 2.0. * * @param templateConfig the current template configuration containing apps * @param flpConfig the FLP configuration containing the intent * @param isAdp whether this is an adaptation project - LocalStorageConnector is omitted for ADP * @param isCap whether this is a CAP project * @param logger optional logger instance * @returns the sandbox app config object */ export declare function generateSandboxAppConfig(templateConfig: TemplateConfig, flpConfig: FlpConfig, isAdp?: boolean, isCap?: boolean, logger?: Logger): SandboxAppConfig; /** * Returns the preview paths. * * @param config configuration from the ui5.yaml * @param logger logger instance * @returns an array of preview paths */ export declare function getPreviewPaths(config: MiddlewareConfig, logger?: ToolsLogger): PreviewUrls[]; /** * Returns true if the given UI5 version qualifies for the new FLP Sandbox (2.0). * * @param ui5Version - the UI5 version to check * @returns true if the version qualifies for the new sandbox */ export declare function qualifiesForNewSandbox(ui5Version: Ui5Version): boolean; /** * Generates the preview files. * * @param basePath path to the application root * @param config configuration from the ui5.yaml * @param fs file system editor * @param logger logger instance * @returns a mem-fs editor with the preview files */ export declare function generatePreviewFiles(basePath: string, config: MiddlewareConfig, fs?: Editor, logger?: ToolsLogger): Promise; export {}; //# sourceMappingURL=config.d.ts.map