@fireproof/core-test 0.0.0-smoke-1b31059-1752074105
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/LICENSE.md +232 -0
- package/blockstore/fp-envelope.test.ts-off +65 -0
- package/blockstore/fragment-gateway.test.ts-off +106 -0
- package/blockstore/interceptor-gateway.test.d.ts +19 -0
- package/blockstore/interceptor-gateway.test.js +217 -0
- package/blockstore/interceptor-gateway.test.js.map +1 -0
- package/blockstore/interceptor-gateway.test.ts +259 -0
- package/blockstore/keyed-crypto-indexeddb-file.test.d.ts +1 -0
- package/blockstore/keyed-crypto-indexeddb-file.test.js +114 -0
- package/blockstore/keyed-crypto-indexeddb-file.test.js.map +1 -0
- package/blockstore/keyed-crypto-indexeddb-file.test.ts +134 -0
- package/blockstore/keyed-crypto.test.d.ts +1 -0
- package/blockstore/keyed-crypto.test.js +310 -0
- package/blockstore/keyed-crypto.test.js.map +1 -0
- package/blockstore/keyed-crypto.test.ts +382 -0
- package/blockstore/loader.test.d.ts +1 -0
- package/blockstore/loader.test.js +241 -0
- package/blockstore/loader.test.js.map +1 -0
- package/blockstore/loader.test.ts +313 -0
- package/blockstore/standalone.test.d.ts +1 -0
- package/blockstore/standalone.test.js +112 -0
- package/blockstore/standalone.test.js.map +1 -0
- package/blockstore/standalone.test.ts +156 -0
- package/blockstore/store.test.d.ts +1 -0
- package/blockstore/store.test.js +152 -0
- package/blockstore/store.test.js.map +1 -0
- package/blockstore/store.test.ts +199 -0
- package/blockstore/transaction.test.d.ts +1 -0
- package/blockstore/transaction.test.js +109 -0
- package/blockstore/transaction.test.js.map +1 -0
- package/blockstore/transaction.test.ts +132 -0
- package/fireproof/all-gateway.test.d.ts +1 -0
- package/fireproof/all-gateway.test.js +333 -0
- package/fireproof/all-gateway.test.js.map +1 -0
- package/fireproof/all-gateway.test.ts +477 -0
- package/fireproof/attachable.test.d.ts +1 -0
- package/fireproof/attachable.test.js +438 -0
- package/fireproof/attachable.test.js.map +1 -0
- package/fireproof/attachable.test.ts +677 -0
- package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
- package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.d.ts +4 -0
- package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js +325 -0
- package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js.map +1 -0
- package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +324 -0
- package/fireproof/charwise-boolean.test.d.ts +1 -0
- package/fireproof/charwise-boolean.test.js +43 -0
- package/fireproof/charwise-boolean.test.js.map +1 -0
- package/fireproof/charwise-boolean.test.ts +68 -0
- package/fireproof/crdt.test.d.ts +1 -0
- package/fireproof/crdt.test.js +509 -0
- package/fireproof/crdt.test.js.map +1 -0
- package/fireproof/crdt.test.ts +572 -0
- package/fireproof/database.test.d.ts +1 -0
- package/fireproof/database.test.js +658 -0
- package/fireproof/database.test.js.map +1 -0
- package/fireproof/database.test.ts +772 -0
- package/fireproof/deleted-docs-handling.test.d.ts +1 -0
- package/fireproof/deleted-docs-handling.test.js +69 -0
- package/fireproof/deleted-docs-handling.test.js.map +1 -0
- package/fireproof/deleted-docs-handling.test.ts +112 -0
- package/fireproof/fireproof.test.d.ts +3 -0
- package/fireproof/fireproof.test.fixture.d.ts +15 -0
- package/fireproof/fireproof.test.fixture.js +134 -0
- package/fireproof/fireproof.test.fixture.js.map +1 -0
- package/fireproof/fireproof.test.fixture.ts +133 -0
- package/fireproof/fireproof.test.js +574 -0
- package/fireproof/fireproof.test.js.map +1 -0
- package/fireproof/fireproof.test.ts +767 -0
- package/fireproof/hello.test.d.ts +1 -0
- package/fireproof/hello.test.js +67 -0
- package/fireproof/hello.test.js.map +1 -0
- package/fireproof/hello.test.ts +75 -0
- package/fireproof/indexer.test.d.ts +1 -0
- package/fireproof/indexer.test.js +408 -0
- package/fireproof/indexer.test.js.map +1 -0
- package/fireproof/indexer.test.ts +459 -0
- package/fireproof/multiple-ledger.test.d.ts +1 -0
- package/fireproof/multiple-ledger.test.js +51 -0
- package/fireproof/multiple-ledger.test.js.map +1 -0
- package/fireproof/multiple-ledger.test.ts +67 -0
- package/fireproof/query-docs.test.d.ts +1 -0
- package/fireproof/query-docs.test.js +69 -0
- package/fireproof/query-docs.test.js.map +1 -0
- package/fireproof/query-docs.test.ts +117 -0
- package/fireproof/query-limit-issue.test.d.ts +1 -0
- package/fireproof/query-limit-issue.test.js +89 -0
- package/fireproof/query-limit-issue.test.js.map +1 -0
- package/fireproof/query-limit-issue.test.ts +147 -0
- package/fireproof/query-property-inconsistency.test.d.ts +1 -0
- package/fireproof/query-property-inconsistency.test.js +52 -0
- package/fireproof/query-property-inconsistency.test.js.map +1 -0
- package/fireproof/query-property-inconsistency.test.ts +90 -0
- package/fireproof/query-result-properties.test.d.ts +1 -0
- package/fireproof/query-result-properties.test.js +25 -0
- package/fireproof/query-result-properties.test.js.map +1 -0
- package/fireproof/query-result-properties.test.ts +43 -0
- package/fireproof/stable-cid.test.d.ts +1 -0
- package/fireproof/stable-cid.test.js +52 -0
- package/fireproof/stable-cid.test.js.map +1 -0
- package/fireproof/stable-cid.test.ts +72 -0
- package/fireproof/utils.test.d.ts +1 -0
- package/fireproof/utils.test.js +124 -0
- package/fireproof/utils.test.js.map +1 -0
- package/fireproof/utils.test.ts +137 -0
- package/gateway/file/loader-config.test.d.ts +1 -0
- package/gateway/file/loader-config.test.js +255 -0
- package/gateway/file/loader-config.test.js.map +1 -0
- package/gateway/file/loader-config.test.ts +309 -0
- package/gateway/indexeddb/loader-config.test.d.ts +1 -0
- package/gateway/indexeddb/loader-config.test.js +77 -0
- package/gateway/indexeddb/loader-config.test.js.map +1 -0
- package/gateway/indexeddb/loader-config.test.ts +80 -0
- package/global-setup.d.ts +2 -0
- package/global-setup.js +9 -0
- package/global-setup.js.map +1 -0
- package/global-setup.ts +11 -0
- package/helpers.d.ts +31 -0
- package/helpers.js +140 -0
- package/helpers.js.map +1 -0
- package/helpers.ts +177 -0
- package/package.json +75 -0
- package/protocols/cloud/msger.test.d.ts +1 -0
- package/protocols/cloud/msger.test.js +464 -0
- package/protocols/cloud/msger.test.js.map +1 -0
- package/protocols/cloud/msger.test.ts +559 -0
- package/runtime/fp-envelope-serialize.test.d.ts +1 -0
- package/runtime/fp-envelope-serialize.test.js +223 -0
- package/runtime/fp-envelope-serialize.test.js.map +1 -0
- package/runtime/fp-envelope-serialize.test.ts +266 -0
- package/runtime/meta-key-hack.test.d.ts +1 -0
- package/runtime/meta-key-hack.test.js +85 -0
- package/runtime/meta-key-hack.test.js.map +1 -0
- package/runtime/meta-key-hack.test.ts +103 -0
- package/setup.file.d.ts +1 -0
- package/setup.file.js +3 -0
- package/setup.file.js.map +1 -0
- package/setup.file.ts +1 -0
- package/setup.indexeddb.d.ts +1 -0
- package/setup.indexeddb.js +2 -0
- package/setup.indexeddb.js.map +1 -0
- package/setup.indexeddb.ts +0 -0
- package/setup.memory.d.ts +1 -0
- package/setup.memory.js +4 -0
- package/setup.memory.js.map +1 -0
- package/setup.memory.ts +2 -0
- package/tsconfig.json +18 -0
- package/vitest.config.d.ts +2 -0
- package/vitest.config.js +8 -0
- package/vitest.config.js.map +1 -0
- package/vitest.config.ts +8 -0
- package/vitest.file.config.d.ts +2 -0
- package/vitest.file.config.js +11 -0
- package/vitest.file.config.js.map +1 -0
- package/vitest.file.config.ts +11 -0
- package/vitest.indexeddb.config.d.ts +2 -0
- package/vitest.indexeddb.config.js +21 -0
- package/vitest.indexeddb.config.js.map +1 -0
- package/vitest.indexeddb.config.ts +34 -0
- package/vitest.memory.config.d.ts +2 -0
- package/vitest.memory.config.js +24 -0
- package/vitest.memory.config.js.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WAAW,CAAC,GAAY,EAAE,KAAkB;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,GAAY,EAAE,KAAkB;QACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,WAAW,CAAC,CAAiB,EAAE,IAAqB;QAClD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,KAAe;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AACD,MAAM,UAAU,UAAU,CAAC,KAAgB;IACzC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
package/helpers.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
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
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fireproof/core-test",
|
|
3
|
+
"version": "0.0.0-smoke-1b31059-1752074105",
|
|
4
|
+
"description": "Live ledger for the web.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"ledger",
|
|
9
|
+
"JSON",
|
|
10
|
+
"document",
|
|
11
|
+
"IPLD",
|
|
12
|
+
"CID",
|
|
13
|
+
"IPFS"
|
|
14
|
+
],
|
|
15
|
+
"contributors": [
|
|
16
|
+
"J Chris Anderson",
|
|
17
|
+
"Alan Shaw",
|
|
18
|
+
"Travis Vachon",
|
|
19
|
+
"Mikeal Rogers",
|
|
20
|
+
"Meno Abels"
|
|
21
|
+
],
|
|
22
|
+
"author": "J Chris Anderson",
|
|
23
|
+
"license": "Apache-2.0 OR MIT",
|
|
24
|
+
"homepage": "https://use-fireproof.com",
|
|
25
|
+
"gptdoc": "import { fireproof } from 'use-fireproof'; const db = fireproof('app-db-name'); const ok = await db.put({ anyField: ['any','json'] }); const doc = await db.get(ok.id); await db.del(doc._id); db.subscribe(myRedrawFn); const result = await db.query('anyField', {range : ['a', 'z']}); result.rows.map(({ key }) => key);",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/fireproof-storage/fireproof.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/fireproof-storage/fireproof/issues"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@adviser/cement": "^0.4.20",
|
|
35
|
+
"react": ">=18.0.0"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@adviser/cement": "^0.4.20",
|
|
39
|
+
"@fireproof/core": "0.0.0-smoke-1b31059-1752074105",
|
|
40
|
+
"@fireproof/core-base": "0.0.0-smoke-1b31059-1752074105",
|
|
41
|
+
"@fireproof/core-blockstore": "0.0.0-smoke-1b31059-1752074105",
|
|
42
|
+
"@fireproof/core-gateways-base": "0.0.0-smoke-1b31059-1752074105",
|
|
43
|
+
"@fireproof/core-gateways-file": "0.0.0-smoke-1b31059-1752074105",
|
|
44
|
+
"@fireproof/core-gateways-indexeddb": "0.0.0-smoke-1b31059-1752074105",
|
|
45
|
+
"@fireproof/core-gateways-memory": "0.0.0-smoke-1b31059-1752074105",
|
|
46
|
+
"@fireproof/core-keybag": "0.0.0-smoke-1b31059-1752074105",
|
|
47
|
+
"@fireproof/core-protocols-cloud": "0.0.0-smoke-1b31059-1752074105",
|
|
48
|
+
"@fireproof/core-runtime": "0.0.0-smoke-1b31059-1752074105",
|
|
49
|
+
"@fireproof/core-types-base": "0.0.0-smoke-1b31059-1752074105",
|
|
50
|
+
"@fireproof/core-types-blockstore": "0.0.0-smoke-1b31059-1752074105",
|
|
51
|
+
"@fireproof/core-types-protocols-cloud": "0.0.0-smoke-1b31059-1752074105",
|
|
52
|
+
"@fireproof/core-types-runtime": "0.0.0-smoke-1b31059-1752074105",
|
|
53
|
+
"@fireproof/vendor": "^3.0.0",
|
|
54
|
+
"@ipld/car": "^5.4.2",
|
|
55
|
+
"@ipld/dag-cbor": "^9.2.4",
|
|
56
|
+
"@ipld/dag-json": "^10.2.5",
|
|
57
|
+
"@types/node": "^24.0.10",
|
|
58
|
+
"cborg": "^4.2.12",
|
|
59
|
+
"charwise": "^3.0.1",
|
|
60
|
+
"use-fireproof": "0.0.0-smoke-1b31059-1752074105",
|
|
61
|
+
"uuidv7": "^1.0.2"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@vitest/browser": "^3.2.4",
|
|
65
|
+
"playwright": "^1.53.2",
|
|
66
|
+
"playwright-chromium": "^1.53.2",
|
|
67
|
+
"vitest": "^3.2.4",
|
|
68
|
+
"zx": "^8.6.1",
|
|
69
|
+
"@fireproof/core-cli": "0.0.0-smoke-1b31059-1752074105"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsc",
|
|
73
|
+
"test": "vitest --run"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|