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

faas-js-runtime

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faas-js-runtime - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

22

bin/cli.js

@@ -22,14 +22,13 @@ #!/usr/bin/env node

function runServer(file) {
async function runServer(file) {
try {
const func = require(extractFullPath(file));
runtime(func, server => {
ON_DEATH(_ => {
server.close();
log(chalk.yellow(`
Goodbye!
`));
});
const server = await runtime(func);
log(chalk.blue(`
ON_DEATH(_ => {
server.close();
log(chalk.yellow(`Goodbye!`));
});
log(chalk.blue(`
The server has started.

@@ -45,5 +44,4 @@

-H'Ce-specversion: 1.0' \\
http://localhost:8080
`));
});
http://localhost:8080`));
} catch (error) {

@@ -50,0 +48,0 @@ log(chalk.redBright('Something went wrong'));

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

## [0.6.0](https://www.github.com/boson-project/faas-js-runtime/compare/v0.5.1...v0.6.0) (2021-04-10)
### Features
* support configurable log levels ([#82](https://www.github.com/boson-project/faas-js-runtime/issues/82)) ([b6f8be4](https://www.github.com/boson-project/faas-js-runtime/commit/b6f8be4f9e671e2c8be7f85e104400d52219e5ff))
### Bug Fixes
* better error handling when network address is already in use ([#74](https://www.github.com/boson-project/faas-js-runtime/issues/74)) ([ae28dcf](https://www.github.com/boson-project/faas-js-runtime/commit/ae28dcfed94dc50fe89a67a1262e78b59c7cbd0a))
### [0.5.1](https://www.github.com/boson-project/faas-js-runtime/compare/v0.5.0...v0.5.1) (2020-11-03)

@@ -7,0 +19,0 @@

@@ -24,5 +24,5 @@ const qs = require('qs');

}
const { log = true } = { ...options };
const { logLevel = 'info' } = { ...options };
const server = fastify({ logger: log });
const server = fastify({ logger: { level: logLevel } });

@@ -29,0 +29,0 @@ // All incoming requests get a Context object

@@ -6,4 +6,4 @@ const { HTTP } = require('cloudevents');

fastify.addContentTypeParser('application/cloudevents+json',
{ parseAs: 'string' }, function(req, body, done) {
done(null, body);
{ parseAs: 'string' }, function(req, body, _done) {
_done(null, body);
});

@@ -15,9 +15,6 @@

fastify.addHook('preHandler', function(request, reply, done) {
if (request.isCloudEvent()) {
fastify.addHook('preHandler', function(request, reply, _done) {
if (request.isCloudEvent()) {
try {
request.fcontext.cloudevent = HTTP.toEvent({
headers: request.headers,
body: request.body
});
request.fcontext.cloudevent = HTTP.toEvent(request);
} catch (err) {

@@ -27,6 +24,6 @@ if (err.message.startsWith('invalid spec version')) {

}
done(err);
_done(err);
}
}
done();
_done();
});

@@ -33,0 +30,0 @@

{
"name": "faas-js-runtime",
"version": "0.5.1",
"version": "0.6.0",
"repository": {

@@ -24,3 +24,3 @@ "type": "git",

"chalk": "^4.1.0",
"cloudevents": "^3.2.0",
"cloudevents": "^4.0.0",
"commander": "^6.1.0",

@@ -27,0 +27,0 @@ "death": "^1.1.0",

@@ -29,2 +29,8 @@ ## FaaS Node.js Runtime Framework

const framework = require('faas-js-runtime');
const options = {
// Pino is used as the logger implementation. Supported log levels are
// documented at this link:
// https://github.com/pinojs/pino/blob/master/docs/api.md#options
logLevel: 'info'
}

@@ -40,3 +46,3 @@ // My function directory is in ./function-dir

server.close();
});
}, options);
```

@@ -52,2 +58,3 @@

setTimeout(_ => {
context.log.info('sending response to client')
resolve(ret);

@@ -54,0 +61,0 @@ }, 500);

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