fix(core): update
This commit is contained in:
parent
78e8171a6a
commit
046059d228
@ -19,23 +19,35 @@ mirror:
|
|||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- 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
|
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 npm config set registry https://registry.npmjs.org
|
- 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:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
@ -50,9 +62,7 @@ testStable:
|
|||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
@ -63,9 +73,7 @@ testBuild:
|
|||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@ -85,6 +93,8 @@ release:
|
|||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g tslint typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,8 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -49,9 +49,9 @@ interface ITestReqRes {
|
|||||||
|
|
||||||
tap.test('should create a typedHandler', async () => {
|
tap.test('should create a typedHandler', async () => {
|
||||||
// lets use the interface in a TypedHandler
|
// lets use the interface in a TypedHandler
|
||||||
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async reqArg => {
|
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async (reqArg) => {
|
||||||
return {
|
return {
|
||||||
surname: 'wow'
|
surname: 'wow',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ tap.test('should spawn a server to test with', async () => {
|
|||||||
testServer = new smartexpress.Server({
|
testServer = new smartexpress.Server({
|
||||||
cors: true,
|
cors: true,
|
||||||
forceSsl: false,
|
forceSsl: false,
|
||||||
port: 3000
|
port: 3000,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ tap.test('should fire a request', async () => {
|
|||||||
'hi'
|
'hi'
|
||||||
);
|
);
|
||||||
const response = await typedRequest.fire({
|
const response = await typedRequest.fire({
|
||||||
name: 'really'
|
name: 'really',
|
||||||
});
|
});
|
||||||
console.log('this is the response:');
|
console.log('this is the response:');
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
@ -19,9 +19,9 @@ interface ITestReqRes {
|
|||||||
|
|
||||||
tap.test('should create a typedHandler', async () => {
|
tap.test('should create a typedHandler', async () => {
|
||||||
// lets use the interface in a TypedHandler
|
// lets use the interface in a TypedHandler
|
||||||
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async reqArg => {
|
testTypedHandler = new typedrequest.TypedHandler<ITestReqRes>('hi', async (reqArg) => {
|
||||||
return {
|
return {
|
||||||
surname: 'wow'
|
surname: 'wow',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -30,7 +30,7 @@ tap.test('should spawn a server to test with', async () => {
|
|||||||
testServer = new smartexpress.Server({
|
testServer = new smartexpress.Server({
|
||||||
cors: true,
|
cors: true,
|
||||||
forceSsl: false,
|
forceSsl: false,
|
||||||
port: 3000
|
port: 3000,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ tap.test('should fire a request', async () => {
|
|||||||
'hi'
|
'hi'
|
||||||
);
|
);
|
||||||
const response = await typedRequest.fire({
|
const response = await typedRequest.fire({
|
||||||
name: 'really'
|
name: 'really',
|
||||||
});
|
});
|
||||||
console.log('this is the response:');
|
console.log('this is the response:');
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
@ -28,7 +28,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
let typedResponseError: TypedResponseError;
|
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) {
|
if (e instanceof TypedResponseError) {
|
||||||
typedResponseError = e;
|
typedResponseError = e;
|
||||||
} else {
|
} else {
|
||||||
@ -39,7 +39,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
|
|||||||
if (typedResponseError) {
|
if (typedResponseError) {
|
||||||
typedRequestArg.error = {
|
typedRequestArg.error = {
|
||||||
text: typedResponseError.errorText,
|
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.response = response;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedRequestArg?.correlation?.phase ? typedRequestArg.correlation.phase = 'response' : null;
|
typedRequestArg?.correlation?.phase ? (typedRequestArg.correlation.phase = 'response') : null;
|
||||||
|
|
||||||
return typedRequestArg;
|
return typedRequestArg;
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,12 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
|
|||||||
public method: string;
|
public method: string;
|
||||||
|
|
||||||
// STATIC
|
// STATIC
|
||||||
constructor(
|
constructor(postEndPointArg: string | IPostMethod, methodArg: T['method']);
|
||||||
postEndPointArg: string | IPostMethod,
|
|
||||||
methodArg: T['method']
|
|
||||||
)
|
|
||||||
constructor(
|
constructor(
|
||||||
postEndPointArg: string | IPostMethodWithTypedRouter,
|
postEndPointArg: string | IPostMethodWithTypedRouter,
|
||||||
methodArg: T['method'],
|
methodArg: T['method'],
|
||||||
typedrouterRefArg?: TypedRouter)
|
typedrouterRefArg?: TypedRouter
|
||||||
{
|
) {
|
||||||
if (typeof postEndPointArg === 'string') {
|
if (typeof postEndPointArg === 'string') {
|
||||||
this.urlEndPoint = postEndPointArg;
|
this.urlEndPoint = postEndPointArg;
|
||||||
} else {
|
} else {
|
||||||
@ -67,8 +64,8 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
|
|||||||
responseBody = response;
|
responseBody = response;
|
||||||
} else {
|
} else {
|
||||||
let responseInterest: plugins.lik.Interest<
|
let responseInterest: plugins.lik.Interest<
|
||||||
string,
|
string,
|
||||||
plugins.typedRequestInterfaces.ITypedRequest
|
plugins.typedRequestInterfaces.ITypedRequest
|
||||||
>;
|
>;
|
||||||
// having a typedrouter allows us to work with async request response cycles.
|
// having a typedrouter allows us to work with async request response cycles.
|
||||||
if (this.typedRouterRef) {
|
if (this.typedRouterRef) {
|
||||||
|
Loading…
Reference in New Issue
Block a user