diff --git a/.knip.json b/.knip.json new file mode 100644 index 00000000..36d25b8c --- /dev/null +++ b/.knip.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://unpkg.com/knip@2/schema.json", + "entry": [ + "src/index.ts", + "src/import-events.ts", + "knexfile.js" + ], + "project": [ + "src/**/*.ts" + ], + "ignoreFiles": [], + "commitlint": false, + "eslint": false, + "github-actions": false, + "husky": false, + "mocha": false, + "nyc": false, + "semantic-release": false +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bae952c4..c691fa83 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,16 @@ before making a change. Please keep the conversations civil, respectful and focus on the topic being discussed. +## Local Quality Checks + +Run dead code and dependency analysis before opening a pull request: + +``` +npm run knip +``` + +`npm run lint` now runs Knip first, then ESLint. + ## Pull Request Process 1. Update the relevant documentation with details of changes to the interface, this includes new environment diff --git a/package-lock.json b/package-lock.json index 0ecb6ac4..7474a2e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,7 @@ "@noble/secp256k1": "1.7.1", "axios": "^1.7.7", "bech32": "2.0.0", - "body-parser": "1.20.1", "debug": "4.3.4", - "dinero.js": "2.0.0-alpha.13", "dotenv": "16.0.3", "express": "4.18.2", "helmet": "6.0.1", @@ -25,7 +23,6 @@ "pg-query-stream": "4.3.0", "ramda": "0.28.0", "redis": "4.5.1", - "rxjs": "7.8.0", "tor-control-ts": "^1.0.0", "ws": "^8.18.0" }, @@ -59,10 +56,12 @@ "cz-conventional-changelog": "3.3.0", "eslint": "^8.13.0", "husky": "8.0.2", + "knip": "2.43.0", "mocha": "^9.2.2", "mochawesome": "^7.1.3", "nyc": "^15.1.0", "rimraf": "^3.0.2", + "rxjs": "7.8.0", "semantic-release": "19.0.5", "semantic-release-telegram": "1.6.0", "sinon": "15.0.1", @@ -749,6 +748,19 @@ "uuid": "9.0.1" } }, + "node_modules/@cucumber/cucumber/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@cucumber/cucumber/node_modules/reflect-metadata": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz", @@ -983,33 +995,36 @@ "dev": true, "license": "MIT" }, - "node_modules/@dinero.js/calculator-number": { - "version": "2.0.0-alpha.13", - "resolved": "https://registry.npmjs.org/@dinero.js/calculator-number/-/calculator-number-2.0.0-alpha.13.tgz", - "integrity": "sha512-Mo/0FUVFq4dVb/RfBIASUxPFbQbkHYC0VBe36DgWfbbhwG6K6ONuzTLBU5W6LdrMpB7D/CxgZISdQ0pyZKwg9w==", - "deprecated": "This package has been consolidated into dinero.js. See https://v2.dinerojs.com/getting-started/upgrade-guide", - "license": "MIT", - "dependencies": { - "@dinero.js/core": "2.0.0-alpha.13" - } - }, - "node_modules/@dinero.js/core": { - "version": "2.0.0-alpha.13", - "resolved": "https://registry.npmjs.org/@dinero.js/core/-/core-2.0.0-alpha.13.tgz", - "integrity": "sha512-RLZz8WmYe1ehqD2YtTpzCzdk0Hqf6oaAVmRlULLkua6vuEVEXjPQEhuyTMLHcS6/Gppy9nuEw8mpSNvU+Sy8QQ==", - "deprecated": "This package has been consolidated into dinero.js. See https://v2.dinerojs.com/getting-started/upgrade-guide", - "license": "MIT", - "dependencies": { - "@dinero.js/currencies": "2.0.0-alpha.13" + "node_modules/@ericcornelissen/bash-parser": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@ericcornelissen/bash-parser/-/bash-parser-0.5.3.tgz", + "integrity": "sha512-9Z0sGuXqf6En19qmwB0Syi1Mc8TYl756dNuuaYal9mrypKa0Jq/IX6aJfh6Rk2S3z66KBisWTqloDo7weYj4zg==", + "deprecated": "Support for this package will stop 2025-12-31", + "dev": true, + "license": "MIT", + "dependencies": { + "array-last": "^1.1.1", + "babylon": "^6.9.1", + "compose-function": "^3.0.3", + "filter-obj": "^1.1.0", + "has-own-property": "^0.1.0", + "identity-function": "^1.0.0", + "is-iterable": "^1.1.0", + "iterable-lookahead": "^1.0.0", + "lodash.curry": "^4.1.1", + "magic-string": "^0.16.0", + "map-obj": "^2.0.0", + "object-pairs": "^0.1.0", + "object-values": "^1.0.0", + "reverse-arguments": "^1.0.0", + "shell-quote-word": "^1.0.1", + "to-pascal-case": "^1.0.0", + "unescape-js": "^1.0.5" + }, + "engines": { + "node": ">=4" } }, - "node_modules/@dinero.js/currencies": { - "version": "2.0.0-alpha.13", - "resolved": "https://registry.npmjs.org/@dinero.js/currencies/-/currencies-2.0.0-alpha.13.tgz", - "integrity": "sha512-vEfDara+xAqOrLww80FyFVw4usWcCsR4HwhaoCvwIzB5UdsLPDeUviAGFi8CoWjtLCR44iIeOHdn9jDr7Jj+TQ==", - "deprecated": "This package has been consolidated into dinero.js. See https://v2.dinerojs.com/getting-started/upgrade-guide", - "license": "MIT" - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", @@ -1508,6 +1523,32 @@ "node": ">= 8" } }, + "node_modules/@npmcli/map-workspaces": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-3.0.6.tgz", + "integrity": "sha512-tkYs0OYnzQm6iIRdfy+LcLBjcKuQCeE5YLb8KnrIlutJfheNaPvPpgoFEyEFgbjzl5PLZ3IA/BWAwRU0eHuQDA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/name-from-folder": "^2.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0", + "read-package-json-fast": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/name-from-folder": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-2.0.0.tgz", + "integrity": "sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/@octokit/auth-token": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.4.tgz", @@ -1699,11 +1740,265 @@ "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", "dev": true, "license": "MIT", - "optional": true, "engines": { "node": ">=14" } }, + "node_modules/@pnpm/constants": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@pnpm/constants/-/constants-7.1.1.tgz", + "integrity": "sha512-31pZqMtjwV+Vaq7MaPrT1EoDFSYwye3dp6BiHIGRJmVThCQwySRKM7hCvqqI94epNkqFAAYoWrNynWoRYosGdw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/core-loggers": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@pnpm/core-loggers/-/core-loggers-9.0.4.tgz", + "integrity": "sha512-P5IiCwLbYy/vlCDTxEMReB67NVs1Y4ip6iIEM3Y1fbxm0JbPMWTUMKGf2fy7eqGDF3/Vuxk5H7o/A4II6SWzMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pnpm/types": "9.4.0" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + }, + "peerDependencies": { + "@pnpm/logger": "^5.0.0" + } + }, + "node_modules/@pnpm/error": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@pnpm/error/-/error-5.0.2.tgz", + "integrity": "sha512-0TEm+tWNYm+9uh6DSKyRbv8pv/6b4NL0PastLvMxIoqZbBZ5Zj1cYi332R9xsSUi31ZOsu2wpgn/bC7DA9hrjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pnpm/constants": "7.1.1" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/fetching-types": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@pnpm/fetching-types/-/fetching-types-5.0.0.tgz", + "integrity": "sha512-o9gdO1v8Uc5P2fBBuW6GSpfTqIivQmQlqjQJdFiQX0m+tgxlrMRneIg392jZuc6fk7kFqjLheInlslgJfwY+4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@zkochan/retry": "^0.2.0", + "node-fetch": "3.0.0-beta.9" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/fetching-types/node_modules/node-fetch": { + "version": "3.0.0-beta.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0-beta.9.tgz", + "integrity": "sha512-RdbZCEynH2tH46+tj0ua9caUHVWrd/RHnRfvly2EVdqGmI3ndS1Vn/xjm5KuGejDt2RNDQsVRLPNd2QPwcewVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "data-uri-to-buffer": "^3.0.1", + "fetch-blob": "^2.1.1" + }, + "engines": { + "node": "^10.17 || >=12.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/@pnpm/graceful-fs": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@pnpm/graceful-fs/-/graceful-fs-3.2.0.tgz", + "integrity": "sha512-vRoXJxscDpHak7YE9SqCkzfrayn+Lw+YueOeHIPEqkgokrHeYgYeONoc2kGh0ObHaRtNSsonozVfJ456kxLNvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.11" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/logger": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@pnpm/logger/-/logger-5.0.0.tgz", + "integrity": "sha512-YfcB2QrX+Wx1o6LD1G2Y2fhDhOix/bAY/oAnMpHoNLsKkWIRbt1oKLkIFvxBMzLwAEPqnYWguJrYC+J6i4ywbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bole": "^5.0.0", + "ndjson": "^2.0.0" + }, + "engines": { + "node": ">=12.17" + } + }, + "node_modules/@pnpm/npm-package-arg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@pnpm/npm-package-arg/-/npm-package-arg-1.0.0.tgz", + "integrity": "sha512-oQYP08exi6mOPdAZZWcNIGS+KKPsnNwUBzSuAEGWuCcqwMAt3k/WVCqVIXzBxhO5sP2b43og69VHmPj6IroKqw==", + "dev": true, + "license": "ISC", + "dependencies": { + "hosted-git-info": "^4.0.1", + "semver": "^7.3.5", + "validate-npm-package-name": "^4.0.0" + }, + "engines": { + "node": ">=14.6" + } + }, + "node_modules/@pnpm/npm-resolver": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@pnpm/npm-resolver/-/npm-resolver-18.0.0.tgz", + "integrity": "sha512-FGHmnRjSf7tQHagk6bMrUtHvZbz3ROUoGRDrpMyqJo///+S7SZt/hSDS77PhZ7T6PRXipkFyUtRkqtHmGKFCAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pnpm/core-loggers": "9.0.4", + "@pnpm/error": "5.0.2", + "@pnpm/fetching-types": "5.0.0", + "@pnpm/graceful-fs": "3.2.0", + "@pnpm/resolve-workspace-range": "5.0.1", + "@pnpm/resolver-base": "11.0.0", + "@pnpm/types": "9.4.0", + "@zkochan/retry": "^0.2.0", + "encode-registry": "^3.0.1", + "load-json-file": "^6.2.0", + "lru-cache": "^10.0.1", + "normalize-path": "^3.0.0", + "p-limit": "^3.1.0", + "p-memoize": "4.0.1", + "parse-npm-tarball-url": "^3.0.0", + "path-temp": "^2.1.0", + "ramda": "npm:@pnpm/ramda@0.28.1", + "rename-overwrite": "^4.0.4", + "semver": "^7.5.4", + "ssri": "10.0.5", + "version-selector-type": "^3.0.0" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + }, + "peerDependencies": { + "@pnpm/logger": "^5.0.0" + } + }, + "node_modules/@pnpm/npm-resolver/node_modules/ramda": { + "name": "@pnpm/ramda", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@pnpm/ramda/-/ramda-0.28.1.tgz", + "integrity": "sha512-zcAG+lvU0fMziNeGXpPyCyCJYp5ZVrPElEE4t14jAmViaihohocZ+dDkcRIyAomox8pQsuZnv1EyHR+pOhmUWw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ramda" + } + }, + "node_modules/@pnpm/resolve-workspace-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@pnpm/resolve-workspace-range/-/resolve-workspace-range-5.0.1.tgz", + "integrity": "sha512-yQ0pMthlw8rTgS/C9hrjne+NEnnSNevCjtdodd7i15I59jMBYciHifZ/vjg0NY+Jl+USTc3dBE+0h/4tdYjMKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.4.0" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/resolver-base": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@pnpm/resolver-base/-/resolver-base-11.0.0.tgz", + "integrity": "sha512-oxfjO8Ie6aBQPXSqOWGJP9s0xj9Z4cbRI7fK63WKhjwmNH4CTrSfikRL2o4FoXo2APAbJEUp2lCxx+86dq2tUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pnpm/types": "9.4.0" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/types": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@pnpm/types/-/types-9.4.0.tgz", + "integrity": "sha512-IRDuIuNobLRQe0UyY2gbrrTzYS46tTNvOEfL6fOf0Qa8NyxUzeXz946v7fQuQE3LSBf8ENBC5SXhRmDl+mBEqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/workspace.pkgs-graph": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@pnpm/workspace.pkgs-graph/-/workspace.pkgs-graph-2.0.11.tgz", + "integrity": "sha512-VRX7E7pX92C0akCMYGzsTqJoOwQS7/8R40pAPK7smgaEpKeEgVThqnIXt+wPdseD5CzS7OzMaIWlT3WXr3O5rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pnpm/npm-package-arg": "^1.0.0", + "@pnpm/npm-resolver": "18.0.0", + "@pnpm/resolve-workspace-range": "5.0.1", + "ramda": "npm:@pnpm/ramda@0.28.1" + }, + "engines": { + "node": ">=16.14" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, + "node_modules/@pnpm/workspace.pkgs-graph/node_modules/ramda": { + "name": "@pnpm/ramda", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@pnpm/ramda/-/ramda-0.28.1.tgz", + "integrity": "sha512-zcAG+lvU0fMziNeGXpPyCyCJYp5ZVrPElEE4t14jAmViaihohocZ+dDkcRIyAomox8pQsuZnv1EyHR+pOhmUWw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ramda" + } + }, "node_modules/@redis/bloom": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz", @@ -2073,6 +2368,34 @@ "dev": true, "license": "(Unlicense OR Apache-2.0)" }, + "node_modules/@snyk/github-codeowners": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@snyk/github-codeowners/-/github-codeowners-1.1.0.tgz", + "integrity": "sha512-lGFf08pbkEac0NYgVf4hdANpAgApRjNByLXB+WBip3qj1iendOIyAwP2GKkKbQMNVy2r1xxDf0ssfWscoiC+Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^4.1.1", + "ignore": "^5.1.8", + "p-map": "^4.0.0" + }, + "bin": { + "github-codeowners": "dist/cli.js" + }, + "engines": { + "node": ">=8.10" + } + }, + "node_modules/@snyk/github-codeowners/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, "node_modules/@teppeis/multimaps": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@teppeis/multimaps/-/multimaps-3.0.0.tgz", @@ -2620,6 +2943,29 @@ "dev": true, "license": "ISC" }, + "node_modules/@zkochan/retry": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@zkochan/retry/-/retry-0.2.0.tgz", + "integrity": "sha512-WhB+2B/ZPlW2Xy/kMJBrMbqecWXcbDDgn0K0wKBAgO2OlBTz1iLJrRWduo+DGGn0Akvz1Lu4Xvls7dJojximWw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/@zkochan/rimraf": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@zkochan/rimraf/-/rimraf-2.1.3.tgz", + "integrity": "sha512-mCfR3gylCzPC+iqdxEA6z5SxJeOgzgbwmyxanKriIne5qZLswDe/M43aD3p5MNzwzXRhbZg/OX+MpES6Zk1a6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=12.10" + } + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -2945,6 +3291,13 @@ "dev": true, "license": "MIT" }, + "node_modules/arity-n": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arity-n/-/arity-n-1.0.4.tgz", + "integrity": "sha512-fExL2kFDC1Q2DUOx3whE/9KoN66IzkY4b4zUHUBFM1ojEYjZZYDcUW3bek/ufGionX9giIKDC5redH2IlGqcQQ==", + "dev": true, + "license": "MIT" + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -2958,6 +3311,19 @@ "dev": true, "license": "MIT" }, + "node_modules/array-last": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz", + "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -3034,6 +3400,16 @@ "proxy-from-env": "^2.1.0" } }, + "node_modules/babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true, + "license": "MIT", + "bin": { + "babylon": "bin/babylon.js" + } + }, "node_modules/bail": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", @@ -3107,9 +3483,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.16", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.16.tgz", - "integrity": "sha512-Lyf3aK28zpsD1yQMiiHD4RvVb6UdMoo8xzG2XzFIfR9luPzOpcBlAsT/qfB1XWS1bxWT+UtE4WmQgsp297FYOA==", + "version": "2.10.17", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.17.tgz", + "integrity": "sha512-HdrkN8eVG2CXxeifv/VdJ4A4RSra1DTW8dc/hdxzhGHN8QePs6gKaWM9pHPcpCoxYZJuOZ8drHmbdpLHjCYjLA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -3211,6 +3587,17 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, + "node_modules/bole": { + "version": "5.0.28", + "resolved": "https://registry.npmjs.org/bole/-/bole-5.0.28.tgz", + "integrity": "sha512-l+yybyZLV7zTD6EuGxoXsilpER1ctMCpdOqjSYNigJJma39ha85fzCtYccPx06oR1u7uCQLOcUAFFzvfXVBmuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-safe-stringify": "^2.0.7", + "individual": "^3.0.0" + } + }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -3333,6 +3720,16 @@ "node": ">=4" } }, + "node_modules/builtins": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.1.0.tgz", + "integrity": "sha512-SW9lzGTLvWTP1AY8xeAMZimqDrIaSdLQUcVr9DMef51niJ022Ri87SwRRKYm4A6iHfkPaiVUu/Duw2Wc4J7kKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -3435,6 +3832,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/camelcase-keys/node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001787", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001787.tgz", @@ -3933,6 +4343,16 @@ "dot-prop": "^5.1.0" } }, + "node_modules/compose-function": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/compose-function/-/compose-function-3.0.3.tgz", + "integrity": "sha512-xzhzTJ5eC+gmIzvZq+C3kCJHsp9os6tJkrigDRZclyGtOKINbZtE8n1Tzmeh32jW+BUDPbvZpibwvJHBLGMVwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "arity-n": "^1.0.4" + } + }, "node_modules/compress-commons": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz", @@ -4362,6 +4782,16 @@ "node": ">=8" } }, + "node_modules/data-uri-to-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", + "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, "node_modules/dateformat": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", @@ -4515,22 +4945,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/del/node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -4596,17 +5010,6 @@ "node": ">=0.3.1" } }, - "node_modules/dinero.js": { - "version": "2.0.0-alpha.13", - "resolved": "https://registry.npmjs.org/dinero.js/-/dinero.js-2.0.0-alpha.13.tgz", - "integrity": "sha512-xuBgE/3/67SXOW/UKjmaRd/YJQkUSlYS+6DvfglFg1Mbfn2K7cp+WQcgU76CLJpJPkJABgILsPjw1Om9OJ5puA==", - "license": "MIT", - "dependencies": { - "@dinero.js/calculator-number": "2.0.0-alpha.13", - "@dinero.js/core": "2.0.0-alpha.13", - "@dinero.js/currencies": "2.0.0-alpha.13" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -4696,6 +5099,29 @@ "dev": true, "license": "MIT" }, + "node_modules/easy-table": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.2.0.tgz", + "integrity": "sha512-OFzVOv03YpvtcWGe5AayU5G2hgybsg3iqA6drU8UaoZyB9jLGMTrz9+asnLp/E+6qPh88yEI1gvyZFZ41dmgww==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "optionalDependencies": { + "wcwidth": "^1.0.1" + } + }, + "node_modules/easy-table/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -4716,6 +5142,19 @@ "dev": true, "license": "MIT" }, + "node_modules/encode-registry": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/encode-registry/-/encode-registry-3.0.1.tgz", + "integrity": "sha512-6qOwkl1g0fv0DN3Y3ggr2EaZXN71aoAqPp3p/pVaWSBSIo+YjLOWN61Fva43oVyQNPf7kgm8lkudzlzojwE2jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mem": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -5261,6 +5700,13 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", @@ -5288,6 +5734,21 @@ "reusify": "^1.0.4" } }, + "node_modules/fetch-blob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-2.1.2.tgz", + "integrity": "sha512-YKqtUDwqLyfyMnmbw8XD6Q8j9i/HggKtPEI+pZ1+8bvheBu78biSmNaXWusx1TauGqtUUGx/cBb1mKdq2rLYow==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10.17.0 || >=12.3.0" + }, + "peerDependenciesMeta": { + "domexception": { + "optional": true + } + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -5340,6 +5801,16 @@ "node": ">=8" } }, + "node_modules/filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/finalhandler": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", @@ -6108,6 +6579,13 @@ "node": ">=8" } }, + "node_modules/has-own-property": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/has-own-property/-/has-own-property-0.1.0.tgz", + "integrity": "sha512-14qdBKoonU99XDhWcFKZTShK+QV47qU97u8zzoVo9cL5TZ3BmBHXogItSt9qJjR0KUMFRhcCW8uGIGl8nkl7Aw==", + "dev": true, + "license": "MIT" + }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", @@ -6229,6 +6707,19 @@ "node": ">=10" } }, + "node_modules/hosted-git-info/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -6319,6 +6810,13 @@ "node": ">=0.10.0" } }, + "node_modules/identity-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/identity-function/-/identity-function-1.0.0.tgz", + "integrity": "sha512-kNrgUK0qI+9qLTBidsH85HjDLpZfrrS0ElquKKe/fJFdB3D7VeKdXXEvOPDUHSHOzdZKCAAaQIWWyp0l2yq6pw==", + "dev": true, + "license": "public domain" + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -6410,6 +6908,12 @@ "node": ">=8" } }, + "node_modules/individual": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/individual/-/individual-3.0.0.tgz", + "integrity": "sha512-rUY5vtT748NMRbEMrTNiFfy29BgGZwGXUi2NFUVMWQrogSLzlJvQV9eeMWi+g1aVaQ53tpyLAQtd5x/JH0Nh1g==", + "dev": true + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -6667,14 +7171,24 @@ "node": ">=8" } }, + "node_modules/is-iterable": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-iterable/-/is-iterable-1.1.1.tgz", + "integrity": "sha512-EdOZCr0NsGE00Pot+x1ZFx9MJK3C6wy91geZpXwvwexDLJvA4nzYyZf7r+EIwSeVsOLDdBz7ATg9NqKTzuNYuQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "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==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=0.12.0" + "node": ">=0.10.0" } }, "node_modules/is-obj": { @@ -6898,6 +7412,19 @@ "node": ">=8" } }, + "node_modules/istanbul-lib-processinfo/node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/istanbul-lib-report": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", @@ -6971,6 +7498,16 @@ "node": ">=8" } }, + "node_modules/iterable-lookahead": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/iterable-lookahead/-/iterable-lookahead-1.0.0.tgz", + "integrity": "sha512-hJnEP2Xk4+44DDwJqUQGdXal5VbyeWLaPyDl2AQc242Zr7iqz4DgpQOrEzglWVMGHMDCkguLHEKxd1+rOsmgSQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/jackspeak": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", @@ -6997,6 +7534,16 @@ "node": ">= 0.6.0" } }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "bin/jiti.js" + } + }, "node_modules/joi": { "version": "17.7.0", "resolved": "https://registry.npmjs.org/joi/-/joi-17.7.0.tgz", @@ -7224,6 +7771,130 @@ "node": "^12.20.0 || >=14" } }, + "node_modules/knip": { + "version": "2.43.0", + "resolved": "https://registry.npmjs.org/knip/-/knip-2.43.0.tgz", + "integrity": "sha512-xXtBpC+XiHZzqBoXtvqH0sLV3iSMu9yPIUoP9GRZVUHAegQyDjC4jOTRfFgc5gJKrfqW4NKc71t7l85NqYieUg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@ericcornelissen/bash-parser": "^0.5.2", + "@npmcli/map-workspaces": "^3.0.4", + "@pkgjs/parseargs": "0.11.0", + "@pnpm/logger": "5.0.0", + "@pnpm/workspace.pkgs-graph": "2.0.11", + "@snyk/github-codeowners": "^1.1.0", + "chalk": "^5.2.0", + "easy-table": "^1.2.0", + "fast-glob": "3.3.2", + "globby": "^13.1.3", + "jiti": "1.21.0", + "js-yaml": "^4.1.0", + "micromatch": "^4.0.5", + "minimist": "^1.2.8", + "pretty-ms": "^8.0.0", + "strip-json-comments": "^5.0.0", + "summary": "^2.1.0", + "typescript": "^5.0.2", + "zod": "3.22.4", + "zod-validation-error": "1.5.0" + }, + "bin": { + "knip": "dist/cli.js" + }, + "engines": { + "node": ">=16.17.0 <17 || >=18.6.0" + } + }, + "node_modules/knip/node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/knip/node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/knip/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/knip/node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/knip/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/knip/node_modules/strip-json-comments": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz", + "integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/knuth-shuffle-seeded": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/knuth-shuffle-seeded/-/knuth-shuffle-seeded-1.0.6.tgz", @@ -7269,43 +7940,29 @@ "license": "MIT" }, "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-6.2.0.tgz", + "integrity": "sha512-gUD/epcRms75Cw8RT1pUdHugZYM5ce64ucs2GEISABwkRsOQr0q2wm/MV2TKThycIe5e0ytRweW2RZxclogCdQ==", "dev": true, "license": "MIT", "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "graceful-fs": "^4.1.15", + "parse-json": "^5.0.0", + "strip-bom": "^4.0.0", + "type-fest": "^0.6.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/load-json-file/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "node_modules/load-json-file/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true, - "license": "MIT", + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/locate-path": { @@ -7344,6 +8001,13 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.curry": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.curry/-/lodash.curry-4.1.1.tgz", + "integrity": "sha512-/u14pXGviLaweY5JI0IUzgzF2J6Ne8INyzAZjImcryjgkZ+ebruBxy2/JaOOkTqScddcYtakjhSaeemV8lR0tA==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.defaults": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", @@ -7560,17 +8224,11 @@ } }, "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } + "license": "ISC" }, "node_modules/luxon": { "version": "3.2.1", @@ -7582,6 +8240,16 @@ "node": ">=12" } }, + "node_modules/magic-string": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.16.0.tgz", + "integrity": "sha512-c4BEos3y6G2qO0B9X7K0FVLOPT9uGrjYwYRLFmDqyl5YMboUviyecnXWp94fJTSMwPw2/sf+CEYt5AGpmklkkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "vlq": "^0.2.1" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -7615,17 +8283,27 @@ "dev": true, "license": "ISC" }, + "node_modules/map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-defer": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha512-TzQSV2DiMYgoF5RycneKVUzIa9bQsj/B3tTgsE3dOGqlzHnGIDaC7XBE7grnA+8kZPnfqSGFe95VHc2oc0VFUQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=4" } }, "node_modules/marked": { @@ -7735,6 +8413,23 @@ "node": ">= 0.6" } }, + "node_modules/mem": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/mem/-/mem-8.1.1.tgz", + "integrity": "sha512-qFCFUDs7U3b8mBDPyz5EToEKoAkgCzqquIgi9nkkR9bixxOVOre+09lbuH7+9Kn2NFpm56M3GUWVbU2hQgdACA==", + "dev": true, + "license": "MIT", + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/mem?sponsor=1" + } + }, "node_modules/meow": { "version": "8.1.2", "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", @@ -7883,13 +8578,13 @@ } }, "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz", + "integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/min-indent": { @@ -8300,6 +8995,41 @@ "dev": true, "license": "MIT" }, + "node_modules/ndjson": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ndjson/-/ndjson-2.0.0.tgz", + "integrity": "sha512-nGl7LRGrzugTtaFcJMhLbpzJM6XdivmbkdlaGcrk/LXg2KL/YBC6z1g70xh0/al+oFuVFP8N8kiWRucmeEH/qQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "json-stringify-safe": "^5.0.1", + "minimist": "^1.2.5", + "readable-stream": "^3.6.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "bin": { + "ndjson": "cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ndjson/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -8644,6 +9374,16 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", + "integrity": "sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -11246,6 +11986,19 @@ "node": ">=8" } }, + "node_modules/nyc/node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/nyc/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -11327,6 +12080,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-pairs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-pairs/-/object-pairs-0.1.0.tgz", + "integrity": "sha512-3ECr6K831I4xX/Mduxr9UC+HPOz/d6WKKYj9p4cmC8Lg8p7g8gitzsxNX5IWlSIgFWN/a4JgrJaoAMKn20oKwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/object-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/object-values/-/object-values-1.0.0.tgz", + "integrity": "sha512-+8hwcz/JnQ9EpLIXzN0Rs7DLsBpJNT/xYehtB/jU93tHYr5BFEO8E+JGQNOSqE7opVzz5cGksKFHt7uUJVLSjQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -11365,6 +12135,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/onetime/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/opener": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", @@ -11427,6 +12207,16 @@ "node": ">=0.10.0" } }, + "node_modules/p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/p-each-series": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.2.0.tgz", @@ -11506,16 +12296,53 @@ } }, "node_modules/p-map": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "dev": true, "license": "MIT", "dependencies": { "aggregate-error": "^3.0.0" }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-memoize": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/p-memoize/-/p-memoize-4.0.1.tgz", + "integrity": "sha512-km0sP12uE0dOZ5qP+s7kGVf07QngxyG0gS8sYFvFWhqlgzOsSy+m71aUejf/0akxj5W7gE//2G74qTv6b4iMog==", + "dev": true, + "license": "MIT", + "dependencies": { + "mem": "^6.0.1", + "mimic-fn": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/p-memoize?sponsor=1" + } + }, + "node_modules/p-memoize/node_modules/mem": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/mem/-/mem-6.1.1.tgz", + "integrity": "sha512-Ci6bIfq/UgcxPTYa8dQQ5FY3BzKkT894bwXWXxC/zqs0XgMO2cT20CGkOqda7gZNkmK5VP4x89IGZ6K7hfbn3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^3.0.0" + }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sindresorhus/mem?sponsor=1" } }, "node_modules/p-reduce": { @@ -11645,6 +12472,42 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-ms": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz", + "integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-npm-tarball-url": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/parse-npm-tarball-url/-/parse-npm-tarball-url-3.0.0.tgz", + "integrity": "sha512-InpdgIdNe5xWMEUcrVQUniQKwnggBtJ7+SCwh7zQAZwbbIYZV9XdgJyhtmDSSvykFyQXoe4BINnzKTfCwWLs5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.1.0" + }, + "engines": { + "node": ">=8.15" + } + }, + "node_modules/parse-npm-tarball-url/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", @@ -11737,12 +12600,18 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-scurry/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==", + "node_modules/path-temp": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/path-temp/-/path-temp-2.1.1.tgz", + "integrity": "sha512-2pIjpQb28baC42ttBsQuRRqZ33a8DnWzfSwEFKJjz7SMiCmBECUOebUNLTmmPCG8F4ZIXG7ZRJ8FAxYXdx0Jiw==", "dev": true, - "license": "ISC" + "license": "MIT", + "dependencies": { + "unique-string": "^2.0.0" + }, + "engines": { + "node": ">=8.15" + } }, "node_modules/path-to-regexp": { "version": "0.1.7", @@ -11938,6 +12807,22 @@ "node": ">=4" } }, + "node_modules/pkg-conf/node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/pkg-conf/node_modules/locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -11988,6 +12873,20 @@ "node": ">=4" } }, + "node_modules/pkg-conf/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/pkg-conf/node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -11998,6 +12897,16 @@ "node": ">=4" } }, + "node_modules/pkg-conf/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -12116,6 +13025,22 @@ "node": ">= 0.8.0" } }, + "node_modules/pretty-ms": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", + "integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse-ms": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -12346,6 +13271,30 @@ "dev": true, "license": "MIT" }, + "node_modules/read-package-json-fast": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz", + "integrity": "sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==", + "dev": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", + "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -12679,6 +13628,35 @@ "node": ">=10" } }, + "node_modules/rename-overwrite": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/rename-overwrite/-/rename-overwrite-4.0.4.tgz", + "integrity": "sha512-5MC+p5npnyaJlFkwTHb0pqU2mkUkkW65ZWH8qwxcDlv+5nchtalcdzG+gaaianbWWwvwxi7vu7WSg6jdCweKug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@zkochan/rimraf": "^2.1.2", + "fs-extra": "10.1.0" + }, + "engines": { + "node": ">=12.10" + } + }, + "node_modules/rename-overwrite/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", @@ -12840,6 +13818,13 @@ "node": ">=0.10.0" } }, + "node_modules/reverse-arguments": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/reverse-arguments/-/reverse-arguments-1.0.0.tgz", + "integrity": "sha512-/x8uIPdTafBqakK0TmPNJzgkLP+3H+yxpUJhCQHsLBg1rYEVNR2D8BRYNWQhVBjyOd7oo1dZRVzIkwMY2oqfYQ==", + "dev": true, + "license": "MIT" + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -12941,6 +13926,7 @@ "version": "7.8.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", + "dev": true, "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" @@ -13184,6 +14170,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -13302,6 +14301,13 @@ "node": ">=8" } }, + "node_modules/shell-quote-word": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/shell-quote-word/-/shell-quote-word-1.0.1.tgz", + "integrity": "sha512-lT297f1WLAdq0A4O+AknIFRP6kkiI3s8C913eJ0XqBxJbZPGWUNkRQk2u8zk4bEAjUJ5i+fSLwB6z1HzeT+DEg==", + "dev": true, + "license": "MIT" + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -13692,6 +14698,19 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/ssri": { + "version": "10.0.5", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", + "integrity": "sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/stackframe": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz", @@ -13777,6 +14796,12 @@ "node": ">=8" } }, + "node_modules/string.fromcodepoint": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/string.fromcodepoint/-/string.fromcodepoint-0.2.1.tgz", + "integrity": "sha512-n69H31OnxSGSZyZbgBlvYIXlrMhJQ0dQAX1js1QDhpaUH6zmU3QYlj07bCwCNlPOu3oRXIubGPl2gDGnHsiCqg==", + "dev": true + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -13870,6 +14895,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/summary": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/summary/-/summary-2.1.0.tgz", + "integrity": "sha512-nMIjMrd5Z2nuB2RZCKJfFMjgS3fygbeyGk9PxPPaJR1RIcyN9yn4A63Isovzm3ZtQuEkLBVgMdPup8UeLH7aQw==", + "dev": true, + "license": "MIT" + }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -14185,6 +15217,23 @@ "node": ">=14.14" } }, + "node_modules/to-no-case": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz", + "integrity": "sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg==", + "dev": true, + "license": "MIT" + }, + "node_modules/to-pascal-case": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-pascal-case/-/to-pascal-case-1.0.0.tgz", + "integrity": "sha512-QGMWHqM6xPrcQW57S23c5/3BbYb0Tbe9p+ur98ckRnGDwD4wbbtDiYI38CfmMKNB5Iv0REjs5SNDntTwvDxzZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-space-case": "^1.0.0" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -14198,6 +15247,26 @@ "node": ">=8.0" } }, + "node_modules/to-regex-range/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/to-space-case": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz", + "integrity": "sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-no-case": "^1.0.0" + } + }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -14517,6 +15586,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, "license": "0BSD" }, "node_modules/type-check": { @@ -14613,6 +15683,16 @@ "dev": true, "license": "MIT" }, + "node_modules/unescape-js": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/unescape-js/-/unescape-js-1.1.4.tgz", + "integrity": "sha512-42SD8NOQEhdYntEiUQdYq/1V/YHwr1HLwlHuTJB5InVVdOSbgI6xu8jK5q65yIzuFCfczzyDF/7hbGzVbyCw0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "string.fromcodepoint": "^0.2.1" + } + }, "node_modules/unified": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz", @@ -14804,6 +15884,19 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/validate-npm-package-name": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", + "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -14813,6 +15906,19 @@ "node": ">= 0.8" } }, + "node_modules/version-selector-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/version-selector-type/-/version-selector-type-3.0.0.tgz", + "integrity": "sha512-PSvMIZS7C1MuVNBXl/CDG2pZq8EXy/NW2dHIdm3bVP5N0PC8utDK8ttXLXj44Gn3J0lQE3U7Mpm1estAOd+eiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.3.2" + }, + "engines": { + "node": ">=10.13" + } + }, "node_modules/vfile": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz", @@ -14845,6 +15951,13 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/vlq": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", + "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", + "dev": true, + "license": "MIT" + }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -15318,6 +16431,29 @@ "engines": { "node": ">= 6" } + }, + "node_modules/zod": { + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-1.5.0.tgz", + "integrity": "sha512-/7eFkAI4qV0tcxMBB/3+d2c1P6jzzZYdYSlBuAklzMuCrJu5bzJfHS0yVAS87dRHVlhftd6RFJDIvv03JgkSbw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "zod": "^3.18.0" + } } } } diff --git a/package.json b/package.json index 9d9f902f..7da4a193 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "prestart": "npm run build", "start": "cd dist && node src/index.js", "build:check": "npm run build -- --noEmit", - "lint": "eslint --ext .ts ./src ./test", + "knip": "knip --config .knip.json --production --include files,dependencies --no-progress --reporter compact", + "lint": "npm run knip && eslint --ext .ts ./src ./test", "lint:report": "eslint -o .lint-reports/eslint.json -f json --ext .ts ./src ./test", "lint:fix": "npm run lint -- --fix", "import": "node -r ts-node/register src/import-events.ts", @@ -100,10 +101,12 @@ "cz-conventional-changelog": "3.3.0", "eslint": "^8.13.0", "husky": "8.0.2", + "knip": "2.43.0", "mocha": "^9.2.2", "mochawesome": "^7.1.3", "nyc": "^15.1.0", "rimraf": "^3.0.2", + "rxjs": "7.8.0", "semantic-release": "19.0.5", "semantic-release-telegram": "1.6.0", "sinon": "15.0.1", @@ -118,9 +121,7 @@ "@noble/secp256k1": "1.7.1", "axios": "^1.7.7", "bech32": "2.0.0", - "body-parser": "1.20.1", "debug": "4.3.4", - "dinero.js": "2.0.0-alpha.13", "dotenv": "16.0.3", "express": "4.18.2", "helmet": "6.0.1", @@ -131,7 +132,6 @@ "pg-query-stream": "4.3.0", "ramda": "0.28.0", "redis": "4.5.1", - "rxjs": "7.8.0", "tor-control-ts": "^1.0.0", "ws": "^8.18.0" }, diff --git a/src/@types/runes.ts b/src/@types/runes.ts deleted file mode 100644 index 3443cc48..00000000 --- a/src/@types/runes.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface IAlternative { - test(values: Record): string | undefined - encode(): string -} - -export interface IRestriction { - test(values: Record): string | undefined - encode(): string -} - -export interface IRuneLike { - test(values: Record): [boolean, string] - encode(): string -} diff --git a/src/constants/payments.ts b/src/constants/payments.ts deleted file mode 100644 index ac9b638d..00000000 --- a/src/constants/payments.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum FeeSchedules { - ADMISSION = 'admission', - PUBLICATION = 'publication' -} diff --git a/src/schemas/http-request-schemas.ts b/src/schemas/http-request-schemas.ts deleted file mode 100644 index f2bd5028..00000000 --- a/src/schemas/http-request-schemas.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Schema from 'joi' - -import { pubkeySchema } from './base-schema' - - -export const generateInvoiceSchema = Schema.object({ - pubkey: pubkeySchema.required(), - tosAccepted: Schema.valid('yes').required(), -}).unknown(false) diff --git a/src/utils/runes/alternative.ts b/src/utils/runes/alternative.ts deleted file mode 100644 index e9977e9f..00000000 --- a/src/utils/runes/alternative.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { IAlternative } from '../../@types/runes' - -const punctuations = /[!"#$%&'()*+-./:;<=>?@[\\\]^`{|}~]/ - -const hasPunctuation = (input: string) => punctuations.test(input) - -// Reference: https://github.com/rustyrussell/runes/blob/master/runes/runes.py - -export class Alternative implements IAlternative { - public constructor( - private readonly field: string, - private readonly cond: string, - private readonly value: string, - ) { - if (Array.from(this.field).some(hasPunctuation)) { - throw Error('Field is not valid') - } - - if (!new Set(['!', '=', '/', '^', '$', '~', '<', '>', '}', '{', '#']).has(this.cond)) { - throw new Error('Cond is not valid') - } - } - - public test(values: Record): string | undefined { - if (this.cond === '#') { - return - } - - const why = (cond: boolean, field: string, explanation: string): string | undefined => - (cond) ? undefined : `${field}: ${explanation}` - - if (!(this.field in values)) { - return why(this.cond === '!', this.field, 'is missing') - } - - if (typeof values[this.field] === 'function') { - return values[this.field](this) - } - - const val = String(values[this.field]) - - switch (this.cond) { - case '!': - return why(false, this.field, 'is present') - case '=': - return why(val === this.value, this.field, `!= ${this.value}`) - case '/': - return why(val !== this.value, this.field, `= ${this.value}`) - case '^': - return why(val.startsWith(this.value), this.field, `does not start with ${this.value}`) - case '$': - return why(val.endsWith(this.value), this.field, `does not end with ${this.value}`) - case '~': - return why(values[this.field].includes(this.value), this.field, `does not contain ${this.value}`) - case '<': - case '>': - { - const actualInt = Number.parseInt(val) - if (Number.isNaN(actualInt)) { - return why(false, this.field, 'not an integer field') - } - const restrictionVal = Number.parseInt(this.value) - if (Number.isNaN(restrictionVal)) { - return why(false, this.field, 'not a valid integer') - } - - if (this.cond === '<') { - return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`) - } else { - return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`) - } - } - case '{': - return why(val < this.value, this.field, `is the same or ordered after ${this.value}`) - case '}': - return why(val > this.value, this.field, `is the same or ordered before ${this.value}`) - } - } - - public encode(): string { - return `${this.field}${this.cond}${this.value.replace(/[\\|&]/g, '\\$&')}` - } - - public static decode(encodedStr: string): [IAlternative, string] { - let cond = undefined - let endOff = 0 - - while (endOff < encodedStr.length) { - if (hasPunctuation(encodedStr[endOff])) { - cond = encodedStr[endOff] - break - } - endOff++ - } - - if (typeof cond === 'undefined') { - throw new Error(`${encodedStr} does not contain any operator`) - } - - const field = encodedStr.slice(0, endOff++) - - let value = '' - - while (endOff < encodedStr.length) { - if (encodedStr[endOff] === '|') { - endOff++ - break - } - - if (encodedStr[endOff] === '&') { - break - } - - if (encodedStr[endOff] === '\\') { - endOff++ - } - - value += encodedStr[endOff++] - } - - return [new Alternative(field, cond, value), encodedStr.slice(endOff)] - } - - public static from(encodedStr: string): IAlternative { - const [field, cond, value] = encodedStr.replace(/\s+/g, '').split(new RegExp(`(${punctuations.source})`, 'g')) - - return new Alternative(field, cond, value) - } -} - - diff --git a/src/utils/runes/restriction.ts b/src/utils/runes/restriction.ts deleted file mode 100644 index 7381617b..00000000 --- a/src/utils/runes/restriction.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { IAlternative, IRestriction } from '../../@types/runes' -import { Alternative } from './alternative' - - -export class Restriction implements IRestriction { - public constructor( - private readonly alternatives: IAlternative[] - ) { - if (!alternatives.length) { - throw new Error('Restriction must have some alternatives') - } - } - - public test(values: Record): string | undefined { - const reasons: string[] = [] - for (const alternative of this.alternatives) { - const reason = alternative.test(values) - if (typeof reason === 'undefined') { - return - } - reasons.push(reason) - } - - return reasons.join(' AND ') - } - - public encode(): string { - return this.alternatives.map((alternative) => alternative.encode()).join('|') - } - - public static decode(encodedStr: string): [IRestriction, string] { - let encStr = encodedStr - let alternative: IAlternative - const alternatives: IAlternative[] = [] - while (encStr.length) { - if (encStr.startsWith('&')) { - encStr = encStr.slice(1) - break - } - - [alternative, encStr] = Alternative.decode(encStr) - - alternatives.push(alternative) - } - - return [new Restriction(alternatives), encStr] - } -} diff --git a/src/utils/runes/rune-like.ts b/src/utils/runes/rune-like.ts deleted file mode 100644 index 6e456974..00000000 --- a/src/utils/runes/rune-like.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { IRestriction, IRuneLike } from '../../@types/runes' -import { Restriction } from './restriction' - - -export class RuneLike implements IRuneLike { - public constructor( - private readonly restrictions: IRestriction[] - ) { } - - public test(values: Record): [boolean, string] { - for (const restriction of this.restrictions) { - const reasons = restriction.test(values) - if (typeof reasons !== 'undefined') { - return [false, reasons] - } - } - - return [true, ''] - } - - public encode(): string { - return this.restrictions.map((restriction) => restriction.encode()).join('&') - } - - public static from(encodedStr: string): IRuneLike { - const restrictions: IRestriction[] = [] - let restriction: IRestriction - let encStr = encodedStr.replace(/\s+/g, '') - - while (encStr.length) { - [restriction, encStr] = Restriction.decode(encStr) - restrictions.push(restriction) - } - - return new RuneLike(restrictions) - } -} diff --git a/test/unit/utils/runes.spec.ts b/test/unit/utils/runes.spec.ts deleted file mode 100644 index f3fbafba..00000000 --- a/test/unit/utils/runes.spec.ts +++ /dev/null @@ -1,347 +0,0 @@ -import { expect } from 'chai' -import sinon from 'sinon' - -import { Alternative } from '../../../src/utils/runes/alternative' -import { Restriction } from '../../../src/utils/runes/restriction' - -describe('Alternative', () => { - describe('constructor', () => { - it('throw error if field has punctuations', () => { - expect(() => new Alternative('%', '=', 'value')).to.throw(Error, 'Field is not valid') - }) - - it('throw error if cond is not valid', () => { - expect(() => new Alternative('field', '@', 'value')).to.throw(Error, 'Cond is not valid') - }) - - it('returns an Alternative if given valid fields', () => { - expect(new Alternative('field', '=', 'value')).to.be.an.instanceOf(Alternative) - }) - }) - - describe('test', () => { - it('returns undefined always if rule is #', () => { - expect(new Alternative('', '#', '').test({})).to.be.undefined - }) - - it('returns reason if field not present with rule field=value', () => { - expect(new Alternative('field', '=', 'value').test({})).to.equal('field: is missing') - }) - - it('returns undefined if field is not present with rule field!', () => { - expect(new Alternative('field', '!', '').test({})).to.be.undefined - }) - - it('returns reason if field is present with rule field!', () => { - expect(new Alternative('field', '!', '').test({ field: 'value' })).to.equal('field: is present') - }) - - it('calls function if field is a function', () => { - const spy = sinon.fake.returns('reason') - const alternative = new Alternative('field', '=', 'value') - - const result = alternative.test({ field: spy }) - - expect(spy).to.have.been.calledOnceWithExactly(alternative) - expect(result).to.equal('reason') - }) - - it('returns reason if field not equals value with rule field=value', () => { - expect(new Alternative('field', '=', 'value').test({ field: 'not value' })).to.equal('field: != value') - }) - - it('returns undefined if field equals value with rule field=value', () => { - expect(new Alternative('field', '=', 'value').test({ field: 'value' })).to.be.undefined - }) - - it('returns undefined if field not equals value with rule field/value', () => { - expect(new Alternative('field', '/', 'value').test({ field: 'not value' })).to.be.undefined - }) - - it('returns reason if field equals value with rule field/value', () => { - expect(new Alternative('field', '/', 'value').test({ field: 'value' })).to.equal('field: = value') - }) - - it('returns undefined if field starts with value with rule field^value', () => { - expect(new Alternative('field', '^', 'value').test({ field: 'value <- here' })).to.be.undefined - }) - - it('returns reason if field does not start value with rule field^value', () => { - expect(new Alternative('field', '^', 'value').test({ field: 'nope' })).to.equal('field: does not start with value') - }) - - it('returns undefined if field ends with value with rule field$value', () => { - expect(new Alternative('field', '$', 'value').test({ field: 'ends -> value' })).to.be.undefined - }) - - it('returns reason if field does not end value with rule field$value', () => { - expect(new Alternative('field', '$', 'value').test({ field: 'nope' })).to.equal('field: does not end with value') - }) - - it('returns undefined if field contains value with in string rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: '-> value <-' })).to.be.undefined - }) - - it('returns reason if field does not contain value in string with rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: 'nope' })).to.equal('field: does not contain value') - }) - - it('returns undefined if field contains value in array with rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: ['value'] })).to.be.undefined - }) - - it('returns reason if field does not contain value in array with rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: [] })).to.equal('field: does not contain value') - }) - - - - - it('returns undefined if field is less than value with rule field { - expect(new Alternative('field', '<', '0').test({ field: -1 })).to.be.undefined - }) - - it('returns reason if field does not less than value with rule field { - expect(new Alternative('field', '<', '0').test({ field: 0 })).to.equal('field: >= 0') - }) - - it('returns undefined if field is greater than value with rule field>value', () => { - expect(new Alternative('field', '>', '0').test({ field: 1 })).to.be.undefined - }) - - it('returns reason if field does not greater than value with rule field>value', () => { - expect(new Alternative('field', '>', '0').test({ field: 0 })).to.equal('field: <= 0') - }) - - it('returns reason if field is not an integer with rule field { - expect(new Alternative('field', '<', '0').test({ field: 'not an integer' })).to.equal('field: not an integer field') - }) - - it('returns reason if field is not an integer with rule field>value', () => { - expect(new Alternative('field', '>', '0').test({ field: 'not an integer' })).to.equal('field: not an integer field') - }) - - it('returns reason if field is not an integer with rule field { - expect(new Alternative('field', '<', 'not an integer').test({ field: 1 })).to.equal('field: not a valid integer') - }) - - it('returns reason if field is not an integer with rule field>value', () => { - expect(new Alternative('field', '>', 'not an integer').test({ field: 1 })).to.equal('field: not a valid integer') - }) - - - - it('returns undefined if field is same as value with rule field{value', () => { - expect(new Alternative('field', '{', 'b').test({ field: 'b' })).to.equal('field: is the same or ordered after b') - }) - - it('returns undefined if field is ordered before value with rule field{value', () => { - expect(new Alternative('field', '{', 'b').test({ field: 'a' })).to.be.undefined - }) - - it('returns reason if field is ordered after value with rule field{value', () => { - expect(new Alternative('field', '{', 'b').test({ field: 'c' })).to.equal('field: is the same or ordered after b') - }) - - it('returns undefined if field is same as value with rule field}value', () => { - expect(new Alternative('field', '}', 'b').test({ field: 'b' })).to.equal('field: is the same or ordered before b') - }) - - it('returns undefined if field is ordered after value with rule field}value', () => { - expect(new Alternative('field', '}', 'b').test({ field: 'c' })).to.be.undefined - }) - - it('returns reason if field is ordered before value with rule field}value', () => { - expect(new Alternative('field', '}', 'b').test({ field: 'a' })).to.equal('field: is the same or ordered before b') - }) - }) - - describe('encode', () => { - it('returns encoded alternative field = value', () => { - expect(new Alternative('field', '=', 'value').encode()).to.equal('field=value') - }) - - it('returns encoded alternative #', () => { - expect(new Alternative('', '#', '').encode()).to.equal('#') - }) - - it('returns encoded alternative field!', () => { - expect(new Alternative('field', '!', '').encode()).to.equal('field!') - }) - - it('returns encoded alternative field=\\|&', () => { - expect(new Alternative('field', '=', '\\|&').encode()).to.equal('field=\\\\\\|\\&') - }) - }) - - describe('decode', () => { - it('decodes #', () => { - const [alternative] = Alternative.decode('#') - expect(alternative.encode()).to.equal('#') - }) - - it('decodes field!', () => { - const [alternative] = Alternative.decode('field!') - expect(alternative.encode()).to.equal('field!') - }) - - it('decodes field=value', () => { - const [alternative] = Alternative.decode('field=value') - expect(alternative.encode()).to.equal('field=value') - }) - - it('decodes field=\\\\\\|\\&', () => { - const [alternative] = Alternative.decode('field=\\\\\\|\\&') - expect(alternative.encode()).to.equal('field=\\\\\\|\\&') - }) - - it('throw error decoding value', () => { - expect(() => Alternative.decode('value')).to.throw(Error, 'value does not contain any operator') - }) - - it('decodes until first | and consumes it', () => { - const [alternative, remainder] = Alternative.decode('a=1|b=2') - expect(alternative.encode()).to.equal('a=1') - expect(remainder).to.equal('b=2') - }) - - it('decodes until first &', () => { - const [alternative, remainder] = Alternative.decode('a=1&b=2') - expect(alternative.encode()).to.equal('a=1') - expect(remainder).to.equal('&b=2') - }) - }) - - describe('from', () => { - it('creates alternative rule with spaces "field = value"', () => { - expect(Alternative.from('field = value').encode()).to.equal('field=value') - }) - }) -}) - -describe('Restriction', () => { - describe('constructor', () => { - it('throws if given alternatives list is empty', () => [ - expect(() => new Restriction([])).to.throw(Error, 'Restriction must have some alternatives'), - ]) - }) - - describe('test', () => { - it('returns undefined given 1 true alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns(undefined) }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns undefined given 2 true alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns(undefined) }, - { test: sinon.fake.returns(undefined) }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).not.to.have.been.called - }) - - it('returns undefined given 1 true and 1 false alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns(undefined) }, - { test: sinon.fake.returns('reason') }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).not.to.have.been.called - }) - - it('returns reason given 1 false alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns('reason') }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.equal('reason') - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns undefined given 1 false and 1 true alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns('reason') }, - { test: sinon.fake.returns(undefined) }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns reasons given 2 false alternatives', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns('reason 1') }, - { test: sinon.fake.returns('reason 2') }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.equal('reason 1 AND reason 2') - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).to.have.been.calledOnceWithExactly(values) - }) - }) - - describe('encode', () => { - it('returns encoded restriction with 1 alternative', () => { - const alternatives: Alternative[] = [ - { encode: sinon.fake.returns('a=1') }, - ] as any - - expect(new Restriction(alternatives).encode()).to.equal('a=1') - }) - - - it('returns encoded restrictions with 2 alternatives', () => { - const alternatives: Alternative[] = [ - { encode: sinon.fake.returns('a=1') }, - { encode: sinon.fake.returns('b=2') }, - ] as any - - expect(new Restriction(alternatives).encode()).to.equal('a=1|b=2') - }) - }) - - describe('decode', () => { - it('returns encoded restriction given 1 alternative', () => { - const [restriction, remainder] = Restriction.decode('a=1') - - expect(restriction.encode()).to.equal('a=1') - expect(remainder).to.be.empty - }) - - it('returns encoded restriction given 2 alternatives', () => { - const [restriction, remainder] = Restriction.decode('a=1|b=2') - - expect(restriction.encode()).to.equal('a=1|b=2') - expect(remainder).to.be.empty - }) - - it('returns encoded restriction given 2 alternatives and another restriction', () => { - const [restriction, remainder] = Restriction.decode('a=1|b=2&c=1') - - expect(restriction.encode()).to.equal('a=1|b=2') - expect(remainder).to.equal('c=1') - }) - }) -}) diff --git a/test/unit/utils/runes/alternative.spec.ts b/test/unit/utils/runes/alternative.spec.ts deleted file mode 100644 index 54c3b22d..00000000 --- a/test/unit/utils/runes/alternative.spec.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { expect } from 'chai' -import sinon from 'sinon' - -import { Alternative } from '../../../../src/utils/runes/alternative' - -describe('Alternative', () => { - describe('constructor', () => { - it('throw error if field has punctuations', () => { - expect(() => new Alternative('%', '=', 'value')).to.throw(Error, 'Field is not valid') - }) - - it('throw error if cond is not valid', () => { - expect(() => new Alternative('field', '@', 'value')).to.throw(Error, 'Cond is not valid') - }) - - it('returns an Alternative if given valid fields', () => { - expect(new Alternative('field', '=', 'value')).to.be.an.instanceOf(Alternative) - }) - }) - - describe('test', () => { - it('returns undefined always if rule is #', () => { - expect(new Alternative('', '#', '').test({})).to.be.undefined - }) - - it('returns reason if field not present with rule field=value', () => { - expect(new Alternative('field', '=', 'value').test({})).to.equal('field: is missing') - }) - - it('returns undefined if field is not present with rule field!', () => { - expect(new Alternative('field', '!', '').test({})).to.be.undefined - }) - - it('returns reason if field is present with rule field!', () => { - expect(new Alternative('field', '!', '').test({ field: 'value' })).to.equal('field: is present') - }) - - it('calls function if field is a function', () => { - const spy = sinon.fake.returns('reason') - const alternative = new Alternative('field', '=', 'value') - - const result = alternative.test({ field: spy }) - - expect(spy).to.have.been.calledOnceWithExactly(alternative) - expect(result).to.equal('reason') - }) - - it('returns reason if field not equals value with rule field=value', () => { - expect(new Alternative('field', '=', 'value').test({ field: 'not value' })).to.equal('field: != value') - }) - - it('returns undefined if field equals value with rule field=value', () => { - expect(new Alternative('field', '=', 'value').test({ field: 'value' })).to.be.undefined - }) - - it('returns undefined if field not equals value with rule field/value', () => { - expect(new Alternative('field', '/', 'value').test({ field: 'not value' })).to.be.undefined - }) - - it('returns reason if field equals value with rule field/value', () => { - expect(new Alternative('field', '/', 'value').test({ field: 'value' })).to.equal('field: = value') - }) - - it('returns undefined if field starts with value with rule field^value', () => { - expect(new Alternative('field', '^', 'value').test({ field: 'value <- here' })).to.be.undefined - }) - - it('returns reason if field does not start value with rule field^value', () => { - expect(new Alternative('field', '^', 'value').test({ field: 'nope' })).to.equal('field: does not start with value') - }) - - it('returns undefined if field ends with value with rule field$value', () => { - expect(new Alternative('field', '$', 'value').test({ field: 'ends -> value' })).to.be.undefined - }) - - it('returns reason if field does not end value with rule field$value', () => { - expect(new Alternative('field', '$', 'value').test({ field: 'nope' })).to.equal('field: does not end with value') - }) - - it('returns undefined if field contains value with in string rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: '-> value <-' })).to.be.undefined - }) - - it('returns reason if field does not contain value in string with rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: 'nope' })).to.equal('field: does not contain value') - }) - - it('returns undefined if field contains value in array with rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: ['value'] })).to.be.undefined - }) - - it('returns reason if field does not contain value in array with rule field~value', () => { - expect(new Alternative('field', '~', 'value').test({ field: [] })).to.equal('field: does not contain value') - }) - - - - - it('returns undefined if field is less than value with rule field { - expect(new Alternative('field', '<', '0').test({ field: -1 })).to.be.undefined - }) - - it('returns reason if field does not less than value with rule field { - expect(new Alternative('field', '<', '0').test({ field: 0 })).to.equal('field: >= 0') - }) - - it('returns undefined if field is greater than value with rule field>value', () => { - expect(new Alternative('field', '>', '0').test({ field: 1 })).to.be.undefined - }) - - it('returns reason if field does not greater than value with rule field>value', () => { - expect(new Alternative('field', '>', '0').test({ field: 0 })).to.equal('field: <= 0') - }) - - it('returns reason if field is not an integer with rule field { - expect(new Alternative('field', '<', '0').test({ field: 'not an integer' })).to.equal('field: not an integer field') - }) - - it('returns reason if field is not an integer with rule field>value', () => { - expect(new Alternative('field', '>', '0').test({ field: 'not an integer' })).to.equal('field: not an integer field') - }) - - it('returns reason if field is not an integer with rule field { - expect(new Alternative('field', '<', 'not an integer').test({ field: 1 })).to.equal('field: not a valid integer') - }) - - it('returns reason if field is not an integer with rule field>value', () => { - expect(new Alternative('field', '>', 'not an integer').test({ field: 1 })).to.equal('field: not a valid integer') - }) - - - - it('returns undefined if field is same as value with rule field{value', () => { - expect(new Alternative('field', '{', 'b').test({ field: 'b' })).to.equal('field: is the same or ordered after b') - }) - - it('returns undefined if field is ordered before value with rule field{value', () => { - expect(new Alternative('field', '{', 'b').test({ field: 'a' })).to.be.undefined - }) - - it('returns reason if field is ordered after value with rule field{value', () => { - expect(new Alternative('field', '{', 'b').test({ field: 'c' })).to.equal('field: is the same or ordered after b') - }) - - it('returns undefined if field is same as value with rule field}value', () => { - expect(new Alternative('field', '}', 'b').test({ field: 'b' })).to.equal('field: is the same or ordered before b') - }) - - it('returns undefined if field is ordered after value with rule field}value', () => { - expect(new Alternative('field', '}', 'b').test({ field: 'c' })).to.be.undefined - }) - - it('returns reason if field is ordered before value with rule field}value', () => { - expect(new Alternative('field', '}', 'b').test({ field: 'a' })).to.equal('field: is the same or ordered before b') - }) - }) - - describe('encode', () => { - it('returns encoded alternative field = value', () => { - expect(new Alternative('field', '=', 'value').encode()).to.equal('field=value') - }) - - it('returns encoded alternative #', () => { - expect(new Alternative('', '#', '').encode()).to.equal('#') - }) - - it('returns encoded alternative field!', () => { - expect(new Alternative('field', '!', '').encode()).to.equal('field!') - }) - - it('returns encoded alternative field=\\|&', () => { - expect(new Alternative('field', '=', '\\|&').encode()).to.equal('field=\\\\\\|\\&') - }) - }) - - describe('decode', () => { - it('decodes #', () => { - const [alternative] = Alternative.decode('#') - expect(alternative.encode()).to.equal('#') - }) - - it('decodes field!', () => { - const [alternative] = Alternative.decode('field!') - expect(alternative.encode()).to.equal('field!') - }) - - it('decodes field=value', () => { - const [alternative] = Alternative.decode('field=value') - expect(alternative.encode()).to.equal('field=value') - }) - - it('decodes field=\\\\\\|\\&', () => { - const [alternative] = Alternative.decode('field=\\\\\\|\\&') - expect(alternative.encode()).to.equal('field=\\\\\\|\\&') - }) - - it('throw error decoding value', () => { - expect(() => Alternative.decode('value')).to.throw(Error, 'value does not contain any operator') - }) - - it('decodes until first | and consumes it', () => { - const [alternative, remainder] = Alternative.decode('a=1|b=2') - expect(alternative.encode()).to.equal('a=1') - expect(remainder).to.equal('b=2') - }) - - it('decodes until first &', () => { - const [alternative, remainder] = Alternative.decode('a=1&b=2') - expect(alternative.encode()).to.equal('a=1') - expect(remainder).to.equal('&b=2') - }) - }) - - describe('from', () => { - it('creates alternative rule with spaces "field = value"', () => { - expect(Alternative.from('field = value').encode()).to.equal('field=value') - }) - }) -}) diff --git a/test/unit/utils/runes/restriction.spec.ts b/test/unit/utils/runes/restriction.spec.ts deleted file mode 100644 index 5a6982ee..00000000 --- a/test/unit/utils/runes/restriction.spec.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { expect } from 'chai' -import sinon from 'sinon' - -import { Alternative } from '../../../../src/utils/runes/alternative' -import { Restriction } from '../../../../src/utils/runes/restriction' - -describe('Restriction', () => { - describe('constructor', () => { - it('throws if given alternatives list is empty', () => { - expect(() => new Restriction([])).to.throw(Error, 'Restriction must have some alternatives') - }) - }) - - describe('test', () => { - it('returns undefined given 1 true alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns(undefined) }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns undefined given 2 true alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns(undefined) }, - { test: sinon.fake.returns(undefined) }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).not.to.have.been.called - }) - - it('returns undefined given 1 true and 1 false alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns(undefined) }, - { test: sinon.fake.returns('reason') }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).not.to.have.been.called - }) - - it('returns reason given 1 false alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns('reason') }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.equal('reason') - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns undefined given 1 false and 1 true alternative', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns('reason') }, - { test: sinon.fake.returns(undefined) }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.be.undefined - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns reasons given 2 false alternatives', () => { - const values = { a: 1 } - const alternatives: Alternative[] = [ - { test: sinon.fake.returns('reason 1') }, - { test: sinon.fake.returns('reason 2') }, - ] as any - - expect(new Restriction(alternatives).test(values)).to.equal('reason 1 AND reason 2') - - expect(alternatives[0].test).to.have.been.calledOnceWithExactly(values) - expect(alternatives[1].test).to.have.been.calledOnceWithExactly(values) - }) - }) - - describe('encode', () => { - it('returns encoded restriction with 1 alternative', () => { - const alternatives: Alternative[] = [ - { encode: sinon.fake.returns('a=1') }, - ] as any - - expect(new Restriction(alternatives).encode()).to.equal('a=1') - }) - - - it('returns encoded restrictions with 2 alternatives', () => { - const alternatives: Alternative[] = [ - { encode: sinon.fake.returns('a=1') }, - { encode: sinon.fake.returns('b=2') }, - ] as any - - expect(new Restriction(alternatives).encode()).to.equal('a=1|b=2') - }) - }) - - describe('decode', () => { - it('returns encoded restriction given 1 alternative', () => { - const [restriction, remainder] = Restriction.decode('a=1') - - expect(restriction.encode()).to.equal('a=1') - expect(remainder).to.be.empty - }) - - it('returns encoded restriction given 2 alternatives', () => { - const [restriction, remainder] = Restriction.decode('a=1|b=2') - - expect(restriction.encode()).to.equal('a=1|b=2') - expect(remainder).to.be.empty - }) - - it('returns encoded restriction given 2 alternatives and another restriction', () => { - const [restriction, remainder] = Restriction.decode('a=1|b=2&c=1') - - expect(restriction.encode()).to.equal('a=1|b=2') - expect(remainder).to.equal('c=1') - }) - }) -}) diff --git a/test/unit/utils/runes/rune-like.spec.ts b/test/unit/utils/runes/rune-like.spec.ts deleted file mode 100644 index 2c1dc839..00000000 --- a/test/unit/utils/runes/rune-like.spec.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { expect } from 'chai' -import sinon from 'sinon' - -import { Alternative } from '../../../../src/utils/runes/alternative' -import { Restriction } from '../../../../src/utils/runes/restriction' -import { RuneLike } from '../../../../src/utils/runes/rune-like' - -describe('RuneLike', () => { - describe('test', () => { - it('returns true if 1 restriction is true', () => { - const values = { a: 1 } - const restrictions: Restriction[] = [ - { test: sinon.fake.returns(undefined) } as any, - ] - - expect(new RuneLike(restrictions).test(values)).to.deep.equal([true, '']) - expect(restrictions[0].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns false and reason if 1 restriction is false', () => { - const values = { a: 1 } - const restrictions: Restriction[] = [ - { test: sinon.fake.returns('reason') } as any, - ] - - expect(new RuneLike(restrictions).test(values)).to.deep.equal([false, 'reason']) - expect(restrictions[0].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns false if 1 restriction is true and 1 is false', () => { - const values = { a: 1 } - const restrictions: Restriction[] = [ - { test: sinon.fake.returns(undefined) } as any, - { test: sinon.fake.returns('reason 2') } as any, - ] - - expect(new RuneLike(restrictions).test(values)).to.deep.equal([false, 'reason 2']) - expect(restrictions[0].test).to.have.been.calledOnceWithExactly(values) - expect(restrictions[1].test).to.have.been.calledOnceWithExactly(values) - }) - - it('returns false if 1 restriction is false and 1 is true', () => { - const values = { a: 1 } - const restrictions: Restriction[] = [ - { test: sinon.fake.returns('reason 1') } as any, - { test: sinon.fake.returns(undefined) } as any, - ] - - expect(new RuneLike(restrictions).test(values)).to.deep.equal([false, 'reason 1']) - expect(restrictions[0].test).to.have.been.calledOnceWithExactly(values) - expect(restrictions[1].test).not.to.have.been.called - }) - - it('returns false if 2 restrictions are false', () => { - const values = { a: 1 } - const restrictions: Restriction[] = [ - { test: sinon.fake.returns('reason 1') } as any, - { test: sinon.fake.returns('reason 2') } as any, - ] - - expect(new RuneLike(restrictions).test(values)).to.deep.equal([false, 'reason 1']) - expect(restrictions[0].test).to.have.been.calledOnceWithExactly(values) - expect(restrictions[1].test).not.to.have.been.called - }) - }) - - describe('encode', () => { - it('encodes 1 restriction', () => { - const restrictions: Restriction[] = [ - { encode: sinon.fake.returns('a=1') }, - ] as any - - expect(new RuneLike(restrictions).encode()).to.equal('a=1') - }) - - it('encodes 2 restrictions', () => { - const restrictions: Restriction[] = [ - { encode: sinon.fake.returns('a=1') }, - { encode: sinon.fake.returns('b=2') }, - ] as any - - expect(new RuneLike(restrictions).encode()).to.equal('a=1&b=2') - }) - }) - - describe('from', () => { - let restrictionDecodeStub: sinon.SinonStub - beforeEach(() => { - restrictionDecodeStub = sinon.stub(Restriction, 'decode') - }) - - afterEach(() => { - restrictionDecodeStub.restore() - }) - - it('returns rune-like given restrictions a=1', () => { - restrictionDecodeStub.withArgs('a=1').returns([ - new Restriction([ - new Alternative('a', '=', '1'), - ]), - '', - ]) - const runeLike = RuneLike.from('a=1') - - expect(runeLike).to.be.an.instanceOf(RuneLike) - - expect(restrictionDecodeStub.firstCall).to.have.been.calledWithExactly('a=1') - expect(runeLike.encode()).to.equal('a=1') - }) - - it('returns rune-like given restrictions a=1|b=2', () => { - restrictionDecodeStub.withArgs('a=1|b=2').returns([ - new Restriction([ - new Alternative('a', '=', '1'), - new Alternative('b', '=', '2'), - ]), - '', - ]) - const runeLike = RuneLike.from('a=1|b=2') - - expect(runeLike).to.be.an.instanceOf(RuneLike) - - expect(restrictionDecodeStub.firstCall).to.have.been.calledWithExactly('a=1|b=2') - expect(runeLike.encode()).to.equal('a=1|b=2') - }) - - it('returns rune-like given restrictions a=1|b=2&c=3', () => { - restrictionDecodeStub.withArgs('a=1|b=2&c=3').returns([ - new Restriction([ - new Alternative('a', '=', '1'), - new Alternative('b', '=', '2'), - ]), - '&c=3', - ]) - restrictionDecodeStub.withArgs('&c=3').returns([ - new Restriction([ - new Alternative('c', '=', '3'), - ]), - '', - ]) - const runeLike = RuneLike.from('a=1|b=2&c=3') - - expect(runeLike).to.be.an.instanceOf(RuneLike) - - expect(restrictionDecodeStub.firstCall).to.have.been.calledWithExactly('a=1|b=2&c=3') - expect(restrictionDecodeStub.secondCall).to.have.been.calledWithExactly('&c=3') - expect(runeLike.encode()).to.equal('a=1|b=2&c=3') - }) - - it('returns rune-like given restrictions with spaces a = 1 | b = 2 & c = 3', () => { - restrictionDecodeStub.withArgs('a=1|b=2&c=3').returns([ - new Restriction([ - new Alternative('a', '=', '1'), - new Alternative('b', '=', '2'), - ]), - '&c=3', - ]) - restrictionDecodeStub.withArgs('&c=3').returns([ - new Restriction([ - new Alternative('c', '=', '3'), - ]), - '', - ]) - const runeLike = RuneLike.from('a = 1 | b = 2 & c = 3') - - expect(runeLike).to.be.an.instanceOf(RuneLike) - - expect(restrictionDecodeStub.firstCall).to.have.been.calledWithExactly('a=1|b=2&c=3') - expect(restrictionDecodeStub.secondCall).to.have.been.calledWithExactly('&c=3') - expect(runeLike.encode()).to.equal('a=1|b=2&c=3') - }) - }) -})