fix(core): update
This commit is contained in:
parent
6788fbf715
commit
8be8ce109e
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
|||||||
|
|
||||||
# builds
|
# builds
|
||||||
dist/
|
dist/
|
||||||
dist_web/
|
dist_*/
|
||||||
dist_serve/
|
|
||||||
dist_ts_web/
|
|
||||||
|
|
||||||
# custom
|
# custom
|
@ -24,13 +24,14 @@ mirror:
|
|||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
snyk:
|
audit:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
4101
package-lock.json
generated
4101
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
@ -3,28 +3,28 @@
|
|||||||
"version": "1.0.29",
|
"version": "1.0.29",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "make typed requests towards apis",
|
"description": "make typed requests towards apis",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)",
|
"build": "(tsbuild --web)",
|
||||||
"format": "(gitzone format)"
|
"format": "(gitzone format)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@gitzone/tsbuild": "^2.1.24",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@gitzone/tstest": "^1.0.33",
|
||||||
"@pushrocks/smartexpress": "^3.0.57",
|
"@pushrocks/smartexpress": "^3.0.69",
|
||||||
"@pushrocks/tapbundle": "^3.2.0",
|
"@pushrocks/tapbundle": "^3.2.1",
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^14.0.13",
|
||||||
"tslint": "^6.0.0",
|
"tslint": "^6.1.2",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.12",
|
"@apiglobal/typedrequest-interfaces": "^1.0.13",
|
||||||
"@pushrocks/lik": "^3.0.17",
|
"@pushrocks/lik": "^4.0.13",
|
||||||
"@pushrocks/smartdelay": "^2.0.6",
|
"@pushrocks/smartdelay": "^2.0.9",
|
||||||
"@pushrocks/smartjson": "^3.0.10",
|
"@pushrocks/smartjson": "^3.0.10",
|
||||||
"@pushrocks/smartrequest": "^1.1.47"
|
"@pushrocks/smartrequest": "^1.1.47"
|
||||||
},
|
},
|
||||||
@ -32,7 +32,8 @@
|
|||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
"ts_web/**/*",
|
"ts_web/**/*",
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"dist_web/**/*",
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
|
25
readme.md
25
readme.md
@ -8,16 +8,27 @@ make typed requests towards apis
|
|||||||
* [docs (typedoc)](https://apiglobal.gitlab.io/typedrequest/)
|
* [docs (typedoc)](https://apiglobal.gitlab.io/typedrequest/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[![pipeline status](https://gitlab.com/apiglobal/typedrequest/badges/master/pipeline.svg)](https://gitlab.com/apiglobal/typedrequest/commits/master)
|
|
||||||
[![coverage report](https://gitlab.com/apiglobal/typedrequest/badges/master/coverage.svg)](https://gitlab.com/apiglobal/typedrequest/commits/master)
|
Status Category | Status Badge
|
||||||
[![npm downloads per month](https://img.shields.io/npm/dm/@apiglobal/typedrequest.svg)](https://www.npmjs.com/package/@apiglobal/typedrequest)
|
-- | --
|
||||||
[![Known Vulnerabilities](https://snyk.io/test/npm/@apiglobal/typedrequest/badge.svg)](https://snyk.io/test/npm/@apiglobal/typedrequest)
|
GitLab Pipelines | [![pipeline status](https://gitlab.com/apiglobal/typedrequest/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||||
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/apiglobal/typedrequest/badges/master/coverage.svg)](https://lossless.cloud)
|
||||||
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
npm | [![npm downloads per month](https://badgen.net/npm/dy/@apiglobal/typedrequest)](https://lossless.cloud)
|
||||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
|
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/apiglobal/typedrequest)](https://lossless.cloud)
|
||||||
|
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||||
|
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiglobal/typedrequest)](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiglobal/typedrequest)](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiglobal/typedrequest)](https://lossless.cloud)
|
||||||
|
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
||||||
|
|
||||||
## Usage
|
## 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). :)
|
||||||
|
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
|
@ -10,11 +10,9 @@ import { TypedHandler } from './typedrequest.classes.typedhandler';
|
|||||||
export class TypedRouter {
|
export class TypedRouter {
|
||||||
public upstreamTypedRouter: TypedRouter;
|
public upstreamTypedRouter: TypedRouter;
|
||||||
|
|
||||||
public routerMap = new plugins.lik.Objectmap<
|
public routerMap = new plugins.lik.ObjectMap<TypedRouter>();
|
||||||
TypedRouter
|
|
||||||
>();
|
|
||||||
|
|
||||||
public handlerMap = new plugins.lik.Objectmap<
|
public handlerMap = new plugins.lik.ObjectMap<
|
||||||
TypedHandler<plugins.typedRequestInterfaces.ITypedRequest>
|
TypedHandler<plugins.typedRequestInterfaces.ITypedRequest>
|
||||||
>();
|
>();
|
||||||
|
|
||||||
@ -28,7 +26,9 @@ export class TypedRouter {
|
|||||||
// lets check for deduplication
|
// lets check for deduplication
|
||||||
const existingTypedHandler = this.getTypedHandlerForMethod(typedHandlerArg.method);
|
const existingTypedHandler = this.getTypedHandlerForMethod(typedHandlerArg.method);
|
||||||
if (existingTypedHandler) {
|
if (existingTypedHandler) {
|
||||||
throw new Error(`a TypedHandler for ${typedHandlerArg.method} alredy exists! Can't add another one.`);
|
throw new Error(
|
||||||
|
`a TypedHandler for ${typedHandlerArg.method} alredy exists! Can't add another one.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handlerMap.add(typedHandlerArg);
|
this.handlerMap.add(typedHandlerArg);
|
||||||
@ -47,7 +47,7 @@ export class TypedRouter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public checkForTypedHandler(methodArg: string): boolean {
|
public checkForTypedHandler(methodArg: string): boolean {
|
||||||
return !! this.getTypedHandlerForMethod(methodArg);
|
return !!this.getTypedHandlerForMethod(methodArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +55,10 @@ export class TypedRouter {
|
|||||||
* @param methodArg
|
* @param methodArg
|
||||||
* @param checkUpstreamRouter
|
* @param checkUpstreamRouter
|
||||||
*/
|
*/
|
||||||
public getTypedHandlerForMethod(methodArg: string, checkUpstreamRouter = true): TypedHandler<any> {
|
public getTypedHandlerForMethod(
|
||||||
|
methodArg: string,
|
||||||
|
checkUpstreamRouter = true
|
||||||
|
): TypedHandler<any> {
|
||||||
let typedHandler: TypedHandler<any>;
|
let typedHandler: TypedHandler<any>;
|
||||||
|
|
||||||
if (this.upstreamTypedRouter && checkUpstreamRouter) {
|
if (this.upstreamTypedRouter && checkUpstreamRouter) {
|
||||||
@ -77,7 +80,6 @@ export class TypedRouter {
|
|||||||
return typedHandler;
|
return typedHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* routes a typed request to a handler
|
* routes a typed request to a handler
|
||||||
* @param typedRequestArg
|
* @param typedRequestArg
|
||||||
|
Loading…
Reference in New Issue
Block a user