Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b80346d742 | |||
| aced21a968 | |||
| fa40e3a5dc | |||
| 9bb0008381 | |||
| 67bbea8811 | |||
| dc826cb65a | |||
| 1266a814c6 | |||
| 25a7397548 | |||
| 5009bec70c | |||
| d8d7b135f7 |
@@ -12,29 +12,25 @@ stages:
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- pnpm install -g pnpm
|
||||
- pnpm install -g @shipzone/npmci
|
||||
- npmci npm prepare
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
# ====================
|
||||
# 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
|
||||
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
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --prod
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
@@ -42,11 +38,10 @@ 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 --only=dev
|
||||
- npmci command pnpm audit --audit-level=high --dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
@@ -57,7 +52,6 @@ auditDevDependencies:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
@@ -68,7 +62,6 @@ testStable:
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
@@ -97,10 +90,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
|
||||
@@ -120,11 +112,9 @@ trigger:
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
- npmci command npm run buildDocs
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
|
||||
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
11
package.json
11
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@apiglobal/typedsocket",
|
||||
"version": "2.0.7",
|
||||
"version": "2.0.12",
|
||||
"private": false,
|
||||
"description": "a typedrequest extension supporting websockets",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -10,7 +10,8 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web --allowimplicitany)"
|
||||
"build": "(tsbuild --web --allowimplicitany)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
@@ -19,13 +20,13 @@
|
||||
"@gitzone/tstest": "^1.0.72",
|
||||
"@pushrocks/smartenv": "^5.0.2",
|
||||
"@pushrocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.6.3"
|
||||
"@types/node": "^18.11.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest": "^2.0.8",
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
"@apiglobal/typedrequest-interfaces": "2.0.1",
|
||||
"@pushrocks/isohash": "^2.0.0",
|
||||
"@pushrocks/smartjson": "^5.0.2",
|
||||
"@pushrocks/smartjson": "^5.0.4",
|
||||
"@pushrocks/smartsocket": "^2.0.7",
|
||||
"@pushrocks/smartstring": "^4.0.2"
|
||||
},
|
||||
|
||||
100
pnpm-lock.yaml
generated
100
pnpm-lock.yaml
generated
@@ -2,35 +2,35 @@ lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@apiglobal/typedrequest': ^2.0.8
|
||||
'@apiglobal/typedrequest-interfaces': ^1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 2.0.1
|
||||
'@gitzone/tsbuild': ^2.1.63
|
||||
'@gitzone/tsbundle': ^2.0.6
|
||||
'@gitzone/tsrun': ^1.2.39
|
||||
'@gitzone/tstest': ^1.0.72
|
||||
'@pushrocks/isohash': ^2.0.0
|
||||
'@pushrocks/smartenv': ^5.0.2
|
||||
'@pushrocks/smartjson': ^5.0.2
|
||||
'@pushrocks/smartjson': ^5.0.4
|
||||
'@pushrocks/smartsocket': ^2.0.7
|
||||
'@pushrocks/smartstring': ^4.0.2
|
||||
'@pushrocks/tapbundle': ^5.0.4
|
||||
'@types/node': ^18.6.3
|
||||
'@types/node': ^18.11.6
|
||||
|
||||
dependencies:
|
||||
'@apiglobal/typedrequest': 2.0.12
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 2.0.1
|
||||
'@pushrocks/isohash': 2.0.0
|
||||
'@pushrocks/smartjson': 5.0.2
|
||||
'@pushrocks/smartjson': 5.0.4
|
||||
'@pushrocks/smartsocket': 2.0.7
|
||||
'@pushrocks/smartstring': 4.0.5
|
||||
|
||||
devDependencies:
|
||||
'@gitzone/tsbuild': 2.1.65
|
||||
'@gitzone/tsbundle': 2.0.7
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.11.5
|
||||
'@gitzone/tstest': 1.0.73_@types+node@18.11.5
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.11.6
|
||||
'@gitzone/tstest': 1.0.73_@types+node@18.11.6
|
||||
'@pushrocks/smartenv': 5.0.3
|
||||
'@pushrocks/tapbundle': 5.0.4
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
packages:
|
||||
|
||||
@@ -44,13 +44,17 @@ packages:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/@apiglobal/typedrequest-interfaces/1.0.15:
|
||||
resolution: {integrity: sha512-KncX168fUQJ73FeT22Cvls41mkJmtasP8dB2s9+9/OyWZpNsCzk9NEmtdRhulW2vLQwuAbQc1eoloe7ffCmhcA==}
|
||||
/@apiglobal/typedrequest-interfaces/1.0.20:
|
||||
resolution: {integrity: sha512-ybsDtavYbzGJYSLodSbkxDvSLYtfMzBTuNZDJpiANt1rZA2MO/GCq8zk5MVLlrUUQIr/7oxPGWqxi1QDwR+RHQ==}
|
||||
|
||||
/@apiglobal/typedrequest-interfaces/2.0.1:
|
||||
resolution: {integrity: sha512-Oi7pNU4vKo5UvcCJmqkH43Us237Ws/Pp/WDYnwnonRnTmIMd+6QjNfN/gXcPnP6tbamk8r8Xzcz9mgnSDM2ysw==}
|
||||
dev: false
|
||||
|
||||
/@apiglobal/typedrequest/2.0.12:
|
||||
resolution: {integrity: sha512-oCxcdKEzihzPDf0jrqG4obFFSgDszvO5LO+0Fk/hH/0bZm0AQ1LssYVwaY8OHjT0ujmkTcC5JFCjaS7LgjKSgQ==}
|
||||
dependencies:
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.20
|
||||
'@pushrocks/isounique': 1.0.5
|
||||
'@pushrocks/lik': 6.0.0
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
@@ -63,7 +67,7 @@ packages:
|
||||
resolution: {integrity: sha512-AsxG9782yVHELir6wsvYafE0knCRF/X10imgNolaemz680wqiFbBIhoNIVGxRw13XW1N9sJVbFJPEoBO0/uuoQ==}
|
||||
dependencies:
|
||||
'@apiglobal/typedrequest': 2.0.12
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.20
|
||||
'@pushrocks/isohash': 2.0.0
|
||||
'@pushrocks/smartsocket': 2.0.7
|
||||
'@pushrocks/smartstring': 4.0.5
|
||||
@@ -144,7 +148,7 @@ packages:
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/smartspawn': 3.0.2
|
||||
'@types/html-minifier': 4.0.2
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
esbuild: 0.14.54
|
||||
html-minifier: 4.0.0
|
||||
typescript: 4.8.4
|
||||
@@ -152,13 +156,13 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@gitzone/tsrun/1.2.39_@types+node@18.11.5:
|
||||
/@gitzone/tsrun/1.2.39_@types+node@18.11.6:
|
||||
resolution: {integrity: sha512-gLqKOic3T1GIdqsp+T5g1OewfboMJKKMr7/SJgBuMx4BUEBfW7TYhqk6psgfewhHs/zKII5rWbbPauykkKlYIg==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@pushrocks/smartfile': 10.0.5
|
||||
'@pushrocks/smartshell': 2.0.30
|
||||
ts-node: 10.9.1_w23x7n7zvvy4jtcrbeyi4toj7i
|
||||
ts-node: 10.9.1_i7h6rytxt6mnf2cd4ja4puifuq
|
||||
typescript: 4.8.4
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
@@ -167,12 +171,12 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@gitzone/tstest/1.0.73_@types+node@18.11.5:
|
||||
/@gitzone/tstest/1.0.73_@types+node@18.11.6:
|
||||
resolution: {integrity: sha512-IaarQBH6vTivIvVpdvwfiABLHf6bkGQlYLcDHymTllMMYrPKRFnpkW+hHJ8KlV0Q8eX/Uyar1PtnSxKEtO3/Fw==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@gitzone/tsbundle': 2.0.7
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.11.5
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.11.6
|
||||
'@pushrocks/consolecolor': 2.0.1
|
||||
'@pushrocks/smartbrowser': 2.0.2
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
@@ -468,7 +472,7 @@ packages:
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartfile-interfaces': 1.0.7
|
||||
'@pushrocks/smarthash': 3.0.1
|
||||
'@pushrocks/smartjson': 5.0.2
|
||||
'@pushrocks/smartjson': 5.0.4
|
||||
'@pushrocks/smartmime': 1.0.5
|
||||
'@pushrocks/smartpath': 5.0.5
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
@@ -495,7 +499,7 @@ packages:
|
||||
/@pushrocks/smarthash/3.0.1:
|
||||
resolution: {integrity: sha512-S9BiLsxTJB4KOXiiqcdp9QHc8srctHQxoWqDNVw7mGJbU6KuCHbFW6NUcEe2us5z389dGNEbbPMy7+0mAdTXVA==}
|
||||
dependencies:
|
||||
'@pushrocks/smartjson': 5.0.2
|
||||
'@pushrocks/smartjson': 5.0.4
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@types/through2': 2.0.36
|
||||
through2: 4.0.2
|
||||
@@ -509,8 +513,8 @@ packages:
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
lodash.clonedeep: 4.5.0
|
||||
|
||||
/@pushrocks/smartjson/5.0.2:
|
||||
resolution: {integrity: sha512-zYy4jaZhBA0JUnheDinARS82fpQZrwLZZWTBHK40UJ4q2n/a/CvFvNDaN81I1PODubV6dsRF4M0JjLk2VJ5XMA==}
|
||||
/@pushrocks/smartjson/5.0.4:
|
||||
resolution: {integrity: sha512-/a64L04y+prOp1LNfuxmbBbcIGdm+vCOSlhndDE2LWDrLn88gfLHERtQqpOdDUbrlXnTWZ1bvMTKbiPJGx9N/w==}
|
||||
dependencies:
|
||||
'@pushrocks/smartstring': 4.0.5
|
||||
'@types/buffer-json': 2.0.1
|
||||
@@ -531,7 +535,7 @@ packages:
|
||||
/@pushrocks/smartlog-interfaces/2.0.23:
|
||||
resolution: {integrity: sha512-tXqwfrekGxGZJB72BFQppywk7413hXVDgcJNeU+kY6xvmzVjf2HxOMbFYhewh1+p4uai1u9n0xcMb0qbbPy4/Q==}
|
||||
dependencies:
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.20
|
||||
|
||||
/@pushrocks/smartlog/3.0.1:
|
||||
resolution: {integrity: sha512-lE6BCrtZcDDjeXymHq9EK+VlrV3lhXXagFubgHiwrtX8+2xzihS3PpLE54pMARf5X5LE00xg1W0QxSzYJ9oMqg==}
|
||||
@@ -664,14 +668,14 @@ packages:
|
||||
/@pushrocks/smartsocket/2.0.7:
|
||||
resolution: {integrity: sha512-xoBdecjxQH5cYlMyzmZ6qoBUlC136HVc4nIjlEqohaI3itNyJI6hmU0FDBFLrgCEKKNJx6PB1NUJJMhHY6lwyw==}
|
||||
dependencies:
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.20
|
||||
'@pushrocks/isohash': 2.0.0
|
||||
'@pushrocks/isounique': 1.0.5
|
||||
'@pushrocks/lik': 6.0.0
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartenv': 5.0.3
|
||||
'@pushrocks/smartexpress': 4.0.21
|
||||
'@pushrocks/smartjson': 5.0.2
|
||||
'@pushrocks/smartjson': 5.0.4
|
||||
'@pushrocks/smartlog': 3.0.1
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/smartrx': 2.0.27
|
||||
@@ -783,7 +787,7 @@ packages:
|
||||
'@adobe/helix-fetch': 3.1.2
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartenv': 5.0.3
|
||||
'@pushrocks/smartjson': 5.0.2
|
||||
'@pushrocks/smartjson': 5.0.4
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/webstore': 2.0.5
|
||||
transitivePeerDependencies:
|
||||
@@ -792,10 +796,10 @@ packages:
|
||||
/@pushrocks/webstore/2.0.5:
|
||||
resolution: {integrity: sha512-O91dyT0o7xgeJsgftopa7NrE+sZxAQRr8i3UOZ6+UhyJx95v3kssPiE6aJ2uNsESKl3IlDq6RInLr1zbyFsqkg==}
|
||||
dependencies:
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.15
|
||||
'@apiglobal/typedrequest-interfaces': 1.0.20
|
||||
'@pushrocks/lik': 6.0.0
|
||||
'@pushrocks/smartenv': 5.0.3
|
||||
'@pushrocks/smartjson': 5.0.2
|
||||
'@pushrocks/smartjson': 5.0.4
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/smartrx': 2.0.27
|
||||
fake-indexeddb: 4.0.0
|
||||
@@ -851,7 +855,7 @@ packages:
|
||||
/@types/accepts/1.3.5:
|
||||
resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
dev: true
|
||||
|
||||
/@types/babel__code-frame/7.0.3:
|
||||
@@ -862,7 +866,7 @@ packages:
|
||||
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
|
||||
dependencies:
|
||||
'@types/connect': 3.4.35
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/buffer-json/2.0.1:
|
||||
resolution: {integrity: sha512-y2q2QGDqpS8NBtgKg8si+vKfanyd8smKzTglDCm7dXrco1VclSR8G1/uezK+sWbEUxsVPTomv5RxsTl3JAzxLA==}
|
||||
@@ -880,14 +884,14 @@ packages:
|
||||
/@types/clean-css/4.2.6:
|
||||
resolution: {integrity: sha512-Ze1tf+LnGPmG6hBFMi0B4TEB0mhF7EiMM5oyjLDNPE9hxrPU0W+5+bHvO+eFPA+bt0iC1zkQMoU/iGdRVjcRbw==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
source-map: 0.6.1
|
||||
dev: true
|
||||
|
||||
/@types/co-body/6.1.0:
|
||||
resolution: {integrity: sha512-3e0q2jyDAnx/DSZi0z2H0yoZ2wt5yRDZ+P7ymcMObvq0ufWRT4tsajyO+Q1VwVWiv9PRR4W3YEjEzBjeZlhF+w==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
'@types/qs': 6.9.7
|
||||
dev: true
|
||||
|
||||
@@ -899,7 +903,7 @@ packages:
|
||||
/@types/connect/3.4.35:
|
||||
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/content-disposition/0.5.5:
|
||||
resolution: {integrity: sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA==}
|
||||
@@ -918,7 +922,7 @@ packages:
|
||||
'@types/connect': 3.4.35
|
||||
'@types/express': 4.17.14
|
||||
'@types/keygrip': 1.0.2
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
dev: true
|
||||
|
||||
/@types/cors/2.8.12:
|
||||
@@ -935,7 +939,7 @@ packages:
|
||||
/@types/express-serve-static-core/4.17.31:
|
||||
resolution: {integrity: sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
'@types/qs': 6.9.7
|
||||
'@types/range-parser': 1.2.4
|
||||
|
||||
@@ -963,23 +967,23 @@ packages:
|
||||
/@types/finalhandler/1.2.0:
|
||||
resolution: {integrity: sha512-NgEZKOhxUSXkwNnWNaMXZaopQ5aFGPAYiEpEWIkQ6Dzc4iS0M1oQsvWne2t+ex9QZUAdTz/ZT4tOXJhWtP6mCw==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/from2/2.3.1:
|
||||
resolution: {integrity: sha512-l7kKtohAc5h0CKh6vFMv5WcWvQx40KE6dQneUg22i8c1mwxhVPbN781bYts/mYXxSBrQMhNxkhwg18QY0MfeOg==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/fs-extra/9.0.13:
|
||||
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/glob/8.0.0:
|
||||
resolution: {integrity: sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA==}
|
||||
dependencies:
|
||||
'@types/minimatch': 5.1.2
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/html-minifier/4.0.2:
|
||||
resolution: {integrity: sha512-4IkmkXJP/25R2fZsCHDX2abztXuQRzUAZq39PfCMz2loLFj8vS9y7aF6vDl58koXSTpsF+eL4Lc5Y4Aww/GCTQ==}
|
||||
@@ -1043,7 +1047,7 @@ packages:
|
||||
'@types/http-errors': 1.8.2
|
||||
'@types/keygrip': 1.0.2
|
||||
'@types/koa-compose': 3.2.5
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
dev: true
|
||||
|
||||
/@types/lodash.clonedeep/4.5.7:
|
||||
@@ -1066,8 +1070,8 @@ packages:
|
||||
/@types/minimatch/5.1.2:
|
||||
resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==}
|
||||
|
||||
/@types/node/18.11.5:
|
||||
resolution: {integrity: sha512-3JRwhbjI+cHLAkUorhf8RnqUbFXajvzX4q6fMn5JwkgtuwfYtRQYI3u4V92vI6NJuTsbBQWWh3RZjFsuevyMGQ==}
|
||||
/@types/node/18.11.6:
|
||||
resolution: {integrity: sha512-j3CEDa2vd96K0AXF8Wur7UucACvnjkk8hYyQAHhUNciabZLDl9nfAEVUSwmh245OOZV15bRA3Y590Gi5jUcDJg==}
|
||||
|
||||
/@types/parse5/6.0.3:
|
||||
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
|
||||
@@ -1094,7 +1098,7 @@ packages:
|
||||
resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==}
|
||||
dependencies:
|
||||
'@types/mime': 3.0.1
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/shortid/0.0.29:
|
||||
resolution: {integrity: sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=}
|
||||
@@ -1123,7 +1127,7 @@ packages:
|
||||
/@types/through2/2.0.36:
|
||||
resolution: {integrity: sha512-vuifQksQHJXhV9McpVsXKuhnf3lsoX70PnhcqIAbs9dqLH2NgrGz0DzZPDY3+Yh6eaRqcE1gnCQ6QhBn1/PT5A==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
|
||||
/@types/trusted-types/2.0.2:
|
||||
resolution: {integrity: sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==}
|
||||
@@ -1146,14 +1150,14 @@ packages:
|
||||
/@types/ws/7.4.7:
|
||||
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
dev: true
|
||||
|
||||
/@types/yauzl/2.10.0:
|
||||
resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
@@ -1856,7 +1860,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.12
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
@@ -3813,7 +3817,7 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/ts-node/10.9.1_w23x7n7zvvy4jtcrbeyi4toj7i:
|
||||
/ts-node/10.9.1_i7h6rytxt6mnf2cd4ja4puifuq:
|
||||
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@@ -3832,7 +3836,7 @@ packages:
|
||||
'@tsconfig/node12': 1.0.11
|
||||
'@tsconfig/node14': 1.0.3
|
||||
'@tsconfig/node16': 1.0.3
|
||||
'@types/node': 18.11.5
|
||||
'@types/node': 18.11.6
|
||||
acorn: 8.8.1
|
||||
acorn-walk: 8.2.0
|
||||
arg: 4.1.3
|
||||
|
||||
48
test/test.ts
48
test/test.ts
@@ -4,17 +4,18 @@ import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
||||
|
||||
import * as typedsocket from '../ts/index.js';
|
||||
|
||||
interface IRequest_Client_Server extends typedrequestInterfaces.implementsTR<
|
||||
typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_Client_Server
|
||||
> {
|
||||
interface IRequest_Client_Server
|
||||
extends typedrequestInterfaces.implementsTR<
|
||||
typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_Client_Server
|
||||
> {
|
||||
method: 'sayhi';
|
||||
request: {
|
||||
greeting: string;
|
||||
};
|
||||
response: {
|
||||
answer: string
|
||||
}
|
||||
answer: string;
|
||||
};
|
||||
}
|
||||
|
||||
let testTypedSocketServer: typedsocket.TypedSocket;
|
||||
@@ -23,45 +24,52 @@ let testTypedSocketClient: typedsocket.TypedSocket;
|
||||
const testTypedRouter = new typedrequest.TypedRouter();
|
||||
|
||||
tap.test('should add some handlers', async () => {
|
||||
testTypedRouter.addTypedHandler<IRequest_Client_Server>(new typedrequest.TypedHandler('sayhi', async requestData => {
|
||||
return {
|
||||
answer: `ok, got it : ${requestData.greeting}`
|
||||
}
|
||||
}));
|
||||
})
|
||||
testTypedRouter.addTypedHandler<IRequest_Client_Server>(
|
||||
new typedrequest.TypedHandler('sayhi', async (requestData) => {
|
||||
return {
|
||||
answer: `ok, got it : ${requestData.greeting}`,
|
||||
};
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
tap.test('should create Server and Client', async (tools) => {
|
||||
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');
|
||||
await tools.delayFor(5000);
|
||||
await testTypedSocketServer.stop();
|
||||
|
||||
// lets create another server
|
||||
testTypedSocketServer = await typedsocket.TypedSocket.createServer(testTypedRouter);
|
||||
|
||||
|
||||
// lets see if auto reconnect works
|
||||
console.log('test: waiting 21 seconds for reconnect');
|
||||
await tools.delayFor(21000);
|
||||
});
|
||||
|
||||
tap.test('should process messages from both sides', async () => {
|
||||
const myServerSideTypedRequest = testTypedSocketServer.createTypedRequest<IRequest_Client_Server>('sayhi');
|
||||
const myClientSideTypedRequest = testTypedSocketClient.createTypedRequest<IRequest_Client_Server>('sayhi');
|
||||
const myServerSideTypedRequest =
|
||||
testTypedSocketServer.createTypedRequest<IRequest_Client_Server>('sayhi');
|
||||
const myClientSideTypedRequest =
|
||||
testTypedSocketClient.createTypedRequest<IRequest_Client_Server>('sayhi');
|
||||
const response = await myClientSideTypedRequest.fire({
|
||||
greeting: 'that is a greeting from the client'
|
||||
greeting: 'that is a greeting from the client',
|
||||
});
|
||||
console.log(response);
|
||||
const response2 = await myServerSideTypedRequest.fire({
|
||||
greeting: 'that is a greeting from the server'
|
||||
greeting: 'that is a greeting from the server',
|
||||
});
|
||||
console.log(response2);
|
||||
})
|
||||
});
|
||||
|
||||
tap.test('should disconnect', async (tools) => {
|
||||
await testTypedSocketClient.stop();
|
||||
await testTypedSocketServer.stop();
|
||||
tools.delayFor(1000).then(() => process.exit(0));
|
||||
})
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@apiglobal/typedsocket',
|
||||
version: '2.0.7',
|
||||
version: '2.0.12',
|
||||
description: 'a typedrequest extension supporting websockets'
|
||||
}
|
||||
|
||||
@@ -126,13 +126,13 @@ export class TypedSocket {
|
||||
this.socketServerOrClient = socketServerOrClientArg;
|
||||
}
|
||||
|
||||
public addTag(keyArg: string, payloadArg: any) {
|
||||
public addTag<T extends plugins.typedrequestInterfaces.ITag = any>(nameArg: T['name'], payloadArg: T['payload']) {
|
||||
if (
|
||||
this.side === 'client' &&
|
||||
this.socketServerOrClient instanceof plugins.smartsocket.SmartsocketClient
|
||||
) {
|
||||
this.socketServerOrClient.socketConnection.addTag({
|
||||
id: keyArg,
|
||||
id: nameArg,
|
||||
payload: payloadArg,
|
||||
});
|
||||
} else {
|
||||
@@ -189,7 +189,7 @@ export class TypedSocket {
|
||||
return allMatching[0];
|
||||
}
|
||||
|
||||
public async findAllTargetConnectionsByTag(keyArg: string, payloadArg?: any) {
|
||||
public async findAllTargetConnectionsByTag<TTag extends plugins.typedrequestInterfaces.ITag = any>(keyArg: TTag['name'], payloadArg?: TTag['payload']) {
|
||||
return this.findAllTargetConnections(async (socketConnectionArg) => {
|
||||
let result: boolean;
|
||||
if (!payloadArg) {
|
||||
@@ -204,7 +204,7 @@ export class TypedSocket {
|
||||
});
|
||||
}
|
||||
|
||||
public async findTargetConnectionByTag(keyArg: string, payloadArg?: any) {
|
||||
public async findTargetConnectionByTag<TTag extends plugins.typedrequestInterfaces.ITag = any>(keyArg: TTag['name'], payloadArg?: TTag['payload']) {
|
||||
const allResults = await this.findAllTargetConnectionsByTag(keyArg, payloadArg);
|
||||
return allResults[0];
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
import * as typedrequest from '@apiglobal/typedrequest';
|
||||
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
||||
|
||||
export {
|
||||
typedrequest,
|
||||
typedrequestInterfaces,
|
||||
}
|
||||
export { typedrequest, typedrequestInterfaces };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as isohash from '@pushrocks/isohash';
|
||||
@@ -13,9 +10,4 @@ import * as smartjson from '@pushrocks/smartjson';
|
||||
import * as smartsocket from '@pushrocks/smartsocket';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
|
||||
export {
|
||||
isohash,
|
||||
smartjson,
|
||||
smartsocket,
|
||||
smartstring
|
||||
}
|
||||
export { isohash, smartjson, smartsocket, smartstring };
|
||||
|
||||
Reference in New Issue
Block a user