@trpc/server 11.0.0-rc.599 → 11.0.0-rc.604
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/aws-lambda/getPlanner.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/index.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.d.ts.map +1 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.js +1 -0
- package/dist/adapters/next-app-dir/nextAppDirCaller.mjs +1 -0
- package/dist/adapters/next-app-dir/rethrowNextErrors.d.ts.map +1 -1
- package/dist/adapters/next-app-dir/rethrowNextErrors.js +2 -1
- package/dist/adapters/next-app-dir/rethrowNextErrors.mjs +2 -1
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +11 -2
- package/dist/adapters/ws.mjs +11 -2
- package/dist/bundle-analysis.json +131 -118
- package/dist/observable/observable.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/clientish/inference.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/clientish/serialize.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +1 -1
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/middleware.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/parser.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.js +3 -2
- package/dist/unstable-core-do-not-import/stream/jsonl.mjs +3 -2
- package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/sse.js +9 -2
- package/dist/unstable-core-do-not-import/stream/sse.mjs +9 -2
- package/dist/unstable-core-do-not-import/stream/tracked.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.js +11 -2
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.mjs +11 -2
- package/dist/unstable-core-do-not-import/stream/utils/withPing.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/utils/withPing.js +6 -2
- package/dist/unstable-core-do-not-import/stream/utils/withPing.mjs +6 -2
- package/dist/unstable-core-do-not-import/transformer.js +1 -1
- package/dist/unstable-core-do-not-import/transformer.mjs +1 -1
- package/dist/unstable-core-do-not-import/types.d.ts +3 -3
- package/dist/unstable-core-do-not-import/types.d.ts.map +1 -1
- package/dist/vendor/unpromise/index.d.ts +3 -0
- package/dist/vendor/unpromise/index.d.ts.map +1 -0
- package/dist/vendor/unpromise/types.d.ts +28 -0
- package/dist/vendor/unpromise/types.d.ts.map +1 -0
- package/dist/vendor/unpromise/unpromise.d.ts +121 -0
- package/dist/vendor/unpromise/unpromise.d.ts.map +1 -0
- package/dist/vendor/unpromise/unpromise.js +276 -0
- package/dist/vendor/unpromise/unpromise.mjs +273 -0
- package/package.json +6 -6
- package/src/adapters/aws-lambda/getPlanner.ts +2 -2
- package/src/adapters/aws-lambda/index.ts +5 -6
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +8 -3
- package/src/adapters/next-app-dir/nextAppDirCaller.ts +1 -0
- package/src/adapters/next-app-dir/rethrowNextErrors.ts +2 -1
- package/src/adapters/ws.ts +18 -2
- package/src/observable/observable.ts +2 -6
- package/src/unstable-core-do-not-import/clientish/inference.ts +4 -4
- package/src/unstable-core-do-not-import/clientish/inferrable.ts +6 -6
- package/src/unstable-core-do-not-import/clientish/serialize.ts +3 -3
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +2 -2
- package/src/unstable-core-do-not-import/initTRPC.ts +3 -9
- package/src/unstable-core-do-not-import/middleware.ts +3 -3
- package/src/unstable-core-do-not-import/parser.ts +5 -5
- package/src/unstable-core-do-not-import/procedureBuilder.ts +51 -53
- package/src/unstable-core-do-not-import/router.ts +6 -7
- package/src/unstable-core-do-not-import/stream/jsonl.ts +3 -2
- package/src/unstable-core-do-not-import/stream/sse.ts +13 -2
- package/src/unstable-core-do-not-import/stream/tracked.ts +2 -5
- package/src/unstable-core-do-not-import/stream/utils/asyncIterable.ts +11 -2
- package/src/unstable-core-do-not-import/stream/utils/withPing.ts +6 -2
- package/src/unstable-core-do-not-import/transformer.ts +1 -1
- package/src/unstable-core-do-not-import/types.ts +11 -13
- package/src/vendor/unpromise/ATTRIBUTION.txt +1 -0
- package/src/vendor/unpromise/LICENSE +20 -0
- package/src/vendor/unpromise/index.ts +7 -0
- package/src/vendor/unpromise/types.ts +55 -0
- package/src/vendor/unpromise/unpromise.ts +380 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPlanner.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/getPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAExE,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AActC;;IAEI;AACJ,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI,MAAM,SAAS,oBAAoB,GACtE,qBAAqB,GACrB,MAAM,SAAS,sBAAsB,
|
|
1
|
+
{"version":3,"file":"getPlanner.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/getPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAExE,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AActC;;IAEI;AACJ,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI,MAAM,SAAS,oBAAoB,GACtE,qBAAqB,GACrB,MAAM,SAAS,sBAAsB,GACnC,iCAAiC,GACjC,KAAK,CAAC;AA6IZ,wBAAgB,UAAU,CAAC,MAAM,SAAS,WAAW,EAAE,KAAK,EAAE,MAAM;;;yBAtI7C,QAAQ;EA0K9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,sBAAsB,EAEtB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGlE,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,WAAW,IAAI;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MA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in.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"fastifyTRPCPlugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAOnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE,MAAM,WAAW,wBAAwB,CAAC,OAAO,SAAS,SAAS;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CACtE,cAAc,EACd,YAAY,CACb,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,EACvC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,QA0C5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextAppDirCaller.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/nextAppDirCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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AK,MAAM,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CACzD,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC,CAClE,GACA,cAAc,CAAC,QAAQ,CAAC,CA4F1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rethrowNextErrors.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/rethrowNextErrors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyCpD;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"rethrowNextErrors.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/rethrowNextErrors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyCpD;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,SAAS,SAsBjD,CAAC"}
|
|
@@ -62,7 +62,8 @@ function isNotFoundError(error) {
|
|
|
62
62
|
}
|
|
63
63
|
// Before Next.js 15, we have to check and rethrow the error manually.
|
|
64
64
|
if (isRedirectError(cause) || isNotFoundError(cause)) {
|
|
65
|
-
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
|
+
throw cause;
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
|
|
@@ -41,7 +41,8 @@ function isNotFoundError(error) {
|
|
|
41
41
|
}
|
|
42
42
|
// Before Next.js 15, we have to check and rethrow the error manually.
|
|
43
43
|
if (isRedirectError(cause) || isNotFoundError(cause)) {
|
|
44
|
-
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
|
+
throw cause;
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAatE,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAatE,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAQlE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,8BAA8B,CACpE,eAAe,EACf,EAAE,CAAC,SAAS,CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,SAAS,IAAI,CAC1D,IAAI,EAAE,yBAAyB,KAC5B,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/C,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,GAC1C,qBAAqB,CACnB,kBAAkB,CAAC,OAAO,CAAC,EAC3B,kBAAkB,CAAC,OAAO,CAAC,CAC5B,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,SAAS,IACrD,0BAA0B,CAAC,OAAO,CAAC,GAAG;IACpC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,OAAO,EAAE,OAAO,CAAC;QACjB;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAGJ,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,SAAS,EAC9D,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC,YAKV,EAAE,CAAC,SAAS,OAAO,eAAe,mBAqYzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,EAAE,CAAC,SAAS,EACpB,MAAM,SAAS,EACf,UAAU,SAAQ,QAiCnB;AAED,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EACvD,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;;EAwCjC"}
|
package/dist/adapters/ws.js
CHANGED
|
@@ -6,6 +6,7 @@ var utils = require('../unstable-core-do-not-import/utils.js');
|
|
|
6
6
|
var parseConnectionParams = require('../unstable-core-do-not-import/http/parseConnectionParams.js');
|
|
7
7
|
var parseTRPCMessage = require('../unstable-core-do-not-import/rpc/parseTRPCMessage.js');
|
|
8
8
|
var observable = require('../observable/observable.js');
|
|
9
|
+
var unpromise = require('../vendor/unpromise/unpromise.js');
|
|
9
10
|
var tracked = require('../unstable-core-do-not-import/stream/tracked.js');
|
|
10
11
|
var transformer = require('../unstable-core-do-not-import/transformer.js');
|
|
11
12
|
var toURL = require('../unstable-core-do-not-import/http/toURL.js');
|
|
@@ -161,8 +162,12 @@ function getWSConnectionHandler(opts) {
|
|
|
161
162
|
abortController.signal.onabort = ()=>resolve('abort');
|
|
162
163
|
});
|
|
163
164
|
utils.run(async ()=>{
|
|
165
|
+
// We need those declarations outside the loop for garbage collection reasons. If they
|
|
166
|
+
// were declared inside, they would not be freed until the next value is present.
|
|
167
|
+
let next;
|
|
168
|
+
let result;
|
|
164
169
|
while(true){
|
|
165
|
-
|
|
170
|
+
next = await unpromise.Unpromise.race([
|
|
166
171
|
iterator.next().catch(TRPCError.getTRPCErrorFromUnknown),
|
|
167
172
|
abortPromise
|
|
168
173
|
]);
|
|
@@ -197,7 +202,7 @@ function getWSConnectionHandler(opts) {
|
|
|
197
202
|
if (next.done) {
|
|
198
203
|
break;
|
|
199
204
|
}
|
|
200
|
-
|
|
205
|
+
result = {
|
|
201
206
|
type: 'data',
|
|
202
207
|
data: next.value
|
|
203
208
|
};
|
|
@@ -214,6 +219,9 @@ function getWSConnectionHandler(opts) {
|
|
|
214
219
|
jsonrpc,
|
|
215
220
|
result
|
|
216
221
|
});
|
|
222
|
+
// free up references for garbage collection
|
|
223
|
+
next = null;
|
|
224
|
+
result = null;
|
|
217
225
|
}
|
|
218
226
|
await iterator.return?.();
|
|
219
227
|
respond({
|
|
@@ -282,6 +290,7 @@ function getWSConnectionHandler(opts) {
|
|
|
282
290
|
}
|
|
283
291
|
}
|
|
284
292
|
client.on('message', async (rawData)=>{
|
|
293
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
285
294
|
const msgStr = rawData.toString();
|
|
286
295
|
if (msgStr === 'PONG') {
|
|
287
296
|
return;
|
package/dist/adapters/ws.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { run, isObject, isAsyncIterable } from '../unstable-core-do-not-import/u
|
|
|
4
4
|
import { parseConnectionParamsFromUnknown } from '../unstable-core-do-not-import/http/parseConnectionParams.mjs';
|
|
5
5
|
import { parseTRPCMessage } from '../unstable-core-do-not-import/rpc/parseTRPCMessage.mjs';
|
|
6
6
|
import { isObservable, observableToAsyncIterable } from '../observable/observable.mjs';
|
|
7
|
+
import { Unpromise } from '../vendor/unpromise/unpromise.mjs';
|
|
7
8
|
import { isTrackedEnvelope } from '../unstable-core-do-not-import/stream/tracked.mjs';
|
|
8
9
|
import { transformTRPCResponse } from '../unstable-core-do-not-import/transformer.mjs';
|
|
9
10
|
import { toURL } from '../unstable-core-do-not-import/http/toURL.mjs';
|
|
@@ -159,8 +160,12 @@ function getWSConnectionHandler(opts) {
|
|
|
159
160
|
abortController.signal.onabort = ()=>resolve('abort');
|
|
160
161
|
});
|
|
161
162
|
run(async ()=>{
|
|
163
|
+
// We need those declarations outside the loop for garbage collection reasons. If they
|
|
164
|
+
// were declared inside, they would not be freed until the next value is present.
|
|
165
|
+
let next;
|
|
166
|
+
let result;
|
|
162
167
|
while(true){
|
|
163
|
-
|
|
168
|
+
next = await Unpromise.race([
|
|
164
169
|
iterator.next().catch(getTRPCErrorFromUnknown),
|
|
165
170
|
abortPromise
|
|
166
171
|
]);
|
|
@@ -195,7 +200,7 @@ function getWSConnectionHandler(opts) {
|
|
|
195
200
|
if (next.done) {
|
|
196
201
|
break;
|
|
197
202
|
}
|
|
198
|
-
|
|
203
|
+
result = {
|
|
199
204
|
type: 'data',
|
|
200
205
|
data: next.value
|
|
201
206
|
};
|
|
@@ -212,6 +217,9 @@ function getWSConnectionHandler(opts) {
|
|
|
212
217
|
jsonrpc,
|
|
213
218
|
result
|
|
214
219
|
});
|
|
220
|
+
// free up references for garbage collection
|
|
221
|
+
next = null;
|
|
222
|
+
result = null;
|
|
215
223
|
}
|
|
216
224
|
await iterator.return?.();
|
|
217
225
|
respond({
|
|
@@ -280,6 +288,7 @@ function getWSConnectionHandler(opts) {
|
|
|
280
288
|
}
|
|
281
289
|
}
|
|
282
290
|
client.on('message', async (rawData)=>{
|
|
291
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
283
292
|
const msgStr = rawData.toString();
|
|
284
293
|
if (msgStr === 'PONG') {
|
|
285
294
|
return;
|