@fireproof/core-test 0.23.1 → 0.23.2

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.
Files changed (91) hide show
  1. package/blockstore/interceptor-gateway.test.js.map +1 -1
  2. package/blockstore/keyed-crypto-indexeddb-file.test.js.map +1 -1
  3. package/blockstore/keyed-crypto.test.js.map +1 -1
  4. package/blockstore/loader.test.js.map +1 -1
  5. package/blockstore/standalone.test.js.map +1 -1
  6. package/blockstore/store.test.js.map +1 -1
  7. package/blockstore/transaction.test.js.map +1 -1
  8. package/fireproof/all-gateway.test.js.map +1 -1
  9. package/fireproof/attachable.test.js.map +1 -1
  10. package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js.map +1 -1
  11. package/fireproof/charwise-boolean.test.js.map +1 -1
  12. package/fireproof/compact-strategy.test.js.map +1 -1
  13. package/fireproof/concurrent.test.js.map +1 -1
  14. package/fireproof/crdt.test.js.map +1 -1
  15. package/fireproof/database.test.js.map +1 -1
  16. package/fireproof/deleted-docs-handling.test.js.map +1 -1
  17. package/fireproof/fireproof.test.fixture.js.map +1 -1
  18. package/fireproof/fireproof.test.js.map +1 -1
  19. package/fireproof/hello.test.js.map +1 -1
  20. package/fireproof/indexer.test.js.map +1 -1
  21. package/fireproof/multiple-ledger.test.js.map +1 -1
  22. package/fireproof/query-docs.test.js.map +1 -1
  23. package/fireproof/query-limit-issue.test.js.map +1 -1
  24. package/fireproof/query-property-inconsistency.test.js.map +1 -1
  25. package/fireproof/query-result-properties.test.js.map +1 -1
  26. package/fireproof/stable-cid.test.js.map +1 -1
  27. package/fireproof/utils.test.js.map +1 -1
  28. package/gateway/file/loader-config.test.js.map +1 -1
  29. package/gateway/indexeddb/create-db-on-write.test.js.map +1 -1
  30. package/gateway/indexeddb/loader-config.test.js.map +1 -1
  31. package/global-setup.js.map +1 -1
  32. package/helpers.js.map +1 -1
  33. package/package.json +18 -18
  34. package/protocols/cloud/msger.test.js.map +1 -1
  35. package/runtime/fp-envelope-serialize.test.js.map +1 -1
  36. package/runtime/key-bag.test.js.map +1 -1
  37. package/runtime/meta-key-hack.test.js.map +1 -1
  38. package/setup.file.js.map +1 -1
  39. package/setup.indexeddb.js.map +1 -1
  40. package/setup.memory.js.map +1 -1
  41. package/vitest.config.js.map +1 -1
  42. package/vitest.file.config.js.map +1 -1
  43. package/vitest.indexeddb.config.js.map +1 -1
  44. package/vitest.memory.config.js.map +1 -1
  45. package/blockstore/fp-envelope.test.ts-off +0 -65
  46. package/blockstore/fragment-gateway.test.ts-off +0 -106
  47. package/blockstore/interceptor-gateway.test.ts +0 -259
  48. package/blockstore/keyed-crypto-indexeddb-file.test.ts +0 -134
  49. package/blockstore/keyed-crypto.test.ts +0 -381
  50. package/blockstore/loader.test.ts +0 -313
  51. package/blockstore/standalone.test.ts +0 -156
  52. package/blockstore/store.test.ts +0 -199
  53. package/blockstore/transaction.test.ts +0 -132
  54. package/fireproof/all-gateway.test.ts +0 -477
  55. package/fireproof/attachable.test.ts +0 -677
  56. package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
  57. package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +0 -324
  58. package/fireproof/charwise-boolean.test.ts +0 -68
  59. package/fireproof/compact-strategy.test.ts +0 -40
  60. package/fireproof/concurrent.test.ts +0 -37
  61. package/fireproof/crdt.test.ts +0 -572
  62. package/fireproof/database.test.ts +0 -772
  63. package/fireproof/deleted-docs-handling.test.ts +0 -112
  64. package/fireproof/fireproof.test.fixture.ts +0 -133
  65. package/fireproof/fireproof.test.ts +0 -767
  66. package/fireproof/hello.test.ts +0 -75
  67. package/fireproof/indexer.test.ts +0 -459
  68. package/fireproof/multiple-ledger.test.ts +0 -67
  69. package/fireproof/query-docs.test.ts +0 -117
  70. package/fireproof/query-limit-issue.test.ts +0 -147
  71. package/fireproof/query-property-inconsistency.test.ts +0 -90
  72. package/fireproof/query-result-properties.test.ts +0 -43
  73. package/fireproof/stable-cid.test.ts +0 -72
  74. package/fireproof/utils.test.ts +0 -137
  75. package/gateway/file/loader-config.test.ts +0 -309
  76. package/gateway/indexeddb/create-db-on-write.test.ts +0 -202
  77. package/gateway/indexeddb/loader-config.test.ts +0 -80
  78. package/global-setup.ts +0 -11
  79. package/helpers.ts +0 -177
  80. package/protocols/cloud/msger.test.ts +0 -559
  81. package/runtime/fp-envelope-serialize.test.ts +0 -266
  82. package/runtime/key-bag.test.ts +0 -243
  83. package/runtime/meta-key-hack.test.ts +0 -103
  84. package/setup.file.ts +0 -1
  85. package/setup.indexeddb.ts +0 -0
  86. package/setup.memory.ts +0 -2
  87. package/tsconfig.json +0 -18
  88. package/vitest.config.ts +0 -8
  89. package/vitest.file.config.ts +0 -11
  90. package/vitest.indexeddb.config.ts +0 -34
  91. package/vitest.memory.config.ts +0 -24
package/helpers.ts DELETED
@@ -1,177 +0,0 @@
1
- import { BuildURI, MockLogger, runtimeFn, toCryptoRuntime, URI, utils, LogCollector, Logger, AppContext } from "@adviser/cement";
2
- import { SuperThis, SuperThisOpts, PARAM, Attachable, Attached, CarTransaction, Falsy, DbMeta } from "@fireproof/core";
3
- import { CID } from "multiformats";
4
- import { sha256 } from "multiformats/hashes/sha2";
5
- import * as json from "multiformats/codecs/json";
6
- import { CommitQueue, encodeFile, ensureSuperThis, TaskManager } from "@fireproof/core-runtime";
7
- import { defaultKeyBagOpts, getKeyBag, KeyBag } from "@fireproof/core-keybag";
8
- import { AttachedRemotesImpl, toStoreRuntime } from "@fireproof/core-blockstore";
9
- import {
10
- Loadable,
11
- BlockstoreRuntime,
12
- CarLog,
13
- AttachedStores,
14
- ActiveStore,
15
- CarGroup,
16
- CommitOpts,
17
- FPBlock,
18
- CarBlockItem,
19
- TransactionMeta,
20
- AnyLink,
21
- } from "@fireproof/core-types-blockstore";
22
-
23
- /* eslint-disable @typescript-eslint/no-empty-function */
24
- export function tracer() {}
25
-
26
- async function toFileWithCid(buffer: Uint8Array, name: string, opts: FilePropertyBag): Promise<FileWithCid> {
27
- return {
28
- file: new File([new Blob([buffer])], name, opts),
29
- cid: (await encodeFile(new File([new Blob([buffer])], name, opts))).cid.toString(),
30
- };
31
- }
32
-
33
- export interface FileWithCid {
34
- file: File;
35
- cid: string;
36
- }
37
- export async function buildBlobFiles(): Promise<FileWithCid[]> {
38
- const cp = toCryptoRuntime();
39
- return [
40
- await toFileWithCid(cp.randomBytes(Math.random() * 51283), `image.jpg`, { type: "image/jpeg" }),
41
- await toFileWithCid(cp.randomBytes(Math.random() * 51283), `fireproof.png`, { type: "image/png" }),
42
- ];
43
- }
44
-
45
- export function storageURL(sthis: SuperThis): URI {
46
- const old = sthis.env.get("FP_STORAGE_URL");
47
- let merged: URI;
48
- if (runtimeFn().isBrowser) {
49
- merged = URI.merge(`indexeddb://fp`, old, "indexeddb:");
50
- } else {
51
- merged = URI.merge(`./dist/env`, old);
52
- }
53
- return merged;
54
- }
55
-
56
- export type MockSuperThis = SuperThis & { ctx: { readonly logCollector: LogCollector } };
57
- export function mockSuperThis(sthis?: Partial<SuperThisOpts>): MockSuperThis {
58
- const mockLog = MockLogger({
59
- pass: new utils.ConsoleWriterStreamDefaultWriter(new utils.ConsoleWriterStream()),
60
- });
61
- return ensureSuperThis({
62
- ...sthis,
63
- logger: mockLog.logger,
64
- ctx: AppContext.merge({
65
- logCollector: mockLog.logCollector,
66
- }),
67
- }) as MockSuperThis;
68
- }
69
-
70
- export function noopUrl(name?: string): URI {
71
- const burl = BuildURI.from("memory://noop");
72
- burl.setParam(PARAM.NAME, name || "test");
73
- return burl.URI();
74
- }
75
-
76
- export function simpleBlockOpts(sthis: SuperThis, name?: string) {
77
- const url = noopUrl(name);
78
- return {
79
- keyBag: defaultKeyBagOpts(sthis),
80
- storeRuntime: toStoreRuntime(sthis),
81
- storeUrls: {
82
- file: url,
83
- wal: url,
84
- meta: url,
85
- car: url,
86
- },
87
- tracer,
88
- };
89
- }
90
-
91
- export async function simpleCID(sthis: SuperThis) {
92
- const bytes = json.encode({ hello: sthis.nextId().str });
93
- const hash = await sha256.digest(bytes);
94
- return CID.create(1, json.code, hash);
95
- }
96
- class MockLoader implements Loadable {
97
- readonly sthis: SuperThis;
98
- readonly logger: Logger;
99
- readonly ebOpts: BlockstoreRuntime;
100
- readonly carLog: CarLog;
101
- readonly attachedStores: AttachedStores;
102
- readonly taskManager: TaskManager;
103
- readonly commitQueue: CommitQueue<unknown>;
104
-
105
- constructor(sthis: SuperThis) {
106
- this.sthis = sthis;
107
- this.logger = sthis.logger;
108
- this.ebOpts = {
109
- // keyBag: sthis.keyBag,
110
- // storeRuntime: sthis.storeRuntime,
111
- storeUrls: {
112
- file: noopUrl("test"),
113
- wal: noopUrl("test"),
114
- meta: noopUrl("test"),
115
- car: noopUrl("test"),
116
- },
117
- } as BlockstoreRuntime;
118
- this.carLog = new CarLog();
119
- this.taskManager = new TaskManager(sthis, () => Promise.resolve(), {
120
- removeAfter: 3,
121
- retryTimeout: 50,
122
- });
123
- this.attachedStores = new AttachedRemotesImpl(this);
124
- this.commitQueue = new CommitQueue({
125
- tracer,
126
- });
127
- }
128
-
129
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
130
- attach(attached: Attachable): Promise<Attached> {
131
- throw new Error("Method not implemented.");
132
- }
133
- ready(): Promise<void> {
134
- throw new Error("Method not implemented.");
135
- }
136
- close(): Promise<void> {
137
- throw new Error("Method not implemented.");
138
- }
139
- keyBag(): Promise<KeyBag> {
140
- return getKeyBag(this.sthis, {});
141
- }
142
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
143
- handleDbMetasFromStore(metas: DbMeta[], store: ActiveStore): Promise<CarGroup> {
144
- // throw new Error("Method not implemented.");
145
- return Promise.resolve([]);
146
- }
147
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
148
- commit<T = unknown>(t: CarTransaction, done: T, opts: CommitOpts): Promise<CarGroup> {
149
- throw new Error("Method not implemented.");
150
- }
151
- destroy(): Promise<void> {
152
- throw new Error("Method not implemented.");
153
- }
154
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
155
- getBlock(cid: AnyLink, store: ActiveStore): Promise<FPBlock | Falsy> {
156
- throw new Error("Method not implemented.");
157
- }
158
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
159
- loadFileCar(cid: AnyLink, store: ActiveStore): Promise<FPBlock<CarBlockItem>> {
160
- throw new Error("Method not implemented.");
161
- }
162
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
163
- loadCar(cid: AnyLink, store: ActiveStore): Promise<FPBlock<CarBlockItem>> {
164
- throw new Error("Method not implemented.");
165
- }
166
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
167
- commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup> {
168
- throw new Error("Method not implemented.");
169
- }
170
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
171
- entries(cache?: boolean): AsyncIterableIterator<FPBlock> {
172
- throw new Error("Method not implemented.");
173
- }
174
- }
175
- export function mockLoader(sthis: SuperThis): Loadable {
176
- return new MockLoader(sthis);
177
- }