Skip to content

Commit 7bc3e60

Browse files
authored
Merge branch 'main' into COMPASS-8459-move-generative-ai-sign-in-enable-to-gen-ai-package
2 parents d1514f8 + fac4f9d commit 7bc3e60

File tree

50 files changed

+920
-597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+920
-597
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **Mongodb Compass**.
2-
This document was automatically generated on Thu Nov 07 2024.
2+
This document was automatically generated on Fri Nov 08 2024.
33

44
## List of dependencies
55

docs/tracking-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Compass Tracking Plan
33

4-
Generated on Thu, Nov 7, 2024 at 05:59 PM
4+
Generated on Fri, Nov 8, 2024 at 03:38 PM
55

66
## Table of Contents
77

package-lock.json

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

packages/atlas-service/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"email": "[email protected]"
1414
},
1515
"homepage": "https://github.com/mongodb-js/compass",
16-
"version": "0.31.1",
16+
"version": "0.32.0",
1717
"repository": {
1818
"type": "git",
1919
"url": "https://github.com/mongodb-js/compass.git"
@@ -83,7 +83,7 @@
8383
"@mongodb-js/devtools-proxy-support": "^0.4.1",
8484
"@mongodb-js/oidc-plugin": "^1.1.1",
8585
"hadron-app-registry": "^9.2.7",
86-
"compass-preferences-model": "^2.29.3",
86+
"compass-preferences-model": "^2.30.0",
8787
"electron": "^32.2.2",
8888
"hadron-ipc": "^3.2.25",
8989
"lodash": "^4.17.21",

packages/atlas-service/src/atlas-service.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,30 @@ describe('AtlasService', function () {
132132
);
133133
expect(getAuthHeadersFn.calledOnce).to.be.true;
134134
});
135+
136+
it('should set CSRF headers when available', async function () {
137+
const fetchStub = sandbox.stub().resolves({ status: 200, ok: true });
138+
global.fetch = fetchStub;
139+
document.head.append(
140+
(() => {
141+
const el = document.createElement('meta');
142+
el.setAttribute('name', 'csrf-token');
143+
el.setAttribute('content', 'token');
144+
return el;
145+
})()
146+
);
147+
document.head.append(
148+
(() => {
149+
const el = document.createElement('meta');
150+
el.setAttribute('name', 'CSRF-TIME');
151+
el.setAttribute('content', 'time');
152+
return el;
153+
})()
154+
);
155+
await atlasService.fetch('/foo/bar', { method: 'POST' });
156+
expect(fetchStub.firstCall.lastArg.headers).to.deep.eq({
157+
'X-CSRF-Time': 'time',
158+
'X-CSRF-Token': 'token',
159+
});
160+
});
135161
});

packages/atlas-service/src/atlas-service.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ function normalizePath(path?: string) {
1919
return encodeURI(path);
2020
}
2121

22+
function getCSRFHeaders() {
23+
return {
24+
'X-CSRF-Token':
25+
document
26+
.querySelector('meta[name="csrf-token" i]')
27+
?.getAttribute('content') ?? '',
28+
'X-CSRF-Time':
29+
document
30+
.querySelector('meta[name="csrf-time" i]')
31+
?.getAttribute('content') ?? '',
32+
};
33+
}
34+
35+
function shouldAddCSRFHeaders(method = 'get') {
36+
return !/^(get|head|options|trace)$/.test(method.toLowerCase());
37+
}
38+
2239
export class AtlasService {
2340
private config: AtlasServiceConfig;
2441
constructor(
@@ -60,6 +77,7 @@ export class AtlasService {
6077
...init,
6178
headers: {
6279
...this.options?.defaultHeaders,
80+
...(shouldAddCSRFHeaders(init?.method) && getCSRFHeaders()),
6381
...init?.headers,
6482
},
6583
});

packages/compass-aggregations/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@mongodb-js/compass-aggregations",
33
"description": "Compass Aggregation Pipeline Builder",
44
"private": true,
5-
"version": "9.48.0",
5+
"version": "9.49.0",
66
"main": "dist/index.js",
77
"compass:main": "src/index.ts",
88
"types": "dist/index.d.ts",
@@ -61,25 +61,25 @@
6161
"@dnd-kit/core": "^6.0.7",
6262
"@dnd-kit/sortable": "^7.0.2",
6363
"@dnd-kit/utilities": "^3.2.1",
64-
"@mongodb-js/atlas-service": "^0.31.1",
65-
"@mongodb-js/compass-app-stores": "^7.32.0",
66-
"@mongodb-js/compass-collection": "^4.45.0",
64+
"@mongodb-js/atlas-service": "^0.32.0",
65+
"@mongodb-js/compass-app-stores": "^7.33.0",
66+
"@mongodb-js/compass-collection": "^4.46.0",
6767
"@mongodb-js/compass-components": "^1.31.1",
68-
"@mongodb-js/compass-connections": "^1.46.0",
69-
"@mongodb-js/compass-crud": "^13.46.0",
68+
"@mongodb-js/compass-connections": "^1.47.0",
69+
"@mongodb-js/compass-crud": "^13.47.0",
7070
"@mongodb-js/compass-editor": "^0.33.0",
71-
"@mongodb-js/compass-field-store": "^9.21.0",
72-
"@mongodb-js/compass-generative-ai": "^0.26.0",
71+
"@mongodb-js/compass-field-store": "^9.22.0",
72+
"@mongodb-js/compass-generative-ai": "^0.27.0",
7373
"@mongodb-js/compass-logging": "^1.4.10",
7474
"@mongodb-js/compass-telemetry": "^1.2.3",
7575
"@mongodb-js/compass-utils": "^0.6.14",
76-
"@mongodb-js/compass-workspaces": "^0.27.0",
76+
"@mongodb-js/compass-workspaces": "^0.28.0",
7777
"@mongodb-js/explain-plan-helper": "^1.2.4",
7878
"@mongodb-js/mongodb-constants": "^0.10.0",
7979
"@mongodb-js/my-queries-storage": "^0.19.0",
8080
"@mongodb-js/shell-bson-parser": "^1.1.2",
8181
"bson": "^6.8.0",
82-
"compass-preferences-model": "^2.29.3",
82+
"compass-preferences-model": "^2.30.0",
8383
"hadron-app-registry": "^9.2.7",
8484
"hadron-document": "^8.6.5",
8585
"hadron-type-checker": "^7.2.3",

packages/compass-app-stores/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"email": "[email protected]"
1212
},
1313
"homepage": "https://github.com/mongodb-js/compass",
14-
"version": "7.32.0",
14+
"version": "7.33.0",
1515
"repository": {
1616
"type": "git",
1717
"url": "https://github.com/mongodb-js/compass.git"
@@ -74,7 +74,7 @@
7474
},
7575
"dependencies": {
7676
"@mongodb-js/compass-components": "^1.31.1",
77-
"@mongodb-js/compass-connections": "^1.46.0",
77+
"@mongodb-js/compass-connections": "^1.47.0",
7878
"@mongodb-js/compass-logging": "^1.4.10",
7979
"@mongodb-js/connection-info": "^0.9.3",
8080
"hadron-app-registry": "^9.2.7",

packages/compass-collection/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"email": "[email protected]"
1212
},
1313
"homepage": "https://github.com/mongodb-js/compass",
14-
"version": "4.45.0",
14+
"version": "4.46.0",
1515
"repository": {
1616
"type": "git",
1717
"url": "https://github.com/mongodb-js/compass.git"
@@ -48,15 +48,15 @@
4848
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
4949
},
5050
"dependencies": {
51-
"@mongodb-js/compass-app-stores": "^7.32.0",
51+
"@mongodb-js/compass-app-stores": "^7.33.0",
5252
"@mongodb-js/compass-components": "^1.31.1",
53-
"@mongodb-js/compass-connections": "^1.46.0",
53+
"@mongodb-js/compass-connections": "^1.47.0",
5454
"@mongodb-js/compass-logging": "^1.4.10",
5555
"@mongodb-js/compass-telemetry": "^1.2.3",
56-
"@mongodb-js/compass-workspaces": "^0.27.0",
56+
"@mongodb-js/compass-workspaces": "^0.28.0",
5757
"@mongodb-js/connection-info": "^0.9.3",
5858
"@mongodb-js/mongodb-constants": "^0.10.2",
59-
"compass-preferences-model": "^2.29.3",
59+
"compass-preferences-model": "^2.30.0",
6060
"hadron-app-registry": "^9.2.7",
6161
"mongodb-collection-model": "^5.23.7",
6262
"mongodb-ns": "^2.4.2",

packages/compass-components/src/components/document-list/document.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ const HadronDocument: React.FunctionComponent<{
8585
editable?: boolean;
8686
editing?: boolean;
8787
onEditStart?: () => void;
88-
}> = ({ value: document, editable = false, editing = false, onEditStart }) => {
88+
extraGutterWidth?: number;
89+
}> = ({
90+
value: document,
91+
editable = false,
92+
editing = false,
93+
onEditStart,
94+
extraGutterWidth,
95+
}) => {
8996
const { elements, visibleElements } = useHadronDocument(document);
9097
const [autoFocus, setAutoFocus] = useState<{
9198
id: string;
@@ -113,8 +120,9 @@ const HadronDocument: React.FunctionComponent<{
113120
editable,
114121
level: 0,
115122
alignWithNestedExpandIcon: false,
123+
extraGutterWidth,
116124
}),
117-
[editable]
125+
[editable, extraGutterWidth]
118126
);
119127

120128
return (
@@ -147,6 +155,7 @@ const HadronDocument: React.FunctionComponent<{
147155
type: el.parent?.currentType === 'Array' ? 'value' : 'key',
148156
});
149157
}}
158+
extraGutterWidth={extraGutterWidth}
150159
></HadronElement>
151160
);
152161
})}

0 commit comments

Comments
 (0)