dzql 0.5.13 → 0.5.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dzql",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "description": "PostgreSQL-powered framework with zero boilerplate CRUD operations and real-time WebSocket synchronization",
5
5
  "type": "module",
6
6
  "main": "src/server/index.js",
@@ -12,11 +12,11 @@ export { createMCPRoute } from "./mcp.js";
12
12
  /**
13
13
  * Process subscription updates when a database event occurs
14
14
  * Forwards atomic events to affected subscriptions for client-side patching
15
- * @param {Object} event - Database event {table, op, pk, before, after}
15
+ * @param {Object} event - Database event {table, op, pk, data}
16
16
  * @param {Function} broadcast - Broadcast function from WebSocket handlers
17
17
  */
18
18
  async function processSubscriptionUpdates(event, broadcast) {
19
- const { table, op, pk, before, after } = event;
19
+ const { table, op, pk, data } = event;
20
20
 
21
21
  // Get all active subscriptions grouped by subscribable
22
22
  const subscriptionsByName = getSubscriptionsBySubscribable();
@@ -39,9 +39,10 @@ async function processSubscriptionUpdates(event, broadcast) {
39
39
  }
40
40
 
41
41
  // Ask PostgreSQL which subscription instances are affected
42
+ // Pass data for both old/new - COALESCE in the function handles it
42
43
  const result = await sql.unsafe(
43
44
  `SELECT ${subscribableName}_affected_documents($1, $2, $3, $4) as affected`,
44
- [table, op, before, after]
45
+ [table, op, data, data]
45
46
  );
46
47
 
47
48
  const affectedParamSets = result[0]?.affected;
@@ -70,8 +71,7 @@ async function processSubscriptionUpdates(event, broadcast) {
70
71
  table,
71
72
  op,
72
73
  pk,
73
- data: after,
74
- before
74
+ data
75
75
  }
76
76
  }
77
77
  });