@fireproof/core-test 0.22.0-keybag → 0.23.1-dev-issue-1057

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 (101) hide show
  1. package/LICENSE.md +197 -228
  2. package/README.md +269 -0
  3. package/blockstore/interceptor-gateway.test.js.map +1 -1
  4. package/blockstore/keyed-crypto-indexeddb-file.test.js +1 -0
  5. package/blockstore/keyed-crypto-indexeddb-file.test.js.map +1 -1
  6. package/blockstore/keyed-crypto.test.js +1 -0
  7. package/blockstore/keyed-crypto.test.js.map +1 -1
  8. package/blockstore/loader.test.js.map +1 -1
  9. package/blockstore/standalone.test.js.map +1 -1
  10. package/blockstore/store.test.js.map +1 -1
  11. package/blockstore/transaction.test.js.map +1 -1
  12. package/fireproof/all-gateway.test.js.map +1 -1
  13. package/fireproof/attachable.test.js.map +1 -1
  14. package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js.map +1 -1
  15. package/fireproof/charwise-boolean.test.js.map +1 -1
  16. package/fireproof/compact-strategy.test.js.map +1 -1
  17. package/fireproof/concurrent.test.js +1 -1
  18. package/fireproof/concurrent.test.js.map +1 -1
  19. package/fireproof/crdt.test.js +1 -0
  20. package/fireproof/crdt.test.js.map +1 -1
  21. package/fireproof/database.test.js.map +1 -1
  22. package/fireproof/deleted-docs-handling.test.js.map +1 -1
  23. package/fireproof/fireproof.test.fixture.d.ts +3 -3
  24. package/fireproof/fireproof.test.fixture.js.map +1 -1
  25. package/fireproof/fireproof.test.js +1 -0
  26. package/fireproof/fireproof.test.js.map +1 -1
  27. package/fireproof/hello.test.js.map +1 -1
  28. package/fireproof/indexer.test.js.map +1 -1
  29. package/fireproof/multiple-ledger.test.js.map +1 -1
  30. package/fireproof/query-docs.test.js.map +1 -1
  31. package/fireproof/query-limit-issue.test.js.map +1 -1
  32. package/fireproof/query-property-inconsistency.test.js.map +1 -1
  33. package/fireproof/query-result-properties.test.js.map +1 -1
  34. package/fireproof/stable-cid.test.js.map +1 -1
  35. package/fireproof/utils.test.js.map +1 -1
  36. package/gateway/file/loader-config.test.js +2 -2
  37. package/gateway/file/loader-config.test.js.map +1 -1
  38. package/gateway/indexeddb/create-db-on-write.test.d.ts +1 -0
  39. package/gateway/indexeddb/create-db-on-write.test.js +145 -0
  40. package/gateway/indexeddb/create-db-on-write.test.js.map +1 -0
  41. package/gateway/indexeddb/loader-config.test.js.map +1 -1
  42. package/global-setup.js.map +1 -1
  43. package/helpers.js.map +1 -1
  44. package/package.json +21 -22
  45. package/protocols/cloud/msger.test.js.map +1 -1
  46. package/runtime/fp-envelope-serialize.test.js.map +1 -1
  47. package/runtime/key-bag.test.js.map +1 -1
  48. package/runtime/meta-key-hack.test.js.map +1 -1
  49. package/setup.file.js.map +1 -1
  50. package/setup.indexeddb.js.map +1 -1
  51. package/setup.memory.js.map +1 -1
  52. package/vitest.config.js.map +1 -1
  53. package/vitest.file.config.js.map +1 -1
  54. package/vitest.indexeddb.config.js.map +1 -1
  55. package/vitest.memory.config.js.map +1 -1
  56. package/blockstore/fp-envelope.test.ts-off +0 -65
  57. package/blockstore/fragment-gateway.test.ts-off +0 -106
  58. package/blockstore/interceptor-gateway.test.ts +0 -259
  59. package/blockstore/keyed-crypto-indexeddb-file.test.ts +0 -134
  60. package/blockstore/keyed-crypto.test.ts +0 -381
  61. package/blockstore/loader.test.ts +0 -313
  62. package/blockstore/standalone.test.ts +0 -156
  63. package/blockstore/store.test.ts +0 -199
  64. package/blockstore/transaction.test.ts +0 -132
  65. package/fireproof/all-gateway.test.ts +0 -477
  66. package/fireproof/attachable.test.ts +0 -677
  67. package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
  68. package/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +0 -324
  69. package/fireproof/charwise-boolean.test.ts +0 -68
  70. package/fireproof/compact-strategy.test.ts +0 -40
  71. package/fireproof/concurrent.test.ts +0 -38
  72. package/fireproof/crdt.test.ts +0 -572
  73. package/fireproof/database.test.ts +0 -772
  74. package/fireproof/deleted-docs-handling.test.ts +0 -112
  75. package/fireproof/fireproof.test.fixture.ts +0 -133
  76. package/fireproof/fireproof.test.ts +0 -767
  77. package/fireproof/hello.test.ts +0 -75
  78. package/fireproof/indexer.test.ts +0 -459
  79. package/fireproof/multiple-ledger.test.ts +0 -67
  80. package/fireproof/query-docs.test.ts +0 -117
  81. package/fireproof/query-limit-issue.test.ts +0 -147
  82. package/fireproof/query-property-inconsistency.test.ts +0 -90
  83. package/fireproof/query-result-properties.test.ts +0 -43
  84. package/fireproof/stable-cid.test.ts +0 -72
  85. package/fireproof/utils.test.ts +0 -137
  86. package/gateway/file/loader-config.test.ts +0 -309
  87. package/gateway/indexeddb/loader-config.test.ts +0 -80
  88. package/global-setup.ts +0 -11
  89. package/helpers.ts +0 -177
  90. package/protocols/cloud/msger.test.ts +0 -559
  91. package/runtime/fp-envelope-serialize.test.ts +0 -266
  92. package/runtime/key-bag.test.ts +0 -243
  93. package/runtime/meta-key-hack.test.ts +0 -103
  94. package/setup.file.ts +0 -1
  95. package/setup.indexeddb.ts +0 -0
  96. package/setup.memory.ts +0 -2
  97. package/tsconfig.json +0 -18
  98. package/vitest.config.ts +0 -8
  99. package/vitest.file.config.ts +0 -11
  100. package/vitest.indexeddb.config.ts +0 -34
  101. package/vitest.memory.config.ts +0 -24
@@ -1,112 +0,0 @@
1
- import { Database, fireproof } from "@fireproof/core";
2
- import { describe, beforeEach, afterEach, it, expect } from "vitest";
3
-
4
- describe("allDocs deleted document handling", () => {
5
- let db: Database;
6
-
7
- beforeEach(async () => {
8
- db = await fireproof("test-deleted-docs");
9
-
10
- // Create a mix of regular and deleted documents
11
- await db.put({ _id: "doc1", value: "one" });
12
- await db.put({ _id: "doc2", value: "two" });
13
- await db.put({ _id: "doc3", value: "three" });
14
-
15
- // Create deleted documents
16
- await db.put({ _id: "deleted1", value: "deleted-one", _deleted: true });
17
- await db.put({ _id: "deleted2", value: "deleted-two", _deleted: true });
18
- });
19
-
20
- afterEach(async () => {
21
- await db.destroy();
22
- });
23
-
24
- it("should exclude deleted documents by default (currently failing)", async () => {
25
- const result = await db.allDocs();
26
-
27
- // This test will fail because allDocs() currently returns deleted documents
28
- expect(result.rows.length).toBe(3); // Only non-deleted docs should be returned
29
-
30
- const ids = result.rows.map((row) => row.key);
31
- expect(ids).toContain("doc1");
32
- expect(ids).toContain("doc2");
33
- expect(ids).toContain("doc3");
34
- expect(ids).not.toContain("deleted1");
35
- expect(ids).not.toContain("deleted2");
36
- });
37
-
38
- it("should include deleted documents when includeDeleted is true (new feature)", async () => {
39
- // This test will fail because the includeDeleted option doesn't exist yet
40
- const result = await db.allDocs({ includeDeleted: true });
41
-
42
- expect(result.rows.length).toBe(5); // All docs
43
-
44
- const ids = result.rows.map((row) => row.key);
45
- expect(ids).toContain("doc1");
46
- expect(ids).toContain("doc2");
47
- expect(ids).toContain("doc3");
48
- expect(ids).toContain("deleted1");
49
- expect(ids).toContain("deleted2");
50
- });
51
-
52
- it("handles empty databases correctly", async () => {
53
- // Create a new empty database
54
- const emptyDb = await fireproof("test-empty-db");
55
-
56
- // Test with default options
57
- const defaultResult = await emptyDb.allDocs();
58
- expect(defaultResult.rows.length).toBe(0);
59
-
60
- // Test with includeDeleted option
61
- const includeDeletedResult = await emptyDb.allDocs({ includeDeleted: true });
62
- expect(includeDeletedResult.rows.length).toBe(0);
63
-
64
- await emptyDb.destroy();
65
- });
66
-
67
- it("handles database with only deleted documents", async () => {
68
- // Create a database with only deleted documents
69
- const deletedOnlyDb = await fireproof("test-deleted-only-db");
70
-
71
- // Add only deleted documents
72
- await deletedOnlyDb.put({ _id: "deleted1", value: "deleted-one", _deleted: true });
73
- await deletedOnlyDb.put({ _id: "deleted2", value: "deleted-two", _deleted: true });
74
-
75
- // By default, should return empty result
76
- const defaultResult = await deletedOnlyDb.allDocs();
77
- expect(defaultResult.rows.length).toBe(0); // This will fail with current implementation
78
-
79
- // With includeDeleted, should return all deleted docs
80
- const includeDeletedResult = await deletedOnlyDb.allDocs({ includeDeleted: true });
81
- expect(includeDeletedResult.rows.length).toBe(2);
82
-
83
- await deletedOnlyDb.destroy();
84
- });
85
-
86
- it("respects limit option while excluding deleted documents", async () => {
87
- // Test with limit option
88
- const limitResult = await db.allDocs({ limit: 2 });
89
-
90
- expect(limitResult.rows.length).toBe(2);
91
-
92
- // All returned documents should be non-deleted
93
- const docs = await Promise.all(limitResult.rows.map((row) => db.get(row.key)));
94
- docs.forEach((doc) => {
95
- expect(doc._deleted).not.toBe(true);
96
- });
97
- });
98
-
99
- it("respects limit option while including deleted documents", async () => {
100
- // Test with limit and includeDeleted options
101
- const result = await db.allDocs({ limit: 3, includeDeleted: true });
102
-
103
- expect(result.rows.length).toBe(3);
104
-
105
- // Can include both deleted and non-deleted documents
106
- const ids = result.rows.map((row) => row.key);
107
-
108
- // We don't test specific IDs here because the order depends on implementation
109
- // Just verify that the limit is respected
110
- expect(ids.length).toBe(3);
111
- });
112
- });
@@ -1,133 +0,0 @@
1
- export const docs = [
2
- {
3
- _id: "02pkji8",
4
- type: "todo",
5
- title: "On the browser",
6
- listId: "0k23ulso",
7
- completed: false,
8
- createdAt: "2024-06-30T15:15:01.482Z",
9
- },
10
- { _id: "0k23ulso", type: "list", title: "Building Apps" },
11
- { _id: "1ctdt28g", type: "list", title: "Having Fun" },
12
- { _id: "294n3m2o", type: "list", title: "Getting Groceries" },
13
- {
14
- _id: "63eheg8",
15
- type: "todo",
16
- title: "Macadamia nut milk",
17
- listId: "294n3m2o",
18
- completed: false,
19
- createdAt: "2024-06-30T15:15:03.282Z",
20
- },
21
- {
22
- _id: "65e459g",
23
- type: "todo",
24
- title: "Fruit salad",
25
- listId: "294n3m2o",
26
- completed: false,
27
- createdAt: "2024-06-30T15:15:04.144Z",
28
- },
29
- {
30
- _id: "6icqlvg",
31
- type: "todo",
32
- title: "Bacon",
33
- listId: "294n3m2o",
34
- completed: false,
35
- createdAt: "2024-06-30T15:15:05.282Z",
36
- },
37
- {
38
- _id: "7terjo",
39
- type: "todo",
40
- title: "Rollerskating meetup",
41
- listId: "1ctdt28g",
42
- completed: false,
43
- createdAt: "2024-06-30T15:15:06.282Z",
44
- },
45
- {
46
- _id: "8vr6cc",
47
- type: "todo",
48
- title: "With or without Redux",
49
- listId: "0k23ulso",
50
- completed: false,
51
- createdAt: "2024-06-30T15:15:07.282Z",
52
- },
53
- {
54
- _id: "ck2sb08",
55
- type: "todo",
56
- title: "Write a sci-fi story with ChatGPT",
57
- listId: "1ctdt28g",
58
- completed: true,
59
- createdAt: "2024-06-30T15:15:08.282Z",
60
- },
61
- {
62
- _id: "dlkeeoo",
63
- type: "todo",
64
- title: "Avocado toast",
65
- listId: "294n3m2o",
66
- completed: false,
67
- createdAt: "2024-06-30T15:15:09.282Z",
68
- },
69
- {
70
- _id: "f9i8tx7nxswo",
71
- type: "todo",
72
- title: "nice",
73
- listId: "0k23ulso",
74
- completed: true,
75
- createdAt: "2024-06-30T15:15:01.482Z",
76
- },
77
- {
78
- _id: "fkgjmbg",
79
- type: "todo",
80
- title: "Automatic replication and versioning",
81
- listId: "0k23ulso",
82
- completed: true,
83
- createdAt: "2024-06-30T15:15:10.282Z",
84
- },
85
- {
86
- _id: "fks8hig",
87
- type: "todo",
88
- title: "Motorcycle ride",
89
- listId: "1ctdt28g",
90
- completed: false,
91
- createdAt: "2024-06-30T15:15:11.282Z",
92
- },
93
- {
94
- _id: "hf60rf",
95
- type: "todo",
96
- title: "Sourdough bread",
97
- listId: "294n3m2o",
98
- completed: true,
99
- createdAt: "2024-06-30T15:15:12.282Z",
100
- },
101
- {
102
- _id: "n219un",
103
- type: "todo",
104
- title: "Login components",
105
- listId: "0k23ulso",
106
- completed: true,
107
- createdAt: "2024-06-30T15:15:13.282Z",
108
- },
109
- {
110
- _id: "phr936g",
111
- type: "todo",
112
- title: "Coffee",
113
- listId: "294n3m2o",
114
- completed: false,
115
- createdAt: "2024-06-30T15:15:14.282Z",
116
- },
117
- {
118
- _id: "vcj2fv8",
119
- type: "todo",
120
- title: "On the phone",
121
- listId: "0k23ulso",
122
- completed: false,
123
- createdAt: "2024-06-30T15:15:15.282Z",
124
- },
125
- {
126
- _id: "vqmbes8",
127
- type: "todo",
128
- title: "GraphQL queries",
129
- listId: "0k23ulso",
130
- completed: false,
131
- createdAt: "2024-06-30T15:15:16.282Z",
132
- },
133
- ];