@fireproof/core 0.19.121 → 0.20.0-dev-preview-06
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/README.md +3 -2
- package/deno/index.d.ts +7 -0
- package/deno/index.js +66 -0
- package/deno/index.js.map +1 -0
- package/deno/metafile-esm.json +1 -0
- package/deno.json +2 -3
- package/index.cjs +1819 -1051
- package/index.cjs.map +1 -1
- package/index.d.cts +746 -333
- package/index.d.ts +746 -333
- package/index.js +1792 -1026
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/node/index.cjs +16 -293
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +4 -40
- package/node/index.d.ts +4 -40
- package/node/index.js +22 -237
- package/node/index.js.map +1 -1
- package/node/metafile-cjs.json +1 -1
- package/node/metafile-esm.json +1 -1
- package/package.json +12 -4
- package/react/index.cjs.map +1 -1
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/fp-envelope.test.ts-off +65 -0
- package/tests/blockstore/interceptor-gateway.test.ts +122 -0
- package/tests/blockstore/keyed-crypto-indexdb-file.test.ts +130 -0
- package/tests/blockstore/keyed-crypto.test.ts +73 -118
- package/tests/blockstore/loader.test.ts +18 -9
- package/tests/blockstore/store.test.ts +40 -31
- package/tests/blockstore/transaction.test.ts +14 -13
- package/tests/fireproof/all-gateway.test.ts +283 -213
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +324 -316
- package/tests/fireproof/crdt.test.ts +78 -19
- package/tests/fireproof/database.test.ts +225 -29
- package/tests/fireproof/fireproof.test.ts +92 -73
- package/tests/fireproof/hello.test.ts +17 -13
- package/tests/fireproof/indexer.test.ts +67 -43
- package/tests/fireproof/utils.test.ts +47 -6
- package/tests/gateway/file/loader-config.test.ts +307 -0
- package/tests/gateway/fp-envelope-serialize.test.ts +256 -0
- package/tests/gateway/indexdb/loader-config.test.ts +79 -0
- package/tests/helpers.ts +44 -17
- package/tests/react/useFireproof.test.tsx +1 -1
- package/tests/www/todo.html +24 -3
- package/web/index.cjs +102 -116
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +15 -29
- package/web/index.d.ts +15 -29
- package/web/index.js +91 -105
- package/web/index.js.map +1 -1
- package/web/metafile-cjs.json +1 -1
- package/web/metafile-esm.json +1 -1
- package/node/chunk-4A4RAVNS.js +0 -17
- package/node/chunk-4A4RAVNS.js.map +0 -1
- package/node/mem-filesystem-LPPT7QV5.js +0 -40
- package/node/mem-filesystem-LPPT7QV5.js.map +0 -1
- package/tests/fireproof/config.test.ts +0 -163
- /package/tests/blockstore/{fragment-gateway.test.ts → fragment-gateway.test.ts-off} +0 -0
- /package/tests/fireproof/{multiple-ledger.test.ts → multiple-database.test.ts} +0 -0
package/README.md
CHANGED
@@ -39,11 +39,12 @@ Jump to the docs site [for JavaScript API basics.](https://use-fireproof.com/doc
|
|
39
39
|
Fireproof [React hooks for live data](https://use-fireproof.com/docs/category/react-hooks) avoid boilerplate and make building collaborative apps a breeze.
|
40
40
|
|
41
41
|
```js
|
42
|
-
import {
|
42
|
+
import { useFireproof } from 'use-fireproof'
|
43
43
|
|
44
44
|
function App() {
|
45
|
+
const { useLiveQuery, useDocument } = useFireproof("my-db-name")
|
45
46
|
const completedTodos = useLiveQuery('completed', { limit: 10 })
|
46
|
-
const [newTodo,
|
47
|
+
const [newTodo, setNewTodo, saveNewTodo] = useDocument(() => ({type: 'todo', text: '', completed: false, created: Date.now() }))
|
47
48
|
```
|
48
49
|
|
49
50
|
Read the [step-by-step React tutorial](https://use-fireproof.com/docs/react-tutorial) to get started.
|
package/deno/index.d.ts
ADDED
package/deno/index.js
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
// src/runtime/gateways/file/deno/deno-filesystem.ts
|
2
|
+
var DenoFileSystem = class {
|
3
|
+
async start() {
|
4
|
+
this.fs = Deno;
|
5
|
+
return this;
|
6
|
+
}
|
7
|
+
async mkdir(path, options) {
|
8
|
+
return this.fs?.mkdir(path, options).then(() => path);
|
9
|
+
}
|
10
|
+
async readdir(path) {
|
11
|
+
const ret = [];
|
12
|
+
for await (const dirEntry of this.fs.readdir(path)) {
|
13
|
+
ret.push(dirEntry.name);
|
14
|
+
}
|
15
|
+
return ret;
|
16
|
+
}
|
17
|
+
async rm(path, options) {
|
18
|
+
return this.fs?.rm(path, options);
|
19
|
+
}
|
20
|
+
async copyFile(source, destination) {
|
21
|
+
return this.fs?.copyFile(source, destination);
|
22
|
+
}
|
23
|
+
async readfile(path) {
|
24
|
+
return this.fs.readFile(path);
|
25
|
+
}
|
26
|
+
async stat(path) {
|
27
|
+
const x = await this.fs.stat(path);
|
28
|
+
return {
|
29
|
+
isFile: () => x.isFile,
|
30
|
+
isDirectory: () => x.isDirectory,
|
31
|
+
isBlockDevice: () => !!x.isBlockDevice,
|
32
|
+
isCharacterDevice: () => !!x.isCharDevice,
|
33
|
+
isSymbolicLink: () => !!x.isSymlink,
|
34
|
+
isFIFO: () => !!x.isFifo,
|
35
|
+
isSocket: () => !!x.isSocket,
|
36
|
+
uid: x.uid,
|
37
|
+
gid: x.gid,
|
38
|
+
size: x.size,
|
39
|
+
atime: x.atime,
|
40
|
+
mtime: x.mtime,
|
41
|
+
ctime: x.birthtime,
|
42
|
+
birthtime: x.birthtime
|
43
|
+
};
|
44
|
+
}
|
45
|
+
async unlink(path) {
|
46
|
+
return this.fs?.unlink(path);
|
47
|
+
}
|
48
|
+
async writefile(path, data) {
|
49
|
+
return this.fs?.writeFile(path, Buffer.from(data));
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
// src/runtime/gateways/file/deno/get-sys-file-system.ts
|
54
|
+
import { ResolveOnce } from "@adviser/cement";
|
55
|
+
var nfs = new ResolveOnce();
|
56
|
+
async function getSysFileSystem(url) {
|
57
|
+
return nfs.once(async () => {
|
58
|
+
const nfs2 = new DenoFileSystem();
|
59
|
+
await nfs2.start();
|
60
|
+
return nfs2;
|
61
|
+
});
|
62
|
+
}
|
63
|
+
export {
|
64
|
+
getSysFileSystem
|
65
|
+
};
|
66
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/runtime/gateways/file/deno/deno-filesystem.ts","../../../src/runtime/gateways/file/deno/get-sys-file-system.ts"],"sourcesContent":["import type { FPStats, SysFileSystem } from \"@fireproof/core\";\n\nexport class DenoFileSystem implements SysFileSystem {\n fs?: {\n mkdir: typeof Deno.mkdir;\n readdir: typeof Deno.readDir;\n rm: typeof Deno.remove;\n copyFile: typeof Deno.copyFile;\n readFile: typeof Deno.readFile;\n stat: typeof Deno.stat;\n unlink: typeof Deno.remove;\n writeFile: typeof Deno.writeFile;\n };\n\n async start(): Promise<SysFileSystem> {\n this.fs = Deno as unknown as DenoFileSystem[\"fs\"];\n return this;\n }\n async mkdir(path: string, options?: { recursive: boolean }): Promise<string | undefined> {\n return this.fs?.mkdir(path, options).then(() => path);\n }\n async readdir(path: string): Promise<string[]> {\n const ret = [];\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n for await (const dirEntry of this.fs!.readdir(path)) {\n ret.push(dirEntry.name);\n }\n return ret;\n }\n async rm(path: string, options?: { recursive: boolean }): Promise<void> {\n return this.fs?.rm(path, options);\n }\n async copyFile(source: string, destination: string): Promise<void> {\n return this.fs?.copyFile(source, destination);\n }\n async readfile(path: string): Promise<Uint8Array> {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.fs!.readFile(path);\n }\n async stat(path: string): Promise<FPStats> {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const x = await this.fs!.stat(path);\n return {\n isFile: () => x.isFile,\n isDirectory: () => x.isDirectory,\n isBlockDevice: () => !!x.isBlockDevice,\n isCharacterDevice: () => !!x.isCharDevice,\n isSymbolicLink: () => !!x.isSymlink,\n isFIFO: () => !!x.isFifo,\n isSocket: () => !!x.isSocket,\n uid: x.uid,\n gid: x.gid,\n size: x.size,\n atime: x.atime,\n mtime: x.mtime,\n ctime: x.birthtime,\n birthtime: x.birthtime,\n };\n }\n async unlink(path: string): Promise<void> {\n return this.fs?.unlink(path);\n }\n async writefile(path: string, data: Uint8Array | string): Promise<void> {\n return this.fs?.writeFile(path, Buffer.from(data));\n }\n}\n","import type { SysFileSystem } from \"@fireproof/core\";\nimport { DenoFileSystem } from \"./deno-filesystem.js\";\nimport { ResolveOnce, URI } from \"@adviser/cement\";\n\nconst nfs = new ResolveOnce<SysFileSystem>();\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport async function getSysFileSystem(url: URI): Promise<SysFileSystem> {\n return nfs.once(async () => {\n const nfs = new DenoFileSystem();\n await nfs.start();\n return nfs;\n });\n}\n"],"mappings":";AAEO,IAAM,iBAAN,MAA8C;AAAA,EAYnD,MAAM,QAAgC;AACpC,SAAK,KAAK;AACV,WAAO;AAAA,EACT;AAAA,EACA,MAAM,MAAM,MAAc,SAA+D;AACvF,WAAO,KAAK,IAAI,MAAM,MAAM,OAAO,EAAE,KAAK,MAAM,IAAI;AAAA,EACtD;AAAA,EACA,MAAM,QAAQ,MAAiC;AAC7C,UAAM,MAAM,CAAC;AAEb,qBAAiB,YAAY,KAAK,GAAI,QAAQ,IAAI,GAAG;AACnD,UAAI,KAAK,SAAS,IAAI;AAAA,IACxB;AACA,WAAO;AAAA,EACT;AAAA,EACA,MAAM,GAAG,MAAc,SAAiD;AACtE,WAAO,KAAK,IAAI,GAAG,MAAM,OAAO;AAAA,EAClC;AAAA,EACA,MAAM,SAAS,QAAgB,aAAoC;AACjE,WAAO,KAAK,IAAI,SAAS,QAAQ,WAAW;AAAA,EAC9C;AAAA,EACA,MAAM,SAAS,MAAmC;AAEhD,WAAO,KAAK,GAAI,SAAS,IAAI;AAAA,EAC/B;AAAA,EACA,MAAM,KAAK,MAAgC;AAEzC,UAAM,IAAI,MAAM,KAAK,GAAI,KAAK,IAAI;AAClC,WAAO;AAAA,MACL,QAAQ,MAAM,EAAE;AAAA,MAChB,aAAa,MAAM,EAAE;AAAA,MACrB,eAAe,MAAM,CAAC,CAAC,EAAE;AAAA,MACzB,mBAAmB,MAAM,CAAC,CAAC,EAAE;AAAA,MAC7B,gBAAgB,MAAM,CAAC,CAAC,EAAE;AAAA,MAC1B,QAAQ,MAAM,CAAC,CAAC,EAAE;AAAA,MAClB,UAAU,MAAM,CAAC,CAAC,EAAE;AAAA,MACpB,KAAK,EAAE;AAAA,MACP,KAAK,EAAE;AAAA,MACP,MAAM,EAAE;AAAA,MACR,OAAO,EAAE;AAAA,MACT,OAAO,EAAE;AAAA,MACT,OAAO,EAAE;AAAA,MACT,WAAW,EAAE;AAAA,IACf;AAAA,EACF;AAAA,EACA,MAAM,OAAO,MAA6B;AACxC,WAAO,KAAK,IAAI,OAAO,IAAI;AAAA,EAC7B;AAAA,EACA,MAAM,UAAU,MAAc,MAA0C;AACtE,WAAO,KAAK,IAAI,UAAU,MAAM,OAAO,KAAK,IAAI,CAAC;AAAA,EACnD;AACF;;;AC/DA,SAAS,mBAAwB;AAEjC,IAAM,MAAM,IAAI,YAA2B;AAE3C,eAAsB,iBAAiB,KAAkC;AACvE,SAAO,IAAI,KAAK,YAAY;AAC1B,UAAMA,OAAM,IAAI,eAAe;AAC/B,UAAMA,KAAI,MAAM;AAChB,WAAOA;AAAA,EACT,CAAC;AACH;","names":["nfs"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"inputs":{"src/runtime/gateways/file/deno/deno-filesystem.ts":{"bytes":2181,"imports":[],"format":"esm"},"src/runtime/gateways/file/deno/get-sys-file-system.ts":{"bytes":462,"imports":[{"path":"src/runtime/gateways/file/deno/deno-filesystem.ts","kind":"import-statement","original":"./deno-filesystem.js"},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/file/deno/index.ts":{"bytes":61,"imports":[{"path":"src/runtime/gateways/file/deno/get-sys-file-system.ts","kind":"import-statement","original":"./get-sys-file-system.js"}],"format":"esm"}},"outputs":{"dist/fireproof-core/deno/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4331},"dist/fireproof-core/deno/index.js":{"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true}],"exports":["getSysFileSystem"],"entryPoint":"src/runtime/gateways/file/deno/index.ts","inputs":{"src/runtime/gateways/file/deno/deno-filesystem.ts":{"bytesInOutput":1243},"src/runtime/gateways/file/deno/get-sys-file-system.ts":{"bytesInOutput":235},"src/runtime/gateways/file/deno/index.ts":{"bytesInOutput":0}},"bytes":1620}}}
|
package/deno.json
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"imports": {
|
3
3
|
"@fireproof/core": "./index.js",
|
4
|
-
"@adviser/cement": "npm:@adviser/cement@^0.3.
|
4
|
+
"@adviser/cement": "npm:@adviser/cement@^0.3.5",
|
5
5
|
"@fireproof/vendor": "npm:@fireproof/vendor@^1.0.4",
|
6
|
-
"@ipld/unixfs": "npm:@ipld/unixfs@^3.0.0",
|
7
6
|
"multiformats": "npm:multiformats@^13.3.1",
|
7
|
+
"@ipld/unixfs": "npm:@ipld/unixfs@^3.0.0",
|
8
8
|
"charwise": "npm:charwise@^3.0.1",
|
9
9
|
"prolly-trees": "npm:prolly-trees@^1.0.4",
|
10
10
|
"idb": "npm:idb@^8.0.1",
|
11
|
-
"memfs": "npm:memfs@^4.15.1",
|
12
11
|
"p-limit": "npm:p-limit@^6.2.0",
|
13
12
|
"p-map": "npm:p-map@^7.0.3",
|
14
13
|
"p-retry": "npm:p-retry@^6.2.1"
|