@fairfox/polly 0.88.1 → 0.89.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.
- package/dist/cli/polly.js +4 -4
- package/dist/cli/polly.js.map +2 -2
- package/dist/gallery/gallery.css +51 -59
- package/dist/gallery/gallery.js +1155 -1047
- package/dist/src/actions/index.js +5 -78
- package/dist/src/actions/index.js.map +2 -2
- package/dist/src/background/index.js +126 -152
- package/dist/src/background/index.js.map +4 -4
- package/dist/src/background/message-router.js +126 -152
- package/dist/src/background/message-router.js.map +4 -4
- package/dist/src/client/index.js +186 -259
- package/dist/src/client/index.js.map +5 -5
- package/dist/src/elysia/index.js +21 -35
- package/dist/src/elysia/index.js.map +2 -2
- package/dist/src/index.js +218 -246
- package/dist/src/index.js.map +10 -10
- package/dist/src/mesh.js +49 -61
- package/dist/src/mesh.js.map +4 -4
- package/dist/src/peer.js +23 -52
- package/dist/src/peer.js.map +2 -2
- package/dist/src/polly-ui/Button.d.ts +7 -0
- package/dist/src/polly-ui/Collapsible.d.ts +3 -1
- package/dist/src/polly-ui/Layout.d.ts +16 -1
- package/dist/src/polly-ui/index.css +47 -59
- package/dist/src/polly-ui/index.js +112 -124
- package/dist/src/polly-ui/index.js.map +13 -13
- package/dist/src/polly-ui/markdown.js +72 -145
- package/dist/src/polly-ui/markdown.js.map +2 -2
- package/dist/src/polly-ui/styles.css +47 -59
- package/dist/src/polly-ui/theme.css +10 -0
- package/dist/src/shared/adapters/index.js +31 -44
- package/dist/src/shared/adapters/index.js.map +2 -2
- package/dist/src/shared/lib/context-helpers.js +126 -152
- package/dist/src/shared/lib/context-helpers.js.map +4 -4
- package/dist/src/shared/lib/errors.js +1 -74
- package/dist/src/shared/lib/errors.js.map +2 -2
- package/dist/src/shared/lib/guards.js +1 -74
- package/dist/src/shared/lib/guards.js.map +2 -2
- package/dist/src/shared/lib/message-bus.js +126 -152
- package/dist/src/shared/lib/message-bus.js.map +4 -4
- package/dist/src/shared/lib/resource.js +16 -27
- package/dist/src/shared/lib/resource.js.map +5 -5
- package/dist/src/shared/lib/state.js +13 -26
- package/dist/src/shared/lib/state.js.map +2 -2
- package/dist/src/shared/lib/test-helpers.js +1 -74
- package/dist/src/shared/lib/test-helpers.js.map +2 -2
- package/dist/src/shared/state/app-state.js +35 -46
- package/dist/src/shared/state/app-state.js.map +5 -5
- package/dist/src/shared/types/messages.js +1 -74
- package/dist/src/shared/types/messages.js.map +2 -2
- package/dist/tools/bdd/src/cli.js +11 -15
- package/dist/tools/bdd/src/cli.js.map +2 -2
- package/dist/tools/bdd/src/index.js +11 -19
- package/dist/tools/bdd/src/index.js.map +2 -2
- package/dist/tools/gallery/src/cli.js +1 -18
- package/dist/tools/gallery/src/cli.js.map +2 -2
- package/dist/tools/init/src/cli.js +1 -18
- package/dist/tools/init/src/cli.js.map +2 -2
- package/dist/tools/mutate/src/cli.js +8 -25
- package/dist/tools/mutate/src/cli.js.map +2 -2
- package/dist/tools/mutate/src/index.js +8 -26
- package/dist/tools/mutate/src/index.js.map +2 -2
- package/dist/tools/quality/src/cli.js +39 -46
- package/dist/tools/quality/src/cli.js.map +3 -3
- package/dist/tools/quality/src/css/check-layout.d.ts +5 -3
- package/dist/tools/quality/src/index.js +39 -47
- package/dist/tools/quality/src/index.js.map +3 -3
- package/dist/tools/test/src/adapters/index.js +4 -77
- package/dist/tools/test/src/adapters/index.js.map +2 -2
- package/dist/tools/test/src/browser/index.js +1 -74
- package/dist/tools/test/src/browser/index.js.map +2 -2
- package/dist/tools/test/src/browser/run.js +5 -22
- package/dist/tools/test/src/browser/run.js.map +2 -2
- package/dist/tools/test/src/contrast/index.js +1 -74
- package/dist/tools/test/src/contrast/index.js.map +2 -2
- package/dist/tools/test/src/coverage-policy/cli.js +13 -25
- package/dist/tools/test/src/coverage-policy/cli.js.map +2 -2
- package/dist/tools/test/src/coverage-policy/index.js +11 -23
- package/dist/tools/test/src/coverage-policy/index.js.map +2 -2
- package/dist/tools/test/src/e2e-mesh/index.js +18 -43
- package/dist/tools/test/src/e2e-mesh/index.js.map +2 -2
- package/dist/tools/test/src/e2e-relay/index.js +615 -623
- package/dist/tools/test/src/e2e-relay/index.js.map +2 -2
- package/dist/tools/test/src/index.js +30 -103
- package/dist/tools/test/src/index.js.map +5 -5
- package/dist/tools/test/src/test-utils.js +1 -74
- package/dist/tools/test/src/test-utils.js.map +2 -2
- package/dist/tools/test/src/tiers/cli.js +1 -18
- package/dist/tools/test/src/tiers/cli.js.map +2 -2
- package/dist/tools/test/src/tiers/worker.js +11 -15
- package/dist/tools/test/src/tiers/worker.js.map +2 -2
- package/dist/tools/test/src/visual/index.js +1112 -1134
- package/dist/tools/test/src/visual/index.js.map +3 -3
- package/dist/tools/verify/src/cli.js +103 -169
- package/dist/tools/verify/src/cli.js.map +2 -2
- package/dist/tools/verify/src/config.js +1 -74
- package/dist/tools/verify/src/config.js.map +2 -2
- package/dist/tools/verify/src/stryker/index.js +1 -19
- package/dist/tools/verify/src/stryker/index.js.map +2 -2
- package/dist/tools/visualize/src/cli.js +69 -85
- package/dist/tools/visualize/src/cli.js.map +2 -2
- package/package.json +1 -1
package/dist/src/mesh.js
CHANGED
|
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
18
18
|
return cached;
|
|
19
19
|
}
|
|
20
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
22
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
23
|
for (let key of __getOwnPropNames(mod))
|
|
24
24
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -62,14 +62,17 @@ var __export = (target, all) => {
|
|
|
62
62
|
set: __exportSetter.bind(all, name)
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
|
-
var __esm = (fn, res) => () =>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
var __esm = (fn, res, err) => () => {
|
|
66
|
+
if (fn)
|
|
67
|
+
try {
|
|
68
|
+
res = fn(fn = 0);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
err = [e];
|
|
71
|
+
}
|
|
72
|
+
if (err)
|
|
73
|
+
throw err[0];
|
|
74
|
+
return res;
|
|
75
|
+
};
|
|
73
76
|
|
|
74
77
|
// src/shared/lib/idb-helpers.ts
|
|
75
78
|
function openIDB(options, openFn = defaultOpenFn) {
|
|
@@ -167,21 +170,6 @@ var init_idb_helpers = __esm(() => {
|
|
|
167
170
|
});
|
|
168
171
|
|
|
169
172
|
// src/shared/lib/encryption.ts
|
|
170
|
-
var exports_encryption = {};
|
|
171
|
-
__export(exports_encryption, {
|
|
172
|
-
EncryptionError: () => EncryptionError,
|
|
173
|
-
KEY_BYTES: () => KEY_BYTES,
|
|
174
|
-
NONCE_BYTES: () => NONCE_BYTES,
|
|
175
|
-
TAG_BYTES: () => TAG_BYTES,
|
|
176
|
-
decodeEncryptedEnvelope: () => decodeEncryptedEnvelope,
|
|
177
|
-
decrypt: () => decrypt,
|
|
178
|
-
decryptOrThrow: () => decryptOrThrow,
|
|
179
|
-
encodeEncryptedEnvelope: () => encodeEncryptedEnvelope,
|
|
180
|
-
encrypt: () => encrypt,
|
|
181
|
-
generateDocumentKey: () => generateDocumentKey,
|
|
182
|
-
openEnvelope: () => openEnvelope,
|
|
183
|
-
sealEnvelope: () => sealEnvelope
|
|
184
|
-
});
|
|
185
173
|
import nacl from "tweetnacl";
|
|
186
174
|
function generateDocumentKey() {
|
|
187
175
|
return nacl.randomBytes(KEY_BYTES);
|
|
@@ -259,17 +247,6 @@ var init_encryption = __esm(() => {
|
|
|
259
247
|
};
|
|
260
248
|
});
|
|
261
249
|
|
|
262
|
-
// src/shared/lib/guards.ts
|
|
263
|
-
function hasKeyInObject(input, key) {
|
|
264
|
-
return typeof input === "object" && input !== null && Object.hasOwn(input, key);
|
|
265
|
-
}
|
|
266
|
-
function isRecord(input) {
|
|
267
|
-
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
268
|
-
}
|
|
269
|
-
function assertNever(value) {
|
|
270
|
-
throw new Error(`assertNever: unexpected value ${JSON.stringify(value)}`);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
250
|
// src/shared/lib/wasm-init.ts
|
|
274
251
|
import wasmPath from "@automerge/automerge/automerge.wasm";
|
|
275
252
|
import { initializeWasm } from "@automerge/automerge-repo/slim";
|
|
@@ -638,12 +615,12 @@ function createBlobStore(adapter, options) {
|
|
|
638
615
|
};
|
|
639
616
|
adapter.on("peer-candidate", peerCandidateHandler);
|
|
640
617
|
async function encryptChunk(plaintext, key) {
|
|
641
|
-
|
|
642
|
-
return
|
|
618
|
+
await Promise.resolve().then(() => init_encryption());
|
|
619
|
+
return encrypt(plaintext, key);
|
|
643
620
|
}
|
|
644
621
|
async function decryptChunk(sealed, key) {
|
|
645
|
-
|
|
646
|
-
return
|
|
622
|
+
await Promise.resolve().then(() => init_encryption());
|
|
623
|
+
return decrypt(sealed, key);
|
|
647
624
|
}
|
|
648
625
|
async function handleChunk(peerId, header, data) {
|
|
649
626
|
const download = downloads.get(header.hash);
|
|
@@ -774,10 +751,10 @@ function createBlobStore(adapter, options) {
|
|
|
774
751
|
return new Promise((resolve) => setTimeout(resolve, 50));
|
|
775
752
|
}
|
|
776
753
|
const store = {
|
|
777
|
-
async put(ref, bytes,
|
|
754
|
+
async put(ref, bytes, options) {
|
|
778
755
|
if (disposed)
|
|
779
756
|
throw new Error("BlobStore is disposed");
|
|
780
|
-
|
|
757
|
+
options?.signal?.throwIfAborted();
|
|
781
758
|
if (bytes.length > maxBlobSize) {
|
|
782
759
|
throw new Error(`Blob exceeds maximum size (${bytes.length} > ${maxBlobSize})`);
|
|
783
760
|
}
|
|
@@ -785,24 +762,24 @@ function createBlobStore(adapter, options) {
|
|
|
785
762
|
if (hash !== ref.hash) {
|
|
786
763
|
throw new Error(`Hash mismatch: expected ${ref.hash}, got ${hash}`);
|
|
787
764
|
}
|
|
788
|
-
|
|
789
|
-
const key =
|
|
765
|
+
options?.signal?.throwIfAborted();
|
|
766
|
+
const key = options?.key ?? defaultKey;
|
|
790
767
|
if (key) {
|
|
791
768
|
keysByHash.set(ref.hash, key);
|
|
792
769
|
}
|
|
793
|
-
|
|
770
|
+
options?.onProgress?.({ loaded: bytes.length, total: bytes.length, phase: "uploading" });
|
|
794
771
|
await cache.put(ref.hash, bytes);
|
|
795
772
|
localHashes.add(ref.hash);
|
|
796
773
|
announceHave(ref.hash);
|
|
797
774
|
},
|
|
798
|
-
async get(hash,
|
|
775
|
+
async get(hash, options) {
|
|
799
776
|
if (disposed)
|
|
800
777
|
throw new Error("BlobStore is disposed");
|
|
801
|
-
|
|
778
|
+
options?.signal?.throwIfAborted();
|
|
802
779
|
const cached = await cache.get(hash);
|
|
803
780
|
if (cached)
|
|
804
781
|
return cached;
|
|
805
|
-
const key =
|
|
782
|
+
const key = options?.key ?? defaultKey;
|
|
806
783
|
const peers = peerBlobs.get(hash);
|
|
807
784
|
const candidates = peers && peers.size > 0 ? Array.from(peers) : Array.from(adapter.connectedPeerIds);
|
|
808
785
|
const targetPeer = candidates[0];
|
|
@@ -817,13 +794,13 @@ function createBlobStore(adapter, options) {
|
|
|
817
794
|
chunks: new Map,
|
|
818
795
|
resolve,
|
|
819
796
|
reject,
|
|
820
|
-
onProgress:
|
|
797
|
+
onProgress: options?.onProgress,
|
|
821
798
|
key,
|
|
822
799
|
peersAttempted: [targetPeer],
|
|
823
800
|
peerRotationIndex: 1
|
|
824
801
|
};
|
|
825
802
|
downloads.set(hash, download);
|
|
826
|
-
|
|
803
|
+
options?.signal?.addEventListener("abort", () => {
|
|
827
804
|
if (downloads.has(hash)) {
|
|
828
805
|
clearDownloadTimers(download);
|
|
829
806
|
downloads.delete(hash);
|
|
@@ -2371,6 +2348,17 @@ import {
|
|
|
2371
2348
|
NetworkAdapter as NetworkAdapter2
|
|
2372
2349
|
} from "@automerge/automerge-repo/slim";
|
|
2373
2350
|
|
|
2351
|
+
// src/shared/lib/guards.ts
|
|
2352
|
+
function hasKeyInObject(input, key) {
|
|
2353
|
+
return typeof input === "object" && input !== null && Object.hasOwn(input, key);
|
|
2354
|
+
}
|
|
2355
|
+
function isRecord(input) {
|
|
2356
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
2357
|
+
}
|
|
2358
|
+
function assertNever(value) {
|
|
2359
|
+
throw new Error(`assertNever: unexpected value ${JSON.stringify(value)}`);
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2374
2362
|
// src/shared/lib/sync-fragment.ts
|
|
2375
2363
|
var SYNC_FRAGMENT_THRESHOLD = 60 * 1024;
|
|
2376
2364
|
var SYNC_FRAGMENT_CHUNK_SIZE = 60 * 1024;
|
|
@@ -3749,7 +3737,7 @@ function getReevaluateDocumentShare(repo) {
|
|
|
3749
3737
|
return () => fn.call(sync);
|
|
3750
3738
|
}
|
|
3751
3739
|
function buildMeshStateModuleDiagnostics() {
|
|
3752
|
-
const
|
|
3740
|
+
const lazyWrappers = getLazyWrappers();
|
|
3753
3741
|
return {
|
|
3754
3742
|
moduleId: getMeshStateModuleId(),
|
|
3755
3743
|
configured: isMeshStateConfigured(),
|
|
@@ -3759,8 +3747,8 @@ function buildMeshStateModuleDiagnostics() {
|
|
|
3759
3747
|
lazyReachedRepo: getLazyReachedRepo(),
|
|
3760
3748
|
lastLoadedRejection: getLastLoadedRejection(),
|
|
3761
3749
|
storageOpenError: getStorageOpenError(),
|
|
3762
|
-
lazyWrappers
|
|
3763
|
-
lazyWrapperDuplicateDocIds: findLazyWrapperDocIdDuplicates(
|
|
3750
|
+
lazyWrappers,
|
|
3751
|
+
lazyWrapperDuplicateDocIds: findLazyWrapperDocIdDuplicates(lazyWrappers)
|
|
3764
3752
|
};
|
|
3765
3753
|
}
|
|
3766
3754
|
function findLazyWrapperDocIdDuplicates(records) {
|
|
@@ -3895,16 +3883,16 @@ async function createMeshClient(options) {
|
|
|
3895
3883
|
storeRevocationInto(revocationStore, record, bytes);
|
|
3896
3884
|
}
|
|
3897
3885
|
const handleRevocationControl = (body, senderId) => {
|
|
3898
|
-
const
|
|
3886
|
+
const keyring = keyringSource();
|
|
3899
3887
|
let record;
|
|
3900
3888
|
try {
|
|
3901
|
-
record = decodeRevocation(body,
|
|
3889
|
+
record = decodeRevocation(body, keyring);
|
|
3902
3890
|
} catch (err) {
|
|
3903
3891
|
const reason = err instanceof RevocationError ? err.code : err instanceof Error ? err.message : String(err);
|
|
3904
3892
|
emitMeshDiagnostic({ kind: "revoke:rejected", senderId, reason });
|
|
3905
3893
|
return;
|
|
3906
3894
|
}
|
|
3907
|
-
switch (classifyIncomingRevocation(record, localPeerId,
|
|
3895
|
+
switch (classifyIncomingRevocation(record, localPeerId, keyring.revokedPeers)) {
|
|
3908
3896
|
case "self":
|
|
3909
3897
|
selfRevocation = record;
|
|
3910
3898
|
emitMeshDiagnostic({
|
|
@@ -3923,7 +3911,7 @@ async function createMeshClient(options) {
|
|
|
3923
3911
|
});
|
|
3924
3912
|
return;
|
|
3925
3913
|
case "apply":
|
|
3926
|
-
applyRevocation(record,
|
|
3914
|
+
applyRevocation(record, keyring);
|
|
3927
3915
|
storeRevocation(record, body);
|
|
3928
3916
|
emitMeshDiagnostic({ kind: "revoke:applied", revokedPeerId: record.revokedPeerId });
|
|
3929
3917
|
return;
|
|
@@ -4044,15 +4032,15 @@ async function createMeshClient(options) {
|
|
|
4044
4032
|
await webrtcAdapter.refreshAllTransportStats();
|
|
4045
4033
|
},
|
|
4046
4034
|
revokePeer: async (targetPeerId, reason) => {
|
|
4047
|
-
const
|
|
4035
|
+
const keyring = keyringSource();
|
|
4048
4036
|
const record = createRevocation({
|
|
4049
|
-
issuer:
|
|
4037
|
+
issuer: keyring.identity,
|
|
4050
4038
|
issuerPeerId: localPeerId,
|
|
4051
4039
|
revokedPeerId: targetPeerId,
|
|
4052
4040
|
...reason !== undefined && { reason }
|
|
4053
4041
|
});
|
|
4054
|
-
const bytes = encodeRevocation(record,
|
|
4055
|
-
applyRevocation(record,
|
|
4042
|
+
const bytes = encodeRevocation(record, keyring.identity);
|
|
4043
|
+
applyRevocation(record, keyring);
|
|
4056
4044
|
storeRevocation(record, bytes);
|
|
4057
4045
|
emitMeshDiagnostic({
|
|
4058
4046
|
kind: "revoke:issued",
|
|
@@ -4353,4 +4341,4 @@ export {
|
|
|
4353
4341
|
wasMeshStateResolved
|
|
4354
4342
|
};
|
|
4355
4343
|
|
|
4356
|
-
//# debugId=
|
|
4344
|
+
//# debugId=E6FC33B402AB2BB964756E2164756E21
|