import type { Plugin } from 'esbuild';
import type { IntentDeclaration } from '@dynatrace-sdk/navigation';
import type { DynatraceApplicationManifest } from '../../interfaces/manifest';
import type { UiCommands } from '../../interfaces';
import type { AppFunctionsBuildPlatform } from '../../build/build-functions';
export type { UiCommands } from '../../interfaces';
export { OperatingSystem } from '../../interfaces';
export declare const DEFAULT_SSO_URL = "https://sso.dynatrace.com";
/**
 * Configuration for static assets that are bundled with the application.
 * Assets are served by the development server and included in the deployed app package.
 * Supports file patterns, exclusions, and custom output paths for flexible asset management.
 * @internal
 * @example Default
 * assets: [
 *    {
 *      glob: '**\/*',
 *      ignore: [],
 *      input: 'src/assets',
 *      output: 'assets'
 *    },
 * ]
 */
export type CliAsset = {
    /**
     * Glob pattern specifying which files to include from the input directory.
     * Use UNIX-style path separators ('/') regardless of operating system.
     * Supports standard glob syntax like wildcards (*) and directory recursion (**).
     * @format valid-glob
     * @errorMessage has to be a glob pattern
     */
    glob: string;
    /**
     * Array of glob patterns for files to exclude from the asset bundle.
     * Useful for filtering out development files, tests, or temporary resources.
     * @itemsFormat valid-glob
     * @itemsErrorMessage has to be a glob pattern
     */
    ignore?: string[];
    /**
     * Source directory containing the assets to be processed.
     * Can be relative to project root or an absolute file system path.
     * All glob patterns are executed within this directory.
     */
    input: string;
    /**
     * Destination directory where assets will be copied in the build output.
     * Path is relative to the build distribution directory (distDir).
     * Maintains directory structure from the input folder.
     * @format relative-path
     * @errorMessage must be a relative path
     */
    output: string;
};
/**
 * Frontend UI build configuration controlling asset processing and bundling behavior.
 * Manages static resources like images, fonts, and other files served with the application.
 */
export type CliUiSource = {
    /**
     * Static asset configurations defining how files are copied and served.
     * Each asset configuration handles different types of static resources.
     * @internal
     */
    assets?: CliAsset[];
};
/**
 * Build configuration for individual workflow action components.
 * Defines entry points and TypeScript configuration for action-specific UI builds.
 */
export type CliActionSource = {
    /**
     * Main TypeScript/React entry file for the action's user interface.
     * Path is relative to the action's directory (`/widgets/actions/<name>`).
     * This file typically exports the action's main React component.
     * @default src/main.tsx
     */
    entryPoint?: string;
    /**
     * TypeScript configuration file for compiling the action's code.
     * Path is relative to the action's directory (`/widgets/actions/<name>`).
     * Should contain action-specific compiler options and path mappings.
     * @default tsconfig.json
     */
    tsconfig?: string;
};
/**
 * ESBuild plugin type alias for build process customization.
 * When using third-party ESBuild plugins, ensure they use the same ESBuild version as dt-app
 * to avoid compatibility issues. Version mismatches can lead to unexpected build failures or
 * runtime errors. Use `npm ls esbuild` to debug version conflicts.
 * @internal
 */
export type EsbuildPlugin = Plugin;
/**
 * Vite plugin type for build process customization.
 * This is a simplified structural type compatible with Vite's Plugin interface.
 * The full Vite Plugin type cannot be used here because ts-json-schema-generator
 * cannot handle its complex type hierarchy (Rolldown.Plugin generics).
 * When using third-party Vite plugins, ensure they are compatible with the Vite version used by dt-app.
 * Use `npm ls vite` to check the version.
 * @internal
 */
export type VitePlugin = {
    name: string;
};
/**
 * Configuration for build process plugins that extend compilation and bundling capabilities.
 * Plugins can modify code transformation, add custom loaders, or integrate with external tools.
 * @internal
 */
export type PluginConfiguration = {
    /**
     * Array of plugins to integrate into the build pipeline.
     * Supports both ESBuild plugins (for standard builds) and Vite plugins (for `--optimize` builds).
     * Plugins execute during compilation to transform code, handle assets, or perform custom processing.
     * Order matters as plugins are executed sequentially.
     * Plugin factories that return arrays (e.g. `vanillaExtractPlugin()`) are also supported
     * and will be flattened automatically.
     * @experimental
     * @default []
     */
    plugins?: (EsbuildPlugin | VitePlugin | (EsbuildPlugin | VitePlugin)[])[];
};
/**
 * Configuration options for customizing the application build process.
 * Controls compilation, bundling, asset processing, and output generation.
 */
export type AppBuildOptions = {
    /**
     * Path to the main HTML entry point file, relative to the project root.
     * This file serves as the template for the generated application.
     * @default ui/index.html
     * @format relative-path
     * @errorMessage must be a relative path
     */
    index?: string;
    /**
     * Whether the build should be performed in production or development mode.
     * @default 'production' when building and 'development' when using development server
     */
    mode?: 'production' | 'development';
    /**
     * Output source maps for app code and libraries. If set to 'true', only source maps for app code is included. Source maps for node_modules are included if the option is set to 'all'. By default, the option is treated as 'all' for development and 'false' for builds.
     * @default undefined
     * @errorMessage must be one of the following values: true, false, 'all'
     */
    sourceMaps?: boolean | 'all';
    /**
     * Use readable chunk names instead of content hashes in optimized builds.
     * Useful for comparing bundles across builds (e.g. in PR pipelines) and for debugging.
     * Only has an effect when using --optimize. The dev server never obfuscates chunk names regardless of this setting.
     * @default false
     */
    namedChunks?: boolean;
    /**
     * Location of source files.
     * @default ./
     */
    sourceRoot?: string;
    /**
     * Base path for application assets in the final build output.
     * Used to configure routing and asset loading in the deployed application.
     * @internal
     * @default ui/
     */
    baseHref?: string;
    /**
     * UI-specific build configuration including asset management and plugin settings.
     * Controls how frontend resources are processed and bundled.
     * If optimize is enabled, Vite plugins from this configuration will be used for the main UI build, and ESBuild plugins will be used for widgets.
     */
    ui?: CliUiSource & PluginConfiguration;
    /**
     * API-specific build configuration for backend processing and plugin integration.
     * Manages server-side code compilation and plugin execution.
     */
    api?: PluginConfiguration;
    /**
     * Advanced configuration for modifying Dynatrace platform dependencies.
     * Allows overriding or ignoring specific platform dependencies during build.
     * @experimental
     * @internal
     */
    dynatraceDependencies?: {
        /**
         * Override specific Dynatrace dependencies with custom versions.
         * Key is the dependency name, value is the semver-compliant version string.
         */
        addOrOverride?: Record<string, string>;
        /**
         * List of Dynatrace dependency names to exclude from the build.
         */
        ignore?: string[];
    };
};
/**
 * Configuration options for the local development server.
 * Controls how the application is served during development including network settings,
 * security policies, and SSL configuration.
 */
export type ServerOptions = {
    /**
     * Port where the app should be served.
     * @default 3000
     */
    port?: number;
    /**
     * The host IP to bind the dev server on.
     * @default 127.0.0.1
     */
    host?: string;
    /**
     * Whether build warnings should be displayed in the dev server or not.
     * @default false
     */
    showWarnings?: boolean;
    /**
     * Whether the dev server should add CSP headers to all requests. If `true`, the dev server will generate a set of default CSP Directives and add the custom CSP Directives to this set if specified. In local development, `frame-src` and `frame-ancestors` are always set to *
     * @default true
     */
    enableCSP?: boolean;
    /**
     * SSL/TLS certificate configuration for HTTPS development server.
     * Provides secure local development environment with custom certificates.
     */
    https?: ServerHttpsOptions;
};
/**
 * HTTPS configuration options for the development server.
 */
export type ServerHttpsOptions = {
    /**
     * Path to SSL certificate in PEM format
     */
    cert: string;
    /**
     * Path to private key in PEM format
     */
    key: string;
};
/**
 * App intent declarations, keyed by intent id.
 *
 * Each declaration is the `IntentDeclaration` from `@dynatrace-sdk/navigation`
 * widened with an open index signature. The platform backend still accepts
 * declaration properties that are not (yet) part of the typed
 * `IntentDeclaration` — for example `visualMode` or `modalContentHeight` — so
 * the index signature lets app teams keep authoring those without a type error
 * until they migrate to the current intent declaration structure.
 *
 * The open index signature is a temporary compatibility shim. It should be
 * removed once app teams have migrated to the typed `IntentDeclaration`
 * structure exposed by `@dynatrace-sdk/navigation`. The accompanying
 * `@deprecated` notice lives on the `intents` option so it surfaces on hover
 * in app configs.
 */
export type IntentsDeclarations = Record<string, IntentDeclaration & Record<string, unknown>>;
/**
 * Core application metadata and configuration options used to generate the Dynatrace app manifest.
 * Defines the app's identity, capabilities, security requirements, and integration features.
 */
export type AppOptions = {
    /**
     * The unique identifier of the app. Limited to 50 characters. Must be an alphanumeric string containing only lowercase characters.
     * @pattern ^[a-z0-9]+(\.[a-z0-9]+)*$
     * @maxLength 50
     */
    id: string;
    /**
     * The name of the app. Limited to 40 characters.
     * @maxLength 40
     */
    name: string;
    /**
     * The version of the app.
     */
    version: string;
    /**
     * The description of the app. Limited to 80 characters.
     * @maxLength 80
     */
    description: string;
    /**
     * Document type definitions for apps that handle custom document formats.
     * Defines how the app processes and displays specific document types.
     * Is relative to the sourceRoot.
     * @internal
     */
    documentTypes?: DocumentTypes;
    /**
     * Path to the app icon, can either be a .svg (recommended) or .png file. An icon will be auto-generated if no icon path is set.
     * @format relative-path
     * @errorMessage must be a relative path
     */
    icon?: string;
    /**
     * Hides the listing in the App Launcher. Useful for widget apps.
     */
    hidden?: boolean;
    /**
     * The list of app capabilities of handling the intents.
     * Use `IntentDeclaration` from `@dynatrace-sdk/navigation` for authoring intent declarations.
     *
     * @deprecated Intent declarations currently accept additional, untyped properties
     * (for example `visualMode`, `modalContentHeight`, `modalTitle`, `modalSize`) for
     * backwards compatibility. These extra properties are deprecated and will stop being
     * accepted in a future release. Migrate your declarations to the typed
     * `IntentDeclaration` structure from `@dynatrace-sdk/navigation`.
     */
    intents?: IntentsDeclarations;
    /**
     * The list of page tokens exposed by the app.
     */
    pageTokens?: Record<string, string>;
    /**
     * Workflow automation actions provided by the app.
     * Workflow automation actions are automatically deployed with the app when detected on the filesystem, regardless of whether they are explicitly configured here.
     * Enables integration with Dynatrace automation workflows and external systems.
     * Is relative to the sourceRoot.
     * @internal
     */
    actions?: Action[];
    /**
     * Content Security Policy directives specific to this application.
     * Defines allowed sources for fonts, images, scripts, and other resources.
     */
    csp?: CSPAppDirectives;
    /**
     * Defines special sandbox options that enable additional capabilities for functions
     */
    functionSandbox?: FunctionSandbox;
    /**
     * The list of scopes required by the app.
     */
    scopes: OAuthScope[];
    /**
     * The self monitoring agent url
     */
    selfMonitoringAgent?: string;
    /**
     * UI command definitions for extending Dynatrace interface functionality.
     * Allows apps to contribute commands to menus, toolbars, and context actions.
     * @experimental
     * @internal
     */
    uiCommands?: UiCommands;
    /**
     * Configuration widgets for app-specific settings management.
     * Settings widgets are automatically deployed with the app when detected on the filesystem, regardless of whether they are explicitly configured here.
     * Provides structured forms for users to configure app behavior and preferences.
     * Is relative to the sourceRoot.
     * @experimental
     * @internal
     */
    settings?: SettingsManifest;
    /**
     * Documents handling configuration for apps that process custom document types.
     * Defines document schemas, rendering, and interaction capabilities.
     * Is relative to the sourceRoot.
     * @experimental
     * @internal
     */
    documents?: DocumentsManifest;
};
/**
 * Base configuration for workflow automation actions.
 * Actions provide reusable automation components that can be triggered by workflows,
 * other apps, or external systems within the Dynatrace platform.
 */
export type ActionBase = {
    /**
     * Human-readable title displayed in workflow editors and action catalogs.
     * Should be concise and descriptive of the action's primary function.
     */
    title: string;
    /**
     * Detailed description explaining the action's purpose, inputs, and behavior.
     * Used in documentation and workflow design interfaces.
     */
    description: string;
    /**
     * Unique identifier for the action within the application scope.
     * Used for action registration, invocation, and workflow references.
     */
    name: string;
    /**
     * Legacy flag indicating whether the action maintains state between executions.
     * @deprecated State management is now handled by the workflow engine
     */
    stateful?: boolean;
    /**
     * Build configuration specific to this action's UI components and compilation.
     * @deprecated Build configuration is now handled at the application level
     */
    build?: CliActionSource & PluginConfiguration;
};
type ActionExtension = {
    /**
     * @deprecated
     * Further properties that need to be part of the manifest.
     */
    [key: string]: any;
};
export type Action = ActionBase & ActionExtension;
/**
 * @internal
 */
export type ActionManifest = Omit<Action, 'build'> & FunctionManifest;
/**
 * Configuration manifest for application settings widgets.
 * Defines structured configuration forms that users can interact with to customize app behavior.
 * @internal
 */
export type SettingsManifest = {
    [key: string]: {
        /**
         * Display name for the settings widget shown in the configuration interface.
         */
        name: string;
        /**
         * Optional description explaining the purpose and impact of these settings.
         */
        description?: string;
        /**
         * Array of JSON schema identifiers that define the structure and validation rules
         * for the configuration data managed by this settings widget.
         */
        schemaIds: string[];
    };
};
/**
 * Manifest configuration for document handling capabilities within the application.
 * Defines how the app processes, displays, and interacts with custom document types.
 * @internal
 */
export type DocumentsManifest = {
    [key: string]: {
        /**
         * Optional display name for the document handler in the Dynatrace interface.
         */
        name?: string;
        /**
         * Optional description of the document type and its processing capabilities.
         */
        description?: string;
    };
};
/**
 * Manifest for document type definitions including visual representation.
 * Maps document type identifiers to their display properties and iconography.
 * @internal
 */
export type DocumentTypesManifest = {
    [key: string]: {
        /**
         * Human-readable name for the document type displayed in interfaces.
         */
        name: string;
        /**
         * Optional icon identifier or path for visual representation of the document type.
         */
        icon?: string;
    };
};
/**
 * Runtime configuration for serverless functions and workflow actions.
 * Controls execution behavior and lifecycle management.
 * @internal
 */
export type FunctionManifest = {
    /**
     * Indicates whether the function can be paused and resumed across execution cycles.
     * Enables long-running workflows that can survive platform restarts or scaling events.
     */
    resumable?: boolean;
};
/**
 * Defines special sandbox options that enable additional capabilities for functions
 */
export type FunctionSandbox = {
    /**
     * Explicitly allows the app to use JavaScript features that evaluate code from strings at runtime (like eval()).
     * This opens up the risk of remote-code execution (RCE) from untrusted input.
     */
    'unsafe-eval'?: UnsafeEval;
};
/**
 * Explicitly allows the app to use JavaScript features that evaluate code from strings at runtime (like eval()).
 * This opens up the risk of remote-code execution (RCE) from untrusted input.
 */
export type UnsafeEval = {
    /**
     * Enables/disables the usage of the eval() JavaScript function in the scope of a dynatrace app function.
     */
    value: boolean;
    /**
     * Additional comment to specify why the eval() function is being used.
     */
    comment: string;
};
/**
 * Content Security Policy (CSP) directives configuration for enhanced application security.
 * Defines trusted sources for various types of resources to prevent XSS and data injection attacks.
 * Each directive type corresponds to a specific CSP header directive.
 */
export type CSPAppDirectives = {
    /**
     * The font-src directive specifies valid sources for fonts loaded.
     */
    'font-src'?: DirectiveValue[];
    /**
     * The img-src directive specifies valid sources of images and favicons.
     */
    'img-src'?: DirectiveValue[];
    /**
     * The media-src directive specifies valid sources for loading media.
     */
    'media-src'?: DirectiveValue[];
    /**
     * The style-src directive specifies valid sources for stylesheets.
     */
    'style-src'?: DirectiveValue[];
    /**
     * The script-src directive specifies valid sources for JavaScript. This includes not only URLs loaded directly into script elements, but also things like inline script event handlers (onclick) and XSLT stylesheets which can trigger script execution.
     */
    'script-src'?: DirectiveValue[];
};
/**
 * Individual CSP directive value with documentation for security compliance.
 * Combines the actual directive value with explanatory context for security audits.
 */
export type DirectiveValue = {
    /**
     * The CSP directive value (e.g., URL, keyword like 'self', 'unsafe-inline').
     * Must follow CSP specification syntax for the corresponding directive type.
     */
    value: string;
    /**
     * Human-readable explanation for why this directive value is necessary.
     * Required for security audits and compliance documentation.
     */
    comment: string;
};
/**
 * OAuth 2.0 scope definition for Dynatrace API access permissions.
 * Defines specific API capabilities required by the application with justification.
 * @internal
 */
export type OAuthScope = {
    /**
     * The OAuth scope identifier as defined by Dynatrace API documentation.
     * Corresponds to specific API endpoints or data access permissions.
     */
    name: string;
    /**
     * Explanation of why this scope is required by the application.
     * Used for permission reviews and compliance documentation.
     */
    comment: string;
};
/**
 * Main configuration object for the dt-app toolkit. The toolkit automatically resolves
 * a config file named `app.config.json` from the project's root directory when running commands.
 * This type defines all available configuration options for building, serving, and managing Dynatrace apps.
 */
export type CliOptions = {
    /**
     * URL to the environment of the project.
     * @format url
     * @errorMessage must contain a valid 'environmentUrl'. Please specify one in your 'app.config.(json|js|ts|cts)' file
     */
    environmentUrl: string;
    /**
     * Configuration options for the build process including source paths, output settings,
     * bundling behavior, and asset management. Controls how your app is compiled and packaged.
     */
    build?: AppBuildOptions;
    /**
     * Core application metadata and configuration including app ID, name, version, description,
     * permissions, intents, actions, and other manifest properties required for app registration.
     */
    app: AppOptions;
    /**
     * Controls whether the Dynatrace SDK is automatically injected into your application.
     * When enabled, provides access to Dynatrace platform APIs and services.
     * @internal
     * @default true
     */
    injectSdk?: boolean;
    /**
     * Development server configuration including port, host, SSL settings, and CSP options.
     * Used when running the app locally during development.
     */
    server?: ServerOptions;
    /**
     * Array of plugin module paths that extend CLI functionality.
     * Plugins can modify build processes, add new commands, or integrate with external tools.
     * @experimental
     */
    plugins?: string[];
};
/**
 * Document type definitions for applications that handle custom document formats.
 * Maps document type identifiers to their display properties and metadata.
 * @internal
 */
export type DocumentTypes = {
    [key: string]: {
        /**
         * Human-readable name for the document type displayed in the Dynatrace interface.
         * Used in file browsers, document listings, and type selection dialogs.
         */
        name: string;
    };
};
/**
 * @internal
 * @deprecated The type will be removed in 1.0
 */
export type CliEnvFlags = {
    /**
     * Provides the client credentials when authenticating against SSO.
     */
    oauthClientSecret?: string | undefined;
};
/**
 * Flags to manipulate dt-app commands.
 * @internal
 */
export type CliFlags = {
    /**
     * The root directory of the project.
     * @default process.cwd()
     */
    root?: string;
    /**
     * Don't actually perform the command. Used for deploy and uninstall. Can only be set with CLI flag `--dry-run`
     * @default false
     */
    dryRun?: boolean;
    /**
     * Disable live reload (file watcher) of development server.
     * Used for dev command. Can only be set with CLI flag `--no-live-reload`.
     * @default false
     */
    noLiveReload?: boolean;
    /**
     * Disable all security hardening measures (CSRF session token, CSP enforcement, strict CORS).
     * Used for dev command. Can only be set with CLI flag `--no-security-hardening`.
     * @internal
     * @default false
     */
    noSecurityHardening?: boolean;
    build?: {
        typeCheck?: boolean;
        optimize?: boolean;
        enableCodeSplitting?: boolean;
        namedChunks?: boolean;
    };
    server?: {
        /**
         * Whether the dev server should open the browser automatically after startup.
         * @default true
         */
        open: boolean;
    };
};
/**
 * @internal
 */
export type CliFlagOptions = CliOptions & CliFlags;
/**
 * @internal
 */
export type ResolvedCliAsset = Required<CliAsset>;
/**
 * @internal
 */
export type ResolvedCliUiSource = Omit<Required<CliUiSource> & Partial<PluginConfiguration>, 'assets'> & {
    assets: ResolvedCliAsset[];
};
type ResolvedCliActionSource = Required<CliActionSource> & Partial<PluginConfiguration>;
/**
 * @internal
 */
export type ResolvedAction = Omit<ActionBase, 'build'> & {
    build: ResolvedCliActionSource;
};
/**
 * @internal
 */
export type ResolvedBuildOptions = Omit<Required<AppBuildOptions>, 'ui' | 'api' | 'functions' | 'sourceMaps'> & {
    sourceMaps?: boolean | 'all';
    ui: ResolvedCliUiSource;
    api: PluginConfiguration;
    typeCheck: boolean;
    optimize?: boolean;
    enableCodeSplitting?: boolean;
    namedChunks?: boolean;
};
/**
 * @internal
 */
export type ResolvedAppOptions = Omit<DynatraceApplicationManifest, 'actions' | 'icon' | 'app-bundle-version'> & {
    actions?: ResolvedAction[];
    selfMonitoringAgent?: string;
};
/**
 * @internal
 */
export type ResolvedServerOptions = Omit<Required<ServerOptions>, 'https'> & {
    https?: {
        cert: string;
        key: string;
    };
    /**
     * Whether the project should be opened in the browser after startup or not.
     * @default true
     */
    open: boolean;
};
/**
 * @internal
 */
export type ResolvedCliOptions = Omit<Required<CliFlagOptions>, 'build' | 'server' | 'dev' | 'icon'> & {
    root: string;
    distDir: string;
    oauth2File: string;
    appFunctionsBuildPlatform: AppFunctionsBuildPlatform;
    build: ResolvedBuildOptions;
    server: ResolvedServerOptions;
    app: ResolvedAppOptions;
};
export type DefaultableCliOptions = Omit<ResolvedCliOptions, 'environmentUrl' | 'app' | 'icon' | 'oauth2File'>;
export interface UiFilePaths {
    entryPoint: string;
    assetsInput: string;
    tsConfigFullPath: string;
}
/**
 * @deprecated The type will be removed in 1.0
 */
export type DeprecatedPluginConfiguration = {
    /**
     * Plugins that should be used to inject code into various parts of the build process.
     * @deprecated This property will be removed
     * @default []
     */
    plugins?: EsbuildPlugin[];
};
/**
 * @deprecated The type will be removed in 1.0
 */
export type ActionPluginConfiguration = {
    /**
     * Plugins that should be used to inject code into various parts of the build process.
     * By default it is inherited from the `build.functions.plugins`
     * @deprecated This property will be removed.
     * @default build.functions.plugins
     */
    plugins?: EsbuildPlugin[];
};
/**
 * @deprecated The type will be removed in 1.0
 */
export type WidgetPluginConfiguration = {
    /**
     * Plugins that should be used to inject code into various parts of the build process.
     * By default it is inherited from the `build.ui.plugins`
     * @deprecated This property will be removed.
     * @default build.ui.plugins
     */
    plugins?: EsbuildPlugin[];
};
export type LegacyFileConfigConfiguration = {
    root: string;
    oauthClientId: string;
    distDir: string;
    oauth2File: string;
    build: {
        baseHref: string;
        settingsPath: string;
        sourceRoot: string;
        ui: {
            entryPoint: string;
            tsconfig: string;
            assets: string;
            additionalEntryPoints: string[];
            sourceMaps?: boolean | 'all';
        };
        functions: {
            input: string;
            glob: string;
            tsconfig: string;
            sourceMaps?: boolean | 'all';
        } & DeprecatedPluginConfiguration;
        widgets: WidgetPluginConfiguration;
        actions: ActionPluginConfiguration;
    };
    dev?: {
        fileWatcher?: {
            ignore: string[];
            include: string[];
        };
    };
    server?: {
        open: boolean;
    };
};
