@amplitude/analytics-node 1.0.5 → 1.1.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/node-client.d.ts +6 -2
- package/lib/cjs/node-client.d.ts.map +1 -1
- package/lib/cjs/node-client.js +16 -13
- package/lib/cjs/node-client.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/node-client.d.ts +6 -2
- package/lib/esm/node-client.d.ts.map +1 -1
- package/lib/esm/node-client.js +16 -13
- package/lib/esm/node-client.js.map +1 -1
- 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 +4 -4
package/lib/cjs/node-client.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { AmplitudeCore } from '@amplitude/analytics-core';
|
|
2
2
|
import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';
|
|
3
|
-
export declare class AmplitudeNode extends AmplitudeCore
|
|
4
|
-
|
|
3
|
+
export declare class AmplitudeNode extends AmplitudeCore {
|
|
4
|
+
config: NodeConfig;
|
|
5
|
+
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
6
|
+
protected _init(options: NodeOptions & {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
}): Promise<void>;
|
|
5
9
|
}
|
|
6
10
|
export declare const createInstance: () => NodeClient;
|
|
7
11
|
declare const _default: NodeClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAMd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIjF,qBAAa,aAAc,SAAQ,aAAa,
|
|
1
|
+
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAMd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIjF,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
|
@@ -11,6 +11,9 @@ var AmplitudeNode = /** @class */ (function (_super) {
|
|
|
11
11
|
}
|
|
12
12
|
AmplitudeNode.prototype.init = function (apiKey, options) {
|
|
13
13
|
if (apiKey === void 0) { apiKey = ''; }
|
|
14
|
+
return (0, analytics_core_1.returnWrapper)(this._init(tslib_1.__assign(tslib_1.__assign({}, options), { apiKey: apiKey })));
|
|
15
|
+
};
|
|
16
|
+
AmplitudeNode.prototype._init = function (options) {
|
|
14
17
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
15
18
|
var nodeOptions;
|
|
16
19
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -21,14 +24,14 @@ var AmplitudeNode = /** @class */ (function (_super) {
|
|
|
21
24
|
return [2 /*return*/];
|
|
22
25
|
}
|
|
23
26
|
this.initializing = true;
|
|
24
|
-
nodeOptions = (0, config_1.useNodeConfig)(apiKey, tslib_1.__assign({}, options));
|
|
27
|
+
nodeOptions = (0, config_1.useNodeConfig)(options.apiKey, tslib_1.__assign({}, options));
|
|
25
28
|
return [4 /*yield*/, _super.prototype._init.call(this, nodeOptions)];
|
|
26
29
|
case 1:
|
|
27
30
|
_a.sent();
|
|
28
|
-
return [4 /*yield*/, this.add(new
|
|
31
|
+
return [4 /*yield*/, this.add(new analytics_core_1.Destination()).promise];
|
|
29
32
|
case 2:
|
|
30
33
|
_a.sent();
|
|
31
|
-
return [4 /*yield*/, this.add(new
|
|
34
|
+
return [4 /*yield*/, this.add(new context_1.Context()).promise];
|
|
32
35
|
case 3:
|
|
33
36
|
_a.sent();
|
|
34
37
|
this.initializing = false;
|
|
@@ -46,16 +49,16 @@ exports.AmplitudeNode = AmplitudeNode;
|
|
|
46
49
|
var createInstance = function () {
|
|
47
50
|
var client = new AmplitudeNode();
|
|
48
51
|
return {
|
|
49
|
-
init: (0, analytics_core_1.debugWrapper)(
|
|
50
|
-
add: (0, analytics_core_1.debugWrapper)(
|
|
51
|
-
remove: (0, analytics_core_1.debugWrapper)(
|
|
52
|
-
track: (0, analytics_core_1.debugWrapper)(
|
|
53
|
-
logEvent: (0, analytics_core_1.debugWrapper)(
|
|
54
|
-
identify: (0, analytics_core_1.debugWrapper)(
|
|
55
|
-
groupIdentify: (0, analytics_core_1.debugWrapper)(
|
|
56
|
-
setGroup: (0, analytics_core_1.debugWrapper)(
|
|
57
|
-
revenue: (0, analytics_core_1.debugWrapper)(
|
|
58
|
-
flush: (0, analytics_core_1.debugWrapper)(
|
|
52
|
+
init: (0, analytics_core_1.debugWrapper)(client.init.bind(client), 'init', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
|
|
53
|
+
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'])),
|
|
54
|
+
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'])),
|
|
55
|
+
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'])),
|
|
56
|
+
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'])),
|
|
57
|
+
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'])),
|
|
58
|
+
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'])),
|
|
59
|
+
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'])),
|
|
60
|
+
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'])),
|
|
61
|
+
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'])),
|
|
59
62
|
setOptOut: (0, analytics_core_1.debugWrapper)(client.setOptOut.bind(client), 'setOptOut', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
|
|
60
63
|
};
|
|
61
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":";;;AAAA,4DAOmC;AAEnC,6CAA4C;AAC5C,mCAAyC;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per,\n debugWrapper,\n getClientLogConfig,\n getClientStates,\n} from '@amplitude/analytics-core';\nimport { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';\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"]}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0
|
|
1
|
+
export declare const VERSION = "1.1.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":";;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.0
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.1.0';\n"]}
|
package/lib/esm/node-client.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { AmplitudeCore } from '@amplitude/analytics-core';
|
|
2
2
|
import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';
|
|
3
|
-
export declare class AmplitudeNode extends AmplitudeCore
|
|
4
|
-
|
|
3
|
+
export declare class AmplitudeNode extends AmplitudeCore {
|
|
4
|
+
config: NodeConfig;
|
|
5
|
+
init(apiKey?: string, options?: NodeOptions): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
6
|
+
protected _init(options: NodeOptions & {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
}): Promise<void>;
|
|
5
9
|
}
|
|
6
10
|
export declare const createInstance: () => NodeClient;
|
|
7
11
|
declare const _default: NodeClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAMd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIjF,qBAAa,aAAc,SAAQ,aAAa,
|
|
1
|
+
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../src/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAMd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIjF,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/esm/node-client.js
CHANGED
|
@@ -9,6 +9,9 @@ var AmplitudeNode = /** @class */ (function (_super) {
|
|
|
9
9
|
}
|
|
10
10
|
AmplitudeNode.prototype.init = function (apiKey, options) {
|
|
11
11
|
if (apiKey === void 0) { apiKey = ''; }
|
|
12
|
+
return returnWrapper(this._init(__assign(__assign({}, options), { apiKey: apiKey })));
|
|
13
|
+
};
|
|
14
|
+
AmplitudeNode.prototype._init = function (options) {
|
|
12
15
|
return __awaiter(this, void 0, void 0, function () {
|
|
13
16
|
var nodeOptions;
|
|
14
17
|
return __generator(this, function (_a) {
|
|
@@ -19,14 +22,14 @@ var AmplitudeNode = /** @class */ (function (_super) {
|
|
|
19
22
|
return [2 /*return*/];
|
|
20
23
|
}
|
|
21
24
|
this.initializing = true;
|
|
22
|
-
nodeOptions = useNodeConfig(apiKey, __assign({}, options));
|
|
25
|
+
nodeOptions = useNodeConfig(options.apiKey, __assign({}, options));
|
|
23
26
|
return [4 /*yield*/, _super.prototype._init.call(this, nodeOptions)];
|
|
24
27
|
case 1:
|
|
25
28
|
_a.sent();
|
|
26
|
-
return [4 /*yield*/, this.add(new
|
|
29
|
+
return [4 /*yield*/, this.add(new Destination()).promise];
|
|
27
30
|
case 2:
|
|
28
31
|
_a.sent();
|
|
29
|
-
return [4 /*yield*/, this.add(new
|
|
32
|
+
return [4 /*yield*/, this.add(new Context()).promise];
|
|
30
33
|
case 3:
|
|
31
34
|
_a.sent();
|
|
32
35
|
this.initializing = false;
|
|
@@ -44,16 +47,16 @@ export { AmplitudeNode };
|
|
|
44
47
|
export var createInstance = function () {
|
|
45
48
|
var client = new AmplitudeNode();
|
|
46
49
|
return {
|
|
47
|
-
init: debugWrapper(
|
|
48
|
-
add: debugWrapper(
|
|
49
|
-
remove: debugWrapper(
|
|
50
|
-
track: debugWrapper(
|
|
51
|
-
logEvent: debugWrapper(
|
|
52
|
-
identify: debugWrapper(
|
|
53
|
-
groupIdentify: debugWrapper(
|
|
54
|
-
setGroup: debugWrapper(
|
|
55
|
-
revenue: debugWrapper(
|
|
56
|
-
flush: debugWrapper(
|
|
50
|
+
init: debugWrapper(client.init.bind(client), 'init', getClientLogConfig(client), getClientStates(client, ['config'])),
|
|
51
|
+
add: debugWrapper(client.add.bind(client), 'add', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
|
|
52
|
+
remove: debugWrapper(client.remove.bind(client), 'remove', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
|
|
53
|
+
track: debugWrapper(client.track.bind(client), 'track', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
54
|
+
logEvent: debugWrapper(client.logEvent.bind(client), 'logEvent', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
55
|
+
identify: debugWrapper(client.identify.bind(client), 'identify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
56
|
+
groupIdentify: debugWrapper(client.groupIdentify.bind(client), 'groupIdentify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
57
|
+
setGroup: debugWrapper(client.setGroup.bind(client), 'setGroup', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
58
|
+
revenue: debugWrapper(client.revenue.bind(client), 'revenue', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
59
|
+
flush: debugWrapper(client.flush.bind(client), 'flush', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
|
|
57
60
|
setOptOut: debugWrapper(client.setOptOut.bind(client), 'setOptOut', getClientLogConfig(client), getClientStates(client, ['config'])),
|
|
58
61
|
};
|
|
59
62
|
};
|
|
@@ -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,GAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;IAAmC,
|
|
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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AM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,QAAQ,EAAE,YAAY,CACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC5B,UAAU,EACV,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CACpE;QACD,OAAO,EAAE,YAAY,CACnB,MAAM,CAAC,OAAO,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} from '@amplitude/analytics-core';\nimport { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types';\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"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0
|
|
1
|
+
export declare const VERSION = "1.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '1.0
|
|
1
|
+
export var VERSION = '1.1.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.0
|
|
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.0';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-node",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Official Amplitude SDK for NodeJS",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@amplitude/analytics-core": "^0.
|
|
40
|
-
"@amplitude/analytics-types": "^0.
|
|
39
|
+
"@amplitude/analytics-core": "^0.12.0",
|
|
40
|
+
"@amplitude/analytics-types": "^0.17.0",
|
|
41
41
|
"tslib": "^2.4.1"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"lib"
|
|
45
45
|
],
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "cbcbf1b25dabe9e34f7af7b928cbecec1cdb20ab"
|
|
47
47
|
}
|