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.
46 lines (45 loc) • 2.09 kB
TypeScript
import type { ResolvedCliOptions } from '../../../utils/config/cli-options';
import type { FileMap } from '../../../create-project/utils/file-map';
type InjectOptions = {
/** Default `'head'` */
location?: 'head' | 'body';
/** Default `false` */
defer?: boolean;
type?: string;
};
export type HtmlBuilder = {
setAppName: (appName: string) => HtmlBuilder;
setBaseURL: (url: string) => HtmlBuilder;
setRootID: (rootId: string) => HtmlBuilder;
injectScript: (url: string, options?: InjectOptions) => HtmlBuilder;
addInjectionMarker: () => HtmlBuilder;
injectScriptWithContent: (content: string, location?: 'head' | 'body') => HtmlBuilder;
injectStylesheet: (url: string) => HtmlBuilder;
build: () => string;
};
/**
* Utility for building the index entry html file and injecting dependencies into
* it.
*/
export declare function getIndexHtmlBuilder(userHtmlPath?: string): HtmlBuilder;
/**
* Populates the created index HTML with all the content needed (css, scripts)
* @param options The CLI options we are getting
* @param uiFiles The filemap containing ui files
* @param normalizedBaseHref The baseHref in normalized format
* @param webSocketUrlScript The url script of the websocket
* @param sdkShimScript The script of the sdk
* @returns The HTML index page in Buffer format
*/
export declare function getHTMLContent(options: ResolvedCliOptions, uiFiles: FileMap, normalizedBaseHref: string, webSocketUrlScript: string, sdkShimScript: string, uiFilesEntryPoint: string, sessionTokenScript?: string): Buffer;
/**
* Injecting the agent script into the index.html.
* If it is an internal app (appId: dynatrace.*) it will not inject the selfmonAgentConfig so the actions from the agent will correlate with the top level session.
* @param html
* @param agentUrl
* @param distDir path where the ui is located e.g. dist/ui or dist/widgets/actions/action-1
* @param appId
* @param uiFiles
*/
export declare function injectAgent(html: HtmlBuilder, agentUrl: string, distDir: string, appId: string): Promise<void>;
export {};