Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e42011eda | |||
| d9512ae3e8 | |||
| 32e72dc131 | |||
| 5371bd058a |
+8
-6
@@ -1,5 +1,5 @@
|
||||
# gitzone ci_default
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
@@ -50,13 +50,13 @@ testLTS:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
@@ -65,7 +65,7 @@ testSTABLE:
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci node install lts
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
@@ -98,7 +98,9 @@ trigger:
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:18-dind
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
|
||||
Generated
+25
-25
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartguard",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -15,18 +15,18 @@
|
||||
}
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.0.0.tgz",
|
||||
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
|
||||
"version": "7.5.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz",
|
||||
"integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/highlight": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"@babel/highlight": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.0.0.tgz",
|
||||
"integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.5.0.tgz",
|
||||
"integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.0.0",
|
||||
@@ -345,9 +345,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/tapbundle": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.9.tgz",
|
||||
"integrity": "sha512-+EMdP3iykAtx192sebHBAWCE+2RGUU7q9kp8iHe62H16WSbDDaDpnRNd6VHv389qTaZlubQb0d/FR+uQJUVUDQ==",
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.11.tgz",
|
||||
"integrity": "sha512-s7epZfJZX+LsBVmIYvoaY4WtgPvRLnHZMVTpQAPJGMBqxJAQxhQ2wvGJjmqMAGhhznAHI6t4g+m0KTp3vFIRVg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
@@ -374,9 +374,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/chai-as-promised": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai-as-promised/-/chai-as-promised-7.1.0.tgz",
|
||||
"integrity": "sha512-MFiW54UOSt+f2bRw8J7LgQeIvE/9b4oGvwU7XW30S9QGAiHGnU/fmiOprsyMkdmH2rl8xSPc0/yrQw8juXU6bQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||
"integrity": "sha512-dberBxQW/XWv6BMj0su1lV9/C9AUx5Hqu2pisuS6S4YK/Qt6vurcj/BmcbEsobIWWCQzhesNY8k73kIxx4X7Mg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "*"
|
||||
@@ -494,9 +494,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.14.9",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.14.9.tgz",
|
||||
"integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg==",
|
||||
"version": "12.7.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.0.tgz",
|
||||
"integrity": "sha512-vqcj1MVm2Sla4PpMfYKh1MyDN4D2f/mPIZD7RdAGqEsbE+JxfeqQHHVbRDQ0Nqn8i73gJa1HQ1Pu3+nH4Q0Yiw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/range-parser": {
|
||||
@@ -1086,9 +1086,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.2.tgz",
|
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"dev": true
|
||||
},
|
||||
"etag": {
|
||||
@@ -2276,9 +2276,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.11.1.tgz",
|
||||
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==",
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz",
|
||||
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.6"
|
||||
@@ -2586,9 +2586,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.17.0",
|
||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.17.0.tgz",
|
||||
"integrity": "sha512-pflx87WfVoYepTet3xLfDOLDm9Jqi61UXIKePOuca0qoAZyrGWonDG9VTbji58Fy+8gciUn8Bt7y69+KEVjc/w==",
|
||||
"version": "5.18.0",
|
||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.18.0.tgz",
|
||||
"integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
|
||||
+16
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartguard",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"private": false,
|
||||
"description": "smart guards for validations",
|
||||
"main": "dist/index.js",
|
||||
@@ -16,13 +16,24 @@
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/smartexpress": "^3.0.35",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.7",
|
||||
"tslint": "^5.11.0",
|
||||
"@pushrocks/tapbundle": "^3.0.11",
|
||||
"@types/node": "^12.7.0",
|
||||
"tslint": "^5.18.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartrequest": "^1.1.16"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"ts/*",
|
||||
"ts_web/*",
|
||||
"dist/*",
|
||||
"dist_web/*",
|
||||
"dist_ts_web/*",
|
||||
"assets/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
[](https://gitlab.com/pushrocks/smartguard/commits/master)
|
||||
[](https://gitlab.com/pushrocks/smartguard/commits/master)
|
||||
[](https://www.npmjs.com/package/@pushrocks/smartguard)
|
||||
[](https://snyk.io/test/npm/@pushrocks/smartguard)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](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)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
+16
-10
@@ -19,7 +19,7 @@ tap.test('should be able to create smartguards for a request', async () => {
|
||||
req: smartexpress.Request;
|
||||
res: smartexpress.Response;
|
||||
}
|
||||
const ipGuard = new smartguard.Guard<IRequestGuardData>(async (dataArg) => {
|
||||
const ipGuard = new smartguard.Guard<IRequestGuardData>(async dataArg => {
|
||||
console.log('executing ip guard');
|
||||
if (dataArg) {
|
||||
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) => {
|
||||
await smartguard.passGuards({
|
||||
req,
|
||||
res
|
||||
}, [ipGuard]);
|
||||
console.log('ip guard said ok');
|
||||
res.status(200);
|
||||
res.send('hi');
|
||||
}));
|
||||
smartexpressInstance.addRoute(
|
||||
'/testroute',
|
||||
new smartexpress.Handler('ALL', async (req, res) => {
|
||||
await smartguard.passGuards(
|
||||
{
|
||||
req,
|
||||
res
|
||||
},
|
||||
[ipGuard]
|
||||
);
|
||||
console.log('ip guard said ok');
|
||||
res.status(200);
|
||||
res.send('hi');
|
||||
})
|
||||
);
|
||||
console.log('Got here ok');
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ export const passGuards = async <T>(dataArg: T, guards: Array<Guard<T>>) => {
|
||||
const guardSet = new GuardSet<T>(guards);
|
||||
const results = await guardSet.executeGuardsWithData(dataArg);
|
||||
for (const result of results) {
|
||||
if(!result) {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,4 @@ import * as plugins from './smartguard.plugins';
|
||||
/**
|
||||
* a block handler is used
|
||||
*/
|
||||
export class BlockHandler {
|
||||
|
||||
}
|
||||
export class BlockHandler {}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
// pushrocks scope
|
||||
export {
|
||||
smartpromise
|
||||
};
|
||||
export { smartpromise };
|
||||
|
||||
Reference in New Issue
Block a user