adonis-fold
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "adonis-fold", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Fold is an IOC container with solid DI layer for node js applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
'use strict' | ||
/** | ||
* @module ImplementationException | ||
* @description makes a new implementation error | ||
*/ | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
class ImplementationException extends Error { | ||
@@ -8,0 +10,0 @@ constructor (message) { |
'use strict' | ||
/** | ||
* @module LoaderException | ||
* @description makes a new exception if | ||
* dependency is missing. | ||
*/ | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
class LoaderException extends Error { | ||
@@ -9,0 +10,0 @@ |
'use strict' | ||
/** | ||
* @module MakeException | ||
* @description makes a new exception there is an error | ||
* while making classes. | ||
*/ | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
class MakeException extends Error { | ||
@@ -9,0 +10,0 @@ |
'use strict' | ||
/** | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
const _ = require('lodash') | ||
@@ -8,2 +14,8 @@ const ImplementationException = require('../Exception/implementation') | ||
/** | ||
* holding injections asked by a provider class | ||
* using static inject getter. | ||
* @type {Array} | ||
* @private | ||
*/ | ||
let staticInjections = [] | ||
@@ -14,3 +26,2 @@ | ||
* @description Helpers for Ioc container | ||
* @private | ||
*/ | ||
@@ -20,3 +31,3 @@ let IocHelpers = exports = module.exports = {} | ||
/** | ||
* @function is_verified_as_binding | ||
* @function isVerifiedAsBinding | ||
* @description here we verify a provider is using correct | ||
@@ -27,4 +38,5 @@ * interface to be registered. | ||
* @return {Boolean} | ||
* @public | ||
*/ | ||
IocHelpers.is_verified_as_binding = function (binding, bindingModule) { | ||
IocHelpers.isVerifiedAsBinding = function (binding, bindingModule) { | ||
if (!bindingModule.closure || typeof (bindingModule.closure) !== 'function') { | ||
@@ -38,3 +50,3 @@ throw new ImplementationException(`Invalid Service provider implementation . ${binding} should return a closure`) | ||
/** | ||
* @function inject_type_hinted_injections | ||
* @function injectTypeHintedInjections | ||
* @description return bindings required by a service provider | ||
@@ -44,4 +56,5 @@ * @param {Object} bindings | ||
* @return {Array} | ||
* @public | ||
*/ | ||
IocHelpers.inject_type_hinted_injections = function (bindings, bindingModule) { | ||
IocHelpers.injectTypeHintedInjections = function (bindings, bindingModule) { | ||
return _.pick(bindings, bindingModule.injections) | ||
@@ -51,3 +64,3 @@ } | ||
/** | ||
* @function register_provider | ||
* @function registerProvider | ||
* @description Here we register and resolve a provider to | ||
@@ -57,4 +70,5 @@ * the ioc container. | ||
* @return {Promise<fulfilled>} | ||
* @public | ||
*/ | ||
IocHelpers.register_provider = function (Provider) { | ||
IocHelpers.registerProvider = function (Provider) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -76,6 +90,6 @@ if (Provider.inject) { | ||
/** | ||
* @function bind_provider | ||
* @function bindProvider | ||
* @description constructors provider defination as an object | ||
* @param {Object} resolved_providers | ||
* @param {Object} unresolved_providers | ||
* @param {Object} resolvedProviders | ||
* @param {Object} unResolvedProviders | ||
* @param {String} binding | ||
@@ -85,8 +99,9 @@ * @param {Function} closure | ||
* @return {Object} | ||
* @public | ||
*/ | ||
IocHelpers.bind_provider = function (resolved_providers, unresolved_providers, binding, closure, singleton) { | ||
IocHelpers.bindProvider = function (resolvedProviders, unResolvedProviders, binding, closure, singleton) { | ||
// removing from unresolved if it was | ||
// deferred. | ||
if (unresolved_providers[binding]) { | ||
delete unresolved_providers[binding] | ||
if (unResolvedProviders[binding]) { | ||
delete unResolvedProviders[binding] | ||
} | ||
@@ -96,3 +111,3 @@ | ||
// does not returns a closure. | ||
IocHelpers.is_verified_as_binding(binding, {closure}) | ||
IocHelpers.isVerifiedAsBinding(binding, {closure}) | ||
@@ -112,3 +127,3 @@ // introspecting injections or use static injections , if there | ||
// adding to resolved providers | ||
resolved_providers[binding] = {closure, injections, singleton} | ||
resolvedProviders[binding] = {closure, injections, singleton} | ||
} |
'use strict' | ||
/** | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
const Loader = require('../Loader/index') | ||
@@ -20,5 +26,5 @@ const introspect = require('../../utils/introspect') | ||
| | ||
| 1. resolved_providers - Providers which have been registered and | ||
| 1. resolveProviders - Providers which have been registered and | ||
| resolved on boot cycle. | ||
| 2. unresolved_providers - Providers which are deferred and only | ||
| 2. unResolveProviders - Providers which are deferred and only | ||
| registered on boot cycle and will be resolved on demand. | ||
@@ -31,5 +37,29 @@ | 3. dump - Dump is a map of autoload directory and will be | ||
*/ | ||
let resolved_providers = {} | ||
let unresolved_providers = {} | ||
/** | ||
* reference to resolved providers | ||
* @type {Object} | ||
* @private | ||
*/ | ||
let resolveProviders = {} | ||
/** | ||
* reference to deferred providers | ||
* @type {Object} | ||
* @private | ||
*/ | ||
let unResolveProviders = {} | ||
/** | ||
* namespace aliases | ||
* @type {Object} | ||
* @private | ||
*/ | ||
let aliases = {} | ||
/** | ||
* reference to autoload dump | ||
* @type {Object} | ||
* @private | ||
*/ | ||
let dump = {} | ||
@@ -58,11 +88,21 @@ | ||
* @return {void} | ||
* @public | ||
*/ | ||
Ioc.bind = function (binding, closure) { | ||
const singleton = false | ||
helpers.bind_provider(resolved_providers, unresolved_providers, binding, closure, singleton) | ||
helpers.bindProvider(resolveProviders, unResolveProviders, binding, closure, singleton) | ||
} | ||
/** | ||
* @function bind | ||
* @description bind a provider to application as singleton | ||
* @param {String} binding binding namespace , have to be unique | ||
* @param {Function} closure closure to be executed while resolving | ||
* provider | ||
* @return {void} | ||
* @public | ||
*/ | ||
Ioc.singleton = function (binding, closure) { | ||
const singleton = true | ||
helpers.bind_provider(resolved_providers, unresolved_providers, binding, closure, singleton) | ||
helpers.bindProvider(resolveProviders, unResolveProviders, binding, closure, singleton) | ||
} | ||
@@ -74,7 +114,8 @@ | ||
* @return {void} | ||
* @public | ||
*/ | ||
Ioc.clear = function () { | ||
resolved_providers = {} | ||
resolveProviders = {} | ||
aliases = {} | ||
unresolved_providers = {} | ||
unResolveProviders = {} | ||
dump = {} | ||
@@ -87,5 +128,6 @@ } | ||
* @return {Object} | ||
* @public | ||
*/ | ||
Ioc.getResolvedProviders = function () { | ||
return resolved_providers | ||
return resolveProviders | ||
} | ||
@@ -97,5 +139,6 @@ | ||
* @return {Object} | ||
* @public | ||
*/ | ||
Ioc.getUnResolvedProviders = function () { | ||
return unresolved_providers | ||
return unResolveProviders | ||
} | ||
@@ -109,2 +152,3 @@ | ||
* @return {void} | ||
* @public | ||
*/ | ||
@@ -123,2 +167,3 @@ Ioc.aliases = function (hash) { | ||
* @return {void} | ||
* @public | ||
*/ | ||
@@ -135,5 +180,6 @@ Ioc.alias = function (key, namespace) { | ||
* @return {void} | ||
* @public | ||
*/ | ||
Ioc.later = function (provides, klass) { | ||
unresolved_providers[provides] = klass | ||
unResolveProviders[provides] = klass | ||
} | ||
@@ -148,2 +194,3 @@ | ||
* @return {void} | ||
* @public | ||
*/ | ||
@@ -160,2 +207,3 @@ Ioc.dump = function (key, path) { | ||
* @return {*} | ||
* @public | ||
*/ | ||
@@ -165,3 +213,3 @@ Ioc.use = function (binding) { | ||
// it can be a PROVIDER, UNRESOLVED_PROVIDER, NPM_MODULE,LOCAL_MODULE | ||
const type = Loader.return_injection_type(resolved_providers, unresolved_providers, aliases, dump, binding) | ||
const type = Loader.returnInjectionType(resolveProviders, unResolveProviders, aliases, dump, binding) | ||
@@ -174,7 +222,7 @@ // if looking for unresolved provider , send them back with an error | ||
// here we grab that binding using it's type | ||
const bindingModule = Loader.resolve_using_type(resolved_providers, unresolved_providers, aliases, dump, binding, type) | ||
const bindingModule = Loader.resolveUsingType(resolveProviders, unResolveProviders, aliases, dump, binding, type) | ||
// if i am resolved provider than make me before returning | ||
if (type === 'PROVIDER' && helpers.is_verified_as_binding(binding, bindingModule)) { | ||
let injections = helpers.inject_type_hinted_injections(resolved_providers, bindingModule) | ||
if (type === 'PROVIDER' && helpers.isVerifiedAsBinding(binding, bindingModule)) { | ||
let injections = helpers.injectTypeHintedInjections(resolveProviders, bindingModule) | ||
injections = _.map(injections, function (injection, index) { | ||
@@ -189,3 +237,13 @@ return Ioc.use(index) | ||
} | ||
return bindingModule.closure.apply(null, injections) | ||
let resolvedModule = bindingModule.closure.apply(null, injections) | ||
// hooks helps in transforming the return result | ||
// and return something else. | ||
// @use case - Lucid class for models | ||
if(resolvedModule.hooks){ | ||
_.each(resolvedModule.hooks, function (hook){ | ||
resolvedModule = resolvedModule[hook]() | ||
}) | ||
} | ||
return resolvedModule | ||
} | ||
@@ -221,2 +279,3 @@ | ||
* @return {*} | ||
* @public | ||
*/ | ||
@@ -236,3 +295,3 @@ Ioc.make = function (binding) { | ||
* a un resolved binding otherwise we replace it | ||
* with register_provider method | ||
* with registerProvider method | ||
*/ | ||
@@ -242,6 +301,6 @@ let registerPromise = new Promise(function (resolve) { resolve() }) | ||
if (typeof (binding) === 'string') { | ||
type = Loader.return_injection_type(resolved_providers, unresolved_providers, aliases, dump, binding) | ||
type = Loader.returnInjectionType(resolveProviders, unResolveProviders, aliases, dump, binding) | ||
if (type === 'UNRESOLVED_PROVIDER') { | ||
let provider = require(unresolved_providers[binding]) | ||
registerPromise = helpers.register_provider(provider) | ||
let provider = require(unResolveProviders[binding]) | ||
registerPromise = helpers.registerProvider(provider) | ||
} | ||
@@ -254,5 +313,5 @@ } | ||
case 'PROVIDER': | ||
return Ioc._makeProvider(resolved_providers[binding]) | ||
return Ioc._makeProvider(resolveProviders[binding]) | ||
case 'UNRESOLVED_PROVIDER': | ||
return Ioc._makeProvider(resolved_providers[binding]) | ||
return Ioc._makeProvider(resolveProviders[binding]) | ||
case 'NPM_MODULE': | ||
@@ -281,2 +340,3 @@ return new Promise(function (resolve) { resolve() }) | ||
* @return {Promise<pending>} | ||
* @public | ||
*/ | ||
@@ -299,2 +359,3 @@ Ioc._makeProvider = function (provider) { | ||
* @return {Promise<pending>} | ||
* @public | ||
*/ | ||
@@ -301,0 +362,0 @@ Ioc._makeClass = function (Binding) { |
'use strict' | ||
/** | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
const LoaderException = require('../Exception/loader') | ||
@@ -12,3 +18,2 @@ const walk = require('walk') | ||
* and resolving module based upon type | ||
* @author Harminder Virk | ||
*/ | ||
@@ -23,2 +28,3 @@ let Loader = exports = module.exports = {} | ||
* @return {*} | ||
* @public | ||
*/ | ||
@@ -40,2 +46,3 @@ Loader.require = function (module) { | ||
* @return {*} | ||
* @public | ||
*/ | ||
@@ -50,3 +57,3 @@ Loader.resolve = function (bindings, module) { | ||
/** | ||
* @function resolve_using_type | ||
* @function resolveUsingType | ||
* @description tries to resolve injection using it's type | ||
@@ -59,4 +66,5 @@ * or throws a custom exception | ||
* @return {*} | ||
* @public | ||
*/ | ||
Loader.resolve_using_type = function (bindings, unresolvedBindings, aliases, dump, injection, type) { | ||
Loader.resolveUsingType = function (bindings, unresolvedBindings, aliases, dump, injection, type) { | ||
let instance = null | ||
@@ -86,3 +94,3 @@ injection = aliases[injection] || injection | ||
/** | ||
* @function return_injection_type | ||
* @function returnInjectionType | ||
* @description Determines type of injection | ||
@@ -93,4 +101,5 @@ * @param {Object} bindings | ||
* @return {String} | ||
* @public | ||
*/ | ||
Loader.return_injection_type = function (bindings, unresolvedBindings, aliases, dump, injection) { | ||
Loader.returnInjectionType = function (bindings, unresolvedBindings, aliases, dump, injection) { | ||
injection = aliases[injection] || injection | ||
@@ -109,3 +118,3 @@ if (bindings[injection]) { | ||
/** | ||
* @function generate_directory_hash | ||
* @function generateDirectoryHash | ||
* @description Generates directory hash with key/value pairs | ||
@@ -119,4 +128,5 @@ * where key is the name of the class and value is path to | ||
* @return {Object} | ||
* @public | ||
*/ | ||
Loader.generate_directory_hash = function (directory, basePath, rootNamespace) { | ||
Loader.generateDirectoryHash = function (directory, basePath, rootNamespace) { | ||
const walker = walk.walk(directory) | ||
@@ -176,3 +186,3 @@ let hash = {} | ||
/** | ||
* @function save_directory_dump | ||
* @function saveDirectoryDump | ||
* @description here we simply convert directory map into a string | ||
@@ -182,4 +192,5 @@ * using JSON.stringify and save it as node module. | ||
* @return {Promise<fulfilled>} | ||
* @public | ||
*/ | ||
Loader.save_directory_dump = function (hash) { | ||
Loader.saveDirectoryDump = function (hash) { | ||
hash = JSON.stringify(hash, null, 2) | ||
@@ -186,0 +197,0 @@ hash = `module.exports = ${hash}` |
'use strict' | ||
/** | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
const _ = require('lodash') | ||
@@ -11,3 +17,2 @@ const Ioc = require('../Ioc') | ||
* nothing else. | ||
* @type {Object} | ||
*/ | ||
@@ -17,3 +22,3 @@ let RegisterarHelpers = exports = module.exports = {} | ||
/** | ||
* @function require_hash | ||
* @function requireHash | ||
* @description Require all files inside in an array using | ||
@@ -24,4 +29,5 @@ * node require method and return required files as an | ||
* @return {Array} | ||
* @public | ||
*/ | ||
RegisterarHelpers.require_hash = function (hash) { | ||
RegisterarHelpers.requireHash = function (hash) { | ||
return _.flatten(_.map(hash, function (item) { | ||
@@ -33,3 +39,3 @@ return require(item) | ||
/** | ||
* @function require_injection | ||
* @function requireInjection | ||
* @description It requires a file using namespace and get path for | ||
@@ -41,3 +47,3 @@ * that namespace from un resolved bindings inside | ||
*/ | ||
RegisterarHelpers.require_injection = function (injection) { | ||
RegisterarHelpers.requireInjection = function (injection) { | ||
return require(Ioc.getUnResolvedProviders()[injection]) | ||
@@ -47,3 +53,3 @@ } | ||
/** | ||
* @function register_deferred | ||
* @function registerDeferred | ||
* @description Registers deferred providers to the ioc | ||
@@ -53,3 +59,3 @@ * container using later method | ||
*/ | ||
RegisterarHelpers.register_deferred = function (hash) { | ||
RegisterarHelpers.registerDeferred = function (hash) { | ||
_.each(hash, function (item, provides) { | ||
@@ -61,3 +67,3 @@ Ioc.later(provides, item) | ||
/** | ||
* @function get_injections_for_resolved_providers | ||
* @function getInjectionsForResolvedProviders | ||
* @description It returns a tree with single node representing | ||
@@ -67,3 +73,3 @@ * all dependencies required by resolved providers. | ||
*/ | ||
RegisterarHelpers.get_injections_for_resolved_providers = function () { | ||
RegisterarHelpers.getInjectionsForResolvedProviders = function () { | ||
return _.flatten(_.map(Ioc.getResolvedProviders(), function (value, key) { | ||
@@ -75,7 +81,7 @@ return value.injections | ||
/** | ||
* @function get_all_resolved_providers | ||
* @function getAllResolvedProviders | ||
* @description It returns namespaces for all resolved providers so far. | ||
* @return {Array} | ||
*/ | ||
RegisterarHelpers.get_all_resolved_providers = function () { | ||
RegisterarHelpers.getAllResolvedProviders = function () { | ||
return _.keys(Ioc.getResolvedProviders()) | ||
@@ -85,8 +91,8 @@ } | ||
/** | ||
* @function get_all_unresolved_providers | ||
* @function getAllUnresolvedProviders | ||
* @description It returns namespaces for all unresolved providers. | ||
* @return {Array} | ||
*/ | ||
RegisterarHelpers.get_all_unresolved_providers = function () { | ||
RegisterarHelpers.getAllUnresolvedProviders = function () { | ||
return _.keys(Ioc.getUnResolvedProviders()) | ||
} |
'use strict' | ||
/** | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
const _ = require('lodash') | ||
@@ -18,10 +24,11 @@ const helpers = require('./helpers') | ||
* @param {Array} hash Array of providers | ||
* @public | ||
*/ | ||
Registerar.register = function (hash, deferredHash) { | ||
return new Promise(function (resolve, reject) { | ||
helpers.register_deferred(deferredHash) | ||
let loadedProviders = helpers.require_hash(hash) | ||
helpers.registerDeferred(deferredHash) | ||
let loadedProviders = helpers.requireHash(hash) | ||
let instances = Q() | ||
loadedProviders.forEach(function (provider) { | ||
instances = instances.then(iocHelpers.register_provider.bind(null, provider)) | ||
instances = instances.then(iocHelpers.registerProvider.bind(null, provider)) | ||
}) | ||
@@ -34,6 +41,13 @@ instances.then(function () { | ||
/** | ||
* @function stableizeCycle | ||
* @description here to make sure all required injections are stable | ||
* before we return final fulfilled promise | ||
* @return {Promise} | ||
* @public | ||
*/ | ||
Registerar.stableizeCycle = function () { | ||
let resolvedProvidersInjections = helpers.get_injections_for_resolved_providers() | ||
let resolvedInjections = helpers.get_all_resolved_providers() | ||
let unResolvedInjections = helpers.get_all_unresolved_providers() | ||
let resolvedProvidersInjections = helpers.getInjectionsForResolvedProviders() | ||
let resolvedInjections = helpers.getAllResolvedProviders() | ||
let unResolvedInjections = helpers.getAllUnresolvedProviders() | ||
let yetToBeResolved = _.difference(resolvedProvidersInjections, resolvedInjections) | ||
@@ -44,4 +58,4 @@ let toBeResolvedFromDeferred = _.intersection(unResolvedInjections, yetToBeResolved) | ||
toBeResolvedFromDeferred.forEach(function (injection) { | ||
let provider = helpers.require_injection(injection) | ||
instances = instances.then(iocHelpers.register_provider.bind(null, provider)) | ||
let provider = helpers.requireInjection(injection) | ||
instances = instances.then(iocHelpers.registerProvider.bind(null, provider)) | ||
}) | ||
@@ -61,2 +75,3 @@ return instances | ||
* @return {Promise<fulfilled>} | ||
* @public | ||
*/ | ||
@@ -66,3 +81,3 @@ Registerar.autoload = function (directory, basePath, rootNamespace) { | ||
Loader | ||
.generate_directory_hash(directory, basePath, rootNamespace) | ||
.generateDirectoryHash(directory, basePath, rootNamespace) | ||
.then(function (hash) { | ||
@@ -88,2 +103,3 @@ _.each(hash, function (item, index) { | ||
* @return {Promise<fulfilled>} | ||
* @public | ||
*/ | ||
@@ -93,4 +109,4 @@ Registerar.dump = function (directory, basePath, rootNamespace) { | ||
Loader | ||
.generate_directory_hash(directory, basePath, rootNamespace) | ||
.then(Loader.save_directory_dump) | ||
.generateDirectoryHash(directory, basePath, rootNamespace) | ||
.then(Loader.saveDirectoryDump) | ||
.then(resolve) | ||
@@ -97,0 +113,0 @@ .then(reject) |
'use strict' | ||
/** | ||
* adonis-fold | ||
* Copyright(c) - Harminder Virk | ||
* MIT Licensed | ||
*/ | ||
const Ioc = require('../Ioc') | ||
@@ -4,0 +10,0 @@ function ServiceProvider () { |
@@ -253,2 +253,21 @@ 'use strict' | ||
it('should return trasnformed object when hooks are defined' , function () { | ||
class Transformed { | ||
static get hooks(){ | ||
return ['extend'] | ||
} | ||
static extend(){ | ||
return 'foo' | ||
} | ||
} | ||
Ioc.bind('App/Transformed', function () { | ||
return Transformed | ||
}) | ||
expect(Ioc.use('App/Transformed')).to.equal('foo') | ||
}) | ||
it('should make use of static injections over provider callback typehiniting', function (done) { | ||
@@ -285,3 +304,3 @@ class Foo { | ||
IocHelpers | ||
.register_provider(FooProvider) | ||
.registerProvider(FooProvider) | ||
.then(function () { | ||
@@ -300,3 +319,3 @@ const FooInstance = Ioc.use('App/Foo') | ||
IocHelpers | ||
.register_provider(FooProvider) | ||
.registerProvider(FooProvider) | ||
.then(done).catch(done) | ||
@@ -303,0 +322,0 @@ }) |
@@ -57,3 +57,3 @@ 'use strict' | ||
it('should determine type of injection to be fulfilled and fallback to npm module when not find inside container', function () { | ||
const module = Loader.return_injection_type({}, {}, {}, {}, 'lodash') | ||
const module = Loader.returnInjectionType({}, {}, {}, {}, 'lodash') | ||
expect(module).to.equal('NPM_MODULE') | ||
@@ -63,3 +63,3 @@ }) | ||
it('should determine type of injection and get internal mapping if exists inside dump', function () { | ||
const module = Loader.return_injection_type({}, {}, {}, {'App/Users': '../../user'}, 'App/Users') | ||
const module = Loader.returnInjectionType({}, {}, {}, {'App/Users': '../../user'}, 'App/Users') | ||
expect(module).to.equal('LOCAL_MODULE') | ||
@@ -70,3 +70,3 @@ }) | ||
const binding = function () { return 'foo' } | ||
const module = Loader.return_injection_type({'App/Users': binding}, {}, {}, {}, 'App/Users') | ||
const module = Loader.returnInjectionType({'App/Users': binding}, {}, {}, {}, 'App/Users') | ||
expect(module).to.equal('PROVIDER') | ||
@@ -79,4 +79,4 @@ }) | ||
const type = Loader.return_injection_type(bindings, {}, {}, {}, 'App/Foo') | ||
const instance = Loader.resolve_using_type(bindings, {}, {}, {}, 'App/Foo', type) | ||
const type = Loader.returnInjectionType(bindings, {}, {}, {}, 'App/Foo') | ||
const instance = Loader.resolveUsingType(bindings, {}, {}, {}, 'App/Foo', type) | ||
@@ -91,4 +91,4 @@ expect(type).to.equal('PROVIDER') | ||
const type = Loader.return_injection_type({}, bindings, {}, {}, 'App/Foo') | ||
const instance = Loader.resolve_using_type({}, bindings, {}, {}, 'App/Foo', type) | ||
const type = Loader.returnInjectionType({}, bindings, {}, {}, 'App/Foo') | ||
const instance = Loader.resolveUsingType({}, bindings, {}, {}, 'App/Foo', type) | ||
@@ -101,3 +101,3 @@ expect(type).to.equal('UNRESOLVED_PROVIDER') | ||
const fn = function () { | ||
return Loader.resolve_using_type({}, {}, {}, 'App/Foo', null) | ||
return Loader.resolveUsingType({}, {}, {}, 'App/Foo', null) | ||
} | ||
@@ -116,3 +116,3 @@ | ||
Loader.generate_directory_hash(basePath, basePath, baseNameSpace) | ||
Loader.generateDirectoryHash(basePath, basePath, baseNameSpace) | ||
.then(function (hash) { | ||
@@ -129,7 +129,7 @@ expect(hash).to.be.an('object') | ||
Loader.generate_directory_hash(basePath, basePath, baseNameSpace) | ||
Loader.generateDirectoryHash(basePath, basePath, baseNameSpace) | ||
.then(function (hash) { | ||
expect(hash).to.be.an('object') | ||
expect(hash['App/Services/UserService']).to.equal(path.join(__dirname + '/app/Services/UserService.js')) | ||
return Loader.save_directory_dump(hash) | ||
return Loader.saveDirectoryDump(hash) | ||
}) | ||
@@ -136,0 +136,0 @@ .then(function () { |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
53046
1601