From 1befd52150222c676e2a7873aa687d027f7eb2e2 Mon Sep 17 00:00:00 2001 From: connoratrug Date: Thu, 9 Nov 2023 15:10:57 +0100 Subject: [PATCH 1/2] chore: setup utils module with type exports and usage example --- apps/helloworld/package.json | 7 +- apps/helloworld/src/App.vue | 7 +- apps/meta-data-utils/package.json | 27 +++ apps/meta-data-utils/src/index.ts | 3 + apps/meta-data-utils/tsconfig.json | 7 + apps/meta-data-utils/vite.config.ts | 19 ++ apps/nuxt3-ssr/package.json | 3 +- apps/package.json | 1 + apps/yarn.lock | 333 +++++++++++++++++++++++++++- 9 files changed, 393 insertions(+), 14 deletions(-) create mode 100644 apps/meta-data-utils/package.json create mode 100644 apps/meta-data-utils/src/index.ts create mode 100644 apps/meta-data-utils/tsconfig.json create mode 100644 apps/meta-data-utils/vite.config.ts diff --git a/apps/helloworld/package.json b/apps/helloworld/package.json index d44d289f47..011fb1205c 100644 --- a/apps/helloworld/package.json +++ b/apps/helloworld/package.json @@ -10,15 +10,16 @@ "checkFormat": "prettier src --check --config ../.prettierrc.js" }, "dependencies": { - "molgenis-components": "*", "graphql-request": "5.2.0", + "meta-data-utils": "*", + "molgenis-components": "*", "vue": "3.3.4", "vue-router": "4.2.5" }, "devDependencies": { - "vite": "4.3.9", "@vitejs/plugin-vue": "4.4.0", - "prettier": "2.8.8" + "prettier": "2.8.8", + "vite": "4.3.9" }, "browserslist": [ "> 1%", diff --git a/apps/helloworld/src/App.vue b/apps/helloworld/src/App.vue index 2cbc597d04..577786d03c 100644 --- a/apps/helloworld/src/App.vue +++ b/apps/helloworld/src/App.vue @@ -1,13 +1,18 @@ - diff --git a/apps/meta-data-utils/package.json b/apps/meta-data-utils/package.json new file mode 100644 index 0000000000..6555fd9508 --- /dev/null +++ b/apps/meta-data-utils/package.json @@ -0,0 +1,27 @@ +{ + "name": "meta-data-utils", + "private": true, + "version": "0.0.0", + "type": "module", + "files": [ + "dist" + ], + "main": "dist/meta-data-utils.umd.cjs", + "module": "dist/meta-data-utils.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/meta-data-utils.js", + "require": "./dist/meta-data-utils.umd.cjs" + } + }, + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "devDependencies": { + "vite": "4.4.5", + "vite-plugin-dts": "3.6.3" + } +} diff --git a/apps/meta-data-utils/src/index.ts b/apps/meta-data-utils/src/index.ts new file mode 100644 index 0000000000..0847bc78ad --- /dev/null +++ b/apps/meta-data-utils/src/index.ts @@ -0,0 +1,3 @@ +export const sayHello = (name: string): string => { + return `Hello ${name}`; +}; diff --git a/apps/meta-data-utils/tsconfig.json b/apps/meta-data-utils/tsconfig.json new file mode 100644 index 0000000000..c982e96d00 --- /dev/null +++ b/apps/meta-data-utils/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "vite": ["./node_modules/vite"] + } + } +} diff --git a/apps/meta-data-utils/vite.config.ts b/apps/meta-data-utils/vite.config.ts new file mode 100644 index 0000000000..5f5619d740 --- /dev/null +++ b/apps/meta-data-utils/vite.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; +import dts from "vite-plugin-dts"; + +export default defineConfig({ + plugins: [ + dts({ + insertTypesEntry: true, + }), + ], + build: { + lib: { + entry: resolve(__dirname, "src/index.ts"), + name: "MetaDataUtils", + fileName: "meta-data-utils", + formats: ["es", "umd", "iife", "cjs"], + }, + }, +}); diff --git a/apps/nuxt3-ssr/package.json b/apps/nuxt3-ssr/package.json index ace5241270..cecdcd5bae 100644 --- a/apps/nuxt3-ssr/package.json +++ b/apps/nuxt3-ssr/package.json @@ -43,6 +43,7 @@ "floating-vue": "^2.0.0-beta.20", "node-fetch-native": "1.4.0", "vite": "4.0.5", - "vue": "3.3.4" + "vue": "3.3.4", + "meta-data-utils": "*" } } diff --git a/apps/package.json b/apps/package.json index 6034da181d..036d5c9c87 100644 --- a/apps/package.json +++ b/apps/package.json @@ -1,6 +1,7 @@ { "private": true, "workspaces": [ + "meta-data-utils", "catalogue", "directory", "settings", diff --git a/apps/yarn.lock b/apps/yarn.lock index 0ba8118f80..e54c14ca6d 100644 --- a/apps/yarn.lock +++ b/apps/yarn.lock @@ -1808,6 +1808,48 @@ semver "^7.3.5" tar "^6.1.11" +"@microsoft/api-extractor-model@7.28.2": + version "7.28.2" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.28.2.tgz#91c66dd820ccc70e0c163e06b392d8363f1b9269" + integrity sha512-vkojrM2fo3q4n4oPh4uUZdjJ2DxQ2+RnDQL/xhTWSRUNPF6P4QyrvY357HBxbnltKcYu+nNNolVqc6TIGQ73Ig== + dependencies: + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "3.61.0" + +"@microsoft/api-extractor@^7.38.0": + version "7.38.2" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.38.2.tgz#fbc329fbec2b27a160507d08d02b78018fd142ac" + integrity sha512-JOARuhTwOcOMIU0O2czscoJy3ddVzIRhSA9/7T1ALuZSNphgWsPk+Bv4E7AnBDmTV4pP4lBNLtCxEHjjpWaytQ== + dependencies: + "@microsoft/api-extractor-model" "7.28.2" + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "3.61.0" + "@rushstack/rig-package" "0.5.1" + "@rushstack/ts-command-line" "4.17.1" + colors "~1.2.1" + lodash "~4.17.15" + resolve "~1.22.1" + semver "~7.5.4" + source-map "~0.6.1" + typescript "~5.0.4" + +"@microsoft/tsdoc-config@~0.16.1": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" + integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + ajv "~6.12.6" + jju "~1.4.0" + resolve "~1.19.0" + +"@microsoft/tsdoc@0.14.2": + version "0.14.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" + integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz" @@ -2547,6 +2589,46 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@rollup/pluginutils@^5.0.5": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.5.tgz#bbb4c175e19ebfeeb8c132c2eea0ecb89941a66c" + integrity sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + +"@rushstack/node-core-library@3.61.0": + version "3.61.0" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.61.0.tgz#7441a0d2ae5268b758a7a49588a78cd55af57e66" + integrity sha512-tdOjdErme+/YOu4gPed3sFS72GhtWCgNV9oDsHDnoLY5oDfwjKUc9Z+JOZZ37uAxcm/OCahDHfuu2ugqrfWAVQ== + dependencies: + colors "~1.2.1" + fs-extra "~7.0.1" + import-lazy "~4.0.0" + jju "~1.4.0" + resolve "~1.22.1" + semver "~7.5.4" + z-schema "~5.0.2" + +"@rushstack/rig-package@0.5.1": + version "0.5.1" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.5.1.tgz#6c9c283cc96b5bb1eae9875946d974ac5429bb21" + integrity sha512-pXRYSe29TjRw7rqxD4WS3HN/sRSbfr+tJs4a9uuaSIBAITbUggygdhuG0VrO0EO+QqH91GhYMN4S6KRtOEmGVA== + dependencies: + resolve "~1.22.1" + strip-json-comments "~3.1.1" + +"@rushstack/ts-command-line@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.17.1.tgz#c78db928ce5b93f2e98fd9e14c24f3f3876e57f1" + integrity sha512-2jweO1O57BYP5qdBGl6apJLB+aRIn5ccIRTPDyULh0KMwVzFqWtw6IZWt1qtUoZD/pD2RNkIOosH6Cq45rIYeg== + dependencies: + "@types/argparse" "1.0.38" + argparse "~1.0.9" + colors "~1.2.1" + string-argv "~0.3.1" + "@sideway/address@^4.1.3": version "4.1.4" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0" @@ -2652,6 +2734,11 @@ "@tufjs/canonical-json" "2.0.0" minimatch "^9.0.3" +"@types/argparse@1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" + integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== + "@types/babel__core@^7.1.14": version "7.20.1" resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz" @@ -3038,6 +3125,28 @@ loupe "^2.3.6" pretty-format "^29.5.0" +"@volar/language-core@1.10.10", "@volar/language-core@~1.10.5": + version "1.10.10" + resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-1.10.10.tgz#9c240a36dd4007b9c4f00739f6cecb81da54a49e" + integrity sha512-nsV1o3AZ5n5jaEAObrS3MWLBWaGwUj/vAsc15FVNIv+DbpizQRISg9wzygsHBr56ELRH8r4K75vkYNMtsSNNWw== + dependencies: + "@volar/source-map" "1.10.10" + +"@volar/source-map@1.10.10", "@volar/source-map@~1.10.5": + version "1.10.10" + resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-1.10.10.tgz#ec807fe60b8afe29e19bf6d1c90d2e76502df541" + integrity sha512-GVKjLnifV4voJ9F0vhP56p4+F3WGf+gXlRtjFZsv6v3WxBTWU3ZVeaRaEHJmWrcv5LXmoYYpk/SC25BKemPRkg== + dependencies: + muggle-string "^0.3.1" + +"@volar/typescript@~1.10.5": + version "1.10.10" + resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-1.10.10.tgz#1f88202c63988ddfcee154a93050312041b83329" + integrity sha512-4a2r5bdUub2m+mYVnLu2wt59fuoYWe7nf0uXtGHU8QQ5LDNfzAR0wK7NgDiQ9rcl2WT3fxT2AA9AylAwFtj50A== + dependencies: + "@volar/language-core" "1.10.10" + path-browserify "^1.0.1" + "@vue-macros/common@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@vue-macros/common/-/common-1.8.0.tgz#885f1e7095b3b4e32773a35fd8f768f82a6c0e5c" @@ -3110,6 +3219,16 @@ estree-walker "^2.0.2" source-map-js "^1.0.2" +"@vue/compiler-core@3.3.8": + version "3.3.8" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.3.8.tgz#301bb60d0245265a88ed5b30e200fbf223acb313" + integrity sha512-hN/NNBUECw8SusQvDSqqcVv6gWq8L6iAktUR0UF3vGu2OhzRqcOiAno0FmBJWwxhYEXRlQJT5XnoKsVq1WZx4g== + dependencies: + "@babel/parser" "^7.23.0" + "@vue/shared" "3.3.8" + estree-walker "^2.0.2" + source-map-js "^1.0.2" + "@vue/compiler-dom@3.2.47": version "3.2.47" resolved "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.47.tgz" @@ -3126,6 +3245,14 @@ "@vue/compiler-core" "3.3.4" "@vue/shared" "3.3.4" +"@vue/compiler-dom@^3.3.0": + version "3.3.8" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.3.8.tgz#09d832514b9b8d9415a3816b065d69dbefcc7e9b" + integrity sha512-+PPtv+p/nWDd0AvJu3w8HS0RIm/C6VGBIRe24b9hSyNWOAPEUosFZ5diwawwP8ip5sJ8n0Pe87TNNNHnvjs0FQ== + dependencies: + "@vue/compiler-core" "3.3.8" + "@vue/shared" "3.3.8" + "@vue/compiler-sfc@3.2.47": version "3.2.47" resolved "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.47.tgz" @@ -3179,6 +3306,20 @@ resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz" integrity sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q== +"@vue/language-core@1.8.22", "@vue/language-core@^1.8.20": + version "1.8.22" + resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-1.8.22.tgz#1ef62645fb9b1f830c6c84a5586e49e74727b1e3" + integrity sha512-bsMoJzCrXZqGsxawtUea1cLjUT9dZnDsy5TuZ+l1fxRMzUGQUG9+Ypq4w//CqpWmrx7nIAJpw2JVF/t258miRw== + dependencies: + "@volar/language-core" "~1.10.5" + "@volar/source-map" "~1.10.5" + "@vue/compiler-dom" "^3.3.0" + "@vue/shared" "^3.3.0" + computeds "^0.0.1" + minimatch "^9.0.3" + muggle-string "^0.3.1" + vue-template-compiler "^2.7.14" + "@vue/reactivity-transform@3.2.47": version "3.2.47" resolved "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.47.tgz" @@ -3275,6 +3416,11 @@ resolved "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz" integrity sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ== +"@vue/shared@3.3.8", "@vue/shared@^3.3.0": + version "3.3.8" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.3.8.tgz#f044942142e1d3a395f24132e6203a784838542d" + integrity sha512-8PGwybFwM4x8pcfgqEQFy70NaQxASvOC5DJwLQfpArw1UDfUXrJkdxD3BhVTMS+0Lef/TU7YO0Jvr0jJY8T+mw== + "@vue/test-utils@2.4.1": version "2.4.1" resolved "https://registry.npmjs.org/@vue/test-utils/-/test-utils-2.4.1.tgz" @@ -3522,6 +3668,16 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +ajv@~6.12.6: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-align@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz" @@ -3718,7 +3874,7 @@ arg@^5.0.2: resolved "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz" integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg== -argparse@^1.0.7: +argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -4835,6 +4991,11 @@ colorette@^2.0.16, colorette@^2.0.19: resolved "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== +colors@~1.2.1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" + integrity sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg== + combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" @@ -4887,6 +5048,11 @@ compress-commons@^5.0.1: normalize-path "^3.0.0" readable-stream "^3.6.0" +computeds@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/computeds/-/computeds-0.0.1.tgz#215b08a4ba3e08a11ff6eee5d6d8d7166a97ce2e" + integrity sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" @@ -6892,6 +7058,11 @@ fast-decode-uri-component@^1.0.1: resolved "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz" integrity sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg== +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + fast-diff@1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.2.tgz" @@ -7252,7 +7423,7 @@ fs-extra@^4.0.1: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^7.0.1: +fs-extra@^7.0.1, fs-extra@~7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -7303,6 +7474,11 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + functions-have-names@^1.2.3: version "1.2.3" resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz" @@ -7993,6 +8169,13 @@ hash-sum@^2.0.0: resolved "https://registry.npmjs.org/hash-sum/-/hash-sum-2.0.0.tgz" integrity sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg== +hasown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + he@1.2.0, he@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" @@ -8244,6 +8427,11 @@ import-lazy@^2.1.0: resolved "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz" integrity sha512-m7ZEHgtw69qOGw+jwxXkHlrlIPdTGkyh66zXZ1ajZbxkDBNjSY/LGbmjc7h0s2ELsUDTAhFr55TrPSSqJGPG0A== +import-lazy@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" + integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== + import-local@^3.0.2: version "3.1.0" resolved "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz" @@ -8464,6 +8652,13 @@ is-ci@^1.0.10: dependencies: ci-info "^1.5.0" +is-core-module@^2.1.0, is-core-module@^2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + is-core-module@^2.11.0: version "2.12.0" resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz" @@ -9278,6 +9473,11 @@ jiti@^1.20.0: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.20.0.tgz#2d823b5852ee8963585c8dd8b7992ffc1ae83b42" integrity sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA== +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA== + joi@^17.7.0: version "17.10.0" resolved "https://registry.yarnpkg.com/joi/-/joi-17.10.0.tgz#04e249daa24d48fada2d34046a8262e474b1326f" @@ -9400,6 +9600,11 @@ json-parse-even-better-errors@^3.0.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz#2cb2ee33069a78870a0c7e3da560026b89669cf7" integrity sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA== +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + json-stable-stringify@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.2.tgz" @@ -9531,7 +9736,7 @@ knitwork@^1.0.0: resolved "https://registry.npmjs.org/knitwork/-/knitwork-1.0.0.tgz" integrity sha512-dWl0Dbjm6Xm+kDxhPQJsCBTxrJzuGl0aP9rhr+TG8D3l+GL90N8O8lYUi7dTSAN2uuDqCtNgb6aEuQH5wsiV8Q== -kolorist@^1.7.0: +kolorist@^1.7.0, kolorist@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/kolorist/-/kolorist-1.8.0.tgz#edddbbbc7894bc13302cdf740af6374d4a04743c" integrity sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ== @@ -9742,6 +9947,11 @@ lodash.defaults@^4.2.0: resolved "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz" integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== + lodash.isarguments@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz" @@ -9792,7 +10002,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz" integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== -lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.3.0: +lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.3.0, lodash@~4.17.15: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -10676,6 +10886,11 @@ ms@2.1.3, ms@^2.0.0: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +muggle-string@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/muggle-string/-/muggle-string-0.3.1.tgz#e524312eb1728c63dd0b2ac49e3282e6ed85963a" + integrity sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg== + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz" @@ -11696,6 +11911,11 @@ pascalcase@^0.1.1: resolved "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz" integrity sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw== +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz" @@ -11743,7 +11963,7 @@ path-key@^4.0.0: resolved "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz" integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== -path-parse@^1.0.7: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -12192,7 +12412,7 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: resolved "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@8.4.31: +postcss@8.4.31, postcss@^8.4.26: version "8.4.31" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== @@ -12388,6 +12608,11 @@ punycode@^1.3.2: resolved "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz" integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + punycode@^2.1.1, punycode@^2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" @@ -13038,6 +13263,23 @@ resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.22. path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@~1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + +resolve@~1.22.1: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz" @@ -13112,7 +13354,7 @@ rollup@^3.21.0, rollup@^3.7.0: optionalDependencies: fsevents "~2.3.2" -rollup@^3.27.1, rollup@^3.29.0: +rollup@^3.25.2, rollup@^3.27.1, rollup@^3.29.0: version "3.29.4" resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.4.tgz#4d70c0f9834146df8705bfb69a9a19c9e1109981" integrity sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw== @@ -13297,7 +13539,7 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.8, semver@^7.5.0, semver@^7.5.3, semver@^7.5.4: +semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.8, semver@^7.5.0, semver@^7.5.3, semver@^7.5.4, semver@~7.5.4: version "7.5.4" resolved "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== @@ -13758,6 +14000,11 @@ strict-uri-encode@^1.0.0: resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz" integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== +string-argv@~0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" + integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== + string-env-interpolation@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz" @@ -13904,7 +14151,7 @@ strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -strip-json-comments@^3.1.1: +strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -14587,6 +14834,11 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" +typescript@~5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== + uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" resolved "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz" @@ -14933,6 +15185,13 @@ uqr@^0.1.2: resolved "https://registry.yarnpkg.com/uqr/-/uqr-0.1.2.tgz#5c6cd5dcff9581f9bb35b982cb89e2c483a41d7d" integrity sha512-MJu7ypHq6QasgF5YRTjqscSzQp/W11zoUk6kvmlH+fmWEs63Y0Eib13hYFwAzagRJcVY8WVnlV+eBDUGMJ5IbA== +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + urix@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz" @@ -15041,6 +15300,11 @@ validate-npm-package-name@^5.0.0: dependencies: builtins "^5.0.0" +validator@^13.7.0: + version "13.11.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.11.0.tgz#23ab3fd59290c61248364eabf4067f04955fbb1b" + integrity sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ== + value-equal@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz" @@ -15103,6 +15367,18 @@ vite-plugin-checker@^0.6.2: vscode-languageserver-textdocument "^1.0.1" vscode-uri "^3.0.2" +vite-plugin-dts@3.6.3: + version "3.6.3" + resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-3.6.3.tgz#7d79f2fe9352841f3b76cc38e8c16be957c9cdcb" + integrity sha512-NyRvgobl15rYj65coi/gH7UAEH+CpSjh539DbGb40DfOTZSvDLNYTzc8CK4460W+LqXuMK7+U3JAxRB3ksrNPw== + dependencies: + "@microsoft/api-extractor" "^7.38.0" + "@rollup/pluginutils" "^5.0.5" + "@vue/language-core" "^1.8.20" + debug "^4.3.4" + kolorist "^1.8.0" + vue-tsc "^1.8.20" + vite-plugin-html@3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/vite-plugin-html/-/vite-plugin-html-3.2.0.tgz" @@ -15192,6 +15468,17 @@ vite@4.3.9, "vite@^3.0.0 || ^4.0.0": optionalDependencies: fsevents "~2.3.2" +vite@4.4.5: + version "4.4.5" + resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.5.tgz#ce9ae1a03841d2ec90f560744712495bf914f698" + integrity sha512-4m5kEtAWHYr0O1Fu7rZp64CfO1PsRGZlD3TAB32UmQlpd7qg15VF7ROqGN5CyqN7HFuwr7ICNM2+fDWRqFEKaA== + dependencies: + esbuild "^0.18.10" + postcss "^8.4.26" + rollup "^3.25.2" + optionalDependencies: + fsevents "~2.3.2" + "vite@^3.0.0 || ^4.0.0 || ^5.0.0-0", "vite@^3.1.0 || ^4.0.0 || ^5.0.0-0", vite@^4.4.9: version "4.4.9" resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.9.tgz#1402423f1a2f8d66fd8d15e351127c7236d29d3d" @@ -15353,6 +15640,23 @@ vue-template-compiler@^2.6.11: de-indent "^1.0.2" he "^1.2.0" +vue-template-compiler@^2.7.14: + version "2.7.15" + resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.15.tgz#ec88ba8ceafe0f17a528b89c57e01e02da92b0de" + integrity sha512-yQxjxMptBL7UAog00O8sANud99C6wJF+7kgbcwqkvA38vCGF7HWE66w0ZFnS/kX5gSoJr/PQ4/oS3Ne2pW37Og== + dependencies: + de-indent "^1.0.2" + he "^1.2.0" + +vue-tsc@^1.8.20: + version "1.8.22" + resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-1.8.22.tgz#421e73c38b50802a6716ca32ed87b5970c867323" + integrity sha512-j9P4kHtW6eEE08aS5McFZE/ivmipXy0JzrnTgbomfABMaVKx37kNBw//irL3+LlE3kOo63XpnRigyPC3w7+z+A== + dependencies: + "@volar/typescript" "~1.10.5" + "@vue/language-core" "1.8.22" + semver "^7.5.4" + vue-types@^4.1.0: version "4.2.1" resolved "https://registry.npmjs.org/vue-types/-/vue-types-4.2.1.tgz" @@ -15795,6 +16099,17 @@ yocto-queue@^1.0.0: resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== +z-schema@~5.0.2: + version "5.0.6" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-5.0.6.tgz#46d6a687b15e4a4369e18d6cb1c7b8618fc256c5" + integrity sha512-+XR1GhnWklYdfr8YaZv/iu+vY+ux7V5DS5zH1DQf6bO5ufrt/5cgNhVO5qyhsjFXvsqQb/f08DWE9b6uPscyAg== + dependencies: + lodash.get "^4.4.2" + lodash.isequal "^4.5.0" + validator "^13.7.0" + optionalDependencies: + commander "^10.0.0" + zen-observable-ts@^0.8.21: version "0.8.21" resolved "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz" From 0e6df4dc349ec6d5722e2c2d0593837b8f4ee94f Mon Sep 17 00:00:00 2001 From: connoratrug Date: Thu, 9 Nov 2023 16:01:01 +0100 Subject: [PATCH 2/2] chore: add lib functions and extend sample use with function and type import --- apps/helloworld/src/App.vue | 10 +- apps/meta-data-utils/src/fieldHelpers.ts | 77 ++++++ apps/meta-data-utils/src/index.ts | 20 ++ apps/meta-data-utils/src/tableQuery.ts | 303 +++++++++++++++++++++++ apps/meta-data-utils/src/types.ts | 54 ++++ apps/meta-data-utils/tsconfig.json | 3 + 6 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 apps/meta-data-utils/src/fieldHelpers.ts create mode 100644 apps/meta-data-utils/src/tableQuery.ts create mode 100644 apps/meta-data-utils/src/types.ts diff --git a/apps/helloworld/src/App.vue b/apps/helloworld/src/App.vue index 577786d03c..4911607f1e 100644 --- a/apps/helloworld/src/App.vue +++ b/apps/helloworld/src/App.vue @@ -8,11 +8,19 @@ diff --git a/apps/meta-data-utils/src/fieldHelpers.ts b/apps/meta-data-utils/src/fieldHelpers.ts new file mode 100644 index 0000000000..224a3c3422 --- /dev/null +++ b/apps/meta-data-utils/src/fieldHelpers.ts @@ -0,0 +1,77 @@ +import type { IColumn } from "./types"; + +export const fieldTypes = () => { + return [ + "BOOL", + "BOOL_ARRAY", + "DATE", + "DATE_ARRAY", + "DATETIME", + "AUTO_ID", + "DATETIME_ARRAY", + "DECIMAL", + "DECIMAL_ARRAY", + "EMAIL", + "EMAIL_ARRAY", + "FILE", + "HEADING", + "HYPERLINK", + "HYPERLINK_ARRAY", + "INT", + "INT_ARRAY", + "LONG", + "LONG_ARRAY", + "ONTOLOGY", + "ONTOLOGY_ARRAY", + "REF", + "REF_ARRAY", + "REFBACK", + "STRING", + "STRING_ARRAY", + "TEXT", + "TEXT_ARRAY", + "UUID", + "UUID_ARRAY", + ]; +}; + +export const isEmpty = (obj: object) => { + for (const prop in obj) { + if (Object.hasOwnProperty.call(obj, prop)) { + return false; + } + } + + return true; +}; + +export const isValueType = (column: IColumn) => { + return ( + column.columnType === "STRING" || + column.columnType === "TEXT" || + column.columnType === "EMAIL" || + column.columnType === "HYPERLINK" || + column.columnType === "UUID" || + column.columnType === "DATE" || + column.columnType === "DATETIME" || + column.columnType === "INT" || + column.columnType === "LONG" || + column.columnType === "DECIMAL" + ); +}; + +export const isRefType = (column: IColumn) => { + return ( + column.columnType === "REF" || + column.columnType === "REFBACK" || + column.columnType === "ONTOLOGY" + ); +}; + +export const isArrayType = (column: IColumn) => { + return column.columnType.endsWith("_ARRAY"); +}; + +export const isFileType = (column: IColumn) => { + return column.columnType === "FILE"; +}; diff --git a/apps/meta-data-utils/src/index.ts b/apps/meta-data-utils/src/index.ts index 0847bc78ad..7e260305c8 100644 --- a/apps/meta-data-utils/src/index.ts +++ b/apps/meta-data-utils/src/index.ts @@ -1,3 +1,23 @@ export const sayHello = (name: string): string => { return `Hello ${name}`; }; + +export { + buildRecordDetailsQueryFields, + buildRecordListQueryFields, + extractExternalSchemas, + extractKeyFromRecord, + buildFilterFromKeysObject, + getTableMetaData, +} from "./tableQuery"; + +export type { + IColumn, + ILocale, + ISetting, + ISchemaMetaData, + ITableMetaData, + KeyObject, +} from "./types"; + +export { fieldTypes, isEmpty, isValueType } from "./fieldHelpers"; diff --git a/apps/meta-data-utils/src/tableQuery.ts b/apps/meta-data-utils/src/tableQuery.ts new file mode 100644 index 0000000000..8b50873aea --- /dev/null +++ b/apps/meta-data-utils/src/tableQuery.ts @@ -0,0 +1,303 @@ +import type { + IColumn, + ISchemaMetaData, + ITableMetaData, + KeyObject, +} from "./types"; +import { + isValueType, + isArrayType, + isFileType, + isRefType, +} from "./fieldHelpers"; + +const FILE_FRAGMENT = "{ id, size, extension, url }"; + +export const buildRecordDetailsQueryFields = ( + schemas: Record, + schemaName: string, + tableId: string +): string => { + const schemaMetaData = schemas[schemaName]; + const tableMetaData = schemaMetaData.tables.find( + (t: ITableMetaData) => + t.id.toLocaleLowerCase() === tableId.toLocaleLowerCase() + ); + + const allColumns = tableMetaData?.columns; + const dataColumns = allColumns + ?.filter((c) => !c.name.startsWith("mg_")) + .filter((c) => c.columnType !== "HEADING"); + + const refTableQueryFields = (refColumn: IColumn): string => { + const refTableMetaData = schemas[ + refColumn.refSchema || schemaName + ].tables.find( + (t: ITableMetaData) => + t.id.toLocaleLowerCase() === + // @ts-ignore we know that refTable is not undefined + convertToPascalCase(refColumn.refTable).toLocaleLowerCase() + ); + + const allRefColumns = refTableMetaData?.columns; + + const refTableDataColumns = allRefColumns + ?.filter((c) => !c.id.startsWith("mg_")) + .filter((c) => c.columnType !== "HEADING"); + + const refFields = refTableDataColumns?.map((column) => { + switch (column.columnType) { + case "STRING": + case "TEXT": + return column.id; + case "FILE": + return `${column.id} ${FILE_FRAGMENT}`; + case "REF": + case "ONTOLOGY": + case "REF_ARRAY": + case "REFBACK": + case "ONTOLOGY_ARRAY": + return ""; // stop recursion + default: + return column.id; + } + }); + + const refQueryFields = refFields ? refFields.join(" ") : ""; + + return refQueryFields; + }; + + const fields = dataColumns?.map((column) => { + switch (column.columnType) { + case "STRING": + case "TEXT": + return column.id; + case "FILE": + return `${column.id} ${FILE_FRAGMENT}`; + case "REF": + case "ONTOLOGY": + case "REF_ARRAY": + case "REFBACK": + case "ONTOLOGY_ARRAY": + return `${column.id} { ${refTableQueryFields(column)} }`; + default: + return column.id; + } + }); + + const queryFields = fields ? fields.join(" ") : ""; + + return queryFields; +}; + +export const buildRecordListQueryFields = ( + tableName: string, + schemaName: string, + schemas: Record +) => { + const keyFields = buildKeyFields(tableName, schemaName, schemas); + const tableMetaData = getTableMetaData(schemas[schemaName], tableName); + + if (tableMetaData === undefined) { + throw new Error( + "buildRecordListQueryFields; tableMetaData is undefined for tableName " + + tableName + + " in schema " + + schemaName + ); + } + + const typeFields = tableMetaData.columns.map((c) => c.id); + + // suggested list fields that are part of this tableType + const additionalFields: any = [ + "id", + "name", + "label", + "description", + "pid", + "acronym", + "logo", + ].filter((value) => typeFields.includes(value)); + + // Special case for logo, expand to include all fields + if (additionalFields[additionalFields.length - 1] === "logo") { + additionalFields.push(["id", "size", "extension", "url"]); + } + + const queryFields = [...new Set([...keyFields, ...additionalFields])]; + + const fieldsString = fieldsToQueryString(queryFields); + + return fieldsString; +}; + +const fieldsToQueryString = (fields: string[][]): string => { + return fields.reduce((acc: string, field: any) => { + if (Array.isArray(field)) { + return (acc += " { " + fieldsToQueryString(field) + " } "); + } else { + return (acc += " " + field); + } + }, ""); +}; + +const buildKeyFields = ( + tableName: string, + schemaName: string, + schemas: Record +) => { + const schemaMetaData = schemas[schemaName]; + const tableMetaData = getTableMetaData(schemaMetaData, tableName); + + const keyFields = tableMetaData.columns.reduce( + (acc: any, column: IColumn) => { + if (column.key === 1) { + if (isValueType(column)) { + acc.push(column.id); + } else if (isRefType(column)) { + if (!column.refTable) { + throw new Error( + "refTable is undefined for refColumn with id " + + column.id + + " in table " + + tableName + + "" + ); + } else { + acc.push(column.id); + acc.push( + buildKeyFields( + column.refTable, + column.refSchema || schemaName, + schemas + ) + ); + } + } else if (isArrayType(column)) { + console.log( + "TODO: buildRecordListQueryFields, key column isArrayType, skip for now" + ); + } else if (isFileType(column)) { + console.log( + "TODO: buildRecordListQueryFields, key column isFileType, skip for now" + ); + } else { + console.log( + "TODO: buildRecordListQueryFields, key column is unknown type, skip for now" + ); + } + } + return acc; + }, + [] + ); + return keyFields || []; +}; + +export const extractExternalSchemas = (schemaMetaData: ISchemaMetaData) => { + return [ + ...new Set( + schemaMetaData.tables.reduce((acc: string[], table: ITableMetaData) => { + table.columns.forEach((column: IColumn) => { + if (column.refSchema) { + acc.push(column.refSchema); + } + }); + return acc; + }, []) + ), + ]; +}; + +export const extractKeyFromRecord = ( + record: any, + tableName: string, + schemaId: string, + schemas: Record +) => { + const schemaMetaData = schemas[schemaId]; + const tableMetaData = getTableMetaData(schemaMetaData, tableName); + + const key = tableMetaData.columns.reduce((acc: any, column: IColumn) => { + if (column.key === 1 && record[column.id]) { + if (isValueType(column)) { + acc[column.id] = record[column.id]; + } else if (isRefType(column)) { + if (!column.refTable) { + throw new Error( + "refTable is undefined for refColumn with id " + + column.id + + " in table " + + tableName + + "" + ); + } else { + acc[column.id] = extractKeyFromRecord( + record[column.id], + column.refTable, + column.refSchema || schemaId, + schemas + ); + } + } else if (isArrayType(column)) { + console.log( + "TODO: extractKeyFromRecord, key column isArrayType, skip for now" + ); + } else if (isFileType(column)) { + console.log( + "TODO: extractKeyFromRecord, key column isFileType, skip for now" + ); + } else { + console.log( + "TODO: extractKeyFromRecord, key column is unknown type, skip for now" + ); + } + } + return acc; + }, {}); + return key || {}; +}; + +export const buildFilterFromKeysObject = (keys: KeyObject) => { + return Object.entries(keys).reduce( + ( + acc: Record, + [key, value]: [string, string | KeyObject] + ) => { + acc[key] = { equals: [value] }; + return acc; + }, + {} + ); +}; + +export const getTableMetaData = ( + schemaMetaData: ISchemaMetaData, + tableName: string +): ITableMetaData => { + const tableMetaData = schemaMetaData.tables.find( + (t: ITableMetaData) => + t.name.toLocaleLowerCase() === tableName.toLocaleLowerCase() + ); + + if (tableMetaData === undefined) { + const msg = "ERROR: tableMetaData is undefined for tableName " + tableName; + console.log(msg); + throw new Error(msg); + } + return tableMetaData; +}; + +function convertToPascalCase(string: string): string { + const words = string.trim().split(/\s+/); + let result = ""; + words.forEach((word: string) => { + result += word.charAt(0).toUpperCase(); + if (word.length > 1) { + result += word.slice(1); + } + }); + return result; +} diff --git a/apps/meta-data-utils/src/types.ts b/apps/meta-data-utils/src/types.ts new file mode 100644 index 0000000000..c035266a66 --- /dev/null +++ b/apps/meta-data-utils/src/types.ts @@ -0,0 +1,54 @@ +export type KeyObject = { + [key: string]: KeyObject | string; +}; + +export interface ISetting { + key: string; + value: string; +} + +export interface ILocale { + locale: string; + value: string; +} + +export interface IColumn { + columnType: string; + id: string; + name: string; + computed?: string; + conditions?: string[]; + descriptions?: ILocale[]; + key?: number; + labels?: ILocale[]; + position?: number; + readonly?: boolean; + defaultValue?: string; + refBack?: string; + refLabel?: string; + refLabelDefault?: string; + refLink?: string; + refSchema?: string; + refTable?: string; + required?: boolean; + semantics?: string[]; + validation?: string; + visible?: string; +} + +export interface ITableMetaData { + id: string; + name: string; + tableType: string; + columns: IColumn[]; + descriptions?: ILocale[]; + externalSchema: string; + labels?: ILocale[]; + semantics?: string[]; + settings?: ISetting[]; +} + +export interface ISchemaMetaData { + name: string; + tables: ITableMetaData[]; +} diff --git a/apps/meta-data-utils/tsconfig.json b/apps/meta-data-utils/tsconfig.json index c982e96d00..a61a4a30d1 100644 --- a/apps/meta-data-utils/tsconfig.json +++ b/apps/meta-data-utils/tsconfig.json @@ -1,5 +1,8 @@ { "compilerOptions": { + "target": "ES2020", + "lib": ["ES2020", "DOM"], + "skipLibCheck": true, "paths": { "vite": ["./node_modules/vite"] }