@amplitude/ampli
Version:
Amplitude CLI
203 lines (202 loc) • 8.2 kB
TypeScript
import { NodeClient, Response } from '@amplitude/node';
import { BaseEvent, Event, EventOptions, GroupOptions, IdentifyOptions, Options, MiddlewareExtra } from '@amplitude/types';
export declare type Environment = 'production' | 'development';
export declare const ApiKey: Record<Environment, string>;
export declare const DefaultOptions: Partial<Options>;
export interface LoadOptionsBase {
disabled?: boolean;
}
export declare type LoadOptionsWithEnvironment = LoadOptionsBase & {
environment: Environment;
client?: {
options?: Partial<Options>;
};
};
export declare type LoadOptionsWithApiKey = LoadOptionsBase & {
client: {
apiKey: string;
options?: Partial<Options>;
};
};
export declare type LoadOptionsWithClientInstance = LoadOptionsBase & {
client: {
instance: NodeClient;
};
};
export declare type LoadOptions = LoadOptionsWithEnvironment | LoadOptionsWithApiKey | LoadOptionsWithClientInstance;
export interface IdentifyProperties {
amplitudeAdmin?: boolean;
approvalWorkflowEnabled?: boolean;
email?: string;
name?: string;
orgId?: string;
orgName?: string;
plan?: string;
plannedEventCount?: number;
projectSpaceId?: string;
projectSpaceName?: string;
role?: "amp-admin" | "org-admin" | "manager" | "member" | "viewer" | "none";
team?: "product" | "engineering" | "marketing" | "growth" | "other" | "customer-success" | "executive" | "design" | "data" | "sales" | "operations" | "finance";
}
export interface GroupProperties {
"[Amplitude] Group ID"?: {
[k: string]: any;
};
"[Amplitude] Group name"?: {
[k: string]: any;
};
branchName?: string;
branchPublishedChangeCount?: number;
branchUnpublishedChangeCount?: number;
"c_Cus Region"?: {
[k: string]: any;
};
"Contract Initial Start Date"?: {
[k: string]: any;
};
createdAt?: string;
destinations?: string[];
environmentName?: "Production" | "Development";
eventCount?: number;
eventNamingConvention?: "UPPER CASE" | "lower case" | "Sentence case" | "Title Case" | "CamelCase" | "lowerCamelCase" | "snake_case" | "Custom" | "None";
eventPropertiesWithOverridesCount?: number;
eventPropertyCount?: number;
eventsWithIssuesL7d?: number;
features?: string[];
flaggedMissingPropertyCountL7d?: number;
flaggedMixedPropertyTypesCountL7d?: number;
groupPropertiesWithOverridesCount?: number;
hasAppWithData?: boolean;
hasData?: boolean;
invalidMissingPropertyCountL7d?: number;
invalidPropertyTypeCountL7d?: number;
invalidPropertyValueCountL7d?: number;
migrationType?: "New Customer" | "Force Migrated" | "Self Opt-in" | "All-in Opt-in";
name?: string;
numberOfDataProjects?: number;
numberOfGovernProjects?: number;
"org csm"?: {
[k: string]: any;
};
"org name"?: string;
"org status"?: {
[k: string]: any;
};
orgId?: string;
orgName?: string;
propertyNamingConvention?: "UPPER CASE" | "lower case" | "Sentence case" | "Title Case" | "CamelCase" | "lowerCamelCase" | "snake_case" | "Custom" | "None";
"service team"?: {
[k: string]: any;
};
"service tier"?: {
[k: string]: any;
};
sharedEventPropertyCount?: number;
sharedGroupPropertyCount?: number;
sources?: string[];
"subscription end"?: {
[k: string]: any;
};
"subscription start"?: {
[k: string]: any;
};
unexpectedEventCount?: number;
unexpectedPropertiesEventCount?: number;
userCount?: number;
userPropertyCount?: number;
workspaceId?: number;
}
export interface CommandFailedProperties {
branchMappedAutomatically?: boolean;
branchMappedToMain?: boolean;
flags: string[];
name: "Export" | "Help" | "Import" | "Info" | "Init" | "Pull" | "Verify" | "Unknown" | "WhoAmI" | "Source" | "Branch" | "Login" | "Logout" | "Checkout" | "Status" | "Setup";
runtimeLanguage: "c#" | "go" | "java" | "javascript" | "kotlin" | "obj-c" | "php" | "python" | "ruby" | "rust" | "scala" | "swift" | "typescript" | "unknown";
runtimePlatform: "android" | "ios" | "browser" | "jre" | "react-native" | "node.js" | ".net" | "*" | "unknown";
runtimeVersion: "ampli" | "v1" | "v2" | "v3" | "v4" | "unknown" | "ampli-v2";
version: string;
}
export interface CommandRanProperties {
branchMappedAutomatically?: boolean;
branchMappedToMain?: boolean;
flags: string[];
name: "Branch" | "Checkout" | "Export" | "Help" | "Import" | "Info" | "Init" | "Login" | "Pull" | "Source" | "Status" | "Unknown" | "Verify" | "WhoAmI" | "Logout" | "Setup";
runtimeLanguage: "c#" | "go" | "java" | "javascript" | "kotlin" | "obj-c" | "php" | "python" | "ruby" | "rust" | "scala" | "swift" | "typescript" | "unknown";
runtimePlatform: "android" | "ios" | "browser" | "jre" | "react-native" | "node.js" | ".net" | "*" | "unknown";
runtimeVersion: "ampli" | "v1" | "v2" | "v3" | "v4" | "unknown" | "ampli-v2";
version: string;
}
export interface UserSignedInProperties {
platform: string;
version?: string;
}
export interface BranchMappingProperties {
branchMappedAutomatically?: boolean;
branchMappedToMain?: boolean;
}
export interface CommandProperties {
flags: string[];
}
export interface RuntimeProperties {
runtimeLanguage: "c#" | "go" | "java" | "javascript" | "kotlin" | "obj-c" | "php" | "python" | "ruby" | "rust" | "scala" | "swift" | "typescript" | "unknown";
runtimePlatform: "android" | "ios" | "browser" | "jre" | "react-native" | "node.js" | ".net" | "*" | "unknown";
runtimeVersion: "ampli" | "v1" | "v2" | "v3" | "v4" | "unknown" | "ampli-v2";
}
export declare class Identify implements BaseEvent {
event_properties?: IdentifyProperties | undefined;
event_type: string;
constructor(event_properties?: IdentifyProperties | undefined);
}
export declare class Group implements BaseEvent {
event_properties?: GroupProperties | undefined;
event_type: string;
constructor(event_properties?: GroupProperties | undefined);
}
export declare class CommandFailed implements BaseEvent {
event_properties: CommandFailedProperties;
event_type: string;
constructor(event_properties: CommandFailedProperties);
}
export declare class CommandRan implements BaseEvent {
event_properties: CommandRanProperties;
event_type: string;
constructor(event_properties: CommandRanProperties);
}
export declare class UserSignedIn implements BaseEvent {
event_properties: UserSignedInProperties;
event_type: string;
constructor(event_properties: UserSignedInProperties);
}
export declare class Ampli {
private disabled;
private amplitude;
get client(): NodeClient;
get isLoaded(): boolean;
private isInitializedAndEnabled;
load(options: LoadOptions): void;
identify(userId: string | undefined, properties?: IdentifyProperties, options?: IdentifyOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
setGroup(userId: string | undefined, name: string, value: string, options?: GroupOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
groupIdentify(groupType: string, groupName: string, properties?: GroupProperties, options?: GroupOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
track(userId: string | undefined, event: Event, options?: EventOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
flush(): {
promise: Promise<Response>;
};
commandFailed(userId: string | undefined, properties: CommandFailedProperties, options?: EventOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
commandRan(userId: string | undefined, properties: CommandRanProperties, options?: EventOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
userSignedIn(userId: string | undefined, properties: UserSignedInProperties, options?: EventOptions, extra?: MiddlewareExtra): {
promise: Promise<Response>;
};
}
export declare const ampli: Ampli;