@voyantjs/distribution 0.19.0 → 0.21.0

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
@@ -106,6 +106,59 @@ export declare const channels: import("drizzle-orm/pg-core").PgTableWithColumns<
106
106
  }, {}, {
107
107
  $type: Record<string, unknown>;
108
108
  }>;
109
+ rateLimitRps: import("drizzle-orm/pg-core").PgColumn<{
110
+ name: "rate_limit_rps";
111
+ tableName: "channels";
112
+ dataType: "number";
113
+ columnType: "PgInteger";
114
+ data: number;
115
+ driverParam: string | number;
116
+ notNull: false;
117
+ hasDefault: false;
118
+ isPrimaryKey: false;
119
+ isAutoincrement: false;
120
+ hasRuntimeDefault: false;
121
+ enumValues: undefined;
122
+ baseColumn: never;
123
+ identity: undefined;
124
+ generated: undefined;
125
+ }, {}, {}>;
126
+ rateLimitBurst: import("drizzle-orm/pg-core").PgColumn<{
127
+ name: "rate_limit_burst";
128
+ tableName: "channels";
129
+ dataType: "number";
130
+ columnType: "PgInteger";
131
+ data: number;
132
+ driverParam: string | number;
133
+ notNull: false;
134
+ hasDefault: false;
135
+ isPrimaryKey: false;
136
+ isAutoincrement: false;
137
+ hasRuntimeDefault: false;
138
+ enumValues: undefined;
139
+ baseColumn: never;
140
+ identity: undefined;
141
+ generated: undefined;
142
+ }, {}, {}>;
143
+ rateLimitPriorityGates: import("drizzle-orm/pg-core").PgColumn<{
144
+ name: "rate_limit_priority_gates";
145
+ tableName: "channels";
146
+ dataType: "json";
147
+ columnType: "PgJsonb";
148
+ data: Record<string, number>;
149
+ driverParam: unknown;
150
+ notNull: false;
151
+ hasDefault: false;
152
+ isPrimaryKey: false;
153
+ isAutoincrement: false;
154
+ hasRuntimeDefault: false;
155
+ enumValues: undefined;
156
+ baseColumn: never;
157
+ identity: undefined;
158
+ generated: undefined;
159
+ }, {}, {
160
+ $type: Record<string, number>;
161
+ }>;
109
162
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
110
163
  name: "created_at";
111
164
  tableName: "channels";
@@ -460,6 +513,78 @@ export declare const channelContracts: import("drizzle-orm/pg-core").PgTableWith
460
513
  identity: undefined;
461
514
  generated: undefined;
462
515
  }, {}, {}>;
516
+ rateLimitRps: import("drizzle-orm/pg-core").PgColumn<{
517
+ name: "rate_limit_rps";
518
+ tableName: "channel_contracts";
519
+ dataType: "number";
520
+ columnType: "PgInteger";
521
+ data: number;
522
+ driverParam: string | number;
523
+ notNull: false;
524
+ hasDefault: false;
525
+ isPrimaryKey: false;
526
+ isAutoincrement: false;
527
+ hasRuntimeDefault: false;
528
+ enumValues: undefined;
529
+ baseColumn: never;
530
+ identity: undefined;
531
+ generated: undefined;
532
+ }, {}, {}>;
533
+ rateLimitBurst: import("drizzle-orm/pg-core").PgColumn<{
534
+ name: "rate_limit_burst";
535
+ tableName: "channel_contracts";
536
+ dataType: "number";
537
+ columnType: "PgInteger";
538
+ data: number;
539
+ driverParam: string | number;
540
+ notNull: false;
541
+ hasDefault: false;
542
+ isPrimaryKey: false;
543
+ isAutoincrement: false;
544
+ hasRuntimeDefault: false;
545
+ enumValues: undefined;
546
+ baseColumn: never;
547
+ identity: undefined;
548
+ generated: undefined;
549
+ }, {}, {}>;
550
+ rateLimitPriorityGates: import("drizzle-orm/pg-core").PgColumn<{
551
+ name: "rate_limit_priority_gates";
552
+ tableName: "channel_contracts";
553
+ dataType: "json";
554
+ columnType: "PgJsonb";
555
+ data: Record<string, number>;
556
+ driverParam: unknown;
557
+ notNull: false;
558
+ hasDefault: false;
559
+ isPrimaryKey: false;
560
+ isAutoincrement: false;
561
+ hasRuntimeDefault: false;
562
+ enumValues: undefined;
563
+ baseColumn: never;
564
+ identity: undefined;
565
+ generated: undefined;
566
+ }, {}, {
567
+ $type: Record<string, number>;
568
+ }>;
569
+ policy: import("drizzle-orm/pg-core").PgColumn<{
570
+ name: "policy";
571
+ tableName: "channel_contracts";
572
+ dataType: "json";
573
+ columnType: "PgJsonb";
574
+ data: Record<string, unknown>;
575
+ driverParam: unknown;
576
+ notNull: false;
577
+ hasDefault: false;
578
+ isPrimaryKey: false;
579
+ isAutoincrement: false;
580
+ hasRuntimeDefault: false;
581
+ enumValues: undefined;
582
+ baseColumn: never;
583
+ identity: undefined;
584
+ generated: undefined;
585
+ }, {}, {
586
+ $type: Record<string, unknown>;
587
+ }>;
463
588
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
464
589
  name: "created_at";
465
590
  tableName: "channel_contracts";
@@ -848,6 +973,144 @@ export declare const channelProductMappings: import("drizzle-orm/pg-core").PgTab
848
973
  identity: undefined;
849
974
  generated: undefined;
850
975
  }, {}, {}>;
976
+ sourceKind: import("drizzle-orm/pg-core").PgColumn<{
977
+ name: "source_kind";
978
+ tableName: "channel_product_mappings";
979
+ dataType: "string";
980
+ columnType: "PgText";
981
+ data: string;
982
+ driverParam: string;
983
+ notNull: false;
984
+ hasDefault: false;
985
+ isPrimaryKey: false;
986
+ isAutoincrement: false;
987
+ hasRuntimeDefault: false;
988
+ enumValues: [string, ...string[]];
989
+ baseColumn: never;
990
+ identity: undefined;
991
+ generated: undefined;
992
+ }, {}, {}>;
993
+ sourceConnectionId: import("drizzle-orm/pg-core").PgColumn<{
994
+ name: "source_connection_id";
995
+ tableName: "channel_product_mappings";
996
+ dataType: "string";
997
+ columnType: "PgText";
998
+ data: string;
999
+ driverParam: string;
1000
+ notNull: false;
1001
+ hasDefault: false;
1002
+ isPrimaryKey: false;
1003
+ isAutoincrement: false;
1004
+ hasRuntimeDefault: false;
1005
+ enumValues: [string, ...string[]];
1006
+ baseColumn: never;
1007
+ identity: undefined;
1008
+ generated: undefined;
1009
+ }, {}, {}>;
1010
+ pushBookings: import("drizzle-orm/pg-core").PgColumn<{
1011
+ name: "push_bookings";
1012
+ tableName: "channel_product_mappings";
1013
+ dataType: "boolean";
1014
+ columnType: "PgBoolean";
1015
+ data: boolean;
1016
+ driverParam: boolean;
1017
+ notNull: true;
1018
+ hasDefault: true;
1019
+ isPrimaryKey: false;
1020
+ isAutoincrement: false;
1021
+ hasRuntimeDefault: false;
1022
+ enumValues: undefined;
1023
+ baseColumn: never;
1024
+ identity: undefined;
1025
+ generated: undefined;
1026
+ }, {}, {}>;
1027
+ pushAvailability: import("drizzle-orm/pg-core").PgColumn<{
1028
+ name: "push_availability";
1029
+ tableName: "channel_product_mappings";
1030
+ dataType: "boolean";
1031
+ columnType: "PgBoolean";
1032
+ data: boolean;
1033
+ driverParam: boolean;
1034
+ notNull: true;
1035
+ hasDefault: true;
1036
+ isPrimaryKey: false;
1037
+ isAutoincrement: false;
1038
+ hasRuntimeDefault: false;
1039
+ enumValues: undefined;
1040
+ baseColumn: never;
1041
+ identity: undefined;
1042
+ generated: undefined;
1043
+ }, {}, {}>;
1044
+ pushContent: import("drizzle-orm/pg-core").PgColumn<{
1045
+ name: "push_content";
1046
+ tableName: "channel_product_mappings";
1047
+ dataType: "boolean";
1048
+ columnType: "PgBoolean";
1049
+ data: boolean;
1050
+ driverParam: boolean;
1051
+ notNull: true;
1052
+ hasDefault: true;
1053
+ isPrimaryKey: false;
1054
+ isAutoincrement: false;
1055
+ hasRuntimeDefault: false;
1056
+ enumValues: undefined;
1057
+ baseColumn: never;
1058
+ identity: undefined;
1059
+ generated: undefined;
1060
+ }, {}, {}>;
1061
+ policy: import("drizzle-orm/pg-core").PgColumn<{
1062
+ name: "policy";
1063
+ tableName: "channel_product_mappings";
1064
+ dataType: "json";
1065
+ columnType: "PgJsonb";
1066
+ data: Record<string, unknown>;
1067
+ driverParam: unknown;
1068
+ notNull: false;
1069
+ hasDefault: false;
1070
+ isPrimaryKey: false;
1071
+ isAutoincrement: false;
1072
+ hasRuntimeDefault: false;
1073
+ enumValues: undefined;
1074
+ baseColumn: never;
1075
+ identity: undefined;
1076
+ generated: undefined;
1077
+ }, {}, {
1078
+ $type: Record<string, unknown>;
1079
+ }>;
1080
+ lastPushedContentHash: import("drizzle-orm/pg-core").PgColumn<{
1081
+ name: "last_pushed_content_hash";
1082
+ tableName: "channel_product_mappings";
1083
+ dataType: "string";
1084
+ columnType: "PgText";
1085
+ data: string;
1086
+ driverParam: string;
1087
+ notNull: false;
1088
+ hasDefault: false;
1089
+ isPrimaryKey: false;
1090
+ isAutoincrement: false;
1091
+ hasRuntimeDefault: false;
1092
+ enumValues: [string, ...string[]];
1093
+ baseColumn: never;
1094
+ identity: undefined;
1095
+ generated: undefined;
1096
+ }, {}, {}>;
1097
+ lastPushedContentAt: import("drizzle-orm/pg-core").PgColumn<{
1098
+ name: "last_pushed_content_at";
1099
+ tableName: "channel_product_mappings";
1100
+ dataType: "date";
1101
+ columnType: "PgTimestamp";
1102
+ data: Date;
1103
+ driverParam: string;
1104
+ notNull: false;
1105
+ hasDefault: false;
1106
+ isPrimaryKey: false;
1107
+ isAutoincrement: false;
1108
+ hasRuntimeDefault: false;
1109
+ enumValues: undefined;
1110
+ baseColumn: never;
1111
+ identity: undefined;
1112
+ generated: undefined;
1113
+ }, {}, {}>;
851
1114
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
852
1115
  name: "created_at";
853
1116
  tableName: "channel_product_mappings";
@@ -940,6 +1203,23 @@ export declare const channelBookingLinks: import("drizzle-orm/pg-core").PgTableW
940
1203
  identity: undefined;
941
1204
  generated: undefined;
942
1205
  }, {}, {}>;
1206
+ bookingItemId: import("drizzle-orm/pg-core").PgColumn<{
1207
+ name: "booking_item_id";
1208
+ tableName: "channel_booking_links";
1209
+ dataType: "string";
1210
+ columnType: "PgText";
1211
+ data: string;
1212
+ driverParam: string;
1213
+ notNull: false;
1214
+ hasDefault: false;
1215
+ isPrimaryKey: false;
1216
+ isAutoincrement: false;
1217
+ hasRuntimeDefault: false;
1218
+ enumValues: [string, ...string[]];
1219
+ baseColumn: never;
1220
+ identity: undefined;
1221
+ generated: undefined;
1222
+ }, {}, {}>;
943
1223
  externalBookingId: import("drizzle-orm/pg-core").PgColumn<{
944
1224
  name: "external_booking_id";
945
1225
  tableName: "channel_booking_links";
@@ -1025,6 +1305,142 @@ export declare const channelBookingLinks: import("drizzle-orm/pg-core").PgTableW
1025
1305
  identity: undefined;
1026
1306
  generated: undefined;
1027
1307
  }, {}, {}>;
1308
+ sourceKind: import("drizzle-orm/pg-core").PgColumn<{
1309
+ name: "source_kind";
1310
+ tableName: "channel_booking_links";
1311
+ dataType: "string";
1312
+ columnType: "PgText";
1313
+ data: string;
1314
+ driverParam: string;
1315
+ notNull: false;
1316
+ hasDefault: false;
1317
+ isPrimaryKey: false;
1318
+ isAutoincrement: false;
1319
+ hasRuntimeDefault: false;
1320
+ enumValues: [string, ...string[]];
1321
+ baseColumn: never;
1322
+ identity: undefined;
1323
+ generated: undefined;
1324
+ }, {}, {}>;
1325
+ sourceConnectionId: import("drizzle-orm/pg-core").PgColumn<{
1326
+ name: "source_connection_id";
1327
+ tableName: "channel_booking_links";
1328
+ dataType: "string";
1329
+ columnType: "PgText";
1330
+ data: string;
1331
+ driverParam: string;
1332
+ notNull: false;
1333
+ hasDefault: false;
1334
+ isPrimaryKey: false;
1335
+ isAutoincrement: false;
1336
+ hasRuntimeDefault: false;
1337
+ enumValues: [string, ...string[]];
1338
+ baseColumn: never;
1339
+ identity: undefined;
1340
+ generated: undefined;
1341
+ }, {}, {}>;
1342
+ pushStatus: import("drizzle-orm/pg-core").PgColumn<{
1343
+ name: "push_status";
1344
+ tableName: "channel_booking_links";
1345
+ dataType: "string";
1346
+ columnType: "PgText";
1347
+ data: string;
1348
+ driverParam: string;
1349
+ notNull: true;
1350
+ hasDefault: true;
1351
+ isPrimaryKey: false;
1352
+ isAutoincrement: false;
1353
+ hasRuntimeDefault: false;
1354
+ enumValues: [string, ...string[]];
1355
+ baseColumn: never;
1356
+ identity: undefined;
1357
+ generated: undefined;
1358
+ }, {}, {}>;
1359
+ pushAttempts: import("drizzle-orm/pg-core").PgColumn<{
1360
+ name: "push_attempts";
1361
+ tableName: "channel_booking_links";
1362
+ dataType: "number";
1363
+ columnType: "PgInteger";
1364
+ data: number;
1365
+ driverParam: string | number;
1366
+ notNull: true;
1367
+ hasDefault: true;
1368
+ isPrimaryKey: false;
1369
+ isAutoincrement: false;
1370
+ hasRuntimeDefault: false;
1371
+ enumValues: undefined;
1372
+ baseColumn: never;
1373
+ identity: undefined;
1374
+ generated: undefined;
1375
+ }, {}, {}>;
1376
+ lastPushAt: import("drizzle-orm/pg-core").PgColumn<{
1377
+ name: "last_push_at";
1378
+ tableName: "channel_booking_links";
1379
+ dataType: "date";
1380
+ columnType: "PgTimestamp";
1381
+ data: Date;
1382
+ driverParam: string;
1383
+ notNull: false;
1384
+ hasDefault: false;
1385
+ isPrimaryKey: false;
1386
+ isAutoincrement: false;
1387
+ hasRuntimeDefault: false;
1388
+ enumValues: undefined;
1389
+ baseColumn: never;
1390
+ identity: undefined;
1391
+ generated: undefined;
1392
+ }, {}, {}>;
1393
+ lastError: import("drizzle-orm/pg-core").PgColumn<{
1394
+ name: "last_error";
1395
+ tableName: "channel_booking_links";
1396
+ dataType: "string";
1397
+ columnType: "PgText";
1398
+ data: string;
1399
+ driverParam: string;
1400
+ notNull: false;
1401
+ hasDefault: false;
1402
+ isPrimaryKey: false;
1403
+ isAutoincrement: false;
1404
+ hasRuntimeDefault: false;
1405
+ enumValues: [string, ...string[]];
1406
+ baseColumn: never;
1407
+ identity: undefined;
1408
+ generated: undefined;
1409
+ }, {}, {}>;
1410
+ pushedPayloadHash: import("drizzle-orm/pg-core").PgColumn<{
1411
+ name: "pushed_payload_hash";
1412
+ tableName: "channel_booking_links";
1413
+ dataType: "string";
1414
+ columnType: "PgText";
1415
+ data: string;
1416
+ driverParam: string;
1417
+ notNull: false;
1418
+ hasDefault: false;
1419
+ isPrimaryKey: false;
1420
+ isAutoincrement: false;
1421
+ hasRuntimeDefault: false;
1422
+ enumValues: [string, ...string[]];
1423
+ baseColumn: never;
1424
+ identity: undefined;
1425
+ generated: undefined;
1426
+ }, {}, {}>;
1427
+ idempotencyKey: import("drizzle-orm/pg-core").PgColumn<{
1428
+ name: "idempotency_key";
1429
+ tableName: "channel_booking_links";
1430
+ dataType: "string";
1431
+ columnType: "PgText";
1432
+ data: string;
1433
+ driverParam: string;
1434
+ notNull: false;
1435
+ hasDefault: false;
1436
+ isPrimaryKey: false;
1437
+ isAutoincrement: false;
1438
+ hasRuntimeDefault: false;
1439
+ enumValues: [string, ...string[]];
1440
+ baseColumn: never;
1441
+ identity: undefined;
1442
+ generated: undefined;
1443
+ }, {}, {}>;
1028
1444
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
1029
1445
  name: "created_at";
1030
1446
  tableName: "channel_booking_links";
@@ -1192,7 +1608,7 @@ export declare const channelWebhookEvents: import("drizzle-orm/pg-core").PgTable
1192
1608
  tableName: "channel_webhook_events";
1193
1609
  dataType: "string";
1194
1610
  columnType: "PgEnumColumn";
1195
- data: "pending" | "processed" | "failed" | "ignored";
1611
+ data: "pending" | "failed" | "processed" | "ignored";
1196
1612
  driverParam: string;
1197
1613
  notNull: true;
1198
1614
  hasDefault: true;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-core.d.ts","sourceRoot":"","sources":["../src/schema-core.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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GAAG,OAAO,QAAQ,CAAC,YAAY,CAAA;AACrD,MAAM,MAAM,wBAAwB,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACvF,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC,YAAY,CAAA;AAClE,MAAM,MAAM,kBAAkB,GAAG,OAAO,gBAAgB,CAAC,YAAY,CAAA;AACrE,MAAM,MAAM,qBAAqB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AACjF,MAAM,MAAM,qBAAqB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAA;AACxE,MAAM,MAAM,qBAAqB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAA;AAC3E,MAAM,MAAM,mBAAmB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA"}
@@ -1,7 +1,8 @@
1
1
  import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
2
2
  import { products } from "@voyantjs/products/schema";
3
3
  import { suppliers } from "@voyantjs/suppliers/schema";
4
- import { boolean, date, index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
4
+ import { sql } from "drizzle-orm";
5
+ import { boolean, date, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
5
6
  import { channelCommissionScopeEnum, channelCommissionTypeEnum, channelContractStatusEnum, channelKindEnum, channelStatusEnum, channelWebhookStatusEnum, distributionCancellationOwnerEnum, distributionPaymentOwnerEnum, } from "./schema-shared";
6
7
  export const channels = pgTable("channels", {
7
8
  id: typeId("channels"),
@@ -10,6 +11,21 @@ export const channels = pgTable("channels", {
10
11
  kind: channelKindEnum("kind").notNull(),
11
12
  status: channelStatusEnum("status").notNull().default("active"),
12
13
  metadata: jsonb("metadata").$type(),
14
+ // ── Channel push: per-channel rate-limit defaults ───────────────
15
+ // Per channel-push-architecture §14.1. Contract-level rules in
16
+ // `channel_contracts` override these for specific commercial deals.
17
+ /** Sustained requests per second the channel allows (operator estimate). */
18
+ rateLimitRps: integer("rate_limit_rps"),
19
+ /** Max tokens in the bucket — controls burst capacity. */
20
+ rateLimitBurst: integer("rate_limit_burst"),
21
+ /**
22
+ * Per-priority reserve thresholds. Example:
23
+ * { "booking": 0, "availability": 0.3, "content": 0.7 }
24
+ * Reads as: bookings dispatch with any tokens; availability when
25
+ * bucket ≥ 30% full; content when ≥ 70% full. Bookings always
26
+ * pre-empt availability/content within one shared upstream budget.
27
+ */
28
+ rateLimitPriorityGates: jsonb("rate_limit_priority_gates").$type(),
13
29
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
14
30
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
15
31
  }, (table) => [
@@ -44,6 +60,22 @@ export const channelContracts = pgTable("channel_contracts", {
44
60
  .default("operator"),
45
61
  settlementTerms: text("settlement_terms"),
46
62
  notes: text("notes"),
63
+ // ── Channel push: per-contract rate-limit overrides ─────────────
64
+ // Per §14.1 — overrides the `channels.*` defaults for this specific
65
+ // supplier relationship (e.g. an enterprise contract gets a higher
66
+ // burst than the public default).
67
+ rateLimitRps: integer("rate_limit_rps"),
68
+ rateLimitBurst: integer("rate_limit_burst"),
69
+ rateLimitPriorityGates: jsonb("rate_limit_priority_gates").$type(),
70
+ /**
71
+ * Per-contract policy bag for channel-push behavior. Currently
72
+ * carries the compensation policy ("strict-atomic" vs
73
+ * "eventually-consistent"), per-mapping field include/exclude
74
+ * lists, and adapter-specific commercial parameters echoed to push
75
+ * calls. Treated as opaque JSON; the channel-push pipeline reads
76
+ * known keys and ignores the rest.
77
+ */
78
+ policy: jsonb("policy").$type(),
47
79
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
48
80
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
49
81
  }, (table) => [
@@ -84,12 +116,38 @@ export const channelProductMappings = pgTable("channel_product_mappings", {
84
116
  externalRateId: text("external_rate_id"),
85
117
  externalCategoryId: text("external_category_id"),
86
118
  active: boolean("active").notNull().default(true),
119
+ // ── Channel push: per-mapping routing + idempotency ──────────────
120
+ // Per §3.1 + §7.2 + §6.1.
121
+ /** Mirrors adapter kind for routing (e.g. "voyant-connect", "direct:tui"). */
122
+ sourceKind: text("source_kind"),
123
+ /** Connection id resolving to a registered SourceAdapter. */
124
+ sourceConnectionId: text("source_connection_id"),
125
+ /** Per-flow push toggles. Default true: a mapping with no override
126
+ * participates in all push flows. */
127
+ pushBookings: boolean("push_bookings").notNull().default(true),
128
+ pushAvailability: boolean("push_availability").notNull().default(true),
129
+ pushContent: boolean("push_content").notNull().default(true),
130
+ /**
131
+ * Per-mapping policy (rate caps, field include/exclude, push-time
132
+ * overrides). Treated as opaque JSON; the channel-push pipeline
133
+ * reads known keys and ignores the rest.
134
+ */
135
+ policy: jsonb("policy").$type(),
136
+ /**
137
+ * Last content hash the upstream acknowledged. Idempotency for the
138
+ * content-push flow: skip when current `sha256(canonicalJson(content))`
139
+ * equals this value. Per §6.1.
140
+ */
141
+ lastPushedContentHash: text("last_pushed_content_hash"),
142
+ /** Time of the last successful content push. */
143
+ lastPushedContentAt: timestamp("last_pushed_content_at", { withTimezone: true }),
87
144
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
88
145
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
89
146
  }, (table) => [
90
147
  index("idx_channel_product_mappings_channel_created").on(table.channelId, table.createdAt),
91
148
  index("idx_channel_product_mappings_product_created").on(table.productId, table.createdAt),
92
149
  index("idx_channel_product_mappings_active_created").on(table.active, table.createdAt),
150
+ index("idx_channel_product_mappings_source_connection").on(table.sourceConnectionId),
93
151
  ]);
94
152
  export const channelBookingLinks = pgTable("channel_booking_links", {
95
153
  id: typeId("channel_booking_links"),
@@ -97,17 +155,56 @@ export const channelBookingLinks = pgTable("channel_booking_links", {
97
155
  .notNull()
98
156
  .references(() => channels.id, { onDelete: "cascade" }),
99
157
  bookingId: text("booking_id").notNull(),
158
+ /**
159
+ * Booking-item scope. Null = booking-level link. Multi-line bookings
160
+ * fan out into one row per `(booking_item_id, channel_id)` so each
161
+ * line can target a different channel. Per §7.1.
162
+ */
163
+ bookingItemId: text("booking_item_id"),
100
164
  externalBookingId: text("external_booking_id"),
101
165
  externalReference: text("external_reference"),
102
166
  externalStatus: text("external_status"),
103
167
  bookedAtExternal: timestamp("booked_at_external", { withTimezone: true }),
104
168
  lastSyncedAt: timestamp("last_synced_at", { withTimezone: true }),
169
+ // ── Channel push lifecycle ───────────────────────────────────────
170
+ // Per §7.1. The row IS the durable intent: pending → ok | failed |
171
+ // compensated. The subscriber INSERTs with `pushStatus = 'pending'`
172
+ // and the durable workflow drains it.
173
+ sourceKind: text("source_kind"),
174
+ sourceConnectionId: text("source_connection_id"),
175
+ /** "pending" | "ok" | "failed" | "compensated" */
176
+ pushStatus: text("push_status").notNull().default("pending"),
177
+ pushAttempts: integer("push_attempts").notNull().default(0),
178
+ lastPushAt: timestamp("last_push_at", { withTimezone: true }),
179
+ lastError: text("last_error"),
180
+ /**
181
+ * SHA-256 of the canonical pushed payload — drift detection on
182
+ * subsequent pushes. Per §7.1.
183
+ */
184
+ pushedPayloadHash: text("pushed_payload_hash"),
185
+ /**
186
+ * Stable idempotency key for the upstream call. Generated from
187
+ * `(booking_id, booking_item_id, channel_id)` so retries don't
188
+ * double-push.
189
+ */
190
+ idempotencyKey: text("idempotency_key"),
105
191
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
106
192
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
107
193
  }, (table) => [
108
194
  index("idx_channel_booking_links_channel_created").on(table.channelId, table.createdAt),
109
195
  index("idx_channel_booking_links_booking_created").on(table.bookingId, table.createdAt),
110
196
  index("idx_channel_booking_links_external_booking_created").on(table.externalBookingId, table.createdAt),
197
+ index("idx_channel_booking_links_push_status").on(table.pushStatus, table.lastPushAt),
198
+ index("idx_channel_booking_links_booking_item")
199
+ .on(table.bookingItemId)
200
+ .where(sql `${table.bookingItemId} IS NOT NULL`),
201
+ /**
202
+ * Per §7.1: the subscriber's `INSERT ... ON CONFLICT DO NOTHING`
203
+ * needs a stable durable-handoff key. `COALESCE(booking_item_id,
204
+ * '')` collapses booking-level rows (item id null) and item-scoped
205
+ * rows into one uniqueness rule.
206
+ */
207
+ uniqueIndex("uniq_channel_booking_links_per_item").on(table.channelId, table.bookingId, sql `COALESCE(${table.bookingItemId}, '')`),
111
208
  ]);
112
209
  export const channelWebhookEvents = pgTable("channel_webhook_events", {
113
210
  id: typeId("channel_webhook_events"),