ts-proto 1.164.1 → 1.164.2
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/build/generate-grpc-web.js +20 -14
- package/package.json +1 -1
|
@@ -301,13 +301,6 @@ function createObservableUnaryMethod(ctx) {
|
|
|
301
301
|
function createInvokeMethod(ctx) {
|
|
302
302
|
const { options } = ctx;
|
|
303
303
|
const { useAbortSignal } = options;
|
|
304
|
-
const maybeAbortSignal = useAbortSignal
|
|
305
|
-
? `
|
|
306
|
-
if (abortSignal) abortSignal.addEventListener("abort", () => {
|
|
307
|
-
observer.error(abortSignal.reason);
|
|
308
|
-
client.close();
|
|
309
|
-
});`
|
|
310
|
-
: "";
|
|
311
304
|
return (0, ts_poet_1.code) `
|
|
312
305
|
invoke<T extends UnaryMethodDefinitionish>(
|
|
313
306
|
methodDesc: T,
|
|
@@ -344,14 +337,27 @@ function createInvokeMethod(ctx) {
|
|
|
344
337
|
}
|
|
345
338
|
},
|
|
346
339
|
});
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
340
|
+
${useAbortSignal
|
|
341
|
+
? `
|
|
342
|
+
if (abortSignal) {
|
|
343
|
+
const abort = () => {
|
|
344
|
+
observer.error(abortSignal.reason);
|
|
345
|
+
client.close();
|
|
346
|
+
};
|
|
347
|
+
abortSignal.addEventListener("abort", abort);
|
|
348
|
+
observer.add(() => {
|
|
349
|
+
if (abortSignal.aborted) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
353
352
|
|
|
354
|
-
|
|
353
|
+
abortSignal.removeEventListener('abort', abort);
|
|
354
|
+
client.close();
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
observer.add(() => client.close());
|
|
358
|
+
}
|
|
359
|
+
`
|
|
360
|
+
: `observer.add(() => client.close());`}
|
|
355
361
|
});
|
|
356
362
|
upStream();
|
|
357
363
|
}).pipe(${share}());
|