fix(core): update
This commit is contained in:
parent
9738d88ec7
commit
d8d7b135f7
@ -12,29 +12,25 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- pnpm install -g pnpm
|
||||||
|
- pnpm install -g @shipzone/npmci
|
||||||
|
- npmci npm prepare
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
auditProductionDependencies:
|
||||||
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 command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm install --production --ignore-scripts
|
- npmci command pnpm audit --audit-level=high --prod
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
@ -42,11 +38,10 @@ 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 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 --only=dev
|
- npmci command pnpm audit --audit-level=high --dev
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
@ -57,7 +52,6 @@ auditDevDependencies:
|
|||||||
testStable:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -68,7 +62,6 @@ testStable:
|
|||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
@ -97,10 +90,9 @@ codequality:
|
|||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
@ -120,11 +112,9 @@ trigger:
|
|||||||
pages:
|
pages:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci node install stable
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command tsdoc
|
- npmci command npm run buildDocs
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${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"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)"
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.63",
|
"@gitzone/tsbuild": "^2.1.63",
|
||||||
|
46
test/test.ts
46
test/test.ts
@ -4,17 +4,18 @@ import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
|||||||
|
|
||||||
import * as typedsocket from '../ts/index.js';
|
import * as typedsocket from '../ts/index.js';
|
||||||
|
|
||||||
interface IRequest_Client_Server extends typedrequestInterfaces.implementsTR<
|
interface IRequest_Client_Server
|
||||||
typedrequestInterfaces.ITypedRequest,
|
extends typedrequestInterfaces.implementsTR<
|
||||||
IRequest_Client_Server
|
typedrequestInterfaces.ITypedRequest,
|
||||||
> {
|
IRequest_Client_Server
|
||||||
|
> {
|
||||||
method: 'sayhi';
|
method: 'sayhi';
|
||||||
request: {
|
request: {
|
||||||
greeting: string;
|
greeting: string;
|
||||||
};
|
};
|
||||||
response: {
|
response: {
|
||||||
answer: string
|
answer: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let testTypedSocketServer: typedsocket.TypedSocket;
|
let testTypedSocketServer: typedsocket.TypedSocket;
|
||||||
@ -23,16 +24,21 @@ let testTypedSocketClient: typedsocket.TypedSocket;
|
|||||||
const testTypedRouter = new typedrequest.TypedRouter();
|
const testTypedRouter = new typedrequest.TypedRouter();
|
||||||
|
|
||||||
tap.test('should add some handlers', async () => {
|
tap.test('should add some handlers', async () => {
|
||||||
testTypedRouter.addTypedHandler<IRequest_Client_Server>(new typedrequest.TypedHandler('sayhi', async requestData => {
|
testTypedRouter.addTypedHandler<IRequest_Client_Server>(
|
||||||
return {
|
new typedrequest.TypedHandler('sayhi', async (requestData) => {
|
||||||
answer: `ok, got it : ${requestData.greeting}`
|
return {
|
||||||
}
|
answer: `ok, got it : ${requestData.greeting}`,
|
||||||
}));
|
};
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('should create Server and Client', async (tools) => {
|
tap.test('should create Server and Client', async (tools) => {
|
||||||
testTypedSocketServer = await typedsocket.TypedSocket.createServer(testTypedRouter);
|
testTypedSocketServer = await typedsocket.TypedSocket.createServer(testTypedRouter);
|
||||||
testTypedSocketClient = await typedsocket.TypedSocket.createClient(testTypedRouter, 'http://localhost:3000');
|
testTypedSocketClient = await typedsocket.TypedSocket.createClient(
|
||||||
|
testTypedRouter,
|
||||||
|
'http://localhost:3000'
|
||||||
|
);
|
||||||
console.log('test: waiting 5 seconds');
|
console.log('test: waiting 5 seconds');
|
||||||
await tools.delayFor(5000);
|
await tools.delayFor(5000);
|
||||||
await testTypedSocketServer.stop();
|
await testTypedSocketServer.stop();
|
||||||
@ -46,22 +52,24 @@ tap.test('should create Server and Client', async (tools) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should process messages from both sides', async () => {
|
tap.test('should process messages from both sides', async () => {
|
||||||
const myServerSideTypedRequest = testTypedSocketServer.createTypedRequest<IRequest_Client_Server>('sayhi');
|
const myServerSideTypedRequest =
|
||||||
const myClientSideTypedRequest = testTypedSocketClient.createTypedRequest<IRequest_Client_Server>('sayhi');
|
testTypedSocketServer.createTypedRequest<IRequest_Client_Server>('sayhi');
|
||||||
|
const myClientSideTypedRequest =
|
||||||
|
testTypedSocketClient.createTypedRequest<IRequest_Client_Server>('sayhi');
|
||||||
const response = await myClientSideTypedRequest.fire({
|
const response = await myClientSideTypedRequest.fire({
|
||||||
greeting: 'that is a greeting from the client'
|
greeting: 'that is a greeting from the client',
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
const response2 = await myServerSideTypedRequest.fire({
|
const response2 = await myServerSideTypedRequest.fire({
|
||||||
greeting: 'that is a greeting from the server'
|
greeting: 'that is a greeting from the server',
|
||||||
});
|
});
|
||||||
console.log(response2);
|
console.log(response2);
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.test('should disconnect', async (tools) => {
|
tap.test('should disconnect', async (tools) => {
|
||||||
await testTypedSocketClient.stop();
|
await testTypedSocketClient.stop();
|
||||||
await testTypedSocketServer.stop();
|
await testTypedSocketServer.stop();
|
||||||
tools.delayFor(1000).then(() => process.exit(0));
|
tools.delayFor(1000).then(() => process.exit(0));
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@apiglobal/typedsocket',
|
name: '@apiglobal/typedsocket',
|
||||||
version: '2.0.7',
|
version: '2.0.8',
|
||||||
description: 'a typedrequest extension supporting websockets'
|
description: 'a typedrequest extension supporting websockets'
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
import * as typedrequest from '@apiglobal/typedrequest';
|
import * as typedrequest from '@apiglobal/typedrequest';
|
||||||
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
||||||
|
|
||||||
export {
|
export { typedrequest, typedrequestInterfaces };
|
||||||
typedrequest,
|
|
||||||
typedrequestInterfaces,
|
|
||||||
}
|
|
||||||
|
|
||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as isohash from '@pushrocks/isohash';
|
import * as isohash from '@pushrocks/isohash';
|
||||||
@ -13,9 +10,4 @@ import * as smartjson from '@pushrocks/smartjson';
|
|||||||
import * as smartsocket from '@pushrocks/smartsocket';
|
import * as smartsocket from '@pushrocks/smartsocket';
|
||||||
import * as smartstring from '@pushrocks/smartstring';
|
import * as smartstring from '@pushrocks/smartstring';
|
||||||
|
|
||||||
export {
|
export { isohash, smartjson, smartsocket, smartstring };
|
||||||
isohash,
|
|
||||||
smartjson,
|
|
||||||
smartsocket,
|
|
||||||
smartstring
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user