Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6003625186 | |||
| 3b50e9c8cc | |||
| 2e42011eda | |||
| d9512ae3e8 | |||
| 32e72dc131 | |||
| 5371bd058a |
+1
-3
@@ -15,8 +15,6 @@ node_modules/
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
dist_*/
|
||||
|
||||
# custom
|
||||
+47
-24
@@ -1,10 +1,10 @@
|
||||
# gitzone ci_default
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
@@ -12,6 +12,9 @@ stages:
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- npm install -g @shipzone/npmci
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
@@ -19,38 +22,42 @@ mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
@@ -60,7 +67,17 @@ testSTABLE:
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
@@ -70,6 +87,7 @@ release:
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
@@ -79,11 +97,14 @@ release:
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci command npm install -g typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
@@ -94,18 +115,20 @@ trigger:
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
|
||||
Vendored
+3
-21
@@ -2,28 +2,10 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "current file",
|
||||
"type": "node",
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"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"
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+26
@@ -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", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitrepo": "smartguard",
|
||||
"shortDescription": "smart guards for validations",
|
||||
"description": "smart guards for validations",
|
||||
"npmPackagename": "@pushrocks/smartguard",
|
||||
"license": "MIT",
|
||||
"projectDomain": "push.rocks"
|
||||
|
||||
Generated
+17656
-1561
File diff suppressed because it is too large
Load Diff
+27
-11
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "@pushrocks/smartguard",
|
||||
"version": "1.0.3",
|
||||
"version": "2.0.0",
|
||||
"private": false,
|
||||
"description": "smart guards for validations",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@@ -13,16 +14,31 @@
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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",
|
||||
"@gitzone/tsbuild": "^2.1.60",
|
||||
"@gitzone/tstest": "^1.0.69",
|
||||
"@pushrocks/smartexpress": "^3.0.110",
|
||||
"@pushrocks/tapbundle": "^5.0.2",
|
||||
"@types/node": "^17.0.22",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartrequest": "^1.1.16"
|
||||
}
|
||||
"@pushrocks/smartrequest": "^1.1.56"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_*/**/*",
|
||||
"dist_ts/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# @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
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
|
||||
## 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)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartguard from '../ts/index';
|
||||
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartguard from '../ts/index.js';
|
||||
import * as smartexpress from '@pushrocks/smartexpress';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
|
||||
@@ -10,7 +10,7 @@ tap.test('should create a demo smartexpress instance', async () => {
|
||||
cors: true,
|
||||
forceSsl: false,
|
||||
defaultAnswer: async () => 'hi there',
|
||||
port: 3211
|
||||
port: 3211,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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({
|
||||
smartexpressInstance.addRoute(
|
||||
'/testroute',
|
||||
new smartexpress.Handler('ALL', async (req, res) => {
|
||||
await smartguard.passGuards(
|
||||
{
|
||||
req,
|
||||
res
|
||||
}, [ipGuard]);
|
||||
res,
|
||||
},
|
||||
[ipGuard]
|
||||
);
|
||||
console.log('ip guard said ok');
|
||||
res.status(200);
|
||||
res.send('hi');
|
||||
}));
|
||||
})
|
||||
);
|
||||
console.log('Got here ok');
|
||||
});
|
||||
|
||||
@@ -48,7 +54,7 @@ tap.test('should start server with guards in place', async () => {
|
||||
|
||||
tap.test('should execute a request', async () => {
|
||||
const response = await smartrequest.request('http://localhost:3211/testroute', {
|
||||
method: 'GET'
|
||||
method: 'GET',
|
||||
});
|
||||
});
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
import * as plugins from './smartguard.plugins';
|
||||
import { Guard } from './smartguard.classes.guard';
|
||||
import { GuardSet } from './smartguard.classes.guardset';
|
||||
export * from './smartguard.classes.guard';
|
||||
import * as plugins from './smartguard.plugins.js';
|
||||
import { Guard } from './smartguard.classes.guard.js';
|
||||
import { GuardSet } from './smartguard.classes.guardset.js';
|
||||
export * from './smartguard.classes.guard.js';
|
||||
|
||||
export const passGuards = async <T>(dataArg: T, guards: Array<Guard<T>>) => {
|
||||
const done = plugins.smartpromise.defer();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import * as plugins from './smartguard.plugins';
|
||||
import * as plugins from './smartguard.plugins.js';
|
||||
|
||||
/**
|
||||
* a block handler is used
|
||||
*/
|
||||
export class BlockHandler {
|
||||
|
||||
}
|
||||
export class BlockHandler {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './smartguard.plugins';
|
||||
import * as plugins from './smartguard.plugins.js';
|
||||
|
||||
export type TGuardFunction<T> = (dataArg: T) => Promise<boolean>;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as plugins from './smartguard.plugins';
|
||||
import { Guard } from './smartguard.classes.guard';
|
||||
import * as plugins from './smartguard.plugins.js';
|
||||
import { Guard } from './smartguard.classes.guard.js';
|
||||
|
||||
/**
|
||||
* a guardSet is a set of guards that need to be fulfilled
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
// pushrocks scope
|
||||
export {
|
||||
smartpromise
|
||||
};
|
||||
export { smartpromise };
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
Reference in New Issue
Block a user