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C,UAAU,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC;AAde,kBAAU,aAczB,CAAA;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,UAAU,GAAG;IACnC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IACrC,qCAAqC;IACrC,0BAA0B;IAC1B,0BAA0B;IAC1B,2BAA2B;IAC3B,gBAAgB;IAChB,UAAU;IACV,KAAK;AACV,CAAC,CAAA","file":"core/index.js","sourcesContent":["import {Initalize} from './initialize/initialize';\nimport fs = require('fs');\nvar recursiveReadDir = require('recursive-readdir-synchronous');\nimport path = require('path');\nimport Q = require(\"q\");\nimport * as Utils from './utils';\nimport {MetaUtils} from './metadata/utils'\nimport {IEntityService} from './interfaces/entity-service';\n//import {PrincipalContext} from '../security/auth/principalContext';\n//var ns = PrincipalContext.getSession();\nvar domain = require('../security/auth/domain');\nimport {Decorators} from './constants';\n\n//import linq = require('../typings/linq/linq');\nimport * as Enumerable from 'linq';\n\n// Ignore .d.ts and all other non .ts files\nfunction ignoreFile(file: string) {\n return !file.endsWith('.js') || file.endsWith('.spec.js');\n}\n\n// ignore node_modules or folders starting with '.', eg. '.git'\nfunction ignoreDirectory(file: string, stats: fs.Stats) {\n return path.basename(file) == \"node_modules\" || path.basename(file).startsWith('.') || path.basename(file) == \"unit-test\";\n}\n\nfunction readIgnore(file: string, stats: fs.Stats) {\n return (stats.isFile() && ignoreFile(file))\n || (stats.isDirectory() && ignoreDirectory(file, stats));\n}\n\nlet _appRoot = process.cwd();\n\nclass Dynamic {\n constructor(config: any, securityConfig: any,server?:any) {\n Utils.config(config);\n Utils.securityConfig(securityConfig);\n config = config;\n securityConfig = securityConfig;\n let ignorePaths = config.Config && config.Config.ignorePaths || [];\n let internalIgnorePaths = config.Config && config.Config.internalIgnorePaths || [];\n ignorePaths = [...ignorePaths, ...internalIgnorePaths];\n var files = this.scanDirectories(ignorePaths);\n this.loadComponents(files);\n this.initialize(files, server);\n }\n\n scanDirectories(ignorePaths: Array<string|Function>): Array<string> {\n ignorePaths.push(readIgnore);\n return recursiveReadDir(_appRoot, ignorePaths);\n //return Q.nfapply(recursiveReadDir, [_appRoot, [readIgnore]]);\n }\n\n loadComponents(files: Array<string>) {\n Enumerable.from(files)\n .forEach(x => {\n try {\n if (x.indexOf(\"gulpfile\") > -1) {\n return;\n }\n var route = path.resolve(x.substring(0, x.lastIndexOf('.')));\n require(route);\n } catch (e) {\n console.log(e);\n throw e;\n }\n });\n }\n\n initialize(files: Array<string>, server: any) {\n new Initalize(files,server);\n }\n}\n\nmodule.exports = function (config: any, securityConfig: any, appRoot?: string,\n entityServiceInst?: IEntityService,\n sqlServerInst?: IEntityService,server?:any) {\n // application root (where we scan the components) set priority: \n // 1. User provided \n // 2. Environment Variable \n // 3. Current working directory\n _appRoot = appRoot || process.env.APP_ROOT || process.cwd();\n //Utils.entityService(entityServiceInst);\n //Utils.sqlEntityService(sqlServerInst);\n new Dynamic(config, securityConfig,server);\n MetaUtils.refreshDerivedObjectsMetadata(Decorators.DOCUMENT);\n MetaUtils.refreshDerivedObjectsMetadata(Decorators.ENTITY);\n}\n\nlet components: Array<any> = [];\n\nexport function addComponent(comp: any) {\n components.push(comp);\n}\n\nexport function initialize(config: any, securityConfig: any, appRoot?: string,\n entityServiceInst?: IEntityService,\n sqlServerInst?: IEntityService, server?: any) {\n // application root (where we scan the components) set priority: \n // 1. User provided \n // 2. Environment Variable \n // 3. Current working directory\n _appRoot = appRoot || process.env.APP_ROOT || process.cwd();\n //Utils.entityService(entityServiceInst);\n new Dynamic(config, securityConfig,server);\n //Utils.sqlEntityService(sqlServerInst);\n components.forEach(x => {\n x.default();\n });\n}\n\nmodule.exports.register = function (app) {\n app.use(domain.middleware('context'));\n //app.use(function (req, res, next) {\n // ns.bindEmitter(req);\n // ns.bindEmitter(res);\n // ns.run(function () {\n // next();\n // });\n //});\n}\n"],"sourceRoot":"/source/"}
\No newline at end of file