@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.
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  Index,
3
3
  index,
4
- Ledger,
4
+ Database,
5
5
  CRDT,
6
6
  IndexRows,
7
7
  toStoreURIRuntime,
8
8
  bs,
9
9
  rt,
10
- LedgerFactory,
10
+ DatabaseFactory,
11
11
  defaultWriteQueueOpts,
12
12
  ensureSuperThis,
13
- LedgerOpts,
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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: LedgerOpts;
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: Ledger<TestType>;
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 = LedgerFactory("test-indexer");
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;
@@ -1,7 +1,7 @@
1
- import { Ledger, ensureSuperThis, fireproof } from "@fireproof/core";
1
+ import { Database, ensureSuperThis, fireproof } from "@fireproof/core";
2
2
 
3
3
  interface DBItem {
4
- readonly db: Ledger;
4
+ readonly db: Database;
5
5
  readonly name: string;
6
6
  }
7
7
 
@@ -10,10 +10,10 @@ describe("HOOK: useFireproof", () => {
10
10
 
11
11
  it("renders the hook correctly and checks types", () => {
12
12
  renderHook(() => {
13
- const { ledger, useLiveQuery, useDocument } = useFireproof("dbname");
13
+ const { database, useLiveQuery, useDocument } = useFireproof("dbname");
14
14
  expect(typeof useLiveQuery).toBe("function");
15
15
  expect(typeof useDocument).toBe("function");
16
- expect(ledger?.constructor.name).toMatch(/^Ledger/);
16
+ expect(database?.constructor.name).toMatch(/^Database/);
17
17
  });
18
18
  });
19
19
  });
@@ -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/ledger-api/replication">Fireproof replication options.</a> You can also see
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 />
@@ -211,7 +211,7 @@
211
211
 
212
212
  <body>
213
213
  <h1><a href="https://use-fireproof.com/">Fireproof</a> Test App</h1>
214
- Ledger:
214
+ Database:
215
215
  <input title="Change list" type="text" name="list" id="list" />
216
216
  <button onclick="changeList(event)">Switch</button>
217
217
 
@@ -156,7 +156,7 @@
156
156
  e.preventDefault();
157
157
  e.target.disabled = true;
158
158
  const input = document.querySelector("#join");
159
- const { ledger: newDb, connection: newConn } = await cx.joinShared(input.value);
159
+ const { database: newDb, connection: newConn } = await cx.joinShared(input.value);
160
160
  setupDb(null, newDb, newConn);
161
161
  };
162
162
 
@@ -196,7 +196,7 @@
196
196
 
197
197
  <body>
198
198
  <h1><a href="https://use-fireproof.com/">Fireproof</a> Test App</h1>
199
- Ledger:
199
+ Database:
200
200
  <input title="Change list" type="text" name="list" id="list" />
201
201
  <button onclick="changeList(event)">Switch</button>
202
202
 
@@ -235,7 +235,7 @@
235
235
 
236
236
  <body>
237
237
  <h1><a href="https://use-fireproof.com/">Fireproof</a> Test App</h1>
238
- Ledger:
238
+ Database:
239
239
  <input title="Change list" type="text" name="list" id="list" />
240
240
  <button onclick="changeList(event)">Switch</button>
241
241