@roc-db/in-memory 0.1.0 → 0.2.0-pre.10

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
@@ -29,14 +29,14 @@ __export(exports_functions, {
29
29
  });
30
30
 
31
31
  // src/functions/begin.ts
32
- var begin = (request, engineOpts) => {
33
- return {
32
+ var begin = (request, engineOpts, callback) => {
33
+ return callback({
34
34
  ...engineOpts,
35
35
  changeSet: request.changeSetRef ? {
36
36
  entities: new Map([]),
37
37
  mutations: new Map([])
38
38
  } : null
39
- };
39
+ });
40
40
  };
41
41
  // src/functions/createEntity.ts
42
42
  import { entityFromRef } from "roc-db";
@@ -115,8 +115,25 @@ var findDebounceMutation = (request, engine, now) => {
115
115
  return res;
116
116
  };
117
117
  // src/functions/pageMutations.ts
118
- var pageMutations = (txn, { size = 30, skip = 0 } = {}) => {
119
- return txn.engineOpts.mutations.values().drop(skip).take(size).toArray();
118
+ var pageMutations = (txn, {
119
+ size = 30,
120
+ skip = 0,
121
+ changeSetRef
122
+ } = {}) => {
123
+ const res = [];
124
+ const iterator = txn.engineOpts.mutations.values().drop(skip);
125
+ let next = iterator.next();
126
+ while (!next.done && res.length < size) {
127
+ if (changeSetRef) {
128
+ if (next.value.changeSetRef === changeSetRef) {
129
+ res.push(next.value);
130
+ }
131
+ } else {
132
+ res.push(next.value);
133
+ }
134
+ next = iterator.next();
135
+ }
136
+ return res;
120
137
  };
121
138
  // src/functions/patchEntity.ts
122
139
  import { deepPatch, NotFoundError } from "roc-db";
@@ -1 +1 @@
1
- export declare const begin: (request: any, engineOpts: any) => any;
1
+ export declare const begin: (request: any, engineOpts: any, callback: any) => any;
@@ -1,6 +1,7 @@
1
1
  import type { ReadTransaction } from "roc-db";
2
2
  import type { InMemoryEngine } from "../types/InMemoryEngine";
3
- export declare const pageMutations: (txn: ReadTransaction<any, InMemoryEngine, any, any>, { size, skip }?: {
3
+ export declare const pageMutations: (txn: ReadTransaction<any, InMemoryEngine, any, any>, { size, skip, changeSetRef, }?: {
4
4
  size?: number;
5
5
  skip?: number;
6
+ changeSetRef?: string;
6
7
  }) => import("roc-db").Mutation[];
package/package.json CHANGED
@@ -1,27 +1,20 @@
1
1
  {
2
2
  "name": "@roc-db/in-memory",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-pre.10",
4
4
  "type": "module",
5
5
  "exports": {
6
- ".": "./src/index.ts"
6
+ ".": {
7
+ "import": "./dist/index.js",
8
+ "types": "./dist/types/index.d.ts"
9
+ }
7
10
  },
8
11
  "files": [
9
12
  "dist"
10
13
  ],
11
14
  "sideEffects": false,
12
- "scripts": {
13
- "build": "NODE_ENV=production bun run scripts/build.ts",
14
- "build:types": "rm -rf dist/types && bun run tsc --noCheck",
15
- "test": "bun test"
16
- },
17
- "devDependencies": {
18
- "@roc-db/test-utils": "0.1.0",
19
- "roc-db": "0.1.0",
20
- "zod": "3.24.2"
21
- },
22
15
  "peerDependencies": {
23
- "roc-db": "0.1.0",
24
- "zod": "3.24.2"
16
+ "roc-db": "0.2.0-pre.10",
17
+ "zod": "^3.0.0"
25
18
  },
26
19
  "keywords": [],
27
20
  "author": "Eigil Sagafos",
Binary file