@logux/server 0.12.5 → 0.12.6

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.
@@ -1,8 +1,11 @@
1
1
  import type {
2
2
  LoguxSubscribeAction,
3
3
  SyncMapChangeAction,
4
+ SyncMapChangedAction,
4
5
  SyncMapCreateAction,
6
+ SyncMapCreatedAction,
5
7
  SyncMapDeleteAction,
8
+ SyncMapDeletedAction,
6
9
  SyncMapTypes,
7
10
  SyncMapValues
8
11
  } from '@logux/actions'
@@ -58,7 +61,10 @@ export function NoConflictResolution<
58
61
  interface SyncMapActionFilter<Value extends SyncMapValues> {
59
62
  (
60
63
  ctx: Context,
61
- action: SyncMapCreateAction<Value> | SyncMapDeleteAction,
64
+ action:
65
+ | SyncMapChangedAction<Value>
66
+ | SyncMapCreatedAction<Value>
67
+ | SyncMapDeletedAction,
62
68
  meta: ServerMeta
63
69
  ): boolean | Promise<boolean>
64
70
  }
@@ -82,7 +88,7 @@ interface SyncMapOperations<Value extends SyncMapValues> {
82
88
  time: number,
83
89
  action: SyncMapChangeAction<Value>,
84
90
  meta: ServerMeta
85
- ): boolean | Promise<boolean | void> | void
91
+ ): boolean | Promise<boolean | void> | void
86
92
 
87
93
  create?(
88
94
  ctx: Context,
@@ -44,6 +44,14 @@ function buildFilter(filter) {
44
44
  if (action.fields[key] !== filter[key]) return false
45
45
  }
46
46
  }
47
+ if (action.type.endsWith('/changed')) {
48
+ for (let key in filter) {
49
+ if (
50
+ key in action.fields &&
51
+ action.fields[key] !== filter[key]
52
+ ) return false
53
+ }
54
+ }
47
55
  return true
48
56
  }
49
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logux/server",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
4
4
  "description": "Build own Logux server or make proxy between WebSocket and HTTP backend on any language",
5
5
  "keywords": [
6
6
  "logux",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@logux/actions": "^0.3.1",
31
- "@logux/core": "^0.8.4",
31
+ "@logux/core": "^0.8.5",
32
32
  "JSONStream": "^1.3.5",
33
33
  "cookie": "^0.5.0",
34
34
  "dotenv": "^16.3.1",