@devcycle/js-client-sdk
Advanced tools
Comparing version 1.13.10 to 1.14.0
{ | ||
"name": "@devcycle/js-client-sdk", | ||
"version": "1.13.10", | ||
"version": "1.14.0", | ||
"description": "The Javascript Client SDK for DevCycle", | ||
@@ -14,16 +14,13 @@ "author": "", | ||
}, | ||
"main": "./src/index.js", | ||
"types": "./src/index.d.ts", | ||
"dependencies": { | ||
"@devcycle/types": "^1.2.0", | ||
"axios": "^1.0.0", | ||
"axios-retry": "^3.3.1", | ||
"lodash": "^4.17.21", | ||
"ua-parser-js": "^1.0.2", | ||
"uuid": "^8.3.2", | ||
"@devcycle/types": "1.1.16", | ||
"@nestjs/class-validator": "0.13.4", | ||
"class-transformer": "0.5.1", | ||
"iso-639-1": "2.1.13", | ||
"reflect-metadata": "0.1.13" | ||
"ua-parser-js": "^1.0.36", | ||
"uuid": "^8.3.2" | ||
}, | ||
"main": "./src/index.js", | ||
"types": "./src/index.d.ts" | ||
"type": "commonjs" | ||
} |
@@ -16,2 +16,3 @@ import { DVCFeatureSet, DevCycleOptions, DVCVariableSet, DVCVariableValue, DevCycleEvent, DevCycleUser, ErrorCallback, DVCFeature, VariableDefinitions } from './types'; | ||
deferInitialization: true; | ||
bootstrapConfig?: never; | ||
}; | ||
@@ -18,0 +19,0 @@ export declare const isDeferredOptions: (arg: DevCycleUser | DevCycleOptionsWithDeferredInitialization) => arg is DevCycleOptionsWithDeferredInitialization; |
@@ -100,7 +100,8 @@ "use strict"; | ||
this.user = new User_1.DVCPopulatedUser(initialUser, this.options, undefined, storedAnonymousId); | ||
return [4 /*yield*/, this.getConfigCache(this.user) | ||
// set up requestConsolidator and hook up callback methods | ||
]; | ||
if (!!this.options.bootstrapConfig) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, this.getConfigCache(this.user)]; | ||
case 2: | ||
_c.sent(); | ||
_c.label = 3; | ||
case 3: | ||
// set up requestConsolidator and hook up callback methods | ||
@@ -112,10 +113,15 @@ this.requestConsolidator = new ConfigRequestConsolidator_1.ConfigRequestConsolidator(function (user, extraParams) { | ||
}, this.user); | ||
_c.label = 3; | ||
case 3: | ||
_c.trys.push([3, 5, 6, 7]); | ||
_c.label = 4; | ||
case 4: | ||
_c.trys.push([4, 8, 9, 10]); | ||
if (!!this.options.bootstrapConfig) return [3 /*break*/, 6]; | ||
return [4 /*yield*/, this.requestConsolidator.queue(this.user)]; | ||
case 4: | ||
case 5: | ||
_c.sent(); | ||
return [3 /*break*/, 7]; | ||
case 5: | ||
case 6: | ||
this.handleConfigReceived(this.options.bootstrapConfig, this.user, Date.now()); | ||
_c.label = 7; | ||
case 7: return [3 /*break*/, 10]; | ||
case 8: | ||
err_1 = _c.sent(); | ||
@@ -125,9 +131,9 @@ this.eventEmitter.emitInitialized(false); | ||
return [2 /*return*/, this]; | ||
case 6: | ||
case 9: | ||
this.resolveOnInitialized(this); | ||
this.logger.info('Client initialized'); | ||
return [7 /*endfinally*/]; | ||
case 7: | ||
case 10: | ||
this.eventEmitter.emitInitialized(true); | ||
if (initialUser.isAnonymous) { | ||
if (this.user.isAnonymous) { | ||
this.store.saveAnonUserId(this.user.user_id); | ||
@@ -179,2 +185,5 @@ } | ||
} | ||
else if (this.options.bootstrapConfig) { | ||
throw new Error('bootstrapConfig option can not be combined with deferred initialization!'); | ||
} | ||
if (!(options === null || options === void 0 ? void 0 : options.reactNative) && typeof window !== 'undefined') { | ||
@@ -181,0 +190,0 @@ this.windowMessageHandler = function (event) { |
@@ -15,3 +15,3 @@ "use strict"; | ||
DVCLogLevels[DVCLogLevels["error"] = 3] = "error"; | ||
})(DVCLogLevels = exports.DVCLogLevels || (exports.DVCLogLevels = {})); | ||
})(DVCLogLevels || (exports.DVCLogLevels = DVCLogLevels = {})); | ||
function dvcDefaultLogger(options) { | ||
@@ -18,0 +18,0 @@ var minLevel = (options === null || options === void 0 ? void 0 : options.level) && (0, isNumber_1.default)(DVCLogLevels[options === null || options === void 0 ? void 0 : options.level]) |
@@ -1,2 +0,2 @@ | ||
import { DVCLogger, DVCDefaultLogLevel, VariableTypeAlias, VariableValue, DVCJSON, DVCCustomDataJSON } from '@devcycle/types'; | ||
import { DVCLogger, DVCDefaultLogLevel, VariableTypeAlias, VariableValue, DVCJSON, DVCCustomDataJSON, BucketedUserConfig } from '@devcycle/types'; | ||
export type DVCVariableValue = VariableValue; | ||
@@ -88,12 +88,18 @@ export type { DVCJSON, DVCCustomDataJSON }; | ||
maxEventQueueSize?: number; | ||
/** | ||
* A full configuration payload to boostrap the SDK with. This will immediately initialize the SDK with | ||
* the provided data and prevent a server roundtrip to fetch a new config. This option can be used for passing | ||
* in a config that was prefetched in a server-side rendered environment, or to implement a custom caching | ||
* system. | ||
*/ | ||
bootstrapConfig?: BucketedUserConfig; | ||
} | ||
export interface DevCycleUser { | ||
/** | ||
* Users must be explicitly defined as anonymous, where the SDK will | ||
* generate a random `user_id` for them. If they are `isAnonymous = false` | ||
* a `user_id` value must be provided. | ||
* If a user is anonymous a unique anonymous user id will be generated and stored in the cache. | ||
* If no user_id is provided, the user is assumed to be anonymous. | ||
*/ | ||
isAnonymous?: boolean; | ||
/** | ||
* Must be defined if `isAnonymous = false` | ||
* A unique user ID. If not provided, an anonymous user ID will be generated. | ||
*/ | ||
@@ -100,0 +106,0 @@ user_id?: string; |
@@ -16,2 +16,3 @@ import { DVCFeatureSet, DevCycleOptions, DVCVariableSet, DVCVariableValue, DevCycleEvent, DevCycleUser, ErrorCallback, DVCFeature, VariableDefinitions } from './types'; | ||
deferInitialization: true; | ||
bootstrapConfig?: never; | ||
}; | ||
@@ -18,0 +19,0 @@ export declare const isDeferredOptions: (arg: DevCycleUser | DevCycleOptionsWithDeferredInitialization) => arg is DevCycleOptionsWithDeferredInitialization; |
@@ -1,2 +0,2 @@ | ||
import { DVCLogger, DVCDefaultLogLevel, VariableTypeAlias, VariableValue, DVCJSON, DVCCustomDataJSON } from '@devcycle/types'; | ||
import { DVCLogger, DVCDefaultLogLevel, VariableTypeAlias, VariableValue, DVCJSON, DVCCustomDataJSON, BucketedUserConfig } from '@devcycle/types'; | ||
export type DVCVariableValue = VariableValue; | ||
@@ -88,12 +88,18 @@ export { DVCJSON, DVCCustomDataJSON }; | ||
maxEventQueueSize?: number; | ||
/** | ||
* A full configuration payload to boostrap the SDK with. This will immediately initialize the SDK with | ||
* the provided data and prevent a server roundtrip to fetch a new config. This option can be used for passing | ||
* in a config that was prefetched in a server-side rendered environment, or to implement a custom caching | ||
* system. | ||
*/ | ||
bootstrapConfig?: BucketedUserConfig; | ||
} | ||
export interface DevCycleUser { | ||
/** | ||
* Users must be explicitly defined as anonymous, where the SDK will | ||
* generate a random `user_id` for them. If they are `isAnonymous = false` | ||
* a `user_id` value must be provided. | ||
* If a user is anonymous a unique anonymous user id will be generated and stored in the cache. | ||
* If no user_id is provided, the user is assumed to be anonymous. | ||
*/ | ||
isAnonymous?: boolean; | ||
/** | ||
* Must be defined if `isAnonymous = false` | ||
* A unique user ID. If not provided, an anonymous user ID will be generated. | ||
*/ | ||
@@ -100,0 +106,0 @@ user_id?: string; |
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
271535
6
3289
+ Added@devcycle/types@1.20.0(transitive)
+ Added@types/validator@13.12.2(transitive)
+ Addedclass-validator@0.14.1(transitive)
+ Addediso-639-1@2.1.15(transitive)
+ Addedreflect-metadata@0.1.14(transitive)
- Removed@nestjs/class-validator@0.13.4
- Removedclass-transformer@0.5.1
- Removediso-639-1@2.1.13
- Removedreflect-metadata@0.1.13
- Removed@devcycle/types@1.1.16(transitive)
- Removed@nestjs/class-validator@0.13.4(transitive)
- Removediso-639-1@2.1.13(transitive)
- Removedreflect-metadata@0.1.13(transitive)
Updated@devcycle/types@^1.2.0
Updatedua-parser-js@^1.0.36