@fairfox/polly 0.78.0 → 0.79.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.
Files changed (80) hide show
  1. package/dist/cli/polly.js +46 -3
  2. package/dist/cli/polly.js.map +3 -3
  3. package/dist/src/background/index.js.map +3 -3
  4. package/dist/src/background/message-router.js.map +3 -3
  5. package/dist/src/client/index.js +137 -32
  6. package/dist/src/client/index.js.map +6 -5
  7. package/dist/src/client/wrapper.d.ts +39 -2
  8. package/dist/src/elysia/index.js +22 -3
  9. package/dist/src/elysia/index.js.map +5 -5
  10. package/dist/src/elysia/route-match.d.ts +13 -0
  11. package/dist/src/index.d.ts +1 -1
  12. package/dist/src/index.js +12 -2
  13. package/dist/src/index.js.map +7 -7
  14. package/dist/src/mesh.js +28 -9
  15. package/dist/src/mesh.js.map +10 -9
  16. package/dist/src/peer.js +6 -2
  17. package/dist/src/peer.js.map +5 -5
  18. package/dist/src/polly-ui/Badge.d.ts +5 -0
  19. package/dist/src/polly-ui/Button.d.ts +31 -6
  20. package/dist/src/polly-ui/Dropdown.d.ts +6 -0
  21. package/dist/src/polly-ui/Select.d.ts +11 -1
  22. package/dist/src/polly-ui/TextInput.d.ts +30 -0
  23. package/dist/src/polly-ui/index.css +10 -0
  24. package/dist/src/polly-ui/index.js +81 -32
  25. package/dist/src/polly-ui/index.js.map +10 -10
  26. package/dist/src/polly-ui/styles.css +10 -0
  27. package/dist/src/shared/adapters/index.js.map +3 -3
  28. package/dist/src/shared/lib/context-helpers.js.map +3 -3
  29. package/dist/src/shared/lib/message-bus.js.map +3 -3
  30. package/dist/src/shared/lib/resource.js +11 -2
  31. package/dist/src/shared/lib/resource.js.map +6 -6
  32. package/dist/src/shared/lib/state.d.ts +20 -0
  33. package/dist/src/shared/lib/state.js +11 -1
  34. package/dist/src/shared/lib/state.js.map +5 -5
  35. package/dist/src/shared/state/app-state.js +10 -1
  36. package/dist/src/shared/state/app-state.js.map +5 -5
  37. package/dist/tools/init/src/cli.js +23 -2
  38. package/dist/tools/init/src/cli.js.map +4 -4
  39. package/dist/tools/init/templates/pwa/package.json.template +1 -1
  40. package/dist/tools/init/templates/pwa/src/service-worker.ts.template +26 -15
  41. package/dist/tools/init/templates/pwa/src/shared-worker.ts.template +13 -3
  42. package/dist/tools/init/templates/pwa/tsconfig.json.template +2 -2
  43. package/dist/tools/init/templates/pwa/tsconfig.worker.json.template +17 -0
  44. package/dist/tools/test/src/browser/index.js +5 -2
  45. package/dist/tools/test/src/browser/index.js.map +3 -3
  46. package/dist/tools/test/src/contrast/index.js +20 -15
  47. package/dist/tools/test/src/contrast/index.js.map +3 -3
  48. package/dist/tools/test/src/e2e-cli/index.d.ts +10 -0
  49. package/dist/tools/test/src/e2e-cli/run-cli.d.ts +25 -0
  50. package/dist/tools/test/src/e2e-cli/with-temp-dir.d.ts +15 -0
  51. package/dist/tools/test/src/e2e-mesh/index.js +12 -7
  52. package/dist/tools/test/src/e2e-mesh/index.js.map +4 -4
  53. package/dist/tools/test/src/e2e-mesh/launch-peer.d.ts +7 -1
  54. package/dist/tools/test/src/e2e-relay/index.d.ts +12 -0
  55. package/dist/tools/test/src/e2e-relay/wait-for-relay-convergence.d.ts +27 -0
  56. package/dist/tools/test/src/e2e-relay/with-repo-server.d.ts +24 -0
  57. package/dist/tools/test/src/e2e-shared/assert.d.ts +18 -0
  58. package/dist/tools/test/src/e2e-shared/contract.d.ts +40 -0
  59. package/dist/tools/test/src/e2e-shared/index.d.ts +2 -0
  60. package/dist/tools/test/src/tiers/args.d.ts +23 -0
  61. package/dist/tools/test/src/tiers/cli.d.ts +2 -0
  62. package/dist/tools/test/src/tiers/cli.js +490 -0
  63. package/dist/tools/test/src/tiers/cli.js.map +16 -0
  64. package/dist/tools/test/src/tiers/detect.d.ts +12 -0
  65. package/dist/tools/test/src/tiers/discover.d.ts +2 -0
  66. package/dist/tools/test/src/tiers/engine.d.ts +3 -0
  67. package/dist/tools/test/src/tiers/index.d.ts +14 -0
  68. package/dist/tools/test/src/tiers/protocol.d.ts +10 -0
  69. package/dist/tools/test/src/tiers/reporter.d.ts +12 -0
  70. package/dist/tools/test/src/tiers/types.d.ts +94 -0
  71. package/dist/tools/test/src/tiers/worker.d.ts +2 -0
  72. package/dist/tools/test/src/tiers/worker.js +60 -0
  73. package/dist/tools/test/src/tiers/worker.js.map +12 -0
  74. package/dist/tools/verify/src/cli.js +165 -30
  75. package/dist/tools/verify/src/cli.js.map +7 -6
  76. package/dist/tools/verify/src/stryker/index.js +20 -11
  77. package/dist/tools/verify/src/stryker/index.js.map +3 -3
  78. package/dist/tools/visualize/src/cli.js +8 -5
  79. package/dist/tools/visualize/src/cli.js.map +4 -4
  80. package/package.json +16 -6
package/dist/src/mesh.js CHANGED
@@ -257,6 +257,17 @@ var init_encryption = __esm(() => {
257
257
  };
258
258
  });
259
259
 
260
+ // src/shared/lib/guards.ts
261
+ function hasKeyInObject(input, key) {
262
+ return typeof input === "object" && input !== null && Object.hasOwn(input, key);
263
+ }
264
+ function isRecord(input) {
265
+ return typeof input === "object" && input !== null && !Array.isArray(input);
266
+ }
267
+ function assertNever(value) {
268
+ throw new Error(`assertNever: unexpected value ${JSON.stringify(value)}`);
269
+ }
270
+
260
271
  // src/shared/lib/wasm-init.ts
261
272
  import wasmPath from "@automerge/automerge/automerge.wasm";
262
273
  import { initializeWasm } from "@automerge/automerge-repo/slim";
@@ -437,7 +448,7 @@ class IndexedDBBlobCache {
437
448
  totalSize += value.size;
438
449
  if (!value.pinned) {
439
450
  candidates.push({
440
- hash: key,
451
+ hash: String(key),
441
452
  accessedAt: value.accessedAt,
442
453
  size: value.size
443
454
  });
@@ -1251,6 +1262,10 @@ class MeshNetworkAdapter extends NetworkAdapter {
1251
1262
  return;
1252
1263
  }
1253
1264
  const tag = payload[0];
1265
+ if (tag === undefined) {
1266
+ emitMeshDiagnostic({ kind: "drop:empty-control-payload", senderId });
1267
+ return;
1268
+ }
1254
1269
  const body = payload.subarray(1);
1255
1270
  switch (tag) {
1256
1271
  case MESH_CONTROL_TYPE.Sync:
@@ -2476,15 +2491,17 @@ function partitionStats(report) {
2476
2491
  retransmittedPacketsSent: undefined,
2477
2492
  retransmittedBytesSent: undefined
2478
2493
  };
2479
- const iter = report.values?.() ?? [];
2494
+ const iter = hasStatsIterator(report) ? report.values() : [];
2480
2495
  for (const raw of iter) {
2481
- if (!raw || typeof raw !== "object")
2496
+ if (!isRecord(raw))
2482
2497
  continue;
2483
- const stat = raw;
2484
- ingestStat(stat, out);
2498
+ ingestStat(raw, out);
2485
2499
  }
2486
2500
  return out;
2487
2501
  }
2502
+ function hasStatsIterator(report) {
2503
+ return report !== null && typeof report === "object" && "values" in report && typeof report.values === "function";
2504
+ }
2488
2505
  function ingestStat(stat, out) {
2489
2506
  const id = String(stat["id"]);
2490
2507
  switch (stat["type"]) {
@@ -3630,11 +3647,13 @@ function decodeRevocationSummary(bytes) {
3630
3647
  if (!item || typeof item !== "object") {
3631
3648
  throw new Error(`decodeRevocationSummary: entry ${index} is not an object`);
3632
3649
  }
3633
- const e = item;
3634
- if (typeof e.r !== "string" || typeof e.i !== "string" || typeof e.t !== "number") {
3650
+ const r = "r" in item ? item.r : undefined;
3651
+ const i = "i" in item ? item.i : undefined;
3652
+ const t = "t" in item ? item.t : undefined;
3653
+ if (typeof r !== "string" || typeof i !== "string" || typeof t !== "number") {
3635
3654
  throw new Error(`decodeRevocationSummary: entry ${index} has missing or wrong-typed fields`);
3636
3655
  }
3637
- return { revokedPeerId: e.r, issuerPeerId: e.i, issuedAt: e.t };
3656
+ return { revokedPeerId: r, issuerPeerId: i, issuedAt: t };
3638
3657
  });
3639
3658
  }
3640
3659
  function compareSummaryEntries(a, b) {
@@ -4332,4 +4351,4 @@ export {
4332
4351
  $meshCounter
4333
4352
  };
4334
4353
 
4335
- //# debugId=6658F510724BA95A64756E2164756E21
4354
+ //# debugId=7FA8CE30CEE539D264756E2164756E21