@forge/util 4.0.0 → 4.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +11 -8
- package/package.json +23 -5
- package/packages/analytics-node-client/src/chunk-G1eueebf.mjs +1 -0
- package/packages/analytics-node-client/src/index.cjs +41 -0
- package/packages/analytics-node-client/src/index.d.cts +1104 -0
- package/packages/analytics-node-client/src/index.d.mts +1104 -0
- package/packages/analytics-node-client/src/index.mjs +41 -0
- package/packages/ari/index.cjs +1 -0
- package/packages/ari/index.d.cts +218 -0
- package/packages/ari/index.d.mts +218 -0
- package/packages/ari/index.mjs +1 -0
- package/packages/899.js +0 -1
- package/packages/analytics-node-client/src/index.js +0 -2
- package/packages/analytics-node-client/src/index.js.LICENSE.txt +0 -8
- package/packages/ari/index.js +0 -1
- package/scripts/build.sh +0 -18
- package/webpack.config.js +0 -20
|
@@ -0,0 +1,1104 @@
|
|
|
1
|
+
type ID = string | null | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Recursively make all object properties nullable
|
|
4
|
+
*/
|
|
5
|
+
type DeepNullable<T> = { [K in keyof T]: T[K] extends object ? DeepNullable<T[K]> | null : T[K] | null; };
|
|
6
|
+
type SegmentEventType$1 = 'track' | 'page' | 'identify' | 'group' | 'alias' | 'screen';
|
|
7
|
+
type JSONPrimitive = string | number | boolean | null;
|
|
8
|
+
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
9
|
+
type JSONObject = {
|
|
10
|
+
[member: string]: JSONValue;
|
|
11
|
+
};
|
|
12
|
+
type JSONArray = JSONValue[];
|
|
13
|
+
type EventProperties = Record<string, any>;
|
|
14
|
+
type Integrations = {
|
|
15
|
+
All?: boolean;
|
|
16
|
+
[integration: string]: boolean | JSONObject | undefined;
|
|
17
|
+
};
|
|
18
|
+
interface CoreOptions {
|
|
19
|
+
integrations?: Integrations;
|
|
20
|
+
timestamp?: Timestamp;
|
|
21
|
+
context?: CoreExtraContext;
|
|
22
|
+
anonymousId?: string;
|
|
23
|
+
userId?: string;
|
|
24
|
+
traits?: Traits;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Context is a dictionary of extra information that provides useful context about a datapoint, for example the user’s ip address or locale. You should only use Context fields for their intended meaning.
|
|
29
|
+
* @link https://segment.com/docs/connections/spec/common/#context
|
|
30
|
+
*/
|
|
31
|
+
interface CoreExtraContext {
|
|
32
|
+
/**
|
|
33
|
+
* This is usually used to flag an .identify() call to just update the trait, rather than "last seen".
|
|
34
|
+
*/
|
|
35
|
+
active?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Current user's IP address.
|
|
38
|
+
*/
|
|
39
|
+
ip?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Locale string for the current user, for example en-US.
|
|
42
|
+
* @example en-US
|
|
43
|
+
*/
|
|
44
|
+
locale?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Dictionary of information about the user’s current location.
|
|
47
|
+
*/
|
|
48
|
+
location?: {
|
|
49
|
+
/**
|
|
50
|
+
* @example San Francisco
|
|
51
|
+
*/
|
|
52
|
+
city?: string;
|
|
53
|
+
/**
|
|
54
|
+
* @example United States
|
|
55
|
+
*/
|
|
56
|
+
country?: string;
|
|
57
|
+
/**
|
|
58
|
+
* @example 40.2964197
|
|
59
|
+
*/
|
|
60
|
+
latitude?: string;
|
|
61
|
+
/**
|
|
62
|
+
* @example -76.9411617
|
|
63
|
+
*/
|
|
64
|
+
longitude?: string;
|
|
65
|
+
/**
|
|
66
|
+
* @example CA
|
|
67
|
+
*/
|
|
68
|
+
region?: string;
|
|
69
|
+
/**
|
|
70
|
+
* @example 100
|
|
71
|
+
*/
|
|
72
|
+
speed?: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Dictionary of information about the current web page.
|
|
76
|
+
*/
|
|
77
|
+
page?: {
|
|
78
|
+
/**
|
|
79
|
+
* @example /academy/
|
|
80
|
+
*/
|
|
81
|
+
path?: string;
|
|
82
|
+
/**
|
|
83
|
+
* @example https://www.foo.com/
|
|
84
|
+
*/
|
|
85
|
+
referrer?: string;
|
|
86
|
+
/**
|
|
87
|
+
* @example projectId=123
|
|
88
|
+
*/
|
|
89
|
+
search?: string;
|
|
90
|
+
/**
|
|
91
|
+
* @example Analytics Academy
|
|
92
|
+
*/
|
|
93
|
+
title?: string;
|
|
94
|
+
/**
|
|
95
|
+
* @example https://segment.com/academy/
|
|
96
|
+
*/
|
|
97
|
+
url?: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* User agent of the device making the request.
|
|
101
|
+
*/
|
|
102
|
+
userAgent?: string;
|
|
103
|
+
/**
|
|
104
|
+
* User agent data returned by the Client Hints API
|
|
105
|
+
*/
|
|
106
|
+
userAgentData?: {
|
|
107
|
+
brands?: {
|
|
108
|
+
brand: string;
|
|
109
|
+
version: string;
|
|
110
|
+
}[];
|
|
111
|
+
mobile?: boolean;
|
|
112
|
+
platform?: string;
|
|
113
|
+
architecture?: string;
|
|
114
|
+
bitness?: string;
|
|
115
|
+
model?: string;
|
|
116
|
+
platformVersion?: string;
|
|
117
|
+
/** @deprecated in favour of fullVersionList */
|
|
118
|
+
uaFullVersion?: string;
|
|
119
|
+
fullVersionList?: {
|
|
120
|
+
brand: string;
|
|
121
|
+
version: string;
|
|
122
|
+
}[];
|
|
123
|
+
wow64?: boolean;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Information about the current library.
|
|
127
|
+
*
|
|
128
|
+
* **Automatically filled out by the library.**
|
|
129
|
+
*
|
|
130
|
+
* This type should probably be "never"
|
|
131
|
+
*/
|
|
132
|
+
library?: {
|
|
133
|
+
/**
|
|
134
|
+
* @example analytics-node-next/latest
|
|
135
|
+
*/
|
|
136
|
+
name: string;
|
|
137
|
+
/**
|
|
138
|
+
* @example "1.43.1"
|
|
139
|
+
*/
|
|
140
|
+
version: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* This is useful in cases where you need to track an event,
|
|
144
|
+
* but also associate information from a previous identify call.
|
|
145
|
+
* You should fill this object the same way you would fill traits in an identify call.
|
|
146
|
+
*/
|
|
147
|
+
traits?: Traits;
|
|
148
|
+
/**
|
|
149
|
+
* Dictionary of information about the campaign that resulted in the API call, containing name, source, medium, term, content, and any other custom UTM parameter.
|
|
150
|
+
*/
|
|
151
|
+
campaign?: Campaign;
|
|
152
|
+
/**
|
|
153
|
+
* Dictionary of information about the way the user was referred to the website or app.
|
|
154
|
+
*/
|
|
155
|
+
referrer?: {
|
|
156
|
+
type?: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
url?: string;
|
|
159
|
+
link?: string;
|
|
160
|
+
id?: string;
|
|
161
|
+
btid?: string;
|
|
162
|
+
urid?: string;
|
|
163
|
+
};
|
|
164
|
+
amp?: {
|
|
165
|
+
id: string;
|
|
166
|
+
};
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
}
|
|
169
|
+
interface CoreSegmentEvent {
|
|
170
|
+
messageId?: string;
|
|
171
|
+
type: SegmentEventType$1;
|
|
172
|
+
category?: string;
|
|
173
|
+
name?: string;
|
|
174
|
+
properties?: EventProperties;
|
|
175
|
+
traits?: Traits;
|
|
176
|
+
integrations?: Integrations;
|
|
177
|
+
context?: CoreExtraContext;
|
|
178
|
+
options?: CoreOptions;
|
|
179
|
+
userId?: ID;
|
|
180
|
+
anonymousId?: ID;
|
|
181
|
+
groupId?: ID;
|
|
182
|
+
previousId?: ID;
|
|
183
|
+
event?: string;
|
|
184
|
+
writeKey?: string;
|
|
185
|
+
sentAt?: Date;
|
|
186
|
+
_metadata?: SegmentEventMetadata;
|
|
187
|
+
timestamp?: Timestamp;
|
|
188
|
+
}
|
|
189
|
+
interface SegmentEventMetadata {
|
|
190
|
+
failedInitializations?: unknown[];
|
|
191
|
+
bundled?: string[];
|
|
192
|
+
unbundled?: string[];
|
|
193
|
+
nodeVersion?: string;
|
|
194
|
+
bundledConfigIds?: string[];
|
|
195
|
+
unbundledConfigIds?: string[];
|
|
196
|
+
bundledIds?: string[];
|
|
197
|
+
}
|
|
198
|
+
type Timestamp = Date | string;
|
|
199
|
+
type DbId = string | number;
|
|
200
|
+
type PhoneNumber = string | number;
|
|
201
|
+
/**
|
|
202
|
+
* Traits are pieces of information you know about a group.
|
|
203
|
+
* This interface represents reserved traits that Segment has standardized.
|
|
204
|
+
* @link https://segment.com/docs/connections/spec/group/#traits
|
|
205
|
+
*/
|
|
206
|
+
type BaseGroupTraits = DeepNullable<{
|
|
207
|
+
/**
|
|
208
|
+
* Street address of a group.
|
|
209
|
+
*/
|
|
210
|
+
address?: BaseUserTraits['address'];
|
|
211
|
+
/**
|
|
212
|
+
* URL to an avatar image for the group.
|
|
213
|
+
*/
|
|
214
|
+
avatar?: BaseUserTraits['avatar'];
|
|
215
|
+
/**
|
|
216
|
+
* Date the group's account was first created. Segment recommends ISO-8601 date strings.
|
|
217
|
+
*/
|
|
218
|
+
createdAt?: BaseUserTraits['createdAt'];
|
|
219
|
+
/**
|
|
220
|
+
* Description of a group
|
|
221
|
+
*/
|
|
222
|
+
description?: BaseUserTraits['description'];
|
|
223
|
+
/**
|
|
224
|
+
* Email address of group.
|
|
225
|
+
*/
|
|
226
|
+
email?: BaseUserTraits['email'];
|
|
227
|
+
/**
|
|
228
|
+
* Number of employees of a group, typically used for companies.
|
|
229
|
+
*/
|
|
230
|
+
employees?: string | number;
|
|
231
|
+
/**
|
|
232
|
+
* Unique ID in your database for a group.
|
|
233
|
+
*/
|
|
234
|
+
id?: BaseUserTraits['id'];
|
|
235
|
+
/**
|
|
236
|
+
* Industry a group is part of.
|
|
237
|
+
*/
|
|
238
|
+
industry?: BaseUserTraits['industry'];
|
|
239
|
+
/**
|
|
240
|
+
* Name of a group.
|
|
241
|
+
*/
|
|
242
|
+
name?: BaseUserTraits['name'];
|
|
243
|
+
/**
|
|
244
|
+
* Phone number of a group
|
|
245
|
+
*/
|
|
246
|
+
phone?: BaseUserTraits['phone'];
|
|
247
|
+
/**
|
|
248
|
+
* Website of a group.
|
|
249
|
+
*/
|
|
250
|
+
website?: BaseUserTraits['website'];
|
|
251
|
+
/**
|
|
252
|
+
* Plan that a group is in.
|
|
253
|
+
*/
|
|
254
|
+
plan?: BaseUserTraits['plan'];
|
|
255
|
+
}>;
|
|
256
|
+
/**
|
|
257
|
+
* Traits are pieces of information you know about a user.
|
|
258
|
+
* This interface represents reserved traits that Segment has standardized.
|
|
259
|
+
* @link https://segment.com/docs/connections/spec/identify/#traits
|
|
260
|
+
*/
|
|
261
|
+
type BaseUserTraits = DeepNullable<{
|
|
262
|
+
/**
|
|
263
|
+
* Unique ID in your database for a user
|
|
264
|
+
*/
|
|
265
|
+
id?: DbId;
|
|
266
|
+
/**
|
|
267
|
+
* Industry a user works in
|
|
268
|
+
*/
|
|
269
|
+
industry?: string;
|
|
270
|
+
/**
|
|
271
|
+
* First name of a user.
|
|
272
|
+
*/
|
|
273
|
+
firstName?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Last name of a user.
|
|
276
|
+
*/
|
|
277
|
+
lastName?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Full name of a user. If you only pass a first and last name Segment automatically fills in the full name for you.
|
|
280
|
+
*/
|
|
281
|
+
name?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Phone number of a user
|
|
284
|
+
*/
|
|
285
|
+
phone?: PhoneNumber;
|
|
286
|
+
/**
|
|
287
|
+
* Title of a user, usually related to their position at a specific company.
|
|
288
|
+
* @example VP of Engineering
|
|
289
|
+
*/
|
|
290
|
+
title?: string;
|
|
291
|
+
/**
|
|
292
|
+
* User's username. This should be unique to each user, like the usernames of Twitter or GitHub.
|
|
293
|
+
*/
|
|
294
|
+
username?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Website of a user.
|
|
297
|
+
*/
|
|
298
|
+
website?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Street address of a user.
|
|
301
|
+
*/
|
|
302
|
+
address?: {
|
|
303
|
+
city?: string;
|
|
304
|
+
country?: string;
|
|
305
|
+
postalCode?: string;
|
|
306
|
+
state?: string;
|
|
307
|
+
street?: string;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Age of a user.
|
|
311
|
+
*/
|
|
312
|
+
age?: number;
|
|
313
|
+
/**
|
|
314
|
+
* URL to an avatar image for the user.
|
|
315
|
+
*/
|
|
316
|
+
avatar?: string;
|
|
317
|
+
/**
|
|
318
|
+
* User's birthday.
|
|
319
|
+
*/
|
|
320
|
+
birthday?: Timestamp;
|
|
321
|
+
/**
|
|
322
|
+
* User's company.
|
|
323
|
+
*/
|
|
324
|
+
company?: {
|
|
325
|
+
name?: string;
|
|
326
|
+
id?: DbId;
|
|
327
|
+
industry?: BaseUserTraits['industry'];
|
|
328
|
+
employee_count?: number;
|
|
329
|
+
plan?: BaseUserTraits['plan'];
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
Plan that a user is in.
|
|
333
|
+
|
|
334
|
+
* @example enterprise
|
|
335
|
+
*/
|
|
336
|
+
plan?: string;
|
|
337
|
+
/**
|
|
338
|
+
* Date the user's account was first created. Segment recommends using ISO-8601 date strings.
|
|
339
|
+
*/
|
|
340
|
+
createdAt?: Timestamp;
|
|
341
|
+
/**
|
|
342
|
+
* Description of user, such as bio.
|
|
343
|
+
*/
|
|
344
|
+
description?: string;
|
|
345
|
+
/**
|
|
346
|
+
* Email address of a user.
|
|
347
|
+
*/
|
|
348
|
+
email?: string;
|
|
349
|
+
/**
|
|
350
|
+
* @example female
|
|
351
|
+
*/
|
|
352
|
+
gender?: string;
|
|
353
|
+
}>;
|
|
354
|
+
/**
|
|
355
|
+
* Traits are pieces of information you know about a group.
|
|
356
|
+
* This interface represents reserved traits that Segment has standardized.
|
|
357
|
+
* @link https://segment.com/docs/connections/spec/group/#traits
|
|
358
|
+
*/
|
|
359
|
+
type GroupTraits = BaseGroupTraits & {
|
|
360
|
+
[customTrait: string]: any;
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* Traits are pieces of information you know about a user.
|
|
364
|
+
* This interface represents reserved traits that Segment has standardized.
|
|
365
|
+
* @link https://segment.com/docs/connections/spec/identify/#traits
|
|
366
|
+
*/
|
|
367
|
+
type UserTraits = BaseUserTraits & {
|
|
368
|
+
[customTrait: string]: any;
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Traits are pieces of information you know about a user or group.
|
|
372
|
+
*/
|
|
373
|
+
type Traits = UserTraits | GroupTraits;
|
|
374
|
+
type Campaign = {
|
|
375
|
+
name: string;
|
|
376
|
+
source: string;
|
|
377
|
+
medium: string;
|
|
378
|
+
[key: string]: string;
|
|
379
|
+
};
|
|
380
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
381
|
+
type LogMessage = {
|
|
382
|
+
level: LogLevel;
|
|
383
|
+
message: string;
|
|
384
|
+
time?: Date;
|
|
385
|
+
extras?: Record<string, any>;
|
|
386
|
+
};
|
|
387
|
+
interface GenericLogger {
|
|
388
|
+
log(level: LogLevel, message: string, extras?: object): void;
|
|
389
|
+
flush(): void;
|
|
390
|
+
logs: LogMessage[];
|
|
391
|
+
}
|
|
392
|
+
declare class CoreLogger implements GenericLogger {
|
|
393
|
+
private _logs;
|
|
394
|
+
log(level: LogLevel, message: string, extras?: object): void;
|
|
395
|
+
get logs(): LogMessage[];
|
|
396
|
+
flush(): void;
|
|
397
|
+
}
|
|
398
|
+
type CompactMetricType = 'g' | 'c';
|
|
399
|
+
type CoreMetricType = 'gauge' | 'counter';
|
|
400
|
+
interface CoreMetric {
|
|
401
|
+
metric: string;
|
|
402
|
+
value: number;
|
|
403
|
+
type: CoreMetricType;
|
|
404
|
+
tags: string[];
|
|
405
|
+
timestamp: number;
|
|
406
|
+
}
|
|
407
|
+
interface CompactMetric {
|
|
408
|
+
m: string;
|
|
409
|
+
v: number;
|
|
410
|
+
k: CompactMetricType;
|
|
411
|
+
t: string[];
|
|
412
|
+
e: number;
|
|
413
|
+
}
|
|
414
|
+
declare abstract class CoreStats {
|
|
415
|
+
metrics: CoreMetric[];
|
|
416
|
+
increment(metric: string, by?: number, tags?: string[]): void;
|
|
417
|
+
gauge(metric: string, value: number, tags?: string[]): void;
|
|
418
|
+
flush(): void;
|
|
419
|
+
/**
|
|
420
|
+
* compact keys for smaller payload
|
|
421
|
+
*/
|
|
422
|
+
serialize(): CompactMetric[];
|
|
423
|
+
}
|
|
424
|
+
interface SerializedContext {
|
|
425
|
+
id: string;
|
|
426
|
+
event: CoreSegmentEvent;
|
|
427
|
+
logs: LogMessage[];
|
|
428
|
+
metrics?: CoreMetric[];
|
|
429
|
+
}
|
|
430
|
+
interface ContextFailedDelivery {
|
|
431
|
+
reason: unknown;
|
|
432
|
+
}
|
|
433
|
+
interface CancelationOptions {
|
|
434
|
+
retry?: boolean;
|
|
435
|
+
reason?: string;
|
|
436
|
+
type?: string;
|
|
437
|
+
}
|
|
438
|
+
declare class ContextCancelation {
|
|
439
|
+
retry: boolean;
|
|
440
|
+
type: string;
|
|
441
|
+
reason?: string;
|
|
442
|
+
constructor(options: CancelationOptions);
|
|
443
|
+
}
|
|
444
|
+
declare abstract class CoreContext<Event extends CoreSegmentEvent = CoreSegmentEvent> {
|
|
445
|
+
event: Event;
|
|
446
|
+
logger: CoreLogger;
|
|
447
|
+
stats: CoreStats;
|
|
448
|
+
attempts: number;
|
|
449
|
+
private _failedDelivery?;
|
|
450
|
+
private _id;
|
|
451
|
+
constructor(event: Event, id?: string, stats?: CoreStats, logger?: CoreLogger);
|
|
452
|
+
static system(): void;
|
|
453
|
+
isSame(other: CoreContext): boolean;
|
|
454
|
+
cancel(error?: Error | ContextCancelation): never;
|
|
455
|
+
log(level: LogLevel, message: string, extras?: object): void;
|
|
456
|
+
get id(): string;
|
|
457
|
+
updateEvent(path: string, val: unknown): Event;
|
|
458
|
+
failedDelivery(): ContextFailedDelivery | undefined;
|
|
459
|
+
setFailedDelivery(options: ContextFailedDelivery): void;
|
|
460
|
+
logs(): LogMessage[];
|
|
461
|
+
flush(): void;
|
|
462
|
+
toJSON(): SerializedContext;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* This is the base contract for all emitted errors. This interface may be extended.
|
|
466
|
+
*/
|
|
467
|
+
interface CoreEmittedError<Ctx extends CoreContext> {
|
|
468
|
+
/**
|
|
469
|
+
* e.g. 'delivery_failure'
|
|
470
|
+
*/
|
|
471
|
+
code: string;
|
|
472
|
+
/**
|
|
473
|
+
* Why the error occurred. This can be an actual error object or a just a message.
|
|
474
|
+
*/
|
|
475
|
+
reason?: unknown;
|
|
476
|
+
ctx?: Ctx;
|
|
477
|
+
}
|
|
478
|
+
type CoreEmitterContract<Ctx extends CoreContext, Err extends CoreEmittedError<Ctx> = CoreEmittedError<Ctx>> = {
|
|
479
|
+
alias: [ctx: Ctx];
|
|
480
|
+
track: [ctx: Ctx];
|
|
481
|
+
identify: [ctx: Ctx];
|
|
482
|
+
page: [ctx: Ctx];
|
|
483
|
+
screen: [ctx: Ctx];
|
|
484
|
+
group: [ctx: Ctx];
|
|
485
|
+
register: [pluginNames: string[]];
|
|
486
|
+
deregister: [pluginNames: string[]];
|
|
487
|
+
error: [error: Err];
|
|
488
|
+
};
|
|
489
|
+
interface CoreAnalytics {
|
|
490
|
+
track(...args: unknown[]): unknown;
|
|
491
|
+
page(...args: unknown[]): unknown;
|
|
492
|
+
identify(...args: unknown[]): unknown;
|
|
493
|
+
group(...args: unknown[]): unknown;
|
|
494
|
+
alias(...args: unknown[]): unknown;
|
|
495
|
+
screen(...args: unknown[]): unknown;
|
|
496
|
+
register(...plugins: unknown[]): Promise<unknown>;
|
|
497
|
+
deregister(...plugins: unknown[]): Promise<unknown>;
|
|
498
|
+
readonly VERSION: string;
|
|
499
|
+
}
|
|
500
|
+
interface CorePluginConfig {
|
|
501
|
+
options: any;
|
|
502
|
+
priority: 'critical' | 'non-critical';
|
|
503
|
+
}
|
|
504
|
+
type PluginType = 'before' | 'after' | 'destination' | 'enrichment' | 'utility';
|
|
505
|
+
interface CorePlugin<Ctx extends CoreContext = CoreContext, Analytics extends CoreAnalytics = any> {
|
|
506
|
+
name: string;
|
|
507
|
+
alternativeNames?: string[];
|
|
508
|
+
version: string;
|
|
509
|
+
type: PluginType;
|
|
510
|
+
isLoaded: () => boolean;
|
|
511
|
+
load: (ctx: Ctx, instance: Analytics, config?: CorePluginConfig) => Promise<unknown>;
|
|
512
|
+
unload?: (ctx: Ctx, instance: Analytics) => Promise<unknown> | unknown;
|
|
513
|
+
ready?: () => Promise<unknown>;
|
|
514
|
+
track?: (ctx: Ctx) => Promise<Ctx> | Ctx;
|
|
515
|
+
identify?: (ctx: Ctx) => Promise<Ctx> | Ctx;
|
|
516
|
+
page?: (ctx: Ctx) => Promise<Ctx> | Ctx;
|
|
517
|
+
group?: (ctx: Ctx) => Promise<Ctx> | Ctx;
|
|
518
|
+
alias?: (ctx: Ctx) => Promise<Ctx> | Ctx;
|
|
519
|
+
screen?: (ctx: Ctx) => Promise<Ctx> | Ctx;
|
|
520
|
+
}
|
|
521
|
+
type EventName = string;
|
|
522
|
+
type EventFnArgs = any[];
|
|
523
|
+
type EmitterContract = Record<EventName, EventFnArgs>;
|
|
524
|
+
interface EmitterOptions {
|
|
525
|
+
/** How many event listeners for a particular event before emitting a warning (0 = disabled)
|
|
526
|
+
* @default 10
|
|
527
|
+
**/
|
|
528
|
+
maxListeners?: number;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Event Emitter that takes the expected contract as a generic
|
|
532
|
+
* @example
|
|
533
|
+
* ```ts
|
|
534
|
+
* type Contract = {
|
|
535
|
+
* delivery_success: [DeliverySuccessResponse, Metrics],
|
|
536
|
+
* delivery_failure: [DeliveryError]
|
|
537
|
+
* }
|
|
538
|
+
* new Emitter<Contract>()
|
|
539
|
+
* .on('delivery_success', (res, metrics) => ...)
|
|
540
|
+
* .on('delivery_failure', (err) => ...)
|
|
541
|
+
* ```
|
|
542
|
+
*/
|
|
543
|
+
declare class Emitter<Contract extends EmitterContract = EmitterContract> {
|
|
544
|
+
maxListeners: number;
|
|
545
|
+
constructor(options?: EmitterOptions);
|
|
546
|
+
private callbacks;
|
|
547
|
+
private warned;
|
|
548
|
+
private warnIfPossibleMemoryLeak;
|
|
549
|
+
on<EventName extends keyof Contract>(event: EventName, callback: (...args: Contract[EventName]) => void): this;
|
|
550
|
+
once<EventName extends keyof Contract>(event: EventName, callback: (...args: Contract[EventName]) => void): this;
|
|
551
|
+
off<EventName extends keyof Contract>(event: EventName, callback: (...args: Contract[EventName]) => void): this;
|
|
552
|
+
emit<EventName extends keyof Contract>(event: EventName, ...args: Contract[EventName]): this;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* This interface is meant to be compatible with different fetch implementations (node and browser).
|
|
556
|
+
* Using the ambient fetch type is not possible because the AbortSignal type is not compatible with node-fetch.
|
|
557
|
+
* @link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
558
|
+
*/
|
|
559
|
+
interface HTTPFetchFn {
|
|
560
|
+
(url: string, requestInit: HTTPFetchRequest): Promise<HTTPResponse>;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* This interface is meant to be compatible with the Request interface.
|
|
564
|
+
* @link https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
565
|
+
*/
|
|
566
|
+
interface HTTPFetchRequest {
|
|
567
|
+
headers: Record<string, string>;
|
|
568
|
+
body: string;
|
|
569
|
+
method: HTTPClientRequest['method'];
|
|
570
|
+
signal: any;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* This interface is meant to very minimally conform to the Response interface.
|
|
574
|
+
* @link https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
575
|
+
*/
|
|
576
|
+
interface HTTPResponse {
|
|
577
|
+
status: number;
|
|
578
|
+
statusText: string;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* This interface is meant to be a generic interface for making HTTP requests.
|
|
582
|
+
* While it may overlap with fetch's Request interface, it is not coupled to it.
|
|
583
|
+
*/
|
|
584
|
+
interface HTTPClientRequest {
|
|
585
|
+
/**
|
|
586
|
+
* URL to be used for the request
|
|
587
|
+
* @example 'https://api.segment.io/v1/batch'
|
|
588
|
+
*/
|
|
589
|
+
url: string;
|
|
590
|
+
/**
|
|
591
|
+
* HTTP method to be used for the request. This will always be a 'POST' request.
|
|
592
|
+
**/
|
|
593
|
+
method: 'POST';
|
|
594
|
+
/**
|
|
595
|
+
* Headers to be sent with the request
|
|
596
|
+
*/
|
|
597
|
+
headers: Record<string, string>;
|
|
598
|
+
/**
|
|
599
|
+
* JSON data to be sent with the request (will be stringified)
|
|
600
|
+
* @example { "batch": [ ... ]}
|
|
601
|
+
*/
|
|
602
|
+
data: Record<string, any>;
|
|
603
|
+
/**
|
|
604
|
+
* Specifies the timeout (in milliseconds) for an HTTP client to get an HTTP response from the server
|
|
605
|
+
* @example 10000
|
|
606
|
+
*/
|
|
607
|
+
httpRequestTimeout: number;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* HTTP client interface for making requests
|
|
611
|
+
*/
|
|
612
|
+
interface HTTPClient {
|
|
613
|
+
makeRequest(_options: HTTPClientRequest): Promise<HTTPResponse>;
|
|
614
|
+
}
|
|
615
|
+
interface AnalyticsSettings {
|
|
616
|
+
/**
|
|
617
|
+
* Key that corresponds to your Segment.io project
|
|
618
|
+
*/
|
|
619
|
+
writeKey: string;
|
|
620
|
+
/**
|
|
621
|
+
* The base URL of the API. Default: "https://api.segment.io"
|
|
622
|
+
*/
|
|
623
|
+
host?: string;
|
|
624
|
+
/**
|
|
625
|
+
* The API path route. Default: "/v1/batch"
|
|
626
|
+
*/
|
|
627
|
+
path?: string;
|
|
628
|
+
/**
|
|
629
|
+
* The number of times to retry flushing a batch. Default: 3
|
|
630
|
+
*/
|
|
631
|
+
maxRetries?: number;
|
|
632
|
+
/**
|
|
633
|
+
* The number of events to enqueue before flushing. Default: 15.
|
|
634
|
+
*/
|
|
635
|
+
flushAt?: number;
|
|
636
|
+
/**
|
|
637
|
+
* @deprecated
|
|
638
|
+
* The number of events to enqueue before flushing. This is deprecated in favor of `flushAt`. Default: 15.
|
|
639
|
+
*/
|
|
640
|
+
maxEventsInBatch?: number;
|
|
641
|
+
/**
|
|
642
|
+
* The number of milliseconds to wait before flushing the queue automatically. Default: 10000
|
|
643
|
+
*/
|
|
644
|
+
flushInterval?: number;
|
|
645
|
+
/**
|
|
646
|
+
* The maximum number of milliseconds to wait for an http request. Default: 10000
|
|
647
|
+
*/
|
|
648
|
+
httpRequestTimeout?: number;
|
|
649
|
+
/**
|
|
650
|
+
* Disable the analytics library. All calls will be a noop. Default: false.
|
|
651
|
+
*/
|
|
652
|
+
disable?: boolean;
|
|
653
|
+
/**
|
|
654
|
+
* Supply a default http client implementation (such as one supporting proxy).
|
|
655
|
+
* Accepts either an HTTPClient instance or a fetch function.
|
|
656
|
+
* Default: an HTTP client that uses globalThis.fetch, with node-fetch as a fallback.
|
|
657
|
+
*/
|
|
658
|
+
httpClient?: HTTPFetchFn | HTTPClient;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* A dictionary of extra context to attach to the call.
|
|
662
|
+
* Note: context differs from traits because it is not attributes of the user itself.
|
|
663
|
+
*/
|
|
664
|
+
interface ExtraContext extends CoreExtraContext {}
|
|
665
|
+
/**
|
|
666
|
+
* An ID associated with the user. Note: at least one of userId or anonymousId must be included.
|
|
667
|
+
**/
|
|
668
|
+
type IdentityOptions = {
|
|
669
|
+
userId: string;
|
|
670
|
+
anonymousId?: string;
|
|
671
|
+
} | {
|
|
672
|
+
userId?: string;
|
|
673
|
+
anonymousId: string;
|
|
674
|
+
};
|
|
675
|
+
type AliasParams = {
|
|
676
|
+
userId: string;
|
|
677
|
+
previousId: string;
|
|
678
|
+
context?: ExtraContext;
|
|
679
|
+
timestamp?: Timestamp;
|
|
680
|
+
integrations?: Integrations;
|
|
681
|
+
};
|
|
682
|
+
type GroupParams = {
|
|
683
|
+
groupId: string;
|
|
684
|
+
/**
|
|
685
|
+
* Traits are pieces of information you know about a group.
|
|
686
|
+
* This interface represents reserved traits that Segment has standardized.
|
|
687
|
+
* @link https://segment.com/docs/connections/spec/group/#traits
|
|
688
|
+
*/
|
|
689
|
+
traits?: GroupTraits;
|
|
690
|
+
context?: ExtraContext;
|
|
691
|
+
timestamp?: Timestamp;
|
|
692
|
+
integrations?: Integrations;
|
|
693
|
+
} & IdentityOptions;
|
|
694
|
+
type IdentifyParams = {
|
|
695
|
+
/**
|
|
696
|
+
* Traits are pieces of information you know about a group.
|
|
697
|
+
* This interface represents reserved traits that Segment has standardized.
|
|
698
|
+
* @link https://segment.com/docs/connections/spec/group/#traits
|
|
699
|
+
*/
|
|
700
|
+
traits?: UserTraits;
|
|
701
|
+
context?: ExtraContext;
|
|
702
|
+
timestamp?: Timestamp;
|
|
703
|
+
integrations?: Integrations;
|
|
704
|
+
} & IdentityOptions;
|
|
705
|
+
type PageParams = {
|
|
706
|
+
category?: string;
|
|
707
|
+
name?: string;
|
|
708
|
+
properties?: EventProperties;
|
|
709
|
+
timestamp?: Timestamp;
|
|
710
|
+
context?: ExtraContext;
|
|
711
|
+
integrations?: Integrations;
|
|
712
|
+
} & IdentityOptions;
|
|
713
|
+
type TrackParams = {
|
|
714
|
+
event: string;
|
|
715
|
+
properties?: EventProperties;
|
|
716
|
+
context?: ExtraContext;
|
|
717
|
+
timestamp?: Timestamp;
|
|
718
|
+
integrations?: Integrations;
|
|
719
|
+
} & IdentityOptions;
|
|
720
|
+
type FlushParams = {
|
|
721
|
+
/**
|
|
722
|
+
* Max time in milliseconds to wait until the resulting promise resolves.
|
|
723
|
+
*/
|
|
724
|
+
timeout?: number;
|
|
725
|
+
/**
|
|
726
|
+
* If true, will prevent new events from entering the pipeline. Default: false
|
|
727
|
+
*/
|
|
728
|
+
close?: boolean;
|
|
729
|
+
};
|
|
730
|
+
type CloseAndFlushParams = {
|
|
731
|
+
/**
|
|
732
|
+
* Max time in milliseconds to wait until the resulting promise resolves.
|
|
733
|
+
*/
|
|
734
|
+
timeout?: FlushParams['timeout'];
|
|
735
|
+
};
|
|
736
|
+
type SegmentEventType = 'track' | 'page' | 'identify' | 'alias' | 'screen';
|
|
737
|
+
interface SegmentEvent extends CoreSegmentEvent {
|
|
738
|
+
type: SegmentEventType;
|
|
739
|
+
}
|
|
740
|
+
interface Plugin extends CorePlugin<Context, Analytics> {}
|
|
741
|
+
declare class Context extends CoreContext<SegmentEvent> {
|
|
742
|
+
static system(): Context;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Map of emitter event names to method args.
|
|
746
|
+
*/
|
|
747
|
+
type NodeEmitterEvents = CoreEmitterContract<Context> & {
|
|
748
|
+
initialize: [AnalyticsSettings];
|
|
749
|
+
call_after_close: [SegmentEvent];
|
|
750
|
+
http_request: [{
|
|
751
|
+
url: string;
|
|
752
|
+
method: string;
|
|
753
|
+
headers: Record<string, string>;
|
|
754
|
+
body: Record<string, any>;
|
|
755
|
+
}];
|
|
756
|
+
drained: [];
|
|
757
|
+
};
|
|
758
|
+
declare class NodeEmitter extends Emitter<NodeEmitterEvents> {}
|
|
759
|
+
type Callback = (err?: unknown, ctx?: Context) => void;
|
|
760
|
+
declare class Analytics extends NodeEmitter implements CoreAnalytics {
|
|
761
|
+
private readonly _eventFactory;
|
|
762
|
+
private _isClosed;
|
|
763
|
+
private _pendingEvents;
|
|
764
|
+
private readonly _closeAndFlushDefaultTimeout;
|
|
765
|
+
private readonly _publisher;
|
|
766
|
+
private _isFlushing;
|
|
767
|
+
private readonly _queue;
|
|
768
|
+
ready: Promise<void>;
|
|
769
|
+
constructor(settings: AnalyticsSettings);
|
|
770
|
+
get VERSION(): string;
|
|
771
|
+
/**
|
|
772
|
+
* Call this method to stop collecting new events and flush all existing events.
|
|
773
|
+
* This method also waits for any event method-specific callbacks to be triggered,
|
|
774
|
+
* and any of their subsequent promises to be resolved/rejected.
|
|
775
|
+
*/
|
|
776
|
+
closeAndFlush({ timeout }?: CloseAndFlushParams): Promise<void>;
|
|
777
|
+
/**
|
|
778
|
+
* Call this method to flush all existing events..
|
|
779
|
+
* This method also waits for any event method-specific callbacks to be triggered,
|
|
780
|
+
* and any of their subsequent promises to be resolved/rejected.
|
|
781
|
+
*/
|
|
782
|
+
flush({ timeout, close }?: FlushParams): Promise<void>;
|
|
783
|
+
private _dispatch;
|
|
784
|
+
/**
|
|
785
|
+
* Combines two unassociated user identities.
|
|
786
|
+
* @link https://segment.com/docs/connections/sources/catalog/libraries/server/node/#alias
|
|
787
|
+
*/
|
|
788
|
+
alias({ userId, previousId, context, timestamp, integrations }: AliasParams, callback?: Callback): void;
|
|
789
|
+
/**
|
|
790
|
+
* Associates an identified user with a collective.
|
|
791
|
+
* @link https://segment.com/docs/connections/sources/catalog/libraries/server/node/#group
|
|
792
|
+
*/
|
|
793
|
+
group({ timestamp, groupId, userId, anonymousId, traits, context, integrations }: GroupParams, callback?: Callback): void;
|
|
794
|
+
/**
|
|
795
|
+
* Includes a unique userId and (maybe anonymousId) and any optional traits you know about them.
|
|
796
|
+
* @link https://segment.com/docs/connections/sources/catalog/libraries/server/node/#identify
|
|
797
|
+
*/
|
|
798
|
+
identify({ userId, anonymousId, traits, context, timestamp, integrations }: IdentifyParams, callback?: Callback): void;
|
|
799
|
+
/**
|
|
800
|
+
* The page method lets you record page views on your website, along with optional extra information about the page being viewed.
|
|
801
|
+
* @link https://segment.com/docs/connections/sources/catalog/libraries/server/node/#page
|
|
802
|
+
*/
|
|
803
|
+
page({ userId, anonymousId, category, name, properties, context, timestamp, integrations }: PageParams, callback?: Callback): void;
|
|
804
|
+
/**
|
|
805
|
+
* Records screen views on your app, along with optional extra information
|
|
806
|
+
* about the screen viewed by the user.
|
|
807
|
+
*
|
|
808
|
+
* TODO: This is not documented on the segment docs ATM (for node).
|
|
809
|
+
*/
|
|
810
|
+
screen({ userId, anonymousId, category, name, properties, context, timestamp, integrations }: PageParams, callback?: Callback): void;
|
|
811
|
+
/**
|
|
812
|
+
* Records actions your users perform.
|
|
813
|
+
* @link https://segment.com/docs/connections/sources/catalog/libraries/server/node/#track
|
|
814
|
+
*/
|
|
815
|
+
track({ userId, anonymousId, event, properties, context, timestamp, integrations }: TrackParams, callback?: Callback): void;
|
|
816
|
+
/**
|
|
817
|
+
* Registers one or more plugins to augment Analytics functionality.
|
|
818
|
+
* @param plugins
|
|
819
|
+
*/
|
|
820
|
+
register(...plugins: Plugin[]): Promise<void>;
|
|
821
|
+
/**
|
|
822
|
+
* Deregisters one or more plugins based on their names.
|
|
823
|
+
* @param pluginNames - The names of one or more plugins to deregister.
|
|
824
|
+
*/
|
|
825
|
+
deregister(...pluginNames: string[]): Promise<void>;
|
|
826
|
+
}
|
|
827
|
+
declare class AnalyticsClient {
|
|
828
|
+
static _buildProperties({ userIdType, tenantIdType, tenantId, event, subproduct, product, env, datacenter, version, origin, orgId, workspaceId, aliases, groups, ic }: {
|
|
829
|
+
userIdType: any;
|
|
830
|
+
tenantIdType: any;
|
|
831
|
+
tenantId: any;
|
|
832
|
+
event: any;
|
|
833
|
+
subproduct: any;
|
|
834
|
+
product: any;
|
|
835
|
+
env: any;
|
|
836
|
+
datacenter: any;
|
|
837
|
+
version: any;
|
|
838
|
+
origin: any;
|
|
839
|
+
orgId: any;
|
|
840
|
+
workspaceId: any;
|
|
841
|
+
aliases: any;
|
|
842
|
+
groups: any;
|
|
843
|
+
ic: any;
|
|
844
|
+
}, eventType: any): any;
|
|
845
|
+
constructor({ env, product, subproduct, sendEventHook, datacenter, version, origin, maxEventsInBatch, flushInterval, baseUrl, logger, errorHandler, perimeter, httpClient, httpRequestTimeout, maxRetries, ic }: {
|
|
846
|
+
env: any;
|
|
847
|
+
product: any;
|
|
848
|
+
subproduct: any;
|
|
849
|
+
sendEventHook: any;
|
|
850
|
+
datacenter: any;
|
|
851
|
+
version: any;
|
|
852
|
+
origin: any;
|
|
853
|
+
maxEventsInBatch: any;
|
|
854
|
+
flushInterval: any;
|
|
855
|
+
baseUrl: any;
|
|
856
|
+
logger: any;
|
|
857
|
+
errorHandler: any;
|
|
858
|
+
perimeter: any;
|
|
859
|
+
httpClient: any;
|
|
860
|
+
httpRequestTimeout: any;
|
|
861
|
+
maxRetries: any;
|
|
862
|
+
ic: any;
|
|
863
|
+
});
|
|
864
|
+
console: any;
|
|
865
|
+
config: {
|
|
866
|
+
env: any;
|
|
867
|
+
product: any;
|
|
868
|
+
subproduct: any;
|
|
869
|
+
sendEventHook: any;
|
|
870
|
+
datacenter: any;
|
|
871
|
+
origin: any;
|
|
872
|
+
version: any;
|
|
873
|
+
ic: any;
|
|
874
|
+
};
|
|
875
|
+
validationMode: string;
|
|
876
|
+
responseCallback: typeof LoggingResponseCallback.callback;
|
|
877
|
+
analyticsClient: Analytics;
|
|
878
|
+
groups: {};
|
|
879
|
+
aliases: {};
|
|
880
|
+
_getTimeoutMilliseconds(timeoutMilliseconds: any): any;
|
|
881
|
+
_eventCallback(event: any): void;
|
|
882
|
+
_buildCompleteTrackEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, trackEvent, subproduct, product, os, timestamp, orgId, workspaceId, groups, validationMode }: {
|
|
883
|
+
userIdType: any;
|
|
884
|
+
userId: any;
|
|
885
|
+
anonymousId: any;
|
|
886
|
+
tenantIdType: any;
|
|
887
|
+
tenantId: any;
|
|
888
|
+
trackEvent: any;
|
|
889
|
+
subproduct: any;
|
|
890
|
+
product: any;
|
|
891
|
+
os: any;
|
|
892
|
+
timestamp: any;
|
|
893
|
+
orgId: any;
|
|
894
|
+
workspaceId: any;
|
|
895
|
+
groups: any;
|
|
896
|
+
validationMode: any;
|
|
897
|
+
}): {
|
|
898
|
+
userId: any;
|
|
899
|
+
anonymousId: any;
|
|
900
|
+
event: string;
|
|
901
|
+
properties: any;
|
|
902
|
+
timestamp: any;
|
|
903
|
+
context: {
|
|
904
|
+
os: any;
|
|
905
|
+
validationMode: any;
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
_buildCompleteTraitEvent({ entityType, entityId, entityTraits, os, timestamp, tenantId, tenantIdType, validationMode }: {
|
|
909
|
+
entityType: any;
|
|
910
|
+
entityId: any;
|
|
911
|
+
entityTraits: any;
|
|
912
|
+
os: any;
|
|
913
|
+
timestamp: any;
|
|
914
|
+
tenantId: any;
|
|
915
|
+
tenantIdType: any;
|
|
916
|
+
validationMode: any;
|
|
917
|
+
}): {
|
|
918
|
+
anonymousId: string;
|
|
919
|
+
traits: {
|
|
920
|
+
entityId: any;
|
|
921
|
+
entityTraits: any;
|
|
922
|
+
entityType: any;
|
|
923
|
+
};
|
|
924
|
+
timestamp: any;
|
|
925
|
+
context: {
|
|
926
|
+
os: any;
|
|
927
|
+
validationMode: any;
|
|
928
|
+
};
|
|
929
|
+
tenantId: any;
|
|
930
|
+
tenantIdType: any;
|
|
931
|
+
};
|
|
932
|
+
_buildCompleteOperationalEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, operationalEvent, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
933
|
+
userIdType: any;
|
|
934
|
+
userId: any;
|
|
935
|
+
anonymousId: any;
|
|
936
|
+
tenantIdType: any;
|
|
937
|
+
tenantId: any;
|
|
938
|
+
operationalEvent: any;
|
|
939
|
+
subproduct: any;
|
|
940
|
+
product: any;
|
|
941
|
+
os: any;
|
|
942
|
+
timestamp: any;
|
|
943
|
+
orgId: any;
|
|
944
|
+
workspaceId: any;
|
|
945
|
+
validationMode: any;
|
|
946
|
+
}): {
|
|
947
|
+
userId: any;
|
|
948
|
+
anonymousId: any;
|
|
949
|
+
event: string;
|
|
950
|
+
properties: any;
|
|
951
|
+
timestamp: any;
|
|
952
|
+
context: {
|
|
953
|
+
os: any;
|
|
954
|
+
validationMode: any;
|
|
955
|
+
};
|
|
956
|
+
};
|
|
957
|
+
_buildCompleteUIEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, uiEvent, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
958
|
+
userIdType: any;
|
|
959
|
+
userId: any;
|
|
960
|
+
anonymousId: any;
|
|
961
|
+
tenantIdType: any;
|
|
962
|
+
tenantId: any;
|
|
963
|
+
uiEvent: any;
|
|
964
|
+
subproduct: any;
|
|
965
|
+
product: any;
|
|
966
|
+
os: any;
|
|
967
|
+
timestamp: any;
|
|
968
|
+
orgId: any;
|
|
969
|
+
workspaceId: any;
|
|
970
|
+
validationMode: any;
|
|
971
|
+
}): {
|
|
972
|
+
userId: any;
|
|
973
|
+
anonymousId: any;
|
|
974
|
+
event: string;
|
|
975
|
+
properties: any;
|
|
976
|
+
timestamp: any;
|
|
977
|
+
context: {
|
|
978
|
+
os: any;
|
|
979
|
+
validationMode: any;
|
|
980
|
+
};
|
|
981
|
+
};
|
|
982
|
+
_buildScreenEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, name, screenEvent, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
983
|
+
userIdType: any;
|
|
984
|
+
userId: any;
|
|
985
|
+
anonymousId: any;
|
|
986
|
+
tenantIdType: any;
|
|
987
|
+
tenantId: any;
|
|
988
|
+
name: any;
|
|
989
|
+
screenEvent: any;
|
|
990
|
+
subproduct: any;
|
|
991
|
+
product: any;
|
|
992
|
+
os: any;
|
|
993
|
+
timestamp: any;
|
|
994
|
+
orgId: any;
|
|
995
|
+
workspaceId: any;
|
|
996
|
+
validationMode: any;
|
|
997
|
+
}): {
|
|
998
|
+
userId: any;
|
|
999
|
+
anonymousId: any;
|
|
1000
|
+
name: any;
|
|
1001
|
+
properties: any;
|
|
1002
|
+
timestamp: any;
|
|
1003
|
+
context: {
|
|
1004
|
+
os: any;
|
|
1005
|
+
validationMode: any;
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
sendOperationalEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, operationalEvent, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
1009
|
+
userIdType?: any;
|
|
1010
|
+
userId?: any;
|
|
1011
|
+
anonymousId?: any;
|
|
1012
|
+
tenantIdType?: any;
|
|
1013
|
+
tenantId?: any;
|
|
1014
|
+
operationalEvent: any;
|
|
1015
|
+
subproduct?: any;
|
|
1016
|
+
product?: any;
|
|
1017
|
+
os?: any;
|
|
1018
|
+
timestamp?: any;
|
|
1019
|
+
orgId?: any;
|
|
1020
|
+
workspaceId?: any;
|
|
1021
|
+
validationMode?: any;
|
|
1022
|
+
}): Promise<any>;
|
|
1023
|
+
sendTrackEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, trackEvent, groups, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
1024
|
+
userIdType?: any;
|
|
1025
|
+
userId?: any;
|
|
1026
|
+
anonymousId?: any;
|
|
1027
|
+
tenantIdType?: any;
|
|
1028
|
+
tenantId?: any;
|
|
1029
|
+
trackEvent: any;
|
|
1030
|
+
groups?: any;
|
|
1031
|
+
subproduct?: any;
|
|
1032
|
+
product?: any;
|
|
1033
|
+
os?: any;
|
|
1034
|
+
timestamp?: any;
|
|
1035
|
+
orgId?: any;
|
|
1036
|
+
workspaceId?: any;
|
|
1037
|
+
validationMode?: any;
|
|
1038
|
+
}): Promise<any>;
|
|
1039
|
+
sendTraitEvent({ entityType, entityId, entityTraits, os, timestamp, tenantId, tenantIdType, validationMode }: {
|
|
1040
|
+
entityType: any;
|
|
1041
|
+
entityId: any;
|
|
1042
|
+
entityTraits: any;
|
|
1043
|
+
os?: any;
|
|
1044
|
+
timestamp?: any;
|
|
1045
|
+
tenantId?: any;
|
|
1046
|
+
tenantIdType?: any;
|
|
1047
|
+
validationMode?: any;
|
|
1048
|
+
}): Promise<any>;
|
|
1049
|
+
sendUIEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, uiEvent, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
1050
|
+
userIdType?: any;
|
|
1051
|
+
userId?: any;
|
|
1052
|
+
anonymousId?: any;
|
|
1053
|
+
tenantIdType?: any;
|
|
1054
|
+
tenantId?: any;
|
|
1055
|
+
uiEvent: any;
|
|
1056
|
+
subproduct?: any;
|
|
1057
|
+
product?: any;
|
|
1058
|
+
os?: any;
|
|
1059
|
+
timestamp?: any;
|
|
1060
|
+
orgId?: any;
|
|
1061
|
+
workspaceId?: any;
|
|
1062
|
+
validationMode?: any;
|
|
1063
|
+
}): Promise<any>;
|
|
1064
|
+
sendScreenEvent({ userIdType, userId, anonymousId, tenantIdType, tenantId, name, screenEvent, subproduct, product, os, timestamp, orgId, workspaceId, validationMode }: {
|
|
1065
|
+
userIdType?: any;
|
|
1066
|
+
userId?: any;
|
|
1067
|
+
anonymousId?: any;
|
|
1068
|
+
tenantIdType?: any;
|
|
1069
|
+
tenantId?: any;
|
|
1070
|
+
name?: any;
|
|
1071
|
+
screenEvent: any;
|
|
1072
|
+
subproduct?: any;
|
|
1073
|
+
product?: any;
|
|
1074
|
+
os?: any;
|
|
1075
|
+
timestamp?: any;
|
|
1076
|
+
orgId?: any;
|
|
1077
|
+
workspaceId?: any;
|
|
1078
|
+
validationMode?: any;
|
|
1079
|
+
}): Promise<any>;
|
|
1080
|
+
gracefulShutdown(): Promise<any>;
|
|
1081
|
+
setGroup(groupsType: any, groupId: any): void;
|
|
1082
|
+
clearGroups(): void;
|
|
1083
|
+
setAlias(aliasType: any, aliasId: any): void;
|
|
1084
|
+
clearAliases(): void;
|
|
1085
|
+
setResponseCallback(responseCallback: any): void;
|
|
1086
|
+
getResponseCallback(): typeof LoggingResponseCallback.callback;
|
|
1087
|
+
setEventValidationMode(eventValidationMode: any): void;
|
|
1088
|
+
}
|
|
1089
|
+
declare class LoggingResponseCallback {
|
|
1090
|
+
static callback(response: any): void;
|
|
1091
|
+
}
|
|
1092
|
+
declare namespace user_type_d_exports {
|
|
1093
|
+
export { ATLASSIAN_ACCOUNT, CUSTOMER_ACCOUNT, HALP, HASHED_EMAIL, LOOM, OPSGENIE, TRELLO, isValidUserIdType };
|
|
1094
|
+
}
|
|
1095
|
+
declare const ATLASSIAN_ACCOUNT: "atlassianAccount";
|
|
1096
|
+
declare const TRELLO: "trello";
|
|
1097
|
+
declare const HASHED_EMAIL: "hashedEmail";
|
|
1098
|
+
declare const OPSGENIE: "opsgenie";
|
|
1099
|
+
declare const HALP: "halp";
|
|
1100
|
+
declare const CUSTOMER_ACCOUNT: "customerAccount";
|
|
1101
|
+
declare const LOOM: "loom";
|
|
1102
|
+
declare function isValidUserIdType(userIdType: any): boolean;
|
|
1103
|
+
export declare function analyticsClient(args: any): AnalyticsClient;
|
|
1104
|
+
export { user_type_d_exports as userTypes };
|