Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
registerGlobalDecorators(confObject) {
const decorators = Reflect.get(confObject, 'decorators') || []
this.registerDecorators(GLOBAL_NAMESPACE_DECORATOR, decorators)
}
registerServices(confObject) {
const services = Reflect.get(confObject, 'services') || {}
for (let alias in services) {
const service = Reflect.get(services[alias], 'service')
const args = Reflect.get(services[alias], 'arguments') || []
const tags = Reflect.get(services[alias], 'tags') || []
const decorators = Reflect.get(services[alias], 'decorators') || []
const listeners = Reflect.get(services[alias], 'listeners') || {}
const isSingleton = Reflect.get(services[alias], 'singleton') || false
this.container.addService(alias, service, args, isSingleton)
this.registerTags(alias, tags, this.container.getConfigValue('serviceDelimiter'))
this.registerListeners(alias, listeners)
this.registerDecorators(alias, decorators)
}
}
registerServices(confObject) {
const services = Reflect.get(confObject, 'services') || {}
for (let alias in services) {
const service = Reflect.get(services[alias], 'service')
const args = Reflect.get(services[alias], 'arguments') || []
const tags = Reflect.get(services[alias], 'tags') || []
const decorators = Reflect.get(services[alias], 'decorators') || []
const listeners = Reflect.get(services[alias], 'listeners') || {}
const isSingleton = Reflect.get(services[alias], 'singleton') || false
this.container.addService(alias, service, args, isSingleton)
this.registerTags(alias, tags, this.container.getConfigValue('serviceDelimiter'))
this.registerListeners(alias, listeners)
this.registerDecorators(alias, decorators)
}
}
registerConfigValues(confObject) {
const values = Reflect.get(confObject, 'config') || {}
for (let key in values) {
this.container.addConfigValue(key, values[key])
}
}
find(alias) {
return Reflect.get(this.decorators, alias) || []
}
registerServices(confObject) {
const services = Reflect.get(confObject, 'services') || {}
for (let alias in services) {
const service = Reflect.get(services[alias], 'service')
const args = Reflect.get(services[alias], 'arguments') || []
const tags = Reflect.get(services[alias], 'tags') || []
const decorators = Reflect.get(services[alias], 'decorators') || []
const listeners = Reflect.get(services[alias], 'listeners') || {}
const isSingleton = Reflect.get(services[alias], 'singleton') || false
this.container.addService(alias, service, args, isSingleton)
this.registerTags(alias, tags, this.container.getConfigValue('serviceDelimiter'))
this.registerListeners(alias, listeners)
this.registerDecorators(alias, decorators)
}
}
const registerServices = (services, flask) => {
for (let alias in services) {
const service = Reflect.get(services[alias], 'service')
const args = Reflect.get(services[alias], 'arguments') || []
const tags = Reflect.get(services[alias], 'tags') || []
const decorators = Reflect.get(services[alias], 'decorators') || []
const listeners = Reflect.get(services[alias], 'listeners') || {}
const isSingleton = Reflect.get(services[alias], 'singleton') || false
isSingleton === true
? flask.singleton(alias, service, args)
: flask.service(alias, service, args)
registerTags(alias, tags, flask)
registerDecorators(alias, decorators, flask)
registerServiceListeners(alias, listeners, flask)
}
}
registerGlobalListeners(confObject) {
const listeners = Reflect.get(confObject, 'listeners') || {}
this.registerListeners(GLOBAL_NAMESPACE_LISTENERS, listeners)
}