profile
viewpoint
Matteo Collina mcollina @nearform In the clouds above Italy Technical Director @nearform, TSC member @nodejs, IoT Expert, Conference Speaker, Ph.D.

davidmarkclements/0x 2044

🔥 single-command flamegraph profiling 🔥

delvedor/find-my-way 747

A crazy fast HTTP router

davidmarkclements/rfdc 334

Really Fast Deep Clone

davidmarkclements/v8-perf 257

Exploring v8 performance characteristics in Node across v8 versions 5.1, 5.8, 5.9, 6.0 and 6.1

davidmarkclements/fast-safe-stringify 235

Safely and quickly serialize JavaScript objects

davidmarkclements/overload-protection 175

Load detection and shedding capabilities for http, express, restify and koa

davidmarkclements/fast-redact 143

very fast object redaction

andreareginato/conference_site 23

A conference site that can be used for your next big event

issue openedfastify/help

Type "number" in schema allows null values by fastify, but not Ajv.

🐛 Bug Report

I want not to allow null values for a body property. Please see the following simple snippet in which I tried to compare results of fastify and ajv for the same schema and input:

const fastify = require("fastify")({});

const Ajv = require("ajv");
const ajv = new Ajv();

const bodySchema = {
  type: "object",
  required: ["age"],
  properties: {
    age: {
      type: "integer",
    },
  },
};

const payload = {
  age: null, // <- setting age to null
};

// ajv result
console.log("AJV validation: ", ajv.validate(bodySchema, payload));

// fastify result
fastify.route({
  method: "POST",
  url: "/",
  schema: {
    body: bodySchema,
  },
  handler: async (req) => {
    console.log("Inside handler", req.body);
    return { insideHandler: true };
  },
});

fastify
  .inject({
    method: "POST",
    url: "/",
    payload,
  })
  .then((res) => {
    console.log("resp status", res.statusCode);
    console.log("res body", res.payload);
  })
  .catch((err) => console.log("err", err));

Results

const payload = { age: null };
AJV validation:  false
Inside handler { age: 0 }
resp status 200
res body {"insideHandler":true}
const payload = { age: 3 };
AJV validation:  true
Inside handler { age: 3 }
resp status 200
res body {"insideHandler":true}

Your Environment

  • node version: 10, 12, 13
  • fastify version: >=2.0.0
  • os: Mac, Windows, Linux
  • any other relevant information

created time in 2 hours

startedmcollina/autocannon

started time in 3 hours

startedrs/zerolog

started time in 4 hours

startedrs/jplot

started time in 4 hours

Pull request review commentfastify/fastify-websocket

Fix / route with prefix in fastify@v3.10.1

 function close (fastify, done) { }  module.exports = fp(fastifyWebsocket, {-  fastify: '3.x',+  fastify: '>= 3.10.1',

This does not qualify as a breaking change?

mcollina

comment created time in 4 hours

push eventnearform/brokeneck

RudyRed

commit sha ccee4f9a6e4bda3ca746a42bce538bc29d869bbf

test: fix coverage

view details

push time in 4 hours

startedzkat/exa

started time in 4 hours

fork jsumners/streamx

An iteration of the Node.js core streams with a series of improvements.

fork in 5 hours

startedmcollina/fastparallel

started time in 5 hours

startedmcollina/fastseries

started time in 5 hours

startedmcollina/fastq

started time in 5 hours

startedmcollina/reusify

started time in 5 hours

startedmcollina/fastq

started time in 5 hours

startedlume/lume

started time in 5 hours

created repositorylancejpollard/clear-diacritics.js

Clear diacritics to make text more suitable for a URL string

created time in 5 hours

startedHyperspace-Logistics/heart

started time in 6 hours

startedvega/ts-json-schema-generator

started time in 6 hours

push eventnearform/brokeneck

RudyRed

commit sha 4aa293caf7c206d4662690f059576b691afa126f

test: fix issue with CI date

view details

push time in 6 hours

push eventnearform/brokeneck

RudyRed

commit sha 0d08ae817e0ff7349cda62e986415a87650ae86c

test: remove unnecessary rerender

view details

RudyRed

commit sha f166ab7818798461a0b410d27680be253cd4aab3

test: change getAllByRole to GetByRole

view details

RudyRed

commit sha d447fd2f386c57d5ddee1a171e4ca4a50e455f5c

Merge branch 'master' of https://github.com/nearform/brokeneck into test/react-components

view details

RudyRed

commit sha e1b295deb8f10312587a2964537bc87989f7bfe7

test: fix test mocking

view details

push time in 6 hours

issue openedfastify/fastify-websocket

Fastify 3.10 breaks prefixed plugins

🐛 Bug Report

Fastify 3.10, together with the use of prefixes, breaks fastify-websocket.

fastify.register(
  (fastify, opts, done) => {
    fastify.get("/", { websocket: true }, (connection, req) => {
      connection.socket.send("This works");
    });

    done();
  },
  { prefix: "/activity" }
);

To Reproduce

  • Clone https://github.com/Skn0tt/fastify-websocket-3.10-repro
  • Run index.js
  • Connect to ws://localhost:3000/activity

Your Environment

  • node version: 15.3
  • fastify version: >=3.10
  • os: Mac

Additional Information

Prior to 3.10, this line was called twice per route:

https://github.com/fastify/fastify-websocket/blob/99c94a003da2353c1f482301027166e64e743582/index.js#L36

That's why this lines makes sure to ignore one of them:

https://github.com/fastify/fastify-websocket/blob/99c94a003da2353c1f482301027166e64e743582/index.js#L42

Now with 3.10, the onRoute is called only once, and all of the routes are effectively ignored.

created time in 6 hours

PR opened fastify/fastify

docs: update installation guide for typescript

fix error

docker/src/api on  master [?] is 📦 v1.0.0 via ⬢ v15.3.0 
❯ npx typescript --init
npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ethan/.npm/_logs/2021-01-16T00_00_47_925Z-debug.log

docker/src/api on  master [?] is 📦 v1.0.0 via ⬢ v15.3.0 
❯ npx tsc --init
message TS6071: Successfully created a tsconfig.json file.

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/fastify/fastify/blob/master/CONTRIBUTING.md

By making a contribution to this project, I certify that:

  • (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

  • (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

  • (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  • (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

Checklist

+1 -1

0 comment

1 changed file

pr created time in 6 hours

Pull request review commentfastify/fastify

refactor: schema controller layer

 The input `schema` can access all the shared schemas added with [`.addSchema`](# #### schemaErrorFormatter This property can be used set a function to format errors that happen while the `validationCompiler` fails to validate the schema. See [#error-handling](Validation-and-Serialization.md#schemaerrorformatter). +<a name="schema-controller"></a>+#### schemaController+This property can be used to fully manage where the schemas of your application will be stored.+It can be useful when your schemas are stored in another data structure that is unknown to Fastify.+See [issue #2446](https://github.com/fastify/fastify/issues/2446) for an example of what+this property helps to resolve.++```js+const fastify = Fastify({+  schemaController: {+    /**+     * This factory is called whenever `fastify.register()` is called.+     * It may receive as input the schemas of the parent context if some schemas has been added.+     * @param {object} parentSchemas: it will be the returned object of the `getSchemas()` function below.
     * @param {object} parentSchemas these schemas will be returned by the `getSchemas()` method function of the returned `bucket`.
Eomm

comment created time in 6 hours

Pull request review commentpinojs/pino

Replacing var with let/const, somewhere left var because scope, somew…

+{+    "env": {+        "browser": true,+        "commonjs": true,+        "es2021": true,+        "node": true+    },+    "extends": [+        "standard"+    ],+    "parserOptions": {+        "ecmaVersion": 12+    },+    "rules": {+        "no-var": "off"+    }

@mcollina what is your opinion of this configuration? It eliminated needing to scatter inline tool directives throughout the source code, but it is more scaffolding than just "install standard". Unfortunately, standard explicitly ignores extra configuration by design. So we can't disable this rule while only using the standard package.

salesh

comment created time in 6 hours

Pull request review commentpinojs/pino

Replacing var with let/const, somewhere left var because scope, somew…

+{

That link explicitly says to add a .eslintrc file to the project. By default, eslint will look for .eslintrc in the project directory (the parent directory when running the tool). So let's keep it .eslintrc and remove the --config in the npm script.

salesh

comment created time in 6 hours

startedjoelpurra/gitslave

started time in 7 hours

push eventnearform/brokeneck

Simone Busoli

commit sha b94b80db1def05857d136b7a7774e64f1ee34bbb

test: adjust coverage thresholds

view details

push time in 7 hours

push eventnearform/brokeneck

Simone Busoli

commit sha 86fded645691a63a8c6eea15ca4062205fb84ac4

feat: edit entities (#56)

view details

RudyRed

commit sha 2bc4e669f7e2583377e299083620f045d60827b3

test: add error boundary tests

view details

RudyRed

commit sha 8cdd2b087a1a54f87db31d334ad2bbdf26f42bed

test: created EntityFields test

view details

RudyRed

commit sha 7a96c42f4c0f8779f8790423a7cde26bf8cd6028

test: created GraphQLErrorBoundary test

view details

RudyRed

commit sha 80fbd946a0226735f434b583e654ea049c2f73de

test: create group tests

view details

RudyRed

commit sha 1c89473acc228fe8873681c4718a096483854abc

test: create user tests

view details

Simone Busoli

commit sha 464bf2237d5a3795d96633e94cf3426a4291bb85

test: use locale-independent assertion on dates

view details

Simone Busoli

commit sha 9f3b527622378552c9fb1b0d79b3034a6ac33fdb

test: fix mock root context

view details

Simone Busoli

commit sha c7e22d773283af611ef1c9892ad5b67f0aae6d0a

Merge branch 'test/react-components' of https://github.com/nearform/brokeneck into test/react-components

view details

push time in 8 hours

created repositorymikeal/npm-registry-data-in-ipld

experiments and examples

created time in 8 hours

issue commentnodejs/TSC

Node.js Technical Steering Committee (TSC) Meeting 2021-01-14

Github landed those features last week; so it might be time to do the rename.

Did they communicate about it? I couldn't find anything on the GitHub blog.

https://github.com/github/renaming#renaming-existing-branches

mhdawson

comment created time in 8 hours

push eventnearform/titus

renovate[bot]

commit sha a997c5901445fec370c0f3b971f57b72a2d43cb7

fix(deps): update dependency pino to ^6.10.0 (#679) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

push time in 8 hours

more