@kosdev-code/kos-ui-sdk 0.1.0-next.851 → 0.1.0-next.852

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/index.js CHANGED
@@ -8375,6 +8375,7 @@ class KosMockRecorder {
8375
8375
  pending = /* @__PURE__ */ new Map();
8376
8376
  exchanges = [];
8377
8377
  pushes = [];
8378
+ sends = [];
8378
8379
  get isRecording() {
8379
8380
  return this.recording;
8380
8381
  }
@@ -8386,6 +8387,7 @@ class KosMockRecorder {
8386
8387
  this.pending.clear();
8387
8388
  this.exchanges = [];
8388
8389
  this.pushes = [];
8390
+ this.sends = [];
8389
8391
  KosLog.info(
8390
8392
  `KosMock recorder started${options.name ? ` (${options.name})` : ""}`
8391
8393
  );
@@ -8394,7 +8396,7 @@ class KosMockRecorder {
8394
8396
  const fixture = this.toFixture();
8395
8397
  this.recording = false;
8396
8398
  KosLog.info(
8397
- `KosMock recorder stopped: ${fixture.exchanges.length} exchanges, ${fixture.pushes.length} pushes`
8399
+ `KosMock recorder stopped: ${fixture.exchanges.length} exchanges, ${fixture.pushes.length} pushes, ${fixture.sends?.length ?? 0} sends`
8398
8400
  );
8399
8401
  return fixture;
8400
8402
  }
@@ -8404,7 +8406,8 @@ class KosMockRecorder {
8404
8406
  name: this.name,
8405
8407
  capturedAt: this.capturedAt,
8406
8408
  exchanges: [...this.exchanges],
8407
- pushes: [...this.pushes]
8409
+ pushes: [...this.pushes],
8410
+ sends: [...this.sends]
8408
8411
  };
8409
8412
  }
8410
8413
  download(filename) {
@@ -8433,6 +8436,7 @@ class KosMockRecorder {
8433
8436
  }
8434
8437
  const frame = decodeRequestFrame(data);
8435
8438
  if (!frame) {
8439
+ this.noteSend(data);
8436
8440
  return;
8437
8441
  }
8438
8442
  this.pending.set(frame.requestId, {
@@ -8440,7 +8444,31 @@ class KosMockRecorder {
8440
8444
  method: frame.method,
8441
8445
  url: frame.url,
8442
8446
  tracker: frame.tracker,
8443
- requestBody: frame.rawBody
8447
+ requestBody: frame.rawBody,
8448
+ requestHeaders: frame.headers
8449
+ });
8450
+ }
8451
+ /**
8452
+ * Everything else a window sends: alias registration, broker subscribes,
8453
+ * client-sent futures. What a window asked for is not recoverable from the
8454
+ * responses it got back, so it is captured rather than discarded.
8455
+ */
8456
+ noteSend(data) {
8457
+ if (typeof data !== "string") {
8458
+ return;
8459
+ }
8460
+ let headers;
8461
+ let body;
8462
+ try {
8463
+ ({ headers, body } = processKosMessage(data));
8464
+ } catch {
8465
+ return;
8466
+ }
8467
+ this.sends.push({
8468
+ tMs: this.elapsed(),
8469
+ type: headers["type"],
8470
+ headers,
8471
+ ...body ? { body } : {}
8444
8472
  });
8445
8473
  }
8446
8474
  /** Interceptor tap: every inbound frame (real, mocked, injected). Internal. */
@@ -8466,6 +8494,7 @@ class KosMockRecorder {
8466
8494
  ...request2,
8467
8495
  status: parseInt(headers["status"] ?? "200", 10) || 200,
8468
8496
  responseBody: body ?? "",
8497
+ responseHeaders: headers,
8469
8498
  latencyMs: Math.max(0, this.elapsed() - request2.tMs),
8470
8499
  ...headers[KOS_MOCKED_HEADER] === "true" ? { mocked: true } : {}
8471
8500
  });
@@ -8477,7 +8506,8 @@ class KosMockRecorder {
8477
8506
  tMs: this.elapsed(),
8478
8507
  kind: "topic",
8479
8508
  topic,
8480
- body: body ?? ""
8509
+ body: body ?? "",
8510
+ headers
8481
8511
  });
8482
8512
  return;
8483
8513
  }
@@ -8491,7 +8521,8 @@ class KosMockRecorder {
8491
8521
  tMs: this.elapsed(),
8492
8522
  kind: "future",
8493
8523
  tracker,
8494
- body: body ?? ""
8524
+ body: body ?? "",
8525
+ headers
8495
8526
  });
8496
8527
  }
8497
8528
  }
@@ -26863,7 +26894,7 @@ const waitForRetry = (depth = 0) => new Promise((resolve) => {
26863
26894
  resolve(true);
26864
26895
  }, 2 ** depth * 10);
26865
26896
  });
26866
- function fetchData$1(key, fetcher) {
26897
+ function readModelHookEntry(key, fetcher) {
26867
26898
  const entry = modelHookCache.get(key);
26868
26899
  if (entry) {
26869
26900
  if (entry.status === "finished") {
@@ -26888,7 +26919,7 @@ function fetchData$1(key, fetcher) {
26888
26919
  throw promise;
26889
26920
  }
26890
26921
  function useSuspenseData$1(key, fetcher) {
26891
- const data = fetchData$1(key, fetcher);
26922
+ const data = readModelHookEntry(key, fetcher);
26892
26923
  return data;
26893
26924
  }
26894
26925
  async function fetchModel$1(kosCore, modelOptions) {
@@ -29429,6 +29460,7 @@ export {
29429
29460
  processId,
29430
29461
  processMiddleware,
29431
29462
  put,
29463
+ readModelHookEntry,
29432
29464
  registerCompanionModel,
29433
29465
  registerCoreModels,
29434
29466
  registerExtensionPoint,