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.
86 lines (85 loc) • 2.81 kB
TypeScript
import type { User } from '@dynatrace-sdk/client-metadata';
import { type JSONObject } from '@dynatrace/openkit-js';
export declare enum TelemetryBizEventType {
VALUE = "value",
ERROR = "error",
CRASH = "crash",
COMMAND = "command"
}
export type TelemetryBizEvent = {
'event.category': TelemetryBizEventType;
name: string;
payload?: object;
};
export type TelemetryBizEventEnriched = {
sessionId: string;
'event.type': string;
'event.category': string;
'event.provider': string;
operatingSystemVersion: string;
appId: string;
appVersion: string;
tenantId: string;
[key: string]: string | JSONObject;
};
/**
* Returns an proper object if object is an error else returns the original object
* @param obj Object to check and fix
* @returns Object to flatten
*/
export declare function transformToObjectIfError(obj: object): object;
/**
* Function to deep clean telemetry payload objects
* @param obj The object to clean
* @returns A clean telemetry object
*/
export declare function deepCleanTelemetryPayload(obj: object): object;
/**
* Generate a new and valid random session id
* @returns session id as a number
*/
export declare function generateNewSessionId(): number;
/**
* Check if the session id is valid
* @param value session id as string
* @returns true if valid
*/
export declare function isSessionIdValid(value: string): boolean;
/**
* Remove any outdated session file
*/
export declare function clearSessionFileIfOutdated(): void;
/**
* Check if session is outdated (older than 24h)
* @param createTimeInMs The time the session file has been created in milliseconds
*/
export declare function isSessionFileOutdated(createTimeInMs: Date): boolean;
/**
* Initialize the session file
* @param sessionId The session id as number
*/
export declare function initializeSessionFile(sessionId: number): Promise<number>;
/**
* Fetch user data from the tokens file
* @param oauth2File Path to the tokens file
* @returns User information
*/
export declare function fetchUserFromTokenFile(oauth2File: string): Promise<User | undefined>;
/**
* Parse the node command line arguments and combine them into an object
* @param args The array of command line arguments
* @returns Object containing the arguments and respective values
*/
export declare function parseCommandArgs(args: string[]): object;
/**
* Extract the session type from the environment url
* @param url The url to extract from
* @returns The session type
*/
export declare function extractSessionTypeFromEnvUrl(url: string): string;
/**
* Get the type of a user (internal/external/heimdall/not available)
* @param user The user to check
* @returns The correct user classification
*/
export declare function getUserType(input?: User | string): string;