@peerbit/document 9.4.3-fb47029 → 9.4.3
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 +2 -7
- package/dist/src/program.d.ts.map +1 -1
- package/dist/src/program.js +1 -2
- package/dist/src/program.js.map +1 -1
- package/dist/src/resumable-iterator.d.ts +1 -1
- package/dist/src/resumable-iterator.d.ts.map +1 -1
- package/dist/src/resumable-iterator.js +2 -10
- package/dist/src/resumable-iterator.js.map +1 -1
- package/dist/src/search.d.ts +3 -24
- package/dist/src/search.d.ts.map +1 -1
- package/dist/src/search.js +46 -209
- package/dist/src/search.js.map +1 -1
- package/package.json +74 -75
- package/src/operation.ts +9 -9
- package/src/program.ts +2 -9
- package/src/resumable-iterator.ts +2 -10
- package/src/search.ts +68 -343
- package/dist/src/most-common-query-predictor.d.ts +0 -38
- package/dist/src/most-common-query-predictor.d.ts.map +0 -1
- package/dist/src/most-common-query-predictor.js +0 -115
- package/dist/src/most-common-query-predictor.js.map +0 -1
- package/dist/src/prefetch.d.ts +0 -22
- package/dist/src/prefetch.d.ts.map +0 -1
- package/dist/src/prefetch.js +0 -47
- package/dist/src/prefetch.js.map +0 -1
- package/src/most-common-query-predictor.ts +0 -161
- package/src/prefetch.ts +0 -80
package/package.json
CHANGED
|
@@ -1,77 +1,76 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
2
|
+
"name": "@peerbit/document",
|
|
3
|
+
"version": "9.4.3",
|
|
4
|
+
"description": "Document store implementation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"*": [
|
|
11
|
+
"*",
|
|
12
|
+
"dist/*",
|
|
13
|
+
"dist/src/*",
|
|
14
|
+
"dist/src/*/index"
|
|
15
|
+
],
|
|
16
|
+
"src/*": [
|
|
17
|
+
"*",
|
|
18
|
+
"dist/*",
|
|
19
|
+
"dist/src/*",
|
|
20
|
+
"dist/src/*/index"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/e2e",
|
|
28
|
+
"!dist/test",
|
|
29
|
+
"!**/*.tsbuildinfo"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/src/index.d.ts",
|
|
34
|
+
"import": "./dist/src/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"eslintConfig": {
|
|
38
|
+
"extends": "peerbit",
|
|
39
|
+
"parserOptions": {
|
|
40
|
+
"project": true,
|
|
41
|
+
"sourceType": "module"
|
|
42
|
+
},
|
|
43
|
+
"ignorePatterns": [
|
|
44
|
+
"!.aegir.js",
|
|
45
|
+
"test/ts-use",
|
|
46
|
+
"*.d.ts"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "aegir clean",
|
|
54
|
+
"build": "aegir build --no-bundle",
|
|
55
|
+
"test": "aegir test --target node",
|
|
56
|
+
"lint": "aegir lint"
|
|
57
|
+
},
|
|
58
|
+
"author": "dao.xyz",
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@dao-xyz/borsh": "^5.2.3",
|
|
62
|
+
"@peerbit/program": "5.2.7",
|
|
63
|
+
"@peerbit/rpc": "5.2.9",
|
|
64
|
+
"@peerbit/shared-log": "11.0.8",
|
|
65
|
+
"@peerbit/indexer-interface": "^2.0.9",
|
|
66
|
+
"@peerbit/indexer-simple": "^1.1.14",
|
|
67
|
+
"@peerbit/indexer-sqlite3": "^1.2.18",
|
|
68
|
+
"@peerbit/document-interface": "^2.0.28"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@peerbit/test-utils": "2.1.42",
|
|
72
|
+
"@peerbit/time": "2.1.0",
|
|
73
|
+
"@types/pidusage": "^2.0.5",
|
|
74
|
+
"pidusage": "^3.0.2"
|
|
75
|
+
}
|
|
77
76
|
}
|
package/src/operation.ts
CHANGED
|
@@ -26,15 +26,15 @@ export class PutWithKeyOperation extends Operation {
|
|
|
26
26
|
// @deprecated
|
|
27
27
|
/* @variant(1)
|
|
28
28
|
export class PutAllOperation<T> extends Operation<T> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
@field({ type: vec(PutOperation) })
|
|
30
|
+
docs: PutOperation<T>[];
|
|
31
|
+
|
|
32
|
+
constructor(props?: { docs: PutOperation<T>[] }) {
|
|
33
|
+
super();
|
|
34
|
+
if (props) {
|
|
35
|
+
this.docs = props.docs;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
39
|
*/
|
|
40
40
|
|
package/src/program.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from "@dao-xyz/borsh";
|
|
8
8
|
import { AccessError } from "@peerbit/crypto";
|
|
9
9
|
import { ResultIndexedValue } from "@peerbit/document-interface";
|
|
10
|
-
import type { QueryCacheOptions } from "@peerbit/indexer-cache";
|
|
11
10
|
import * as indexerTypes from "@peerbit/indexer-interface";
|
|
12
11
|
import {
|
|
13
12
|
type Change,
|
|
@@ -40,7 +39,6 @@ import {
|
|
|
40
39
|
type CanRead,
|
|
41
40
|
type CanSearch,
|
|
42
41
|
DocumentIndex,
|
|
43
|
-
type PrefetchOptions,
|
|
44
42
|
type TransformOptions,
|
|
45
43
|
type WithContext,
|
|
46
44
|
coerceWithContext,
|
|
@@ -97,11 +95,7 @@ export type SetupOptions<
|
|
|
97
95
|
canSearch?: CanSearch;
|
|
98
96
|
canRead?: CanRead<I>;
|
|
99
97
|
idProperty?: string | string[];
|
|
100
|
-
|
|
101
|
-
resolver?: number;
|
|
102
|
-
query?: QueryCacheOptions;
|
|
103
|
-
};
|
|
104
|
-
prefetch?: boolean | Partial<PrefetchOptions>;
|
|
98
|
+
cacheSize?: number;
|
|
105
99
|
} & TransformOptions<T, I>;
|
|
106
100
|
log?: {
|
|
107
101
|
trim?: TrimOptions;
|
|
@@ -198,7 +192,7 @@ export class Documents<
|
|
|
198
192
|
transform: options.index,
|
|
199
193
|
indexBy: idProperty,
|
|
200
194
|
compatibility: options.compatibility,
|
|
201
|
-
|
|
195
|
+
cacheSize: options?.index?.cacheSize,
|
|
202
196
|
replicate: async (query, results) => {
|
|
203
197
|
// here we arrive for all the results we want to persist.
|
|
204
198
|
|
|
@@ -216,7 +210,6 @@ export class Documents<
|
|
|
216
210
|
},
|
|
217
211
|
dbType: this.constructor,
|
|
218
212
|
maybeOpen: this.maybeSubprogramOpen.bind(this),
|
|
219
|
-
prefetch: options.index?.prefetch,
|
|
220
213
|
});
|
|
221
214
|
|
|
222
215
|
// document v6 and below need log compatibility of v8 or below
|
|
@@ -62,15 +62,7 @@ export class ResumableIterators<T extends Record<string, any>> {
|
|
|
62
62
|
this.queues.del(id);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!iterator) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
const pending = await iterator.iterator.pending();
|
|
71
|
-
if (pending === 0 && iterator.iterator.done()) {
|
|
72
|
-
this.clear(id);
|
|
73
|
-
}
|
|
74
|
-
return pending;
|
|
65
|
+
getPending(id: string) {
|
|
66
|
+
return this.queues.get(id)?.iterator.pending();
|
|
75
67
|
}
|
|
76
68
|
}
|