@mongodb-js/compass-components 1.70.0 → 1.70.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"bson-value.d.ts","sourceRoot":"","sources":["../../src/components/bson-value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAalC,KAAK,YAAY,GAAG,WAAW,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEnD,KAAK,UAAU,GAAG,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI;IACnD,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAgDF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CACtD,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG;IACjC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAoBF,CAAC;AAqbF,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,qBAqDnE;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"bson-value.d.ts","sourceRoot":"","sources":["../../src/components/bson-value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAYlC,KAAK,YAAY,GAAG,WAAW,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEnD,KAAK,UAAU,GAAG,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI;IACnD,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAgDF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CACtD,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG;IACjC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAoBF,CAAC;AA+cF,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,qBAqDnE;AAED,eAAe,SAAS,CAAC"}
@@ -37,7 +37,6 @@ exports.BSONValueContainer = void 0;
37
37
  const react_1 = __importStar(require("react"));
38
38
  const hadron_type_checker_1 = require("hadron-type-checker");
39
39
  const bson_1 = require("bson");
40
- const mongodb_query_parser_1 = require("mongodb-query-parser");
41
40
  const leafygreen_1 = require("./leafygreen");
42
41
  const tokens_1 = require("@leafygreen-ui/tokens");
43
42
  const emotion_1 = require("@leafygreen-ui/emotion");
@@ -297,9 +296,34 @@ const KeyValue = ({ type }) => {
297
296
  }, [type]);
298
297
  return (react_1.default.createElement(exports.BSONValueContainer, { type: type, title: stringifiedValue }, stringifiedValue));
299
298
  };
299
+ function stringifyValue(value) {
300
+ if (value === undefined) {
301
+ return 'undefined';
302
+ }
303
+ if ((0, hadron_type_checker_1.isBsonValue)(value)) {
304
+ return value.inspect().replace(/^new /, '');
305
+ }
306
+ if (Array.isArray(value)) {
307
+ return `[${value.map(stringifyValue).join(',')}]`;
308
+ }
309
+ if (value !== null && typeof value === 'object') {
310
+ return `{${Object.entries(value)
311
+ .map(([k, v]) => `${JSON.stringify(k)}:${stringifyValue(v)}`)
312
+ .join(',')}}`;
313
+ }
314
+ return JSON.stringify(value);
315
+ }
300
316
  const DBRefValue = ({ value, }) => {
301
317
  const stringifiedValue = (0, react_1.useMemo)(() => {
302
- return (0, mongodb_query_parser_1.toJSString)(value, 0);
318
+ const args = [JSON.stringify(value.collection), stringifyValue(value.oid)];
319
+ const hasFields = Object.keys(value.fields ?? {}).length > 0;
320
+ if (value.db || hasFields) {
321
+ args.push(stringifyValue(value.db));
322
+ }
323
+ if (hasFields) {
324
+ args.push(stringifyValue(value.fields));
325
+ }
326
+ return `DBRef(${args.join(', ')})`;
303
327
  }, [value]);
304
328
  return (react_1.default.createElement(exports.BSONValueContainer, { type: "DBRef", title: stringifiedValue }, stringifiedValue));
305
329
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongodb-js/compass-components",
3
- "version": "1.70.0",
3
+ "version": "1.70.1",
4
4
  "description": "React Components used in Compass",
5
5
  "license": "SSPL",
6
6
  "main": "dist/index.js",
@@ -35,70 +35,69 @@
35
35
  "@dnd-kit/core": "^6.0.7",
36
36
  "@dnd-kit/sortable": "^7.0.2",
37
37
  "@dnd-kit/utilities": "^3.2.1",
38
- "@leafygreen-ui/avatar": "^3.3.0",
39
- "@leafygreen-ui/badge": "^10.2.4",
40
- "@leafygreen-ui/banner": "^10.2.5",
41
- "@leafygreen-ui/button": "^25.2.1",
42
- "@leafygreen-ui/card": "^13.3.1",
43
- "@leafygreen-ui/checkbox": "^18.1.5",
44
- "@leafygreen-ui/chip": "^4.2.1",
45
- "@leafygreen-ui/code": "^20.2.8",
46
- "@leafygreen-ui/combobox": "^12.5.1",
47
- "@leafygreen-ui/confirmation-modal": "^11.0.1",
48
- "@leafygreen-ui/copyable": "^12.0.3",
49
- "@leafygreen-ui/drawer": "^5.2.3",
50
- "@leafygreen-ui/emotion": "^5.2.0",
51
- "@leafygreen-ui/guide-cue": "^8.2.0",
52
- "@leafygreen-ui/hooks": "^9.3.1",
53
- "@leafygreen-ui/icon": "^14.9.0",
54
- "@leafygreen-ui/icon-button": "^17.1.5",
55
- "@leafygreen-ui/info-sprinkle": "^5.0.11",
56
- "@leafygreen-ui/input-option": "^4.1.5",
57
- "@leafygreen-ui/leafygreen-provider": "^5.0.4",
58
- "@leafygreen-ui/logo": "^11.1.0",
59
- "@leafygreen-ui/marketing-modal": "^8.2.1",
60
- "@leafygreen-ui/menu": "^33.2.1",
61
- "@leafygreen-ui/modal": "^22.0.1",
62
- "@leafygreen-ui/palette": "^5.0.2",
63
- "@leafygreen-ui/pipeline": "^8.0.10",
64
- "@leafygreen-ui/polymorphic": "^3.1.0",
65
- "@leafygreen-ui/popover": "^14.3.2",
66
- "@leafygreen-ui/portal": "^7.1.0",
67
- "@leafygreen-ui/progress-bar": "^1.0.8",
68
- "@leafygreen-ui/radio-box-group": "^15.0.11",
69
- "@leafygreen-ui/radio-group": "^13.0.12",
70
- "@leafygreen-ui/search-input": "^6.1.3",
71
- "@leafygreen-ui/segmented-control": "^11.1.0",
72
- "@leafygreen-ui/select": "^17.1.0",
73
- "@leafygreen-ui/skeleton-loader": "^3.0.11",
74
- "@leafygreen-ui/split-button": "^6.3.1",
75
- "@leafygreen-ui/table": "^15.2.3",
76
- "@leafygreen-ui/tabs": "^17.0.11",
77
- "@leafygreen-ui/text-area": "^12.1.5",
78
- "@leafygreen-ui/text-input": "^16.2.3",
79
- "@leafygreen-ui/toast": "^8.1.3",
80
- "@leafygreen-ui/toggle": "^12.1.5",
81
- "@leafygreen-ui/tokens": "^4.2.2",
82
- "@leafygreen-ui/tooltip": "^14.3.2",
83
- "@leafygreen-ui/typography": "^22.2.4",
84
- "@lg-chat/chat-window": "^6.0.2",
85
- "@lg-chat/input-bar": "^12.2.2",
86
- "@lg-chat/leafygreen-chat-provider": "^6.0.0",
87
- "@lg-chat/message": "^12.0.0",
88
- "@lg-chat/message-prompts": "^4.2.2",
89
- "@mongodb-js/compass-context-menu": "^0.3.17",
38
+ "@leafygreen-ui/avatar": "^3.3.1",
39
+ "@leafygreen-ui/badge": "^10.2.5",
40
+ "@leafygreen-ui/banner": "^10.2.6",
41
+ "@leafygreen-ui/button": "^25.2.2",
42
+ "@leafygreen-ui/card": "^13.3.2",
43
+ "@leafygreen-ui/checkbox": "^18.1.6",
44
+ "@leafygreen-ui/chip": "^4.2.2",
45
+ "@leafygreen-ui/code": "^20.2.9",
46
+ "@leafygreen-ui/combobox": "^12.5.2",
47
+ "@leafygreen-ui/confirmation-modal": "^11.0.2",
48
+ "@leafygreen-ui/copyable": "^12.0.4",
49
+ "@leafygreen-ui/drawer": "^5.2.4",
50
+ "@leafygreen-ui/emotion": "^5.2.1",
51
+ "@leafygreen-ui/guide-cue": "^8.2.1",
52
+ "@leafygreen-ui/hooks": "^9.3.2",
53
+ "@leafygreen-ui/icon": "^14.9.1",
54
+ "@leafygreen-ui/icon-button": "^17.1.6",
55
+ "@leafygreen-ui/info-sprinkle": "^5.0.12",
56
+ "@leafygreen-ui/input-option": "^4.1.6",
57
+ "@leafygreen-ui/leafygreen-provider": "^5.0.5",
58
+ "@leafygreen-ui/logo": "^11.1.1",
59
+ "@leafygreen-ui/marketing-modal": "^8.2.2",
60
+ "@leafygreen-ui/menu": "^33.2.2",
61
+ "@leafygreen-ui/modal": "^22.0.2",
62
+ "@leafygreen-ui/palette": "^5.0.3",
63
+ "@leafygreen-ui/pipeline": "^8.0.11",
64
+ "@leafygreen-ui/polymorphic": "^3.1.1",
65
+ "@leafygreen-ui/popover": "^14.3.3",
66
+ "@leafygreen-ui/portal": "^7.1.1",
67
+ "@leafygreen-ui/progress-bar": "^1.0.9",
68
+ "@leafygreen-ui/radio-box-group": "^15.0.12",
69
+ "@leafygreen-ui/radio-group": "^13.0.13",
70
+ "@leafygreen-ui/search-input": "^6.1.4",
71
+ "@leafygreen-ui/segmented-control": "^11.1.1",
72
+ "@leafygreen-ui/select": "^17.1.1",
73
+ "@leafygreen-ui/skeleton-loader": "^3.0.12",
74
+ "@leafygreen-ui/split-button": "^6.3.2",
75
+ "@leafygreen-ui/table": "^15.2.4",
76
+ "@leafygreen-ui/tabs": "^17.0.12",
77
+ "@leafygreen-ui/text-area": "^12.1.6",
78
+ "@leafygreen-ui/text-input": "^16.2.4",
79
+ "@leafygreen-ui/toast": "^8.1.4",
80
+ "@leafygreen-ui/toggle": "^12.1.6",
81
+ "@leafygreen-ui/tokens": "^4.2.3",
82
+ "@leafygreen-ui/tooltip": "^14.3.3",
83
+ "@leafygreen-ui/typography": "^22.2.5",
84
+ "@lg-chat/chat-window": "^6.0.3",
85
+ "@lg-chat/input-bar": "^12.2.3",
86
+ "@lg-chat/leafygreen-chat-provider": "^6.0.1",
87
+ "@lg-chat/message": "^12.0.1",
88
+ "@lg-chat/message-prompts": "^4.2.3",
89
+ "@mongodb-js/compass-context-menu": "^0.3.18",
90
90
  "@mongodb-js/diagramming": "^2.4.1",
91
91
  "@react-aria/interactions": "^3.9.1",
92
92
  "@react-aria/utils": "^3.13.1",
93
93
  "@react-aria/visually-hidden": "^3.3.1",
94
94
  "bson": "^7.3.2",
95
95
  "focus-trap-react": "^9.0.2",
96
- "hadron-document": "^8.12.1",
97
- "hadron-type-checker": "^7.5.10",
96
+ "hadron-document": "^8.12.2",
97
+ "hadron-type-checker": "^7.5.11",
98
98
  "is-electron-renderer": "^2.0.1",
99
99
  "lodash": "^4.18.1",
100
- "mongodb-query-parser": "^5.0.5",
101
- "mongodb-query-util": "^2.6.10",
100
+ "mongodb-query-util": "^2.6.11",
102
101
  "polished": "^4.2.2",
103
102
  "react": "^18.3.1",
104
103
  "react-dom": "^18.3.1",
@@ -109,11 +108,11 @@
109
108
  },
110
109
  "devDependencies": {
111
110
  "@emotion/css": "^11.13.5",
112
- "@leafygreen-ui/lib": "^15.7.0",
113
- "@mongodb-js/eslint-config-compass": "^1.4.27",
111
+ "@leafygreen-ui/lib": "^15.7.1",
112
+ "@mongodb-js/eslint-config-compass": "^1.4.28",
114
113
  "@mongodb-js/mocha-config-compass": "^1.8.1",
115
114
  "@mongodb-js/prettier-config-compass": "^1.2.9",
116
- "@mongodb-js/testing-library-compass": "^1.7.1",
115
+ "@mongodb-js/testing-library-compass": "^1.7.2",
117
116
  "@mongodb-js/tsconfig-compass": "^1.3.1",
118
117
  "@types/chai": "^4.2.21",
119
118
  "@types/chai-dom": "^0.0.10",
@@ -133,5 +132,5 @@
133
132
  "publishConfig": {
134
133
  "access": "public"
135
134
  },
136
- "gitHead": "13069dd486790839d988fbef8ff12c1056fa86c8"
135
+ "gitHead": "ef7b44ec5ff794f83d167daa4146b0bdcab5e0a3"
137
136
  }