@phpsandbox/sdk 0.0.2 → 0.0.5

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.
@@ -3283,6 +3283,19 @@ var Transport = class {
3283
3283
  }
3284
3284
  return this.call("invoke", { action, data }, options);
3285
3285
  }
3286
+ /**
3287
+ * Reconnect the websocket without disposing listeners.
3288
+ * Uses the underlying ReconnectingWebSocket's reconnect mechanism.
3289
+ * This preserves all event listeners and state.
3290
+ */
3291
+ reconnect() {
3292
+ if (this.closed) {
3293
+ throw new Error("Cannot reconnect a closed transport. The transport has been permanently closed.");
3294
+ }
3295
+ this.log("info", "Reconnecting transport");
3296
+ this.connectPromise = null;
3297
+ this.rws.reconnect();
3298
+ }
3286
3299
  disconnect() {
3287
3300
  if (this.closed) {
3288
3301
  console.trace("Transport is already closed, cannot disconnect again");
@@ -4561,7 +4574,7 @@ var Client = class {
4561
4574
  var PHPSandbox = class extends Client {
4562
4575
  };
4563
4576
  var _initPromise, _NotebookInstance_instances, init_fn;
4564
- var _NotebookInstance = class _NotebookInstance {
4577
+ var NotebookInstance = class {
4565
4578
  constructor(data, client) {
4566
4579
  this.data = data;
4567
4580
  this.client = client;
@@ -4675,9 +4688,12 @@ var _NotebookInstance = class _NotebookInstance {
4675
4688
  this.disposables.push(disposable);
4676
4689
  return disposable;
4677
4690
  }
4678
- reconnect() {
4679
- this.dispose();
4680
- return new _NotebookInstance(this.data, this.client);
4691
+ async reconnect() {
4692
+ this.socket.reconnect();
4693
+ this.initialized = false;
4694
+ await this.whenConnected();
4695
+ __privateMethod(this, _NotebookInstance_instances, init_fn).call(this);
4696
+ return this.ready().then(() => this);
4681
4697
  }
4682
4698
  async beacon(iframe, options) {
4683
4699
  const result = await this.ready();
@@ -4688,7 +4704,7 @@ var _NotebookInstance = class _NotebookInstance {
4688
4704
  _initPromise = new WeakMap();
4689
4705
  _NotebookInstance_instances = new WeakSet();
4690
4706
  init_fn = function() {
4691
- return new Promise((resolve, reject) => {
4707
+ __privateSet(this, _initPromise, new Promise((resolve, reject) => {
4692
4708
  this.onDidInitialize((result) => {
4693
4709
  this.initialized = result;
4694
4710
  if (result.type === "error") {
@@ -4696,9 +4712,9 @@ init_fn = function() {
4696
4712
  }
4697
4713
  resolve(result);
4698
4714
  });
4699
- });
4715
+ }));
4716
+ return __privateGet(this, _initPromise);
4700
4717
  };
4701
- var NotebookInstance = _NotebookInstance;
4702
4718
  export {
4703
4719
  ApiError,
4704
4720
  Beacon,