UNPKG

@salesforce/plugin-telemetry

Version:

Command usage and error telemetry for the Salesforce CLI

47 lines (46 loc) 1.48 kB
import type { Attributes } from '@salesforce/telemetry'; import { AsyncCreatable } from '@salesforce/kit'; import { JsonMap } from '@salesforce/ts-types'; export type TelemetryOptions = { cacheDir?: string; telemetryFilePath?: string; executable?: string; }; export default class Telemetry extends AsyncCreatable { /** * The name of event telemetry type. */ static EVENT: string; /** * The name of exception telemetry type. */ static EXCEPTION: string; /** * The temporary directory where telemetry log files are stored. */ static tmpDir: string; private static cacheDir; private static executable; private static telemetryTmpFile; private static acknowledged; firstRun: boolean; private fileDescriptor; private cliId?; constructor(options: TelemetryOptions); /** * Tell the user they acknowledge data collection. */ static acknowledgeDataCollection(): Promise<void>; getTelemetryFilePath(): string; getCLIId(): string; /** * Record data to the telemetry file. Only valid properties will be recorded to the file, which * are strings, numbers, and booleans. All booleans get logged to App Insights as string representations. */ record(data: JsonMap): void; recordError(error: Error, data: JsonMap): void; clear(): Promise<void>; read(): Promise<Attributes[]>; upload(): void; protected init(): Promise<void>; }