@voyantjs/distribution 0.20.0 → 0.21.1

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 (54) hide show
  1. package/dist/channel-push/admin-routes.d.ts +31 -0
  2. package/dist/channel-push/admin-routes.d.ts.map +1 -0
  3. package/dist/channel-push/admin-routes.js +165 -0
  4. package/dist/channel-push/availability-push.d.ts +76 -0
  5. package/dist/channel-push/availability-push.d.ts.map +1 -0
  6. package/dist/channel-push/availability-push.js +238 -0
  7. package/dist/channel-push/booking-push.d.ts +114 -0
  8. package/dist/channel-push/booking-push.d.ts.map +1 -0
  9. package/dist/channel-push/booking-push.js +503 -0
  10. package/dist/channel-push/content-push.d.ts +60 -0
  11. package/dist/channel-push/content-push.d.ts.map +1 -0
  12. package/dist/channel-push/content-push.js +256 -0
  13. package/dist/channel-push/index.d.ts +15 -0
  14. package/dist/channel-push/index.d.ts.map +1 -0
  15. package/dist/channel-push/index.js +18 -0
  16. package/dist/channel-push/plugin.d.ts +18 -0
  17. package/dist/channel-push/plugin.d.ts.map +1 -0
  18. package/dist/channel-push/plugin.js +21 -0
  19. package/dist/channel-push/reconciler.d.ts +85 -0
  20. package/dist/channel-push/reconciler.d.ts.map +1 -0
  21. package/dist/channel-push/reconciler.js +175 -0
  22. package/dist/channel-push/subscriber.d.ts +40 -0
  23. package/dist/channel-push/subscriber.d.ts.map +1 -0
  24. package/dist/channel-push/subscriber.js +174 -0
  25. package/dist/channel-push/types.d.ts +43 -0
  26. package/dist/channel-push/types.d.ts.map +1 -0
  27. package/dist/channel-push/types.js +32 -0
  28. package/dist/channel-push/workflows.d.ts +56 -0
  29. package/dist/channel-push/workflows.d.ts.map +1 -0
  30. package/dist/channel-push/workflows.js +100 -0
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +3 -0
  34. package/dist/rate-limit.d.ts +69 -0
  35. package/dist/rate-limit.d.ts.map +1 -0
  36. package/dist/rate-limit.js +135 -0
  37. package/dist/routes.d.ts +170 -10
  38. package/dist/routes.d.ts.map +1 -1
  39. package/dist/schema-core.d.ts +417 -1
  40. package/dist/schema-core.d.ts.map +1 -1
  41. package/dist/schema-core.js +98 -1
  42. package/dist/schema-push-intents.d.ts +387 -0
  43. package/dist/schema-push-intents.d.ts.map +1 -0
  44. package/dist/schema-push-intents.js +77 -0
  45. package/dist/schema.d.ts +1 -0
  46. package/dist/schema.d.ts.map +1 -1
  47. package/dist/schema.js +1 -0
  48. package/dist/service.d.ts +103 -7
  49. package/dist/service.d.ts.map +1 -1
  50. package/dist/validation.d.ts +5 -5
  51. package/dist/webhook-deliveries.d.ts +86 -0
  52. package/dist/webhook-deliveries.d.ts.map +1 -0
  53. package/dist/webhook-deliveries.js +293 -0
  54. package/package.json +16 -8
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Per-channel rate limiting (token bucket on Postgres).
3
+ *
4
+ * `acquireToken` is the canonical channel-push wrapper around the
5
+ * generic `infra.rate_limit_buckets` primitive. Each call:
6
+ *
7
+ * 1. Atomically refills the bucket based on `(now - last_refill_at) *
8
+ * refill_rate`, capped at capacity.
9
+ * 2. Checks the priority gate: tokens_available >= gate * capacity
10
+ * AND tokens_available >= 1.
11
+ * 3. On success, decrements by 1 and returns `{ acquired: true }`.
12
+ * 4. On denial, returns `{ acquired: false, retryAfterMs }` computed
13
+ * from how long until enough tokens refill to clear the gate.
14
+ *
15
+ * Whole thing is one round-trip (an UPSERT with conditional UPDATE).
16
+ *
17
+ * Per docs/architecture/channel-push-architecture.md §14.2 and §14.3.
18
+ */
19
+ import { infraRateLimitBucketsTable } from "@voyantjs/db/schema/infra";
20
+ import { eq } from "drizzle-orm";
21
+ export const DEFAULT_PRIORITY_GATES = {
22
+ booking: 0,
23
+ availability: 0.3,
24
+ content: 0.7,
25
+ };
26
+ /**
27
+ * Build the channel-push scope key from a (channel, connection) pair.
28
+ * Same shape used by the workflow + reconciler so all paths address the
29
+ * same bucket.
30
+ */
31
+ export function channelScopeKey(channelId, connectionId) {
32
+ return `channel:${channelId}:${connectionId}`;
33
+ }
34
+ /**
35
+ * Acquire one token from the bucket at `scope`, applying the priority
36
+ * gate for `priority`. Creates the bucket on first call (UPSERT with
37
+ * full capacity).
38
+ */
39
+ export async function acquireToken(db, scope, config, priority) {
40
+ const gate = config.priorityGates?.[priority] ?? DEFAULT_PRIORITY_GATES[priority];
41
+ const gateThreshold = Math.max(0, gate) * config.burst;
42
+ const now = new Date();
43
+ // Read or create the bucket. We use an UPSERT to keep the operation
44
+ // single-call.
45
+ const existing = await db
46
+ .select()
47
+ .from(infraRateLimitBucketsTable)
48
+ .where(eq(infraRateLimitBucketsTable.scope, scope))
49
+ .limit(1);
50
+ let bucket = existing[0];
51
+ if (!bucket) {
52
+ const created = await db
53
+ .insert(infraRateLimitBucketsTable)
54
+ .values({
55
+ scope,
56
+ tokensAvailable: String(config.burst),
57
+ capacity: String(config.burst),
58
+ refillRatePerSec: String(config.rps),
59
+ lastRefillAt: now,
60
+ })
61
+ .onConflictDoNothing()
62
+ .returning();
63
+ if (created[0]) {
64
+ bucket = created[0];
65
+ }
66
+ else {
67
+ // Lost the race — re-read.
68
+ const reread = await db
69
+ .select()
70
+ .from(infraRateLimitBucketsTable)
71
+ .where(eq(infraRateLimitBucketsTable.scope, scope))
72
+ .limit(1);
73
+ bucket = reread[0];
74
+ }
75
+ if (!bucket) {
76
+ throw new Error(`acquireToken: failed to create bucket for scope "${scope}"`);
77
+ }
78
+ }
79
+ // Refill based on elapsed time, then check the gate.
80
+ const tokensBefore = Number.parseFloat(bucket.tokensAvailable);
81
+ const capacity = Number.parseFloat(bucket.capacity);
82
+ const refillRate = Number.parseFloat(bucket.refillRatePerSec);
83
+ const elapsedMs = now.getTime() - new Date(bucket.lastRefillAt).getTime();
84
+ const refilled = Math.min(capacity, tokensBefore + (elapsedMs / 1000) * refillRate);
85
+ if (refilled < 1 || refilled < gateThreshold) {
86
+ // Not enough tokens. Compute the wait until we cross the higher of
87
+ // (1, gateThreshold).
88
+ const target = Math.max(1, gateThreshold);
89
+ const deficit = target - refilled;
90
+ const retryAfterMs = refillRate > 0 ? Math.ceil((deficit / refillRate) * 1000) : 60_000;
91
+ // Persist the refill so concurrent acquirers see the same baseline.
92
+ await db
93
+ .update(infraRateLimitBucketsTable)
94
+ .set({
95
+ tokensAvailable: String(refilled),
96
+ lastRefillAt: now,
97
+ updatedAt: now,
98
+ })
99
+ .where(eq(infraRateLimitBucketsTable.scope, scope));
100
+ return {
101
+ acquired: false,
102
+ retryAfterMs: Math.max(retryAfterMs, 0),
103
+ tokensAvailable: refilled,
104
+ };
105
+ }
106
+ const after = refilled - 1;
107
+ await db
108
+ .update(infraRateLimitBucketsTable)
109
+ .set({
110
+ tokensAvailable: String(after),
111
+ lastRefillAt: now,
112
+ updatedAt: now,
113
+ })
114
+ .where(eq(infraRateLimitBucketsTable.scope, scope));
115
+ return { acquired: true, tokensRemaining: after };
116
+ }
117
+ /**
118
+ * Drain the bucket to zero and freeze it for `cooldownMs`.
119
+ *
120
+ * Called when an upstream returns 429 with a `Retry-After` hint —
121
+ * prevents subsequent dispatchers from immediately retrying through
122
+ * the same bucket and lets our outbound estimate converge with the
123
+ * channel's authoritative state. Per §14.4.
124
+ */
125
+ export async function drainBucket(db, scope, cooldownMs) {
126
+ const lastRefillAt = new Date(Date.now() + cooldownMs);
127
+ await db
128
+ .update(infraRateLimitBucketsTable)
129
+ .set({
130
+ tokensAvailable: "0",
131
+ lastRefillAt,
132
+ updatedAt: new Date(),
133
+ })
134
+ .where(eq(infraRateLimitBucketsTable.scope, scope));
135
+ }
package/dist/routes.d.ts CHANGED
@@ -19,6 +19,11 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
19
19
  metadata: {
20
20
  [x: string]: import("hono/utils/types").JSONValue;
21
21
  } | null;
22
+ rateLimitRps: number | null;
23
+ rateLimitBurst: number | null;
24
+ rateLimitPriorityGates: {
25
+ [x: string]: number;
26
+ } | null;
22
27
  createdAt: string;
23
28
  updatedAt: string;
24
29
  website: string | null;
@@ -47,6 +52,11 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
47
52
  metadata: {
48
53
  [x: string]: import("hono/utils/types").JSONValue;
49
54
  } | null;
55
+ rateLimitRps: number | null;
56
+ rateLimitBurst: number | null;
57
+ rateLimitPriorityGates: {
58
+ [x: string]: number;
59
+ } | null;
50
60
  createdAt: string;
51
61
  updatedAt: string;
52
62
  website: string | null;
@@ -72,6 +82,11 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
72
82
  metadata: {
73
83
  [x: string]: import("hono/utils/types").JSONValue;
74
84
  } | null;
85
+ rateLimitRps: number | null;
86
+ rateLimitBurst: number | null;
87
+ rateLimitPriorityGates: {
88
+ [x: string]: number;
89
+ } | null;
75
90
  createdAt: string;
76
91
  updatedAt: string;
77
92
  website: string | null;
@@ -135,6 +150,11 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
135
150
  metadata: {
136
151
  [x: string]: import("hono/utils/types").JSONValue;
137
152
  } | null;
153
+ rateLimitRps: number | null;
154
+ rateLimitBurst: number | null;
155
+ rateLimitPriorityGates: {
156
+ [x: string]: number;
157
+ } | null;
138
158
  createdAt: string;
139
159
  updatedAt: string;
140
160
  website: string | null;
@@ -175,6 +195,11 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
175
195
  metadata: {
176
196
  [x: string]: import("hono/utils/types").JSONValue;
177
197
  } | null;
198
+ rateLimitRps: number | null;
199
+ rateLimitBurst: number | null;
200
+ rateLimitPriorityGates: {
201
+ [x: string]: number;
202
+ } | null;
178
203
  createdAt: string;
179
204
  updatedAt: string;
180
205
  website: string | null;
@@ -529,6 +554,14 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
529
554
  cancellationOwner: "operator" | "channel" | "mixed";
530
555
  settlementTerms: string | null;
531
556
  notes: string | null;
557
+ rateLimitRps: number | null;
558
+ rateLimitBurst: number | null;
559
+ rateLimitPriorityGates: {
560
+ [x: string]: number;
561
+ } | null;
562
+ policy: {
563
+ [x: string]: import("hono/utils/types").JSONValue;
564
+ } | null;
532
565
  createdAt: string;
533
566
  updatedAt: string;
534
567
  }[];
@@ -553,6 +586,14 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
553
586
  notes: string | null;
554
587
  paymentOwner: "split" | "operator" | "channel";
555
588
  supplierId: string | null;
589
+ policy: {
590
+ [x: string]: import("hono/utils/types").JSONValue;
591
+ } | null;
592
+ rateLimitRps: number | null;
593
+ rateLimitBurst: number | null;
594
+ rateLimitPriorityGates: {
595
+ [x: string]: number;
596
+ } | null;
556
597
  channelId: string;
557
598
  startsAt: string;
558
599
  endsAt: string | null;
@@ -580,6 +621,14 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
580
621
  cancellationOwner: "operator" | "channel" | "mixed";
581
622
  settlementTerms: string | null;
582
623
  notes: string | null;
624
+ rateLimitRps: number | null;
625
+ rateLimitBurst: number | null;
626
+ rateLimitPriorityGates: {
627
+ [x: string]: number;
628
+ } | null;
629
+ policy: {
630
+ [x: string]: import("hono/utils/types").JSONValue;
631
+ } | null;
583
632
  createdAt: string;
584
633
  updatedAt: string;
585
634
  }[];
@@ -642,6 +691,14 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
642
691
  cancellationOwner: "operator" | "channel" | "mixed";
643
692
  settlementTerms: string | null;
644
693
  notes: string | null;
694
+ rateLimitRps: number | null;
695
+ rateLimitBurst: number | null;
696
+ rateLimitPriorityGates: {
697
+ [x: string]: number;
698
+ } | null;
699
+ policy: {
700
+ [x: string]: import("hono/utils/types").JSONValue;
701
+ } | null;
645
702
  createdAt: string;
646
703
  updatedAt: string;
647
704
  };
@@ -681,6 +738,14 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
681
738
  cancellationOwner: "operator" | "channel" | "mixed";
682
739
  settlementTerms: string | null;
683
740
  notes: string | null;
741
+ rateLimitRps: number | null;
742
+ rateLimitBurst: number | null;
743
+ rateLimitPriorityGates: {
744
+ [x: string]: number;
745
+ } | null;
746
+ policy: {
747
+ [x: string]: import("hono/utils/types").JSONValue;
748
+ } | null;
684
749
  createdAt: string;
685
750
  updatedAt: string;
686
751
  };
@@ -935,6 +1000,16 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
935
1000
  externalRateId: string | null;
936
1001
  externalCategoryId: string | null;
937
1002
  active: boolean;
1003
+ sourceKind: string | null;
1004
+ sourceConnectionId: string | null;
1005
+ pushBookings: boolean;
1006
+ pushAvailability: boolean;
1007
+ pushContent: boolean;
1008
+ policy: {
1009
+ [x: string]: import("hono/utils/types").JSONValue;
1010
+ } | null;
1011
+ lastPushedContentHash: string | null;
1012
+ lastPushedContentAt: string | null;
938
1013
  createdAt: string;
939
1014
  updatedAt: string;
940
1015
  }[];
@@ -957,10 +1032,20 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
957
1032
  updatedAt: string;
958
1033
  active: boolean;
959
1034
  productId: string;
1035
+ policy: {
1036
+ [x: string]: import("hono/utils/types").JSONValue;
1037
+ } | null;
960
1038
  channelId: string;
961
1039
  externalRateId: string | null;
962
1040
  externalCategoryId: string | null;
963
1041
  externalProductId: string | null;
1042
+ sourceKind: string | null;
1043
+ sourceConnectionId: string | null;
1044
+ pushBookings: boolean;
1045
+ pushAvailability: boolean;
1046
+ pushContent: boolean;
1047
+ lastPushedContentHash: string | null;
1048
+ lastPushedContentAt: string | null;
964
1049
  } | undefined;
965
1050
  };
966
1051
  outputFormat: "json";
@@ -980,6 +1065,16 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
980
1065
  externalRateId: string | null;
981
1066
  externalCategoryId: string | null;
982
1067
  active: boolean;
1068
+ sourceKind: string | null;
1069
+ sourceConnectionId: string | null;
1070
+ pushBookings: boolean;
1071
+ pushAvailability: boolean;
1072
+ pushContent: boolean;
1073
+ policy: {
1074
+ [x: string]: import("hono/utils/types").JSONValue;
1075
+ } | null;
1076
+ lastPushedContentHash: string | null;
1077
+ lastPushedContentAt: string | null;
983
1078
  createdAt: string;
984
1079
  updatedAt: string;
985
1080
  }[];
@@ -1039,6 +1134,16 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1039
1134
  externalRateId: string | null;
1040
1135
  externalCategoryId: string | null;
1041
1136
  active: boolean;
1137
+ sourceKind: string | null;
1138
+ sourceConnectionId: string | null;
1139
+ pushBookings: boolean;
1140
+ pushAvailability: boolean;
1141
+ pushContent: boolean;
1142
+ policy: {
1143
+ [x: string]: import("hono/utils/types").JSONValue;
1144
+ } | null;
1145
+ lastPushedContentHash: string | null;
1146
+ lastPushedContentAt: string | null;
1042
1147
  createdAt: string;
1043
1148
  updatedAt: string;
1044
1149
  };
@@ -1075,6 +1180,16 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1075
1180
  externalRateId: string | null;
1076
1181
  externalCategoryId: string | null;
1077
1182
  active: boolean;
1183
+ sourceKind: string | null;
1184
+ sourceConnectionId: string | null;
1185
+ pushBookings: boolean;
1186
+ pushAvailability: boolean;
1187
+ pushContent: boolean;
1188
+ policy: {
1189
+ [x: string]: import("hono/utils/types").JSONValue;
1190
+ } | null;
1191
+ lastPushedContentHash: string | null;
1192
+ lastPushedContentAt: string | null;
1078
1193
  createdAt: string;
1079
1194
  updatedAt: string;
1080
1195
  };
@@ -1118,11 +1233,20 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1118
1233
  id: string;
1119
1234
  channelId: string;
1120
1235
  bookingId: string;
1236
+ bookingItemId: string | null;
1121
1237
  externalBookingId: string | null;
1122
1238
  externalReference: string | null;
1123
1239
  externalStatus: string | null;
1124
1240
  bookedAtExternal: string | null;
1125
1241
  lastSyncedAt: string | null;
1242
+ sourceKind: string | null;
1243
+ sourceConnectionId: string | null;
1244
+ pushStatus: string;
1245
+ pushAttempts: number;
1246
+ lastPushAt: string | null;
1247
+ lastError: string | null;
1248
+ pushedPayloadHash: string | null;
1249
+ idempotencyKey: string | null;
1126
1250
  createdAt: string;
1127
1251
  updatedAt: string;
1128
1252
  }[];
@@ -1143,13 +1267,22 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1143
1267
  id: string;
1144
1268
  createdAt: string;
1145
1269
  updatedAt: string;
1270
+ idempotencyKey: string | null;
1146
1271
  bookingId: string;
1272
+ bookingItemId: string | null;
1147
1273
  channelId: string;
1274
+ sourceKind: string | null;
1275
+ sourceConnectionId: string | null;
1148
1276
  externalBookingId: string | null;
1149
1277
  externalReference: string | null;
1150
1278
  externalStatus: string | null;
1151
1279
  bookedAtExternal: string | null;
1152
1280
  lastSyncedAt: string | null;
1281
+ pushStatus: string;
1282
+ pushAttempts: number;
1283
+ lastPushAt: string | null;
1284
+ lastError: string | null;
1285
+ pushedPayloadHash: string | null;
1153
1286
  } | undefined;
1154
1287
  };
1155
1288
  outputFormat: "json";
@@ -1165,11 +1298,20 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1165
1298
  id: string;
1166
1299
  channelId: string;
1167
1300
  bookingId: string;
1301
+ bookingItemId: string | null;
1168
1302
  externalBookingId: string | null;
1169
1303
  externalReference: string | null;
1170
1304
  externalStatus: string | null;
1171
1305
  bookedAtExternal: string | null;
1172
1306
  lastSyncedAt: string | null;
1307
+ sourceKind: string | null;
1308
+ sourceConnectionId: string | null;
1309
+ pushStatus: string;
1310
+ pushAttempts: number;
1311
+ lastPushAt: string | null;
1312
+ lastError: string | null;
1313
+ pushedPayloadHash: string | null;
1314
+ idempotencyKey: string | null;
1173
1315
  createdAt: string;
1174
1316
  updatedAt: string;
1175
1317
  }[];
@@ -1225,11 +1367,20 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1225
1367
  id: string;
1226
1368
  channelId: string;
1227
1369
  bookingId: string;
1370
+ bookingItemId: string | null;
1228
1371
  externalBookingId: string | null;
1229
1372
  externalReference: string | null;
1230
1373
  externalStatus: string | null;
1231
1374
  bookedAtExternal: string | null;
1232
1375
  lastSyncedAt: string | null;
1376
+ sourceKind: string | null;
1377
+ sourceConnectionId: string | null;
1378
+ pushStatus: string;
1379
+ pushAttempts: number;
1380
+ lastPushAt: string | null;
1381
+ lastError: string | null;
1382
+ pushedPayloadHash: string | null;
1383
+ idempotencyKey: string | null;
1233
1384
  createdAt: string;
1234
1385
  updatedAt: string;
1235
1386
  };
@@ -1262,11 +1413,20 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1262
1413
  id: string;
1263
1414
  channelId: string;
1264
1415
  bookingId: string;
1416
+ bookingItemId: string | null;
1265
1417
  externalBookingId: string | null;
1266
1418
  externalReference: string | null;
1267
1419
  externalStatus: string | null;
1268
1420
  bookedAtExternal: string | null;
1269
1421
  lastSyncedAt: string | null;
1422
+ sourceKind: string | null;
1423
+ sourceConnectionId: string | null;
1424
+ pushStatus: string;
1425
+ pushAttempts: number;
1426
+ lastPushAt: string | null;
1427
+ lastError: string | null;
1428
+ pushedPayloadHash: string | null;
1429
+ idempotencyKey: string | null;
1270
1430
  createdAt: string;
1271
1431
  updatedAt: string;
1272
1432
  };
@@ -1316,7 +1476,7 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1316
1476
  };
1317
1477
  receivedAt: string;
1318
1478
  processedAt: string | null;
1319
- status: "pending" | "processed" | "failed" | "ignored";
1479
+ status: "pending" | "failed" | "processed" | "ignored";
1320
1480
  errorMessage: string | null;
1321
1481
  createdAt: string;
1322
1482
  }[];
@@ -1336,16 +1496,16 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1336
1496
  data: {
1337
1497
  id: string;
1338
1498
  createdAt: string;
1339
- status: "pending" | "processed" | "failed" | "ignored";
1340
- channelId: string;
1341
- eventType: string;
1342
- externalEventId: string | null;
1499
+ status: "pending" | "failed" | "processed" | "ignored";
1500
+ errorMessage: string | null;
1343
1501
  payload: {
1344
1502
  [x: string]: import("hono/utils/types").JSONValue;
1345
1503
  };
1504
+ channelId: string;
1505
+ eventType: string;
1506
+ externalEventId: string | null;
1346
1507
  receivedAt: string;
1347
1508
  processedAt: string | null;
1348
- errorMessage: string | null;
1349
1509
  } | undefined;
1350
1510
  };
1351
1511
  outputFormat: "json";
@@ -1367,7 +1527,7 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1367
1527
  };
1368
1528
  receivedAt: string;
1369
1529
  processedAt: string | null;
1370
- status: "pending" | "processed" | "failed" | "ignored";
1530
+ status: "pending" | "failed" | "processed" | "ignored";
1371
1531
  errorMessage: string | null;
1372
1532
  createdAt: string;
1373
1533
  }[];
@@ -1429,7 +1589,7 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1429
1589
  };
1430
1590
  receivedAt: string;
1431
1591
  processedAt: string | null;
1432
- status: "pending" | "processed" | "failed" | "ignored";
1592
+ status: "pending" | "failed" | "processed" | "ignored";
1433
1593
  errorMessage: string | null;
1434
1594
  createdAt: string;
1435
1595
  };
@@ -1468,7 +1628,7 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
1468
1628
  };
1469
1629
  receivedAt: string;
1470
1630
  processedAt: string | null;
1471
- status: "pending" | "processed" | "failed" | "ignored";
1631
+ status: "pending" | "failed" | "processed" | "ignored";
1472
1632
  errorMessage: string | null;
1473
1633
  createdAt: string;
1474
1634
  };
@@ -2490,12 +2650,12 @@ export declare const distributionRoutes: import("hono/hono-base").HonoBase<Env,
2490
2650
  updatedAt: string;
2491
2651
  status: "draft" | "archived" | "running" | "completed";
2492
2652
  notes: string | null;
2653
+ startedAt: string | null;
2493
2654
  channelId: string;
2494
2655
  contractId: string | null;
2495
2656
  periodStart: string | null;
2496
2657
  periodEnd: string | null;
2497
2658
  externalReportReference: string | null;
2498
- startedAt: string | null;
2499
2659
  completedAt: string | null;
2500
2660
  } | undefined;
2501
2661
  };
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../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