@voyantjs/distribution 0.1.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.
@@ -0,0 +1,1369 @@
1
+ import type { InsertContactPointForEntity, InsertNamedContactForEntity, UpdateContactPoint as UpdateIdentityContactPoint, UpdateNamedContact as UpdateIdentityNamedContact } from "@voyantjs/identity/validation";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ import type { z } from "zod";
4
+ import type { Channel } from "./schema.js";
5
+ import type { channelBookingLinkListQuerySchema, channelCommissionRuleListQuerySchema, channelContractListQuerySchema, channelInventoryAllotmentListQuerySchema, channelInventoryAllotmentTargetListQuerySchema, channelInventoryReleaseExecutionListQuerySchema, channelInventoryReleaseRuleListQuerySchema, channelListQuerySchema, channelProductMappingListQuerySchema, channelReconciliationItemListQuerySchema, channelReconciliationPolicyListQuerySchema, channelReconciliationRunListQuerySchema, channelReleaseScheduleListQuerySchema, channelRemittanceExceptionListQuerySchema, channelSettlementApprovalListQuerySchema, channelSettlementItemListQuerySchema, channelSettlementPolicyListQuerySchema, channelSettlementRunListQuerySchema, channelWebhookEventListQuerySchema, insertChannelBookingLinkSchema, insertChannelCommissionRuleSchema, insertChannelContractSchema, insertChannelInventoryAllotmentSchema, insertChannelInventoryAllotmentTargetSchema, insertChannelInventoryReleaseExecutionSchema, insertChannelInventoryReleaseRuleSchema, insertChannelProductMappingSchema, insertChannelReconciliationItemSchema, insertChannelReconciliationPolicySchema, insertChannelReconciliationRunSchema, insertChannelReleaseScheduleSchema, insertChannelRemittanceExceptionSchema, insertChannelSchema, insertChannelSettlementApprovalSchema, insertChannelSettlementItemSchema, insertChannelSettlementPolicySchema, insertChannelSettlementRunSchema, insertChannelWebhookEventSchema, updateChannelBookingLinkSchema, updateChannelCommissionRuleSchema, updateChannelContractSchema, updateChannelInventoryAllotmentSchema, updateChannelInventoryAllotmentTargetSchema, updateChannelInventoryReleaseExecutionSchema, updateChannelInventoryReleaseRuleSchema, updateChannelProductMappingSchema, updateChannelReconciliationItemSchema, updateChannelReconciliationPolicySchema, updateChannelReconciliationRunSchema, updateChannelReleaseScheduleSchema, updateChannelRemittanceExceptionSchema, updateChannelSchema, updateChannelSettlementApprovalSchema, updateChannelSettlementItemSchema, updateChannelSettlementPolicySchema, updateChannelSettlementRunSchema, updateChannelWebhookEventSchema } from "./validation.js";
6
+ type ChannelListQuery = z.infer<typeof channelListQuerySchema>;
7
+ type ChannelContractListQuery = z.infer<typeof channelContractListQuerySchema>;
8
+ type ChannelCommissionRuleListQuery = z.infer<typeof channelCommissionRuleListQuerySchema>;
9
+ type ChannelProductMappingListQuery = z.infer<typeof channelProductMappingListQuerySchema>;
10
+ type ChannelBookingLinkListQuery = z.infer<typeof channelBookingLinkListQuerySchema>;
11
+ type ChannelWebhookEventListQuery = z.infer<typeof channelWebhookEventListQuerySchema>;
12
+ type ChannelInventoryAllotmentListQuery = z.infer<typeof channelInventoryAllotmentListQuerySchema>;
13
+ type ChannelInventoryAllotmentTargetListQuery = z.infer<typeof channelInventoryAllotmentTargetListQuerySchema>;
14
+ type ChannelInventoryReleaseRuleListQuery = z.infer<typeof channelInventoryReleaseRuleListQuerySchema>;
15
+ type ChannelSettlementRunListQuery = z.infer<typeof channelSettlementRunListQuerySchema>;
16
+ type ChannelSettlementItemListQuery = z.infer<typeof channelSettlementItemListQuerySchema>;
17
+ type ChannelReconciliationRunListQuery = z.infer<typeof channelReconciliationRunListQuerySchema>;
18
+ type ChannelReconciliationItemListQuery = z.infer<typeof channelReconciliationItemListQuerySchema>;
19
+ type ChannelInventoryReleaseExecutionListQuery = z.infer<typeof channelInventoryReleaseExecutionListQuerySchema>;
20
+ type ChannelSettlementPolicyListQuery = z.infer<typeof channelSettlementPolicyListQuerySchema>;
21
+ type ChannelReconciliationPolicyListQuery = z.infer<typeof channelReconciliationPolicyListQuerySchema>;
22
+ type ChannelReleaseScheduleListQuery = z.infer<typeof channelReleaseScheduleListQuerySchema>;
23
+ type ChannelRemittanceExceptionListQuery = z.infer<typeof channelRemittanceExceptionListQuerySchema>;
24
+ type ChannelSettlementApprovalListQuery = z.infer<typeof channelSettlementApprovalListQuerySchema>;
25
+ type CreateChannelInput = z.infer<typeof insertChannelSchema>;
26
+ type UpdateChannelInput = z.infer<typeof updateChannelSchema>;
27
+ type CreateChannelContractInput = z.infer<typeof insertChannelContractSchema>;
28
+ type UpdateChannelContractInput = z.infer<typeof updateChannelContractSchema>;
29
+ type CreateChannelCommissionRuleInput = z.infer<typeof insertChannelCommissionRuleSchema>;
30
+ type UpdateChannelCommissionRuleInput = z.infer<typeof updateChannelCommissionRuleSchema>;
31
+ type CreateChannelProductMappingInput = z.infer<typeof insertChannelProductMappingSchema>;
32
+ type UpdateChannelProductMappingInput = z.infer<typeof updateChannelProductMappingSchema>;
33
+ type CreateChannelBookingLinkInput = z.infer<typeof insertChannelBookingLinkSchema>;
34
+ type UpdateChannelBookingLinkInput = z.infer<typeof updateChannelBookingLinkSchema>;
35
+ type CreateChannelWebhookEventInput = z.infer<typeof insertChannelWebhookEventSchema>;
36
+ type UpdateChannelWebhookEventInput = z.infer<typeof updateChannelWebhookEventSchema>;
37
+ type CreateChannelInventoryAllotmentInput = z.infer<typeof insertChannelInventoryAllotmentSchema>;
38
+ type UpdateChannelInventoryAllotmentInput = z.infer<typeof updateChannelInventoryAllotmentSchema>;
39
+ type CreateChannelInventoryAllotmentTargetInput = z.infer<typeof insertChannelInventoryAllotmentTargetSchema>;
40
+ type UpdateChannelInventoryAllotmentTargetInput = z.infer<typeof updateChannelInventoryAllotmentTargetSchema>;
41
+ type CreateChannelInventoryReleaseRuleInput = z.infer<typeof insertChannelInventoryReleaseRuleSchema>;
42
+ type UpdateChannelInventoryReleaseRuleInput = z.infer<typeof updateChannelInventoryReleaseRuleSchema>;
43
+ type CreateChannelSettlementRunInput = z.infer<typeof insertChannelSettlementRunSchema>;
44
+ type UpdateChannelSettlementRunInput = z.infer<typeof updateChannelSettlementRunSchema>;
45
+ type CreateChannelSettlementItemInput = z.infer<typeof insertChannelSettlementItemSchema>;
46
+ type UpdateChannelSettlementItemInput = z.infer<typeof updateChannelSettlementItemSchema>;
47
+ type CreateChannelReconciliationRunInput = z.infer<typeof insertChannelReconciliationRunSchema>;
48
+ type UpdateChannelReconciliationRunInput = z.infer<typeof updateChannelReconciliationRunSchema>;
49
+ type CreateChannelReconciliationItemInput = z.infer<typeof insertChannelReconciliationItemSchema>;
50
+ type UpdateChannelReconciliationItemInput = z.infer<typeof updateChannelReconciliationItemSchema>;
51
+ type CreateChannelInventoryReleaseExecutionInput = z.infer<typeof insertChannelInventoryReleaseExecutionSchema>;
52
+ type UpdateChannelInventoryReleaseExecutionInput = z.infer<typeof updateChannelInventoryReleaseExecutionSchema>;
53
+ type CreateChannelSettlementPolicyInput = z.infer<typeof insertChannelSettlementPolicySchema>;
54
+ type UpdateChannelSettlementPolicyInput = z.infer<typeof updateChannelSettlementPolicySchema>;
55
+ type CreateChannelReconciliationPolicyInput = z.infer<typeof insertChannelReconciliationPolicySchema>;
56
+ type UpdateChannelReconciliationPolicyInput = z.infer<typeof updateChannelReconciliationPolicySchema>;
57
+ type CreateChannelReleaseScheduleInput = z.infer<typeof insertChannelReleaseScheduleSchema>;
58
+ type UpdateChannelReleaseScheduleInput = z.infer<typeof updateChannelReleaseScheduleSchema>;
59
+ type CreateChannelRemittanceExceptionInput = z.infer<typeof insertChannelRemittanceExceptionSchema>;
60
+ type UpdateChannelRemittanceExceptionInput = z.infer<typeof updateChannelRemittanceExceptionSchema>;
61
+ type CreateChannelSettlementApprovalInput = z.infer<typeof insertChannelSettlementApprovalSchema>;
62
+ type UpdateChannelSettlementApprovalInput = z.infer<typeof updateChannelSettlementApprovalSchema>;
63
+ type ChannelHydratedFields = {
64
+ website: string | null;
65
+ contactName: string | null;
66
+ contactEmail: string | null;
67
+ };
68
+ export declare const distributionService: {
69
+ listChannels(db: PostgresJsDatabase, query: ChannelListQuery): Promise<{
70
+ data: ({
71
+ id: string;
72
+ name: string;
73
+ description: string | null;
74
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
75
+ status: "active" | "archived" | "inactive" | "pending";
76
+ metadata: Record<string, unknown> | null;
77
+ createdAt: Date;
78
+ updatedAt: Date;
79
+ } & ChannelHydratedFields)[];
80
+ total: number;
81
+ limit: number;
82
+ offset: number;
83
+ }>;
84
+ getChannelById(db: PostgresJsDatabase, id: string): Promise<({
85
+ id: string;
86
+ name: string;
87
+ description: string | null;
88
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
89
+ status: "active" | "archived" | "inactive" | "pending";
90
+ metadata: Record<string, unknown> | null;
91
+ createdAt: Date;
92
+ updatedAt: Date;
93
+ } & ChannelHydratedFields) | null>;
94
+ createChannel(db: PostgresJsDatabase, data: CreateChannelInput): Promise<({
95
+ id: string;
96
+ name: string;
97
+ description: string | null;
98
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
99
+ status: "active" | "archived" | "inactive" | "pending";
100
+ metadata: Record<string, unknown> | null;
101
+ createdAt: Date;
102
+ updatedAt: Date;
103
+ } & ChannelHydratedFields) | null>;
104
+ updateChannel(db: PostgresJsDatabase, id: string, data: UpdateChannelInput): Promise<({
105
+ id: string;
106
+ name: string;
107
+ description: string | null;
108
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
109
+ status: "active" | "archived" | "inactive" | "pending";
110
+ metadata: Record<string, unknown> | null;
111
+ createdAt: Date;
112
+ updatedAt: Date;
113
+ } & ChannelHydratedFields) | null>;
114
+ deleteChannel(db: PostgresJsDatabase, id: string): Promise<{
115
+ id: string;
116
+ } | null>;
117
+ listChannelContactPoints(db: PostgresJsDatabase, channelId: string): Promise<{
118
+ id: string;
119
+ entityType: string;
120
+ entityId: string;
121
+ kind: "email" | "phone" | "mobile" | "whatsapp" | "website" | "sms" | "fax" | "social" | "other";
122
+ label: string | null;
123
+ value: string;
124
+ normalizedValue: string | null;
125
+ isPrimary: boolean;
126
+ notes: string | null;
127
+ metadata: Record<string, unknown> | null;
128
+ createdAt: Date;
129
+ updatedAt: Date;
130
+ }[] | null>;
131
+ createChannelContactPoint(db: PostgresJsDatabase, channelId: string, data: InsertContactPointForEntity): Promise<{
132
+ value: string;
133
+ createdAt: Date;
134
+ updatedAt: Date;
135
+ kind: "email" | "phone" | "mobile" | "whatsapp" | "website" | "sms" | "fax" | "social" | "other";
136
+ entityType: string;
137
+ entityId: string;
138
+ label: string | null;
139
+ normalizedValue: string | null;
140
+ isPrimary: boolean;
141
+ notes: string | null;
142
+ metadata: Record<string, unknown> | null;
143
+ id: string;
144
+ } | null>;
145
+ updateChannelContactPoint(db: PostgresJsDatabase, id: string, data: UpdateIdentityContactPoint): Promise<{
146
+ id: string;
147
+ entityType: string;
148
+ entityId: string;
149
+ kind: "email" | "phone" | "mobile" | "whatsapp" | "website" | "sms" | "fax" | "social" | "other";
150
+ label: string | null;
151
+ value: string;
152
+ normalizedValue: string | null;
153
+ isPrimary: boolean;
154
+ notes: string | null;
155
+ metadata: Record<string, unknown> | null;
156
+ createdAt: Date;
157
+ updatedAt: Date;
158
+ } | null>;
159
+ deleteChannelContactPoint(db: PostgresJsDatabase, id: string): Promise<{
160
+ id: string;
161
+ } | null>;
162
+ listChannelContacts(db: PostgresJsDatabase, channelId: string): Promise<{
163
+ id: string;
164
+ entityType: string;
165
+ entityId: string;
166
+ role: "primary" | "other" | "legal" | "general" | "reservations" | "operations" | "front_desk" | "sales" | "emergency" | "accounting";
167
+ name: string;
168
+ title: string | null;
169
+ email: string | null;
170
+ phone: string | null;
171
+ isPrimary: boolean;
172
+ notes: string | null;
173
+ metadata: Record<string, unknown> | null;
174
+ createdAt: Date;
175
+ updatedAt: Date;
176
+ }[] | null>;
177
+ createChannelContact(db: PostgresJsDatabase, channelId: string, data: InsertNamedContactForEntity): Promise<{
178
+ name: string;
179
+ createdAt: Date;
180
+ updatedAt: Date;
181
+ email: string | null;
182
+ phone: string | null;
183
+ entityType: string;
184
+ entityId: string;
185
+ isPrimary: boolean;
186
+ notes: string | null;
187
+ metadata: Record<string, unknown> | null;
188
+ role: "primary" | "other" | "legal" | "general" | "reservations" | "operations" | "front_desk" | "sales" | "emergency" | "accounting";
189
+ title: string | null;
190
+ id: string;
191
+ } | null>;
192
+ updateChannelContact(db: PostgresJsDatabase, id: string, data: UpdateIdentityNamedContact): Promise<{
193
+ id: string;
194
+ entityType: string;
195
+ entityId: string;
196
+ role: "primary" | "other" | "legal" | "general" | "reservations" | "operations" | "front_desk" | "sales" | "emergency" | "accounting";
197
+ name: string;
198
+ title: string | null;
199
+ email: string | null;
200
+ phone: string | null;
201
+ isPrimary: boolean;
202
+ notes: string | null;
203
+ metadata: Record<string, unknown> | null;
204
+ createdAt: Date;
205
+ updatedAt: Date;
206
+ } | null>;
207
+ deleteChannelContact(db: PostgresJsDatabase, id: string): Promise<{
208
+ id: string;
209
+ } | null>;
210
+ listContracts(db: PostgresJsDatabase, query: ChannelContractListQuery): Promise<{
211
+ data: {
212
+ id: string;
213
+ channelId: string;
214
+ supplierId: string | null;
215
+ status: "active" | "draft" | "expired" | "terminated";
216
+ startsAt: string;
217
+ endsAt: string | null;
218
+ paymentOwner: "operator" | "channel" | "split";
219
+ cancellationOwner: "operator" | "channel" | "mixed";
220
+ settlementTerms: string | null;
221
+ notes: string | null;
222
+ createdAt: Date;
223
+ updatedAt: Date;
224
+ }[];
225
+ total: number;
226
+ limit: number;
227
+ offset: number;
228
+ }>;
229
+ getContractById(db: PostgresJsDatabase, id: string): Promise<{
230
+ id: string;
231
+ channelId: string;
232
+ supplierId: string | null;
233
+ status: "active" | "draft" | "expired" | "terminated";
234
+ startsAt: string;
235
+ endsAt: string | null;
236
+ paymentOwner: "operator" | "channel" | "split";
237
+ cancellationOwner: "operator" | "channel" | "mixed";
238
+ settlementTerms: string | null;
239
+ notes: string | null;
240
+ createdAt: Date;
241
+ updatedAt: Date;
242
+ } | null>;
243
+ createContract(db: PostgresJsDatabase, data: CreateChannelContractInput): Promise<{
244
+ paymentOwner: "operator" | "channel" | "split";
245
+ createdAt: Date;
246
+ updatedAt: Date;
247
+ notes: string | null;
248
+ id: string;
249
+ startsAt: string;
250
+ endsAt: string | null;
251
+ status: "active" | "draft" | "expired" | "terminated";
252
+ supplierId: string | null;
253
+ channelId: string;
254
+ cancellationOwner: "operator" | "channel" | "mixed";
255
+ settlementTerms: string | null;
256
+ } | undefined>;
257
+ updateContract(db: PostgresJsDatabase, id: string, data: UpdateChannelContractInput): Promise<{
258
+ id: string;
259
+ channelId: string;
260
+ supplierId: string | null;
261
+ status: "active" | "draft" | "expired" | "terminated";
262
+ startsAt: string;
263
+ endsAt: string | null;
264
+ paymentOwner: "operator" | "channel" | "split";
265
+ cancellationOwner: "operator" | "channel" | "mixed";
266
+ settlementTerms: string | null;
267
+ notes: string | null;
268
+ createdAt: Date;
269
+ updatedAt: Date;
270
+ } | null>;
271
+ deleteContract(db: PostgresJsDatabase, id: string): Promise<{
272
+ id: string;
273
+ } | null>;
274
+ listCommissionRules(db: PostgresJsDatabase, query: ChannelCommissionRuleListQuery): Promise<{
275
+ data: {
276
+ id: string;
277
+ contractId: string;
278
+ scope: "product" | "category" | "booking" | "rate";
279
+ productId: string | null;
280
+ externalRateId: string | null;
281
+ externalCategoryId: string | null;
282
+ commissionType: "fixed" | "percentage";
283
+ amountCents: number | null;
284
+ percentBasisPoints: number | null;
285
+ validFrom: string | null;
286
+ validTo: string | null;
287
+ createdAt: Date;
288
+ updatedAt: Date;
289
+ }[];
290
+ total: number;
291
+ limit: number;
292
+ offset: number;
293
+ }>;
294
+ getCommissionRuleById(db: PostgresJsDatabase, id: string): Promise<{
295
+ id: string;
296
+ contractId: string;
297
+ scope: "product" | "category" | "booking" | "rate";
298
+ productId: string | null;
299
+ externalRateId: string | null;
300
+ externalCategoryId: string | null;
301
+ commissionType: "fixed" | "percentage";
302
+ amountCents: number | null;
303
+ percentBasisPoints: number | null;
304
+ validFrom: string | null;
305
+ validTo: string | null;
306
+ createdAt: Date;
307
+ updatedAt: Date;
308
+ } | null>;
309
+ createCommissionRule(db: PostgresJsDatabase, data: CreateChannelCommissionRuleInput): Promise<{
310
+ createdAt: Date;
311
+ updatedAt: Date;
312
+ id: string;
313
+ productId: string | null;
314
+ validFrom: string | null;
315
+ validTo: string | null;
316
+ amountCents: number | null;
317
+ contractId: string;
318
+ scope: "product" | "category" | "booking" | "rate";
319
+ externalRateId: string | null;
320
+ externalCategoryId: string | null;
321
+ commissionType: "fixed" | "percentage";
322
+ percentBasisPoints: number | null;
323
+ } | undefined>;
324
+ updateCommissionRule(db: PostgresJsDatabase, id: string, data: UpdateChannelCommissionRuleInput): Promise<{
325
+ id: string;
326
+ contractId: string;
327
+ scope: "product" | "category" | "booking" | "rate";
328
+ productId: string | null;
329
+ externalRateId: string | null;
330
+ externalCategoryId: string | null;
331
+ commissionType: "fixed" | "percentage";
332
+ amountCents: number | null;
333
+ percentBasisPoints: number | null;
334
+ validFrom: string | null;
335
+ validTo: string | null;
336
+ createdAt: Date;
337
+ updatedAt: Date;
338
+ } | null>;
339
+ deleteCommissionRule(db: PostgresJsDatabase, id: string): Promise<{
340
+ id: string;
341
+ } | null>;
342
+ listProductMappings(db: PostgresJsDatabase, query: ChannelProductMappingListQuery): Promise<{
343
+ data: {
344
+ id: string;
345
+ channelId: string;
346
+ productId: string;
347
+ externalProductId: string | null;
348
+ externalRateId: string | null;
349
+ externalCategoryId: string | null;
350
+ active: boolean;
351
+ createdAt: Date;
352
+ updatedAt: Date;
353
+ }[];
354
+ total: number;
355
+ limit: number;
356
+ offset: number;
357
+ }>;
358
+ getProductMappingById(db: PostgresJsDatabase, id: string): Promise<{
359
+ id: string;
360
+ channelId: string;
361
+ productId: string;
362
+ externalProductId: string | null;
363
+ externalRateId: string | null;
364
+ externalCategoryId: string | null;
365
+ active: boolean;
366
+ createdAt: Date;
367
+ updatedAt: Date;
368
+ } | null>;
369
+ createProductMapping(db: PostgresJsDatabase, data: CreateChannelProductMappingInput): Promise<{
370
+ createdAt: Date;
371
+ updatedAt: Date;
372
+ id: string;
373
+ productId: string;
374
+ active: boolean;
375
+ channelId: string;
376
+ externalRateId: string | null;
377
+ externalCategoryId: string | null;
378
+ externalProductId: string | null;
379
+ } | undefined>;
380
+ updateProductMapping(db: PostgresJsDatabase, id: string, data: UpdateChannelProductMappingInput): Promise<{
381
+ id: string;
382
+ channelId: string;
383
+ productId: string;
384
+ externalProductId: string | null;
385
+ externalRateId: string | null;
386
+ externalCategoryId: string | null;
387
+ active: boolean;
388
+ createdAt: Date;
389
+ updatedAt: Date;
390
+ } | null>;
391
+ deleteProductMapping(db: PostgresJsDatabase, id: string): Promise<{
392
+ id: string;
393
+ } | null>;
394
+ listBookingLinks(db: PostgresJsDatabase, query: ChannelBookingLinkListQuery): Promise<{
395
+ data: {
396
+ id: string;
397
+ channelId: string;
398
+ bookingId: string;
399
+ externalBookingId: string | null;
400
+ externalReference: string | null;
401
+ externalStatus: string | null;
402
+ bookedAtExternal: Date | null;
403
+ lastSyncedAt: Date | null;
404
+ createdAt: Date;
405
+ updatedAt: Date;
406
+ }[];
407
+ total: number;
408
+ limit: number;
409
+ offset: number;
410
+ }>;
411
+ getBookingLinkById(db: PostgresJsDatabase, id: string): Promise<{
412
+ id: string;
413
+ channelId: string;
414
+ bookingId: string;
415
+ externalBookingId: string | null;
416
+ externalReference: string | null;
417
+ externalStatus: string | null;
418
+ bookedAtExternal: Date | null;
419
+ lastSyncedAt: Date | null;
420
+ createdAt: Date;
421
+ updatedAt: Date;
422
+ } | null>;
423
+ createBookingLink(db: PostgresJsDatabase, data: CreateChannelBookingLinkInput): Promise<{
424
+ bookingId: string;
425
+ createdAt: Date;
426
+ updatedAt: Date;
427
+ id: string;
428
+ channelId: string;
429
+ externalBookingId: string | null;
430
+ externalReference: string | null;
431
+ externalStatus: string | null;
432
+ bookedAtExternal: Date | null;
433
+ lastSyncedAt: Date | null;
434
+ } | undefined>;
435
+ updateBookingLink(db: PostgresJsDatabase, id: string, data: UpdateChannelBookingLinkInput): Promise<{
436
+ id: string;
437
+ channelId: string;
438
+ bookingId: string;
439
+ externalBookingId: string | null;
440
+ externalReference: string | null;
441
+ externalStatus: string | null;
442
+ bookedAtExternal: Date | null;
443
+ lastSyncedAt: Date | null;
444
+ createdAt: Date;
445
+ updatedAt: Date;
446
+ } | null>;
447
+ deleteBookingLink(db: PostgresJsDatabase, id: string): Promise<{
448
+ id: string;
449
+ } | null>;
450
+ listWebhookEvents(db: PostgresJsDatabase, query: ChannelWebhookEventListQuery): Promise<{
451
+ data: {
452
+ id: string;
453
+ channelId: string;
454
+ eventType: string;
455
+ externalEventId: string | null;
456
+ payload: Record<string, unknown>;
457
+ receivedAt: Date;
458
+ processedAt: Date | null;
459
+ status: "pending" | "processed" | "failed" | "ignored";
460
+ errorMessage: string | null;
461
+ createdAt: Date;
462
+ }[];
463
+ total: number;
464
+ limit: number;
465
+ offset: number;
466
+ }>;
467
+ getWebhookEventById(db: PostgresJsDatabase, id: string): Promise<{
468
+ id: string;
469
+ channelId: string;
470
+ eventType: string;
471
+ externalEventId: string | null;
472
+ payload: Record<string, unknown>;
473
+ receivedAt: Date;
474
+ processedAt: Date | null;
475
+ status: "pending" | "processed" | "failed" | "ignored";
476
+ errorMessage: string | null;
477
+ createdAt: Date;
478
+ } | null>;
479
+ createWebhookEvent(db: PostgresJsDatabase, data: CreateChannelWebhookEventInput): Promise<{
480
+ createdAt: Date;
481
+ id: string;
482
+ status: "pending" | "processed" | "failed" | "ignored";
483
+ channelId: string;
484
+ eventType: string;
485
+ externalEventId: string | null;
486
+ payload: Record<string, unknown>;
487
+ receivedAt: Date;
488
+ processedAt: Date | null;
489
+ errorMessage: string | null;
490
+ } | undefined>;
491
+ updateWebhookEvent(db: PostgresJsDatabase, id: string, data: UpdateChannelWebhookEventInput): Promise<{
492
+ id: string;
493
+ channelId: string;
494
+ eventType: string;
495
+ externalEventId: string | null;
496
+ payload: Record<string, unknown>;
497
+ receivedAt: Date;
498
+ processedAt: Date | null;
499
+ status: "pending" | "processed" | "failed" | "ignored";
500
+ errorMessage: string | null;
501
+ createdAt: Date;
502
+ } | null>;
503
+ deleteWebhookEvent(db: PostgresJsDatabase, id: string): Promise<{
504
+ id: string;
505
+ } | null>;
506
+ listInventoryAllotments(db: PostgresJsDatabase, query: ChannelInventoryAllotmentListQuery): Promise<{
507
+ data: {
508
+ id: string;
509
+ channelId: string;
510
+ contractId: string | null;
511
+ productId: string;
512
+ optionId: string | null;
513
+ startTimeId: string | null;
514
+ validFrom: string | null;
515
+ validTo: string | null;
516
+ guaranteedCapacity: number | null;
517
+ maxCapacity: number | null;
518
+ active: boolean;
519
+ notes: string | null;
520
+ createdAt: Date;
521
+ updatedAt: Date;
522
+ }[];
523
+ total: number;
524
+ limit: number;
525
+ offset: number;
526
+ }>;
527
+ getInventoryAllotmentById(db: PostgresJsDatabase, id: string): Promise<{
528
+ id: string;
529
+ channelId: string;
530
+ contractId: string | null;
531
+ productId: string;
532
+ optionId: string | null;
533
+ startTimeId: string | null;
534
+ validFrom: string | null;
535
+ validTo: string | null;
536
+ guaranteedCapacity: number | null;
537
+ maxCapacity: number | null;
538
+ active: boolean;
539
+ notes: string | null;
540
+ createdAt: Date;
541
+ updatedAt: Date;
542
+ } | null>;
543
+ createInventoryAllotment(db: PostgresJsDatabase, data: CreateChannelInventoryAllotmentInput): Promise<{
544
+ createdAt: Date;
545
+ updatedAt: Date;
546
+ notes: string | null;
547
+ id: string;
548
+ productId: string;
549
+ optionId: string | null;
550
+ maxCapacity: number | null;
551
+ active: boolean;
552
+ startTimeId: string | null;
553
+ validFrom: string | null;
554
+ validTo: string | null;
555
+ channelId: string;
556
+ contractId: string | null;
557
+ guaranteedCapacity: number | null;
558
+ } | undefined>;
559
+ updateInventoryAllotment(db: PostgresJsDatabase, id: string, data: UpdateChannelInventoryAllotmentInput): Promise<{
560
+ id: string;
561
+ channelId: string;
562
+ contractId: string | null;
563
+ productId: string;
564
+ optionId: string | null;
565
+ startTimeId: string | null;
566
+ validFrom: string | null;
567
+ validTo: string | null;
568
+ guaranteedCapacity: number | null;
569
+ maxCapacity: number | null;
570
+ active: boolean;
571
+ notes: string | null;
572
+ createdAt: Date;
573
+ updatedAt: Date;
574
+ } | null>;
575
+ deleteInventoryAllotment(db: PostgresJsDatabase, id: string): Promise<{
576
+ id: string;
577
+ } | null>;
578
+ listInventoryAllotmentTargets(db: PostgresJsDatabase, query: ChannelInventoryAllotmentTargetListQuery): Promise<{
579
+ data: {
580
+ id: string;
581
+ allotmentId: string;
582
+ slotId: string | null;
583
+ startTimeId: string | null;
584
+ dateLocal: string | null;
585
+ guaranteedCapacity: number | null;
586
+ maxCapacity: number | null;
587
+ soldCapacity: number | null;
588
+ remainingCapacity: number | null;
589
+ active: boolean;
590
+ createdAt: Date;
591
+ updatedAt: Date;
592
+ }[];
593
+ total: number;
594
+ limit: number;
595
+ offset: number;
596
+ }>;
597
+ getInventoryAllotmentTargetById(db: PostgresJsDatabase, id: string): Promise<{
598
+ id: string;
599
+ allotmentId: string;
600
+ slotId: string | null;
601
+ startTimeId: string | null;
602
+ dateLocal: string | null;
603
+ guaranteedCapacity: number | null;
604
+ maxCapacity: number | null;
605
+ soldCapacity: number | null;
606
+ remainingCapacity: number | null;
607
+ active: boolean;
608
+ createdAt: Date;
609
+ updatedAt: Date;
610
+ } | null>;
611
+ createInventoryAllotmentTarget(db: PostgresJsDatabase, data: CreateChannelInventoryAllotmentTargetInput): Promise<{
612
+ createdAt: Date;
613
+ updatedAt: Date;
614
+ id: string;
615
+ maxCapacity: number | null;
616
+ active: boolean;
617
+ startTimeId: string | null;
618
+ dateLocal: string | null;
619
+ slotId: string | null;
620
+ remainingCapacity: number | null;
621
+ guaranteedCapacity: number | null;
622
+ allotmentId: string;
623
+ soldCapacity: number | null;
624
+ } | undefined>;
625
+ updateInventoryAllotmentTarget(db: PostgresJsDatabase, id: string, data: UpdateChannelInventoryAllotmentTargetInput): Promise<{
626
+ id: string;
627
+ allotmentId: string;
628
+ slotId: string | null;
629
+ startTimeId: string | null;
630
+ dateLocal: string | null;
631
+ guaranteedCapacity: number | null;
632
+ maxCapacity: number | null;
633
+ soldCapacity: number | null;
634
+ remainingCapacity: number | null;
635
+ active: boolean;
636
+ createdAt: Date;
637
+ updatedAt: Date;
638
+ } | null>;
639
+ deleteInventoryAllotmentTarget(db: PostgresJsDatabase, id: string): Promise<{
640
+ id: string;
641
+ } | null>;
642
+ listInventoryReleaseRules(db: PostgresJsDatabase, query: ChannelInventoryReleaseRuleListQuery): Promise<{
643
+ data: {
644
+ id: string;
645
+ allotmentId: string;
646
+ releaseMode: "manual" | "automatic";
647
+ releaseDaysBeforeStart: number | null;
648
+ releaseHoursBeforeStart: number | null;
649
+ unsoldAction: "release_to_general_pool" | "expire" | "retain";
650
+ notes: string | null;
651
+ createdAt: Date;
652
+ updatedAt: Date;
653
+ }[];
654
+ total: number;
655
+ limit: number;
656
+ offset: number;
657
+ }>;
658
+ getInventoryReleaseRuleById(db: PostgresJsDatabase, id: string): Promise<{
659
+ id: string;
660
+ allotmentId: string;
661
+ releaseMode: "manual" | "automatic";
662
+ releaseDaysBeforeStart: number | null;
663
+ releaseHoursBeforeStart: number | null;
664
+ unsoldAction: "release_to_general_pool" | "expire" | "retain";
665
+ notes: string | null;
666
+ createdAt: Date;
667
+ updatedAt: Date;
668
+ } | null>;
669
+ createInventoryReleaseRule(db: PostgresJsDatabase, data: CreateChannelInventoryReleaseRuleInput): Promise<{
670
+ createdAt: Date;
671
+ updatedAt: Date;
672
+ notes: string | null;
673
+ id: string;
674
+ allotmentId: string;
675
+ releaseMode: "manual" | "automatic";
676
+ releaseDaysBeforeStart: number | null;
677
+ releaseHoursBeforeStart: number | null;
678
+ unsoldAction: "release_to_general_pool" | "expire" | "retain";
679
+ } | undefined>;
680
+ updateInventoryReleaseRule(db: PostgresJsDatabase, id: string, data: UpdateChannelInventoryReleaseRuleInput): Promise<{
681
+ id: string;
682
+ allotmentId: string;
683
+ releaseMode: "manual" | "automatic";
684
+ releaseDaysBeforeStart: number | null;
685
+ releaseHoursBeforeStart: number | null;
686
+ unsoldAction: "release_to_general_pool" | "expire" | "retain";
687
+ notes: string | null;
688
+ createdAt: Date;
689
+ updatedAt: Date;
690
+ } | null>;
691
+ deleteInventoryReleaseRule(db: PostgresJsDatabase, id: string): Promise<{
692
+ id: string;
693
+ } | null>;
694
+ listSettlementRuns(db: PostgresJsDatabase, query: ChannelSettlementRunListQuery): Promise<{
695
+ data: {
696
+ id: string;
697
+ channelId: string;
698
+ contractId: string | null;
699
+ status: "void" | "open" | "draft" | "posted" | "paid";
700
+ currencyCode: string | null;
701
+ periodStart: string | null;
702
+ periodEnd: string | null;
703
+ statementReference: string | null;
704
+ generatedAt: Date | null;
705
+ postedAt: Date | null;
706
+ paidAt: Date | null;
707
+ notes: string | null;
708
+ metadata: Record<string, unknown> | null;
709
+ createdAt: Date;
710
+ updatedAt: Date;
711
+ }[];
712
+ total: number;
713
+ limit: number;
714
+ offset: number;
715
+ }>;
716
+ getSettlementRunById(db: PostgresJsDatabase, id: string): Promise<{
717
+ id: string;
718
+ channelId: string;
719
+ contractId: string | null;
720
+ status: "void" | "open" | "draft" | "posted" | "paid";
721
+ currencyCode: string | null;
722
+ periodStart: string | null;
723
+ periodEnd: string | null;
724
+ statementReference: string | null;
725
+ generatedAt: Date | null;
726
+ postedAt: Date | null;
727
+ paidAt: Date | null;
728
+ notes: string | null;
729
+ metadata: Record<string, unknown> | null;
730
+ createdAt: Date;
731
+ updatedAt: Date;
732
+ } | null>;
733
+ createSettlementRun(db: PostgresJsDatabase, data: CreateChannelSettlementRunInput): Promise<{
734
+ createdAt: Date;
735
+ updatedAt: Date;
736
+ notes: string | null;
737
+ metadata: Record<string, unknown> | null;
738
+ id: string;
739
+ status: "void" | "open" | "draft" | "posted" | "paid";
740
+ channelId: string;
741
+ contractId: string | null;
742
+ currencyCode: string | null;
743
+ periodStart: string | null;
744
+ periodEnd: string | null;
745
+ statementReference: string | null;
746
+ generatedAt: Date | null;
747
+ postedAt: Date | null;
748
+ paidAt: Date | null;
749
+ } | undefined>;
750
+ updateSettlementRun(db: PostgresJsDatabase, id: string, data: UpdateChannelSettlementRunInput): Promise<{
751
+ id: string;
752
+ channelId: string;
753
+ contractId: string | null;
754
+ status: "void" | "open" | "draft" | "posted" | "paid";
755
+ currencyCode: string | null;
756
+ periodStart: string | null;
757
+ periodEnd: string | null;
758
+ statementReference: string | null;
759
+ generatedAt: Date | null;
760
+ postedAt: Date | null;
761
+ paidAt: Date | null;
762
+ notes: string | null;
763
+ metadata: Record<string, unknown> | null;
764
+ createdAt: Date;
765
+ updatedAt: Date;
766
+ } | null>;
767
+ deleteSettlementRun(db: PostgresJsDatabase, id: string): Promise<{
768
+ id: string;
769
+ } | null>;
770
+ listSettlementItems(db: PostgresJsDatabase, query: ChannelSettlementItemListQuery): Promise<{
771
+ data: {
772
+ id: string;
773
+ settlementRunId: string;
774
+ bookingLinkId: string | null;
775
+ bookingId: string | null;
776
+ commissionRuleId: string | null;
777
+ status: "void" | "pending" | "paid" | "approved" | "disputed";
778
+ grossAmountCents: number;
779
+ commissionAmountCents: number;
780
+ netRemittanceAmountCents: number;
781
+ currencyCode: string | null;
782
+ remittanceDueAt: Date | null;
783
+ paidAt: Date | null;
784
+ notes: string | null;
785
+ createdAt: Date;
786
+ updatedAt: Date;
787
+ }[];
788
+ total: number;
789
+ limit: number;
790
+ offset: number;
791
+ }>;
792
+ getSettlementItemById(db: PostgresJsDatabase, id: string): Promise<{
793
+ id: string;
794
+ settlementRunId: string;
795
+ bookingLinkId: string | null;
796
+ bookingId: string | null;
797
+ commissionRuleId: string | null;
798
+ status: "void" | "pending" | "paid" | "approved" | "disputed";
799
+ grossAmountCents: number;
800
+ commissionAmountCents: number;
801
+ netRemittanceAmountCents: number;
802
+ currencyCode: string | null;
803
+ remittanceDueAt: Date | null;
804
+ paidAt: Date | null;
805
+ notes: string | null;
806
+ createdAt: Date;
807
+ updatedAt: Date;
808
+ } | null>;
809
+ createSettlementItem(db: PostgresJsDatabase, data: CreateChannelSettlementItemInput): Promise<{
810
+ bookingId: string | null;
811
+ createdAt: Date;
812
+ updatedAt: Date;
813
+ notes: string | null;
814
+ id: string;
815
+ status: "void" | "pending" | "paid" | "approved" | "disputed";
816
+ currencyCode: string | null;
817
+ paidAt: Date | null;
818
+ settlementRunId: string;
819
+ bookingLinkId: string | null;
820
+ commissionRuleId: string | null;
821
+ grossAmountCents: number;
822
+ commissionAmountCents: number;
823
+ netRemittanceAmountCents: number;
824
+ remittanceDueAt: Date | null;
825
+ } | undefined>;
826
+ updateSettlementItem(db: PostgresJsDatabase, id: string, data: UpdateChannelSettlementItemInput): Promise<{
827
+ id: string;
828
+ settlementRunId: string;
829
+ bookingLinkId: string | null;
830
+ bookingId: string | null;
831
+ commissionRuleId: string | null;
832
+ status: "void" | "pending" | "paid" | "approved" | "disputed";
833
+ grossAmountCents: number;
834
+ commissionAmountCents: number;
835
+ netRemittanceAmountCents: number;
836
+ currencyCode: string | null;
837
+ remittanceDueAt: Date | null;
838
+ paidAt: Date | null;
839
+ notes: string | null;
840
+ createdAt: Date;
841
+ updatedAt: Date;
842
+ } | null>;
843
+ deleteSettlementItem(db: PostgresJsDatabase, id: string): Promise<{
844
+ id: string;
845
+ } | null>;
846
+ listReconciliationRuns(db: PostgresJsDatabase, query: ChannelReconciliationRunListQuery): Promise<{
847
+ data: {
848
+ id: string;
849
+ channelId: string;
850
+ contractId: string | null;
851
+ status: "draft" | "archived" | "running" | "completed";
852
+ periodStart: string | null;
853
+ periodEnd: string | null;
854
+ externalReportReference: string | null;
855
+ startedAt: Date | null;
856
+ completedAt: Date | null;
857
+ notes: string | null;
858
+ metadata: Record<string, unknown> | null;
859
+ createdAt: Date;
860
+ updatedAt: Date;
861
+ }[];
862
+ total: number;
863
+ limit: number;
864
+ offset: number;
865
+ }>;
866
+ getReconciliationRunById(db: PostgresJsDatabase, id: string): Promise<{
867
+ id: string;
868
+ channelId: string;
869
+ contractId: string | null;
870
+ status: "draft" | "archived" | "running" | "completed";
871
+ periodStart: string | null;
872
+ periodEnd: string | null;
873
+ externalReportReference: string | null;
874
+ startedAt: Date | null;
875
+ completedAt: Date | null;
876
+ notes: string | null;
877
+ metadata: Record<string, unknown> | null;
878
+ createdAt: Date;
879
+ updatedAt: Date;
880
+ } | null>;
881
+ createReconciliationRun(db: PostgresJsDatabase, data: CreateChannelReconciliationRunInput): Promise<{
882
+ createdAt: Date;
883
+ updatedAt: Date;
884
+ notes: string | null;
885
+ metadata: Record<string, unknown> | null;
886
+ id: string;
887
+ status: "draft" | "archived" | "running" | "completed";
888
+ channelId: string;
889
+ contractId: string | null;
890
+ periodStart: string | null;
891
+ periodEnd: string | null;
892
+ externalReportReference: string | null;
893
+ startedAt: Date | null;
894
+ completedAt: Date | null;
895
+ } | undefined>;
896
+ updateReconciliationRun(db: PostgresJsDatabase, id: string, data: UpdateChannelReconciliationRunInput): Promise<{
897
+ id: string;
898
+ channelId: string;
899
+ contractId: string | null;
900
+ status: "draft" | "archived" | "running" | "completed";
901
+ periodStart: string | null;
902
+ periodEnd: string | null;
903
+ externalReportReference: string | null;
904
+ startedAt: Date | null;
905
+ completedAt: Date | null;
906
+ notes: string | null;
907
+ metadata: Record<string, unknown> | null;
908
+ createdAt: Date;
909
+ updatedAt: Date;
910
+ } | null>;
911
+ deleteReconciliationRun(db: PostgresJsDatabase, id: string): Promise<{
912
+ id: string;
913
+ } | null>;
914
+ listReconciliationItems(db: PostgresJsDatabase, query: ChannelReconciliationItemListQuery): Promise<{
915
+ data: {
916
+ id: string;
917
+ reconciliationRunId: string;
918
+ bookingLinkId: string | null;
919
+ bookingId: string | null;
920
+ externalBookingId: string | null;
921
+ issueType: "other" | "missing_booking" | "status_mismatch" | "amount_mismatch" | "cancel_mismatch" | "missing_payout";
922
+ severity: "error" | "info" | "warning";
923
+ resolutionStatus: "open" | "ignored" | "resolved";
924
+ notes: string | null;
925
+ resolvedAt: Date | null;
926
+ createdAt: Date;
927
+ updatedAt: Date;
928
+ }[];
929
+ total: number;
930
+ limit: number;
931
+ offset: number;
932
+ }>;
933
+ getReconciliationItemById(db: PostgresJsDatabase, id: string): Promise<{
934
+ id: string;
935
+ reconciliationRunId: string;
936
+ bookingLinkId: string | null;
937
+ bookingId: string | null;
938
+ externalBookingId: string | null;
939
+ issueType: "other" | "missing_booking" | "status_mismatch" | "amount_mismatch" | "cancel_mismatch" | "missing_payout";
940
+ severity: "error" | "info" | "warning";
941
+ resolutionStatus: "open" | "ignored" | "resolved";
942
+ notes: string | null;
943
+ resolvedAt: Date | null;
944
+ createdAt: Date;
945
+ updatedAt: Date;
946
+ } | null>;
947
+ createReconciliationItem(db: PostgresJsDatabase, data: CreateChannelReconciliationItemInput): Promise<{
948
+ bookingId: string | null;
949
+ createdAt: Date;
950
+ updatedAt: Date;
951
+ notes: string | null;
952
+ id: string;
953
+ externalBookingId: string | null;
954
+ bookingLinkId: string | null;
955
+ reconciliationRunId: string;
956
+ issueType: "other" | "missing_booking" | "status_mismatch" | "amount_mismatch" | "cancel_mismatch" | "missing_payout";
957
+ severity: "error" | "info" | "warning";
958
+ resolutionStatus: "open" | "ignored" | "resolved";
959
+ resolvedAt: Date | null;
960
+ } | undefined>;
961
+ updateReconciliationItem(db: PostgresJsDatabase, id: string, data: UpdateChannelReconciliationItemInput): Promise<{
962
+ id: string;
963
+ reconciliationRunId: string;
964
+ bookingLinkId: string | null;
965
+ bookingId: string | null;
966
+ externalBookingId: string | null;
967
+ issueType: "other" | "missing_booking" | "status_mismatch" | "amount_mismatch" | "cancel_mismatch" | "missing_payout";
968
+ severity: "error" | "info" | "warning";
969
+ resolutionStatus: "open" | "ignored" | "resolved";
970
+ notes: string | null;
971
+ resolvedAt: Date | null;
972
+ createdAt: Date;
973
+ updatedAt: Date;
974
+ } | null>;
975
+ deleteReconciliationItem(db: PostgresJsDatabase, id: string): Promise<{
976
+ id: string;
977
+ } | null>;
978
+ listReleaseExecutions(db: PostgresJsDatabase, query: ChannelInventoryReleaseExecutionListQuery): Promise<{
979
+ data: {
980
+ id: string;
981
+ allotmentId: string;
982
+ releaseRuleId: string | null;
983
+ targetId: string | null;
984
+ slotId: string | null;
985
+ actionTaken: "expired" | "released" | "retained" | "manual_override";
986
+ status: "pending" | "failed" | "completed" | "skipped";
987
+ releasedCapacity: number | null;
988
+ executedAt: Date | null;
989
+ notes: string | null;
990
+ metadata: Record<string, unknown> | null;
991
+ createdAt: Date;
992
+ updatedAt: Date;
993
+ }[];
994
+ total: number;
995
+ limit: number;
996
+ offset: number;
997
+ }>;
998
+ getReleaseExecutionById(db: PostgresJsDatabase, id: string): Promise<{
999
+ id: string;
1000
+ allotmentId: string;
1001
+ releaseRuleId: string | null;
1002
+ targetId: string | null;
1003
+ slotId: string | null;
1004
+ actionTaken: "expired" | "released" | "retained" | "manual_override";
1005
+ status: "pending" | "failed" | "completed" | "skipped";
1006
+ releasedCapacity: number | null;
1007
+ executedAt: Date | null;
1008
+ notes: string | null;
1009
+ metadata: Record<string, unknown> | null;
1010
+ createdAt: Date;
1011
+ updatedAt: Date;
1012
+ } | null>;
1013
+ createReleaseExecution(db: PostgresJsDatabase, data: CreateChannelInventoryReleaseExecutionInput): Promise<{
1014
+ createdAt: Date;
1015
+ updatedAt: Date;
1016
+ notes: string | null;
1017
+ metadata: Record<string, unknown> | null;
1018
+ id: string;
1019
+ status: "pending" | "failed" | "completed" | "skipped";
1020
+ slotId: string | null;
1021
+ allotmentId: string;
1022
+ releaseRuleId: string | null;
1023
+ targetId: string | null;
1024
+ actionTaken: "expired" | "released" | "retained" | "manual_override";
1025
+ releasedCapacity: number | null;
1026
+ executedAt: Date | null;
1027
+ } | undefined>;
1028
+ updateReleaseExecution(db: PostgresJsDatabase, id: string, data: UpdateChannelInventoryReleaseExecutionInput): Promise<{
1029
+ id: string;
1030
+ allotmentId: string;
1031
+ releaseRuleId: string | null;
1032
+ targetId: string | null;
1033
+ slotId: string | null;
1034
+ actionTaken: "expired" | "released" | "retained" | "manual_override";
1035
+ status: "pending" | "failed" | "completed" | "skipped";
1036
+ releasedCapacity: number | null;
1037
+ executedAt: Date | null;
1038
+ notes: string | null;
1039
+ metadata: Record<string, unknown> | null;
1040
+ createdAt: Date;
1041
+ updatedAt: Date;
1042
+ } | null>;
1043
+ deleteReleaseExecution(db: PostgresJsDatabase, id: string): Promise<{
1044
+ id: string;
1045
+ } | null>;
1046
+ listSettlementPolicies(db: PostgresJsDatabase, query: ChannelSettlementPolicyListQuery): Promise<{
1047
+ data: {
1048
+ id: string;
1049
+ channelId: string;
1050
+ contractId: string | null;
1051
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1052
+ autoGenerate: boolean;
1053
+ approvalRequired: boolean;
1054
+ remittanceDaysAfterPeriodEnd: number | null;
1055
+ minimumPayoutAmountCents: number | null;
1056
+ currencyCode: string | null;
1057
+ active: boolean;
1058
+ notes: string | null;
1059
+ metadata: Record<string, unknown> | null;
1060
+ createdAt: Date;
1061
+ updatedAt: Date;
1062
+ }[];
1063
+ total: number;
1064
+ limit: number;
1065
+ offset: number;
1066
+ }>;
1067
+ getSettlementPolicyById(db: PostgresJsDatabase, id: string): Promise<{
1068
+ id: string;
1069
+ channelId: string;
1070
+ contractId: string | null;
1071
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1072
+ autoGenerate: boolean;
1073
+ approvalRequired: boolean;
1074
+ remittanceDaysAfterPeriodEnd: number | null;
1075
+ minimumPayoutAmountCents: number | null;
1076
+ currencyCode: string | null;
1077
+ active: boolean;
1078
+ notes: string | null;
1079
+ metadata: Record<string, unknown> | null;
1080
+ createdAt: Date;
1081
+ updatedAt: Date;
1082
+ } | null>;
1083
+ createSettlementPolicy(db: PostgresJsDatabase, data: CreateChannelSettlementPolicyInput): Promise<{
1084
+ createdAt: Date;
1085
+ updatedAt: Date;
1086
+ notes: string | null;
1087
+ metadata: Record<string, unknown> | null;
1088
+ id: string;
1089
+ active: boolean;
1090
+ channelId: string;
1091
+ contractId: string | null;
1092
+ currencyCode: string | null;
1093
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1094
+ autoGenerate: boolean;
1095
+ approvalRequired: boolean;
1096
+ remittanceDaysAfterPeriodEnd: number | null;
1097
+ minimumPayoutAmountCents: number | null;
1098
+ } | undefined>;
1099
+ updateSettlementPolicy(db: PostgresJsDatabase, id: string, data: UpdateChannelSettlementPolicyInput): Promise<{
1100
+ id: string;
1101
+ channelId: string;
1102
+ contractId: string | null;
1103
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1104
+ autoGenerate: boolean;
1105
+ approvalRequired: boolean;
1106
+ remittanceDaysAfterPeriodEnd: number | null;
1107
+ minimumPayoutAmountCents: number | null;
1108
+ currencyCode: string | null;
1109
+ active: boolean;
1110
+ notes: string | null;
1111
+ metadata: Record<string, unknown> | null;
1112
+ createdAt: Date;
1113
+ updatedAt: Date;
1114
+ } | null>;
1115
+ deleteSettlementPolicy(db: PostgresJsDatabase, id: string): Promise<{
1116
+ id: string;
1117
+ } | null>;
1118
+ listReconciliationPolicies(db: PostgresJsDatabase, query: ChannelReconciliationPolicyListQuery): Promise<{
1119
+ data: {
1120
+ id: string;
1121
+ channelId: string;
1122
+ contractId: string | null;
1123
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1124
+ autoRun: boolean;
1125
+ compareGrossAmounts: boolean;
1126
+ compareStatuses: boolean;
1127
+ compareCancellations: boolean;
1128
+ amountToleranceCents: number | null;
1129
+ active: boolean;
1130
+ notes: string | null;
1131
+ metadata: Record<string, unknown> | null;
1132
+ createdAt: Date;
1133
+ updatedAt: Date;
1134
+ }[];
1135
+ total: number;
1136
+ limit: number;
1137
+ offset: number;
1138
+ }>;
1139
+ getReconciliationPolicyById(db: PostgresJsDatabase, id: string): Promise<{
1140
+ id: string;
1141
+ channelId: string;
1142
+ contractId: string | null;
1143
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1144
+ autoRun: boolean;
1145
+ compareGrossAmounts: boolean;
1146
+ compareStatuses: boolean;
1147
+ compareCancellations: boolean;
1148
+ amountToleranceCents: number | null;
1149
+ active: boolean;
1150
+ notes: string | null;
1151
+ metadata: Record<string, unknown> | null;
1152
+ createdAt: Date;
1153
+ updatedAt: Date;
1154
+ } | null>;
1155
+ createReconciliationPolicy(db: PostgresJsDatabase, data: CreateChannelReconciliationPolicyInput): Promise<{
1156
+ createdAt: Date;
1157
+ updatedAt: Date;
1158
+ notes: string | null;
1159
+ metadata: Record<string, unknown> | null;
1160
+ id: string;
1161
+ active: boolean;
1162
+ channelId: string;
1163
+ contractId: string | null;
1164
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1165
+ autoRun: boolean;
1166
+ compareGrossAmounts: boolean;
1167
+ compareStatuses: boolean;
1168
+ compareCancellations: boolean;
1169
+ amountToleranceCents: number | null;
1170
+ } | undefined>;
1171
+ updateReconciliationPolicy(db: PostgresJsDatabase, id: string, data: UpdateChannelReconciliationPolicyInput): Promise<{
1172
+ id: string;
1173
+ channelId: string;
1174
+ contractId: string | null;
1175
+ frequency: "manual" | "daily" | "weekly" | "monthly";
1176
+ autoRun: boolean;
1177
+ compareGrossAmounts: boolean;
1178
+ compareStatuses: boolean;
1179
+ compareCancellations: boolean;
1180
+ amountToleranceCents: number | null;
1181
+ active: boolean;
1182
+ notes: string | null;
1183
+ metadata: Record<string, unknown> | null;
1184
+ createdAt: Date;
1185
+ updatedAt: Date;
1186
+ } | null>;
1187
+ deleteReconciliationPolicy(db: PostgresJsDatabase, id: string): Promise<{
1188
+ id: string;
1189
+ } | null>;
1190
+ listReleaseSchedules(db: PostgresJsDatabase, query: ChannelReleaseScheduleListQuery): Promise<{
1191
+ data: {
1192
+ id: string;
1193
+ releaseRuleId: string;
1194
+ scheduleKind: "manual" | "daily" | "hourly";
1195
+ nextRunAt: Date | null;
1196
+ lastRunAt: Date | null;
1197
+ active: boolean;
1198
+ notes: string | null;
1199
+ metadata: Record<string, unknown> | null;
1200
+ createdAt: Date;
1201
+ updatedAt: Date;
1202
+ }[];
1203
+ total: number;
1204
+ limit: number;
1205
+ offset: number;
1206
+ }>;
1207
+ getReleaseScheduleById(db: PostgresJsDatabase, id: string): Promise<{
1208
+ id: string;
1209
+ releaseRuleId: string;
1210
+ scheduleKind: "manual" | "daily" | "hourly";
1211
+ nextRunAt: Date | null;
1212
+ lastRunAt: Date | null;
1213
+ active: boolean;
1214
+ notes: string | null;
1215
+ metadata: Record<string, unknown> | null;
1216
+ createdAt: Date;
1217
+ updatedAt: Date;
1218
+ } | null>;
1219
+ createReleaseSchedule(db: PostgresJsDatabase, data: CreateChannelReleaseScheduleInput): Promise<{
1220
+ createdAt: Date;
1221
+ updatedAt: Date;
1222
+ notes: string | null;
1223
+ metadata: Record<string, unknown> | null;
1224
+ id: string;
1225
+ active: boolean;
1226
+ releaseRuleId: string;
1227
+ scheduleKind: "manual" | "daily" | "hourly";
1228
+ nextRunAt: Date | null;
1229
+ lastRunAt: Date | null;
1230
+ } | undefined>;
1231
+ updateReleaseSchedule(db: PostgresJsDatabase, id: string, data: UpdateChannelReleaseScheduleInput): Promise<{
1232
+ id: string;
1233
+ releaseRuleId: string;
1234
+ scheduleKind: "manual" | "daily" | "hourly";
1235
+ nextRunAt: Date | null;
1236
+ lastRunAt: Date | null;
1237
+ active: boolean;
1238
+ notes: string | null;
1239
+ metadata: Record<string, unknown> | null;
1240
+ createdAt: Date;
1241
+ updatedAt: Date;
1242
+ } | null>;
1243
+ deleteReleaseSchedule(db: PostgresJsDatabase, id: string): Promise<{
1244
+ id: string;
1245
+ } | null>;
1246
+ listRemittanceExceptions(db: PostgresJsDatabase, query: ChannelRemittanceExceptionListQuery): Promise<{
1247
+ data: {
1248
+ id: string;
1249
+ channelId: string;
1250
+ settlementItemId: string | null;
1251
+ reconciliationItemId: string | null;
1252
+ exceptionType: string;
1253
+ severity: "error" | "info" | "warning";
1254
+ status: "open" | "ignored" | "resolved" | "investigating";
1255
+ openedAt: Date;
1256
+ resolvedAt: Date | null;
1257
+ notes: string | null;
1258
+ metadata: Record<string, unknown> | null;
1259
+ createdAt: Date;
1260
+ updatedAt: Date;
1261
+ }[];
1262
+ total: number;
1263
+ limit: number;
1264
+ offset: number;
1265
+ }>;
1266
+ getRemittanceExceptionById(db: PostgresJsDatabase, id: string): Promise<{
1267
+ id: string;
1268
+ channelId: string;
1269
+ settlementItemId: string | null;
1270
+ reconciliationItemId: string | null;
1271
+ exceptionType: string;
1272
+ severity: "error" | "info" | "warning";
1273
+ status: "open" | "ignored" | "resolved" | "investigating";
1274
+ openedAt: Date;
1275
+ resolvedAt: Date | null;
1276
+ notes: string | null;
1277
+ metadata: Record<string, unknown> | null;
1278
+ createdAt: Date;
1279
+ updatedAt: Date;
1280
+ } | null>;
1281
+ createRemittanceException(db: PostgresJsDatabase, data: CreateChannelRemittanceExceptionInput): Promise<{
1282
+ createdAt: Date;
1283
+ updatedAt: Date;
1284
+ notes: string | null;
1285
+ metadata: Record<string, unknown> | null;
1286
+ id: string;
1287
+ status: "open" | "ignored" | "resolved" | "investigating";
1288
+ channelId: string;
1289
+ severity: "error" | "info" | "warning";
1290
+ resolvedAt: Date | null;
1291
+ settlementItemId: string | null;
1292
+ reconciliationItemId: string | null;
1293
+ exceptionType: string;
1294
+ openedAt: Date;
1295
+ } | undefined>;
1296
+ updateRemittanceException(db: PostgresJsDatabase, id: string, data: UpdateChannelRemittanceExceptionInput): Promise<{
1297
+ id: string;
1298
+ channelId: string;
1299
+ settlementItemId: string | null;
1300
+ reconciliationItemId: string | null;
1301
+ exceptionType: string;
1302
+ severity: "error" | "info" | "warning";
1303
+ status: "open" | "ignored" | "resolved" | "investigating";
1304
+ openedAt: Date;
1305
+ resolvedAt: Date | null;
1306
+ notes: string | null;
1307
+ metadata: Record<string, unknown> | null;
1308
+ createdAt: Date;
1309
+ updatedAt: Date;
1310
+ } | null>;
1311
+ deleteRemittanceException(db: PostgresJsDatabase, id: string): Promise<{
1312
+ id: string;
1313
+ } | null>;
1314
+ listSettlementApprovals(db: PostgresJsDatabase, query: ChannelSettlementApprovalListQuery): Promise<{
1315
+ data: {
1316
+ id: string;
1317
+ settlementRunId: string;
1318
+ approverUserId: string | null;
1319
+ status: "pending" | "approved" | "rejected";
1320
+ decidedAt: Date | null;
1321
+ notes: string | null;
1322
+ metadata: Record<string, unknown> | null;
1323
+ createdAt: Date;
1324
+ updatedAt: Date;
1325
+ }[];
1326
+ total: number;
1327
+ limit: number;
1328
+ offset: number;
1329
+ }>;
1330
+ getSettlementApprovalById(db: PostgresJsDatabase, id: string): Promise<{
1331
+ id: string;
1332
+ settlementRunId: string;
1333
+ approverUserId: string | null;
1334
+ status: "pending" | "approved" | "rejected";
1335
+ decidedAt: Date | null;
1336
+ notes: string | null;
1337
+ metadata: Record<string, unknown> | null;
1338
+ createdAt: Date;
1339
+ updatedAt: Date;
1340
+ } | null>;
1341
+ createSettlementApproval(db: PostgresJsDatabase, data: CreateChannelSettlementApprovalInput): Promise<{
1342
+ createdAt: Date;
1343
+ updatedAt: Date;
1344
+ notes: string | null;
1345
+ metadata: Record<string, unknown> | null;
1346
+ id: string;
1347
+ status: "pending" | "approved" | "rejected";
1348
+ settlementRunId: string;
1349
+ approverUserId: string | null;
1350
+ decidedAt: Date | null;
1351
+ } | undefined>;
1352
+ updateSettlementApproval(db: PostgresJsDatabase, id: string, data: UpdateChannelSettlementApprovalInput): Promise<{
1353
+ id: string;
1354
+ settlementRunId: string;
1355
+ approverUserId: string | null;
1356
+ status: "pending" | "approved" | "rejected";
1357
+ decidedAt: Date | null;
1358
+ notes: string | null;
1359
+ metadata: Record<string, unknown> | null;
1360
+ createdAt: Date;
1361
+ updatedAt: Date;
1362
+ } | null>;
1363
+ deleteSettlementApproval(db: PostgresJsDatabase, id: string): Promise<{
1364
+ id: string;
1365
+ } | null>;
1366
+ };
1367
+ export type HydratedChannel = Channel & ChannelHydratedFields;
1368
+ export {};
1369
+ //# sourceMappingURL=service.d.ts.map