From 69b56e2f39c78d8cdc0ae797b35166904a18987a Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 11:54:25 -0700 Subject: [PATCH 01/62] chore: use dotfile for mocha --- .mocharc.json | 5 +++++ package.json | 2 +- tests/setup.js | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .mocharc.json delete mode 100644 tests/setup.js diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..a48e8dc --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,5 @@ +{ + "extension": ["ts", "js"], + "spec": "tests/**/*.test.*", + "require": "ts-node/register" +} diff --git a/package.json b/package.json index a358054..8c9353e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "description": "MOdel and method DEfinitions", "scripts": { - "test": "nyc --reporter=text mocha --recursive --bail --require @babel/register/lib --require tests/setup.js tests", + "test": "mocha", "lint": "eslint src tests && prettier --write src tests", "lint:fix": "eslint --fix --cache src tests && prettier --write src tests", "build:assets": "node build_entities.js && node build_filter.js", diff --git a/tests/setup.js b/tests/setup.js deleted file mode 100644 index c693a94..0000000 --- a/tests/setup.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-unused-vars -import chai from "chai"; From 44175b98bfcbd448a5a4311fd662ee5e4518362a Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 11:55:22 -0700 Subject: [PATCH 02/62] update: enable typescript --- .babelrc | 1 + package-lock.json | 704 ++++++++++++++++++++++++++++++++++++++++++---- package.json | 16 +- tsconfig.json | 32 +++ 4 files changed, 701 insertions(+), 52 deletions(-) create mode 100644 tsconfig.json diff --git a/.babelrc b/.babelrc index 4fce77d..4800916 100644 --- a/.babelrc +++ b/.babelrc @@ -9,6 +9,7 @@ } ], "@babel/preset-react", + "@babel/preset-typescript" ], "plugins": [ "@babel/plugin-proposal-class-properties" diff --git a/package-lock.json b/package-lock.json index 6568ef6..b1c13f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -288,6 +288,12 @@ "@babel/types": "^7.18.6" } }, + "@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true + }, "@babel/helper-validator-identifier": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", @@ -616,6 +622,23 @@ "@babel/helper-plugin-utils": "^7.14.5" } }, + "@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true + } + } + }, "@babel/plugin-transform-arrow-functions": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz", @@ -920,6 +943,176 @@ "@babel/helper-plugin-utils": "^7.18.9" } }, + "@babel/plugin-transform-typescript": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz", + "integrity": "sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-typescript": "^7.22.5" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "dev": true, + "requires": { + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", + "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.15.tgz", + "integrity": "sha512-jKkwA59IXcvSaiK2UN45kKwSC9o+KuoXsBDvHvU/7BecYIp8GQ2UwrVvFgJASUT+hBnwJx6MhvMCuMzwZZ7jlg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.5", + "@babel/helper-function-name": "^7.22.5", + "@babel/helper-member-expression-to-functions": "^7.22.15", + "@babel/helper-optimise-call-expression": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "semver": "^6.3.1" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "requires": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz", + "integrity": "sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==", + "dev": true, + "requires": { + "@babel/types": "^7.23.0" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz", + "integrity": "sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true + }, + "@babel/helper-replace-supers": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz", + "integrity": "sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-member-expression-to-functions": "^7.22.15", + "@babel/helper-optimise-call-expression": "^7.22.5" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz", + "integrity": "sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true + }, + "@babel/highlight": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", + "dev": true + }, + "@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + } + }, + "@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, "@babel/plugin-transform-unicode-escapes": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.6.tgz", @@ -1050,6 +1243,116 @@ "@babel/plugin-transform-react-pure-annotations": "^7.16.7" } }, + "@babel/preset-typescript": { + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.23.2.tgz", + "integrity": "sha512-u4UJc1XsS1GhIGteM8rnGiIvf9rJpiVgMEeCnwlLA7WJPC+jcXWJAGxYmeqs5hOZD8BbAfnV5ezBOxQbb4OUxA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", + "@babel/plugin-syntax-jsx": "^7.22.5", + "@babel/plugin-transform-modules-commonjs": "^7.23.0", + "@babel/plugin-transform-typescript": "^7.22.15" + }, + "dependencies": { + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true + }, + "@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "dev": true, + "requires": { + "@babel/types": "^7.22.15" + } + }, + "@babel/helper-module-transforms": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", + "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true + }, + "@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", + "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", + "dev": true + }, + "@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.0.tgz", + "integrity": "sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.23.0", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-simple-access": "^7.22.5" + } + }, + "@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + } + } + }, "@babel/register": { "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.18.9.tgz", @@ -1149,7 +1452,6 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -1158,7 +1460,6 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -1191,6 +1492,29 @@ } } }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true + } + } + }, + "@eslint-community/regexpp": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz", + "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==", + "dev": true + }, "@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -1296,9 +1620,9 @@ } }, "@exabyte-io/eslint-config": { - "version": "2022.11.17-0", - "resolved": "https://registry.npmjs.org/@exabyte-io/eslint-config/-/eslint-config-2022.11.17-0.tgz", - "integrity": "sha512-BYTDSqvjj6ZiWb8l46T5BKrVfkelct+vK2mh7joHu5UWtJMUzLkb0KQMV1+6SUy4xHFnws33XS7/+JSW1yeZOQ==", + "version": "2023.8.29-1", + "resolved": "https://registry.npmjs.org/@exabyte-io/eslint-config/-/eslint-config-2023.8.29-1.tgz", + "integrity": "sha512-2da786Y5j3soXcxRi/MST6qc2aIUgTjCjcqfm+xQkGfJSV8FaQR/jccENLZ5i5ynYUMqQ8Elir2Q3n4LBFqeBg==", "dev": true }, "@exabyte-io/esse.js": { @@ -1570,35 +1894,56 @@ "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", "optional": true }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" }, "@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" }, "@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" }, "@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" }, "@types/chai": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==", - "dev": true + "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==" }, "@types/crypto-js": { "version": "4.1.2", @@ -1619,14 +1964,12 @@ "@types/js-yaml": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", - "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", - "dev": true + "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==" }, "@types/json-schema": { "version": "7.0.12", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", - "dev": true + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==" }, "@types/json5": { "version": "0.0.29", @@ -1649,14 +1992,12 @@ "@types/mocha": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", - "dev": true + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==" }, "@types/node": { "version": "20.6.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz", - "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==", - "dev": true + "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==" }, "@types/prettier": { "version": "2.7.3", @@ -1667,14 +2008,12 @@ "@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", - "dev": true + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" }, "@types/react": { "version": "18.2.21", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.21.tgz", "integrity": "sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==", - "dev": true, "requires": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -1685,7 +2024,6 @@ "version": "1.7.8", "resolved": "https://registry.npmjs.org/@types/react-jsonschema-form/-/react-jsonschema-form-1.7.8.tgz", "integrity": "sha512-oFyNOa8VDSt1jGN4r+prTFD2hojZBsqLoTkRfo+XvANR3taLUeMJlGhtOP+hpi/k19OxpEb24TZciMmQyPZ9TA==", - "dev": true, "requires": { "@types/json-schema": "*", "@types/react": "*" @@ -1694,15 +2032,165 @@ "@types/scheduler": { "version": "0.16.3", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", - "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", + "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==" + }, + "@types/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", "dev": true }, "@types/underscore": { "version": "1.11.9", "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.9.tgz", - "integrity": "sha512-M63wKUdsjDFUfyFt1TCUZHGFk9KDAa5JP0adNUErbm0U45Lr06HtANdYRP+GyleEopEoZ4UyBcdAC5TnW4Uz2w==", + "integrity": "sha512-M63wKUdsjDFUfyFt1TCUZHGFk9KDAa5JP0adNUErbm0U45Lr06HtANdYRP+GyleEopEoZ4UyBcdAC5TnW4Uz2w==" + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", + "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", + "dev": true, + "requires": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "dependencies": { + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@typescript-eslint/parser": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", + "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", + "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", "dev": true }, + "@typescript-eslint/typescript-estree": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "dependencies": { + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@typescript-eslint/utils": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", + "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" + }, + "dependencies": { + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.62.0", + "eslint-visitor-keys": "^3.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true + } + } + }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -1730,8 +2218,7 @@ "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" }, "aggregate-error": { "version": "3.1.0", @@ -1834,8 +2321,7 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" }, "argparse": { "version": "1.0.10", @@ -1887,6 +2373,12 @@ "is-string": "^1.0.7" } }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "array.prototype.flat": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", @@ -2390,8 +2882,7 @@ "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" }, "cross-spawn": { "version": "7.0.3", @@ -2419,8 +2910,7 @@ "csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", - "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", - "dev": true + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "d": { "version": "1.0.1", @@ -2511,6 +3001,15 @@ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3282,6 +3781,19 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, + "fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3294,6 +3806,15 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "file": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/file/-/file-0.2.2.tgz", @@ -3514,12 +4035,46 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "dependencies": { + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + } + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -4496,8 +5051,7 @@ "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, "mathjs": { "version": "3.20.2", @@ -4554,6 +5108,12 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -4799,6 +5359,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "next-tick": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", @@ -5240,6 +5806,12 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -5333,6 +5905,12 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -5533,6 +6111,12 @@ "signal-exit": "^3.0.2" } }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rfdc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", @@ -5548,6 +6132,15 @@ "glob": "^7.1.3" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "rxjs": { "version": "7.5.6", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz", @@ -5974,7 +6567,6 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -5994,14 +6586,12 @@ "acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==" }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" } } }, @@ -6034,6 +6624,23 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", "dev": true }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -6079,8 +6686,7 @@ "typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" }, "unbox-primitive": { "version": "1.0.2", @@ -6170,8 +6776,7 @@ "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" }, "valid-url": { "version": "1.0.9", @@ -6364,8 +6969,7 @@ "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index 8c9353e..96bab8a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lint": "eslint src tests && prettier --write src tests", "lint:fix": "eslint --fix --cache src tests && prettier --write src tests", "build:assets": "node build_entities.js && node build_filter.js", - "transpile": "babel --out-dir dist src", + "transpile": "tsc", "postinstall": "npm run transpile", "prettier": "prettier --check src tests", "prepare": "husky install || exit 0" @@ -40,17 +40,29 @@ "@babel/preset-react": "7.16.7", "@babel/register": "^7.16.0", "@babel/runtime-corejs3": "7.16.8", + "@types/chai": "^4.3.5", + "@types/js-yaml": "^4.0.5", + "@types/json-schema": "^7.0.12", + "@types/mocha": "^10.0.1", + "@types/node": "^20.4.2", + "@types/react-jsonschema-form": "^1.7.8", + "@types/underscore": "^1.11.6", "ajv": "4.1.7", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "mixwith": "^0.1.1", + "ts-node": "^10.9.1", + "typescript": "^4.5.5", "underscore": "^1.13.3", "underscore.string": "^3.3.4" }, "devDependencies": { + "@babel/preset-typescript": "^7.22.5", "@exabyte-io/code.js": "2023.9.14-1", - "@exabyte-io/eslint-config": "^2022.11.17-0", + "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", "chai": "^4.3.4", "eslint": "7.32.0", "eslint-config-airbnb": "19.0.2", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..f28e65f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "target": "ES2018", + "jsx": "react", + "lib": ["ES2019", "dom"], + "allowJs": true, + "module": "commonjs", + "moduleResolution": "Node", + "declaration": true, + "outDir": "./dist", + "noEmitOnError": false, + "isolatedModules": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "types": ["mocha", "node"], + "rootDir": "./src", + "baseUrl": "./" + }, + "include": [ + "./src" + ], + "exclude": [ + "node_modules", + "dist" + ], + "ts-node": { + "files": true, + "compilerOptions": {} + }, +} From 11c7bdffc610b5ce457fbe8a81a5baa7079bb997 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 12:52:02 -0700 Subject: [PATCH 03/62] chore: move model interface from web-app --- src/utils/model_interface.ts | 92 ++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/utils/model_interface.ts diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts new file mode 100644 index 0000000..562851a --- /dev/null +++ b/src/utils/model_interface.ts @@ -0,0 +1,92 @@ +import { categorizedModelList, tree } from "../index"; + +import { + BaseModel, + CategorizedBaseModel as CategorizedModel } from "@exabyte-io/code.js/dist/types"; + +type SimpleModel = Omit; + +export function safelyGetSlug(slugObj: { slug: string } | string): string { + return typeof slugObj === "string" ? slugObj : slugObj.slug; +} + +/** + * The model interface converts between the legacy model data structure (type, subtype, functional) + * and the categorized model data structure (tier1, tier2, ...). + */ +export class ModelInterface { + static convertToSimple(cm?: CategorizedModel): SimpleModel { + if (!cm) return this.convertUnknownToSimple(); + + switch (cm.categories.tier3) { + case "dft": + return this.convertDftToSimple(cm); + case "ml": + return this.convertMlToSimple(); + default: + return this.convertUnknownToSimple(); + } + } + + static convertDftToSimple(cm: CategorizedModel): SimpleModel { + if (!cm.categories?.subtype) return this.convertUnknownToSimple(); + const { subtype } = cm.categories; + + // @ts-ignore todo: adjust ESSE schemas + const { functional } = cm.parameters; + return { + type: "dft", + subtype, + functional: tree.treeSlugToNamedObject(functional), + }; + } + + static convertMlToSimple(): SimpleModel { + return { + type: "ml", + subtype: "re", + }; + } + + static convertUnknownToSimple(): SimpleModel { + return { + type: "unknown", + subtype: "unknown", + }; + } + + static convertToCategorized(sm?: SimpleModel): CategorizedModel | undefined { + switch (sm?.type) { + case "dft": + return this.convertDftToCategorized(sm); + case "ml": + return this.convertMlToCategorized(); + case "unknown": + return undefined; + default: + return undefined; + } + } + + static convertDftToCategorized(sm: SimpleModel): CategorizedModel { + const { subtype, functional: functionalStringOrObject } = sm; + const defaultFunctionals = { lda: "pz", gga: "pbe", hybrid: "b3lyp" }; + let functional: string; + if (!functionalStringOrObject) { + functional = defaultFunctionals[subtype as keyof typeof defaultFunctionals]; + } else { + // @ts-ignore todo: adjust ESSE schemas + functional = safelyGetSlug(functionalStringOrObject); + } + const path = `/pb/qm/dft/ksdft/${subtype}?functional=${functional}`; + // @ts-ignore todo: adjust ESSE schemas + return categorizedModelList.find((cm) => cm.path === path); + } + + static convertMlToCategorized(): CategorizedModel { + // TODO: allow other ML types + const path = "/st/det/ml/re/none"; + // @ts-ignore todo: adjust ESSE schemas + return categorizedModelList.find((cm) => cm.path === path); + } +} From 26947e5d7f9f171bea6b85bdcb93eff48292319c Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 14:07:01 -0700 Subject: [PATCH 04/62] chore: inherit from defaultabe in-memory entity --- src/model.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model.js b/src/model.js index f48575d..6554da8 100644 --- a/src/model.js +++ b/src/model.js @@ -1,4 +1,4 @@ -import { InMemoryEntity } from "@exabyte-io/code.js/dist/entity"; +import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import lodash from "lodash"; import { DFTModelConfig } from "./default_models"; @@ -6,7 +6,7 @@ import { Method } from "./method"; import { MethodFactory } from "./methods/factory"; import { getTreeByApplicationNameAndVersion, MODEL_TREE, treeSlugToNamedObject } from "./tree"; -export class Model extends InMemoryEntity { +export class Model extends DefaultableInMemoryEntity { constructor({ application, ...config }) { super(config); this._application = application; From 01d76c7b9aa32a05a9f8ea4f559b9ae17615721d Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 14:07:35 -0700 Subject: [PATCH 05/62] chore: add mui-path-imports eslint plugin --- package-lock.json | 15 +++++++++++++++ package.json | 1 + 2 files changed, 16 insertions(+) diff --git a/package-lock.json b/package-lock.json index b1c13f5..918d240 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3556,6 +3556,15 @@ } } }, + "eslint-plugin-mui-path-imports": { + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/eslint-plugin-mui-path-imports/-/eslint-plugin-mui-path-imports-0.0.15.tgz", + "integrity": "sha512-u61kgRBtUAG+zoApuf8oWuW6mf3SIfrpMq/gSQEM2h/3qzkqvWXB4RRmPzVryS6bpeXT0QsW8rFcdcMVnoz0hw==", + "dev": true, + "requires": { + "requireindex": "^1.2.0" + } + }, "eslint-plugin-prettier": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", @@ -6079,6 +6088,12 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "requireindex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", + "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", + "dev": true + }, "resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", diff --git a/package.json b/package.json index 96bab8a..9a5e922 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "eslint-plugin-import": "2.25.3", "eslint-plugin-jsdoc": "37.1.0", "eslint-plugin-jsx-a11y": "6.5.1", + "eslint-plugin-mui-path-imports": "0.0.15", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "7.30.0", "eslint-plugin-simple-import-sort": "7.0.0", From 8423eb145fe7f20e9bd4ddeaf7cac5e0459a063e Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 16:03:42 -0700 Subject: [PATCH 06/62] update: add application-flavor package --- package-lock.json | 90 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 92 insertions(+) diff --git a/package-lock.json b/package-lock.json index 918d240..99d6558 100644 --- a/package-lock.json +++ b/package-lock.json @@ -397,6 +397,16 @@ "@babel/plugin-syntax-dynamic-import": "^7.8.3" } }, + "@babel/plugin-proposal-export-default-from": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.16.0.tgz", + "integrity": "sha512-kFAhaIbh5qbBwETRNa/cgGmPJ/BicXhIyrZhAkyYhf/Z9LXCTRGO1mvUwczto0Hl1q4YtzP9cRtTKT4wujm38Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-export-default-from": "^7.16.0" + } + }, "@babel/plugin-proposal-export-namespace-from": { "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", @@ -534,6 +544,23 @@ "@babel/helper-plugin-utils": "^7.8.0" } }, + "@babel/plugin-syntax-export-default-from": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.22.5.tgz", + "integrity": "sha512-ODAqWWXB/yReh/jVQDag/3/tl6lgBueQkk/TcfW/59Oykm4c8a55XloX0CTk2k2VJiFWMgHby9xNX29IbCv9dQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true + } + } + }, "@babel/plugin-syntax-export-namespace-from": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", @@ -1565,6 +1592,69 @@ } } }, + "@exabyte-io/application-flavors.js": { + "version": "2023.9.20-0", + "resolved": "https://registry.npmjs.org/@exabyte-io/application-flavors.js/-/application-flavors.js-2023.9.20-0.tgz", + "integrity": "sha512-5nN9upiSHlo6KfxSwuCb9BZb6VvcegjT+G6vIlxW2wLADvaObjWzY8CL2DMwwb+B9f5v/Xu1vj1DavVE9GqF3A==", + "dev": true, + "requires": { + "@babel/cli": "7.16.0", + "@babel/core": "7.16.7", + "@babel/eslint-parser": "7.16.3", + "@babel/plugin-proposal-class-properties": "^7.16.0", + "@babel/plugin-proposal-export-default-from": "7.16.0", + "@babel/preset-env": "7.16.4", + "@babel/register": "7.16.0", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "underscore": "^1.12.1", + "underscore.string": "^3.3.4" + }, + "dependencies": { + "@babel/core": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", + "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + } + }, + "@babel/register": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.16.0.tgz", + "integrity": "sha512-lzl4yfs0zVXnooeLE0AAfYaT7F3SPA8yB2Bj4W1BiZwLbMS3MZH35ZvCWSRHvneUugwuM+Wsnrj7h0F7UmU3NQ==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.0", + "source-map-support": "^0.5.16" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, "@exabyte-io/code.js": { "version": "2023.9.14-1", "resolved": "https://registry.npmjs.org/@exabyte-io/code.js/-/code.js-2023.9.14-1.tgz", diff --git a/package.json b/package.json index 9a5e922..7464df3 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.22.5", + "@exabyte-io/application-flavors.js": "2023.9.20-0", "@exabyte-io/code.js": "2023.9.14-1", "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", @@ -83,6 +84,7 @@ }, "peerDependencies": { "@exabyte-io/ade.js": "*", + "@exabyte-io/application-flavors.js": "*", "@exabyte-io/code.js": "*", "@exabyte-io/made.js": "*" }, From 6207882a7d64d2a995f8aa5650225601d366db66 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 19:07:55 -0700 Subject: [PATCH 07/62] chore: adjust imports of modelinterface --- src/utils/model_interface.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts index 562851a..223f266 100644 --- a/src/utils/model_interface.ts +++ b/src/utils/model_interface.ts @@ -1,8 +1,10 @@ -import { categorizedModelList, tree } from "../index"; - -import { +import { BaseModel, - CategorizedBaseModel as CategorizedModel } from "@exabyte-io/code.js/dist/types"; + CategorizedBaseModel as CategorizedModel, +} from "@exabyte-io/code.js/dist/types"; + +import { allModels as categorizedModelList } from "../data/model_list"; +import { treeSlugToNamedObject } from "../tree"; type SimpleModel = Omit; @@ -37,7 +39,7 @@ export class ModelInterface { return { type: "dft", subtype, - functional: tree.treeSlugToNamedObject(functional), + functional: treeSlugToNamedObject(functional), }; } From 858651247184d04c352c921397f736138a32536f Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 19:08:09 -0700 Subject: [PATCH 08/62] refactor: remove model tree from model class --- src/model.js | 71 +++++++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 48 deletions(-) diff --git a/src/model.js b/src/model.js index 6554da8..45bc6aa 100644 --- a/src/model.js +++ b/src/model.js @@ -1,16 +1,20 @@ +import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/src/js/models"; import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import lodash from "lodash"; +import { allModels as categorizedModelList } from "./data/model_list"; +import { PseudopotentialMethodConfig } from "./default_methods"; import { DFTModelConfig } from "./default_models"; import { Method } from "./method"; import { MethodFactory } from "./methods/factory"; -import { getTreeByApplicationNameAndVersion, MODEL_TREE, treeSlugToNamedObject } from "./tree"; +import { ModelInterface } from "./utils/model_interface"; export class Model extends DefaultableInMemoryEntity { constructor({ application, ...config }) { super(config); this._application = application; this._MethodFactory = MethodFactory; + this._defaultCategorized = this.getDefaultCategorized(); } get type() { @@ -26,37 +30,12 @@ export class Model extends DefaultableInMemoryEntity { this.setMethod(this._MethodFactory.create(this.defaultMethodConfig)); } - get allowedTypes() { - return Object.keys(this.tree).map((modelSlug) => treeSlugToNamedObject(modelSlug)); - } - - get allowedSubtypes() { - return Object.keys(this.treeBranchForType).map((slug) => treeSlugToNamedObject(slug)); - } - get defaultType() { - return this.allowedTypes[0]?.slug; + return this.defaultConfig.type; } get defaultSubtype() { - return this.allowedSubtypes[0]?.slug; - } - - get tree() { - return (this._application && this.treeByApplicationNameAndVersion) || MODEL_TREE; - } - - get treeBranchForType() { - return this.tree[this.type] || {}; - } - - get treeBranchForSubType() { - return this.treeBranchForType[this.subtype] || {}; - } - - get treeByApplicationNameAndVersion() { - const [name, version] = [this._application.name, this._application.version]; - return getTreeByApplicationNameAndVersion({ name, version }); + return this.defaultConfig.subtype; } get groupSlug() { @@ -75,36 +54,32 @@ export class Model extends DefaultableInMemoryEntity { this._method = method; } - // Consider moving the below to `Method` - get methodsFromTree() { - return this.treeBranchForSubType.methods || {}; - } - - get methodTypes() { - return Object.keys(this.methodsFromTree).map((m) => treeSlugToNamedObject(m)); + // eslint-disable-next-line class-methods-use-this + get defaultMethodConfig() { + return PseudopotentialMethodConfig; } - get methodSubtypes() { - return this.methodsFromTree[this.method.type].map((m) => treeSlugToNamedObject(m)) || []; - } + getDefaultCategorized() { + const filteredModels = filterModelsByApplicationParameters({ + modelList: categorizedModelList, + appName: this._application?.name, + version: this._application?.version, + build: this._application?.build, + }); - get defaultMethodConfig() { - const type = Object.keys(this.methodsFromTree)[0]; - const subtype = (this.methodsFromTree[type] || [])[0]; - return { type, subtype }; + return filteredModels[0]; } - static get defaultConfig() { + get defaultConfig() { + const defaultModel = !this._defaultCategorized + ? DFTModelConfig + : ModelInterface.convertToSimple(this._defaultCategorized); return { - ...DFTModelConfig, + ...defaultModel, method: Method.defaultConfig, }; } - static get allTypes() { - return Object.keys(this.tree).map((modelSlug) => treeSlugToNamedObject(modelSlug)); - } - toJSON() { return { ...super.toJSON(), From 5bd029a68d4ebca68a5a2074677d1bc39a3232be Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 19:08:30 -0700 Subject: [PATCH 09/62] update: inherit from defaultable in-memory entity --- src/method.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/method.js b/src/method.js index 96af12f..a165049 100644 --- a/src/method.js +++ b/src/method.js @@ -1,10 +1,10 @@ -import { InMemoryEntity } from "@exabyte-io/code.js/dist/entity"; +import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import { deepClone } from "@exabyte-io/code.js/dist/utils"; import lodash from "lodash"; import { PseudopotentialMethodConfig } from "./default_methods"; -export class Method extends InMemoryEntity { +export class Method extends DefaultableInMemoryEntity { constructor(config) { const data = config.data || {}; super({ ...config, data }); From c4e182fcbb7b0acee76e9c3590832b3bcc6769bd Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Mon, 23 Oct 2023 19:18:26 -0700 Subject: [PATCH 10/62] refactor: move slug related functions to utils --- src/utils/model_interface.ts | 8 ++------ src/utils/slugifiedEntry.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 src/utils/slugifiedEntry.ts diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts index 223f266..a70dc6b 100644 --- a/src/utils/model_interface.ts +++ b/src/utils/model_interface.ts @@ -4,14 +4,10 @@ import { } from "@exabyte-io/code.js/dist/types"; import { allModels as categorizedModelList } from "../data/model_list"; -import { treeSlugToNamedObject } from "../tree"; +import { safelyGetSlug, stringToSlugifiedEntry } from "./slugifiedEntry"; type SimpleModel = Omit; -export function safelyGetSlug(slugObj: { slug: string } | string): string { - return typeof slugObj === "string" ? slugObj : slugObj.slug; -} - /** * The model interface converts between the legacy model data structure (type, subtype, functional) * and the categorized model data structure (tier1, tier2, ...). @@ -39,7 +35,7 @@ export class ModelInterface { return { type: "dft", subtype, - functional: treeSlugToNamedObject(functional), + functional: stringToSlugifiedEntry(functional), }; } diff --git a/src/utils/slugifiedEntry.ts b/src/utils/slugifiedEntry.ts new file mode 100644 index 0000000..d84d2b2 --- /dev/null +++ b/src/utils/slugifiedEntry.ts @@ -0,0 +1,17 @@ +import { SlugifiedEntry } from "@exabyte-io/code.js/src/types"; + +export function slugifiedEntryToString(entry: SlugifiedEntry): string { + return entry.slug; +} + +export function stringToSlugifiedEntry(slug: string, name?: string): SlugifiedEntry { + const _name = !name ? slug : name; + return { + name: _name, + slug, + }; +} + +export function safelyGetSlug(slugObj: SlugifiedEntry | string): string { + return typeof slugObj === "string" ? slugObj : slugifiedEntryToString(slugObj); +} From e5d9311f8660013c6c162afeddb7539e3d0da22d Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 09:57:44 -0700 Subject: [PATCH 11/62] chore: add typescript + utils --- package-lock.json | 220 ++++++++++++++++++++++++++++++++-------------- package.json | 24 ++--- 2 files changed, 166 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99d6558..c9cdad4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -291,8 +291,7 @@ "@babel/helper-string-parser": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", - "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", - "dev": true + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==" }, "@babel/helper-validator-identifier": { "version": "7.18.6", @@ -653,7 +652,6 @@ "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", - "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.22.5" }, @@ -661,8 +659,7 @@ "@babel/helper-plugin-utils": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", - "dev": true + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==" } } }, @@ -974,7 +971,6 @@ "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz", "integrity": "sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==", - "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.22.5", "@babel/helper-create-class-features-plugin": "^7.22.15", @@ -986,7 +982,6 @@ "version": "7.22.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", - "dev": true, "requires": { "@babel/highlight": "^7.22.13", "chalk": "^2.4.2" @@ -996,7 +991,6 @@ "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", - "dev": true, "requires": { "@babel/types": "^7.22.5" } @@ -1005,7 +999,6 @@ "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.15.tgz", "integrity": "sha512-jKkwA59IXcvSaiK2UN45kKwSC9o+KuoXsBDvHvU/7BecYIp8GQ2UwrVvFgJASUT+hBnwJx6MhvMCuMzwZZ7jlg==", - "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.22.5", "@babel/helper-environment-visitor": "^7.22.5", @@ -1021,14 +1014,12 @@ "@babel/helper-environment-visitor": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==" }, "@babel/helper-function-name": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, "requires": { "@babel/template": "^7.22.15", "@babel/types": "^7.23.0" @@ -1038,7 +1029,6 @@ "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz", "integrity": "sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==", - "dev": true, "requires": { "@babel/types": "^7.23.0" } @@ -1047,7 +1037,6 @@ "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz", "integrity": "sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==", - "dev": true, "requires": { "@babel/types": "^7.22.5" } @@ -1055,14 +1044,12 @@ "@babel/helper-plugin-utils": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", - "dev": true + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==" }, "@babel/helper-replace-supers": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz", "integrity": "sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw==", - "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-member-expression-to-functions": "^7.22.15", @@ -1073,7 +1060,6 @@ "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz", "integrity": "sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==", - "dev": true, "requires": { "@babel/types": "^7.22.5" } @@ -1082,7 +1068,6 @@ "version": "7.22.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, "requires": { "@babel/types": "^7.22.5" } @@ -1090,14 +1075,12 @@ "@babel/helper-validator-identifier": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", - "dev": true + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==" }, "@babel/highlight": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", - "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", @@ -1107,14 +1090,12 @@ "@babel/parser": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", - "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", - "dev": true + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==" }, "@babel/template": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", - "dev": true, "requires": { "@babel/code-frame": "^7.22.13", "@babel/parser": "^7.22.15", @@ -1125,7 +1106,6 @@ "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, "requires": { "@babel/helper-string-parser": "^7.22.5", "@babel/helper-validator-identifier": "^7.22.20", @@ -1135,8 +1115,7 @@ "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==" } } }, @@ -1274,7 +1253,6 @@ "version": "7.23.2", "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.23.2.tgz", "integrity": "sha512-u4UJc1XsS1GhIGteM8rnGiIvf9rJpiVgMEeCnwlLA7WJPC+jcXWJAGxYmeqs5hOZD8BbAfnV5ezBOxQbb4OUxA==", - "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-validator-option": "^7.22.15", @@ -1286,14 +1264,12 @@ "@babel/helper-environment-visitor": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==" }, "@babel/helper-module-imports": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", - "dev": true, "requires": { "@babel/types": "^7.22.15" } @@ -1302,7 +1278,6 @@ "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", - "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-module-imports": "^7.22.15", @@ -1314,14 +1289,12 @@ "@babel/helper-plugin-utils": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", - "dev": true + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==" }, "@babel/helper-simple-access": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", - "dev": true, "requires": { "@babel/types": "^7.22.5" } @@ -1330,7 +1303,6 @@ "version": "7.22.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, "requires": { "@babel/types": "^7.22.5" } @@ -1338,20 +1310,17 @@ "@babel/helper-validator-identifier": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", - "dev": true + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==" }, "@babel/helper-validator-option": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", - "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", - "dev": true + "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==" }, "@babel/plugin-syntax-jsx": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", - "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.22.5" } @@ -1360,7 +1329,6 @@ "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.0.tgz", "integrity": "sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ==", - "dev": true, "requires": { "@babel/helper-module-transforms": "^7.23.0", "@babel/helper-plugin-utils": "^7.22.5", @@ -1371,7 +1339,6 @@ "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, "requires": { "@babel/helper-string-parser": "^7.22.5", "@babel/helper-validator-identifier": "^7.22.20", @@ -1479,6 +1446,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -1487,6 +1455,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -2013,27 +1982,32 @@ "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true }, "@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true }, "@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true }, "@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true }, "@types/chai": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==" + "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==", + "dev": true }, "@types/crypto-js": { "version": "4.1.2", @@ -2054,12 +2028,14 @@ "@types/js-yaml": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", - "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==" + "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", + "dev": true }, "@types/json-schema": { "version": "7.0.12", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==" + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", + "dev": true }, "@types/json5": { "version": "0.0.29", @@ -2082,12 +2058,14 @@ "@types/mocha": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==" + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true }, "@types/node": { "version": "20.6.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz", - "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==" + "integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==", + "dev": true }, "@types/prettier": { "version": "2.7.3", @@ -2098,12 +2076,14 @@ "@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", + "dev": true }, "@types/react": { "version": "18.2.21", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.21.tgz", "integrity": "sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==", + "dev": true, "requires": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -2114,6 +2094,7 @@ "version": "1.7.8", "resolved": "https://registry.npmjs.org/@types/react-jsonschema-form/-/react-jsonschema-form-1.7.8.tgz", "integrity": "sha512-oFyNOa8VDSt1jGN4r+prTFD2hojZBsqLoTkRfo+XvANR3taLUeMJlGhtOP+hpi/k19OxpEb24TZciMmQyPZ9TA==", + "dev": true, "requires": { "@types/json-schema": "*", "@types/react": "*" @@ -2122,7 +2103,8 @@ "@types/scheduler": { "version": "0.16.3", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", - "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==" + "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", + "dev": true }, "@types/semver": { "version": "7.5.4", @@ -2133,7 +2115,8 @@ "@types/underscore": { "version": "1.11.9", "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.9.tgz", - "integrity": "sha512-M63wKUdsjDFUfyFt1TCUZHGFk9KDAa5JP0adNUErbm0U45Lr06HtANdYRP+GyleEopEoZ4UyBcdAC5TnW4Uz2w==" + "integrity": "sha512-M63wKUdsjDFUfyFt1TCUZHGFk9KDAa5JP0adNUErbm0U45Lr06HtANdYRP+GyleEopEoZ4UyBcdAC5TnW4Uz2w==", + "dev": true }, "@typescript-eslint/eslint-plugin": { "version": "5.62.0", @@ -2308,7 +2291,8 @@ "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true }, "aggregate-error": { "version": "3.1.0", @@ -2411,7 +2395,8 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "argparse": { "version": "1.0.10", @@ -2972,7 +2957,8 @@ "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true }, "cross-spawn": { "version": "7.0.3", @@ -3000,7 +2986,8 @@ "csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", - "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", + "dev": true }, "d": { "version": "1.0.1", @@ -3126,6 +3113,16 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, "enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -3473,6 +3470,52 @@ } } }, + "eslint-import-resolver-typescript": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", + "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", + "dev": true, + "requires": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + }, + "dependencies": { + "eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "requires": { + "debug": "^3.2.7" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + } + } + }, "eslint-module-utils": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", @@ -4099,6 +4142,15 @@ "get-intrinsic": "^1.1.1" } }, + "get-tsconfig": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", + "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "dev": true, + "requires": { + "resolve-pkg-maps": "^1.0.0" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -4239,6 +4291,23 @@ } } }, + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + }, + "dependencies": { + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + } + } + }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -5150,7 +5219,8 @@ "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "mathjs": { "version": "3.20.2", @@ -6200,6 +6270,12 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true + }, "resolve.exports": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz", @@ -6592,6 +6668,12 @@ } } }, + "tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -6672,6 +6754,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -6691,12 +6774,14 @@ "acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==" + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true } } }, @@ -6791,7 +6876,8 @@ "typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true }, "unbox-primitive": { "version": "1.0.2", @@ -6881,7 +6967,8 @@ "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true }, "valid-url": { "version": "1.0.9", @@ -7074,7 +7161,8 @@ "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index 7464df3..ff0ef7f 100644 --- a/package.json +++ b/package.json @@ -38,21 +38,13 @@ "@babel/plugin-proposal-class-properties": "7.16.0", "@babel/preset-env": "7.16.4", "@babel/preset-react": "7.16.7", + "@babel/preset-typescript": "^7.22.5", "@babel/register": "^7.16.0", "@babel/runtime-corejs3": "7.16.8", - "@types/chai": "^4.3.5", - "@types/js-yaml": "^4.0.5", - "@types/json-schema": "^7.0.12", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.2", - "@types/react-jsonschema-form": "^1.7.8", - "@types/underscore": "^1.11.6", "ajv": "4.1.7", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "mixwith": "^0.1.1", - "ts-node": "^10.9.1", - "typescript": "^4.5.5", "underscore": "^1.13.3", "underscore.string": "^3.3.4" }, @@ -62,6 +54,11 @@ "@exabyte-io/code.js": "2023.9.14-1", "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", + "@types/chai": "^4.3.5", + "@types/js-yaml": "^4.0.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.4.2", + "@types/underscore": "^1.11.6", "@typescript-eslint/eslint-plugin": "^5.56.0", "@typescript-eslint/parser": "^5.56.0", "chai": "^4.3.4", @@ -69,6 +66,7 @@ "eslint-config-airbnb": "19.0.2", "eslint-config-prettier": "^8.5.0", "eslint-import-resolver-exports": "^1.0.0-beta.2", + "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "2.25.3", "eslint-plugin-jsdoc": "37.1.0", "eslint-plugin-jsx-a11y": "6.5.1", @@ -80,7 +78,9 @@ "lint-staged": "^12.1.2", "mocha": "^9.1.3", "nyc": "^15.1.0", - "prettier": "^2.7.1" + "prettier": "^2.7.1", + "ts-node": "^10.9.1", + "typescript": "^4.5.5" }, "peerDependencies": { "@exabyte-io/ade.js": "*", @@ -92,7 +92,7 @@ "node": ">=12.0.0" }, "lint-staged": { - "*.js": "eslint --cache --fix", - "*.{js,css}": "prettier --write" + "*.{js,ts}": "eslint --cache --fix", + "*.{js,ts,css}": "prettier --write" } } From 864237ae5e2f660e23d7b04d3b9e8d139c63eeff Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 09:59:05 -0700 Subject: [PATCH 12/62] chore: fix mocha settings --- .mocharc.json | 2 +- src/model.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.mocharc.json b/.mocharc.json index a48e8dc..ec3216d 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,5 +1,5 @@ { "extension": ["ts", "js"], "spec": "tests/**/*.test.*", - "require": "ts-node/register" + "require": ["ts-node/register"] } diff --git a/src/model.js b/src/model.js index 45bc6aa..2244c00 100644 --- a/src/model.js +++ b/src/model.js @@ -1,4 +1,4 @@ -import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/src/js/models"; +import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/models"; import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import lodash from "lodash"; From 0e652ee259fb69a9be151f885f66bb42c2dcd56e Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 10:39:42 -0700 Subject: [PATCH 13/62] chore: remove redundant mixwith package --- package-lock.json | 3 ++- package.json | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c9cdad4..6e75e55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5316,7 +5316,8 @@ "mixwith": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/mixwith/-/mixwith-0.1.1.tgz", - "integrity": "sha512-DQsf/liljH/9e+94jR+xfK8vlKceeKdOM9H9UEXLwGuvEEpO6debNtJ9yt1ZKzPKPrwqGxzMdu0BR1fnQb6i4A==" + "integrity": "sha512-DQsf/liljH/9e+94jR+xfK8vlKceeKdOM9H9UEXLwGuvEEpO6debNtJ9yt1ZKzPKPrwqGxzMdu0BR1fnQb6i4A==", + "dev": true }, "mkdirp": { "version": "1.0.4", diff --git a/package.json b/package.json index ff0ef7f..62052da 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "ajv": "4.1.7", "js-yaml": "^4.1.0", "lodash": "^4.17.21", - "mixwith": "^0.1.1", "underscore": "^1.13.3", "underscore.string": "^3.3.4" }, From 11799451dfa7120c9f02eff4fdb2c71ab1e4ba26 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 14:42:53 -0700 Subject: [PATCH 14/62] refactor: isolate filtering the model list --- src/model.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/model.js b/src/model.js index 2244c00..b2c0d7e 100644 --- a/src/model.js +++ b/src/model.js @@ -14,7 +14,7 @@ export class Model extends DefaultableInMemoryEntity { super(config); this._application = application; this._MethodFactory = MethodFactory; - this._defaultCategorized = this.getDefaultCategorized(); + this._defaultCategorized = this.getDefaultCategorizedModel(); } get type() { @@ -59,7 +59,8 @@ export class Model extends DefaultableInMemoryEntity { return PseudopotentialMethodConfig; } - getDefaultCategorized() { + getCategorizedModels() { + if (!this._application) return categorizedModelList; const filteredModels = filterModelsByApplicationParameters({ modelList: categorizedModelList, appName: this._application?.name, @@ -67,7 +68,11 @@ export class Model extends DefaultableInMemoryEntity { build: this._application?.build, }); - return filteredModels[0]; + return filteredModels; + } + + getDefaultCategorizedModel() { + return this.getCategorizedModels()[0]; } get defaultConfig() { From a3611a9c409f314aa7ead3b40f5e24de0aff84d3 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 14:47:40 -0700 Subject: [PATCH 15/62] refactor: replace slug method with utils --- src/models/dft.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/models/dft.js b/src/models/dft.js index 7fef6b7..22e3b38 100644 --- a/src/models/dft.js +++ b/src/models/dft.js @@ -1,8 +1,7 @@ -import _ from "underscore"; - +import { filterEntityList } from "@exabyte-io/code.js/dist/utils"; import { MethodFactory } from "../methods/factory"; import { Model } from "../model"; -import { treeSlugToNamedObject } from "../tree"; +import { safelyGetSlug, stringToSlugifiedEntry } from "../utils/slugifiedEntry"; export class DFTModel extends Model { constructor(config) { @@ -60,13 +59,13 @@ export class DFTModel extends Model { } setFunctional(functional) { - this.setProp("functional", this._stringToSlugifiedObject(functional)); + this.setProp("functional", stringToSlugifiedEntry(functional)); this.setMethod(this._MethodFactory.create(this.defaultMethodConfig)); } _setArrayProp(name, data) { // eslint-disable-next-line no-param-reassign, no-undef - data = safeMakeArray(data).map((r) => this._stringToSlugifiedObject(r)); + data = safeMakeArray(data).map((r) => stringToSlugifiedEntry(r)); this.setProp(name, data); this[`_${name}`] = data; } @@ -80,10 +79,10 @@ export class DFTModel extends Model { } toJSON() { - const pickSlugFromObject = (o) => _.pick(o, "slug"); + const functional = safelyGetSlug(this.functional); return { ...super.toJSON(), - functional: pickSlugFromObject(this.functional), // only store slug for `functional` + functional, refiners: this.refiners, modifiers: this.modifiers, }; @@ -94,7 +93,7 @@ export class DFTModel extends Model { * @returns {Object.[]} - List of functional objects */ get allFunctionals() { - return this.treeBranchForSubType.functionals.map((x) => treeSlugToNamedObject(x)); + return this.treeBranchForSubType.functionals.map((x) => stringToSlugifiedEntry(x)); } /** @@ -102,7 +101,7 @@ export class DFTModel extends Model { * @returns {Object.[]} - List of refiner objects */ get allRefiners() { - return this.treeBranchForSubType.refiners.map((x) => treeSlugToNamedObject(x)); + return this.treeBranchForSubType.refiners.map((x) => stringToSlugifiedEntry(x)); } /** @@ -110,6 +109,6 @@ export class DFTModel extends Model { * @returns {Object.[]} - List of modifier objects */ get allModifiers() { - return this.treeBranchForSubType.modifiers.map((x) => treeSlugToNamedObject(x)); + return this.treeBranchForSubType.modifiers.map((x) => stringToSlugifiedEntry(x)); } } From 3b672ffddc131a8d8e0d5be0a19a1b8316c2fcfb Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 14:51:17 -0700 Subject: [PATCH 16/62] update: get default config from model list --- src/models/dft.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/models/dft.js b/src/models/dft.js index 22e3b38..a6bc892 100644 --- a/src/models/dft.js +++ b/src/models/dft.js @@ -1,4 +1,5 @@ import { filterEntityList } from "@exabyte-io/code.js/dist/utils"; + import { MethodFactory } from "../methods/factory"; import { Model } from "../model"; import { safelyGetSlug, stringToSlugifiedEntry } from "../utils/slugifiedEntry"; @@ -28,7 +29,8 @@ export class DFTModel extends Model { } get defaultFunctional() { - return treeSlugToNamedObject(this.treeBranchForSubType.functionals[0]); + const functional = safelyGetSlug(this.defaultConfig?.functional) || "pbe"; + return stringToSlugifiedEntry(functional); } // eslint-disable-next-line class-methods-use-this @@ -53,6 +55,18 @@ export class DFTModel extends Model { return this.prop("modifiers", this.defaultModifiers); } + getDefaultCategorizedModel() { + const subtype = this.subtype || "gga"; + const filterObj = { + regex: "\\/pb\\/qm\\/dft\\/ksdft\\/" + subtype + "\\?functional=([A-Za-z0-9_-]+)", + }; + const filtered = filterEntityList({ + entitiesOrPaths: this.getCategorizedModels(), + filterObjects: [filterObj], + }); + return filtered[0]; + } + setSubtype(subtype) { this.setProp("subtype", subtype); this.setFunctional(this.defaultFunctional); From d7c090fcb4dffd797da2fe1de3ef7ebd490972c3 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 14:51:49 -0700 Subject: [PATCH 17/62] test: default functional of dft model --- tests/dft_model.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/dft_model.test.ts diff --git a/tests/dft_model.test.ts b/tests/dft_model.test.ts new file mode 100644 index 0000000..d98b633 --- /dev/null +++ b/tests/dft_model.test.ts @@ -0,0 +1,11 @@ +import { expect } from "chai"; + +import { DFTModel } from "../src/models/dft"; + +describe("DFTModel", () => { + it("should have a default functional", () => { + const config = { type: "dft", subtype: "lda" }; + const model = new DFTModel(config); + expect(model.defaultFunctional.slug).to.be.equal("pz"); + }); +}); From 0c0fdebec2d9463933794d9ac197859fd3ce2376 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 14:59:05 -0700 Subject: [PATCH 18/62] docs: add docstring to getCategorizedModels() --- src/model.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/model.js b/src/model.js index b2c0d7e..9260874 100644 --- a/src/model.js +++ b/src/model.js @@ -59,6 +59,9 @@ export class Model extends DefaultableInMemoryEntity { return PseudopotentialMethodConfig; } + /** + * @returns {{ path: string }[]} - Array of categorized models + */ getCategorizedModels() { if (!this._application) return categorizedModelList; const filteredModels = filterModelsByApplicationParameters({ From 9ea2848b022de76d738b9fd6688a34c04ab266a9 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 17:07:14 -0700 Subject: [PATCH 19/62] chore: use explicit import for lodash --- src/method.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/method.js b/src/method.js index a165049..f90ddbf 100644 --- a/src/method.js +++ b/src/method.js @@ -1,6 +1,7 @@ import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import { deepClone } from "@exabyte-io/code.js/dist/utils"; -import lodash from "lodash"; +import isEmpty from "lodash/isEmpty"; +import omit from "lodash/omit"; import { PseudopotentialMethodConfig } from "./default_methods"; @@ -57,7 +58,7 @@ export class Method extends DefaultableInMemoryEntity { get omitInHashCalculation() { const data = this.prop("data"); - return !data.searchText && lodash.isEmpty(lodash.omit(data, "searchText")); + return !data.searchText && isEmpty(omit(data, "searchText")); } // data without client-only fields From a640a65c8a1708861aa5ff91362e3f217b5c4424 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 17:08:08 -0700 Subject: [PATCH 20/62] chore: remove UI-related functions --- src/models/dft.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/models/dft.js b/src/models/dft.js index a6bc892..2226deb 100644 --- a/src/models/dft.js +++ b/src/models/dft.js @@ -101,28 +101,4 @@ export class DFTModel extends Model { modifiers: this.modifiers, }; } - - /** - * Get all functionals in the form of {name: ..., slug: ...} for further use in UI - * @returns {Object.[]} - List of functional objects - */ - get allFunctionals() { - return this.treeBranchForSubType.functionals.map((x) => stringToSlugifiedEntry(x)); - } - - /** - * Get all refiners in the form of {name: ..., slug: ...} for further use in UI - * @returns {Object.[]} - List of refiner objects - */ - get allRefiners() { - return this.treeBranchForSubType.refiners.map((x) => stringToSlugifiedEntry(x)); - } - - /** - * Get all modifiers in the form of {name: ..., slug: ...} for further use in UI - * @returns {Object.[]} - List of modifier objects - */ - get allModifiers() { - return this.treeBranchForSubType.modifiers.map((x) => stringToSlugifiedEntry(x)); - } } From 4e7e622e754aecf98d5af5e7b3d4a258acbbdfb8 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 18:32:13 -0700 Subject: [PATCH 21/62] chore: add separate instance method for default config --- src/model.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/model.js b/src/model.js index 9260874..34d74ef 100644 --- a/src/model.js +++ b/src/model.js @@ -31,11 +31,11 @@ export class Model extends DefaultableInMemoryEntity { } get defaultType() { - return this.defaultConfig.type; + return this._defaultConfig.type; } get defaultSubtype() { - return this.defaultConfig.subtype; + return this._defaultConfig.subtype; } get groupSlug() { @@ -78,16 +78,25 @@ export class Model extends DefaultableInMemoryEntity { return this.getCategorizedModels()[0]; } - get defaultConfig() { - const defaultModel = !this._defaultCategorized - ? DFTModelConfig - : ModelInterface.convertToSimple(this._defaultCategorized); + static get defaultConfig() { return { - ...defaultModel, + ...DFTModelConfig, method: Method.defaultConfig, }; } + /** + * Instance method for default config. + * This is used to obtain default properties such as type/subtype. + */ + get _defaultConfig() { + // TODO: Add suitable method, given application/model + const defaultModel = ModelInterface.convertToSimple(this._defaultCategorized); + return { + ...defaultModel, + }; + } + toJSON() { return { ...super.toJSON(), From 11469190894809a0181d68e773e8e3c629ce4d6c Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 18:33:10 -0700 Subject: [PATCH 22/62] chore: avoid recursion in default getters --- src/models/dft.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/models/dft.js b/src/models/dft.js index 2226deb..6905569 100644 --- a/src/models/dft.js +++ b/src/models/dft.js @@ -29,7 +29,7 @@ export class DFTModel extends Model { } get defaultFunctional() { - const functional = safelyGetSlug(this.defaultConfig?.functional) || "pbe"; + const functional = safelyGetSlug(this._defaultConfig?.functional) || "pbe"; return stringToSlugifiedEntry(functional); } @@ -56,7 +56,8 @@ export class DFTModel extends Model { } getDefaultCategorizedModel() { - const subtype = this.subtype || "gga"; + const subtype = this.prop("subtype", "gga"); + const filterObj = { regex: "\\/pb\\/qm\\/dft\\/ksdft\\/" + subtype + "\\?functional=([A-Za-z0-9_-]+)", }; From b35e192866770b2030fc9f2ab278c33c32d50a9f Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 18:33:53 -0700 Subject: [PATCH 23/62] refactor: replace tree in model factory --- src/models/factory.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/models/factory.js b/src/models/factory.js index decbd6f..a253adf 100644 --- a/src/models/factory.js +++ b/src/models/factory.js @@ -1,5 +1,7 @@ +import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/models"; + +import { allModels as categorizedModelList } from "../data/model_list"; import { Model } from "../model"; -import { getDefaultModelTypeForApplication } from "../tree"; import { DFTModel } from "./dft"; export class ModelFactory { @@ -16,13 +18,20 @@ export class ModelFactory { } } + static getDefaultModelForApplication(application) { + if (application) return categorizedModelList[0]; + const filteredModels = filterModelsByApplicationParameters({ + modelList: categorizedModelList, + appName: this._application?.name, + version: this._application?.version, + build: this._application?.build, + }); + return filteredModels[0]; + } + static createFromApplication(config) { const { application } = config; - const type = application && getDefaultModelTypeForApplication(application); - if (!type) - throw new Error( - `ModelFactory.createFromApplication: cannot determine model type: ${type}`, - ); - return this.create({ ...config, type }); + const defaultModel = this.getDefaultModelForApplication(application); + return this.create({ ...config, ...defaultModel }); } } From a4e6620c16cd4acf057de6bd530b6aec551ee2f9 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 18:34:42 -0700 Subject: [PATCH 24/62] test: create dft model via factory --- tests/dft_model.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/dft_model.test.ts b/tests/dft_model.test.ts index d98b633..77a6b72 100644 --- a/tests/dft_model.test.ts +++ b/tests/dft_model.test.ts @@ -1,6 +1,7 @@ import { expect } from "chai"; import { DFTModel } from "../src/models/dft"; +import { ModelFactory } from "../src/models/factory"; describe("DFTModel", () => { it("should have a default functional", () => { @@ -8,4 +9,10 @@ describe("DFTModel", () => { const model = new DFTModel(config); expect(model.defaultFunctional.slug).to.be.equal("pz"); }); + + it("can be created from the factory", () => { + const config = { type: "dft" }; + const model = ModelFactory.create(config) as DFTModel; + expect(model.functional?.slug).to.be.equal("pbe"); + }); }); From 110b9f8a8aae8c820d6b89f1d86d7ef358ccd3a8 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 18:40:28 -0700 Subject: [PATCH 25/62] codejs++: use 2023.10.24-0 --- package-lock.json | 62 ++++++++++++++++++------------------ package.json | 2 +- src/utils/model_interface.ts | 5 +-- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e75e55..c163600 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1368,9 +1368,9 @@ } }, "@babel/runtime-corejs2": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.22.15.tgz", - "integrity": "sha512-CcAMW2o5uqgeXIXYYPrgmaYj1HOLvQb2DrBi7+bELD4nUVSKk+Sth+yYuGqSRf+aAiOv3sIZJTUiJBhoASJRLg==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.23.2.tgz", + "integrity": "sha512-lTwRWGcAUBANnxD0A4c5/wKQ0eLhgdAy9kdY2rzTmmliumBQ8u8awykMnaQAnZR3PC47jLRjGoj+hozZqy9Bww==", "dev": true, "requires": { "core-js": "^2.6.12", @@ -1625,9 +1625,9 @@ } }, "@exabyte-io/code.js": { - "version": "2023.9.14-1", - "resolved": "https://registry.npmjs.org/@exabyte-io/code.js/-/code.js-2023.9.14-1.tgz", - "integrity": "sha512-Auwr0iw7OWz3caoVWwVkEIMVj0CK93Z1eE4ZrEtqS6HAqGVAavp1FfgNVrNPjZinzVZNfyykKOCGe4D+H/ReKA==", + "version": "2023.10.24-0", + "resolved": "https://registry.npmjs.org/@exabyte-io/code.js/-/code.js-2023.10.24-0.tgz", + "integrity": "sha512-fltazq1k/fNaBM0eKDL+GK+qOKb8k79/Q0KszB6j69q1roZbro32itGzyT1w5pbkYoPP2LX9qdjO8omlzm4ddQ==", "dev": true, "requires": { "@babel/cli": "7.16.0", @@ -1638,7 +1638,7 @@ "@babel/preset-react": "7.16.7", "@babel/register": "^7.16.0", "@babel/runtime-corejs3": "7.16.8", - "@exabyte-io/esse.js": "2023.8.31-0", + "@exabyte-io/esse.js": "^2023.10.24-0", "@types/chai": "^4.3.5", "@types/crypto-js": "^4.1.1", "@types/js-yaml": "^4.0.5", @@ -1685,9 +1685,9 @@ "dev": true }, "@exabyte-io/esse.js": { - "version": "2023.8.31-0", - "resolved": "https://registry.npmjs.org/@exabyte-io/esse.js/-/esse.js-2023.8.31-0.tgz", - "integrity": "sha512-thSlEJ7ToUJg/y5tMLtzfMAWPU7IQ7H1NcYt+Y86F/MYBF3N+20jFJeohafLJ+OJe432LqBZPP7F/IRr4kD6fA==", + "version": "2023.10.24-0", + "resolved": "https://registry.npmjs.org/@exabyte-io/esse.js/-/esse.js-2023.10.24-0.tgz", + "integrity": "sha512-6Oz0azZlCpiQ0vlO7m+JjBfpQf33I75dnOgV3hztIs5XC/sz0i3DnoPwNzbXR6LpYkiu40XjW+lO/Z0hDhSm+g==", "dev": true, "requires": { "@babel/cli": "7.16.0", @@ -2010,9 +2010,9 @@ "dev": true }, "@types/crypto-js": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.2.tgz", - "integrity": "sha512-t33RNmTu5ufG/sorROIafiCVJMx3jz95bXUMoPAZcUD14fxMXnuTzqzXZoxpR0tNx2xpw11Dlmem9vGCsrSOfA==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.3.tgz", + "integrity": "sha512-YP1sYYayLe7Eg5oXyLLvOLfxBfZ5Fgpz6sVWkpB18wDMywCLPWmqzRz+9gyuOoLF0fzDTTFwlyNbx7koONUwqA==", "dev": true }, "@types/glob": { @@ -2044,9 +2044,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.198", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz", - "integrity": "sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==", + "version": "4.14.200", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz", + "integrity": "sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==", "dev": true }, "@types/minimatch": { @@ -2074,15 +2074,15 @@ "dev": true }, "@types/prop-types": { - "version": "15.7.5", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", + "version": "15.7.9", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.9.tgz", + "integrity": "sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g==", "dev": true }, "@types/react": { - "version": "18.2.21", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.21.tgz", - "integrity": "sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==", + "version": "18.2.31", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.31.tgz", + "integrity": "sha512-c2UnPv548q+5DFh03y8lEDeMfDwBn9G3dRwfkrxQMo/dOtRHUUO57k6pHvBIfH/VF4Nh+98mZ5aaSe+2echD5g==", "dev": true, "requires": { "@types/prop-types": "*", @@ -2091,9 +2091,9 @@ } }, "@types/react-jsonschema-form": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@types/react-jsonschema-form/-/react-jsonschema-form-1.7.8.tgz", - "integrity": "sha512-oFyNOa8VDSt1jGN4r+prTFD2hojZBsqLoTkRfo+XvANR3taLUeMJlGhtOP+hpi/k19OxpEb24TZciMmQyPZ9TA==", + "version": "1.7.10", + "resolved": "https://registry.npmjs.org/@types/react-jsonschema-form/-/react-jsonschema-form-1.7.10.tgz", + "integrity": "sha512-WycAa8c+f78wYVvEgCoN7Pv6u8t8LN2rgZirv898OWFAXSK96QXH1v0FnJvHvhdTqG7ap/Mk/ODaSZK2Aa0XLw==", "dev": true, "requires": { "@types/json-schema": "*", @@ -2101,9 +2101,9 @@ } }, "@types/scheduler": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", - "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", + "version": "0.16.5", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.5.tgz", + "integrity": "sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==", "dev": true }, "@types/semver": { @@ -2978,9 +2978,9 @@ "dev": true }, "crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==", "dev": true }, "csstype": { diff --git a/package.json b/package.json index 62052da..2ebdc39 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "devDependencies": { "@babel/preset-typescript": "^7.22.5", "@exabyte-io/application-flavors.js": "2023.9.20-0", - "@exabyte-io/code.js": "2023.9.14-1", + "@exabyte-io/code.js": "2023.10.24-0", "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", "@types/chai": "^4.3.5", diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts index a70dc6b..5078229 100644 --- a/src/utils/model_interface.ts +++ b/src/utils/model_interface.ts @@ -1,7 +1,4 @@ -import { - BaseModel, - CategorizedBaseModel as CategorizedModel, -} from "@exabyte-io/code.js/dist/types"; +import { BaseModel, CategorizedModel } from "@exabyte-io/code.js/dist/types"; import { allModels as categorizedModelList } from "../data/model_list"; import { safelyGetSlug, stringToSlugifiedEntry } from "./slugifiedEntry"; From ddbdfc7dd1a37f18af49f78af6f868aced8a9a0b Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Tue, 24 Oct 2023 18:56:13 -0700 Subject: [PATCH 26/62] appl-flavors++: use chore/SOF-6991 --- package-lock.json | 5 ++--- package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index c163600..a7d97a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1562,9 +1562,8 @@ } }, "@exabyte-io/application-flavors.js": { - "version": "2023.9.20-0", - "resolved": "https://registry.npmjs.org/@exabyte-io/application-flavors.js/-/application-flavors.js-2023.9.20-0.tgz", - "integrity": "sha512-5nN9upiSHlo6KfxSwuCb9BZb6VvcegjT+G6vIlxW2wLADvaObjWzY8CL2DMwwb+B9f5v/Xu1vj1DavVE9GqF3A==", + "version": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", + "from": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", "dev": true, "requires": { "@babel/cli": "7.16.0", diff --git a/package.json b/package.json index 2ebdc39..763b9eb 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.22.5", - "@exabyte-io/application-flavors.js": "2023.9.20-0", + "@exabyte-io/application-flavors.js": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", "@exabyte-io/code.js": "2023.10.24-0", "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", From 81e9d6d5c16bc67bb90bedae383373444dfd70af Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 09:53:10 -0700 Subject: [PATCH 27/62] chore: fix create from application --- src/models/factory.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/models/factory.js b/src/models/factory.js index a253adf..2914b8b 100644 --- a/src/models/factory.js +++ b/src/models/factory.js @@ -2,6 +2,7 @@ import { filterModelsByApplicationParameters } from "@exabyte-io/application-fla import { allModels as categorizedModelList } from "../data/model_list"; import { Model } from "../model"; +import { ModelInterface } from "../utils/model_interface"; import { DFTModel } from "./dft"; export class ModelFactory { @@ -19,14 +20,14 @@ export class ModelFactory { } static getDefaultModelForApplication(application) { - if (application) return categorizedModelList[0]; + if (!application) return categorizedModelList[0]; const filteredModels = filterModelsByApplicationParameters({ modelList: categorizedModelList, - appName: this._application?.name, - version: this._application?.version, - build: this._application?.build, + appName: application?.name, + version: application?.version, + build: application?.build, }); - return filteredModels[0]; + return ModelInterface.convertToSimple(filteredModels[0]); } static createFromApplication(config) { From 00916a361ccd05dc7e86cc3867dfac3d290d05c6 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 09:53:53 -0700 Subject: [PATCH 28/62] test: create dft model from application --- tests/dft_model.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/dft_model.test.ts b/tests/dft_model.test.ts index 77a6b72..6f359f0 100644 --- a/tests/dft_model.test.ts +++ b/tests/dft_model.test.ts @@ -15,4 +15,22 @@ describe("DFTModel", () => { const model = ModelFactory.create(config) as DFTModel; expect(model.functional?.slug).to.be.equal("pbe"); }); + + it("can be created from the factory given an application", () => { + const config = { + application: { + name: "espresso", + version: "6.3", + build: "Default", + }, + otherProperty: 42, + }; + const model = ModelFactory.createFromApplication(config); + expect(model).to.be.instanceof(DFTModel); + expect(model.type).to.be.equal("dft"); + expect(model.subtype).to.be.equal("gga"); + // @ts-ignore + expect(model.functional?.slug).to.be.equal("pbe"); + expect(model._json.otherProperty).to.be.equal(42); + }); }); From 4daaf55bce7e920d348f048e0301391ab5c52b22 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 10:05:52 -0700 Subject: [PATCH 29/62] test: move model test to typescript --- tests/model.test.js | 12 ------------ tests/model.test.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) delete mode 100644 tests/model.test.js create mode 100644 tests/model.test.ts diff --git a/tests/model.test.js b/tests/model.test.js deleted file mode 100644 index 920fa0c..0000000 --- a/tests/model.test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { expect } from "chai"; - -import { Model } from "../src/model"; - -describe("Model", () => { - const obj = { type: "dft" }; - - it("can be created", () => { - const app = new Model(obj); - expect(app.type).to.equal("dft"); - }); -}); diff --git a/tests/model.test.ts b/tests/model.test.ts new file mode 100644 index 0000000..2a5d0e6 --- /dev/null +++ b/tests/model.test.ts @@ -0,0 +1,19 @@ +import { expect } from "chai"; + +import { Model } from "../src/model"; +import { ModelFactory } from "../src/models/factory"; + +describe("Model", () => { + const obj = { type: "dft" }; + + it("can be created", () => { + // @ts-ignore + const model = new Model(obj); + expect(model.type).to.equal("dft"); + }); + + it("can be created from the model factory", () => { + const model = ModelFactory.create(obj); + expect(model.type).to.be.equal("dft"); + }); +}); From abc1a6846b2a6501c7b8bcefdfe61767370505db Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 10:55:35 -0700 Subject: [PATCH 30/62] update: use model interface of chore/SOF-6706 --- src/utils/model_interface.ts | 55 +++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts index 5078229..4efa2a9 100644 --- a/src/utils/model_interface.ts +++ b/src/utils/model_interface.ts @@ -1,9 +1,24 @@ -import { BaseModel, CategorizedModel } from "@exabyte-io/code.js/dist/types"; +// import { BaseModel, CategorizedModel } from "@exabyte-io/code.js/dist/types"; +import { + BaseModel, + CategorizedModel, + LegacyModelDensityFunctionalTheory, + LegacyModelRegression, + LegacyModelUnknown, + ModelGeneralizedGradientApproximation, + ModelHybridFunctional, + ModelLocalDensityApproximation, + ModelRegression, +} from "@exabyte-io/code.js/dist/types"; import { allModels as categorizedModelList } from "../data/model_list"; import { safelyGetSlug, stringToSlugifiedEntry } from "./slugifiedEntry"; type SimpleModel = Omit; +type CategorizedDftModel = + | Omit + | Omit + | Omit; /** * The model interface converts between the legacy model data structure (type, subtype, functional) @@ -23,37 +38,47 @@ export class ModelInterface { } } - static convertDftToSimple(cm: CategorizedModel): SimpleModel { + private static functionalsPerSubtype(subtype: string): string[] { + return categorizedModelList.reduce((accumulator, item) => { + if (item.categories?.subtype === subtype && item.parameters.functional) { + accumulator.push(item.parameters.functional); + } + return accumulator; + }, []); + } + + static convertDftToSimple( + cm: CategorizedDftModel, + ): Omit { if (!cm.categories?.subtype) return this.convertUnknownToSimple(); const { subtype } = cm.categories; - - // @ts-ignore todo: adjust ESSE schemas - const { functional } = cm.parameters; + const functional = cm.parameters?.functional; return { type: "dft", subtype, + // @ts-ignore todo: cover undefined functional case functional: stringToSlugifiedEntry(functional), }; } - static convertMlToSimple(): SimpleModel { + static convertMlToSimple(): Omit { return { type: "ml", subtype: "re", }; } - static convertUnknownToSimple(): SimpleModel { + static convertUnknownToSimple(): Omit { return { type: "unknown", subtype: "unknown", }; } - static convertToCategorized(sm?: SimpleModel): CategorizedModel | undefined { + static convertToCategorized(sm?: SimpleModel): Omit | undefined { switch (sm?.type) { case "dft": - return this.convertDftToCategorized(sm); + return this.convertDftToCategorized(sm as LegacyModelDensityFunctionalTheory); case "ml": return this.convertMlToCategorized(); case "unknown": @@ -63,22 +88,20 @@ export class ModelInterface { } } - static convertDftToCategorized(sm: SimpleModel): CategorizedModel { + static convertDftToCategorized(sm: LegacyModelDensityFunctionalTheory): CategorizedDftModel { const { subtype, functional: functionalStringOrObject } = sm; - const defaultFunctionals = { lda: "pz", gga: "pbe", hybrid: "b3lyp" }; let functional: string; if (!functionalStringOrObject) { - functional = defaultFunctionals[subtype as keyof typeof defaultFunctionals]; + [functional] = this.functionalsPerSubtype(subtype); } else { - // @ts-ignore todo: adjust ESSE schemas functional = safelyGetSlug(functionalStringOrObject); } + // TODO: cover other parameter combinations, e.g. functional + spin-orbit const path = `/pb/qm/dft/ksdft/${subtype}?functional=${functional}`; - // @ts-ignore todo: adjust ESSE schemas - return categorizedModelList.find((cm) => cm.path === path); + return categorizedModelList.find((cm) => cm.path === path) as CategorizedDftModel; } - static convertMlToCategorized(): CategorizedModel { + static convertMlToCategorized(): Omit { // TODO: allow other ML types const path = "/st/det/ml/re/none"; // @ts-ignore todo: adjust ESSE schemas From d35881598f7591aa37acbb6661af8ffbd0f6a0c4 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 11:23:00 -0700 Subject: [PATCH 31/62] update: add method interface --- src/utils/method_interface.ts | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/utils/method_interface.ts diff --git a/src/utils/method_interface.ts b/src/utils/method_interface.ts new file mode 100644 index 0000000..bb8c3ea --- /dev/null +++ b/src/utils/method_interface.ts @@ -0,0 +1,112 @@ +import { + BaseMethod, + CategorizedMethod, + LegacyMethodLocalorbital, + LegacyMethodPseudopotential, + LegacyMethodRegression, + LegacyMethodUnknown, + UnitMethodPseudopotential, + UnitMethodRegression, +} from "@exabyte-io/code.js/dist/types"; + +import { allMethods as categorizedMethodList } from "../data/method_list"; +import { LocalOrbitalMethodConfig, UnknownMethodConfig } from "../default_methods"; +import { safelyGetSlug } from "./slugifiedEntry"; + +/** + * The method interface converts between the legacy method data structure (type, subtype) + * and the categorized method data structure (units with tier1, tier2, ...). + */ +export class MethodInterface { + static convertToSimple(cm: CategorizedMethod | undefined): BaseMethod { + if (!cm) return this.convertUnknownToSimple(); + const pspUnits = cm.units.filter((u) => u.categories.type === "psp"); + const aoUnit = cm.units.find((u) => u.categories.type === "ao"); + const reUnit = cm.units.find( + (u) => u.name && u.name.includes("regression"), + ) as UnitMethodRegression; + if (pspUnits.length) return this.convertPspUnitsToSimple(pspUnits); + if (aoUnit) return this.convertAoUnitToSimple(); + if (reUnit) return this.convertRegressionUnitToSimple(reUnit); + return this.convertRegressionUnitToSimple(reUnit); + } + + static convertUnknownToSimple(): LegacyMethodUnknown { + // @ts-ignore todo: move default_methods to TS + return UnknownMethodConfig; + } + + static convertPspUnitsToSimple( + cm: UnitMethodPseudopotential[], + ): LegacyMethodUnknown | LegacyMethodPseudopotential { + const [firstUnit, ...otherUnits] = cm; + if (!firstUnit || !firstUnit.categories?.subtype) return this.convertUnknownToSimple(); + const subtype = otherUnits?.length ? "any" : firstUnit.categories.subtype; + return { + type: "pseudopotential", + subtype, + } as LegacyMethodPseudopotential; + } + + static convertAoUnitToSimple(): LegacyMethodLocalorbital { + // @ts-ignore todo: move default_methods to TS + return LocalOrbitalMethodConfig; + } + + static convertRegressionUnitToSimple(cm: UnitMethodRegression): LegacyMethodRegression { + const type = cm.categories.type || "linear"; + const subtype = cm.categories.subtype || "least_squares"; + return { + type: safelyGetSlug(type) as "linear" | "kernel_ridge", + subtype: safelyGetSlug(subtype) as "least_squares" | "ridge", + data: cm.data, + precision: cm.precision, + }; + } + + static convertToCategorized(sm?: BaseMethod): CategorizedMethod | undefined { + switch (sm?.type) { + case "pseudopotential": + return this.convertPspToCategorized(sm as LegacyMethodPseudopotential); + case "localorbital": + return this.convertAoToCategorized(); + case "linear": + return this.convertRegressionToCategorized(sm as LegacyMethodRegression); + case "kernel_ridge": + return this.convertRegressionToCategorized(sm as LegacyMethodRegression); + default: + return undefined; + } + } + + static convertPspToCategorized(sm: LegacyMethodPseudopotential): CategorizedMethod { + // TODO: support other PSP methods, e.g. PSP + conjugate gradient + const subtype = safelyGetSlug(sm.subtype); + // the "any" subtype is equivalent to the method representing all planewave-pseudopotential + // methods. All other subtypes are equivalent to using a specific PW-PSP method. + const path = + subtype === "any" + ? "/qm/wf/none/psp/us::/qm/wf/none/psp/nc::/qm/wf/none/psp/paw::/qm/wf/none/pw/none" + : `/qm/wf/none/smearing/gaussian::/linalg/diag/none/davidson/none::/qm/wf/none/psp/${subtype}::/qm/wf/none/pw/none`; + + return categorizedMethodList.find((catMethod) => { + return catMethod.path === path; + }) as CategorizedMethod; + } + + static convertAoToCategorized(): CategorizedMethod { + // TODO: support other localorbital methods + const path = "/qm/wf/none/ao/pople?basisSlug=6-31G"; + return categorizedMethodList.find((cm) => cm.path === path) as CategorizedMethod; + } + + static convertRegressionToCategorized(sm: LegacyMethodRegression): CategorizedMethod { + const type = safelyGetSlug(sm.type); + const subtype = safelyGetSlug(sm.subtype); + const { precision, data } = sm; + const path = `/none/none/none/${type}/${subtype}`; + const method = categorizedMethodList.find((cm) => cm.path === path) as CategorizedMethod; + Object.assign(method.units[0], { precision, data }); + return method; + } +} From 0aee1ae4005149f684de8660b32c51374c899f55 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 13:38:31 -0700 Subject: [PATCH 32/62] update: create default method from model+application --- src/model.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/model.js b/src/model.js index 34d74ef..4f1f95c 100644 --- a/src/model.js +++ b/src/model.js @@ -1,12 +1,15 @@ +import { filterMethodsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/methods"; import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/models"; import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import lodash from "lodash"; +import { allMethods as categorizedMethodList } from "./data/method_list"; import { allModels as categorizedModelList } from "./data/model_list"; -import { PseudopotentialMethodConfig } from "./default_methods"; import { DFTModelConfig } from "./default_models"; import { Method } from "./method"; import { MethodFactory } from "./methods/factory"; +import { filterMethodsByModel } from "./tree"; +import { MethodInterface } from "./utils/method_interface"; import { ModelInterface } from "./utils/model_interface"; export class Model extends DefaultableInMemoryEntity { @@ -54,9 +57,27 @@ export class Model extends DefaultableInMemoryEntity { this._method = method; } - // eslint-disable-next-line class-methods-use-this + getCategorizedMethods() { + const catModel = ModelInterface.convertToCategorized(this._json); + let filteredMethods = filterMethodsByModel({ + methodList: categorizedMethodList, + // model: ModelInterface.convertToCategorized(this._json), + model: catModel, + }); + if (this._application) { + filteredMethods = filterMethodsByApplicationParameters({ + methodList: filteredMethods, + appName: this._application?.name, + version: this._application?.version, + build: this._application?.build, + }); + } + return filteredMethods; + } + get defaultMethodConfig() { - return PseudopotentialMethodConfig; + const [defaultCategorizedMethod] = this.getCategorizedMethods(); + return MethodInterface.convertToSimple(defaultCategorizedMethod); } /** From a38e379e2524950d242864284dadb1063a38feee Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 13:39:41 -0700 Subject: [PATCH 33/62] test: verify method type for default dft model --- tests/dft_model.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/dft_model.test.ts b/tests/dft_model.test.ts index 6f359f0..34ac9ca 100644 --- a/tests/dft_model.test.ts +++ b/tests/dft_model.test.ts @@ -32,5 +32,6 @@ describe("DFTModel", () => { // @ts-ignore expect(model.functional?.slug).to.be.equal("pbe"); expect(model._json.otherProperty).to.be.equal(42); + expect(model.method.type).to.be.equal("pseudopotential"); }); }); From 2cceccefed427f55b1a597bca20f89942c9768e6 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 13:55:06 -0700 Subject: [PATCH 34/62] refactor: use lodash for sortby util --- src/methods/pseudopotential.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/methods/pseudopotential.js b/src/methods/pseudopotential.js index ff0b588..479333f 100644 --- a/src/methods/pseudopotential.js +++ b/src/methods/pseudopotential.js @@ -1,5 +1,5 @@ import { safeMakeArray } from "@exabyte-io/code.js/dist/utils"; -import _ from "underscore"; +import sortBy from "lodash/sortBy"; import { Method } from "../method"; @@ -71,7 +71,7 @@ export class PseudopotentialMethod extends Method { // sort by alphabetical order to ensure elements order consistency in VASP POSCAR/POTCAR this.setData({ ...this.data, - pseudo: _.sortBy(pseudopotentials, "element").map((x) => x.toJSON()), + pseudo: sortBy(pseudopotentials, ["element"]).map((x) => x.toJSON()), }); } @@ -82,7 +82,7 @@ export class PseudopotentialMethod extends Method { // sort by alphabetical order to ensure elements order consistency in VASP POSCAR/POTCAR this.setData({ ...this.data, - allPseudo: _.sortBy(pseudopotentials, "element").map((x) => x.toJSON()), + allPseudo: sortBy(pseudopotentials, ["element"]).map((x) => x.toJSON()), }); } From c7ffe048b8af55b9d72bcadbe05022994a9dba80 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 16:50:07 -0700 Subject: [PATCH 35/62] style: remove redundant comment --- src/model.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/model.js b/src/model.js index 4f1f95c..39488fe 100644 --- a/src/model.js +++ b/src/model.js @@ -61,7 +61,6 @@ export class Model extends DefaultableInMemoryEntity { const catModel = ModelInterface.convertToCategorized(this._json); let filteredMethods = filterMethodsByModel({ methodList: categorizedMethodList, - // model: ModelInterface.convertToCategorized(this._json), model: catModel, }); if (this._application) { From dd31530b8d3db3a90f2bfd65d8fdfb873747f5ae Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 17:29:41 -0700 Subject: [PATCH 36/62] chore: add method filter functions to interface --- src/modules.d.ts | 21 +++++++++++++++++ src/utils/method_interface.ts | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/modules.d.ts diff --git a/src/modules.d.ts b/src/modules.d.ts new file mode 100644 index 0000000..529f056 --- /dev/null +++ b/src/modules.d.ts @@ -0,0 +1,21 @@ +declare module "@exabyte-io/application-flavors.js/lib/js/methods" { + // TODO: add TS to application-flavors + + interface FilterProps { + methodList: object[]; + appName?: string; + version?: string; + build?: string; + executable?: string; + flavor?: string; + } + + export function filterMethodsByApplicationParameters({ + methodList, + appName, + version, + build, + executable, + flavor, + }: FilterProps): object[]; +} diff --git a/src/utils/method_interface.ts b/src/utils/method_interface.ts index bb8c3ea..8438706 100644 --- a/src/utils/method_interface.ts +++ b/src/utils/method_interface.ts @@ -1,6 +1,9 @@ +import { filterMethodsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/methods"; import { + ApplicationSchemaBase, BaseMethod, CategorizedMethod, + CategorizedModel, LegacyMethodLocalorbital, LegacyMethodPseudopotential, LegacyMethodRegression, @@ -11,6 +14,7 @@ import { import { allMethods as categorizedMethodList } from "../data/method_list"; import { LocalOrbitalMethodConfig, UnknownMethodConfig } from "../default_methods"; +import { filterMethodsByModel } from "../tree"; import { safelyGetSlug } from "./slugifiedEntry"; /** @@ -109,4 +113,43 @@ export class MethodInterface { Object.assign(method.units[0], { precision, data }); return method; } + + static filterCategorizedMethods({ + model, + application, + }: { + model?: CategorizedModel; + application?: ApplicationSchemaBase; + }): CategorizedMethod[] { + let filteredMethods = categorizedMethodList; + if (model) { + // @ts-ignore todo: sort out types of filter function + filteredMethods = filterMethodsByModel({ + // @ts-ignore + methodList: filteredMethods, + model, + }); + } + if (application) { + // @ts-ignore todo: sort out types of filter function + filteredMethods = filterMethodsByApplicationParameters({ + methodList: filteredMethods, + appName: application?.name, + version: application?.version, + build: application?.build, + }); + } + return filteredMethods; + } + + static filterLegacyMethods({ + model, + application, + }: { + model?: CategorizedModel; + application?: ApplicationSchemaBase; + }): BaseMethod[] { + const categorizedMethods = this.filterCategorizedMethods({ application, model }); + return categorizedMethods.map((cm) => this.convertToSimple(cm)); + } } From c830a3180b06f2f201cbd9860d34e6d86d65764a Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 17:30:38 -0700 Subject: [PATCH 37/62] chore: remove unused functions --- src/default_methods.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/default_methods.js b/src/default_methods.js index 85d91c8..f800fe4 100644 --- a/src/default_methods.js +++ b/src/default_methods.js @@ -1,7 +1,3 @@ -import lodash from "lodash"; - -import { MODEL_NAMES, MODEL_TREE } from "./tree"; - export const PseudopotentialMethodConfig = { type: "pseudopotential", subtype: "us", @@ -16,23 +12,3 @@ export const UnknownMethodConfig = { type: "unknown", subtype: "unknown", }; - -export function allowedTypes(model) { - return lodash - .keys(lodash.get(MODEL_TREE, `${model.type}.${model.subtype}.methods`, [])) - .map((x) => { - return { - slug: x, - name: lodash.get(MODEL_NAMES, x, x), - }; - }); -} - -export function allowedSubtypes(model, type) { - return lodash.get(MODEL_TREE, `${model.type}.${model.subtype}.methods.${type}`, []).map((x) => { - return { - slug: x, - name: lodash.get(MODEL_NAMES, x, x), - }; - }); -} From 6026e7e1644211501e9ffc7d4b8d7c9fb767913d Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 17:35:33 -0700 Subject: [PATCH 38/62] refactor: move default_models to typescript --- src/default_models.js | 9 --------- src/default_models.ts | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) delete mode 100644 src/default_models.js create mode 100644 src/default_models.ts diff --git a/src/default_models.js b/src/default_models.js deleted file mode 100644 index 3614747..0000000 --- a/src/default_models.js +++ /dev/null @@ -1,9 +0,0 @@ -export const DFTModelConfig = { - type: "dft", - subtype: "gga", -}; - -export const UnknownModelConfig = { - type: "unknown", - subtype: "unknown", -}; diff --git a/src/default_models.ts b/src/default_models.ts new file mode 100644 index 0000000..4f773de --- /dev/null +++ b/src/default_models.ts @@ -0,0 +1,14 @@ +import { + LegacyModelDensityFunctionalTheory, + LegacyModelUnknown, +} from "@exabyte-io/code.js/dist/types"; + +export const DFTModelConfig: Omit = { + type: "dft", + subtype: "gga", +}; + +export const UnknownModelConfig: Omit = { + type: "unknown", + subtype: "unknown", +}; From 6ee7c07ba54352f5f6e12417cec6ab825e51c674 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 17:37:51 -0700 Subject: [PATCH 39/62] refactor: move default_methods to typescript --- src/default_methods.js | 14 -------------- src/default_methods.ts | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 src/default_methods.js create mode 100644 src/default_methods.ts diff --git a/src/default_methods.js b/src/default_methods.js deleted file mode 100644 index f800fe4..0000000 --- a/src/default_methods.js +++ /dev/null @@ -1,14 +0,0 @@ -export const PseudopotentialMethodConfig = { - type: "pseudopotential", - subtype: "us", -}; - -export const LocalOrbitalMethodConfig = { - type: "localorbital", - subtype: "pople", -}; - -export const UnknownMethodConfig = { - type: "unknown", - subtype: "unknown", -}; diff --git a/src/default_methods.ts b/src/default_methods.ts new file mode 100644 index 0000000..80f27af --- /dev/null +++ b/src/default_methods.ts @@ -0,0 +1,20 @@ +import { + LegacyMethodLocalorbital, + LegacyMethodPseudopotential, + LegacyMethodUnknown, +} from "@exabyte-io/code.js/dist/types"; + +export const PseudopotentialMethodConfig: LegacyMethodPseudopotential = { + type: "pseudopotential", + subtype: "us", +}; + +export const LocalOrbitalMethodConfig: LegacyMethodLocalorbital = { + type: "localorbital", + subtype: "pople", +}; + +export const UnknownMethodConfig: LegacyMethodUnknown = { + type: "unknown", + subtype: "unknown", +}; From d76c4c3699621559bcb240257b9b8ee3b872b1b7 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 17:54:24 -0700 Subject: [PATCH 40/62] refactor: remove model tree --- src/tree.js | 145 +--------------------------------------------------- 1 file changed, 1 insertion(+), 144 deletions(-) diff --git a/src/tree.js b/src/tree.js index ec6bab8..d0d58b0 100644 --- a/src/tree.js +++ b/src/tree.js @@ -1,6 +1,5 @@ -import { deepClone, filterEntityList, mergeTerminalNodes } from "@exabyte-io/code.js/dist/utils"; +import { filterEntityList, mergeTerminalNodes } from "@exabyte-io/code.js/dist/utils"; import lodash from "lodash"; -import _ from "underscore"; import modelMethodMap from "./data/model_method_map"; @@ -12,71 +11,6 @@ export const METHODS = { unknown: "unknown", }; -const methods = { - [METHODS.pseudopotential]: ["paw", "nc", "us"], - // TODO: Add additional basis set options, once user choice of specific (i.e 3-21G vs cc-pVDZ) is implemented. - [METHODS.localorbital]: ["pople"], - [METHODS.unknown]: ["unknown"], -}; - -export const getPseudopotentialTypesFromTree = () => methods[METHODS.pseudopotential]; - -// DFT-specific - -const DFTModelRefiners = ["hse", "g0w0"]; -const DFTModelModifiers = ["soc", "magn"]; - -const DFTModelTree = { - gga: { - refiners: DFTModelRefiners, - modifiers: DFTModelModifiers, - methods, - functionals: ["pbe", "pbesol", "pw91", "other"], - }, - lda: { - refiners: DFTModelRefiners, - modifiers: DFTModelModifiers, - methods, - functionals: ["pz", "pw", "vwn", "other"], - }, - hybrid: { - methods, - functionals: ["b3lyp", "hse06"], - }, - other: { - methods, - functionals: ["other"], - }, -}; - -export const getDFTFunctionalsFromTree = () => Object.keys(DFTModelTree); - -export const getDFTFunctionalsByApproximation = (approximation) => { - const branch = DFTModelTree[approximation]; - return branch && branch.functionals; -}; - -// GENERAL - -export const MODEL_TREE = { - dft: DFTModelTree, - ml: { - re: { - methods: { - linear: ["least_squares", "ridge"], - kernel_ridge: ["least_squares"], - }, - }, - }, - unknown: { - unknown: { - methods: { - unknown: ["unknown"], - }, - }, - }, -}; - export const MODEL_NAMES = { dft: "density functional theory", lda: "local density approximation", @@ -86,83 +20,6 @@ export const MODEL_NAMES = { re: "regression", }; -export const treeSlugToNamedObject = (modelSlug) => { - return { - slug: modelSlug, - name: lodash.get(MODEL_NAMES, modelSlug, modelSlug), - }; -}; - -// TODO: find a better way to handle application-specific model-method combination -// must be a subset of the MODEL_TREE above -// demonstrate how tree can be modified -// VASP_MODELS_TREE.gga.functionals = _.omit(VASP_MODELS_TREE.gga.functionals); - -const VASP_MODELS_TREE = deepClone(_.pick(MODEL_TREE, "dft")); -const ESPRESSO_MODELS_TREE = deepClone(_.pick(MODEL_TREE, "dft")); -const NWCHEM_MODELS_TREE = deepClone(_.pick(MODEL_TREE, "dft")); - -["gga", "lda"].forEach((approximation) => { - // pick "paw" for vasp - VASP_MODELS_TREE.dft[approximation].methods.pseudopotential = VASP_MODELS_TREE.dft[ - approximation - ].methods.pseudopotential.splice(0, 1); - - // assert "us" is the first option - ESPRESSO_MODELS_TREE.dft[approximation].methods.pseudopotential = - ESPRESSO_MODELS_TREE.dft[approximation].methods.pseudopotential.reverse(); -}); - -const UNKNOWN_MODELS_TREE = _.pick(MODEL_TREE, "unknown"); -const ML_MODELS_TREE = _.pick(MODEL_TREE, "ml"); - -const MODELS_TREE_CONFIGS_BY_APPLICATION_NAME_VERSION = [ - { - name: "vasp", - tree: VASP_MODELS_TREE, - }, - { - name: "espresso", - tree: ESPRESSO_MODELS_TREE, - }, - { - name: "python", - tree: UNKNOWN_MODELS_TREE, - }, - { - name: "shell", - tree: UNKNOWN_MODELS_TREE, - }, - { - name: "exabyteml", - tree: ML_MODELS_TREE, - }, - { - name: "jupyterLab", - tree: UNKNOWN_MODELS_TREE, - }, - { - name: "nwchem", - tree: NWCHEM_MODELS_TREE, - }, -]; - -export const getTreeByApplicationNameAndVersion = ({ - name, - // eslint-disable-next-line no-unused-vars - version, -}) => { - // TODO: add logic to filter by version when necessary - const cfgs = MODELS_TREE_CONFIGS_BY_APPLICATION_NAME_VERSION.filter( - (cfg) => cfg.name === name, - ).map((x) => x.tree); - return Object.assign({}, ...cfgs); -}; - -export const getDefaultModelTypeForApplication = (application) => { - return Object.keys(getTreeByApplicationNameAndVersion(application))[0]; -}; - function safelyGet(obj, ...args) { return lodash.get(obj, args, undefined); } From 46019aa4f0b3a91b1498c6282be4e0c648d752cb Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 17:58:53 -0700 Subject: [PATCH 41/62] refactor: move filter functions to separate file --- src/filter.js | 62 ++++++++++++++++++++++++++++++++++ src/model.js | 2 +- src/tree.js | 63 ----------------------------------- src/utils/method_interface.ts | 2 +- tests/filter.test.js | 2 +- 5 files changed, 65 insertions(+), 66 deletions(-) create mode 100644 src/filter.js diff --git a/src/filter.js b/src/filter.js new file mode 100644 index 0000000..b99f462 --- /dev/null +++ b/src/filter.js @@ -0,0 +1,62 @@ +import { filterEntityList, mergeTerminalNodes } from "@exabyte-io/code.js/dist/utils"; +import lodash from "lodash"; + +import modelMethodMap from "./data/model_method_map"; + +function safelyGet(obj, ...args) { + return lodash.get(obj, args, undefined); +} + +/** + * Create list of filter objects based on model categories. + * @param {Object} filterTree - filter tree constructed from assets + * @param {string} tier1 - Level 1 tier + * @param {string} tier2 - Level 2 tier + * @param {string} tier3 - Level 3 tier + * @param {string} type - Type + * @param {string} subtype - Subtype + * @return {*[]} + */ +function getMethodFilterObjects({ filterTree, tier1, tier2, tier3, type, subtype }) { + let filterList; + if (!tier1) { + filterList = mergeTerminalNodes(filterTree); + } else if (!tier2) { + filterList = mergeTerminalNodes(safelyGet(filterTree, tier1)); + } else if (!tier3) { + filterList = mergeTerminalNodes(safelyGet(filterTree, tier1, tier2)); + } else if (!type) { + filterList = mergeTerminalNodes(safelyGet(filterTree, tier1, tier2, tier3)); + } else if (!subtype) { + filterList = mergeTerminalNodes(safelyGet(filterTree, tier1, tier2, tier3, type)); + } else { + filterList = safelyGet(filterTree, tier1, tier2, tier3, type, subtype); + } + const extractUniqueBy = (name) => { + return lodash + .chain(filterList) + .filter(Boolean) + .filter((o) => Boolean(o[name])) + .uniqBy(name) + .value(); + }; + + return [].concat(extractUniqueBy("path"), extractUniqueBy("regex")); +} + +/** + * Filter list of method configs based on model + * @param {Object[]} methodList - Array of method configs + * @param {Object} model - Model config for which methods should be filtered + * @return {Object[]} + */ +export function filterMethodsByModel({ methodList, model }) { + if (!model) return []; + const { categories } = model; + const filterObjects = getMethodFilterObjects({ filterTree: modelMethodMap, ...categories }); + return filterEntityList({ + entitiesOrPaths: methodList, + filterObjects, + multiPathSeparator: "::", + }); +} diff --git a/src/model.js b/src/model.js index 39488fe..ab09dcb 100644 --- a/src/model.js +++ b/src/model.js @@ -6,9 +6,9 @@ import lodash from "lodash"; import { allMethods as categorizedMethodList } from "./data/method_list"; import { allModels as categorizedModelList } from "./data/model_list"; import { DFTModelConfig } from "./default_models"; +import { filterMethodsByModel } from "./filter"; import { Method } from "./method"; import { MethodFactory } from "./methods/factory"; -import { filterMethodsByModel } from "./tree"; import { MethodInterface } from "./utils/method_interface"; import { ModelInterface } from "./utils/model_interface"; diff --git a/src/tree.js b/src/tree.js index d0d58b0..6bf7edd 100644 --- a/src/tree.js +++ b/src/tree.js @@ -1,8 +1,3 @@ -import { filterEntityList, mergeTerminalNodes } from "@exabyte-io/code.js/dist/utils"; -import lodash from "lodash"; - -import modelMethodMap from "./data/model_method_map"; - // TODO: migrate to use manifest instead export const METHODS = { @@ -19,61 +14,3 @@ export const MODEL_NAMES = { ml: "machine learning", re: "regression", }; - -function safelyGet(obj, ...args) { - return lodash.get(obj, args, undefined); -} - -/** - * Create list of filter objects based on model categories. - * @param {Object} filterTree - filter tree constructed from assets - * @param {string} tier1 - Level 1 tier - * @param {string} tier2 - Level 2 tier - * @param {string} tier3 - Level 3 tier - * @param {string} type - Type - * @param {string} subtype - Subtype - * @return {*[]} - */ -function getMethodFilterObjects({ filterTree, tier1, tier2, tier3, type, subtype }) { - let filterList; - if (!tier1) { - filterList = mergeTerminalNodes(filterTree); - } else if (!tier2) { - filterList = mergeTerminalNodes(safelyGet(filterTree, tier1)); - } else if (!tier3) { - filterList = mergeTerminalNodes(safelyGet(filterTree, tier1, tier2)); - } else if (!type) { - filterList = mergeTerminalNodes(safelyGet(filterTree, tier1, tier2, tier3)); - } else if (!subtype) { - filterList = mergeTerminalNodes(safelyGet(filterTree, tier1, tier2, tier3, type)); - } else { - filterList = safelyGet(filterTree, tier1, tier2, tier3, type, subtype); - } - const extractUniqueBy = (name) => { - return lodash - .chain(filterList) - .filter(Boolean) - .filter((o) => Boolean(o[name])) - .uniqBy(name) - .value(); - }; - - return [].concat(extractUniqueBy("path"), extractUniqueBy("regex")); -} - -/** - * Filter list of method configs based on model - * @param {Object[]} methodList - Array of method configs - * @param {Object} model - Model config for which methods should be filtered - * @return {Object[]} - */ -export function filterMethodsByModel({ methodList, model }) { - if (!model) return []; - const { categories } = model; - const filterObjects = getMethodFilterObjects({ filterTree: modelMethodMap, ...categories }); - return filterEntityList({ - entitiesOrPaths: methodList, - filterObjects, - multiPathSeparator: "::", - }); -} diff --git a/src/utils/method_interface.ts b/src/utils/method_interface.ts index 8438706..f107cb4 100644 --- a/src/utils/method_interface.ts +++ b/src/utils/method_interface.ts @@ -14,7 +14,7 @@ import { import { allMethods as categorizedMethodList } from "../data/method_list"; import { LocalOrbitalMethodConfig, UnknownMethodConfig } from "../default_methods"; -import { filterMethodsByModel } from "../tree"; +import { filterMethodsByModel } from "../filter"; import { safelyGetSlug } from "./slugifiedEntry"; /** diff --git a/tests/filter.test.js b/tests/filter.test.js index 7b910a1..c87714b 100644 --- a/tests/filter.test.js +++ b/tests/filter.test.js @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { filterMethodsByModel } from "../src/tree"; +import { filterMethodsByModel } from "../src/filter"; describe("model-method filter", () => { const methodConfigs = [ From 4183b68abf98c7b66cefa66b39fa3abde2dc9740 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 18:29:51 -0700 Subject: [PATCH 42/62] update: add filter function to model interface --- src/modules.d.ts | 22 +++++++++++++++++++++- src/utils/model_interface.ts | 17 ++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/modules.d.ts b/src/modules.d.ts index 529f056..252d374 100644 --- a/src/modules.d.ts +++ b/src/modules.d.ts @@ -1,7 +1,7 @@ declare module "@exabyte-io/application-flavors.js/lib/js/methods" { // TODO: add TS to application-flavors - interface FilterProps { + interface FilterPropsMethod { methodList: object[]; appName?: string; version?: string; @@ -19,3 +19,23 @@ declare module "@exabyte-io/application-flavors.js/lib/js/methods" { flavor, }: FilterProps): object[]; } + +declare module "@exabyte-io/application-flavors.js/lib/js/models" { + interface FilterPropsModel { + modelList: object[]; + appName?: string; + version?: string; + build?: string; + executable?: string; + flavor?: string; + } + + export function filterModelsByApplicationParameters({ + modelList, + appName, + version, + build, + executable, + flavor, + }: FilterPropsModel): object[]; +} diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts index 4efa2a9..b416215 100644 --- a/src/utils/model_interface.ts +++ b/src/utils/model_interface.ts @@ -1,5 +1,6 @@ -// import { BaseModel, CategorizedModel } from "@exabyte-io/code.js/dist/types"; +import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/models"; import { + ApplicationSchemaBase, BaseModel, CategorizedModel, LegacyModelDensityFunctionalTheory, @@ -107,4 +108,18 @@ export class ModelInterface { // @ts-ignore todo: adjust ESSE schemas return categorizedModelList.find((cm) => cm.path === path); } + + static filterCategorizedModels(application?: ApplicationSchemaBase): CategorizedModel[] { + // @ts-ignore todo: adjust type of model list + if (!application) return categorizedModelList; + const filteredModels = filterModelsByApplicationParameters({ + modelList: categorizedModelList, + appName: application?.name, + version: application?.version, + build: application?.build, + }); + + // @ts-ignore todo: adjust type of model list + return filteredModels; + } } From 4801e84ac893be5c7739bf1c106a040a00cf75f2 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 18:30:24 -0700 Subject: [PATCH 43/62] refactor: use filter functions from interfaces --- src/model.js | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/src/model.js b/src/model.js index ab09dcb..63cc52c 100644 --- a/src/model.js +++ b/src/model.js @@ -1,12 +1,7 @@ -import { filterMethodsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/methods"; -import { filterModelsByApplicationParameters } from "@exabyte-io/application-flavors.js/lib/js/models"; import { DefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import lodash from "lodash"; -import { allMethods as categorizedMethodList } from "./data/method_list"; -import { allModels as categorizedModelList } from "./data/model_list"; import { DFTModelConfig } from "./default_models"; -import { filterMethodsByModel } from "./filter"; import { Method } from "./method"; import { MethodFactory } from "./methods/factory"; import { MethodInterface } from "./utils/method_interface"; @@ -59,19 +54,10 @@ export class Model extends DefaultableInMemoryEntity { getCategorizedMethods() { const catModel = ModelInterface.convertToCategorized(this._json); - let filteredMethods = filterMethodsByModel({ - methodList: categorizedMethodList, + return MethodInterface.filterCategorizedMethods({ + application: this._application, model: catModel, }); - if (this._application) { - filteredMethods = filterMethodsByApplicationParameters({ - methodList: filteredMethods, - appName: this._application?.name, - version: this._application?.version, - build: this._application?.build, - }); - } - return filteredMethods; } get defaultMethodConfig() { @@ -83,15 +69,7 @@ export class Model extends DefaultableInMemoryEntity { * @returns {{ path: string }[]} - Array of categorized models */ getCategorizedModels() { - if (!this._application) return categorizedModelList; - const filteredModels = filterModelsByApplicationParameters({ - modelList: categorizedModelList, - appName: this._application?.name, - version: this._application?.version, - build: this._application?.build, - }); - - return filteredModels; + return ModelInterface.filterCategorizedModels(this._application); } getDefaultCategorizedModel() { From 8b3c3c7a8942ef31d6e07b7254d69ecc91e3d13e Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 19:19:44 -0700 Subject: [PATCH 44/62] chore: add safeguards for undefined params --- src/utils/method_interface.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/utils/method_interface.ts b/src/utils/method_interface.ts index f107cb4..2dabdc8 100644 --- a/src/utils/method_interface.ts +++ b/src/utils/method_interface.ts @@ -114,14 +114,13 @@ export class MethodInterface { return method; } - static filterCategorizedMethods({ - model, - application, - }: { + static filterCategorizedMethods(params?: { model?: CategorizedModel; application?: ApplicationSchemaBase; }): CategorizedMethod[] { let filteredMethods = categorizedMethodList; + if (!params) return filteredMethods; + const { model, application } = params; if (model) { // @ts-ignore todo: sort out types of filter function filteredMethods = filterMethodsByModel({ @@ -142,14 +141,13 @@ export class MethodInterface { return filteredMethods; } - static filterLegacyMethods({ - model, - application, - }: { + static filterLegacyMethods(params?: { model?: CategorizedModel; application?: ApplicationSchemaBase; }): BaseMethod[] { - const categorizedMethods = this.filterCategorizedMethods({ application, model }); + let _params = params; + if (!params) _params = {}; + const categorizedMethods = this.filterCategorizedMethods(params); return categorizedMethods.map((cm) => this.convertToSimple(cm)); } } From dce6f12856f9c0d9f24cf3d07b0550e1ad7e96e2 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 19:20:21 -0700 Subject: [PATCH 45/62] chore: re-implement tree utility functions --- src/tree.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tree.js b/src/tree.js index 6bf7edd..b3ffe61 100644 --- a/src/tree.js +++ b/src/tree.js @@ -1,4 +1,7 @@ // TODO: migrate to use manifest instead +import { MethodInterface } from "./utils/method_interface"; +import { ModelInterface } from "./utils/model_interface"; +import { safelyGetSlug } from "./utils/slugifiedEntry"; export const METHODS = { pseudopotential: "pseudopotential", @@ -14,3 +17,23 @@ export const MODEL_NAMES = { ml: "machine learning", re: "regression", }; + +export function getAvailableDFTFunctionals() { + const functionals = ModelInterface.filterCategorizedModels().reduce((accumulator, item) => { + if (item.parameters?.functional) { + accumulator.push(item.parameters.functional); + } + return accumulator; + }, []); + return [...new Set(functionals)]; +} + +export function getPseudopotentialTypes() { + const subtypes = MethodInterface.filterLegacyMethods().reduce((accumulator, item) => { + if (item.type === METHODS.pseudopotential) { + accumulator.push(safelyGetSlug(item.subtype)); + } + return accumulator; + }, []); + return [...new Set(subtypes)]; +} From a2499d545f905ccd22d1c4f8575d2b56a735bdeb Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Wed, 25 Oct 2023 19:20:54 -0700 Subject: [PATCH 46/62] test: verify tree utility functions --- tests/tree.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/tree.test.ts diff --git a/tests/tree.test.ts b/tests/tree.test.ts new file mode 100644 index 0000000..468323b --- /dev/null +++ b/tests/tree.test.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { getAvailableDFTFunctionals, getPseudopotentialTypes } from "../src/tree"; + +describe("tree", () => { + it("can get a list of available DFT functionals", () => { + const functionals = getAvailableDFTFunctionals(); + const supportedFunctionals = ["pbe", "hse06", "b3lyp", "pz"]; + expect(functionals).to.have.members(supportedFunctionals); + }); + + it("can get a list of pseudopotential types", () => { + const ppTypes = getPseudopotentialTypes(); + const supportedPseudoTypes = ["paw", "us", "nc", "any"]; + expect(ppTypes).to.have.members(supportedPseudoTypes); + }); +}); From 1f1b629190f66f2f73cecb9628ccd008a0f36dcb Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 12:33:10 -0700 Subject: [PATCH 47/62] chore: add tsconfig to files --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 763b9eb..8887a26 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "/src", ".babelrc", "build_entities.js", - "build_filter.js" + "build_filter.js", + "tsconfig.json" ], "author": "Exabyte Inc.", "bugs": { From df5b8493a95fb91e75e6f7d272c78d90064caa20 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 14:25:09 -0700 Subject: [PATCH 48/62] update: adjust tree utility functions based on model list --- src/tree.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tree.js b/src/tree.js index b3ffe61..99a84a4 100644 --- a/src/tree.js +++ b/src/tree.js @@ -18,9 +18,19 @@ export const MODEL_NAMES = { re: "regression", }; -export function getAvailableDFTFunctionals() { +export function getDFTApproximations() { + const approximations = ModelInterface.filterCategorizedModels().reduce((accumulator, item) => { + if (item.categories.type === "ksdft") { + accumulator.push(item.categories.subtype); + } + return accumulator; + }, []); + return [...new Set(approximations)]; +} + +export function getDFTFunctionalsByApproximation(approximation) { const functionals = ModelInterface.filterCategorizedModels().reduce((accumulator, item) => { - if (item.parameters?.functional) { + if (item.categories.subtype === approximation && item.parameters?.functional) { accumulator.push(item.parameters.functional); } return accumulator; From 32d1b8ae02dfa12ec9a8a6f4dcc954eb12e8ca13 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 14:25:26 -0700 Subject: [PATCH 49/62] test: verify tree utility functions II --- tests/tree.test.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/tree.test.ts b/tests/tree.test.ts index 468323b..d399bde 100644 --- a/tests/tree.test.ts +++ b/tests/tree.test.ts @@ -1,12 +1,25 @@ import { expect } from "chai"; -import { getAvailableDFTFunctionals, getPseudopotentialTypes } from "../src/tree"; +import { + getDFTApproximations, + getDFTFunctionalsByApproximation, + getPseudopotentialTypes, +} from "../src/tree"; describe("tree", () => { it("can get a list of available DFT functionals", () => { - const functionals = getAvailableDFTFunctionals(); - const supportedFunctionals = ["pbe", "hse06", "b3lyp", "pz"]; - expect(functionals).to.have.members(supportedFunctionals); + const approximations = getDFTApproximations(); + const supportedApproximations = ["lda", "gga", "hybrid"]; + expect(approximations).to.have.members(supportedApproximations); + }); + + it("can get a list of functions by approximation", () => { + const ldaFunctionals = getDFTFunctionalsByApproximation("lda"); + expect(ldaFunctionals).to.include("pz"); + const ggaFunctionals = getDFTFunctionalsByApproximation("gga"); + expect(ggaFunctionals).to.include("pbe"); + const hybridFunctionals = getDFTFunctionalsByApproximation("hybrid"); + expect(hybridFunctionals).to.include("hse06"); }); it("can get a list of pseudopotential types", () => { From 70a605d5a4cb906a105d79f5b4f91612c6bdc283 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 14:43:09 -0700 Subject: [PATCH 50/62] chore: assume model without method in interface --- src/utils/model_interface.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/model_interface.ts b/src/utils/model_interface.ts index b416215..3bcec7e 100644 --- a/src/utils/model_interface.ts +++ b/src/utils/model_interface.ts @@ -16,6 +16,7 @@ import { allModels as categorizedModelList } from "../data/model_list"; import { safelyGetSlug, stringToSlugifiedEntry } from "./slugifiedEntry"; type SimpleModel = Omit; +type CategorizedModel_ = Omit; type CategorizedDftModel = | Omit | Omit @@ -26,7 +27,7 @@ type CategorizedDftModel = * and the categorized model data structure (tier1, tier2, ...). */ export class ModelInterface { - static convertToSimple(cm?: CategorizedModel): SimpleModel { + static convertToSimple(cm?: CategorizedModel_): SimpleModel { if (!cm) return this.convertUnknownToSimple(); switch (cm.categories.tier3) { @@ -76,7 +77,7 @@ export class ModelInterface { }; } - static convertToCategorized(sm?: SimpleModel): Omit | undefined { + static convertToCategorized(sm?: SimpleModel): CategorizedModel_ | undefined { switch (sm?.type) { case "dft": return this.convertDftToCategorized(sm as LegacyModelDensityFunctionalTheory); @@ -109,7 +110,7 @@ export class ModelInterface { return categorizedModelList.find((cm) => cm.path === path); } - static filterCategorizedModels(application?: ApplicationSchemaBase): CategorizedModel[] { + static filterCategorizedModels(application?: ApplicationSchemaBase): CategorizedModel_[] { // @ts-ignore todo: adjust type of model list if (!application) return categorizedModelList; const filteredModels = filterModelsByApplicationParameters({ From fdbdc7d0ea989e1ab6cdbe55d6caf45e75ab7955 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 16:43:32 -0700 Subject: [PATCH 51/62] update: handle unknown model case --- src/model.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/model.js b/src/model.js index 63cc52c..da95d09 100644 --- a/src/model.js +++ b/src/model.js @@ -73,6 +73,7 @@ export class Model extends DefaultableInMemoryEntity { } getDefaultCategorizedModel() { + if (this.type === "unknown") return undefined; return this.getCategorizedModels()[0]; } From fe962bb05097d256e864946a5a898d05d4f0196c Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 16:45:39 -0700 Subject: [PATCH 52/62] test: unknown model is created correctly --- tests/model.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/model.test.ts b/tests/model.test.ts index 2a5d0e6..33e38f7 100644 --- a/tests/model.test.ts +++ b/tests/model.test.ts @@ -16,4 +16,12 @@ describe("Model", () => { const model = ModelFactory.create(obj); expect(model.type).to.be.equal("dft"); }); + + it("should have 'unknown' model as default if type is 'unknown'", () => { + const config = { type: "unknown" }; + const model = ModelFactory.create(config); + expect(model.type).to.be.equal("unknown"); + expect(model.subtype).to.be.equal("unknown"); + expect(model._defaultCategorized).to.be.undefined; + }); }); From a2d989cc0eb61b01b38bb9800bff7fa9d2cd4807 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 16:46:21 -0700 Subject: [PATCH 53/62] chore: handle undefined functional case --- src/models/dft.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/dft.js b/src/models/dft.js index 6905569..81453b8 100644 --- a/src/models/dft.js +++ b/src/models/dft.js @@ -29,7 +29,9 @@ export class DFTModel extends Model { } get defaultFunctional() { - const functional = safelyGetSlug(this._defaultConfig?.functional) || "pbe"; + const functional = this._defaultConfig?.functional + ? safelyGetSlug(this._defaultConfig?.functional) + : "pbe"; return stringToSlugifiedEntry(functional); } From 606b1cdc41a62a2a4abd933274628fdac6223d5a Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 17:08:07 -0700 Subject: [PATCH 54/62] codejs++: use chore/SOF-6991 --- package-lock.json | 11 +++++------ package.json | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7d97a2..33a2a03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1624,9 +1624,8 @@ } }, "@exabyte-io/code.js": { - "version": "2023.10.24-0", - "resolved": "https://registry.npmjs.org/@exabyte-io/code.js/-/code.js-2023.10.24-0.tgz", - "integrity": "sha512-fltazq1k/fNaBM0eKDL+GK+qOKb8k79/Q0KszB6j69q1roZbro32itGzyT1w5pbkYoPP2LX9qdjO8omlzm4ddQ==", + "version": "git+https://github.com/Exabyte-io/code.js.git#b94c987f98d620790466cefc04ba354395a1c62d", + "from": "git+https://github.com/Exabyte-io/code.js.git#b94c987f98d620790466cefc04ba354395a1c62d", "dev": true, "requires": { "@babel/cli": "7.16.0", @@ -2079,9 +2078,9 @@ "dev": true }, "@types/react": { - "version": "18.2.31", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.31.tgz", - "integrity": "sha512-c2UnPv548q+5DFh03y8lEDeMfDwBn9G3dRwfkrxQMo/dOtRHUUO57k6pHvBIfH/VF4Nh+98mZ5aaSe+2echD5g==", + "version": "18.2.33", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.33.tgz", + "integrity": "sha512-v+I7S+hu3PIBoVkKGpSYYpiBT1ijqEzWpzQD62/jm4K74hPpSP7FF9BnKG6+fg2+62weJYkkBWDJlZt5JO/9hg==", "dev": true, "requires": { "@types/prop-types": "*", diff --git a/package.json b/package.json index 8887a26..1fb550c 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "devDependencies": { "@babel/preset-typescript": "^7.22.5", "@exabyte-io/application-flavors.js": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", - "@exabyte-io/code.js": "2023.10.24-0", + "@exabyte-io/code.js": "git+https://github.com/Exabyte-io/code.js.git#b94c987f98d620790466cefc04ba354395a1c62d", "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", "@types/chai": "^4.3.5", From 110e53a63b1e8f36830db06e2740cf81e9336f0c Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 17:34:48 -0700 Subject: [PATCH 55/62] appl-flavors++: update chore/SOF-6991 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33a2a03..5666a72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1562,8 +1562,8 @@ } }, "@exabyte-io/application-flavors.js": { - "version": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", - "from": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", + "version": "git+https://github.com/Exabyte-io/application-flavors.git#b3de5b1111d5f1300fe97cd6483265ac28640466", + "from": "git+https://github.com/Exabyte-io/application-flavors.git#b3de5b1111d5f1300fe97cd6483265ac28640466", "dev": true, "requires": { "@babel/cli": "7.16.0", diff --git a/package.json b/package.json index 1fb550c..80e266b 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.22.5", - "@exabyte-io/application-flavors.js": "git+https://github.com/Exabyte-io/application-flavors.git#7abfb0ca49faa8ea3227ed2272c50aaf80a59388", + "@exabyte-io/application-flavors.js": "git+https://github.com/Exabyte-io/application-flavors.git#b3de5b1111d5f1300fe97cd6483265ac28640466", "@exabyte-io/code.js": "git+https://github.com/Exabyte-io/code.js.git#b94c987f98d620790466cefc04ba354395a1c62d", "@exabyte-io/eslint-config": "^2023.8.29-1", "@exabyte-io/made.js": "2022.6.15-0", From 5c6b47e8df124c708f0624f66add828f17d3d9a8 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Thu, 26 Oct 2023 17:35:15 -0700 Subject: [PATCH 56/62] test: default models for applications --- tests/model.test.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/model.test.ts b/tests/model.test.ts index 33e38f7..60a1998 100644 --- a/tests/model.test.ts +++ b/tests/model.test.ts @@ -24,4 +24,38 @@ describe("Model", () => { expect(model.subtype).to.be.equal("unknown"); expect(model._defaultCategorized).to.be.undefined; }); + + it("default model for espresso is DFT PBE", () => { + const application = { name: "espresso", version: "6.3", build: "Default" }; + const model = ModelFactory.createFromApplication({ application }); + expect(model.type).to.be.equal("dft"); + expect(model.subtype).to.be.equal("gga"); + // @ts-ignore + expect(model.functional.slug).to.be.equal("pbe"); + }); + + it("default model for vasp is DFT PBE", () => { + const application = { name: "vasp", version: "5.4.4", build: "Default" }; + const model = ModelFactory.createFromApplication({ application }); + expect(model.type).to.be.equal("dft"); + expect(model.subtype).to.be.equal("gga"); + // @ts-ignore + expect(model.functional.slug).to.be.equal("pbe"); + }); + + it("default model for nwchem is DFT B3LYP", () => { + const application = { name: "nwchem", version: "6.6", build: "Default" }; + const model = ModelFactory.createFromApplication({ application }); + expect(model.type).to.be.equal("dft"); + expect(model.subtype).to.be.equal("hybrid"); + // @ts-ignore + expect(model.functional.slug).to.be.equal("b3lyp"); + }); + + it("default model for exabyteml is regression", () => { + const application = { name: "exabyteml", version: "0.2.0", build: "Default" }; + const model = ModelFactory.createFromApplication({ application }); + expect(model.type).to.be.equal("ml"); + expect(model.subtype).to.be.equal("re"); + }); }); From 23835146d8b3286c3db7346028f4420dc8d72668 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Fri, 27 Oct 2023 08:55:13 -0700 Subject: [PATCH 57/62] chore: return legacy model if no application --- src/models/factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/factory.js b/src/models/factory.js index 2914b8b..bafc745 100644 --- a/src/models/factory.js +++ b/src/models/factory.js @@ -20,7 +20,7 @@ export class ModelFactory { } static getDefaultModelForApplication(application) { - if (!application) return categorizedModelList[0]; + if (!application) return ModelInterface.convertToSimple(categorizedModelList[0]); const filteredModels = filterModelsByApplicationParameters({ modelList: categorizedModelList, appName: application?.name, From 36851f78536be508d5cf6f5cc057cccbc1b3bbfe Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Fri, 27 Oct 2023 10:29:11 -0700 Subject: [PATCH 58/62] refactor: move tree.js to typescript --- src/{tree.js => tree.ts} | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) rename src/{tree.js => tree.ts} (54%) diff --git a/src/tree.js b/src/tree.ts similarity index 54% rename from src/tree.js rename to src/tree.ts index 99a84a4..cde5ecf 100644 --- a/src/tree.js +++ b/src/tree.ts @@ -18,28 +18,36 @@ export const MODEL_NAMES = { re: "regression", }; -export function getDFTApproximations() { - const approximations = ModelInterface.filterCategorizedModels().reduce((accumulator, item) => { - if (item.categories.type === "ksdft") { - accumulator.push(item.categories.subtype); - } - return accumulator; - }, []); +export function getDFTApproximations(): string[] { + const approximations = ModelInterface.filterCategorizedModels().reduce( + (accumulator, item) => { + if (item.categories.type === "ksdft" && item.categories.subtype) { + accumulator.push(safelyGetSlug(item.categories.subtype)); + } + return accumulator; + }, + [], + ); return [...new Set(approximations)]; } -export function getDFTFunctionalsByApproximation(approximation) { - const functionals = ModelInterface.filterCategorizedModels().reduce((accumulator, item) => { - if (item.categories.subtype === approximation && item.parameters?.functional) { - accumulator.push(item.parameters.functional); - } - return accumulator; - }, []); +export function getDFTFunctionalsByApproximation(approximation: string): string[] { + const functionals = ModelInterface.filterCategorizedModels().reduce( + (accumulator, item) => { + // @ts-ignore todo: make sure it is dft model + if (item.categories?.subtype === approximation && item.parameters?.functional) { + // @ts-ignore + accumulator.push(item.parameters.functional); + } + return accumulator; + }, + [], + ); return [...new Set(functionals)]; } -export function getPseudopotentialTypes() { - const subtypes = MethodInterface.filterLegacyMethods().reduce((accumulator, item) => { +export function getPseudopotentialTypes(): string[] { + const subtypes = MethodInterface.filterLegacyMethods().reduce((accumulator, item) => { if (item.type === METHODS.pseudopotential) { accumulator.push(safelyGetSlug(item.subtype)); } From e21ba6ef78561bcd6accc2a6e9f6f72f8aa04b86 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Fri, 27 Oct 2023 10:30:05 -0700 Subject: [PATCH 59/62] test: default dft model + group slug --- tests/dft_model.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/dft_model.test.ts b/tests/dft_model.test.ts index 34ac9ca..9177687 100644 --- a/tests/dft_model.test.ts +++ b/tests/dft_model.test.ts @@ -1,5 +1,6 @@ import { expect } from "chai"; +import { DFTModelConfig } from "../src/default_models"; import { DFTModel } from "../src/models/dft"; import { ModelFactory } from "../src/models/factory"; @@ -34,4 +35,24 @@ describe("DFTModel", () => { expect(model._json.otherProperty).to.be.equal(42); expect(model.method.type).to.be.equal("pseudopotential"); }); + + it("can be created from default model config", () => { + const model = ModelFactory.create(DFTModelConfig); + expect(model.type).to.be.equal("dft"); + expect(model.subtype).to.be.equal("gga"); + // @ts-ignore + expect(model.functional.slug).to.be.equal("pbe"); + }); + + it("creates the group slug 'qe:dft:gga:pbe' for DFT GGA", () => { + const application = { + name: "espresso", + shortName: "qe", + version: "6.3", + build: "Default", + }; + const model = ModelFactory.createFromApplication({ application }); + const expectedGroupSlug = "qe:dft:gga:pbe"; + expect(model.groupSlug).to.be.equal(expectedGroupSlug); + }); }); From cb5b68eb0c49a4e47b8d713f14574b4d3d7e572f Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Fri, 27 Oct 2023 11:54:40 -0700 Subject: [PATCH 60/62] chore: handle case of functional as string --- src/models/dft.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/models/dft.js b/src/models/dft.js index 81453b8..9a2bc63 100644 --- a/src/models/dft.js +++ b/src/models/dft.js @@ -46,7 +46,8 @@ export class DFTModel extends Model { } get functional() { - return this.prop("functional", this.defaultFunctional); + const functional = this.prop("functional", this.defaultFunctional); + return typeof functional === "string" ? stringToSlugifiedEntry(functional) : functional; } get refiners() { From 1c5655a29461e97176ccf8c912906ddf16b4941d Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Fri, 27 Oct 2023 11:55:07 -0700 Subject: [PATCH 61/62] chore: add plugin for typescript imports --- .eslintrc.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0b5cb28..1bee895 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,4 +1,7 @@ { - "extends": ["@exabyte-io/eslint-config"] + "extends": [ + "@exabyte-io/eslint-config", + "plugin:import/typescript" + ] } From 2c874569791ddafc967a001e779ee4fa40e6ba69 Mon Sep 17 00:00:00 2001 From: Alexander Zech Date: Fri, 27 Oct 2023 11:55:30 -0700 Subject: [PATCH 62/62] test: functional as slugifiedEntry --- tests/dft_model.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/dft_model.test.ts b/tests/dft_model.test.ts index 9177687..181482a 100644 --- a/tests/dft_model.test.ts +++ b/tests/dft_model.test.ts @@ -12,6 +12,14 @@ describe("DFTModel", () => { }); it("can be created from the factory", () => { + const config = { type: "dft", subtype: "lda", functional: "pz" }; + const model = ModelFactory.create(config) as DFTModel; + expect(model.type).to.be.equal("dft"); + expect(model.subtype).to.be.equal("lda"); + expect(model.functional?.slug).to.be.equal("pz"); + }); + + it("can be created from the factory with incomplete config", () => { const config = { type: "dft" }; const model = ModelFactory.create(config) as DFTModel; expect(model.functional?.slug).to.be.equal("pbe");