@yorkie-js/sdk 0.7.10-rc → 0.7.10-rc2

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.
@@ -20976,7 +20976,7 @@ function createAuthInterceptor(apiKey, token) {
20976
20976
  };
20977
20977
  }
20978
20978
  const name = "@yorkie-js/sdk";
20979
- const version = "0.7.10-rc";
20979
+ const version = "0.7.10-rc2";
20980
20980
  const pkg = {
20981
20981
  name,
20982
20982
  version
@@ -21346,10 +21346,43 @@ class Client {
21346
21346
  baseUrl: rpcAddr,
21347
21347
  interceptors: [authInterceptor, createMetricInterceptor(opts?.userAgent)],
21348
21348
  fetch: (input, init) => {
21349
+ const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
21350
+ if (/\/yorkie\.v1\.YorkieService\/Watch/.test(url)) {
21351
+ return fetch(input, {
21352
+ ...init,
21353
+ keepalive: this.keepalive
21354
+ });
21355
+ }
21356
+ const callerSignal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
21357
+ const innerAC = new AbortController();
21358
+ let onCallerAbort;
21359
+ if (callerSignal) {
21360
+ if (callerSignal.aborted) {
21361
+ innerAC.abort(callerSignal.reason);
21362
+ } else {
21363
+ onCallerAbort = () => innerAC.abort(callerSignal.reason);
21364
+ callerSignal.addEventListener("abort", onCallerAbort);
21365
+ }
21366
+ }
21367
+ const detach = () => {
21368
+ if (callerSignal && onCallerAbort) {
21369
+ callerSignal.removeEventListener("abort", onCallerAbort);
21370
+ }
21371
+ };
21349
21372
  return fetch(input, {
21350
21373
  ...init,
21374
+ signal: innerAC.signal,
21351
21375
  keepalive: this.keepalive
21352
- });
21376
+ }).then(
21377
+ (res) => {
21378
+ detach();
21379
+ return res;
21380
+ },
21381
+ (err) => {
21382
+ detach();
21383
+ throw err;
21384
+ }
21385
+ );
21353
21386
  }
21354
21387
  };
21355
21388
  this.rpcClient = createClient(