@roc-db/in-memory 0.2.0-pre.53 → 0.2.0-pre.55

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
@@ -24,6 +24,7 @@ __export(exports_functions, {
24
24
  readEntity: () => readEntity,
25
25
  pageMutations: () => pageMutations,
26
26
  pageEntitiesByIndex: () => pageEntitiesByIndex,
27
+ pageEntities: () => pageEntities,
27
28
  getChangeSetMutations: () => getChangeSetMutations,
28
29
  findDebounceMutation: () => findDebounceMutation,
29
30
  commit: () => commit,
@@ -173,6 +174,27 @@ var getChangeSetMutations = (txn, changeSetRef) => {
173
174
  });
174
175
  return res;
175
176
  };
177
+ // src/functions/pageEntities.ts
178
+ var pageEntities = (txn, args) => {
179
+ const { size, entities, childrenOf } = args;
180
+ const result = [];
181
+ for (const [, doc] of txn.engineOpts.entities) {
182
+ if (size && result.length >= size) {
183
+ break;
184
+ }
185
+ if (entities && entities !== "*" && !entities.includes(doc.entity)) {
186
+ continue;
187
+ } else {
188
+ if (childrenOf && childrenOf.length > 0) {
189
+ if (!childrenOf.some((childRef) => doc.__.parentRefs.includes(childRef))) {
190
+ continue;
191
+ }
192
+ }
193
+ result.push(doc);
194
+ }
195
+ }
196
+ return result;
197
+ };
176
198
  // src/functions/pageEntitiesByIndex.ts
177
199
  var pageEntitiesByIndex = (txn, entity, field, value) => {
178
200
  const { entitiesIndex } = txn.engineOpts;
@@ -2,6 +2,7 @@ export { batchReadEntities } from "./batchReadEntities";
2
2
  export { commit } from "./commit";
3
3
  export { findDebounceMutation } from "./findDebounceMutation";
4
4
  export { getChangeSetMutations } from "./getChangeSetMutations";
5
+ export { pageEntities } from "./pageEntities";
5
6
  export { pageEntitiesByIndex } from "./pageEntitiesByIndex";
6
7
  export { pageMutations } from "./pageMutations";
7
8
  export { readEntity } from "./readEntity";
@@ -0,0 +1 @@
1
+ export declare const pageEntities: (txn: any, args: any) => any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roc-db/in-memory",
3
- "version": "0.2.0-pre.53",
3
+ "version": "0.2.0-pre.55",
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.53",
16
+ "roc-db": "0.2.0-pre.55",
17
17
  "zod": "^3.0.0"
18
18
  },
19
19
  "keywords": [],