@fireproof/core 0.20.0-dev-preview-12 → 0.20.0-dev-preview-14
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/index.cjs +30 -5
- package/index.cjs.map +1 -1
- package/index.d.cts +19 -2
- package/index.d.ts +19 -2
- package/index.js +30 -5
- 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/fireproof/all-gateway.test.ts +15 -18
@@ -2,6 +2,7 @@ import { Database, Ledger, LedgerFactory, PARAM, bs, ensureSuperThis, fireproof
|
|
2
2
|
|
3
3
|
import { fileContent } from "./cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js";
|
4
4
|
import { simpleCID } from "../helpers.js";
|
5
|
+
import { Future } from "@adviser/cement";
|
5
6
|
|
6
7
|
// import { DataStore, MetaStore, WALState, WALStore } from "../../src/blockstore/types.js";
|
7
8
|
// import { Gateway } from "../../src/blockstore/gateway.js";
|
@@ -386,25 +387,21 @@ describe("noop Gateway subscribe", function () {
|
|
386
387
|
const metaUrl = await metaGateway.buildUrl(sthis, metaStore.url(), "main");
|
387
388
|
await metaGateway.start(sthis, metaStore.url());
|
388
389
|
|
389
|
-
let resolve: () => void;
|
390
390
|
let didCall = false;
|
391
|
-
const p = new
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
await p;
|
406
|
-
expect(didCall).toBeTruthy();
|
407
|
-
}
|
391
|
+
const p = new Future<void>();
|
392
|
+
|
393
|
+
const metaSubscribeResult = (await metaGateway.subscribe(sthis, metaUrl.Ok(), async (data: bs.FPEnvelopeMeta) => {
|
394
|
+
// const decodedData = sthis.txt.decode(data);
|
395
|
+
expect(Array.isArray(data.payload)).toBeTruthy();
|
396
|
+
didCall = true;
|
397
|
+
p.resolve();
|
398
|
+
})) as bs.UnsubscribeResult;
|
399
|
+
expect(metaSubscribeResult.isOk()).toBeTruthy();
|
400
|
+
const ok = await db.put({ _id: "key1", hello: "world1" });
|
401
|
+
expect(ok).toBeTruthy();
|
402
|
+
expect(ok.id).toBe("key1");
|
403
|
+
await p.asPromise();
|
404
|
+
expect(didCall).toBeTruthy();
|
408
405
|
});
|
409
406
|
});
|
410
407
|
|