From eb152d4dfd63c40a55e32b6941dde4639919a524 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 13 Mar 2024 17:26:07 +0100 Subject: [PATCH] Lint --- .eslintrc | 31 +- jest-mongodb-config.ts | 6 +- jest.config.ts | 14 +- package-lock.json | 644 ++++++++++++++++++++------ package.json | 9 +- src/cache/Cache.ts | 12 +- src/cache/engine/MemoryCacheEngine.ts | 18 +- src/cache/engine/RedisCacheEngine.ts | 12 +- src/extend/aggregate.ts | 6 +- src/extend/query.ts | 4 +- src/key.ts | 2 +- src/plugin.ts | 8 +- tests/cache-memory.test.ts | 20 +- tests/cache-options.test.ts | 10 +- tests/cache-redis.test.ts | 40 +- tests/key.test.ts | 36 +- tests/schemas/StorySchema.ts | 6 +- tests/schemas/UserSchema.ts | 10 +- 18 files changed, 621 insertions(+), 267 deletions(-) diff --git a/.eslintrc b/.eslintrc index 6061016..3d76170 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,8 +13,9 @@ ], "extends": [ "eslint:recommended", + "plugin:sonarjs/recommended", "plugin:@typescript-eslint/eslint-recommended", - "plugin:sonarjs/recommended" + "plugin:@stylistic/recommended-extends" ], "globals": { "Atomics": "readonly", @@ -25,33 +26,13 @@ "sourceType": "module" }, "rules": { - "comma-dangle": [ - "error", - "never" - ], + + "@stylistic/arrow-parens": ["error", "always"], + "@stylistic/brace-style": ["error", "1tbs"], "@typescript-eslint/array-type": "error", "@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/method-signature-style": "error", - "@typescript-eslint/consistent-indexed-object-style": "error", - "indent": [ - "error", - 2 - ], - "arrow-parens": [ - "error" - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "never" - ] + "@typescript-eslint/consistent-indexed-object-style": "error" }, "overrides": [ { diff --git a/jest-mongodb-config.ts b/jest-mongodb-config.ts index d6b3200..35fd69a 100644 --- a/jest-mongodb-config.ts +++ b/jest-mongodb-config.ts @@ -1,10 +1,10 @@ export default { mongodbMemoryServerOptions: { binary: { - skipMD5: true + skipMD5: true, }, autoStart: false, - instance: {} + instance: {}, }, - useSharedDBForAllJestWorkers: false + useSharedDBForAllJestWorkers: false, } diff --git a/jest.config.ts b/jest.config.ts index 24276e7..c61c8d9 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -5,28 +5,28 @@ const mongo = require('@shelf/jest-mongodb/jest-preset') const config = recursive(mongo, { roots: [ '/src/', - '/tests/' + '/tests/', ], clearMocks: true, collectCoverage: true, collectCoverageFrom: [ 'src/**/*.ts', '!src/**/*.d.ts', - '!src/interfaces/**/*.ts' + '!src/interfaces/**/*.ts', ], coverageDirectory: 'coverage', testMatch: [ - '/tests/**/*.test.ts' + '/tests/**/*.test.ts', ], transform: { - '^.+\\.(t|j)sx?$': '@swc/jest' + '^.+\\.(t|j)sx?$': '@swc/jest', }, testPathIgnorePatterns: [ - 'node_modules' + 'node_modules', ], watchPathIgnorePatterns: [ - 'globalConfig' - ] + 'globalConfig', + ], }) module.exports = config diff --git a/package-lock.json b/package-lock.json index 01a5a0a..8a0f674 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,25 +15,26 @@ }, "devDependencies": { "@shelf/jest-mongodb": "4.2.0", + "@stylistic/eslint-plugin": "1.6.3", "@swc/cli": "0.3.10", - "@swc/core": "1.4.2", + "@swc/core": "1.4.7", "@swc/helpers": "0.5.6", "@swc/jest": "0.2.36", "@swc/register": "0.1.10", "@types/jest": "29.5.12", "@types/ms": "0.7.34", "@types/node": "20", - "@typescript-eslint/eslint-plugin": "7.1.0", - "@typescript-eslint/parser": "7.1.0", + "@typescript-eslint/eslint-plugin": "7.2.0", + "@typescript-eslint/parser": "7.2.0", "eslint": "8.57.0", "eslint-plugin-jest": "27.9.0", "eslint-plugin-jest-formatting": "3.1.0", "eslint-plugin-sonarjs": "0.24.0", "jest": "29.7.0", "merge": "2.1.1", - "mongoose": "*", + "mongoose": "latest", "open-cli": "8.0.0", - "typescript": "5.3.3" + "typescript": "5.4.2" }, "engines": { "node": ">=16" @@ -2701,6 +2702,361 @@ "node": ">=14.0.0" } }, + "node_modules/@stylistic/eslint-plugin": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-1.6.3.tgz", + "integrity": "sha512-WDa4FjhImp7YcztRaMG09svhKYYhi2Hc4p9ltQRSqyB4fsUUFm+GKzStqqH7xfjHnxacMJaOnaMGRTUqIIZDLA==", + "dev": true, + "dependencies": { + "@stylistic/eslint-plugin-js": "1.6.3", + "@stylistic/eslint-plugin-jsx": "1.6.3", + "@stylistic/eslint-plugin-plus": "1.6.3", + "@stylistic/eslint-plugin-ts": "1.6.3", + "@types/eslint": "^8.56.2" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-js": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.6.3.tgz", + "integrity": "sha512-ckdz51oHxD2FaxgY2piJWJVJiwgp8Uu96s+as2yB3RMwavn3nHBrpliVukXY9S/DmMicPRB2+H8nBk23GDG+qA==", + "dev": true, + "dependencies": { + "@types/eslint": "^8.56.2", + "acorn": "^8.11.3", + "escape-string-regexp": "^4.0.0", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-jsx": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-jsx/-/eslint-plugin-jsx-1.6.3.tgz", + "integrity": "sha512-SRysCIg59Zvn3dJPqHziiHwuni4NNj1et5stAmivmyQ3Cdp2ULCB7tGxCF1OxpkwRlZQue3ZgdiM7EXfJKaf9w==", + "dev": true, + "dependencies": { + "@stylistic/eslint-plugin-js": "^1.6.3", + "@types/eslint": "^8.56.2", + "estraverse": "^5.3.0", + "picomatch": "^4.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-jsx/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/@stylistic/eslint-plugin-jsx/node_modules/picomatch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.1.tgz", + "integrity": "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@stylistic/eslint-plugin-plus": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-plus/-/eslint-plugin-plus-1.6.3.tgz", + "integrity": "sha512-TuwQOdyVGycDPw5XeF7W4f3ZonAVzOAzORSaD2yGAJ0fRAbJ+l/v3CkKzIAqBBwWkc+c2aRMsWtLP2+viBnmlQ==", + "dev": true, + "dependencies": { + "@types/eslint": "^8.56.2", + "@typescript-eslint/utils": "^6.21.0" + }, + "peerDependencies": { + "eslint": "*" + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@stylistic/eslint-plugin-plus/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@stylistic/eslint-plugin-ts": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-ts/-/eslint-plugin-ts-1.6.3.tgz", + "integrity": "sha512-v5GwZsPLblWM9uAIdaSi31Sed3XBWlTFQJ3b5upEmj6QsKYivA5nmIYutwqqL133QdVWjmC86pINlx2Muq3uNQ==", + "dev": true, + "dependencies": { + "@stylistic/eslint-plugin-js": "1.6.3", + "@types/eslint": "^8.56.2", + "@typescript-eslint/utils": "^6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@swc/cli": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.3.10.tgz", @@ -2760,9 +3116,9 @@ } }, "node_modules/@swc/core": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.2.tgz", - "integrity": "sha512-vWgY07R/eqj1/a0vsRKLI9o9klGZfpLNOVEnrv4nrccxBgYPjcf22IWwAoaBJ+wpA7Q4fVjCUM8lP0m01dpxcg==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.7.tgz", + "integrity": "sha512-I7a9sUxB+z+UCf6KudqrQH/RgLal/S+E+t4uBdbggycLyJe7WvBgPrQlcN5UpEuD9YC2PJ0CN6kgD6ARStg+pg==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -2777,16 +3133,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.4.2", - "@swc/core-darwin-x64": "1.4.2", - "@swc/core-linux-arm-gnueabihf": "1.4.2", - "@swc/core-linux-arm64-gnu": "1.4.2", - "@swc/core-linux-arm64-musl": "1.4.2", - "@swc/core-linux-x64-gnu": "1.4.2", - "@swc/core-linux-x64-musl": "1.4.2", - "@swc/core-win32-arm64-msvc": "1.4.2", - "@swc/core-win32-ia32-msvc": "1.4.2", - "@swc/core-win32-x64-msvc": "1.4.2" + "@swc/core-darwin-arm64": "1.4.7", + "@swc/core-darwin-x64": "1.4.7", + "@swc/core-linux-arm-gnueabihf": "1.4.7", + "@swc/core-linux-arm64-gnu": "1.4.7", + "@swc/core-linux-arm64-musl": "1.4.7", + "@swc/core-linux-x64-gnu": "1.4.7", + "@swc/core-linux-x64-musl": "1.4.7", + "@swc/core-win32-arm64-msvc": "1.4.7", + "@swc/core-win32-ia32-msvc": "1.4.7", + "@swc/core-win32-x64-msvc": "1.4.7" }, "peerDependencies": { "@swc/helpers": "^0.5.0" @@ -2798,9 +3154,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.2.tgz", - "integrity": "sha512-1uSdAn1MRK5C1m/TvLZ2RDvr0zLvochgrZ2xL+lRzugLlCTlSA+Q4TWtrZaOz+vnnFVliCpw7c7qu0JouhgQIw==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.7.tgz", + "integrity": "sha512-IhfP2Mrrh9WcdlBJQbPNBhfdOhW/SC910SiuzvxaLgJmzq1tw6TVDNUz4Zf85TbK5uzgR0emtPc9hTGxynl57A==", "cpu": [ "arm64" ], @@ -2814,9 +3170,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.2.tgz", - "integrity": "sha512-TYD28+dCQKeuxxcy7gLJUCFLqrwDZnHtC2z7cdeGfZpbI2mbfppfTf2wUPzqZk3gEC96zHd4Yr37V3Tvzar+lQ==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.7.tgz", + "integrity": "sha512-MO01pnxJDS6st5IiqyTnAOz9kpAPP/O4lzEUH9E80XdXBzwptS5hNTM0egBlqueWDFrPM26RI81JLtyTU7kR8w==", "cpu": [ "x64" ], @@ -2830,9 +3186,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.2.tgz", - "integrity": "sha512-Eyqipf7ZPGj0vplKHo8JUOoU1un2sg5PjJMpEesX0k+6HKE2T8pdyeyXODN0YTFqzndSa/J43EEPXm+rHAsLFQ==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.7.tgz", + "integrity": "sha512-+cDaXW6PZqGhXIq9C4xE+/QuyUsLkXf8d8uSXep+rZYDl4YHS9Fi7HpZQnqLX6al/iVhwe3VnxHMGw50gxcr/g==", "cpu": [ "arm" ], @@ -2846,9 +3202,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.2.tgz", - "integrity": "sha512-wZn02DH8VYPv3FC0ub4my52Rttsus/rFw+UUfzdb3tHMHXB66LqN+rR0ssIOZrH6K+VLN6qpTw9VizjyoH0BxA==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.7.tgz", + "integrity": "sha512-RNnVHRKhEtA3pM34wgb3Vumf5M6/XlWzFdkHEMZIkOKyNSUhZiv8X3tsEK+n1rZQWIDkvlw4YyHtB8vK18WdCA==", "cpu": [ "arm64" ], @@ -2862,9 +3218,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.2.tgz", - "integrity": "sha512-3G0D5z9hUj9bXNcwmA1eGiFTwe5rWkuL3DsoviTj73TKLpk7u64ND0XjEfO0huVv4vVu9H1jodrKb7nvln/dlw==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.7.tgz", + "integrity": "sha512-p7Xm4Pib02d1SFS9XXMoOcCTDIkFWMspspptPX00VcjAdZYnXWujWGuD2W+KN1gq5syHB1g3TsYs9LP2dGsKqw==", "cpu": [ "arm64" ], @@ -2878,9 +3234,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.2.tgz", - "integrity": "sha512-LFxn9U8cjmYHw3jrdPNqPAkBGglKE3tCZ8rA7hYyp0BFxuo7L2ZcEnPm4RFpmSCCsExFH+LEJWuMGgWERoktvg==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.7.tgz", + "integrity": "sha512-ViI5jy03cFYPETsye1J+oPbHE4v8oIDN34qebzvgHUlNKOXfc1ig0Zha5oQnKp3zj1rmjcSLIMqK++WR021G5A==", "cpu": [ "x64" ], @@ -2894,9 +3250,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.2.tgz", - "integrity": "sha512-dp0fAmreeVVYTUcb4u9njTPrYzKnbIH0EhH2qvC9GOYNNREUu2GezSIDgonjOXkHiTCvopG4xU7y56XtXj4VrQ==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.7.tgz", + "integrity": "sha512-Nf3Axcx/ILl7XE44eidNNPF39rg/KIeqg2545vrOXJG02iu7pEjZuu8wm6w+23BpP4COjZJymlg9LzPT1ZBD5Q==", "cpu": [ "x64" ], @@ -2910,9 +3266,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.2.tgz", - "integrity": "sha512-HlVIiLMQkzthAdqMslQhDkoXJ5+AOLUSTV6fm6shFKZKqc/9cJvr4S8UveNERL9zUficA36yM3bbfo36McwnvQ==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.7.tgz", + "integrity": "sha512-MFkJEaC59AO2HpndmHhCkaj8NJus5etjMtBphOe9em7jmmfdQ7mLenKHbZ/CspHNl8yNPO9Qzpa/at2838x+RQ==", "cpu": [ "arm64" ], @@ -2926,9 +3282,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.2.tgz", - "integrity": "sha512-WCF8faPGjCl4oIgugkp+kL9nl3nUATlzKXCEGFowMEmVVCFM0GsqlmGdPp1pjZoWc9tpYanoXQDnp5IvlDSLhA==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.7.tgz", + "integrity": "sha512-nwrfERocUei9sxqd6URrWcEC3KDcTBD+beMerB9idvuzy4rcm5k1O1ClUlZ9pJOZn+vMN1tqZjLze4hJMT9STQ==", "cpu": [ "ia32" ], @@ -2942,9 +3298,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.2.tgz", - "integrity": "sha512-oV71rwiSpA5xre2C5570BhCsg1HF97SNLsZ/12xv7zayGzqr3yvFALFJN8tHKpqUdCB4FGPjoP3JFdV3i+1wUw==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.7.tgz", + "integrity": "sha512-d5T8Z/axAml8FTA+T9RS2mwJDNIbSSz5jcEiWaGuKVDIoSZib2HpMvnMydOGsIrmjfS1Z4ZhdAawivPhAZ3M8Q==", "cpu": [ "x64" ], @@ -3115,6 +3471,22 @@ "@types/responselike": "^1.0.0" } }, + "node_modules/@types/eslint": { + "version": "8.56.5", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz", + "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, "node_modules/@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -3247,16 +3619,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.0.tgz", - "integrity": "sha512-j6vT/kCulhG5wBmGtstKeiVr1rdXE4nk+DT1k6trYkwlrvW9eOF5ZbgKnd/YR6PcM4uTEXa0h6Fcvf6X7Dxl0w==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.2.0.tgz", + "integrity": "sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/type-utils": "7.1.0", - "@typescript-eslint/utils": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/scope-manager": "7.2.0", + "@typescript-eslint/type-utils": "7.2.0", + "@typescript-eslint/utils": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -3282,13 +3654,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz", + "integrity": "sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3299,9 +3671,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.2.0.tgz", + "integrity": "sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3312,13 +3684,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", - "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz", + "integrity": "sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3340,17 +3712,17 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", - "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.2.0.tgz", + "integrity": "sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/scope-manager": "7.2.0", + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/typescript-estree": "7.2.0", "semver": "^7.5.4" }, "engines": { @@ -3365,12 +3737,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz", + "integrity": "sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/types": "7.2.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -3406,15 +3778,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", - "integrity": "sha512-V1EknKUubZ1gWFjiOZhDSNToOjs63/9O0puCgGS8aDOgpZY326fzFu15QAUjwaXzRZjf/qdsdBrckYdv9YxB8w==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.2.0.tgz", + "integrity": "sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/scope-manager": "7.2.0", + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/typescript-estree": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0", "debug": "^4.3.4" }, "engines": { @@ -3434,13 +3806,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz", + "integrity": "sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3451,9 +3823,9 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.2.0.tgz", + "integrity": "sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3464,13 +3836,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", - "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz", + "integrity": "sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3492,12 +3864,12 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz", + "integrity": "sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/types": "7.2.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -3550,13 +3922,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.0.tgz", - "integrity": "sha512-UZIhv8G+5b5skkcuhgvxYWHjk7FW7/JP5lPASMEUoliAPwIH/rxoUSQPia2cuOj9AmDZmwUl1usKm85t5VUMew==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.2.0.tgz", + "integrity": "sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.1.0", - "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/typescript-estree": "7.2.0", + "@typescript-eslint/utils": "7.2.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -3577,13 +3949,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz", + "integrity": "sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3594,9 +3966,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.2.0.tgz", + "integrity": "sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3607,13 +3979,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", - "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz", + "integrity": "sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/visitor-keys": "7.2.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3635,17 +4007,17 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", - "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.2.0.tgz", + "integrity": "sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/scope-manager": "7.2.0", + "@typescript-eslint/types": "7.2.0", + "@typescript-eslint/typescript-estree": "7.2.0", "semver": "^7.5.4" }, "engines": { @@ -3660,12 +4032,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz", + "integrity": "sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/types": "7.2.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -3790,9 +4162,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", - "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -8803,9 +9175,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 2d3fe24..fd11b8a 100644 --- a/package.json +++ b/package.json @@ -82,16 +82,17 @@ }, "devDependencies": { "@shelf/jest-mongodb": "4.2.0", + "@stylistic/eslint-plugin": "1.6.3", "@swc/cli": "0.3.10", - "@swc/core": "1.4.2", + "@swc/core": "1.4.7", "@swc/helpers": "0.5.6", "@swc/jest": "0.2.36", "@swc/register": "0.1.10", "@types/jest": "29.5.12", "@types/ms": "0.7.34", "@types/node": "20", - "@typescript-eslint/eslint-plugin": "7.1.0", - "@typescript-eslint/parser": "7.1.0", + "@typescript-eslint/eslint-plugin": "7.2.0", + "@typescript-eslint/parser": "7.2.0", "eslint": "8.57.0", "eslint-plugin-jest": "27.9.0", "eslint-plugin-jest-formatting": "3.1.0", @@ -100,7 +101,7 @@ "merge": "2.1.1", "mongoose": "latest", "open-cli": "8.0.0", - "typescript": "5.3.3" + "typescript": "5.4.2" }, "peerDependencies": { "mongoose": ">=6.6.0 < 9" diff --git a/src/cache/Cache.ts b/src/cache/Cache.ts index 058f9e6..e661352 100644 --- a/src/cache/Cache.ts +++ b/src/cache/Cache.ts @@ -12,7 +12,7 @@ class CacheEngine { #defaultTTL: number readonly #engines = ['memory', 'redis'] as const - constructor (cacheOptions: ICacheOptions) { + constructor(cacheOptions: ICacheOptions) { if (!this.#engines.includes(cacheOptions.engine)) { throw new Error(`Invalid engine name: ${cacheOptions.engine}`) } @@ -32,24 +32,24 @@ class CacheEngine { } } - async get (key: string): Promise { + async get(key: string): Promise { return this.#engine.get(key) } - async set (key: string, value: Record | Record[], ttl: string | null): Promise { + async set(key: string, value: Record | Record[], ttl: string | null): Promise { const actualTTL = ttl ? ms(ttl) : this.#defaultTTL return this.#engine.set(key, value, actualTTL) } - async del (key: string): Promise { + async del(key: string): Promise { return this.#engine.del(key) } - async clear (): Promise { + async clear(): Promise { return this.#engine.clear() } - async close (): Promise { + async close(): Promise { return this.#engine.close() } } diff --git a/src/cache/engine/MemoryCacheEngine.ts b/src/cache/engine/MemoryCacheEngine.ts index b3ae702..d8e2e31 100644 --- a/src/cache/engine/MemoryCacheEngine.ts +++ b/src/cache/engine/MemoryCacheEngine.ts @@ -4,11 +4,11 @@ import type ICacheEngine from '../../interfaces/ICacheEngine' class MemoryCacheEngine implements ICacheEngine { #cache: Map - constructor () { + constructor() { this.#cache = new Map() } - get (key: string): IData { + get(key: string): IData { const item = this.#cache.get(key) if (!item || item.expiresAt < Date.now()) { this.del(key) @@ -17,22 +17,22 @@ class MemoryCacheEngine implements ICacheEngine { return item.value } - set (key: string, value: IData, ttl = Infinity): void { - this.#cache.set(key, { - value, - expiresAt: Date.now() + ttl + set(key: string, value: IData, ttl = Infinity): void { + this.#cache.set(key, { + value, + expiresAt: Date.now() + ttl, }) } - del (key: string): void { + del(key: string): void { this.#cache.delete(key) } - clear (): void { + clear(): void { this.#cache.clear() } - close (): void { + close(): void { // do nothing } } diff --git a/src/cache/engine/RedisCacheEngine.ts b/src/cache/engine/RedisCacheEngine.ts index 55308f6..8a7c512 100644 --- a/src/cache/engine/RedisCacheEngine.ts +++ b/src/cache/engine/RedisCacheEngine.ts @@ -8,14 +8,14 @@ import type ICacheEngine from '../../interfaces/ICacheEngine' class RedisCacheEngine implements ICacheEngine { #client: Redis - constructor (options: RedisOptions) { + constructor(options: RedisOptions) { if (!options.keyPrefix) { options.keyPrefix = 'cache-mongoose:' } this.#client = new IORedis(options) } - async get (key: string): Promise { + async get(key: string): Promise { const value = await this.#client.get(key) if (value === null) { return undefined @@ -33,20 +33,20 @@ class RedisCacheEngine implements ICacheEngine { }) as Promise | Record[]> } - async set (key: string, value: unknown, ttl = Infinity): Promise { + async set(key: string, value: unknown, ttl = Infinity): Promise { const serializedValue = JSON.stringify(value) await this.#client.setex(key, Math.ceil(ttl / 1000), serializedValue) } - async del (key: string): Promise { + async del(key: string): Promise { await this.#client.del(key) } - async clear (): Promise { + async clear(): Promise { await this.#client.flushdb() } - async close (): Promise { + async close(): Promise { await this.#client.quit() } } diff --git a/src/extend/aggregate.ts b/src/extend/aggregate.ts index b0c2191..1080bcf 100644 --- a/src/extend/aggregate.ts +++ b/src/extend/aggregate.ts @@ -3,16 +3,16 @@ import type Cache from '../cache/Cache' import { getKey } from '../key' -export default function extendQuery (mongoose: Mongoose, cache: Cache): void { +export default function extendQuery(mongoose: Mongoose, cache: Cache): void { // eslint-disable-next-line @typescript-eslint/unbound-method const mongooseExec = mongoose.Aggregate.prototype.exec // eslint-disable-next-line @typescript-eslint/explicit-function-return-type mongoose.Aggregate.prototype.getCacheKey = function () { if (this._key != null) return this._key - + return getKey({ - pipeline: this.pipeline() + pipeline: this.pipeline(), }) } diff --git a/src/extend/query.ts b/src/extend/query.ts index 929d86c..061aab5 100644 --- a/src/extend/query.ts +++ b/src/extend/query.ts @@ -3,7 +3,7 @@ import type Cache from '../cache/Cache' import { getKey } from '../key' -export default function extendQuery (mongoose: Mongoose, cache: Cache): void { +export default function extendQuery(mongoose: Mongoose, cache: Cache): void { // eslint-disable-next-line @typescript-eslint/unbound-method const mongooseExec = mongoose.Query.prototype.exec @@ -26,7 +26,7 @@ export default function extendQuery (mongoose: Mongoose, cache: Cache): void { _path: this._path, _fields: this._fields, _distinct: this._distinct, - _conditions: this._conditions + _conditions: this._conditions, }) } diff --git a/src/key.ts b/src/key.ts index 0fb94ef..0c2e513 100644 --- a/src/key.ts +++ b/src/key.ts @@ -1,7 +1,7 @@ import { createHash } from 'crypto' import sortKeys from 'sort-keys' -export function getKey (data: Record[] | Record): string { +export function getKey(data: Record[] | Record): string { const sortedObj = sortKeys(data, { deep: true }) const sortedStr = JSON.stringify(sortedObj, (_, val: unknown) => { return val instanceof RegExp ? String(val) : val diff --git a/src/plugin.ts b/src/plugin.ts index fb22e10..1aeef9a 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -33,11 +33,11 @@ class CacheMongoose { static #instance: CacheMongoose | undefined private cache!: Cache - private constructor () { + private constructor() { // Private constructor to prevent external instantiation } - public static init (mongoose: Mongoose, cacheOptions: ICacheOptions): CacheMongoose { + public static init(mongoose: Mongoose, cacheOptions: ICacheOptions): CacheMongoose { if (!this.#instance) { this.#instance = new CacheMongoose() this.#instance.cache = new Cache(cacheOptions) @@ -51,7 +51,7 @@ class CacheMongoose { return this.#instance } - public async clear (customKey?: string): Promise { + public async clear(customKey?: string): Promise { if (customKey != null) { await this.cache.del(customKey) } else { @@ -59,7 +59,7 @@ class CacheMongoose { } } - public async close (): Promise { + public async close(): Promise { await this.cache.close() } } diff --git a/tests/cache-memory.test.ts b/tests/cache-memory.test.ts index e0408a6..293028e 100644 --- a/tests/cache-memory.test.ts +++ b/tests/cache-memory.test.ts @@ -8,7 +8,7 @@ describe('CacheMongoose', () => { const User = model('User', UserSchema) const cache = CacheMongoose.init(mongoose, { - engine: 'memory' + engine: 'memory', }) beforeAll(async () => { @@ -29,7 +29,7 @@ describe('CacheMongoose', () => { it('should use memory cache', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const user1 = await User.findById(user._id).cache().exec() @@ -45,7 +45,7 @@ describe('CacheMongoose', () => { it('should not use cache', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache().exec() @@ -62,7 +62,7 @@ describe('CacheMongoose', () => { it('should use memory cache with custom key', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache('1 minute', 'test-custom-key').exec() @@ -78,7 +78,7 @@ describe('CacheMongoose', () => { it('should use memory cache and clear custom key', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache('1 minute', 'test-custom-key-second').exec() @@ -95,7 +95,7 @@ describe('CacheMongoose', () => { it('should use memory cache and custom key with an empty string', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache('1 minute', '').exec() @@ -118,19 +118,19 @@ describe('CacheMongoose', () => { await User.create([ { name: 'John', role: 'admin' }, { name: 'Bob', role: 'admin' }, - { name: 'Alice', role: 'user' } + { name: 'Alice', role: 'user' }, ]) const cache1 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).cache().exec() await User.create({ name: 'Mark', role: 'admin' }) const cache2 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).cache().exec() expect(cache1).not.toBeNull() @@ -143,7 +143,7 @@ describe('CacheMongoose', () => { const users = [ { name: 'John', age: 30, role: 'admin' }, { name: 'Alice', age: 25, role: 'user' }, - { name: 'Bob', age: 35, role: 'user' } + { name: 'Bob', age: 35, role: 'user' }, ] beforeEach(async () => { diff --git a/tests/cache-options.test.ts b/tests/cache-options.test.ts index 9a3063d..a8d42ba 100644 --- a/tests/cache-options.test.ts +++ b/tests/cache-options.test.ts @@ -5,7 +5,7 @@ import type ICacheOptions from '../src/interfaces/ICacheOptions' describe('Cache class tests', () => { it('should create a new instance of Cache', () => { const cacheOptions: ICacheOptions = { - engine: 'memory' + engine: 'memory', } const cache = new Cache(cacheOptions) @@ -19,7 +19,7 @@ describe('Cache class tests', () => { it('should throw an error if the cache engine is not supported', () => { const cacheOptions: ICacheOptions = { - engine: 'not-supported' + engine: 'not-supported', } expect(() => new Cache(cacheOptions)).toThrow(`Invalid engine name: ${cacheOptions.engine}`) @@ -27,7 +27,7 @@ describe('Cache class tests', () => { it('should throw an error if the cache engine is redis and no engine options are provided', () => { const cacheOptions: ICacheOptions = { - engine: 'redis' + engine: 'redis', } expect(() => new Cache(cacheOptions)).toThrow(`Engine options are required for ${cacheOptions.engine} engine`) @@ -38,9 +38,9 @@ describe('Cache class tests', () => { engine: 'redis', engineOptions: { host: 'localhost', - port: 6379 + port: 6379, }, - defaultTTL: '10 minutes' + defaultTTL: '10 minutes', } const cache = new Cache(cacheOptions) diff --git a/tests/cache-redis.test.ts b/tests/cache-redis.test.ts index f929257..7a4e942 100644 --- a/tests/cache-redis.test.ts +++ b/tests/cache-redis.test.ts @@ -11,9 +11,9 @@ describe('cache redis', () => { engine: 'redis', engineOptions: { host: 'localhost', - port: 6379 + port: 6379, }, - defaultTTL: '10 seconds' + defaultTTL: '10 seconds', }) beforeAll(async () => { @@ -34,7 +34,7 @@ describe('cache redis', () => { it('should use cache', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const user1 = await User.findById(user._id).cache().exec() @@ -50,7 +50,7 @@ describe('cache redis', () => { it('should clear cache', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache().exec() @@ -67,7 +67,7 @@ describe('cache redis', () => { it('should use cache with custom-key-1', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache('30 seconds', 'custom-key-1').exec() @@ -83,7 +83,7 @@ describe('cache redis', () => { it('should clear custom-key-2', async () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache('30 seconds', 'custom-key-2').exec() @@ -102,7 +102,7 @@ describe('cache redis', () => { const user = await User.create({ name: 'John Doe', - role: 'admin' + role: 'admin', }) const cache1 = await User.findById(user._id).cache().exec() @@ -117,12 +117,12 @@ describe('cache redis', () => { await User.create([ { name: 'Alice', - role: 'admin' + role: 'admin', }, { name: 'Bob', - role: 'admin' - } + role: 'admin', + }, ]) const cache3 = await User.find({ role: 'admin' }).cache().exec() @@ -139,19 +139,19 @@ describe('cache redis', () => { await User.create([ { name: 'John', role: 'admin' }, { name: 'Bob', role: 'admin' }, - { name: 'Alice', role: 'user' } + { name: 'Alice', role: 'user' }, ]) const cache1 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).cache('30 seconds').exec() await User.create({ name: 'Mark', role: 'admin' }) const cache2 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).cache('30 seconds').exec() expect(cache1).not.toBeNull() @@ -163,25 +163,25 @@ describe('cache redis', () => { await User.create([ { name: 'John', role: 'admin' }, { name: 'Bob', role: 'admin' }, - { name: 'Alice', role: 'user' } + { name: 'Alice', role: 'user' }, ]) const cache1 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).cache('30 seconds', 'aggregate-custom-key').exec() await User.create({ name: 'Mark', role: 'admin' }) const cache2 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).cache('30 seconds', 'aggregate-custom-key').exec() // Don't use cache key const cache3 = await User.aggregate([ { $match: { role: 'admin' } }, - { $group: { _id: '$role', count: { $sum: 1 } } } + { $group: { _id: '$role', count: { $sum: 1 } } }, ]).exec() expect(cache1).not.toBeNull() @@ -195,7 +195,7 @@ describe('cache redis', () => { await User.create([ { name: 'John', role: 'admin' }, { name: 'Bob', role: 'admin' }, - { name: 'Alice', role: 'user' } + { name: 'Alice', role: 'user' }, ]) const cache1 = await User.find({ role: 'admin' }).lean().cache('30 seconds').exec() @@ -211,7 +211,7 @@ describe('cache redis', () => { await User.create([ { name: 'John', role: 'admin' }, { name: 'Alice', role: 'user' }, - { name: 'Andy', role: 'user' } + { name: 'Andy', role: 'user' }, ]) const cache1 = await User.find({ name: /^J/ }).cache('30 seconds').exec() @@ -235,7 +235,7 @@ describe('cache redis', () => { await User.create([ { name: 'C', role: 'admin' }, { name: 'V', role: 'user' }, - { name: 'G', role: 'user' } + { name: 'G', role: 'user' }, ]) const cache1 = await User.findOne({ name: 'G' }).lean().cache('30 seconds').exec() diff --git a/tests/key.test.ts b/tests/key.test.ts index 341dfec..caf35e3 100644 --- a/tests/key.test.ts +++ b/tests/key.test.ts @@ -15,10 +15,10 @@ describe('generateHash()', () => { hey: { waldo: true, fred: null, - missing: undefined - } - } - } + missing: undefined, + }, + }, + }, } const data2 = { @@ -32,10 +32,10 @@ describe('generateHash()', () => { hey: { waldo: true, fred: null, - missing: undefined - } - } - } + missing: undefined, + }, + }, + }, } const data3 = { @@ -47,12 +47,12 @@ describe('generateHash()', () => { hey: { fred: null, waldo: true, - missing: undefined + missing: undefined, }, - word: 'world' - } + word: 'world', + }, }, - foo: 42 + foo: 42, } const data4 = { @@ -64,12 +64,12 @@ describe('generateHash()', () => { hey: { fred: null, waldo: true, - missing: undefined + missing: undefined, }, - word: 'world' - } + word: 'world', + }, }, - foo: 42 + foo: 42, } it('should generate hash keys for objects with different key orders', () => { @@ -88,13 +88,13 @@ describe('generateHash()', () => { const date = new Date() const hash1 = getKey({ name: 'John Doe', - date: { $lte: date } + date: { $lte: date }, }) await wait(50) const date2 = new Date() const hash2 = getKey({ name: 'John Doe', - date: { $lte: date2 } + date: { $lte: date2 }, }) expect(hash1).not.toEqual(hash2) }) diff --git a/tests/schemas/StorySchema.ts b/tests/schemas/StorySchema.ts index 56b0607..9bca2c9 100644 --- a/tests/schemas/StorySchema.ts +++ b/tests/schemas/StorySchema.ts @@ -7,12 +7,12 @@ const UserSchema = new Schema({ type: Schema.Types.ObjectId, ref: 'User', required: true, - index: true + index: true, }, title: { type: String, - required: true - } + required: true, + }, }, { timestamps: true }) export default UserSchema diff --git a/tests/schemas/UserSchema.ts b/tests/schemas/UserSchema.ts index db8243d..bb18d01 100644 --- a/tests/schemas/UserSchema.ts +++ b/tests/schemas/UserSchema.ts @@ -5,21 +5,21 @@ import type IUser from '../interfaces/IUser' const UserSchema = new Schema({ name: { type: String, - required: true + required: true, }, role: { type: String, - required: true + required: true, }, age: { - type: Number - } + type: Number, + }, }, { timestamps: true }) UserSchema.virtual('stories', { ref: 'Story', localField: '_id', - foreignField: 'userId' + foreignField: 'userId', }) export default UserSchema