iii-browser-sdk 0.26.0-rc.7 → 0.26.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/reporter.ts","../src/iii.ts"],"mappings":";;;KAkDY,cAAA;EC+I2D,8CD7IrE,UAAA,UCqpEQ;EDnpER,QAAA,UCmpEQ;EDjpER,QAAA,UC2oEkB;EDzoElB,QAAA;EAEA,aAAA;EAEA,eAAA;AAAA;;;;;;;;;;;;ACwGF;;KAAY,WAAA;EAuBmB;;;;;;EAhB7B,UAAA;EAAA;;;;;;;EAQA,SAAA,WAYA;EAVA,mBAAA;EAUoC;;;;;EAJpC,kBAAA,GAAqB,OAAA,CAAQ,qBAAA,GA4gErB;EA1gER,OAAA,GAAU,MAAA,kBA0gEF;EAxgER,OAAA;IAAY,aAAA;IAAwB,QAAA,GAAW,OAAA,CAAQ,cAAA;EAAA;AAAA;;;;;AA2gEzD;;;;;;;;;;;;;AAiBA;;;;;cAnCa,UAAA;EAmCmC;;;;;;;;EAAA;IA1B5B,KAAA;EAAA;;;;;;;;;;;;;cASP,aAAA;;;;;;;;;;IATO,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0BP,cAAA,GAAkB,OAAA,UAAiB,OAAA,GAAU,WAAA,KAAc,IAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/reporter.ts","../src/iii.ts"],"mappings":";;;KAkDY,cAAA;EC+I2D,8CD7IrE,UAAA,UCgrEQ;ED9qER,QAAA,UC8qEQ;ED5qER,QAAA,UCsqEkB;EDpqElB,QAAA;EAEA,aAAA;EAEA,eAAA;AAAA;;;;;;;;;;;;ACwGF;;KAAY,WAAA;EAuBmB;;;;;;EAhB7B,UAAA;EAAA;;;;;;;EAQA,SAAA,WAYA;EAVA,mBAAA;EAUoC;;;;;EAJpC,kBAAA,GAAqB,OAAA,CAAQ,qBAAA,GAuiErB;EAriER,OAAA,GAAU,MAAA,kBAqiEF;EAniER,OAAA;IAAY,aAAA;IAAwB,QAAA,GAAW,OAAA,CAAQ,cAAA;EAAA;AAAA;;;;;AAsiEzD;;;;;;;;;;;;;AAiBA;;;;;cAnCa,UAAA;EAmCmC;;;;;;;;EAAA;IA1B5B,KAAA;EAAA;;;;;;;;;;;;;cASP,aAAA;;;;;;;;;;IATO,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0BP,cAAA,GAAkB,OAAA,UAAiB,OAAA,GAAU,WAAA,KAAc,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/reporter.ts","../src/iii.ts"],"mappings":";;;KAkDY,cAAA;EC+I2D,8CD7IrE,UAAA,UCqpEQ;EDnpER,QAAA,UCmpEQ;EDjpER,QAAA,UC2oEkB;EDzoElB,QAAA;EAEA,aAAA;EAEA,eAAA;AAAA;;;;;;;;;;;;ACwGF;;KAAY,WAAA;EAuBmB;;;;;;EAhB7B,UAAA;EAAA;;;;;;;EAQA,SAAA,WAYA;EAVA,mBAAA;EAUoC;;;;;EAJpC,kBAAA,GAAqB,OAAA,CAAQ,qBAAA,GA4gErB;EA1gER,OAAA,GAAU,MAAA,kBA0gEF;EAxgER,OAAA;IAAY,aAAA;IAAwB,QAAA,GAAW,OAAA,CAAQ,cAAA;EAAA;AAAA;;;;;AA2gEzD;;;;;;;;;;;;;AAiBA;;;;;cAnCa,UAAA;EAmCmC;;;;;;;;EAAA;IA1B5B,KAAA;EAAA;;;;;;;;;;;;;cASP,aAAA;;;;;;;;;;IATO,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0BP,cAAA,GAAkB,OAAA,UAAiB,OAAA,GAAU,WAAA,KAAc,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/reporter.ts","../src/iii.ts"],"mappings":";;;KAkDY,cAAA;EC+I2D,8CD7IrE,UAAA,UCgrEQ;ED9qER,QAAA,UC8qEQ;ED5qER,QAAA,UCsqEkB;EDpqElB,QAAA;EAEA,aAAA;EAEA,eAAA;AAAA;;;;;;;;;;;;ACwGF;;KAAY,WAAA;EAuBmB;;;;;;EAhB7B,UAAA;EAAA;;;;;;;EAQA,SAAA,WAYA;EAVA,mBAAA;EAUoC;;;;;EAJpC,kBAAA,GAAqB,OAAA,CAAQ,qBAAA,GAuiErB;EAriER,OAAA,GAAU,MAAA,kBAqiEF;EAniER,OAAA;IAAY,aAAA;IAAwB,QAAA,GAAW,OAAA,CAAQ,cAAA;EAAA;AAAA;;;;;AAsiEzD;;;;;;;;;;;;;AAiBA;;;;;cAnCa,UAAA;EAmCmC;;;;;;;;EAAA;IA1B5B,KAAA;EAAA;;;;;;;;;;;;;cASP,aAAA;;;;;;;;;;IATO,KAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0BP,cAAA,GAAkB,OAAA,UAAiB,OAAA,GAAU,WAAA,KAAc,IAAA"}
package/dist/index.mjs CHANGED
@@ -4120,9 +4120,10 @@ var Sdk = class {
4120
4120
  return;
4121
4121
  }
4122
4122
  }
4123
- /** A state from the engine for `handle`; `disposed` frees its id. */
4123
+ /** A state from the engine for `handle`; `disposed` frees its id, unless the handle observes again. */
4124
4124
  applyObserverState(handle, wireState, reason) {
4125
4125
  const state = toObserverState(wireState);
4126
+ if (state === "disposed" && reason?.code === "OBSERVER_DISCONNECTED" && this.observeAgain(handle)) return;
4126
4127
  handle.setState(state, reason ? {
4127
4128
  code: reason.code,
4128
4129
  message: reason.message
@@ -4131,6 +4132,26 @@ var Sdk = class {
4131
4132
  this.unlistObserve(handle);
4132
4133
  if (this.observerHandles.get(handle.id) === handle) this.observerHandles.delete(handle.id);
4133
4134
  }
4135
+ /**
4136
+ * The engine disposed `handle`'s observer while this worker was away past
4137
+ * `observers.observer_grace_ms` (`OBSERVER_DISCONNECTED`, usually its answer
4138
+ * to the replay): the handle observes its id again at once, a new observer
4139
+ * (acceptance E17), and goes back to `pending` instead of `disposed`. Not
4140
+ * one with `max_fires` or `expires_in_ms` (a new observer would restart its
4141
+ * counters, decision 56), one being disposed, refused or in `error`, or one
4142
+ * already observed again on this connection (the engine disposed that one too).
4143
+ */
4144
+ observeAgain(handle) {
4145
+ const { max_fires, expires_in_ms } = handle.message;
4146
+ if (max_fires != null || expires_in_ms != null || handle.state === "error") return false;
4147
+ if (this.observerHandles.get(handle.id) !== handle || handle.observedAgainOn === this.connectionEpoch) return false;
4148
+ this.logWarn(`Observer ${handle.id}: the engine disposed it while this worker was away past the grace period; observing it again`);
4149
+ handle.observedAgainOn = this.connectionEpoch;
4150
+ this.unlistObserve(handle);
4151
+ handle.setState("pending");
4152
+ this.sendObserve(handle);
4153
+ return true;
4154
+ }
4134
4155
  unlistObserve(handle) {
4135
4156
  const sent = this.observesSent.get(handle.id);
4136
4157
  const at = sent ? sent.indexOf(handle) : -1;