Skip to content

Commit

Permalink
deps: @npmcli/redact@2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jun 27, 2024
1 parent 29204c8 commit 6f0d7ce
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
29 changes: 24 additions & 5 deletions node_modules/@npmcli/redact/lib/deep-map.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
function filterError (input) {
return {
errorType: input.name,
message: input.message,
stack: input.stack,
...(input.code ? { code: input.code } : {}),
...(input.statusCode ? { statusCode: input.statusCode } : {}),
}
}

const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) => {
// this is in an effort to maintain bole's error logging behavior
if (path.join('.') === '$' && input instanceof Error) {
return deepMap({ err: filterError(input) }, handler, path, seen)
}
if (input instanceof Error) {
return deepMap(filterError(input), handler, path, seen)
}
if (input instanceof Buffer) {
return `[unable to log instanceof buffer]`
}
if (input instanceof Uint8Array) {
return `[unable to log instanceof Uint8Array]`
}

if (Array.isArray(input)) {
const result = []
for (let i = 0; i < input.length; i++) {
Expand All @@ -21,11 +45,6 @@ const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input]))
} else if (typeof input === 'object' || typeof input === 'function') {
const result = {}

if (input instanceof Error) {
// `name` property is not included in `Object.getOwnPropertyNames(error)`
result.errorType = input.name
}

for (const propertyName of Object.getOwnPropertyNames(input)) {
// skip logging internal properties
if (propertyName.startsWith('_')) {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/@npmcli/redact/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@npmcli/redact",
"version": "2.0.0",
"version": "2.0.1",
"description": "Redact sensitive npm information from output",
"main": "lib/index.js",
"exports": {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"@npmcli/map-workspaces": "^3.0.6",
"@npmcli/package-json": "^5.2.0",
"@npmcli/promise-spawn": "^7.0.2",
"@npmcli/redact": "^2.0.0",
"@npmcli/redact": "^2.0.1",
"@npmcli/run-script": "^8.1.0",
"@sigstore/tuf": "^2.3.4",
"abbrev": "^2.0.0",
Expand Down Expand Up @@ -1760,9 +1760,9 @@
}
},
"node_modules/@npmcli/redact": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.0.tgz",
"integrity": "sha512-SEjCPAVHWYUIQR+Yn03kJmrJjZDtJLYpj300m3HV9OTRZNpC5YpbMsM3eTkECyT4aWj8lDr9WeY6TWefpubtYQ==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.1.tgz",
"integrity": "sha512-YgsR5jCQZhVmTJvjduTOIHph0L73pK8xwMVaDY0PatySqVM9AZj93jpoXYSJqfHFxFkN9dmqTw6OiqExsS3LPw==",
"inBundle": true,
"license": "ISC",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@npmcli/map-workspaces": "^3.0.6",
"@npmcli/package-json": "^5.2.0",
"@npmcli/promise-spawn": "^7.0.2",
"@npmcli/redact": "^2.0.0",
"@npmcli/redact": "^2.0.1",
"@npmcli/run-script": "^8.1.0",
"@sigstore/tuf": "^2.3.4",
"abbrev": "^2.0.0",
Expand Down

0 comments on commit 6f0d7ce

Please sign in to comment.