evo360-types 1.3.476 → 1.3.478

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.
@@ -159,11 +159,50 @@ export interface ICampaignSentToday {
159
159
  email?: number;
160
160
  };
161
161
  }
162
+ /**
163
+ * Where ONE channel stands in the dispatch queue (F3.3).
164
+ *
165
+ * The four pacing knobs are configured per channel, so the two channels advance through
166
+ * the audience at different speeds and each needs its own position. Both channels read
167
+ * the SAME queue (`dispatch_state == 'pending'` ordered by `__name__`); what separates
168
+ * them is the `startAfter` each one uses.
169
+ */
170
+ export interface ICampaignDispatchChannelState {
171
+ /**
172
+ * Last recipient id this channel dispatched — the `startAfter` of its own page.
173
+ * A channel held back by its window or its daily limit simply does NOT advance this,
174
+ * which is what records the legs it still owes.
175
+ */
176
+ cursor_doc_id?: string | null;
177
+ /**
178
+ * Earliest instant this channel may dispatch again (its own `batch_interval_minutes`).
179
+ * This is the AUTHORITY on the channel's turn: the scheduled `campaign.dispatch_batch`
180
+ * task is only a wake-up call and grants no permission by itself, so a batch that fires
181
+ * early (the feat-080 sweep reviving a chain, say) re-reads this and defers.
182
+ * Firestore returns a Timestamp — `.toDate()` before comparing.
183
+ */
184
+ next_at?: Date | null;
185
+ }
162
186
  export interface ICampaignDispatchState {
187
+ /**
188
+ * LEGACY (pre-F3.3): the single campaign-wide cursor. It no longer governs sending —
189
+ * `per_channel.{channel}.cursor_doc_id` does. It is still written, as the MINIMUM of
190
+ * the per-channel cursors, for two reasons: a campaign in flight when F3.3 deployed
191
+ * seeds both channels from it, and a rollback to the previous engine must resume
192
+ * BEHIND every channel rather than ahead of one (re-reading is inert — the send task
193
+ * is idempotent on `dedup_key` — whereas skipping loses a send silently).
194
+ * Do not read this to answer "how far has the campaign got": ask per channel.
195
+ */
163
196
  cursor_doc_id?: string | null;
164
197
  next_dispatch_task_id?: string | null;
165
198
  sent_today?: ICampaignSentToday;
166
199
  batches_dispatched?: number;
200
+ /** Per-channel queue position and turn (F3.3). Absent on a campaign that last ran
201
+ * under the pre-F3.3 engine; each channel then falls back to `cursor_doc_id`. */
202
+ per_channel?: {
203
+ whatsapp?: ICampaignDispatchChannelState;
204
+ email?: ICampaignDispatchChannelState;
205
+ };
167
206
  }
168
207
  export type CampaignPrevalidationStatus = "approved" | "warnings" | "blocked";
169
208
  export interface ICampaignPrevalidation {
@@ -231,11 +231,51 @@ export interface ICampaignSentToday {
231
231
  };
232
232
  }
233
233
 
234
+ /**
235
+ * Where ONE channel stands in the dispatch queue (F3.3).
236
+ *
237
+ * The four pacing knobs are configured per channel, so the two channels advance through
238
+ * the audience at different speeds and each needs its own position. Both channels read
239
+ * the SAME queue (`dispatch_state == 'pending'` ordered by `__name__`); what separates
240
+ * them is the `startAfter` each one uses.
241
+ */
242
+ export interface ICampaignDispatchChannelState {
243
+ /**
244
+ * Last recipient id this channel dispatched — the `startAfter` of its own page.
245
+ * A channel held back by its window or its daily limit simply does NOT advance this,
246
+ * which is what records the legs it still owes.
247
+ */
248
+ cursor_doc_id?: string | null;
249
+ /**
250
+ * Earliest instant this channel may dispatch again (its own `batch_interval_minutes`).
251
+ * This is the AUTHORITY on the channel's turn: the scheduled `campaign.dispatch_batch`
252
+ * task is only a wake-up call and grants no permission by itself, so a batch that fires
253
+ * early (the feat-080 sweep reviving a chain, say) re-reads this and defers.
254
+ * Firestore returns a Timestamp — `.toDate()` before comparing.
255
+ */
256
+ next_at?: Date | null;
257
+ }
258
+
234
259
  export interface ICampaignDispatchState {
260
+ /**
261
+ * LEGACY (pre-F3.3): the single campaign-wide cursor. It no longer governs sending —
262
+ * `per_channel.{channel}.cursor_doc_id` does. It is still written, as the MINIMUM of
263
+ * the per-channel cursors, for two reasons: a campaign in flight when F3.3 deployed
264
+ * seeds both channels from it, and a rollback to the previous engine must resume
265
+ * BEHIND every channel rather than ahead of one (re-reading is inert — the send task
266
+ * is idempotent on `dedup_key` — whereas skipping loses a send silently).
267
+ * Do not read this to answer "how far has the campaign got": ask per channel.
268
+ */
235
269
  cursor_doc_id?: string | null;
236
270
  next_dispatch_task_id?: string | null;
237
271
  sent_today?: ICampaignSentToday;
238
272
  batches_dispatched?: number;
273
+ /** Per-channel queue position and turn (F3.3). Absent on a campaign that last ran
274
+ * under the pre-F3.3 engine; each channel then falls back to `cursor_doc_id`. */
275
+ per_channel?: {
276
+ whatsapp?: ICampaignDispatchChannelState;
277
+ email?: ICampaignDispatchChannelState;
278
+ };
239
279
  }
240
280
 
241
281
  export type CampaignPrevalidationStatus = "approved" | "warnings" | "blocked";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.476",
3
+ "version": "1.3.478",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",