@roc-db/in-memory 0.2.0-pre.44 → 0.2.0-pre.46

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
@@ -39,7 +39,11 @@ var saveMutation = (txn, finalizedMutation) => {
39
39
  };
40
40
 
41
41
  // src/functions/commit.ts
42
- var commit = (txn, mutation, { created, updated, deleted }) => {
42
+ var commit = (txn, mutation, {
43
+ created,
44
+ updated,
45
+ deleted
46
+ }) => {
43
47
  const { mutations } = txn.engineOpts;
44
48
  const currentMutation = mutations.get(txn.mutation.ref);
45
49
  if (currentMutation) {
@@ -62,7 +66,11 @@ var commit = (txn, mutation, { created, updated, deleted }) => {
62
66
  txn.engineOpts.entities.set(doc.ref, doc);
63
67
  }
64
68
  for (const ref of deleted) {
65
- txn.engineOpts.entities.delete(ref);
69
+ if (ref.startsWith("Mutation/")) {
70
+ txn.engineOpts.mutations.delete(ref);
71
+ } else {
72
+ txn.engineOpts.entities.delete(ref);
73
+ }
66
74
  }
67
75
  return mutation;
68
76
  };
@@ -1,5 +1,6 @@
1
- export declare const commit: (txn: any, mutation: any, { created, updated, deleted }: {
2
- created: any;
3
- updated: any;
4
- deleted: any;
5
- }) => any;
1
+ import type { Entity, Mutation, Ref, WriteTransaction } from "roc-db";
2
+ export declare const commit: (txn: WriteTransaction, mutation: Mutation, { created, updated, deleted, }: {
3
+ created: Entity[];
4
+ updated: Entity[];
5
+ deleted: Ref[];
6
+ }) => Mutation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roc-db/in-memory",
3
- "version": "0.2.0-pre.44",
3
+ "version": "0.2.0-pre.46",
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.44",
16
+ "roc-db": "0.2.0-pre.46",
17
17
  "zod": "^3.0.0"
18
18
  },
19
19
  "keywords": [],