Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy #5115

Merged
merged 15 commits into from
Feb 25, 2020
Merged

Deploy #5115

merged 15 commits into from
Feb 25, 2020

Conversation

artsyit
Copy link
Contributor

@artsyit artsyit commented Feb 25, 2020

This is an automatically generated release PR!

@artsy-peril
Copy link
Contributor

artsy-peril bot commented Feb 25, 2020

New dependencies added: express-http-context, @babel/plugin-proposal-nullish-coalescing-operator and @babel/plugin-proposal-optional-chaining.

express-http-context

Author: Steve Konves

Description: Get and set request-scoped context anywhere

Homepage: https://github.com/skonves/express-http-context#readme

Createdabout 3 years ago
Last Updated8 months ago
LicenseMIT
Maintainers1
Releases16
Direct Dependencies@types/cls-hooked, @types/express and cls-hooked
Keywordsexpress, http, request and context
README

travis
coveralls
npm
npm
david

Express HTTP Context

Get and set request-scoped context anywhere. This is just an unopinionated, idiomatic ExpressJS implementation of cls-hooked (forked from continuation-local-storage). It's a great place to store user state, claims from a JWT, request/correlation IDs, and any other request-scoped data. Context is preserved even over async/await (in node 8+).

How to use it

Install: npm install --save express-http-context
(Note: For node v4-7, use the legacy version: npm install --save express-http-context@<1.0.0)

Use the middleware immediately before the first middleware that needs to have access to the context.
You won't have access to the context in any middleware "used" before this one.

Note that some popular middlewares (such as body-parser, express-jwt) may cause context to get lost.
To workaround such issues, you are advised to use any third party middleware that does NOT need the context
BEFORE you use this middleware.

var express = require('express');
var httpContext = require('express-http-context');

var app = express();
// Use any third party middleware that does not need access to the context here, e.g. 
// app.use(some3rdParty.middleware);
app.use(httpContext.middleware);
// all code from here on has access to the same context for each request

Set values based on the incoming request:

// Example authorization middleware
app.use((req, res, next) => {
	userService.getUser(req.get('Authorization'), (err, result) => {
		if (err) {
			next(err);
		} else {
			httpContext.set('user', result.user)
			next();
		}
	});
});

Get them from code that doesn't have access to the express req object:

var httpContext = require('express-http-context');

// Somewhere deep in the Todo Service
function createTodoItem(title, content, callback) {
	var user = httpContext.get('user');
	db.insert({ title, content, userId: user.id }, callback);
}

You can access cls namespace directly as (it may be useful if you want to apply some patch to it, for example https://github.com/TimBeyer/cls-bluebird):

var ns = require('express-http-context').ns;

Troubleshooting

To avoid weird behavior with express:

  1. Make sure you require express-http-context in the first row of your app. Some popular packages use async which breaks CLS.

For users of Node 10

  1. Node 10.0.x - 10.3.x are not supported. V8 version 6.6 introduced a bug that breaks async_hooks during async/await. Node 10.4.x uses V8 v6.7 in which the bug is fixed. See: Different async_hooks behavior in Node 10 nodejs/node#20274.

See Issue #4 for more context. If you find any other weird behaviors, please feel free to open an issue.

Contributors

Interesting in contributing? Take a look at the Contributing Guidlines

@babel/plugin-proposal-nullish-coalescing-operator

Author: Unknown

Description: Remove nullish coalescing operator

Homepage: http://npmjs.com/package/@babel/plugin-proposal-nullish-coalescing-operator

Createdover 2 years ago
Last Updatedabout 1 month ago
LicenseMIT
Maintainers6
Releases40
Direct Dependencies@babel/helper-plugin-utils and @babel/plugin-syntax-nullish-coalescing-operator
Keywordsbabel-plugin
README

@babel/plugin-proposal-nullish-coalescing-operator

Remove nullish coalescing operator

See our website @babel/plugin-proposal-nullish-coalescing-operator for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-proposal-nullish-coalescing-operator

or using yarn:

yarn add @babel/plugin-proposal-nullish-coalescing-operator --dev

@babel/plugin-proposal-optional-chaining

Author: Unknown

Description: Transform optional chaining operators into a series of nil checks

Homepage: http://npmjs.com/package/@babel/plugin-proposal-optional-chaining

Createdover 2 years ago
Last Updatedabout 1 month ago
LicenseMIT
Maintainers6
Releases40
Direct Dependencies@babel/helper-plugin-utils and @babel/plugin-syntax-optional-chaining
Keywordsbabel-plugin
README

@babel/plugin-proposal-optional-chaining

Transform optional chaining operators into a series of nil checks

See our website @babel/plugin-proposal-optional-chaining for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-proposal-optional-chaining

or using yarn:

yarn add @babel/plugin-proposal-optional-chaining --dev

This deploy contains the following PRs:

Generated by 🚫 dangerJS against 4acd268

@codecov
Copy link

codecov bot commented Feb 25, 2020

Codecov Report

Merging #5115 into release will decrease coverage by <.1%.
The diff coverage is 50%.

@@            Coverage Diff            @@
##           release   #5115     +/-   ##
=========================================
- Coverage     79.2%   79.2%   -0.1%     
=========================================
  Files         1251    1251             
  Lines        34107   34116      +9     
  Branches      2032    2034      +2     
=========================================
+ Hits         27029   27030      +1     
- Misses        6056    6063      +7     
- Partials      1022    1023      +1

@mzikherman mzikherman merged commit 890d484 into release Feb 25, 2020
@mzikherman mzikherman deleted the staging branch February 25, 2020 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants