@peerbit/document 13.1.2 → 13.1.4
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/src/program.d.ts.map +1 -1
- package/dist/src/program.js +19 -7
- package/dist/src/program.js.map +1 -1
- package/dist/src/search.d.ts +1 -0
- package/dist/src/search.d.ts.map +1 -1
- package/dist/src/search.js +5 -1
- package/dist/src/search.js.map +1 -1
- package/package.json +11 -11
- package/src/program.ts +18 -11
- package/src/search.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/document",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.4",
|
|
4
4
|
"description": "Document store implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -61,18 +61,18 @@
|
|
|
61
61
|
"uint8arrays": "^5.1.0",
|
|
62
62
|
"@peerbit/cache": "3.1.0",
|
|
63
63
|
"@peerbit/crypto": "3.1.2",
|
|
64
|
+
"@peerbit/document-interface": "3.2.46",
|
|
64
65
|
"@peerbit/indexer-cache": "0.2.8",
|
|
65
|
-
"@peerbit/document-interface": "3.2.45",
|
|
66
66
|
"@peerbit/indexer-interface": "3.0.5",
|
|
67
67
|
"@peerbit/indexer-simple": "1.2.8",
|
|
68
|
+
"@peerbit/log": "6.2.3",
|
|
68
69
|
"@peerbit/indexer-sqlite3": "3.0.8",
|
|
69
|
-
"@peerbit/
|
|
70
|
-
"@peerbit/logger": "2.0.1",
|
|
71
|
-
"@peerbit/program": "6.0.32",
|
|
70
|
+
"@peerbit/program": "6.0.33",
|
|
72
71
|
"@peerbit/pubsub": "5.3.0",
|
|
73
|
-
"@peerbit/
|
|
72
|
+
"@peerbit/shared-log": "13.2.4",
|
|
73
|
+
"@peerbit/rpc": "6.1.1",
|
|
74
74
|
"@peerbit/stream-interface": "6.0.11",
|
|
75
|
-
"@peerbit/
|
|
75
|
+
"@peerbit/logger": "2.0.1"
|
|
76
76
|
},
|
|
77
77
|
"optionalDependencies": {
|
|
78
78
|
"@peerbit/document-rust": "0.1.1"
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"@types/pidusage": "^2.0.5",
|
|
84
84
|
"pidusage": "^4.0.1",
|
|
85
85
|
"uuid": "^10.0.0",
|
|
86
|
+
"@peerbit/native-backbone": "0.1.3",
|
|
87
|
+
"@peerbit/test-utils": "3.1.4",
|
|
86
88
|
"@peerbit/log-rust": "1.1.2",
|
|
87
|
-
"
|
|
88
|
-
"@peerbit/
|
|
89
|
-
"@peerbit/time": "3.0.0",
|
|
90
|
-
"peerbit": "5.3.2"
|
|
89
|
+
"peerbit": "5.3.4",
|
|
90
|
+
"@peerbit/time": "3.0.0"
|
|
91
91
|
},
|
|
92
92
|
"repository": {
|
|
93
93
|
"type": "git",
|
package/src/program.ts
CHANGED
|
@@ -5,11 +5,7 @@ import {
|
|
|
5
5
|
serialize,
|
|
6
6
|
variant,
|
|
7
7
|
} from "@dao-xyz/borsh";
|
|
8
|
-
import {
|
|
9
|
-
AccessError,
|
|
10
|
-
type PublicSignKey,
|
|
11
|
-
SignatureWithKey,
|
|
12
|
-
} from "@peerbit/crypto";
|
|
8
|
+
import { AccessError, type PublicSignKey } from "@peerbit/crypto";
|
|
13
9
|
import {
|
|
14
10
|
Context,
|
|
15
11
|
NotFoundError,
|
|
@@ -2333,20 +2329,31 @@ export class Documents<
|
|
|
2333
2329
|
if (this.keepCache?.has(e.hash)) {
|
|
2334
2330
|
return true;
|
|
2335
2331
|
}
|
|
2336
|
-
|
|
2332
|
+
// Only the signer identity matters here. Use getPublicKeys so
|
|
2333
|
+
// prepared native entries (hollow in JS, signature bytes in the
|
|
2334
|
+
// native store) can still answer; if the signer is genuinely
|
|
2335
|
+
// unknowable we cannot prove the entry is ours, so do not keep.
|
|
2336
|
+
const resolveKeys = async (entry: Entry<Operation>) => {
|
|
2337
|
+
try {
|
|
2338
|
+
return await entry.getPublicKeys();
|
|
2339
|
+
} catch {
|
|
2340
|
+
return undefined;
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
let publicKeys: PublicSignKey[] | undefined = undefined;
|
|
2337
2344
|
if (e instanceof Entry) {
|
|
2338
|
-
|
|
2345
|
+
publicKeys = await resolveKeys(e);
|
|
2339
2346
|
} else {
|
|
2340
2347
|
const entry = await this.log.log.get(e.hash);
|
|
2341
|
-
|
|
2348
|
+
publicKeys = entry ? await resolveKeys(entry) : undefined;
|
|
2342
2349
|
}
|
|
2343
2350
|
|
|
2344
|
-
if (!
|
|
2351
|
+
if (!publicKeys) {
|
|
2345
2352
|
return false;
|
|
2346
2353
|
}
|
|
2347
2354
|
|
|
2348
|
-
for (const
|
|
2349
|
-
if (
|
|
2355
|
+
for (const publicKey of publicKeys) {
|
|
2356
|
+
if (publicKey.equals(this.node.identity.publicKey)) {
|
|
2350
2357
|
this.keepCache?.add(e.hash);
|
|
2351
2358
|
return true;
|
|
2352
2359
|
}
|
package/src/search.ts
CHANGED
|
@@ -403,6 +403,7 @@ export type ReachScope = {
|
|
|
403
403
|
|
|
404
404
|
export type RemoteQueryOptions<Q, R, D> = RPCRequestAllOptions<Q, R> & {
|
|
405
405
|
replicate?: boolean;
|
|
406
|
+
from?: string[]; // if specified, only query these peers
|
|
406
407
|
minAge?: number;
|
|
407
408
|
throwOnMissing?: boolean;
|
|
408
409
|
retryMissingResponses?: boolean;
|
|
@@ -4907,7 +4908,12 @@ export class DocumentIndex<
|
|
|
4907
4908
|
...(typeof options?.remote === "object"
|
|
4908
4909
|
? options.remote
|
|
4909
4910
|
: {}),
|
|
4910
|
-
from:
|
|
4911
|
+
from:
|
|
4912
|
+
fetchOptions?.from ??
|
|
4913
|
+
initialRemoteTargets ??
|
|
4914
|
+
(typeof options?.remote === "object"
|
|
4915
|
+
? options.remote.from
|
|
4916
|
+
: undefined),
|
|
4911
4917
|
}
|
|
4912
4918
|
: false,
|
|
4913
4919
|
resolve,
|