diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..1c3a07d --- /dev/null +++ b/.eslintrc @@ -0,0 +1,90 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": [ + "tsconfig.json", + "tsconfig.spec.json" + ] + }, + "plugins": [ + "@typescript-eslint", + "jest" + ], + "extends": [ + "eslint:recommended", + "standard-with-typescript", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:jest/recommended" + ], + "rules": { + "@typescript-eslint/indent": [ + "error", + 4 + ], + "@typescript-eslint/member-delimiter-style": [ + "error", + { + "multiline": { + "delimiter": "semi", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/restrict-template-expressions": "warn", + "@typescript-eslint/semi": [ + "error" + ], + "@typescript-eslint/space-before-function-paren": [ + "error", + "never" + ], + "@typescript-eslint/strict-boolean-expressions": "warn", + "comma-dangle": [ + "error", + "always-multiline" + ], + "function-paren-newline": [ + "error", + "multiline-arguments" + ], + "indent": "off", + "jest/expect-expect": [ + "error", + { + "assertFunctionNames": [ + "expect", + "request.*.expect" + ] + } + ], + "jest/no-test-return-statement": "error", + "multiline-comment-style": [ + "error", + "starred-block" + ], + "semi": "off", + "space-unary-ops": [ + "error", + { + "words": false, + "nonwords": false + } + ], + "spaced-comment": [ + "error", + "always", + { + "block": { + "balanced": true + } + } + ], + "valid-jsdoc": "warn" + } +} diff --git a/package-lock.json b/package-lock.json index be435f0..9459f30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -693,6 +693,12 @@ "integrity": "sha512-aRnpPa7ysx3aNW60hTiCtLHlQaIFsXFCgQlpakNgDNVFzbtusSY8PwjAQgRWfSk0ekNoBjO51eQRB6upA9uuyw==", "dev": true }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -741,6 +747,12 @@ "integrity": "sha512-Q5hTcfdudEL2yOmluA1zaSyPbzWPmJ3XfSWeP3RyoYvS9hnje1ZyagrZOuQ6+1nQC1Gw+7gap3pLNL3xL6UBug==", "dev": true }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -871,6 +883,94 @@ "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.18.0.tgz", + "integrity": "sha512-kuO8WQjV+RCZvAXVRJfXWiJ8iYEtfHlKgcqqqXg9uUkIolEHuUaMmm8/lcO4xwCOtaw6mY0gStn2Lg4/eUXXYQ==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "2.18.0", + "eslint-utils": "^1.4.3", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.18.0.tgz", + "integrity": "sha512-J6MopKPHuJYmQUkANLip7g9I82ZLe1naCbxZZW3O2sIxTiq/9YYoOELEKY7oPg0hJ0V/AQ225h2z0Yp+RRMXhw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.18.0", + "eslint-scope": "^5.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + } + } + }, + "@typescript-eslint/parser": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.18.0.tgz", + "integrity": "sha512-SJJPxFMEYEWkM6pGfcnjLU+NJIPo+Ko1QrCBL+i0+zV30ggLD90huEmMMhKLHBpESWy9lVEeWlQibweNQzyc+A==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.18.0", + "@typescript-eslint/typescript-estree": "2.18.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.18.0.tgz", + "integrity": "sha512-gVHylf7FDb8VSi2ypFuEL3hOtoC4HkZZ5dOjXvVjoyKdRrvXAOPSzpNRnKMfaUUEiSLP8UF9j9X9EDLxC0lfZg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "@webassemblyjs/ast": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", @@ -1109,6 +1209,12 @@ } } }, + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "dev": true + }, "acorn-walk": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", @@ -1319,12 +1425,33 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "array-includes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", + "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0", + "is-string": "^1.0.5" + } + }, "array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, + "array.prototype.flat": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", + "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -1450,50 +1577,6 @@ "is-buffer": "^1.1.5" } }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, "babel-jest": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz", @@ -1983,12 +2066,6 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -2101,6 +2178,12 @@ "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, "chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -2214,6 +2297,15 @@ "timers-ext": "0.1" } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, "cli-highlight": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.4.tgz", @@ -2319,6 +2411,12 @@ } } }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, "cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -2529,6 +2627,12 @@ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", @@ -2926,6 +3030,15 @@ "randombytes": "^2.0.0" } }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", @@ -3208,26 +3321,604 @@ "source-map": "~0.6.1" } }, + "eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz", + "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + } + } + }, + "eslint-config-standard": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.0.tgz", + "integrity": "sha512-EF6XkrrGVbvv8hL/kYa/m6vnvmUT+K82pJJc4JJVMM6+Qgqh0pnwprSxdduDLB9p/7bIxD+YV5O0wfb8lmcPbA==", + "dev": true + }, + "eslint-config-standard-with-typescript": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-12.0.1.tgz", + "integrity": "sha512-v0DDNzsb36Oun3N04Y27Ca9DfF+S9Orrdtqa5anUUpwIu/MMqCRxYAcKdD0Uao+Gzqz9EjaFYjBKZCPFyXH5jw==", + "dev": true, + "requires": { + "@typescript-eslint/parser": "^2.10.0", + "eslint-config-standard": "^14.1.0" + } + }, + "eslint-import-resolver-node": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz", + "integrity": "sha512-b8crLDo0M5RSe5YG8Pu2DYBj71tSB6OvXkfzwbJU2w7y8P4/yo0MyF8jU26IEuEuHF2K5/gcAJE3LhQGqBBbVg==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-module-utils": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz", + "integrity": "sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + } + } + }, + "eslint-plugin-es": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.0.tgz", + "integrity": "sha512-6/Jb/J/ZvSebydwbBJO1R9E5ky7YeElfK56Veh7e4QGFHCXoIXGH9HhVz+ibJLM3XJ1XjP+T7rKBLUa/Y7eIng==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz", + "integrity": "sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==", + "dev": true, + "requires": { + "array-includes": "^3.0.3", + "array.prototype.flat": "^1.2.1", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.2", + "eslint-module-utils": "^2.4.1", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.0", + "read-pkg-up": "^2.0.0", + "resolve": "^1.12.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + } + } + }, + "eslint-plugin-jest": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.6.0.tgz", + "integrity": "sha512-GH8AhcFXspOLqak7fqnddLXEJsrFyvgO8Bm60SexvKSn1+3rWYESnCiWUOCUcBTprNSDSE4CtAZdM4EyV6gPPw==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "^2.5.0", + "micromatch": "^4.0.2" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "eslint-plugin-node": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.0.0.tgz", + "integrity": "sha512-chUs/NVID+sknFiJzxoN9lM7uKSOEta8GC8365hw1nDfwIPIjjpRSwwPvQanWv8dt/pDe9EV4anmVSwdiSndNg==", + "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-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "ignore": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-plugin-promise": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", + "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", + "dev": true + }, + "eslint-plugin-standard": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz", + "integrity": "sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==", + "dev": true + }, "eslint-scope": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", "dev": true, "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" } }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, "esm": { "version": "3.2.25", "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" }, + "espree": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", + "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", + "dev": true, + "requires": { + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "dev": true + } + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -3482,6 +4173,28 @@ } } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -3639,6 +4352,15 @@ "escape-string-regexp": "^1.0.5" } }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -3746,6 +4468,23 @@ } } }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "dev": true + }, "flush-write-stream": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", @@ -4489,6 +5228,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "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": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -4912,6 +5657,12 @@ "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", "dev": true }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, "ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -4926,6 +5677,24 @@ "minimatch": "^3.0.4" } }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, "import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", @@ -4973,6 +5742,107 @@ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, + "inquirer": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz", + "integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^2.4.2", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.2.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-escapes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", + "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "figures": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", + "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } + } + } + }, "interpret": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", @@ -5224,6 +6094,12 @@ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", @@ -5920,6 +6796,12 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -6547,6 +7429,12 @@ "xtend": "^4.0.0" } }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, "mysql": { "version": "2.17.1", "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.17.1.tgz", @@ -7031,6 +7919,18 @@ "isobject": "^3.0.1" } }, + "object.values": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", + "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -7047,6 +7947,15 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, "opencollective-postinstall": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", @@ -7231,6 +8140,15 @@ } } }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parent-require": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parent-require/-/parent-require-1.0.0.tgz", @@ -7429,6 +8347,12 @@ "which": "^1.2.10" } }, + "picomatch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz", + "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==", + "dev": true + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -7876,6 +8800,12 @@ "safe-regex": "^1.1.0" } }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, "registry-auth-token": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.4.0.tgz", @@ -8040,6 +8970,16 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -8071,6 +9011,15 @@ "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", "dev": true }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -8317,6 +9266,25 @@ "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -8880,6 +9848,58 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "tapable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", @@ -8994,6 +10014,12 @@ "require-main-filename": "^2.0.0" } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "thenify": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", @@ -9022,6 +10048,12 @@ "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", "optional": true }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -9088,6 +10120,15 @@ "next-tick": "1" } }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", @@ -9314,30 +10355,10 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, - "tslint": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", - "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", - "dev": true, - "requires": { - "babel-code-frame": "^6.22.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^3.2.0", - "glob": "^7.1.1", - "js-yaml": "^3.7.0", - "minimatch": "^3.0.4", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.27.2" - } - }, "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -9376,6 +10397,12 @@ "prelude-ls": "~1.1.2" } }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -10255,6 +11282,15 @@ } } }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "write-file-atomic": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz", diff --git a/package.json b/package.json index b116924..a2e2be7 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "scripts": { "start": "ts-node -r tsconfig-paths/register -r dotenv/config src/main.ts", "dev": "NODE_ENV=dev nodemon --exec 'ts-node -r dotenv/config src/main.ts' src/main.ts", - "lint": "tslint -p tsconfig.json -c tslint.json", + "lint": "eslint ./src/**/*.ts ./test/**/*.ts", + "lint:fix": "eslint ./src/**/*.ts ./test/**/*.ts --fix", "test": "jest --coverage", "showcoverage": "open ./coverage/lcov-report/index.html", "typeorm": "npx ts-node node_modules/typeorm/cli.js", @@ -54,7 +55,16 @@ "@types/rimraf": "2.0.2", "@types/simple-oauth2": "2.2.1", "@types/supertest": "2.0.7", + "@typescript-eslint/eslint-plugin": "2.18.0", + "@typescript-eslint/parser": "2.18.0", "codecov": "3.3.0", + "eslint": "6.8.0", + "eslint-config-standard-with-typescript": "12.0.1", + "eslint-plugin-import": "2.20.1", + "eslint-plugin-jest": "23.6.0", + "eslint-plugin-node": "11.0.0", + "eslint-plugin-promise": "4.2.1", + "eslint-plugin-standard": "4.0.1", "jest": "24.7.1", "nodemon": "1.19.0", "rimraf": "2.6.3", @@ -63,7 +73,6 @@ "ts-loader": "4.4.2", "ts-node": "7.0.1", "tsconfig-paths": "3.8.0", - "tslint": "5.11.0", "webpack": "4.30.0", "webpack-cli": "3.3.1", "webpack-node-externals": "1.7.2" diff --git a/src/abstracts/auth.service.abstract.ts b/src/abstracts/auth.service.abstract.ts index a5ca1f6..8b650f0 100644 --- a/src/abstracts/auth.service.abstract.ts +++ b/src/abstracts/auth.service.abstract.ts @@ -23,17 +23,16 @@ import { SUB_SYSTEM_TOKEN_EXPIRES_IN } from '../constants'; * Handles authorization via OAuth 2. */ export abstract class AuthService implements Authentication { - protected oAuth2Client: oauth2.OAuthClient; protected oAuth2Config: oauth2.ModuleOptions = { client: { id: '', - secret: '' + secret: '', }, auth: { tokenHost: '', tokenPath: '', - } + }, }; constructor( @@ -113,7 +112,7 @@ export abstract class AuthService implements Authentication { const jsonBody = JSON.parse(body); const createUserDto: CreateUserDto = { externalUserId: jsonBody.id, - name: jsonBody.name + name: jsonBody.name, }; return createUserDto; }).catch((error) => { @@ -149,5 +148,4 @@ export abstract class AuthService implements Authentication { * @param accessToken */ protected abstract getApiRequest(accessToken: string): Promise; - } diff --git a/src/app.controller.ts b/src/app.controller.ts index 4f72a06..3309f3f 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -13,7 +13,8 @@ import { ApiExcludeEndpoint } from '@nestjs/swagger'; @Controller() export class AppController { constructor( - private readonly appService: AppService) { } + private readonly appService: AppService, + ) { } @Get() @ApiExcludeEndpoint() diff --git a/src/app.module.ts b/src/app.module.ts index 574d904..042d8a4 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -45,22 +45,22 @@ import { SettingService } from './services/setting.service'; import { SettingController } from './controllers/setting.controller'; import { SettingModule } from './modules/setting.module'; import { - TEST_DB_CONNECTION, - TEST_DB_HOST, - TEST_DB_PORT, - TEST_DB_USERNAME, - TEST_DB_PASSWORD, - TEST_DB_DATABASE, - TEST_DB_SYNCHRONIZE, - TYPEORM_CONNECTION, - TYPEORM_HOST, - TYPEORM_PORT, - TYPEORM_USERNAME, - TYPEORM_PASSWORD, - TYPEORM_DATABASE, - TYPEORM_LOGGING, - TYPEORM_SYNCHRONIZE, - USE_CERN_SSO + TEST_DB_CONNECTION, + TEST_DB_HOST, + TEST_DB_PORT, + TEST_DB_USERNAME, + TEST_DB_PASSWORD, + TEST_DB_DATABASE, + TEST_DB_SYNCHRONIZE, + TYPEORM_CONNECTION, + TYPEORM_HOST, + TYPEORM_PORT, + TYPEORM_USERNAME, + TYPEORM_PASSWORD, + TYPEORM_DATABASE, + TYPEORM_LOGGING, + TYPEORM_SYNCHRONIZE, + USE_CERN_SSO, } from './constants'; import { FlpModule } from './modules/flp.module'; import { FlpController } from './controllers/flp.controller'; @@ -72,89 +72,89 @@ import { TagService } from './services/tag.service'; let databaseOptions; // Use a different database for running tests. if (process.env.NODE_ENV === 'test') { - databaseOptions = { - type: TEST_DB_CONNECTION, - host: TEST_DB_HOST, - port: +TEST_DB_PORT, - username: TEST_DB_USERNAME, - password: TEST_DB_PASSWORD, - database: TEST_DB_DATABASE, - entities: ['src/**/**.entity{.ts,.js}'], - synchronize: TEST_DB_SYNCHRONIZE === 'true' ? true : false, - migrations: ['populate/*{.ts,.js}'], - migrationsRun: true - }; + databaseOptions = { + type: TEST_DB_CONNECTION, + host: TEST_DB_HOST, + port: +TEST_DB_PORT, + username: TEST_DB_USERNAME, + password: TEST_DB_PASSWORD, + database: TEST_DB_DATABASE, + entities: ['src/**/**.entity{.ts,.js}'], + synchronize: TEST_DB_SYNCHRONIZE === 'true', + migrations: ['populate/*{.ts,.js}'], + migrationsRun: true, + }; } else { - databaseOptions = { - type: TYPEORM_CONNECTION, - host: TYPEORM_HOST, - port: TYPEORM_PORT, - username: TYPEORM_USERNAME, - password: TYPEORM_PASSWORD, - database: TYPEORM_DATABASE, - entities: ['src/**/**.entity{.ts,.js}'], - logging: TYPEORM_LOGGING, - synchronize: TYPEORM_SYNCHRONIZE === 'true' ? true : false, - migrations: ['src/migration/*{.ts,.js}', 'src/populate/*{.ts,.js}'], - migrationsRun: true + databaseOptions = { + type: TYPEORM_CONNECTION, + host: TYPEORM_HOST, + port: TYPEORM_PORT, + username: TYPEORM_USERNAME, + password: TYPEORM_PASSWORD, + database: TYPEORM_DATABASE, + entities: ['src/**/**.entity{.ts,.js}'], + logging: TYPEORM_LOGGING, + synchronize: TYPEORM_SYNCHRONIZE === 'true', + migrations: ['src/migration/*{.ts,.js}', 'src/populate/*{.ts,.js}'], + migrationsRun: true, // what to do with the cli variable from ormconfig.json - }; + }; } const authServiceProvider = { - provide: AuthService, - useClass: USE_CERN_SSO === 'true' - ? CernAuthService - : GithubAuthService, + provide: AuthService, + useClass: USE_CERN_SSO === 'true' + ? CernAuthService + : GithubAuthService, }; @Module({ - imports: [ - TypeOrmModule.forRoot(databaseOptions), - RunModule, - LogModule, - FlpModule, - TagModule, - AttachmentModule, - SubSystemModule, - UserModule, - AuthModule, - SubSystemPermissionModule, - OverviewModule, - InfoLogModule, - SettingModule, - ], - controllers: [ - AppController, - RunController, - LogController, - FlpController, - TagController, - AttachmentController, - SubSystemController, - UserController, - AuthController, - OverviewController, - SettingController, - CreatepdfController - ], - providers: [ - AppService, - RunService, - LogService, - FlpSerivce, - TagService, - AttachmentService, - SubSystemService, - UserService, - authServiceProvider, - AuthUtility, - BCryptService, - SubSystemPermissionService, - OverviewService, - InfoLogService, - TimeUtility, - SettingService, - CreatePdfService - ], + imports: [ + TypeOrmModule.forRoot(databaseOptions), + RunModule, + LogModule, + FlpModule, + TagModule, + AttachmentModule, + SubSystemModule, + UserModule, + AuthModule, + SubSystemPermissionModule, + OverviewModule, + InfoLogModule, + SettingModule, + ], + controllers: [ + AppController, + RunController, + LogController, + FlpController, + TagController, + AttachmentController, + SubSystemController, + UserController, + AuthController, + OverviewController, + SettingController, + CreatepdfController, + ], + providers: [ + AppService, + RunService, + LogService, + FlpSerivce, + TagService, + AttachmentService, + SubSystemService, + UserService, + authServiceProvider, + AuthUtility, + BCryptService, + SubSystemPermissionService, + OverviewService, + InfoLogService, + TimeUtility, + SettingService, + CreatePdfService, + ], }) export class AppModule { } diff --git a/src/app.service.ts b/src/app.service.ts index 3ea6ee2..ab61b32 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -36,7 +36,7 @@ export class AppService { - ` + `, ].join(''); } } diff --git a/src/common/auth.guard.ts b/src/common/auth.guard.ts index 250bb4b..2ee2a89 100644 --- a/src/common/auth.guard.ts +++ b/src/common/auth.guard.ts @@ -6,7 +6,6 @@ import { Reflector } from '@nestjs/core'; @Injectable() export class JwtAuthGuard extends AuthGuard('jwt') implements CanActivate { - canActivate( context: ExecutionContext, ): boolean | Promise | Observable { diff --git a/src/constants.ts b/src/constants.ts index 9fce3dd..c5bf6f1 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -52,16 +52,18 @@ if (process.env.NODE_ENV === 'test') { // InfoLogger setting export const USE_INFO_LOGGER = process.env.USE_INFO_LOGGER ? process.env.USE_INFO_LOGGER : 'false'; -// Test database settings used when running `$ npm test` -// Since Travis CI does not have a .env file, a new variable is created to set the name. +/* + * Test database settings used when running `$ npm test` + * Since Travis CI does not have a .env file, a new variable is created to set the name. + */ const TEST_DATABASE_NAME = TYPEORM_DATABASE ? 'test_' + TYPEORM_DATABASE : 'test_jiskefet'; export const TEST_DB_CONNECTION = process.env.TEST_DB_CONNECTION ? process.env.TEST_DB_CONNECTION : 'mysql'; export const TEST_DB_HOST = process.env.TEST_DB_HOST ? process.env.TEST_DB_HOST : '127.0.0.1'; export const TEST_DB_USERNAME = process.env.TEST_DB_USERNAME ? process.env.TEST_DB_USERNAME : 'root'; export const TEST_DB_PASSWORD = process.env.TEST_DB_PASSWORD; -export const TEST_DB_DATABASE = process.env.TEST_DB_DATABASE ? - process.env.TEST_DB_DATABASE : TEST_DATABASE_NAME; +export const TEST_DB_DATABASE = process.env.TEST_DB_DATABASE + ? process.env.TEST_DB_DATABASE : TEST_DATABASE_NAME; export const TEST_DB_PORT = process.env.TEST_DB_PORT ? process.env.TEST_DB_PORT : 3306; export const TEST_DB_SYNCHRONIZE = process.env.TEST_DB_SYNCHRONIZE ? process.env.TEST_DB_SYNCHRONIZE : 'true'; export const TEST_DB_LOGGING = process.env.TEST_DB_LOGGING ? process.env.TEST_DB_LOGGING : 'true'; diff --git a/src/controllers/attachment.controller.ts b/src/controllers/attachment.controller.ts index b7821be..f852caf 100644 --- a/src/controllers/attachment.controller.ts +++ b/src/controllers/attachment.controller.ts @@ -13,7 +13,7 @@ import { ApiOkResponse, ApiNotFoundResponse, ApiConsumes, - ApiImplicitFile + ApiImplicitFile, } from '@nestjs/swagger'; import { Controller, @@ -26,7 +26,7 @@ import { UploadedFile, UseInterceptors, FileInterceptor, - NotFoundException + NotFoundException, } from '@nestjs/common'; import { AttachmentService } from '../services/attachment.service'; import { AuthGuard } from '@nestjs/passport'; @@ -45,9 +45,8 @@ import { JwtAuthGuard } from '../common/auth.guard'; @UseFilters(new HttpExceptionFilter()) @Controller('attachments') export class AttachmentController { - constructor( - private readonly attachmentservice: AttachmentService + private readonly attachmentservice: AttachmentService, ) { } /** @@ -75,14 +74,15 @@ export class AttachmentController { @Post() @ApiOperation({ title: 'Creates an attachment for a log with a file upload field through the Swagger UI.', - description: 'This endpoint is only available in dev modus' + description: 'This endpoint is only available in dev modus', }) @ApiConsumes('multipart/form-data') @ApiImplicitFile({ name: 'file', required: false }) @UseInterceptors(FileInterceptor('file', { limits: { fileSize: FILE_UPLOAD_LIMIT * 1024 * 1024 } })) async uploadFile( @Body() logId: number, - @UploadedFile() file?: FileDto): Promise> { + @UploadedFile() file?: FileDto, + ): Promise> { switch (process.env.NODE_ENV) { case 'dev': try { @@ -90,7 +90,7 @@ export class AttachmentController { fileName: file.originalname, fileMime: file.mimetype, fileData: Buffer.from(file.buffer).toString('base64'), - creationTime: new Date() + creationTime: new Date(), }; return createResponseItem(await this.attachmentservice.create(logId, attachment)); } catch (error) { diff --git a/src/controllers/auth.controller.ts b/src/controllers/auth.controller.ts index 0b8dac9..3d8ab82 100644 --- a/src/controllers/auth.controller.ts +++ b/src/controllers/auth.controller.ts @@ -15,7 +15,7 @@ import { BadRequestException, UnauthorizedException, NotFoundException, - UseFilters + UseFilters, } from '@nestjs/common'; import { ApiImplicitQuery, @@ -23,7 +23,7 @@ import { ApiOperation, ApiResponse, ApiOkResponse, - ApiUnprocessableEntityResponse + ApiUnprocessableEntityResponse, } from '@nestjs/swagger'; import { AuthUtility } from '../utility/auth.utility'; import { UserService } from '../services/user.service'; @@ -59,14 +59,14 @@ export class AuthController { @Get('/auth') @ApiOperation({ title: 'Authenticate a user by giving an Authorization Grant.' }) @ApiOkResponse({ - description: 'User has successfully authenticated and a JWT has been given as a response.' + description: 'User has successfully authenticated and a JWT has been given as a response.', }) @ApiUnprocessableEntityResponse({ - description: 'User has not provided an Authorization Grant as a query parameter.' + description: 'User has not provided an Authorization Grant as a query parameter.', }) @ApiResponse({ status: 401, - description: 'User is unauthorized due to an invalid Authorization Grant.' + description: 'User is unauthorized due to an invalid Authorization Grant.', }) @ApiImplicitQuery({ name: 'grant', required: true, type: 'string' }) async auth(@Query() query?: any): Promise<{ token: string }> { @@ -96,15 +96,15 @@ export class AuthController { @Get('/user/profile') @ApiOperation({ title: 'Returns the user\'s profile' }) @ApiOkResponse({ - description: 'User successfully received profile information.' + description: 'User successfully received profile information.', }) @ApiResponse({ status: 400, - description: 'No JWT could be found in headers.' + description: 'No JWT could be found in headers.', }) @ApiResponse({ status: 401, - description: 'User is unauthorized' + description: 'User is unauthorized', }) async profile(@Headers() headers: any): Promise> { try { @@ -114,7 +114,7 @@ export class AuthController { process.env.ALLOW_ANONYMOUS.toLowerCase() === 'true') { return createResponseItem({ userData: { - userId: 1 + userId: 1, }, profileData: { name: 'Anonymous', @@ -127,8 +127,8 @@ export class AuthController { identityclass: 'CERN Registered', federation: 'CERN', phone: null, - mobile: null - } + mobile: null, + }, }); } jwt = null; @@ -155,15 +155,15 @@ export class AuthController { @Get('/test-token') @ApiOperation({ title: 'Returns a JWT for authorization when running end-to-end tests.' }) @ApiOkResponse({ - description: 'The hashed secret given matches the secret in the environment and a JWT is returned.' + description: 'The hashed secret given matches the secret in the environment and a JWT is returned.', }) @ApiResponse({ status: 400, - description: 'The required query parameter \'hashedSecret\' is missing.' + description: 'The required query parameter \'hashedSecret\' is missing.', }) @ApiResponse({ status: 401, - description: 'Hashed secret was not accepted' + description: 'Hashed secret was not accepted', }) @ApiImplicitQuery({ name: 'hashedSecret', required: false, type: 'string' }) async testToken(@Query() query?: any): Promise> { @@ -183,10 +183,11 @@ export class AuthController { return createResponseItem(jwt); } else { throw new UnauthorizedException( - 'The hashed secret given does not match the secret in the environment.'); + 'The hashed secret given does not match the secret in the environment.', + ); } default: - throw new NotFoundException(); + throw new NotFoundException(); } } } diff --git a/src/controllers/createpdf.controller.ts b/src/controllers/createpdf.controller.ts index 9d33db5..e1e5d5e 100644 --- a/src/controllers/createpdf.controller.ts +++ b/src/controllers/createpdf.controller.ts @@ -14,79 +14,91 @@ import { AuthGuard } from '@nestjs/passport'; @UseGuards(AuthGuard()) @Controller('createpdf') export class CreatepdfController { - constructor(public createPdfService: CreatePdfService, private logService: LogService, - private runService: RunService) {} + constructor( + public createPdfService: CreatePdfService, + private readonly logService: LogService, + private readonly runService: RunService, + ) {} - /** - * Get Log information in pdf by id. /createpdf/getlog?id=number - * @param query there must be one id - * @param res response to client - */ - @Get('getlog') - // query is needed, with body or param doesn't works - async getLogInfo(@Query() query: CreateLogInfo, @Res() res: Response): Promise { - const epochTime = new (Date)().getTime(); - const params = await this.logService.getLogInfoParams(query.id); - return this.createPdfService - .createPdf(params, `Log_${query.id}_${epochTime}.pdf`, '/templates/LogInfoTemplate.ejs', res); - } - /** - * Get differense between two runs in pdf - * by their id. /createpdf/getrunconf?id1=number&id2=number - * @param query there must be two id of runs - * @param res response to client - */ - @Get('getrunconf') - // query is needed, with body or param doesn't works - async runconf(@Query() query: CreateRunConf, @Res() res: Response): Promise { - const epochTime = new (Date)().getTime(); - const params = await this.runService.getRunConfParams(query.id1, query.id2); - return this.createPdfService - .createPdf(params, `Run_${query.id1}_and_${query.id2}_${epochTime}`, '/templates/RunTemplate.ejs', res); - } - /** - * Post bug report in pdf from html form - * that located in /createpdf. /createpdf/downloadPDF - * @param res response to client - * @param userData it is data that is taken from html form - */ - @Post('downloadPDF') - makePdf(@Res() res: Response, @Body() userData: CreateUserData): Promise { + /** + * Get Log information in pdf by id. /createpdf/getlog?id=number + * @param query there must be one id + * @param res response to client + */ + @Get('getlog') + // query is needed, with body or param doesn't works + async getLogInfo(@Query() query: CreateLogInfo, @Res() res: Response): Promise { + const epochTime = new(Date)().getTime(); + const params = await this.logService.getLogInfoParams(query.id); + return this.createPdfService + .createPdf(params, `Log_${query.id}_${epochTime}.pdf`, '/templates/LogInfoTemplate.ejs', res); + } - const allDate = new (Date)().toLocaleString('en-GB'); - const epochTime = new (Date)().getTime(); - const fname = userData.fname; - const lname = userData.lname; - const occupationData = userData.occupation; - const bugReportData = userData.bugReport; + /** + * Get differense between two runs in pdf + * by their id. /createpdf/getrunconf?id1=number&id2=number + * @param query there must be two id of runs + * @param res response to client + */ + @Get('getrunconf') + // query is needed, with body or param doesn't works + async runconf(@Query() query: CreateRunConf, @Res() res: Response): Promise { + const epochTime = new(Date)().getTime(); + const params = await this.runService.getRunConfParams(query.id1, query.id2); + return this.createPdfService + .createPdf(params, `Run_${query.id1}_and_${query.id2}_${epochTime}`, '/templates/RunTemplate.ejs', res); + } - const params = {firstname : fname, lastname : lname, occupation : occupationData, bugReport : bugReportData, - date : allDate}; - return this.createPdfService - .createPdf(params, `BugReport_${epochTime}.pdf`, '/templates/BugReportTemplate.ejs', res); - } - /** - * Get html form for bug report. /createpdf - */ - @Get() - @Render('index') - showIndex(): any { - return {}; - } - /** - * Get html form for Log information. /createpdf/loginfo - */ - @Get('loginfo') - @Render('logInfo') - LogInfo(): any { - return {}; - } - /** - * Get html form for differense between two runs. /createpdf/runconf - */ - @Get('runconf') - @Render('runinfo') - RunInfo(): any { - return {}; - } + /** + * Post bug report in pdf from html form + * that located in /createpdf. /createpdf/downloadPDF + * @param res response to client + * @param userData it is data that is taken from html form + */ + @Post('downloadPDF') + makePdf(@Res() res: Response, @Body() userData: CreateUserData): Promise { + const allDate = new(Date)().toLocaleString('en-GB'); + const epochTime = new(Date)().getTime(); + const fname = userData.fname; + const lname = userData.lname; + const occupationData = userData.occupation; + const bugReportData = userData.bugReport; + + const params = { + firstname: fname, + lastname: lname, + occupation: occupationData, + bugReport: bugReportData, + date: allDate, + }; + return this.createPdfService + .createPdf(params, `BugReport_${epochTime}.pdf`, '/templates/BugReportTemplate.ejs', res); + } + + /** + * Get html form for bug report. /createpdf + */ + @Get() + @Render('index') + showIndex(): any { + return {}; + } + + /** + * Get html form for Log information. /createpdf/loginfo + */ + @Get('loginfo') + @Render('logInfo') + LogInfo(): any { + return {}; + } + + /** + * Get html form for differense between two runs. /createpdf/runconf + */ + @Get('runconf') + @Render('runinfo') + RunInfo(): any { + return {}; + } } diff --git a/src/controllers/flp.controller.ts b/src/controllers/flp.controller.ts index 80d3b82..1761d4b 100644 --- a/src/controllers/flp.controller.ts +++ b/src/controllers/flp.controller.ts @@ -13,7 +13,7 @@ import { ApiOkResponse, ApiNotFoundResponse, ApiCreatedResponse, - ApiConflictResponse + ApiConflictResponse, } from '@nestjs/swagger'; import { UseGuards, Controller, Get, Param, Patch, Post, Body, UseFilters } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; @@ -32,10 +32,10 @@ import { JwtAuthGuard } from '../common/auth.guard'; @UseFilters(new HttpExceptionFilter()) @Controller('flp') export class FlpController { - constructor( - private readonly flpService: FlpSerivce + private readonly flpService: FlpSerivce, ) { } + /** * Find a specific Flp. /flp/id * @param id unique identifier for a Flp. @@ -82,8 +82,9 @@ export class FlpController { @ApiNotFoundResponse({ description: 'The Run number or/and FLP name does not exist.' }) async updateById( @Param('id') runId: number, - @Param('name') flpName: string, - @Body() request: PatchFlpDto): Promise> { + @Param('name') flpName: string, + @Body() request: PatchFlpDto, + ): Promise> { // Update bytes that are produced for the flp (during runtime). try { const flp = await this.flpService.patch(flpName, runId, request); diff --git a/src/controllers/log.controller.ts b/src/controllers/log.controller.ts index 184b626..c68413a 100644 --- a/src/controllers/log.controller.ts +++ b/src/controllers/log.controller.ts @@ -14,10 +14,10 @@ import { ApiCreatedResponse, ApiConflictResponse, ApiNotFoundResponse, - ApiResponse + ApiResponse, } from '@nestjs/swagger'; import { - Get, Post, Controller, Body, Param, Query, UseGuards, Patch, UseFilters, UsePipes, ValidationPipe + Get, Post, Controller, Body, Param, Query, UseGuards, Patch, UseFilters, UsePipes, ValidationPipe, } from '@nestjs/common'; import { LogService } from '../services/log.service'; import { CreateLogDto } from '../dtos/create.log.dto'; @@ -41,11 +41,10 @@ import { ThreadDto } from 'dtos/thread.dto'; @UseFilters(new HttpExceptionFilter()) @Controller('logs') export class LogController { - constructor( private readonly logService: LogService, private readonly loggerService: InfoLogService, - private readonly attachmentService: AttachmentService + private readonly attachmentService: AttachmentService, ) { } /** @@ -77,7 +76,8 @@ export class LogController { @ApiCreatedResponse({ description: 'Succesfully created an Attachment.', type: Attachment }) async createAttachment( @Param('id') logId: number, - @Body() createAttachmentDto: CreateAttachmentDto): Promise> { + @Body() createAttachmentDto: CreateAttachmentDto, + ): Promise> { try { const attachment = await this.attachmentService.create(logId, createAttachmentDto); return createResponseItem(attachment); @@ -149,5 +149,4 @@ export class LogController { return createErrorResponse(error); } } - } diff --git a/src/controllers/overview.controller.ts b/src/controllers/overview.controller.ts index ebae406..8659875 100644 --- a/src/controllers/overview.controller.ts +++ b/src/controllers/overview.controller.ts @@ -23,7 +23,6 @@ import { JwtAuthGuard } from '../common/auth.guard'; @UseFilters(new HttpExceptionFilter()) @Controller('overview') export class OverviewController { - constructor(private readonly overviewService: OverviewService) { } /** diff --git a/src/controllers/run.controller.ts b/src/controllers/run.controller.ts index 4cd0fe2..ad006f7 100644 --- a/src/controllers/run.controller.ts +++ b/src/controllers/run.controller.ts @@ -6,8 +6,8 @@ * copied verbatim in the file "LICENSE" */ -import { Get, Controller, Body, Param, Query, UseGuards, Patch, UseFilters } from '@nestjs/common'; -import { Post } from '@nestjs/common'; +import { Get, Controller, Body, Param, Query, UseGuards, Patch, UseFilters, Post } from '@nestjs/common'; + import { ApiUseTags, ApiBearerAuth, @@ -16,7 +16,7 @@ import { ApiConflictResponse, ApiCreatedResponse, ApiNotFoundResponse, - ApiResponse + ApiResponse, } from '@nestjs/swagger'; import { RunService } from '../services/run.service'; import { CreateRunDto } from '../dtos/create.run.dto'; @@ -40,7 +40,7 @@ import { JwtAuthGuard } from '../common/auth.guard'; export class RunController { constructor( private readonly runService: RunService, - private readonly loggerService: InfoLogService + private readonly loggerService: InfoLogService, ) { } /** @@ -99,7 +99,6 @@ export class RunController { } catch (error) { return createErrorResponse(error); } - } /** @@ -116,7 +115,7 @@ export class RunController { @ApiConflictResponse({ description: 'The Log is already linked to the Run.' }) @ApiNotFoundResponse({ description: 'The Log or Run does not exist.' }) async linkLogToRun(@Param('id') - runNumber: number, @Body() request: LinkLogToRunDto): Promise> { + runNumber: number, @Body() request: LinkLogToRunDto): Promise> { try { const logToRun = await this.runService.linkLogToRun(runNumber, request); return createResponseItem(logToRun); diff --git a/src/controllers/setting.controller.ts b/src/controllers/setting.controller.ts index d9732cb..8441ff2 100644 --- a/src/controllers/setting.controller.ts +++ b/src/controllers/setting.controller.ts @@ -18,7 +18,6 @@ import { HttpExceptionFilter } from '../filters/httpexception.filter'; @UseFilters(new HttpExceptionFilter()) @Controller() export class SettingController { - constructor( private readonly settingService: SettingService, ) { } diff --git a/src/controllers/subsystem.controller.ts b/src/controllers/subsystem.controller.ts index ab177a8..2ae6a3f 100644 --- a/src/controllers/subsystem.controller.ts +++ b/src/controllers/subsystem.controller.ts @@ -23,7 +23,8 @@ import { JwtAuthGuard } from '../common/auth.guard'; @Controller('subsystems') export class SubSystemController { constructor( - private readonly subSystemService: SubSystemService) { } + private readonly subSystemService: SubSystemService, + ) { } /** * Get all subsystem diff --git a/src/controllers/tag.controller.ts b/src/controllers/tag.controller.ts index 42b8002..ab73291 100644 --- a/src/controllers/tag.controller.ts +++ b/src/controllers/tag.controller.ts @@ -16,7 +16,7 @@ import { ApiConflictResponse, ApiOkResponse, ApiNotFoundResponse, - ApiResponse + ApiResponse, } from '@nestjs/swagger'; import { AuthGuard } from '@nestjs/passport'; import { HttpExceptionFilter } from '../filters/httpexception.filter'; @@ -37,9 +37,8 @@ import { JwtAuthGuard } from '../common/auth.guard'; @UseFilters(new HttpExceptionFilter()) @Controller('tags') export class TagController { - constructor( - private readonly tagService: TagService + private readonly tagService: TagService, ) { } /** @@ -103,7 +102,7 @@ export class TagController { @ApiNotFoundResponse({ description: 'No Runs found for this Tag.' }) async findRunsByTagId(@Param('id') tagId: number): Promise> { try { - const runsByTagId = await this.tagService.findRunsByTagId (tagId); + const runsByTagId = await this.tagService.findRunsByTagId(tagId); return createResponseItem(runsByTagId); } catch (error) { return createErrorResponse(error); diff --git a/src/controllers/user.controller.ts b/src/controllers/user.controller.ts index bd2e07f..63cde96 100644 --- a/src/controllers/user.controller.ts +++ b/src/controllers/user.controller.ts @@ -11,7 +11,7 @@ import { ApiBearerAuth, ApiOperation, ApiOkResponse, - ApiNotFoundResponse + ApiNotFoundResponse, } from '@nestjs/swagger'; import { Get, Controller, Param, Post, Body, UseGuards, Query, UseFilters } from '@nestjs/common'; import * as uuid from 'uuid/v4'; @@ -40,14 +40,13 @@ import { JwtAuthGuard } from '../common/auth.guard'; @UseFilters(new HttpExceptionFilter()) @Controller('users') export class UserController { - constructor( private readonly subSystemPermissionService: SubSystemPermissionService, private readonly authService: AuthService, private readonly bcryptService: BCryptService, private readonly userService: UserService, private readonly logService: LogService, - private readonly loggerService: InfoLogService + private readonly loggerService: InfoLogService, ) { } /** @@ -76,7 +75,7 @@ export class UserController { @ApiOkResponse({ description: 'Succesfully returned all Tokens.', type: [SubSystemPermission] }) @ApiNotFoundResponse({ description: 'Unable to find Tokens with given User ID' }) async findTokensByExternalUserId(@Param('id') userId: number): - Promise> { + Promise> { try { const tokenByExternalId = await this.subSystemPermissionService.findTokensByExternalUserId(userId); return createResponseItems(tokenByExternalId); @@ -92,7 +91,7 @@ export class UserController { @ApiOperation({ title: 'Creates a Token and links it to a Subsytem.' }) @ApiOkResponse({ description: 'Succesfully created a Token.' }) async generateTokenForSubsystem(@Param('id') userId: number, @Body() request: CreateSubSystemPermissionDto): - Promise> { + Promise> { const uniqueId: string = uuid(); request.subSystemHash = await this.bcryptService.hashToken(uniqueId); request.user = userId; @@ -104,9 +103,9 @@ export class UserController { // add extra field to the jwt token to identify that a machine is making the request const jwtPayload: JwtPayload = { - ['token']: uniqueId, - ['is_subsystem']: 'true', - ['permission_id']: newSubSystemPermission.subSystemPermissionId.toString() + token: uniqueId, + is_subsystem: 'true', + permission_id: newSubSystemPermission.subSystemPermissionId.toString(), }; // creates a jwt and returns it @@ -129,9 +128,7 @@ export class UserController { @ApiOperation({ title: 'Returns all Logs for a specific User.' }) @ApiOkResponse({ description: 'Succesfully returned Logs.', type: [Log] }) @ApiNotFoundResponse({ description: 'No Logs found for this User.' }) - async findLogsByUserId( - @Param('id') userId: number, @Query() query?: QueryLogDto - ): Promise> { + async findLogsByUserId(@Param('id') userId: number, @Query() query?: QueryLogDto): Promise> { try { const logsByUserId = await this.logService.findLogsByUserId(userId, query); return createResponseItems(logsByUserId.logs, undefined, logsByUserId.additionalInformation); diff --git a/src/dtos/create.attachment.dto.ts b/src/dtos/create.attachment.dto.ts index 5491eae..855cbd0 100644 --- a/src/dtos/create.attachment.dto.ts +++ b/src/dtos/create.attachment.dto.ts @@ -11,7 +11,6 @@ import { IsString, IsBase64, IsByteLength, IsOptional } from 'class-validator'; import { FILE_UPLOAD_LIMIT } from '../constants'; export class CreateAttachmentDto { - @ApiModelProperty({ type: 'string', format: 'date-time', diff --git a/src/dtos/create.log.dto.ts b/src/dtos/create.log.dto.ts index 742854c..6fcbfe6 100644 --- a/src/dtos/create.log.dto.ts +++ b/src/dtos/create.log.dto.ts @@ -26,21 +26,21 @@ export class CreateLogDto { @ApiModelProperty({ example: 'human', description: 'Where did the log come from?', - enum: ['human', 'process'] + enum: ['human', 'process'], }) @IsEnum(Origin, { each: true, message: 'Each value in origin must be a valid enum value' }) origin: string; @ApiModelProperty({ example: 1, - description: 'The id of a log' + description: 'The id of a log', }) @IsInt() rootId?: number; @ApiModelProperty({ example: 1, - description: 'Log id of Parent comment' + description: 'Log id of Parent comment', }) @IsInt() parentId?: number; diff --git a/src/dtos/create.run.dto.ts b/src/dtos/create.run.dto.ts index 8f1150a..a5b467e 100644 --- a/src/dtos/create.run.dto.ts +++ b/src/dtos/create.run.dto.ts @@ -15,7 +15,6 @@ import { IsInt, IsString, IsEnum, IsDateString, IsNumber } from 'class-validator import { RunType } from '../enums/run.runtype.enum'; export class CreateRunDto { - @ApiModelProperty({ example: 1, description: 'The id of the run', @@ -46,7 +45,7 @@ export class CreateRunDto { @ApiModelProperty({ example: 'COSMICS', description: 'What kind of run.', - enum: ['PHYSICS' , 'COSMICS' , 'TECHNICAL'], + enum: ['PHYSICS', 'COSMICS', 'TECHNICAL'], }) @IsEnum(RunType, { each: true, message: 'Each value in subtype must be a valid enum value' }) readonly runType: string; diff --git a/src/dtos/create.subsystemPermission.dto.ts b/src/dtos/create.subsystemPermission.dto.ts index 9a9ff80..5514267 100644 --- a/src/dtos/create.subsystemPermission.dto.ts +++ b/src/dtos/create.subsystemPermission.dto.ts @@ -15,7 +15,6 @@ import { IsString, IsBoolean } from 'class-validator'; import { SubSystem } from '../entities/sub_system.entity'; export class CreateSubSystemPermissionDto { - @ApiModelProperty({ type: 'integer', format: 'int64', diff --git a/src/dtos/create.tag.dto.ts b/src/dtos/create.tag.dto.ts index 59f000b..c493fb1 100644 --- a/src/dtos/create.tag.dto.ts +++ b/src/dtos/create.tag.dto.ts @@ -10,10 +10,9 @@ import { IsString } from 'class-validator'; import { ApiModelProperty } from '@nestjs/swagger'; export class CreateTagDto { - @ApiModelProperty({ example: '#ALICE', - description: 'The text of the tag' + description: 'The text of the tag', }) @IsString() tagText: string; diff --git a/src/dtos/create.user.dto.ts b/src/dtos/create.user.dto.ts index 3ea9900..84b7ee2 100644 --- a/src/dtos/create.user.dto.ts +++ b/src/dtos/create.user.dto.ts @@ -27,7 +27,7 @@ export class CreateUserDto { * The user's name from the database of the OAuth provider (e.g. GitHub, CERN etc.). */ @ApiModelProperty({ - type: 'string' + type: 'string', }) name: string; } diff --git a/src/dtos/createpdf.loginfo.dto.ts b/src/dtos/createpdf.loginfo.dto.ts index dbde63e..9966cb3 100644 --- a/src/dtos/createpdf.loginfo.dto.ts +++ b/src/dtos/createpdf.loginfo.dto.ts @@ -4,7 +4,7 @@ import { IsNumber } from 'class-validator'; export class CreateLogInfo { @ApiModelProperty({ example: 5, - description: 'Log id' + description: 'Log id', }) @IsNumber() id: number; diff --git a/src/dtos/createpdf.runconf.dto.ts b/src/dtos/createpdf.runconf.dto.ts index 1eb6df1..9f3c089 100644 --- a/src/dtos/createpdf.runconf.dto.ts +++ b/src/dtos/createpdf.runconf.dto.ts @@ -4,13 +4,14 @@ import { IsNumber } from 'class-validator'; export class CreateRunConf { @ApiModelProperty({ example: 5, - description: 'ID of the previous run' + description: 'ID of the previous run', }) @IsNumber() id1: number; + @ApiModelProperty({ example: 7, - description: 'ID of the current run' + description: 'ID of the current run', }) @IsNumber() id2: number; diff --git a/src/dtos/createpdf.userdata.dto.ts b/src/dtos/createpdf.userdata.dto.ts index 91b4e67..4c64853 100644 --- a/src/dtos/createpdf.userdata.dto.ts +++ b/src/dtos/createpdf.userdata.dto.ts @@ -2,26 +2,25 @@ import { ApiModelProperty } from '@nestjs/swagger'; export class CreateUserData { @ApiModelProperty({ example: 'Nick', - description: 'First worker\'s name' + description: 'First worker\'s name', }) fname: string; @ApiModelProperty({ example: 'Fury', - description: 'Last worker\'s name' + description: 'Last worker\'s name', }) lname: string; @ApiModelProperty({ example: 'Student', - description: 'Occupation' + description: 'Occupation', }) occupation: string; @ApiModelProperty({ example: 'Something wrong! There is a big black hole! Help me!', - description: 'Bug report' + description: 'Bug report', }) bugReport: string; - } diff --git a/src/dtos/file.dto.ts b/src/dtos/file.dto.ts index 4a82a5e..1013f05 100644 --- a/src/dtos/file.dto.ts +++ b/src/dtos/file.dto.ts @@ -7,7 +7,6 @@ */ export class FileDto { - fieldname: string; originalname: string; diff --git a/src/dtos/get.overview.dto.ts b/src/dtos/get.overview.dto.ts index b91b9f6..109b9d0 100644 --- a/src/dtos/get.overview.dto.ts +++ b/src/dtos/get.overview.dto.ts @@ -9,7 +9,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; export class GetOverviewDto { - @ApiModelProperty({ type: 'string', }) diff --git a/src/dtos/query.log.dto.ts b/src/dtos/query.log.dto.ts index 8756cf9..4804237 100644 --- a/src/dtos/query.log.dto.ts +++ b/src/dtos/query.log.dto.ts @@ -20,7 +20,6 @@ import { User } from '../entities/user.entity'; */ @Entity('logs') export class QueryLogDto { - @ApiModelProperty({ description: 'On which field to order on.', required: false, @@ -36,7 +35,7 @@ export class QueryLogDto { @IsEnum(OrderDirection, { each: true, message: `orderDirection must be of enum string types: - ${_.values(OrderDirection).map((x: OrderDirection) => x)}.` + ${_.values(OrderDirection).map((x: OrderDirection) => x)}.`, }) @IsOptional() orderDirection?: OrderDirection; diff --git a/src/dtos/query.overview.dto.ts b/src/dtos/query.overview.dto.ts index 2f113c0..d5434be 100644 --- a/src/dtos/query.overview.dto.ts +++ b/src/dtos/query.overview.dto.ts @@ -15,7 +15,6 @@ import { IsOptional, IsNumber } from 'class-validator'; */ @Entity('overview') export class QueryOverviewDto { - @ApiModelProperty({ description: 'In which time range the logs of eachsubsystem should be posted', required: false, diff --git a/src/dtos/query.run.dto.ts b/src/dtos/query.run.dto.ts index 3b60938..197ecf0 100644 --- a/src/dtos/query.run.dto.ts +++ b/src/dtos/query.run.dto.ts @@ -34,7 +34,7 @@ export class QueryRunDto { @IsEnum(OrderDirection, { each: true, message: `orderDirection must be of enum string types: - ${_.values(OrderDirection).map((x: OrderDirection) => x)}.` + ${_.values(OrderDirection).map((x: OrderDirection) => x)}.`, }) @IsOptional() orderDirection?: OrderDirection; @@ -47,7 +47,7 @@ export class QueryRunDto { format: 'int64', }) @IsNumber() - pageSize: number = 25; + pageSize = 25; @ApiModelProperty({ description: 'The current page, i.e. the offset in the result set based on pageSize.', @@ -57,7 +57,7 @@ export class QueryRunDto { format: 'int64', }) @IsNumber() - pageNumber: number = 1; + pageNumber = 1; @ApiModelProperty({ description: 'The id of the log.', diff --git a/src/dtos/query.tag.dto.ts b/src/dtos/query.tag.dto.ts index 79e9aa0..ad89b57 100644 --- a/src/dtos/query.tag.dto.ts +++ b/src/dtos/query.tag.dto.ts @@ -10,10 +10,9 @@ import { IsString, IsOptional } from 'class-validator'; import { ApiModelProperty } from '@nestjs/swagger'; export class QueryTagDto { - @ApiModelProperty({ description: 'The text of the tag', - required: false + required: false, }) @IsString() @IsOptional() diff --git a/src/dtos/thread.dto.ts b/src/dtos/thread.dto.ts index f36b55f..68681b0 100644 --- a/src/dtos/thread.dto.ts +++ b/src/dtos/thread.dto.ts @@ -10,44 +10,43 @@ import { ApiModelProperty } from '@nestjs/swagger'; import { User } from '../entities/user.entity'; export class ThreadDto { - @ApiModelProperty({ - description: 'The id of the thread/log' + description: 'The id of the thread/log', }) logId: number; @ApiModelProperty({ - description: 'The id of the run\'s log id' + description: 'The id of the run\'s log id', }) commentFkRootLogId: number; @ApiModelProperty({ - description: 'The id of the comment on a thread' + description: 'The id of the comment on a thread', }) commentFkParentLogId: number; @ApiModelProperty({ - description: 'Date and Time when the comment was created' + description: 'Date and Time when the comment was created', }) creationTime: Date; @ApiModelProperty({ - description: 'Title of the comment' + description: 'Title of the comment', }) title: string; @ApiModelProperty({ - description: 'Content of the comment' + description: 'Content of the comment', }) body: string; @ApiModelProperty({ - description: 'user' + description: 'user', }) user: User; @ApiModelProperty({ - description: 'A list of sub-comment of the parent comment' + description: 'A list of sub-comment of the parent comment', }) comments: ThreadDto[]; diff --git a/src/entities/attachment.entity.ts b/src/entities/attachment.entity.ts index a32dcce..8049bd5 100644 --- a/src/entities/attachment.entity.ts +++ b/src/entities/attachment.entity.ts @@ -12,7 +12,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('attachment') export class Attachment { - @PrimaryGeneratedColumn({ name: 'file_id' }) @ApiModelProperty({ type: 'integer', @@ -25,9 +24,9 @@ export class Attachment { log => log.attachments, { nullable: true, - cascade: ['insert'] + cascade: ['insert'], - } + }, ) @JoinColumn({ name: 'fk_log_id' }) @ApiModelProperty() @@ -39,7 +38,7 @@ export class Attachment { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) creationTime: Date; @@ -57,7 +56,7 @@ export class Attachment { @Column({ name: 'file_data', - type: 'longblob' + type: 'longblob', }) @ApiModelProperty() fileData: string; diff --git a/src/entities/detector.entity.ts b/src/entities/detector.entity.ts index f169dd5..9a8700e 100644 --- a/src/entities/detector.entity.ts +++ b/src/entities/detector.entity.ts @@ -13,7 +13,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('detector') export class Detector { - @PrimaryGeneratedColumn({ name: 'detector_id' }) @ApiModelProperty({ type: 'integer', diff --git a/src/entities/detector_quality_history.entity.ts b/src/entities/detector_quality_history.entity.ts index b7a8c78..a4320ea 100644 --- a/src/entities/detector_quality_history.entity.ts +++ b/src/entities/detector_quality_history.entity.ts @@ -14,7 +14,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('detector_quality_history') export class DetectorQualityHistory { - @PrimaryGeneratedColumn({ name: 'detector_quality_history_id' }) detectorQualityHistoryId: number; @@ -22,8 +21,8 @@ export class DetectorQualityHistory { type => Run, run => run.detectorQualityHistories, { - primary: true - } + primary: true, + }, ) @JoinColumn({ name: 'fk_run_number' }) run: Run; @@ -32,8 +31,8 @@ export class DetectorQualityHistory { type => Detector, detector => detector.detectorQualityHistories, { - primary: true - } + primary: true, + }, ) @JoinColumn({ name: 'fk_detector_id' }) detector: Detector; @@ -42,8 +41,8 @@ export class DetectorQualityHistory { type => User, user => user.detectorQualityHistories, { - nullable: false - } + nullable: false, + }, ) @JoinColumn({ name: 'fk_changed_by_user_id' }) user: User; @@ -54,7 +53,7 @@ export class DetectorQualityHistory { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) changeTime: Date; diff --git a/src/entities/detectors_in_run.entity.ts b/src/entities/detectors_in_run.entity.ts index bf2c010..3df676b 100644 --- a/src/entities/detectors_in_run.entity.ts +++ b/src/entities/detectors_in_run.entity.ts @@ -13,18 +13,18 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('detectors_in_run') export class DetectorsInRun { - @ApiModelProperty( { type: 'integer', - } + }, ) @ManyToOne( - type => Run, run => run.detectorsInRun, + type => Run, + run => run.detectorsInRun, { primary: true, - eager: true - } + eager: true, + }, ) @JoinColumn({ name: 'fk_run_number' }) run: Run; @@ -32,14 +32,15 @@ export class DetectorsInRun { @ApiModelProperty( { type: 'integer', - } + }, ) @ManyToOne( - type => Detector, detector => detector.detectorsInRun, + type => Detector, + detector => detector.detectorsInRun, { primary: true, - eager: true - } + eager: true, + }, ) @JoinColumn({ name: 'fk_detector_id' }) detector: Detector; @@ -48,7 +49,7 @@ export class DetectorsInRun { { type: 'enum', enum: ['test'], - } + }, ) @Column({ name: 'run_quality', diff --git a/src/entities/epn_role_session.entity.ts b/src/entities/epn_role_session.entity.ts index 307d14f..f63c441 100644 --- a/src/entities/epn_role_session.entity.ts +++ b/src/entities/epn_role_session.entity.ts @@ -12,23 +12,23 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('epn_role_session') export class EpnRoleSession { - @PrimaryGeneratedColumn({ name: 'session_number' }) sessionNumber: number; @PrimaryColumn({ name: 'epn_role_name', type: 'char', - length: 16 + length: 16, }) epnRoleName: string; @ManyToOne( - type => Run, run => run.epnRoleSessions, + type => Run, + run => run.epnRoleSessions, { primary: true, - eager: true - } + eager: true, + }, ) @JoinColumn({ name: 'fk_run_number' }) run: Run; @@ -63,7 +63,7 @@ export class EpnRoleSession { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) sessionStart: Date; @@ -73,7 +73,7 @@ export class EpnRoleSession { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) sessionEnd: Date; } diff --git a/src/entities/flp_role.entity.ts b/src/entities/flp_role.entity.ts index 7b738f4..5869431 100644 --- a/src/entities/flp_role.entity.ts +++ b/src/entities/flp_role.entity.ts @@ -12,36 +12,36 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('flp_role') export class FlpRole { - @PrimaryColumn({ name: 'flp_name', type: 'char', - length: 16 + length: 16, }) flpName: string; @ManyToOne( - type => Run, run => run.flpRoles, + type => Run, + run => run.flpRoles, { primary: true, - eager: true - } + eager: true, + }, ) @JoinColumn({ name: 'fk_run_number' }) @ApiModelProperty({ type: 'integer', - format: 'int64' + format: 'int64', }) run: Run; @Column({ - name: 'flp_hostname' + name: 'flp_hostname', }) flpHostname: string; @Column({ name: 'n_sub_timeframes', - nullable: true + nullable: true, }) @ApiModelProperty({ type: 'integer', @@ -51,7 +51,7 @@ export class FlpRole { @Column({ name: 'equipment_bytes', - nullable: true + nullable: true, }) @ApiModelProperty({ type: 'integer', @@ -61,7 +61,7 @@ export class FlpRole { @Column({ name: 'recording_bytes', - nullable: true + nullable: true, }) @ApiModelProperty({ type: 'integer', @@ -71,7 +71,7 @@ export class FlpRole { @Column({ name: 'fair_mq_bytes', - nullable: true + nullable: true, }) @ApiModelProperty({ type: 'integer', @@ -79,7 +79,9 @@ export class FlpRole { }) fairMQBytes: number; - // Maybe there is use for it later. - // @Column({ name: 'bytes_processed' }) - // bytesProcessed: number; + /* + * Maybe there is use for it later. + * @Column({ name: 'bytes_processed' }) + * bytesProcessed: number; + */ } diff --git a/src/entities/infolog.entity.ts b/src/entities/infolog.entity.ts index 19b8417..fb57796 100644 --- a/src/entities/infolog.entity.ts +++ b/src/entities/infolog.entity.ts @@ -9,18 +9,18 @@ import { Entity, Column, PrimaryColumn } from 'typeorm'; import { USE_INFO_LOGGER } from '../constants'; -@Entity('messages', { database: 'INFOLOGGER', synchronize: USE_INFO_LOGGER === 'true' ? true : false }) +@Entity('messages', { database: 'INFOLOGGER', synchronize: USE_INFO_LOGGER === 'true' }) export class InfoLog { @Column({ name: 'severity', - nullable: true + nullable: true, }) severity: string; @Column({ name: 'level', nullable: true, - unsigned: true + unsigned: true, }) level: number; @@ -28,83 +28,83 @@ export class InfoLog { name: 'timestamp', type: 'double', precision: 16, - scale: 6 + scale: 6, }) timestamp: number; @Column({ name: 'hostname', - nullable: true + nullable: true, }) hostname: string; @Column({ name: 'rolename', - nullable: true + nullable: true, }) rolename: string; @Column({ name: 'pid', nullable: true, - unsigned: true + unsigned: true, }) pid: number; @Column({ name: 'username', - nullable: true + nullable: true, }) username: string; @Column({ name: 'system', - nullable: true + nullable: true, }) system: string; @Column({ name: 'facility', - nullable: true + nullable: true, }) facility: string; @Column({ name: 'detector', - nullable: true + nullable: true, }) detector: string; @Column({ name: 'partition', - nullable: true + nullable: true, }) partition: string; @Column({ name: 'run', nullable: true, - unsigned: true + unsigned: true, }) run: number; @Column({ name: 'errcode', nullable: true, - unsigned: true + unsigned: true, }) errcode: number; @Column({ name: 'errline', nullable: true, - unsigned: true + unsigned: true, }) errline: number; @Column({ name: 'errsource', - nullable: true + nullable: true, }) errsource: string; diff --git a/src/entities/intervention_log.entity.ts b/src/entities/intervention_log.entity.ts index f0d86a5..5ef3b7e 100644 --- a/src/entities/intervention_log.entity.ts +++ b/src/entities/intervention_log.entity.ts @@ -11,13 +11,12 @@ import { Log } from './log.entity'; @Entity('intervention_log') export class InterventionLog { - @OneToOne( type => Log, { primary: true, eager: true, - } + }, ) @JoinColumn({ name: 'log_id' }) log: Log; @@ -25,7 +24,7 @@ export class InterventionLog { @Column({ name: 'time_of_call', precision: 0, - nullable: true + nullable: true, }) timeOfCall: Date; @@ -33,20 +32,20 @@ export class InterventionLog { name: 'intervention_type', type: 'enum', enum: ['test'], - nullable: true + nullable: true, }) interventionType: 'test'; @Column({ type: 'enum', enum: ['test'], - nullable: true + nullable: true, }) location: 'test'; @Column({ name: 'action_taken', - nullable: true + nullable: true, }) actionTaken: string; } diff --git a/src/entities/log.entity.ts b/src/entities/log.entity.ts index 83891bf..3d92ffd 100644 --- a/src/entities/log.entity.ts +++ b/src/entities/log.entity.ts @@ -14,7 +14,7 @@ import { JoinTable, OneToMany, ManyToOne, - JoinColumn + JoinColumn, } from 'typeorm'; import { Tag } from './tag.entity'; import { Attachment } from './attachment.entity'; @@ -25,7 +25,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('log') export class Log { - @PrimaryGeneratedColumn({ name: 'log_id' }) @ApiModelProperty({ type: 'integer', @@ -41,21 +40,22 @@ export class Log { { type: 'enum', enum: ['run', 'subsystem', 'announcement', 'intervention', 'comment'], - } + }, ) subtype: 'run' | 'subsystem' | 'announcement' | 'intervention' | 'comment'; + @ApiModelProperty( { type: User, - } + }, ) @ManyToOne( type => User, user => user.logs, { nullable: false, - cascade: ['insert'] - } + cascade: ['insert'], + }, ) @JoinColumn({ name: 'fk_user_id' }) user: User; @@ -68,7 +68,7 @@ export class Log { { type: 'enum', enum: ['human', 'process'], - } + }, ) origin: 'human' | 'process'; @@ -78,7 +78,7 @@ export class Log { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) creationTime: Date; @@ -115,7 +115,7 @@ export class Log { @Column({ name: 'comment_fk_parent_log_id', - nullable: true + nullable: true, }) @ApiModelProperty({ required: false, @@ -126,7 +126,7 @@ export class Log { @Column({ name: 'comment_fk_root_log_id', - nullable: true + nullable: true, }) @ApiModelProperty({ required: false, @@ -138,7 +138,7 @@ export class Log { @ApiModelProperty({ type: Tag, isArray: true, - minProperties: 1 + minProperties: 1, }) @ManyToMany(type => Tag, tag => tag.logs) tags: Tag[]; @@ -149,23 +149,23 @@ export class Log { }) @ManyToMany( type => Run, - run => run.logs + run => run.logs, ) @JoinTable({ name: 'runs_in_log', joinColumn: { name: 'fk_log_id', - referencedColumnName: 'logId' + referencedColumnName: 'logId', }, inverseJoinColumn: { name: 'fk_run_number', - referencedColumnName: 'runNumber' - } + referencedColumnName: 'runNumber', + }, }) runs: Run[]; @OneToMany(type => Attachment, attachment => attachment.log, { - cascade: ['insert'] + cascade: ['insert'], }) @ApiModelProperty({ type: Attachment, diff --git a/src/entities/report_preference.entity.ts b/src/entities/report_preference.entity.ts index 712b6b7..ef88c75 100644 --- a/src/entities/report_preference.entity.ts +++ b/src/entities/report_preference.entity.ts @@ -11,13 +11,12 @@ import { User } from './user.entity'; @Entity('report_preference') export class ReportPreference { - @ManyToOne( type => User, user => user.reportPreferences, { - primary: true - } + primary: true, + }, ) @JoinColumn({ name: 'fk_user_id' }) user: User; diff --git a/src/entities/run.entity.ts b/src/entities/run.entity.ts index b26188c..1754432 100644 --- a/src/entities/run.entity.ts +++ b/src/entities/run.entity.ts @@ -19,9 +19,8 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('run') export class Run { - @PrimaryColumn({ - name: 'run_number' + name: 'run_number', }) @ApiModelProperty({ type: 'integer', @@ -57,7 +56,7 @@ export class Run { @ApiModelProperty({ required: false, type: 'string', - format: 'date-time' + format: 'date-time', }) TrgEndTime: Date; @@ -69,14 +68,14 @@ export class Run { @ApiModelProperty({ required: false, type: 'string', - format: 'date-time' + format: 'date-time', }) O2EndTime: Date; @Column({ name: 'activity_id', type: 'char', - length: 64 + length: 64, }) @ApiModelProperty() activityId: string; @@ -87,7 +86,7 @@ export class Run { enum: [ 'PHYSICS', 'COSMICS', - 'TECHNICAL' + 'TECHNICAL', ], }) @ApiModelProperty( @@ -96,9 +95,9 @@ export class Run { enum: [ 'PHYSICS', 'COSMICS', - 'TECHNICAL' + 'TECHNICAL', ], - } + }, ) runType: ['PHYSICS' | 'COSMICS' | 'TECHNICAL']; @@ -108,7 +107,7 @@ export class Run { enum: [ 'Good', 'Bad', - 'Unknown' + 'Unknown', ], nullable: true, }) @@ -119,9 +118,9 @@ export class Run { enum: [ 'Good', 'Bad', - 'Unknown' + 'Unknown', ], - } + }, ) runQuality: ['Good' | 'Bad' | 'Unknown']; @@ -193,7 +192,7 @@ export class Run { @ApiModelProperty({ type: 'integer', isArray: true, - minProperties: 1 + minProperties: 1, }) @ManyToMany(type => Tag, tag => tag.runs) tags: Tag[]; @@ -201,7 +200,7 @@ export class Run { @ApiModelProperty({ type: 'integer', isArray: true, - minProperties: 1 + minProperties: 1, }) @ManyToMany(type => Log, log => log.runs) logs: Log[]; @@ -211,7 +210,7 @@ export class Run { { type: EpnRoleSession, isArray: true, - } + }, ) epnRoleSessions: EpnRoleSession[]; diff --git a/src/entities/run_eor_history.entity.ts b/src/entities/run_eor_history.entity.ts index 28fbeba..83b7ef8 100644 --- a/src/entities/run_eor_history.entity.ts +++ b/src/entities/run_eor_history.entity.ts @@ -13,7 +13,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('run_eor_history') export class RunEorHistory { - @PrimaryGeneratedColumn({ name: 'eor_history_id' }) eorHistoryId: number; @@ -21,8 +20,8 @@ export class RunEorHistory { type => Run, run => run.runQualityHistories, { - primary: true - } + primary: true, + }, ) @JoinColumn({ name: 'fk_run_number' }) run: Run; @@ -37,8 +36,8 @@ export class RunEorHistory { type => User, user => user.runEorHistories, { - nullable: false - } + nullable: false, + }, ) @JoinColumn({ name: 'fk_changed_by_user_id' }) user: User; @@ -49,7 +48,7 @@ export class RunEorHistory { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) changeTime: Date; diff --git a/src/entities/run_quality_history.entity.ts b/src/entities/run_quality_history.entity.ts index b3a99d0..6c7a929 100644 --- a/src/entities/run_quality_history.entity.ts +++ b/src/entities/run_quality_history.entity.ts @@ -13,7 +13,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('run_quality_history') export class RunQualityHistory { - @PrimaryGeneratedColumn({ name: 'run_quality_history_id' }) runQualityHistoryId: number; @@ -21,8 +20,8 @@ export class RunQualityHistory { type => Run, run => run.runQualityHistories, { - primary: true - } + primary: true, + }, ) @JoinColumn({ name: 'fk_run_number' }) run: Run; @@ -31,8 +30,8 @@ export class RunQualityHistory { type => User, user => user.runQualityHistories, { - nullable: false - } + nullable: false, + }, ) @JoinColumn({ name: 'fk_changed_by_user_id' }) user: User; @@ -43,7 +42,7 @@ export class RunQualityHistory { }) @ApiModelProperty({ type: 'string', - format: 'date-time' + format: 'date-time', }) changeTime: Date; diff --git a/src/entities/sub_system.entity.ts b/src/entities/sub_system.entity.ts index 7675ce1..48d926f 100644 --- a/src/entities/sub_system.entity.ts +++ b/src/entities/sub_system.entity.ts @@ -12,7 +12,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('sub_system') export class SubSystem { - @PrimaryGeneratedColumn({ name: 'subsystem_id' }) @ApiModelProperty({ type: 'integer', @@ -28,7 +27,7 @@ export class SubSystem { { type: 'integer', isArray: true, - } + }, ) @OneToMany(type => SubSystemPermission, subSystemPermission => subSystemPermission.subsystem) subSystemPermissions: SubSystemPermission[]; diff --git a/src/entities/sub_system_permission.entity.ts b/src/entities/sub_system_permission.entity.ts index 2b2d479..cdf971d 100644 --- a/src/entities/sub_system_permission.entity.ts +++ b/src/entities/sub_system_permission.entity.ts @@ -13,7 +13,7 @@ import { JoinColumn, ManyToMany, JoinTable, - PrimaryGeneratedColumn + PrimaryGeneratedColumn, } from 'typeorm'; import { SubSystem } from './sub_system.entity'; import { User } from './user.entity'; @@ -22,7 +22,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('sub_system_permission') export class SubSystemPermission { - @PrimaryGeneratedColumn({ name: 'sub_system_permission_id' }) @ApiModelProperty() subSystemPermissionId: number; @@ -30,64 +29,64 @@ export class SubSystemPermission { @ApiModelProperty( { type: User, - } + }, ) @ManyToOne( type => User, user => user.subSystemPermissions, { nullable: false, - cascade: ['insert'] - } + cascade: ['insert'], + }, ) @JoinColumn({ - name: 'fk_user_id' + name: 'fk_user_id', }) user: User; @ApiModelProperty( { type: SubSystem, - } + }, ) @ManyToOne( type => SubSystem, subSystem => subSystem.subSystemPermissions, { nullable: false, - cascade: ['insert'] - } + cascade: ['insert'], + }, ) @JoinColumn({ - name: 'fk_subsystem_id' + name: 'fk_subsystem_id', }) subsystem: SubSystem; @ApiModelProperty() @Column({ name: 'sub_system_hash', - type: 'varchar' + type: 'varchar', }) subSystemHash: string; @ApiModelProperty() @Column({ name: 'sub_system_token_description', - type: 'varchar' + type: 'varchar', }) subSystemTokenDescription: string; @ApiModelProperty() @Column({ name: 'is_member', - type: 'tinyint' + type: 'tinyint', }) isMember: boolean; @ApiModelProperty() @Column({ name: 'edit_eor_reason', - type: 'tinyint' + type: 'tinyint', }) editEorReason: boolean; @@ -95,19 +94,19 @@ export class SubSystemPermission { { type: SubSystemRole, isArray: true, - } + }, ) @ManyToMany(type => SubSystemRole) @JoinTable({ name: 'sub_system_permission_in_sub_system_role', joinColumn: { name: 'fk_sub_system_permission_id', - referencedColumnName: 'subSystemPermissionId' + referencedColumnName: 'subSystemPermissionId', }, inverseJoinColumn: { name: 'fk_sub_system_role_id', - referencedColumnName: 'subSystemRoleId' - } + referencedColumnName: 'subSystemRoleId', + }, }) subSystemRoles: SubSystemRole[]; } diff --git a/src/entities/sub_system_role.entity.ts b/src/entities/sub_system_role.entity.ts index 1965cf1..19feaa0 100644 --- a/src/entities/sub_system_role.entity.ts +++ b/src/entities/sub_system_role.entity.ts @@ -10,19 +10,18 @@ import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; @Entity('sub_system_role') export class SubSystemRole { - @PrimaryGeneratedColumn({ name: 'sub_system_role_id' }) subSystemRoleId: number; @Column({ name: 'sub_system_role_name', - type: 'varchar' + type: 'varchar', }) subSystemRoleName: string; @Column({ name: 'sub_system_role_description', - type: 'varchar' + type: 'varchar', }) subSystemRoleDescription: string; } diff --git a/src/entities/tag.entity.ts b/src/entities/tag.entity.ts index 4b6eded..dc99dfe 100644 --- a/src/entities/tag.entity.ts +++ b/src/entities/tag.entity.ts @@ -13,7 +13,6 @@ import { Log } from './log.entity'; @Entity('tag') export class Tag { - @PrimaryGeneratedColumn({ name: 'tag_id' }) @ApiModelProperty({ type: 'integer', @@ -30,17 +29,19 @@ export class Tag { name: 'tags_in_run', joinColumn: { name: 'fk_tag_id', - referencedColumnName: 'tagId' + referencedColumnName: 'tagId', }, inverseJoinColumn: { name: 'fk_run_number', - referencedColumnName: 'runNumber' - } + referencedColumnName: 'runNumber', + }, }) @ApiModelProperty({ type: Run, - // isArray: true, - // minProperties: 1 + /* + * isArray: true, + * minProperties: 1 + */ }) runs: Run[]; @@ -49,17 +50,19 @@ export class Tag { name: 'tags_in_log', joinColumn: { name: 'fk_tag_id', - referencedColumnName: 'tagId' + referencedColumnName: 'tagId', }, inverseJoinColumn: { name: 'fk_log_id', - referencedColumnName: 'logId' - } + referencedColumnName: 'logId', + }, }) @ApiModelProperty({ type: Log, - // isArray: true, - // minProperties: 1 + /* + * isArray: true, + * minProperties: 1 + */ }) logs: Log[]; } diff --git a/src/entities/user.entity.ts b/src/entities/user.entity.ts index 9a05859..ec64168 100644 --- a/src/entities/user.entity.ts +++ b/src/entities/user.entity.ts @@ -19,7 +19,6 @@ import { ApiModelProperty } from '@nestjs/swagger'; @Entity('user') export class User { - @PrimaryGeneratedColumn({ name: 'user_id' }) @ApiModelProperty({ type: 'integer', @@ -30,7 +29,7 @@ export class User { @Column({ name: 'external_id', type: 'int', - unique: true + unique: true, }) @ApiModelProperty({ type: 'integer', @@ -40,7 +39,7 @@ export class User { @Column({ name: 'sams_id', - type: 'int' + type: 'int', }) @ApiModelProperty({ type: 'integer', diff --git a/src/entities/user_filter.entity.ts b/src/entities/user_filter.entity.ts index 5c174e8..3962528 100644 --- a/src/entities/user_filter.entity.ts +++ b/src/entities/user_filter.entity.ts @@ -11,7 +11,6 @@ import { User } from './user.entity'; @Entity('user_filter') export class UserFilter { - @PrimaryGeneratedColumn({ name: 'filter_id' }) filterId: number; @@ -19,8 +18,8 @@ export class UserFilter { type => User, user => user.userFilters, { - primary: true - } + primary: true, + }, ) @JoinColumn({ name: 'fk_user_id' }) user: User; diff --git a/src/entities/user_notification.entity.ts b/src/entities/user_notification.entity.ts index eef0128..1552c15 100644 --- a/src/entities/user_notification.entity.ts +++ b/src/entities/user_notification.entity.ts @@ -11,34 +11,33 @@ import { User } from './user.entity'; @Entity('user_notification') export class UserNotification { - @ManyToOne( type => User, user => user.userNotifications, { primary: true, nullable: false, - eager: true - } + eager: true, + }, ) @JoinColumn({ name: 'fk_user_id' }) user: User; @Column({ name: 'notify_sor', - type: 'tinyint' + type: 'tinyint', }) notifySor: boolean; @Column({ name: 'notify_eor', - type: 'tinyint' + type: 'tinyint', }) notifyEor: boolean; @Column({ name: 'notify_subsystem', - type: 'tinyint' + type: 'tinyint', }) notifySubsystem: boolean; } diff --git a/src/enums/env.enum.ts b/src/enums/env.enum.ts index b61ba0f..381b83f 100644 --- a/src/enums/env.enum.ts +++ b/src/enums/env.enum.ts @@ -8,15 +8,17 @@ export enum Database { } export enum Regex { - // IP regex from https://regexr.com/38odc - // URL regex from https://regexr.com/3ajfi + /* + * IP regex from https://regexr.com/38odc + * URL regex from https://regexr.com/3ajfi + */ IP_OR_URL_OR_LOCALHOST = - '\\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]).){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])(.+)?)\\b|' + + '\\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]).){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])(.+)?)\\b|' + '([--:\\w?@%&+~#=]*\\.[a-z]{2,4}\/{0,2})((?:[?&](?:\\w+)=(?:\\w+))+|[--:\\w?@%&+~#=]+)?|' + '(http(s)?:\/\/)?(localhost)(.+)?', BOOLEAN = '^(tru|fals)e$', // Allow port numbers between 1 - 65535, from http://gamon.webfactional.com/regexnumericrangegenerator/ PORT_NUMBER = - '^([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|' + + '^([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|' + '99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$', } diff --git a/src/filters/httpexception.filter.ts b/src/filters/httpexception.filter.ts index b455d52..d67c7d7 100644 --- a/src/filters/httpexception.filter.ts +++ b/src/filters/httpexception.filter.ts @@ -38,7 +38,7 @@ export class HttpExceptionFilter implements ExceptionFilter { error: exception.name, code: exception.getStatus(), message: errorMsg, - customMessage: customErrorMsg + customMessage: customErrorMsg, }; } diff --git a/src/helpers/auth.helper.ts b/src/helpers/auth.helper.ts index 20e53af..289840b 100644 --- a/src/helpers/auth.helper.ts +++ b/src/helpers/auth.helper.ts @@ -22,7 +22,7 @@ dotenv.config(); * @param app Nest application. * @returns JWT string */ -export const getJwt = async (app: INestApplication): Promise => { +export const getJwt = async(app: INestApplication): Promise => { const bcryptService = new BCryptService(); const hashedSecret = await bcryptService.hashToken(JWT_SECRET_KEY); const response = await request(app.getHttpServer()) diff --git a/src/helpers/response.helper.ts b/src/helpers/response.helper.ts index f4f0306..c36e94e 100644 --- a/src/helpers/response.helper.ts +++ b/src/helpers/response.helper.ts @@ -11,7 +11,7 @@ import { CollectionSuccessObject, SuccessObject, ErrorObject, - InnerError + InnerError, } from '../interfaces/response_object.interface'; import { HttpException, HttpStatus } from '@nestjs/common'; @@ -21,7 +21,7 @@ export const createResponseItem = (item: T, meta?: Meta, additionalData?: any meta, data: { ...additionalData, - item + item, }, }; }; @@ -33,7 +33,7 @@ export const createResponseItems = ( meta, data: { ...additionalData, - items + items, }, }; }; @@ -59,7 +59,7 @@ export const createErrorResponse = ( code: errorCode, message: httpError ? httpError.message : 'Oops, something went wrong', details: stackTrace, - innerError + innerError, }, }; break; @@ -72,7 +72,7 @@ export const createErrorResponse = ( code: errorCode, message: httpError ? httpError.message : 'Oops, something went wrong', details, - innerError + innerError, }, }; } diff --git a/src/interfaces/infologger.interface.ts b/src/interfaces/infologger.interface.ts index a3b1690..78582f0 100644 --- a/src/interfaces/infologger.interface.ts +++ b/src/interfaces/infologger.interface.ts @@ -6,29 +6,31 @@ * copied verbatim in the file "LICENSE" */ -// export interface InfoLogProtocols { -// [ -// version: '1.4', -// fields: [ -// { name: 'severity', type: string }, -// { name: 'level', type: number }, -// { name: 'timestamp', type: number }, -// { name: 'hostname', type: string }, -// { name: 'rolename', type: string }, -// { name: 'pid', type: number }, -// { name: 'username', type: string }, -// { name: 'system', type: string }, -// { name: 'facility', type: string }, -// { name: 'detector', type: string }, -// { name: 'partition', type: string }, -// { name: 'run', type: number }, -// { name: 'errcode', type: number }, -// { name: 'errline', type: number }, -// { name: 'errsource', type: string }, -// { name: 'message', type: string } -// ], -// ]; -// } +/* + * export interface InfoLogProtocols { + * [ + * version: '1.4', + * fields: [ + * { name: 'severity', type: string }, + * { name: 'level', type: number }, + * { name: 'timestamp', type: number }, + * { name: 'hostname', type: string }, + * { name: 'rolename', type: string }, + * { name: 'pid', type: number }, + * { name: 'username', type: string }, + * { name: 'system', type: string }, + * { name: 'facility', type: string }, + * { name: 'detector', type: string }, + * { name: 'partition', type: string }, + * { name: 'run', type: number }, + * { name: 'errcode', type: number }, + * { name: 'errline', type: number }, + * { name: 'errsource', type: string }, + * { name: 'message', type: string } + * ], + * ]; + * } + */ module.exports = { version: '1.4', @@ -48,6 +50,6 @@ module.exports = { { name: 'errcode', type: Number }, { name: 'errline', type: Number }, { name: 'errsource', type: String }, - { name: 'message', type: String } - ] + { name: 'message', type: String }, + ], }; diff --git a/src/main.ts b/src/main.ts index 42ccf84..abeee19 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,7 +21,7 @@ import { join } from 'path'; * Check the .env against the array of variables. * if one of the variables is missing or does not pass the check, the program will exit. */ -//#region +// #region function preCheck(): void { const envUtil = new EnvironmentUtility(); let keys: string[] = [ @@ -43,7 +43,7 @@ function preCheck(): void { 'SUB_SYSTEM_TOKEN_EXPIRES_IN', 'CLIENT_ID', 'CLIENT_SECRET', - 'AUTH_REDIRECT_URI' + 'AUTH_REDIRECT_URI', ]; let values: string[] = [ @@ -85,7 +85,7 @@ function preCheck(): void { 'TEST_DB_DATABASE', 'TEST_DB_PORT', 'TEST_DB_SYNCHRONIZE', - 'TEST_DB_LOGGING' + 'TEST_DB_LOGGING', ]; values = [ @@ -102,7 +102,7 @@ function preCheck(): void { envUtil.checkEnv(keys, values); } } -//#endregion +// #endregion preCheck(); @@ -111,9 +111,11 @@ async function bootstrap(): Promise { app.enableCors(); app.setBaseViewsDir(join(__dirname, 'views')); app.setViewEngine('hbs'); - // Increases the packet limit to 15MB instead of the default 100kb - // app.use(bodyParser.json({ limit: 5000000 })); - // app.use(bodyParser.urlencoded({ limit: 5000000, extended: true })); + /* + * Increases the packet limit to 15MB instead of the default 100kb + * app.use(bodyParser.json({ limit: 5000000 })); + * app.use(bodyParser.urlencoded({ limit: 5000000, extended: true })); + */ const options = new DocumentBuilder() .setTitle(APPLICATION_NAME) diff --git a/src/migration/1564060597067-CreateUserAnonymous.ts b/src/migration/1564060597067-CreateUserAnonymous.ts index 4f682d4..43b0ff3 100644 --- a/src/migration/1564060597067-CreateUserAnonymous.ts +++ b/src/migration/1564060597067-CreateUserAnonymous.ts @@ -1,12 +1,10 @@ -import {MigrationInterface, QueryRunner} from "typeorm"; +import { MigrationInterface, QueryRunner } from 'typeorm'; export class CreateUserAnonymous1564060597067 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { await queryRunner.query("INSERT INTO `user` (`user_id`, `external_id`, `sams_id`, `name`) VALUES (1,1,1,'Anonymous')"); } public async down(queryRunner: QueryRunner): Promise { } - } diff --git a/src/modules/infolog.module.ts b/src/modules/infolog.module.ts index 2db45ea..c2a121b 100644 --- a/src/modules/infolog.module.ts +++ b/src/modules/infolog.module.ts @@ -31,16 +31,16 @@ if (USE_INFO_LOGGER === 'true') { password: 'root', database: 'INFOLOGGER', synchronize: true, - logging: true - }) + logging: true, + }), ]; } @Global() @Module({ - imports: [ - ...imports - ], + imports: [ + ...imports, + ], providers: [InfoLogService, TimeUtility], exports: [InfoLogService], }) diff --git a/src/modules/run.module.ts b/src/modules/run.module.ts index 25fed69..73c8f42 100644 --- a/src/modules/run.module.ts +++ b/src/modules/run.module.ts @@ -14,9 +14,9 @@ import { Run } from '../entities/run.entity'; @Global() @Module({ - imports: [TypeOrmModule.forFeature([Run])], - providers: [RunService], - controllers: [RunController], - exports: [RunService], + imports: [TypeOrmModule.forFeature([Run])], + providers: [RunService], + controllers: [RunController], + exports: [RunService], }) export class RunModule { } diff --git a/src/modules/setting.module.ts b/src/modules/setting.module.ts index e8173e3..186c740 100644 --- a/src/modules/setting.module.ts +++ b/src/modules/setting.module.ts @@ -11,8 +11,8 @@ import { SettingService } from '../services/setting.service'; import { SettingController } from '../controllers/setting.controller'; @Module({ - providers: [SettingService], - controllers: [SettingController], - exports: [SettingService], + providers: [SettingService], + controllers: [SettingController], + exports: [SettingService], }) export class SettingModule { } diff --git a/src/modules/subsystem.module.ts b/src/modules/subsystem.module.ts index e21951c..c58143e 100644 --- a/src/modules/subsystem.module.ts +++ b/src/modules/subsystem.module.ts @@ -13,9 +13,9 @@ import { SubSystemService } from '../services/subsystem.service'; import { SubSystemController } from '../controllers/subsystem.controller'; @Module({ - imports: [TypeOrmModule.forFeature([SubSystem])], - providers: [SubSystemService], - controllers: [SubSystemController], - exports: [SubSystemService], + imports: [TypeOrmModule.forFeature([SubSystem])], + providers: [SubSystemService], + controllers: [SubSystemController], + exports: [SubSystemService], }) export class SubSystemModule { } diff --git a/src/modules/subsystem_permission.module.ts b/src/modules/subsystem_permission.module.ts index 3e50c22..18a9ff6 100644 --- a/src/modules/subsystem_permission.module.ts +++ b/src/modules/subsystem_permission.module.ts @@ -12,8 +12,8 @@ import { SubSystemPermission } from '../entities/sub_system_permission.entity'; import { SubSystemPermissionService } from '../services/subsystem_permission.service'; @Module({ - imports: [TypeOrmModule.forFeature([SubSystemPermission])], - providers: [SubSystemPermissionService], - exports: [SubSystemPermissionService], + imports: [TypeOrmModule.forFeature([SubSystemPermission])], + providers: [SubSystemPermissionService], + exports: [SubSystemPermissionService], }) export class SubSystemPermissionModule { } diff --git a/src/services/attachment.service.ts b/src/services/attachment.service.ts index d36c3e7..643adea 100644 --- a/src/services/attachment.service.ts +++ b/src/services/attachment.service.ts @@ -16,13 +16,12 @@ import { Log } from '../entities/log.entity'; @Injectable() export class AttachmentService { - private readonly repository: Repository; private readonly logRepository: Repository; constructor( - @InjectRepository(Attachment) repository: Repository, - @InjectRepository(Log) logRepository: Repository + @InjectRepository(Attachment) repository: Repository, + @InjectRepository(Log) logRepository: Repository, ) { this.repository = repository; this.logRepository = logRepository; @@ -38,9 +37,7 @@ export class AttachmentService { if (logId) { const log = await this.logRepository.findOne(logId); if (!log) { - throw new HttpException( - `Log for logId ${logId} doesn't exist.`, HttpStatus.NOT_FOUND - ); + throw new HttpException(`Log for logId ${logId} doesn't exist.`, HttpStatus.NOT_FOUND); } AttachmentEntity.log = log; } diff --git a/src/services/bcrypt.service.ts b/src/services/bcrypt.service.ts index e489e43..83e1de7 100644 --- a/src/services/bcrypt.service.ts +++ b/src/services/bcrypt.service.ts @@ -11,9 +11,11 @@ import { Injectable } from '@nestjs/common'; @Injectable() export class BCryptService { - // let end user decide whether he wants to modify the number of saltRounds. - // private saltRounds: number = process.env.NUMBER_SALT_ROUNDS; - private saltRounds: number = 10; + /* + * let end user decide whether he wants to modify the number of saltRounds. + * private saltRounds: number = process.env.NUMBER_SALT_ROUNDS; + */ + private readonly saltRounds = 10; /** * Hash token with bcrypt diff --git a/src/services/cern.auth.service.ts b/src/services/cern.auth.service.ts index 75006ca..3828916 100644 --- a/src/services/cern.auth.service.ts +++ b/src/services/cern.auth.service.ts @@ -22,11 +22,10 @@ import { CLIENT_ID, CLIENT_SECRET, CERN_REGISTERED_URI } from '../constants'; */ @Injectable() export class CernAuthService extends AuthService { - - private cernRegisteredURI: string; + private readonly cernRegisteredURI: string; constructor( - @Inject(UserService) userService: UserService, + @Inject(UserService) userService: UserService, @Inject(SubSystemPermissionService) subSystemPermissionService: SubSystemPermissionService, @Inject(BCryptService) bcryptService: BCryptService, @Inject(JwtService) jwtService: JwtService, @@ -36,10 +35,12 @@ export class CernAuthService extends AuthService { this.oAuth2Config.client.id = CLIENT_ID; this.oAuth2Config.client.secret = CLIENT_SECRET; - // if (CERN_REGISTERED_URI === undefined - // || CERN_REGISTERED_URI === '') { - // throw new InvalidSettingException('CERN_REGISTERED_URI must be filled in'); - // } + /* + * if (CERN_REGISTERED_URI === undefined + * || CERN_REGISTERED_URI === '') { + * throw new InvalidSettingException('CERN_REGISTERED_URI must be filled in'); + * } + */ this.cernRegisteredURI = CERN_REGISTERED_URI; @@ -57,13 +58,12 @@ export class CernAuthService extends AuthService { */ protected async getToken(code: string): Promise { try { - // This line will return a 400 Bad Request error (Invalid grant) const authorizationGrant = await this.oAuth2Client.authorizationCode.getToken({ code, - redirect_uri: this.cernRegisteredURI - } as any); + redirect_uri: this.cernRegisteredURI, + } as any); const accessTokenObject = await this.oAuth2Client.accessToken.create(authorizationGrant); if (!accessTokenObject.token.access_token) { @@ -86,8 +86,8 @@ export class CernAuthService extends AuthService { url: 'https://oauthresource.web.cern.ch/api/User', headers: { 'User-Agent': 'Jiskefet', - 'Authorization': `bearer ${accessToken}` - } + Authorization: `bearer ${accessToken}`, + }, }; } } diff --git a/src/services/createpdf.service.ts b/src/services/createpdf.service.ts index 01197d5..58b89da 100644 --- a/src/services/createpdf.service.ts +++ b/src/services/createpdf.service.ts @@ -9,35 +9,34 @@ import { Run } from 'entities/run.entity'; @Injectable() export class CreatePdfService { - /** - * This function creates and sends - * PDF document to client - * @param params this is parameters that - * puts in .ejs template - * instead of vars - * @param fileName it is the name of file - * when it will be downloaded - * @param pathToEjs this is path to the .ejs - * template - * @param res this is Response object, that used - * for sending PDF to client - */ - async createPdf(params: {}, fileName: string, pathToEjs: string, @Res() res: Response): Promise { - const html = await ejs.renderFile(join(__dirname, '..', pathToEjs), params); // rendering html string with params - const options = { format : 'A4', orientation : 'portrait'}; // setting options for PDF - // creating PDF - pdfMake.create(html, options) - .toBuffer(function returnPDF(err: NodeJS.ErrnoException, buffer: Buffer): void { - if (err) { - console.log(err); - return res.end(err); - } - res.writeHead(200, { - 'Content-type': 'application/pdf', - 'Content-Disposition': 'attachment;filename="{name}.pdf"'.replace('{name}', fileName) - }); - return res.end(buffer); // sendind ready PDF to client - }); - } - + /** + * This function creates and sends + * PDF document to client + * @param params this is parameters that + * puts in .ejs template + * instead of vars + * @param fileName it is the name of file + * when it will be downloaded + * @param pathToEjs this is path to the .ejs + * template + * @param res this is Response object, that used + * for sending PDF to client + */ + async createPdf(params: {}, fileName: string, pathToEjs: string, @Res() res: Response): Promise { + const html = await ejs.renderFile(join(__dirname, '..', pathToEjs), params); // rendering html string with params + const options = { format: 'A4', orientation: 'portrait' }; // setting options for PDF + // creating PDF + pdfMake.create(html, options) + .toBuffer(function returnPDF(err: NodeJS.ErrnoException, buffer: Buffer): void { + if (err) { + console.log(err); + return res.end(err); + } + res.writeHead(200, { + 'Content-type': 'application/pdf', + 'Content-Disposition': 'attachment;filename="{name}.pdf"'.replace('{name}', fileName), + }); + return res.end(buffer); // sendind ready PDF to client + }); + } } diff --git a/src/services/flp.service.ts b/src/services/flp.service.ts index cf24ef4..463119b 100644 --- a/src/services/flp.service.ts +++ b/src/services/flp.service.ts @@ -21,8 +21,8 @@ export class FlpSerivce { private readonly runRepository: Repository; constructor( - @InjectRepository(FlpRole) flpRepository: Repository, - @InjectRepository(Run) runRepository: Repository + @InjectRepository(FlpRole) flpRepository: Repository, + @InjectRepository(Run) runRepository: Repository, ) { this.flpRepository = flpRepository; this.runRepository = runRepository; @@ -58,7 +58,8 @@ export class FlpSerivce { if (flp) { throw new HttpException( `FLP with run number ${createFlpDto.run} and ${createFlpDto.flpName} already exist.`, - HttpStatus.CONFLICT); + HttpStatus.CONFLICT, + ); } flpEntity.run = await this.runRepository.findOne(createFlpDto.run); diff --git a/src/services/github.auth.service.ts b/src/services/github.auth.service.ts index c549e57..f84cf6b 100644 --- a/src/services/github.auth.service.ts +++ b/src/services/github.auth.service.ts @@ -21,9 +21,8 @@ import { CLIENT_ID, CLIENT_SECRET } from '../constants'; */ @Injectable() export class GithubAuthService extends AuthService { - constructor( - @Inject(UserService) userService: UserService, + @Inject(UserService) userService: UserService, @Inject(SubSystemPermissionService) subSystemPermissionService: SubSystemPermissionService, @Inject(BCryptService) bcryptService: BCryptService, @Inject(JwtService) jwtService: JwtService, @@ -65,8 +64,8 @@ export class GithubAuthService extends AuthService { url: 'https://api.github.com/user', headers: { 'User-Agent': 'request', - 'Authorization': `token ${accessToken}` - } + Authorization: `token ${accessToken}`, + }, }; } } diff --git a/src/services/infolog.service.ts b/src/services/infolog.service.ts index 6fadff2..743b6db 100644 --- a/src/services/infolog.service.ts +++ b/src/services/infolog.service.ts @@ -20,13 +20,12 @@ import { USE_INFO_LOGGER } from '../constants'; @Injectable() export class InfoLogService extends Logger { - private readonly infoLogRepository: Repository; private readonly INFO_LOG_DIR_PATH: string = 'infolog-data'; constructor( - @InjectRepository(InfoLog) infoLogRepository: Repository, - private readonly timeUtility: TimeUtility + @InjectRepository(InfoLog) infoLogRepository: Repository, + private readonly timeUtility: TimeUtility, ) { super(); this.ensureInfoLogDirExists(); @@ -87,7 +86,6 @@ export class InfoLogService extends Logger { if (USE_INFO_LOGGER === 'true') { this.infoLogRepository.save(infoLogs).then(() => { const infoLog = new CreateInfologDto(); - // tslint:disable-next-line:no-trailing-whitespace infoLog.message = `Successfully saved InfoLogs that could not be persisted to the database in the past due to a possible database outage.`; this.logInfoLog(infoLog); @@ -112,7 +110,8 @@ export class InfoLogService extends Logger { if (err) { return console.log(err); } - }); + }, + ); }); } } diff --git a/src/services/log.service.ts b/src/services/log.service.ts index a9736c6..ed8e4e3 100644 --- a/src/services/log.service.ts +++ b/src/services/log.service.ts @@ -29,8 +29,8 @@ export class LogService { private readonly threadUtility: ThreadUtility; constructor( - @InjectRepository(Log) logRepository: Repository, - @InjectRepository(Run) runRepository: Repository + @InjectRepository(Log) logRepository: Repository, + @InjectRepository(Run) runRepository: Repository, ) { this.logRepository = logRepository; this.runRepository = runRepository; @@ -62,7 +62,7 @@ export class LogService { * @param queryLogDto queryfilters. */ async find(queryLogDto?: QueryLogDto): - Promise<{ logs: Log[] | ThreadDto, additionalInformation: AdditionalOptions }> { + Promise<{ logs: Log[] | ThreadDto; additionalInformation: AdditionalOptions }> { // check to return thread or any logs if (queryLogDto.threadId) { return await this.findThread(queryLogDto.threadId); @@ -97,8 +97,7 @@ export class LogService { } const run = await this.runRepository.findOne(linkRunToLogDto.runNumber); if (!run) { - throw new HttpException( - `Run with run number ${linkRunToLogDto.runNumber} does not exist.`, HttpStatus.NOT_FOUND); + throw new HttpException(`Run with run number ${linkRunToLogDto.runNumber} does not exist.`, HttpStatus.NOT_FOUND); } log.runs = [...log.runs, run]; await this.logRepository.save(log); @@ -110,8 +109,8 @@ export class LogService { */ async findLogsByUserId( userId: number, - queryLogDto: QueryLogDto - ): Promise<{ logs: Log[], additionalInformation: AdditionalOptions }> { + queryLogDto: QueryLogDto, + ): Promise<{ logs: Log[]; additionalInformation: AdditionalOptions }> { let query = await this.logRepository .createQueryBuilder('log') .innerJoinAndSelect('log.user', 'user') @@ -120,7 +119,7 @@ export class LogService { if (queryLogDto.orderBy) { query = query.orderBy( `log.${queryLogDto.orderBy}`, - queryLogDto.orderDirection || OrderDirection.asc + queryLogDto.orderDirection || OrderDirection.asc, ); } const result = await query @@ -132,8 +131,8 @@ export class LogService { additionalInformation: { count: result[1], pageNumber: queryLogDto.pageNumber, - pageSize: queryLogDto.pageSize - } + pageSize: queryLogDto.pageSize, + }, }; } @@ -144,18 +143,21 @@ export class LogService { * @param Id this is ID of log */ async getLogInfoParams(Id: number): Promise { - const result = await this.findLogById(Id); if (!result) { - throw new HttpException( - `Log with log id ${Id} does not exists.`, HttpStatus.NOT_FOUND - ); + throw new HttpException(`Log with log id ${Id} does not exists.`, HttpStatus.NOT_FOUND); } const params = { - user: result.user.userId, external: result.user.externalUserId, sams: result.user.samsId, - logId: result.logId, subsytemID: result.subsystemFkSubsystemId, subtype: result.subtype, - origin: result.origin, creationTime: result.creationTime, - title: result.title, text: result.body + user: result.user.userId, + external: result.user.externalUserId, + sams: result.user.samsId, + logId: result.logId, + subsytemID: result.subsystemFkSubsystemId, + subtype: result.subtype, + origin: result.origin, + creationTime: result.creationTime, + title: result.title, + text: result.body, }; return params; } @@ -176,9 +178,7 @@ export class LogService { if (runId) { const run = await this.runRepository.findOne(runId); if (!run) { - throw new HttpException( - `Run with run number ${runId} does not exist.`, HttpStatus.NOT_FOUND - ); + throw new HttpException(`Run with run number ${runId} does not exist.`, HttpStatus.NOT_FOUND); } await log.runs.push(run); } @@ -217,41 +217,41 @@ export class LogService { * @param queryLogDto queryfilters. */ private async findAllLogs(queryLogDto: QueryLogDto): - Promise<{ logs: Log[], additionalInformation: AdditionalOptions }> { + Promise<{ logs: Log[]; additionalInformation: AdditionalOptions }> { let query = await this.logRepository.createQueryBuilder('log') .innerJoinAndSelect('log.user', 'user') .where('title like :title', { - title: queryLogDto.searchterm ? `%${queryLogDto.searchterm}%` : '%' + title: queryLogDto.searchterm ? `%${queryLogDto.searchterm}%` : '%', }) .andWhere('subtype like :subtype', { - subtype: queryLogDto.subtype ? queryLogDto.subtype : '%' + subtype: queryLogDto.subtype ? queryLogDto.subtype : '%', }) .andWhere('origin like :origin', { - origin: queryLogDto.origin ? queryLogDto.origin : '%' + origin: queryLogDto.origin ? queryLogDto.origin : '%', }); if (queryLogDto.startCreationTime) { await query.andWhere('creation_time >= :startCreationTime', { - startCreationTime: queryLogDto.startCreationTime + startCreationTime: queryLogDto.startCreationTime, }); } if (queryLogDto.endCreationTime) { await query.andWhere('creation_time <= :endCreationTime', { - endCreationTime: queryLogDto.endCreationTime + endCreationTime: queryLogDto.endCreationTime, }); } if (queryLogDto.logId) { await query.andWhere('log_id = :id', { - id: queryLogDto.logId + id: queryLogDto.logId, }); } if (queryLogDto.orderBy) { query = query.orderBy( `log.${queryLogDto.orderBy}`, - queryLogDto.orderDirection || OrderDirection.asc + queryLogDto.orderDirection || OrderDirection.asc, ); } const result = await query @@ -263,8 +263,8 @@ export class LogService { additionalInformation: { count: result[1], pageNumber: queryLogDto.pageNumber, - pageSize: queryLogDto.pageSize - } + pageSize: queryLogDto.pageSize, + }, }; } @@ -272,7 +272,7 @@ export class LogService { * Find a thread that contains the log with given @param logId. */ private async findThread(logId: number): - Promise<{ logs: ThreadDto, additionalInformation: AdditionalOptions }> { + Promise<{ logs: ThreadDto; additionalInformation: AdditionalOptions }> { // Fetch the Log by given logId const log = await this.logRepository.findOne(logId); @@ -289,8 +289,8 @@ export class LogService { const comments = await this.logRepository.find({ where: [{ commentFkRootLogId: root.logId, - logId: Not(root.logId) - }] + logId: Not(root.logId), + }], }); const amountOfComments = comments.length; @@ -300,9 +300,8 @@ export class LogService { return { logs: threadStructured, additionalInformation: { - count: amountOfComments + 1 - } + count: amountOfComments + 1, + }, }; } - } diff --git a/src/services/overview.service.ts b/src/services/overview.service.ts index b160c2a..55479b8 100644 --- a/src/services/overview.service.ts +++ b/src/services/overview.service.ts @@ -19,7 +19,7 @@ export class OverviewService { private readonly subSystemRepository: Repository; constructor( - @InjectRepository(SubSystem) subSystemRepository: Repository + @InjectRepository(SubSystem) subSystemRepository: Repository, ) { this.subSystemRepository = subSystemRepository; } @@ -40,9 +40,9 @@ export class OverviewService { LEFT JOIN user u ON u.user_id = ll.fk_user_id WHERE ll.creation_time > (NOW() - INTERVAL ${query.timeRange ? query.timeRange : '24'} HOUR) - GROUP BY ss.subsystem_id;` + GROUP BY ss.subsystem_id;`, ); - const overview = new Array() as GetOverviewDto[]; + const overview = [] as GetOverviewDto[]; for (const rowDataPacket of result) { const subsystem = {} as GetOverviewDto; subsystem.subsystemName = rowDataPacket.subsystem_name; @@ -54,5 +54,4 @@ export class OverviewService { } return overview; } - } diff --git a/src/services/run.service.ts b/src/services/run.service.ts index 5e7da9b..617d754 100644 --- a/src/services/run.service.ts +++ b/src/services/run.service.ts @@ -24,15 +24,14 @@ import { FlpRole } from '../entities/flp_role.entity'; @Injectable() export class RunService { - private readonly runRepository: Repository; private readonly logRepository: Repository; private readonly flpRepository: Repository; constructor( - @InjectRepository(Run) runRepository: Repository, + @InjectRepository(Run) runRepository: Repository, @InjectRepository(Log) logRepostiory: Repository, - @InjectRepository(FlpRole) flpRepository: Repository + @InjectRepository(FlpRole) flpRepository: Repository, ) { this.runRepository = runRepository; this.logRepository = logRepostiory; @@ -49,7 +48,8 @@ export class RunService { if (run) { throw new HttpException( `The request could not be completed due to a conflict with the run number: ${RunEntity.runNumber}`, - HttpStatus.CONFLICT); + HttpStatus.CONFLICT, + ); } return await this.runRepository.save(RunEntity); } @@ -58,70 +58,70 @@ export class RunService { * Returns runs from the db, filtered by the optional query. * @param query QueryRunDto */ - async findAll(queryRunDto?: QueryRunDto): Promise<{ runs: Run[], additionalInformation: AdditionalOptions }> { + async findAll(queryRunDto?: QueryRunDto): Promise<{ runs: Run[]; additionalInformation: AdditionalOptions }> { let query = await this.runRepository.createQueryBuilder(); if (queryRunDto.runType) { await query.andWhere('run_type like :runType', { - runType: queryRunDto.runType ? queryRunDto.runType : '%' + runType: queryRunDto.runType ? queryRunDto.runType : '%', }); } if (queryRunDto.runQuality) { await query.andWhere('run_quality like :runQuality', { - runQuality: queryRunDto.runQuality ? queryRunDto.runQuality : '%' + runQuality: queryRunDto.runQuality ? queryRunDto.runQuality : '%', }); } // o2 start if (queryRunDto.startTimeO2Start) { await query.andWhere('time_o2_start >= :startTimeO2Start', { - startTimeO2Start: queryRunDto.startTimeO2Start + startTimeO2Start: queryRunDto.startTimeO2Start, }); } if (queryRunDto.endTimeO2Start) { await query.andWhere('time_o2_start <= :endTimeO2Start', { - endTimeO2Start: queryRunDto.endTimeO2Start + endTimeO2Start: queryRunDto.endTimeO2Start, }); } // trg start if (queryRunDto.startTimeTrgStart) { await query.andWhere('time_trg_start >= :startTimeTrgStart', { - startTimeTrgStart: queryRunDto.startTimeTrgStart + startTimeTrgStart: queryRunDto.startTimeTrgStart, }); } if (queryRunDto.endTimeTrgStart) { await query.andWhere('time_o2_start <= :endTimeTrgStart', { - endTimeTrgStart: queryRunDto.endTimeTrgStart + endTimeTrgStart: queryRunDto.endTimeTrgStart, }); } // trg end if (queryRunDto.startTimeTrgEnd) { await query.andWhere('time_trg_end >= :startTimeTrgEnd', { - startTimeTrgEnd: queryRunDto.startTimeTrgEnd + startTimeTrgEnd: queryRunDto.startTimeTrgEnd, }); } if (queryRunDto.endTimeTrgEnd) { await query.andWhere('time_trg_end <= :endTimeTrgEnd', { - endTimeTrgEnd: queryRunDto.endTimeTrgEnd + endTimeTrgEnd: queryRunDto.endTimeTrgEnd, }); } // o2 end if (queryRunDto.startTimeO2End) { await query.andWhere('time_o2_end >= :startTimeO2End', { - startTimeO2End: queryRunDto.startTimeO2End + startTimeO2End: queryRunDto.startTimeO2End, }); } if (queryRunDto.endTimeO2End) { await query.andWhere('time_o2_end <= :endTimeO2End', { - endTimeO2End: queryRunDto.endTimeO2End + endTimeO2End: queryRunDto.endTimeO2End, }); } @@ -136,7 +136,7 @@ export class RunService { if (queryRunDto.orderBy) { query = query.orderBy( _.snakeCase(queryRunDto.orderBy).replace('o_2', 'o2'), - queryRunDto.orderDirection || OrderDirection.asc + queryRunDto.orderDirection || OrderDirection.asc, ); } @@ -149,8 +149,8 @@ export class RunService { additionalInformation: { count: result[1], pageNumber: queryRunDto.pageNumber, - pageSize: queryRunDto.pageSize - } + pageSize: queryRunDto.pageSize, + }, }; } @@ -175,13 +175,11 @@ export class RunService { async linkLogToRun(runNumber: number, linkLogToRunDto: LinkLogToRunDto): Promise { const run = await this.findById(runNumber); if (!run) { - throw new HttpException( - `Run with with number ${runNumber} does not exist.`, HttpStatus.NOT_FOUND); + throw new HttpException(`Run with with number ${runNumber} does not exist.`, HttpStatus.NOT_FOUND); } const log = await this.logRepository.findOne(linkLogToRunDto.logId); if (!log) { - throw new HttpException( - `Log with log number ${linkLogToRunDto.logId} does not exist.`, HttpStatus.NOT_FOUND); + throw new HttpException(`Log with log number ${linkLogToRunDto.logId} does not exist.`, HttpStatus.NOT_FOUND); } run.logs = [...run.logs, log]; await this.runRepository.save(run); @@ -195,8 +193,7 @@ export class RunService { async updateRun(runNumber: number, patchRunDto: PatchRunDto): Promise { const runToUpdate: Run = await this.findById(runNumber); if (!runToUpdate) { - throw new HttpException( - `Run with with number ${runNumber} does not exist.`, HttpStatus.NOT_FOUND); + throw new HttpException(`Run with with number ${runNumber} does not exist.`, HttpStatus.NOT_FOUND); } let accSubtimeframes = 0; let accBytesReadOut = 0; @@ -220,6 +217,7 @@ export class RunService { return await this.runRepository.save(runToUpdate); } + /** * This function gets params for * RunConf template @@ -228,33 +226,42 @@ export class RunService { * @param Id2 this is ID of the second run */ async getRunConfParams(Id1: number, Id2: number): Promise { - const curDate = new Date(); const firstResult = await this.findById(Id1); const secondResult = await this.findById(Id2); if (!firstResult) { - throw new HttpException( - `Run with run number ${Id1} does not exists.`, HttpStatus.NOT_FOUND - ); + throw new HttpException(`Run with run number ${Id1} does not exists.`, HttpStatus.NOT_FOUND); } else if (!secondResult) { - throw new HttpException( - `Run with run number ${Id2} does not exists.`, HttpStatus.NOT_FOUND - ); + throw new HttpException(`Run with run number ${Id2} does not exists.`, HttpStatus.NOT_FOUND); } const params = { - Run1: firstResult.runNumber, O21: firstResult.O2StartTime, - TargetStart1: firstResult.TrgStartTime, TargetEnd1: firstResult.TrgEndTime, o2End1: firstResult.O2EndTime, - runType1: firstResult.runType, RunQuality1: firstResult.runQuality, NumbDetectors1: firstResult.nDetectors, - numberFlips1: firstResult.nFlps, timeFrame1: firstResult.nTimeframes, - SubTimeFrame1: firstResult.nSubtimeframes, Readout1: firstResult.bytesReadOut, - Bytestimeframe1: firstResult.bytesTimeframeBuilder, Run2: secondResult.runNumber, - O22: secondResult.O2StartTime, TargetStart2: secondResult.TrgStartTime, - TargetEnd2: secondResult.TrgEndTime, o2End2: secondResult.O2EndTime, runType2: secondResult.runType, - RunQuality2: secondResult.runQuality, NumbDetectors2: secondResult.nDetectors, - numberFlips2: secondResult.nFlps, timeFrame2: secondResult.nTimeframes, - SubTimeFrame2: secondResult.nSubtimeframes, Readout2: secondResult.bytesReadOut, + Run1: firstResult.runNumber, + O21: firstResult.O2StartTime, + TargetStart1: firstResult.TrgStartTime, + TargetEnd1: firstResult.TrgEndTime, + o2End1: firstResult.O2EndTime, + runType1: firstResult.runType, + RunQuality1: firstResult.runQuality, + NumbDetectors1: firstResult.nDetectors, + numberFlips1: firstResult.nFlps, + timeFrame1: firstResult.nTimeframes, + SubTimeFrame1: firstResult.nSubtimeframes, + Readout1: firstResult.bytesReadOut, + Bytestimeframe1: firstResult.bytesTimeframeBuilder, + Run2: secondResult.runNumber, + O22: secondResult.O2StartTime, + TargetStart2: secondResult.TrgStartTime, + TargetEnd2: secondResult.TrgEndTime, + o2End2: secondResult.O2EndTime, + runType2: secondResult.runType, + RunQuality2: secondResult.runQuality, + NumbDetectors2: secondResult.nDetectors, + numberFlips2: secondResult.nFlps, + timeFrame2: secondResult.nTimeframes, + SubTimeFrame2: secondResult.nSubtimeframes, + Readout2: secondResult.bytesReadOut, Bytestimeframe2: secondResult.bytesTimeframeBuilder, - Data: curDate.toLocaleString('en-GB') + Data: curDate.toLocaleString('en-GB'), }; return params; } diff --git a/src/services/setting.service.ts b/src/services/setting.service.ts index f855b2f..1dc3510 100644 --- a/src/services/setting.service.ts +++ b/src/services/setting.service.ts @@ -12,25 +12,24 @@ import { USE_CERN_SSO, CLIENT_ID, AUTH_REDIRECT_URI, FILE_UPLOAD_LIMIT } from '. @Injectable() export class SettingService { - async getSettings(): Promise { if (USE_CERN_SSO === 'true') { return { - ['API_VERSION']: (global as any).apiVersion, - ['FILE_UPLOAD_LIMIT']: FILE_UPLOAD_LIMIT.toString(), - ['USE_CERN_SSO']: USE_CERN_SSO, - ['AUTH_URL']: - `https://oauth.web.cern.ch/OAuth/Authorize?response_type=code` - + `&client_id=${CLIENT_ID}&redirect_uri=${AUTH_REDIRECT_URI}`, + API_VERSION: (global as any).apiVersion, + FILE_UPLOAD_LIMIT: FILE_UPLOAD_LIMIT.toString(), + USE_CERN_SSO: USE_CERN_SSO, + AUTH_URL: + 'https://oauth.web.cern.ch/OAuth/Authorize?response_type=code' + + `&client_id=${CLIENT_ID}&redirect_uri=${AUTH_REDIRECT_URI}`, }; } return { - ['API_VERSION']: (global as any).apiVersion, - ['FILE_UPLOAD_LIMIT']: FILE_UPLOAD_LIMIT.toString(), - ['USE_CERN_SSO']: USE_CERN_SSO, - ['AUTH_URL']: - `https://github.com/login/oauth/authorize?response_type=code&client_id=${CLIENT_ID}&` - + `redirect_uri=${AUTH_REDIRECT_URI}` + API_VERSION: (global as any).apiVersion, + FILE_UPLOAD_LIMIT: FILE_UPLOAD_LIMIT.toString(), + USE_CERN_SSO: USE_CERN_SSO, + AUTH_URL: + `https://github.com/login/oauth/authorize?response_type=code&client_id=${CLIENT_ID}&` + + `redirect_uri=${AUTH_REDIRECT_URI}`, }; } } diff --git a/src/services/subsystem.service.ts b/src/services/subsystem.service.ts index ca3341a..a4ed7bb 100644 --- a/src/services/subsystem.service.ts +++ b/src/services/subsystem.service.ts @@ -13,7 +13,6 @@ import { SubSystem } from '../entities/sub_system.entity'; @Injectable() export class SubSystemService { - private readonly repository: Repository; constructor(@InjectRepository(SubSystem) repository: Repository) { diff --git a/src/services/subsystem_permission.service.ts b/src/services/subsystem_permission.service.ts index 08a0372..911c28b 100644 --- a/src/services/subsystem_permission.service.ts +++ b/src/services/subsystem_permission.service.ts @@ -15,11 +15,10 @@ import { CreateSubSystemPermissionDto } from '../dtos/create.subsystemPermission @Injectable() export class SubSystemPermissionService { - private readonly repository: Repository; constructor( - @InjectRepository(SubSystemPermission) repository: Repository, + @InjectRepository(SubSystemPermission) repository: Repository, ) { this.repository = repository; } @@ -48,9 +47,9 @@ export class SubSystemPermissionService { async findTokensByExternalUserId(userId: number): Promise { const result = await this.repository.query( `SELECT sub_system_permission_id, sub_system_token_description - FROM sub_system_permission WHERE fk_user_id = ${userId};` + FROM sub_system_permission WHERE fk_user_id = ${userId};`, ); - const overview = new Array() as SubSystemPermission[]; + const overview = [] as SubSystemPermission[]; for (const r of result) { const subSystemPermission = {} as SubSystemPermission; subSystemPermission.subSystemPermissionId = r.sub_system_permission_id; @@ -75,7 +74,8 @@ export class SubSystemPermissionService { * @param subSystemPermissionDto */ async saveTokenForSubSystemPermission( - subSystemPermissionDto: CreateSubSystemPermissionDto): Promise { + subSystemPermissionDto: CreateSubSystemPermissionDto, + ): Promise { const newSubSystemPermission: SubSystemPermission = plainToClass(SubSystemPermission, subSystemPermissionDto); return this.repository.save(newSubSystemPermission); } diff --git a/src/services/tag.service.ts b/src/services/tag.service.ts index 03cb272..5308209 100644 --- a/src/services/tag.service.ts +++ b/src/services/tag.service.ts @@ -21,7 +21,7 @@ export class TagService { private readonly tagRepository: Repository; constructor( - @InjectRepository(Tag) tagRepository: Repository + @InjectRepository(Tag) tagRepository: Repository, ) { this.tagRepository = tagRepository; } @@ -43,7 +43,7 @@ export class TagService { const query = await this.tagRepository.createQueryBuilder('tag') .select('tag', 'tag') .where('tag_text like :tagText', { - tagText: queryTagDto.tagText ? queryTagDto.tagText : '%' + tagText: queryTagDto.tagText ? queryTagDto.tagText : '%', }) .getMany(); return query; diff --git a/src/services/user.service.ts b/src/services/user.service.ts index cc0b7b9..6a23d89 100644 --- a/src/services/user.service.ts +++ b/src/services/user.service.ts @@ -15,7 +15,6 @@ import { Injectable } from '@nestjs/common'; @Injectable() export class UserService { - private readonly repository: Repository; constructor(@InjectRepository(User) repository: Repository) { diff --git a/src/strategies/jwt.strategy.ts b/src/strategies/jwt.strategy.ts index 98a3fe1..f1d032c 100644 --- a/src/strategies/jwt.strategy.ts +++ b/src/strategies/jwt.strategy.ts @@ -18,7 +18,6 @@ import { JWT_SECRET_KEY } from '../constants'; */ @Injectable() export class JwtStrategy extends PassportStrategy(Strategy) { - constructor(private readonly authService: AuthService) { super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), diff --git a/src/utility/env.utility.ts b/src/utility/env.utility.ts index 146ea93..9d05c29 100644 --- a/src/utility/env.utility.ts +++ b/src/utility/env.utility.ts @@ -40,7 +40,7 @@ export class EnvironmentUtility { } if (values) { - for (let i: number = 0; i < keys.length; i++) { + for (let i = 0; i < keys.length; i++) { // Retrieve the starting keyword in order to determine which case to use const startingKey: string = values[i].substr(0, values[i].indexOf(':')); @@ -67,7 +67,7 @@ export class EnvironmentUtility { case 'matches': let possibleValues: string[]; possibleValues = values[i].replace('matches:', '').replace(/\s/g, '').split(','); - if (possibleValues.indexOf(constants[keys[i]]) === -1) { + if (!possibleValues.includes(constants[keys[i]])) { errorMsg.push(`${[keys[i]]} does not match the possible string(s): ${possibleValues}.`); } break; @@ -97,10 +97,12 @@ export class EnvironmentUtility { if (errorMsg.length) { if (errorMsg.length === 1) { throw new EnvValueDoesNotMatchException( - 'Environment value does not match expected value: \n' + errorMsg[0]); + 'Environment value does not match expected value: \n' + errorMsg[0], + ); } throw new EnvValueDoesNotMatchException( - 'Environment value does not match expected value: \n' + errorMsg.join('\n')); + 'Environment value does not match expected value: \n' + errorMsg.join('\n'), + ); } } } diff --git a/src/utility/thread.utility.ts b/src/utility/thread.utility.ts index 956eb6b..f7ab306 100644 --- a/src/utility/thread.utility.ts +++ b/src/utility/thread.utility.ts @@ -38,7 +38,6 @@ export class ThreadUtility { * @param thread return a threadDto */ private addComments(comments: Log[], parentId: number, thread: ThreadDto): any { - // tslint:disable-next-line:prefer-for-of for (let a = 0; a < comments.length; a++) { if (comments[a].commentFkParentLogId === parentId) { const subComment = comments[a].toThreadDto(); diff --git a/test/controllers/log.controller.e2e-spec.ts b/test/controllers/log.controller.e2e-spec.ts index acf4201..dbd7ef6 100644 --- a/test/controllers/log.controller.e2e-spec.ts +++ b/test/controllers/log.controller.e2e-spec.ts @@ -18,9 +18,9 @@ describe('LogController', () => { let app: INestApplication; let jwt: string; - beforeAll(async () => { + beforeAll(async() => { const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule] + imports: [AppModule], }).compile(); app = await moduleFixture.createNestApplication(); @@ -29,7 +29,7 @@ describe('LogController', () => { jwt = await getJwt(app); }); - afterAll(async () => { + afterAll(async() => { await app.close(); }); @@ -40,21 +40,21 @@ describe('LogController', () => { title: 'test log', body: 'text of test log', run: 1, - user: 1 + user: 1, }; it('should return status 201 and JSON Content-Type', () => { return request(app.getHttpServer()) - .post(`/logs`) + .post('/logs') .set('Authorization', `Bearer ${jwt}`) .send(logToPost) .expect(201) .expect('Content-Type', /json/); }); - it('should return an object containing "test log" as a title', async () => { + it('should return an object containing "test log" as a title', async() => { const response = await request(app.getHttpServer()) - .post(`/logs`) + .post('/logs') .set('Authorization', `Bearer ${jwt}`) .send(logToPost) .set('Accept', 'application/json'); @@ -65,7 +65,7 @@ describe('LogController', () => { // non existing run logToPost.run = -1; return request(app.getHttpServer()) - .post(`/logs`) + .post('/logs') .set('Authorization', `Bearer ${jwt}`) .send(logToPost) .expect(404) @@ -75,7 +75,7 @@ describe('LogController', () => { it('should return status 400 and JSON Content-Type', () => { logToPost = null; return request(app.getHttpServer()) - .post(`/logs`) + .post('/logs') .set('Authorization', `Bearer ${jwt}`) .send(logToPost) .expect(400) @@ -92,7 +92,7 @@ describe('LogController', () => { .expect('Content-Type', /json/); }); - it('should return an object with a logs array', async () => { + it('should return an object with a logs array', async() => { const response = await request(app.getHttpServer()) .get('/logs') .set('Authorization', `Bearer ${jwt}`); @@ -110,7 +110,7 @@ describe('LogController', () => { .expect('Content-Type', /json/); }); - it('should return an object', async () => { + it('should return an object', async() => { const response = await request(app.getHttpServer()) .get(`/logs/${1}`) .set('Authorization', `Bearer ${jwt}`); @@ -121,7 +121,7 @@ describe('LogController', () => { describe('PATCH /logs/{id}/runs', () => { const linkRunToLogDto: LinkRunToLogDto = { - runNumber: 1 + runNumber: 1, }; it('should link a run to a log', () => { diff --git a/test/controllers/log.service.spec.ts b/test/controllers/log.service.spec.ts index a1b0b5e..834bf7d 100644 --- a/test/controllers/log.service.spec.ts +++ b/test/controllers/log.service.spec.ts @@ -44,13 +44,13 @@ describe('LogService', () => { password: TEST_DB_PASSWORD, database: TEST_DB_DATABASE, entities: ['src/**/**.entity{.ts,.js}'], - synchronize: TEST_DB_SYNCHRONIZE === 'true' ? true : false, + synchronize: TEST_DB_SYNCHRONIZE === 'true', migrations: ['populate/*{.ts,.js}'], - migrationsRun: true + migrationsRun: true, }; const queryRunDto: QueryRunDto = { pageNumber: 1, - pageSize: 25 + pageSize: 25, }; const queryLogDto: QueryLogDto = {}; const logDto: CreateLogDto = { @@ -59,22 +59,24 @@ describe('LogService', () => { subtype: 'run', origin: 'human', user: 1, - run: null + run: null, }; - beforeAll(async () => { - // maybe add a switch to support an in memory db like sqljs, - // so that tests can be run in a CI pipeline like Travis + beforeAll(async() => { + /* + * maybe add a switch to support an in memory db like sqljs, + * so that tests can be run in a CI pipeline like Travis + */ testingModule = await Test.createTestingModule({ providers: [ RunService, LogService, - FlpSerivce + FlpSerivce, ], imports: [ TypeOrmModule.forRoot(databaseOptions), - TypeOrmModule.forFeature([Run, Log, FlpRole]) - ] + TypeOrmModule.forFeature([Run, Log, FlpRole]), + ], }) .compile(); @@ -83,35 +85,34 @@ describe('LogService', () => { flpService = await testingModule.get(FlpSerivce); }); - afterAll(async () => { + afterAll(async() => { testingModule.close(); }); describe('initialize', () => { - it('logService should be defined', async () => { + it('logService should be defined', async() => { expect(logService).toBeDefined(); }); - it('runService should be defined', async () => { + it('runService should be defined', async() => { expect(runService).toBeDefined(); }); }); - describe('getLogInfoParams', ()=> { - it('should return params with logId 1', async () => { + describe('getLogInfoParams', () => { + it('should return params with logId 1', async() => { const result = await logService.getLogInfoParams(1); expect(result.logId).toBe(1); }); }); describe('post()', () => { - - it('should create one log and return it', async () => { + it('should create one log and return it', async() => { const result = await logService.create(logDto); expect(result).toBeInstanceOf(Log); }); - it('should link a run to a log', async () => { + it('should link a run to a log', async() => { // retrieve the latest run const runs = await runService.findAll(queryRunDto); const latestRun = runs.runs[runs.runs.length - 1]; @@ -132,17 +133,17 @@ describe('LogService', () => { }); describe('get()', () => { - it('should return a log with logId 1', async () => { + it('should return a log with logId 1', async() => { log = await logService.findLogById(1); expect(log.logId).toBe(1); }); - it('should return multiple logs', async () => { + it('should return multiple logs', async() => { const logs = await logService.find(queryLogDto); expect((logs.logs as Log[]).length).toBeGreaterThanOrEqual(1); }); - it('should return the logs from the given user', async () => { + it('should return the logs from the given user', async() => { const logsFromUser = await logService.findLogsByUserId(1, queryLogDto); expect(typeof logsFromUser.logs).toBe('object'); expect(logsFromUser.logs[0].user.userId).toBe(1); diff --git a/test/controllers/run.controller.e2e-spec.ts b/test/controllers/run.controller.e2e-spec.ts index 04a949e..661b0ef 100644 --- a/test/controllers/run.controller.e2e-spec.ts +++ b/test/controllers/run.controller.e2e-spec.ts @@ -21,11 +21,11 @@ describe('RunController', () => { let runToPost: CreateRunDto; const runNumber = Math.floor(+new Date() / 1000); - const activityId: string = 'run.controller.e2e-spec.ts'; + const activityId = 'run.controller.e2e-spec.ts'; - beforeAll(async () => { + beforeAll(async() => { const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule] + imports: [AppModule], }).compile(); app = await moduleFixture.createNestApplication(); @@ -34,7 +34,7 @@ describe('RunController', () => { jwt = await getJwt(app); }); - afterAll(async () => { + afterAll(async() => { await app.close(); }); @@ -47,22 +47,22 @@ describe('RunController', () => { activityId, nDetectors: 16, nFlps: 7, - nEpns: 8 + nEpns: 8, }; it('should return status 201 and JSON Cotent-Type', () => { return request(app.getHttpServer()) - .post(`/runs`) + .post('/runs') .set('Authorization', `Bearer ${jwt}`) .send(runToPost) .expect(201) .expect('Content-Type', /json/); }); - it(`should return an object containing ${activityId} as the activityId`, async () => { + it(`should return an object containing ${activityId} as the activityId`, async() => { runToPost.runNumber = runToPost.runNumber + 3; const response = await request(app.getHttpServer()) - .post(`/runs`) + .post('/runs') .set('Authorization', `Bearer ${jwt}`) .send(runToPost) .set('Accept', 'application/json'); @@ -79,7 +79,7 @@ describe('RunController', () => { .expect('Content-Type', /json/); }); - it('should return an object with a runs array', async () => { + it('should return an object with a runs array', async() => { const response = await request(app.getHttpServer()) .get('/runs') .set('Authorization', `Bearer ${jwt}`); @@ -97,7 +97,7 @@ describe('RunController', () => { .expect('Content-Type', /json/); }); - it('should return an object', async () => { + it('should return an object', async() => { const response = await request(app.getHttpServer()) .get(`/runs/${runToPost.runNumber}`) .set('Authorization', `Bearer ${jwt}`); @@ -109,7 +109,7 @@ describe('RunController', () => { describe('PATCH /runs/{id}/logs', () => { const linkLogToRunDto: LinkLogToRunDto = { - logId: 1 + logId: 1, }; it('should return status 200 and JSON Content-Type', () => { @@ -127,7 +127,7 @@ describe('RunController', () => { const patchRunDto: PatchRunDto = { O2EndTime: new Date(), TrgEndTime: new Date(), - runQuality: 'Unknown' + runQuality: 'Unknown', }; return request(app.getHttpServer()) diff --git a/test/controllers/run.service.spec.ts b/test/controllers/run.service.spec.ts index 389fd9f..1e74498 100644 --- a/test/controllers/run.service.spec.ts +++ b/test/controllers/run.service.spec.ts @@ -49,7 +49,7 @@ describe('RunService', () => { password: TEST_DB_PASSWORD, database: TEST_DB_DATABASE, entities: ['src/**/**.entity{.ts,.js}'], - synchronize: TEST_DB_SYNCHRONIZE === 'true' ? true : false, + synchronize: TEST_DB_SYNCHRONIZE === 'true', migrations: ['populate/*{.ts,.js}'], migrationsRun: true, // logging: 'all' @@ -57,7 +57,7 @@ describe('RunService', () => { const runNumber = Math.floor(+new Date() / 1000); const queryRunDto: QueryRunDto = { pageNumber: 1, - pageSize: 25 + pageSize: 25, }; const queryLogDto: QueryLogDto = {}; const runDto: CreateRunDto = { @@ -68,22 +68,24 @@ describe('RunService', () => { nFlps: 1, runType: RunType.TECHNICAL, O2StartTime: new Date(), - TrgStartTime: new Date() + TrgStartTime: new Date(), }; - beforeAll(async () => { - // maybe add a switch to support an in memory db like sqljs, - // so that tests can be run in a CI pipeline like Travis + beforeAll(async() => { + /* + * maybe add a switch to support an in memory db like sqljs, + * so that tests can be run in a CI pipeline like Travis + */ testingModule = await Test.createTestingModule({ providers: [ RunService, LogService, - FlpSerivce + FlpSerivce, ], imports: [ TypeOrmModule.forRoot(databaseOptions), - TypeOrmModule.forFeature([Run, Log, FlpRole]) - ] + TypeOrmModule.forFeature([Run, Log, FlpRole]), + ], }) .compile(); @@ -92,22 +94,22 @@ describe('RunService', () => { flpService = await testingModule.get(FlpSerivce); }); - afterAll(async () => { + afterAll(async() => { testingModule.close(); }); describe('initialize', () => { - it('expects logService to be defined', async () => { + it('expects logService to be defined', async() => { expect(logService).toBeDefined(); }); - it('expects runService to be defined', async () => { + it('expects runService to be defined', async() => { expect(runService).toBeDefined(); }); }); describe('getRunConfParams', () => { - it('should return params with runNumber 1 and 2', async () => { + it('should return params with runNumber 1 and 2', async() => { const result = await runService.getRunConfParams(1, 2); expect(result.Run1).toBe(1); expect(result.Run2).toBe(2); @@ -115,12 +117,12 @@ describe('RunService', () => { }); describe('post()', () => { - it('should create one run and return it', async () => { + it('should create one run and return it', async() => { const result = await runService.create(runDto); expect(result).toBeInstanceOf(Run); }); - it('should link a log to a run', async () => { + it('should link a log to a run', async() => { const runs = await runService.findAll(queryRunDto); latestRun = runs.runs[runs.runs.length - 1]; const runId = latestRun.runNumber; @@ -136,11 +138,11 @@ describe('RunService', () => { expect(await runService.linkLogToRun(runId, logId)).toEqual(run); }); - it('should update a specific run and return it', async () => { + it('should update a specific run and return it', async() => { patchRunDto = { O2EndTime: new Date(), TrgEndTime: new Date(), - runQuality: 'Unknown' + runQuality: 'Unknown', }; const updatedRun = await runService.updateRun(latestRun.runNumber, patchRunDto); @@ -152,12 +154,12 @@ describe('RunService', () => { }); describe('get()', () => { - it('should return a run with runNumber 1', async () => { + it('should return a run with runNumber 1', async() => { run = await runService.findById(1); expect(run.runNumber).toBe(1); }); - it('should return multiple runs', async () => { + it('should return multiple runs', async() => { const runResult = await runService.findAll(queryRunDto); expect(runResult.runs.length).toBeGreaterThanOrEqual(1); }); diff --git a/test/utility/auth.utility.spec.ts b/test/utility/auth.utility.spec.ts index 44bee16..b957694 100644 --- a/test/utility/auth.utility.spec.ts +++ b/test/utility/auth.utility.spec.ts @@ -16,58 +16,57 @@ describe('AuthUtility', () => { const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6ImViYWNhODQxOGRjOGRhZmQ3YmFmZTZmZWZlZTJkZTczODcw' + 'YjNiOWQiLCJpYXQiOjE1NDI4NDI4NzUsImV4cCI6MTU0Mjg0NjQ3NX0.NjlUBIyEvFR0XzQ3Fk5Svj25itbCCAcyfyGpMPSrn2I'; - beforeAll(async () => { + beforeAll(async() => { const module: TestingModule = await Test.createTestingModule({}).compile(); app = module.createNestApplication(); await app.init(); }); - afterAll(async () => { + afterAll(async() => { await app.close(); }); describe('getJwtFromHeaders', () => { const headersWithAuth = { - 'host': 'localhost:3000', - 'connection': 'keep-alive', - 'accept': 'application/json, text/*', - 'origin': 'http://localhost:8080', - 'authorization': + host: 'localhost:3000', + connection: 'keep-alive', + accept: 'application/json, text/*', + origin: 'http://localhost:8080', + authorization: 'bearer ' + jwt, 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)' + 'AppleWebKit/537.36 (KHTML, like Gecko)' + 'Chrome/70.0.3538.102 Safari/537.36', - 'dnt': '1', - 'referer': 'http://localhost:8080/logs', + dnt: '1', + referer: 'http://localhost:8080/logs', 'accept-encoding': 'gzip, deflate, br', - 'accept-language': 'nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7' + 'accept-language': 'nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7', }; const headersWithCookieToken = { - 'host': 'localhost:3000', - 'connection': 'keep-alive', + host: 'localhost:3000', + connection: 'keep-alive', 'upgrade-insecure-requests': '1', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)' + 'AppleWebKit/537.36 (KHTML, like Gecko) ' + 'Chrome/70.0.3538.102 Safari/537.36', - 'dnt': '1', - 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', + dnt: '1', + accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7', - 'cookie': + cookie: 'ga=GA1.1.1745498335.1542716010; ' + - `token=${jwt}` + `token=${jwt}`, }; - it('should return JWT from authorization headers', async () => { + it('should return JWT from authorization headers', async() => { return expect(await authUtility.getJwtFromHeaders(headersWithAuth)).toBe(jwt); }); - it('should return JWT from cookie headers with a token', async () => { + it('should return JWT from cookie headers with a token', async() => { return expect(await authUtility.getJwtFromHeaders(headersWithCookieToken)).toBe(jwt); }); }); - }); diff --git a/tslint.json b/tslint.json deleted file mode 100644 index b130668..0000000 --- a/tslint.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": [ - "tslint:recommended" - ], - "linterOptions": { - "exclude": [ - "src/migration/*.ts", "ormconfig.json", "src/global.d.ts" - ] - }, - "rules": { - "arrow-parens": false, - "arrow-return-shorthand": true, - "align": [ - true, - "parameters", - "arguments", - "statements" - ], - "member-access": false, - "ban": false, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "eofline": true, - "forin": true, - "import-spacing": true, - "indent": [ - true, - "spaces", - 4 - ], - "interface-name": [ - true, - "never-prefix" - ], - "jsdoc-format": true, - "label-position": true, - "max-line-length": [ - true, - 120 - ], - "member-ordering": [ - true, - { - "order": [ - "public-static-field", - "public-instance-field", - "private-static-field", - "private-instance-field", - "public-constructor", - "private-constructor", - "public-instance-method", - "protected-instance-method", - "private-instance-method" - ] - } - ], - "new-parens": true, - "no-any": false, - "no-arg": true, - "no-bitwise": true, - "no-console": [ - false, - "log", - "error", - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-consecutive-blank-lines": [ - true - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-shadowed-variable": true, - "no-string-literal": true, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-reference": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unsafe-any": false, - "no-var-keyword": true, - "ordered-imports": false, - "object-literal-sort-keys": false, - "one-variable-per-declaration": [ - true, - "ignore-for-loop" - ], - "one-line": [ - true, - "check-catch", - "check-else", - "check-open-brace", - "check-whitespace" - ], - "prefer-template": [ - true, - "allow-single-concat" - ], - "quotemark": [ - true, - "single", - "jsx-double" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "switch-default": true, - "trailing-comma": [ - true, - { - "singleline": "never" - } - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef": [ - true, - "parameter", - "property-declaration", - "member-variable-declaration", - "call-signature" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords", - "check-format", - "allow-pascal-case" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-module", - "check-separator", - "check-rest-spread", - "check-type", - "check-typecast", - "check-type-operator", - "check-preblock" - ] - } -} \ No newline at end of file