Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 2.6.6 to 2.6.7

16

CHANGELOG.md

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

## [2.6.7][] - 2022-03-18
- Add cors to server config
- Update metatests dependency
- Allow `async` procedure `validate` function
- Emit application init events on user application
- Try to coerce dependency names under `node`, `npm`, `metarhia` keys.
dependencies with '/', '@', '-' will also be available by removing those
symbols and converting name to camelCase format.
e.g `@metahia/common` -> `metarhiaCommon`, `date-fns` -> `dateFns`.
- Improve application/worker error logs
- Update dependencies
## [2.6.6][] - 2021-10-12

@@ -240,3 +253,4 @@

[unreleased]: https://github.com/metarhia/impress/compare/v2.6.6...HEAD
[unreleased]: https://github.com/metarhia/impress/compare/v2.6.7...HEAD
[2.6.7]: https://github.com/metarhia/impress/compare/v2.6.6...v2.6.7
[2.6.6]: https://github.com/metarhia/impress/compare/v2.6.5...v2.6.6

@@ -243,0 +257,0 @@ [2.6.5]: https://github.com/metarhia/impress/compare/v2.6.4...v2.6.5

@@ -25,2 +25,11 @@ 'use strict';

class UserApplication extends events.EventEmitter {
constructor(app, data) {
super();
Object.assign(this, data);
this.introspect = async (interfaces) => app.introspect(interfaces);
this.invoke = async (call) => app.invoke(call);
}
}
const SANDBOX = { ...metavm.COMMON_CONTEXT, Error, node, npm, metarhia };

@@ -65,2 +74,3 @@

this.createSandbox();
this.sandbox.application.emit('loading');
await Promise.allSettled([

@@ -76,3 +86,5 @@ this.schemas.load(),

]);
this.sandbox.application.emit('loaded');
await Promise.allSettled(this.starts.map((fn) => this.execute(fn)));
this.sandbox.application.emit('started');
await this.api.load();

@@ -93,2 +105,3 @@ if (kind === 'scheduler') await this.scheduler.load();

this.initialization = false;
this.sandbox.application.emit('initialized');
}

@@ -118,5 +131,4 @@

const server = { host, port, protocol };
const application = { worker, server, resources, schemas, scheduler };
application.introspect = async (interfaces) => this.introspect(interfaces);
application.invoke = async (call) => this.invoke(call);
const userAppData = { worker, server, resources, schemas, scheduler };
const application = new UserApplication(this, userAppData);
const sandbox = { ...SANDBOX, console, application, config, process };

@@ -151,3 +163,6 @@ sandbox.api = {};

return method().catch((err) => {
this.console.error(err.stack);
this.console.error(
`Failed to execute method: ${err && err.message}`,
err.stack
);
});

@@ -154,0 +169,0 @@ }

'use strict';
const metautil = require('metautil');
const node = {};

@@ -20,6 +22,17 @@ const npm = {};

if (pkg.dependencies) npmpkg.push(...Object.keys(pkg.dependencies));
const dependencies = [...internals, ...npmpkg, ...metapkg, ...optional];
const dependencies = [...internals, ...npmpkg, ...metapkg];
const notLoaded = new Set();
const assignNamespace = (container, name, value) => {
container[name] = value;
const key = metautil.replace(
name.startsWith('@') ? name.slice(1) : name,
'/',
'-'
);
const camelKey = metautil.spinalToCamel(key);
container[camelKey] = value;
};
for (const name of dependencies) {

@@ -37,10 +50,10 @@ if (name === 'impress') continue;

if (internals.includes(name)) {
node[name] = lib;
assignNamespace(node, name, lib);
continue;
}
if (metapkg.includes(name)) {
metarhia[name] = lib;
assignNamespace(metarhia, name, lib);
continue;
}
npm[name] = lib;
assignNamespace(npm, name, lib);
}

@@ -47,0 +60,0 @@

2

lib/procedure.js

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

if (validate) {
validate(args);
await validate(args);
}

@@ -70,0 +70,0 @@ let result;

@@ -29,4 +29,7 @@ 'use strict';

const logError = async (err) => {
console.error(err ? err.stack : 'No exception stack available');
const logError = (type) => async (err) => {
console.error(
`${type} error detected: ${err && err.message}`,
err ? err.stack : 'No exception stack available'
);
if (application.finalization) return;

@@ -48,5 +51,5 @@ if (application.initialization) {

process.on('uncaughtException', logError);
process.on('warning', logError);
process.on('unhandledRejection', logError);
process.on('uncaughtException', logError('uncaughtException'));
process.on('warning', logError('warning'));
process.on('unhandledRejection', logError('unhandledRejection'));

@@ -87,2 +90,4 @@ if (config.server.protocol === 'https') {

});
})();
})().catch((err) => {
console.info(`Can not start Application in worker ${threadId}`, err);
});
{
"name": "impress",
"version": "2.6.6",
"version": "2.6.7",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -66,25 +66,25 @@ "description": "Enterprise application server for Node.js",

"engines": {
"node": "^12.9 || 14 || 16"
"node": "^12.9 || 14 || 16 || 17"
},
"dependencies": {
"metacom": "^2.0.4",
"metaconfiguration": "^2.1.5",
"metalog": "^3.1.5",
"metaschema": "^1.3.4",
"metautil": "^3.5.16",
"metavm": "^1.0.3",
"metawatch": "^1.0.4"
"metacom": "^2.0.5",
"metaconfiguration": "^2.1.6",
"metalog": "^3.1.7",
"metaschema": "^1.4.1",
"metautil": "^3.5.19",
"metavm": "^1.1.0",
"metawatch": "^1.0.5"
},
"devDependencies": {
"@types/node": "^16.10.4",
"@types/ws": "^8.2.0",
"eslint": "^7.32.0",
"@types/node": "^17.0.21",
"@types/ws": "^8.5.3",
"eslint": "^8.11.0",
"eslint-config-metarhia": "^7.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"metatests": "^0.7.2",
"prettier": "^2.4.1",
"typescript": "^4.4.4"
"metatests": "^0.8.2",
"prettier": "^2.6.0",
"typescript": "^4.6.2"
}
}

@@ -6,3 +6,2 @@ <div align="center">

[![ci Status](https://github.com/metarhia/impress/workflows/Testing%20CI/badge.svg)](https://github.com/metarhia/impress/actions?query=workflow%3A%22Testing+CI%22+branch%3Amaster)
[![codacy](https://api.codacy.com/project/badge/Grade/6fb7b607a9cb445984aebbc08fdeb13c)](https://www.codacy.com/app/metarhia/impress)
[![snyk](https://snyk.io/test/github/metarhia/impress/badge.svg)](https://snyk.io/test/github/metarhia/impress)

@@ -110,5 +109,5 @@ [![npm downloads/month](https://img.shields.io/npm/dm/impress.svg)](https://www.npmjs.com/package/impress)

Copyright (c) 2012-2021 Metarhia contributors.
Copyright (c) 2012-2022 Metarhia contributors.
See github for full [contributors list](https://github.com/metarhia/impress/graphs/contributors).
Impress Application Server is [MIT licensed](./LICENSE).
Project coordinator: &lt;timur.shemsedinov@gmail.com&gt;

@@ -29,2 +29,5 @@ ({

},
cors: {
origin: 'string',
},
});

@@ -45,2 +45,5 @@ export interface LogConfig {

};
cors: {
origin: string;
};
}

@@ -47,0 +50,0 @@

@@ -0,1 +1,3 @@

import { EventEmitter, NodeJS } from 'events';
export interface Task {

@@ -19,3 +21,3 @@ name: string;

export interface Application {
export interface Application extends NodeJS.EventEmitter {
worker: object;

@@ -28,2 +30,11 @@ server: object;

scheduler: Scheduler;
on(event: 'loading', listener: (...args: any[]) => void): this;
once(event: 'loading', listener: (...args: any[]) => void): this;
on(event: 'loaded', listener: (...args: any[]) => void): this;
once(event: 'loaded', listener: (...args: any[]) => void): this;
on(event: 'started', listener: (...args: any[]) => void): this;
once(event: 'started', listener: (...args: any[]) => void): this;
on(event: 'initialized', listener: (...args: any[]) => void): this;
once(event: 'initialized', listener: (...args: any[]) => void): this;
}

@@ -30,0 +41,0 @@

Sorry, the diff of this file is not supported yet

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