Socket
Socket
Sign inDemoInstall

impress

Package Overview
Dependencies
Maintainers
4
Versions
719
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

impress - npm Package Compare versions

Comparing version 3.0.0-alpha.3 to 3.0.0-alpha.4

7

CHANGELOG.md

@@ -5,2 +5,6 @@ # Changelog

## [3.0.0-alpha.4][] - 2022-07-30
- Fix scheduler: task id, unknown app, etc.
## [3.0.0-alpha.3][] - 2022-07-26

@@ -288,3 +292,4 @@

[unreleased]: https://github.com/metarhia/impress/compare/v3.0.0-alpha.3...HEAD
[unreleased]: https://github.com/metarhia/impress/compare/v3.0.0-alpha.4...HEAD
[3.0.0-alpha.4]: https://github.com/metarhia/impress/compare/v3.0.0-alpha.3...v3.0.0-alpha.4
[3.0.0-alpha.3]: https://github.com/metarhia/impress/compare/v3.0.0-alpha.2...v3.0.0-alpha.3

@@ -291,0 +296,0 @@ [3.0.0-alpha.2]: https://github.com/metarhia/impress/compare/v3.0.0-alpha.1...v3.0.0-alpha.2

7

lib/dependencies.js

@@ -37,8 +37,2 @@ 'use strict';

const loadPlugins = (lib) => {
for (const plugin of Object.keys(lib.plugins)) {
lib.plugins[plugin] = String(lib.plugins[plugin]);
}
};
for (const name of dependencies) {

@@ -55,3 +49,2 @@ if (name === 'impress') continue;

}
if (lib.plugins) loadPlugins(lib);
if (internals.includes(name)) {

@@ -58,0 +51,0 @@ assignNamespace(node, name, lib);

@@ -70,3 +70,3 @@ 'use strict';

if (!filePath.endsWith('.js')) return;
const script = await this.createScript(filePath);
let script = await this.createScript(filePath);
if (!script) return;

@@ -88,7 +88,6 @@ const proc = new Procedure(script, 'method', this.application);

if (!plugin) return;
const context = this.application.sandbox;
const { exports } = metavm.createScript(name, plugin, { context });
iface = exports(iface);
script = plugin(iface);
iface = script();
}
for (const [name, script] of Object.entries(iface)) {
for (const name of Object.keys(iface)) {
const proc = new Procedure(script, name, this.application);

@@ -95,0 +94,0 @@ this.changeInterface(interfaceName, name, proc);

@@ -31,3 +31,3 @@ 'use strict';

if (date === now) {
const nextId = parseInt(id);
const nextId = parseInt(id) + 1;
if (nextId > this.nextId) this.nextId = nextId;

@@ -63,4 +63,5 @@ }

};
this.tasks.set(id, task);
return this.start(id);
const started = this.start(id);
if (started) this.tasks.set(id, task);
return started;
}

@@ -71,5 +72,10 @@

task.id = id;
this.restore({ id, ...task });
const every = metautil.parseEvery(task.every);
const next = metautil.nextEvent(every);
if (next === -1) {
this.console.error(new Error('Can not schedule a task in the past'));
return '';
}
this.nextId++;
const started = this.restore({ id, ...task });
if (!started) return id;
const filePath = path.join(this.path, id + '.json');

@@ -115,12 +121,6 @@ try {

const next = metautil.nextEvent(task.every);
if (next === -1) {
this.remove(id);
return false;
}
if (next === 0) {
this.execute(task, true);
return true;
}
if (next === -1) this.remove(id);
if (next <= 0) return false;
task.timer = setTimeout(() => {
const once = task.every.interval === 0;
const once = task.every.ms === 0;
this.execute(task, once);

@@ -188,12 +188,13 @@ }, next);

});
this.applications
.get(task.app)
.pool.next()
.then((next) => {
next.postMessage(msg, [port]);
})
.catch(() => {
const error = new Error('No thread available');
this.console.error(error);
});
const app = this.applications.get(task.app);
if (!app) {
const data = JSON.stringify(task);
const error = new Error('No application for task: ' + data);
this.console.error(error);
return;
}
app.pool.next().then(
(next) => next.postMessage(msg, [port]),
() => this.console.error(new Error('No thread available')),
);
});

@@ -200,0 +201,0 @@ }

{
"name": "impress",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -69,7 +69,7 @@ "description": "Enterprise application server for Node.js",

"dependencies": {
"metacom": "^3.0.0-alpha.3",
"metacom": "^3.0.0-alpha.4",
"metaconfiguration": "^2.1.8",
"metalog": "^3.1.9",
"metaschema": "^2.1.0",
"metautil": "^3.5.21",
"metautil": "^3.5.22",
"metavm": "^1.2.1",

@@ -76,0 +76,0 @@ "metawatch": "^1.0.6"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc