4 Commits

Author SHA1 Message Date
philkunz 2e42011eda 1.0.5 2019-08-07 16:42:25 +02:00
philkunz d9512ae3e8 fix(core): update 2019-08-07 16:42:24 +02:00
philkunz 32e72dc131 1.0.4 2019-08-07 16:34:34 +02:00
philkunz 5371bd058a fix(core): update 2019-08-07 16:34:34 +02:00
11 changed files with 100 additions and 59 deletions
+8 -6
View File
@@ -1,5 +1,5 @@
# gitzone ci_default # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
@@ -50,13 +50,13 @@ testLTS:
- docker - docker
- notpriv - notpriv
testSTABLE: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install lts
- npmci npm install - npmci npm install
- npmci npm test - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@@ -65,7 +65,7 @@ testSTABLE:
release: release:
stage: release stage: release
script: script:
- npmci node install stable - npmci node install lts
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
@@ -98,7 +98,9 @@ trigger:
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc
+25 -25
View File
@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartguard", "name": "@pushrocks/smartguard",
"version": "1.0.3", "version": "1.0.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -15,18 +15,18 @@
} }
}, },
"@babel/code-frame": { "@babel/code-frame": {
"version": "7.0.0", "version": "7.5.5",
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.0.0.tgz", "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz",
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/highlight": "^7.0.0" "@babel/highlight": "^7.0.0"
} }
}, },
"@babel/highlight": { "@babel/highlight": {
"version": "7.0.0", "version": "7.5.0",
"resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.0.0.tgz", "resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.5.0.tgz",
"integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.0.0", "chalk": "^2.0.0",
@@ -345,9 +345,9 @@
} }
}, },
"@pushrocks/tapbundle": { "@pushrocks/tapbundle": {
"version": "3.0.9", "version": "3.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.9.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.11.tgz",
"integrity": "sha512-+EMdP3iykAtx192sebHBAWCE+2RGUU7q9kp8iHe62H16WSbDDaDpnRNd6VHv389qTaZlubQb0d/FR+uQJUVUDQ==", "integrity": "sha512-s7epZfJZX+LsBVmIYvoaY4WtgPvRLnHZMVTpQAPJGMBqxJAQxhQ2wvGJjmqMAGhhznAHI6t4g+m0KTp3vFIRVg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@pushrocks/early": "^3.0.3", "@pushrocks/early": "^3.0.3",
@@ -374,9 +374,9 @@
"dev": true "dev": true
}, },
"@types/chai-as-promised": { "@types/chai-as-promised": {
"version": "7.1.0", "version": "7.1.1",
"resolved": "https://verdaccio.lossless.one/@types%2fchai-as-promised/-/chai-as-promised-7.1.0.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fchai-as-promised/-/chai-as-promised-7.1.1.tgz",
"integrity": "sha512-MFiW54UOSt+f2bRw8J7LgQeIvE/9b4oGvwU7XW30S9QGAiHGnU/fmiOprsyMkdmH2rl8xSPc0/yrQw8juXU6bQ==", "integrity": "sha512-dberBxQW/XWv6BMj0su1lV9/C9AUx5Hqu2pisuS6S4YK/Qt6vurcj/BmcbEsobIWWCQzhesNY8k73kIxx4X7Mg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/chai": "*" "@types/chai": "*"
@@ -494,9 +494,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "10.14.9", "version": "12.7.0",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.14.9.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.0.tgz",
"integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg==", "integrity": "sha512-vqcj1MVm2Sla4PpMfYKh1MyDN4D2f/mPIZD7RdAGqEsbE+JxfeqQHHVbRDQ0Nqn8i73gJa1HQ1Pu3+nH4Q0Yiw==",
"dev": true "dev": true
}, },
"@types/range-parser": { "@types/range-parser": {
@@ -1086,9 +1086,9 @@
"dev": true "dev": true
}, },
"esutils": { "esutils": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.2.tgz", "resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true "dev": true
}, },
"etag": { "etag": {
@@ -2276,9 +2276,9 @@
"dev": true "dev": true
}, },
"resolve": { "resolve": {
"version": "1.11.1", "version": "1.12.0",
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.11.1.tgz", "resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz",
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
"dev": true, "dev": true,
"requires": { "requires": {
"path-parse": "^1.0.6" "path-parse": "^1.0.6"
@@ -2586,9 +2586,9 @@
"dev": true "dev": true
}, },
"tslint": { "tslint": {
"version": "5.17.0", "version": "5.18.0",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.17.0.tgz", "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.18.0.tgz",
"integrity": "sha512-pflx87WfVoYepTet3xLfDOLDm9Jqi61UXIKePOuca0qoAZyrGWonDG9VTbji58Fy+8gciUn8Bt7y69+KEVjc/w==", "integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
+16 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartguard", "name": "@pushrocks/smartguard",
"version": "1.0.3", "version": "1.0.5",
"private": false, "private": false,
"description": "smart guards for validations", "description": "smart guards for validations",
"main": "dist/index.js", "main": "dist/index.js",
@@ -16,13 +16,24 @@
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15", "@gitzone/tstest": "^1.0.15",
"@pushrocks/smartexpress": "^3.0.35", "@pushrocks/smartexpress": "^3.0.35",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^3.0.11",
"@types/node": "^10.11.7", "@types/node": "^12.7.0",
"tslint": "^5.11.0", "tslint": "^5.18.0",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.16" "@pushrocks/smartrequest": "^1.1.16"
} },
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
} }
+26
View File
@@ -0,0 +1,26 @@
# @pushrocks/smartguard
smart guards for validations
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartguard)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartguard)
* [github.com (source mirror)](https://github.com/pushrocks/smartguard)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartguard/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smartguard/badges/master/build.svg)](https://gitlab.com/pushrocks/smartguard/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartguard/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartguard/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartguard.svg)](https://www.npmjs.com/package/@pushrocks/smartguard)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartguard/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartguard)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
+11 -5
View File
@@ -19,7 +19,7 @@ tap.test('should be able to create smartguards for a request', async () => {
req: smartexpress.Request; req: smartexpress.Request;
res: smartexpress.Response; res: smartexpress.Response;
} }
const ipGuard = new smartguard.Guard<IRequestGuardData>(async (dataArg) => { const ipGuard = new smartguard.Guard<IRequestGuardData>(async dataArg => {
console.log('executing ip guard'); console.log('executing ip guard');
if (dataArg) { if (dataArg) {
console.log('ip guard succeeded'); console.log('ip guard succeeded');
@@ -30,15 +30,21 @@ tap.test('should be able to create smartguards for a request', async () => {
} }
}); });
smartexpressInstance.addRoute('/testroute', new smartexpress.Handler('ALL', async (req, res) => { smartexpressInstance.addRoute(
await smartguard.passGuards({ '/testroute',
new smartexpress.Handler('ALL', async (req, res) => {
await smartguard.passGuards(
{
req, req,
res res
}, [ipGuard]); },
[ipGuard]
);
console.log('ip guard said ok'); console.log('ip guard said ok');
res.status(200); res.status(200);
res.send('hi'); res.send('hi');
})); })
);
console.log('Got here ok'); console.log('Got here ok');
}); });
+1 -1
View File
@@ -8,7 +8,7 @@ export const passGuards = async <T>(dataArg: T, guards: Array<Guard<T>>) => {
const guardSet = new GuardSet<T>(guards); const guardSet = new GuardSet<T>(guards);
const results = await guardSet.executeGuardsWithData(dataArg); const results = await guardSet.executeGuardsWithData(dataArg);
for (const result of results) { for (const result of results) {
if(!result) { if (!result) {
return; return;
} }
} }
+1 -3
View File
@@ -3,6 +3,4 @@ import * as plugins from './smartguard.plugins';
/** /**
* a block handler is used * a block handler is used
*/ */
export class BlockHandler { export class BlockHandler {}
}
+1 -3
View File
@@ -1,6 +1,4 @@
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
// pushrocks scope // pushrocks scope
export { export { smartpromise };
smartpromise
};