@amplitude/analytics-core 0.2.2 → 0.3.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.
- package/LICENSE +21 -0
- package/lib/cjs/config.d.ts +8 -9
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +35 -53
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/core-client.d.ts +17 -12
- package/lib/cjs/core-client.d.ts.map +1 -1
- package/lib/cjs/core-client.js +83 -84
- package/lib/cjs/core-client.js.map +1 -1
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +6 -15
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/messages.d.ts +1 -1
- package/lib/cjs/messages.d.ts.map +1 -1
- package/lib/cjs/messages.js +1 -1
- package/lib/cjs/messages.js.map +1 -1
- package/lib/cjs/plugins/destination.d.ts.map +1 -1
- package/lib/cjs/plugins/destination.js +6 -5
- package/lib/cjs/plugins/destination.js.map +1 -1
- package/lib/cjs/utils/event-builder.d.ts +2 -2
- package/lib/cjs/utils/event-builder.d.ts.map +1 -1
- package/lib/cjs/utils/event-builder.js +3 -2
- package/lib/cjs/utils/event-builder.js.map +1 -1
- package/lib/cjs/utils/response-builder.d.ts.map +1 -1
- package/lib/cjs/utils/response-builder.js +16 -15
- package/lib/cjs/utils/response-builder.js.map +1 -1
- package/lib/cjs/utils/return-wrapper.d.ts +3 -0
- package/lib/cjs/utils/return-wrapper.d.ts.map +1 -0
- package/lib/cjs/utils/return-wrapper.js +16 -0
- package/lib/cjs/utils/return-wrapper.js.map +1 -0
- package/lib/cjs/utils/valid-properties.d.ts.map +1 -1
- package/lib/cjs/utils/valid-properties.js +5 -1
- package/lib/cjs/utils/valid-properties.js.map +1 -1
- package/lib/esm/config.d.ts +8 -9
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +26 -43
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/core-client.d.ts +17 -12
- package/lib/esm/core-client.d.ts.map +1 -1
- package/lib/esm/core-client.js +82 -72
- package/lib/esm/core-client.js.map +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/messages.d.ts +1 -1
- package/lib/esm/messages.d.ts.map +1 -1
- package/lib/esm/messages.js +1 -1
- package/lib/esm/messages.js.map +1 -1
- package/lib/esm/plugins/destination.d.ts.map +1 -1
- package/lib/esm/plugins/destination.js +7 -6
- package/lib/esm/plugins/destination.js.map +1 -1
- package/lib/esm/utils/event-builder.d.ts +2 -2
- package/lib/esm/utils/event-builder.d.ts.map +1 -1
- package/lib/esm/utils/event-builder.js +3 -2
- package/lib/esm/utils/event-builder.js.map +1 -1
- package/lib/esm/utils/response-builder.d.ts.map +1 -1
- package/lib/esm/utils/response-builder.js +16 -15
- package/lib/esm/utils/response-builder.js.map +1 -1
- package/lib/esm/utils/return-wrapper.d.ts +3 -0
- package/lib/esm/utils/return-wrapper.d.ts.map +1 -0
- package/lib/esm/utils/return-wrapper.js +13 -0
- package/lib/esm/utils/return-wrapper.js.map +1 -0
- package/lib/esm/utils/valid-properties.d.ts.map +1 -1
- package/lib/esm/utils/valid-properties.js +5 -1
- package/lib/esm/utils/valid-properties.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/core-client.js
CHANGED
|
@@ -1,78 +1,88 @@
|
|
|
1
1
|
import { __awaiter, __generator } from "tslib";
|
|
2
|
-
import { createConfig, getConfig } from './config';
|
|
3
2
|
import { createGroupIdentifyEvent, createIdentifyEvent, createTrackEvent, createRevenueEvent, createGroupEvent, } from './utils/event-builder';
|
|
4
3
|
import { deregister, push, register } from './timeline';
|
|
5
4
|
import { buildResult } from './utils/result-builder';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
5
|
+
var AmplitudeCore = /** @class */ (function () {
|
|
6
|
+
function AmplitudeCore(name) {
|
|
7
|
+
if (name === void 0) { name = '$default'; }
|
|
8
|
+
this.logEvent = this.track.bind(this);
|
|
9
|
+
this.name = name;
|
|
10
|
+
}
|
|
11
|
+
// NOTE: Do not use `_apiKey` and `_userId` here
|
|
12
|
+
AmplitudeCore.prototype.init = function (_apiKey, _userId, config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
return Promise.resolve();
|
|
15
|
+
};
|
|
16
|
+
AmplitudeCore.prototype.track = function (eventInput, eventProperties, eventOptions) {
|
|
17
|
+
var event = createTrackEvent(eventInput, eventProperties, eventOptions);
|
|
18
|
+
return this.dispatch(event);
|
|
19
|
+
};
|
|
20
|
+
AmplitudeCore.prototype.identify = function (identify, eventOptions, userId, deviceId) {
|
|
21
|
+
var event = createIdentifyEvent(userId, deviceId, identify, eventOptions);
|
|
22
|
+
return this.dispatch(event);
|
|
23
|
+
};
|
|
24
|
+
AmplitudeCore.prototype.groupIdentify = function (groupType, groupName, identify, eventOptions, userId, deviceId) {
|
|
25
|
+
var event = createGroupIdentifyEvent(userId, deviceId, groupType, groupName, identify, eventOptions);
|
|
26
|
+
return this.dispatch(event);
|
|
27
|
+
};
|
|
28
|
+
AmplitudeCore.prototype.setGroup = function (groupType, groupName) {
|
|
29
|
+
var event = createGroupEvent(groupType, groupName);
|
|
30
|
+
return this.dispatch(event);
|
|
31
|
+
};
|
|
32
|
+
AmplitudeCore.prototype.revenue = function (revenue, eventOptions) {
|
|
33
|
+
var event = createRevenueEvent(revenue, eventOptions);
|
|
34
|
+
return this.dispatch(event);
|
|
35
|
+
};
|
|
36
|
+
AmplitudeCore.prototype.add = function (plugin) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
38
|
+
var config;
|
|
39
|
+
return __generator(this, function (_a) {
|
|
40
|
+
config = this.config;
|
|
41
|
+
return [2 /*return*/, register(plugin, config)];
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
AmplitudeCore.prototype.remove = function (pluginName) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
var config;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
config = this.config;
|
|
50
|
+
return [2 /*return*/, deregister(pluginName, config)];
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
AmplitudeCore.prototype.dispatch = function (event) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var result, e_1, message;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
_a.trys.push([0, 2, , 3]);
|
|
61
|
+
return [4 /*yield*/, push(event, this.config)];
|
|
62
|
+
case 1:
|
|
63
|
+
result = _a.sent();
|
|
64
|
+
if (result.code === 200) {
|
|
65
|
+
this.config.loggerProvider.log(result.message);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.config.loggerProvider.error(result.message);
|
|
69
|
+
}
|
|
70
|
+
return [2 /*return*/, result];
|
|
71
|
+
case 2:
|
|
72
|
+
e_1 = _a.sent();
|
|
73
|
+
message = String(e_1);
|
|
74
|
+
this.config.loggerProvider.error(message);
|
|
75
|
+
return [2 /*return*/, buildResult(event, 0, message)];
|
|
76
|
+
case 3: return [2 /*return*/];
|
|
60
77
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}); };
|
|
74
|
-
export var setOptOut = function (optOut) {
|
|
75
|
-
var config = getConfig();
|
|
76
|
-
config.optOut = Boolean(optOut);
|
|
77
|
-
};
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
AmplitudeCore.prototype.setOptOut = function (optOut) {
|
|
82
|
+
var config = this.config;
|
|
83
|
+
config.optOut = Boolean(optOut);
|
|
84
|
+
};
|
|
85
|
+
return AmplitudeCore;
|
|
86
|
+
}());
|
|
87
|
+
export { AmplitudeCore };
|
|
78
88
|
//# sourceMappingURL=core-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client.js","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"core-client.js","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":";AACA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD;IAME,uBAAY,IAAiB;QAAjB,qBAAA,EAAA,iBAAiB;QAe7B,aAAQ,GAAG,IA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","sourcesContent":["import { Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';\nimport {\n createGroupIdentifyEvent,\n createIdentifyEvent,\n createTrackEvent,\n createRevenueEvent,\n createGroupEvent,\n} from './utils/event-builder';\nimport { deregister, push, register } from './timeline';\nimport { buildResult } from './utils/result-builder';\nexport class AmplitudeCore<T extends Config> {\n name: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: T;\n\n constructor(name = '$default') {\n this.name = name;\n }\n\n // NOTE: Do not use `_apiKey` and `_userId` here\n init(_apiKey: string | undefined, _userId: string | undefined, config: T) {\n this.config = config;\n return Promise.resolve();\n }\n\n track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions) {\n const event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return this.dispatch(event);\n }\n\n logEvent = this.track.bind(this);\n\n identify(identify: Identify, eventOptions?: EventOptions, userId?: string, deviceId?: string) {\n const event = createIdentifyEvent(userId, deviceId, identify, eventOptions);\n return this.dispatch(event);\n }\n\n groupIdentify(\n groupType: string,\n groupName: string | string[],\n identify: Identify,\n eventOptions?: EventOptions,\n userId?: string,\n deviceId?: string,\n ) {\n const event = createGroupIdentifyEvent(userId, deviceId, groupType, groupName, identify, eventOptions);\n return this.dispatch(event);\n }\n\n setGroup(groupType: string, groupName: string | string[]) {\n const event = createGroupEvent(groupType, groupName);\n return this.dispatch(event);\n }\n\n revenue(revenue: Revenue, eventOptions?: EventOptions) {\n const event = createRevenueEvent(revenue, eventOptions);\n return this.dispatch(event);\n }\n\n async add(plugin: Plugin) {\n const config = this.config;\n return register(plugin, config);\n }\n\n async remove(pluginName: string) {\n const config = this.config;\n return deregister(pluginName, config);\n }\n\n async dispatch(event: Event) {\n try {\n const result = await push(event, this.config);\n if (result.code === 200) {\n this.config.loggerProvider.log(result.message);\n } else {\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 return buildResult(event, 0, message);\n }\n }\n\n setOptOut(optOut: boolean) {\n const config = this.config;\n config.optOut = Boolean(optOut);\n }\n}\n"]}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { getConfig } from './config';
|
|
1
|
+
export { AmplitudeCore } from './core-client';
|
|
3
2
|
export { buildResponse } from './utils/response-builder';
|
|
4
3
|
export { Identify } from './identify';
|
|
5
4
|
export { Revenue } from './revenue';
|
|
@@ -7,4 +6,5 @@ export { Destination } from './plugins/destination';
|
|
|
7
6
|
export { Config } from './config';
|
|
8
7
|
export { Logger } from './logger';
|
|
9
8
|
export { AMPLITUDE_PREFIX } from './constants';
|
|
9
|
+
export { returnWrapper } from './utils/return-wrapper';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { getConfig } from './config';
|
|
1
|
+
export { AmplitudeCore } from './core-client';
|
|
3
2
|
export { buildResponse } from './utils/response-builder';
|
|
4
3
|
export { Identify } from './identify';
|
|
5
4
|
export { Revenue } from './revenue';
|
|
@@ -7,4 +6,5 @@ export { Destination } from './plugins/destination';
|
|
|
7
6
|
export { Config } from './config';
|
|
8
7
|
export { Logger } from './logger';
|
|
9
8
|
export { AMPLITUDE_PREFIX } from './constants';
|
|
9
|
+
export { returnWrapper } from './utils/return-wrapper';
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { AmplitudeCore } from './core-client';\nexport { buildResponse } from './utils/response-builder';\nexport { Identify } from './identify';\nexport { Revenue } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { Config } from './config';\nexport { Logger } from './logger';\nexport { AMPLITUDE_PREFIX } from './constants';\nexport { returnWrapper } from './utils/return-wrapper';\n"]}
|
package/lib/esm/messages.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export declare const SUCCESS_MESSAGE = "Event tracked successfully";
|
|
|
2
2
|
export declare const UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
|
|
3
3
|
export declare const MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";
|
|
4
4
|
export declare const OPT_OUT_MESSAGE = "Event skipped due to optOut config";
|
|
5
|
-
export declare const MISSING_API_KEY_MESSAGE = "Event
|
|
5
|
+
export declare const MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";
|
|
6
6
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,+CAA+C,CAAC;AACzF,eAAO,MAAM,eAAe,uCAAuC,CAAC;AACpE,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,+CAA+C,CAAC;AACzF,eAAO,MAAM,eAAe,uCAAuC,CAAC;AACpE,eAAO,MAAM,uBAAuB,0CAA0C,CAAC"}
|
package/lib/esm/messages.js
CHANGED
|
@@ -2,5 +2,5 @@ export var SUCCESS_MESSAGE = 'Event tracked successfully';
|
|
|
2
2
|
export var UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';
|
|
3
3
|
export var MAX_RETRIES_EXCEEDED_MESSAGE = 'Event rejected due to exceeded retry count';
|
|
4
4
|
export var OPT_OUT_MESSAGE = 'Event skipped due to optOut config';
|
|
5
|
-
export var MISSING_API_KEY_MESSAGE = 'Event
|
|
5
|
+
export var MISSING_API_KEY_MESSAGE = 'Event rejected due to missing API key';
|
|
6
6
|
//# sourceMappingURL=messages.js.map
|
package/lib/esm/messages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,eAAe,GAAG,4BAA4B,CAAC;AAC5D,MAAM,CAAC,IAAM,wBAAwB,GAAG,2BAA2B,CAAC;AACpE,MAAM,CAAC,IAAM,4BAA4B,GAAG,4CAA4C,CAAC;AACzF,MAAM,CAAC,IAAM,eAAe,GAAG,oCAAoC,CAAC;AACpE,MAAM,CAAC,IAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,eAAe,GAAG,4BAA4B,CAAC;AAC5D,MAAM,CAAC,IAAM,wBAAwB,GAAG,2BAA2B,CAAC;AACpE,MAAM,CAAC,IAAM,4BAA4B,GAAG,4CAA4C,CAAC;AACzF,MAAM,CAAC,IAAM,eAAe,GAAG,oCAAoC,CAAC;AACpE,MAAM,CAAC,IAAM,uBAAuB,GAAG,uCAAuC,CAAC","sourcesContent":["export const SUCCESS_MESSAGE = 'Event tracked successfully';\nexport const UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';\nexport const MAX_RETRIES_EXCEEDED_MESSAGE = 'Event rejected due to exceeded retry count';\nexport const OPT_OUT_MESSAGE = 'Event skipped due to optOut config';\nexport const MISSING_API_KEY_MESSAGE = 'Event rejected due to missing API key';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../../src/plugins/destination.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,kBAAkB,IAAI,OAAO,EAC7B,iBAAiB,EACjB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K,GAAG,OAAO,CAAC,MAAM,CAAC;IAYtC,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IA0B7B,QAAQ,CAAC,OAAO,EAAE,MAAM;IAalB,KAAK;IAOL,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE;IAuB1B,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;IAwB5C,qBAAqB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE;IAI3D,qBAAqB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE;IAyB3D,6BAA6B,CAAC,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,OAAO,EAAE;IAS3E,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE;IAyB/D,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE;IAIlC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAK7D,WAAW,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE;IAM9B,gBAAgB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE;IAMnC,QAAQ;CAKT"}
|
|
@@ -4,7 +4,7 @@ import { MISSING_API_KEY_MESSAGE, SUCCESS_MESSAGE, UNEXPECTED_ERROR_MESSAGE } fr
|
|
|
4
4
|
import { STORAGE_PREFIX } from '../constants';
|
|
5
5
|
import { chunk } from '../utils/chunk';
|
|
6
6
|
import { buildResult } from '../utils/result-builder';
|
|
7
|
-
import {
|
|
7
|
+
import { createServerConfig } from '../config';
|
|
8
8
|
var Destination = /** @class */ (function () {
|
|
9
9
|
function Destination() {
|
|
10
10
|
this.name = 'amplitude';
|
|
@@ -102,7 +102,7 @@ var Destination = /** @class */ (function () {
|
|
|
102
102
|
};
|
|
103
103
|
Destination.prototype.send = function (list) {
|
|
104
104
|
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
var payload, res, e_1;
|
|
105
|
+
var payload, serverUrl, res, e_1;
|
|
106
106
|
return __generator(this, function (_a) {
|
|
107
107
|
switch (_a.label) {
|
|
108
108
|
case 0:
|
|
@@ -116,7 +116,8 @@ var Destination = /** @class */ (function () {
|
|
|
116
116
|
_a.label = 1;
|
|
117
117
|
case 1:
|
|
118
118
|
_a.trys.push([1, 3, , 4]);
|
|
119
|
-
|
|
119
|
+
serverUrl = createServerConfig(this.config.serverZone, this.config.useBatch).serverUrl;
|
|
120
|
+
return [4 /*yield*/, this.config.transportProvider.send(serverUrl, payload)];
|
|
120
121
|
case 2:
|
|
121
122
|
res = _a.sent();
|
|
122
123
|
if (res === null) {
|
|
@@ -162,11 +163,11 @@ var Destination = /** @class */ (function () {
|
|
|
162
163
|
this.fulfillRequest(list, res.statusCode, res.body.error);
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
|
-
var dropIndex = __spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(res.body.silencedEvents), false).flat();
|
|
166
|
+
var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();
|
|
166
167
|
var dropIndexSet = new Set(dropIndex);
|
|
167
168
|
var retry = list.filter(function (context, index) {
|
|
168
169
|
if (dropIndexSet.has(index)) {
|
|
169
|
-
_this.fulfillRequest([context], res.statusCode, res.
|
|
170
|
+
_this.fulfillRequest([context], res.statusCode, res.body.error);
|
|
170
171
|
return;
|
|
171
172
|
}
|
|
172
173
|
return true;
|
|
@@ -192,7 +193,7 @@ var Destination = /** @class */ (function () {
|
|
|
192
193
|
var retry = list.filter(function (context, index) {
|
|
193
194
|
if ((context.event.user_id && dropUserIdsSet.has(context.event.user_id)) ||
|
|
194
195
|
(context.event.device_id && dropDeviceIdsSet.has(context.event.device_id))) {
|
|
195
|
-
_this.fulfillRequest([context], res.statusCode, res.
|
|
196
|
+
_this.fulfillRequest([context], res.statusCode, res.body.error);
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
198
199
|
if (throttledIndexSet.has(index)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../../src/plugins/destination.ts"],"names":[],"mappings":";AAAA,OAAO,EAOL,UAAU,EAIV,MAAM,GAEP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;IAAA;QACE,SAAI,GAAG,WAAW,CAAC;QACnB,SAAI,GAAG,UAAU,CAAC,WAAoB,CAAC;QAEvC,YAAO,GAAG,IAAI,CAAC;QACf,aAAQ,GAAG,KAAK,CAAC;QACjB,eAAU,GAAG,EAAE,CAAC;QAChB,WAAM,GAAe,IAAI,GAAG,EAAE,CAAC;QAK/B,cAAS,GAAG,KAAK,CAAC;QAClB,UAAK,GAAc,EAAE,CAAC;IA+MxB,CAAC;IA7MC,2BAAK,GAAL,UAAM,MAAc;QAApB,iBAWC;QAVC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,UAAU,GAAG,UAAG,cAAc,cAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAE,CAAC;QAC7E,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,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lB,qBAAkB,EAAlB,IAAkB;YAAlB,2BAAkB;;QAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QACpC,MAAM,CAAC,OAAO,CAAC,UAAC,KAAK,IAAK,OAAA,KAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED,sCAAgB,GAAhB;QAAA,iBAIC;QAJgB,gBAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,2BAAkB;;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QACpC,MAAM,CAAC,OAAO,CAAC,UAAC,KAAK,IAAK,OAAA,KAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAzB,CAAyB,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED,8BAAQ,GAAR;QACE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QACpC,IAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IACH,kBAAC;AAAD,CAAC,AA5ND,IA4NC","sourcesContent":["import {\n Config,\n DestinationContext as Context,\n DestinationPlugin,\n Event,\n InvalidResponse,\n PayloadTooLargeResponse,\n PluginType,\n RateLimitResponse,\n Response,\n Result,\n Status,\n SuccessResponse,\n} from '@amplitude/analytics-types';\nimport { MISSING_API_KEY_MESSAGE, SUCCESS_MESSAGE, UNEXPECTED_ERROR_MESSAGE } from '../messages';\nimport { STORAGE_PREFIX } from '../constants';\nimport { chunk } from '../utils/chunk';\nimport { buildResult } from '../utils/result-builder';\nimport { getApiHost } from '../config';\n\nexport class Destination implements DestinationPlugin {\n name = 'amplitude';\n type = PluginType.DESTINATION as const;\n\n backoff = 1000;\n throttle = 30000;\n storageKey = '';\n backup: Set<Event> = new Set();\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: Config;\n scheduled = false;\n queue: Context[] = [];\n\n setup(config: Config) {\n this.config = config;\n\n this.storageKey = `${STORAGE_PREFIX}_${this.config.apiKey.substring(0, 10)}`;\n const unsent = this.config.storageProvider.get(this.storageKey);\n this.snapshot(); // sets storage to '[]'\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map((event) => this.execute(event))).catch();\n }\n\n return Promise.resolve(undefined);\n }\n\n execute(event: Event): Promise<Result> {\n return new Promise((resolve) => {\n const context = {\n event,\n attempts: 0,\n callback: (result: Result) => resolve(result),\n delay: 0,\n };\n this.addToQueue(context);\n });\n }\n\n addToQueue(...list: Context[]) {\n const tryable = list.filter((context) => {\n if (context.attempts < this.config.flushMaxRetries) {\n return true;\n }\n this.fulfillRequest([context], 500, Status.Unknown);\n return false;\n });\n\n this.addToBackup(...tryable.map((context) => context.event));\n tryable.forEach((context) => {\n context.attempts += 1;\n const delay = context.delay;\n context.delay = 0;\n if (context.attempts === 1 && !context.delay) {\n this.queue = this.queue.concat(context);\n this.schedule(this.config.flushIntervalMillis);\n return;\n }\n setTimeout(() => {\n this.queue = this.queue.concat(context);\n this.schedule(this.config.flushIntervalMillis);\n }, delay || context.attempts * this.backoff);\n });\n }\n\n schedule(timeout: number) {\n if (this.scheduled) return;\n this.scheduled = true;\n setTimeout(() => {\n void this.flush().then(() => {\n this.scheduled = false;\n if (this.queue.length > 0) {\n this.schedule(timeout);\n }\n });\n }, timeout);\n }\n\n async flush() {\n const list = this.queue;\n this.queue = [];\n const batches = chunk(list, this.config.flushQueueSize);\n await Promise.all(batches.map((batch) => this.send(batch)));\n }\n\n async send(list: Context[]) {\n if (!this.config.apiKey) {\n return this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE);\n }\n\n const payload = {\n api_key: this.config.apiKey,\n events: list.map((context) => context.event),\n };\n\n try {\n const res = await this.config.transportProvider.send(getApiHost(this.config), payload);\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return;\n }\n this.handleReponse(res, list);\n } catch (e) {\n this.fulfillRequest(list, 0, String(e));\n }\n }\n\n handleReponse(res: Response, list: Context[]) {\n const { status } = res;\n switch (status) {\n case Status.Success:\n this.handleSuccessResponse(res, list);\n break;\n\n case Status.Invalid:\n this.handleInvalidResponse(res, list);\n break;\n\n case Status.PayloadTooLarge:\n this.handlePayloadTooLargeResponse(res, list);\n break;\n\n case Status.RateLimit:\n this.handleRateLimitResponse(res, list);\n break;\n\n default:\n this.handleOtherReponse(list);\n }\n }\n\n handleSuccessResponse(res: SuccessResponse, list: Context[]) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n }\n\n handleInvalidResponse(res: InvalidResponse, list: Context[]) {\n if (res.body.missingField) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n\n const dropIndex = [\n ...Object.values(res.body.eventsWithInvalidFields),\n ...Object.values(res.body.eventsWithMissingFields),\n ...res.body.silencedEvents,\n ].flat();\n const dropIndexSet = new Set(dropIndex);\n\n const retry = list.filter((context, index) => {\n if (dropIndexSet.has(index)) {\n this.fulfillRequest([context], res.statusCode, res.status);\n return;\n }\n return true;\n });\n\n this.addToQueue(...retry);\n }\n\n handlePayloadTooLargeResponse(res: PayloadTooLargeResponse, list: Context[]) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.flushQueueSize /= 2;\n this.addToQueue(...list);\n }\n\n handleRateLimitResponse(res: RateLimitResponse, list: Context[]) {\n const dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n const dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n const throttledIndex = res.body.throttledEvents;\n const dropUserIdsSet = new Set(dropUserIds);\n const dropDeviceIdsSet = new Set(dropDeviceIds);\n const throttledIndexSet = new Set(throttledIndex);\n\n const retry = list.filter((context, index) => {\n if (\n (context.event.user_id && dropUserIdsSet.has(context.event.user_id)) ||\n (context.event.device_id && dropDeviceIdsSet.has(context.event.device_id))\n ) {\n this.fulfillRequest([context], res.statusCode, res.status);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.delay = this.throttle;\n }\n return true;\n });\n\n this.addToQueue(...retry);\n }\n\n handleOtherReponse(list: Context[]) {\n this.addToQueue(...list);\n }\n\n fulfillRequest(list: Context[], code: number, message: string) {\n this.removeFromBackup(...list.map((context) => context.event));\n list.forEach((context) => context.callback(buildResult(context.event, code, message)));\n }\n\n addToBackup(...events: Event[]) {\n if (!this.config.saveEvents) return;\n events.forEach((event) => this.backup.add(event));\n this.snapshot();\n }\n\n removeFromBackup(...events: Event[]) {\n if (!this.config.saveEvents) return;\n events.forEach((event) => this.backup.delete(event));\n this.snapshot();\n }\n\n snapshot() {\n if (!this.config.saveEvents) return;\n const events = Array.from(this.backup);\n this.config.storageProvider.set(this.storageKey, events);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../../src/plugins/destination.ts"],"names":[],"mappings":";AAAA,OAAO,EAOL,UAAU,EAIV,MAAM,GAEP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;IAAA;QACE,SAAI,GAAG,WAAW,CAAC;QACnB,SAAI,GAAG,UAAU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AAM,CAAC,KAAK,CAAC,EAAzB,CAAyB,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED,8BAAQ,GAAR;QACE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QACpC,IAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IACH,kBAAC;AAAD,CAAC,AA9ND,IA8NC","sourcesContent":["import {\n Config,\n DestinationContext as Context,\n DestinationPlugin,\n Event,\n InvalidResponse,\n PayloadTooLargeResponse,\n PluginType,\n RateLimitResponse,\n Response,\n Result,\n Status,\n SuccessResponse,\n} from '@amplitude/analytics-types';\nimport { MISSING_API_KEY_MESSAGE, SUCCESS_MESSAGE, UNEXPECTED_ERROR_MESSAGE } from '../messages';\nimport { STORAGE_PREFIX } from '../constants';\nimport { chunk } from '../utils/chunk';\nimport { buildResult } from '../utils/result-builder';\nimport { createServerConfig } from '../config';\n\nexport class Destination implements DestinationPlugin {\n name = 'amplitude';\n type = PluginType.DESTINATION as const;\n\n backoff = 1000;\n throttle = 30000;\n storageKey = '';\n backup: Set<Event> = new Set();\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: Config;\n scheduled = false;\n queue: Context[] = [];\n\n setup(config: Config) {\n this.config = config;\n\n this.storageKey = `${STORAGE_PREFIX}_${this.config.apiKey.substring(0, 10)}`;\n const unsent = this.config.storageProvider.get(this.storageKey);\n this.snapshot(); // sets storage to '[]'\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map((event) => this.execute(event))).catch();\n }\n\n return Promise.resolve(undefined);\n }\n\n execute(event: Event): Promise<Result> {\n return new Promise((resolve) => {\n const context = {\n event,\n attempts: 0,\n callback: (result: Result) => resolve(result),\n delay: 0,\n };\n this.addToQueue(context);\n });\n }\n\n addToQueue(...list: Context[]) {\n const tryable = list.filter((context) => {\n if (context.attempts < this.config.flushMaxRetries) {\n return true;\n }\n this.fulfillRequest([context], 500, Status.Unknown);\n return false;\n });\n\n this.addToBackup(...tryable.map((context) => context.event));\n tryable.forEach((context) => {\n context.attempts += 1;\n const delay = context.delay;\n context.delay = 0;\n if (context.attempts === 1 && !context.delay) {\n this.queue = this.queue.concat(context);\n this.schedule(this.config.flushIntervalMillis);\n return;\n }\n setTimeout(() => {\n this.queue = this.queue.concat(context);\n this.schedule(this.config.flushIntervalMillis);\n }, delay || context.attempts * this.backoff);\n });\n }\n\n schedule(timeout: number) {\n if (this.scheduled) return;\n this.scheduled = true;\n setTimeout(() => {\n void this.flush().then(() => {\n this.scheduled = false;\n if (this.queue.length > 0) {\n this.schedule(timeout);\n }\n });\n }, timeout);\n }\n\n async flush() {\n const list = this.queue;\n this.queue = [];\n const batches = chunk(list, this.config.flushQueueSize);\n await Promise.all(batches.map((batch) => this.send(batch)));\n }\n\n async send(list: Context[]) {\n if (!this.config.apiKey) {\n return this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE);\n }\n\n const payload = {\n api_key: this.config.apiKey,\n events: list.map((context) => context.event),\n };\n\n try {\n const { serverUrl } = createServerConfig(this.config.serverZone, this.config.useBatch);\n const res = await this.config.transportProvider.send(serverUrl, payload);\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return;\n }\n this.handleReponse(res, list);\n } catch (e) {\n this.fulfillRequest(list, 0, String(e));\n }\n }\n\n handleReponse(res: Response, list: Context[]) {\n const { status } = res;\n switch (status) {\n case Status.Success:\n this.handleSuccessResponse(res, list);\n break;\n\n case Status.Invalid:\n this.handleInvalidResponse(res, list);\n break;\n\n case Status.PayloadTooLarge:\n this.handlePayloadTooLargeResponse(res, list);\n break;\n\n case Status.RateLimit:\n this.handleRateLimitResponse(res, list);\n break;\n\n default:\n this.handleOtherReponse(list);\n }\n }\n\n handleSuccessResponse(res: SuccessResponse, list: Context[]) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n }\n\n handleInvalidResponse(res: InvalidResponse, list: Context[]) {\n if (res.body.missingField) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n\n const dropIndex = [\n ...Object.values(res.body.eventsWithInvalidFields),\n ...Object.values(res.body.eventsWithMissingFields),\n ...Object.values(res.body.eventsWithInvalidIdLengths),\n ...res.body.silencedEvents,\n ].flat();\n const dropIndexSet = new Set(dropIndex);\n\n const retry = list.filter((context, index) => {\n if (dropIndexSet.has(index)) {\n this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n\n this.addToQueue(...retry);\n }\n\n handlePayloadTooLargeResponse(res: PayloadTooLargeResponse, list: Context[]) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.flushQueueSize /= 2;\n this.addToQueue(...list);\n }\n\n handleRateLimitResponse(res: RateLimitResponse, list: Context[]) {\n const dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n const dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n const throttledIndex = res.body.throttledEvents;\n const dropUserIdsSet = new Set(dropUserIds);\n const dropDeviceIdsSet = new Set(dropDeviceIds);\n const throttledIndexSet = new Set(throttledIndex);\n\n const retry = list.filter((context, index) => {\n if (\n (context.event.user_id && dropUserIdsSet.has(context.event.user_id)) ||\n (context.event.device_id && dropDeviceIdsSet.has(context.event.device_id))\n ) {\n this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.delay = this.throttle;\n }\n return true;\n });\n\n this.addToQueue(...retry);\n }\n\n handleOtherReponse(list: Context[]) {\n this.addToQueue(...list);\n }\n\n fulfillRequest(list: Context[], code: number, message: string) {\n this.removeFromBackup(...list.map((context) => context.event));\n list.forEach((context) => context.callback(buildResult(context.event, code, message)));\n }\n\n addToBackup(...events: Event[]) {\n if (!this.config.saveEvents) return;\n events.forEach((event) => this.backup.add(event));\n this.snapshot();\n }\n\n removeFromBackup(...events: Event[]) {\n if (!this.config.saveEvents) return;\n events.forEach((event) => this.backup.delete(event));\n this.snapshot();\n }\n\n snapshot() {\n if (!this.config.saveEvents) return;\n const events = Array.from(this.backup);\n this.config.storageProvider.set(this.storageKey, events);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TrackEvent, IdentifyEvent, GroupIdentifyEvent, Identify as IIdentify, Revenue, RevenueEvent, EventOptions } from '@amplitude/analytics-types';
|
|
2
|
-
export declare const createTrackEvent: (
|
|
1
|
+
import { BaseEvent, TrackEvent, IdentifyEvent, GroupIdentifyEvent, Identify as IIdentify, Revenue, RevenueEvent, EventOptions } from '@amplitude/analytics-types';
|
|
2
|
+
export declare const createTrackEvent: (eventInput: BaseEvent | string, eventProperties?: Record<string, any> | undefined, eventOptions?: EventOptions | undefined) => TrackEvent;
|
|
3
3
|
export declare const createIdentifyEvent: (userId: string | undefined, deviceId: string | undefined, identify: IIdentify, eventOptions?: EventOptions | undefined) => IdentifyEvent;
|
|
4
4
|
export declare const createGroupIdentifyEvent: (userId: string | undefined, deviceId: string | undefined, groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions | undefined) => GroupIdentifyEvent;
|
|
5
5
|
export declare const createGroupEvent: (groupType: string, groupName: string | string[]) => IdentifyEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/event-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAElB,QAAQ,IAAI,SAAS,EACrB,OAAO,EACP,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"event-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/event-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,aAAa,EACb,kBAAkB,EAElB,QAAQ,IAAI,SAAS,EACrB,OAAO,EACP,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,gBAAgB,eACf,SAAS,GAAG,MAAM,iGAG7B,UAOF,CAAC;AAEF,eAAO,MAAM,mBAAmB,WACtB,MAAM,GAAG,SAAS,YAChB,MAAM,GAAG,SAAS,YAClB,SAAS,8CAElB,aAaF,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAC3B,MAAM,GAAG,SAAS,YAChB,MAAM,GAAG,SAAS,aACjB,MAAM,aACN,MAAM,GAAG,MAAM,EAAE,YAClB,SAAS,8CAElB,kBAgBF,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAAe,MAAM,aAAa,MAAM,GAAG,MAAM,EAAE,kBAY/E,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAa,OAAO,8CAAgC,YAMlF,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { SpecialEventType, } from '@amplitude/analytics-types';
|
|
3
3
|
import { Identify } from '../identify';
|
|
4
|
-
export var createTrackEvent = function (
|
|
5
|
-
|
|
4
|
+
export var createTrackEvent = function (eventInput, eventProperties, eventOptions) {
|
|
5
|
+
var baseEvent = typeof eventInput === 'string' ? { event_type: eventInput } : eventInput;
|
|
6
|
+
return __assign(__assign(__assign({}, baseEvent), eventOptions), (eventProperties && { event_properties: eventProperties }));
|
|
6
7
|
};
|
|
7
8
|
export var createIdentifyEvent = function (userId, deviceId, identify, eventOptions) {
|
|
8
9
|
var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify.getUserProperties(), user_id: userId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-builder.js","sourceRoot":"","sources":["../../../src/utils/event-builder.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"event-builder.js","sourceRoot":"","sources":["../../../src/utils/event-builder.ts"],"names":[],"mappings":";AAAA,OAAO,EAKL,gBAAgB,GAKjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAC9B,UAA8B,EAC9B,eAAqC,EACrC,YAA2B;IAE3B,IAAM,SAAS,GAAc,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IACtG,sCACK,SAAS,GACT,YAAY,GACZ,CAAC,eAAe,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,EAC7D;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UACjC,MAA0B,EAC1B,QAA4B,EAC5B,QAAmB,EACnB,YAA2B;IAE3B,IAAM,aAAa,yBACd,YAAY,KACf,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EACrC,eAAe,EAAE,QAAQ,CAAC,iBAAiB,EAAE,EAC7C,OAAO,EAAE,MAAM,GAChB,CAAC;IAEF,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,aAAa,CAAC,SAAS,GAAG,QAAQ,CAAC;KACpC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,wBAAwB,GAAG,UACtC,MAA0B,EAC1B,QAA4B,EAC5B,SAAiB,EACjB,SAA4B,EAC5B,QAAmB,EACnB,YAA2B;;IAE3B,IAAM,aAAa,yBACd,YAAY,KACf,UAAU,EAAE,gBAAgB,CAAC,cAAc,EAC3C,gBAAgB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,EAC9C,MAAM;YACJ,GAAC,SAAS,IAAG,SAAS;iBAExB,OAAO,EAAE,MAAM,GAChB,CAAC;IAEF,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,aAAa,CAAC,SAAS,GAAG,QAAQ,CAAC;KACpC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,SAAiB,EAAE,SAA4B;;IAC9E,IAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAEnC,IAAM,UAAU,GAAkB;QAChC,UAAU,EAAE,gBAAgB,CAAC,QAAQ;QACrC,eAAe,EAAE,QAAQ,CAAC,iBAAiB,EAAE;QAC7C,MAAM;YACJ,GAAC,SAAS,IAAG,SAAS;eACvB;KACF,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAC,OAAgB,EAAE,YAA2B;IAC9E,6BACK,YAAY,KACf,UAAU,EAAE,gBAAgB,CAAC,OAAO,EACpC,gBAAgB,EAAE,OAAO,CAAC,kBAAkB,EAAE,IAC9C;AACJ,CAAC,CAAC","sourcesContent":["import {\n BaseEvent,\n TrackEvent,\n IdentifyEvent,\n GroupIdentifyEvent,\n SpecialEventType,\n Identify as IIdentify,\n Revenue,\n RevenueEvent,\n EventOptions,\n} from '@amplitude/analytics-types';\nimport { Identify } from '../identify';\n\nexport const createTrackEvent = (\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n): TrackEvent => {\n const baseEvent: BaseEvent = typeof eventInput === 'string' ? { event_type: eventInput } : eventInput;\n return {\n ...baseEvent,\n ...eventOptions,\n ...(eventProperties && { event_properties: eventProperties }),\n };\n};\n\nexport const createIdentifyEvent = (\n userId: string | undefined,\n deviceId: string | undefined,\n identify: IIdentify,\n eventOptions?: EventOptions,\n): IdentifyEvent => {\n const identifyEvent: IdentifyEvent = {\n ...eventOptions,\n event_type: SpecialEventType.IDENTIFY,\n user_properties: identify.getUserProperties(),\n user_id: userId,\n };\n\n if (deviceId !== undefined && deviceId.length > 0) {\n identifyEvent.device_id = deviceId;\n }\n\n return identifyEvent;\n};\n\nexport const createGroupIdentifyEvent = (\n userId: string | undefined,\n deviceId: string | undefined,\n groupType: string,\n groupName: string | string[],\n identify: IIdentify,\n eventOptions?: EventOptions,\n): GroupIdentifyEvent => {\n const groupIdentify: GroupIdentifyEvent = {\n ...eventOptions,\n event_type: SpecialEventType.GROUP_IDENTIFY,\n group_properties: identify.getUserProperties(),\n groups: {\n [groupType]: groupName,\n },\n user_id: userId,\n };\n\n if (deviceId !== undefined && deviceId.length > 0) {\n groupIdentify.device_id = deviceId;\n }\n\n return groupIdentify;\n};\n\nexport const createGroupEvent = (groupType: string, groupName: string | string[]) => {\n const identify = new Identify();\n identify.set(groupType, groupName);\n\n const groupEvent: IdentifyEvent = {\n event_type: SpecialEventType.IDENTIFY,\n user_properties: identify.getUserProperties(),\n groups: {\n [groupType]: groupName,\n },\n };\n return groupEvent;\n};\n\nexport const createRevenueEvent = (revenue: Revenue, eventOptions?: EventOptions): RevenueEvent => {\n return {\n ...eventOptions,\n event_type: SpecialEventType.REVENUE,\n event_properties: revenue.getEventProperties(),\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/response-builder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAU,MAAM,4BAA4B,CAAC;AAG9D,eAAO,MAAM,aAAa,iBAAkB,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"response-builder.d.ts","sourceRoot":"","sources":["../../../src/utils/response-builder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAU,MAAM,4BAA4B,CAAC;AAG9D,eAAO,MAAM,aAAa,iBAAkB,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,QAAQ,GAAG,IAmE5E,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Status } from '@amplitude/analytics-types';
|
|
5
5
|
import { buildStatus } from './status-builder';
|
|
6
6
|
export var buildResponse = function (responseJSON) {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
8
8
|
if (typeof responseJSON !== 'object') {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
@@ -30,12 +30,13 @@ export var buildResponse = function (responseJSON) {
|
|
|
30
30
|
missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : '',
|
|
31
31
|
eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},
|
|
32
32
|
eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},
|
|
34
|
+
epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,
|
|
35
|
+
exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},
|
|
36
|
+
silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],
|
|
37
|
+
silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],
|
|
38
|
+
throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},
|
|
39
|
+
throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : [],
|
|
39
40
|
},
|
|
40
41
|
};
|
|
41
42
|
case Status.PayloadTooLarge:
|
|
@@ -43,7 +44,7 @@ export var buildResponse = function (responseJSON) {
|
|
|
43
44
|
status: status,
|
|
44
45
|
statusCode: statusCode,
|
|
45
46
|
body: {
|
|
46
|
-
error: (
|
|
47
|
+
error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : '',
|
|
47
48
|
},
|
|
48
49
|
};
|
|
49
50
|
case Status.RateLimit:
|
|
@@ -51,13 +52,13 @@ export var buildResponse = function (responseJSON) {
|
|
|
51
52
|
status: status,
|
|
52
53
|
statusCode: statusCode,
|
|
53
54
|
body: {
|
|
54
|
-
error: (
|
|
55
|
-
epsThreshold: (
|
|
56
|
-
throttledDevices: (
|
|
57
|
-
throttledUsers: (
|
|
58
|
-
exceededDailyQuotaDevices: (
|
|
59
|
-
exceededDailyQuotaUsers: (
|
|
60
|
-
throttledEvents: (
|
|
55
|
+
error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : '',
|
|
56
|
+
epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,
|
|
57
|
+
throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},
|
|
58
|
+
throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},
|
|
59
|
+
exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},
|
|
60
|
+
exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},
|
|
61
|
+
throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : [],
|
|
61
62
|
},
|
|
62
63
|
};
|
|
63
64
|
case Status.Timeout:
|
|
@@ -1 +1 @@
|
|
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I,EAAE;oBAC1E,eAAe,EAAE,MAAA,YAAY,CAAC,gBAAgB,mCAAI,EAAE;oBACpD,cAAc,EAAE,MAAA,YAAY,CAAC,eAAe,mCAAI,EAAE;oBAClD,gBAAgB,EAAE,MAAA,YAAY,CAAC,iBAAiB,mCAAI,EAAE;oBACtD,eAAe,EAAE,MAAA,YAAY,CAAC,gBAAgB,mCAAI,EAAE;iBACrD;aACF,CAAC;QACJ,KAAK,MAAM,CAAC,eAAe;YACzB,OAAO;gBACL,MAAM,QAAA;gBACN,UAAU,YAAA;gBACV,IAAI,EAAE;oBACJ,KAAK,EAAE,MAAA,YAAY,CAAC,KAAK,mCAAI,EAAE;iBAChC;aACF,CAAC;QACJ,KAAK,MAAM,CAAC,SAAS;YACnB,OAAO;gBACL,MAAM,QAAA;gBACN,UAAU,YAAA;gBACV,IAAI,EAAE;oBACJ,KAAK,EAAE,MAAA,YAAY,CAAC,KAAK,mCAAI,EAAE;oBAC/B,YAAY,EAAE,MAAA,YAAY,CAAC,aAAa,mCAAI,CAAC;oBAC7C,gBAAgB,EAAE,MAAA,YAAY,CAAC,iBAAiB,mCAAI,EAAE;oBACtD,cAAc,EAAE,MAAA,YAAY,CAAC,eAAe,mCAAI,EAAE;oBAClD,yBAAyB,EAAE,MAAA,YAAY,CAAC,4BAA4B,mCAAI,EAAE;oBAC1E,uBAAuB,EAAE,MAAA,YAAY,CAAC,0BAA0B,mCAAI,EAAE;oBACtE,eAAe,EAAE,MAAA,YAAY,CAAC,gBAAgB,mCAAI,EAAE;iBACrD;aACF,CAAC;QACJ,KAAK,MAAM,CAAC,OAAO,CAAC;QACpB;YACE,OAAO;gBACL,MAAM,QAAA;gBACN,UAAU,YAAA;aACX,CAAC;KACL;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\nimport { Response, Status } from '@amplitude/analytics-types';\nimport { buildStatus } from './status-builder';\n\nexport const buildResponse = (responseJSON: Record<string, any>): Response | null => {\n if (typeof responseJSON !== 'object') {\n return null;\n }\n\n const statusCode = responseJSON.code || 0;\n const status = buildStatus(statusCode);\n\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: responseJSON.events_ingested ?? 0,\n payloadSizeBytes: responseJSON.payload_size_bytes ?? 0,\n serverUploadTime: responseJSON.server_upload_time ?? 0,\n },\n };\n\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: responseJSON.error ?? '',\n missingField: responseJSON.missing_field ?? '',\n eventsWithInvalidFields: responseJSON.events_with_invalid_fields ?? {},\n eventsWithMissingFields: responseJSON.events_with_missing_fields ?? {},\n epsThreshold: responseJSON.eps_threshold ?? 0,\n exceededDailyQuotaDevices: responseJSON.exceeded_daily_quota_devices ?? {},\n silencedDevices: responseJSON.silenced_devices ?? [],\n silencedEvents: responseJSON.silenced_events ?? [],\n throttledDevices: responseJSON.throttled_devices ?? {},\n throttledEvents: responseJSON.throttled_events ?? [],\n },\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: responseJSON.error ?? '',\n },\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: responseJSON.error ?? '',\n epsThreshold: responseJSON.eps_threshold ?? 0,\n throttledDevices: responseJSON.throttled_devices ?? {},\n throttledUsers: responseJSON.throttled_users ?? {},\n exceededDailyQuotaDevices: responseJSON.exceeded_daily_quota_devices ?? {},\n exceededDailyQuotaUsers: responseJSON.exceeded_daily_quota_users ?? {},\n throttledEvents: responseJSON.throttled_events ?? [],\n },\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode,\n };\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"response-builder.js","sourceRoot":"","sources":["../../../src/utils/response-builder.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,4DAA4D;AAC5D,sDAAsD;AACtD,OAAO,EAAY,MAAM,EA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AAA,YAAY,CAAC,eAAe,mCAAI,EAAE;oBAClD,gBAAgB,EAAE,MAAA,YAAY,CAAC,iBAAiB,mCAAI,EAAE;oBACtD,eAAe,EAAE,MAAA,YAAY,CAAC,gBAAgB,mCAAI,EAAE;iBACrD;aACF,CAAC;QACJ,KAAK,MAAM,CAAC,eAAe;YACzB,OAAO;gBACL,MAAM,QAAA;gBACN,UAAU,YAAA;gBACV,IAAI,EAAE;oBACJ,KAAK,EAAE,MAAA,YAAY,CAAC,KAAK,mCAAI,EAAE;iBAChC;aACF,CAAC;QACJ,KAAK,MAAM,CAAC,SAAS;YACnB,OAAO;gBACL,MAAM,QAAA;gBACN,UAAU,YAAA;gBACV,IAAI,EAAE;oBACJ,KAAK,EAAE,MAAA,YAAY,CAAC,KAAK,mCAAI,EAAE;oBAC/B,YAAY,EAAE,MAAA,YAAY,CAAC,aAAa,mCAAI,CAAC;oBAC7C,gBAAgB,EAAE,MAAA,YAAY,CAAC,iBAAiB,mCAAI,EAAE;oBACtD,cAAc,EAAE,MAAA,YAAY,CAAC,eAAe,mCAAI,EAAE;oBAClD,yBAAyB,EAAE,MAAA,YAAY,CAAC,4BAA4B,mCAAI,EAAE;oBAC1E,uBAAuB,EAAE,MAAA,YAAY,CAAC,0BAA0B,mCAAI,EAAE;oBACtE,eAAe,EAAE,MAAA,YAAY,CAAC,gBAAgB,mCAAI,EAAE;iBACrD;aACF,CAAC;QACJ,KAAK,MAAM,CAAC,OAAO,CAAC;QACpB;YACE,OAAO;gBACL,MAAM,QAAA;gBACN,UAAU,YAAA;aACX,CAAC;KACL;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\nimport { Response, Status } from '@amplitude/analytics-types';\nimport { buildStatus } from './status-builder';\n\nexport const buildResponse = (responseJSON: Record<string, any>): Response | null => {\n if (typeof responseJSON !== 'object') {\n return null;\n }\n\n const statusCode = responseJSON.code || 0;\n const status = buildStatus(statusCode);\n\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: responseJSON.events_ingested ?? 0,\n payloadSizeBytes: responseJSON.payload_size_bytes ?? 0,\n serverUploadTime: responseJSON.server_upload_time ?? 0,\n },\n };\n\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: responseJSON.error ?? '',\n missingField: responseJSON.missing_field ?? '',\n eventsWithInvalidFields: responseJSON.events_with_invalid_fields ?? {},\n eventsWithMissingFields: responseJSON.events_with_missing_fields ?? {},\n eventsWithInvalidIdLengths: responseJSON.events_with_invalid_id_lengths ?? {},\n epsThreshold: responseJSON.eps_threshold ?? 0,\n exceededDailyQuotaDevices: responseJSON.exceeded_daily_quota_devices ?? {},\n silencedDevices: responseJSON.silenced_devices ?? [],\n silencedEvents: responseJSON.silenced_events ?? [],\n throttledDevices: responseJSON.throttled_devices ?? {},\n throttledEvents: responseJSON.throttled_events ?? [],\n },\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: responseJSON.error ?? '',\n },\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: responseJSON.error ?? '',\n epsThreshold: responseJSON.eps_threshold ?? 0,\n throttledDevices: responseJSON.throttled_devices ?? {},\n throttledUsers: responseJSON.throttled_users ?? {},\n exceededDailyQuotaDevices: responseJSON.exceeded_daily_quota_devices ?? {},\n exceededDailyQuotaUsers: responseJSON.exceeded_daily_quota_users ?? {},\n throttledEvents: responseJSON.throttled_events ?? [],\n },\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode,\n };\n }\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"return-wrapper.d.ts","sourceRoot":"","sources":["../../../src/utils/return-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,eAAO,MAAM,aAAa,uBACH,GAAG,KAAK,GAAG,+EAG9B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
|
+
export var returnWrapper = function (fn) {
|
|
3
|
+
return function () {
|
|
4
|
+
var args = [];
|
|
5
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6
|
+
args[_i] = arguments[_i];
|
|
7
|
+
}
|
|
8
|
+
return ({
|
|
9
|
+
promise: fn.apply(void 0, __spreadArray([], __read(args), false)),
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=return-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"return-wrapper.js","sourceRoot":"","sources":["../../../src/utils/return-wrapper.ts"],"names":[],"mappings":";AAEA,MAAM,CAAC,IAAM,aAAa,GACxB,UAAkC,EAAK;IACvC,OAAA;QAAC,cAAsB;aAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;YAAtB,yBAAsB;;QAA8C,OAAA,CAAC;YACpE,OAAO,EAAE,EAAE,wCAAI,IAAI,UAAkB;SACtC,CAAC;IAFmE,CAEnE;AAFF,CAEE,CAAC","sourcesContent":["import { AmplitudeReturn } from '@amplitude/analytics-types';\n\nexport const returnWrapper =\n <T extends (...args: any) => any>(fn: T) =>\n (...args: Parameters<T>): AmplitudeReturn<Awaited<ReturnType<T>>> => ({\n promise: fn(...args) as ReturnType<T>,\n });\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valid-properties.d.ts","sourceRoot":"","sources":["../../../src/utils/valid-properties.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;MAAyC,OAUlE,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,MAAM,SAAS,GAAG,KAAG,
|
|
1
|
+
{"version":3,"file":"valid-properties.d.ts","sourceRoot":"","sources":["../../../src/utils/valid-properties.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;MAAyC,OAUlE,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,MAAM,SAAS,GAAG,KAAG,OAuBhE,CAAC"}
|