@amplitude/analytics-node 1.3.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/config.d.ts +1 -2
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +1 -0
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +6 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/node-client.d.ts +2 -3
- package/lib/cjs/node-client.d.ts.map +1 -1
- package/lib/cjs/node-client.js +1 -0
- package/lib/cjs/node-client.js.map +1 -1
- package/lib/cjs/plugins/context.d.ts +2 -2
- package/lib/cjs/plugins/context.d.ts.map +1 -1
- package/lib/cjs/plugins/context.js +2 -2
- package/lib/cjs/plugins/context.js.map +1 -1
- package/lib/cjs/transports/http.d.ts +1 -2
- package/lib/cjs/transports/http.d.ts.map +1 -1
- package/lib/cjs/transports/http.js +3 -2
- package/lib/cjs/transports/http.js.map +1 -1
- package/lib/cjs/types.d.ts +2 -0
- package/lib/cjs/types.d.ts.map +1 -0
- package/lib/cjs/types.js +12 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +2 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/config.d.ts +1 -2
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/node-client.d.ts +2 -3
- package/lib/esm/node-client.d.ts.map +1 -1
- package/lib/esm/node-client.js.map +1 -1
- package/lib/esm/plugins/context.d.ts +2 -2
- package/lib/esm/plugins/context.d.ts.map +1 -1
- package/lib/esm/plugins/context.js +1 -2
- package/lib/esm/plugins/context.js.map +1 -1
- package/lib/esm/transports/http.d.ts +1 -2
- package/lib/esm/transports/http.d.ts.map +1 -1
- package/lib/esm/transports/http.js.map +1 -1
- package/lib/esm/types.d.ts +2 -0
- package/lib/esm/types.d.ts.map +1 -0
- package/lib/esm/types.js +3 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/package.json +3 -4
package/lib/cjs/config.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-
|
|
2
|
-
import { Config } from '@amplitude/analytics-core';
|
|
1
|
+
import { Config, NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-core';
|
|
3
2
|
export declare class NodeConfig extends Config implements INodeConfig {
|
|
4
3
|
constructor(apiKey: string, options?: NodeOptions);
|
|
5
4
|
}
|
package/lib/cjs/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,
|
|
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"}
|
package/lib/cjs/config.js
CHANGED
package/lib/cjs/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"
|
|
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"]}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createInstance } from './node-client';
|
|
2
|
-
export declare const add: (plugin: import("@amplitude/analytics-
|
|
2
|
+
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>;
|
|
3
3
|
export { Revenue, Identify } from '@amplitude/analytics-core';
|
|
4
|
-
export * as Types from '
|
|
4
|
+
export * as Types from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
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;
|
|
4
|
-
var
|
|
5
|
+
var tslib_1 = require("tslib");
|
|
6
|
+
var node_client_1 = tslib_1.__importDefault(require("./node-client"));
|
|
5
7
|
var node_client_2 = require("./node-client");
|
|
6
8
|
Object.defineProperty(exports, "createInstance", { enumerable: true, get: function () { return node_client_2.createInstance; } });
|
|
7
9
|
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;
|
|
8
10
|
var analytics_core_1 = require("@amplitude/analytics-core");
|
|
9
11
|
Object.defineProperty(exports, "Revenue", { enumerable: true, get: function () { return analytics_core_1.Revenue; } });
|
|
10
12
|
Object.defineProperty(exports, "Identify", { enumerable: true, get: function () { return analytics_core_1.Identify; } });
|
|
11
|
-
|
|
13
|
+
// Export types to maintain backward compatibility with `analytics-types`.
|
|
14
|
+
// In the next major version, only export customer-facing types to reduce the public API surface.
|
|
15
|
+
exports.Types = tslib_1.__importStar(require("./types"));
|
|
12
16
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD
|
|
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"]}
|
package/lib/cjs/node-client.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { AmplitudeCore } from '@amplitude/analytics-core';
|
|
2
|
-
import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';
|
|
1
|
+
import { AmplitudeCore, NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-core';
|
|
3
2
|
export declare class AmplitudeNode extends AmplitudeCore {
|
|
4
3
|
config: NodeConfig;
|
|
5
|
-
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-
|
|
4
|
+
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
|
|
6
5
|
protected _init(options: NodeOptions & {
|
|
7
6
|
apiKey: string;
|
|
8
7
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,
|
|
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"}
|
package/lib/cjs/node-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":";;;;AAAA,4DAUmC;AACnC,6CAA4C;AAC5C,mCAAyC;AAEzC;IAAmC,yCAAa;IAAhD;;IA4BA,CAAC;IAvBC,4BAAI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C,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,QAAQ,EAAE,IAAA,6BAAY,EACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC5B,UAAU,EACV,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,OAAO,EAAE,IAAA,6BAAY,EACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3B,SAAS,EACT,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,KAAK,EAAE,IAAA,6BAAY,EACjB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EACzB,OAAO,EACP,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,SAAS,EAAE,IAAA,6BAAY,EACrB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAC7B,WAAW,EACX,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;KACF,CAAC;AACJ,CAAC,CAAC;AAtEW,QAAA,cAAc,kBAsEzB;AAEF,kBAAe,IAAA,sBAAc,GAAE,CAAC","sourcesContent":["import {\n AmplitudeCore,\n Destination,\n returnWrapper,\n debugWrapper,\n getClientLogConfig,\n getClientStates,\n NodeClient,\n NodeConfig,\n NodeOptions,\n} from '@amplitude/analytics-core';\nimport { Context } from './plugins/context';\nimport { useNodeConfig } from './config';\n\nexport class AmplitudeNode extends AmplitudeCore {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: NodeConfig;\n\n init(apiKey = '', options?: NodeOptions) {\n return returnWrapper(this._init({ ...options, apiKey }));\n }\n protected async _init(options: NodeOptions & { apiKey: string }) {\n // Step 0: Block concurrent initialization\n if (this.initializing) {\n return;\n }\n this.initializing = true;\n\n const nodeOptions = useNodeConfig(options.apiKey, {\n ...options,\n });\n\n await super._init(nodeOptions);\n\n await this.add(new Destination()).promise;\n await this.add(new Context()).promise;\n\n this.initializing = false;\n\n await this.runQueuedFunctions('dispatchQ');\n }\n}\n\nexport const createInstance = (): NodeClient => {\n const client = new AmplitudeNode();\n return {\n init: debugWrapper(\n client.init.bind(client),\n 'init',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n add: debugWrapper(\n client.add.bind(client),\n 'add',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n remove: debugWrapper(\n client.remove.bind(client),\n 'remove',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n track: debugWrapper(\n client.track.bind(client),\n 'track',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n logEvent: debugWrapper(\n client.logEvent.bind(client),\n 'logEvent',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n identify: debugWrapper(\n client.identify.bind(client),\n 'identify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n groupIdentify: debugWrapper(\n client.groupIdentify.bind(client),\n 'groupIdentify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n setGroup: debugWrapper(\n client.setGroup.bind(client),\n 'setGroup',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n revenue: debugWrapper(\n client.revenue.bind(client),\n 'revenue',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n flush: debugWrapper(\n client.flush.bind(client),\n 'flush',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n setOptOut: debugWrapper(\n client.setOptOut.bind(client),\n 'setOptOut',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n };\n};\n\nexport default createInstance();\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BeforePlugin, NodeConfig, Event
|
|
1
|
+
import { BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-core';
|
|
2
2
|
export declare class Context implements BeforePlugin {
|
|
3
3
|
name: string;
|
|
4
|
-
type:
|
|
4
|
+
type: "before";
|
|
5
5
|
config: NodeConfig;
|
|
6
6
|
eventId: number;
|
|
7
7
|
library: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
exports.Context = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var analytics_types_1 = require("@amplitude/analytics-types");
|
|
5
5
|
var analytics_core_1 = require("@amplitude/analytics-core");
|
|
6
6
|
var version_1 = require("../version");
|
|
7
7
|
var Context = /** @class */ (function () {
|
|
8
8
|
function Context() {
|
|
9
9
|
this.name = 'context';
|
|
10
|
-
this.type =
|
|
10
|
+
this.type = 'before';
|
|
11
11
|
this.eventId = 0;
|
|
12
12
|
this.library = "amplitude-node-ts/".concat(version_1.VERSION);
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"
|
|
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"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Payload, Response, Transport } from '@amplitude/analytics-
|
|
2
|
-
import { BaseTransport } from '@amplitude/analytics-core';
|
|
1
|
+
import { BaseTransport, Payload, Response, Transport } from '@amplitude/analytics-core';
|
|
3
2
|
export declare class Http extends BaseTransport implements Transport {
|
|
4
3
|
send(serverUrl: string, payload: Payload): Promise<Response | null>;
|
|
5
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,
|
|
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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
exports.Http = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var analytics_core_1 = require("@amplitude/analytics-core");
|
|
5
|
-
var http = require("http");
|
|
6
|
-
var https = require("https");
|
|
6
|
+
var http = tslib_1.__importStar(require("http"));
|
|
7
|
+
var https = tslib_1.__importStar(require("https"));
|
|
7
8
|
var Http = /** @class */ (function (_super) {
|
|
8
9
|
tslib_1.__extends(Http, _super);
|
|
9
10
|
function Http() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":"
|
|
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,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,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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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';
|
|
2
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/lib/cjs/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OfflineDisabled = exports.ServerZone = exports.LogLevel = exports.RevenueProperty = exports.SpecialEventType = exports.IdentifyOperation = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
5
|
+
var analytics_core_1 = require("@amplitude/analytics-core");
|
|
6
|
+
Object.defineProperty(exports, "IdentifyOperation", { enumerable: true, get: function () { return analytics_core_1.IdentifyOperation; } });
|
|
7
|
+
Object.defineProperty(exports, "SpecialEventType", { enumerable: true, get: function () { return analytics_core_1.SpecialEventType; } });
|
|
8
|
+
Object.defineProperty(exports, "RevenueProperty", { enumerable: true, get: function () { return analytics_core_1.RevenueProperty; } });
|
|
9
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return analytics_core_1.LogLevel; } });
|
|
10
|
+
Object.defineProperty(exports, "ServerZone", { enumerable: true, get: function () { return analytics_core_1.ServerZone; } });
|
|
11
|
+
Object.defineProperty(exports, "OfflineDisabled", { enumerable: true, get: function () { return analytics_core_1.OfflineDisabled; } });
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/cjs/version.js
CHANGED
package/lib/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.4.0';\n"]}
|
package/lib/esm/config.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-
|
|
2
|
-
import { Config } from '@amplitude/analytics-core';
|
|
1
|
+
import { Config, NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-core';
|
|
3
2
|
export declare class NodeConfig extends Config implements INodeConfig {
|
|
4
3
|
constructor(apiKey: string, options?: NodeOptions);
|
|
5
4
|
}
|
package/lib/esm/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,
|
|
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"}
|
package/lib/esm/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";
|
|
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"]}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createInstance } from './node-client';
|
|
2
|
-
export declare const add: (plugin: import("@amplitude/analytics-
|
|
2
|
+
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>;
|
|
3
3
|
export { Revenue, Identify } from '@amplitude/analytics-core';
|
|
4
|
-
export * as Types from '
|
|
4
|
+
export * as Types from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,eAAO,MAAQ,GAAG,
|
|
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"}
|
package/lib/esm/index.js
CHANGED
|
@@ -3,6 +3,6 @@ import client from './node-client';
|
|
|
3
3
|
export { createInstance } from './node-client';
|
|
4
4
|
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;
|
|
5
5
|
export { Revenue, Identify } from '@amplitude/analytics-core';
|
|
6
|
-
import * as Types_1 from '
|
|
6
|
+
import * as Types_1 from './types';
|
|
7
7
|
export { Types_1 as Types };
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,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;
|
|
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"]}
|
package/lib/esm/node-client.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { AmplitudeCore } from '@amplitude/analytics-core';
|
|
2
|
-
import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';
|
|
1
|
+
import { AmplitudeCore, NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-core';
|
|
3
2
|
export declare class AmplitudeNode extends AmplitudeCore {
|
|
4
3
|
config: NodeConfig;
|
|
5
|
-
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-
|
|
4
|
+
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
|
|
6
5
|
protected _init(options: NodeOptions & {
|
|
7
6
|
apiKey: string;
|
|
8
7
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,
|
|
1
|
+
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,GAIhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;IAAmC,iCAAa;IAAhD;;IA4BA,CAAC;IAvBC,4BAAI,GAAJ,UAAK,MAAW,EAAE,OAAqB;QAAlC,uBAAA,EAAA,WAAW;QACd,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,uBAAM,OAAO,KAAE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,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3B,SAAS,EACT,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,KAAK,EAAE,YAAY,CACjB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EACzB,OAAO,EACP,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,SAAS,EAAE,YAAY,CACrB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAC7B,WAAW,EACX,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,EAAE,CAAC","sourcesContent":["import {\n AmplitudeCore,\n Destination,\n returnWrapper,\n debugWrapper,\n getClientLogConfig,\n getClientStates,\n NodeClient,\n NodeConfig,\n NodeOptions,\n} from '@amplitude/analytics-core';\nimport { Context } from './plugins/context';\nimport { useNodeConfig } from './config';\n\nexport class AmplitudeNode extends AmplitudeCore {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: NodeConfig;\n\n init(apiKey = '', options?: NodeOptions) {\n return returnWrapper(this._init({ ...options, apiKey }));\n }\n protected async _init(options: NodeOptions & { apiKey: string }) {\n // Step 0: Block concurrent initialization\n if (this.initializing) {\n return;\n }\n this.initializing = true;\n\n const nodeOptions = useNodeConfig(options.apiKey, {\n ...options,\n });\n\n await super._init(nodeOptions);\n\n await this.add(new Destination()).promise;\n await this.add(new Context()).promise;\n\n this.initializing = false;\n\n await this.runQueuedFunctions('dispatchQ');\n }\n}\n\nexport const createInstance = (): NodeClient => {\n const client = new AmplitudeNode();\n return {\n init: debugWrapper(\n client.init.bind(client),\n 'init',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n add: debugWrapper(\n client.add.bind(client),\n 'add',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n remove: debugWrapper(\n client.remove.bind(client),\n 'remove',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n track: debugWrapper(\n client.track.bind(client),\n 'track',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n logEvent: debugWrapper(\n client.logEvent.bind(client),\n 'logEvent',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n identify: debugWrapper(\n client.identify.bind(client),\n 'identify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n groupIdentify: debugWrapper(\n client.groupIdentify.bind(client),\n 'groupIdentify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n setGroup: debugWrapper(\n client.setGroup.bind(client),\n 'setGroup',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n revenue: debugWrapper(\n client.revenue.bind(client),\n 'revenue',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n flush: debugWrapper(\n client.flush.bind(client),\n 'flush',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n setOptOut: debugWrapper(\n client.setOptOut.bind(client),\n 'setOptOut',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n };\n};\n\nexport default createInstance();\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BeforePlugin, NodeConfig, Event
|
|
1
|
+
import { BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-core';
|
|
2
2
|
export declare class Context implements BeforePlugin {
|
|
3
3
|
name: string;
|
|
4
|
-
type:
|
|
4
|
+
type: "before";
|
|
5
5
|
config: NodeConfig;
|
|
6
6
|
eventId: number;
|
|
7
7
|
library: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { PluginType } from '@amplitude/analytics-types';
|
|
3
2
|
import { UUID } from '@amplitude/analytics-core';
|
|
4
3
|
import { VERSION } from '../version';
|
|
5
4
|
var Context = /** @class */ (function () {
|
|
6
5
|
function Context() {
|
|
7
6
|
this.name = 'context';
|
|
8
|
-
this.type =
|
|
7
|
+
this.type = 'before';
|
|
9
8
|
this.eventId = 0;
|
|
10
9
|
this.library = "amplitude-node-ts/".concat(VERSION);
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
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"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Payload, Response, Transport } from '@amplitude/analytics-
|
|
2
|
-
import { BaseTransport } from '@amplitude/analytics-core';
|
|
1
|
+
import { BaseTransport, Payload, Response, Transport } from '@amplitude/analytics-core';
|
|
3
2
|
export declare class Http extends BaseTransport implements Transport {
|
|
4
3
|
send(serverUrl: string, payload: Payload): Promise<Response | null>;
|
|
5
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/transports/http.ts"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AAG,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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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';
|
|
2
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/lib/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '1.
|
|
1
|
+
export var VERSION = '1.4.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.4.0';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Official Amplitude SDK for NodeJS",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -37,12 +37,11 @@
|
|
|
37
37
|
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@amplitude/analytics-core": "^
|
|
41
|
-
"@amplitude/analytics-types": "^1.3.5",
|
|
40
|
+
"@amplitude/analytics-core": "^2.17.0",
|
|
42
41
|
"tslib": "^2.4.1"
|
|
43
42
|
},
|
|
44
43
|
"files": [
|
|
45
44
|
"lib"
|
|
46
45
|
],
|
|
47
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "93e9392404bb8e78961f1b8ef1afb1edd4752a05"
|
|
48
47
|
}
|