fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-06 15:05:29 +00:00
parent 78e8171a6a
commit 046059d228
7 changed files with 39 additions and 29 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- 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
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
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +93,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

View File

@ -41,5 +41,8 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}
}

View File

@ -49,9 +49,9 @@ interface ITestReqRes {
tap.test('should create a typedHandler', async () => {
// lets use the interface in a TypedHandler
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async reqArg => {
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async (reqArg) => {
return {
surname: 'wow'
surname: 'wow',
};
});
});
@ -60,7 +60,7 @@ tap.test('should spawn a server to test with', async () => {
testServer = new smartexpress.Server({
cors: true,
forceSsl: false,
port: 3000
port: 3000,
});
});
@ -83,7 +83,7 @@ tap.test('should fire a request', async () => {
'hi'
);
const response = await typedRequest.fire({
name: 'really'
name: 'really',
});
console.log('this is the response:');
console.log(response);

View File

@ -19,9 +19,9 @@ interface ITestReqRes {
tap.test('should create a typedHandler', async () => {
// lets use the interface in a TypedHandler
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async reqArg => {
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async (reqArg) => {
return {
surname: 'wow'
surname: 'wow',
};
});
});
@ -30,7 +30,7 @@ tap.test('should spawn a server to test with', async () => {
testServer = new smartexpress.Server({
cors: true,
forceSsl: false,
port: 3000
port: 3000,
});
});
@ -53,7 +53,7 @@ tap.test('should fire a request', async () => {
'hi'
);
const response = await typedRequest.fire({
name: 'really'
name: 'really',
});
console.log('this is the response:');
console.log(response);

View File

@ -28,7 +28,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
);
}
let typedResponseError: TypedResponseError;
const response = await this.handlerFunction(typedRequestArg.request).catch(e => {
const response = await this.handlerFunction(typedRequestArg.request).catch((e) => {
if (e instanceof TypedResponseError) {
typedResponseError = e;
} else {
@ -39,7 +39,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
if (typedResponseError) {
typedRequestArg.error = {
text: typedResponseError.errorText,
data: typedResponseError.errorData
data: typedResponseError.errorData,
};
}
@ -47,7 +47,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
typedRequestArg.response = response;
}
typedRequestArg?.correlation?.phase ? typedRequestArg.correlation.phase = 'response' : null;
typedRequestArg?.correlation?.phase ? (typedRequestArg.correlation.phase = 'response') : null;
return typedRequestArg;
}

View File

@ -29,15 +29,12 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
public method: string;
// STATIC
constructor(
postEndPointArg: string | IPostMethod,
methodArg: T['method']
)
constructor(postEndPointArg: string | IPostMethod, methodArg: T['method']);
constructor(
postEndPointArg: string | IPostMethodWithTypedRouter,
methodArg: T['method'],
typedrouterRefArg?: TypedRouter)
{
typedrouterRefArg?: TypedRouter
) {
if (typeof postEndPointArg === 'string') {
this.urlEndPoint = postEndPointArg;
} else {
@ -67,8 +64,8 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
responseBody = response;
} else {
let responseInterest: plugins.lik.Interest<
string,
plugins.typedRequestInterfaces.ITypedRequest
string,
plugins.typedRequestInterfaces.ITypedRequest
>;
// having a typedrouter allows us to work with async request response cycles.
if (this.typedRouterRef) {