@voyant-travel/commerce 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.
Files changed (210) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +145 -0
  3. package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts +2 -0
  4. package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts.map +1 -0
  5. package/dist/accepted-quote-version-reservation-golden-flow.test.js +398 -0
  6. package/dist/index.d.ts +15 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +14 -0
  9. package/dist/interface.d.ts +18 -0
  10. package/dist/interface.d.ts.map +1 -0
  11. package/dist/interface.js +246 -0
  12. package/dist/interface.test.d.ts +2 -0
  13. package/dist/interface.test.d.ts.map +1 -0
  14. package/dist/interface.test.js +357 -0
  15. package/dist/markets/index.d.ts +11 -0
  16. package/dist/markets/index.d.ts.map +1 -0
  17. package/dist/markets/index.js +12 -0
  18. package/dist/markets/routes.d.ts +1182 -0
  19. package/dist/markets/routes.d.ts.map +1 -0
  20. package/dist/markets/routes.js +209 -0
  21. package/dist/markets/schema.d.ts +1527 -0
  22. package/dist/markets/schema.d.ts.map +1 -0
  23. package/dist/markets/schema.js +240 -0
  24. package/dist/markets/service-core.d.ts +253 -0
  25. package/dist/markets/service-core.d.ts.map +1 -0
  26. package/dist/markets/service-core.js +242 -0
  27. package/dist/markets/service-rules.d.ts +191 -0
  28. package/dist/markets/service-rules.d.ts.map +1 -0
  29. package/dist/markets/service-rules.js +155 -0
  30. package/dist/markets/service-shared.d.ts +36 -0
  31. package/dist/markets/service-shared.d.ts.map +1 -0
  32. package/dist/markets/service-shared.js +7 -0
  33. package/dist/markets/service.d.ts +43 -0
  34. package/dist/markets/service.d.ts.map +1 -0
  35. package/dist/markets/service.js +42 -0
  36. package/dist/markets/validation.d.ts +451 -0
  37. package/dist/markets/validation.d.ts.map +1 -0
  38. package/dist/markets/validation.js +160 -0
  39. package/dist/pricing/events.d.ts +53 -0
  40. package/dist/pricing/events.d.ts.map +1 -0
  41. package/dist/pricing/events.js +28 -0
  42. package/dist/pricing/index.d.ts +15 -0
  43. package/dist/pricing/index.d.ts.map +1 -0
  44. package/dist/pricing/index.js +18 -0
  45. package/dist/pricing/routes-core.d.ts +981 -0
  46. package/dist/pricing/routes-core.d.ts.map +1 -0
  47. package/dist/pricing/routes-core.js +102 -0
  48. package/dist/pricing/routes-public.d.ts +136 -0
  49. package/dist/pricing/routes-public.d.ts.map +1 -0
  50. package/dist/pricing/routes-public.js +14 -0
  51. package/dist/pricing/routes-rules.d.ts +1339 -0
  52. package/dist/pricing/routes-rules.d.ts.map +1 -0
  53. package/dist/pricing/routes-rules.js +138 -0
  54. package/dist/pricing/routes-shared.d.ts +14 -0
  55. package/dist/pricing/routes-shared.d.ts.map +1 -0
  56. package/dist/pricing/routes-shared.js +3 -0
  57. package/dist/pricing/routes.d.ts +7 -0
  58. package/dist/pricing/routes.d.ts.map +1 -0
  59. package/dist/pricing/routes.js +6 -0
  60. package/dist/pricing/schema-catalogs.d.ts +467 -0
  61. package/dist/pricing/schema-catalogs.d.ts.map +1 -0
  62. package/dist/pricing/schema-catalogs.js +47 -0
  63. package/dist/pricing/schema-categories.d.ts +497 -0
  64. package/dist/pricing/schema-categories.d.ts.map +1 -0
  65. package/dist/pricing/schema-categories.js +54 -0
  66. package/dist/pricing/schema-departure-overrides.d.ts +228 -0
  67. package/dist/pricing/schema-departure-overrides.d.ts.map +1 -0
  68. package/dist/pricing/schema-departure-overrides.js +36 -0
  69. package/dist/pricing/schema-option-rules.d.ts +1770 -0
  70. package/dist/pricing/schema-option-rules.d.ts.map +1 -0
  71. package/dist/pricing/schema-option-rules.js +181 -0
  72. package/dist/pricing/schema-policies.d.ts +395 -0
  73. package/dist/pricing/schema-policies.d.ts.map +1 -0
  74. package/dist/pricing/schema-policies.js +41 -0
  75. package/dist/pricing/schema-relations.d.ts +59 -0
  76. package/dist/pricing/schema-relations.d.ts.map +1 -0
  77. package/dist/pricing/schema-relations.js +111 -0
  78. package/dist/pricing/schema-shared.d.ts +11 -0
  79. package/dist/pricing/schema-shared.d.ts.map +1 -0
  80. package/dist/pricing/schema-shared.js +67 -0
  81. package/dist/pricing/schema.d.ts +8 -0
  82. package/dist/pricing/schema.d.ts.map +1 -0
  83. package/dist/pricing/schema.js +7 -0
  84. package/dist/pricing/service-catalog-plane-pricing.d.ts +95 -0
  85. package/dist/pricing/service-catalog-plane-pricing.d.ts.map +1 -0
  86. package/dist/pricing/service-catalog-plane-pricing.js +382 -0
  87. package/dist/pricing/service-catalogs.d.ts +139 -0
  88. package/dist/pricing/service-catalogs.d.ts.map +1 -0
  89. package/dist/pricing/service-catalogs.js +89 -0
  90. package/dist/pricing/service-categories.d.ts +147 -0
  91. package/dist/pricing/service-categories.d.ts.map +1 -0
  92. package/dist/pricing/service-categories.js +105 -0
  93. package/dist/pricing/service-departure-overrides.d.ts +67 -0
  94. package/dist/pricing/service-departure-overrides.d.ts.map +1 -0
  95. package/dist/pricing/service-departure-overrides.js +54 -0
  96. package/dist/pricing/service-option-rules.d.ts +321 -0
  97. package/dist/pricing/service-option-rules.d.ts.map +1 -0
  98. package/dist/pricing/service-option-rules.js +340 -0
  99. package/dist/pricing/service-policies.d.ts +123 -0
  100. package/dist/pricing/service-policies.d.ts.map +1 -0
  101. package/dist/pricing/service-policies.js +95 -0
  102. package/dist/pricing/service-public.d.ts +89 -0
  103. package/dist/pricing/service-public.d.ts.map +1 -0
  104. package/dist/pricing/service-public.js +473 -0
  105. package/dist/pricing/service-rule-resolver.d.ts +67 -0
  106. package/dist/pricing/service-rule-resolver.d.ts.map +1 -0
  107. package/dist/pricing/service-rule-resolver.js +204 -0
  108. package/dist/pricing/service-shared.d.ts +53 -0
  109. package/dist/pricing/service-shared.d.ts.map +1 -0
  110. package/dist/pricing/service-shared.js +4 -0
  111. package/dist/pricing/service-transfer-rules.d.ts +211 -0
  112. package/dist/pricing/service-transfer-rules.d.ts.map +1 -0
  113. package/dist/pricing/service-transfer-rules.js +139 -0
  114. package/dist/pricing/service.d.ts +79 -0
  115. package/dist/pricing/service.d.ts.map +1 -0
  116. package/dist/pricing/service.js +78 -0
  117. package/dist/pricing/validation-public.d.ts +412 -0
  118. package/dist/pricing/validation-public.d.ts.map +1 -0
  119. package/dist/pricing/validation-public.js +111 -0
  120. package/dist/pricing/validation-shared.d.ts +71 -0
  121. package/dist/pricing/validation-shared.d.ts.map +1 -0
  122. package/dist/pricing/validation-shared.js +63 -0
  123. package/dist/pricing/validation.d.ts +987 -0
  124. package/dist/pricing/validation.d.ts.map +1 -0
  125. package/dist/pricing/validation.js +307 -0
  126. package/dist/promotions/events.d.ts +38 -0
  127. package/dist/promotions/events.d.ts.map +1 -0
  128. package/dist/promotions/events.js +25 -0
  129. package/dist/promotions/index.d.ts +12 -0
  130. package/dist/promotions/index.d.ts.map +1 -0
  131. package/dist/promotions/index.js +17 -0
  132. package/dist/promotions/routes-shared.d.ts +14 -0
  133. package/dist/promotions/routes-shared.d.ts.map +1 -0
  134. package/dist/promotions/routes-shared.js +3 -0
  135. package/dist/promotions/routes.d.ts +395 -0
  136. package/dist/promotions/routes.d.ts.map +1 -0
  137. package/dist/promotions/routes.js +55 -0
  138. package/dist/promotions/schema.d.ts +675 -0
  139. package/dist/promotions/schema.d.ts.map +1 -0
  140. package/dist/promotions/schema.js +126 -0
  141. package/dist/promotions/service-booking-confirmed.d.ts +77 -0
  142. package/dist/promotions/service-booking-confirmed.d.ts.map +1 -0
  143. package/dist/promotions/service-booking-confirmed.js +134 -0
  144. package/dist/promotions/service-boundary-scheduler.d.ts +85 -0
  145. package/dist/promotions/service-boundary-scheduler.d.ts.map +1 -0
  146. package/dist/promotions/service-boundary-scheduler.js +141 -0
  147. package/dist/promotions/service-catalog-evaluator.d.ts +22 -0
  148. package/dist/promotions/service-catalog-evaluator.d.ts.map +1 -0
  149. package/dist/promotions/service-catalog-evaluator.js +33 -0
  150. package/dist/promotions/service-catalog-plane-promotions.d.ts +73 -0
  151. package/dist/promotions/service-catalog-plane-promotions.d.ts.map +1 -0
  152. package/dist/promotions/service-catalog-plane-promotions.js +118 -0
  153. package/dist/promotions/service-evaluator.d.ts +134 -0
  154. package/dist/promotions/service-evaluator.d.ts.map +1 -0
  155. package/dist/promotions/service-evaluator.js +302 -0
  156. package/dist/promotions/service-storefront.d.ts +147 -0
  157. package/dist/promotions/service-storefront.d.ts.map +1 -0
  158. package/dist/promotions/service-storefront.js +326 -0
  159. package/dist/promotions/service.d.ts +143 -0
  160. package/dist/promotions/service.d.ts.map +1 -0
  161. package/dist/promotions/service.js +359 -0
  162. package/dist/promotions/validation.d.ts +195 -0
  163. package/dist/promotions/validation.d.ts.map +1 -0
  164. package/dist/promotions/validation.js +167 -0
  165. package/dist/promotions/workflow-bulk-reindex.d.ts +36 -0
  166. package/dist/promotions/workflow-bulk-reindex.d.ts.map +1 -0
  167. package/dist/promotions/workflow-bulk-reindex.js +53 -0
  168. package/dist/promotions/workflow-runtime.d.ts +17 -0
  169. package/dist/promotions/workflow-runtime.d.ts.map +1 -0
  170. package/dist/promotions/workflow-runtime.js +9 -0
  171. package/dist/runtime.d.ts +18 -0
  172. package/dist/runtime.d.ts.map +1 -0
  173. package/dist/runtime.js +27 -0
  174. package/dist/runtime.test.d.ts +2 -0
  175. package/dist/runtime.test.d.ts.map +1 -0
  176. package/dist/runtime.test.js +25 -0
  177. package/dist/schema.d.ts +5 -0
  178. package/dist/schema.d.ts.map +1 -0
  179. package/dist/schema.js +4 -0
  180. package/dist/sellability/index.d.ts +13 -0
  181. package/dist/sellability/index.d.ts.map +1 -0
  182. package/dist/sellability/index.js +17 -0
  183. package/dist/sellability/routes.d.ts +2332 -0
  184. package/dist/sellability/routes.d.ts.map +1 -0
  185. package/dist/sellability/routes.js +166 -0
  186. package/dist/sellability/schema.d.ts +1716 -0
  187. package/dist/sellability/schema.d.ts.map +1 -0
  188. package/dist/sellability/schema.js +278 -0
  189. package/dist/sellability/service-records.d.ts +316 -0
  190. package/dist/sellability/service-records.d.ts.map +1 -0
  191. package/dist/sellability/service-records.js +253 -0
  192. package/dist/sellability/service-resolve.d.ts +72 -0
  193. package/dist/sellability/service-resolve.d.ts.map +1 -0
  194. package/dist/sellability/service-resolve.js +580 -0
  195. package/dist/sellability/service-shared.d.ts +124 -0
  196. package/dist/sellability/service-shared.d.ts.map +1 -0
  197. package/dist/sellability/service-shared.js +96 -0
  198. package/dist/sellability/service-snapshots.d.ts +191 -0
  199. package/dist/sellability/service-snapshots.d.ts.map +1 -0
  200. package/dist/sellability/service-snapshots.js +153 -0
  201. package/dist/sellability/service.d.ts +1038 -0
  202. package/dist/sellability/service.d.ts.map +1 -0
  203. package/dist/sellability/service.js +17 -0
  204. package/dist/sellability/validation.d.ts +477 -0
  205. package/dist/sellability/validation.d.ts.map +1 -0
  206. package/dist/sellability/validation.js +192 -0
  207. package/dist/types.d.ts +239 -0
  208. package/dist/types.d.ts.map +1 -0
  209. package/dist/types.js +1 -0
  210. package/package.json +62 -0
@@ -0,0 +1,1038 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import { resolve } from "./service-resolve.js";
3
+ import { getSnapshotById, listSnapshotItems, listSnapshots } from "./service-snapshots.js";
4
+ import type { SellabilityPersistSnapshotInput } from "./validation.js";
5
+ export type SellabilityServiceOptions = Record<string, never>;
6
+ export declare function createSellabilityService(_options?: SellabilityServiceOptions): {
7
+ resolve: typeof resolve;
8
+ listPolicies(db: PostgresJsDatabase, query: {
9
+ limit: number;
10
+ offset: number;
11
+ scope?: "market" | "channel" | "global" | "product" | "option" | undefined;
12
+ policyType?: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window" | undefined;
13
+ productId?: string | undefined;
14
+ optionId?: string | undefined;
15
+ marketId?: string | undefined;
16
+ channelId?: string | undefined;
17
+ active?: boolean | undefined;
18
+ }): Promise<{
19
+ data: {
20
+ id: string;
21
+ name: string;
22
+ scope: "market" | "channel" | "global" | "product" | "option";
23
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
24
+ productId: string | null;
25
+ optionId: string | null;
26
+ marketId: string | null;
27
+ channelId: string | null;
28
+ priority: number;
29
+ active: boolean;
30
+ conditions: Record<string, unknown>;
31
+ effects: Record<string, unknown>;
32
+ notes: string | null;
33
+ metadata: Record<string, unknown> | null;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ }[];
37
+ total: number;
38
+ limit: number;
39
+ offset: number;
40
+ }>;
41
+ getPolicyById(db: PostgresJsDatabase, id: string): Promise<{
42
+ id: string;
43
+ name: string;
44
+ scope: "market" | "channel" | "global" | "product" | "option";
45
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
46
+ productId: string | null;
47
+ optionId: string | null;
48
+ marketId: string | null;
49
+ channelId: string | null;
50
+ priority: number;
51
+ active: boolean;
52
+ conditions: Record<string, unknown>;
53
+ effects: Record<string, unknown>;
54
+ notes: string | null;
55
+ metadata: Record<string, unknown> | null;
56
+ createdAt: Date;
57
+ updatedAt: Date;
58
+ } | null>;
59
+ createPolicy(db: PostgresJsDatabase, data: {
60
+ name: string;
61
+ scope: "market" | "channel" | "global" | "product" | "option";
62
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
63
+ priority: number;
64
+ active: boolean;
65
+ conditions: Record<string, unknown>;
66
+ effects: Record<string, unknown>;
67
+ productId?: string | null | undefined;
68
+ optionId?: string | null | undefined;
69
+ marketId?: string | null | undefined;
70
+ channelId?: string | null | undefined;
71
+ notes?: string | null | undefined;
72
+ metadata?: Record<string, unknown> | null | undefined;
73
+ }): Promise<{
74
+ id: string;
75
+ active: boolean;
76
+ metadata: Record<string, unknown> | null;
77
+ name: string;
78
+ createdAt: Date;
79
+ updatedAt: Date;
80
+ marketId: string | null;
81
+ notes: string | null;
82
+ priority: number;
83
+ productId: string | null;
84
+ optionId: string | null;
85
+ channelId: string | null;
86
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
87
+ scope: "market" | "channel" | "global" | "product" | "option";
88
+ conditions: Record<string, unknown>;
89
+ effects: Record<string, unknown>;
90
+ } | null>;
91
+ updatePolicy(db: PostgresJsDatabase, id: string, data: {
92
+ name?: string | undefined;
93
+ scope?: "market" | "channel" | "global" | "product" | "option" | undefined;
94
+ policyType?: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window" | undefined;
95
+ productId?: string | null | undefined;
96
+ optionId?: string | null | undefined;
97
+ marketId?: string | null | undefined;
98
+ channelId?: string | null | undefined;
99
+ priority?: number | undefined;
100
+ active?: boolean | undefined;
101
+ conditions?: Record<string, unknown> | undefined;
102
+ effects?: Record<string, unknown> | undefined;
103
+ notes?: string | null | undefined;
104
+ metadata?: Record<string, unknown> | null | undefined;
105
+ }): Promise<{
106
+ id: string;
107
+ name: string;
108
+ scope: "market" | "channel" | "global" | "product" | "option";
109
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
110
+ productId: string | null;
111
+ optionId: string | null;
112
+ marketId: string | null;
113
+ channelId: string | null;
114
+ priority: number;
115
+ active: boolean;
116
+ conditions: Record<string, unknown>;
117
+ effects: Record<string, unknown>;
118
+ notes: string | null;
119
+ metadata: Record<string, unknown> | null;
120
+ createdAt: Date;
121
+ updatedAt: Date;
122
+ } | null>;
123
+ deletePolicy(db: PostgresJsDatabase, id: string): Promise<{
124
+ id: string;
125
+ } | null>;
126
+ listPolicyResults(db: PostgresJsDatabase, query: {
127
+ limit: number;
128
+ offset: number;
129
+ snapshotId?: string | undefined;
130
+ snapshotItemId?: string | undefined;
131
+ policyId?: string | undefined;
132
+ status?: "blocked" | "passed" | "warning" | "adjusted" | undefined;
133
+ }): Promise<{
134
+ data: {
135
+ id: string;
136
+ snapshotId: string;
137
+ snapshotItemId: string | null;
138
+ policyId: string | null;
139
+ candidateIndex: number;
140
+ status: "blocked" | "passed" | "warning" | "adjusted";
141
+ message: string | null;
142
+ details: Record<string, unknown> | null;
143
+ createdAt: Date;
144
+ }[];
145
+ total: number;
146
+ limit: number;
147
+ offset: number;
148
+ }>;
149
+ getPolicyResultById(db: PostgresJsDatabase, id: string): Promise<{
150
+ id: string;
151
+ snapshotId: string;
152
+ snapshotItemId: string | null;
153
+ policyId: string | null;
154
+ candidateIndex: number;
155
+ status: "blocked" | "passed" | "warning" | "adjusted";
156
+ message: string | null;
157
+ details: Record<string, unknown> | null;
158
+ createdAt: Date;
159
+ } | null>;
160
+ createPolicyResult(db: PostgresJsDatabase, data: {
161
+ snapshotId: string;
162
+ candidateIndex: number;
163
+ status: "blocked" | "passed" | "warning" | "adjusted";
164
+ snapshotItemId?: string | null | undefined;
165
+ policyId?: string | null | undefined;
166
+ message?: string | null | undefined;
167
+ details?: Record<string, unknown> | null | undefined;
168
+ }): Promise<{
169
+ id: string;
170
+ status: "blocked" | "passed" | "warning" | "adjusted";
171
+ snapshotId: string;
172
+ message: string | null;
173
+ createdAt: Date;
174
+ candidateIndex: number;
175
+ snapshotItemId: string | null;
176
+ policyId: string | null;
177
+ details: Record<string, unknown> | null;
178
+ } | null>;
179
+ updatePolicyResult(db: PostgresJsDatabase, id: string, data: {
180
+ snapshotId?: string | undefined;
181
+ snapshotItemId?: string | null | undefined;
182
+ policyId?: string | null | undefined;
183
+ candidateIndex?: number | undefined;
184
+ status?: "blocked" | "passed" | "warning" | "adjusted" | undefined;
185
+ message?: string | null | undefined;
186
+ details?: Record<string, unknown> | null | undefined;
187
+ }): Promise<{
188
+ id: string;
189
+ snapshotId: string;
190
+ snapshotItemId: string | null;
191
+ policyId: string | null;
192
+ candidateIndex: number;
193
+ status: "blocked" | "passed" | "warning" | "adjusted";
194
+ message: string | null;
195
+ details: Record<string, unknown> | null;
196
+ createdAt: Date;
197
+ } | null>;
198
+ deletePolicyResult(db: PostgresJsDatabase, id: string): Promise<{
199
+ id: string;
200
+ } | null>;
201
+ listOfferRefreshRuns(db: PostgresJsDatabase, query: {
202
+ limit: number;
203
+ offset: number;
204
+ offerId?: string | undefined;
205
+ snapshotId?: string | undefined;
206
+ status?: "expired" | "pending" | "running" | "completed" | "failed" | undefined;
207
+ }): Promise<{
208
+ data: {
209
+ id: string;
210
+ offerId: string;
211
+ snapshotId: string | null;
212
+ status: "expired" | "pending" | "running" | "completed" | "failed";
213
+ startedAt: Date;
214
+ completedAt: Date | null;
215
+ notes: string | null;
216
+ metadata: Record<string, unknown> | null;
217
+ createdAt: Date;
218
+ updatedAt: Date;
219
+ }[];
220
+ total: number;
221
+ limit: number;
222
+ offset: number;
223
+ }>;
224
+ getOfferRefreshRunById(db: PostgresJsDatabase, id: string): Promise<{
225
+ id: string;
226
+ offerId: string;
227
+ snapshotId: string | null;
228
+ status: "expired" | "pending" | "running" | "completed" | "failed";
229
+ startedAt: Date;
230
+ completedAt: Date | null;
231
+ notes: string | null;
232
+ metadata: Record<string, unknown> | null;
233
+ createdAt: Date;
234
+ updatedAt: Date;
235
+ } | null>;
236
+ createOfferRefreshRun(db: PostgresJsDatabase, data: {
237
+ offerId: string;
238
+ status: "expired" | "pending" | "running" | "completed" | "failed";
239
+ snapshotId?: string | null | undefined;
240
+ startedAt?: string | null | undefined;
241
+ completedAt?: string | null | undefined;
242
+ notes?: string | null | undefined;
243
+ metadata?: Record<string, unknown> | null | undefined;
244
+ }): Promise<{
245
+ id: string;
246
+ status: "expired" | "pending" | "running" | "completed" | "failed";
247
+ snapshotId: string | null;
248
+ metadata: Record<string, unknown> | null;
249
+ createdAt: Date;
250
+ updatedAt: Date;
251
+ notes: string | null;
252
+ offerId: string;
253
+ startedAt: Date;
254
+ completedAt: Date | null;
255
+ } | null>;
256
+ updateOfferRefreshRun(db: PostgresJsDatabase, id: string, data: {
257
+ offerId?: string | undefined;
258
+ snapshotId?: string | null | undefined;
259
+ status?: "expired" | "pending" | "running" | "completed" | "failed" | undefined;
260
+ startedAt?: string | null | undefined;
261
+ completedAt?: string | null | undefined;
262
+ notes?: string | null | undefined;
263
+ metadata?: Record<string, unknown> | null | undefined;
264
+ }): Promise<{
265
+ id: string;
266
+ offerId: string;
267
+ snapshotId: string | null;
268
+ status: "expired" | "pending" | "running" | "completed" | "failed";
269
+ startedAt: Date;
270
+ completedAt: Date | null;
271
+ notes: string | null;
272
+ metadata: Record<string, unknown> | null;
273
+ createdAt: Date;
274
+ updatedAt: Date;
275
+ } | null>;
276
+ deleteOfferRefreshRun(db: PostgresJsDatabase, id: string): Promise<{
277
+ id: string;
278
+ } | null>;
279
+ listOfferExpirationEvents(db: PostgresJsDatabase, query: {
280
+ limit: number;
281
+ offset: number;
282
+ offerId?: string | undefined;
283
+ snapshotId?: string | undefined;
284
+ status?: "superseded" | "cancelled" | "scheduled" | "expired" | undefined;
285
+ }): Promise<{
286
+ data: {
287
+ id: string;
288
+ offerId: string;
289
+ snapshotId: string | null;
290
+ expiresAt: Date;
291
+ expiredAt: Date | null;
292
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
293
+ reason: string | null;
294
+ metadata: Record<string, unknown> | null;
295
+ createdAt: Date;
296
+ updatedAt: Date;
297
+ }[];
298
+ total: number;
299
+ limit: number;
300
+ offset: number;
301
+ }>;
302
+ getOfferExpirationEventById(db: PostgresJsDatabase, id: string): Promise<{
303
+ id: string;
304
+ offerId: string;
305
+ snapshotId: string | null;
306
+ expiresAt: Date;
307
+ expiredAt: Date | null;
308
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
309
+ reason: string | null;
310
+ metadata: Record<string, unknown> | null;
311
+ createdAt: Date;
312
+ updatedAt: Date;
313
+ } | null>;
314
+ createOfferExpirationEvent(db: PostgresJsDatabase, data: {
315
+ offerId: string;
316
+ expiresAt: string;
317
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
318
+ snapshotId?: string | null | undefined;
319
+ expiredAt?: string | null | undefined;
320
+ reason?: string | null | undefined;
321
+ metadata?: Record<string, unknown> | null | undefined;
322
+ }): Promise<{
323
+ id: string;
324
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
325
+ reason: string | null;
326
+ snapshotId: string | null;
327
+ metadata: Record<string, unknown> | null;
328
+ createdAt: Date;
329
+ updatedAt: Date;
330
+ offerId: string;
331
+ expiresAt: Date;
332
+ expiredAt: Date | null;
333
+ } | null>;
334
+ updateOfferExpirationEvent(db: PostgresJsDatabase, id: string, data: {
335
+ offerId?: string | undefined;
336
+ snapshotId?: string | null | undefined;
337
+ expiresAt?: string | undefined;
338
+ expiredAt?: string | null | undefined;
339
+ status?: "superseded" | "cancelled" | "scheduled" | "expired" | undefined;
340
+ reason?: string | null | undefined;
341
+ metadata?: Record<string, unknown> | null | undefined;
342
+ }): Promise<{
343
+ id: string;
344
+ offerId: string;
345
+ snapshotId: string | null;
346
+ expiresAt: Date;
347
+ expiredAt: Date | null;
348
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
349
+ reason: string | null;
350
+ metadata: Record<string, unknown> | null;
351
+ createdAt: Date;
352
+ updatedAt: Date;
353
+ } | null>;
354
+ deleteOfferExpirationEvent(db: PostgresJsDatabase, id: string): Promise<{
355
+ id: string;
356
+ } | null>;
357
+ listExplanations(db: PostgresJsDatabase, query: {
358
+ limit: number;
359
+ offset: number;
360
+ snapshotId?: string | undefined;
361
+ snapshotItemId?: string | undefined;
362
+ explanationType?: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning" | undefined;
363
+ }): Promise<{
364
+ data: {
365
+ id: string;
366
+ snapshotId: string;
367
+ snapshotItemId: string | null;
368
+ candidateIndex: number;
369
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
370
+ code: string | null;
371
+ message: string;
372
+ details: Record<string, unknown> | null;
373
+ createdAt: Date;
374
+ }[];
375
+ total: number;
376
+ limit: number;
377
+ offset: number;
378
+ }>;
379
+ getExplanationById(db: PostgresJsDatabase, id: string): Promise<{
380
+ id: string;
381
+ snapshotId: string;
382
+ snapshotItemId: string | null;
383
+ candidateIndex: number;
384
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
385
+ code: string | null;
386
+ message: string;
387
+ details: Record<string, unknown> | null;
388
+ createdAt: Date;
389
+ } | null>;
390
+ createExplanation(db: PostgresJsDatabase, data: {
391
+ snapshotId: string;
392
+ candidateIndex: number;
393
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
394
+ message: string;
395
+ snapshotItemId?: string | null | undefined;
396
+ code?: string | null | undefined;
397
+ details?: Record<string, unknown> | null | undefined;
398
+ }): Promise<{
399
+ id: string;
400
+ code: string | null;
401
+ snapshotId: string;
402
+ message: string;
403
+ createdAt: Date;
404
+ candidateIndex: number;
405
+ snapshotItemId: string | null;
406
+ details: Record<string, unknown> | null;
407
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
408
+ } | null>;
409
+ updateExplanation(db: PostgresJsDatabase, id: string, data: {
410
+ snapshotId?: string | undefined;
411
+ snapshotItemId?: string | null | undefined;
412
+ candidateIndex?: number | undefined;
413
+ explanationType?: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning" | undefined;
414
+ code?: string | null | undefined;
415
+ message?: string | undefined;
416
+ details?: Record<string, unknown> | null | undefined;
417
+ }): Promise<{
418
+ id: string;
419
+ snapshotId: string;
420
+ snapshotItemId: string | null;
421
+ candidateIndex: number;
422
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
423
+ code: string | null;
424
+ message: string;
425
+ details: Record<string, unknown> | null;
426
+ createdAt: Date;
427
+ } | null>;
428
+ deleteExplanation(db: PostgresJsDatabase, id: string): Promise<{
429
+ id: string;
430
+ } | null>;
431
+ persistSnapshot(db: PostgresJsDatabase, input: SellabilityPersistSnapshotInput): Promise<{
432
+ snapshot: {
433
+ id: string;
434
+ status: "expired" | "resolved" | "offer_constructed";
435
+ createdAt: Date;
436
+ updatedAt: Date;
437
+ marketId: string | null;
438
+ fxRateSetId: string | null;
439
+ productId: string | null;
440
+ optionId: string | null;
441
+ channelId: string | null;
442
+ offerId: string | null;
443
+ slotId: string | null;
444
+ expiresAt: Date | null;
445
+ requestedCurrencyCode: string | null;
446
+ sourceCurrencyCode: string | null;
447
+ queryPayload: Record<string, unknown>;
448
+ pricingSummary: Record<string, unknown>;
449
+ };
450
+ resolved: {
451
+ data: {
452
+ product: {
453
+ id: string;
454
+ name: string;
455
+ };
456
+ option: {
457
+ id: string;
458
+ name: string;
459
+ code: string | null;
460
+ };
461
+ slot: {
462
+ id: string;
463
+ productId: string;
464
+ optionId: string | null;
465
+ startTimeId: string | null;
466
+ dateLocal: string;
467
+ startsAt: Date | string;
468
+ timezone: string;
469
+ unlimited: boolean;
470
+ remainingPax: number | null;
471
+ remainingPickups: number | null;
472
+ pastCutoff: boolean;
473
+ tooEarly: boolean;
474
+ };
475
+ market: {
476
+ id: string;
477
+ code: string;
478
+ name: string;
479
+ } | null;
480
+ channel: {
481
+ id: string;
482
+ kind: "direct" | "reseller" | "affiliate" | "ota" | "marketplace" | "api_partner" | "connect";
483
+ } | null;
484
+ sellability: {
485
+ mode: "unavailable" | "sellable" | "on_request";
486
+ onRequest: boolean;
487
+ allotmentStatus: "sellable" | "not_applicable";
488
+ };
489
+ pricing: {
490
+ currencyCode: string;
491
+ sellAmountCents: number;
492
+ costAmountCents: number;
493
+ marginAmountCents: number;
494
+ breakdown: import("./service-shared.js").ResolvedPriceBreakdown[];
495
+ components: import("./service-shared.js").ResolvedPriceComponent[];
496
+ fx: {
497
+ fxRateSetId: string;
498
+ baseCurrency: string;
499
+ quoteCurrency: string;
500
+ rateDecimal: number;
501
+ } | null;
502
+ };
503
+ sources: {
504
+ marketProductRuleId: string | null;
505
+ marketChannelRuleId: string | null;
506
+ marketPriceCatalogId: string | null;
507
+ optionPriceRuleId: string;
508
+ optionStartTimeRuleId: string | null;
509
+ channelInventoryAllotmentIds: string[];
510
+ channelInventoryReleaseRuleId: string | null;
511
+ };
512
+ }[];
513
+ meta: {
514
+ total: number;
515
+ };
516
+ };
517
+ }>;
518
+ listSnapshots: typeof listSnapshots;
519
+ getSnapshotById: typeof getSnapshotById;
520
+ listSnapshotItems: typeof listSnapshotItems;
521
+ };
522
+ export declare const sellabilityService: {
523
+ resolve: typeof resolve;
524
+ listPolicies(db: PostgresJsDatabase, query: {
525
+ limit: number;
526
+ offset: number;
527
+ scope?: "market" | "channel" | "global" | "product" | "option" | undefined;
528
+ policyType?: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window" | undefined;
529
+ productId?: string | undefined;
530
+ optionId?: string | undefined;
531
+ marketId?: string | undefined;
532
+ channelId?: string | undefined;
533
+ active?: boolean | undefined;
534
+ }): Promise<{
535
+ data: {
536
+ id: string;
537
+ name: string;
538
+ scope: "market" | "channel" | "global" | "product" | "option";
539
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
540
+ productId: string | null;
541
+ optionId: string | null;
542
+ marketId: string | null;
543
+ channelId: string | null;
544
+ priority: number;
545
+ active: boolean;
546
+ conditions: Record<string, unknown>;
547
+ effects: Record<string, unknown>;
548
+ notes: string | null;
549
+ metadata: Record<string, unknown> | null;
550
+ createdAt: Date;
551
+ updatedAt: Date;
552
+ }[];
553
+ total: number;
554
+ limit: number;
555
+ offset: number;
556
+ }>;
557
+ getPolicyById(db: PostgresJsDatabase, id: string): Promise<{
558
+ id: string;
559
+ name: string;
560
+ scope: "market" | "channel" | "global" | "product" | "option";
561
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
562
+ productId: string | null;
563
+ optionId: string | null;
564
+ marketId: string | null;
565
+ channelId: string | null;
566
+ priority: number;
567
+ active: boolean;
568
+ conditions: Record<string, unknown>;
569
+ effects: Record<string, unknown>;
570
+ notes: string | null;
571
+ metadata: Record<string, unknown> | null;
572
+ createdAt: Date;
573
+ updatedAt: Date;
574
+ } | null>;
575
+ createPolicy(db: PostgresJsDatabase, data: {
576
+ name: string;
577
+ scope: "market" | "channel" | "global" | "product" | "option";
578
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
579
+ priority: number;
580
+ active: boolean;
581
+ conditions: Record<string, unknown>;
582
+ effects: Record<string, unknown>;
583
+ productId?: string | null | undefined;
584
+ optionId?: string | null | undefined;
585
+ marketId?: string | null | undefined;
586
+ channelId?: string | null | undefined;
587
+ notes?: string | null | undefined;
588
+ metadata?: Record<string, unknown> | null | undefined;
589
+ }): Promise<{
590
+ id: string;
591
+ active: boolean;
592
+ metadata: Record<string, unknown> | null;
593
+ name: string;
594
+ createdAt: Date;
595
+ updatedAt: Date;
596
+ marketId: string | null;
597
+ notes: string | null;
598
+ priority: number;
599
+ productId: string | null;
600
+ optionId: string | null;
601
+ channelId: string | null;
602
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
603
+ scope: "market" | "channel" | "global" | "product" | "option";
604
+ conditions: Record<string, unknown>;
605
+ effects: Record<string, unknown>;
606
+ } | null>;
607
+ updatePolicy(db: PostgresJsDatabase, id: string, data: {
608
+ name?: string | undefined;
609
+ scope?: "market" | "channel" | "global" | "product" | "option" | undefined;
610
+ policyType?: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window" | undefined;
611
+ productId?: string | null | undefined;
612
+ optionId?: string | null | undefined;
613
+ marketId?: string | null | undefined;
614
+ channelId?: string | null | undefined;
615
+ priority?: number | undefined;
616
+ active?: boolean | undefined;
617
+ conditions?: Record<string, unknown> | undefined;
618
+ effects?: Record<string, unknown> | undefined;
619
+ notes?: string | null | undefined;
620
+ metadata?: Record<string, unknown> | null | undefined;
621
+ }): Promise<{
622
+ id: string;
623
+ name: string;
624
+ scope: "market" | "channel" | "global" | "product" | "option";
625
+ policyType: "currency" | "custom" | "pickup" | "capability" | "occupancy" | "question" | "allotment" | "availability_window";
626
+ productId: string | null;
627
+ optionId: string | null;
628
+ marketId: string | null;
629
+ channelId: string | null;
630
+ priority: number;
631
+ active: boolean;
632
+ conditions: Record<string, unknown>;
633
+ effects: Record<string, unknown>;
634
+ notes: string | null;
635
+ metadata: Record<string, unknown> | null;
636
+ createdAt: Date;
637
+ updatedAt: Date;
638
+ } | null>;
639
+ deletePolicy(db: PostgresJsDatabase, id: string): Promise<{
640
+ id: string;
641
+ } | null>;
642
+ listPolicyResults(db: PostgresJsDatabase, query: {
643
+ limit: number;
644
+ offset: number;
645
+ snapshotId?: string | undefined;
646
+ snapshotItemId?: string | undefined;
647
+ policyId?: string | undefined;
648
+ status?: "blocked" | "passed" | "warning" | "adjusted" | undefined;
649
+ }): Promise<{
650
+ data: {
651
+ id: string;
652
+ snapshotId: string;
653
+ snapshotItemId: string | null;
654
+ policyId: string | null;
655
+ candidateIndex: number;
656
+ status: "blocked" | "passed" | "warning" | "adjusted";
657
+ message: string | null;
658
+ details: Record<string, unknown> | null;
659
+ createdAt: Date;
660
+ }[];
661
+ total: number;
662
+ limit: number;
663
+ offset: number;
664
+ }>;
665
+ getPolicyResultById(db: PostgresJsDatabase, id: string): Promise<{
666
+ id: string;
667
+ snapshotId: string;
668
+ snapshotItemId: string | null;
669
+ policyId: string | null;
670
+ candidateIndex: number;
671
+ status: "blocked" | "passed" | "warning" | "adjusted";
672
+ message: string | null;
673
+ details: Record<string, unknown> | null;
674
+ createdAt: Date;
675
+ } | null>;
676
+ createPolicyResult(db: PostgresJsDatabase, data: {
677
+ snapshotId: string;
678
+ candidateIndex: number;
679
+ status: "blocked" | "passed" | "warning" | "adjusted";
680
+ snapshotItemId?: string | null | undefined;
681
+ policyId?: string | null | undefined;
682
+ message?: string | null | undefined;
683
+ details?: Record<string, unknown> | null | undefined;
684
+ }): Promise<{
685
+ id: string;
686
+ status: "blocked" | "passed" | "warning" | "adjusted";
687
+ snapshotId: string;
688
+ message: string | null;
689
+ createdAt: Date;
690
+ candidateIndex: number;
691
+ snapshotItemId: string | null;
692
+ policyId: string | null;
693
+ details: Record<string, unknown> | null;
694
+ } | null>;
695
+ updatePolicyResult(db: PostgresJsDatabase, id: string, data: {
696
+ snapshotId?: string | undefined;
697
+ snapshotItemId?: string | null | undefined;
698
+ policyId?: string | null | undefined;
699
+ candidateIndex?: number | undefined;
700
+ status?: "blocked" | "passed" | "warning" | "adjusted" | undefined;
701
+ message?: string | null | undefined;
702
+ details?: Record<string, unknown> | null | undefined;
703
+ }): Promise<{
704
+ id: string;
705
+ snapshotId: string;
706
+ snapshotItemId: string | null;
707
+ policyId: string | null;
708
+ candidateIndex: number;
709
+ status: "blocked" | "passed" | "warning" | "adjusted";
710
+ message: string | null;
711
+ details: Record<string, unknown> | null;
712
+ createdAt: Date;
713
+ } | null>;
714
+ deletePolicyResult(db: PostgresJsDatabase, id: string): Promise<{
715
+ id: string;
716
+ } | null>;
717
+ listOfferRefreshRuns(db: PostgresJsDatabase, query: {
718
+ limit: number;
719
+ offset: number;
720
+ offerId?: string | undefined;
721
+ snapshotId?: string | undefined;
722
+ status?: "expired" | "pending" | "running" | "completed" | "failed" | undefined;
723
+ }): Promise<{
724
+ data: {
725
+ id: string;
726
+ offerId: string;
727
+ snapshotId: string | null;
728
+ status: "expired" | "pending" | "running" | "completed" | "failed";
729
+ startedAt: Date;
730
+ completedAt: Date | null;
731
+ notes: string | null;
732
+ metadata: Record<string, unknown> | null;
733
+ createdAt: Date;
734
+ updatedAt: Date;
735
+ }[];
736
+ total: number;
737
+ limit: number;
738
+ offset: number;
739
+ }>;
740
+ getOfferRefreshRunById(db: PostgresJsDatabase, id: string): Promise<{
741
+ id: string;
742
+ offerId: string;
743
+ snapshotId: string | null;
744
+ status: "expired" | "pending" | "running" | "completed" | "failed";
745
+ startedAt: Date;
746
+ completedAt: Date | null;
747
+ notes: string | null;
748
+ metadata: Record<string, unknown> | null;
749
+ createdAt: Date;
750
+ updatedAt: Date;
751
+ } | null>;
752
+ createOfferRefreshRun(db: PostgresJsDatabase, data: {
753
+ offerId: string;
754
+ status: "expired" | "pending" | "running" | "completed" | "failed";
755
+ snapshotId?: string | null | undefined;
756
+ startedAt?: string | null | undefined;
757
+ completedAt?: string | null | undefined;
758
+ notes?: string | null | undefined;
759
+ metadata?: Record<string, unknown> | null | undefined;
760
+ }): Promise<{
761
+ id: string;
762
+ status: "expired" | "pending" | "running" | "completed" | "failed";
763
+ snapshotId: string | null;
764
+ metadata: Record<string, unknown> | null;
765
+ createdAt: Date;
766
+ updatedAt: Date;
767
+ notes: string | null;
768
+ offerId: string;
769
+ startedAt: Date;
770
+ completedAt: Date | null;
771
+ } | null>;
772
+ updateOfferRefreshRun(db: PostgresJsDatabase, id: string, data: {
773
+ offerId?: string | undefined;
774
+ snapshotId?: string | null | undefined;
775
+ status?: "expired" | "pending" | "running" | "completed" | "failed" | undefined;
776
+ startedAt?: string | null | undefined;
777
+ completedAt?: string | null | undefined;
778
+ notes?: string | null | undefined;
779
+ metadata?: Record<string, unknown> | null | undefined;
780
+ }): Promise<{
781
+ id: string;
782
+ offerId: string;
783
+ snapshotId: string | null;
784
+ status: "expired" | "pending" | "running" | "completed" | "failed";
785
+ startedAt: Date;
786
+ completedAt: Date | null;
787
+ notes: string | null;
788
+ metadata: Record<string, unknown> | null;
789
+ createdAt: Date;
790
+ updatedAt: Date;
791
+ } | null>;
792
+ deleteOfferRefreshRun(db: PostgresJsDatabase, id: string): Promise<{
793
+ id: string;
794
+ } | null>;
795
+ listOfferExpirationEvents(db: PostgresJsDatabase, query: {
796
+ limit: number;
797
+ offset: number;
798
+ offerId?: string | undefined;
799
+ snapshotId?: string | undefined;
800
+ status?: "superseded" | "cancelled" | "scheduled" | "expired" | undefined;
801
+ }): Promise<{
802
+ data: {
803
+ id: string;
804
+ offerId: string;
805
+ snapshotId: string | null;
806
+ expiresAt: Date;
807
+ expiredAt: Date | null;
808
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
809
+ reason: string | null;
810
+ metadata: Record<string, unknown> | null;
811
+ createdAt: Date;
812
+ updatedAt: Date;
813
+ }[];
814
+ total: number;
815
+ limit: number;
816
+ offset: number;
817
+ }>;
818
+ getOfferExpirationEventById(db: PostgresJsDatabase, id: string): Promise<{
819
+ id: string;
820
+ offerId: string;
821
+ snapshotId: string | null;
822
+ expiresAt: Date;
823
+ expiredAt: Date | null;
824
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
825
+ reason: string | null;
826
+ metadata: Record<string, unknown> | null;
827
+ createdAt: Date;
828
+ updatedAt: Date;
829
+ } | null>;
830
+ createOfferExpirationEvent(db: PostgresJsDatabase, data: {
831
+ offerId: string;
832
+ expiresAt: string;
833
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
834
+ snapshotId?: string | null | undefined;
835
+ expiredAt?: string | null | undefined;
836
+ reason?: string | null | undefined;
837
+ metadata?: Record<string, unknown> | null | undefined;
838
+ }): Promise<{
839
+ id: string;
840
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
841
+ reason: string | null;
842
+ snapshotId: string | null;
843
+ metadata: Record<string, unknown> | null;
844
+ createdAt: Date;
845
+ updatedAt: Date;
846
+ offerId: string;
847
+ expiresAt: Date;
848
+ expiredAt: Date | null;
849
+ } | null>;
850
+ updateOfferExpirationEvent(db: PostgresJsDatabase, id: string, data: {
851
+ offerId?: string | undefined;
852
+ snapshotId?: string | null | undefined;
853
+ expiresAt?: string | undefined;
854
+ expiredAt?: string | null | undefined;
855
+ status?: "superseded" | "cancelled" | "scheduled" | "expired" | undefined;
856
+ reason?: string | null | undefined;
857
+ metadata?: Record<string, unknown> | null | undefined;
858
+ }): Promise<{
859
+ id: string;
860
+ offerId: string;
861
+ snapshotId: string | null;
862
+ expiresAt: Date;
863
+ expiredAt: Date | null;
864
+ status: "superseded" | "cancelled" | "scheduled" | "expired";
865
+ reason: string | null;
866
+ metadata: Record<string, unknown> | null;
867
+ createdAt: Date;
868
+ updatedAt: Date;
869
+ } | null>;
870
+ deleteOfferExpirationEvent(db: PostgresJsDatabase, id: string): Promise<{
871
+ id: string;
872
+ } | null>;
873
+ listExplanations(db: PostgresJsDatabase, query: {
874
+ limit: number;
875
+ offset: number;
876
+ snapshotId?: string | undefined;
877
+ snapshotItemId?: string | undefined;
878
+ explanationType?: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning" | undefined;
879
+ }): Promise<{
880
+ data: {
881
+ id: string;
882
+ snapshotId: string;
883
+ snapshotItemId: string | null;
884
+ candidateIndex: number;
885
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
886
+ code: string | null;
887
+ message: string;
888
+ details: Record<string, unknown> | null;
889
+ createdAt: Date;
890
+ }[];
891
+ total: number;
892
+ limit: number;
893
+ offset: number;
894
+ }>;
895
+ getExplanationById(db: PostgresJsDatabase, id: string): Promise<{
896
+ id: string;
897
+ snapshotId: string;
898
+ snapshotItemId: string | null;
899
+ candidateIndex: number;
900
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
901
+ code: string | null;
902
+ message: string;
903
+ details: Record<string, unknown> | null;
904
+ createdAt: Date;
905
+ } | null>;
906
+ createExplanation(db: PostgresJsDatabase, data: {
907
+ snapshotId: string;
908
+ candidateIndex: number;
909
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
910
+ message: string;
911
+ snapshotItemId?: string | null | undefined;
912
+ code?: string | null | undefined;
913
+ details?: Record<string, unknown> | null | undefined;
914
+ }): Promise<{
915
+ id: string;
916
+ code: string | null;
917
+ snapshotId: string;
918
+ message: string;
919
+ createdAt: Date;
920
+ candidateIndex: number;
921
+ snapshotItemId: string | null;
922
+ details: Record<string, unknown> | null;
923
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
924
+ } | null>;
925
+ updateExplanation(db: PostgresJsDatabase, id: string, data: {
926
+ snapshotId?: string | undefined;
927
+ snapshotItemId?: string | null | undefined;
928
+ candidateIndex?: number | undefined;
929
+ explanationType?: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning" | undefined;
930
+ code?: string | null | undefined;
931
+ message?: string | undefined;
932
+ details?: Record<string, unknown> | null | undefined;
933
+ }): Promise<{
934
+ id: string;
935
+ snapshotId: string;
936
+ snapshotItemId: string | null;
937
+ candidateIndex: number;
938
+ explanationType: "pricing" | "blocked" | "sellable" | "policy" | "pickup" | "allotment" | "warning";
939
+ code: string | null;
940
+ message: string;
941
+ details: Record<string, unknown> | null;
942
+ createdAt: Date;
943
+ } | null>;
944
+ deleteExplanation(db: PostgresJsDatabase, id: string): Promise<{
945
+ id: string;
946
+ } | null>;
947
+ persistSnapshot(db: PostgresJsDatabase, input: SellabilityPersistSnapshotInput): Promise<{
948
+ snapshot: {
949
+ id: string;
950
+ status: "expired" | "resolved" | "offer_constructed";
951
+ createdAt: Date;
952
+ updatedAt: Date;
953
+ marketId: string | null;
954
+ fxRateSetId: string | null;
955
+ productId: string | null;
956
+ optionId: string | null;
957
+ channelId: string | null;
958
+ offerId: string | null;
959
+ slotId: string | null;
960
+ expiresAt: Date | null;
961
+ requestedCurrencyCode: string | null;
962
+ sourceCurrencyCode: string | null;
963
+ queryPayload: Record<string, unknown>;
964
+ pricingSummary: Record<string, unknown>;
965
+ };
966
+ resolved: {
967
+ data: {
968
+ product: {
969
+ id: string;
970
+ name: string;
971
+ };
972
+ option: {
973
+ id: string;
974
+ name: string;
975
+ code: string | null;
976
+ };
977
+ slot: {
978
+ id: string;
979
+ productId: string;
980
+ optionId: string | null;
981
+ startTimeId: string | null;
982
+ dateLocal: string;
983
+ startsAt: Date | string;
984
+ timezone: string;
985
+ unlimited: boolean;
986
+ remainingPax: number | null;
987
+ remainingPickups: number | null;
988
+ pastCutoff: boolean;
989
+ tooEarly: boolean;
990
+ };
991
+ market: {
992
+ id: string;
993
+ code: string;
994
+ name: string;
995
+ } | null;
996
+ channel: {
997
+ id: string;
998
+ kind: "direct" | "reseller" | "affiliate" | "ota" | "marketplace" | "api_partner" | "connect";
999
+ } | null;
1000
+ sellability: {
1001
+ mode: "unavailable" | "sellable" | "on_request";
1002
+ onRequest: boolean;
1003
+ allotmentStatus: "sellable" | "not_applicable";
1004
+ };
1005
+ pricing: {
1006
+ currencyCode: string;
1007
+ sellAmountCents: number;
1008
+ costAmountCents: number;
1009
+ marginAmountCents: number;
1010
+ breakdown: import("./service-shared.js").ResolvedPriceBreakdown[];
1011
+ components: import("./service-shared.js").ResolvedPriceComponent[];
1012
+ fx: {
1013
+ fxRateSetId: string;
1014
+ baseCurrency: string;
1015
+ quoteCurrency: string;
1016
+ rateDecimal: number;
1017
+ } | null;
1018
+ };
1019
+ sources: {
1020
+ marketProductRuleId: string | null;
1021
+ marketChannelRuleId: string | null;
1022
+ marketPriceCatalogId: string | null;
1023
+ optionPriceRuleId: string;
1024
+ optionStartTimeRuleId: string | null;
1025
+ channelInventoryAllotmentIds: string[];
1026
+ channelInventoryReleaseRuleId: string | null;
1027
+ };
1028
+ }[];
1029
+ meta: {
1030
+ total: number;
1031
+ };
1032
+ };
1033
+ }>;
1034
+ listSnapshots: typeof listSnapshots;
1035
+ getSnapshotById: typeof getSnapshotById;
1036
+ listSnapshotItems: typeof listSnapshotItems;
1037
+ };
1038
+ //# sourceMappingURL=service.d.ts.map