diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..936b7eb --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1283 @@ +{ + "name": "@digitalcredentials/cred-store", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@digitalcredentials/cred-store", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "cors": "^2.8.6", + "dotenv": "^17.2.3", + "express": "^5.2.1", + "mariadb": "^3.4.5" + }, + "devDependencies": { + "nodemon": "^3.1.11" + } + }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.10.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.9.tgz", + "integrity": "sha512-ne4A0IpG3+2ETuREInjPNhUGis1SFjv1d5asp8MzEAGtOZeTeHVDOYqOgqfhvseqg/iXty2hjBf1zAOb7RNiNw==", + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dotenv": { + "version": "17.2.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/mariadb": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/mariadb/-/mariadb-3.4.5.tgz", + "integrity": "sha512-gThTYkhIS5rRqkVr+Y0cIdzr+GRqJ9sA2Q34e0yzmyhMCwyApf3OKAC1jnF23aSlIOqJuyaUFUcj7O1qZslmmQ==", + "license": "LGPL-2.1-or-later", + "dependencies": { + "@types/geojson": "^7946.0.16", + "@types/node": "^24.0.13", + "denque": "^2.1.0", + "iconv-lite": "^0.6.3", + "lru-cache": "^10.4.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/mariadb/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/nodemon": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.11.tgz", + "integrity": "sha512-is96t8F/1//UHAjNPHpbsNY46ELPpftGUoSVNXwUfMk/qdjSylYrWSu1XavVTBOn526kFiOR733ATgNBCQyH0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..cc91137 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "@digitalcredentials/cred-store", + "version": "1.0.0", + "description": "Relational implementation of a storage/log service for Verifiable Credentials", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node -r dotenv/config server.js", + "dev": "nodemon -r dotenv/config server.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/digitalcredentials/cred-store.git" + }, + "author": "James Chartrand", + "license": "ISC", + "bugs": { + "url": "https://github.com/digitalcredentials/cred-store/issues" + }, + "homepage": "https://github.com/digitalcredentials/cred-store#readme", + "dependencies": { + "cors": "^2.8.6", + "dotenv": "^17.2.3", + "express": "^5.2.1", + "mariadb": "^3.4.5" + }, + "devDependencies": { + "nodemon": "^3.1.11" + } +} diff --git a/server.js b/server.js new file mode 100644 index 0000000..bae7779 --- /dev/null +++ b/server.js @@ -0,0 +1,29 @@ +import { build } from './src/app.js' +import https from 'https' +import http from 'http' +import fs from 'fs' + +const run = async () => { + const port = 3000; + const enableHttpsForDev = false; + + const app = await build() + + if (enableHttpsForDev) { + https + .createServer( + { + key: fs.readFileSync('server-dev-only.key'), + cert: fs.readFileSync('server-dev-only.cert') + }, + app + ) + .listen(port, () => console.log(`Server running on port ${port}`)) + } else { + http + .createServer(app) + .listen(port, () => console.log(`Server running on port ${port}`)) + } +} + +run() \ No newline at end of file diff --git a/setup.sql b/setup.sql new file mode 100644 index 0000000..8f4fcac --- /dev/null +++ b/setup.sql @@ -0,0 +1,5 @@ +CREATE USER 'creduser'@'localhost' IDENTIFIED BY 'creduser'; +GRANT ALL PRIVILEGES ON *.* TO 'creduser'@'localhost'; +FLUSH PRIVILEGES; + +SHOW GRANTS FOR 'creduser'@'localhost'; \ No newline at end of file diff --git a/src/app.js b/src/app.js new file mode 100644 index 0000000..249e269 --- /dev/null +++ b/src/app.js @@ -0,0 +1,407 @@ +import express from 'express' +import cors from 'cors' +import {createDatabase, seedDatabase} from './seed.js' +import { + fetchCredentials, + fetchAllCredentials, + fetchCredentialCount, + addCredential, + updateCredential, + updateCredentials, + getCredential, + getReportData, + fetchBatches, + fetchTemplates, + fetchAllTemplates, + getTemplate, + fetchHolders, + fetchHolderCount, + getHolder, + addHolder, + addHolders, + updateHolder, + fetchCredentialsForHolder, + fetchCredentialCountForHolder, + checkForHolderDuplicates, + addPickup, + addNotification, + lookupPickupToken, + fetchAllTenants, + getTenant, + addTenant, + updateTenant, + addBatch, + getAllTags, + getTag, + updateTag, + addTag +} from './queries.js' + +export async function build() { + var app = express() + + app.use(express.json()) + app.use(express.urlencoded({ extended: false })) + app.use(cors()) + + app.get('/healthz', async function (req, res) { + try { + // TODO add some meaningful check like a select from the DB + } catch (e) { + console.log(`exception in healthz: ${JSON.stringify(e)}`) + return res.status(503).json({ + error: `cred-store healthz check failed with error: ${e}`, + healthy: false + }) + } + res.json({ message: 'cred-store server status: ok.', healthy: true }) + }) + + app.get('/', function (req, res) { + res.json({ message: 'cred-store server status: ok.' }) + }) + + app.get('/seed', async function (req, res) { + await createDatabase() + await seedDatabase() + + res.json({ message: 'created and seeded db' }) + }) + + app.post('/credential', async function (req, res) { + let submittedCred = req.body; + try { + const result = await addCredential(submittedCred) + res.json({message: 'credential created'}); + } catch (err) { + throw err; + } + }) + + app.post('/batch', async function (req, res) { + let submittedBatch = req.body; + try { + const result = await addBatch(submittedBatch) + res.json({message: 'batch added'}); + } catch (err) { + throw err; + } + }) + + app.post('/credentials/query', async function (req, res) { + let query = req.body; + try { + const result = await fetchCredentials(query.queryTerm, query.currentPage); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.get('/holder/credentials/:id', async function (req, res) { + const id = req.params.id + try { + const result = await fetchCredentialsForHolder(id); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.get('/template/:id', async function (req, res) { + const id = req.params.id + try { + const result = await getTemplate(id); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.post('/holder/credentials/count/:id', async function (req, res) { + const id = req.params.id + let query = req.body; + try { + const result = await fetchCredentialCountForHolder(id,query.queryTerm); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.post('/holders/query', async function (req, res) { + let query = req.body; + try { + const result = await fetchHolders(query.queryTerm, query.currentPage); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.post('/holder', async function (req, res) { + let submittedHolder = req.body; + try { + const result = await addHolder(submittedHolder) + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + app.post('/tenant', async function (req, res) { + let data = req.body; + try { + const result = await addTenant(data) + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + app.post('/holders', async function (req, res) { + let holders = req.body; + try { + const result = await addHolders(holders) + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + app.get('/holder/:id', async function (req, res) { + const id = req.params.id + try { + const result = await getHolder(id); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.get('/tenant/:id', async function (req, res) { + const id = req.params.id + try { + const result = await getTenant(id); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.get('/credentials', async function (req, res) { + const id = req.params.id + try { + const result = await fetchAllCredentials(); + res.send(result); + } catch (err) { + throw err; + } + }) + + + app.put('/holder/:id', async function (req, res) { + const id = req.params.id + let updatedValues = req.body; + try { + const result = await updateHolder(id, updatedValues); + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + app.put('/tenant/:id', async function (req, res) { + const id = req.params.id + let updatedValues = req.body; + try { + const result = await updateTenant(id, updatedValues); + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + + app.post('/holders/duplicates', async function (req, res) { + const emailList = req.body; + try { + const result = await checkForHolderDuplicates(emailList); + res.json(result) + } catch (e) { + throw e + } + + }) + + app.post('/credentials/count', async function (req, res) { + let query = req.body; + try { + const result = await fetchCredentialCount(query.queryTerm); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.post('/holders/count', async function (req, res) { + let query = req.body; + try { + const result = await fetchHolderCount(query.queryTerm); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.get('/credential/:id', async function (req, res) { + const id = req.params.id + try { + const result = await getCredential(id); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.put('/credential/:id', async function (req, res) { + const id = req.params.id + let updatedValues = req.body; + try { + const result = updateCredential(id, updatedValues); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.put('/credentials', async function (req, res) { + let updatedValues = req.body; + try { + const result = updateCredentials(updatedValues); + res.send(result); + } catch (err) { + throw err; + } + }) + + + app.get('/report', async function (req, res) { + try { + const result = await getReportData(); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.get('/batches', async function (req, res) { + try { + const result = await fetchBatches(5); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.get('/templates', async function (req, res) { + try { + const result = await fetchAllTemplates(); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.get('/tags', async function (req, res) { + try { + const result = await getAllTags(); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.get('/tag/:id', async function (req, res) { + const id = req.params.id + try { + const result = await getTag(id); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.put('/tag/:id', async function (req, res) { + const id = req.params.id + let updatedValues = req.body.tag; + try { + const result = updateTag(id, updatedValues); + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + app.post('/tag', async function (req, res) { + let data = req.body.tag; + try { + const result = await addTag(data) + res.json({success:true}); + } catch (err) { + throw err; + } + }) + + + app.get('/tenants', async function (req, res) { + try { + const result = await fetchAllTenants(); + res.send(result); + } catch (err) { + throw err; + } + }) + + app.post('/templates/query', async function (req, res) { + let query = req.body; + try { + const result = await fetchTemplates(query.queryTerm); + res.json(result); + } catch (err) { + throw err; + } + }) + + app.post('/notification', async function (req, res) { + let submittedNotification = req.body; + try { + const result = await addNotification(submittedNotification) + res.json(result); + } catch (err) { + throw err; + } + }) + + app.get('/notification/:pickuptoken', async function (req, res) { + const pickupToken = req.params.pickuptoken + try { + const result = await lookupPickupToken(pickupToken) + res.json(result); + } catch (err) { + throw err; + } + }) + + app.post('/pickup', async function (req, res) { + let submittedPickup = req.body; + try { + const result = await addPickup(submittedPickup) + res.json(result); + } catch (err) { + throw err; + } + }) + + return app +} \ No newline at end of file diff --git a/src/pool.js b/src/pool.js new file mode 100644 index 0000000..35d2ef6 --- /dev/null +++ b/src/pool.js @@ -0,0 +1,12 @@ +import mariadb from 'mariadb'; +const pool = mariadb.createPool({ + host: 'localhost', + user: 'creduser', + password: 'creduser', + connectionLimit: 5, + database: 'credentials' +}); + +export default pool; + +// pool.end(); // Close the pool when done \ No newline at end of file diff --git a/src/queries.js b/src/queries.js new file mode 100644 index 0000000..847ac3b --- /dev/null +++ b/src/queries.js @@ -0,0 +1,437 @@ +import pool from './pool.js' + +export const fetchAllCredentials = async () => { + return await pool.query(commonCredQuery); +} + +export const fetchBatches = async (limit) => { + return await pool.query(`select id, name, description, added_by, date_added from batch${limit?' LIMIT ' + limit:''}`); +} + +export const fetchAllTemplates = async () => { + return await pool.query(`select * from template`); +} + +export const fetchAllTenants = async () => { + return await pool.query(`select * from tenant`); +} + +const ITEMS_PER_PAGE = 6; + +export const fetchTemplates = async (queryTerm) => { + + const templates = await pool.query(`SELECT * FROM template WHERE + name LIKE '%${queryTerm}%' OR + description LIKE '%${queryTerm}%' + `); + const count = await fetchTemplateCount(queryTerm) + return {templates,count} +} + +const commonCredQuery = `SELECT + credential.id AS id, + holder.id as holder_id, + holder.name as holder_name, + holder.email as holder_email, + holder.did as holder_did, + holder.org_id as holder_org_id, + credential.cred_name as cred_name, + credential.status as status, + credential.date_added as date_added, + credential.cred_template_id, + credential.valid_from, + credential.valid_until, + tenant.id as tenant_id, + tenant.env_name as tenant_env_name, + tenant.issuer_name as tenant_issuer_name, + tenant.issuer_image_url as tenant_issuer_image_url, + tenant.issuer_url as tenant_issuer_url, + template.id as template_id, + template.template_json as template_json, + template.name as template_name, + template.description as template_description, + template.image_url as template_image_url, + tag.id as tag_id, + tag.name as tag_name, + tag.description as tag_description + FROM credential + INNER JOIN holder ON credential.holder_id = holder.id + INNER JOIN tenant ON credential.tenant_id = tenant.id + INNER JOIN template ON credential.cred_template_id = template.id + INNER JOIN tag ON credential.tag_id = tag.id + ` + +export const fetchCredentials = async (queryTerm, currentPage) => { + const offset = (currentPage - 1) * ITEMS_PER_PAGE; + const credentials = await pool.query(`${commonCredQuery} WHERE + holder.name LIKE '%${queryTerm}%' OR + credential.cred_name LIKE '%${queryTerm}%' OR + holder.email LIKE '%${queryTerm}%' OR + credential.status LIKE '%${queryTerm}%' + ORDER BY credential.date_added DESC + LIMIT ${ITEMS_PER_PAGE} OFFSET ${offset} + `); + const count = await fetchCredentialCount(queryTerm) + return {credentials,count} +} + +export const getTemplate = async id => { + const result = await pool.query(`SELECT * FROM template WHERE id = ?`, [id]); + const template = result[0] + return template +} + +export const getAllTags = async () => { + const result = await pool.query(`SELECT * FROM tag`); + const tag = result + return tag +} + +export const getTag = async id => { + const result = await pool.query(`SELECT * FROM tag WHERE id = ?`, [id]); + const tag = result[0] + return tag +} + +export const addTag = async tag => { + const result = await pool.query(`INSERT INTO tag (name, description) VALUES (?,?)`, [tag.name, tag.description]); + return result; +} + +export const updateTag = async (id, tag) => { + const result = await pool.query(`UPDATE tag + SET name = ?, + description = ? + WHERE id = ?`, [tag.name, tag.description, id]); + return result; +} + +export const getCredential = async id => { + + const result = await pool.query(`${commonCredQuery} WHERE credential.id = ?`, [id]); + const credential = result[0] + const holder = { + id: credential.holder_id, + name: credential.holder_name, + did: credential.holder_did, + org_id: credential.holder_org_id, + email: credential.holder_email + } + + const tenant = { + id: credential.tenant_id, + issuer_name: credential.tenant_issuer_name, + issuer_url: credential.tenant_issuer_url, + issuer_image_url: credential.tenant_issuer_image_url, + env_name: credential.tenant_env_name + } + + const template = { + id: credential.template_id, + template_json: credential.template_json, + name: credential.template_name, + description: credential.template_description, + image_url: credential.template_image_url + } + + const tag = { + id: credential.tag_id, + name: credential.tag_name, + description: credential.tag_description + } + + delete credential.holder_id + delete credential.holder_name + delete credential.holder_did + delete credential.holder_org_id + delete credential.holder_email + + delete credential.tenant_id + delete credential.tenant_issuer_name + delete credential.tenant_issuer_url + delete credential.tenant_issuer_image_url + delete credential.tenant_env_name + + delete credential.template_id + delete credential.template_name + delete credential.template_description + delete credential.template_image_url + delete credential.template_json + delete credential.cred_template_id + + delete credential.tag_id + delete credential.tag_name + delete credential.tag_description + + return {credential, holder, tenant, template, tag} + +} + +export const addBatch = async batch => { + let conn; + try { + conn = await pool.getConnection(); + await conn.beginTransaction(); + + await addHolders(conn, batch.holders); + await addCredentials(conn, batch.credentials); + + await conn.commit(); + console.log("Transaction successful!"); + + } catch (err) { + if (conn) await conn.rollback(); + console.error("Transaction failed:", err); + throw err; + } finally { + if (conn) return conn.release(); + } +} + +export const checkForHolderDuplicates = async emailList => { + const emailsAsStrings = emailList.map(email=>`'${email}'`).join(',') + const query = `SELECT * FROM holder WHERE email IN (${emailsAsStrings})`; + const result = await pool.query(query); + return result +} + +export const addHolders = async data => { + const added_by = data.added_by + const queryValues = data.holders.map(holder=>`('${holder.name}','${holder.did}','${holder.email}','${holder.org_id}', '${added_by}')`).join(',') + const result = await pool.query(`insert into holder (name, did, email, org_id, added_by) values ${queryValues}`); + return result; +} + +export const addCredentials = async credentials => { + // TODO, this is a batch so will need to add the batch info, ie., batch description (category???), templateId, csv file. + const queryValues = credentials.map(credential=>`(${credential.cred_name},${credential.holder_id},${credential.cred_template_id},${credential.tenant_id},${credential.status},${credential.tag_id},${credential.valid_from},${credential.valid_until},${credential.added_by})`).join(',') + const result = await pool.query(`insert into credential (cred_name, holder_id, cred_template_id, tenant_id, status, tag_id, valid_from, valid_until, added_by) values ${queryValues}`); + return result; +} + +export const addCredential = async credential => { + const result = await pool.query(`insert into credential (cred_name, holder_id, cred_template_id, tenant_id, status, tag_id, valid_from, valid_until, added_by) values (?,?,?,?,?,?,?,?,?)`, [credential.cred_name, credential.holder_id, credential.cred_template_id, credential.tenant_id, credential.status, credential.tag_id, credential.valid_from, credential.valid_until, credential.added_by]); + return result; +} + +export const updateCredential = async (id, credential) => { + const result = await pool.query(`UPDATE credential + SET cred_name = ?, + holder_id = ?, + cred_template_id = ?, + tenant_id = ?, + status = ?, + tag_id = ?, + valid_from = ?, + valid_until = ? + WHERE id = ?`, [credential.cred_name, credential.holder_id, credential.cred_template_id, credential.tenant_id, credential.status, credential.tag_id, credential.valid_from, credential.valid_until ,id]); + return result; +} + +export const updateCredentials = async (values) => { + const credentialIdList = values.cred_ids.split(',').map(credId=>`'${credId}'`).join() + const result = await pool.query(`UPDATE credential + SET status = ?, + cred_template_id = ?, + tenant_id = ?, + status = ?, + tag_id = ?, + updated_by = ? + WHERE id IN (${credentialIdList})`, [values.status, values.cred_template_id, values.tenant_id, values.status, values.tag_id, values.updated_by]); + return result; +} + + +export const fetchHolders = async (queryTerm, currentPage) => { + const offset = (currentPage - 1) * ITEMS_PER_PAGE; + const holders = await pool.query(`SELECT * FROM holder WHERE + name LIKE '%${queryTerm}%' OR + did LIKE '%${queryTerm}%' OR + email LIKE '%${queryTerm}%' OR + org_id LIKE '%${queryTerm}%' + ORDER BY name DESC + LIMIT ${ITEMS_PER_PAGE} OFFSET ${offset} + `); + const count = await fetchHolderCount(queryTerm) + return {holders,count} +} + +export const fetchHolderCount = async (queryTerm) => { + const result = await pool.query(`SELECT COUNT(*) as count FROM holder + WHERE + name LIKE '%${queryTerm}%' OR + did LIKE '%${queryTerm}%' OR + email LIKE '%${queryTerm}%' OR + org_id LIKE '%${queryTerm}%' + `); + const count = result[0].count.toString() + return count +} + +export const fetchCredentialsForHolder = async (holderId) => { + + const theQuery = `${commonCredQuery} WHERE + holder.id = '${holderId}' + ORDER BY credential.date_added DESC + ` + const credentials = await pool.query(theQuery); + return credentials +} + + +export const fetchCredentialCountForHolder = async (orgId, queryTerm) => { + const result = await pool.query(`SELECT COUNT(*) as count FROM credential + INNER JOIN holder ON credential.holder_id = holder.id + WHERE + holder.org_id = '${orgId}' AND + ( + holder.name LIKE '%${queryTerm}%' OR + credential.cred_name LIKE '%${queryTerm}%' OR + holder.email LIKE '%${queryTerm}%' OR + credential.status LIKE '%${queryTerm}%' + ) + `); + const count = result[0].count.toString() + return count +} + + + +export const getHolder = async id => { + const result = await pool.query(`SELECT * FROM holder WHERE id = ?`, [id]); + return result[0] +} + +export const addHolder = async data => { + const result = await pool.query(`insert into holder (name, did, email, org_id, added_by) values (?,?,?,?,?)`, [data.holder.name, data.holder.did, data.holder.email, data.holder.org_id, data.added_by]); + return result; +} + +export const updateHolder = async (id, data) => { + const result = await pool.query(`UPDATE holder + SET name = ?, + did = ?, + email = ?, + org_id = ?, + updated_by = ? + WHERE id = ?`, [data.holder.name, data.holder.did, data.holder.email, data.holder.org_id, data.updated_by, id]); + return result; +} + +export const getTenant = async id => { + const result = await pool.query(`SELECT * FROM tenant WHERE id = ?`, [id]); + return result[0] +} + +export const addTenant = async data => { + const result = await pool.query(`insert into tenant (name, description, email, issuer_name, issuer_url, issuer_image_url, env_name, is_active, added_by) values (?,?,?,?,?,?,?,?,?)`, + [data.tenant.name, data.tenant.description, data.tenant.email, data.tenant.issuer_name, data.tenant.issuer_url, data.tenant.issuer_image_url, data.tenant.env_name, data.tenant.is_active, data.added_by]); + return result; +} + +export const updateTenant = async (id, data) => { + const result = await pool.query(`UPDATE tenant + SET name = ?, + description = ?, + email = ?, + issuer_name = ?, + issuer_url = ?, + issuer_image_url = ?, + env_name = ?, + is_active = ?, + updated_by = ? + WHERE id = ?`, [data.tenant.name, data.tenant.description, data.tenant.email, data.tenant.issuer_name, data.tenant.issuer_url, data.tenant.issuer_image_url, data.tenant.env_name, data.tenant.is_active, data.updated_by, id]); + return result; +} + +export const addPickup = async pickup => { + const result = await pool.query(`INSERT INTO pickup (credential_id, template_id, pickup_token) VALUES (?,?,?) RETURNING id`, [pickup.credential_id, pickup.template_id, pickup.pickup_token]); + return result[0]; +} + +export const lookupPickupToken = async pickupToken => { + //we do the pickup lookup separately so that + //we can show a different message if the token is good, but there are no creds for the holder + const tokenLookupResult = await pool.query(`SELECT * FROM notification WHERE pickup_token = ?`, [pickupToken]); + const holderId = tokenLookupResult[0].holder_id; + return fetchCredentialsForHolder(holderId) +} + +export const addNotification = async notification => { + const result = await pool.query(`INSERT INTO notification (credential_id, email, holder_id) VALUES (?,?,?) RETURNING pickup_token`, [notification.credential_id, notification.email, notification.holder_id]); + return result[0]; +} + +export const fetchBatchesByQuery = async (queryTerm, currentPage = 1) => { + const offset = (currentPage - 1) * ITEMS_PER_PAGE; + const batches = await pool.query(`SELECT id, name, description, added_by, date_added FROM batch WHERE + name LIKE '%${queryTerm}%' OR + description LIKE '%${queryTerm}%' OR + added_by LIKE '%${queryTerm}%' + ORDER BY date_added DESC + LIMIT ${ITEMS_PER_PAGE} OFFSET ${offset} + `); + const count = await fetchBatchCountForQuery(queryTerm) + return {batches,count} + +} + +export const fetchBatchCountForQuery = async (queryTerm) => { + const result = await pool.query(`SELECT COUNT(*) as count FROM batch WHERE + name LIKE '%${queryTerm}%' OR + description LIKE '%${queryTerm}%' OR + added_by LIKE '%${queryTerm}%' + `); + const count = result[0].count.toString() + return count +} + +export const fetchCredentialCount = async (queryTerm) => { + const result = await pool.query(`SELECT COUNT(*) as count FROM credential + INNER JOIN holder ON credential.holder_id = holder.id + WHERE + holder.name LIKE '%${queryTerm}%' OR + credential.cred_name LIKE '%${queryTerm}%' OR + holder.email LIKE '%${queryTerm}%' OR + credential.status LIKE '%${queryTerm}%' + `); + const count = result[0].count.toString() + return count +} + +export const fetchTemplateCount = async (queryTerm) => { + const result = await pool.query(`SELECT COUNT(*) as count FROM template WHERE + name LIKE '%${queryTerm}%' OR + description LIKE '%${queryTerm}%' + `); + const count = result[0].count.toString() + return count +} + + + + +const convertToNumber = (count) => { + return new Number(count.toString()); +} + +export const getReportData = async () => { + const result = await Promise.all([ + pool.query("SELECT COUNT(*) AS total_credentials FROM credential"), + pool.query("SELECT COUNT(*) AS total_templates FROM template"), + pool.query("SELECT COUNT(*) AS total_batches FROM batch"), + pool.query("SELECT status, COUNT(*) AS count FROM credential GROUP BY status;"), + pool.query("SELECT YEAR(date_added) AS year, MONTH(date_added) AS month, COUNT(*) AS count FROM credential GROUP BY year, month ORDER BY year, month;") + ]); + const totalCredentials = result[0][0].total_credentials.toString(); + const totalTemplates = result[1][0].total_templates.toString(); + const totalBatches = result[2][0].total_batches.toString(); + const byStatus = result[3].reduce( + (accumulator, statusObject) => {accumulator[statusObject.status] = convertToNumber(statusObject.count); return accumulator}, + {}); + const byMonth = result[4].map(row=>{row.count = convertToNumber(row.count); return row}) + return {totalCredentials, totalBatches, totalTemplates, byStatus, byMonth}; +} + + + diff --git a/src/seed.js b/src/seed.js new file mode 100644 index 0000000..26459bd --- /dev/null +++ b/src/seed.js @@ -0,0 +1,263 @@ +import mariadb from 'mariadb'; +import pool from './pool.js'; +import { credentials, templates, batches, tags, holders, tenants } from './seedData.js'; + +// Define connection parameters without +// specifying a 'database' because we haven't got one yet +const connectionConfig = { + host: 'localhost', + port: 3306, // Default MariaDB port + user: 'creduser', + password: 'creduser', + connectionLimit: 1 +}; + +export async function createDatabase(dbName) { + let conn; + try { + // Establish a connection to the server, + // but not to a specific database because we haven't got one yet + conn = await mariadb.createConnection(connectionConfig); + console.log("Connected to MariaDB server."); + + // Execute the CREATE DATABASE query + const dbQuery = `CREATE DATABASE IF NOT EXISTS credential`; + await conn.query(dbQuery); + console.log(`Database credentials created.`); + + } catch (err) { + console.error("Error creating database:", err); + } finally { + // Close the connection + if (conn) { + await conn.end(); + console.log("Connection closed."); + } + } +} + +async function dropTables(conn) { + + try { + console.log('Dropping all tables...'); + await conn.query(`DROP TABLE IF EXISTS credential, tag, batch, template, holder, notification, pickup, tenant;`); + console.log('All tables successfully dropped.'); + } catch (err) { + console.error('Error trying to drop tables:', err); + } +} + +async function addTables(conn) { + + try { + + console.log('Creating tables...'); + + await conn.query(` + CREATE TABLE IF NOT EXISTS credential ( + id UUID NOT NULL DEFAULT UUID(), + cred_name VARCHAR(100) NOT NULL, + verifiable_credential JSON, + batch_id UUID, + tenant_id UUID NOT NULL, + tag_id UUID, + cred_template_id UUID, + email_template_id UUID, + holder_id UUID NOT NULL, + valid_from DATE DEFAULT NULL, + valid_until DATE DEFAULT NULL, + status ENUM('hidden','collectable') NOT NULL DEFAULT 'collectable', + date_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, + added_by VARCHAR(100) NOT NULL, + updated_by VARCHAR(100), + PRIMARY KEY (id) + ); + `); + + await conn.query(` + CREATE TABLE IF NOT EXISTS template ( + id UUID NOT NULL DEFAULT UUID(), + name VARCHAR(100) NOT NULL, + template_json JSON NOT NULL, + description VARCHAR(255), + image_url VARCHAR(255) NOT NULL, + PRIMARY KEY (id) + ); + `) + + await conn.query(` + CREATE TABLE IF NOT EXISTS pickup ( + id UUID NOT NULL DEFAULT UUID(), + credential_id UUID NOT NULL, + template_id UUID NOT NULL, + date_collected DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, + pickup_token UUID NOT NULL, + PRIMARY KEY (id) + ); + `) + + await conn.query(` + CREATE TABLE IF NOT EXISTS notification ( + id UUID NOT NULL DEFAULT UUID(), + credential_id UUID NOT NULL, + holder_id UUID NOT NULL, + email VARCHAR(100) NOT NULL, + date_notifed DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, + pickup_token UUID NOT NULL DEFAULT UUID(), + PRIMARY KEY (id) + ); + `) + + await conn.query(` + CREATE TABLE IF NOT EXISTS holder ( + id UUID NOT NULL DEFAULT UUID(), + name VARCHAR(100) NOT NULL, + email VARCHAR(100) NOT NULL UNIQUE, + org_id VARCHAR(100), + did VARCHAR(255), + added_by VARCHAR(100) NOT NULL, + updated_by VARCHAR(100), + PRIMARY KEY (id) + ); + `) + + await conn.query(` + CREATE TABLE IF NOT EXISTS tenant ( + id UUID NOT NULL DEFAULT UUID(), + name VARCHAR(100) NOT NULL, + description VARCHAR(255) NOT NULL, + email VARCHAR(100) NOT NULL, + issuer_name VARCHAR(100) NOT NULL, + issuer_image_url VARCHAR(300) NOT NULL, + issuer_url VARCHAR(300) NOT NULL, + env_name VARCHAR(100) NOT NULL, + is_active BOOLEAN NOT NULL DEFAULT TRUE, + added_by VARCHAR(100) NOT NULL, + updated_by VARCHAR(100), + PRIMARY KEY (id) + ); + `) + + await conn.query(` + CREATE TABLE IF NOT EXISTS batch ( + id UUID NOT NULL DEFAULT UUID(), + name VARCHAR(100) NOT NULL, + uploaded_csv BLOB, + description VARCHAR(255), + template_id UUID NOT NULL, + date_added DATETIME DEFAULT CURRENT_TIMESTAMP, + added_by VARCHAR(100), + PRIMARY KEY (id) + ); + `) + + await conn.query(` + CREATE TABLE IF NOT EXISTS tag ( + id UUID NOT NULL DEFAULT UUID(), + name VARCHAR(100) NOT NULL, + description VARCHAR(255), + date_added DATETIME DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id) + ); + `) + + } catch (err) { + console.error('Error adding tables', err); + } +} + + +async function seedTables(conn) { + + try { + console.log('Started seeding...'); + // --- Insert Seed Data --- + const insertedCredentials = await Promise.all( + credentials.map(credential => conn.query(` + INSERT IGNORE INTO credential (cred_name, cred_template_id, holder_id, added_by, tag_id, status, valid_from, valid_until, date_added, tenant_id) + VALUES ( + '${credential.cred_name}', + '${credential.cred_template_id}', + '${credential.holder_id}', + '${credential.added_by}', + '${credential.tag_id}', + '${credential.status}', + ${credential.valid_from ? "'" + credential.valid_from + "'" : 'NULL'}, + ${credential.valid_until ? "'" + credential.valid_until + "'" : 'NULL'}, + '${credential.date_added}', + '${credential.tenant_id}') + `) + ) + ) + + const insertedBatches = await Promise.all( + batches.map(batch => conn.query(` + INSERT IGNORE INTO batch (name, description, uploaded_csv, added_by) + VALUES ('${batch.name}', '${batch.description}', '${batch.uploaded_csv}', '${batch.added_by}') + `) + ) + ) + + const insertedHolder = await Promise.all( + holders.map(holder => conn.query(` + INSERT IGNORE INTO holder (id, name, email, org_id, did, added_by) + VALUES ('${holder.id}','${holder.name}', '${holder.email}', '${holder.org_id}', ${holder.did ? "'" + holder.did + "'" : 'NULL'}, '${holder.added_by}') + `) + ) + ) + + const insertedTenants = await Promise.all( + tenants.map(tenant => conn.query(` + INSERT IGNORE INTO tenant (id, name, description, email, issuer_name, issuer_url, issuer_image_url, env_name ) + VALUES ('${tenant.id}','${tenant.name}', '${tenant.description}', '${tenant.email}', '${tenant.issuer_name}', '${tenant.issuer_url}', '${tenant.issuer_image_url}', '${tenant.env_name}' ) + `) + ) + ) + + const insertedTemplates = await Promise.all( + templates.map(template => conn.query(` + INSERT IGNORE INTO template (id, name, description, template_json, image_url) + VALUES ('${template.id}', '${template.name}', '${template.description}', '${template.template_json}', '${template.image_url}') + `) + ) + ) + + const insertedTags = await Promise.all( + tags.map(tag => conn.query(` + INSERT IGNORE INTO tag (id, name, description) + VALUES ('${tag.id}', '${tag.name}', '${tag.description}') + `) + ) + ) + + + console.log('Credentials seeded!'); + + } catch (err) { + console.error('Error during database seeding:', err); + } +} + + +export async function seedDatabase() { + let conn; + try { + conn = await pool.getConnection(); + // start transaction (auto-commit is disabled on pooled connections) + await conn.beginTransaction(); + await dropTables(conn); + await addTables(conn); + await seedTables(conn); + await conn.commit(); + console.log("Transaction successful!"); + + } catch (err) { + // roll back the transaction if error + if (conn) await conn.rollback(); + console.error("Transaction failed:", err); + throw err; // re-throw for calling function to handle + } finally { + // release connection back to the pool + if (conn) return conn.release(); + } +} \ No newline at end of file diff --git a/src/seedData.js b/src/seedData.js new file mode 100644 index 0000000..bd1bbc1 --- /dev/null +++ b/src/seedData.js @@ -0,0 +1,365 @@ +import testVC from './vc-templates/test-vc.js' + +const tags = [ + { + id: 'd6e15727-9fe1-4961-8c5b-ea44a9bd81aa', + name: 'Spring2026', + description: 'Spring Convocation' + }, + { + id: '3958dc9e-712f-4377-85e9-fec4b6a6442a', + name: 'Fall2026', + description: 'Fall Convocation' + }, + { + id: '3958dc9e-712f-4377-85e9-fec226a6442a', + name: 'BostonMeeting2024', + description: 'Conference attendance' + }, + { + id: '3958dc9e-712f-4377-85e9-fec4b6a9842a', + name: 'DefltMeeting2025', + description: 'Conference attendance' + } +]; + +const holders = [ + { + id: 'B21A0736-5F70-4251-B648-1551595DB051', + name: 'James Chartrand', + email: 'jc.chartrand@gmail.com', + did: 'did:web:digitalcredentials.github.io:vc-test-fixtures:dids:me', + org_id: '1', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: '73BEFADD-0BA4-418E-9141-0DCDBDE98776', + name: 'Taylor Tuna', + email: 'taylor@pacific.sea', + did: 'did:web:digitalcredentials.github.io:vc-test-fixtures:dids:tuna', + org_id: '2', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: 'C74643D6-6771-4510-B3BC-9442DAED936D', + name: 'Sam Salmon', + email: 'sam@pacific.sea', + did: 'did:web:digitalcredentials.github.io:vc-test-fixtures:dids:salmon', + org_id: '3', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: 'F9D0AAF4-E535-4B8C-84A2-7B627DF21031', + name: 'Charlie Crayfish', + email: 'charlie@pacific.sea', + did: 'did:web:digitalcredentials.github.io:vc-test-fixtures:dids:crayfish', + org_id: '4', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: 'F9D0AAF4-E535-4B8C-84A2-7B627DF21031', + name: 'Harper Haddock', + email: 'harper@pacific.sea', + org_id: '5', + added_by: 'jc.chartrand@gmail.com' + } +]; + +const tenants = [ + { + id: '2366E51E-10D1-4EFD-9200-FCCD2A0452E8', + name: 'Economics Department', + email: 'jc.chartrand@gmail.com', + description: 'Economics Department Signer', + env_name: 'UN_PROTECTED_TEST', + issuer_name: 'Wonderful U - Department of Economics', + issuer_url: 'https://econ.wonderfulu.edu', + issuer_image_url: 'https://digitalcredentials.github.io/badge-assets/classroom.png' + }, + { + id: '4A46FCEA-9634-43CB-ABD5-B293997FBFFF', + name: 'Chemistry Department', + email: 'jc.chartrand@gmail.com', + description: 'Chemistry Department Signer', + env_name: 'PROTECTED_TEST', + issuer_name: 'Wonderful U - Department of Che istry', + issuer_url: 'https://chem.wonderfulu.edu', + issuer_image_url: 'https://digitalcredentials.github.io/badge-assets/classroom.png' + }, + { + id: '262F661C-4A25-4279-8474-0EB302D714BD', + name: 'Continuing Education', + email: 'jc.chartrand@gmail.com', + description: 'Continuing Education Signer', + env_name: 'RANDOMING_TESTING', + issuer_name: 'Wonderful U - Continuing Education', + issuer_url: 'https://con-ed.wonderfulu.edu', + issuer_image_url: 'https://digitalcredentials.github.io/badge-assets/classroom.png' + }, + { + id: 'DAF9A925-B98D-4FA1-9008-0800FECB4FF1', + name: 'Registrar', + email: 'jc.chartrand@gmail.com', + description: 'For signing miscellaneous registrarial documents,', + env_name: 'TEST', + issuer_name: 'Wonderful U - Registrar', + issuer_url: 'https://registrar.wonderfulu.edu', + issuer_image_url: 'https://digitalcredentials.github.io/badge-assets/classroom.png' + }, + { + id: '90A5CC2F-660F-47B6-918F-FA7064961CC8', + name: 'Human Resources', + email: 'jc.chartrand@gmail.com', + desciption: 'For signing records of employment.', + env_name: 'TESTING', + issuer_name: 'Wonderful U - Human Resources', + issuer_url: 'https://hr.wonderfulu.edu', + issuer_image_url: 'https://digitalcredentials.github.io/badge-assets/classroom.png' + } +]; + +const templates = [ + { + id: '3958dc9e-742f-4377-85e9-fec4b6a6442a', + template_json: testVC, + name: 'Bachelor of Engineering', + description: 'Standard Bachelor of Engineering', + image_url: '/customers/evil-rabbit.png', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: '76d65c26-f784-44a2-ac19-586678f7c2f2', + template_json: testVC, + name: 'Bachelor of Science', + description: 'Standard Bachelor of Science', + image_url: '/customers/evil-rabbit.png', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: 'CC27C14A-0ACF-4F4A-A6C9-D45682C144B9', + template_json: testVC, + name: 'Bachelor of Arts', + description: 'Standard Bachelor of Arts', + image_url: '/customers/evil-rabbit.png', + added_by: 'jc.chartrand@gmail.com' + }, + { + id: '13D07535-C59E-4157-A011-F8D2EF4E0CBB', + template_json: testVC, + name: 'Master of Science', + description: 'Standard Master of Science', + image_url: '/customers/evil-rabbit.png', + added_by: 'jc.chartrand@gmail.com' + } +]; + +const credentials = [ + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[1].id, + holder_id: 'B21A0736-5F70-4251-B648-1551595DB051', + added_by: 'chartraj@mit.edu', + status: 'collectable', + date_added: '2026-01-24 14:30:00', + tenant_id: '2366E51E-10D1-4EFD-9200-FCCD2A0452E8', + valid_from: '2020-03-08', + valid_until: '2024-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[1].id, + holder_id: '73BEFADD-0BA4-418E-9141-0DCDBDE98776', + holder_email: 'chartraj@mit.edu', + added_by: 'chartraj@mit.edu', + status: 'collectable', + date_added: '2026-01-24 14:30:00', + tenant_id: '2366E51E-10D1-4EFD-9200-FCCD2A0452E8', + valid_until: '2024-03-09' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[2].id, + holder_id: 'C74643D6-6771-4510-B3BC-9442DAED936D', + added_by: 'someone@mit.edu', + status: 'collectable', + date_added: '2026-01-24 14:30:00', + tenant_id: '2366E51E-10D1-4EFD-9200-FCCD2A0452E8', + valid_from: '2020-03-08' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[2].id, + holder_id: 'F9D0AAF4-E535-4B8C-84A2-7B627DF21031', + added_by: 'someone@mit.edu', + status: 'collectable', + date_added: '2026-01-24 14:30:00', + tenant_id: '2366E51E-10D1-4EFD-9200-FCCD2A0452E8', + valid_from: '2020-03-08' + }, + { + id: 'cdedcb59-39a0-43f7-a7a9-be6bd30b1a46', + tag_id: tags[1].id, + cred_name: "Master of Scientific", + cred_template_id: templates[2].id, + holder_id: 'B21A0736-5F70-4251-B648-1551595DB051', + added_by: 'someone@mit.edu', + status: 'collectable', + date_added: '2025-12-24 14:30:00', + tenant_id: '4A46FCEA-9634-43CB-ABD5-B293997FBFFF', + valid_from: '2020-03-08', + valid_until: '2024-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[3].id, + holder_id: '73BEFADD-0BA4-418E-9141-0DCDBDE98776', + added_by: 'chartraj@mit.edu', + status: 'collectable', + date_added: '2025-12-24 14:30:00', + tenant_id: '4A46FCEA-9634-43CB-ABD5-B293997FBFFF', + valid_from: '2020-03-08', + valid_until: '2024-03-09' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[0].id, + holder_id: 'C74643D6-6771-4510-B3BC-9442DAED936D', + added_by: 'someone@mit.edu', + status: 'hidden', + date_added: '2025-12-24 14:30:00', + tenant_id: '4A46FCEA-9634-43CB-ABD5-B293997FBFFF', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[2].id, + holder_id: 'F9D0AAF4-E535-4B8C-84A2-7B627DF21031', + added_by: 'chartraj@mit.edu', + status: 'hidden', + date_added: '2025-08-24 14:30:00', + tenant_id: '4A46FCEA-9634-43CB-ABD5-B293997FBFFF', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[1].id, + holder_id: 'B21A0736-5F70-4251-B648-1551595DB051', + added_by: 'someone@mit.edu', + status: 'hidden', + date_added: '2025-08-24 14:30:00', + tenant_id: '262F661C-4A25-4279-8474-0EB302D714BD', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[3].id, + holder_id: '73BEFADD-0BA4-418E-9141-0DCDBDE98776', + added_by: 'chartraj@mit.edu', + date_added: '2025-08-24 14:30:00', + status: 'hidden', + tenant_id: '262F661C-4A25-4279-8474-0EB302D714BD', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[3].id, + holder_id: 'C74643D6-6771-4510-B3BC-9442DAED936D', + added_by: 'someone@mit.edu', + status: 'hidden', + date_added: '2025-08-24 14:30:00', + tenant_id: '262F661C-4A25-4279-8474-0EB302D714BD', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[1].id, + holder_id: 'F9D0AAF4-E535-4B8C-84A2-7B627DF21031', + added_by: 'chartraj@mit.edu', + status: 'hidden', + date_added: '2025-08-24 14:30:00', + tenant_id: '262F661C-4A25-4279-8474-0EB302D714BD', + + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[0].id, + holder_id: 'B21A0736-5F70-4251-B648-1551595DB051', + added_by: 'someone@mit.edu', + date_added: '2025-08-24 14:30:00', + status: 'collectable', + tenant_id: 'DAF9A925-B98D-4FA1-9008-0800FECB4FF1', + valid_until: '2028-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[0].id, + holder_id: '73BEFADD-0BA4-418E-9141-0DCDBDE98776', + added_by: 'chartraj@mit.edu', + date_added: '2025-11-24 14:30:00', + status: 'collectable', + tenant_id: 'DAF9A925-B98D-4FA1-9008-0800FECB4FF1', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[2].id, + holder_id: 'C74643D6-6771-4510-B3BC-9442DAED936D', + added_by: 'someone@mit.edu', + date_added: '2025-11-24 14:30:00', + status: 'collectable', + tenant_id: 'DAF9A925-B98D-4FA1-9008-0800FECB4FF1', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + }, + { + tag_id: tags[0].id, + cred_name: "Bachelor of Arts", + cred_template_id: templates[2].id, + holder_id: 'F9D0AAF4-E535-4B8C-84A2-7B627DF21031', + added_by: 'chartraj@mit.edu', + date_added: '2025-11-24 14:30:00', + status: 'collectable', + tenant_id: '90A5CC2F-660F-47B6-918F-FA7064961CC8', + valid_until: '2028-03-09' + }, + { + tag_id: tags[1].id, + cred_name: "Master of Science", + cred_template_id: templates[0].id, + holder_id: 'B21A0736-5F70-4251-B648-1551595DB051', + added_by: 'someone@mit.edu', + status: 'collectable', + date_added: '2025-11-24 14:30:00', + tenant_id: '90A5CC2F-660F-47B6-918F-FA7064961CC8', + valid_from: '2020-03-08', + valid_until: '2028-03-09' + } +]; + +const batches = [ + { name: 'Spring2026', description: '1st batch for spring convocation', uploaded_csv: 'csv data', added_by: 'chartraj@mit.edu' }, + { name: 'Spring2025', description: '1st batch for spring convocation', uploaded_csv: 'csv data', added_by: 'chartraj@mit.edu' }, + { name: 'Fall2025', description: '1st batch for fall convocation', uploaded_csv: 'csv data', added_by: 'chartraj@mit.edu' } +]; + +export { credentials, batches, tags, templates, holders, tenants }; diff --git a/src/vc-templates/test-vc.js b/src/vc-templates/test-vc.js new file mode 100644 index 0000000..b6f61c9 --- /dev/null +++ b/src/vc-templates/test-vc.js @@ -0,0 +1,47 @@ +export default JSON.stringify({ + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "id": "urn:uuid:19281fe8-90d2-4eao-a9da-6188898a6c", + "type": [ + "VerifiableCredential", + "OpenBadgeCredential" + ], + "issuer": { + "type": [ + "Profile" + ], + "name": "The Learned", + "image": { + "id": "https://digitalcredentials.github.io/badge-assets/classroom.png", + "type": "Image", + "caption": "Learned logo" + } + }, + "validFrom": "2025-02-24T00:00:00Z", + "name": "Parker Pearl", + "credentialSubject": { + "type": [ + "AchievementSubject" + ], + "achievement": { + "id": "https://something.org/theProgram", + + "type": [ + "Achievement" + ], + "image": { + "id": "https://digitalcredentials.github.io/badge-assets/brain.png", + "type": "Image", + "caption": "Certificate logo" + }, + "criteria": { + "narrative": "Objectively told the truth" + }, + "description": "Successfully completed all modules.", + "name": "Truth, veracity, candor, and verisimilitude." + } + } +}) \ No newline at end of file