Socket
Socket
Sign inDemoInstall

@mongosh/node-runtime-worker-thread

Package Overview
Dependencies
8
Maintainers
13
Versions
78
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

4

dist/serializer.js

@@ -16,3 +16,5 @@ "use strict";

function serializeError(err) {
const keys = getNames(err).concat('name');
const keys = getNames(err)
.concat('name')
.filter((key) => typeof err[key] !== 'function');
return keys.reduce((acc, key) => {

@@ -19,0 +21,0 @@ acc[key] = err[key];

{
"name": "@mongosh/node-runtime-worker-thread",
"version": "2.1.0",
"version": "2.1.1",
"description": "MongoDB shell runtime that lives in a worker thread",

@@ -40,7 +40,7 @@ "homepage": "https://github.com/mongodb-js/mongosh",

"@mongodb-js/tsconfig-mongosh": "^1.0.0",
"@mongosh/browser-runtime-core": "2.1.0",
"@mongosh/browser-runtime-electron": "2.1.0",
"@mongosh/service-provider-core": "2.1.0",
"@mongosh/service-provider-server": "2.1.0",
"@mongosh/types": "2.1.0",
"@mongosh/browser-runtime-core": "2.1.1",
"@mongosh/browser-runtime-electron": "2.1.1",
"@mongosh/service-provider-core": "2.1.1",
"@mongosh/service-provider-server": "2.1.1",
"@mongosh/types": "2.1.1",
"bson": "^6.2.0",

@@ -58,3 +58,3 @@ "depcheck": "^1.4.3",

},
"gitHead": "963c75bc45834b1bf69e62bf5b72c4ae8ef26cb4"
"gitHead": "c7e70b65988d21c9020abf2bbd253a94b1d3316c"
}

@@ -147,2 +147,46 @@ import path from 'path';

});
it('COMPASS-5919 - correctly serializes babel parse errors', async function () {
/**
* babel syntax errors have a `clone()` method, which breaks structured cloning
*/
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});
const err: Error = await runtime.evaluate('1 +* 3').catch((e) => e);
expect(err).to.be.instanceof(Error);
expect(err).to.have.property('name', 'SyntaxError');
});
context(
'when `evaluate` returns an error that has a function property',
function () {
it('removes the function property from the error', async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});
const script = `
class CustomError extends Error {
constructor() {
super('custom error');
}
foo() {
return 'hello, world';
}
}
throw new CustomError();
`;
const err: Error = await runtime.evaluate(script).catch((e) => e);
expect(err).to.be.instanceof(Error);
expect(err).to.have.property('name', 'Error');
expect(err).not.to.have.property('foo');
expect(err).to.have.property('message', 'custom error');
});
}
);
});

@@ -149,0 +193,0 @@ });

@@ -30,3 +30,6 @@ import { inspect } from 'util';

// Name is the only constructor property we care about
const keys = getNames(err).concat('name');
const keys = getNames(err)
.concat('name')
// structured cloning cannot handle functions
.filter((key) => typeof err[key] !== 'function');
return keys.reduce((acc, key) => {

@@ -33,0 +36,0 @@ (acc as any)[key] = err[key];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc