diff --git a/.eslintignore b/.eslintignore index 0be0cc9..de4d1f0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,2 @@ -node_modules/** -typings/** -.vscode/** \ No newline at end of file +dist +node_modules diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index f474f15..0000000 --- a/.eslintrc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], - "extends": [ - "airbnb-base", - "eslint:recommended", - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "@typescript-eslint/no-explicit-any": 0, - "consistent-return": 0, - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": ["**/*.test.js", "**/*.test.ts"] - } - ], - "import/extensions": 0, - "import/no-unresolved": 0, - "max-len": 0, - "no-console": 0, - "no-param-reassign": 0, - "no-plusplus": 0, - "no-underscore-dangle": 0, - "no-use-before-define": [2, "nofunc"], - "space-before-function-paren": 0 - } -} diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..9b874b0 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,24 @@ +module.exports = { + extends: ["standard-with-typescript"], + parser: "@typescript-eslint/parser", + parserOptions: { + project: "./tsconfig-eslint.json", + tsconfigRootDir: __dirname, + sourceType: "module", + warnOnUnsupportedTypeScriptVersion: false, + }, + plugins: [ + "redos", + "simple-import-sort" + ], + rules: { + // note you must disable the base rule as it can report incorrect errors + "no-use-before-define": "off", + "@typescript-eslint/no-use-before-define": ["error"], + "@typescript-eslint/triple-slash-reference": "off", + "simple-import-sort/imports": "error", + }, + env: { + mocha: true + } +}; diff --git a/.mocharc.json b/.mocharc.json index 23018e8..390e009 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,6 +1,8 @@ { - "extension": ["ts"], + "extension": [ + "ts" + ], "loader": "ts-node/esm", "require": "ts-node/register", - "spec": "lib/**/*.test.ts" + "spec": "src/**/*.test.ts" } diff --git a/.nvmrc b/.nvmrc index d928989..e65243f 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.15.1 +16.19.0 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..1d085ca --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +** diff --git a/LICENSE b/LICENSE index b92a384..1fc2529 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2022 Eric Dobbertin +Copyright (c) 2013-2023 Eric Dobbertin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/package-lock.json b/package-lock.json index cd8217a..9f6effa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,19 +10,25 @@ "license": "MIT", "devDependencies": { "@types/mocha": "^9.1.1", - "@typescript-eslint/eslint-plugin": "^5.30.5", - "@typescript-eslint/parser": "^5.30.5", - "eslint": "^8.19.0", - "eslint-config-airbnb-base": "^15.0.0", + "@typescript-eslint/eslint-plugin": "^5.30.7", + "@typescript-eslint/parser": "^5.30.7", + "eslint": "^8.20.0", + "eslint-config-standard-with-typescript": "^22.0.0", "eslint-plugin-import": "^2.26.0", - "expect": "^28.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-redos": "^4.4.1", + "eslint-plugin-simple-import-sort": "^7.0.0", + "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0", + "expect": "^29.3.1", "mocha": "^10.0.0", - "semantic-release": "^19.0.3", - "ts-node": "^10.8.2", - "typescript": "^4.7.4" + "semantic-release": "^19.0.5", + "ts-node": "^10.9.1", + "typescript": "^4.9.4" }, "engines": { - "node": ">=14.16" + "node": ">=14.16", + "npm": ">=8" } }, "node_modules/@babel/code-frame": { @@ -154,15 +160,15 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", - "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.3.2", - "globals": "^13.15.0", + "espree": "^9.4.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -171,22 +177,38 @@ }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -194,36 +216,36 @@ "dev": true }, "node_modules/@jest/expect-utils": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-28.1.1.tgz", - "integrity": "sha512-n/ghlvdhCdMI/hTcnn4qV57kQuV9OTsZzH1TTCVARANKhl6hXJqLKUkwX69ftMGpsbpt96SsDD8n8LD2d9+FRw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.3.1.tgz", + "integrity": "sha512-wlrznINZI5sMjwvUoLVk617ll/UYfGIZNxmbU+Pa7wmkL4vYzhV9R2pwVqUh4NWWuLQWkI8+8mOkxs//prKQ3g==", "dev": true, "dependencies": { - "jest-get-type": "^28.0.2" + "jest-get-type": "^29.2.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/schemas": { - "version": "28.0.2", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.0.2.tgz", - "integrity": "sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA==", + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", + "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", "dev": true, "dependencies": { - "@sinclair/typebox": "^0.23.3" + "@sinclair/typebox": "^0.24.1" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/types": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.1.1.tgz", - "integrity": "sha512-vRXVqSg1VhDnB8bWcmvLzmg0Bt9CRKVgHPXqYwvWMX3TvAjeO+nRuK6+VdTKCtWOvYlmkF/HqNAL/z+N3B53Kw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.3.1.tgz", + "integrity": "sha512-d0S0jmmTpjnhCmNpApgX3jrUZgZ22ivKJRvL2lli5hpCRoNnp1f85r2/wpKfXuYu8E7Jjh1hGfhPyup1NM5AmA==", "dev": true, "dependencies": { - "@jest/schemas": "^28.0.2", + "@jest/schemas": "^29.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -231,7 +253,7 @@ "chalk": "^4.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jridgewell/resolve-uri": { @@ -559,9 +581,9 @@ } }, "node_modules/@sinclair/typebox": { - "version": "0.23.5", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz", - "integrity": "sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg==", + "version": "0.24.51", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", + "integrity": "sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==", "dev": true }, "node_modules/@tootallnate/once": { @@ -669,6 +691,12 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -676,9 +704,9 @@ "dev": true }, "node_modules/@types/yargs": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", - "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", + "version": "17.0.19", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.19.tgz", + "integrity": "sha512-cAx3qamwaYX9R0fzOIZAlFpo4A+1uBVCxqpKz9D26uTF4srRXaGTTsikQmaotCtNdbhzyUH7ft6p9ktz9s6UNQ==", "dev": true, "dependencies": { "@types/yargs-parser": "*" @@ -691,17 +719,17 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.5.tgz", - "integrity": "sha512-lftkqRoBvc28VFXEoRgyZuztyVUQ04JvUnATSPtIRFAccbXTWL6DEtXGYMcbg998kXw1NLUJm7rTQ9eUt+q6Ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.48.0.tgz", + "integrity": "sha512-SVLafp0NXpoJY7ut6VFVUU9I+YeFsDzeQwtK0WZ+xbRN3mtxJ08je+6Oi2N89qDn087COdO0u3blKZNv9VetRQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.30.5", - "@typescript-eslint/type-utils": "5.30.5", - "@typescript-eslint/utils": "5.30.5", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/type-utils": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" @@ -739,14 +767,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.5.tgz", - "integrity": "sha512-zj251pcPXI8GO9NDKWWmygP6+UjwWmrdf9qMW/L/uQJBM/0XbU2inxe5io/234y/RCvwpKEYjZ6c1YrXERkK4Q==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.48.0.tgz", + "integrity": "sha512-1mxNA8qfgxX8kBvRDIHEzrRGrKHQfQlbW6iHyfHYS0Q4X1af+S6mkLNtgCOsGVl8+/LUPrqdHMssAemkrQ01qg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.30.5", - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/typescript-estree": "5.30.5", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/typescript-estree": "5.48.0", "debug": "^4.3.4" }, "engines": { @@ -766,13 +794,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz", - "integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.0.tgz", + "integrity": "sha512-0AA4LviDtVtZqlyUQnZMVHydDATpD9SAX/RC5qh6cBd3xmyWvmXYF+WT1oOmxkeMnWDlUVTwdODeucUnjz3gow==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/visitor-keys": "5.30.5" + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -783,12 +811,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.30.5.tgz", - "integrity": "sha512-k9+ejlv1GgwN1nN7XjVtyCgE0BTzhzT1YsQF0rv4Vfj2U9xnslBgMYYvcEYAFVdvhuEscELJsB7lDkN7WusErw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.0.tgz", + "integrity": "sha512-vbtPO5sJyFjtHkGlGK4Sthmta0Bbls4Onv0bEqOGm7hP9h8UpRsHJwsrCiWtCUndTRNQO/qe6Ijz9rnT/DB+7g==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.30.5", + "@typescript-eslint/typescript-estree": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -809,9 +838,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz", - "integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -822,13 +851,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz", - "integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.0.tgz", + "integrity": "sha512-7pjd94vvIjI1zTz6aq/5wwE/YrfIyEPLtGJmRfyNR9NYIW+rOvzzUv3Cmq2hRKpvt6e9vpvPUQ7puzX7VSmsEw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/visitor-keys": "5.30.5", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -849,9 +878,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -864,17 +893,19 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.5.tgz", - "integrity": "sha512-o4SSUH9IkuA7AYIfAvatldovurqTAHrfzPApOZvdUq01hHojZojCFXx06D/aFpKCgWbMPRdJBWAC3sWp3itwTA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.0.tgz", + "integrity": "sha512-x2jrMcPaMfsHRRIkL+x96++xdzvrdBCnYRd5QiW5Wgo1OB4kDYPbC1XjWP/TNqlfK93K/lUL92erq5zPLgFScQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.30.5", - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/typescript-estree": "5.30.5", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/typescript-estree": "5.48.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -909,13 +940,28 @@ "node": ">=4.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz", - "integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.30.5", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -933,9 +979,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", - "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1216,6 +1262,32 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "peer": true, + "dependencies": { + "semver": "^7.0.0" + } + }, + "node_modules/builtins/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "peer": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1333,10 +1405,19 @@ } }, "node_modules/ci-info": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz", - "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", - "dev": true + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.7.1.tgz", + "integrity": "sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } }, "node_modules/clean-stack": { "version": "2.2.0", @@ -1407,12 +1488,6 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "node_modules/confusing-browser-globals": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", - "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", - "dev": true - }, "node_modules/conventional-changelog-angular": { "version": "5.0.13", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz", @@ -1674,12 +1749,12 @@ } }, "node_modules/diff-sequences": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz", - "integrity": "sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", + "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", "dev": true, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/dir-glob": { @@ -1841,13 +1916,15 @@ } }, "node_modules/eslint": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.19.0.tgz", - "integrity": "sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", + "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1857,18 +1934,21 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", + "espree": "^9.4.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -1879,8 +1959,7 @@ "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" @@ -1892,23 +1971,48 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-config-airbnb-base": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz", - "integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==", + "node_modules/eslint-config-standard": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "peerDependencies": { + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0" + } + }, + "node_modules/eslint-config-standard-with-typescript": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-22.0.0.tgz", + "integrity": "sha512-VA36U7UlFpwULvkdnh6MQj5GAV2Q+tT68ALLAwJP0ZuNXU2m0wX07uxX4qyLRdHgSzH4QJ73CveKBuSOYvh7vQ==", "dev": true, "dependencies": { - "confusing-browser-globals": "^1.0.10", - "object.assign": "^4.1.2", - "object.entries": "^1.1.5", - "semver": "^6.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" + "@typescript-eslint/parser": "^5.0.0", + "eslint-config-standard": "17.0.0" }, "peerDependencies": { - "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.25.2" + "@typescript-eslint/eslint-plugin": "^5.0.0", + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0", + "typescript": "*" } }, "node_modules/eslint-import-resolver-node": { @@ -1952,6 +2056,52 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "peer": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "peer": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, "node_modules/eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -2006,6 +2156,156 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, + "node_modules/eslint-plugin-n": { + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.6.0.tgz", + "integrity": "sha512-Hd/F7wz4Mj44Jp0H6Jtty13NcE69GNTY0rVlgTIj1XBnGGVI6UTdDrpE6vqu3AHo07bygq/N+7OH/lgz1emUJw==", + "dev": true, + "peer": true, + "dependencies": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.11.0", + "minimatch": "^3.1.2", + "resolve": "^1.22.1", + "semver": "^7.3.8" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-n/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "peer": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "dependencies": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "peerDependencies": { + "eslint": ">=5.16.0" + } + }, + "node_modules/eslint-plugin-node/node_modules/eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-node/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-node/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-promise": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", + "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-plugin-redos": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-redos/-/eslint-plugin-redos-4.4.2.tgz", + "integrity": "sha512-Dh2s8/lTHgaz/24Qipm1QRBCBwG6/jVOctSjr4gz5Q4MHbD3/PiqNkdvLEzvbKJ/S/VX6fQI2WjUg7IsLJA4eA==", + "dev": true, + "dependencies": { + "recheck": "4.4.2" + }, + "peerDependencies": { + "eslint": ">= 3" + } + }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, + "node_modules/eslint-plugin-you-dont-need-lodash-underscore": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-you-dont-need-lodash-underscore/-/eslint-plugin-you-dont-need-lodash-underscore-6.12.0.tgz", + "integrity": "sha512-WF4mNp+k2532iswT6iUd1BX6qjd3AV4cFy/09VC82GY9SsRtvkxhUIx7JNGSe0/bLyd57oTr4inPFiIaENXhGw==", + "dev": true, + "dependencies": { + "kebab-case": "^1.0.0" + }, + "engines": { + "node": ">=4.0" + } + }, "node_modules/eslint-scope": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", @@ -2055,18 +2355,91 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/espree": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", - "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "dependencies": { - "acorn": "^8.7.1", + "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esprima": { @@ -2148,19 +2521,19 @@ } }, "node_modules/expect": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-28.1.1.tgz", - "integrity": "sha512-/AANEwGL0tWBwzLNOvO0yUdy2D52jVdNXppOqswC49sxMN2cPWsGCQdzuIf9tj6hHoBQzNvx75JUYuQAckPo3w==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.3.1.tgz", + "integrity": "sha512-gGb1yTgU30Q0O/tQq+z30KBWv24ApkMgFUpvKBkyLUBL68Wv8dHdJxTBZFl/iT8K/bqDHvUYRH6IIN3rToopPA==", "dev": true, "dependencies": { - "@jest/expect-utils": "^28.1.1", - "jest-get-type": "^28.0.2", - "jest-matcher-utils": "^28.1.1", - "jest-message-util": "^28.1.1", - "jest-util": "^28.1.1" + "@jest/expect-utils": "^29.3.1", + "jest-get-type": "^29.2.0", + "jest-matcher-utils": "^29.3.1", + "jest-message-util": "^29.3.1", + "jest-util": "^29.3.1" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/fast-deep-equal": { @@ -2409,12 +2782,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -2541,9 +2908,9 @@ } }, "node_modules/globals": { - "version": "13.16.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.16.0.tgz", - "integrity": "sha512-A1lrQfpNF+McdPOnnFqY3kSN0AFTy485bTi1bkLk4mVPODIUEcSfhHgRqA+QdXPksrSTTztYXx37NFV+GpGk3Q==", + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -2581,6 +2948,12 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -2912,9 +3285,9 @@ } }, "node_modules/is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -3193,71 +3566,71 @@ } }, "node_modules/jest-diff": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.1.tgz", - "integrity": "sha512-/MUUxeR2fHbqHoMMiffe/Afm+U8U4olFRJ0hiVG2lZatPJcnGxx292ustVu7bULhjV65IYMxRdploAKLbcrsyg==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.3.1.tgz", + "integrity": "sha512-vU8vyiO7568tmin2lA3r2DP8oRvzhvRcD4DjpXc6uGveQodyk7CKLhQlCSiwgx3g0pFaE88/KLZ0yaTWMc4Uiw==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "diff-sequences": "^28.1.1", - "jest-get-type": "^28.0.2", - "pretty-format": "^28.1.1" + "diff-sequences": "^29.3.1", + "jest-get-type": "^29.2.0", + "pretty-format": "^29.3.1" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-get-type": { - "version": "28.0.2", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", - "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "version": "29.2.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", + "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", "dev": true, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.1.tgz", - "integrity": "sha512-NPJPRWrbmR2nAJ+1nmnfcKKzSwgfaciCCrYZzVnNoxVoyusYWIjkBMNvu0RHJe7dNj4hH3uZOPZsQA+xAYWqsw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.3.1.tgz", + "integrity": "sha512-fkRMZUAScup3txIKfMe3AIZZmPEjWEdsPJFK3AIy5qRohWqQFg1qrmKfYXR9qEkNc7OdAu2N4KPHibEmy4HPeQ==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "jest-diff": "^28.1.1", - "jest-get-type": "^28.0.2", - "pretty-format": "^28.1.1" + "jest-diff": "^29.3.1", + "jest-get-type": "^29.2.0", + "pretty-format": "^29.3.1" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-message-util": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-28.1.1.tgz", - "integrity": "sha512-xoDOOT66fLfmTRiqkoLIU7v42mal/SqwDKvfmfiWAdJMSJiU+ozgluO7KbvoAgiwIrrGZsV7viETjc8GNrA/IQ==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.3.1.tgz", + "integrity": "sha512-lMJTbgNcDm5z+6KDxWtqOFWlGQxD6XaYwBqHR8kmpkP+WWWG90I35kdtQHY67Ay5CSuydkTBbJG+tH9JShFCyA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^28.1.1", + "@jest/types": "^29.3.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^28.1.1", + "pretty-format": "^29.3.1", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-util": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.1.1.tgz", - "integrity": "sha512-FktOu7ca1DZSyhPAxgxB6hfh2+9zMoJ7aEQA759Z6p45NuO8mWcqujH+UdHlCm/V6JTWwDztM2ITCzU1ijJAfw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.3.1.tgz", + "integrity": "sha512-7YOVZaiX7RJLv76ZfHt4nbNEzzTRiMW/IiOG7ZOKmTXmoGBxUDefgMAxQubu6WPVqP5zSzAdZG0FfLcC7HOIFQ==", "dev": true, "dependencies": { - "@jest/types": "^28.1.1", + "@jest/types": "^29.3.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -3265,7 +3638,17 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" } }, "node_modules/js-tokens": { @@ -3317,9 +3700,9 @@ "dev": true }, "node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { "minimist": "^1.2.0" @@ -3365,6 +3748,12 @@ "node": "*" } }, + "node_modules/kebab-case": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/kebab-case/-/kebab-case-1.0.2.tgz", + "integrity": "sha512-7n6wXq4gNgBELfDCpzKc+mRrZFs7D+wgfF5WRFLNAr4DA/qtr9Js8uOAVAfHhuLMfAcQ0pRKqbpjx+TcJVdE1Q==", + "dev": true + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -3885,6 +4274,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -6462,20 +6857,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.entries": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz", - "integrity": "sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/object.values": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", @@ -6747,18 +7128,17 @@ } }, "node_modules/pretty-format": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.1.tgz", - "integrity": "sha512-wwJbVTGFHeucr5Jw2bQ9P+VYHyLdAqedFLEkdQUVaBF/eiidDwH5OpilINq4mEfhbCjLnirt6HTTDhv1HaTIQw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.3.1.tgz", + "integrity": "sha512-FyLnmb1cYJV8biEIiRyzRFvs2lry7PPIvOqKVe1GCUEYg4YGmlx1qG9EJNMxArYm7piII4qb8UV1Pncq5dxmcg==", "dev": true, "dependencies": { - "@jest/schemas": "^28.0.2", - "ansi-regex": "^5.0.1", + "@jest/schemas": "^29.0.0", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/pretty-format/node_modules/ansi-styles": { @@ -7040,6 +7420,64 @@ "node": ">=8.10.0" } }, + "node_modules/recheck": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck/-/recheck-4.4.2.tgz", + "integrity": "sha512-BepDoP4G7Vn67SeWrndfAm6iRbKwWd0actNOjT0ki2M6U0JUmsFfdBxSArw67bSRu/RHvMYu2NEQwGgvRzs61g==", + "dev": true, + "optionalDependencies": { + "recheck-jar": "4.4.2", + "recheck-linux-x64": "4.4.2", + "recheck-macos-x64": "4.4.2", + "recheck-windows-x64": "4.4.2" + } + }, + "node_modules/recheck-jar": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-jar/-/recheck-jar-4.4.2.tgz", + "integrity": "sha512-RmlG75x6Fwxk8sKX1E5Rd/5UeBFVB2dZQGzcdMjhYcA7xdpFLaw4Ha3Nc8Bbn5THbFE+58iX+VSMTCofJ8J+ng==", + "dev": true, + "optional": true + }, + "node_modules/recheck-linux-x64": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-linux-x64/-/recheck-linux-x64-4.4.2.tgz", + "integrity": "sha512-U/1NhC+NTYEdkxez01gAqlJ3nAcbQq97S9cVRu3+kBQihFAUZwuQlua0jm/TdIpmcOiKzA7I3S08Pqs5GjIjpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/recheck-macos-x64": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-macos-x64/-/recheck-macos-x64-4.4.2.tgz", + "integrity": "sha512-ouO1OhS1rZFwYUDC5Q+NDS9vDQYGOPuEUBj4eFYfBtVs9HF30uQTgfneIbAGpVOonMkhvTPzpaz11J0x3lCNDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/recheck-windows-x64": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-windows-x64/-/recheck-windows-x64-4.4.2.tgz", + "integrity": "sha512-8qztWxeGGMtQILx8m2ggpkxjg1VOojCNd+ArhXVgJjhsx1tjImY3NiFMccajmPKhQYDg9m80Ao3PQYzqEKT/mQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", @@ -7202,9 +7640,9 @@ "dev": true }, "node_modules/semantic-release": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-19.0.3.tgz", - "integrity": "sha512-HaFbydST1cDKZHuFZxB8DTrBLJVK/AnDExpK0s3EqLIAAUAHUgnd+VSJCUtTYQKkAkauL8G9CucODrVCc7BuAA==", + "version": "19.0.5", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-19.0.5.tgz", + "integrity": "sha512-NMPKdfpXTnPn49FDogMBi36SiBfXkSOJqCkk0E4iWOY1tusvvgBwqUmxTX1kmlT6kIYed9YwNKD1sfPpqa5yaA==", "dev": true, "dependencies": { "@semantic-release/commit-analyzer": "^9.0.2", @@ -7539,9 +7977,9 @@ } }, "node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, "dependencies": { "escape-string-regexp": "^2.0.0" @@ -7829,9 +8267,9 @@ } }, "node_modules/ts-node": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.2.tgz", - "integrity": "sha512-LYdGnoGddf1D6v8REPtIH+5iq/gTDuZqv2/UJUU7tKjuEU8xVZorBM+buCGNjj+pGEud+sOoM4CX3/YzINpENA==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -7938,9 +8376,9 @@ } }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -8026,12 +8464,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "node_modules/v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", - "dev": true - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -8371,15 +8803,15 @@ } }, "@eslint/eslintrc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", - "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.3.2", - "globals": "^13.15.0", + "espree": "^9.4.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -8388,16 +8820,22 @@ } }, "@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" } }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, "@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -8405,30 +8843,30 @@ "dev": true }, "@jest/expect-utils": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-28.1.1.tgz", - "integrity": "sha512-n/ghlvdhCdMI/hTcnn4qV57kQuV9OTsZzH1TTCVARANKhl6hXJqLKUkwX69ftMGpsbpt96SsDD8n8LD2d9+FRw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.3.1.tgz", + "integrity": "sha512-wlrznINZI5sMjwvUoLVk617ll/UYfGIZNxmbU+Pa7wmkL4vYzhV9R2pwVqUh4NWWuLQWkI8+8mOkxs//prKQ3g==", "dev": true, "requires": { - "jest-get-type": "^28.0.2" + "jest-get-type": "^29.2.0" } }, "@jest/schemas": { - "version": "28.0.2", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.0.2.tgz", - "integrity": "sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA==", + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", + "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", "dev": true, "requires": { - "@sinclair/typebox": "^0.23.3" + "@sinclair/typebox": "^0.24.1" } }, "@jest/types": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.1.1.tgz", - "integrity": "sha512-vRXVqSg1VhDnB8bWcmvLzmg0Bt9CRKVgHPXqYwvWMX3TvAjeO+nRuK6+VdTKCtWOvYlmkF/HqNAL/z+N3B53Kw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.3.1.tgz", + "integrity": "sha512-d0S0jmmTpjnhCmNpApgX3jrUZgZ22ivKJRvL2lli5hpCRoNnp1f85r2/wpKfXuYu8E7Jjh1hGfhPyup1NM5AmA==", "dev": true, "requires": { - "@jest/schemas": "^28.0.2", + "@jest/schemas": "^29.0.0", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -8712,9 +9150,9 @@ } }, "@sinclair/typebox": { - "version": "0.23.5", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz", - "integrity": "sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg==", + "version": "0.24.51", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", + "integrity": "sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==", "dev": true }, "@tootallnate/once": { @@ -8819,6 +9257,12 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -8826,9 +9270,9 @@ "dev": true }, "@types/yargs": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz", - "integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==", + "version": "17.0.19", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.19.tgz", + "integrity": "sha512-cAx3qamwaYX9R0fzOIZAlFpo4A+1uBVCxqpKz9D26uTF4srRXaGTTsikQmaotCtNdbhzyUH7ft6p9ktz9s6UNQ==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -8841,17 +9285,17 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.5.tgz", - "integrity": "sha512-lftkqRoBvc28VFXEoRgyZuztyVUQ04JvUnATSPtIRFAccbXTWL6DEtXGYMcbg998kXw1NLUJm7rTQ9eUt+q6Ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.48.0.tgz", + "integrity": "sha512-SVLafp0NXpoJY7ut6VFVUU9I+YeFsDzeQwtK0WZ+xbRN3mtxJ08je+6Oi2N89qDn087COdO0u3blKZNv9VetRQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.30.5", - "@typescript-eslint/type-utils": "5.30.5", - "@typescript-eslint/utils": "5.30.5", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/type-utils": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" @@ -8869,52 +9313,53 @@ } }, "@typescript-eslint/parser": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.5.tgz", - "integrity": "sha512-zj251pcPXI8GO9NDKWWmygP6+UjwWmrdf9qMW/L/uQJBM/0XbU2inxe5io/234y/RCvwpKEYjZ6c1YrXERkK4Q==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.48.0.tgz", + "integrity": "sha512-1mxNA8qfgxX8kBvRDIHEzrRGrKHQfQlbW6iHyfHYS0Q4X1af+S6mkLNtgCOsGVl8+/LUPrqdHMssAemkrQ01qg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.30.5", - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/typescript-estree": "5.30.5", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/typescript-estree": "5.48.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.5.tgz", - "integrity": "sha512-NJ6F+YHHFT/30isRe2UTmIGGAiXKckCyMnIV58cE3JkHmaD6e5zyEYm5hBDv0Wbin+IC0T1FWJpD3YqHUG/Ydg==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.0.tgz", + "integrity": "sha512-0AA4LviDtVtZqlyUQnZMVHydDATpD9SAX/RC5qh6cBd3xmyWvmXYF+WT1oOmxkeMnWDlUVTwdODeucUnjz3gow==", "dev": true, "requires": { - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/visitor-keys": "5.30.5" + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0" } }, "@typescript-eslint/type-utils": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.30.5.tgz", - "integrity": "sha512-k9+ejlv1GgwN1nN7XjVtyCgE0BTzhzT1YsQF0rv4Vfj2U9xnslBgMYYvcEYAFVdvhuEscELJsB7lDkN7WusErw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.0.tgz", + "integrity": "sha512-vbtPO5sJyFjtHkGlGK4Sthmta0Bbls4Onv0bEqOGm7hP9h8UpRsHJwsrCiWtCUndTRNQO/qe6Ijz9rnT/DB+7g==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.30.5", + "@typescript-eslint/typescript-estree": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.5.tgz", - "integrity": "sha512-kZ80w/M2AvsbRvOr3PjaNh6qEW1LFqs2pLdo2s5R38B2HYXG8Z0PP48/4+j1QHJFL3ssHIbJ4odPRS8PlHrFfw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.5.tgz", - "integrity": "sha512-qGTc7QZC801kbYjAr4AgdOfnokpwStqyhSbiQvqGBLixniAKyH+ib2qXIVo4P9NgGzwyfD9I0nlJN7D91E1VpQ==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.0.tgz", + "integrity": "sha512-7pjd94vvIjI1zTz6aq/5wwE/YrfIyEPLtGJmRfyNR9NYIW+rOvzzUv3Cmq2hRKpvt6e9vpvPUQ7puzX7VSmsEw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/visitor-keys": "5.30.5", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -8923,9 +9368,9 @@ }, "dependencies": { "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -8934,17 +9379,19 @@ } }, "@typescript-eslint/utils": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.30.5.tgz", - "integrity": "sha512-o4SSUH9IkuA7AYIfAvatldovurqTAHrfzPApOZvdUq01hHojZojCFXx06D/aFpKCgWbMPRdJBWAC3sWp3itwTA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.0.tgz", + "integrity": "sha512-x2jrMcPaMfsHRRIkL+x96++xdzvrdBCnYRd5QiW5Wgo1OB4kDYPbC1XjWP/TNqlfK93K/lUL92erq5zPLgFScQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.30.5", - "@typescript-eslint/types": "5.30.5", - "@typescript-eslint/typescript-estree": "5.30.5", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/typescript-estree": "5.48.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "dependencies": { "eslint-scope": { @@ -8962,16 +9409,25 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true + }, + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, "@typescript-eslint/visitor-keys": { - "version": "5.30.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.5.tgz", - "integrity": "sha512-D+xtGo9HUMELzWIUqcQc0p2PO4NyvTrgIOK/VnSH083+8sq0tiLozNRKuLarwHYGRuA6TVBQSuuLwJUDWd3aaA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "requires": { - "@typescript-eslint/types": "5.30.5", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -8982,9 +9438,9 @@ "dev": true }, "acorn": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", - "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true }, "acorn-jsx": { @@ -9195,6 +9651,28 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "peer": true, + "requires": { + "semver": "^7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "peer": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -9276,9 +9754,9 @@ } }, "ci-info": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz", - "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.7.1.tgz", + "integrity": "sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==", "dev": true }, "clean-stack": { @@ -9339,12 +9817,6 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "confusing-browser-globals": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", - "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", - "dev": true - }, "conventional-changelog-angular": { "version": "5.0.13", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz", @@ -9539,9 +10011,9 @@ "dev": true }, "diff-sequences": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz", - "integrity": "sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", + "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", "dev": true }, "dir-glob": { @@ -9670,13 +10142,15 @@ "dev": true }, "eslint": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.19.0.tgz", - "integrity": "sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", + "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -9686,18 +10160,21 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", + "espree": "^9.4.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -9708,20 +10185,69 @@ "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" + }, + "dependencies": { + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } } }, - "eslint-config-airbnb-base": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz", - "integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==", + "eslint-config-standard": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", + "dev": true, + "requires": {} + }, + "eslint-config-standard-with-typescript": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-22.0.0.tgz", + "integrity": "sha512-VA36U7UlFpwULvkdnh6MQj5GAV2Q+tT68ALLAwJP0ZuNXU2m0wX07uxX4qyLRdHgSzH4QJ73CveKBuSOYvh7vQ==", "dev": true, "requires": { - "confusing-browser-globals": "^1.0.10", - "object.assign": "^4.1.2", - "object.entries": "^1.1.5", - "semver": "^6.3.0" + "@typescript-eslint/parser": "^5.0.0", + "eslint-config-standard": "17.0.0" } }, "eslint-import-resolver-node": { @@ -9766,6 +10292,36 @@ } } }, + "eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "peer": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "peer": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "peer": true + } + } + }, "eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -9813,6 +10369,108 @@ } } }, + "eslint-plugin-n": { + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.6.0.tgz", + "integrity": "sha512-Hd/F7wz4Mj44Jp0H6Jtty13NcE69GNTY0rVlgTIj1XBnGGVI6UTdDrpE6vqu3AHo07bygq/N+7OH/lgz1emUJw==", + "dev": true, + "peer": true, + "requires": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.11.0", + "minimatch": "^3.1.2", + "resolve": "^1.22.1", + "semver": "^7.3.8" + }, + "dependencies": { + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "peer": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "requires": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-plugin-promise": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", + "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", + "dev": true, + "requires": {} + }, + "eslint-plugin-redos": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-redos/-/eslint-plugin-redos-4.4.2.tgz", + "integrity": "sha512-Dh2s8/lTHgaz/24Qipm1QRBCBwG6/jVOctSjr4gz5Q4MHbD3/PiqNkdvLEzvbKJ/S/VX6fQI2WjUg7IsLJA4eA==", + "dev": true, + "requires": { + "recheck": "4.4.2" + } + }, + "eslint-plugin-simple-import-sort": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true, + "requires": {} + }, + "eslint-plugin-you-dont-need-lodash-underscore": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-you-dont-need-lodash-underscore/-/eslint-plugin-you-dont-need-lodash-underscore-6.12.0.tgz", + "integrity": "sha512-WF4mNp+k2532iswT6iUd1BX6qjd3AV4cFy/09VC82GY9SsRtvkxhUIx7JNGSe0/bLyd57oTr4inPFiIaENXhGw==", + "dev": true, + "requires": { + "kebab-case": "^1.0.0" + } + }, "eslint-scope": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", @@ -9847,12 +10505,12 @@ "dev": true }, "espree": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", - "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "requires": { - "acorn": "^8.7.1", + "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" } @@ -9911,16 +10569,16 @@ } }, "expect": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-28.1.1.tgz", - "integrity": "sha512-/AANEwGL0tWBwzLNOvO0yUdy2D52jVdNXppOqswC49sxMN2cPWsGCQdzuIf9tj6hHoBQzNvx75JUYuQAckPo3w==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.3.1.tgz", + "integrity": "sha512-gGb1yTgU30Q0O/tQq+z30KBWv24ApkMgFUpvKBkyLUBL68Wv8dHdJxTBZFl/iT8K/bqDHvUYRH6IIN3rToopPA==", "dev": true, "requires": { - "@jest/expect-utils": "^28.1.1", - "jest-get-type": "^28.0.2", - "jest-matcher-utils": "^28.1.1", - "jest-message-util": "^28.1.1", - "jest-util": "^28.1.1" + "@jest/expect-utils": "^29.3.1", + "jest-get-type": "^29.2.0", + "jest-matcher-utils": "^29.3.1", + "jest-message-util": "^29.3.1", + "jest-util": "^29.3.1" } }, "fast-deep-equal": { @@ -10107,12 +10765,6 @@ "functions-have-names": "^1.2.2" } }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -10211,9 +10863,9 @@ } }, "globals": { - "version": "13.16.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.16.0.tgz", - "integrity": "sha512-A1lrQfpNF+McdPOnnFqY3kSN0AFTy485bTi1bkLk4mVPODIUEcSfhHgRqA+QdXPksrSTTztYXx37NFV+GpGk3Q==", + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -10239,6 +10891,12 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -10469,9 +11127,9 @@ "dev": true }, "is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "dev": true, "requires": { "has": "^1.0.3" @@ -10657,59 +11315,59 @@ "dev": true }, "jest-diff": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.1.tgz", - "integrity": "sha512-/MUUxeR2fHbqHoMMiffe/Afm+U8U4olFRJ0hiVG2lZatPJcnGxx292ustVu7bULhjV65IYMxRdploAKLbcrsyg==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.3.1.tgz", + "integrity": "sha512-vU8vyiO7568tmin2lA3r2DP8oRvzhvRcD4DjpXc6uGveQodyk7CKLhQlCSiwgx3g0pFaE88/KLZ0yaTWMc4Uiw==", "dev": true, "requires": { "chalk": "^4.0.0", - "diff-sequences": "^28.1.1", - "jest-get-type": "^28.0.2", - "pretty-format": "^28.1.1" + "diff-sequences": "^29.3.1", + "jest-get-type": "^29.2.0", + "pretty-format": "^29.3.1" } }, "jest-get-type": { - "version": "28.0.2", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", - "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "version": "29.2.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", + "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", "dev": true }, "jest-matcher-utils": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.1.tgz", - "integrity": "sha512-NPJPRWrbmR2nAJ+1nmnfcKKzSwgfaciCCrYZzVnNoxVoyusYWIjkBMNvu0RHJe7dNj4hH3uZOPZsQA+xAYWqsw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.3.1.tgz", + "integrity": "sha512-fkRMZUAScup3txIKfMe3AIZZmPEjWEdsPJFK3AIy5qRohWqQFg1qrmKfYXR9qEkNc7OdAu2N4KPHibEmy4HPeQ==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^28.1.1", - "jest-get-type": "^28.0.2", - "pretty-format": "^28.1.1" + "jest-diff": "^29.3.1", + "jest-get-type": "^29.2.0", + "pretty-format": "^29.3.1" } }, "jest-message-util": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-28.1.1.tgz", - "integrity": "sha512-xoDOOT66fLfmTRiqkoLIU7v42mal/SqwDKvfmfiWAdJMSJiU+ozgluO7KbvoAgiwIrrGZsV7viETjc8GNrA/IQ==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.3.1.tgz", + "integrity": "sha512-lMJTbgNcDm5z+6KDxWtqOFWlGQxD6XaYwBqHR8kmpkP+WWWG90I35kdtQHY67Ay5CSuydkTBbJG+tH9JShFCyA==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^28.1.1", + "@jest/types": "^29.3.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^28.1.1", + "pretty-format": "^29.3.1", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, "jest-util": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.1.1.tgz", - "integrity": "sha512-FktOu7ca1DZSyhPAxgxB6hfh2+9zMoJ7aEQA759Z6p45NuO8mWcqujH+UdHlCm/V6JTWwDztM2ITCzU1ijJAfw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.3.1.tgz", + "integrity": "sha512-7YOVZaiX7RJLv76ZfHt4nbNEzzTRiMW/IiOG7ZOKmTXmoGBxUDefgMAxQubu6WPVqP5zSzAdZG0FfLcC7HOIFQ==", "dev": true, "requires": { - "@jest/types": "^28.1.1", + "@jest/types": "^29.3.1", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -10717,6 +11375,12 @@ "picomatch": "^2.2.3" } }, + "js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -10763,9 +11427,9 @@ "dev": true }, "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "requires": { "minimist": "^1.2.0" @@ -10797,6 +11461,12 @@ "through": ">=2.2.7 <3" } }, + "kebab-case": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/kebab-case/-/kebab-case-1.0.2.tgz", + "integrity": "sha512-7n6wXq4gNgBELfDCpzKc+mRrZFs7D+wgfF5WRFLNAr4DA/qtr9Js8uOAVAfHhuLMfAcQ0pRKqbpjx+TcJVdE1Q==", + "dev": true + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -11185,6 +11855,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -12986,17 +13662,6 @@ "object-keys": "^1.1.1" } }, - "object.entries": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz", - "integrity": "sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - } - }, "object.values": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", @@ -13187,13 +13852,12 @@ "dev": true }, "pretty-format": { - "version": "28.1.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.1.tgz", - "integrity": "sha512-wwJbVTGFHeucr5Jw2bQ9P+VYHyLdAqedFLEkdQUVaBF/eiidDwH5OpilINq4mEfhbCjLnirt6HTTDhv1HaTIQw==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.3.1.tgz", + "integrity": "sha512-FyLnmb1cYJV8biEIiRyzRFvs2lry7PPIvOqKVe1GCUEYg4YGmlx1qG9EJNMxArYm7piII4qb8UV1Pncq5dxmcg==", "dev": true, "requires": { - "@jest/schemas": "^28.0.2", - "ansi-regex": "^5.0.1", + "@jest/schemas": "^29.0.0", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -13407,6 +14071,46 @@ "picomatch": "^2.2.1" } }, + "recheck": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck/-/recheck-4.4.2.tgz", + "integrity": "sha512-BepDoP4G7Vn67SeWrndfAm6iRbKwWd0actNOjT0ki2M6U0JUmsFfdBxSArw67bSRu/RHvMYu2NEQwGgvRzs61g==", + "dev": true, + "requires": { + "recheck-jar": "4.4.2", + "recheck-linux-x64": "4.4.2", + "recheck-macos-x64": "4.4.2", + "recheck-windows-x64": "4.4.2" + } + }, + "recheck-jar": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-jar/-/recheck-jar-4.4.2.tgz", + "integrity": "sha512-RmlG75x6Fwxk8sKX1E5Rd/5UeBFVB2dZQGzcdMjhYcA7xdpFLaw4Ha3Nc8Bbn5THbFE+58iX+VSMTCofJ8J+ng==", + "dev": true, + "optional": true + }, + "recheck-linux-x64": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-linux-x64/-/recheck-linux-x64-4.4.2.tgz", + "integrity": "sha512-U/1NhC+NTYEdkxez01gAqlJ3nAcbQq97S9cVRu3+kBQihFAUZwuQlua0jm/TdIpmcOiKzA7I3S08Pqs5GjIjpQ==", + "dev": true, + "optional": true + }, + "recheck-macos-x64": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-macos-x64/-/recheck-macos-x64-4.4.2.tgz", + "integrity": "sha512-ouO1OhS1rZFwYUDC5Q+NDS9vDQYGOPuEUBj4eFYfBtVs9HF30uQTgfneIbAGpVOonMkhvTPzpaz11J0x3lCNDw==", + "dev": true, + "optional": true + }, + "recheck-windows-x64": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/recheck-windows-x64/-/recheck-windows-x64-4.4.2.tgz", + "integrity": "sha512-8qztWxeGGMtQILx8m2ggpkxjg1VOojCNd+ArhXVgJjhsx1tjImY3NiFMccajmPKhQYDg9m80Ao3PQYzqEKT/mQ==", + "dev": true, + "optional": true + }, "redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", @@ -13512,9 +14216,9 @@ "dev": true }, "semantic-release": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-19.0.3.tgz", - "integrity": "sha512-HaFbydST1cDKZHuFZxB8DTrBLJVK/AnDExpK0s3EqLIAAUAHUgnd+VSJCUtTYQKkAkauL8G9CucODrVCc7BuAA==", + "version": "19.0.5", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-19.0.5.tgz", + "integrity": "sha512-NMPKdfpXTnPn49FDogMBi36SiBfXkSOJqCkk0E4iWOY1tusvvgBwqUmxTX1kmlT6kIYed9YwNKD1sfPpqa5yaA==", "dev": true, "requires": { "@semantic-release/commit-analyzer": "^9.0.2", @@ -13786,9 +14490,9 @@ } }, "stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, "requires": { "escape-string-regexp": "^2.0.0" @@ -14010,9 +14714,9 @@ "dev": true }, "ts-node": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.2.tgz", - "integrity": "sha512-LYdGnoGddf1D6v8REPtIH+5iq/gTDuZqv2/UJUU7tKjuEU8xVZorBM+buCGNjj+pGEud+sOoM4CX3/YzINpENA==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", @@ -14081,9 +14785,9 @@ "dev": true }, "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "dev": true }, "uglify-js": { @@ -14147,12 +14851,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", - "dev": true - }, "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/package.json b/package.json index fc7aa26..ac5fd7f 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,6 @@ "description": "An API for interacting with a MongoDB document or modifier", "author": "Eric Dobbertin ", "license": "MIT", - "engines": { - "node": ">=14.16" - }, "repository": { "type": "git", "url": "https://github.com/longshotlabs/node-mongo-object.git" @@ -15,38 +12,52 @@ "url": "https://github.com/longshotlabs/node-mongo-object/issues" }, "homepage": "https://github.com/longshotlabs/node-mongo-object", + "type": "module", "files": [ - "dist" + "dist", + "LICENSE", + "README.md" ], - "type": "module", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./dist/cjs/main.js", + "module": "./dist/esm/main.js", + "types": "./dist/esm/main.d.ts", "exports": { ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "import": "./dist/esm/main.js", + "require": "./dist/cjs/main.js" } }, + "engines": { + "node": ">=14.16", + "npm": ">=8" + }, + "browserslist": "> 0.5%, last 2 versions, Firefox ESR, not dead", "scripts": { - "build": "rm -rf dist/** && tsc --declaration", - "lint:fix": "eslint ./lib/. --fix || true", - "lint": "eslint ./lib/.", + "build": "rm -rf dist/** && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./scripts/post-build.sh", + "check": "tsc --noEmit", + "lint": "eslint . --ext ts,tsx", + "lint:fix": "eslint . --fix --ext ts,tsx", "prepublishOnly": "npm run build", "test": "mocha", "test:watch": "npm test -- --watch" }, "devDependencies": { "@types/mocha": "^9.1.1", - "@typescript-eslint/eslint-plugin": "^5.30.5", - "@typescript-eslint/parser": "^5.30.5", - "eslint": "^8.19.0", - "eslint-config-airbnb-base": "^15.0.0", + "@typescript-eslint/eslint-plugin": "^5.30.7", + "@typescript-eslint/parser": "^5.30.7", + "eslint": "^8.20.0", + "eslint-config-standard-with-typescript": "^22.0.0", "eslint-plugin-import": "^2.26.0", - "expect": "^28.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-redos": "^4.4.1", + "eslint-plugin-simple-import-sort": "^7.0.0", + "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0", + "expect": "^29.3.1", "mocha": "^10.0.0", - "semantic-release": "^19.0.3", - "ts-node": "^10.8.2", - "typescript": "^4.7.4" + "semantic-release": "^19.0.5", + "ts-node": "^10.9.1", + "typescript": "^4.9.4" }, "release": { "branches": [ diff --git a/scripts/post-build.sh b/scripts/post-build.sh new file mode 100755 index 0000000..ec679b9 --- /dev/null +++ b/scripts/post-build.sh @@ -0,0 +1,11 @@ +cat > dist/cjs/package.json < dist/esm/package.json < { it('round trip', () => { // Helper Functions - function passthru(doc: MongoDoc) { - const mDoc = new MongoObject(doc); - return mDoc.getObject(); + function passthru (doc: MongoDoc): MongoDoc { + const mDoc = new MongoObject(doc) + return mDoc.getObject() } - function rt(doc: MongoDoc) { - expect(passthru(doc)).toEqual(doc); + function rt (doc: MongoDoc): void { + expect(passthru(doc)).toEqual(doc) } // Round Trip Tests - rt({}); - rt({ a: 1 }); - rt({ a: 'Test' }); - rt({ a: new Date() }); - rt({ a: [] }); - rt({ a: {} }); - rt({ a: [1, 2] }); - rt({ a: ['Test1', 'Test2'] }); - rt({ a: [new Date(), new Date()] }); - rt({ a: { b: 1 } }); - rt({ a: { b: 'Test' } }); - rt({ a: { b: new Date() } }); - rt({ a: { b: [] } }); - rt({ a: { b: {} } }); - rt({ a: { b: [1, 2] } }); - rt({ a: { b: ['Test1', 'Test2'] } }); - rt({ a: { b: [new Date(), new Date()] } }); - rt({ a: { b: [{ c: 1 }, { c: 2 }] } }); - rt({ a: { b: [{ c: 'Test1' }, { c: 'Test2' }] } }); - rt({ a: { b: [{ c: new Date() }, { c: new Date() }] } }); - rt({ string: 't', length: 5 }); - }); + rt({}) + rt({ a: 1 }) + rt({ a: 'Test' }) + rt({ a: new Date() }) + rt({ a: [] }) + rt({ a: {} }) + rt({ a: [1, 2] }) + rt({ a: ['Test1', 'Test2'] }) + rt({ a: [new Date(), new Date()] }) + rt({ a: { b: 1 } }) + rt({ a: { b: 'Test' } }) + rt({ a: { b: new Date() } }) + rt({ a: { b: [] } }) + rt({ a: { b: {} } }) + rt({ a: { b: [1, 2] } }) + rt({ a: { b: ['Test1', 'Test2'] } }) + rt({ a: { b: [new Date(), new Date()] } }) + rt({ a: { b: [{ c: 1 }, { c: 2 }] } }) + rt({ a: { b: [{ c: 'Test1' }, { c: 'Test2' }] } }) + rt({ a: { b: [{ c: new Date() }, { c: new Date() }] } }) + rt({ string: 't', length: 5 }) + }) it('typed arrays', () => { - const mo = new MongoObject({ foo: new Uint8Array(10) }); + const mo = new MongoObject({ foo: new Uint8Array(10) }) // We must use non-dot-notation to access private prop and keep TypeScript happy // eslint-disable-next-line dot-notation - expect(mo['_affectedKeys']['foo.0']).toEqual(undefined); - }); + // @ts-expect-error private access for testing + expect(mo._affectedKeys['foo.0']).toEqual(undefined) + }) it('forEachNode', () => { - const mo = new MongoObject({ foo: 'k', length: 5 }); + const mo = new MongoObject({ foo: 'k', length: 5 }) // We must use non-dot-notation to access private prop and keep TypeScript happy // eslint-disable-next-line dot-notation - expect(mo['_affectedKeys']).toEqual({ foo: 'foo', length: 'length' }); + // @ts-expect-error private access for testing + expect(mo._affectedKeys).toEqual({ foo: 'foo', length: 'length' }) - let count = 0; + let count = 0 mo.forEachNode(() => { - count += 1; - }); - expect(count).toEqual(2); - }); + count += 1 + }) + expect(count).toEqual(2) + }) it('flat', () => { // Helper Functions - function flat(doc: MongoDoc, opts?: GetFlatObjectOptions) { - const mDoc = new MongoObject(doc); - return mDoc.getFlatObject(opts); + function flat (doc: MongoDoc, opts?: GetFlatObjectOptions): Record { + const mDoc = new MongoObject(doc) + return mDoc.getFlatObject(opts) } - function testFlat( + function testFlat ( doc: MongoDoc, exp: Record, - opts?: GetFlatObjectOptions, - ) { - expect(flat(doc, opts)).toEqual(exp); + opts?: GetFlatObjectOptions + ): void { + expect(flat(doc, opts)).toEqual(exp) } // Flatten Tests - const testDate = new Date(); - testFlat({}, {}); - testFlat({ a: 1 }, { a: 1 }); - testFlat({ a: 'Test' }, { a: 'Test' }); - testFlat({ a: testDate }, { a: testDate }); - testFlat({ a: [] }, { a: [] }); - testFlat({ a: {} }, { a: {} }); - testFlat({ a: [1, 2] }, { 'a.0': 1, 'a.1': 2 }); - testFlat({ a: [1, 2] }, { a: [1, 2] }, { keepArrays: true }); - testFlat({ a: ['Test1', 'Test2'] }, { 'a.0': 'Test1', 'a.1': 'Test2' }); + const testDate = new Date() + testFlat({}, {}) + testFlat({ a: 1 }, { a: 1 }) + testFlat({ a: 'Test' }, { a: 'Test' }) + testFlat({ a: testDate }, { a: testDate }) + testFlat({ a: [] }, { a: [] }) + testFlat({ a: {} }, { a: {} }) + testFlat({ a: [1, 2] }, { 'a.0': 1, 'a.1': 2 }) + testFlat({ a: [1, 2] }, { a: [1, 2] }, { keepArrays: true }) + testFlat({ a: ['Test1', 'Test2'] }, { 'a.0': 'Test1', 'a.1': 'Test2' }) testFlat( { a: ['Test1', 'Test2'] }, { a: ['Test1', 'Test2'] }, - { keepArrays: true }, - ); - testFlat({ a: [testDate, testDate] }, { 'a.0': testDate, 'a.1': testDate }); + { keepArrays: true } + ) + testFlat({ a: [testDate, testDate] }, { 'a.0': testDate, 'a.1': testDate }) testFlat( { a: [testDate, testDate] }, { a: [testDate, testDate] }, - { keepArrays: true }, - ); - testFlat({ a: { b: 1 } }, { 'a.b': 1 }); - testFlat({ a: { b: 'Test' } }, { 'a.b': 'Test' }); - testFlat({ a: { b: testDate } }, { 'a.b': testDate }); - testFlat({ a: { b: [] } }, { 'a.b': [] }); - testFlat({ a: { b: {} } }, { 'a.b': {} }); - testFlat({ a: { b: [1, 2] } }, { 'a.b.0': 1, 'a.b.1': 2 }); - testFlat({ a: { b: [1, 2] } }, { 'a.b': [1, 2] }, { keepArrays: true }); + { keepArrays: true } + ) + testFlat({ a: { b: 1 } }, { 'a.b': 1 }) + testFlat({ a: { b: 'Test' } }, { 'a.b': 'Test' }) + testFlat({ a: { b: testDate } }, { 'a.b': testDate }) + testFlat({ a: { b: [] } }, { 'a.b': [] }) + testFlat({ a: { b: {} } }, { 'a.b': {} }) + testFlat({ a: { b: [1, 2] } }, { 'a.b.0': 1, 'a.b.1': 2 }) + testFlat({ a: { b: [1, 2] } }, { 'a.b': [1, 2] }, { keepArrays: true }) testFlat( { a: { b: ['Test1', 'Test2'] } }, - { 'a.b.0': 'Test1', 'a.b.1': 'Test2' }, - ); + { 'a.b.0': 'Test1', 'a.b.1': 'Test2' } + ) testFlat( { a: { b: ['Test1', 'Test2'] } }, { 'a.b': ['Test1', 'Test2'] }, - { keepArrays: true }, - ); + { keepArrays: true } + ) testFlat( { a: { b: [testDate, testDate] } }, - { 'a.b.0': testDate, 'a.b.1': testDate }, - ); + { 'a.b.0': testDate, 'a.b.1': testDate } + ) testFlat( { a: { b: [testDate, testDate] } }, { 'a.b': [testDate, testDate] }, - { keepArrays: true }, - ); + { keepArrays: true } + ) testFlat( { a: { b: [{ c: 1 }, { c: 2 }] } }, - { 'a.b.0.c': 1, 'a.b.1.c': 2 }, - ); + { 'a.b.0.c': 1, 'a.b.1.c': 2 } + ) testFlat( { a: { b: [{ c: 1 }, { c: 2 }] } }, { 'a.b': [{ c: 1 }, { c: 2 }] }, - { keepArrays: true }, - ); + { keepArrays: true } + ) testFlat( { a: { b: [{ c: 'Test1' }, { c: 'Test2' }] } }, - { 'a.b.0.c': 'Test1', 'a.b.1.c': 'Test2' }, - ); + { 'a.b.0.c': 'Test1', 'a.b.1.c': 'Test2' } + ) testFlat( { a: { b: [{ c: 'Test1' }, { c: 'Test2' }] } }, { 'a.b': [{ c: 'Test1' }, { c: 'Test2' }] }, - { keepArrays: true }, - ); + { keepArrays: true } + ) testFlat( { a: { b: [{ c: testDate }, { c: testDate }] } }, - { 'a.b.0.c': testDate, 'a.b.1.c': testDate }, - ); + { 'a.b.0.c': testDate, 'a.b.1.c': testDate } + ) testFlat( { a: { b: [{ c: testDate }, { c: testDate }] } }, { 'a.b': [{ c: testDate }, { c: testDate }] }, - { keepArrays: true }, - ); - }); + { keepArrays: true } + ) + }) it('removeValueForPosition', () => { // Helper Function - function testRemove(doc: MongoDoc, exp: MongoDoc, pos: string) { - const mDoc = new MongoObject(doc); - mDoc.removeValueForPosition(pos); - expect(mDoc.getObject()).toEqual(exp); + function testRemove (doc: MongoDoc, exp: MongoDoc, pos: string): void { + const mDoc = new MongoObject(doc) + mDoc.removeValueForPosition(pos) + expect(mDoc.getObject()).toEqual(exp) } // correctly removed testRemove( { - foo: 'bar', + foo: 'bar' }, {}, - 'foo', - ); + 'foo' + ) // correctly not removed testRemove( { - foo: 'bar', + foo: 'bar' }, { - foo: 'bar', + foo: 'bar' }, - 'fooBar', - ); + 'fooBar' + ) // all descendents are removed, too testRemove( { foo: { - bar: 'foobar', - }, + bar: 'foobar' + } }, {}, - 'foo', - ); + 'foo' + ) // but not siblings testRemove( { foo: { bar: 'foobar', - foobar: 1, - }, + foobar: 1 + } }, { foo: { - bar: 'foobar', - }, + bar: 'foobar' + } }, - 'foo[foobar]', - ); - }); + 'foo[foobar]' + ) + }) it('getValueForPosition', () => { // Helper Function - function testGetVal(doc: MongoDoc, pos: string, exp: any) { - const mDoc = new MongoObject(doc); - expect(mDoc.getValueForPosition(pos)).toEqual(exp); + function testGetVal (doc: MongoDoc, pos: string, exp: any): void { + const mDoc = new MongoObject(doc) + expect(mDoc.getValueForPosition(pos)).toEqual(exp) } - testGetVal({ $pull: { foo: 'bar' } }, '$pull', { foo: 'bar' }); + testGetVal({ $pull: { foo: 'bar' } }, '$pull', { foo: 'bar' }) - testGetVal({ $pull: { foo: 'bar' } }, '$pull[foo]', 'bar'); + testGetVal({ $pull: { foo: 'bar' } }, '$pull[foo]', 'bar') - testGetVal({ foo: ['bar'] }, 'foo', ['bar']); + testGetVal({ foo: ['bar'] }, 'foo', ['bar']) - testGetVal({ foo: ['bar'] }, 'foo[0]', 'bar'); + testGetVal({ foo: ['bar'] }, 'foo[0]', 'bar') - testGetVal({ foo: [{ a: 1 }, { a: 2 }] }, 'foo', [{ a: 1 }, { a: 2 }]); + testGetVal({ foo: [{ a: 1 }, { a: 2 }] }, 'foo', [{ a: 1 }, { a: 2 }]) - testGetVal({ foo: [{ a: 1 }, { a: 2 }] }, 'foo[1]', { a: 2 }); + testGetVal({ foo: [{ a: 1 }, { a: 2 }] }, 'foo[1]', { a: 2 }) - testGetVal({ foo: [{ a: 1 }, { a: 2 }] }, 'foo[1][a]', 2); - }); + testGetVal({ foo: [{ a: 1 }, { a: 2 }] }, 'foo[1][a]', 2) + }) it('getInfoForKey', () => { // Helper Function - function testGetInfo(doc: MongoDoc, key: string, exp: KeyInfo | undefined) { - const mDoc = new MongoObject(doc); - expect(mDoc.getInfoForKey(key)).toEqual(exp); + function testGetInfo (doc: MongoDoc, key: string, exp: KeyInfo | undefined): void { + const mDoc = new MongoObject(doc) + expect(mDoc.getInfoForKey(key)).toEqual(exp) } testGetInfo({ $set: { foo: 'bar' } }, 'foo', { value: 'bar', - operator: '$set', - }); + operator: '$set' + }) testGetInfo({ $set: { 'foo.bar': 1 } }, 'foo.bar', { value: 1, - operator: '$set', - }); + operator: '$set' + }) - testGetInfo({ $set: { 'foo.bar': 1 } }, '$set', undefined); // Not valid + testGetInfo({ $set: { 'foo.bar': 1 } }, '$set', undefined) // Not valid testGetInfo({ $set: { 'foo.bar.0': 1 } }, 'foo.bar.0', { value: 1, - operator: '$set', - }); + operator: '$set' + }) testGetInfo({ $pull: { foo: 'bar' } }, 'foo', { value: 'bar', - operator: '$pull', - }); + operator: '$pull' + }) - testGetInfo({ foo: ['bar'] }, 'foo', { value: ['bar'], operator: null }); + testGetInfo({ foo: ['bar'] }, 'foo', { value: ['bar'], operator: null }) - testGetInfo({ foo: ['bar'] }, 'foo.0', { value: 'bar', operator: null }); + testGetInfo({ foo: ['bar'] }, 'foo.0', { value: 'bar', operator: null }) testGetInfo({ foo: [{ a: 1 }, { a: 2 }] }, 'foo.1.a', { value: 2, - operator: null, - }); + operator: null + }) testGetInfo({ foo: [{ a: 1 }, { a: 2 }] }, 'foo.1', { value: { a: 2 }, - operator: null, - }); - }); + operator: null + }) + }) it('_keyToPosition', () => { // Helper Function - function convert(key: string, wrapAll: boolean, exp: string) { + function convert (key: string, wrapAll: boolean, exp: string): void { // We must use non-dot-notation to access private prop and keep TypeScript happy // eslint-disable-next-line dot-notation - const pos = MongoObject['_keyToPosition'](key, wrapAll); - expect(pos).toEqual(exp); + // @ts-expect-error private access for testing + const pos = MongoObject._keyToPosition(key, wrapAll) + expect(pos).toEqual(exp) } - convert('foo', false, 'foo'); - convert('foo', true, '[foo]'); - convert('foo.bar', false, 'foo[bar]'); - convert('foo.bar', true, '[foo][bar]'); - convert('foo.bar.0', false, 'foo[bar][0]'); - convert('foo.bar.0', true, '[foo][bar][0]'); - }); + convert('foo', false, 'foo') + convert('foo', true, '[foo]') + convert('foo.bar', false, 'foo[bar]') + convert('foo.bar', true, '[foo][bar]') + convert('foo.bar.0', false, 'foo[bar][0]') + convert('foo.bar.0', true, '[foo][bar][0]') + }) it('makeKeyGeneric', () => { - function testMakeKeyGeneric(input: any, expectedOutput: string | null) { - const generic = MongoObject.makeKeyGeneric(input); - expect(generic).toEqual(expectedOutput); + function testMakeKeyGeneric (input: any, expectedOutput: string | null): void { + const generic = MongoObject.makeKeyGeneric(input) + expect(generic).toEqual(expectedOutput) } - testMakeKeyGeneric(0, null); - testMakeKeyGeneric({}, null); - testMakeKeyGeneric('foo', 'foo'); - testMakeKeyGeneric('foo.bar', 'foo.bar'); - testMakeKeyGeneric('foo.$', 'foo.$'); + testMakeKeyGeneric(0, null) + testMakeKeyGeneric({}, null) + testMakeKeyGeneric('foo', 'foo') + testMakeKeyGeneric('foo.bar', 'foo.bar') + testMakeKeyGeneric('foo.$', 'foo.$') testMakeKeyGeneric( 'foo.0.0.ab.c.123.4square.d.67e.f.g.1', - 'foo.$.$.ab.c.$.4square.d.67e.f.g.$', - ); - testMakeKeyGeneric('foo.$[].foo.$[bar].$.$[]', 'foo.$.foo.$.$.$'); + 'foo.$.$.ab.c.$.4square.d.67e.f.g.$' + ) + testMakeKeyGeneric('foo.$[].foo.$[bar].$.$[]', 'foo.$.foo.$.$.$') testMakeKeyGeneric( 'foo.$foo.$foo[bar]foo.foo$[].foo$[bar]', - 'foo.$foo.$foo[bar]foo.foo$[].foo$[bar]', - ); - }); + 'foo.$foo.$foo[bar]foo.foo$[].foo$[bar]' + ) + }) it('docToModifier', () => { - const date = new Date(); + const date = new Date() const testObj = { a: 1, @@ -334,22 +338,22 @@ describe('MongoObject', () => { a: 1, b: 'foo', c: date, - d: null, // make sure that null, empty, etc. don't end up in $unset when under an array - }, - }, + d: null // make sure that null, empty, etc. don't end up in $unset when under an array + } + } ], - e: [1, 2], + e: [1, 2] }, e: null, f: '', - g: undefined, // undefined props are removed - }; + g: undefined // undefined props are removed + } // Test 1 w/ keepArrays, w/ keepEmptyStrings let mod = MongoObject.docToModifier(testObj, { keepArrays: true, - keepEmptyStrings: true, - }); + keepEmptyStrings: true + }) expect(mod).toEqual({ $set: { a: 1, @@ -367,25 +371,25 @@ describe('MongoObject', () => { d: { a: 1, b: 'foo', - c: date, + c: date // null should have been removed, too - }, - }, + } + } ], 'd.e': [1, 2], // array of non-objects should remain array - f: '', // empty string should be set rather than unset + f: '' // empty string should be set rather than unset }, $unset: { - e: '', - }, - }); + e: '' + } + }) // Test 2 w/ keepArrays, w/o keepEmptyStrings mod = MongoObject.docToModifier(testObj, { keepArrays: true, - keepEmptyStrings: false, - }); + keepEmptyStrings: false + }) expect(mod).toEqual({ $set: { a: 1, @@ -403,25 +407,25 @@ describe('MongoObject', () => { d: { a: 1, b: 'foo', - c: date, + c: date // null should have been removed, too - }, - }, + } + } ], - 'd.e': [1, 2], // array of non-objects should remain array + 'd.e': [1, 2] // array of non-objects should remain array }, $unset: { e: '', - f: '', - }, - }); + f: '' + } + }) // Test 3 w/o keepArrays, w/ keepEmptyStrings mod = MongoObject.docToModifier(testObj, { keepArrays: false, - keepEmptyStrings: true, - }); + keepEmptyStrings: true + }) expect(mod).toEqual({ $set: { a: 1, @@ -438,19 +442,19 @@ describe('MongoObject', () => { 'd.d.0.d.c': date, 'd.e.0': 1, 'd.e.1': 2, - f: '', + f: '' }, $unset: { 'd.d.0.d.d': '', - e: '', - }, - }); + e: '' + } + }) // Test 4 w/o keepArrays, w/o keepEmptyStrings mod = MongoObject.docToModifier(testObj, { keepArrays: false, - keepEmptyStrings: false, - }); + keepEmptyStrings: false + }) expect(mod).toEqual({ $set: { a: 1, @@ -466,217 +470,217 @@ describe('MongoObject', () => { 'd.d.0.d.b': 'foo', 'd.d.0.d.c': date, 'd.e.0': 1, - 'd.e.1': 2, + 'd.e.1': 2 }, $unset: { 'd.d.0.d.d': '', e: '', - f: '', - }, - }); - }); + f: '' + } + }) + }) it('expandObj', () => { - function testExpandObj(val: Record, exp: Record) { - const mod = MongoObject.expandObj(val); - expect(mod).toEqual(exp); + function testExpandObj (val: Record, exp: Record): void { + const mod = MongoObject.expandObj(val) + expect(mod).toEqual(exp) } - testExpandObj({}, {}); - testExpandObj({ foo: 'bar' }, { foo: 'bar' }); - testExpandObj({ foo: 'bar', baz: 1 }, { foo: 'bar', baz: 1 }); + testExpandObj({}, {}) + testExpandObj({ foo: 'bar' }, { foo: 'bar' }) + testExpandObj({ foo: 'bar', baz: 1 }, { foo: 'bar', baz: 1 }) testExpandObj( { 'foo.bar': 'baz', - baz: 1, + baz: 1 }, { foo: { bar: 'baz' }, - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.bar.0': 'foo', 'foo.bar.1': 'baz', - baz: 1, + baz: 1 }, { foo: { bar: ['foo', 'baz'] }, - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.bar.1': 'baz', - baz: 1, + baz: 1 }, { foo: { bar: [, 'baz'] }, // eslint-disable-line no-sparse-arrays - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.bar.1.bam': 'baz', - baz: 1, + baz: 1 }, { foo: { bar: [, { bam: 'baz' }] }, // eslint-disable-line no-sparse-arrays - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.bar.0': null, 'foo.bar.1.bam': 'baz', - baz: 1, + baz: 1 }, { foo: { bar: [null, { bam: 'baz' }] }, - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.bar.0': 'baz', 'foo.bar.1.bam': 'baz', - baz: 1, + baz: 1 }, { foo: { bar: ['baz', { bam: 'baz' }] }, - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.bar.0': 'baz', 'foo.bar.1.bam': 'baz', 'foo.bar.1.boo': 'foo', - baz: 1, + baz: 1 }, { foo: { bar: ['baz', { bam: 'baz', boo: 'foo' }] }, - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.0': null, 'foo.1.bar': 'baz', - baz: 1, + baz: 1 }, { foo: [null, { bar: 'baz' }], - baz: 1, - }, - ); + baz: 1 + } + ) testExpandObj( { 'foo.0': null, 'foo.1.bar': null, - baz: 1, + baz: 1 }, { foo: [null, { bar: null }], - baz: 1, - }, - ); - }); + baz: 1 + } + ) + }) it('setValueForPosition', () => { // Helper Function - function testSet( + function testSet ( doc: MongoDoc, exp: MongoDoc, pos: string, key: string, value: any, - operator: string | null = null, - ) { - const mDoc = new MongoObject(doc); - mDoc.setValueForPosition(pos, value); + operator: string | null = null + ): void { + const mDoc = new MongoObject(doc) + mDoc.setValueForPosition(pos, value) - expect(mDoc.getObject()).toEqual(exp); + expect(mDoc.getObject()).toEqual(exp) expect(mDoc.getInfoForKey(key)).toEqual({ operator, - value, - }); + value + }) } // Correctly set depth 1 - testSet({}, { foo: 'bar' }, 'foo', 'foo', 'bar'); + testSet({}, { foo: 'bar' }, 'foo', 'foo', 'bar') // Correctly set nested object testSet( { foo: { - bar: {}, - }, + bar: {} + } }, { foo: { bar: { - baz: 'baz', - }, - }, + baz: 'baz' + } + } }, 'foo[bar][baz]', 'foo.bar.baz', - 'baz', - ); + 'baz' + ) // Should remove descendants testSet( { foo: { bar: { - baz: 'baz', - }, - }, + baz: 'baz' + } + } }, { foo: { - bar: 'bar', - }, + bar: 'bar' + } }, 'foo[bar]', 'foo.bar', - 'bar', - ); + 'bar' + ) // Should not set siblings testSet( { foo: { bar: 'foobar', - foobar: 1, - }, + foobar: 1 + } }, { foo: { bar: 'baz', - foobar: 1, - }, + foobar: 1 + } }, 'foo[bar]', 'foo.bar', - 'baz', - ); + 'baz' + ) // Correctly set with $set testSet( { $set: { - bar: 'bar', - }, + bar: 'bar' + } }, { $set: { bar: 'foo' } }, '$set[bar]', 'bar', 'foo', - '$set', - ); - }); -}); + '$set' + ) + }) +}) diff --git a/lib/mongo-object.ts b/src/mongo-object.ts similarity index 55% rename from lib/mongo-object.ts rename to src/mongo-object.ts index 5db52bb..b9bfa4f 100644 --- a/lib/mongo-object.ts +++ b/src/mongo-object.ts @@ -10,68 +10,68 @@ import { isObject, keyToPosition, makeKeyGeneric, - reportNulls, -} from './util.js'; + reportNulls +} from './util.js' -const REMOVED_MARKER = '______MONGO_OBJECT_REMOVED______'; +const REMOVED_MARKER = '______MONGO_OBJECT_REMOVED______' -export type MongoDoc = Record; +export type MongoDoc = Record export interface GetFlatObjectOptions { /** * Pass `true` to keep entire arrays */ - keepArrays?: boolean; + keepArrays?: boolean } interface DocToModifierOptions { /** * Pass `true` to $set entire arrays. Otherwise the modifier will $set individual array items. */ - keepArrays?: boolean; + keepArrays?: boolean /** * Pass `true` to keep empty strings in the $set. Otherwise $unset them. */ - keepEmptyStrings?: boolean; + keepEmptyStrings?: boolean } interface PositionInfo { - key: string; - operator: string | null; - position: string; + key: string + operator: string | null + position: string } export interface KeyInfo { - operator: string | null; - value: any; + operator: string | null + value: any } interface MongoUpdateDoc { - $each?: Record; - $set?: Record; - $unset?: Record; + $each?: Record + $set?: Record + $unset?: Record } export default class MongoObject { - private _affectedKeys: Record = {}; + private _affectedKeys: Record = {} - private _arrayItemPositions: string[] = []; + private _arrayItemPositions: string[] = [] - private _blackboxKeys: string[] = []; + private readonly _blackboxKeys: string[] = [] - private _genericAffectedKeys: Record = {}; + private _genericAffectedKeys: Record = {} - private _obj: MongoDoc; + private readonly _obj: MongoDoc - private _objectPositions: string[] = []; + private _objectPositions: string[] = [] - private _parentPositions: string[] = []; + private _parentPositions: string[] = [] - private _positionsByGenericKey: Record = {}; + private _positionsByGenericKey: Record = {} - private _positionsInsideArrays: string[] = []; + private _positionsInsideArrays: string[] = [] - private _positionsThatCreateGenericKey: Record = {}; + private _positionsThatCreateGenericKey: Record = {} /* * @constructor @@ -84,173 +84,176 @@ export default class MongoObject { * upon creation of the instance, the object will have any `undefined` keys * removed recursively. */ - constructor(obj: MongoDoc, blackboxKeys: string[] = []) { - this._obj = obj; - this._blackboxKeys = blackboxKeys; - this._reParseObj(); + constructor (obj: MongoDoc, blackboxKeys: string[] = []) { + this._obj = obj + this._blackboxKeys = blackboxKeys + this._reParseObj() } - _reParseObj() { - const blackboxKeys = this._blackboxKeys; + _reParseObj (): void { + const blackboxKeys = this._blackboxKeys - this._affectedKeys = {}; - this._genericAffectedKeys = {}; - this._positionsByGenericKey = {}; - this._positionsThatCreateGenericKey = {}; - this._parentPositions = []; - this._positionsInsideArrays = []; - this._objectPositions = []; - this._arrayItemPositions = []; + this._affectedKeys = {} + this._genericAffectedKeys = {} + this._positionsByGenericKey = {} + this._positionsThatCreateGenericKey = {} + this._parentPositions = [] + this._positionsInsideArrays = [] + this._objectPositions = [] + this._arrayItemPositions = [] - function parseObj( + function parseObj ( self: MongoObject, val: unknown, currentPosition?: string, affectedKey?: string | null, operator?: string, adjusted?: boolean, - isWithinArray?: boolean, - ) { + isWithinArray?: boolean + ): void { // Adjust for first-level modifier operators - if (!operator && affectedKey && affectedKey.substring(0, 1) === '$') { - operator = affectedKey; - affectedKey = null; + if (operator == null && affectedKey?.substring(0, 1) === '$') { + operator = affectedKey + affectedKey = null } - let affectedKeyIsBlackBox = false; - let stop = false; - if (affectedKey) { + let affectedKeyIsBlackBox = false + let stop = false + if (affectedKey != null) { // Adjust for $push and $addToSet and $pull and $pop - if (!adjusted) { + if (adjusted !== true) { if ( - operator === '$push' - || operator === '$addToSet' - || operator === '$pop' + operator === '$push' || + operator === '$addToSet' || + operator === '$pop' ) { // Adjust for $each // We can simply jump forward and pretend like the $each array // is the array for the field. This has the added benefit of // skipping past any $slice, which we also don't care about. if (isBasicObject(val) && '$each' in (val as MongoUpdateDoc)) { - val = (val as MongoUpdateDoc).$each; - currentPosition = `${currentPosition}[$each]`; + val = (val as MongoUpdateDoc).$each + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + currentPosition = `${currentPosition}[$each]` } else { - affectedKey = `${affectedKey}.0`; + affectedKey = `${affectedKey}.0` } - adjusted = true; + adjusted = true } else if (operator === '$pull') { - affectedKey = `${affectedKey}.0`; + affectedKey = `${affectedKey}.0` if (isBasicObject(val)) { - stop = true; + stop = true } - adjusted = true; + adjusted = true } } // Make generic key - const affectedKeyGeneric = makeKeyGeneric(affectedKey); - if (affectedKeyGeneric === null) throw new Error(`Failed to get generic key for key "${affectedKey}"`); + const affectedKeyGeneric = makeKeyGeneric(affectedKey) + if (affectedKeyGeneric === null) throw new Error(`Failed to get generic key for key "${affectedKey}"`) // Determine whether affected key should be treated as a black box - affectedKeyIsBlackBox = affectedKeyGeneric !== null - && blackboxKeys.indexOf(affectedKeyGeneric) > -1; + affectedKeyIsBlackBox = affectedKeyGeneric !== null && + blackboxKeys.includes(affectedKeyGeneric) // Mark that this position affects this generic and non-generic key - if (currentPosition) { - self._affectedKeys[currentPosition] = affectedKey; - self._genericAffectedKeys[currentPosition] = affectedKeyGeneric; + if (currentPosition != null) { + self._affectedKeys[currentPosition] = affectedKey + self._genericAffectedKeys[currentPosition] = affectedKeyGeneric const positionInfo: PositionInfo = { key: affectedKey, - operator: operator || null, - position: currentPosition, - }; + operator: operator ?? null, + position: currentPosition + } - if (!self._positionsByGenericKey[affectedKeyGeneric]) self._positionsByGenericKey[affectedKeyGeneric] = []; - self._positionsByGenericKey[affectedKeyGeneric].push(positionInfo); + if (self._positionsByGenericKey[affectedKeyGeneric] == null) self._positionsByGenericKey[affectedKeyGeneric] = [] + self._positionsByGenericKey[affectedKeyGeneric].push(positionInfo) // Operators other than $unset will cause ancestor object keys to // be auto-created. - if (operator && operator !== '$unset') { + if (operator != null && operator !== '$unset') { MongoObject.objectsThatGenericKeyWillCreate( - affectedKeyGeneric, + affectedKeyGeneric ).forEach((objGenericKey) => { - if (!self._positionsThatCreateGenericKey[objGenericKey]) { - self._positionsThatCreateGenericKey[objGenericKey] = []; + if (self._positionsThatCreateGenericKey[objGenericKey] === undefined) { + self._positionsThatCreateGenericKey[objGenericKey] = [] } self._positionsThatCreateGenericKey[objGenericKey].push( - positionInfo, - ); - }); + positionInfo + ) + }) } // If we're within an array, mark this position so we can omit it from flat docs - if (isWithinArray) self._positionsInsideArrays.push(currentPosition); + if (isWithinArray === true) self._positionsInsideArrays.push(currentPosition) } } - if (stop) return; + if (stop) return // Loop through arrays if (Array.isArray(val) && val.length > 0) { - if (currentPosition) { + if (currentPosition != null) { // Mark positions with arrays that should be ignored when we want endpoints only - self._parentPositions.push(currentPosition); + self._parentPositions.push(currentPosition) } // Loop val.forEach((v, i) => { - if (currentPosition) self._arrayItemPositions.push(`${currentPosition}[${i}]`); + if (currentPosition != null) self._arrayItemPositions.push(`${currentPosition}[${i}]`) parseObj( self, v, - currentPosition ? `${currentPosition}[${i}]` : String(i), + currentPosition != null ? `${currentPosition}[${i}]` : String(i), + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${affectedKey}.${i}`, operator, adjusted, - true, - ); - }); + true + ) + }) } else if ( - (isBasicObject(val) && !affectedKeyIsBlackBox) - || !currentPosition + (isBasicObject(val) && !affectedKeyIsBlackBox) || + currentPosition == null ) { // Loop through object keys, only for basic objects, // but always for the passed-in object, even if it // is a custom object. - if (currentPosition && !isEmpty(val)) { + if (currentPosition != null && !isEmpty(val)) { // Mark positions with objects that should be ignored when we want endpoints only - self._parentPositions.push(currentPosition); + self._parentPositions.push(currentPosition) // Mark positions with objects that should be left out of flat docs. - self._objectPositions.push(currentPosition); + self._objectPositions.push(currentPosition) } // Loop Object.keys(val as Record).forEach((k) => { - const v = (val as Record)[k]; + const v = (val as Record)[k] if (v === undefined) { - delete (val as Record)[k]; + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete (val as Record)[k] } else if (k !== '$slice') { parseObj( self, v, - currentPosition ? `${currentPosition}[${k}]` : k, + currentPosition != null ? `${currentPosition}[${k}]` : k, appendAffectedKey(affectedKey, k), operator, adjusted, - isWithinArray, - ); + isWithinArray + ) } - }); + }) } } - parseObj(this, this._obj); + parseObj(this, this._obj) } /** @@ -266,72 +269,72 @@ export default class MongoObject { * (3) the representation of what would be changed in mongo, using mongo dot notation * (4) the generic equivalent of argument 3, with '$' instead of numeric pieces */ - forEachNode(func: () => void, { endPointsOnly = true } = {}): void { - if (typeof func !== 'function') throw new Error('filter requires a loop function'); + forEachNode (func: () => void, { endPointsOnly = true } = {}): void { + if (typeof func !== 'function') throw new Error('filter requires a loop function') - const updatedValues: Record = {}; + const updatedValues: Record = {} Object.keys(this._affectedKeys).forEach((position) => { - if (endPointsOnly && this._parentPositions.indexOf(position) > -1) return; // Only endpoints + if (endPointsOnly && this._parentPositions.includes(position)) return // Only endpoints func.call({ value: this.getValueForPosition(position), - isArrayItem: this._arrayItemPositions.indexOf(position) > -1, + isArrayItem: this._arrayItemPositions.includes(position), operator: extractOp(position), position, key: this._affectedKeys[position], genericKey: this._genericAffectedKeys[position], updateValue: (newVal: any) => { - updatedValues[position] = newVal; + updatedValues[position] = newVal }, remove: () => { - updatedValues[position] = undefined; - }, - }); - }); + updatedValues[position] = undefined + } + }) + }) // Actually update/remove values as instructed Object.keys(updatedValues).forEach((position) => { - this.setValueForPosition(position, updatedValues[position]); - }); + this.setValueForPosition(position, updatedValues[position]) + }) } - getValueForPosition(position: string): any { - const subkeys = position.split('['); - let current: any = this._obj; - const ln = subkeys.length; + getValueForPosition (position: string): any { + const subkeys = position.split('[') + let current: any = this._obj + const ln = subkeys.length for (let i = 0; i < ln; i++) { - let subkey = subkeys[i]; + let subkey = subkeys[i] // If the subkey ends in ']', remove the ending - if (subkey.slice(-1) === ']') subkey = subkey.slice(0, -1); - current = current[subkey]; - if (!Array.isArray(current) && !isBasicObject(current) && i < ln - 1) return; + if (subkey.slice(-1) === ']') subkey = subkey.slice(0, -1) + current = current[subkey] + if (!Array.isArray(current) && !isBasicObject(current) && i < ln - 1) return } - if (current === REMOVED_MARKER) return; - return current; + if (current === REMOVED_MARKER) return + return current } /** * @param position * @param value */ - setValueForPosition(position: string, value: any): void { - const subkeys = position.split('['); - let current: any = this._obj; - const ln = subkeys.length; + setValueForPosition (position: string, value: any): void { + const subkeys = position.split('[') + let current: any = this._obj + const ln = subkeys.length - let createdObjectsOrArrays = false; - let affectedKey: string | null | undefined = ''; + let createdObjectsOrArrays = false + let affectedKey: string | null | undefined = '' for (let i = 0; i < ln; i++) { - let subkey = subkeys[i]; + let subkey = subkeys[i] // If the subkey ends in "]", remove the ending - if (subkey.slice(-1) === ']') subkey = subkey.slice(0, -1); + if (subkey.slice(-1) === ']') subkey = subkey.slice(0, -1) // We don't store modifiers - if (subkey && subkey.substring(0, 1) !== '$') { - affectedKey = appendAffectedKey(affectedKey, subkey); + if (subkey.length > 0 && subkey.substring(0, 1) !== '$') { + affectedKey = appendAffectedKey(affectedKey, subkey) } // If we've reached the key in the object tree that needs setting or @@ -342,54 +345,55 @@ export default class MongoObject { if (Array.isArray(current)) { // We can't just delete it because indexes in the position strings will be off // We will mark it uniquely and then parse this elsewhere - current[Number(subkey)] = REMOVED_MARKER; + current[Number(subkey)] = REMOVED_MARKER } else { - delete current[subkey]; + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete current[subkey] } } else { - current[subkey] = value; + current[subkey] = value } - this._affectedKeys[position] = affectedKey; + this._affectedKeys[position] = affectedKey } else { // Otherwise attempt to keep moving deeper into the object. // If we're setting (as opposed to deleting) a key and we hit a place // in the ancestor chain where the keys are not yet created, create them. if (current[subkey] === undefined && value !== undefined) { // See if the next piece is a number - const nextPiece = subkeys[i + 1]; - current[subkey] = Number.isNaN(parseInt(nextPiece, 10)) ? {} : []; - createdObjectsOrArrays = true; + const nextPiece = subkeys[i + 1] + current[subkey] = Number.isNaN(parseInt(nextPiece, 10)) ? {} : [] + createdObjectsOrArrays = true } // Move deeper into the object - current = current[subkey]; + current = current[subkey] // If we can go no further, then quit - if (!Array.isArray(current) && !isBasicObject(current) && i < ln - 1) return; + if (!Array.isArray(current) && !isBasicObject(current) && i < ln - 1) return } } // If there are now new arrays or objects in the main object, we need to reparse it if ( - createdObjectsOrArrays - || Array.isArray(value) - || isBasicObject(value) + createdObjectsOrArrays || + Array.isArray(value) || + isBasicObject(value) ) { - this._reParseObj(); + this._reParseObj() } } - removeValueForPosition(position: string): void { - this.setValueForPosition(position, undefined); + removeValueForPosition (position: string): void { + this.setValueForPosition(position, undefined) } - getKeyForPosition(position: string): string | null | undefined { - return this._affectedKeys[position]; + getKeyForPosition (position: string): string | null | undefined { + return this._affectedKeys[position] } - getGenericKeyForPosition(position: string): string | null | undefined { - return this._genericAffectedKeys[position]; + getGenericKeyForPosition (position: string): string | null | undefined { + return this._genericAffectedKeys[position] } /** @@ -397,14 +401,14 @@ export default class MongoObject { * @returns The value and operator of the requested non-generic key. * Example: {value: 1, operator: "$pull"} */ - getInfoForKey(key: string): KeyInfo | void { + getInfoForKey (key: string): KeyInfo | undefined { // Get the info - const position = this.getPositionForKey(key); - if (position) { + const position = this.getPositionForKey(key) + if (position !== undefined) { return { value: this.getValueForPosition(position), - operator: extractOp(position), - }; + operator: extractOp(position) + } } // If we haven't returned yet, check to see if there is an array value @@ -412,20 +416,20 @@ export default class MongoObject { // We find the first item within the array, strip the last piece off the // position string, and then return whatever is at that new position in // the original object. - const positions = this.getPositionsForGenericKey(`${key}.$`); + const positions = this.getPositionsForGenericKey(`${key}.$`) for (let index = 0; index < positions.length; index++) { - const pos = positions[index]; - let value = this.getValueForPosition(pos); + const pos = positions[index] + let value = this.getValueForPosition(pos) if (value === undefined) { - const parentPosition = pos.slice(0, pos.lastIndexOf('[')); - value = this.getValueForPosition(parentPosition); + const parentPosition = pos.slice(0, pos.lastIndexOf('[')) + value = this.getValueForPosition(parentPosition) } if (value !== undefined) { return { value, - operator: extractOp(pos), - }; + operator: extractOp(pos) + } } } } @@ -437,14 +441,14 @@ export default class MongoObject { * affects the requested non-generic key. * Example: 'foo[bar][0]' */ - getPositionForKey(key: string): string | void { - const positions = Object.getOwnPropertyNames(this._affectedKeys); + getPositionForKey (key: string): string | undefined { + const positions = Object.getOwnPropertyNames(this._affectedKeys) for (let index = 0; index < positions.length; index++) { - const position = positions[index]; + const position = positions[index] // We return the first one we find. While it's // possible that multiple update operators could // affect the same non-generic key, we'll assume that's not the case. - if (this._affectedKeys[position] === key) return position; + if (this._affectedKeys[position] === key) return position } } @@ -454,10 +458,10 @@ export default class MongoObject { * affect the requested generic key. * Example: ['foo[bar][0]'] */ - getPositionsForGenericKey(genericKey: string): string[] { + getPositionsForGenericKey (genericKey: string): string[] { return this.getPositionsInfoForGenericKey(genericKey).map( - (p) => p.position, - ); + (p) => p.position + ) } /** @@ -465,18 +469,18 @@ export default class MongoObject { * @returns An array of position info for the places in the object that * affect the requested generic key. */ - getPositionsInfoForGenericKey(genericKey: string): PositionInfo[] { - let positions = this._positionsByGenericKey[genericKey]; - if (!positions || positions.length === 0) positions = this._positionsByGenericKey[`${genericKey}.$`]; - if (!positions || positions.length === 0) positions = []; + getPositionsInfoForGenericKey (genericKey: string): PositionInfo[] { + let positions = this._positionsByGenericKey[genericKey] + if (positions == null || positions.length === 0) positions = this._positionsByGenericKey[`${genericKey}.$`] + if (positions == null || positions.length === 0) positions = [] return positions.map((info) => ({ value: this.getValueForPosition(info.position), - ...info, - })); + ...info + })) } - getPositionsThatCreateGenericKey(genericKey: string) { - return this._positionsThatCreateGenericKey[genericKey] || []; + getPositionsThatCreateGenericKey (genericKey: string): PositionInfo[] { + return this._positionsThatCreateGenericKey[genericKey] ?? [] } /** @@ -484,9 +488,9 @@ export default class MongoObject { * @param {String} key - Non-generic key * @returns The value of the requested non-generic key */ - getValueForKey(key: string): any { - const position = this.getPositionForKey(key); - if (position) return this.getValueForPosition(position); + getValueForKey (key: string): any { + const position = this.getPositionForKey(key) + if (position != null) return this.getValueForPosition(position) } /** @@ -497,136 +501,138 @@ export default class MongoObject { * @param op Operator under which to set it, or `null` for a non-modifier object * @returns */ - addKey(key: string, val: any, op: string): void { - const position = op ? `${op}[${key}]` : keyToPosition(key); - this.setValueForPosition(position, val); + addKey (key: string, val: any, op: string | null): void { + const position = op != null ? `${op}[${key}]` : keyToPosition(key) + this.setValueForPosition(position, val) } /** * Removes anything that affects any of the generic keys in the list */ - removeGenericKeys(keys: string[]): void { + removeGenericKeys (keys: string[]): void { Object.getOwnPropertyNames(this._genericAffectedKeys).forEach( (position) => { - const genericKey = this._genericAffectedKeys[position]; - if (genericKey !== null && keys.indexOf(genericKey) > -1) { - this.removeValueForPosition(position); + const genericKey = this._genericAffectedKeys[position] + if (genericKey !== null && keys.includes(genericKey)) { + this.removeValueForPosition(position) } - }, - ); + } + ) } /** * Removes anything that affects the requested generic key */ - removeGenericKey(key: string): void { + removeGenericKey (key: string): void { Object.getOwnPropertyNames(this._genericAffectedKeys).forEach( (position) => { if (this._genericAffectedKeys[position] === key) { - this.removeValueForPosition(position); + this.removeValueForPosition(position) } - }, - ); + } + ) } /** * Removes anything that affects the requested non-generic key */ - removeKey(key: string): void { + removeKey (key: string): void { // We don't use getPositionForKey here because we want to be sure to // remove for all positions if there are multiple. Object.getOwnPropertyNames(this._affectedKeys).forEach((position) => { if (this._affectedKeys[position] === key) { - this.removeValueForPosition(position); + this.removeValueForPosition(position) } - }); + }) } /** * Removes anything that affects any of the non-generic keys in the list */ - removeKeys(keys: string[]): void { - keys.forEach((key) => this.removeKey(key)); + removeKeys (keys: string[]): void { + keys.forEach((key) => this.removeKey(key)) } /** * Passes all affected keys to a test function, which * should return false to remove whatever is affecting that key */ - filterGenericKeys(test: (genericKey: string) => boolean): void { - const checkedKeys: string[] = []; - const keysToRemove: string[] = []; + filterGenericKeys (test: (genericKey: string) => boolean): void { + const checkedKeys: string[] = [] + const keysToRemove: string[] = [] Object.getOwnPropertyNames(this._genericAffectedKeys).forEach( (position) => { - const genericKey = this._genericAffectedKeys[position]; - if (genericKey !== null && checkedKeys.indexOf(genericKey) === -1) { - checkedKeys.push(genericKey); - if (genericKey && !test(genericKey)) { - keysToRemove.push(genericKey); + const genericKey = this._genericAffectedKeys[position] + if (genericKey !== null && !checkedKeys.includes(genericKey)) { + checkedKeys.push(genericKey) + if (genericKey != null && !test(genericKey)) { + keysToRemove.push(genericKey) } } - }, - ); + } + ) - keysToRemove.forEach((key) => this.removeGenericKey(key)); + keysToRemove.forEach((key) => this.removeGenericKey(key)) } /** * Sets the value for every place in the object that affects * the requested non-generic key */ - setValueForKey(key: string, val: any): void { + setValueForKey (key: string, val: any): void { // We don't use getPositionForKey here because we want to be sure to // set the value for all positions if there are multiple. Object.getOwnPropertyNames(this._affectedKeys).forEach((position) => { if (this._affectedKeys[position] === key) { - this.setValueForPosition(position, val); + this.setValueForPosition(position, val) } - }); + }) } /** * Sets the value for every place in the object that affects * the requested generic key */ - setValueForGenericKey(key: string, val: any): void { + setValueForGenericKey (key: string, val: any): void { // We don't use getPositionForKey here because we want to be sure to // set the value for all positions if there are multiple. Object.getOwnPropertyNames(this._genericAffectedKeys).forEach( (position) => { if (this._genericAffectedKeys[position] === key) { - this.setValueForPosition(position, val); + this.setValueForPosition(position, val) } - }, - ); + } + ) } - removeArrayItems() { + removeArrayItems (): void { // Traverse and pull out removed array items at this point - function traverse(obj: any) { - each(obj, (val, indexOrProp) => { + function traverse (obj: any): void { + each(obj, (val, indexOrProp): undefined => { // Move deeper into the object - const next = obj[indexOrProp]; + const next = obj[indexOrProp] // If we can go no further, then quit if (isBasicObject(next)) { - traverse(next); + traverse(next) } else if (Array.isArray(next)) { - obj[indexOrProp] = next.filter((item) => item !== REMOVED_MARKER); - traverse(obj[indexOrProp]); + obj[indexOrProp] = next.filter((item) => item !== REMOVED_MARKER) + traverse(obj[indexOrProp]) } - }); + + return undefined + }) } - traverse(this._obj); + traverse(this._obj) } /** * Get the source object, potentially modified by other method calls on this * MongoObject instance. */ - getObject(): MongoDoc { - return this._obj; + getObject (): MongoDoc { + return this._obj } /** @@ -642,25 +648,25 @@ export default class MongoObject { * if ever what we actually want. To avoid this confusion, we * set entire arrays. */ - getFlatObject({ keepArrays = false }: GetFlatObjectOptions = {}): Record< - string, - any + getFlatObject ({ keepArrays = false }: GetFlatObjectOptions = {}): Record< + string, + any > { - const newObj: Record = {}; + const newObj: Record = {} Object.keys(this._affectedKeys).forEach((position) => { - const affectedKey = this._affectedKeys[position]; + const affectedKey = this._affectedKeys[position] if ( - typeof affectedKey === 'string' - && ((keepArrays === true - && this._positionsInsideArrays.indexOf(position) === -1 - && this._objectPositions.indexOf(position) === -1) - || (keepArrays !== true - && this._parentPositions.indexOf(position) === -1)) + typeof affectedKey === 'string' && + ((keepArrays && + !this._positionsInsideArrays.includes(position) && + !this._objectPositions.includes(position)) || + (!keepArrays && + !this._parentPositions.includes(position))) ) { - newObj[affectedKey] = this.getValueForPosition(position); + newObj[affectedKey] = this.getValueForPosition(position) } - }); - return newObj; + }) + return newObj } /** @@ -668,8 +674,8 @@ export default class MongoObject { * @param key Key to test * @returns True if the non-generic key is affected by this object */ - affectsKey(key: string): boolean { - return !!this.getPositionForKey(key); + affectsKey (key: string): boolean { + return this.getPositionForKey(key) !== undefined } /** @@ -677,14 +683,14 @@ export default class MongoObject { * @param key Key to test * @returns True if the generic key is affected by this object */ - affectsGenericKey(key: string): boolean { - const positions = Object.getOwnPropertyNames(this._genericAffectedKeys); + affectsGenericKey (key: string): boolean { + const positions = Object.getOwnPropertyNames(this._genericAffectedKeys) for (let index = 0; index < positions.length; index++) { - const position = positions[index]; - if (this._genericAffectedKeys[position] === key) return true; + const position = positions[index] + if (this._genericAffectedKeys[position] === key) return true } - return false; + return false } /** @@ -692,33 +698,33 @@ export default class MongoObject { * @param key Key to test * @returns Like affectsGenericKey, but will return true if a child key is affected */ - affectsGenericKeyImplicit(key: string): boolean { - const positions = Object.getOwnPropertyNames(this._genericAffectedKeys); + affectsGenericKeyImplicit (key: string): boolean { + const positions = Object.getOwnPropertyNames(this._genericAffectedKeys) for (let index = 0; index < positions.length; index++) { - const position = positions[index]; - const affectedKey = this._genericAffectedKeys[position]; + const position = positions[index] + const affectedKey = this._genericAffectedKeys[position] if ( - affectedKey !== null - && genericKeyAffectsOtherGenericKey(key, affectedKey) - ) return true; + affectedKey !== null && + genericKeyAffectsOtherGenericKey(key, affectedKey) + ) return true } - return false; + return false } /* STATIC */ - private static _keyToPosition = keyToPosition; + private static readonly _keyToPosition = keyToPosition - public static cleanNulls = cleanNulls; + public static cleanNulls = cleanNulls - public static expandKey = expandKey; + public static expandKey = expandKey - public static isBasicObject = isBasicObject; + public static isBasicObject = isBasicObject - public static makeKeyGeneric = makeKeyGeneric; + public static makeKeyGeneric = makeKeyGeneric - public static reportNulls = reportNulls; + public static reportNulls = reportNulls /** * This is different from MongoObject.prototype.getKeyForPosition in that @@ -729,12 +735,12 @@ export default class MongoObject { * @param position * @returns The key that this position in an object would affect. */ - static _positionToKey(position: string): string | null | undefined { + static _positionToKey (position: string): string | null | undefined { // XXX Probably a better way to do this, but this is // foolproof for now. - const mDoc = new MongoObject({}); - mDoc.setValueForPosition(position, 1); // Value doesn't matter - return mDoc.getKeyForPosition(position); + const mDoc = new MongoObject({}) + mDoc.setValueForPosition(position, 1) // Value doesn't matter + return mDoc.getKeyForPosition(position) } /** @@ -748,84 +754,84 @@ export default class MongoObject { * null, undefined, and empty string values into `modifier.$unset`, and * putting the rest of the keys into `modifier.$set`. */ - public static docToModifier( + public static docToModifier ( doc: any, - { keepArrays = false, keepEmptyStrings = false }: DocToModifierOptions = {}, + { keepArrays = false, keepEmptyStrings = false }: DocToModifierOptions = {} ): any { // Flatten doc - const mDoc = new MongoObject(doc); - let flatDoc = mDoc.getFlatObject({ keepArrays }); + const mDoc = new MongoObject(doc) + let flatDoc = mDoc.getFlatObject({ keepArrays }) // Get a list of null, undefined, and empty string values so we can unset them instead - const nulls = reportNulls(flatDoc, keepEmptyStrings); - flatDoc = cleanNulls(flatDoc, false, keepEmptyStrings); + const nulls = reportNulls(flatDoc, keepEmptyStrings) + flatDoc = cleanNulls(flatDoc, false, keepEmptyStrings) - const modifier: MongoUpdateDoc = {}; - if (!isEmpty(flatDoc)) modifier.$set = flatDoc; - if (!isEmpty(nulls)) modifier.$unset = nulls; - return modifier; + const modifier: MongoUpdateDoc = {} + if (!isEmpty(flatDoc)) modifier.$set = flatDoc + if (!isEmpty(nulls)) modifier.$unset = nulls + return modifier } - static objAffectsKey(obj: any, key: string): boolean { - const mDoc = new MongoObject(obj); - return mDoc.affectsKey(key); + static objAffectsKey (obj: any, key: string): boolean { + const mDoc = new MongoObject(obj) + return mDoc.affectsKey(key) } /** * @param genericKey Generic key * @return Array of other generic keys that would be created by this generic key */ - static objectsThatGenericKeyWillCreate(genericKey: string): string[] { - const objs = []; + static objectsThatGenericKeyWillCreate (genericKey: string): string[] { + const objs = [] do { - const lastDotPosition = genericKey.lastIndexOf('.'); - genericKey = lastDotPosition === -1 ? '' : genericKey.slice(0, lastDotPosition); - if (genericKey.length && !genericKey.endsWith('.$')) objs.push(genericKey); - } while (genericKey.length); + const lastDotPosition = genericKey.lastIndexOf('.') + genericKey = lastDotPosition === -1 ? '' : genericKey.slice(0, lastDotPosition) + if (genericKey.length > 0 && !genericKey.endsWith('.$')) objs.push(genericKey) + } while (genericKey.length > 0) - return objs; + return objs } /** * Takes a flat object and returns an expanded version of it. */ - static expandObj(doc: Record): Record { - const newDoc = {}; + static expandObj (doc: Record): Record { + const newDoc = {} Object.keys(doc).forEach((key) => { - const val = doc[key]; - const subkeys = key.split('.'); - const subkeylen = subkeys.length; - let current: any = newDoc; + const val = doc[key] + const subkeys = key.split('.') + const subkeylen = subkeys.length + let current: any = newDoc for (let i = 0; i < subkeylen; i++) { - const subkey = subkeys[i]; + const subkey = subkeys[i] if ( - typeof current[subkey] !== 'undefined' - && !isObject(current[subkey]) + typeof current[subkey] !== 'undefined' && + !isObject(current[subkey]) ) { - break; // Already set for some reason; leave it alone + break // Already set for some reason; leave it alone } if (i === subkeylen - 1) { // Last iteration; time to set the value - current[subkey] = val; + current[subkey] = val } else { // See if the next piece is a number - const nextPiece = subkeys[i + 1]; - const nextPieceInt = parseInt(nextPiece, 10); + const nextPiece = subkeys[i + 1] + const nextPieceInt = parseInt(nextPiece, 10) if (Number.isNaN(nextPieceInt) && !isObject(current[subkey])) { - current[subkey] = {}; + current[subkey] = {} } else if ( - !Number.isNaN(nextPieceInt) - && !Array.isArray(current[subkey]) + !Number.isNaN(nextPieceInt) && + !Array.isArray(current[subkey]) ) { - current[subkey] = []; + current[subkey] = [] } } - current = current[subkey]; + current = current[subkey] } - }); - return newDoc; + }) + return newDoc } } diff --git a/lib/util.test.ts b/src/util.test.ts similarity index 63% rename from lib/util.test.ts rename to src/util.test.ts index 43dc22e..7e40353 100644 --- a/lib/util.test.ts +++ b/src/util.test.ts @@ -1,11 +1,12 @@ -import expectPkg from 'expect'; -import { cleanNulls, reportNulls } from './util.js'; +import expectPkg from 'expect' -const expect = expectPkg.default; +import { cleanNulls, reportNulls } from './util.js' + +const expect = expectPkg.default describe('util', () => { it('cleanNulls', () => { - const date = new Date(); + const date = new Date() const cleaned = cleanNulls({ a: undefined, @@ -18,22 +19,22 @@ describe('util', () => { b: undefined, c: null, d: '', - e: 'keep me', + e: 'keep me' }, g: { - a: null, + a: null }, h: { - a: date, - }, - }); + a: date + } + }) expect(cleaned).toEqual({ e: 'keep me', f: { e: 'keep me' }, - h: { a: date }, - }); - }); + h: { a: date } + }) + }) it('cleanNulls with arrays', () => { const cleaned = cleanNulls({ @@ -42,28 +43,28 @@ describe('util', () => { { c: null, d: '', - e: undefined, + e: undefined }, { c: null, d: '', - e: [null, 'keep', '', undefined], - }, - ], - }, - }); + e: [null, 'keep', '', undefined] + } + ] + } + }) expect(cleaned).toEqual({ a: { b: [ undefined, { - e: [undefined, 'keep'], - }, - ], - }, - }); - }); + e: [undefined, 'keep'] + } + ] + } + }) + }) it('reportNulls', () => { const report = reportNulls({ @@ -71,13 +72,13 @@ describe('util', () => { b: undefined, c: null, d: '', - e: 'keep me', - }); + e: 'keep me' + }) expect(report).toEqual({ a: '', b: '', c: '', - d: '', - }); - }); -}); + d: '' + }) + }) +}) diff --git a/lib/util.ts b/src/util.ts similarity index 56% rename from lib/util.ts rename to src/util.ts index 61c38ea..23d3931 100644 --- a/lib/util.ts +++ b/src/util.ts @@ -1,5 +1,5 @@ /** Used as references for various `Number` constants. */ -const MAX_SAFE_INTEGER = 9007199254740991; +const MAX_SAFE_INTEGER = 9007199254740991 /** * @param doc Source object or array @@ -8,31 +8,31 @@ const MAX_SAFE_INTEGER = 9007199254740991; * @returns An object in which all properties with null, undefined, or empty * string values have been removed, recursively. */ -export function cleanNulls( +export function cleanNulls ( doc: Record, isArray = false, - keepEmptyStrings = false, -) { - const newDoc = isArray ? [] : {}; + keepEmptyStrings = false +): Record | any[] { + const newDoc = isArray ? [] : {} Object.keys(doc).forEach((key) => { - let val = doc[key]; + let val = doc[key] if (!Array.isArray(val) && isBasicObject(val)) { - val = cleanNulls(val, false, keepEmptyStrings); // Recurse into plain objects - if (!isEmpty(val)) (newDoc as Record)[key] = val; + val = cleanNulls(val, false, keepEmptyStrings) // Recurse into plain objects + if (!isEmpty(val)) (newDoc as Record)[key] = val } else if (Array.isArray(val)) { - val = cleanNulls(val, true, keepEmptyStrings); // Recurse into non-typed arrays - if (!isEmpty(val)) (newDoc as Record)[key] = val; + val = cleanNulls(val, true, keepEmptyStrings) // Recurse into non-typed arrays + if (!isEmpty(val)) (newDoc as Record)[key] = val } else if (!isNullUndefinedOrEmptyString(val)) { - (newDoc as Record)[key] = val; + (newDoc as Record)[key] = val } else if ( - keepEmptyStrings - && typeof val === 'string' - && val.length === 0 + keepEmptyStrings && + typeof val === 'string' && + val.length === 0 ) { - (newDoc as Record)[key] = val; + (newDoc as Record)[key] = val } - }); - return newDoc; + }) + return newDoc } /** @@ -40,8 +40,8 @@ export function cleanNulls( * @returns True if obj is an Object as opposed to * something that inherits from Object */ -export function isBasicObject(obj: any): boolean { - return obj === Object(obj) && Object.getPrototypeOf(obj) === Object.prototype; +export function isBasicObject (obj: any): boolean { + return obj === Object(obj) && Object.getPrototypeOf(obj) === Object.prototype } /** @@ -52,150 +52,151 @@ export function isBasicObject(obj: any): boolean { * original object that were null, undefined, or empty strings, and the value * of each key is "". */ -export function reportNulls( +export function reportNulls ( flatDoc: Record, - keepEmptyStrings = false, + keepEmptyStrings = false ): Record { - const nulls: Record = {}; + const nulls: Record = {} // Loop through the flat doc Object.keys(flatDoc).forEach((key) => { - const val = flatDoc[key]; + const val = flatDoc[key] if ( - val === null - || val === undefined - || (!keepEmptyStrings && typeof val === 'string' && val.length === 0) + val === null || + val === undefined || + (!keepEmptyStrings && typeof val === 'string' && val.length === 0) || // If value is an array in which all the values recursively are undefined, null, // or an empty string - || (Array.isArray(val) - && (cleanNulls(val, true, keepEmptyStrings) as any[]).length === 0) + (Array.isArray(val) && + (cleanNulls(val, true, keepEmptyStrings) as any[]).length === 0) ) { - nulls[key] = ''; + nulls[key] = '' } - }); - return nulls; + }) + return nulls } -export function appendAffectedKey( +export function appendAffectedKey ( affectedKey: string | null | undefined, - key: string, + key: string ): string | null | undefined { - if (key === '$each') return affectedKey; - return affectedKey ? `${affectedKey}.${key}` : key; + if (key === '$each') return affectedKey + return (affectedKey != null && affectedKey.length > 0) ? `${affectedKey}.${key}` : key } // Extracts operator piece, if present, from position string -export function extractOp(position: string): string | null { - const firstPositionPiece = position.slice(0, position.indexOf('[')); - return firstPositionPiece.substring(0, 1) === '$' ? firstPositionPiece : null; +export function extractOp (position: string): string | null { + const firstPositionPiece = position.slice(0, position.indexOf('[')) + return firstPositionPiece.substring(0, 1) === '$' ? firstPositionPiece : null } -export function genericKeyAffectsOtherGenericKey( +export function genericKeyAffectsOtherGenericKey ( key: string, - affectedKey: string, + affectedKey: string ): boolean { // If the affected key is the test key - if (affectedKey === key) return true; + if (affectedKey === key) return true // If the affected key implies the test key because the affected key // starts with the test key followed by a period - if (affectedKey.substring(0, key.length + 1) === `${key}.`) return true; + if (affectedKey.substring(0, key.length + 1) === `${key}.`) return true // If the affected key implies the test key because the affected key // starts with the test key and the test key ends with ".$" - const lastTwo = key.slice(-2); - if (lastTwo === '.$' && key.slice(0, -2) === affectedKey) return true; + const lastTwo = key.slice(-2) + if (lastTwo === '.$' && key.slice(0, -2) === affectedKey) return true - return false; + return false } -export function isNullUndefinedOrEmptyString(val: any): boolean { +export function isNullUndefinedOrEmptyString (val: any): boolean { return ( - val === undefined - || val === null - || (typeof val === 'string' && val.length === 0) - ); + val === undefined || + val === null || + (typeof val === 'string' && val.length === 0) + ) } -export function isLength(value: any): boolean { +export function isLength (value: any): boolean { return ( - typeof value === 'number' - && value > -1 - && value % 1 === 0 - && value <= MAX_SAFE_INTEGER - ); + typeof value === 'number' && + value > -1 && + value % 1 === 0 && + value <= MAX_SAFE_INTEGER + ) } -export function isArrayLike(value: any): boolean { - return value != null && typeof value !== 'function' && isLength(value.length); +export function isArrayLike (value: any): boolean { + return value != null && typeof value !== 'function' && isLength(value.length) } -export function each( +export function each ( collection: any, - iteratee: (item: any, keyOrIndex: number | string, obj: any) => boolean | void, + iteratee: (item: any, keyOrIndex: number | string, obj: any) => boolean | undefined ): void { if (collection == null) { - return; + return } if (Array.isArray(collection)) { - collection.forEach(iteratee); - return; + collection.forEach(iteratee) + return } - const iterable = Object(collection); + const iterable = Object(collection) if (!isArrayLike(collection)) { - Object.keys(iterable).forEach((key) => iteratee(iterable[key], key, iterable)); - return; + Object.keys(iterable).forEach((key) => iteratee(iterable[key], key, iterable)) + return } - let index = -1; + let index = -1 while (++index < collection.length) { if (iteratee(iterable[index], index, iterable) === false) { - break; + break } } } -export function isPrototype(value: any): boolean { - const Ctor = value && value.constructor; - const proto = (typeof Ctor === 'function' && Ctor.prototype) || Object.prototype; - - return value === proto; +export function isPrototype (value: unknown): boolean { + const Ctor = value?.constructor + if (typeof Ctor !== 'function' || Ctor.prototype === undefined) { + return value === Object.prototype + } + return value === Ctor.prototype } -export function isEmpty(value: any): boolean { +export function isEmpty (value: any): boolean { if (value === null || value === undefined) { - return true; + return true } if (Array.isArray(value) || typeof value === 'string') { - return !value.length; + return value.length === 0 } - const tag = Object.prototype.toString.call(value); + const tag = Object.prototype.toString.call(value) if (tag === '[object Map]' || tag === '[object Set]') { - return !value.size; + return value.size === 0 } if (isPrototype(value)) { - return !Object.keys(value).length; + return Object.keys(value).length === 0 } // eslint-disable-next-line no-restricted-syntax for (const key in value) { if (Object.hasOwnProperty.call(value, key)) { - return false; + return false } } - return true; + return true } -export function isObject(value: any): boolean { - const type = typeof value; - return value != null && (type === 'object' || type === 'function'); +export function isObject (value: any): boolean { + const type = typeof value + return value != null && (type === 'object' || type === 'function') } /* Takes a specific string that uses any mongo-style positional update @@ -206,21 +207,21 @@ export function isObject(value: any): boolean { * @param key A specific or generic key * @returns Generic name. */ -export function makeKeyGeneric(key: string): string | null { - if (typeof key !== 'string') return null; - return key.replace(/\.([0-9]+|\$\[[^\]]*\])(?=\.|$)/g, '.$'); +export function makeKeyGeneric (key: string): string | null { + if (typeof key !== 'string') return null + return key.replace(/\.([0-9]+|\$\[[^\]]*\])(?=\.|$)/g, '.$') } -export function keyToPosition(key: string, wrapAll = false): string { - let position = ''; +export function keyToPosition (key: string, wrapAll = false): string { + let position = '' key.split('.').forEach((piece, i) => { if (i === 0 && !wrapAll) { - position += piece; + position += piece } else { - position += `[${piece}]`; + position += `[${piece}]` } - }); - return position; + }) + return position } /** @@ -236,29 +237,30 @@ export function keyToPosition(key: string, wrapAll = false): string { * @param key Key * @param obj Object */ -export function expandKey(val: any, key: string, obj: any): void { - const subkeys = key.split('['); - let current = obj; +export function expandKey (val: any, key: string, obj: any): void { + const subkeys = key.split('[') + let current = obj for (let i = 0, ln = subkeys.length; i < ln; i++) { - let subkey = subkeys[i]; + let subkey = subkeys[i] if (subkey.slice(-1) === ']') { - subkey = subkey.slice(0, -1); + subkey = subkey.slice(0, -1) } if (i === ln - 1) { // Last iteration; time to set the value; always overwrite - current[subkey] = val; + current[subkey] = val // If val is undefined, delete the property - if (val === undefined) delete current[subkey]; + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + if (val === undefined) delete current[subkey] } else { // See if the next piece is a number - const nextPiece = subkeys[i + 1]; - if (!current[subkey]) { - current[subkey] = Number.isNaN(parseInt(nextPiece, 10)) ? {} : []; + const nextPiece = subkeys[i + 1] + if (current[subkey] === undefined) { + current[subkey] = Number.isNaN(parseInt(nextPiece, 10)) ? {} : [] } } - current = current[subkey]; + current = current[subkey] } } diff --git a/tsconfig-base.json b/tsconfig-base.json new file mode 100644 index 0000000..dcdbfda --- /dev/null +++ b/tsconfig-base.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Language and Environment */ + "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Modules */ + "module": "node16", + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node16", + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "compileOnSave": false, + "exclude": [ + "node_modules", + "dist" + ], + "include": [ + "src" + ] +} \ No newline at end of file diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json new file mode 100644 index 0000000..458d64b --- /dev/null +++ b/tsconfig-cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig-base.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "dist/cjs" + } +} \ No newline at end of file diff --git a/tsconfig-eslint.json b/tsconfig-eslint.json new file mode 100644 index 0000000..f38897e --- /dev/null +++ b/tsconfig-eslint.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "src", + "test" + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 77742e8..729ad07 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,31 +1,11 @@ { - "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - "outDir": "./dist", - "rootDir": "./lib", - - /* Language and Environment */ - "lib": ["ES2022"], - "target": "ES2022", - "module": "ES2022", - "moduleResolution": "Node16", - - /* Interop Constraints */ - "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - - /* Type Checking */ - "strict": true /* Enable all strict type-checking options. */, - "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */, - "noImplicitThis": true /* Enable error reporting when 'this' is given the type 'any'. */, - "useUnknownInCatchVariables": true /* Default catch clause variables as 'unknown' instead of 'any'. */, - - /* Completeness */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - }, + "extends": "./tsconfig-base.json", "ts-node": { - "esm": true + "files": true }, - "include": ["lib/**/*"], - "exclude": ["node_modules"] -} + "compilerOptions": { + "declaration": true, + "module": "node16", + "outDir": "dist/esm" + } +} \ No newline at end of file