@amplitude/analytics-core 2.8.1 → 2.10.0

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.
Files changed (51) hide show
  1. package/lib/cjs/core-client.d.ts +36 -4
  2. package/lib/cjs/core-client.d.ts.map +1 -1
  3. package/lib/cjs/core-client.js +89 -2
  4. package/lib/cjs/core-client.js.map +1 -1
  5. package/lib/cjs/identify.d.ts +4 -0
  6. package/lib/cjs/identify.d.ts.map +1 -1
  7. package/lib/cjs/identify.js +16 -1
  8. package/lib/cjs/identify.js.map +1 -1
  9. package/lib/cjs/index.d.ts +1 -1
  10. package/lib/cjs/index.d.ts.map +1 -1
  11. package/lib/cjs/index.js.map +1 -1
  12. package/lib/cjs/timeline.d.ts +4 -1
  13. package/lib/cjs/timeline.d.ts.map +1 -1
  14. package/lib/cjs/timeline.js +30 -0
  15. package/lib/cjs/timeline.js.map +1 -1
  16. package/lib/cjs/types/event/event.d.ts +33 -0
  17. package/lib/cjs/types/event/event.d.ts.map +1 -1
  18. package/lib/cjs/types/event/event.js.map +1 -1
  19. package/lib/cjs/types/plugin.d.ts +22 -0
  20. package/lib/cjs/types/plugin.d.ts.map +1 -1
  21. package/lib/cjs/types/plugin.js.map +1 -1
  22. package/lib/cjs/types/server-zone.d.ts +5 -1
  23. package/lib/cjs/types/server-zone.d.ts.map +1 -1
  24. package/lib/cjs/types/server-zone.js +4 -0
  25. package/lib/cjs/types/server-zone.js.map +1 -1
  26. package/lib/esm/core-client.d.ts +36 -4
  27. package/lib/esm/core-client.d.ts.map +1 -1
  28. package/lib/esm/core-client.js +89 -2
  29. package/lib/esm/core-client.js.map +1 -1
  30. package/lib/esm/identify.d.ts +4 -0
  31. package/lib/esm/identify.d.ts.map +1 -1
  32. package/lib/esm/identify.js +15 -0
  33. package/lib/esm/identify.js.map +1 -1
  34. package/lib/esm/index.d.ts +1 -1
  35. package/lib/esm/index.d.ts.map +1 -1
  36. package/lib/esm/index.js.map +1 -1
  37. package/lib/esm/timeline.d.ts +4 -1
  38. package/lib/esm/timeline.d.ts.map +1 -1
  39. package/lib/esm/timeline.js +30 -0
  40. package/lib/esm/timeline.js.map +1 -1
  41. package/lib/esm/types/event/event.d.ts +33 -0
  42. package/lib/esm/types/event/event.d.ts.map +1 -1
  43. package/lib/esm/types/event/event.js.map +1 -1
  44. package/lib/esm/types/plugin.d.ts +22 -0
  45. package/lib/esm/types/plugin.d.ts.map +1 -1
  46. package/lib/esm/types/plugin.js.map +1 -1
  47. package/lib/esm/types/server-zone.d.ts +5 -1
  48. package/lib/esm/types/server-zone.d.ts.map +1 -1
  49. package/lib/esm/types/server-zone.js +4 -0
  50. package/lib/esm/types/server-zone.js.map +1 -1
  51. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../src/types/event/event.ts"],"names":[],"mappings":";;;AAGA,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B,gCAAgC;IAChC,iCAAY,CAAA;IACZ,0CAAqB,CAAA;IAErB,8CAA8C;IAC9C,iCAAY,CAAA;IACZ,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,uCAAkB,CAAA;IAElB,8DAA8D;IAC9D,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAE1B,+CAA+C;IAC/C,qCAAgB,CAAA;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAkB5B;AAuCD;;;GAGG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,0CAAsB,CAAA;IACtB,qDAAiC,CAAA;IACjC,8CAA0B,CAAA;AAC5B,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B","sourcesContent":["import { BaseEvent } from './base-event';\nimport { RevenueEventProperties } from '../../revenue';\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport type UserProperties =\n | IdentifyUserProperties\n | {\n [key in Exclude<string, IdentifyOperation>]: any;\n };\n\n/**\n * Strings that have special meaning when used as an event's type\n * and have different specifications.\n */\nexport enum SpecialEventType {\n IDENTIFY = '$identify',\n GROUP_IDENTIFY = '$groupidentify',\n REVENUE = 'revenue_amount',\n}\n\nexport interface TrackEvent extends BaseEvent {\n event_type: Exclude<string, SpecialEventType>;\n}\n\nexport interface IdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.IDENTIFY;\n user_properties: UserProperties;\n}\n\nexport interface GroupIdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.GROUP_IDENTIFY;\n group_properties: UserProperties;\n}\n\nexport interface RevenueEvent extends BaseEvent {\n event_type: SpecialEventType.REVENUE;\n event_properties:\n | RevenueEventProperties\n | {\n [key: string]: any;\n };\n}\n\nexport type Event = TrackEvent | IdentifyEvent | GroupIdentifyEvent | RevenueEvent;\n"]}
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../src/types/event/event.ts"],"names":[],"mappings":";;;AAGA,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B,gCAAgC;IAChC,iCAAY,CAAA;IACZ,0CAAqB,CAAA;IAErB,8CAA8C;IAC9C,iCAAY,CAAA;IACZ,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,uCAAkB,CAAA;IAElB,8DAA8D;IAC9D,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAE1B,+CAA+C;IAC/C,qCAAgB,CAAA;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAkB5B;AAwED;;;GAGG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,0CAAsB,CAAA;IACtB,qDAAiC,CAAA;IACjC,8CAA0B,CAAA;AAC5B,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B","sourcesContent":["import { BaseEvent } from './base-event';\nimport { RevenueEventProperties } from '../../revenue';\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\n/**\n * Represents the structure of user properties that can be sent with an Identify or GroupIdentify event.\n *\n * This type supports both:\n *\n * 1. Reserved Amplitude identify operations via `IdentifyUserProperties`:\n * These operations enable structured updates to user properties.\n *\n * Example:\n * ```ts\n * {\n * $set: { plan: 'premium', login_count: 1 },\n * $add: { login_count: 1 },\n * $unset: { plan: '-' },\n * $clearAll: '-'\n * }\n * ```\n *\n * 2. Custom user-defined properties (excluding reserved operation keys):\n * Useful for assigning static properties without using Identify operations.\n *\n * Example:\n * ```ts\n * {\n * custom_flag: true,\n * experiment_group: 'B',\n * favorite_color: 'blue'\n * }\n * ```\n *\n * This union ensures compatibility with Amplitude's identify semantics\n * while allowing flexibility to define arbitrary non-reserved properties.\n */\nexport type UserProperties =\n | IdentifyUserProperties\n | {\n [key in Exclude<string, IdentifyOperation>]: any;\n };\n\n/**\n * Strings that have special meaning when used as an event's type\n * and have different specifications.\n */\nexport enum SpecialEventType {\n IDENTIFY = '$identify',\n GROUP_IDENTIFY = '$groupidentify',\n REVENUE = 'revenue_amount',\n}\n\nexport interface TrackEvent extends BaseEvent {\n event_type: Exclude<string, SpecialEventType>;\n}\n\nexport interface IdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.IDENTIFY;\n user_properties: UserProperties;\n}\n\nexport interface GroupIdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.GROUP_IDENTIFY;\n group_properties: UserProperties;\n}\n\nexport interface RevenueEvent extends BaseEvent {\n event_type: SpecialEventType.REVENUE;\n event_properties:\n | RevenueEventProperties\n | {\n [key: string]: any;\n };\n}\n\nexport type Event = TrackEvent | IdentifyEvent | GroupIdentifyEvent | RevenueEvent;\n"]}
@@ -6,11 +6,33 @@ type PluginTypeBefore = 'before';
6
6
  type PluginTypeEnrichment = 'enrichment';
7
7
  type PluginTypeDestination = 'destination';
8
8
  export type PluginType = PluginTypeBefore | PluginTypeEnrichment | PluginTypeDestination;
9
+ export interface AnalyticsIdentity {
10
+ deviceId?: string;
11
+ userId?: string;
12
+ userProperties?: {
13
+ [key: string]: any;
14
+ };
15
+ }
9
16
  interface PluginBase<T = CoreClient, U = IConfig> {
10
17
  name?: string;
11
18
  type?: PluginType;
12
19
  setup?(config: U, client: T): Promise<void>;
13
20
  teardown?(): Promise<void>;
21
+ /**
22
+ * Called when the identity is changed. This is a **best-effort** API and may not be triggered in all scenarios.
23
+ *
24
+ * Currently supported only in the Browser SDK. Not supported in React Native or Node SDKs.
25
+ *
26
+ * @param identity The changed identity. If a field is missing, it means it has not changed.
27
+ * For example, `{ userId: undefined }` means the userId was explicitly changed to `undefined`,
28
+ * while deviceId and userProperties remain unchanged.
29
+ *
30
+ * Note: `onIdentityChanged()` will be triggered when a user logs in via `setUserId()`.
31
+ * It will not be triggered on subsequent page loads (e.g., when a user reopens the site in a new tab).
32
+ */
33
+ onIdentityChanged?(identity: AnalyticsIdentity): Promise<void>;
34
+ onSessionIdChanged?(sessionId: number): Promise<void>;
35
+ onOptOutChanged?(optOut: boolean): Promise<void>;
14
36
  }
15
37
  export interface BeforePlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {
16
38
  type: PluginTypeBefore;
@@ -1 +1 @@
1
- {"version":3,"file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CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from './event/event';\nimport { IConfig } from '../config';\nimport { Result } from './result';\nimport { CoreClient } from '../core-client';\n\ntype PluginTypeBefore = 'before';\ntype PluginTypeEnrichment = 'enrichment';\ntype PluginTypeDestination = 'destination';\nexport type PluginType = PluginTypeBefore | PluginTypeEnrichment | PluginTypeDestination;\n\ninterface PluginBase<T = CoreClient, U = IConfig> {\n name?: string;\n type?: PluginType;\n setup?(config: U, client: T): Promise<void>;\n teardown?(): Promise<void>;\n}\n\nexport interface BeforePlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeBefore;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface EnrichmentPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type?: PluginTypeEnrichment;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface DestinationPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeDestination;\n execute(context: Event): Promise<Result>;\n flush?(): Promise<void>;\n}\n\nexport type Plugin<T = CoreClient, U = IConfig> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;\n"]}
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from './event/event';\nimport { IConfig } from '../config';\nimport { Result } from './result';\nimport { CoreClient } from '../core-client';\n\ntype PluginTypeBefore = 'before';\ntype PluginTypeEnrichment = 'enrichment';\ntype PluginTypeDestination = 'destination';\nexport type PluginType = PluginTypeBefore | PluginTypeEnrichment | PluginTypeDestination;\n\nexport interface AnalyticsIdentity {\n deviceId?: string;\n userId?: string;\n userProperties?: { [key: string]: any };\n}\n\ninterface PluginBase<T = CoreClient, U = IConfig> {\n name?: string;\n type?: PluginType;\n setup?(config: U, client: T): Promise<void>;\n teardown?(): Promise<void>;\n /**\n * Called when the identity is changed. This is a **best-effort** API and may not be triggered in all scenarios.\n *\n * Currently supported only in the Browser SDK. Not supported in React Native or Node SDKs.\n *\n * @param identity The changed identity. If a field is missing, it means it has not changed.\n * For example, `{ userId: undefined }` means the userId was explicitly changed to `undefined`,\n * while deviceId and userProperties remain unchanged.\n *\n * Note: `onIdentityChanged()` will be triggered when a user logs in via `setUserId()`.\n * It will not be triggered on subsequent page loads (e.g., when a user reopens the site in a new tab).\n */\n onIdentityChanged?(identity: AnalyticsIdentity): Promise<void>;\n onSessionIdChanged?(sessionId: number): Promise<void>;\n onOptOutChanged?(optOut: boolean): Promise<void>;\n}\n\nexport interface BeforePlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeBefore;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface EnrichmentPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type?: PluginTypeEnrichment;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface DestinationPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeDestination;\n execute(context: Event): Promise<Result>;\n flush?(): Promise<void>;\n}\n\nexport type Plugin<T = CoreClient, U = IConfig> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;\n"]}
@@ -3,7 +3,11 @@
3
3
  */
4
4
  export declare enum ServerZone {
5
5
  US = "US",
6
- EU = "EU"
6
+ EU = "EU",
7
+ /**
8
+ * Add for session-replay-browser migration from analytics-type v1.x.
9
+ */
10
+ STAGING = "STAGING"
7
11
  }
8
12
  export type ServerZoneType = 'US' | 'EU';
9
13
  //# sourceMappingURL=server-zone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-zone.d.ts","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"server-zone.d.ts","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,OAAO;IACT,EAAE,OAAO;IACT;;OAEG;IACH,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC"}
@@ -8,5 +8,9 @@ var ServerZone;
8
8
  (function (ServerZone) {
9
9
  ServerZone["US"] = "US";
10
10
  ServerZone["EU"] = "EU";
11
+ /**
12
+ * Add for session-replay-browser migration from analytics-type v1.x.
13
+ */
14
+ ServerZone["STAGING"] = "STAGING";
11
15
  })(ServerZone = exports.ServerZone || (exports.ServerZone = {}));
12
16
  //# sourceMappingURL=server-zone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-zone.js","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,uBAAS,CAAA;AACX,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB","sourcesContent":["/**\n * @deprecated use ServerZoneType instead\n */\nexport enum ServerZone {\n US = 'US',\n EU = 'EU',\n}\n\nexport type ServerZoneType = 'US' | 'EU';\n"]}
1
+ {"version":3,"file":"server-zone.js","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,uBAAS,CAAA;IACT;;OAEG;IACH,iCAAmB,CAAA;AACrB,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB","sourcesContent":["/**\n * @deprecated use ServerZoneType instead\n */\nexport enum ServerZone {\n US = 'US',\n EU = 'EU',\n /**\n * Add for session-replay-browser migration from analytics-type v1.x.\n */\n STAGING = 'STAGING',\n}\n\nexport type ServerZoneType = 'US' | 'EU';\n"]}
@@ -2,12 +2,14 @@ import { Plugin } from './types/plugin';
2
2
  import { IConfig } from './config';
3
3
  import { BaseEvent, EventOptions } from './types/event/base-event';
4
4
  import { Result } from './types/result';
5
- import { Event } from './types/event/event';
5
+ import { Event, UserProperties } from './types/event/event';
6
6
  import { IIdentify } from './identify';
7
7
  import { IRevenue } from './revenue';
8
8
  import { Timeline } from './timeline';
9
- import { returnWrapper } from './utils/return-wrapper';
10
- import { AmplitudeReturn } from './utils/return-wrapper';
9
+ import { AmplitudeReturn, returnWrapper } from './utils/return-wrapper';
10
+ interface PluginHost {
11
+ plugin(name: string): Plugin | undefined;
12
+ }
11
13
  export interface CoreClient {
12
14
  /**
13
15
  * Adds a new plugin.
@@ -141,7 +143,7 @@ export interface CoreClient {
141
143
  */
142
144
  flush(): AmplitudeReturn<void>;
143
145
  }
144
- export declare class AmplitudeCore implements CoreClient {
146
+ export declare class AmplitudeCore implements CoreClient, PluginHost {
145
147
  protected initializing: boolean;
146
148
  protected name: string;
147
149
  config: IConfig;
@@ -164,9 +166,39 @@ export declare class AmplitudeCore implements CoreClient {
164
166
  _removePlugin(pluginName: string): AmplitudeReturn<void>;
165
167
  dispatchWithCallback(event: Event, callback: (result: Result) => void): void;
166
168
  dispatch(event: Event): Promise<Result>;
169
+ /**
170
+ *
171
+ * This method applies identify operations to user properties and
172
+ * returns a single object representing the final user property state.
173
+ *
174
+ * This is a best-effort api that only supports $set, $clearAll, and $unset.
175
+ * Other operations are not supported and are ignored.
176
+ *
177
+ *
178
+ * @param userProperties The `event.userProperties` object from an Identify event.
179
+ * @returns A key-value object user properties without operations.
180
+ *
181
+ * @example
182
+ * Input:
183
+ * {
184
+ * $set: { plan: 'premium' },
185
+ * custom_flag: true
186
+ * }
187
+ *
188
+ * Output:
189
+ * {
190
+ * plan: 'premium',
191
+ * custom_flag: true
192
+ * }
193
+ */
194
+ getOperationAppliedUserProperties(userProperties: UserProperties | undefined): {
195
+ [key: string]: any;
196
+ };
167
197
  process(event: Event): Promise<Result>;
168
198
  setOptOut(optOut: boolean): void;
169
199
  _setOptOut(optOut: boolean): void;
170
200
  flush(): AmplitudeReturn<void>;
201
+ plugin(name: string): Plugin | undefined;
171
202
  }
203
+ export {};
172
204
  //# sourceMappingURL=core-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-client.d.ts","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC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MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAOtE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAU7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,iCAAiC,CAAC,cAAc,EAAE,cAAc,GAAG,SAAS,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAsD/F,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IA8B5C,SAAS,CAAC,MAAM,EAAE,OAAO;IAQzB,UAAU,CAAC,MAAM,EAAE,OAAO;IAO1B,KAAK;IAIL,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CASzC"}
@@ -1,4 +1,6 @@
1
1
  import { __awaiter, __generator, __values } from "tslib";
2
+ import { IdentifyOperation, SpecialEventType, } from './types/event/event';
3
+ import { OrderedIdentifyOperations } from './identify';
2
4
  import { CLIENT_NOT_INITIALIZED, OPT_OUT_MESSAGE } from './types/messages';
3
5
  import { Timeline } from './timeline';
4
6
  import { createGroupEvent, createGroupIdentifyEvent, createIdentifyEvent, createRevenueEvent, createTrackEvent, } from './utils/event-builder';
@@ -142,9 +144,79 @@ var AmplitudeCore = /** @class */ (function () {
142
144
  });
143
145
  });
144
146
  };
147
+ /**
148
+ *
149
+ * This method applies identify operations to user properties and
150
+ * returns a single object representing the final user property state.
151
+ *
152
+ * This is a best-effort api that only supports $set, $clearAll, and $unset.
153
+ * Other operations are not supported and are ignored.
154
+ *
155
+ *
156
+ * @param userProperties The `event.userProperties` object from an Identify event.
157
+ * @returns A key-value object user properties without operations.
158
+ *
159
+ * @example
160
+ * Input:
161
+ * {
162
+ * $set: { plan: 'premium' },
163
+ * custom_flag: true
164
+ * }
165
+ *
166
+ * Output:
167
+ * {
168
+ * plan: 'premium',
169
+ * custom_flag: true
170
+ * }
171
+ */
172
+ AmplitudeCore.prototype.getOperationAppliedUserProperties = function (userProperties) {
173
+ var updatedProperties = {};
174
+ if (userProperties === undefined) {
175
+ return updatedProperties;
176
+ }
177
+ // Keep non-operation keys for later merge
178
+ var nonOpProperties = {};
179
+ Object.keys(userProperties).forEach(function (key) {
180
+ if (!Object.values(IdentifyOperation).includes(key)) {
181
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
182
+ // @ts-ignore
183
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
184
+ nonOpProperties[key] = userProperties[key];
185
+ }
186
+ });
187
+ OrderedIdentifyOperations.forEach(function (operation) {
188
+ // Skip when key is an operation.
189
+ if (!Object.keys(userProperties).includes(operation))
190
+ return;
191
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
192
+ var opProperties = userProperties[operation];
193
+ switch (operation) {
194
+ case IdentifyOperation.CLEAR_ALL:
195
+ // Due to operation order, the following line will never execute.
196
+ /* istanbul ignore next */
197
+ Object.keys(updatedProperties).forEach(function (prop) {
198
+ delete updatedProperties[prop];
199
+ });
200
+ break;
201
+ case IdentifyOperation.UNSET:
202
+ Object.keys(opProperties).forEach(function (prop) {
203
+ delete updatedProperties[prop];
204
+ });
205
+ break;
206
+ case IdentifyOperation.SET:
207
+ Object.assign(updatedProperties, opProperties);
208
+ break;
209
+ }
210
+ });
211
+ // Merge non-operation properties.
212
+ // Custom properties should not be affected by operations.
213
+ // https://github.com/amplitude/nova/blob/343f678ded83c032e83b189796b3c2be161b48f5/src/main/java/com/amplitude/userproperty/model/ModifyUserPropertiesIdent.java#L79-L83
214
+ Object.assign(updatedProperties, nonOpProperties);
215
+ return updatedProperties;
216
+ };
145
217
  AmplitudeCore.prototype.process = function (event) {
146
218
  return __awaiter(this, void 0, void 0, function () {
147
- var result, e_2, message, result;
219
+ var userProperties, result, e_2, message, result;
148
220
  return __generator(this, function (_a) {
149
221
  switch (_a.label) {
150
222
  case 0:
@@ -153,6 +225,10 @@ var AmplitudeCore = /** @class */ (function () {
153
225
  if (this.config.optOut) {
154
226
  return [2 /*return*/, buildResult(event, 0, OPT_OUT_MESSAGE)];
155
227
  }
228
+ if (event.event_type === SpecialEventType.IDENTIFY) {
229
+ userProperties = this.getOperationAppliedUserProperties(event.user_properties);
230
+ this.timeline.onIdentityChanged({ userProperties: userProperties });
231
+ }
156
232
  return [4 /*yield*/, this.timeline.push(event)];
157
233
  case 1:
158
234
  result = _a.sent();
@@ -181,11 +257,22 @@ var AmplitudeCore = /** @class */ (function () {
181
257
  this._setOptOut(optOut);
182
258
  };
183
259
  AmplitudeCore.prototype._setOptOut = function (optOut) {
184
- this.config.optOut = Boolean(optOut);
260
+ if (this.config.optOut !== optOut) {
261
+ this.timeline.onOptOutChanged(optOut);
262
+ this.config.optOut = Boolean(optOut);
263
+ }
185
264
  };
186
265
  AmplitudeCore.prototype.flush = function () {
187
266
  return returnWrapper(this.timeline.flush());
188
267
  };
268
+ AmplitudeCore.prototype.plugin = function (name) {
269
+ var plugin = this.timeline.plugins.find(function (plugin) { return plugin.name === name; });
270
+ if (plugin === undefined) {
271
+ this.config.loggerProvider.debug("Cannot find plugin with name ".concat(name));
272
+ return undefined;
273
+ }
274
+ return plugin;
275
+ };
189
276
  return AmplitudeCore;
190
277
  }());
191
278
  export { AmplitudeCore };
@@ -1 +1 @@
1
- {"version":3,"file":"core-client.js","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA+JvD;IAaE,uBAAY,IAAiB;QAAjB,qBAAA,EAAA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AC,CAAC,CAAC;YACzD,OAAO;SACR;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,kCAAU,GAAV,UAAW,MAAe;QACxB,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,6BAAK,GAAL;QACE,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IACH,oBAAC;AAAD,CAAC,AAzJD,IAyJC","sourcesContent":["import { Plugin } from './types/plugin';\nimport { IConfig } from './config';\nimport { BaseEvent, EventOptions } from './types/event/base-event';\nimport { Result } from './types/result';\nimport { Event } from './types/event/event';\nimport { IIdentify } from './identify';\nimport { IRevenue } from './revenue';\nimport { CLIENT_NOT_INITIALIZED, OPT_OUT_MESSAGE } from './types/messages';\nimport { Timeline } from './timeline';\nimport {\n createGroupEvent,\n createGroupIdentifyEvent,\n createIdentifyEvent,\n createRevenueEvent,\n createTrackEvent,\n} from './utils/event-builder';\nimport { buildResult } from './utils/result-builder';\nimport { returnWrapper } from './utils/return-wrapper';\nimport { AmplitudeReturn } from './utils/return-wrapper';\n\nexport interface CoreClient {\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'myPlugin',\n * type: 'enrichment',\n * setup(config: Config) {\n * return;\n * },\n * execute(context: Event) {\n * return context;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin): AmplitudeReturn<void>;\n\n /**\n * Removes a plugin.\n *\n * ```typescript\n * amplitude.remove('myPlugin');\n * ```\n */\n remove(pluginName: string): AmplitudeReturn<void>;\n\n /**\n * Tracks user-defined event, with specified type, optional event properties and optional overwrites.\n *\n * ```typescript\n * // event tracking with event type only\n * track('Page Load');\n *\n * // event tracking with event type and additional event properties\n * track('Page Load', { loadTime: 1000 });\n *\n * // event tracking with event type, additional event properties, and overwritten event options\n * track('Page Load', { loadTime: 1000 }, { sessionId: -1 });\n *\n * // alternatively, this tracking method is awaitable\n * const result = await track('Page Load').promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n track(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Alias for track()\n */\n logEvent(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Sends an identify event containing user property operations\n *\n * ```typescript\n * const id = new Identify();\n * id.set('colors', ['rose', 'gold']);\n * identify(id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await identify(id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n identify(identify: IIdentify, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a group identify event containing group property operations.\n *\n * ```typescript\n * const id = new Identify();\n * id.set('skills', ['js', 'ts']);\n * const groupType = 'org';\n * const groupName = 'engineering';\n * groupIdentify(groupType, groupName, id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await groupIdentify(groupType, groupName, id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n groupIdentify(\n groupType: string,\n groupName: string | string[],\n identify: IIdentify,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Assigns a user to group\n *\n * ```typescript\n * const groupType = 'orgId';\n * const groupName = '15';\n * setGroup(groupType, groupName, { user_id: '12345' })\n * ```\n */\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a revenue event containing revenue property operations.\n *\n * ```typescript\n * const rev = new Revenue();\n * rev.setRevenue(100);\n * revenue(rev);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await revenue(rev).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n revenue(revenue: IRevenue, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sets a new optOut config value. This toggles event tracking on/off.\n *\n *```typescript\n * // Stops tracking\n * setOptOut(true);\n *\n * // Starts/resumes tracking\n * setOptOut(false);\n * ```\n */\n setOptOut(optOut: boolean): void;\n\n /**\n * Flush all unsent events.\n *\n *```typescript\n * flush();\n * ```\n */\n flush(): AmplitudeReturn<void>;\n}\n\nexport class AmplitudeCore implements CoreClient {\n protected initializing = false;\n protected name: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: IConfig;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n timeline: Timeline;\n isReady = false;\n protected q: Array<CallableFunction | typeof returnWrapper> = [];\n protected dispatchQ: Array<CallableFunction> = [];\n\n constructor(name = '$default') {\n this.timeline = new Timeline(this);\n this.name = name;\n }\n\n protected async _init(config: IConfig) {\n this.config = config;\n this.timeline.reset(this);\n await this.runQueuedFunctions('q');\n this.isReady = true;\n }\n\n async runQueuedFunctions(queueName: 'q' | 'dispatchQ') {\n const queuedFunctions = this[queueName];\n this[queueName] = [];\n for (const queuedFunction of queuedFunctions) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const val: ReturnType<typeof returnWrapper> | Promise<any> = queuedFunction();\n if (val && 'promise' in val) {\n await val.promise;\n } else {\n await val;\n }\n }\n // Rerun queued functions if the queue has accrued more while awaiting promises\n if (this[queueName].length) {\n await this.runQueuedFunctions(queueName);\n }\n }\n\n track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions) {\n const event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n logEvent = this.track.bind(this);\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n const event = createIdentifyEvent(identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n const event = createGroupIdentifyEvent(groupType, groupName, identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions) {\n const event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n const event = createRevenueEvent(revenue, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n add(plugin: Plugin) {\n if (!this.isReady) {\n this.q.push(this._addPlugin.bind(this, plugin));\n return returnWrapper();\n }\n return this._addPlugin(plugin);\n }\n\n _addPlugin(plugin: Plugin) {\n return returnWrapper(this.timeline.register(plugin, this.config));\n }\n\n remove(pluginName: string) {\n if (!this.isReady) {\n this.q.push(this._removePlugin.bind(this, pluginName));\n return returnWrapper();\n }\n return this._removePlugin(pluginName);\n }\n\n _removePlugin(pluginName: string) {\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n }\n\n dispatchWithCallback(event: Event, callback: (result: Result) => void): void {\n if (!this.isReady) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n }\n\n async dispatch(event: Event): Promise<Result> {\n if (!this.isReady) {\n return new Promise<Result>((resolve) => {\n this.dispatchQ.push(this.dispatchWithCallback.bind(this, event, resolve));\n });\n }\n\n return this.process(event);\n }\n\n async process(event: Event): Promise<Result> {\n try {\n // skip event processing if opt out\n if (this.config.optOut) {\n return buildResult(event, 0, OPT_OUT_MESSAGE);\n }\n\n const result = await this.timeline.push(event);\n\n result.code === 200\n ? this.config.loggerProvider.log(result.message)\n : result.code === 100\n ? this.config.loggerProvider.warn(result.message)\n : this.config.loggerProvider.error(result.message);\n\n return result;\n } catch (e) {\n const message = String(e);\n this.config.loggerProvider.error(message);\n const result = buildResult(event, 0, message);\n\n return result;\n }\n }\n\n setOptOut(optOut: boolean) {\n if (!this.isReady) {\n this.q.push(this._setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this._setOptOut(optOut);\n }\n\n _setOptOut(optOut: boolean) {\n this.config.optOut = Boolean(optOut);\n }\n\n flush() {\n return returnWrapper(this.timeline.flush());\n }\n}\n"]}
1
+ {"version":3,"file":"core-client.js","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":";AAIA,OAAO,EAEL,iBAAiB,EAEjB,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAa,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAmB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAkKxE;IAaE,uBAAY,IAAiB;QAAjB,qBAAA,EAAA,iBAAiB;QAZnB,iBAAY,GAAG,KAAK,CAAC;QAQ/B,YAAO,GAAG,KAAK,CAAC;QACN,MAAC,GAAmD,EAAE,CAAC;QACvD,cAAS,GAA4B,EAAE,CAAC;QAuClD,aAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QApC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEe,6BAAK,GAArB,UAAsB,MAAe;;;;;wBACnC,IAAI,CAAC,MAAM,GAA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AI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzD,OAAO;SACR;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,kCAAU,GAAV,UAAW,MAAe;QACxB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE;YACjC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;SACtC;IACH,CAAC;IAED,6BAAK,GAAL;QACE,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,8BAAM,GAAN,UAAO,IAAY;QACjB,IAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,IAAI,KAAK,IAAI,EAApB,CAAoB,CAAC,CAAC;QAC5E,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,uCAAgC,IAAI,CAAE,CAAC,CAAC;YACzE,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,oBAAC;AAAD,CAAC,AA1PD,IA0PC","sourcesContent":["import { Plugin } from './types/plugin';\nimport { IConfig } from './config';\nimport { BaseEvent, EventOptions } from './types/event/base-event';\nimport { Result } from './types/result';\nimport {\n Event,\n IdentifyOperation,\n IdentifyUserProperties,\n SpecialEventType,\n UserProperties,\n} from './types/event/event';\nimport { IIdentify, OrderedIdentifyOperations } from './identify';\nimport { IRevenue } from './revenue';\nimport { CLIENT_NOT_INITIALIZED, OPT_OUT_MESSAGE } from './types/messages';\nimport { Timeline } from './timeline';\nimport {\n createGroupEvent,\n createGroupIdentifyEvent,\n createIdentifyEvent,\n createRevenueEvent,\n createTrackEvent,\n} from './utils/event-builder';\nimport { buildResult } from './utils/result-builder';\nimport { AmplitudeReturn, returnWrapper } from './utils/return-wrapper';\n\ninterface PluginHost {\n plugin(name: string): Plugin | undefined;\n}\n\nexport interface CoreClient {\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'myPlugin',\n * type: 'enrichment',\n * setup(config: Config) {\n * return;\n * },\n * execute(context: Event) {\n * return context;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin): AmplitudeReturn<void>;\n\n /**\n * Removes a plugin.\n *\n * ```typescript\n * amplitude.remove('myPlugin');\n * ```\n */\n remove(pluginName: string): AmplitudeReturn<void>;\n\n /**\n * Tracks user-defined event, with specified type, optional event properties and optional overwrites.\n *\n * ```typescript\n * // event tracking with event type only\n * track('Page Load');\n *\n * // event tracking with event type and additional event properties\n * track('Page Load', { loadTime: 1000 });\n *\n * // event tracking with event type, additional event properties, and overwritten event options\n * track('Page Load', { loadTime: 1000 }, { sessionId: -1 });\n *\n * // alternatively, this tracking method is awaitable\n * const result = await track('Page Load').promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n track(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Alias for track()\n */\n logEvent(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Sends an identify event containing user property operations\n *\n * ```typescript\n * const id = new Identify();\n * id.set('colors', ['rose', 'gold']);\n * identify(id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await identify(id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n identify(identify: IIdentify, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a group identify event containing group property operations.\n *\n * ```typescript\n * const id = new Identify();\n * id.set('skills', ['js', 'ts']);\n * const groupType = 'org';\n * const groupName = 'engineering';\n * groupIdentify(groupType, groupName, id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await groupIdentify(groupType, groupName, id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n groupIdentify(\n groupType: string,\n groupName: string | string[],\n identify: IIdentify,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Assigns a user to group\n *\n * ```typescript\n * const groupType = 'orgId';\n * const groupName = '15';\n * setGroup(groupType, groupName, { user_id: '12345' })\n * ```\n */\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a revenue event containing revenue property operations.\n *\n * ```typescript\n * const rev = new Revenue();\n * rev.setRevenue(100);\n * revenue(rev);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await revenue(rev).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n revenue(revenue: IRevenue, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sets a new optOut config value. This toggles event tracking on/off.\n *\n *```typescript\n * // Stops tracking\n * setOptOut(true);\n *\n * // Starts/resumes tracking\n * setOptOut(false);\n * ```\n */\n setOptOut(optOut: boolean): void;\n\n /**\n * Flush all unsent events.\n *\n *```typescript\n * flush();\n * ```\n */\n flush(): AmplitudeReturn<void>;\n}\n\nexport class AmplitudeCore implements CoreClient, PluginHost {\n protected initializing = false;\n protected name: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: IConfig;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n timeline: Timeline;\n isReady = false;\n protected q: Array<CallableFunction | typeof returnWrapper> = [];\n protected dispatchQ: Array<CallableFunction> = [];\n\n constructor(name = '$default') {\n this.timeline = new Timeline(this);\n this.name = name;\n }\n\n protected async _init(config: IConfig) {\n this.config = config;\n this.timeline.reset(this);\n await this.runQueuedFunctions('q');\n this.isReady = true;\n }\n\n async runQueuedFunctions(queueName: 'q' | 'dispatchQ') {\n const queuedFunctions = this[queueName];\n this[queueName] = [];\n for (const queuedFunction of queuedFunctions) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const val: ReturnType<typeof returnWrapper> | Promise<any> = queuedFunction();\n if (val && 'promise' in val) {\n await val.promise;\n } else {\n await val;\n }\n }\n // Rerun queued functions if the queue has accrued more while awaiting promises\n if (this[queueName].length) {\n await this.runQueuedFunctions(queueName);\n }\n }\n\n track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions) {\n const event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n logEvent = this.track.bind(this);\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n const event = createIdentifyEvent(identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n const event = createGroupIdentifyEvent(groupType, groupName, identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions) {\n const event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n const event = createRevenueEvent(revenue, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n add(plugin: Plugin) {\n if (!this.isReady) {\n this.q.push(this._addPlugin.bind(this, plugin));\n return returnWrapper();\n }\n return this._addPlugin(plugin);\n }\n\n _addPlugin(plugin: Plugin) {\n return returnWrapper(this.timeline.register(plugin, this.config));\n }\n\n remove(pluginName: string) {\n if (!this.isReady) {\n this.q.push(this._removePlugin.bind(this, pluginName));\n return returnWrapper();\n }\n return this._removePlugin(pluginName);\n }\n\n _removePlugin(pluginName: string) {\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n }\n\n dispatchWithCallback(event: Event, callback: (result: Result) => void): void {\n if (!this.isReady) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n }\n\n async dispatch(event: Event): Promise<Result> {\n if (!this.isReady) {\n return new Promise<Result>((resolve) => {\n this.dispatchQ.push(this.dispatchWithCallback.bind(this, event, resolve));\n });\n }\n\n return this.process(event);\n }\n\n /**\n *\n * This method applies identify operations to user properties and\n * returns a single object representing the final user property state.\n *\n * This is a best-effort api that only supports $set, $clearAll, and $unset.\n * Other operations are not supported and are ignored.\n *\n *\n * @param userProperties The `event.userProperties` object from an Identify event.\n * @returns A key-value object user properties without operations.\n *\n * @example\n * Input:\n * {\n * $set: { plan: 'premium' },\n * custom_flag: true\n * }\n *\n * Output:\n * {\n * plan: 'premium',\n * custom_flag: true\n * }\n */\n getOperationAppliedUserProperties(userProperties: UserProperties | undefined): { [key: string]: any } {\n const updatedProperties: { [key: string]: any } = {};\n\n if (userProperties === undefined) {\n return updatedProperties;\n }\n\n // Keep non-operation keys for later merge\n const nonOpProperties: {\n [key in Exclude<string, IdentifyOperation>]: any;\n } = {};\n Object.keys(userProperties).forEach((key) => {\n if (!Object.values(IdentifyOperation).includes(key as IdentifyOperation)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n nonOpProperties[key] = userProperties[key];\n }\n });\n\n OrderedIdentifyOperations.forEach((operation) => {\n // Skip when key is an operation.\n if (!Object.keys(userProperties).includes(operation)) return;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const opProperties: IdentifyUserProperties = userProperties[operation];\n\n switch (operation) {\n case IdentifyOperation.CLEAR_ALL:\n // Due to operation order, the following line will never execute.\n /* istanbul ignore next */\n Object.keys(updatedProperties).forEach((prop) => {\n delete updatedProperties[prop];\n });\n break;\n case IdentifyOperation.UNSET:\n Object.keys(opProperties).forEach((prop) => {\n delete updatedProperties[prop];\n });\n break;\n case IdentifyOperation.SET:\n Object.assign(updatedProperties, opProperties);\n break;\n }\n });\n\n // Merge non-operation properties.\n // Custom properties should not be affected by operations.\n // https://github.com/amplitude/nova/blob/343f678ded83c032e83b189796b3c2be161b48f5/src/main/java/com/amplitude/userproperty/model/ModifyUserPropertiesIdent.java#L79-L83\n Object.assign(updatedProperties, nonOpProperties);\n\n return updatedProperties;\n }\n\n async process(event: Event): Promise<Result> {\n try {\n // skip event processing if opt out\n if (this.config.optOut) {\n return buildResult(event, 0, OPT_OUT_MESSAGE);\n }\n\n if (event.event_type === SpecialEventType.IDENTIFY) {\n const userProperties = this.getOperationAppliedUserProperties(event.user_properties);\n this.timeline.onIdentityChanged({ userProperties: userProperties });\n }\n\n const result = await this.timeline.push(event);\n\n result.code === 200\n ? this.config.loggerProvider.log(result.message)\n : result.code === 100\n ? this.config.loggerProvider.warn(result.message)\n : this.config.loggerProvider.error(result.message);\n\n return result;\n } catch (e) {\n const message = String(e);\n this.config.loggerProvider.error(message);\n const result = buildResult(event, 0, message);\n\n return result;\n }\n }\n\n setOptOut(optOut: boolean) {\n if (!this.isReady) {\n this.q.push(this._setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this._setOptOut(optOut);\n }\n\n _setOptOut(optOut: boolean) {\n if (this.config.optOut !== optOut) {\n this.timeline.onOptOutChanged(optOut);\n this.config.optOut = Boolean(optOut);\n }\n }\n\n flush() {\n return returnWrapper(this.timeline.flush());\n }\n\n plugin(name: string): Plugin | undefined {\n const plugin = this.timeline.plugins.find((plugin) => plugin.name === name);\n if (plugin === undefined) {\n this.config.loggerProvider.debug(`Cannot find plugin with name ${name}`);\n return undefined;\n }\n\n return plugin;\n }\n}\n"]}
@@ -62,5 +62,9 @@ export declare enum IdentifyOperation {
62
62
  UNSET = "$unset",
63
63
  CLEAR_ALL = "$clearAll"
64
64
  }
65
+ /**
66
+ * Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210
67
+ */
68
+ export declare const OrderedIdentifyOperations: IdentifyOperation[];
65
69
  export {};
66
70
  //# sourceMappingURL=identify.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,iBAAiB,IAAI,sBAAsB,CAAC;IAC5C,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC/D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC/D,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClE,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACjE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9D,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,IAAI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AC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACrD,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACpD,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC;CAClD;AAED,oBAAY,iBAAiB;IAE3B,GAAG,SAAS;IACZ,QAAQ,aAAa;IAGrB,GAAG,SAAS;IACZ,MAAM,YAAY;IAClB,OAAO,aAAa;IACpB,MAAM,YAAY;IAGlB,SAAS,eAAe;IACxB,UAAU,gBAAgB;IAG1B,KAAK,WAAW;IAChB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAWrC,CAAC"}
@@ -105,4 +105,19 @@ export var IdentifyOperation;
105
105
  IdentifyOperation["UNSET"] = "$unset";
106
106
  IdentifyOperation["CLEAR_ALL"] = "$clearAll";
107
107
  })(IdentifyOperation || (IdentifyOperation = {}));
108
+ /**
109
+ * Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210
110
+ */
111
+ export var OrderedIdentifyOperations = [
112
+ IdentifyOperation.CLEAR_ALL,
113
+ IdentifyOperation.UNSET,
114
+ IdentifyOperation.SET,
115
+ IdentifyOperation.SET_ONCE,
116
+ IdentifyOperation.ADD,
117
+ IdentifyOperation.APPEND,
118
+ IdentifyOperation.PREPEND,
119
+ IdentifyOperation.PREINSERT,
120
+ IdentifyOperation.POSTINSERT,
121
+ IdentifyOperation.REMOVE,
122
+ ];
108
123
  //# sourceMappingURL=identify.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAgB7D;IA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O,4BAAS,GAAjB,UAAkB,SAA4B,EAAE,QAAgB,EAAE,KAAwB;QACxF,IAAI,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE;YAC/D,6CAA6C;YAC7C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACnC,4CAA4C;YAC5C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,SAAS,KAAK,iBAAiB,CAAC,GAAG,EAAE;YACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;SAClC;QAED,IAAI,SAAS,KAAK,iBAAiB,CAAC,KAAK,IAAI,SAAS,KAAK,iBAAiB,CAAC,MAAM,EAAE;YACnF,OAAO,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACH,eAAC;AAAD,CAAC,AArGD,IAqGC;;AAiCD,MAAM,CAAN,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B,gCAAgC;IAChC,iCAAY,CAAA;IACZ,0CAAqB,CAAA;IAErB,8CAA8C;IAC9C,iCAAY,CAAA;IACZ,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,uCAAkB,CAAA;IAElB,8DAA8D;IAC9D,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAE1B,+CAA+C;IAC/C,qCAAgB,CAAA;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,KAAjB,iBAAiB,QAkB5B","sourcesContent":["import { UNSET_VALUE } from './types/constants';\nimport { isValidProperties } from './utils/valid-properties';\n\nexport interface IIdentify {\n getUserProperties(): IdentifyUserProperties;\n set(property: string, value: ValidPropertyType): IIdentify;\n setOnce(property: string, value: ValidPropertyType): IIdentify;\n append(property: string, value: ValidPropertyType): IIdentify;\n prepend(property: string, value: ValidPropertyType): IIdentify;\n postInsert(property: string, value: ValidPropertyType): IIdentify;\n preInsert(property: string, value: ValidPropertyType): IIdentify;\n remove(property: string, value: ValidPropertyType): IIdentify;\n add(property: string, value: number): IIdentify;\n unset(property: string): IIdentify;\n clearAll(): IIdentify;\n}\n\nexport class Identify implements IIdentify {\n protected readonly _propertySet: Set<string> = new Set<string>();\n protected _properties: IdentifyUserProperties = {};\n\n public getUserProperties(): IdentifyUserProperties {\n return { ...this._properties };\n }\n\n public set(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n }\n\n public setOnce(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n }\n\n public append(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n }\n\n public prepend(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n }\n\n public postInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n }\n\n public preInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n }\n\n public remove(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n }\n\n public add(property: string, value: number): Identify {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n }\n\n public unset(property: string): Identify {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n }\n\n public clearAll(): Identify {\n // When clear all happens, all properties are unset. Reset the entire object.\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n\n return this;\n }\n\n // Returns whether or not this set actually worked.\n private _safeSet(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._validate(operation, property, value)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let userPropertyMap: any = this._properties[operation];\n if (userPropertyMap === undefined) {\n userPropertyMap = {};\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._properties[operation] = userPropertyMap;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n\n return false;\n }\n\n private _validate(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) {\n // clear all already set. Skipping operation;\n return false;\n }\n\n if (this._propertySet.has(property)) {\n // Property already used. Skipping operation\n return false;\n }\n\n if (operation === IdentifyOperation.ADD) {\n return typeof value === 'number';\n }\n\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n }\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n"]}
1
+ {"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAgB7D;IAAA;QACqB,iBAAY,GAAgB,IAAI,GAAG,EAAU,CAAC;QACvD,gBAAW,GAA2B,EAAE,CAAC;IAmGrD,CAAC;IAjGQ,oCAAiB,GAAxB;QACE,oBAAY,IAAI,CAAC,WAAW,EAAG;IACjC,CAAC;IAEM,sBAAG,GAAV,UAAW,QAAgB,EAAE,KAAwB;QACnD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,0BAAO,GAAd,UAAe,QAAgB,EAAE,KAAwB;QACvD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,yBAAM,GAAb,UAAc,QAAgB,EAAE,KAAwB;QACtD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,0BAAO,GAAd,UAAe,QAAgB,EAAE,KAAwB;QACvD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,6BAAU,GAAjB,UAAkB,QAAgB,EAAE,KAAwB;QAC1D,IAAI,CAAC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A;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,KAAjB,iBAAiB,QAkB5B;AAED;;GAEG;AACH,MAAM,CAAC,IAAM,yBAAyB,GAAG;IACvC,iBAAiB,CAAC,SAAS;IAC3B,iBAAiB,CAAC,KAAK;IACvB,iBAAiB,CAAC,GAAG;IACrB,iBAAiB,CAAC,QAAQ;IAC1B,iBAAiB,CAAC,GAAG;IACrB,iBAAiB,CAAC,MAAM;IACxB,iBAAiB,CAAC,OAAO;IACzB,iBAAiB,CAAC,SAAS;IAC3B,iBAAiB,CAAC,UAAU;IAC5B,iBAAiB,CAAC,MAAM;CACzB,CAAC","sourcesContent":["import { UNSET_VALUE } from './types/constants';\nimport { isValidProperties } from './utils/valid-properties';\n\nexport interface IIdentify {\n getUserProperties(): IdentifyUserProperties;\n set(property: string, value: ValidPropertyType): IIdentify;\n setOnce(property: string, value: ValidPropertyType): IIdentify;\n append(property: string, value: ValidPropertyType): IIdentify;\n prepend(property: string, value: ValidPropertyType): IIdentify;\n postInsert(property: string, value: ValidPropertyType): IIdentify;\n preInsert(property: string, value: ValidPropertyType): IIdentify;\n remove(property: string, value: ValidPropertyType): IIdentify;\n add(property: string, value: number): IIdentify;\n unset(property: string): IIdentify;\n clearAll(): IIdentify;\n}\n\nexport class Identify implements IIdentify {\n protected readonly _propertySet: Set<string> = new Set<string>();\n protected _properties: IdentifyUserProperties = {};\n\n public getUserProperties(): IdentifyUserProperties {\n return { ...this._properties };\n }\n\n public set(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n }\n\n public setOnce(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n }\n\n public append(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n }\n\n public prepend(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n }\n\n public postInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n }\n\n public preInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n }\n\n public remove(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n }\n\n public add(property: string, value: number): Identify {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n }\n\n public unset(property: string): Identify {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n }\n\n public clearAll(): Identify {\n // When clear all happens, all properties are unset. Reset the entire object.\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n\n return this;\n }\n\n // Returns whether or not this set actually worked.\n private _safeSet(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._validate(operation, property, value)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let userPropertyMap: any = this._properties[operation];\n if (userPropertyMap === undefined) {\n userPropertyMap = {};\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._properties[operation] = userPropertyMap;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n\n return false;\n }\n\n private _validate(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) {\n // clear all already set. Skipping operation;\n return false;\n }\n\n if (this._propertySet.has(property)) {\n // Property already used. Skipping operation\n return false;\n }\n\n if (operation === IdentifyOperation.ADD) {\n return typeof value === 'number';\n }\n\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n }\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n\n/**\n * Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210\n */\nexport const OrderedIdentifyOperations = [\n IdentifyOperation.CLEAR_ALL,\n IdentifyOperation.UNSET,\n IdentifyOperation.SET,\n IdentifyOperation.SET_ONCE,\n IdentifyOperation.ADD,\n IdentifyOperation.APPEND,\n IdentifyOperation.PREPEND,\n IdentifyOperation.PREINSERT,\n IdentifyOperation.POSTINSERT,\n IdentifyOperation.REMOVE,\n];\n"]}
@@ -4,7 +4,7 @@ export { Revenue, IRevenue, RevenueProperty } from './revenue';
4
4
  export { Destination } from './plugins/destination';
5
5
  export { IdentityEventSender } from './plugins/identity';
6
6
  export { IConfig, Config, RequestMetadata } from './config';
7
- export { Logger, ILogger } from './logger';
7
+ export { Logger, ILogger, LogConfig } from './logger';
8
8
  export { getGlobalScope } from './global-scope';
9
9
  export { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';
10
10
  export { isNewSession } from './session';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,IAA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reClient } from './core-client';\nexport { Identify, IIdentify } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { IdentityEventSender } from './plugins/identity';\nexport { IConfig, Config, RequestMetadata } from './config';\nexport { Logger, ILogger } from './logger';\nexport { getGlobalScope } from './global-scope';\nexport { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';\nexport { isNewSession } from './session';\nexport { getCookieName, getOldCookieName } from './cookie-name';\nexport { getLanguage } from './language';\nexport { getQueryParams } from './query-params';\n\nexport { returnWrapper, AmplitudeReturn } from './utils/return-wrapper';\nexport { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug';\nexport { UUID } from './utils/uuid';\nexport { createIdentifyEvent } from './utils/event-builder';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType } from './types/storage';\nexport { Event, IdentifyOperation, SpecialEventType, IdentifyEvent, GroupIdentifyEvent } from './types/event/event';\nexport { EventOptions, BaseEvent } from './types/event/base-event';\nexport { IngestionMetadata } from './types/event/ingestion-metadata';\nexport { ServerZoneType, ServerZone } from './types/server-zone';\nexport { OfflineDisabled } from './types/offline';\nexport { Plan } from './types/event/plan';\nexport { TransportType, Transport } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport { Plugin, BeforePlugin, DestinationPlugin, EnrichmentPlugin, PluginType } from './types/plugin';\nexport { Result } from './types/result';\nexport {\n ElementInteractionsOptions,\n Messenger,\n ActionType,\n DEFAULT_CSS_SELECTOR_ALLOWLIST,\n DEFAULT_DATA_ATTRIBUTE_PREFIX,\n DEFAULT_ACTION_CLICK_ALLOWLIST,\n} from './types/element-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { Status } from './types/status';\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n} from './types/browser-config';\nexport { BrowserClient } from './types/browser-client';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAa,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAW,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAsB,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAmB,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAS,iBAAiB,EAAE,gBAAgB,EAAqC,MAAM,qBAAqB,CAAC;AAGpH,OAAO,EAAkB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAQlD,OAAO,EAIL,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { AmplitudeCore, CoreClient } from './core-client';\nexport { Identify, IIdentify } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { IdentityEventSender } from './plugins/identity';\nexport { IConfig, Config, RequestMetadata } from './config';\nexport { Logger, ILogger, LogConfig } from './logger';\nexport { getGlobalScope } from './global-scope';\nexport { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';\nexport { isNewSession } from './session';\nexport { getCookieName, getOldCookieName } from './cookie-name';\nexport { getLanguage } from './language';\nexport { getQueryParams } from './query-params';\n\nexport { returnWrapper, AmplitudeReturn } from './utils/return-wrapper';\nexport { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug';\nexport { UUID } from './utils/uuid';\nexport { createIdentifyEvent } from './utils/event-builder';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType } from './types/storage';\nexport { Event, IdentifyOperation, SpecialEventType, IdentifyEvent, GroupIdentifyEvent } from './types/event/event';\nexport { EventOptions, BaseEvent } from './types/event/base-event';\nexport { IngestionMetadata } from './types/event/ingestion-metadata';\nexport { ServerZoneType, ServerZone } from './types/server-zone';\nexport { OfflineDisabled } from './types/offline';\nexport { Plan } from './types/event/plan';\nexport { TransportType, Transport } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport { Plugin, BeforePlugin, DestinationPlugin, EnrichmentPlugin, PluginType } from './types/plugin';\nexport { Result } from './types/result';\nexport {\n ElementInteractionsOptions,\n Messenger,\n ActionType,\n DEFAULT_CSS_SELECTOR_ALLOWLIST,\n DEFAULT_DATA_ATTRIBUTE_PREFIX,\n DEFAULT_ACTION_CLICK_ALLOWLIST,\n} from './types/element-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { Status } from './types/status';\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n} from './types/browser-config';\nexport { BrowserClient } from './types/browser-client';\n"]}
@@ -1,4 +1,4 @@
1
- import { Plugin } from './types/plugin';
1
+ import { AnalyticsIdentity, Plugin } from './types/plugin';
2
2
  import { CoreClient } from './core-client';
3
3
  import { IConfig } from './config';
4
4
  import { EventCallback } from './types/event-callback';
@@ -17,5 +17,8 @@ export declare class Timeline {
17
17
  scheduleApply(timeout: number): void;
18
18
  apply(item: [Event, EventCallback] | undefined): Promise<void>;
19
19
  flush(): Promise<void>;
20
+ onIdentityChanged(identity: AnalyticsIdentity): void;
21
+ onSessionIdChanged(sessionId: number): void;
22
+ onOptOutChanged(optOut: boolean): void;
20
23
  }
21
24
  //# sourceMappingURL=timeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,qBAAa,QAAQ;IAQP,OAAO,CAAC,MAAM;IAP1B,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,CAAM;IAErC,QAAQ,UAAS;IAGjB,OAAO,EAAE,MAAM,EAAE,CAAM;gBAEH,MAAM,EAAE,UAAU;IAEhC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAmBxC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAWpD,KAAK,CAAC,MAAM,EAAE,UAAU;IAQxB,IAAI,CAAC,KAAK,EAAE,KAAK;IAOjB,aAAa,CAAC,OAAO,EAAE,MAAM;IAavB,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,SAAS;IAgE9C,KAAK;CAgBZ"}
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqD,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CA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