@roc-db/in-memory 0.2.0-pre.20 → 0.2.0-pre.21

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/dist/index.js CHANGED
@@ -25,9 +25,27 @@ __export(exports_functions, {
25
25
  findDebounceMutation: () => findDebounceMutation,
26
26
  deleteEntity: () => deleteEntity,
27
27
  createEntity: () => createEntity,
28
- begin: () => begin
28
+ begin: () => begin,
29
+ batchReadEntities: () => batchReadEntities
29
30
  });
30
31
 
32
+ // src/functions/readEntity.ts
33
+ import { DELETED_IN_CHANGE_SET_SYMBOL } from "roc-db";
34
+ var readEntity = (txn, ref) => {
35
+ if (txn.request.changeSetRef) {
36
+ const doc = txn.engineOpts.changeSet.entities.get(ref);
37
+ if (doc === DELETED_IN_CHANGE_SET_SYMBOL)
38
+ return;
39
+ if (doc)
40
+ return doc;
41
+ }
42
+ return txn.engineOpts.entities.get(ref);
43
+ };
44
+
45
+ // src/functions/batchReadEntities.ts
46
+ var batchReadEntities = (txn, refs) => {
47
+ return refs.map((ref) => readEntity(txn, ref));
48
+ };
31
49
  // src/functions/begin.ts
32
50
  var begin = (request, engineOpts, callback) => {
33
51
  return callback({
@@ -80,10 +98,10 @@ var createEntity = (txn, ref, {
80
98
  }
81
99
  };
82
100
  // src/functions/deleteEntity.ts
83
- import { DELETED_IN_CHANGE_SET_SYMBOL } from "roc-db";
101
+ import { DELETED_IN_CHANGE_SET_SYMBOL as DELETED_IN_CHANGE_SET_SYMBOL2 } from "roc-db";
84
102
  var deleteEntity = (txn, ref) => {
85
103
  if (txn.request.changeSetRef) {
86
- txn.engineOpts.changeSet.entities.set(ref, DELETED_IN_CHANGE_SET_SYMBOL);
104
+ txn.engineOpts.changeSet.entities.set(ref, DELETED_IN_CHANGE_SET_SYMBOL2);
87
105
  return true;
88
106
  } else {
89
107
  txn.engineOpts.entities.delete(ref);
@@ -137,21 +155,6 @@ var pageMutations = (txn, {
137
155
  };
138
156
  // src/functions/patchEntity.ts
139
157
  import { deepPatch, NotFoundError } from "roc-db";
140
-
141
- // src/functions/readEntity.ts
142
- import { DELETED_IN_CHANGE_SET_SYMBOL as DELETED_IN_CHANGE_SET_SYMBOL2 } from "roc-db";
143
- var readEntity = (txn, ref) => {
144
- if (txn.request.changeSetRef) {
145
- const doc = txn.engineOpts.changeSet.entities.get(ref);
146
- if (doc === DELETED_IN_CHANGE_SET_SYMBOL2)
147
- return;
148
- if (doc)
149
- return doc;
150
- }
151
- return txn.engineOpts.entities.get(ref);
152
- };
153
-
154
- // src/functions/patchEntity.ts
155
158
  var patchEntity = (txn, ref, { data = {}, children = {}, parents = {}, ancestors = {} }) => {
156
159
  const existingDocument = readEntity(txn, ref);
157
160
  if (!existingDocument)
@@ -0,0 +1,2 @@
1
+ import type { Ref } from "roc-db";
2
+ export declare const batchReadEntities: (txn: any, refs: Ref[]) => any[];
@@ -1,3 +1,4 @@
1
+ export { batchReadEntities } from "./batchReadEntities";
1
2
  export { begin } from "./begin";
2
3
  export { createEntity } from "./createEntity";
3
4
  export { deleteEntity } from "./deleteEntity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roc-db/in-memory",
3
- "version": "0.2.0-pre.20",
3
+ "version": "0.2.0-pre.21",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "sideEffects": false,
15
15
  "peerDependencies": {
16
- "roc-db": "0.2.0-pre.20",
16
+ "roc-db": "0.2.0-pre.21",
17
17
  "zod": "^3.0.0"
18
18
  },
19
19
  "keywords": [],