@fireproof/core 0.19.117 → 0.19.119-dev-log
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +1 -1
- package/tests/blockstore/fragment-gateway.test.ts +2 -3
- package/tests/blockstore/keyed-crypto.test.ts +7 -7
- package/tests/blockstore/loader.test.ts +4 -5
- package/tests/blockstore/store.test.ts +5 -6
- package/tests/blockstore/transaction.test.ts +5 -6
- package/tests/fireproof/all-gateway.test.ts +4 -5
- package/tests/fireproof/config.test.ts +2 -3
- package/tests/fireproof/crdt.test.ts +10 -11
- package/tests/fireproof/database.test.ts +9 -9
- package/tests/fireproof/fireproof.test.ts +11 -11
- package/tests/fireproof/indexer.test.ts +9 -10
- package/tests/fireproof/multiple-ledger.test.ts +2 -3
- package/tests/fireproof/utils.test.ts +2 -3
- package/tests/helpers.ts +15 -15
- package/web/gateway-impl.d.cts +1 -0
- package/web/gateway-impl.d.ts +1 -0
@@ -3,8 +3,7 @@ import { sha256 as hasher } from "multiformats/hashes/sha2";
|
|
3
3
|
import { BlockView } from "multiformats";
|
4
4
|
import { CID } from "multiformats/cid";
|
5
5
|
import { MemoryBlockstore } from "@fireproof/vendor/@web3-storage/pail/block";
|
6
|
-
import { CRDTMeta, IndexTransactionMeta, SuperThis, bs, rt } from "@fireproof/core";
|
7
|
-
import { mockSuperThis } from "../helpers.js";
|
6
|
+
import { CRDTMeta, IndexTransactionMeta, SuperThis, bs, ensureSuperThis, rt } from "@fireproof/core";
|
8
7
|
|
9
8
|
class MyMemoryBlockStore extends bs.EncryptedBlockstore {
|
10
9
|
readonly memblock = new MemoryBlockstore();
|
@@ -51,7 +50,7 @@ describe("basic Loader simple", function () {
|
|
51
50
|
let loader: bs.Loader;
|
52
51
|
let block: BlockView;
|
53
52
|
let t: bs.CarTransaction;
|
54
|
-
const sthis =
|
53
|
+
const sthis = ensureSuperThis();
|
55
54
|
|
56
55
|
afterEach(async function () {
|
57
56
|
await loader.close();
|
@@ -99,7 +98,7 @@ describe("basic Loader with two commits", function () {
|
|
99
98
|
let carCid: bs.CarGroup;
|
100
99
|
let carCid0: bs.CarGroup;
|
101
100
|
|
102
|
-
const sthis =
|
101
|
+
const sthis = ensureSuperThis();
|
103
102
|
|
104
103
|
afterEach(async function () {
|
105
104
|
await loader.close();
|
@@ -201,7 +200,7 @@ describe("basic Loader with index commits", function () {
|
|
201
200
|
let indexerResult: IndexTransactionMeta;
|
202
201
|
let cid: CID;
|
203
202
|
// let indexMap: Map<string, CID>;
|
204
|
-
const sthis =
|
203
|
+
const sthis = ensureSuperThis();
|
205
204
|
|
206
205
|
afterEach(async function () {
|
207
206
|
await ib.close();
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { CID } from "multiformats";
|
2
|
-
import { bs, NotFoundError, SuperThis } from "@fireproof/core";
|
3
|
-
import { mockSuperThis } from "../helpers.js";
|
2
|
+
import { bs, ensureSuperThis, NotFoundError, SuperThis } from "@fireproof/core";
|
4
3
|
|
5
4
|
function runtime(sthis: SuperThis) {
|
6
5
|
return bs.toStoreRuntime({}, sthis);
|
@@ -20,7 +19,7 @@ describe("DataStore", function () {
|
|
20
19
|
let store: bs.DataStore;
|
21
20
|
let raw: bs.TestGateway;
|
22
21
|
|
23
|
-
const sthis =
|
22
|
+
const sthis = ensureSuperThis();
|
24
23
|
afterEach(async () => {
|
25
24
|
await store.close();
|
26
25
|
await store.destroy();
|
@@ -53,7 +52,7 @@ describe("DataStore with a saved car", function () {
|
|
53
52
|
let raw: bs.TestGateway;
|
54
53
|
let car: bs.AnyBlock;
|
55
54
|
|
56
|
-
const sthis =
|
55
|
+
const sthis = ensureSuperThis();
|
57
56
|
|
58
57
|
afterEach(async () => {
|
59
58
|
await store.close();
|
@@ -95,7 +94,7 @@ describe("MetaStore", function () {
|
|
95
94
|
let store: bs.MetaStore;
|
96
95
|
let raw: bs.TestGateway;
|
97
96
|
|
98
|
-
const sthis =
|
97
|
+
const sthis = ensureSuperThis();
|
99
98
|
|
100
99
|
afterEach(async () => {
|
101
100
|
await store.close();
|
@@ -133,7 +132,7 @@ describe("MetaStore with a saved header", function () {
|
|
133
132
|
let store: bs.MetaStore;
|
134
133
|
let raw: bs.TestGateway;
|
135
134
|
let cid: CID;
|
136
|
-
const sthis =
|
135
|
+
const sthis = ensureSuperThis();
|
137
136
|
|
138
137
|
afterEach(async () => {
|
139
138
|
await store.close();
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { CID } from "multiformats";
|
2
|
-
import { bs, SuperThis } from "@fireproof/core";
|
3
|
-
import { mockSuperThis } from "../helpers.js";
|
2
|
+
import { bs, ensureSuperThis, SuperThis } from "@fireproof/core";
|
4
3
|
|
5
4
|
describe("Fresh TransactionBlockstore", function () {
|
6
5
|
let blocks: bs.BaseBlockstore;
|
7
|
-
const sthis =
|
6
|
+
const sthis = ensureSuperThis();
|
8
7
|
beforeEach(function () {
|
9
8
|
blocks = new bs.BaseBlockstore();
|
10
9
|
});
|
@@ -33,7 +32,7 @@ describe("Fresh TransactionBlockstore", function () {
|
|
33
32
|
|
34
33
|
describe("TransactionBlockstore with name", function () {
|
35
34
|
let blocks: bs.EncryptedBlockstore;
|
36
|
-
const sthis =
|
35
|
+
const sthis = ensureSuperThis();
|
37
36
|
beforeEach(function () {
|
38
37
|
blocks = new bs.EncryptedBlockstore(sthis, { name: "test" });
|
39
38
|
});
|
@@ -57,7 +56,7 @@ describe("TransactionBlockstore with name", function () {
|
|
57
56
|
describe("A transaction", function () {
|
58
57
|
let tblocks: bs.CarTransaction;
|
59
58
|
let blocks: bs.EncryptedBlockstore;
|
60
|
-
const sthis =
|
59
|
+
const sthis = ensureSuperThis();
|
61
60
|
beforeEach(async function () {
|
62
61
|
blocks = new bs.EncryptedBlockstore(sthis, { name: "test" });
|
63
62
|
tblocks = new bs.CarTransaction(blocks);
|
@@ -83,7 +82,7 @@ describe("TransactionBlockstore with a completed transaction", function () {
|
|
83
82
|
let blocks: bs.BaseBlockstore;
|
84
83
|
let cid: CID;
|
85
84
|
let cid2: CID;
|
86
|
-
const sthis =
|
85
|
+
const sthis = ensureSuperThis();
|
87
86
|
|
88
87
|
beforeEach(async function () {
|
89
88
|
cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { Database, bs } from "@fireproof/core";
|
1
|
+
import { Database, bs, ensureSuperThis } from "@fireproof/core";
|
2
2
|
import { URI } from "@adviser/cement";
|
3
3
|
|
4
4
|
import { fileContent } from "./cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js";
|
5
|
-
import { mockSuperThis } from "../helpers.js";
|
6
5
|
|
7
6
|
function customExpect(value: unknown, matcher: (val: unknown) => void, message: string): void {
|
8
7
|
try {
|
@@ -37,7 +36,7 @@ describe("noop Gateway", function () {
|
|
37
36
|
let fileGateway: ExtendedGateway;
|
38
37
|
let walGateway: ExtendedGateway;
|
39
38
|
|
40
|
-
const sthis =
|
39
|
+
const sthis = ensureSuperThis();
|
41
40
|
|
42
41
|
afterEach(async function () {
|
43
42
|
await db.close();
|
@@ -302,7 +301,7 @@ describe("noop Gateway subscribe", function () {
|
|
302
301
|
let metaStore: ExtendedStore;
|
303
302
|
|
304
303
|
let metaGateway: ExtendedGateway;
|
305
|
-
const sthis =
|
304
|
+
const sthis = ensureSuperThis();
|
306
305
|
|
307
306
|
afterEach(async function () {
|
308
307
|
await db.close();
|
@@ -352,7 +351,7 @@ describe("Gateway", function () {
|
|
352
351
|
let metaGateway: ExtendedGateway;
|
353
352
|
// let fileGateway: ExtendedGateway;
|
354
353
|
// let walGateway: ExtendedGateway;
|
355
|
-
const sthis =
|
354
|
+
const sthis = ensureSuperThis();
|
356
355
|
|
357
356
|
afterEach(async function () {
|
358
357
|
await db.close();
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { describe, it, expect, beforeAll } from "vitest";
|
2
|
-
import { dataDir, fireproof, rt } from "@fireproof/core";
|
2
|
+
import { dataDir, ensureSuperThis, fireproof, rt } from "@fireproof/core";
|
3
3
|
import { runtimeFn, URI } from "@adviser/cement";
|
4
|
-
import { mockSuperThis } from "../helpers.js";
|
5
4
|
|
6
5
|
describe("runtime", () => {
|
7
6
|
it("runtime", () => {
|
@@ -28,7 +27,7 @@ describe("fireproof/config", () => {
|
|
28
27
|
version: rt.FILESTORE_VERSION,
|
29
28
|
});
|
30
29
|
}
|
31
|
-
const sthis =
|
30
|
+
const sthis = ensureSuperThis();
|
32
31
|
beforeAll(async () => {
|
33
32
|
await sthis.start();
|
34
33
|
if (runtimeFn().isNodeIsh) {
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import { CRDT } from "@fireproof/core";
|
1
|
+
import { CRDT, ensureSuperThis } from "@fireproof/core";
|
2
2
|
import { bs } from "@fireproof/core";
|
3
3
|
import { CRDTMeta, DocValue } from "@fireproof/core";
|
4
4
|
import { Index, index } from "@fireproof/core";
|
5
|
-
import { mockSuperThis } from "../helpers.js";
|
6
5
|
|
7
6
|
describe("Fresh crdt", function () {
|
8
7
|
let crdt: CRDT<{ hello: string } | { points: number }>;
|
9
|
-
const sthis =
|
8
|
+
const sthis = ensureSuperThis();
|
10
9
|
afterEach(async function () {
|
11
10
|
await crdt.close();
|
12
11
|
await crdt.destroy();
|
@@ -41,7 +40,7 @@ describe("CRDT with one record", function () {
|
|
41
40
|
}
|
42
41
|
let crdt: CRDT<Partial<CRDTTestType>>;
|
43
42
|
let firstPut: CRDTMeta;
|
44
|
-
const sthis =
|
43
|
+
const sthis = ensureSuperThis();
|
45
44
|
|
46
45
|
afterEach(async function () {
|
47
46
|
await crdt.close();
|
@@ -92,7 +91,7 @@ describe("CRDT with a multi-write", function () {
|
|
92
91
|
}
|
93
92
|
let crdt: CRDT<CRDTTestType>;
|
94
93
|
let firstPut: CRDTMeta;
|
95
|
-
const sthis =
|
94
|
+
const sthis = ensureSuperThis();
|
96
95
|
|
97
96
|
afterEach(async function () {
|
98
97
|
await crdt.close();
|
@@ -158,7 +157,7 @@ describe("CRDT with two multi-writes", function () {
|
|
158
157
|
let crdt: CRDT<CRDTTestType>;
|
159
158
|
let firstPut: CRDTMeta;
|
160
159
|
let secondPut: CRDTMeta;
|
161
|
-
const sthis =
|
160
|
+
const sthis = ensureSuperThis();
|
162
161
|
afterEach(async function () {
|
163
162
|
await crdt.close();
|
164
163
|
await crdt.destroy();
|
@@ -206,7 +205,7 @@ describe("CRDT with two multi-writes", function () {
|
|
206
205
|
|
207
206
|
describe("Compact a named CRDT with writes", function () {
|
208
207
|
let crdt: CRDT<CRDTTestType>;
|
209
|
-
const sthis =
|
208
|
+
const sthis = ensureSuperThis();
|
210
209
|
afterEach(async function () {
|
211
210
|
await crdt.close();
|
212
211
|
await crdt.destroy();
|
@@ -262,7 +261,7 @@ describe("Compact a named CRDT with writes", function () {
|
|
262
261
|
describe("CRDT with an index", function () {
|
263
262
|
let crdt: CRDT<CRDTTestType>;
|
264
263
|
let idx: Index<number, CRDTTestType>;
|
265
|
-
const sthis =
|
264
|
+
const sthis = ensureSuperThis();
|
266
265
|
afterEach(async function () {
|
267
266
|
await crdt.close();
|
268
267
|
await crdt.destroy();
|
@@ -308,7 +307,7 @@ describe("Loader with a committed transaction", function () {
|
|
308
307
|
let crdt: CRDT<CRDTTestType>;
|
309
308
|
let done: CRDTMeta;
|
310
309
|
const dbname = "test-loader";
|
311
|
-
const sthis =
|
310
|
+
const sthis = ensureSuperThis();
|
312
311
|
afterEach(async function () {
|
313
312
|
await crdt.close();
|
314
313
|
await crdt.destroy();
|
@@ -351,7 +350,7 @@ describe("Loader with two committed transactions", function () {
|
|
351
350
|
let blockstore: bs.EncryptedBlockstore;
|
352
351
|
let done1: CRDTMeta;
|
353
352
|
let done2: CRDTMeta;
|
354
|
-
const sthis =
|
353
|
+
const sthis = ensureSuperThis();
|
355
354
|
afterEach(async function () {
|
356
355
|
await crdt.close();
|
357
356
|
await crdt.destroy();
|
@@ -401,7 +400,7 @@ describe("Loader with many committed transactions", function () {
|
|
401
400
|
let crdt: CRDT<Doc>;
|
402
401
|
let dones: CRDTMeta[];
|
403
402
|
const count = 10;
|
404
|
-
const sthis =
|
403
|
+
const sthis = ensureSuperThis();
|
405
404
|
afterEach(async function () {
|
406
405
|
await crdt.close();
|
407
406
|
await crdt.destroy();
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { buildBlobFiles, FileWithCid
|
2
|
-
import { bs, Database, DocResponse, DocFileMeta, DocWithId, DocFiles } from "@fireproof/core";
|
1
|
+
import { buildBlobFiles, FileWithCid } from "../helpers.js";
|
2
|
+
import { bs, Database, DocResponse, DocFileMeta, DocWithId, DocFiles, ensureSuperThis } from "@fireproof/core";
|
3
3
|
|
4
4
|
describe("basic Database", () => {
|
5
5
|
let db: Database;
|
6
|
-
const sthis =
|
6
|
+
const sthis = ensureSuperThis();
|
7
7
|
afterEach(async () => {
|
8
8
|
await db.close();
|
9
9
|
await db.destroy();
|
@@ -39,7 +39,7 @@ describe("basic Database with record", function () {
|
|
39
39
|
readonly value: string;
|
40
40
|
}
|
41
41
|
let db: Database;
|
42
|
-
const sthis =
|
42
|
+
const sthis = ensureSuperThis();
|
43
43
|
afterEach(async () => {
|
44
44
|
await db.close();
|
45
45
|
await db.destroy();
|
@@ -93,7 +93,7 @@ describe("named Database with record", function () {
|
|
93
93
|
readonly value: string;
|
94
94
|
}
|
95
95
|
let db: Database;
|
96
|
-
const sthis =
|
96
|
+
const sthis = ensureSuperThis();
|
97
97
|
afterEach(async () => {
|
98
98
|
await db.close();
|
99
99
|
await db.destroy();
|
@@ -220,7 +220,7 @@ describe("named Database with record", function () {
|
|
220
220
|
describe("basic Database parallel writes / public", function () {
|
221
221
|
let db: Database;
|
222
222
|
const writes: Promise<DocResponse>[] = [];
|
223
|
-
const sthis =
|
223
|
+
const sthis = ensureSuperThis();
|
224
224
|
afterEach(async () => {
|
225
225
|
await db.close();
|
226
226
|
await db.destroy();
|
@@ -300,7 +300,7 @@ describe("basic Database with subscription", function () {
|
|
300
300
|
let unsubscribe: () => void;
|
301
301
|
let lastDoc: DocWithId<NonNullable<unknown>>;
|
302
302
|
let waitForSub: Promise<void>;
|
303
|
-
const sthis =
|
303
|
+
const sthis = ensureSuperThis();
|
304
304
|
afterEach(async () => {
|
305
305
|
await db.close();
|
306
306
|
await db.destroy();
|
@@ -344,7 +344,7 @@ describe("basic Database with no update subscription", function () {
|
|
344
344
|
let db: Database;
|
345
345
|
let didRun: number;
|
346
346
|
let unsubscribe: () => void;
|
347
|
-
const sthis =
|
347
|
+
const sthis = ensureSuperThis();
|
348
348
|
afterEach(async () => {
|
349
349
|
await db.close();
|
350
350
|
await db.destroy();
|
@@ -381,7 +381,7 @@ describe("database with files input", () => {
|
|
381
381
|
let db: Database;
|
382
382
|
let imagefiles: FileWithCid[] = [];
|
383
383
|
let result: DocResponse;
|
384
|
-
const sthis =
|
384
|
+
const sthis = ensureSuperThis();
|
385
385
|
|
386
386
|
afterEach(async () => {
|
387
387
|
await db.close();
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { sleep } from "../helpers.js";
|
2
2
|
import { docs } from "./fireproof.test.fixture.js";
|
3
3
|
import { CID } from "multiformats/cid";
|
4
4
|
|
5
|
-
import { Database, DocResponse, DocWithId, Index, IndexRows, MapFn, bs, fireproof, index } from "@fireproof/core";
|
5
|
+
import { Database, DocResponse, DocWithId, Index, IndexRows, MapFn, bs, ensureSuperThis, fireproof, index } from "@fireproof/core";
|
6
6
|
|
7
7
|
export function carLogIncludesGroup(list: bs.AnyLink[], cid: CID) {
|
8
8
|
return list.some((c) => c.equals(cid));
|
@@ -25,7 +25,7 @@ describe("dreamcode", function () {
|
|
25
25
|
let doc: DocWithId<Doc>;
|
26
26
|
let result: IndexRows<string, Doc>;
|
27
27
|
let db: Database;
|
28
|
-
const sthis =
|
28
|
+
const sthis = ensureSuperThis();
|
29
29
|
afterEach(async function () {
|
30
30
|
await db.close();
|
31
31
|
await db.destroy();
|
@@ -67,7 +67,7 @@ describe("public API", function () {
|
|
67
67
|
let ok: DocResponse;
|
68
68
|
let doc: DocWithId<Doc>;
|
69
69
|
let query: IndexRows<string, Doc>;
|
70
|
-
const sthis =
|
70
|
+
const sthis = ensureSuperThis();
|
71
71
|
|
72
72
|
afterEach(async () => {
|
73
73
|
await db.close();
|
@@ -106,7 +106,7 @@ describe("basic database", function () {
|
|
106
106
|
foo: string;
|
107
107
|
}
|
108
108
|
let db: Database<Doc>;
|
109
|
-
const sthis =
|
109
|
+
const sthis = ensureSuperThis();
|
110
110
|
afterEach(async function () {
|
111
111
|
await db.close();
|
112
112
|
await db.destroy();
|
@@ -170,7 +170,7 @@ describe("basic database", function () {
|
|
170
170
|
|
171
171
|
describe("benchmarking with compaction", function () {
|
172
172
|
let db: Database;
|
173
|
-
const sthis =
|
173
|
+
const sthis = ensureSuperThis();
|
174
174
|
afterEach(async function () {
|
175
175
|
await db.close();
|
176
176
|
await db.destroy();
|
@@ -225,7 +225,7 @@ describe("benchmarking with compaction", function () {
|
|
225
225
|
describe("benchmarking a database", function () {
|
226
226
|
/** @type {Database} */
|
227
227
|
let db: Database;
|
228
|
-
const sthis =
|
228
|
+
const sthis = ensureSuperThis();
|
229
229
|
afterEach(async function () {
|
230
230
|
await db.close();
|
231
231
|
await db.destroy();
|
@@ -383,7 +383,7 @@ describe("Reopening a database", function () {
|
|
383
383
|
foo: string;
|
384
384
|
}
|
385
385
|
let db: Database;
|
386
|
-
const sthis =
|
386
|
+
const sthis = ensureSuperThis();
|
387
387
|
afterEach(async function () {
|
388
388
|
await db.close();
|
389
389
|
await db.destroy();
|
@@ -488,7 +488,7 @@ describe("Reopening a database with indexes", function () {
|
|
488
488
|
let idx: Index<string, Doc>;
|
489
489
|
let didMap: boolean;
|
490
490
|
let mapFn: MapFn<Doc>;
|
491
|
-
const sthis =
|
491
|
+
const sthis = ensureSuperThis();
|
492
492
|
afterEach(async function () {
|
493
493
|
await db.close();
|
494
494
|
await db.destroy();
|
@@ -585,7 +585,7 @@ describe("Reopening a database with indexes", function () {
|
|
585
585
|
});
|
586
586
|
|
587
587
|
describe("basic js verify", function () {
|
588
|
-
const sthis =
|
588
|
+
const sthis = ensureSuperThis();
|
589
589
|
beforeAll(async function () {
|
590
590
|
await sthis.start();
|
591
591
|
});
|
@@ -617,7 +617,7 @@ describe("same workload twice, same CID", function () {
|
|
617
617
|
let headA: string;
|
618
618
|
let headB: string;
|
619
619
|
|
620
|
-
const sthis =
|
620
|
+
const sthis = ensureSuperThis();
|
621
621
|
// let configA: any;
|
622
622
|
// let configB: any;
|
623
623
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { Index, index, Database, CRDT, IndexRows } from "@fireproof/core";
|
2
|
-
import { mockSuperThis } from "../helpers.js";
|
1
|
+
import { Index, index, Database, CRDT, IndexRows, ensureSuperThis } from "@fireproof/core";
|
3
2
|
|
4
3
|
interface TestType {
|
5
4
|
readonly title: string;
|
@@ -10,7 +9,7 @@ describe("basic Index", () => {
|
|
10
9
|
let db: Database<TestType>;
|
11
10
|
let indexer: Index<string, TestType>;
|
12
11
|
let didMap: boolean;
|
13
|
-
const sthis =
|
12
|
+
const sthis = ensureSuperThis();
|
14
13
|
afterEach(async function () {
|
15
14
|
await db.close();
|
16
15
|
await db.destroy();
|
@@ -97,7 +96,7 @@ describe("basic Index", () => {
|
|
97
96
|
describe("Index query with compound key", function () {
|
98
97
|
let db: Database<TestType>;
|
99
98
|
let indexer: Index<[string, number], TestType>;
|
100
|
-
const sthis =
|
99
|
+
const sthis = ensureSuperThis();
|
101
100
|
afterEach(async function () {
|
102
101
|
await db.close();
|
103
102
|
await db.destroy();
|
@@ -127,7 +126,7 @@ describe("Index query with compound key", function () {
|
|
127
126
|
describe("basic Index with map fun", function () {
|
128
127
|
let db: Database<TestType>;
|
129
128
|
let indexer: Index<string, TestType>;
|
130
|
-
const sthis =
|
129
|
+
const sthis = ensureSuperThis();
|
131
130
|
afterEach(async function () {
|
132
131
|
await db.close();
|
133
132
|
await db.destroy();
|
@@ -157,7 +156,7 @@ describe("basic Index with map fun", function () {
|
|
157
156
|
describe("basic Index with map fun with value", function () {
|
158
157
|
let db: Database<TestType>;
|
159
158
|
let indexer: Index<string, TestType, number>;
|
160
|
-
const sthis =
|
159
|
+
const sthis = ensureSuperThis();
|
161
160
|
afterEach(async function () {
|
162
161
|
await db.close();
|
163
162
|
await db.destroy();
|
@@ -195,7 +194,7 @@ describe("basic Index with map fun with value", function () {
|
|
195
194
|
describe("Index query with map and compound key", function () {
|
196
195
|
let db: Database<TestType>;
|
197
196
|
let indexer: Index<[string, number], TestType>;
|
198
|
-
const sthis =
|
197
|
+
const sthis = ensureSuperThis();
|
199
198
|
afterEach(async function () {
|
200
199
|
await db.close();
|
201
200
|
await db.destroy();
|
@@ -225,7 +224,7 @@ describe("Index query with map and compound key", function () {
|
|
225
224
|
describe("basic Index with string fun", function () {
|
226
225
|
let db: Database<TestType>;
|
227
226
|
let indexer: Index<string, TestType>;
|
228
|
-
const sthis =
|
227
|
+
const sthis = ensureSuperThis();
|
229
228
|
afterEach(async function () {
|
230
229
|
await db.close();
|
231
230
|
await db.destroy();
|
@@ -264,7 +263,7 @@ describe("basic Index upon cold start", function () {
|
|
264
263
|
let didMap: number;
|
265
264
|
let mapFn: (doc: TestType) => string;
|
266
265
|
let result: IndexRows<string, TestType>;
|
267
|
-
const sthis =
|
266
|
+
const sthis = ensureSuperThis();
|
268
267
|
// result, mapFn;
|
269
268
|
afterEach(async function () {
|
270
269
|
await crdt.close();
|
@@ -355,7 +354,7 @@ describe("basic Index with no data", function () {
|
|
355
354
|
let db: Database<TestType>;
|
356
355
|
let indexer: Index<string, TestType>;
|
357
356
|
let didMap: boolean;
|
358
|
-
const sthis =
|
357
|
+
const sthis = ensureSuperThis();
|
359
358
|
afterEach(async function () {
|
360
359
|
await db.close();
|
361
360
|
await db.destroy();
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { Database, fireproof } from "
|
2
|
-
import { mockSuperThis } from "../helpers.js";
|
1
|
+
import { Database, ensureSuperThis, fireproof } from "@fireproof/core";
|
3
2
|
|
4
3
|
interface DBItem {
|
5
4
|
readonly db: Database;
|
@@ -17,7 +16,7 @@ function shuffle(ina: DBItem[]): DBItem[] {
|
|
17
16
|
|
18
17
|
describe("Multiple Databases", () => {
|
19
18
|
const dbs: DBItem[] = [];
|
20
|
-
const sthis =
|
19
|
+
const sthis = ensureSuperThis();
|
21
20
|
const rows = 10;
|
22
21
|
const concurrentDbs = 7;
|
23
22
|
beforeEach(async () => {
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import { URI } from "@adviser/cement";
|
2
|
-
import { rt, getStore, ensureSuperLog } from "@fireproof/core";
|
3
|
-
import { mockSuperThis } from "../helpers.js";
|
2
|
+
import { rt, getStore, ensureSuperLog, ensureSuperThis } from "@fireproof/core";
|
4
3
|
|
5
4
|
// only for test
|
6
5
|
import { UUID } from "uuidv7";
|
7
6
|
|
8
7
|
describe("utils", () => {
|
9
|
-
const sthis =
|
8
|
+
const sthis = ensureSuperThis();
|
10
9
|
const logger = ensureSuperLog(sthis, "getfilename");
|
11
10
|
|
12
11
|
beforeAll(async () => {
|
package/tests/helpers.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { dataDir,
|
1
|
+
import { runtimeFn, toCryptoRuntime, URI } from "@adviser/cement";
|
2
|
+
import { dataDir, rt, SuperThis } from "@fireproof/core";
|
3
3
|
|
4
4
|
export { dataDir };
|
5
5
|
|
@@ -37,16 +37,16 @@ export function storageURL(sthis: SuperThis): URI {
|
|
37
37
|
return merged;
|
38
38
|
}
|
39
39
|
|
40
|
-
export type MockSuperThis = SuperThis & { logCollector: LogCollector };
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
42
|
-
export function mockSuperThis(sthis?: Partial<SuperThisOpts>): MockSuperThis {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
40
|
+
// export type MockSuperThis = SuperThis & { logCollector: LogCollector };
|
41
|
+
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
42
|
+
// export function mockSuperThis(sthis?: Partial<SuperThisOpts>): MockSuperThis {
|
43
|
+
// const mockLog = MockLogger();
|
44
|
+
// const ethis = ensureSuperThis({
|
45
|
+
// logger: mockLog.logger,
|
46
|
+
// ctx: {
|
47
|
+
// logCollector: mockLog.logCollector,
|
48
|
+
// },
|
49
|
+
// }) as MockSuperThis;
|
50
|
+
// ethis.logCollector = mockLog.logCollector;
|
51
|
+
// return ethis;
|
52
|
+
// }
|
package/web/gateway-impl.d.cts
CHANGED