Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amplitude/analytics-core

Package Overview
Dependencies
Maintainers
19
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/analytics-core - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

5

lib/cjs/core-client.d.ts

@@ -9,4 +9,9 @@ import { CoreClient, Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';

protected q: CallableFunction[];
protected pluginQueue: CallableFunction[];
constructor(name?: string);
_init(config: T): Promise<void>;
protected getAndResetQueuedFunctions(): CallableFunction[];
protected runQueuedFunctions(): Promise<void>;
protected getAndResetQueuedPluginFunctions(): CallableFunction[];
protected runQueuedPluginFunctions(): Promise<void>;
track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>;

@@ -13,0 +18,0 @@ logEvent: (eventInput: BaseEvent | string, eventProperties?: Record<string, any> | undefined, eventOptions?: EventOptions | undefined) => Promise<import("@amplitude/analytics-types").Result>;

83

lib/cjs/core-client.js

@@ -13,2 +13,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

this.q = [];
this.pluginQueue = [];
this.logEvent = this.track.bind(this);

@@ -20,2 +21,25 @@ this.timeline = new timeline_1.Timeline();

return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
return (0, tslib_1.__generator)(this, function (_a) {
switch (_a.label) {
case 0:
this.config = config;
this.timeline.reset();
return [4 /*yield*/, this.runQueuedPluginFunctions()];
case 1:
_a.sent();
return [4 /*yield*/, this.runQueuedFunctions()];
case 2:
_a.sent();
return [2 /*return*/];
}
});
});
};
AmplitudeCore.prototype.getAndResetQueuedFunctions = function () {
var queuedFunctions = this.q;
this.q = [];
return queuedFunctions;
};
AmplitudeCore.prototype.runQueuedFunctions = function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;

@@ -26,6 +50,3 @@ var e_1, _a;

case 0:
this.config = config;
this.timeline.reset();
queuedFunctions = this.q;
this.q = [];
queuedFunctions = this.getAndResetQueuedFunctions();
_b.label = 1;

@@ -62,2 +83,46 @@ case 1:

};
AmplitudeCore.prototype.getAndResetQueuedPluginFunctions = function () {
var queuedFunctions = this.pluginQueue;
this.pluginQueue = [];
return queuedFunctions;
};
AmplitudeCore.prototype.runQueuedPluginFunctions = function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var queuedFunctions, queuedFunctions_2, queuedFunctions_2_1, queuedFunction, e_2_1;
var e_2, _a;
return (0, tslib_1.__generator)(this, function (_b) {
switch (_b.label) {
case 0:
queuedFunctions = this.getAndResetQueuedPluginFunctions();
_b.label = 1;
case 1:
_b.trys.push([1, 6, 7, 8]);
queuedFunctions_2 = (0, tslib_1.__values)(queuedFunctions), queuedFunctions_2_1 = queuedFunctions_2.next();
_b.label = 2;
case 2:
if (!!queuedFunctions_2_1.done) return [3 /*break*/, 5];
queuedFunction = queuedFunctions_2_1.value;
return [4 /*yield*/, queuedFunction()];
case 3:
_b.sent();
_b.label = 4;
case 4:
queuedFunctions_2_1 = queuedFunctions_2.next();
return [3 /*break*/, 2];
case 5: return [3 /*break*/, 8];
case 6:
e_2_1 = _b.sent();
e_2 = { error: e_2_1 };
return [3 /*break*/, 8];
case 7:
try {
if (queuedFunctions_2_1 && !queuedFunctions_2_1.done && (_a = queuedFunctions_2.return)) _a.call(queuedFunctions_2);
}
finally { if (e_2) throw e_2.error; }
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
});
});
};
AmplitudeCore.prototype.track = function (eventInput, eventProperties, eventOptions) {

@@ -87,3 +152,3 @@ var event = (0, event_builder_1.createTrackEvent)(eventInput, eventProperties, eventOptions);

if (!this.config) {
this.q.push(this.add.bind(this, plugin));
this.pluginQueue.push(this.add.bind(this, plugin));
return [2 /*return*/];

@@ -99,3 +164,3 @@ }

if (!this.config) {
this.q.push(this.remove.bind(this, pluginName));
this.pluginQueue.push(this.remove.bind(this, pluginName));
return [2 /*return*/];

@@ -110,3 +175,3 @@ }

return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var result, e_2, message;
var result, e_3, message;
return (0, tslib_1.__generator)(this, function (_b) {

@@ -131,4 +196,4 @@ switch (_b.label) {

case 2:
e_2 = _b.sent();
message = String(e_2);
e_3 = _b.sent();
message = String(e_3);
this.config.loggerProvider.error(message);

@@ -135,0 +200,0 @@ return [2 /*return*/, (0, result_builder_1.buildResult)(event, 0, message)];

@@ -9,4 +9,9 @@ import { CoreClient, Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';

protected q: CallableFunction[];
protected pluginQueue: CallableFunction[];
constructor(name?: string);
_init(config: T): Promise<void>;
protected getAndResetQueuedFunctions(): CallableFunction[];
protected runQueuedFunctions(): Promise<void>;
protected getAndResetQueuedPluginFunctions(): CallableFunction[];
protected runQueuedPluginFunctions(): Promise<void>;
track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>;

@@ -13,0 +18,0 @@ logEvent: (eventInput: BaseEvent | string, eventProperties?: Record<string, any> | undefined, eventOptions?: EventOptions | undefined) => Promise<import("@amplitude/analytics-types").Result>;

@@ -11,2 +11,3 @@ import { __awaiter, __generator, __values } from "tslib";

this.q = [];
this.pluginQueue = [];
this.logEvent = this.track.bind(this);

@@ -18,2 +19,25 @@ this.timeline = new Timeline();

return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.config = config;
this.timeline.reset();
return [4 /*yield*/, this.runQueuedPluginFunctions()];
case 1:
_a.sent();
return [4 /*yield*/, this.runQueuedFunctions()];
case 2:
_a.sent();
return [2 /*return*/];
}
});
});
};
AmplitudeCore.prototype.getAndResetQueuedFunctions = function () {
var queuedFunctions = this.q;
this.q = [];
return queuedFunctions;
};
AmplitudeCore.prototype.runQueuedFunctions = function () {
return __awaiter(this, void 0, void 0, function () {
var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;

@@ -24,6 +48,3 @@ var e_1, _a;

case 0:
this.config = config;
this.timeline.reset();
queuedFunctions = this.q;
this.q = [];
queuedFunctions = this.getAndResetQueuedFunctions();
_b.label = 1;

@@ -60,2 +81,46 @@ case 1:

};
AmplitudeCore.prototype.getAndResetQueuedPluginFunctions = function () {
var queuedFunctions = this.pluginQueue;
this.pluginQueue = [];
return queuedFunctions;
};
AmplitudeCore.prototype.runQueuedPluginFunctions = function () {
return __awaiter(this, void 0, void 0, function () {
var queuedFunctions, queuedFunctions_2, queuedFunctions_2_1, queuedFunction, e_2_1;
var e_2, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
queuedFunctions = this.getAndResetQueuedPluginFunctions();
_b.label = 1;
case 1:
_b.trys.push([1, 6, 7, 8]);
queuedFunctions_2 = __values(queuedFunctions), queuedFunctions_2_1 = queuedFunctions_2.next();
_b.label = 2;
case 2:
if (!!queuedFunctions_2_1.done) return [3 /*break*/, 5];
queuedFunction = queuedFunctions_2_1.value;
return [4 /*yield*/, queuedFunction()];
case 3:
_b.sent();
_b.label = 4;
case 4:
queuedFunctions_2_1 = queuedFunctions_2.next();
return [3 /*break*/, 2];
case 5: return [3 /*break*/, 8];
case 6:
e_2_1 = _b.sent();
e_2 = { error: e_2_1 };
return [3 /*break*/, 8];
case 7:
try {
if (queuedFunctions_2_1 && !queuedFunctions_2_1.done && (_a = queuedFunctions_2.return)) _a.call(queuedFunctions_2);
}
finally { if (e_2) throw e_2.error; }
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
});
});
};
AmplitudeCore.prototype.track = function (eventInput, eventProperties, eventOptions) {

@@ -85,3 +150,3 @@ var event = createTrackEvent(eventInput, eventProperties, eventOptions);

if (!this.config) {
this.q.push(this.add.bind(this, plugin));
this.pluginQueue.push(this.add.bind(this, plugin));
return [2 /*return*/];

@@ -97,3 +162,3 @@ }

if (!this.config) {
this.q.push(this.remove.bind(this, pluginName));
this.pluginQueue.push(this.remove.bind(this, pluginName));
return [2 /*return*/];

@@ -108,3 +173,3 @@ }

return __awaiter(this, void 0, void 0, function () {
var result, e_2, message;
var result, e_3, message;
return __generator(this, function (_b) {

@@ -129,4 +194,4 @@ switch (_b.label) {

case 2:
e_2 = _b.sent();
message = String(e_2);
e_3 = _b.sent();
message = String(e_3);
this.config.loggerProvider.error(message);

@@ -133,0 +198,0 @@ return [2 /*return*/, buildResult(event, 0, message)];

4

package.json
{
"name": "@amplitude/analytics-core",
"version": "0.9.5",
"version": "0.9.6",
"description": "",

@@ -43,3 +43,3 @@ "author": "Amplitude Inc",

],
"gitHead": "f556fd2194aebce71de5b2b53c12e611d8c9b5a7"
"gitHead": "e0e8c340cf94fd182cc313a177d4148ed89f4bd5"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc