fix(core): update
This commit is contained in:
		| @@ -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 | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								package.json
									
									
									
									
									
								
							| @@ -24,5 +24,16 @@ | |||||||
|   "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
									
								
								readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								readme.md
									
									
									
									
									
										Normal 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 | ||||||
|  | [](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
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -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'); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -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,6 +1,4 @@ | |||||||
| import * as smartpromise from '@pushrocks/smartpromise'; | import * as smartpromise from '@pushrocks/smartpromise'; | ||||||
|  |  | ||||||
| // pushrocks scope | // pushrocks scope | ||||||
| export { | export { smartpromise }; | ||||||
|   smartpromise |  | ||||||
| }; |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user