import type { User } from '@dynatrace-sdk/client-metadata'; import { type JSONValue } from '@dynatrace/openkit-js'; export declare const LOGGER_SCOPE = "TELEMETRY"; export declare enum TelemetryBizEventType { VALUE = "value", ERROR = "error", CRASH = "crash", COMMAND = "command", AI_RESOURCE = "ai-resource" } export type TelemetryBizEvent = { 'event.category': TelemetryBizEventType; name: string; payload?: object; /** * Top-level payload keys whose values are already sanitized and must NOT be * re-cleaned (e.g. path-valued config metrics). */ rawPayloadKeys?: string[]; }; export type TelemetryBizEventEnriched = { sessionId: string; 'event.category': string; 'event.provider': string; operatingSystemVersion: string; appId: string; appVersion: string; tenantId: string; [key: string]: JSONValue; }; /** The outcome of a CLI or VS Code command, reported alongside `durationMs`. */ export type CommandOutcome = 'success' | 'failure'; /** * 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 * @param skipKeys Top-level keys to leave untouched (already sanitized values) * @returns A clean telemetry object */ export declare function deepCleanTelemetryPayload(obj: object, skipKeys?: Set): 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; /** * Fetch user data from the tokens file. * * Passes the token from the tokens file to `getUser` explicitly instead of letting * `dtFetch` acquire one: this function runs on the telemetry path, which must never * trigger an interactive SSO login. If the stored token is expired the request simply * fails and telemetry continues without user information. * @param oauth2File Path to the tokens file * @returns User information */ export declare function fetchUserFromTokenFile(oauth2File: string): Promise; /** * 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;