Comparing version 2.0.0-alpha.38 to 2.0.0-alpha.39
@@ -26,7 +26,7 @@ 'use strict'; | ||
const start = id => { | ||
const start = (id) => { | ||
const workerPath = path.join(__dirname, 'lib/worker.js'); | ||
const worker = new Worker(workerPath, { trackUnmanagedFds: true }); | ||
threads[id] = worker; | ||
worker.on('exit', code => { | ||
worker.on('exit', (code) => { | ||
if (code !== 0) start(id); | ||
@@ -50,3 +50,3 @@ else if (--active === 0) process.exit(0); | ||
process.stdin.setRawMode(true); | ||
process.stdin.on('data', data => { | ||
process.stdin.on('data', (data) => { | ||
const key = data[0]; | ||
@@ -53,0 +53,0 @@ if (key === CTRL_C) stop(); |
@@ -27,2 +27,3 @@ 'use strict'; | ||
this.static = new Map(); | ||
this.resources = new Map(); | ||
this.root = process.cwd(); | ||
@@ -34,2 +35,3 @@ this.path = path.join(this.root, 'application'); | ||
this.staticPath = path.join(this.path, 'static'); | ||
this.resourcesPath = path.join(this.path, 'resources'); | ||
this.starts = []; | ||
@@ -49,2 +51,3 @@ this.Application = Application; | ||
this.loadPlace('static', this.staticPath), | ||
this.loadPlace('resources', this.resourcesPath), | ||
this.loadPlace('api', this.apiPath), | ||
@@ -56,3 +59,3 @@ (async () => { | ||
]); | ||
await Promise.allSettled(this.starts.map(fn => this.execute(fn))); | ||
await Promise.allSettled(this.starts.map((fn) => this.execute(fn))); | ||
this.starts = []; | ||
@@ -79,8 +82,15 @@ this.initialization = true; | ||
createSandbox() { | ||
const { auth, config, console } = this; | ||
const { auth, config, console, resources } = this; | ||
const { server: { host, port, protocol } = {} } = this; | ||
const introspect = async interfaces => this.introspect(interfaces); | ||
const introspect = async (interfaces) => this.introspect(interfaces); | ||
const worker = { id: 'W' + node.worker.threadId.toString() }; | ||
const server = { host, port, protocol }; | ||
const application = { security, introspect, worker, server, auth }; | ||
const application = { | ||
security, | ||
introspect, | ||
worker, | ||
server, | ||
auth, | ||
resources, | ||
}; | ||
const api = {}; | ||
@@ -222,2 +232,14 @@ const lib = {}; | ||
async loadResource(filePath) { | ||
const key = filePath.substring(this.resourcesPath.length); | ||
try { | ||
const data = await fsp.readFile(filePath); | ||
this.resources.set(key, data); | ||
} catch (err) { | ||
if (err.code !== 'ENOENT') { | ||
this.console.error(err.stack); | ||
} | ||
} | ||
} | ||
async loadPlace(place, placePath) { | ||
@@ -231,2 +253,3 @@ const files = await fsp.readdir(placePath, { withFileTypes: true }); | ||
else if (place === 'static') await this.loadFile(filePath); | ||
else if (place === 'resources') await this.loadResource(filePath); | ||
else await this.loadModule(filePath); | ||
@@ -256,2 +279,3 @@ } | ||
else if (place === 'static') this.loadFile(filePath); | ||
else if (place === 'resources') this.loadResource(filePath); | ||
else this.loadModule(filePath); | ||
@@ -281,3 +305,3 @@ }); | ||
} | ||
const args = signature.split(',').map(s => s.trim()); | ||
const args = signature.split(',').map((s) => s.trim()); | ||
interfaceMethods[methodName] = args; | ||
@@ -284,0 +308,0 @@ } |
@@ -16,3 +16,3 @@ 'use strict'; | ||
const parseCookies = cookie => { | ||
const parseCookies = (cookie) => { | ||
const values = {}; | ||
@@ -29,3 +29,3 @@ const items = cookie.split(';'); | ||
const contextHandler = auth => session => ({ | ||
const contextHandler = (auth) => (session) => ({ | ||
get: (data, key) => { | ||
@@ -32,0 +32,0 @@ if (key === 'token') return session.token; |
@@ -16,5 +16,5 @@ 'use strict'; | ||
const metalibs = ['@metarhia/common', '@metarhia/config']; | ||
const metacore = ['metavm', 'metacom', 'metaschema', 'metasql']; | ||
const metatools = ['metatests', 'metalog']; | ||
const metapkg = [...metalibs, ...metacore, ...metatools]; | ||
const metacore = ['metavm', 'metacom', 'metalog']; | ||
const metaoptional = ['metaschema', 'metasql']; | ||
const metapkg = [...metalibs, ...metacore, ...metaoptional]; | ||
@@ -28,3 +28,8 @@ const npmpkg = ['ws']; | ||
if (name === 'impress') continue; | ||
const lib = require(name); | ||
let lib = null; | ||
try { | ||
lib = require(name); | ||
} catch { | ||
continue; | ||
} | ||
if (internals.includes(name)) { | ||
@@ -31,0 +36,0 @@ node[name] = lib; |
@@ -22,3 +22,3 @@ 'use strict'; | ||
const md5 = filePath => | ||
const md5 = (filePath) => | ||
new Promise((resolve, reject) => { | ||
@@ -35,3 +35,3 @@ const hash = crypto.createHash('md5'); | ||
// Upload file to application/files | ||
const uploadFile = async fileName => { | ||
const uploadFile = async (fileName) => { | ||
const dir1 = common.generateKey(2, common.DIGIT); | ||
@@ -38,0 +38,0 @@ const dir2 = common.generateKey(2, common.DIGIT); |
@@ -35,3 +35,3 @@ 'use strict'; | ||
task.executing = true; | ||
task.run(task, taskResult => { | ||
task.run(task, (taskResult) => { | ||
task.error = taskResult; | ||
@@ -38,0 +38,0 @@ task.success = taskResult === null; |
@@ -15,3 +15,3 @@ 'use strict'; | ||
const deserializeHash = phcString => { | ||
const deserializeHash = (phcString) => { | ||
const parsed = phcString.split('$'); | ||
@@ -23,3 +23,3 @@ parsed.shift(); | ||
const params = Object.fromEntries( | ||
parsed[1].split(',').map(p => { | ||
parsed[1].split(',').map((p) => { | ||
const kv = p.split('='); | ||
@@ -46,3 +46,3 @@ kv[1] = Number(kv[1]); | ||
const hashPassword = password => | ||
const hashPassword = (password) => | ||
new Promise((resolve, reject) => { | ||
@@ -65,3 +65,3 @@ crypto.randomBytes(SALT_LEN, (err, salt) => { | ||
let defaultHash; | ||
hashPassword('').then(hash => { | ||
hashPassword('').then((hash) => { | ||
defaultHash = hash; | ||
@@ -68,0 +68,0 @@ }); |
'use strict'; | ||
const isConstant = s => s === s.toUpperCase(); | ||
const isConstant = (s) => s === s.toUpperCase(); | ||
const makePrivate = instance => { | ||
const makePrivate = (instance) => { | ||
const iface = {}; | ||
@@ -7,0 +7,0 @@ const fields = Object.keys(instance); |
@@ -29,3 +29,3 @@ 'use strict'; | ||
const logError = err => { | ||
const logError = (err) => { | ||
console.error(err ? err.stack : 'No exception stack available'); | ||
@@ -59,3 +59,3 @@ }; | ||
worker.parentPort.on('message', async message => { | ||
worker.parentPort.on('message', async (message) => { | ||
if (message.name === 'stop') { | ||
@@ -62,0 +62,0 @@ if (application.finalization) return; |
{ | ||
"name": "impress", | ||
"version": "2.0.0-alpha.38", | ||
"version": "2.0.0-alpha.39", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -65,4 +65,2 @@ "description": "Impress application server for Node.js and Metarhia private cloud", | ||
"metalog": "^3.0.0", | ||
"metaschema": "^0.4.0", | ||
"metasql": "^0.3.0-alpha.2", | ||
"metavm": "^1.0.0" | ||
@@ -69,0 +67,0 @@ }, |
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
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
32799
5
750
- Removedmetaschema@^0.4.0
- Removedmetasql@^0.3.0-alpha.2
- Removed@metarhia/common@1.5.0(transitive)
- Removedmetaschema@0.4.0(transitive)
- Removedmetasql@0.3.0-alpha.3(transitive)
- Removedmetasync@0.3.32(transitive)
- Removedmetavm@1.0.0(transitive)
- Removedpg@8.13.1(transitive)
- Removedpg-cloudflare@1.1.1(transitive)
- Removedpg-connection-string@2.7.0(transitive)
- Removedpg-int8@1.0.1(transitive)
- Removedpg-pool@3.7.0(transitive)
- Removedpg-protocol@1.7.0(transitive)
- Removedpg-types@2.2.0(transitive)
- Removedpgpass@1.0.5(transitive)
- Removedpostgres-array@2.0.0(transitive)
- Removedpostgres-bytea@1.0.0(transitive)
- Removedpostgres-date@1.0.7(transitive)
- Removedpostgres-interval@1.2.0(transitive)
- Removedsplit2@4.2.0(transitive)
- Removedxtend@4.0.2(transitive)