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.

58 lines (57 loc) 2.41 kB
import type { FastifyInstance, FastifyPluginCallback } from 'fastify'; import type { FunctionSandbox } from '../../utils/config/cli-options'; export type FileMap = Record<string, { content: Buffer; filename?: string; sourceMap?: Buffer; isOfType?: 'function' | 'action'; }>; /** Configuration options */ export type FastifyAppFunctionPluginOptions = { /** Absolute path to the app */ baseDir: string; /** Absolute path to the app functions */ functionsDir: string; /** The base path where the app functions are served under */ apiBasePath: string; /** A function that provides a token */ getToken: () => Promise<string>; /** The environment URL */ environmentUrl: string; /** The app ID */ appId: string; /** The app version */ appVersion: string; /** The app Name */ appName: string; /** The tenant ID */ tenantId?: string; /** Localhost endpoint URL */ devProxyUrl: string; /** Defines special sandbox options that could be enable for functions */ functionSandbox?: FunctionSandbox; }; /** Factory function for creating the fastify app function plugin */ export declare function fastifyAppFunctionPlugin( /** Options for the fastify plugin */ options: FastifyAppFunctionPluginOptions): Promise<{ plugin: FastifyPluginCallback; update: (fileMap: FileMap, reset?: boolean) => void; }>; /** * Registers a secondary listener that is notified alongside the Fastify update handler. * Used by the Vite HMR plugin so it can receive esbuild output without importing Vite code * into the build watchers. * @todo Please remove this when fully switching to vite only */ export declare function registerExtraFunctionUpdateListener(listener: (fileMap: FileMap) => void): void; /** Returns updateFunctions */ export declare function executeUpdateFunctions(fileMap: FileMap): void; /** Helper function that will register new function plugin on the fastify server */ export declare function registerFunctionPlugin(server: FastifyInstance): Promise<void>; /** * Extracts the tenant ID from the environment URL or returns a placeholder if it could not be extracted. * @param environmentUrl The environment URL to extract the tenant ID from. * @returns The extracted tenant ID or placeholder if it could not be extracted. */ export declare function extractTenantIdFromEnvUrl(environmentUrl: string): string;