Skip to content

Commit

Permalink
deps: npm-profile@6.1.0 (#5034)
Browse files Browse the repository at this point in the history
  * Allow web-login donecheck to cancel opener promise
  * set 'npm-use-webauthn' header depending on option
  • Loading branch information
wraithgar committed Jun 22, 2022
1 parent 2953983 commit 01eef03
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
23 changes: 21 additions & 2 deletions node_modules/npm-profile/lib/index.js
Expand Up @@ -2,6 +2,7 @@

const fetch = require('npm-registry-fetch')
const { HttpErrorBase } = require('npm-registry-fetch/lib/errors')
const EventEmitter = require('events')
const os = require('os')
const { URL } = require('url')
const log = require('proc-log')
Expand Down Expand Up @@ -59,6 +60,9 @@ const webAuth = (opener, opts, body) => {
...opts,
method: 'POST',
body,
headers: {
'npm-use-webauthn': opts.authType === 'webauthn',
},
}).then(res => {
return Promise.all([res, res.json()])
}).then(([res, content]) => {
Expand All @@ -70,8 +74,23 @@ const webAuth = (opener, opts, body) => {
return content
}).then(({ doneUrl, loginUrl }) => {
log.verbose('web auth', 'opening url pair')
return opener(loginUrl).then(
() => webAuthCheckLogin(doneUrl, { ...opts, cache: false })

const doneEmitter = new EventEmitter()

const openPromise = opener(loginUrl, doneEmitter)
const webAuthCheckPromise = webAuthCheckLogin(doneUrl, { ...opts, cache: false })
.then(authResult => {
log.verbose('web auth', 'done-check finished')

// cancel open prompt if it's present
doneEmitter.emit('abort')

return authResult
})

return Promise.all([openPromise, webAuthCheckPromise]).then(
// pick the auth result and pass it along
([, authResult]) => authResult
)
}).catch(er => {
if ((er.statusCode >= 400 && er.statusCode <= 499) || er.statusCode === 500) {
Expand Down
6 changes: 3 additions & 3 deletions node_modules/npm-profile/package.json
@@ -1,6 +1,6 @@
{
"name": "npm-profile",
"version": "6.0.3",
"version": "6.1.0",
"description": "Library for updating an npmjs.com profile",
"keywords": [],
"author": "GitHub Inc.",
Expand All @@ -20,7 +20,7 @@
],
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.4.1",
"@npmcli/template-oss": "3.4.2",
"nock": "^13.2.4",
"tap": "^16.0.1"
},
Expand All @@ -44,6 +44,6 @@
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.4.1"
"version": "3.4.2"
}
}
14 changes: 7 additions & 7 deletions package-lock.json
Expand Up @@ -133,7 +133,7 @@
"npm-install-checks": "^5.0.0",
"npm-package-arg": "^9.0.2",
"npm-pick-manifest": "^7.0.1",
"npm-profile": "^6.0.3",
"npm-profile": "^6.1.0",
"npm-registry-fetch": "^13.1.1",
"npm-user-validate": "^1.0.1",
"npmlog": "^6.0.2",
Expand Down Expand Up @@ -5173,9 +5173,9 @@
}
},
"node_modules/npm-profile": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-6.0.3.tgz",
"integrity": "sha512-TVeHhnol2Iemud+Sr70/uqax5LnLJ9y361w+m5+Z7WYV2B1t6FhRDxDu72+yYYTvsgshkhnXEqbPjuD87kYXfA==",
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-6.1.0.tgz",
"integrity": "sha512-JHnBzSqS9xPa0M3g90zhaGElSVdxoAipGkraBaM6Jph2XiSiwFN1HmfRTqndYhDkXia2hWRWl8O5RbDvae++GA==",
"inBundle": true,
"dependencies": {
"npm-registry-fetch": "^13.0.1",
Expand Down Expand Up @@ -13646,9 +13646,9 @@
}
},
"npm-profile": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-6.0.3.tgz",
"integrity": "sha512-TVeHhnol2Iemud+Sr70/uqax5LnLJ9y361w+m5+Z7WYV2B1t6FhRDxDu72+yYYTvsgshkhnXEqbPjuD87kYXfA==",
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-6.1.0.tgz",
"integrity": "sha512-JHnBzSqS9xPa0M3g90zhaGElSVdxoAipGkraBaM6Jph2XiSiwFN1HmfRTqndYhDkXia2hWRWl8O5RbDvae++GA==",
"requires": {
"npm-registry-fetch": "^13.0.1",
"proc-log": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -102,7 +102,7 @@
"npm-install-checks": "^5.0.0",
"npm-package-arg": "^9.0.2",
"npm-pick-manifest": "^7.0.1",
"npm-profile": "^6.0.3",
"npm-profile": "^6.1.0",
"npm-registry-fetch": "^13.1.1",
"npm-user-validate": "^1.0.1",
"npmlog": "^6.0.2",
Expand Down

0 comments on commit 01eef03

Please sign in to comment.