@amplitude/analytics-core
Advanced tools
Comparing version 2.3.0 to 2.4.0-featureremoteconfig.0
@@ -1,2 +0,2 @@ | ||
import { Event, Config as IConfig, Logger as ILogger, LogLevel, Storage, Transport, Plan, IngestionMetadata, Options, ServerZoneType, OfflineDisabled } from '@amplitude/analytics-types'; | ||
import { Event, Config as IConfig, Logger as ILogger, LogLevel, Storage, Transport, Plan, IngestionMetadata, Options, ServerZoneType, OfflineDisabled, RequestMetadata as IRequestMetadata, HistogramOptions as IHistogramOptions, HistogramKey } from '@amplitude/analytics-types'; | ||
import { Logger } from './logger'; | ||
@@ -33,2 +33,3 @@ export declare const getDefaultConfig: () => { | ||
useBatch: boolean; | ||
requestMetadata?: RequestMetadata; | ||
protected _optOut: boolean; | ||
@@ -47,2 +48,15 @@ get optOut(): boolean; | ||
}; | ||
export declare class RequestMetadata implements IRequestMetadata { | ||
sdk: { | ||
metrics: { | ||
histogram: HistogramOptions; | ||
}; | ||
}; | ||
constructor(); | ||
recordHistogram<T extends HistogramKey>(key: T, value: HistogramOptions[T]): void; | ||
} | ||
declare class HistogramOptions implements IHistogramOptions { | ||
remote_config_fetch_time?: number; | ||
} | ||
export {}; | ||
//# sourceMappingURL=config.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createServerConfig = exports.getServerUrl = exports.Config = exports.getDefaultConfig = void 0; | ||
exports.RequestMetadata = exports.createServerConfig = exports.getServerUrl = exports.Config = exports.getDefaultConfig = void 0; | ||
var analytics_types_1 = require("@amplitude/analytics-types"); | ||
@@ -81,2 +81,21 @@ var constants_1 = require("./constants"); | ||
exports.createServerConfig = createServerConfig; | ||
var RequestMetadata = /** @class */ (function () { | ||
function RequestMetadata() { | ||
this.sdk = { | ||
metrics: { | ||
histogram: new HistogramOptions(), | ||
}, | ||
}; | ||
} | ||
RequestMetadata.prototype.recordHistogram = function (key, value) { | ||
this.sdk.metrics.histogram[key] = value; | ||
}; | ||
return RequestMetadata; | ||
}()); | ||
exports.RequestMetadata = RequestMetadata; | ||
var HistogramOptions = /** @class */ (function () { | ||
function HistogramOptions() { | ||
} | ||
return HistogramOptions; | ||
}()); | ||
//# sourceMappingURL=config.js.map |
@@ -5,3 +5,3 @@ export { AmplitudeCore } from './core-client'; | ||
export { Destination } from './plugins/destination'; | ||
export { Config } from './config'; | ||
export { Config, RequestMetadata } from './config'; | ||
export { Logger } from './logger'; | ||
@@ -8,0 +8,0 @@ export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './constants'; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createIdentifyEvent = exports.BaseTransport = exports.MemoryStorage = exports.UUID = exports.getClientStates = exports.getClientLogConfig = exports.debugWrapper = exports.returnWrapper = exports.STORAGE_PREFIX = exports.AMPLITUDE_PREFIX = exports.Logger = exports.Config = exports.Destination = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0; | ||
exports.createIdentifyEvent = exports.BaseTransport = exports.MemoryStorage = exports.UUID = exports.getClientStates = exports.getClientLogConfig = exports.debugWrapper = exports.returnWrapper = exports.STORAGE_PREFIX = exports.AMPLITUDE_PREFIX = exports.Logger = exports.RequestMetadata = exports.Config = exports.Destination = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0; | ||
var core_client_1 = require("./core-client"); | ||
@@ -13,2 +13,3 @@ Object.defineProperty(exports, "AmplitudeCore", { enumerable: true, get: function () { return core_client_1.AmplitudeCore; } }); | ||
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } }); | ||
Object.defineProperty(exports, "RequestMetadata", { enumerable: true, get: function () { return config_1.RequestMetadata; } }); | ||
var logger_1 = require("./logger"); | ||
@@ -15,0 +16,0 @@ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } }); |
@@ -178,3 +178,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
client_upload_time: new Date().toISOString(), | ||
request_metadata: this.config.requestMetadata, | ||
}; | ||
this.config.requestMetadata = new config_1.RequestMetadata(); | ||
_a.label = 1; | ||
@@ -181,0 +183,0 @@ case 1: |
@@ -17,12 +17,20 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
Timeline.prototype.register = function (plugin, config) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
return tslib_1.__generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
plugin.name = (_a = plugin.name) !== null && _a !== void 0 ? _a : (0, uuid_1.UUID)(); | ||
plugin.type = (_b = plugin.type) !== null && _b !== void 0 ? _b : 'enrichment'; | ||
return [4 /*yield*/, ((_c = plugin.setup) === null || _c === void 0 ? void 0 : _c.call(plugin, config, this.client))]; | ||
if (this.plugins.some(function (existingPlugin) { return existingPlugin.name === plugin.name; })) { | ||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
config.loggerProvider.warn("Plugin with name ".concat(plugin.name, " already exists, skipping registration")); | ||
return [2 /*return*/]; | ||
} | ||
if (plugin.name === undefined) { | ||
plugin.name = (0, uuid_1.UUID)(); | ||
config.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(plugin.name, ". \n Set a name for the plugin to prevent it from being added multiple times.")); | ||
} | ||
plugin.type = (_a = plugin.type) !== null && _a !== void 0 ? _a : 'enrichment'; | ||
return [4 /*yield*/, ((_b = plugin.setup) === null || _b === void 0 ? void 0 : _b.call(plugin, config, this.client))]; | ||
case 1: | ||
_d.sent(); | ||
_c.sent(); | ||
this.plugins.push(plugin); | ||
@@ -29,0 +37,0 @@ return [2 /*return*/]; |
@@ -1,2 +0,2 @@ | ||
import { Event, Config as IConfig, Logger as ILogger, LogLevel, Storage, Transport, Plan, IngestionMetadata, Options, ServerZoneType, OfflineDisabled } from '@amplitude/analytics-types'; | ||
import { Event, Config as IConfig, Logger as ILogger, LogLevel, Storage, Transport, Plan, IngestionMetadata, Options, ServerZoneType, OfflineDisabled, RequestMetadata as IRequestMetadata, HistogramOptions as IHistogramOptions, HistogramKey } from '@amplitude/analytics-types'; | ||
import { Logger } from './logger'; | ||
@@ -33,2 +33,3 @@ export declare const getDefaultConfig: () => { | ||
useBatch: boolean; | ||
requestMetadata?: RequestMetadata; | ||
protected _optOut: boolean; | ||
@@ -47,2 +48,15 @@ get optOut(): boolean; | ||
}; | ||
export declare class RequestMetadata implements IRequestMetadata { | ||
sdk: { | ||
metrics: { | ||
histogram: HistogramOptions; | ||
}; | ||
}; | ||
constructor(); | ||
recordHistogram<T extends HistogramKey>(key: T, value: HistogramOptions[T]): void; | ||
} | ||
declare class HistogramOptions implements IHistogramOptions { | ||
remote_config_fetch_time?: number; | ||
} | ||
export {}; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -76,2 +76,21 @@ import { LogLevel, } from '@amplitude/analytics-types'; | ||
}; | ||
var RequestMetadata = /** @class */ (function () { | ||
function RequestMetadata() { | ||
this.sdk = { | ||
metrics: { | ||
histogram: new HistogramOptions(), | ||
}, | ||
}; | ||
} | ||
RequestMetadata.prototype.recordHistogram = function (key, value) { | ||
this.sdk.metrics.histogram[key] = value; | ||
}; | ||
return RequestMetadata; | ||
}()); | ||
export { RequestMetadata }; | ||
var HistogramOptions = /** @class */ (function () { | ||
function HistogramOptions() { | ||
} | ||
return HistogramOptions; | ||
}()); | ||
//# sourceMappingURL=config.js.map |
@@ -5,3 +5,3 @@ export { AmplitudeCore } from './core-client'; | ||
export { Destination } from './plugins/destination'; | ||
export { Config } from './config'; | ||
export { Config, RequestMetadata } from './config'; | ||
export { Logger } from './logger'; | ||
@@ -8,0 +8,0 @@ export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './constants'; |
@@ -5,3 +5,3 @@ export { AmplitudeCore } from './core-client'; | ||
export { Destination } from './plugins/destination'; | ||
export { Config } from './config'; | ||
export { Config, RequestMetadata } from './config'; | ||
export { Logger } from './logger'; | ||
@@ -8,0 +8,0 @@ export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './constants'; |
@@ -7,3 +7,3 @@ import { __awaiter, __generator, __read, __rest, __spreadArray } from "tslib"; | ||
import { buildResult } from '../utils/result-builder'; | ||
import { createServerConfig } from '../config'; | ||
import { createServerConfig, RequestMetadata } from '../config'; | ||
import { UUID } from '../utils/uuid'; | ||
@@ -176,3 +176,5 @@ function getErrorMessage(error) { | ||
client_upload_time: new Date().toISOString(), | ||
request_metadata: this.config.requestMetadata, | ||
}; | ||
this.config.requestMetadata = new RequestMetadata(); | ||
_a.label = 1; | ||
@@ -179,0 +181,0 @@ case 1: |
@@ -15,12 +15,20 @@ import { __assign, __awaiter, __generator, __read, __values } from "tslib"; | ||
Timeline.prototype.register = function (plugin, config) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
plugin.name = (_a = plugin.name) !== null && _a !== void 0 ? _a : UUID(); | ||
plugin.type = (_b = plugin.type) !== null && _b !== void 0 ? _b : 'enrichment'; | ||
return [4 /*yield*/, ((_c = plugin.setup) === null || _c === void 0 ? void 0 : _c.call(plugin, config, this.client))]; | ||
if (this.plugins.some(function (existingPlugin) { return existingPlugin.name === plugin.name; })) { | ||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
config.loggerProvider.warn("Plugin with name ".concat(plugin.name, " already exists, skipping registration")); | ||
return [2 /*return*/]; | ||
} | ||
if (plugin.name === undefined) { | ||
plugin.name = UUID(); | ||
config.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(plugin.name, ". \n Set a name for the plugin to prevent it from being added multiple times.")); | ||
} | ||
plugin.type = (_a = plugin.type) !== null && _a !== void 0 ? _a : 'enrichment'; | ||
return [4 /*yield*/, ((_b = plugin.setup) === null || _b === void 0 ? void 0 : _b.call(plugin, config, this.client))]; | ||
case 1: | ||
_d.sent(); | ||
_c.sent(); | ||
this.plugins.push(plugin); | ||
@@ -27,0 +35,0 @@ return [2 /*return*/]; |
{ | ||
"name": "@amplitude/analytics-core", | ||
"version": "2.3.0", | ||
"version": "2.4.0-featureremoteconfig.0", | ||
"description": "", | ||
@@ -38,3 +38,3 @@ "author": "Amplitude Inc", | ||
"dependencies": { | ||
"@amplitude/analytics-types": "^2.6.0", | ||
"@amplitude/analytics-types": "^2.7.0-featureremoteconfig.0", | ||
"tslib": "^2.4.1" | ||
@@ -45,3 +45,3 @@ }, | ||
], | ||
"gitHead": "79b78f3a3c810012825defd513488bdf3390ac0c" | ||
"gitHead": "bb0d8e6aadf87baa76ba5b1c3a7268d13d1d2978" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
390447
3804
1