Comparing version 1.2.8 to 1.2.9
{ | ||
"name": "rox-base", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "Rollout.io ROX JS SDK Base", | ||
@@ -5,0 +5,0 @@ "author": "Rollout.io <support@rollout.io>", |
import { Configuration as configurationRepository, Flags as flagsRepository } from '../repositories'; | ||
const defaultOptions = { flagsRepository, configurationRepository }; | ||
export default class RoxClassRegister { | ||
constructor(options = {} ){ | ||
this.options = Object.assign({}, defaultOptions, options) | ||
this._flagsRepository = this.options.flagsRepository | ||
this._configurationRepository = this.options.configurationRepository | ||
constructor(options = {}) { | ||
this.options = Object.assign({}, defaultOptions, options); | ||
this._flagsRepository = this.options.flagsRepository; | ||
this._configurationRepository = this.options.configurationRepository; | ||
} | ||
handleContainer(baseName, container) { | ||
baseName = baseName.length > 0 ? baseName + '.' : '' | ||
for (let prop in container){ | ||
baseName = baseName.length > 0 ? baseName + '.' : ''; | ||
for (let prop in container) { | ||
if (container.hasOwnProperty(prop)) { | ||
let value = container[prop] | ||
if (value._entityType === 'flag' || | ||
value._entityType === 'variant'){ | ||
this._flagsRepository.addFlag(`${baseName}${prop}`, value); | ||
let entity = container[prop]; | ||
if (entity._entityType === 'flag' || entity._entityType === 'variant') { | ||
this._flagsRepository.addFlag(`${baseName}${prop}`, entity); | ||
} | ||
if (value._entityType === 'configuration'){ | ||
this._configurationRepository.addRemoteConfiguration(`${baseName}${prop}`, value); | ||
if (entity._entityType === 'configuration') { | ||
this._configurationRepository.addRemoteConfiguration(`${baseName}${prop}`, entity); | ||
} | ||
@@ -24,0 +22,0 @@ } |
@@ -14,3 +14,5 @@ import { CustomProperty } from '../entities'; | ||
let _deps = {}; | ||
let _deps = { | ||
ClassRegister | ||
}; | ||
const minimumIntervalInSec = 30; | ||
@@ -78,3 +80,3 @@ const disableIntervalTime = 0; | ||
useCache: false, | ||
shouldProcess: false | ||
shouldProcess: true | ||
}); | ||
@@ -97,3 +99,3 @@ } | ||
this.containers[name] = container; | ||
new ClassRegister().handleContainer(name, container); | ||
new _deps.ClassRegister().handleContainer(name, container); | ||
} | ||
@@ -109,8 +111,19 @@ | ||
unfreeze() { | ||
FlagsRepository.flags.forEach(flag => { | ||
unfreeze(namespace) { | ||
const namespaceFilter = flag => { | ||
if (!flag.name || typeof namespace !== 'string') return true; | ||
const flagNameParts = flag.name.split('.'); | ||
if (flagNameParts.length === 1 && namespace === '') { | ||
return true; | ||
} else if (flagNameParts.slice(0, flagNameParts.length - 1).join('.') === namespace) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
FlagsRepository.flags.filter(namespaceFilter).forEach(flag => { | ||
flag.unfreeze(); | ||
}); | ||
ConfigurationRepository.remoteConfigurations.forEach(remoteConfiguration => { | ||
ConfigurationRepository.remoteConfigurations.filter(namespaceFilter).forEach(remoteConfiguration => { | ||
remoteConfiguration.unfreeze(); | ||
@@ -148,4 +161,4 @@ }); | ||
export default function(deps = {}) { | ||
_deps = deps; | ||
_deps = Object.assign({}, _deps, deps); | ||
return instance; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1539069
10675
4
16