diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7a8a53..a95dfb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,14 +3,14 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci cache: paths: - - .npmci_cache/ - key: "$CI_BUILD_STAGE" + - .npmci_cache/ + key: '$CI_BUILD_STAGE' stages: -- security -- test -- release -- metadata + - security + - test + - release + - metadata # ==================== # security stage @@ -18,21 +18,23 @@ stages: mirror: stage: security script: - - npmci git mirror + - npmci git mirror tags: - - docker - - notpriv + - lossless + - docker + - notpriv snyk: + image: registry.gitlab.com/hosttoday/ht-docker-node:snyk stage: security script: - npmci npm prepare - - npmci command npm install -g snyk - npmci command npm install --ignore-scripts - npmci command snyk test tags: - - docker - - notpriv + - lossless + - docker + - notpriv # ==================== # test stage @@ -41,37 +43,40 @@ snyk: testStable: stage: test script: - - npmci npm prepare - - npmci node install stable - - npmci npm install - - npmci npm test + - npmci npm prepare + - npmci node install stable + - npmci npm install + - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker - - priv + - lossless + - docker + - priv testBuild: stage: test script: - - npmci npm prepare - - npmci node install stable - - npmci npm install - - npmci command npm run build + - npmci npm prepare + - npmci node install stable + - npmci npm install + - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker - - notpriv + - lossless + - docker + - notpriv release: stage: release script: - - npmci node install stable - - npmci npm publish + - npmci node install stable + - npmci npm publish only: - - tags + - tags tags: - - docker - - notpriv + - lossless + - docker + - notpriv # ==================== # metadata stage @@ -85,18 +90,20 @@ codequality: - npmci npm install - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - - docker - - priv + - lossless + - docker + - priv trigger: stage: metadata script: - - npmci trigger + - npmci trigger only: - - tags + - tags tags: - - docker - - notpriv + - lossless + - docker + - notpriv pages: stage: metadata @@ -107,6 +114,7 @@ pages: - npmci npm install - npmci command tsdoc tags: + - lossless - docker - notpriv only: @@ -114,5 +122,5 @@ pages: artifacts: expire_in: 1 week paths: - - public + - public allow_failure: true diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..112db52 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "current file", + "type": "node", + "request": "launch", + "args": [ + "${relativeFile}" + ], + "runtimeArgs": ["-r", "@gitzone/tsrun"], + "cwd": "${workspaceRoot}", + "protocol": "inspector", + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": "test.ts", + "type": "node", + "request": "launch", + "args": [ + "test/test.ts" + ], + "runtimeArgs": ["-r", "@gitzone/tsrun"], + "cwd": "${workspaceRoot}", + "protocol": "inspector", + "internalConsoleOptions": "openOnSessionStart" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..01d2b8d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,26 @@ +{ + "json.schemas": [ + { + "fileMatch": ["/npmextra.json"], + "schema": { + "type": "object", + "properties": { + "npmci": { + "type": "object", + "description": "settings for npmci" + }, + "gitzone": { + "type": "object", + "description": "settings for gitzone", + "properties": { + "projectType": { + "type": "string", + "enum": ["website", "element", "service", "npm"] + } + } + } + } + } + } + ] +} diff --git a/npmextra.json b/npmextra.json index c035555..94fbce8 100644 --- a/npmextra.json +++ b/npmextra.json @@ -4,6 +4,7 @@ "npmAccessLevel": "public" }, "gitzone": { + "projectType": "npm", "module": { "githost": "gitlab.com", "gitscope": "pushrocks", diff --git a/package-lock.json b/package-lock.json index f33470c..345a154 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,18 +11,18 @@ "dev": true }, "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "version": "7.8.3", + "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" } }, "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "version": "7.8.3", + "resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.8.3.tgz", + "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", "dev": true, "requires": { "chalk": "^2.0.0", @@ -73,7 +73,7 @@ }, "@pushrocks/consolecolor": { "version": "2.0.1", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fconsolecolor/-/consolecolor-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/@pushrocks/consolecolor/-/consolecolor-2.0.1.tgz", "integrity": "sha512-iOFCHVeFZ2OywbdwSxVI4/wokkcLrXVdHLgvMmkNhJ220eeLgjNZWx3EJo3vNW3zq5ybCSCUIq0878djBxrWpw==", "dev": true, "requires": { @@ -137,11 +137,11 @@ } }, "@pushrocks/smartdelay": { - "version": "2.0.3", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.3.tgz", - "integrity": "sha512-TXKDDqsc7sBTLl+oiYNaF6IdNk1n70i8ur8QfwcUU6tegTnrEkvMWy9h5Zdty/fq1ioCNpKLvuXoA+fgYVwKGQ==", + "version": "2.0.6", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.6.tgz", + "integrity": "sha512-4wUnzWNhRPODpaaL5GuRaje/C5dg+TMhBxmr57PKc2fqYpy6azWJwonf/s5xpcbJLCPJRbj1x8M5MqgCFq2uvg==", "requires": { - "@pushrocks/smartpromise": "^3.0.2" + "@pushrocks/smartpromise": "^3.0.6" } }, "@pushrocks/smarterror": { @@ -198,23 +198,23 @@ } }, "@pushrocks/smarthash": { - "version": "2.0.6", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarthash/-/smarthash-2.0.6.tgz", - "integrity": "sha512-jHk9srgRLkszk/oPCUOkxTX2Fqu7qKwx13aEeSIBx8UCtFbXPLecJAqEaGEVk1mw9e4Oq0iC6O0jEnxKo5NQwA==", + "version": "2.1.6", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarthash/-/smarthash-2.1.6.tgz", + "integrity": "sha512-TYa3wECYkeDoE8SomxcCJFg5Kt4+G4MtNMu3yATJCCoPLJIbyV1CwUvYuFYkkce2W4ZvH9h/N6dsHc69oI5Jcw==", "requires": { - "@pushrocks/smartjson": "^3.0.5", - "@pushrocks/smartpromise": "^3.0.2", + "@pushrocks/smartjson": "^3.0.10", + "@pushrocks/smartpromise": "^3.0.6", "@types/through2": "^2.0.34", "through2": "^3.0.1" } }, "@pushrocks/smartjson": { - "version": "3.0.8", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-3.0.8.tgz", - "integrity": "sha512-EjC3611RSZaZmK+nXxXrYDBxdxYWtrxjOrZtQzbYn0yM33KSCH0sLIAG8B2wYZVAOj4A2pC8mVxFSJ1w3iRFHg==", + "version": "3.0.10", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-3.0.10.tgz", + "integrity": "sha512-0tBkET2yjmSSIf4DlgeyU8U/J2EshTmQGuMY28EjPq9VvuCFXLh72WmETpA4QqKRMqhWp1+P+RZgnQupW3GQxQ==", "requires": { "@types/fast-json-stable-stringify": "^2.0.0", - "fast-json-stable-stringify": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", "lodash.clonedeep": "^4.5.0" } }, @@ -267,7 +267,7 @@ }, "@pushrocks/smartpath": { "version": "4.0.1", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/@pushrocks/smartpath/-/smartpath-4.0.1.tgz", "integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA==", "dev": true }, @@ -326,21 +326,22 @@ } }, "@pushrocks/tapbundle": { - "version": "3.0.13", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.13.tgz", - "integrity": "sha512-23O4UMBafCuD+RnUlXNvtT9DGbL1HMD+xZE1Zcr7Ll7WvgxUgRQQfk9kq6qbLLbjaRe1J2Ijsgh1HuZbBaucLQ==", + "version": "3.2.0", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz", + "integrity": "sha512-xnKIGe7NJqxWBaFeKIEXShDjV2wap1XJqmlp3m1MKqmIF62vRpZnkzpyE1ZAoNwiYQmIsXIpvP/PDv+iPevPfw==", "dev": true, "requires": { "@pushrocks/early": "^3.0.3", "@pushrocks/smartdelay": "^2.0.3", + "@pushrocks/smartfile": "^7.0.6", "@pushrocks/smartpromise": "^3.0.2", "smartchai": "^2.0.1" } }, "@types/chai": { - "version": "4.2.4", - "resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.4.tgz", - "integrity": "sha512-7qvf9F9tMTzo0akeswHPGqgUx/gIaJqrOEET/FCD8CFRkSUHlygQiM5yB6OvjrtdxBVLSyw7COJubsFYs0683g==", + "version": "4.2.8", + "resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.8.tgz", + "integrity": "sha512-U1bQiWbln41Yo6EeHMr+34aUhvrMVyrhn9lYfPSpLTCrZlGxU4Rtn1bocX+0p2Fc/Jkd2FanCEXdw0WNfHHM0w==", "dev": true }, "@types/chai-as-promised": { @@ -414,9 +415,9 @@ "dev": true }, "@types/node": { - "version": "12.11.5", - "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.11.5.tgz", - "integrity": "sha512-LC8ALj/24PhByn39nr5jnTvpE7MujK8y7LQmV74kHYF5iQ0odCPkMH4IZNZw+cobKfSXqaC8GgegcbIsQpffdA==" + "version": "13.7.0", + "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.0.tgz", + "integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ==" }, "@types/through2": { "version": "2.0.34", @@ -451,7 +452,7 @@ }, "ansi-256-colors": { "version": "1.1.0", - "resolved": "https://verdaccio.lossless.one/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz", "integrity": "sha1-kQ3lDvzHwJ49gvL4er1rcAwYgYo=", "dev": true }, @@ -478,7 +479,7 @@ }, "argparse": { "version": "1.0.10", - "resolved": "https://verdaccio.lossless.one/argparse/-/argparse-1.0.10.tgz", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { @@ -493,19 +494,19 @@ }, "asynckit": { "version": "0.4.0", - "resolved": "https://verdaccio.lossless.one/asynckit/-/asynckit-0.4.0.tgz", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, "balanced-match": { "version": "1.0.0", - "resolved": "https://verdaccio.lossless.one/balanced-match/-/balanced-match-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.11", - "resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { @@ -622,7 +623,7 @@ }, "color-convert": { "version": "1.9.3", - "resolved": "https://verdaccio.lossless.one/color-convert/-/color-convert-1.9.3.tgz", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { @@ -631,7 +632,7 @@ }, "color-name": { "version": "1.1.3", - "resolved": "https://verdaccio.lossless.one/color-name/-/color-name-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, @@ -652,15 +653,10 @@ }, "concat-map": { "version": "0.0.1", - "resolved": "https://verdaccio.lossless.one/concat-map/-/concat-map-0.0.1.tgz", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, "cron": { "version": "1.7.2", "resolved": "https://verdaccio.lossless.one/cron/-/cron-1.7.2.tgz", @@ -717,7 +713,7 @@ }, "delayed-stream": { "version": "1.0.0", - "resolved": "https://verdaccio.lossless.one/delayed-stream/-/delayed-stream-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, @@ -744,7 +740,7 @@ }, "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://verdaccio.lossless.one/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, @@ -776,9 +772,9 @@ } }, "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://verdaccio.lossless.one/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "version": "2.1.0", + "resolved": "https://verdaccio.lossless.one/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "figures": { "version": "3.1.0", @@ -822,7 +818,7 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://verdaccio.lossless.one/fs.realpath/-/fs.realpath-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, @@ -869,7 +865,7 @@ }, "has-flag": { "version": "3.0.0", - "resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, @@ -884,7 +880,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { @@ -921,14 +917,9 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, "isexe": { "version": "2.0.0", - "resolved": "https://verdaccio.lossless.one/isexe/-/isexe-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, @@ -950,7 +941,7 @@ }, "jsonfile": { "version": "4.0.0", - "resolved": "https://verdaccio.lossless.one/jsonfile/-/jsonfile-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "requires": { @@ -1051,7 +1042,7 @@ }, "minimatch": { "version": "3.0.4", - "resolved": "https://verdaccio.lossless.one/minimatch/-/minimatch-3.0.4.tgz", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { @@ -1115,7 +1106,7 @@ }, "once": { "version": "1.4.0", - "resolved": "https://verdaccio.lossless.one/once/-/once-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { @@ -1231,7 +1222,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://verdaccio.lossless.one/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1253,11 +1244,6 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" - }, "pump": { "version": "3.0.0", "resolved": "https://verdaccio.lossless.one/pump/-/pump-3.0.0.tgz", @@ -1269,17 +1255,13 @@ } }, "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "version": "3.5.0", + "resolved": "https://verdaccio.lossless.one/readable-stream/-/readable-stream-3.5.0.tgz", + "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" } }, "require-directory": { @@ -1295,9 +1277,9 @@ "dev": true }, "resolve": { - "version": "1.12.0", - "resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "version": "1.15.0", + "resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.15.0.tgz", + "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -1323,9 +1305,9 @@ } }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.2.0", + "resolved": "https://verdaccio.lossless.one/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" }, "semver": { "version": "5.7.1", @@ -1376,7 +1358,7 @@ }, "source-map": { "version": "0.6.1", - "resolved": "https://verdaccio.lossless.one/source-map/-/source-map-0.6.1.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, @@ -1392,7 +1374,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://verdaccio.lossless.one/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -1407,11 +1389,11 @@ } }, "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "version": "1.3.0", + "resolved": "https://verdaccio.lossless.one/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "~5.2.0" } }, "strip-ansi": { @@ -1472,9 +1454,9 @@ "dev": true }, "tslint": { - "version": "5.20.0", - "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.0.tgz", - "integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==", + "version": "6.0.0", + "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-6.0.0.tgz", + "integrity": "sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1488,7 +1470,7 @@ "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.8.0", + "tslib": "^1.10.0", "tsutils": "^2.29.0" } }, @@ -1521,7 +1503,7 @@ }, "universalify": { "version": "0.1.2", - "resolved": "https://verdaccio.lossless.one/universalify/-/universalify-0.1.2.tgz", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, @@ -1541,7 +1523,7 @@ }, "which": { "version": "1.3.1", - "resolved": "https://verdaccio.lossless.one/which/-/which-1.3.1.tgz", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { @@ -1603,7 +1585,7 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://verdaccio.lossless.one/wrappy/-/wrappy-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, diff --git a/package.json b/package.json index 29611c3..2dc703f 100644 --- a/package.json +++ b/package.json @@ -15,15 +15,15 @@ "@gitzone/tsbuild": "^2.1.17", "@gitzone/tsrun": "^1.2.8", "@gitzone/tstest": "^1.0.28", - "@pushrocks/tapbundle": "^3.0.13", - "@types/node": "^12.11.5", - "tslint": "^5.20.0", + "@pushrocks/tapbundle": "^3.2.0", + "@types/node": "^13.7.0", + "tslint": "^6.0.0", "tslint-config-prettier": "^1.18.0" }, "dependencies": { - "@pushrocks/smartdelay": "^2.0.3", + "@pushrocks/smartdelay": "^2.0.6", "@pushrocks/smarterror": "^2.0.1", - "@pushrocks/smarthash": "^2.0.6", + "@pushrocks/smarthash": "^2.1.6", "@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smarttime": "^3.0.12" }, @@ -38,4 +38,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index 8758a21..d76d54c 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ cache things in smart ways * [docs (typedoc)](https://pushrocks.gitlab.io/smartcache/) ## Status for master -[![build status](https://gitlab.com/pushrocks/smartcache/badges/master/build.svg)](https://gitlab.com/pushrocks/smartcache/commits/master) +[![pipeline status](https://gitlab.com/pushrocks/smartcache/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartcache/commits/master) [![coverage report](https://gitlab.com/pushrocks/smartcache/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartcache/commits/master) [![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartcache.svg)](https://www.npmjs.com/package/@pushrocks/smartcache) [![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartcache/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartcache) @@ -18,6 +18,11 @@ cache things in smart ways ## Usage + +## Contribution + +We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) + For further information read the linked docs at the top of this readme. > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) diff --git a/test/test.ts b/test/test.ts index 219dbfe..f6fa4cb 100644 --- a/test/test.ts +++ b/test/test.ts @@ -13,7 +13,7 @@ tap.test('try to get async responses', async () => { const getResponse = async () => { const response = await smartcacheInstance .cacheReturn(async () => { - console.log('function ran'); + console.log('function 1 ran'); return 'hello'; }, 1000) .catch(err => { @@ -27,7 +27,7 @@ tap.test('try to get async responses', async () => { const response = await smartcacheInstance .cacheReturn(async () => { console.log('function 2 ran'); - return 'hello'; + return 'hello there!'; }, 1000) .catch(err => { console.log(err); @@ -36,13 +36,13 @@ tap.test('try to get async responses', async () => { console.log(response); }; - getResponse(); - getResponse(); - getResponse2(); - getResponse2(); - await smartdelay.delayFor(1000).then(async () => { + await getResponse(); + await getResponse(); + await getResponse2(); + await getResponse2(); + await smartdelay.delayFor(2000).then(async () => { await getResponse(); - // getResponse2(); + await getResponse2(); }); }); diff --git a/ts/smartcache.classes.smartcache.ts b/ts/smartcache.classes.smartcache.ts index f9e326f..2a84479 100644 --- a/ts/smartcache.classes.smartcache.ts +++ b/ts/smartcache.classes.smartcache.ts @@ -5,8 +5,8 @@ export class SmartCache { private _cacheManager = new CacheManager(); async cacheReturn(asyncCachedFuncArg: () => Promise, cacheDuration: number = 5000) { - let callStack: string = new plugins.smarterror.SmartError('').cleanFullStack; - let callHash = plugins.smarthash.sha256FromStringSync(callStack); + const callStack: string = new plugins.smarterror.SmartError('Cache Creation Point').cleanFullStack.split('\n')[2]; + const callHash = plugins.smarthash.sha256FromStringSync(callStack); // console.log(callHash); if ( @@ -17,7 +17,7 @@ export class SmartCache { return this._cacheManager.getCache(callHash).cachedObject; } else { this._cacheManager.announceCache(callHash, cacheDuration); - let newCachedObject = await asyncCachedFuncArg(); + const newCachedObject = await asyncCachedFuncArg(); this._cacheManager.setCache(callHash, newCachedObject, cacheDuration); return newCachedObject; }