@powerhousedao/reactor 6.0.0-dev.42 → 6.0.0-dev.44

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.
Files changed (148) hide show
  1. package/dist/src/cache/kysely-operation-index.d.ts +2 -1
  2. package/dist/src/cache/kysely-operation-index.d.ts.map +1 -1
  3. package/dist/src/cache/kysely-operation-index.js +7 -2
  4. package/dist/src/cache/kysely-operation-index.js.map +1 -1
  5. package/dist/src/cache/operation-index-types.d.ts +4 -2
  6. package/dist/src/cache/operation-index-types.d.ts.map +1 -1
  7. package/dist/src/cache/operation-index-types.js.map +1 -1
  8. package/dist/src/core/types.d.ts +1 -1
  9. package/dist/src/core/types.d.ts.map +1 -1
  10. package/dist/src/events/types.d.ts +1 -1
  11. package/dist/src/events/types.d.ts.map +1 -1
  12. package/dist/src/executor/document-action-handler.d.ts +1 -1
  13. package/dist/src/executor/document-action-handler.d.ts.map +1 -1
  14. package/dist/src/executor/document-action-handler.js +16 -11
  15. package/dist/src/executor/document-action-handler.js.map +1 -1
  16. package/dist/src/executor/simple-job-executor.d.ts.map +1 -1
  17. package/dist/src/executor/simple-job-executor.js +32 -19
  18. package/dist/src/executor/simple-job-executor.js.map +1 -1
  19. package/dist/src/executor/types.d.ts +1 -1
  20. package/dist/src/executor/types.d.ts.map +1 -1
  21. package/dist/src/executor/util.d.ts +1 -1
  22. package/dist/src/executor/util.d.ts.map +1 -1
  23. package/dist/src/executor/util.js.map +1 -1
  24. package/dist/src/index.d.ts +6 -7
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/index.js +2 -3
  27. package/dist/src/index.js.map +1 -1
  28. package/dist/src/processors/index.d.ts +1 -1
  29. package/dist/src/processors/index.d.ts.map +1 -1
  30. package/dist/src/processors/processor-manager.d.ts +2 -2
  31. package/dist/src/processors/processor-manager.d.ts.map +1 -1
  32. package/dist/src/processors/processor-manager.js.map +1 -1
  33. package/dist/src/processors/relational/types.d.ts +1 -26
  34. package/dist/src/processors/relational/types.d.ts.map +1 -1
  35. package/dist/src/processors/relational/types.js +1 -1
  36. package/dist/src/processors/relational/types.js.map +1 -1
  37. package/dist/src/processors/relational/utils.d.ts +1 -28
  38. package/dist/src/processors/relational/utils.d.ts.map +1 -1
  39. package/dist/src/processors/relational/utils.js +1 -66
  40. package/dist/src/processors/relational/utils.js.map +1 -1
  41. package/dist/src/processors/utils.d.ts +2 -2
  42. package/dist/src/processors/utils.d.ts.map +1 -1
  43. package/dist/src/read-models/base-read-model.d.ts +1 -1
  44. package/dist/src/read-models/base-read-model.d.ts.map +1 -1
  45. package/dist/src/read-models/document-view.d.ts +2 -2
  46. package/dist/src/read-models/document-view.d.ts.map +1 -1
  47. package/dist/src/read-models/document-view.js.map +1 -1
  48. package/dist/src/read-models/interfaces.d.ts +1 -1
  49. package/dist/src/read-models/interfaces.d.ts.map +1 -1
  50. package/dist/src/storage/interfaces.d.ts +4 -14
  51. package/dist/src/storage/interfaces.d.ts.map +1 -1
  52. package/dist/src/storage/interfaces.js.map +1 -1
  53. package/dist/src/storage/kysely/document-indexer.d.ts +2 -1
  54. package/dist/src/storage/kysely/document-indexer.d.ts.map +1 -1
  55. package/dist/src/storage/kysely/document-indexer.js.map +1 -1
  56. package/dist/src/storage/kysely/store.d.ts +2 -2
  57. package/dist/src/storage/kysely/store.d.ts.map +1 -1
  58. package/dist/src/storage/kysely/store.js.map +1 -1
  59. package/dist/src/storage/kysely/sync-cursor-storage.d.ts +1 -1
  60. package/dist/src/storage/kysely/sync-cursor-storage.d.ts.map +1 -1
  61. package/dist/src/storage/kysely/sync-cursor-storage.js +6 -2
  62. package/dist/src/storage/kysely/sync-cursor-storage.js.map +1 -1
  63. package/dist/src/storage/kysely/types.d.ts +2 -0
  64. package/dist/src/storage/kysely/types.d.ts.map +1 -1
  65. package/dist/src/storage/migrations/011_add_cursor_type_column.d.ts +3 -0
  66. package/dist/src/storage/migrations/011_add_cursor_type_column.d.ts.map +1 -0
  67. package/dist/src/storage/migrations/011_add_cursor_type_column.js +29 -0
  68. package/dist/src/storage/migrations/011_add_cursor_type_column.js.map +1 -0
  69. package/dist/src/storage/migrations/012_add_source_remote_column.d.ts +3 -0
  70. package/dist/src/storage/migrations/012_add_source_remote_column.d.ts.map +1 -0
  71. package/dist/src/storage/migrations/012_add_source_remote_column.js +7 -0
  72. package/dist/src/storage/migrations/012_add_source_remote_column.js.map +1 -0
  73. package/dist/src/storage/migrations/migrator.d.ts.map +1 -1
  74. package/dist/src/storage/migrations/migrator.js +4 -0
  75. package/dist/src/storage/migrations/migrator.js.map +1 -1
  76. package/dist/src/subs/subscription-notification-read-model.d.ts +2 -1
  77. package/dist/src/subs/subscription-notification-read-model.d.ts.map +1 -1
  78. package/dist/src/subs/subscription-notification-read-model.js.map +1 -1
  79. package/dist/src/sync/batch-aggregator.d.ts +25 -0
  80. package/dist/src/sync/batch-aggregator.d.ts.map +1 -0
  81. package/dist/src/sync/batch-aggregator.js +94 -0
  82. package/dist/src/sync/batch-aggregator.js.map +1 -0
  83. package/dist/src/sync/buffered-mailbox.d.ts +14 -8
  84. package/dist/src/sync/buffered-mailbox.d.ts.map +1 -1
  85. package/dist/src/sync/buffered-mailbox.js +34 -6
  86. package/dist/src/sync/buffered-mailbox.js.map +1 -1
  87. package/dist/src/sync/channels/composite-channel-factory.d.ts +0 -6
  88. package/dist/src/sync/channels/composite-channel-factory.d.ts.map +1 -1
  89. package/dist/src/sync/channels/composite-channel-factory.js +4 -10
  90. package/dist/src/sync/channels/composite-channel-factory.js.map +1 -1
  91. package/dist/src/sync/channels/gql-channel-factory.js +2 -2
  92. package/dist/src/sync/channels/gql-channel-factory.js.map +1 -1
  93. package/dist/src/sync/channels/{gql-channel.d.ts → gql-req-channel.d.ts} +8 -27
  94. package/dist/src/sync/channels/gql-req-channel.d.ts.map +1 -0
  95. package/dist/src/sync/channels/{gql-channel.js → gql-req-channel.js} +142 -182
  96. package/dist/src/sync/channels/gql-req-channel.js.map +1 -0
  97. package/dist/src/sync/channels/gql-res-channel.d.ts +25 -0
  98. package/dist/src/sync/channels/gql-res-channel.d.ts.map +1 -0
  99. package/dist/src/sync/channels/gql-res-channel.js +79 -0
  100. package/dist/src/sync/channels/gql-res-channel.js.map +1 -0
  101. package/dist/src/sync/channels/index.d.ts +5 -5
  102. package/dist/src/sync/channels/index.d.ts.map +1 -1
  103. package/dist/src/sync/channels/index.js +5 -5
  104. package/dist/src/sync/channels/index.js.map +1 -1
  105. package/dist/src/sync/channels/utils.d.ts +15 -1
  106. package/dist/src/sync/channels/utils.d.ts.map +1 -1
  107. package/dist/src/sync/channels/utils.js +66 -2
  108. package/dist/src/sync/channels/utils.js.map +1 -1
  109. package/dist/src/sync/index.d.ts +6 -6
  110. package/dist/src/sync/index.d.ts.map +1 -1
  111. package/dist/src/sync/index.js +5 -5
  112. package/dist/src/sync/index.js.map +1 -1
  113. package/dist/src/sync/interfaces.d.ts +4 -18
  114. package/dist/src/sync/interfaces.d.ts.map +1 -1
  115. package/dist/src/sync/mailbox.d.ts +39 -18
  116. package/dist/src/sync/mailbox.d.ts.map +1 -1
  117. package/dist/src/sync/mailbox.js +50 -20
  118. package/dist/src/sync/mailbox.js.map +1 -1
  119. package/dist/src/sync/sync-manager.d.ts +5 -13
  120. package/dist/src/sync/sync-manager.d.ts.map +1 -1
  121. package/dist/src/sync/sync-manager.js +91 -275
  122. package/dist/src/sync/sync-manager.js.map +1 -1
  123. package/dist/src/sync/sync-operation.d.ts +1 -1
  124. package/dist/src/sync/sync-operation.d.ts.map +1 -1
  125. package/dist/src/sync/sync-operation.js +3 -0
  126. package/dist/src/sync/sync-operation.js.map +1 -1
  127. package/dist/src/sync/types.d.ts +2 -1
  128. package/dist/src/sync/types.d.ts.map +1 -1
  129. package/dist/src/sync/types.js.map +1 -1
  130. package/dist/src/sync/utils.d.ts +19 -3
  131. package/dist/src/sync/utils.d.ts.map +1 -1
  132. package/dist/src/sync/utils.js +120 -1
  133. package/dist/src/sync/utils.js.map +1 -1
  134. package/package.json +5 -4
  135. package/dist/src/processors/relational/relational-db-processor.d.ts +0 -47
  136. package/dist/src/processors/relational/relational-db-processor.d.ts.map +0 -1
  137. package/dist/src/processors/relational/relational-db-processor.js +0 -45
  138. package/dist/src/processors/relational/relational-db-processor.js.map +0 -1
  139. package/dist/src/processors/types.d.ts +0 -71
  140. package/dist/src/processors/types.d.ts.map +0 -1
  141. package/dist/src/processors/types.js +0 -2
  142. package/dist/src/processors/types.js.map +0 -1
  143. package/dist/src/sync/channels/gql-channel.d.ts.map +0 -1
  144. package/dist/src/sync/channels/gql-channel.js.map +0 -1
  145. package/dist/src/sync/channels/polling-channel.d.ts +0 -39
  146. package/dist/src/sync/channels/polling-channel.d.ts.map +0 -1
  147. package/dist/src/sync/channels/polling-channel.js +0 -72
  148. package/dist/src/sync/channels/polling-channel.js.map +0 -1
@@ -2,12 +2,12 @@ import { BufferedMailbox } from "../buffered-mailbox.js";
2
2
  import { ChannelError } from "../errors.js";
3
3
  import { Mailbox } from "../mailbox.js";
4
4
  import { ChannelErrorSource } from "../types.js";
5
- import { sortEnvelopesByFirstOperationTimestamp } from "../utils.js";
6
- import { envelopesToSyncOperations } from "./utils.js";
5
+ import { sortEnvelopesByFirstOperationTimestamp, trimMailboxFromAckOrdinal, } from "../utils.js";
6
+ import { envelopesToSyncOperations, getLatestAppliedOrdinal, serializeEnvelope, } from "./utils.js";
7
7
  /**
8
8
  * GraphQL-based synchronization channel for network communication between reactors.
9
9
  */
10
- export class GqlChannel {
10
+ export class GqlRequestChannel {
11
11
  logger;
12
12
  inbox;
13
13
  outbox;
@@ -23,6 +23,8 @@ export class GqlChannel {
23
23
  failureCount;
24
24
  lastSuccessUtcMs;
25
25
  lastFailureUtcMs;
26
+ lastPersistedInboxOrdinal = 0;
27
+ lastPersistedOutboxOrdinal = 0;
26
28
  constructor(logger, channelId, remoteName, cursorStorage, config, operationIndex, pollTimer) {
27
29
  this.logger = logger;
28
30
  this.channelId = channelId;
@@ -46,8 +48,56 @@ export class GqlChannel {
46
48
  this.bufferedOutbox = new BufferedMailbox(500, 25);
47
49
  this.outbox = this.bufferedOutbox;
48
50
  this.deadLetter = new Mailbox();
51
+ // when sync ops are added to the outbox, push them to the remote
49
52
  this.outbox.onAdded((syncOps) => {
50
- this.handleOutboxAdded(syncOps);
53
+ if (this.isShutdown) {
54
+ return;
55
+ }
56
+ this.pushSyncOperations(syncOps).catch((error) => {
57
+ const err = error instanceof Error ? error : new Error(String(error));
58
+ const channelError = new ChannelError(ChannelErrorSource.Outbox, err);
59
+ for (const syncOp of syncOps) {
60
+ syncOp.failed(channelError);
61
+ }
62
+ // move to dead letters
63
+ this.deadLetter.add(...syncOps);
64
+ this.outbox.remove(...syncOps);
65
+ });
66
+ });
67
+ // Instead of listening to syncops directly for cursor updates, we listen
68
+ // to the mailbox. This is for efficiency: many syncops may fire on a trim,
69
+ // but only one onRemoved callback will be fired for the batch.
70
+ this.outbox.onRemoved((syncOps) => {
71
+ const maxOrdinal = getLatestAppliedOrdinal(syncOps);
72
+ if (maxOrdinal > this.lastPersistedOutboxOrdinal) {
73
+ this.lastPersistedOutboxOrdinal = maxOrdinal;
74
+ this.cursorStorage
75
+ .upsert({
76
+ remoteName: this.remoteName,
77
+ cursorType: "outbox",
78
+ cursorOrdinal: maxOrdinal,
79
+ lastSyncedAtUtcMs: Date.now(),
80
+ })
81
+ .catch((error) => {
82
+ this.logger.error("Failed to update outbox cursor for @ChannelId! This means that future application runs may resend duplicate operations. This is recoverable (with deduplication protection), but not-optimal: @Error", this.channelId, error);
83
+ });
84
+ }
85
+ });
86
+ this.inbox.onRemoved((syncOps) => {
87
+ const maxOrdinal = getLatestAppliedOrdinal(syncOps);
88
+ if (maxOrdinal > this.lastPersistedInboxOrdinal) {
89
+ this.lastPersistedInboxOrdinal = maxOrdinal;
90
+ this.cursorStorage
91
+ .upsert({
92
+ remoteName: this.remoteName,
93
+ cursorType: "inbox",
94
+ cursorOrdinal: maxOrdinal,
95
+ lastSyncedAtUtcMs: Date.now(),
96
+ })
97
+ .catch((error) => {
98
+ this.logger.error("Failed to update inbox cursor for @ChannelId! This is unlikely to cause a problem, but not-optimal: @Error", this.channelId, error);
99
+ });
100
+ }
51
101
  });
52
102
  }
53
103
  /**
@@ -57,12 +107,21 @@ export class GqlChannel {
57
107
  this.bufferedOutbox.flush();
58
108
  this.isShutdown = true;
59
109
  this.pollTimer.stop();
110
+ return Promise.resolve();
60
111
  }
61
112
  /**
62
113
  * Initializes the channel by registering it on the remote server and starting polling.
63
114
  */
64
115
  async init() {
65
116
  await this.touchRemoteChannel();
117
+ // get cursors -- these are the last acknowledged ordinals for the inbox and outbox
118
+ const cursors = await this.cursorStorage.list(this.remoteName);
119
+ const inboxOrdinal = cursors.find((c) => c.cursorType === "inbox")?.cursorOrdinal ?? 0;
120
+ const outboxOrdinal = cursors.find((c) => c.cursorType === "outbox")?.cursorOrdinal ?? 0;
121
+ this.inbox.init(inboxOrdinal);
122
+ this.outbox.init(outboxOrdinal);
123
+ this.lastPersistedInboxOrdinal = inboxOrdinal;
124
+ this.lastPersistedOutboxOrdinal = outboxOrdinal;
66
125
  this.pollTimer.setDelegate(() => this.poll());
67
126
  this.pollTimer.start();
68
127
  }
@@ -76,58 +135,35 @@ export class GqlChannel {
76
135
  if (this.failureCount >= this.config.maxFailures) {
77
136
  return;
78
137
  }
79
- let cursor;
138
+ let response;
80
139
  try {
81
- cursor = await this.cursorStorage.get(this.remoteName);
140
+ response = await this.pollSyncEnvelopes(this.inbox.ackOrdinal, this.inbox.latestOrdinal);
82
141
  }
83
142
  catch (error) {
84
143
  this.handlePollError(error);
85
144
  return;
86
145
  }
87
- const cursorOrdinal = cursor.cursorOrdinal;
88
- let envelopes;
89
- try {
90
- envelopes = await this.pollSyncEnvelopes(cursorOrdinal);
91
- }
92
- catch (error) {
93
- this.handlePollError(error);
94
- return;
146
+ const { envelopes, ackOrdinal } = response;
147
+ // first: trim outbox
148
+ if (ackOrdinal > 0) {
149
+ trimMailboxFromAckOrdinal(this.outbox, ackOrdinal);
95
150
  }
96
- let maxCursorOrdinal = cursorOrdinal;
151
+ // todo: Is this necessary? Outbox items should have been sorted when returned.
97
152
  const sortedEnvelopes = sortEnvelopesByFirstOperationTimestamp(envelopes);
98
- const hasKeyedEnvelopes = sortedEnvelopes.some((e) => e.key || (e.dependsOn && e.dependsOn.length > 0));
99
- if (hasKeyedEnvelopes) {
100
- this.inbox.pause();
101
- }
102
- try {
103
- for (const envelope of sortedEnvelopes) {
104
- if (envelope.type.toLowerCase() === "operations" &&
105
- envelope.operations) {
106
- const syncOps = envelopesToSyncOperations(envelope, this.remoteName);
107
- for (const syncOp of syncOps) {
108
- syncOp.transported();
109
- this.inbox.add(syncOp);
110
- }
153
+ // convert the envelopes to sync operations
154
+ const allSyncOps = [];
155
+ for (const envelope of sortedEnvelopes) {
156
+ if (envelope.type.toLowerCase() === "operations" && envelope.operations) {
157
+ const syncOps = envelopesToSyncOperations(envelope, this.remoteName);
158
+ for (const syncOp of syncOps) {
159
+ syncOp.transported();
111
160
  }
112
- if (envelope.cursor &&
113
- envelope.cursor.cursorOrdinal > maxCursorOrdinal) {
114
- maxCursorOrdinal = envelope.cursor.cursorOrdinal;
115
- }
116
- }
117
- }
118
- finally {
119
- if (hasKeyedEnvelopes) {
120
- this.inbox.resume();
161
+ allSyncOps.push(...syncOps);
121
162
  }
122
163
  }
123
- if (maxCursorOrdinal > cursorOrdinal) {
124
- try {
125
- await this.updateCursor(maxCursorOrdinal);
126
- }
127
- catch (error) {
128
- this.handlePollError(error);
129
- return;
130
- }
164
+ // add all of them to the inbox
165
+ if (allSyncOps.length > 0) {
166
+ this.inbox.add(...allSyncOps);
131
167
  }
132
168
  this.lastSuccessUtcMs = Date.now();
133
169
  this.failureCount = 0;
@@ -171,74 +207,82 @@ export class GqlChannel {
171
207
  /**
172
208
  * Queries the remote GraphQL endpoint for sync envelopes.
173
209
  */
174
- async pollSyncEnvelopes(cursorOrdinal) {
210
+ async pollSyncEnvelopes(ackOrdinal, latestOrdinal) {
175
211
  const query = `
176
- query PollSyncEnvelopes($channelId: String!, $cursorOrdinal: Int!) {
177
- pollSyncEnvelopes(channelId: $channelId, cursorOrdinal: $cursorOrdinal) {
178
- type
179
- channelMeta {
180
- id
181
- }
182
- operations {
183
- operation {
184
- index
185
- timestampUtcMs
186
- hash
187
- skip
188
- error
212
+ query PollSyncEnvelopes($channelId: String!, $outboxAck: Int!, $outboxLatest: Int!) {
213
+ pollSyncEnvelopes(channelId: $channelId, outboxAck: $outboxAck, outboxLatest: $outboxLatest) {
214
+ envelopes {
215
+ type
216
+ channelMeta {
189
217
  id
190
- action {
191
- id
192
- type
218
+ }
219
+ operations {
220
+ operation {
221
+ index
193
222
  timestampUtcMs
194
- input
195
- scope
196
- attachments {
197
- data
198
- mimeType
199
- hash
200
- extension
201
- fileName
202
- }
203
- context {
204
- signer {
205
- user {
206
- address
207
- networkId
208
- chainId
209
- }
210
- app {
211
- name
212
- key
223
+ hash
224
+ skip
225
+ error
226
+ id
227
+ action {
228
+ id
229
+ type
230
+ timestampUtcMs
231
+ input
232
+ scope
233
+ attachments {
234
+ data
235
+ mimeType
236
+ hash
237
+ extension
238
+ fileName
239
+ }
240
+ context {
241
+ signer {
242
+ user {
243
+ address
244
+ networkId
245
+ chainId
246
+ }
247
+ app {
248
+ name
249
+ key
250
+ }
251
+ signatures
213
252
  }
214
- signatures
215
253
  }
216
254
  }
217
255
  }
256
+ context {
257
+ documentId
258
+ documentType
259
+ scope
260
+ branch
261
+ ordinal
262
+ }
218
263
  }
219
- context {
220
- documentId
221
- documentType
222
- scope
223
- branch
264
+ cursor {
265
+ remoteName
266
+ cursorOrdinal
267
+ lastSyncedAtUtcMs
224
268
  }
269
+ key
270
+ dependsOn
225
271
  }
226
- cursor {
227
- remoteName
228
- cursorOrdinal
229
- lastSyncedAtUtcMs
230
- }
231
- key
232
- dependsOn
272
+ ackOrdinal
233
273
  }
234
274
  }
235
275
  `;
236
276
  const variables = {
237
277
  channelId: this.channelId,
238
- cursorOrdinal,
278
+ outboxAck: ackOrdinal,
279
+ outboxLatest: latestOrdinal,
239
280
  };
240
281
  const response = await this.executeGraphQL(query, variables);
241
- return response.pollSyncEnvelopes;
282
+ return {
283
+ envelopes: response.pollSyncEnvelopes.envelopes,
284
+ ackOrdinal: response.pollSyncEnvelopes.ackOrdinal,
285
+ };
242
286
  }
243
287
  /**
244
288
  * Registers or updates this channel on the remote server via GraphQL mutation.
@@ -274,24 +318,6 @@ export class GqlChannel {
274
318
  };
275
319
  await this.executeGraphQL(mutation, variables);
276
320
  }
277
- /**
278
- * Handles sync operations added to the outbox by sending them to the remote.
279
- */
280
- handleOutboxAdded(syncOps) {
281
- if (this.isShutdown) {
282
- return;
283
- }
284
- // Execute async but don't await (fire and forget with error handling)
285
- this.pushSyncOperations(syncOps).catch((error) => {
286
- const err = error instanceof Error ? error : new Error(String(error));
287
- const channelError = new ChannelError(ChannelErrorSource.Outbox, err);
288
- for (const syncOp of syncOps) {
289
- syncOp.failed(channelError);
290
- this.deadLetter.add(syncOp);
291
- this.outbox.remove(syncOp);
292
- }
293
- });
294
- }
295
321
  /**
296
322
  * Pushes multiple sync operations to the remote via a single GraphQL mutation.
297
323
  * Creates one SyncEnvelope per SyncOperation with key/dependsOn for batch ordering.
@@ -333,64 +359,9 @@ export class GqlChannel {
333
359
  }
334
360
  `;
335
361
  const variables = {
336
- envelopes: envelopes.map((e) => this.serializeEnvelope(e)),
362
+ envelopes: envelopes.map((e) => serializeEnvelope(e)),
337
363
  };
338
364
  await this.executeGraphQL(mutation, variables);
339
- for (const syncOp of syncOps) {
340
- this.outbox.remove(syncOp);
341
- }
342
- }
343
- /**
344
- * Serializes a SyncEnvelope for GraphQL transport.
345
- *
346
- * Signatures are serialized as comma-separated strings since GraphQL schema
347
- * defines them as [String!]!. Extra context fields (resultingState, ordinal)
348
- * are stripped since they are not defined in OperationContextInput.
349
- */
350
- serializeEnvelope(envelope) {
351
- return {
352
- type: envelope.type.toUpperCase(),
353
- channelMeta: envelope.channelMeta,
354
- operations: envelope.operations?.map((opWithContext) => ({
355
- operation: {
356
- index: opWithContext.operation.index,
357
- timestampUtcMs: opWithContext.operation.timestampUtcMs,
358
- hash: opWithContext.operation.hash,
359
- skip: opWithContext.operation.skip,
360
- error: opWithContext.operation.error,
361
- id: opWithContext.operation.id,
362
- action: this.serializeAction(opWithContext.operation.action),
363
- },
364
- context: {
365
- documentId: opWithContext.context.documentId,
366
- documentType: opWithContext.context.documentType,
367
- scope: opWithContext.context.scope,
368
- branch: opWithContext.context.branch,
369
- },
370
- })),
371
- cursor: envelope.cursor,
372
- key: envelope.key,
373
- dependsOn: envelope.dependsOn,
374
- };
375
- }
376
- /**
377
- * Serializes an action for GraphQL transport, converting signature tuples to strings.
378
- */
379
- serializeAction(action) {
380
- const signer = action.context?.signer;
381
- if (!signer?.signatures) {
382
- return action;
383
- }
384
- return {
385
- ...action,
386
- context: {
387
- ...action.context,
388
- signer: {
389
- ...signer,
390
- signatures: signer.signatures.map((sig) => Array.isArray(sig) ? sig.join(", ") : sig),
391
- },
392
- },
393
- };
394
365
  }
395
366
  /**
396
367
  * Gets the authorization header value using jwtHandler.
@@ -454,17 +425,6 @@ export class GqlChannel {
454
425
  }
455
426
  return result.data;
456
427
  }
457
- /**
458
- * Updates the synchronization cursor for this channel's remote.
459
- */
460
- async updateCursor(cursorOrdinal) {
461
- const cursor = {
462
- remoteName: this.remoteName,
463
- cursorOrdinal,
464
- lastSyncedAtUtcMs: Date.now(),
465
- };
466
- await this.cursorStorage.upsert(cursor);
467
- }
468
428
  /**
469
429
  * Gets the current health status of the channel.
470
430
  */
@@ -484,4 +444,4 @@ export class GqlChannel {
484
444
  return this.pollTimer;
485
445
  }
486
446
  }
487
- //# sourceMappingURL=gql-channel.js.map
447
+ //# sourceMappingURL=gql-req-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql-req-channel.js","sourceRoot":"","sources":["../../../../src/sync/channels/gql-req-channel.ts"],"names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AAE,IAAI,CAAC,YAAY;SAChC,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import type { ILogger } from "../../logging/types.js";
2
+ import type { ISyncCursorStorage } from "../../storage/interfaces.js";
3
+ import type { IChannel } from "../interfaces.js";
4
+ import { Mailbox } from "../mailbox.js";
5
+ /**
6
+ * This class is used server-side to accumulate inbox + outbox operations.
7
+ *
8
+ * In general, the resolvers are responsible for updating mailboxes.
9
+ */
10
+ export declare class GqlResponseChannel implements IChannel {
11
+ private readonly logger;
12
+ readonly inbox: Mailbox;
13
+ readonly outbox: Mailbox;
14
+ readonly deadLetter: Mailbox;
15
+ private readonly channelId;
16
+ private readonly remoteName;
17
+ private readonly cursorStorage;
18
+ private isShutdown;
19
+ private lastPersistedInboxOrdinal;
20
+ private lastPersistedOutboxOrdinal;
21
+ constructor(logger: ILogger, channelId: string, remoteName: string, cursorStorage: ISyncCursorStorage);
22
+ shutdown(): Promise<void>;
23
+ init(): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=gql-res-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql-res-channel.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/gql-res-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,QAAQ;IAa/C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAZzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,yBAAyB,CAAa;IAC9C,OAAO,CAAC,0BAA0B,CAAa;gBAG5B,MAAM,EAAE,OAAO,EAChC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,kBAAkB;IAyDnC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAY5B"}
@@ -0,0 +1,79 @@
1
+ import { Mailbox } from "../mailbox.js";
2
+ import { getLatestAppliedOrdinal } from "./utils.js";
3
+ /**
4
+ * This class is used server-side to accumulate inbox + outbox operations.
5
+ *
6
+ * In general, the resolvers are responsible for updating mailboxes.
7
+ */
8
+ export class GqlResponseChannel {
9
+ logger;
10
+ inbox;
11
+ outbox;
12
+ deadLetter;
13
+ channelId;
14
+ remoteName;
15
+ cursorStorage;
16
+ isShutdown;
17
+ lastPersistedInboxOrdinal = 0;
18
+ lastPersistedOutboxOrdinal = 0;
19
+ constructor(logger, channelId, remoteName, cursorStorage) {
20
+ this.logger = logger;
21
+ this.channelId = channelId;
22
+ this.remoteName = remoteName;
23
+ this.cursorStorage = cursorStorage;
24
+ this.isShutdown = false;
25
+ this.inbox = new Mailbox();
26
+ this.outbox = new Mailbox();
27
+ this.deadLetter = new Mailbox();
28
+ // Instead of listening to syncops directly for cursor updates, we listen
29
+ // to the mailbox. This is for efficiency: many syncops may fire on a trim,
30
+ // but only one onRemoved callback will be fired for the batch.
31
+ this.outbox.onRemoved((syncOps) => {
32
+ const maxOrdinal = getLatestAppliedOrdinal(syncOps);
33
+ if (maxOrdinal > this.lastPersistedOutboxOrdinal) {
34
+ this.lastPersistedOutboxOrdinal = maxOrdinal;
35
+ this.cursorStorage
36
+ .upsert({
37
+ remoteName: this.remoteName,
38
+ cursorType: "outbox",
39
+ cursorOrdinal: maxOrdinal,
40
+ lastSyncedAtUtcMs: Date.now(),
41
+ })
42
+ .catch((error) => {
43
+ this.logger.error("Failed to update outbox cursor for @ChannelId! This means that future application runs may resend duplicate operations. This is recoverable (with deduplication protection), but not-optimal: @Error", this.channelId, error);
44
+ });
45
+ }
46
+ });
47
+ this.inbox.onRemoved((syncOps) => {
48
+ const maxOrdinal = getLatestAppliedOrdinal(syncOps);
49
+ if (maxOrdinal > this.lastPersistedInboxOrdinal) {
50
+ this.lastPersistedInboxOrdinal = maxOrdinal;
51
+ this.cursorStorage
52
+ .upsert({
53
+ remoteName: this.remoteName,
54
+ cursorType: "inbox",
55
+ cursorOrdinal: maxOrdinal,
56
+ lastSyncedAtUtcMs: Date.now(),
57
+ })
58
+ .catch((error) => {
59
+ this.logger.error("Failed to update inbox cursor for @ChannelId! This is unlikely to cause a problem, but not-optimal: @Error", this.channelId, error);
60
+ });
61
+ }
62
+ });
63
+ }
64
+ shutdown() {
65
+ this.isShutdown = true;
66
+ return Promise.resolve();
67
+ }
68
+ async init() {
69
+ // get cursors -- these are the last acknowledged ordinals for the inbox and outbox
70
+ const cursors = await this.cursorStorage.list(this.remoteName);
71
+ const inboxOrdinal = cursors.find((c) => c.cursorType === "inbox")?.cursorOrdinal ?? 0;
72
+ const outboxOrdinal = cursors.find((c) => c.cursorType === "outbox")?.cursorOrdinal ?? 0;
73
+ this.inbox.init(inboxOrdinal);
74
+ this.outbox.init(outboxOrdinal);
75
+ this.lastPersistedInboxOrdinal = inboxOrdinal;
76
+ this.lastPersistedOutboxOrdinal = outboxOrdinal;
77
+ }
78
+ }
79
+ //# sourceMappingURL=gql-res-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql-res-channel.js","sourceRoot":"","sources":["../../../../src/sync/channels/gql-res-channel.ts"],"names":[],"mappings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jB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,EAAE,aAAa,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,YAAY,CAAC;QAC9C,IAAI,CAAC,0BAA0B,GAAG,aAAa,CAAC;IAClD,CAAC;CACF"}
@@ -1,8 +1,8 @@
1
- export { PollingChannel } from "./polling-channel.js";
2
- export { GqlChannel, type GqlChannelConfig } from "./gql-channel.js";
3
- export { GqlChannelFactory } from "./gql-channel-factory.js";
4
1
  export { CompositeChannelFactory } from "./composite-channel-factory.js";
5
- export { envelopeToSyncOperation } from "./utils.js";
6
- export { type IPollTimer } from "./poll-timer.js";
2
+ export { GqlChannelFactory } from "./gql-channel-factory.js";
3
+ export { GqlRequestChannel as GqlChannel, type GqlChannelConfig, } from "./gql-req-channel.js";
4
+ export { GqlResponseChannel as PollingChannel } from "./gql-res-channel.js";
7
5
  export { IntervalPollTimer } from "./interval-poll-timer.js";
6
+ export { type IPollTimer } from "./poll-timer.js";
7
+ export { envelopeToSyncOperation } from "./utils.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,iBAAiB,IAAI,UAAU,EAC/B,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,8 +1,8 @@
1
- export { PollingChannel } from "./polling-channel.js";
2
- export { GqlChannel } from "./gql-channel.js";
3
- export { GqlChannelFactory } from "./gql-channel-factory.js";
4
1
  export { CompositeChannelFactory } from "./composite-channel-factory.js";
5
- export { envelopeToSyncOperation } from "./utils.js";
6
- export {} from "./poll-timer.js";
2
+ export { GqlChannelFactory } from "./gql-channel-factory.js";
3
+ export { GqlRequestChannel as GqlChannel, } from "./gql-req-channel.js";
4
+ export { GqlResponseChannel as PollingChannel } from "./gql-res-channel.js";
7
5
  export { IntervalPollTimer } from "./interval-poll-timer.js";
6
+ export {} from "./poll-timer.js";
7
+ export { envelopeToSyncOperation } from "./utils.js";
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAmB,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,iBAAiB,IAAI,UAAU,GAEhC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAmB,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,5 +1,18 @@
1
+ import type { Action } from "document-model";
1
2
  import { SyncOperation } from "../sync-operation.js";
2
- import type { SyncEnvelope } from "../types.js";
3
+ import { type SyncEnvelope } from "../types.js";
4
+ /**
5
+ * Serializes an action for GraphQL transport, converting signature tuples to strings.
6
+ */
7
+ export declare function serializeAction(action: Action): unknown;
8
+ /**
9
+ * Serializes a SyncEnvelope for GraphQL transport.
10
+ *
11
+ * Signatures are serialized as comma-separated strings since GraphQL schema
12
+ * defines them as [String!]!. Extra context fields (resultingState, ordinal)
13
+ * are stripped since they are not defined in OperationContextInput.
14
+ */
15
+ export declare function serializeEnvelope(envelope: SyncEnvelope): unknown;
3
16
  /**
4
17
  * Converts a SyncEnvelope containing operations into a SyncOperation.
5
18
  *
@@ -27,4 +40,5 @@ export declare function envelopeToSyncOperation(envelope: SyncEnvelope, remoteNa
27
40
  * causality across documents.
28
41
  */
29
42
  export declare function envelopesToSyncOperations(envelope: SyncEnvelope, remoteName: string): SyncOperation[];
43
+ export declare const getLatestAppliedOrdinal: (syncOps: SyncOperation[]) => number;
30
44
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsDhD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,GACjB,aAAa,CA6Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,GACjB,aAAa,EAAE,CAuBjB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAKrE;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAkBvD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAyBjE;AAmDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,GACjB,aAAa,CA6Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,GACjB,aAAa,EAAE,CAuBjB;AAED,eAAO,MAAM,uBAAuB,GAAI,SAAS,aAAa,EAAE,KAAG,MAUlE,CAAC"}