Compare commits

...

8 Commits

Author SHA1 Message Date
912572cba5 2.0.13 2022-10-26 14:23:24 +02:00
b001ebaab8 fix(core): update 2022-10-26 14:23:24 +02:00
aa15da6b92 2.0.12 2022-10-09 18:57:31 +02:00
f144f27daa fix(core): update 2022-10-09 18:57:31 +02:00
a58c9a0541 2.0.11 2022-10-09 18:52:50 +02:00
649db1059c fix(core): update 2022-10-09 18:52:49 +02:00
e0c75716d7 2.0.10 2022-08-19 17:59:47 +02:00
009985c226 fix(core): update 2022-08-19 17:59:47 +02:00
10 changed files with 4310 additions and 14188 deletions

View File

@ -12,20 +12,12 @@ stages:
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
@ -36,6 +28,7 @@ auditProductionDependencies:
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
@ -96,10 +89,9 @@ codequality:
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
@ -119,11 +111,10 @@ trigger:
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci node install stable
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
- npmci command npm run buildDocs
tags:
- lossless
- docker

24
.vscode/launch.json vendored
View File

@ -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"
}
]
}

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com",
"gitscope": "apiglobal",
"gitrepo": "typedrequest",
"shortDescription": "make typed requests towards apis",
"description": "make typed requests towards apis",
"npmPackagename": "@apiglobal/typedrequest",
"license": "MIT",
"projectDomain": "api.global"

14133
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@apiglobal/typedrequest",
"version": "2.0.9",
"version": "2.0.13",
"private": false,
"description": "make typed requests towards apis",
"main": "dist_ts/index.js",
@ -11,7 +11,7 @@
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)",
"format": "(gitzone format)"
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.65",
@ -23,12 +23,12 @@
"@types/node": "^18.7.6"
},
"dependencies": {
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@apiglobal/typedrequest-interfaces": "^2.0.0",
"@pushrocks/isounique": "^1.0.5",
"@pushrocks/lik": "^6.0.0",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/webrequest": "^3.0.12"
"@pushrocks/webrequest": "^3.0.13"
},
"files": [
"ts/**/*",

4280
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiglobal/typedrequest',
version: '2.0.9',
version: '2.0.13',
description: 'make typed requests towards apis'
}

View File

@ -6,8 +6,6 @@ import { TypedTarget } from './typedrequest.classes.typedtarget.js';
const webrequestInstance = new plugins.webrequest.WebRequest();
export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest> {
/**
* in case we post against a url endpoint
*/
@ -23,7 +21,7 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
/**
* note the overloading is thought to deal with promises
* @param postEndPointArg
* @param methodArg
* @param methodArg
*/
constructor(postTarget: string | TypedTarget, methodArg: T['method']) {
if (typeof postTarget === 'string') {

View File

@ -23,7 +23,7 @@ export class TypedRouter {
* adds the handler to the routing map
* @param typedHandlerArg
*/
public addTypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest> (
public addTypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest>(
typedHandlerArg: TypedHandler<T>
) {
// lets check for deduplication
@ -41,15 +41,15 @@ export class TypedRouter {
* adds another sub typedRouter
* @param typedRequest
*/
public addTypedRouter (typedRouterArg: TypedRouter) {
const routerExists = this.routerMap.findSync(routerArg => routerArg === typedRouterArg)
public addTypedRouter(typedRouterArg: TypedRouter) {
const routerExists = this.routerMap.findSync((routerArg) => routerArg === typedRouterArg);
if (!routerExists) {
this.routerMap.add(typedRouterArg);
typedRouterArg.addTypedRouter(this);
}
}
public checkForTypedHandler (methodArg: string): boolean {
public checkForTypedHandler(methodArg: string): boolean {
return !!this.getTypedHandlerForMethod(methodArg);
}
@ -58,7 +58,7 @@ export class TypedRouter {
* @param methodArg
* @param checkUpstreamRouter
*/
public getTypedHandlerForMethod (
public getTypedHandlerForMethod(
methodArg: string,
checkedRouters: TypedRouter[] = []
): TypedHandler<any> {
@ -86,8 +86,10 @@ export class TypedRouter {
* if typedrequest object has correlation.phase === 'response' -> routes a typed request object to request fire event
* @param typedRequestArg
*/
public async routeAndAddResponse<T extends plugins.typedRequestInterfaces.ITypedRequest = plugins.typedRequestInterfaces.ITypedRequest> (typedRequestArg: T): Promise<T> {
if (typedRequestArg?.correlation?.phase === 'request') {
public async routeAndAddResponse<
T extends plugins.typedRequestInterfaces.ITypedRequest = plugins.typedRequestInterfaces.ITypedRequest
>(typedRequestArg: T, localRequestArg = false): Promise<T> {
if (typedRequestArg?.correlation?.phase === 'request' || localRequestArg) {
const typedHandler = this.getTypedHandlerForMethod(typedRequestArg.method);
if (!typedHandler) {
@ -110,7 +112,7 @@ export class TypedRouter {
} else {
console.log('received weirdly shaped request');
console.log(typedRequestArg);
return null
return null;
}
}
}

View File

@ -52,7 +52,9 @@ export class TypedTarget {
*/
public isAsync: boolean;
public async post<T extends plugins.typedRequestInterfaces.ITypedRequest>(payloadArg: T): Promise<T> {
public async post<T extends plugins.typedRequestInterfaces.ITypedRequest>(
payloadArg: T
): Promise<T> {
let responseInterest: plugins.lik.Interest<
string,
plugins.typedRequestInterfaces.ITypedRequest