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.
55 lines (54 loc) • 2.17 kB
TypeScript
import type { FastifyInstance, FastifyPluginCallback } from 'fastify';
import type { ResolvedCliOptions } 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;
/** Either ExecutionMode.RUNTIME or ExecutionMode.RUNTIME_SIMULATOR */
executionMode: ExecutionMode;
};
export declare const enum ExecutionMode {
RUNTIME_SIMULATOR = "runtime-simulator",
RUNTIME = "js-runtime"
}
/** 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;
}>;
/** 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(options: ResolvedCliOptions, 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;