@amplitude/analytics-core 0.11.3 → 0.11.4
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 +7 -7
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +1 -1
- package/lib/cjs/config.js.map +1 -1
- package/lib/esm/config.d.ts +7 -7
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +1 -1
- package/lib/esm/config.js.map +1 -1
- package/package.json +3 -3
package/lib/cjs/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event, Config as IConfig, Logger as ILogger,
|
|
1
|
+
import { Event, Config as IConfig, Logger as ILogger, LogLevel, Storage, Transport, Plan, IngestionMetadata, ServerZone, Options } from '@amplitude/analytics-types';
|
|
2
2
|
import { Logger } from './logger';
|
|
3
3
|
export declare const getDefaultConfig: () => {
|
|
4
4
|
flushMaxRetries: number;
|
|
@@ -22,21 +22,21 @@ export declare class Config implements IConfig {
|
|
|
22
22
|
plan?: Plan;
|
|
23
23
|
ingestionMetadata?: IngestionMetadata;
|
|
24
24
|
serverUrl: string | undefined;
|
|
25
|
-
serverZone?: ServerZone;
|
|
25
|
+
serverZone?: keyof typeof ServerZone;
|
|
26
26
|
transportProvider: Transport;
|
|
27
27
|
storageProvider?: Storage<Event[]>;
|
|
28
28
|
useBatch: boolean;
|
|
29
|
-
|
|
29
|
+
protected _optOut: boolean;
|
|
30
30
|
get optOut(): boolean;
|
|
31
31
|
set optOut(optOut: boolean);
|
|
32
|
-
constructor(options:
|
|
32
|
+
constructor(options: Options);
|
|
33
33
|
}
|
|
34
|
-
export declare const getServerUrl: (serverZone: ServerZone, useBatch: boolean) => "https://api2.amplitude.com/2/httpapi" | "https://api.eu.amplitude.com/2/httpapi" | "https://api2.amplitude.com/batch" | "https://api.eu.amplitude.com/batch";
|
|
35
|
-
export declare const createServerConfig: (serverUrl?: string, serverZone?: ServerZone, useBatch?: boolean) => {
|
|
34
|
+
export declare const getServerUrl: (serverZone: keyof typeof ServerZone, useBatch: boolean) => "https://api2.amplitude.com/2/httpapi" | "https://api.eu.amplitude.com/2/httpapi" | "https://api2.amplitude.com/batch" | "https://api.eu.amplitude.com/batch";
|
|
35
|
+
export declare const createServerConfig: (serverUrl?: string, serverZone?: keyof typeof ServerZone, useBatch?: boolean) => {
|
|
36
36
|
serverUrl: string;
|
|
37
37
|
serverZone: undefined;
|
|
38
38
|
} | {
|
|
39
|
-
serverZone: ServerZone;
|
|
39
|
+
serverZone: ServerZone | "US" | "EU";
|
|
40
40
|
serverUrl: string;
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=config.d.ts.map
|
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,EACL,KAAK,EACL,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,QAAQ,EACR,OAAO,EACP,SAAS,EACT,IAAI,EACJ,iBAAiB,EACjB,UAAU,EACV,OAAO,EACR,MAAM,4BAA4B,CAAC;AAQpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,gBAAgB;;;;;;;;;;CAU3B,CAAC;AAEH,qBAAa,MAAO,YAAW,OAAO;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACrC,iBAAiB,EAAE,SAAS,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,OAAO,UAAS;IAC1B,IAAI,MAAM,IAGS,OAAO,CADzB;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAEzB;gBAEW,OAAO,EAAE,OAAO;CAuB7B;AAED,eAAO,MAAM,YAAY,eAAgB,MAAM,iBAAiB,YAAY,OAAO,kKAKlF,CAAC;AAEF,eAAO,MAAM,kBAAkB,oCAEjB,MAAM,iBAAiB,aACzB,OAAO;;;;;;CAUlB,CAAC"}
|
package/lib/cjs/config.js
CHANGED
|
@@ -67,7 +67,7 @@ var createServerConfig = function (serverUrl, serverZone, useBatch) {
|
|
|
67
67
|
if (serverUrl) {
|
|
68
68
|
return { serverUrl: serverUrl, serverZone: undefined };
|
|
69
69
|
}
|
|
70
|
-
var _serverZone = [
|
|
70
|
+
var _serverZone = ['US', 'EU'].includes(serverZone) ? serverZone : (0, exports.getDefaultConfig)().serverZone;
|
|
71
71
|
return {
|
|
72
72
|
serverZone: _serverZone,
|
|
73
73
|
serverUrl: (0, exports.getServerUrl)(_serverZone, useBatch),
|
package/lib/cjs/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;AAAA,8DAWoC;AACpC,yCAKqB;AAErB,mCAAkC;AAE3B,IAAM,gBAAgB,GAAG,cAAM,OAAA,CAAC;IACrC,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,GAAG;IACnB,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;AA/CY,wBAAM;AAiDZ,IAAM,YAAY,GAAG,UAAC,UAAmC,EAAE,QAAiB;IACjF,IAAI,UAAU,KAAK,4BAAU,CAAC,EAAE,EAAE;QAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,yCAA6B,CAAC,CAAC,CAAC,mCAAuB,CAAC;KAC3E;IACD,OAAO,QAAQ,CAAC,CAAC,CAAC,sCAA0B,CAAC,CAAC,CAAC,gCAAoB,CAAC;AACtE,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEK,IAAM,kBAAkB,GAAG,UAChC,SAAc,EACd,UAAmE,EACnE,QAA+C;IAF/C,0BAAA,EAAA,cAAc;IACd,2BAAA,EAAA,aAAsC,IAAA,wBAAgB,GAAE,CAAC,UAAU;IACnE,yBAAA,EAAA,WAAoB,IAAA,wBAAgB,GAAE,CAAC,QAAQ;IAE/C,IAAI,SAAS,EAAE;QACb,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;KAC7C;IACD,IAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,wBAAgB,GAAE,CAAC,UAAU,CAAC;IACnG,OAAO;QACL,UAAU,EAAE,WAAW;QACvB,SAAS,EAAE,IAAA,oBAAY,EAAC,WAAW,EAAE,QAAQ,CAAC;KAC/C,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,kBAAkB,sBAa7B","sourcesContent":["import {\n Event,\n Config as IConfig,\n Logger as ILogger,\n LogLevel,\n Storage,\n Transport,\n Plan,\n IngestionMetadata,\n ServerZone,\n Options,\n} from '@amplitude/analytics-types';\nimport {\n AMPLITUDE_SERVER_URL,\n AMPLITUDE_BATCH_SERVER_URL,\n EU_AMPLITUDE_SERVER_URL,\n EU_AMPLITUDE_BATCH_SERVER_URL,\n} from './constants';\n\nimport { Logger } from './logger';\n\nexport const getDefaultConfig = () => ({\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 10000,\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false,\n});\n\nexport class Config implements IConfig {\n apiKey: string;\n flushIntervalMillis: number;\n flushMaxRetries: number;\n flushQueueSize: number;\n loggerProvider: ILogger;\n logLevel: LogLevel;\n minIdLength?: number;\n plan?: Plan;\n ingestionMetadata?: IngestionMetadata;\n serverUrl: string | undefined;\n serverZone?: keyof typeof ServerZone;\n transportProvider: Transport;\n storageProvider?: Storage<Event[]>;\n useBatch: boolean;\n\n protected _optOut = false;\n get optOut() {\n return this._optOut;\n }\n set optOut(optOut: boolean) {\n this._optOut = optOut;\n }\n\n constructor(options: Options) {\n const defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = options.flushIntervalMillis || defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = options.logLevel ?? defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = options.optOut ?? defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = options.useBatch ?? defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n\n const serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n}\n\nexport const getServerUrl = (serverZone: keyof typeof ServerZone, useBatch: boolean) => {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n};\n\nexport const createServerConfig = (\n serverUrl = '',\n serverZone: keyof typeof ServerZone = getDefaultConfig().serverZone,\n useBatch: boolean = getDefaultConfig().useBatch,\n) => {\n if (serverUrl) {\n return { serverUrl, serverZone: undefined };\n }\n const _serverZone = ['US', 'EU'].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch),\n };\n};\n"]}
|
package/lib/esm/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event, Config as IConfig, Logger as ILogger,
|
|
1
|
+
import { Event, Config as IConfig, Logger as ILogger, LogLevel, Storage, Transport, Plan, IngestionMetadata, ServerZone, Options } from '@amplitude/analytics-types';
|
|
2
2
|
import { Logger } from './logger';
|
|
3
3
|
export declare const getDefaultConfig: () => {
|
|
4
4
|
flushMaxRetries: number;
|
|
@@ -22,21 +22,21 @@ export declare class Config implements IConfig {
|
|
|
22
22
|
plan?: Plan;
|
|
23
23
|
ingestionMetadata?: IngestionMetadata;
|
|
24
24
|
serverUrl: string | undefined;
|
|
25
|
-
serverZone?: ServerZone;
|
|
25
|
+
serverZone?: keyof typeof ServerZone;
|
|
26
26
|
transportProvider: Transport;
|
|
27
27
|
storageProvider?: Storage<Event[]>;
|
|
28
28
|
useBatch: boolean;
|
|
29
|
-
|
|
29
|
+
protected _optOut: boolean;
|
|
30
30
|
get optOut(): boolean;
|
|
31
31
|
set optOut(optOut: boolean);
|
|
32
|
-
constructor(options:
|
|
32
|
+
constructor(options: Options);
|
|
33
33
|
}
|
|
34
|
-
export declare const getServerUrl: (serverZone: ServerZone, useBatch: boolean) => "https://api2.amplitude.com/2/httpapi" | "https://api.eu.amplitude.com/2/httpapi" | "https://api2.amplitude.com/batch" | "https://api.eu.amplitude.com/batch";
|
|
35
|
-
export declare const createServerConfig: (serverUrl?: string, serverZone?: ServerZone, useBatch?: boolean) => {
|
|
34
|
+
export declare const getServerUrl: (serverZone: keyof typeof ServerZone, useBatch: boolean) => "https://api2.amplitude.com/2/httpapi" | "https://api.eu.amplitude.com/2/httpapi" | "https://api2.amplitude.com/batch" | "https://api.eu.amplitude.com/batch";
|
|
35
|
+
export declare const createServerConfig: (serverUrl?: string, serverZone?: keyof typeof ServerZone, useBatch?: boolean) => {
|
|
36
36
|
serverUrl: string;
|
|
37
37
|
serverZone: undefined;
|
|
38
38
|
} | {
|
|
39
|
-
serverZone: ServerZone;
|
|
39
|
+
serverZone: ServerZone | "US" | "EU";
|
|
40
40
|
serverUrl: string;
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=config.d.ts.map
|
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,EACL,KAAK,EACL,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,QAAQ,EACR,OAAO,EACP,SAAS,EACT,IAAI,EACJ,iBAAiB,EACjB,UAAU,EACV,OAAO,EACR,MAAM,4BAA4B,CAAC;AAQpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,gBAAgB;;;;;;;;;;CAU3B,CAAC;AAEH,qBAAa,MAAO,YAAW,OAAO;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACrC,iBAAiB,EAAE,SAAS,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,OAAO,UAAS;IAC1B,IAAI,MAAM,IAGS,OAAO,CADzB;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAEzB;gBAEW,OAAO,EAAE,OAAO;CAuB7B;AAED,eAAO,MAAM,YAAY,eAAgB,MAAM,iBAAiB,YAAY,OAAO,kKAKlF,CAAC;AAEF,eAAO,MAAM,kBAAkB,oCAEjB,MAAM,iBAAiB,aACzB,OAAO;;;;;;CAUlB,CAAC"}
|
package/lib/esm/config.js
CHANGED
|
@@ -63,7 +63,7 @@ export var createServerConfig = function (serverUrl, serverZone, useBatch) {
|
|
|
63
63
|
if (serverUrl) {
|
|
64
64
|
return { serverUrl: serverUrl, serverZone: undefined };
|
|
65
65
|
}
|
|
66
|
-
var _serverZone = [
|
|
66
|
+
var _serverZone = ['US', 'EU'].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;
|
|
67
67
|
return {
|
|
68
68
|
serverZone: _serverZone,
|
|
69
69
|
serverUrl: getServerUrl(_serverZone, useBatch),
|
package/lib/esm/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,QA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AAC,oBAAoB,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAChC,SAAc,EACd,UAAmE,EACnE,QAA+C;IAF/C,0BAAA,EAAA,cAAc;IACd,2BAAA,EAAA,aAAsC,gBAAgB,EAAE,CAAC,UAAU;IACnE,yBAAA,EAAA,WAAoB,gBAAgB,EAAE,CAAC,QAAQ;IAE/C,IAAI,SAAS,EAAE;QACb,OAAO,EAAE,SAAS,WAAA,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;KAC7C;IACD,IAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,UAAU,CAAC;IACnG,OAAO;QACL,UAAU,EAAE,WAAW;QACvB,SAAS,EAAE,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;KAC/C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n Event,\n Config as IConfig,\n Logger as ILogger,\n LogLevel,\n Storage,\n Transport,\n Plan,\n IngestionMetadata,\n ServerZone,\n Options,\n} from '@amplitude/analytics-types';\nimport {\n AMPLITUDE_SERVER_URL,\n AMPLITUDE_BATCH_SERVER_URL,\n EU_AMPLITUDE_SERVER_URL,\n EU_AMPLITUDE_BATCH_SERVER_URL,\n} from './constants';\n\nimport { Logger } from './logger';\n\nexport const getDefaultConfig = () => ({\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 10000,\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false,\n});\n\nexport class Config implements IConfig {\n apiKey: string;\n flushIntervalMillis: number;\n flushMaxRetries: number;\n flushQueueSize: number;\n loggerProvider: ILogger;\n logLevel: LogLevel;\n minIdLength?: number;\n plan?: Plan;\n ingestionMetadata?: IngestionMetadata;\n serverUrl: string | undefined;\n serverZone?: keyof typeof ServerZone;\n transportProvider: Transport;\n storageProvider?: Storage<Event[]>;\n useBatch: boolean;\n\n protected _optOut = false;\n get optOut() {\n return this._optOut;\n }\n set optOut(optOut: boolean) {\n this._optOut = optOut;\n }\n\n constructor(options: Options) {\n const defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = options.flushIntervalMillis || defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = options.logLevel ?? defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = options.optOut ?? defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = options.useBatch ?? defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n\n const serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n}\n\nexport const getServerUrl = (serverZone: keyof typeof ServerZone, useBatch: boolean) => {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n};\n\nexport const createServerConfig = (\n serverUrl = '',\n serverZone: keyof typeof ServerZone = getDefaultConfig().serverZone,\n useBatch: boolean = getDefaultConfig().useBatch,\n) => {\n if (serverUrl) {\n return { serverUrl, serverZone: undefined };\n }\n const _serverZone = ['US', 'EU'].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch),\n };\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@amplitude/analytics-types": "^0.
|
|
37
|
+
"@amplitude/analytics-types": "^0.16.0",
|
|
38
38
|
"tslib": "^2.4.1"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"lib"
|
|
42
42
|
],
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e9b73ad53882d499ca14e3d53e8885825554d0d9"
|
|
44
44
|
}
|