Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(currentType).forEach(key => {
types[type] = types[type] || {};
let resolver = currentType[key];
const interceptors = [];
if (config.$externals) {
const [symbol] = config.$externals
.map(e => e.map)
.filter(s => resolver.includes(s));
if (symbol) {
const hasMultipleSymbols = [
...new Set(resolver.split('=>').map(r => r.replace(/ +?/g, '').trim()))
];
if (hasMultipleSymbols.length > 2) {
const directives = hasMultipleSymbols.slice(1, hasMultipleSymbols.length);
for (const injectorSymbol of getInjectorSymbols(config.$externals, directives)) {
core_1.Container.set(injectorSymbol.token, injectorSymbol.method);
interceptors.push(injectorSymbol.token);
}
}
else {
const { token, interceptor } = setPart(config.$externals, resolver, symbol);
core_1.Container.set(token, interceptor);
interceptors.push(token);
}
resolver = Object.keys(app_tokens_1.Roots)
.map(node => {
const types = Object.keys(app_tokens_1.Roots[node]).filter(key => resolver.includes(key));
if (types.length) {
return types[0];
}
})
.filter(i => !!i)[0];
config.$externals = compiledPaths.map(external => {
if (external.file.includes('.ts')) {
external.module = require(external.transpiledFile);
}
else {
const m = require('esm')(module)(path_1.join(process.cwd(), external.file));
external.module = m['default'] || m;
}
core_1.Container.set(external.map, external.module);
return external;
});
}
return __awaiter(this, void 0, void 0, function* () {
const types = {};
const Arguments = core_1.Container.get(app_tokens_1.TypesToken);
config.$args = config.$args || {};
Object.keys(config.$args).forEach(reusableArgumentKey => {
const args = {};
Object.keys(config.$args[reusableArgumentKey]).forEach(o => {
args[o] = parse_ast_1.ParseArgs(config.$args[reusableArgumentKey][o]);
Arguments.set(reusableArgumentKey, args);
});
});
Object.keys(config.$types).forEach(type => {
if (types[type]) {
return;
}
const currentType = config.$types[type];
Object.keys(currentType).forEach(key => {
types[type] = types[type] || {};
let resolver = currentType[key];