diff --git a/package-lock.json b/package-lock.json index 3915f14c91d..9c6c1dbdc44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10182,27 +10182,6 @@ "url": "https://opencollective.com/node-fetch" } }, - "node_modules/@mongodb-js/diagramming": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@mongodb-js/diagramming/-/diagramming-1.8.0.tgz", - "integrity": "sha512-ABg9MVNUm4wD5UijQHf3Il6WSrHPqchmMFHJMJ1OAgMEDXXKJNzUvK1Zhz5iDEEO5uIHOYSQRcCY8MeC9bo+fA==", - "license": "MIT", - "dependencies": { - "@emotion/react": "^11.14.0", - "@emotion/styled": "^11.14.0", - "@leafygreen-ui/icon": "^14.3.0", - "@leafygreen-ui/inline-definition": "^9.0.5", - "@leafygreen-ui/leafygreen-provider": "^5.0.2", - "@leafygreen-ui/palette": "^5.0.0", - "@leafygreen-ui/tokens": "^3.2.1", - "@leafygreen-ui/typography": "^22.1.0", - "@xyflow/react": "12.5.1", - "d3-path": "^3.1.0", - "elkjs": "^0.10.0", - "react": "17.0.2", - "react-dom": "17.0.2" - } - }, "node_modules/@mongodb-js/dl-center": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@mongodb-js/dl-center/-/dl-center-1.3.0.tgz", @@ -49191,6 +49170,232 @@ "xvfb-maybe": "^0.2.1" } }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/emotion": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/emotion/-/emotion-5.0.3.tgz", + "integrity": "sha512-elu8af9Qh8Oy/IwqXcNKitHAQBAO4+zmHuLi0fRzY46kTwXvLYqPpJFRcySqITWLPyBcMsF56ta8yQKXghEYOA==", + "license": "Apache-2.0", + "dependencies": { + "@emotion/css": "^11.1.3", + "@emotion/server": "^11.4.0" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/hooks": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/hooks/-/hooks-9.1.4.tgz", + "integrity": "sha512-Cr+XRTh+8M8g30TjY7YPEHvtJmiPd9Nquc6Kcm/GqUNAPKthMGJIQKyzSlF+mvBDbrvV6dZVZh8mvHdENa2Tfg==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/tokens": "^3.2.4", + "lodash": "^4.17.21" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/hooks/node_modules/@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/icon": { + "version": "14.5.1", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/icon/-/icon-14.5.1.tgz", + "integrity": "sha512-SU0U2yJWox8I5Cs+NWErdxXEK8bp8hvbarIUkvucGDpJ6BGimho1f0v5Df1kQq3vDQRYX413nZeoPTL5b7g4KQ==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/emotion": "^5.0.3", + "lodash": "^4.17.21" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/inline-definition": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/inline-definition/-/inline-definition-9.0.5.tgz", + "integrity": "sha512-GVxxefMclIgUSWJClGIMb//jp2JWRyCLJJ28FsXl80U8LBGmYzt8VvlH9o0nFOcTd9r6Nk1tRsEgJBpuvTo+3w==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/emotion": "^5.0.2", + "@leafygreen-ui/lib": "^15.3.0", + "@leafygreen-ui/palette": "^5.0.2", + "@leafygreen-ui/tokens": "^3.2.4", + "@leafygreen-ui/tooltip": "^14.1.3" + }, + "peerDependencies": { + "@leafygreen-ui/leafygreen-provider": "^5.0.4" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/leafygreen-provider": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/leafygreen-provider/-/leafygreen-provider-5.0.4.tgz", + "integrity": "sha512-VDlmjTiIqlITVhq4VKUDq8FLySWnHkTxSV2n1sxOanLNPuatOXjxsPmCkPUBXhmQKk/fBf4yQnDKOwJvkyzE6Q==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/hooks": "^9.1.3", + "@leafygreen-ui/lib": "^15.3.0", + "react-transition-group": "^4.4.5" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/palette": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/palette/-/palette-5.0.2.tgz", + "integrity": "sha512-+PrfGeJSv4goxm/vKpfJJDOP7t/uElj+14K8jiIyu3qR3TcFRIZ5h1VMvICTUgqvRc8W+xIZYQwsLa2XCu2lvw==", + "license": "Apache-2.0" + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/polymorphic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/polymorphic/-/polymorphic-3.1.0.tgz", + "integrity": "sha512-5fbXD6ExTmMScvODuipfB1Ti/Dvoaxxg+daSftqXfNQlEkEnd5cPnezOOl1LMsu2xUoZT6NXsFgukZYsmXEVpQ==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/lib": "^15.4.0", + "lodash": "^4.17.21" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/polymorphic/node_modules/@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/popover": { + "version": "14.0.6", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/popover/-/popover-14.0.6.tgz", + "integrity": "sha512-H84TSOZbk43kRqrNvly4eMTV/L4SlnrVMPPasH/bOW8knt7dGnSkSjWlawH78qe0yCxt+rWKW7MmUMuaPagNnw==", + "license": "Apache-2.0", + "dependencies": { + "@floating-ui/react": "^0.26.28", + "@leafygreen-ui/emotion": "^5.0.3", + "@leafygreen-ui/hooks": "^9.1.4", + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/portal": "^7.0.4", + "@leafygreen-ui/tokens": "^3.2.4", + "@types/react-transition-group": "^4.4.5", + "lodash": "^4.17.21", + "react-transition-group": "^4.4.5" + }, + "peerDependencies": { + "@leafygreen-ui/leafygreen-provider": "^5.0.4" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/popover/node_modules/@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/popover/node_modules/@leafygreen-ui/portal": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/portal/-/portal-7.0.4.tgz", + "integrity": "sha512-qpxnBlpLzQtP4GCcbTo2M4RYpPuORMjgP+IMJNl2oQAg75DLIIAcRbV5yuMpN1IRsus0fBHykfquSe5UvA13aw==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/hooks": "^9.1.3", + "@leafygreen-ui/lib": "^15.3.0" + }, + "peerDependencies": { + "react-dom": "^17.0.0 || ^18.0.0" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/tooltip": { + "version": "14.1.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/tooltip/-/tooltip-14.1.4.tgz", + "integrity": "sha512-OHuWYuwL6PEMt8fLs8bVhqrEZR4zmvBuKli01bLffxBwQZXhsLg5fsBfY/iqeoIVUd6NR0FlCfNebcqYrP2ccQ==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/emotion": "^5.0.3", + "@leafygreen-ui/hooks": "^9.1.4", + "@leafygreen-ui/icon": "^14.5.1", + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/palette": "^5.0.2", + "@leafygreen-ui/popover": "^14.0.6", + "@leafygreen-ui/tokens": "^3.2.4", + "@leafygreen-ui/typography": "^22.1.3", + "lodash": "^4.17.21", + "polished": "^4.2.2" + }, + "peerDependencies": { + "@leafygreen-ui/leafygreen-provider": "^5.0.4" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/tooltip/node_modules/@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/typography": { + "version": "22.1.3", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/typography/-/typography-22.1.3.tgz", + "integrity": "sha512-yhQGva/0t2wyJe+edt88Dld1FUyw0xXMrHVegjtTH7c7EiLjG1eD4S+ze/Iz4F7Pxm0wXuxV3ZBrHfx2XqR6mA==", + "license": "Apache-2.0", + "dependencies": { + "@leafygreen-ui/emotion": "^5.0.3", + "@leafygreen-ui/icon": "^14.5.1", + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/palette": "^5.0.2", + "@leafygreen-ui/polymorphic": "^3.1.0", + "@leafygreen-ui/tokens": "^3.2.4" + }, + "peerDependencies": { + "@leafygreen-ui/leafygreen-provider": "^5.0.4" + } + }, + "packages/compass-data-modeling/node_modules/@leafygreen-ui/typography/node_modules/@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "packages/compass-data-modeling/node_modules/@mongodb-js/diagramming": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/diagramming/-/diagramming-1.8.0.tgz", + "integrity": "sha512-ABg9MVNUm4wD5UijQHf3Il6WSrHPqchmMFHJMJ1OAgMEDXXKJNzUvK1Zhz5iDEEO5uIHOYSQRcCY8MeC9bo+fA==", + "license": "MIT", + "dependencies": { + "@emotion/react": "^11.14.0", + "@emotion/styled": "^11.14.0", + "@leafygreen-ui/icon": "^14.3.0", + "@leafygreen-ui/inline-definition": "^9.0.5", + "@leafygreen-ui/leafygreen-provider": "^5.0.2", + "@leafygreen-ui/palette": "^5.0.0", + "@leafygreen-ui/tokens": "^3.2.1", + "@leafygreen-ui/typography": "^22.1.0", + "@xyflow/react": "12.5.1", + "d3-path": "^3.1.0", + "elkjs": "^0.10.0", + "react": "17.0.2", + "react-dom": "17.0.2" + } + }, "packages/compass-data-modeling/node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -62879,6 +63084,195 @@ "xvfb-maybe": "^0.2.1" }, "dependencies": { + "@leafygreen-ui/emotion": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/emotion/-/emotion-5.0.3.tgz", + "integrity": "sha512-elu8af9Qh8Oy/IwqXcNKitHAQBAO4+zmHuLi0fRzY46kTwXvLYqPpJFRcySqITWLPyBcMsF56ta8yQKXghEYOA==", + "requires": { + "@emotion/css": "^11.1.3", + "@emotion/server": "^11.4.0" + } + }, + "@leafygreen-ui/hooks": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/hooks/-/hooks-9.1.4.tgz", + "integrity": "sha512-Cr+XRTh+8M8g30TjY7YPEHvtJmiPd9Nquc6Kcm/GqUNAPKthMGJIQKyzSlF+mvBDbrvV6dZVZh8mvHdENa2Tfg==", + "requires": { + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/tokens": "^3.2.4", + "lodash": "^4.17.21" + }, + "dependencies": { + "@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "requires": { + "lodash": "^4.17.21" + } + } + } + }, + "@leafygreen-ui/icon": { + "version": "14.5.1", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/icon/-/icon-14.5.1.tgz", + "integrity": "sha512-SU0U2yJWox8I5Cs+NWErdxXEK8bp8hvbarIUkvucGDpJ6BGimho1f0v5Df1kQq3vDQRYX413nZeoPTL5b7g4KQ==", + "requires": { + "@leafygreen-ui/emotion": "^5.0.3", + "lodash": "^4.17.21" + } + }, + "@leafygreen-ui/inline-definition": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/inline-definition/-/inline-definition-9.0.5.tgz", + "integrity": "sha512-GVxxefMclIgUSWJClGIMb//jp2JWRyCLJJ28FsXl80U8LBGmYzt8VvlH9o0nFOcTd9r6Nk1tRsEgJBpuvTo+3w==", + "requires": { + "@leafygreen-ui/emotion": "^5.0.2", + "@leafygreen-ui/lib": "^15.3.0", + "@leafygreen-ui/palette": "^5.0.2", + "@leafygreen-ui/tokens": "^3.2.4", + "@leafygreen-ui/tooltip": "^14.1.3" + } + }, + "@leafygreen-ui/leafygreen-provider": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/leafygreen-provider/-/leafygreen-provider-5.0.4.tgz", + "integrity": "sha512-VDlmjTiIqlITVhq4VKUDq8FLySWnHkTxSV2n1sxOanLNPuatOXjxsPmCkPUBXhmQKk/fBf4yQnDKOwJvkyzE6Q==", + "requires": { + "@leafygreen-ui/hooks": "^9.1.3", + "@leafygreen-ui/lib": "^15.3.0", + "react-transition-group": "^4.4.5" + } + }, + "@leafygreen-ui/palette": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/palette/-/palette-5.0.2.tgz", + "integrity": "sha512-+PrfGeJSv4goxm/vKpfJJDOP7t/uElj+14K8jiIyu3qR3TcFRIZ5h1VMvICTUgqvRc8W+xIZYQwsLa2XCu2lvw==" + }, + "@leafygreen-ui/polymorphic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/polymorphic/-/polymorphic-3.1.0.tgz", + "integrity": "sha512-5fbXD6ExTmMScvODuipfB1Ti/Dvoaxxg+daSftqXfNQlEkEnd5cPnezOOl1LMsu2xUoZT6NXsFgukZYsmXEVpQ==", + "requires": { + "@leafygreen-ui/lib": "^15.4.0", + "lodash": "^4.17.21" + }, + "dependencies": { + "@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "requires": { + "lodash": "^4.17.21" + } + } + } + }, + "@leafygreen-ui/popover": { + "version": "14.0.6", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/popover/-/popover-14.0.6.tgz", + "integrity": "sha512-H84TSOZbk43kRqrNvly4eMTV/L4SlnrVMPPasH/bOW8knt7dGnSkSjWlawH78qe0yCxt+rWKW7MmUMuaPagNnw==", + "requires": { + "@floating-ui/react": "^0.26.28", + "@leafygreen-ui/emotion": "^5.0.3", + "@leafygreen-ui/hooks": "^9.1.4", + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/portal": "^7.0.4", + "@leafygreen-ui/tokens": "^3.2.4", + "@types/react-transition-group": "^4.4.5", + "lodash": "^4.17.21", + "react-transition-group": "^4.4.5" + }, + "dependencies": { + "@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "requires": { + "lodash": "^4.17.21" + } + }, + "@leafygreen-ui/portal": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/portal/-/portal-7.0.4.tgz", + "integrity": "sha512-qpxnBlpLzQtP4GCcbTo2M4RYpPuORMjgP+IMJNl2oQAg75DLIIAcRbV5yuMpN1IRsus0fBHykfquSe5UvA13aw==", + "requires": { + "@leafygreen-ui/hooks": "^9.1.3", + "@leafygreen-ui/lib": "^15.3.0" + } + } + } + }, + "@leafygreen-ui/tooltip": { + "version": "14.1.4", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/tooltip/-/tooltip-14.1.4.tgz", + "integrity": "sha512-OHuWYuwL6PEMt8fLs8bVhqrEZR4zmvBuKli01bLffxBwQZXhsLg5fsBfY/iqeoIVUd6NR0FlCfNebcqYrP2ccQ==", + "requires": { + "@leafygreen-ui/emotion": "^5.0.3", + "@leafygreen-ui/hooks": "^9.1.4", + "@leafygreen-ui/icon": "^14.5.1", + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/palette": "^5.0.2", + "@leafygreen-ui/popover": "^14.0.6", + "@leafygreen-ui/tokens": "^3.2.4", + "@leafygreen-ui/typography": "^22.1.3", + "lodash": "^4.17.21", + "polished": "^4.2.2" + }, + "dependencies": { + "@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "requires": { + "lodash": "^4.17.21" + } + } + } + }, + "@leafygreen-ui/typography": { + "version": "22.1.3", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/typography/-/typography-22.1.3.tgz", + "integrity": "sha512-yhQGva/0t2wyJe+edt88Dld1FUyw0xXMrHVegjtTH7c7EiLjG1eD4S+ze/Iz4F7Pxm0wXuxV3ZBrHfx2XqR6mA==", + "requires": { + "@leafygreen-ui/emotion": "^5.0.3", + "@leafygreen-ui/icon": "^14.5.1", + "@leafygreen-ui/lib": "^15.4.0", + "@leafygreen-ui/palette": "^5.0.2", + "@leafygreen-ui/polymorphic": "^3.1.0", + "@leafygreen-ui/tokens": "^3.2.4" + }, + "dependencies": { + "@leafygreen-ui/lib": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@leafygreen-ui/lib/-/lib-15.4.0.tgz", + "integrity": "sha512-jF6sJ4+rmhvky7Gs8c1wxtOyiYEhu+I+3M5PFi+xFHjNm/tkxjSfjsz18eEccR6M6li8JGVb2o/OU/mbVg0oqQ==", + "requires": { + "lodash": "^4.17.21" + } + } + } + }, + "@mongodb-js/diagramming": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/diagramming/-/diagramming-1.8.0.tgz", + "integrity": "sha512-ABg9MVNUm4wD5UijQHf3Il6WSrHPqchmMFHJMJ1OAgMEDXXKJNzUvK1Zhz5iDEEO5uIHOYSQRcCY8MeC9bo+fA==", + "requires": { + "@emotion/react": "^11.14.0", + "@emotion/styled": "^11.14.0", + "@leafygreen-ui/icon": "^14.3.0", + "@leafygreen-ui/inline-definition": "^9.0.5", + "@leafygreen-ui/leafygreen-provider": "^5.0.2", + "@leafygreen-ui/palette": "^5.0.0", + "@leafygreen-ui/tokens": "^3.2.1", + "@leafygreen-ui/typography": "^22.1.0", + "@xyflow/react": "12.5.1", + "d3-path": "^3.1.0", + "elkjs": "^0.10.0", + "react": "17.0.2", + "react-dom": "17.0.2" + } + }, "@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -65825,26 +66219,6 @@ } } }, - "@mongodb-js/diagramming": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@mongodb-js/diagramming/-/diagramming-1.8.0.tgz", - "integrity": "sha512-ABg9MVNUm4wD5UijQHf3Il6WSrHPqchmMFHJMJ1OAgMEDXXKJNzUvK1Zhz5iDEEO5uIHOYSQRcCY8MeC9bo+fA==", - "requires": { - "@emotion/react": "^11.14.0", - "@emotion/styled": "^11.14.0", - "@leafygreen-ui/icon": "^13.1.2", - "@leafygreen-ui/inline-definition": "^9.0.5", - "@leafygreen-ui/leafygreen-provider": "^4.0.2", - "@leafygreen-ui/palette": "^4.1.3", - "@leafygreen-ui/tokens": "^3.2.4", - "@leafygreen-ui/typography": "^20.0.2", - "@xyflow/react": "12.5.1", - "d3-path": "^3.1.0", - "elkjs": "^0.10.0", - "react": "^17.0.2", - "react-dom": "^17.0.2" - } - }, "@mongodb-js/dl-center": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@mongodb-js/dl-center/-/dl-center-1.3.0.tgz", diff --git a/packages/compass-data-modeling/src/components/diagram-editor.tsx b/packages/compass-data-modeling/src/components/diagram-editor.tsx index 9436fb57512..faf55312b4c 100644 --- a/packages/compass-data-modeling/src/components/diagram-editor.tsx +++ b/packages/compass-data-modeling/src/components/diagram-editor.tsx @@ -10,6 +10,7 @@ import type { DataModelingState } from '../store/reducer'; import { addNewFieldToCollection, moveCollection, + onAddNestedField, selectCollection, selectRelationship, selectBackground, @@ -132,6 +133,7 @@ const DiagramContent: React.FunctionComponent<{ isInRelationshipDrawingMode: boolean; editErrors?: string[]; newCollection?: string; + onAddFieldToObjectField: (ns: string, parentPath: string[]) => void; onAddNewFieldToCollection: (ns: string) => void; onMoveCollection: (ns: string, newPosition: [number, number]) => void; onCollectionSelect: (namespace: string) => void; @@ -154,6 +156,7 @@ const DiagramContent: React.FunctionComponent<{ model, isInRelationshipDrawingMode, newCollection, + onAddFieldToObjectField, onAddNewFieldToCollection, onMoveCollection, onCollectionSelect, @@ -325,6 +328,13 @@ const DiagramContent: React.FunctionComponent<{ [onAddNewFieldToCollection] ); + const onClickAddFieldToObjectField = useCallback( + (event: React.MouseEvent, nodeId: string, parentPath: string[]) => { + onAddFieldToObjectField(nodeId, parentPath); + }, + [onAddFieldToObjectField] + ); + const diagramProps = useMemo( () => ({ isDarkMode, @@ -332,6 +342,7 @@ const DiagramContent: React.FunctionComponent<{ edges, nodes, onAddFieldToNodeClick: onClickAddFieldToCollection, + onAddFieldToObjectFieldClick: onClickAddFieldToObjectField, onNodeClick, onPaneClick, onEdgeClick, @@ -345,6 +356,7 @@ const DiagramContent: React.FunctionComponent<{ edges, nodes, onClickAddFieldToCollection, + onClickAddFieldToObjectField, onNodeClick, onPaneClick, onEdgeClick, @@ -406,6 +418,7 @@ const ConnectedDiagramContent = connect( }, { onAddNewFieldToCollection: addNewFieldToCollection, + onAddFieldToObjectField: onAddNestedField, onMoveCollection: moveCollection, onCollectionSelect: selectCollection, onRelationshipSelect: selectRelationship, diff --git a/packages/compass-data-modeling/src/store/diagram.ts b/packages/compass-data-modeling/src/store/diagram.ts index fd41d43b3d7..0be67bcd368 100644 --- a/packages/compass-data-modeling/src/store/diagram.ts +++ b/packages/compass-data-modeling/src/store/diagram.ts @@ -500,6 +500,38 @@ export function redoEdit(): DataModelingThunkAction { }; } +export function onAddNestedField( + ns: string, + parentFieldPath: string[] +): DataModelingThunkAction { + return (dispatch, getState) => { + const modelState = selectCurrentModelFromState(getState()); + + const collection = modelState.collections.find((c) => c.ns === ns); + if (!collection) { + throw new Error('Collection to add field to not found'); + } + + const edit: Omit< + Extract, + 'id' | 'timestamp' + > = { + type: 'AddField', + ns, + // Use the first unique field name we can use. + field: [ + ...parentFieldPath, + getNewUnusedFieldName(collection.jsonSchema, parentFieldPath), + ], + jsonSchema: { + bsonType: 'string', + }, + }; + + return dispatch(applyEdit(edit)); + }; +} + export function addNewFieldToCollection( ns: string ): DataModelingThunkAction { diff --git a/packages/compass-data-modeling/src/utils/nodes-and-edges.ts b/packages/compass-data-modeling/src/utils/nodes-and-edges.ts index 6bc35676c42..4e9c92bd4d9 100644 --- a/packages/compass-data-modeling/src/utils/nodes-and-edges.ts +++ b/packages/compass-data-modeling/src/utils/nodes-and-edges.ts @@ -1,5 +1,10 @@ import toNS from 'mongodb-ns'; -import type { NodeProps, EdgeProps, NodeGlyph } from '@mongodb-js/diagramming'; +import type { + NodeProps, + EdgeProps, + NodeGlyph, + NodeField, +} from '@mongodb-js/diagramming'; import type { MongoDBJSONSchema } from 'mongodb-schema'; import type { SelectedItems } from '../store/diagram'; import type { @@ -33,6 +38,37 @@ export const getHighlightedFields = ( return selection; }; +const getBaseNodeField = (fieldPath: string[]): NodeField => { + return { + name: fieldPath[fieldPath.length - 1], + id: fieldPath, + depth: fieldPath.length - 1, + }; +}; + +/** + * Create the base field list to be used for positioning and measuring in node layouts. + */ +export const getBaseFieldsFromSchema = ({ + jsonSchema, +}: { + jsonSchema: MongoDBJSONSchema; +}): NodeField[] => { + if (!jsonSchema || !jsonSchema.properties) { + return []; + } + const fields: NodeField[] = []; + + traverseSchema({ + jsonSchema, + visitor: ({ fieldPath }) => { + fields.push(getBaseNodeField(fieldPath)); + }, + }); + + return fields; +}; + const KEY_GLYPH: NodeGlyph[] = ['key']; const NO_GLYPH: NodeGlyph[] = []; @@ -54,17 +90,16 @@ export const getFieldsFromSchema = ({ jsonSchema, visitor: ({ fieldPath, fieldTypes }) => { fields.push({ - name: fieldPath[fieldPath.length - 1], - id: fieldPath, + ...getBaseNodeField(fieldPath), type: fieldTypes.length === 1 ? fieldTypes[0] : fieldTypes, - depth: fieldPath.length - 1, glyphs: fieldTypes.length === 1 && fieldTypes[0] === 'objectId' ? KEY_GLYPH : NO_GLYPH, selectable: true, selected: - !!selectedField && areFieldPathsEqual(fieldPath, selectedField), + !!selectedField?.length && + areFieldPathsEqual(fieldPath, selectedField), variant: highlightedFields.length && highlightedFields.some((highlightedField) => @@ -96,7 +131,7 @@ export function collectionToBaseNodeForLayout({ x: displayPosition[0], y: displayPosition[1], }, - fields: getFieldsFromSchema({ jsonSchema }), + fields: getBaseFieldsFromSchema({ jsonSchema }), }; } diff --git a/packages/compass-data-modeling/src/utils/schema.ts b/packages/compass-data-modeling/src/utils/schema.ts index 71e6332663f..db545a13b36 100644 --- a/packages/compass-data-modeling/src/utils/schema.ts +++ b/packages/compass-data-modeling/src/utils/schema.ts @@ -1,7 +1,21 @@ import type { MongoDBJSONSchema } from 'mongodb-schema'; -export function getNewUnusedFieldName(jsonSchema: MongoDBJSONSchema): string { - const existingFieldNames = new Set(Object.keys(jsonSchema.properties || {})); +export function getNewUnusedFieldName( + jsonSchema: MongoDBJSONSchema, + parentFieldPath: string[] = [] +): string { + let parentJSONSchema: MongoDBJSONSchema | undefined = jsonSchema; + for (const currentField of parentFieldPath) { + if (!currentField) { + throw new Error('Invalid field path to get new field name'); + } + parentJSONSchema = parentJSONSchema?.properties?.[currentField]; + } + + const existingFieldNames = new Set( + Object.keys(parentJSONSchema?.properties || {}) + ); + let i = 1; let fieldName = `field-${i}`;