@amplitude/identity
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -5,3 +5,3 @@ import { Identity, IdentityListener } from '@amplitude/types'; | ||
private _userId; | ||
private _identityListeners; | ||
private readonly _identityListeners; | ||
static generateDefaultId: () => string; | ||
@@ -22,5 +22,5 @@ /** | ||
private _alertIdentityListeners; | ||
addIdentityListener(...listeners: Array<IdentityListener>): void; | ||
getIdentityListeners(): Array<IdentityListener>; | ||
addIdentityListener(...listeners: IdentityListener[]): void; | ||
getIdentityListeners(): IdentityListener[]; | ||
} | ||
//# sourceMappingURL=identity.d.ts.map |
import { Identity } from '@amplitude/types'; | ||
declare class IdentityManager { | ||
private _instanceMap; | ||
private readonly _instanceMap; | ||
getInstance(instanceName?: string, optionalFallbackIdentity?: Identity | null): Identity; | ||
@@ -5,0 +5,0 @@ /** |
@@ -15,3 +15,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var identity = this._instanceMap.get(instanceName); | ||
if (identity == undefined) { | ||
if (identity === undefined) { | ||
identity = optionalFallbackIdentity !== null ? optionalFallbackIdentity : new identity_1.DefaultIdentity(); | ||
@@ -29,7 +29,8 @@ this._instanceMap.set(instanceName, identity); | ||
var e_1, _a; | ||
var _b; | ||
if (instanceName === void 0) { instanceName = types_1.DEFAULT_IDENTITY_INSTANCE; } | ||
if (optionalNewIdentity === void 0) { optionalNewIdentity = null; } | ||
var oldIdentity = this._instanceMap.get(instanceName); | ||
var oldListeners = (oldIdentity === null || oldIdentity === void 0 ? void 0 : oldIdentity.getIdentityListeners()) || []; | ||
if (!oldIdentity) { | ||
var oldListeners = (_b = oldIdentity === null || oldIdentity === void 0 ? void 0 : oldIdentity.getIdentityListeners()) !== null && _b !== void 0 ? _b : []; | ||
if (oldIdentity === undefined) { | ||
utils_1.logger.warn("Did not find a identity to reset for " + instanceName); | ||
@@ -73,3 +74,3 @@ } | ||
exports.identityManager = identityManager; | ||
if (!identityManager) { | ||
if (identityManager === undefined) { | ||
exports.identityManager = identityManager = new IdentityManager(); | ||
@@ -76,0 +77,0 @@ globalNamespace.identityManager = identityManager; |
@@ -5,3 +5,3 @@ import { Identity, IdentityListener } from '@amplitude/types'; | ||
private _userId; | ||
private _identityListeners; | ||
private readonly _identityListeners; | ||
static generateDefaultId: () => string; | ||
@@ -22,5 +22,5 @@ /** | ||
private _alertIdentityListeners; | ||
addIdentityListener(...listeners: Array<IdentityListener>): void; | ||
getIdentityListeners(): Array<IdentityListener>; | ||
addIdentityListener(...listeners: IdentityListener[]): void; | ||
getIdentityListeners(): IdentityListener[]; | ||
} | ||
//# sourceMappingURL=identity.d.ts.map |
import { Identity } from '@amplitude/types'; | ||
declare class IdentityManager { | ||
private _instanceMap; | ||
private readonly _instanceMap; | ||
getInstance(instanceName?: string, optionalFallbackIdentity?: Identity | null): Identity; | ||
@@ -5,0 +5,0 @@ /** |
@@ -13,3 +13,3 @@ import { __read, __spread, __values } from "tslib"; | ||
var identity = this._instanceMap.get(instanceName); | ||
if (identity == undefined) { | ||
if (identity === undefined) { | ||
identity = optionalFallbackIdentity !== null ? optionalFallbackIdentity : new DefaultIdentity(); | ||
@@ -27,7 +27,8 @@ this._instanceMap.set(instanceName, identity); | ||
var e_1, _a; | ||
var _b; | ||
if (instanceName === void 0) { instanceName = DEFAULT_IDENTITY_INSTANCE; } | ||
if (optionalNewIdentity === void 0) { optionalNewIdentity = null; } | ||
var oldIdentity = this._instanceMap.get(instanceName); | ||
var oldListeners = (oldIdentity === null || oldIdentity === void 0 ? void 0 : oldIdentity.getIdentityListeners()) || []; | ||
if (!oldIdentity) { | ||
var oldListeners = (_b = oldIdentity === null || oldIdentity === void 0 ? void 0 : oldIdentity.getIdentityListeners()) !== null && _b !== void 0 ? _b : []; | ||
if (oldIdentity === undefined) { | ||
logger.warn("Did not find a identity to reset for " + instanceName); | ||
@@ -70,3 +71,3 @@ } | ||
var identityManager = globalNamespace.identityManager; | ||
if (!identityManager) { | ||
if (identityManager === undefined) { | ||
identityManager = new IdentityManager(); | ||
@@ -73,0 +74,0 @@ globalNamespace.identityManager = identityManager; |
{ | ||
"name": "@amplitude/identity", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Identity Manager for JS-based SDK's to help track device and user ID's", | ||
@@ -19,4 +19,6 @@ "repository": "git://github.com/amplitude/Amplitude-Node.git", | ||
"dependencies": { | ||
"@amplitude/types": "^1.0.4", | ||
"@amplitude/utils": "^1.0.4" | ||
"@amplitude/eslint-config-typescript": "^1.1.0", | ||
"@amplitude/types": "^1.1.0", | ||
"@amplitude/utils": "^1.1.0", | ||
"tslib": "^1.9.3" | ||
}, | ||
@@ -48,3 +50,3 @@ "devDependencies": { | ||
"sideEffects": false, | ||
"gitHead": "24c1bdd5219a6d2ef9f5c134f47c5322062f4047" | ||
"gitHead": "ea5ccaa5f17d29b47dd17a65e16da2fe154798f2" | ||
} |
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
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
45593
453
4
+ Addedtslib@^1.9.3
+ Added@amplitude/eslint-config-typescript@1.10.2(transitive)
+ Added@eslint-community/eslint-utils@4.4.1(transitive)
+ Added@eslint-community/regexpp@4.12.1(transitive)
+ Added@eslint/config-array@0.19.0(transitive)
+ Added@eslint/core@0.9.0(transitive)
+ Added@eslint/eslintrc@3.2.0(transitive)
+ Added@eslint/js@9.15.0(transitive)
+ Added@eslint/object-schema@2.1.4(transitive)
+ Added@eslint/plugin-kit@0.2.3(transitive)
+ Added@humanfs/core@0.19.1(transitive)
+ Added@humanfs/node@0.16.6(transitive)
+ Added@humanwhocodes/module-importer@1.0.1(transitive)
+ Added@humanwhocodes/retry@0.3.10.4.1(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedacorn-jsx@5.3.2(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedeslint@9.15.0(transitive)
+ Addedeslint-config-prettier@8.10.0(transitive)
+ Addedeslint-scope@8.2.0(transitive)
+ Addedeslint-visitor-keys@3.4.34.2.0(transitive)
+ Addedespree@10.3.0(transitive)
+ Addedesquery@1.6.0(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@5.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfile-entry-cache@8.0.0(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedflat-cache@4.0.1(transitive)
+ Addedflatted@3.3.2(transitive)
+ Addedglob-parent@6.0.2(transitive)
+ Addedglobals@14.0.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stable-stringify-without-jsonify@1.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlevn@0.4.1(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedms@2.1.3(transitive)
+ Addednatural-compare@1.4.0(transitive)
+ Addedoptionator@0.9.4(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedprelude-ls@1.2.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedtype-check@0.4.0(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedyocto-queue@0.1.0(transitive)
Updated@amplitude/types@^1.1.0
Updated@amplitude/utils@^1.1.0