@fireproof/core 0.20.0-dev-preview-05 → 0.20.0-dev-preview-06
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +10 -10
- package/index.cjs +25 -25
- package/index.cjs.map +1 -1
- package/index.d.cts +17 -17
- package/index.d.ts +17 -17
- package/index.js +25 -25
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +3 -3
- package/react/index.cjs +22 -22
- package/react/index.cjs.map +1 -1
- package/react/index.d.cts +7 -7
- package/react/index.d.ts +7 -7
- package/react/index.js +22 -22
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/fireproof/all-gateway.test.ts +7 -7
- package/tests/fireproof/crdt.test.ts +10 -10
- package/tests/fireproof/{ledger.test.ts → database.test.ts} +31 -31
- package/tests/fireproof/fireproof.test.ts +34 -34
- package/tests/fireproof/hello.test.ts +6 -6
- package/tests/fireproof/indexer.test.ts +18 -18
- package/tests/fireproof/{multiple-ledger.test.ts → multiple-database.test.ts} +2 -2
- package/tests/react/useFireproof.test.tsx +2 -2
- package/tests/www/gallery.html +2 -2
- package/tests/www/todo-aws.html +1 -1
- package/tests/www/todo-ipfs.html +1 -1
- package/tests/www/todo-local.html +1 -1
- package/tests/www/todo.html +1 -1
@@ -1,16 +1,16 @@
|
|
1
1
|
import {
|
2
2
|
Index,
|
3
3
|
index,
|
4
|
-
|
4
|
+
Database,
|
5
5
|
CRDT,
|
6
6
|
IndexRows,
|
7
7
|
toStoreURIRuntime,
|
8
8
|
bs,
|
9
9
|
rt,
|
10
|
-
|
10
|
+
DatabaseFactory,
|
11
11
|
defaultWriteQueueOpts,
|
12
12
|
ensureSuperThis,
|
13
|
-
|
13
|
+
DatabaseOpts,
|
14
14
|
} from "@fireproof/core";
|
15
15
|
|
16
16
|
interface TestType {
|
@@ -19,7 +19,7 @@ interface TestType {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
describe("basic Index", () => {
|
22
|
-
let db:
|
22
|
+
let db: Database<TestType>;
|
23
23
|
let indexer: Index<string, TestType>;
|
24
24
|
let didMap: boolean;
|
25
25
|
const sthis = ensureSuperThis();
|
@@ -31,7 +31,7 @@ describe("basic Index", () => {
|
|
31
31
|
});
|
32
32
|
beforeEach(async function () {
|
33
33
|
await sthis.start();
|
34
|
-
db =
|
34
|
+
db = DatabaseFactory("test-indexer");
|
35
35
|
await db.put({ title: "amazing" });
|
36
36
|
await db.put({ title: "creative" });
|
37
37
|
await db.put({ title: "bazillas" });
|
@@ -107,7 +107,7 @@ describe("basic Index", () => {
|
|
107
107
|
});
|
108
108
|
|
109
109
|
describe("Index query with compound key", function () {
|
110
|
-
let db:
|
110
|
+
let db: Database<TestType>;
|
111
111
|
let indexer: Index<[string, number], TestType>;
|
112
112
|
const sthis = ensureSuperThis();
|
113
113
|
afterEach(async function () {
|
@@ -118,7 +118,7 @@ describe("Index query with compound key", function () {
|
|
118
118
|
});
|
119
119
|
beforeEach(async function () {
|
120
120
|
await sthis.start();
|
121
|
-
db =
|
121
|
+
db = DatabaseFactory("test-indexer");
|
122
122
|
await db.put({ title: "amazing", score: 1 });
|
123
123
|
await db.put({ title: "creative", score: 2 });
|
124
124
|
await db.put({ title: "creative", score: 20 });
|
@@ -137,7 +137,7 @@ describe("Index query with compound key", function () {
|
|
137
137
|
});
|
138
138
|
|
139
139
|
describe("basic Index with map fun", function () {
|
140
|
-
let db:
|
140
|
+
let db: Database<TestType>;
|
141
141
|
let indexer: Index<string, TestType>;
|
142
142
|
const sthis = ensureSuperThis();
|
143
143
|
afterEach(async function () {
|
@@ -148,7 +148,7 @@ describe("basic Index with map fun", function () {
|
|
148
148
|
});
|
149
149
|
beforeEach(async function () {
|
150
150
|
await sthis.start();
|
151
|
-
db =
|
151
|
+
db = DatabaseFactory("test-indexer");
|
152
152
|
await db.put({ title: "amazing" });
|
153
153
|
await db.put({ title: "creative" });
|
154
154
|
await db.put({ title: "bazillas" });
|
@@ -167,7 +167,7 @@ describe("basic Index with map fun", function () {
|
|
167
167
|
});
|
168
168
|
|
169
169
|
describe("basic Index with map fun with value", function () {
|
170
|
-
let db:
|
170
|
+
let db: Database<TestType>;
|
171
171
|
let indexer: Index<string, TestType, number>;
|
172
172
|
const sthis = ensureSuperThis();
|
173
173
|
afterEach(async function () {
|
@@ -176,7 +176,7 @@ describe("basic Index with map fun with value", function () {
|
|
176
176
|
});
|
177
177
|
beforeEach(async function () {
|
178
178
|
await sthis.start();
|
179
|
-
db =
|
179
|
+
db = DatabaseFactory("test-indexer");
|
180
180
|
await db.put({ title: "amazing" });
|
181
181
|
await db.put({ title: "creative" });
|
182
182
|
await db.put({ title: "bazillas" });
|
@@ -205,7 +205,7 @@ describe("basic Index with map fun with value", function () {
|
|
205
205
|
});
|
206
206
|
|
207
207
|
describe("Index query with map and compound key", function () {
|
208
|
-
let db:
|
208
|
+
let db: Database<TestType>;
|
209
209
|
let indexer: Index<[string, number], TestType>;
|
210
210
|
const sthis = ensureSuperThis();
|
211
211
|
afterEach(async function () {
|
@@ -216,7 +216,7 @@ describe("Index query with map and compound key", function () {
|
|
216
216
|
});
|
217
217
|
beforeEach(async function () {
|
218
218
|
await sthis.start();
|
219
|
-
db =
|
219
|
+
db = DatabaseFactory("test-indexer");
|
220
220
|
await db.put({ title: "amazing", score: 1 });
|
221
221
|
await db.put({ title: "creative", score: 2 });
|
222
222
|
await db.put({ title: "creative", score: 20 });
|
@@ -235,7 +235,7 @@ describe("Index query with map and compound key", function () {
|
|
235
235
|
});
|
236
236
|
|
237
237
|
describe("basic Index with string fun", function () {
|
238
|
-
let db:
|
238
|
+
let db: Database<TestType>;
|
239
239
|
let indexer: Index<string, TestType>;
|
240
240
|
const sthis = ensureSuperThis();
|
241
241
|
afterEach(async function () {
|
@@ -246,7 +246,7 @@ describe("basic Index with string fun", function () {
|
|
246
246
|
});
|
247
247
|
beforeEach(async function () {
|
248
248
|
await sthis.start();
|
249
|
-
db =
|
249
|
+
db = DatabaseFactory("test-indexer");
|
250
250
|
await db.put({ title: "amazing" });
|
251
251
|
await db.put({ title: "creative" });
|
252
252
|
await db.put({ title: "bazillas" });
|
@@ -277,7 +277,7 @@ describe("basic Index upon cold start", function () {
|
|
277
277
|
let mapFn: (doc: TestType) => string;
|
278
278
|
let result: IndexRows<string, TestType>;
|
279
279
|
const sthis = ensureSuperThis();
|
280
|
-
let dbOpts:
|
280
|
+
let dbOpts: DatabaseOpts;
|
281
281
|
// result, mapFn;
|
282
282
|
afterEach(async function () {
|
283
283
|
await crdt.close();
|
@@ -375,7 +375,7 @@ describe("basic Index upon cold start", function () {
|
|
375
375
|
});
|
376
376
|
|
377
377
|
describe("basic Index with no data", function () {
|
378
|
-
let db:
|
378
|
+
let db: Database<TestType>;
|
379
379
|
let indexer: Index<string, TestType>;
|
380
380
|
let didMap: boolean;
|
381
381
|
const sthis = ensureSuperThis();
|
@@ -387,7 +387,7 @@ describe("basic Index with no data", function () {
|
|
387
387
|
});
|
388
388
|
beforeEach(async function () {
|
389
389
|
await sthis.start();
|
390
|
-
db =
|
390
|
+
db = DatabaseFactory("test-indexer");
|
391
391
|
indexer = new Index<string, TestType>(sthis, db.crdt, "hello", (doc) => {
|
392
392
|
didMap = true;
|
393
393
|
return doc.title;
|
@@ -10,10 +10,10 @@ describe("HOOK: useFireproof", () => {
|
|
10
10
|
|
11
11
|
it("renders the hook correctly and checks types", () => {
|
12
12
|
renderHook(() => {
|
13
|
-
const {
|
13
|
+
const { database, useLiveQuery, useDocument } = useFireproof("dbname");
|
14
14
|
expect(typeof useLiveQuery).toBe("function");
|
15
15
|
expect(typeof useDocument).toBe("function");
|
16
|
-
expect(
|
16
|
+
expect(database?.constructor.name).toMatch(/^Database/);
|
17
17
|
});
|
18
18
|
});
|
19
19
|
});
|
package/tests/www/gallery.html
CHANGED
@@ -122,8 +122,8 @@
|
|
122
122
|
<h3>Files</h3>
|
123
123
|
<p>
|
124
124
|
Data is stored locally and encrypted before upload to S3. This is a demo so the encryption key is not managed securely. Read
|
125
|
-
more about <a href="https://use-fireproof.com/docs/
|
126
|
-
a demo without images but <a href="https://fireproof.storage/s3up-test.html">with compaction and refresh buttons.</a>
|
125
|
+
more about <a href="https://use-fireproof.com/docs/database-api/replication">Fireproof replication options.</a> You can also
|
126
|
+
see a demo without images but <a href="https://fireproof.storage/s3up-test.html">with compaction and refresh buttons.</a>
|
127
127
|
</p>
|
128
128
|
<label for="files-up"><strong>Drop files:</strong></label>
|
129
129
|
<input accept="image/*" title="save to Fireproof" type="file" id="files-up" multiple />
|
package/tests/www/todo-aws.html
CHANGED
package/tests/www/todo-ipfs.html
CHANGED
@@ -156,7 +156,7 @@
|
|
156
156
|
e.preventDefault();
|
157
157
|
e.target.disabled = true;
|
158
158
|
const input = document.querySelector("#join");
|
159
|
-
const {
|
159
|
+
const { database: newDb, connection: newConn } = await cx.joinShared(input.value);
|
160
160
|
setupDb(null, newDb, newConn);
|
161
161
|
};
|
162
162
|
|
package/tests/www/todo.html
CHANGED