Socket
Socket
Sign inDemoInstall

@amplitude/analytics-node

Package Overview
Dependencies
Maintainers
19
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/analytics-node - npm Package Compare versions

Comparing version 0.3.7 to 0.4.0

3

lib/cjs/index.d.ts

@@ -1,4 +0,5 @@

export { add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush, } from './node-client';
export { createInstance } from './node-client';
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin) => import("@amplitude/analytics-types").AmplitudeReturn<void>, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, init: (apiKey: string, options?: import("@amplitude/analytics-types").NodeOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<void>, logEvent: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, remove: (pluginName: string) => import("@amplitude/analytics-types").AmplitudeReturn<void>, revenue: (revenue: import("@amplitude/analytics-types").Revenue, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setOptOut: (optOut: boolean) => void, track: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, flush: () => import("@amplitude/analytics-types").AmplitudeReturn<void>;
export { Revenue, Identify } from '@amplitude/analytics-core';
export * as Types from '@amplitude/analytics-types';
//# sourceMappingURL=index.d.ts.map

@@ -0,15 +1,8 @@

/* eslint-disable @typescript-eslint/unbound-method */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Types = exports.Identify = exports.Revenue = exports.flush = exports.track = exports.setOptOut = exports.setGroup = exports.revenue = exports.remove = exports.logEvent = exports.init = exports.identify = exports.groupIdentify = exports.add = void 0;
exports.Types = exports.Identify = exports.Revenue = exports.flush = exports.track = exports.setOptOut = exports.setGroup = exports.revenue = exports.remove = exports.logEvent = exports.init = exports.identify = exports.groupIdentify = exports.add = exports.createInstance = void 0;
var node_client_1 = require("./node-client");
Object.defineProperty(exports, "add", { enumerable: true, get: function () { return node_client_1.add; } });
Object.defineProperty(exports, "groupIdentify", { enumerable: true, get: function () { return node_client_1.groupIdentify; } });
Object.defineProperty(exports, "identify", { enumerable: true, get: function () { return node_client_1.identify; } });
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return node_client_1.init; } });
Object.defineProperty(exports, "logEvent", { enumerable: true, get: function () { return node_client_1.logEvent; } });
Object.defineProperty(exports, "remove", { enumerable: true, get: function () { return node_client_1.remove; } });
Object.defineProperty(exports, "revenue", { enumerable: true, get: function () { return node_client_1.revenue; } });
Object.defineProperty(exports, "setGroup", { enumerable: true, get: function () { return node_client_1.setGroup; } });
Object.defineProperty(exports, "setOptOut", { enumerable: true, get: function () { return node_client_1.setOptOut; } });
Object.defineProperty(exports, "track", { enumerable: true, get: function () { return node_client_1.track; } });
Object.defineProperty(exports, "flush", { enumerable: true, get: function () { return node_client_1.flush; } });
var node_client_2 = require("./node-client");
Object.defineProperty(exports, "createInstance", { enumerable: true, get: function () { return node_client_2.createInstance; } });
exports.add = node_client_1.default.add, exports.groupIdentify = node_client_1.default.groupIdentify, exports.identify = node_client_1.default.identify, exports.init = node_client_1.default.init, exports.logEvent = node_client_1.default.logEvent, exports.remove = node_client_1.default.remove, exports.revenue = node_client_1.default.revenue, exports.setGroup = node_client_1.default.setGroup, exports.setOptOut = node_client_1.default.setOptOut, exports.track = node_client_1.default.track, exports.flush = node_client_1.default.flush;
var analytics_core_1 = require("@amplitude/analytics-core");

@@ -16,0 +9,0 @@ Object.defineProperty(exports, "Revenue", { enumerable: true, get: function () { return analytics_core_1.Revenue; } });

import { AmplitudeCore } from '@amplitude/analytics-core';
import { NodeConfig, NodeOptions } from '@amplitude/analytics-types';
import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';
export declare class AmplitudeNode extends AmplitudeCore<NodeConfig> {
init(apiKey: string, options?: NodeOptions): Promise<void>;
}
/**
* Initializes the Amplitude SDK with your apiKey and optional configurations.
* This method must be called before any other operations.
*
* ```typescript
* await init(API_KEY, USER_ID, options).promise;
* ```
*/
export declare const init: (apiKey: string, options?: NodeOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
/**
* Adds a new plugin.
*
* ```typescript
* const plugin = {...};
* add(plugin);
*
* // alternatively, this tracking method is awaitable
* await add(plugin).promise;
* ```
*/
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
/**
* Removes a plugin.
*
* ```typescript
* remove('myPlugin');
*
* // alternatively, this tracking method is awaitable
* await remove('myPlugin').promise;
* ```
*/
export declare const remove: (pluginName: string) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
/**
* Tracks user-defined event, with specified type, optional event properties and optional overwrites.
*
* ```typescript
* // event tracking with event type only
* track('Page Load');
*
* // event tracking with event type and additional event properties
* track('Page Load', { loadTime: 1000 });
*
* // event tracking with event type, additional event properties, and overwritten event options
* track('Page Load', { loadTime: 1000 }, { sessionId: -1 });
*
* // alternatively, this tracking method is awaitable
* const result = await track('Page Load').promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const track: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Alias for track()
*/
export declare const logEvent: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sends an identify event containing user property operations
*
* ```typescript
* const id = new Identify();
* id.set('colors', ['rose', 'gold']);
* identify(id);
*
* // alternatively, this tracking method is awaitable
* const result = await identify(id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sends a group identify event containing group property operations.
*
* ```typescript
* const id = new Identify();
* id.set('skills', ['js', 'ts']);
* const groupType = 'org';
* const groupName = 'engineering';
* groupIdentify(groupType, groupName, id);
*
* // alternatively, this tracking method is awaitable
* const result = await groupIdentify(groupType, groupName, id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
export declare const setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sends a revenue event containing revenue property operations.
*
* ```typescript
* const rev = new Revenue();
* rev.setRevenue(100);
* revenue(rev);
*
* // alternatively, this tracking method is awaitable
* const result = await revenue(rev).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const revenue: (revenue: import("@amplitude/analytics-types").Revenue, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sets a new optOut config value. This toggles event tracking on/off.
*
*```typescript
* // Stops tracking
* setOptOut(true);
*
* // Starts/resumes tracking
* setOptOut(false);
* ```
*/
export declare const setOptOut: (optOut: boolean) => void;
/**
* Flush and send all the events which haven't been sent.
*
*```typescript
* // Send all the unsent events
* flush();
*
* // alternatively, this tracking method is awaitable
* await flush().promise;
* ```
*/
export declare const flush: () => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
export declare const createInstance: () => NodeClient;
declare const _default: NodeClient;
export default _default;
//# sourceMappingURL=node-client.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.flush = exports.setOptOut = exports.revenue = exports.setGroup = exports.groupIdentify = exports.identify = exports.logEvent = exports.track = exports.remove = exports.add = exports.init = exports.AmplitudeNode = void 0;
exports.createInstance = exports.AmplitudeNode = void 0;
var tslib_1 = require("tslib");

@@ -18,2 +18,7 @@ var analytics_core_1 = require("@amplitude/analytics-core");

case 0:
// Step 0: Block concurrent initialization
if (this.initializing) {
return [2 /*return*/];
}
this.initializing = true;
nodeOptions = (0, config_1.useNodeConfig)(apiKey, (0, tslib_1.__assign)({}, options));

@@ -29,2 +34,3 @@ return [4 /*yield*/, _super.prototype._init.call(this, nodeOptions)];

_a.sent();
this.initializing = false;
// Set timeline ready for processing events

@@ -44,135 +50,20 @@ // Send existing events, which might be collected by track before init

exports.AmplitudeNode = AmplitudeNode;
var client = new AmplitudeNode();
/**
* Initializes the Amplitude SDK with your apiKey and optional configurations.
* This method must be called before any other operations.
*
* ```typescript
* await init(API_KEY, USER_ID, options).promise;
* ```
*/
exports.init = (0, analytics_core_1.returnWrapper)(client.init.bind(client));
/**
* Adds a new plugin.
*
* ```typescript
* const plugin = {...};
* add(plugin);
*
* // alternatively, this tracking method is awaitable
* await add(plugin).promise;
* ```
*/
exports.add = (0, analytics_core_1.returnWrapper)(client.add.bind(client));
/**
* Removes a plugin.
*
* ```typescript
* remove('myPlugin');
*
* // alternatively, this tracking method is awaitable
* await remove('myPlugin').promise;
* ```
*/
exports.remove = (0, analytics_core_1.returnWrapper)(client.remove.bind(client));
/**
* Tracks user-defined event, with specified type, optional event properties and optional overwrites.
*
* ```typescript
* // event tracking with event type only
* track('Page Load');
*
* // event tracking with event type and additional event properties
* track('Page Load', { loadTime: 1000 });
*
* // event tracking with event type, additional event properties, and overwritten event options
* track('Page Load', { loadTime: 1000 }, { sessionId: -1 });
*
* // alternatively, this tracking method is awaitable
* const result = await track('Page Load').promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
exports.track = (0, analytics_core_1.returnWrapper)(client.track.bind(client));
/**
* Alias for track()
*/
exports.logEvent = (0, analytics_core_1.returnWrapper)(client.logEvent.bind(client));
/**
* Sends an identify event containing user property operations
*
* ```typescript
* const id = new Identify();
* id.set('colors', ['rose', 'gold']);
* identify(id);
*
* // alternatively, this tracking method is awaitable
* const result = await identify(id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
exports.identify = (0, analytics_core_1.returnWrapper)(client.identify.bind(client));
/**
* Sends a group identify event containing group property operations.
*
* ```typescript
* const id = new Identify();
* id.set('skills', ['js', 'ts']);
* const groupType = 'org';
* const groupName = 'engineering';
* groupIdentify(groupType, groupName, id);
*
* // alternatively, this tracking method is awaitable
* const result = await groupIdentify(groupType, groupName, id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
exports.groupIdentify = (0, analytics_core_1.returnWrapper)(client.groupIdentify.bind(client));
exports.setGroup = (0, analytics_core_1.returnWrapper)(client.setGroup.bind(client));
/**
* Sends a revenue event containing revenue property operations.
*
* ```typescript
* const rev = new Revenue();
* rev.setRevenue(100);
* revenue(rev);
*
* // alternatively, this tracking method is awaitable
* const result = await revenue(rev).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
exports.revenue = (0, analytics_core_1.returnWrapper)(client.revenue.bind(client));
/**
* Sets a new optOut config value. This toggles event tracking on/off.
*
*```typescript
* // Stops tracking
* setOptOut(true);
*
* // Starts/resumes tracking
* setOptOut(false);
* ```
*/
exports.setOptOut = client.setOptOut.bind(client);
/**
* Flush and send all the events which haven't been sent.
*
*```typescript
* // Send all the unsent events
* flush();
*
* // alternatively, this tracking method is awaitable
* await flush().promise;
* ```
*/
exports.flush = (0, analytics_core_1.returnWrapper)(client.flush.bind(client));
var createInstance = function () {
var client = new AmplitudeNode();
return {
init: (0, analytics_core_1.returnWrapper)(client.init.bind(client)),
add: (0, analytics_core_1.returnWrapper)(client.add.bind(client)),
remove: (0, analytics_core_1.returnWrapper)(client.remove.bind(client)),
track: (0, analytics_core_1.returnWrapper)(client.track.bind(client)),
logEvent: (0, analytics_core_1.returnWrapper)(client.logEvent.bind(client)),
identify: (0, analytics_core_1.returnWrapper)(client.identify.bind(client)),
groupIdentify: (0, analytics_core_1.returnWrapper)(client.groupIdentify.bind(client)),
setGroup: (0, analytics_core_1.returnWrapper)(client.setGroup.bind(client)),
revenue: (0, analytics_core_1.returnWrapper)(client.revenue.bind(client)),
flush: (0, analytics_core_1.returnWrapper)(client.flush.bind(client)),
setOptOut: client.setOptOut.bind(client),
};
};
exports.createInstance = createInstance;
exports.default = (0, exports.createInstance)();
//# sourceMappingURL=node-client.js.map

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

export declare const VERSION = "0.3.7";
export declare const VERSION = "0.4.0";
//# sourceMappingURL=version.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '0.3.7';
exports.VERSION = '0.4.0';
//# sourceMappingURL=version.js.map

@@ -1,4 +0,5 @@

export { add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush, } from './node-client';
export { createInstance } from './node-client';
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin) => import("@amplitude/analytics-types").AmplitudeReturn<void>, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, init: (apiKey: string, options?: import("@amplitude/analytics-types").NodeOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<void>, logEvent: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, remove: (pluginName: string) => import("@amplitude/analytics-types").AmplitudeReturn<void>, revenue: (revenue: import("@amplitude/analytics-types").Revenue, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, setOptOut: (optOut: boolean) => void, track: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>, flush: () => import("@amplitude/analytics-types").AmplitudeReturn<void>;
export { Revenue, Identify } from '@amplitude/analytics-core';
export * as Types from '@amplitude/analytics-types';
//# sourceMappingURL=index.d.ts.map

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

export { add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush, } from './node-client';
/* eslint-disable @typescript-eslint/unbound-method */
import client from './node-client';
export { createInstance } from './node-client';
export var add = client.add, groupIdentify = client.groupIdentify, identify = client.identify, init = client.init, logEvent = client.logEvent, remove = client.remove, revenue = client.revenue, setGroup = client.setGroup, setOptOut = client.setOptOut, track = client.track, flush = client.flush;
export { Revenue, Identify } from '@amplitude/analytics-core';

@@ -3,0 +6,0 @@ import * as Types_1 from '@amplitude/analytics-types';

import { AmplitudeCore } from '@amplitude/analytics-core';
import { NodeConfig, NodeOptions } from '@amplitude/analytics-types';
import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';
export declare class AmplitudeNode extends AmplitudeCore<NodeConfig> {
init(apiKey: string, options?: NodeOptions): Promise<void>;
}
/**
* Initializes the Amplitude SDK with your apiKey and optional configurations.
* This method must be called before any other operations.
*
* ```typescript
* await init(API_KEY, USER_ID, options).promise;
* ```
*/
export declare const init: (apiKey: string, options?: NodeOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
/**
* Adds a new plugin.
*
* ```typescript
* const plugin = {...};
* add(plugin);
*
* // alternatively, this tracking method is awaitable
* await add(plugin).promise;
* ```
*/
export declare const add: (plugin: import("@amplitude/analytics-types").Plugin) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
/**
* Removes a plugin.
*
* ```typescript
* remove('myPlugin');
*
* // alternatively, this tracking method is awaitable
* await remove('myPlugin').promise;
* ```
*/
export declare const remove: (pluginName: string) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
/**
* Tracks user-defined event, with specified type, optional event properties and optional overwrites.
*
* ```typescript
* // event tracking with event type only
* track('Page Load');
*
* // event tracking with event type and additional event properties
* track('Page Load', { loadTime: 1000 });
*
* // event tracking with event type, additional event properties, and overwritten event options
* track('Page Load', { loadTime: 1000 }, { sessionId: -1 });
*
* // alternatively, this tracking method is awaitable
* const result = await track('Page Load').promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const track: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Alias for track()
*/
export declare const logEvent: (eventInput: string | import("@amplitude/analytics-types").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sends an identify event containing user property operations
*
* ```typescript
* const id = new Identify();
* id.set('colors', ['rose', 'gold']);
* identify(id);
*
* // alternatively, this tracking method is awaitable
* const result = await identify(id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const identify: (identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sends a group identify event containing group property operations.
*
* ```typescript
* const id = new Identify();
* id.set('skills', ['js', 'ts']);
* const groupType = 'org';
* const groupName = 'engineering';
* groupIdentify(groupType, groupName, id);
*
* // alternatively, this tracking method is awaitable
* const result = await groupIdentify(groupType, groupName, id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-types").Identify, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
export declare const setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sends a revenue event containing revenue property operations.
*
* ```typescript
* const rev = new Revenue();
* rev.setRevenue(100);
* revenue(rev);
*
* // alternatively, this tracking method is awaitable
* const result = await revenue(rev).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export declare const revenue: (revenue: import("@amplitude/analytics-types").Revenue, eventOptions?: import("@amplitude/analytics-types").EventOptions | undefined) => import("@amplitude/analytics-types").AmplitudeReturn<Promise<import("@amplitude/analytics-types").Result>>;
/**
* Sets a new optOut config value. This toggles event tracking on/off.
*
*```typescript
* // Stops tracking
* setOptOut(true);
*
* // Starts/resumes tracking
* setOptOut(false);
* ```
*/
export declare const setOptOut: (optOut: boolean) => void;
/**
* Flush and send all the events which haven't been sent.
*
*```typescript
* // Send all the unsent events
* flush();
*
* // alternatively, this tracking method is awaitable
* await flush().promise;
* ```
*/
export declare const flush: () => import("@amplitude/analytics-types").AmplitudeReturn<Promise<void>>;
export declare const createInstance: () => NodeClient;
declare const _default: NodeClient;
export default _default;
//# sourceMappingURL=node-client.d.ts.map

@@ -16,2 +16,7 @@ import { __assign, __awaiter, __extends, __generator } from "tslib";

case 0:
// Step 0: Block concurrent initialization
if (this.initializing) {
return [2 /*return*/];
}
this.initializing = true;
nodeOptions = useNodeConfig(apiKey, __assign({}, options));

@@ -27,2 +32,3 @@ return [4 /*yield*/, _super.prototype._init.call(this, nodeOptions)];

_a.sent();
this.initializing = false;
// Set timeline ready for processing events

@@ -42,135 +48,19 @@ // Send existing events, which might be collected by track before init

export { AmplitudeNode };
var client = new AmplitudeNode();
/**
* Initializes the Amplitude SDK with your apiKey and optional configurations.
* This method must be called before any other operations.
*
* ```typescript
* await init(API_KEY, USER_ID, options).promise;
* ```
*/
export var init = returnWrapper(client.init.bind(client));
/**
* Adds a new plugin.
*
* ```typescript
* const plugin = {...};
* add(plugin);
*
* // alternatively, this tracking method is awaitable
* await add(plugin).promise;
* ```
*/
export var add = returnWrapper(client.add.bind(client));
/**
* Removes a plugin.
*
* ```typescript
* remove('myPlugin');
*
* // alternatively, this tracking method is awaitable
* await remove('myPlugin').promise;
* ```
*/
export var remove = returnWrapper(client.remove.bind(client));
/**
* Tracks user-defined event, with specified type, optional event properties and optional overwrites.
*
* ```typescript
* // event tracking with event type only
* track('Page Load');
*
* // event tracking with event type and additional event properties
* track('Page Load', { loadTime: 1000 });
*
* // event tracking with event type, additional event properties, and overwritten event options
* track('Page Load', { loadTime: 1000 }, { sessionId: -1 });
*
* // alternatively, this tracking method is awaitable
* const result = await track('Page Load').promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export var track = returnWrapper(client.track.bind(client));
/**
* Alias for track()
*/
export var logEvent = returnWrapper(client.logEvent.bind(client));
/**
* Sends an identify event containing user property operations
*
* ```typescript
* const id = new Identify();
* id.set('colors', ['rose', 'gold']);
* identify(id);
*
* // alternatively, this tracking method is awaitable
* const result = await identify(id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export var identify = returnWrapper(client.identify.bind(client));
/**
* Sends a group identify event containing group property operations.
*
* ```typescript
* const id = new Identify();
* id.set('skills', ['js', 'ts']);
* const groupType = 'org';
* const groupName = 'engineering';
* groupIdentify(groupType, groupName, id);
*
* // alternatively, this tracking method is awaitable
* const result = await groupIdentify(groupType, groupName, id).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export var groupIdentify = returnWrapper(client.groupIdentify.bind(client));
export var setGroup = returnWrapper(client.setGroup.bind(client));
/**
* Sends a revenue event containing revenue property operations.
*
* ```typescript
* const rev = new Revenue();
* rev.setRevenue(100);
* revenue(rev);
*
* // alternatively, this tracking method is awaitable
* const result = await revenue(rev).promise;
* console.log(result.event); // {...}
* console.log(result.code); // 200
* console.log(result.message); // "Event tracked successfully"
* ```
*/
export var revenue = returnWrapper(client.revenue.bind(client));
/**
* Sets a new optOut config value. This toggles event tracking on/off.
*
*```typescript
* // Stops tracking
* setOptOut(true);
*
* // Starts/resumes tracking
* setOptOut(false);
* ```
*/
export var setOptOut = client.setOptOut.bind(client);
/**
* Flush and send all the events which haven't been sent.
*
*```typescript
* // Send all the unsent events
* flush();
*
* // alternatively, this tracking method is awaitable
* await flush().promise;
* ```
*/
export var flush = returnWrapper(client.flush.bind(client));
export var createInstance = function () {
var client = new AmplitudeNode();
return {
init: returnWrapper(client.init.bind(client)),
add: returnWrapper(client.add.bind(client)),
remove: returnWrapper(client.remove.bind(client)),
track: returnWrapper(client.track.bind(client)),
logEvent: returnWrapper(client.logEvent.bind(client)),
identify: returnWrapper(client.identify.bind(client)),
groupIdentify: returnWrapper(client.groupIdentify.bind(client)),
setGroup: returnWrapper(client.setGroup.bind(client)),
revenue: returnWrapper(client.revenue.bind(client)),
flush: returnWrapper(client.flush.bind(client)),
setOptOut: client.setOptOut.bind(client),
};
};
export default createInstance();
//# sourceMappingURL=node-client.js.map

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

export declare const VERSION = "0.3.7";
export declare const VERSION = "0.4.0";
//# sourceMappingURL=version.d.ts.map

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

export var VERSION = '0.3.7';
export var VERSION = '0.4.0';
//# sourceMappingURL=version.js.map
{
"name": "@amplitude/analytics-node",
"version": "0.3.7",
"version": "0.4.0",
"description": "Official Amplitude SDK for NodeJS",

@@ -38,4 +38,4 @@ "author": "Amplitude Inc",

"dependencies": {
"@amplitude/analytics-core": "^0.7.0",
"@amplitude/analytics-types": "^0.7.0",
"@amplitude/analytics-core": "^0.8.0",
"@amplitude/analytics-types": "^0.8.0",
"tslib": "^2.3.1"

@@ -46,3 +46,3 @@ },

],
"gitHead": "d71a39cd63930ee604f0df293767692c09ab54f5"
"gitHead": "c701a2b7ada6c8817bf28894f4d68cfa5dd0c403"
}

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