Skip to content

Commit 139c8dc

Browse files
authored
chore: Update bson to latest and exclude it from plugins dist by adding module to peer dependencies list (#2299)
* chore: Update bson to latest and exclude it from plugins dist by adding module to peer dependencies list * test(@mongodb-js/compass-query-history): Update assertion to match bson 4 output * test(@mongodb-js/compass-import-export): Remove bson v1 test case * fix(mongodb-compass): depcheck ignore bson, it's used by the app, but not directly
1 parent a8a34bb commit 139c8dc

File tree

16 files changed

+3179
-3818
lines changed

16 files changed

+3179
-3818
lines changed

package-lock.json

Lines changed: 3139 additions & 3774 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-aggregations/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@mongodb-js/compass-export-to-language": "*",
3232
"@mongodb-js/compass-field-store": "*",
3333
"async": "^1.5.2",
34+
"bson": "*",
3435
"electron": "*",
3536
"hadron-react-bson": "*",
3637
"hadron-react-buttons": "*",
@@ -151,7 +152,7 @@
151152
"@mongodb-js/mongodb-redux-common": "^1.3.0",
152153
"acorn-loose": "^8.0.2",
153154
"astring": "^1.7.0",
154-
"bson": "4.1.0",
155+
"bson": "^4.4.0",
155156
"decomment": "^0.9.2",
156157
"is-electron-renderer": "^2.0.1",
157158
"lodash.debounce": "^4.0.8",

packages/compass-collection/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"autoprefixer": "^9.7.4",
6969
"babel-loader": "^8.2.2",
7070
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz",
71-
"bson": "4.1.0",
71+
"bson": "^4.4.0",
7272
"bson-transpilers": "^0.15.0",
7373
"chai": "^4.2.0",
7474
"chai-enzyme": "1.0.0-beta.1",

packages/compass-crud/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@hot-loader/react-dom": "^16.8.4",
3434
"@mongodb-js/compass-query-bar": "*",
3535
"@mongodb-js/compass-status": "*",
36+
"bson": "*",
3637
"hadron-react-bson": "*",
3738
"hadron-react-buttons": "*",
3839
"hadron-react-components": "*",
@@ -140,7 +141,7 @@
140141
"ag-grid-community": "20.2.0",
141142
"ag-grid-react": "20.2.0",
142143
"brace": "^0.11.1",
143-
"bson": "4.1.0",
144+
"bson": "^4.4.0",
144145
"debug": "^4.1.1",
145146
"fast-json-parse": "^1.0.3",
146147
"hadron-document": "^7.3.0",

packages/compass-import-export/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
},
3131
"license": "SSPL",
3232
"peerDependencies": {
33+
"bson": "*",
3334
"hadron-react-buttons": "*",
3435
"mongodb-ace-theme": "*",
3536
"prop-types": "^15.5.8",
@@ -139,7 +140,7 @@
139140
"dependencies": {
140141
"JSONStream": "^1.3.5",
141142
"ansi-to-html": "^0.6.11",
142-
"bson": "github:addaleax/js-bson#after-the-next-bson-release-you-can-just-use-the-npm-package-again",
143+
"bson": "^4.4.0",
143144
"csv-parser": "^2.3.1",
144145
"fast-csv": "^3.4.0",
145146
"flat": "cipacda/flat",

packages/compass-import-export/src/utils/formatters.spec.js

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,37 +68,26 @@ describe('formatters', () => {
6868
}
6969
});
7070

71-
for (const bsonVersion of ['v1', 'v4']) {
72-
it(`works for input from bson version ${bsonVersion}`, async() => {
73-
// The driver returns bson v1.x objects to us. They don't have a
74-
// .toExtendedJSON() method, we simulate that.
75-
class FakeBSON1Binary extends Binary {
76-
get toExtendedJSON() { return undefined; }
77-
}
71+
it('works for input with Binary data', async() => {
72+
const binary = new Binary(Buffer.from('56391cc226bc4affbe520f67856c09ec'), 4);
7873

79-
const binary = new Binary(Buffer.from('56391cc226bc4affbe520f67856c09ec'), 4);
80-
if (bsonVersion === 'v1') {
81-
Object.setPrototypeOf(binary, FakeBSON1Binary.prototype);
82-
}
74+
const docs = [
75+
{
76+
_id: new ObjectID('5e5ea7558d35931a05eafec0'),
77+
test: binary
78+
},
79+
];
80+
const source = stream.Readable.from(docs);
81+
const formatter = createJSONFormatter({brackets: true});
82+
const dest = fs.createWriteStream(FIXTURES.JSON_MULTI_SMALL_DOCS);
8383

84-
const docs = [
85-
{
86-
_id: new ObjectID('5e5ea7558d35931a05eafec0'),
87-
test: binary
88-
},
89-
];
90-
const source = stream.Readable.from(docs);
91-
const formatter = createJSONFormatter({brackets: true});
92-
const dest = fs.createWriteStream(FIXTURES.JSON_MULTI_SMALL_DOCS);
84+
await pipeline(source, formatter, dest);
9385

94-
await pipeline(source, formatter, dest);
86+
const contents = await readFile(FIXTURES.JSON_MULTI_SMALL_DOCS);
87+
const parsed = EJSON.parse(contents);
9588

96-
const contents = await readFile(FIXTURES.JSON_MULTI_SMALL_DOCS);
97-
const parsed = EJSON.parse(contents);
98-
99-
expect(parsed).to.deep.equal(docs);
100-
});
101-
}
89+
expect(parsed).to.deep.equal(docs);
90+
});
10291
});
10392
});
10493
describe('jsonl', () => {

packages/compass-query-history/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@
3939
},
4040
"dependencies": {
4141
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz",
42-
"bson": "4.1.0",
42+
"bson": "^4.4.0",
4343
"highlight.js": "^9.12.0",
4444
"lodash": "^4.17.15"
4545
},
4646
"peerDependencies": {
47+
"bson": "*",
4748
"debug": "*",
4849
"hadron-react-components": "*",
4950
"mongodb-query-parser": "*",

packages/compass-query-history/src/utils/format-query.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('formatQuery [Utils]', () => {
6161
describe('when the property has a Decimal128', () => {
6262
const value = new bson.Decimal128('0.00');
6363
const filter = { field: value };
64-
const expected = '{\n field: NumberDecimal(\'0E-6176\')\n}';
64+
const expected = '{\n field: NumberDecimal(\'0.00\')\n}';
6565

6666
it('returns the shell syntax string', () => {
6767
expect(formatQuery(filter)).to.equal(expected);

packages/compass-schema-validation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"babel-loader": "^8.2.2",
6565
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz",
6666
"brace": "^0.11.1",
67-
"bson": "4.1.0",
67+
"bson": "^4.4.0",
6868
"chai": "^4.1.2",
6969
"chai-enzyme": "1.0.0-beta.1",
7070
"classnames": "^2.2.5",

packages/compass-schema/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"peerDependencies": {
2727
"@mongodb-js/compass-query-bar": "*",
2828
"@mongodb-js/compass-status": "*",
29-
"bson": "4.1.0",
29+
"bson": "*",
3030
"d3": "3.5.17",
3131
"debug": "^3.0.1",
3232
"hadron-ipc": "*",
@@ -55,7 +55,7 @@
5555
"autoprefixer": "^9.4.6",
5656
"babel-loader": "^8.2.2",
5757
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz",
58-
"bson": "4.1.0",
58+
"bson": "^4.4.0",
5959
"chai": "^4.1.2",
6060
"chai-enzyme": "1.0.0-beta.0",
6161
"classnames": "^2.2.5",

0 commit comments

Comments
 (0)