Initial commit with Advoware proxy

This commit is contained in:
root
2025-10-19 14:57:07 +00:00
commit 273aa8b549
45771 changed files with 5534555 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Amplitude Analytics
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,164 @@
<p align="center">
<a href="https://amplitude.com" target="_blank" align="center">
<img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
</a>
<br />
</p>
# @amplitude/analytics-node
Official Amplitude SDK for Node.js
# Doc
See our [Typescript Analytics Node SDK](https://amplitude.github.io/Amplitude-TypeScript/modules/_amplitude_analytics_node.html) Reference for a list and description of all available SDK methods.
# Installation and Quick Start
Please visit our :100:[Developer Center](https://www.docs.developers.amplitude.com/data/sdks/typescript-node/) for instructions on installing and using our the SDK.
## Installation
To get started with using Amplitude Node.js SDK, install the package to your project via NPM.
### Using Node package
This package is published on NPM registry and is available to be installed using npm and yarn.
```sh
# npm
npm install @amplitude/analytics-node@^1.0.0
# yarn
yarn add @amplitude/analytics-node@^1.0.0
```
## Usage
### Initializing SDK
Initialization is necessary before any instrumentation is done. The API key for your Amplitude project is required.
```typescript
amplitude.init(API_KEY);
```
### Tracking an Event
Events represent how users interact with your application. For example, "Button Clicked" may be an action you want to note.
```typescript
import { track } from '@amplitude/analytics-node';
// Track a basic event
track('Button Clicked', undefined, {
user_id: 'user@amplitude.com',
});
// Track events with additional properties
const eventProperties = {
selectedColors: ['red', 'blue'],
};
track('Button Clicked', eventProperties, {
user_id: 'user@amplitude.com',
});
```
### User Properties
User properties help you understand your users at the time they performed some action within your app such as their device details, their preferences, or language.
```typescript
import { Identify, identify } from '@amplitude/analytics-node';
const event = new Identify();
// sets the value of a user property
event.set('key1', 'value1');
// sets the value of a user property only once
event.setOnce('key1', 'value1');
// increments a user property by some numerical value.
event.add('value1', 10);
// pre inserts a value or values to a user property
event.preInsert('ab-tests', 'new-user-test');
// post inserts a value or values to a user property
event.postInsert('ab-tests', 'new-user-test');
// removes a value or values to a user property
event.remove('ab-tests', 'new-user-test')
// sends identify event
identify(event);
```
### prepend/append
* append will append a value or values to a user property array.
* prepend will prepend a value or values to a user property.
### User Groups
```typescript
import { setGroup } from '@amplitude/analytics-node';
// set group with single group name
setGroup('orgId', '15');
// set group with multiple group names
setGroup('sport', ['soccer', 'tennis']);
```
### Group Identify
This feature is only available to Growth and Enterprise customers who have purchased the [Accounts add-on](https://amplitude.zendesk.com/hc/en-us/articles/115001765532).
Use the Group Identify API to set or update properties of particular groups. However, these updates will only affect events going forward.
```typescript
import { Identify, groupIdentify } from '@amplitude/analytics-node';
const groupType = 'plan';
const groupName = 'enterprise';
const identity = new Identify()
identity.set('key1', 'value1');
groupIdentify(groupType, groupName, identity);
```
### Track Revenue
Revenue instances will store each revenue transaction and allow you to define several special revenue properties (such as 'revenueType', 'productIdentifier', etc.) that are used in Amplitude's Event Segmentation and Revenue LTV charts. These Revenue instance objects are then passed into `revenue` to send as revenue events to Amplitude. This allows us to automatically display data relevant to revenue in the platform. You can use this to track both in-app and non-in-app purchases.
```typescript
import { Revenue, revenue } from '@amplitude/analytics-node';
const event = new Revenue()
.setProductId('com.company.productId')
.setPrice(3.99)
.setQuantity(3);
revenue(event);
```
### Callback
All asynchronous API are optionally awaitable through a specific Promise interface. This also serves as callback interface.
```typescript
// Using async/await
const results = await track('Button Clicked').promise;
result.event; // {...} (The final event object sent to Amplitude)
result.code; // 200 (The HTTP response status code of the request.
result.message; // "Event tracked successfully" (The response message)
// Using promises
track('Button Clicked').promise.then((result) => {
result.event; // {...} (The final event object sent to Amplitude)
result.code; // 200 (The HTTP response status code of the request.
result.message; // "Event tracked successfully" (The response message)
});
```

View File

@@ -0,0 +1,6 @@
import { Config, NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-core';
export declare class NodeConfig extends Config implements INodeConfig {
constructor(apiKey: string, options?: NodeOptions);
}
export declare const useNodeConfig: (apiKey: string, overrides?: NodeOptions) => INodeConfig;
//# sourceMappingURL=config.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG3F,qBAAa,UAAW,SAAQ,MAAO,YAAW,WAAW;gBAC/C,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW;CAOlD;AAED,eAAO,MAAM,aAAa,WAAY,MAAM,cAAc,WAAW,KAAG,WAEvE,CAAC"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useNodeConfig = exports.NodeConfig = void 0;
var tslib_1 = require("tslib");
var analytics_core_1 = require("@amplitude/analytics-core");
var http_1 = require("./transports/http");
var NodeConfig = /** @class */ (function (_super) {
tslib_1.__extends(NodeConfig, _super);
function NodeConfig(apiKey, options) {
return _super.call(this, tslib_1.__assign(tslib_1.__assign({ transportProvider: new http_1.Http() }, options), { apiKey: apiKey })) || this;
}
return NodeConfig;
}(analytics_core_1.Config));
exports.NodeConfig = NodeConfig;
var useNodeConfig = function (apiKey, overrides) {
return new NodeConfig(apiKey, overrides);
};
exports.useNodeConfig = useNodeConfig;
//# sourceMappingURL=config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;AAAA,4DAA2F;AAC3F,0CAAyC;AAEzC;IAAgC,sCAAM;IACpC,oBAAY,MAAc,EAAE,OAAqB;eAC/C,sDACE,iBAAiB,EAAE,IAAI,WAAI,EAAE,IAC1B,OAAO,KACV,MAAM,QAAA,IACN;IACJ,CAAC;IACH,iBAAC;AAAD,CAAC,AARD,CAAgC,uBAAM,GAQrC;AARY,gCAAU;AAUhB,IAAM,aAAa,GAAG,UAAC,MAAc,EAAE,SAAuB;IACnE,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB","sourcesContent":["import { Config, NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-core';\nimport { Http } from './transports/http';\n\nexport class NodeConfig extends Config implements INodeConfig {\n constructor(apiKey: string, options?: NodeOptions) {\n super({\n transportProvider: new Http(),\n ...options,\n apiKey,\n });\n }\n}\n\nexport const useNodeConfig = (apiKey: string, overrides?: NodeOptions): INodeConfig => {\n return new NodeConfig(apiKey, overrides);\n};\n"]}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,eAAO,MAAQ,GAAG,kNAAE,aAAa,8RAAE,QAAQ,6OAAE,IAAI,wJAAE,QAAQ,2SAAE,MAAM,qFAAE,OAAO,2OAAE,QAAQ,qOAAE,SAAS,6BAAE,KAAK,2SAAE,KAAK,iEACvG,CAAC;AACT,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAI9D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}

View File

@@ -0,0 +1,16 @@
"use strict";
/* 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 = exports.createInstance = void 0;
var tslib_1 = require("tslib");
var node_client_1 = tslib_1.__importDefault(require("./node-client"));
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");
Object.defineProperty(exports, "Revenue", { enumerable: true, get: function () { return analytics_core_1.Revenue; } });
Object.defineProperty(exports, "Identify", { enumerable: true, get: function () { return analytics_core_1.Identify; } });
// Export types to maintain backward compatibility with `analytics-types`.
// In the next major version, only export customer-facing types to reduce the public API surface.
exports.Types = tslib_1.__importStar(require("./types"));
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;;;;AAEtD,sEAAmC;AACnC,6CAA+C;AAAtC,6GAAA,cAAc,OAAA;AACR,QAAA,GAAG,GAChB,qBAAM,MADY,QAAA,aAAa,GAC/B,qBAAM,gBAD2B,QAAA,QAAQ,GACzC,qBAAM,WADqC,QAAA,IAAI,GAC/C,qBAAM,OAD2C,QAAA,QAAQ,GACzD,qBAAM,WADqD,QAAA,MAAM,GACjE,qBAAM,SAD6D,QAAA,OAAO,GAC1E,qBAAM,UADsE,QAAA,QAAQ,GACpF,qBAAM,WADgF,QAAA,SAAS,GAC/F,qBAAM,YAD2F,QAAA,KAAK,GACtG,qBAAM,QADkG,QAAA,KAAK,GAC7G,qBAAM,OAAC;AACT,4DAA8D;AAArD,yGAAA,OAAO,OAAA;AAAE,0GAAA,QAAQ,OAAA;AAE1B,0EAA0E;AAC1E,iGAAiG;AACjG,yDAAiC","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\n\nimport client from './node-client';\nexport { createInstance } from './node-client';\nexport const { add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush } =\n client;\nexport { Revenue, Identify } from '@amplitude/analytics-core';\n\n// Export types to maintain backward compatibility with `analytics-types`.\n// In the next major version, only export customer-facing types to reduce the public API surface.\nexport * as Types from './types';\n"]}

View File

@@ -0,0 +1,12 @@
import { AmplitudeCore, NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-core';
export declare class AmplitudeNode extends AmplitudeCore {
config: NodeConfig;
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
protected _init(options: NodeOptions & {
apiKey: string;
}): Promise<void>;
}
export declare const createInstance: () => NodeClient;
declare const _default: NodeClient;
export default _default;
//# sourceMappingURL=node-client.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAMb,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAInC,qBAAa,aAAc,SAAQ,aAAa;IAG9C,MAAM,EAAE,UAAU,CAAC;IAEnB,IAAI,CAAC,MAAM,SAAK,EAAE,OAAO,CAAC,EAAE,WAAW;cAGvB,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;CAoBhE;AAED,eAAO,MAAM,cAAc,QAAO,UAsEjC,CAAC;;AAEF,wBAAgC"}

View File

@@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createInstance = exports.AmplitudeNode = void 0;
var tslib_1 = require("tslib");
var analytics_core_1 = require("@amplitude/analytics-core");
var context_1 = require("./plugins/context");
var config_1 = require("./config");
var AmplitudeNode = /** @class */ (function (_super) {
tslib_1.__extends(AmplitudeNode, _super);
function AmplitudeNode() {
return _super !== null && _super.apply(this, arguments) || this;
}
AmplitudeNode.prototype.init = function (apiKey, options) {
if (apiKey === void 0) { apiKey = ''; }
return (0, analytics_core_1.returnWrapper)(this._init(tslib_1.__assign(tslib_1.__assign({}, options), { apiKey: apiKey })));
};
AmplitudeNode.prototype._init = function (options) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var nodeOptions;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
// Step 0: Block concurrent initialization
if (this.initializing) {
return [2 /*return*/];
}
this.initializing = true;
nodeOptions = (0, config_1.useNodeConfig)(options.apiKey, tslib_1.__assign({}, options));
return [4 /*yield*/, _super.prototype._init.call(this, nodeOptions)];
case 1:
_a.sent();
return [4 /*yield*/, this.add(new analytics_core_1.Destination()).promise];
case 2:
_a.sent();
return [4 /*yield*/, this.add(new context_1.Context()).promise];
case 3:
_a.sent();
this.initializing = false;
return [4 /*yield*/, this.runQueuedFunctions('dispatchQ')];
case 4:
_a.sent();
return [2 /*return*/];
}
});
});
};
return AmplitudeNode;
}(analytics_core_1.AmplitudeCore));
exports.AmplitudeNode = AmplitudeNode;
var createInstance = function () {
var client = new AmplitudeNode();
return {
init: (0, analytics_core_1.debugWrapper)(client.init.bind(client), 'init', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
add: (0, analytics_core_1.debugWrapper)(client.add.bind(client), 'add', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.plugins'])),
remove: (0, analytics_core_1.debugWrapper)(client.remove.bind(client), 'remove', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.plugins'])),
track: (0, analytics_core_1.debugWrapper)(client.track.bind(client), 'track', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
logEvent: (0, analytics_core_1.debugWrapper)(client.logEvent.bind(client), 'logEvent', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
identify: (0, analytics_core_1.debugWrapper)(client.identify.bind(client), 'identify', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
groupIdentify: (0, analytics_core_1.debugWrapper)(client.groupIdentify.bind(client), 'groupIdentify', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
setGroup: (0, analytics_core_1.debugWrapper)(client.setGroup.bind(client), 'setGroup', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
revenue: (0, analytics_core_1.debugWrapper)(client.revenue.bind(client), 'revenue', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
flush: (0, analytics_core_1.debugWrapper)(client.flush.bind(client), 'flush', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
setOptOut: (0, analytics_core_1.debugWrapper)(client.setOptOut.bind(client), 'setOptOut', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
};
};
exports.createInstance = createInstance;
exports.default = (0, exports.createInstance)();
//# sourceMappingURL=node-client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
import { BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-core';
export declare class Context implements BeforePlugin {
name: string;
type: "before";
config: NodeConfig;
eventId: number;
library: string;
setup(config: NodeConfig): Promise<undefined>;
execute(context: Event): Promise<Event>;
}
//# sourceMappingURL=context.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlF,qBAAa,OAAQ,YAAW,YAAY;IAC1C,IAAI,SAAa;IACjB,IAAI,WAAqB;IAKzB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,SAAK;IACZ,OAAO,SAAkC;IAEzC,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAK7C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;CAqBxC"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = void 0;
var tslib_1 = require("tslib");
var analytics_core_1 = require("@amplitude/analytics-core");
var version_1 = require("../version");
var Context = /** @class */ (function () {
function Context() {
this.name = 'context';
this.type = 'before';
this.eventId = 0;
this.library = "amplitude-node-ts/".concat(version_1.VERSION);
}
Context.prototype.setup = function (config) {
this.config = config;
return Promise.resolve(undefined);
};
Context.prototype.execute = function (context) {
var _this = this;
return new Promise(function (resolve) {
var time = new Date().getTime();
var contextEvent = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ time: time, insert_id: (0, analytics_core_1.UUID)(), plan: _this.config.plan }, (_this.config.ingestionMetadata && {
ingestion_metadata: {
source_name: _this.config.ingestionMetadata.sourceName,
source_version: _this.config.ingestionMetadata.sourceVersion,
},
})), context), { event_id: _this.eventId++, library: _this.library });
return resolve(contextEvent);
});
};
return Context;
}());
exports.Context = Context;
//# sourceMappingURL=context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":";;;;AAAA,4DAAkF;AAClF,sCAAqC;AAErC;IAAA;QACE,SAAI,GAAG,SAAS,CAAC;QACjB,SAAI,GAAG,QAAiB,CAAC;QAMzB,YAAO,GAAG,CAAC,CAAC;QACZ,YAAO,GAAG,4BAAqB,iBAAO,CAAE,CAAC;IA4B3C,CAAC;IA1BC,uBAAK,GAAL,UAAM,MAAkB;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,yBAAO,GAAP,UAAQ,OAAc;QAAtB,iBAoBC;QAnBC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,IAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;YAElC,IAAM,YAAY,wDAChB,IAAI,MAAA,EACJ,SAAS,EAAE,IAAA,qBAAI,GAAE,EACjB,IAAI,EAAE,KAAI,CAAC,MAAM,CAAC,IAAI,IACnB,CAAC,KAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI;gBACnC,kBAAkB,EAAE;oBAClB,WAAW,EAAE,KAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU;oBACrD,cAAc,EAAE,KAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,aAAa;iBAC5D;aACF,CAAC,GACC,OAAO,KACV,QAAQ,EAAE,KAAI,CAAC,OAAO,EAAE,EACxB,OAAO,EAAE,KAAI,CAAC,OAAO,GACtB,CAAC;YACF,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IACH,cAAC;AAAD,CAAC,AArCD,IAqCC;AArCY,0BAAO","sourcesContent":["import { UUID, BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-core';\nimport { VERSION } from '../version';\n\nexport class Context implements BeforePlugin {\n name = 'context';\n type = 'before' as const;\n\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: NodeConfig;\n eventId = 0;\n library = `amplitude-node-ts/${VERSION}`;\n\n setup(config: NodeConfig): Promise<undefined> {\n this.config = config;\n return Promise.resolve(undefined);\n }\n\n execute(context: Event): Promise<Event> {\n return new Promise((resolve) => {\n const time = new Date().getTime();\n\n const contextEvent: Event = {\n time,\n insert_id: UUID(),\n plan: this.config.plan,\n ...(this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion,\n },\n }),\n ...context,\n event_id: this.eventId++,\n library: this.library,\n };\n return resolve(contextEvent);\n });\n }\n}\n"]}

View File

@@ -0,0 +1,5 @@
import { BaseTransport, Payload, Response, Transport } from '@amplitude/analytics-core';
export declare class Http extends BaseTransport implements Transport {
send(serverUrl: string, payload: Payload): Promise<Response | null>;
}
//# sourceMappingURL=http.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAIxF,qBAAa,IAAK,SAAQ,aAAc,YAAW,SAAS;IAC1D,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAgDpE"}

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Http = void 0;
var tslib_1 = require("tslib");
var analytics_core_1 = require("@amplitude/analytics-core");
var http = tslib_1.__importStar(require("http"));
var https = tslib_1.__importStar(require("https"));
var Http = /** @class */ (function (_super) {
tslib_1.__extends(Http, _super);
function Http() {
return _super !== null && _super.apply(this, arguments) || this;
}
Http.prototype.send = function (serverUrl, payload) {
var _this = this;
var protocol;
if (serverUrl.startsWith('http://')) {
protocol = http;
}
else if (serverUrl.startsWith('https://')) {
protocol = https;
}
else {
throw new Error('Invalid server url');
}
var url = new URL(serverUrl);
var requestPayload = JSON.stringify(payload);
var options = {
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestPayload),
},
hostname: url.hostname,
method: 'POST',
path: url.pathname,
port: url.port,
protocol: url.protocol,
};
return new Promise(function (resolve) {
var req = protocol.request(options, function (res) {
res.setEncoding('utf8');
var responsePayload = '';
res.on('data', function (chunk) {
responsePayload += chunk;
});
res.on('end', function () {
if (res.complete && responsePayload.length > 0) {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
var parsedResponsePayload = JSON.parse(responsePayload);
var result = _this.buildResponse(parsedResponsePayload);
resolve(result);
}
catch (_a) {
resolve(_this.buildResponse({ code: res.statusCode }));
}
}
});
});
req.on('error', function () { return resolve(null); });
req.end(requestPayload);
});
};
return Http;
}(analytics_core_1.BaseTransport));
exports.Http = Http;
//# sourceMappingURL=http.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":";;;;AAAA,4DAAwF;AACxF,iDAA6B;AAC7B,mDAA+B;AAE/B;IAA0B,gCAAa;IAAvC;;IAiDA,CAAC;IAhDC,mBAAI,GAAJ,UAAK,SAAiB,EAAE,OAAgB;QAAxC,iBA+CC;QA9CC,IAAI,QAAoC,CAAC;QACzC,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YACnC,QAAQ,GAAG,IAAI,CAAC;SACjB;aAAM,IAAI,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC3C,QAAQ,GAAG,KAAK,CAAC;SAClB;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACvC;QAED,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAC/B,IAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAM,OAAO,GAAG;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC;aACpD;YACD,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG,CAAC,QAAQ;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;SACvB,CAAC;QACF,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,IAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,UAAC,GAAG;gBACxC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,IAAI,eAAe,GAAG,EAAE,CAAC;gBACzB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,KAAa;oBAC3B,eAAe,IAAI,KAAK,CAAC;gBAC3B,CAAC,CAAC,CAAC;gBAEH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE;oBACZ,IAAI,GAAG,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC9C,IAAI;4BACF,mEAAmE;4BACnE,IAAM,qBAAqB,GAAwB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;4BAC/E,IAAM,MAAM,GAAG,KAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;4BACzD,OAAO,CAAC,MAAM,CAAC,CAAC;yBACjB;wBAAC,WAAM;4BACN,OAAO,CAAC,KAAI,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;yBACvD;qBACF;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,cAAM,OAAA,OAAO,CAAC,IAAI,CAAC,EAAb,CAAa,CAAC,CAAC;YACrC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IACH,WAAC;AAAD,CAAC,AAjDD,CAA0B,8BAAa,GAiDtC;AAjDY,oBAAI","sourcesContent":["import { BaseTransport, Payload, Response, Transport } from '@amplitude/analytics-core';\nimport * as http from 'http';\nimport * as https from 'https';\n\nexport class Http extends BaseTransport implements Transport {\n send(serverUrl: string, payload: Payload): Promise<Response | null> {\n let protocol: typeof http | typeof https;\n if (serverUrl.startsWith('http://')) {\n protocol = http;\n } else if (serverUrl.startsWith('https://')) {\n protocol = https;\n } else {\n throw new Error('Invalid server url');\n }\n\n const url = new URL(serverUrl);\n const requestPayload = JSON.stringify(payload);\n const options = {\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': Buffer.byteLength(requestPayload),\n },\n hostname: url.hostname,\n method: 'POST',\n path: url.pathname,\n port: url.port,\n protocol: url.protocol,\n };\n return new Promise((resolve) => {\n const req = protocol.request(options, (res) => {\n res.setEncoding('utf8');\n let responsePayload = '';\n res.on('data', (chunk: string) => {\n responsePayload += chunk;\n });\n\n res.on('end', () => {\n if (res.complete && responsePayload.length > 0) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const parsedResponsePayload: Record<string, any> = JSON.parse(responsePayload);\n const result = this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch {\n resolve(this.buildResponse({ code: res.statusCode }));\n }\n }\n });\n });\n req.on('error', () => resolve(null));\n req.end(requestPayload);\n });\n }\n}\n"]}

View File

@@ -0,0 +1,2 @@
export { AmplitudeReturn, BaseEvent, EventOptions, IConfig, Event, IdentifyEvent, GroupIdentifyEvent, IdentifyOperation, SpecialEventType, IIdentify, IRevenue, RevenueProperty, ILogger, LogLevel, Plugin, BeforePlugin, EnrichmentPlugin, DestinationPlugin, Result, ServerZoneType, ServerZone, IdentityStorageType, Storage, TransportType, OfflineDisabled, } from '@amplitude/analytics-core';
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,SAAS,EACT,YAAY,EACZ,OAAO,EACP,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,OAAO,EACP,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,eAAe,GAChB,MAAM,2BAA2B,CAAC"}

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OfflineDisabled = exports.ServerZone = exports.LogLevel = exports.RevenueProperty = exports.SpecialEventType = exports.IdentifyOperation = void 0;
/* eslint-disable @typescript-eslint/unbound-method */
var analytics_core_1 = require("@amplitude/analytics-core");
Object.defineProperty(exports, "IdentifyOperation", { enumerable: true, get: function () { return analytics_core_1.IdentifyOperation; } });
Object.defineProperty(exports, "SpecialEventType", { enumerable: true, get: function () { return analytics_core_1.SpecialEventType; } });
Object.defineProperty(exports, "RevenueProperty", { enumerable: true, get: function () { return analytics_core_1.RevenueProperty; } });
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return analytics_core_1.LogLevel; } });
Object.defineProperty(exports, "ServerZone", { enumerable: true, get: function () { return analytics_core_1.ServerZone; } });
Object.defineProperty(exports, "OfflineDisabled", { enumerable: true, get: function () { return analytics_core_1.OfflineDisabled; } });
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,4DA0BmC;AAlBjC,mHAAA,iBAAiB,OAAA;AACjB,kHAAA,gBAAgB,OAAA;AAGhB,iHAAA,eAAe,OAAA;AAEf,0GAAA,QAAQ,OAAA;AAOR,4GAAA,UAAU,OAAA;AAIV,iHAAA,eAAe,OAAA","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\nexport {\n AmplitudeReturn,\n BaseEvent,\n EventOptions,\n IConfig,\n Event,\n IdentifyEvent,\n GroupIdentifyEvent,\n IdentifyOperation,\n SpecialEventType,\n IIdentify,\n IRevenue,\n RevenueProperty,\n ILogger,\n LogLevel,\n Plugin,\n BeforePlugin,\n EnrichmentPlugin,\n DestinationPlugin,\n Result,\n ServerZoneType,\n ServerZone,\n IdentityStorageType,\n Storage,\n TransportType,\n OfflineDisabled,\n} from '@amplitude/analytics-core';\n"]}

View File

@@ -0,0 +1,2 @@
export declare const VERSION = "1.5.14";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '1.5.14';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.5.14';\n"]}

View File

@@ -0,0 +1,6 @@
import { Config, NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-core';
export declare class NodeConfig extends Config implements INodeConfig {
constructor(apiKey: string, options?: NodeOptions);
}
export declare const useNodeConfig: (apiKey: string, overrides?: NodeOptions) => INodeConfig;
//# sourceMappingURL=config.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG3F,qBAAa,UAAW,SAAQ,MAAO,YAAW,WAAW;gBAC/C,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW;CAOlD;AAED,eAAO,MAAM,aAAa,WAAY,MAAM,cAAc,WAAW,KAAG,WAEvE,CAAC"}

View File

@@ -0,0 +1,15 @@
import { __assign, __extends } from "tslib";
import { Config } from '@amplitude/analytics-core';
import { Http } from './transports/http';
var NodeConfig = /** @class */ (function (_super) {
__extends(NodeConfig, _super);
function NodeConfig(apiKey, options) {
return _super.call(this, __assign(__assign({ transportProvider: new Http() }, options), { apiKey: apiKey })) || this;
}
return NodeConfig;
}(Config));
export { NodeConfig };
export var useNodeConfig = function (apiKey, overrides) {
return new NodeConfig(apiKey, overrides);
};
//# sourceMappingURL=config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAA0C,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC;IAAgC,8BAAM;IACpC,oBAAY,MAAc,EAAE,OAAqB;eAC/C,sCACE,iBAAiB,EAAE,IAAI,IAAI,EAAE,IAC1B,OAAO,KACV,MAAM,QAAA,IACN;IACJ,CAAC;IACH,iBAAC;AAAD,CAAC,AARD,CAAgC,MAAM,GAQrC;;AAED,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,MAAc,EAAE,SAAuB;IACnE,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC,CAAC","sourcesContent":["import { Config, NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-core';\nimport { Http } from './transports/http';\n\nexport class NodeConfig extends Config implements INodeConfig {\n constructor(apiKey: string, options?: NodeOptions) {\n super({\n transportProvider: new Http(),\n ...options,\n apiKey,\n });\n }\n}\n\nexport const useNodeConfig = (apiKey: string, overrides?: NodeOptions): INodeConfig => {\n return new NodeConfig(apiKey, overrides);\n};\n"]}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,eAAO,MAAQ,GAAG,kNAAE,aAAa,8RAAE,QAAQ,6OAAE,IAAI,wJAAE,QAAQ,2SAAE,MAAM,qFAAE,OAAO,2OAAE,QAAQ,qOAAE,SAAS,6BAAE,KAAK,2SAAE,KAAK,iEACvG,CAAC;AACT,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAI9D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}

View File

@@ -0,0 +1,8 @@
/* 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';
import * as Types_1 from './types';
export { Types_1 as Types };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,MAAM,CAAS,IAAA,GAAG,GAChB,MAAM,IADU,EAAE,aAAa,GAC/B,MAAM,cADyB,EAAE,QAAQ,GACzC,MAAM,SADmC,EAAE,IAAI,GAC/C,MAAM,KADyC,EAAE,QAAQ,GACzD,MAAM,SADmD,EAAE,MAAM,GACjE,MAAM,OAD2D,EAAE,OAAO,GAC1E,MAAM,QADoE,EAAE,QAAQ,GACpF,MAAM,SAD8E,EAAE,SAAS,GAC/F,MAAM,UADyF,EAAE,KAAK,GACtG,MAAM,MADgG,EAAE,KAAK,GAC7G,MAAM,MADuG,CACtG;AACT,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;yBAIvC,SAAS;oBAApB,KAAK","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\n\nimport client from './node-client';\nexport { createInstance } from './node-client';\nexport const { add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush } =\n client;\nexport { Revenue, Identify } from '@amplitude/analytics-core';\n\n// Export types to maintain backward compatibility with `analytics-types`.\n// In the next major version, only export customer-facing types to reduce the public API surface.\nexport * as Types from './types';\n"]}

View File

@@ -0,0 +1,12 @@
import { AmplitudeCore, NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-core';
export declare class AmplitudeNode extends AmplitudeCore {
config: NodeConfig;
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
protected _init(options: NodeOptions & {
apiKey: string;
}): Promise<void>;
}
export declare const createInstance: () => NodeClient;
declare const _default: NodeClient;
export default _default;
//# sourceMappingURL=node-client.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAMb,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAInC,qBAAa,aAAc,SAAQ,aAAa;IAG9C,MAAM,EAAE,UAAU,CAAC;IAEnB,IAAI,CAAC,MAAM,SAAK,EAAE,OAAO,CAAC,EAAE,WAAW;cAGvB,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;CAoBhE;AAED,eAAO,MAAM,cAAc,QAAO,UAsEjC,CAAC;;AAEF,wBAAgC"}

View File

@@ -0,0 +1,64 @@
import { __assign, __awaiter, __extends, __generator } from "tslib";
import { AmplitudeCore, Destination, returnWrapper, debugWrapper, getClientLogConfig, getClientStates, } from '@amplitude/analytics-core';
import { Context } from './plugins/context';
import { useNodeConfig } from './config';
var AmplitudeNode = /** @class */ (function (_super) {
__extends(AmplitudeNode, _super);
function AmplitudeNode() {
return _super !== null && _super.apply(this, arguments) || this;
}
AmplitudeNode.prototype.init = function (apiKey, options) {
if (apiKey === void 0) { apiKey = ''; }
return returnWrapper(this._init(__assign(__assign({}, options), { apiKey: apiKey })));
};
AmplitudeNode.prototype._init = function (options) {
return __awaiter(this, void 0, void 0, function () {
var nodeOptions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
// Step 0: Block concurrent initialization
if (this.initializing) {
return [2 /*return*/];
}
this.initializing = true;
nodeOptions = useNodeConfig(options.apiKey, __assign({}, options));
return [4 /*yield*/, _super.prototype._init.call(this, nodeOptions)];
case 1:
_a.sent();
return [4 /*yield*/, this.add(new Destination()).promise];
case 2:
_a.sent();
return [4 /*yield*/, this.add(new Context()).promise];
case 3:
_a.sent();
this.initializing = false;
return [4 /*yield*/, this.runQueuedFunctions('dispatchQ')];
case 4:
_a.sent();
return [2 /*return*/];
}
});
});
};
return AmplitudeNode;
}(AmplitudeCore));
export { AmplitudeNode };
export var createInstance = function () {
var client = new AmplitudeNode();
return {
init: debugWrapper(client.init.bind(client), 'init', getClientLogConfig(client), getClientStates(client, ['config'])),
add: debugWrapper(client.add.bind(client), 'add', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
remove: debugWrapper(client.remove.bind(client), 'remove', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
track: debugWrapper(client.track.bind(client), 'track', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
logEvent: debugWrapper(client.logEvent.bind(client), 'logEvent', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
identify: debugWrapper(client.identify.bind(client), 'identify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
groupIdentify: debugWrapper(client.groupIdentify.bind(client), 'groupIdentify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
setGroup: debugWrapper(client.setGroup.bind(client), 'setGroup', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
revenue: debugWrapper(client.revenue.bind(client), 'revenue', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
flush: debugWrapper(client.flush.bind(client), 'flush', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
setOptOut: debugWrapper(client.setOptOut.bind(client), 'setOptOut', getClientLogConfig(client), getClientStates(client, ['config'])),
};
};
export default createInstance();
//# sourceMappingURL=node-client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
import { BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-core';
export declare class Context implements BeforePlugin {
name: string;
type: "before";
config: NodeConfig;
eventId: number;
library: string;
setup(config: NodeConfig): Promise<undefined>;
execute(context: Event): Promise<Event>;
}
//# sourceMappingURL=context.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlF,qBAAa,OAAQ,YAAW,YAAY;IAC1C,IAAI,SAAa;IACjB,IAAI,WAAqB;IAKzB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,SAAK;IACZ,OAAO,SAAkC;IAEzC,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAK7C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;CAqBxC"}

View File

@@ -0,0 +1,31 @@
import { __assign } from "tslib";
import { UUID } from '@amplitude/analytics-core';
import { VERSION } from '../version';
var Context = /** @class */ (function () {
function Context() {
this.name = 'context';
this.type = 'before';
this.eventId = 0;
this.library = "amplitude-node-ts/".concat(VERSION);
}
Context.prototype.setup = function (config) {
this.config = config;
return Promise.resolve(undefined);
};
Context.prototype.execute = function (context) {
var _this = this;
return new Promise(function (resolve) {
var time = new Date().getTime();
var contextEvent = __assign(__assign(__assign({ time: time, insert_id: UUID(), plan: _this.config.plan }, (_this.config.ingestionMetadata && {
ingestion_metadata: {
source_name: _this.config.ingestionMetadata.sourceName,
source_version: _this.config.ingestionMetadata.sourceVersion,
},
})), context), { event_id: _this.eventId++, library: _this.library });
return resolve(contextEvent);
});
};
return Context;
}());
export { Context };
//# sourceMappingURL=context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAmC,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;IAAA;QACE,SAAI,GAAG,SAAS,CAAC;QACjB,SAAI,GAAG,QAAiB,CAAC;QAMzB,YAAO,GAAG,CAAC,CAAC;QACZ,YAAO,GAAG,4BAAqB,OAAO,CAAE,CAAC;IA4B3C,CAAC;IA1BC,uBAAK,GAAL,UAAM,MAAkB;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,yBAAO,GAAP,UAAQ,OAAc;QAAtB,iBAoBC;QAnBC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,IAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;YAElC,IAAM,YAAY,gCAChB,IAAI,MAAA,EACJ,SAAS,EAAE,IAAI,EAAE,EACjB,IAAI,EAAE,KAAI,CAAC,MAAM,CAAC,IAAI,IACnB,CAAC,KAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI;gBACnC,kBAAkB,EAAE;oBAClB,WAAW,EAAE,KAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU;oBACrD,cAAc,EAAE,KAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,aAAa;iBAC5D;aACF,CAAC,GACC,OAAO,KACV,QAAQ,EAAE,KAAI,CAAC,OAAO,EAAE,EACxB,OAAO,EAAE,KAAI,CAAC,OAAO,GACtB,CAAC;YACF,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IACH,cAAC;AAAD,CAAC,AArCD,IAqCC","sourcesContent":["import { UUID, BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-core';\nimport { VERSION } from '../version';\n\nexport class Context implements BeforePlugin {\n name = 'context';\n type = 'before' as const;\n\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: NodeConfig;\n eventId = 0;\n library = `amplitude-node-ts/${VERSION}`;\n\n setup(config: NodeConfig): Promise<undefined> {\n this.config = config;\n return Promise.resolve(undefined);\n }\n\n execute(context: Event): Promise<Event> {\n return new Promise((resolve) => {\n const time = new Date().getTime();\n\n const contextEvent: Event = {\n time,\n insert_id: UUID(),\n plan: this.config.plan,\n ...(this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion,\n },\n }),\n ...context,\n event_id: this.eventId++,\n library: this.library,\n };\n return resolve(contextEvent);\n });\n }\n}\n"]}

View File

@@ -0,0 +1,5 @@
import { BaseTransport, Payload, Response, Transport } from '@amplitude/analytics-core';
export declare class Http extends BaseTransport implements Transport {
send(serverUrl: string, payload: Payload): Promise<Response | null>;
}
//# sourceMappingURL=http.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAIxF,qBAAa,IAAK,SAAQ,aAAc,YAAW,SAAS;IAC1D,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAgDpE"}

View File

@@ -0,0 +1,63 @@
import { __extends } from "tslib";
import { BaseTransport } from '@amplitude/analytics-core';
import * as http from 'http';
import * as https from 'https';
var Http = /** @class */ (function (_super) {
__extends(Http, _super);
function Http() {
return _super !== null && _super.apply(this, arguments) || this;
}
Http.prototype.send = function (serverUrl, payload) {
var _this = this;
var protocol;
if (serverUrl.startsWith('http://')) {
protocol = http;
}
else if (serverUrl.startsWith('https://')) {
protocol = https;
}
else {
throw new Error('Invalid server url');
}
var url = new URL(serverUrl);
var requestPayload = JSON.stringify(payload);
var options = {
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestPayload),
},
hostname: url.hostname,
method: 'POST',
path: url.pathname,
port: url.port,
protocol: url.protocol,
};
return new Promise(function (resolve) {
var req = protocol.request(options, function (res) {
res.setEncoding('utf8');
var responsePayload = '';
res.on('data', function (chunk) {
responsePayload += chunk;
});
res.on('end', function () {
if (res.complete && responsePayload.length > 0) {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
var parsedResponsePayload = JSON.parse(responsePayload);
var result = _this.buildResponse(parsedResponsePayload);
resolve(result);
}
catch (_a) {
resolve(_this.buildResponse({ code: res.statusCode }));
}
}
});
});
req.on('error', function () { return resolve(null); });
req.end(requestPayload);
});
};
return Http;
}(BaseTransport));
export { Http };
//# sourceMappingURL=http.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAgC,MAAM,2BAA2B,CAAC;AACxF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;IAA0B,wBAAa;IAAvC;;IAiDA,CAAC;IAhDC,mBAAI,GAAJ,UAAK,SAAiB,EAAE,OAAgB;QAAxC,iBA+CC;QA9CC,IAAI,QAAoC,CAAC;QACzC,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YACnC,QAAQ,GAAG,IAAI,CAAC;SACjB;aAAM,IAAI,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC3C,QAAQ,GAAG,KAAK,CAAC;SAClB;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACvC;QAED,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAC/B,IAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAM,OAAO,GAAG;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC;aACpD;YACD,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG,CAAC,QAAQ;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;SACvB,CAAC;QACF,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,IAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,UAAC,GAAG;gBACxC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,IAAI,eAAe,GAAG,EAAE,CAAC;gBACzB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,KAAa;oBAC3B,eAAe,IAAI,KAAK,CAAC;gBAC3B,CAAC,CAAC,CAAC;gBAEH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE;oBACZ,IAAI,GAAG,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC9C,IAAI;4BACF,mEAAmE;4BACnE,IAAM,qBAAqB,GAAwB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;4BAC/E,IAAM,MAAM,GAAG,KAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;4BACzD,OAAO,CAAC,MAAM,CAAC,CAAC;yBACjB;wBAAC,WAAM;4BACN,OAAO,CAAC,KAAI,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;yBACvD;qBACF;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,cAAM,OAAA,OAAO,CAAC,IAAI,CAAC,EAAb,CAAa,CAAC,CAAC;YACrC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IACH,WAAC;AAAD,CAAC,AAjDD,CAA0B,aAAa,GAiDtC","sourcesContent":["import { BaseTransport, Payload, Response, Transport } from '@amplitude/analytics-core';\nimport * as http from 'http';\nimport * as https from 'https';\n\nexport class Http extends BaseTransport implements Transport {\n send(serverUrl: string, payload: Payload): Promise<Response | null> {\n let protocol: typeof http | typeof https;\n if (serverUrl.startsWith('http://')) {\n protocol = http;\n } else if (serverUrl.startsWith('https://')) {\n protocol = https;\n } else {\n throw new Error('Invalid server url');\n }\n\n const url = new URL(serverUrl);\n const requestPayload = JSON.stringify(payload);\n const options = {\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': Buffer.byteLength(requestPayload),\n },\n hostname: url.hostname,\n method: 'POST',\n path: url.pathname,\n port: url.port,\n protocol: url.protocol,\n };\n return new Promise((resolve) => {\n const req = protocol.request(options, (res) => {\n res.setEncoding('utf8');\n let responsePayload = '';\n res.on('data', (chunk: string) => {\n responsePayload += chunk;\n });\n\n res.on('end', () => {\n if (res.complete && responsePayload.length > 0) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const parsedResponsePayload: Record<string, any> = JSON.parse(responsePayload);\n const result = this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch {\n resolve(this.buildResponse({ code: res.statusCode }));\n }\n }\n });\n });\n req.on('error', () => resolve(null));\n req.end(requestPayload);\n });\n }\n}\n"]}

View File

@@ -0,0 +1,2 @@
export { AmplitudeReturn, BaseEvent, EventOptions, IConfig, Event, IdentifyEvent, GroupIdentifyEvent, IdentifyOperation, SpecialEventType, IIdentify, IRevenue, RevenueProperty, ILogger, LogLevel, Plugin, BeforePlugin, EnrichmentPlugin, DestinationPlugin, Result, ServerZoneType, ServerZone, IdentityStorageType, Storage, TransportType, OfflineDisabled, } from '@amplitude/analytics-core';
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,SAAS,EACT,YAAY,EACZ,OAAO,EACP,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,OAAO,EACP,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,eAAe,GAChB,MAAM,2BAA2B,CAAC"}

View File

@@ -0,0 +1,3 @@
/* eslint-disable @typescript-eslint/unbound-method */
export { IdentifyOperation, SpecialEventType, RevenueProperty, LogLevel, ServerZone, OfflineDisabled, } from '@amplitude/analytics-core';
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAQL,iBAAiB,EACjB,gBAAgB,EAGhB,eAAe,EAEf,QAAQ,EAOR,UAAU,EAIV,eAAe,GAChB,MAAM,2BAA2B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\nexport {\n AmplitudeReturn,\n BaseEvent,\n EventOptions,\n IConfig,\n Event,\n IdentifyEvent,\n GroupIdentifyEvent,\n IdentifyOperation,\n SpecialEventType,\n IIdentify,\n IRevenue,\n RevenueProperty,\n ILogger,\n LogLevel,\n Plugin,\n BeforePlugin,\n EnrichmentPlugin,\n DestinationPlugin,\n Result,\n ServerZoneType,\n ServerZone,\n IdentityStorageType,\n Storage,\n TransportType,\n OfflineDisabled,\n} from '@amplitude/analytics-core';\n"]}

View File

@@ -0,0 +1,2 @@
export declare const VERSION = "1.5.14";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}

View File

@@ -0,0 +1,2 @@
export var VERSION = '1.5.14';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.5.14';\n"]}

View File

@@ -0,0 +1,47 @@
{
"name": "@amplitude/analytics-node",
"version": "1.5.14",
"description": "Official Amplitude SDK for NodeJS",
"author": "Amplitude Inc",
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
"license": "MIT",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/esm/index.d.ts",
"sideEffects": false,
"publishConfig": {
"access": "public",
"tag": "latest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
},
"scripts": {
"build": "yarn build:es5 & yarn build:esm",
"build:es5": "tsc -p ./tsconfig.es5.json",
"build:esm": "tsc -p ./tsconfig.esm.json",
"clean": "rimraf node_modules lib coverage",
"fix": "yarn fix:eslint & yarn fix:prettier",
"fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
"lint": "yarn lint:eslint & yarn lint:prettier",
"lint:eslint": "eslint '{src,test}/**/*.ts'",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"test": "jest",
"typecheck": "tsc -p ./tsconfig.json",
"version": "yarn version-file && yarn build",
"version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts"
},
"bugs": {
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
},
"dependencies": {
"@amplitude/analytics-core": "^2.26.2",
"tslib": "^2.4.1"
},
"files": [
"lib"
],
"gitHead": "3fb30ef85184a6b55503171f99be5648fc00651c"
}