UNPKG

dt-app

Version:

The Dynatrace App Toolkit is a tool you can use from your command line to create, develop, and deploy apps on your Dynatrace environment.

64 lines (63 loc) 4 kB
import { AppFunctionsBuildPlatform } from '../../build/build-functions'; import type { CliFlagOptions, CliEnvFlags, CliFlags, CliOptions, DefaultableCliOptions, LegacyFileConfigConfiguration, ResolvedCliOptions, ResolvedCliUiSource, UiFilePaths } from './cli-options'; /** Returns the path to the OAuth2 token file. */ export declare function getOAuth2FilePath(root: string): string; /** * Resolves UI file paths for projects using legacy or fallback structure patterns. * * This function handles three distinct project structure scenarios: * 1. **New structure**: `<sourceRoot>/ui/main.tsx` exists - Returns new-structure paths * 2. **Legacy structure**: `<sourceRoot>/main.tsx` exists - Returns legacy-specific paths * 3. **No UI**: Neither `<sourceRoot>/ui/main.tsx` nor `<sourceRoot>/main.tsx` exist - Returns `null` * * @param root - Absolute path to the project root directory * @param sourceRoot - Relative path from root to source directory (e.g., 'src', './') * @param uiOptions - UI build source configuration from app.config options assets * * @returns {UiFilePaths | null} Resolved UI file paths, or `null` when no UI entry point exists. * Callers are responsible for deciding whether a missing UI is valid (e.g. hidden apps). * */ export declare function resolveUiFilePaths(root: string, sourceRoot: string, uiOptions: ResolvedCliUiSource): UiFilePaths | null; /** * Helper function that will return default CLI options based on the isDev flag * @internal */ export declare function getDefaultCliOptions(isDev: boolean, sourceRoot?: string, root?: string): DefaultableCliOptions; /** * Normalize the baseHref to always end with a slash. * @returns Normalized baseHref */ export declare function getNormalizedBaseHrefWithSlash(baseHref: string): string; /** Tries to normalize given Url. Returns param if not successful */ export declare function tryNormalizeUrl(url: string): string; /** * Merges `b` onto `a` and returns a new object. Neither input is mutated. * * Merge rules: * - **Plain objects** are deep-merged recursively (lodash `mergeWith` default behavior). * - **Arrays** are replaced wholesale — the array from `b` wins in its entirety. * This differs from lodash's default, which would merge arrays index-by-index. * - **Arrays of objects for known keys** (`assets`, `actions`) additionally have * per-item defaults from `arrayObjectDefaults` merged into every element before * the array is set. This ensures, for example, that every asset always carries * an `ignore` field even when the caller omitted it. * - **`undefined` values in `b`** are ignored; the corresponding value from `a` * is kept. This lets partial configs omit fields without clearing them. */ export declare function mergeRecursively(a: any, b: any): any; /** Prints warning to the terminal if app config has deprecated options defined */ export declare function printPathConfigurationsWarnings(fileConfig: Partial<LegacyFileConfigConfiguration>, argsConfig: Partial<CliOptions & CliFlags & CliEnvFlags & { appFunctionsBuildPlatform: AppFunctionsBuildPlatform; global: string; }>): void; /** Patches UI assets input based on resolved filesystem structure (new vs legacy). */ export declare function applyUiPathConventions(options: ResolvedCliOptions): void; /** Validates declared actions and resolves them to their final form. */ export declare function validateAndPruneActions(options: ResolvedCliOptions): Promise<void>; /** Checks self-monitoring agent reachability and clears the URL if unreachable. */ export declare function validateSelfMonAgent(options: ResolvedCliOptions): Promise<void>; /** Merges CLI args, config file, and environment variables into resolved options. Pure and synchronous. */ export declare function mergeOptions(argsConfig: Partial<CliFlagOptions & { appFunctionsBuildPlatform: AppFunctionsBuildPlatform; }>, fileConfig: CliOptions, envConfig?: Record<string, string | undefined>, isDev?: boolean): ResolvedCliOptions;