fix(core): update

This commit is contained in:
Philipp Kunz 2018-11-11 19:40:59 +01:00
parent 57b73f8220
commit c519090b34
7 changed files with 93 additions and 21 deletions

4
.snyk Normal file
View File

@ -0,0 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.1
ignore: {}
patch: {}

61
package-lock.json generated
View File

@ -74,6 +74,15 @@
"@pushrocks/smartpromise": "^2.0.5" "@pushrocks/smartpromise": "^2.0.5"
} }
}, },
"@pushrocks/qenv": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@pushrocks/qenv/-/qenv-2.0.2.tgz",
"integrity": "sha512-DKYbGy2m0fDRCVp9vwtgx1vZfYfK0k36POplCGo0jJat/DmB51KOjZ3gkqRqNJnoRQrn/kFH8+Xrm7D6gOotoA==",
"dev": true,
"requires": {
"@pushrocks/smartfile": "^6.0.6"
}
},
"@pushrocks/smartdelay": { "@pushrocks/smartdelay": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.2.tgz",
@ -100,6 +109,16 @@
"vinyl-file": "^3.0.0" "vinyl-file": "^3.0.0"
} }
}, },
"@pushrocks/smarthash": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@pushrocks/smarthash/-/smarthash-2.0.0.tgz",
"integrity": "sha512-+nxpmemy7Tn5tTRlJKR68HJzFDLVMJQSM/GRzb7wgYPVkjs+zeME4oTV6pn8x3//qFio8C3RdrvsQ1iz+xO/jw==",
"requires": {
"@pushrocks/smartpromise": "^2.0.5",
"@types/through2": "^2.0.33",
"through2": "^2.0.3"
}
},
"@pushrocks/smartlog": { "@pushrocks/smartlog": {
"version": "2.0.9", "version": "2.0.9",
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog/-/smartlog-2.0.9.tgz", "resolved": "https://registry.npmjs.org/@pushrocks/smartlog/-/smartlog-2.0.9.tgz",
@ -211,6 +230,14 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.5.tgz",
"integrity": "sha512-GzdHjq3t3eGLMv92Al90Iq+EoLL+86mPfQhuglbBFO7HiLdC/rkt+zrzJJumAiBF6nsrBWhou22rPW663AAyFw==" "integrity": "sha512-GzdHjq3t3eGLMv92Al90Iq+EoLL+86mPfQhuglbBFO7HiLdC/rkt+zrzJJumAiBF6nsrBWhou22rPW663AAyFw=="
}, },
"@types/through2": {
"version": "2.0.34",
"resolved": "https://registry.npmjs.org/@types/through2/-/through2-2.0.34.tgz",
"integrity": "sha512-nhRG8+RuG/L+0fAZBQYaRflXKjTrHOKH8MFTChnf+dNVMxA3wHYYrfj0tztK0W51ABXjGfRCDc0vRkecCOrsow==",
"requires": {
"@types/node": "*"
}
},
"@types/vinyl": { "@types/vinyl": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.2.tgz",
@ -463,8 +490,7 @@
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
"dev": true
}, },
"deep-eql": { "deep-eql": {
"version": "3.0.1", "version": "3.0.1",
@ -609,8 +635,7 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
"dev": true
}, },
"is-utf8": { "is-utf8": {
"version": "0.2.1", "version": "0.2.1",
@ -621,8 +646,7 @@
"isarray": { "isarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
"dev": true
}, },
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
@ -773,14 +797,12 @@
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
"dev": true
}, },
"readable-stream": { "readable-stream": {
"version": "2.3.6", "version": "2.3.6",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true,
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",
"inherits": "~2.0.3", "inherits": "~2.0.3",
@ -815,8 +837,7 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"dev": true
}, },
"semver": { "semver": {
"version": "5.6.0", "version": "5.6.0",
@ -864,7 +885,6 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": { "requires": {
"safe-buffer": "~5.1.0" "safe-buffer": "~5.1.0"
} }
@ -912,6 +932,15 @@
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true "dev": true
}, },
"through2": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
"integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
"requires": {
"readable-stream": "~2.3.6",
"xtend": "~4.0.1"
}
},
"ts-node": { "ts-node": {
"version": "7.0.1", "version": "7.0.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz",
@ -990,8 +1019,7 @@
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
"dev": true
}, },
"vinyl": { "vinyl": {
"version": "2.2.0", "version": "2.2.0",
@ -1035,6 +1063,11 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true "dev": true
}, },
"xtend": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
},
"yn": { "yn": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",

View File

@ -15,12 +15,14 @@
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15", "@gitzone/tstest": "^1.0.15",
"@pushrocks/qenv": "^2.0.2",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.7", "@types/node": "^10.11.7",
"tslint": "^5.11.0", "tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smarthash": "^2.0.0",
"@pushrocks/smartlog-interfaces": "^2.0.3", "@pushrocks/smartlog-interfaces": "^2.0.3",
"@pushrocks/smartrequest": "^1.1.14" "@pushrocks/smartrequest": "^1.1.14"
} }

3
qenv.yml Normal file
View File

@ -0,0 +1,3 @@
vars:
- RECEIVER_ENDPOINT
- PASSPHRASE

View File

@ -1,8 +1,34 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import { Qenv } from '@pushrocks/qenv';
import * as smartlog from '@pushrocks/smartlog';
const testQenv = new Qenv('./', './.nogit/');
import * as smartlogDestinationReceiver from '../ts/index'; import * as smartlogDestinationReceiver from '../ts/index';
tap.test('first test', async () => { let testSmartlogReceiver: smartlogDestinationReceiver.SmartlogDestinationReceiver;
console.log(smartlogDestinationReceiver.standardExport);
tap.test('should create a valid SmartlogDestinationReceiver', async () => {
testSmartlogReceiver = new smartlogDestinationReceiver.SmartlogDestinationReceiver({
receiverEndpoint: process.env.RECEIVER_ENDPOINT,
passphrase: process.env.PASSPHRASE
});
});
tap.test('should send a valid message', async () => {
testSmartlogReceiver.handleLog({
timestamp: Date.now(),
context: {
company: 'Lossless GmbH',
companyunit: 'Lossless Cloud',
containerName: null,
environment: 'local',
runtime: 'node',
zone: 'gitzone'
},
type: 'log',
level: 'info',
message: 'This is a message',
});
}); });
tap.start(); tap.start();

View File

@ -17,10 +17,13 @@ export class SmartlogDestinationReceiver implements ILogDestination {
this.options = optionsArg; this.options = optionsArg;
} }
handleLog(logPackageArg: ILogPackage) { public async handleLog(logPackageArg: ILogPackage) {
plugins.smartrequest.postJson(this.options.receiverEndpoint, <ILogPackageAuthenticated>{ const response = await plugins.smartrequest.postJson(this.options.receiverEndpoint, {
auth: this.options.passphrase, requestBody: {
logPackage: logPackageArg auth: plugins.smarthash.sha256FromStringSync(this.options.passphrase),
logPackage: logPackageArg
}
}); });
console.log(response.body);
} }
} }

View File

@ -1,4 +1,5 @@
import * as smarthash from '@pushrocks/smarthash';
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces'; import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
import * as smartrequest from '@pushrocks/smartrequest'; import * as smartrequest from '@pushrocks/smartrequest';
export { smartlogInterfaces, smartrequest }; export { smarthash, smartlogInterfaces, smartrequest };