Socket
Socket
Sign inDemoInstall

@amplitude/analytics-core

Package Overview
Dependencies
Maintainers
19
Versions
94
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.3.1 to 0.4.0

lib/cjs/event-bridge/event-bridge-channel.d.ts

8

lib/cjs/config.d.ts

@@ -1,2 +0,2 @@

import { Event, Config as IConfig, Logger as ILogger, InitOptions, LogLevel, Storage, Transport, Plugin, ServerZone } from '@amplitude/analytics-types';
import { Event, Config as IConfig, Logger as ILogger, InitOptions, LogLevel, Storage, Transport, Plan, Plugin, ServerZone } from '@amplitude/analytics-types';
import { Logger } from './logger';

@@ -18,6 +18,2 @@ export declare const getDefaultConfig: () => {

apiKey: string;
appVersion?: string;
userId?: string;
deviceId?: string;
sessionId?: number;
flushIntervalMillis: number;

@@ -29,3 +25,3 @@ flushMaxRetries: number;

minIdLength?: number;
partnerId?: string;
plan?: Plan;
plugins: Plugin[];

@@ -32,0 +28,0 @@ optOut: boolean;

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

this.apiKey = options.apiKey;
this.appVersion = options.appVersion;
this.userId = options.userId;
this.deviceId = options.deviceId;
this.sessionId = options.sessionId;
this.flushIntervalMillis = options.flushIntervalMillis || defaultConfig.flushIntervalMillis;

@@ -36,3 +32,3 @@ this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;

this.minIdLength = options.minIdLength;
this.partnerId = options.partnerId;
this.plan = options.plan;
this.plugins = defaultConfig.plugins;

@@ -39,0 +35,0 @@ this.optOut = (_b = options.optOut) !== null && _b !== void 0 ? _b : defaultConfig.optOut;

@@ -1,3 +0,3 @@

import { Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';
export declare class AmplitudeCore<T extends Config> {
import { CoreClient, Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';
export declare class AmplitudeCore<T extends Config> implements CoreClient<T> {
name: string;

@@ -17,3 +17,4 @@ config: T;

setOptOut(optOut: boolean): void;
flush(): Promise<void>;
}
//# sourceMappingURL=core-client.d.ts.map

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

};
AmplitudeCore.prototype.flush = function () {
var config = this.config;
return (0, timeline_1.flush)(config);
};
return AmplitudeCore;

@@ -89,0 +93,0 @@ }());

@@ -9,3 +9,5 @@ export { AmplitudeCore } from './core-client';

export { returnWrapper } from './utils/return-wrapper';
export { UUID } from './utils/uuid';
export { MemoryStorage } from './storage/memory';
export { BaseTransport } from './transports/base';
//# sourceMappingURL=index.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseTransport = exports.returnWrapper = exports.AMPLITUDE_PREFIX = exports.Logger = exports.Config = exports.Destination = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0;
exports.BaseTransport = exports.MemoryStorage = exports.UUID = exports.returnWrapper = exports.AMPLITUDE_PREFIX = exports.Logger = exports.Config = exports.Destination = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0;
var core_client_1 = require("./core-client");

@@ -19,4 +19,8 @@ Object.defineProperty(exports, "AmplitudeCore", { enumerable: true, get: function () { return core_client_1.AmplitudeCore; } });

Object.defineProperty(exports, "returnWrapper", { enumerable: true, get: function () { return return_wrapper_1.returnWrapper; } });
var uuid_1 = require("./utils/uuid");
Object.defineProperty(exports, "UUID", { enumerable: true, get: function () { return uuid_1.UUID; } });
var memory_1 = require("./storage/memory");
Object.defineProperty(exports, "MemoryStorage", { enumerable: true, get: function () { return memory_1.MemoryStorage; } });
var base_1 = require("./transports/base");
Object.defineProperty(exports, "BaseTransport", { enumerable: true, get: function () { return base_1.BaseTransport; } });
//# sourceMappingURL=index.js.map

@@ -12,2 +12,3 @@ import { Config, DestinationContext as Context, DestinationPlugin, Event, InvalidResponse, PayloadTooLargeResponse, PluginType, RateLimitResponse, Response, Result, SuccessResponse } from '@amplitude/analytics-types';

queue: Context[];
queueBuffer: Set<Context>;
setup(config: Config): Promise<undefined>;

@@ -17,3 +18,3 @@ execute(event: Event): Promise<Result>;

schedule(timeout: number): void;
flush(): Promise<void>;
flush(includeQueueBuffer?: boolean): Promise<void>;
send(list: Context[]): Promise<void>;

@@ -20,0 +21,0 @@ handleReponse(res: Response, list: Context[]): void;

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

this.queue = [];
this.queueBuffer = new Set();
}

@@ -68,5 +69,9 @@ Destination.prototype.setup = function (config) {

}
_this.queueBuffer.add(context);
setTimeout(function () {
_this.queue = _this.queue.concat(context);
_this.schedule(_this.config.flushIntervalMillis);
if (_this.queueBuffer.has(context)) {
_this.queueBuffer.delete(context);
_this.queue = _this.queue.concat(context);
_this.schedule(_this.config.flushIntervalMillis);
}
}, delay || context.attempts * _this.backoff);

@@ -89,3 +94,4 @@ });

};
Destination.prototype.flush = function () {
Destination.prototype.flush = function (includeQueueBuffer) {
if (includeQueueBuffer === void 0) { includeQueueBuffer = false; }
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {

@@ -99,2 +105,6 @@ var list, batches;

this.queue = [];
if (includeQueueBuffer) {
list.push.apply(list, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(this.queueBuffer.values()), false));
this.queueBuffer.clear();
}
batches = (0, chunk_1.chunk)(list, this.config.flushQueueSize);

@@ -101,0 +111,0 @@ return [4 /*yield*/, Promise.all(batches.map(function (batch) { return _this.send(batch); }))];

@@ -8,2 +8,3 @@ import { Config, Event, EventCallback, Plugin, Result } from '@amplitude/analytics-types';

export declare const apply: () => Promise<void>;
export declare const flush: (config: Config) => Promise<void>;
//# sourceMappingURL=timeline.d.ts.map
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
exports.apply = exports.scheduleApply = exports.push = exports.deregister = exports.register = exports.queue = void 0;
exports.flush = exports.apply = exports.scheduleApply = exports.push = exports.deregister = exports.register = exports.queue = void 0;
var tslib_1 = require("tslib");

@@ -134,2 +134,17 @@ var analytics_types_1 = require("@amplitude/analytics-types");

exports.apply = apply;
var flush = function (config) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
var destination, flushDestinations;
return (0, tslib_1.__generator)(this, function (_a) {
switch (_a.label) {
case 0:
destination = config.plugins.filter(function (plugin) { return plugin.type === analytics_types_1.PluginType.DESTINATION; });
flushDestinations = destination.map(function (plugin) { return plugin.flush && plugin.flush(true); });
return [4 /*yield*/, Promise.all(flushDestinations)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); };
exports.flush = flush;
//# sourceMappingURL=timeline.js.map

@@ -1,2 +0,2 @@

import { Event, Config as IConfig, Logger as ILogger, InitOptions, LogLevel, Storage, Transport, Plugin, ServerZone } from '@amplitude/analytics-types';
import { Event, Config as IConfig, Logger as ILogger, InitOptions, LogLevel, Storage, Transport, Plan, Plugin, ServerZone } from '@amplitude/analytics-types';
import { Logger } from './logger';

@@ -18,6 +18,2 @@ export declare const getDefaultConfig: () => {

apiKey: string;
appVersion?: string;
userId?: string;
deviceId?: string;
sessionId?: number;
flushIntervalMillis: number;

@@ -29,3 +25,3 @@ flushMaxRetries: number;

minIdLength?: number;
partnerId?: string;
plan?: Plan;
plugins: Plugin[];

@@ -32,0 +28,0 @@ optOut: boolean;

@@ -22,6 +22,2 @@ import { LogLevel, ServerZone, } from '@amplitude/analytics-types';

this.apiKey = options.apiKey;
this.appVersion = options.appVersion;
this.userId = options.userId;
this.deviceId = options.deviceId;
this.sessionId = options.sessionId;
this.flushIntervalMillis = options.flushIntervalMillis || defaultConfig.flushIntervalMillis;

@@ -33,3 +29,3 @@ this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;

this.minIdLength = options.minIdLength;
this.partnerId = options.partnerId;
this.plan = options.plan;
this.plugins = defaultConfig.plugins;

@@ -36,0 +32,0 @@ this.optOut = (_b = options.optOut) !== null && _b !== void 0 ? _b : defaultConfig.optOut;

@@ -1,3 +0,3 @@

import { Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';
export declare class AmplitudeCore<T extends Config> {
import { CoreClient, Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types';
export declare class AmplitudeCore<T extends Config> implements CoreClient<T> {
name: string;

@@ -17,3 +17,4 @@ config: T;

setOptOut(optOut: boolean): void;
flush(): Promise<void>;
}
//# sourceMappingURL=core-client.d.ts.map
import { __awaiter, __generator } from "tslib";
import { createGroupIdentifyEvent, createIdentifyEvent, createTrackEvent, createRevenueEvent, createGroupEvent, } from './utils/event-builder';
import { deregister, push, register } from './timeline';
import { deregister, flush, push, register } from './timeline';
import { buildResult } from './utils/result-builder';

@@ -85,2 +85,6 @@ var AmplitudeCore = /** @class */ (function () {

};
AmplitudeCore.prototype.flush = function () {
var config = this.config;
return flush(config);
};
return AmplitudeCore;

@@ -87,0 +91,0 @@ }());

@@ -9,3 +9,5 @@ export { AmplitudeCore } from './core-client';

export { returnWrapper } from './utils/return-wrapper';
export { UUID } from './utils/uuid';
export { MemoryStorage } from './storage/memory';
export { BaseTransport } from './transports/base';
//# sourceMappingURL=index.d.ts.map

@@ -9,3 +9,5 @@ export { AmplitudeCore } from './core-client';

export { returnWrapper } from './utils/return-wrapper';
export { UUID } from './utils/uuid';
export { MemoryStorage } from './storage/memory';
export { BaseTransport } from './transports/base';
//# sourceMappingURL=index.js.map

@@ -12,2 +12,3 @@ import { Config, DestinationContext as Context, DestinationPlugin, Event, InvalidResponse, PayloadTooLargeResponse, PluginType, RateLimitResponse, Response, Result, SuccessResponse } from '@amplitude/analytics-types';

queue: Context[];
queueBuffer: Set<Context>;
setup(config: Config): Promise<undefined>;

@@ -17,3 +18,3 @@ execute(event: Event): Promise<Result>;

schedule(timeout: number): void;
flush(): Promise<void>;
flush(includeQueueBuffer?: boolean): Promise<void>;
send(list: Context[]): Promise<void>;

@@ -20,0 +21,0 @@ handleReponse(res: Response, list: Context[]): void;

@@ -18,2 +18,3 @@ import { __awaiter, __generator, __read, __spreadArray } from "tslib";

this.queue = [];
this.queueBuffer = new Set();
}

@@ -66,5 +67,9 @@ Destination.prototype.setup = function (config) {

}
_this.queueBuffer.add(context);
setTimeout(function () {
_this.queue = _this.queue.concat(context);
_this.schedule(_this.config.flushIntervalMillis);
if (_this.queueBuffer.has(context)) {
_this.queueBuffer.delete(context);
_this.queue = _this.queue.concat(context);
_this.schedule(_this.config.flushIntervalMillis);
}
}, delay || context.attempts * _this.backoff);

@@ -87,3 +92,4 @@ });

};
Destination.prototype.flush = function () {
Destination.prototype.flush = function (includeQueueBuffer) {
if (includeQueueBuffer === void 0) { includeQueueBuffer = false; }
return __awaiter(this, void 0, void 0, function () {

@@ -97,2 +103,6 @@ var list, batches;

this.queue = [];
if (includeQueueBuffer) {
list.push.apply(list, __spreadArray([], __read(this.queueBuffer.values()), false));
this.queueBuffer.clear();
}
batches = chunk(list, this.config.flushQueueSize);

@@ -99,0 +109,0 @@ return [4 /*yield*/, Promise.all(batches.map(function (batch) { return _this.send(batch); }))];

@@ -8,2 +8,3 @@ import { Config, Event, EventCallback, Plugin, Result } from '@amplitude/analytics-types';

export declare const apply: () => Promise<void>;
export declare const flush: (config: Config) => Promise<void>;
//# sourceMappingURL=timeline.d.ts.map

@@ -126,2 +126,16 @@ import { __assign, __awaiter, __generator, __read, __values } from "tslib";

}); };
export var flush = function (config) { return __awaiter(void 0, void 0, void 0, function () {
var destination, flushDestinations;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
destination = config.plugins.filter(function (plugin) { return plugin.type === PluginType.DESTINATION; });
flushDestinations = destination.map(function (plugin) { return plugin.flush && plugin.flush(true); });
return [4 /*yield*/, Promise.all(flushDestinations)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); };
//# sourceMappingURL=timeline.js.map
{
"name": "@amplitude/analytics-core",
"version": "0.3.1",
"version": "0.4.0",
"description": "",

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

"dependencies": {
"@amplitude/analytics-types": "^0.2.1",
"@amplitude/analytics-types": "^0.3.0",
"tslib": "^2.3.1"

@@ -42,3 +42,3 @@ },

],
"gitHead": "d7589883b3d0e09be9b827a87bb6d2f4bee3a643"
"gitHead": "b76a2494587c6a27e2007047c1602269ed2b3403"
}

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

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

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

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

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