@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/package.json CHANGED
@@ -1,77 +1,76 @@
1
1
  {
2
- "name": "@peerbit/document",
3
- "version": "9.4.3-fb47029",
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-fb47029",
63
- "@peerbit/rpc": "5.2.9-fb47029",
64
- "@peerbit/shared-log": "11.0.8-fb47029",
65
- "@peerbit/indexer-interface": "2.0.9-fb47029",
66
- "@peerbit/indexer-simple": "1.1.14-fb47029",
67
- "@peerbit/indexer-sqlite3": "1.2.18-fb47029",
68
- "@peerbit/document-interface": "2.0.28-fb47029",
69
- "@peerbit/indexer-cache": "0.0.1-fb47029"
70
- },
71
- "devDependencies": {
72
- "@peerbit/test-utils": "2.1.42-fb47029",
73
- "@peerbit/time": "2.1.0-fb47029",
74
- "@types/pidusage": "^2.0.5",
75
- "pidusage": "^3.0.2"
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
- @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
- }
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
- cache?: {
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
- cache: options?.index?.cache,
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
- async getPending(id: string) {
66
- let iterator = this.queues.get(id);
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
  }