@roc-db/in-memory 0.2.0-pre.47 → 0.2.0-pre.49

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
@@ -10,7 +10,10 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // src/createInMemoryAdapter.ts
13
- import { createAdapter, Snowflake } from "roc-db";
13
+ import {
14
+ createAdapter,
15
+ Snowflake
16
+ } from "roc-db";
14
17
 
15
18
  // src/functions/index.ts
16
19
  var exports_functions = {};
@@ -76,7 +79,7 @@ var commit = (txn, mutation, {
76
79
  };
77
80
  // src/functions/findDebounceMutation.ts
78
81
  var findDebounceMutation = (request, engine, now, mutationName) => {
79
- const debounceTime = request.settings.debounce;
82
+ const debounceTime = request.operation.debounce;
80
83
  const thresholdTime = new Date(now - debounceTime * 1000).toISOString();
81
84
  const res = engine.mutations.values().find((mutation) => {
82
85
  if (mutation.operation.name === mutationName && mutation.timestamp > thresholdTime && mutation.payload.ref === request.payload.ref) {
@@ -127,8 +130,8 @@ var createInMemoryAdapter = ({
127
130
  operations,
128
131
  entities,
129
132
  snowflake = new Snowflake(1, 1),
130
- session,
131
- optimistic = true
133
+ optimistic = true,
134
+ session
132
135
  }) => {
133
136
  return createAdapter({
134
137
  name: "in-memory",
@@ -136,8 +139,8 @@ var createInMemoryAdapter = ({
136
139
  entities,
137
140
  functions: exports_functions,
138
141
  snowflake,
139
- session,
140
- optimistic
142
+ optimistic,
143
+ session
141
144
  }, {
142
145
  entities: new Map,
143
146
  mutations: new Map
@@ -1,11 +1,13 @@
1
- import { Snowflake, type Adapter, type Operation } from "roc-db";
1
+ import { Snowflake, type Adapter, type Operation, type Session } from "roc-db";
2
2
  import type { z } from "zod";
3
3
  type Entity = z.ZodObject<{
4
4
  entity: z.ZodLiteral<string>;
5
5
  }>;
6
- export declare const createInMemoryAdapter: <const Name extends string, const Operations extends readonly Operation[], const Entities extends readonly Entity[]>({ operations, entities, snowflake, session, optimistic, }: {
6
+ export declare const createInMemoryAdapter: <const Name extends string, const Operations extends readonly Operation[], const Entities extends readonly Entity[]>({ operations, entities, snowflake, optimistic, session, }: {
7
7
  operations: Operations;
8
8
  entities: Entities;
9
9
  snowflake?: Snowflake;
10
+ optimistic?: boolean;
11
+ session: Session;
10
12
  }) => Adapter;
11
13
  export {};
@@ -1,3 +1,3 @@
1
- import type { WriteOperation } from "roc-db";
1
+ import type { WriteRequest } from "roc-db";
2
2
  import type { InMemoryEngine } from "../types/InMemoryEngine";
3
- export declare const findDebounceMutation: (request: WriteOperation, engine: InMemoryEngine, now: any, mutationName: string) => import("roc-db").Mutation | undefined;
3
+ export declare const findDebounceMutation: (request: WriteRequest, engine: InMemoryEngine, now: number, mutationName: string) => import("roc-db").Mutation | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roc-db/in-memory",
3
- "version": "0.2.0-pre.47",
3
+ "version": "0.2.0-pre.49",
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.47",
16
+ "roc-db": "0.2.0-pre.49",
17
17
  "zod": "^3.0.0"
18
18
  },
19
19
  "keywords": [],