@voyantjs/flights-contracts 0.96.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.
- package/README.md +45 -0
- package/dist/contract/adapter.d.ts +210 -0
- package/dist/contract/adapter.d.ts.map +1 -0
- package/dist/contract/adapter.js +43 -0
- package/dist/contract/post-book-types.d.ts +90 -0
- package/dist/contract/post-book-types.d.ts.map +1 -0
- package/dist/contract/post-book-types.js +1 -0
- package/dist/contract/schemas.d.ts +3896 -0
- package/dist/contract/schemas.d.ts.map +1 -0
- package/dist/contract/schemas.js +508 -0
- package/dist/contract/types.d.ts +504 -0
- package/dist/contract/types.d.ts.map +1 -0
- package/dist/contract/types.js +35 -0
- package/dist/contracts.test.d.ts +2 -0
- package/dist/contracts.test.d.ts.map +1 -0
- package/dist/contracts.test.js +18 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/reference/contract.d.ts +90 -0
- package/dist/reference/contract.d.ts.map +1 -0
- package/dist/reference/contract.js +26 -0
- package/dist/reference/static-bundle.d.ts +29 -0
- package/dist/reference/static-bundle.d.ts.map +1 -0
- package/dist/reference/static-bundle.js +83 -0
- package/package.json +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/contract/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,eAAO,MAAM,gBAAgB;;;;;EAA8D,CAAA;AAC3F,eAAO,MAAM,mBAAmB;;;;;;EAA0D,CAAA;AAC1F,eAAO,MAAM,uBAAuB;;;;EAA+C,CAAA;AACnF,eAAO,MAAM,uBAAuB;;;;;;EAMlC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;EAKnC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;;EAMnC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;;;EAOn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GAAG,IAAI;mBAC5C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;EAQ7D,CAAA;AAED,eAAO,MAAM,iBAAiB,uCAM7B,CAAA;AAED,eAAO,MAAM,0BAA0B;;;;;;;;uBArBtB,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;sBAC9C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;sBAC7C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;uBAC5C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;;uBAH7C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;sBAC9C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;sBAC7C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;uBAC5C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;;;;;;;;iBA6B5D,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;iBAK1C,CAAA"}
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FLIGHT_CAPABILITIES } from "./types.js";
|
|
3
|
+
const decimalStringSchema = z.string().regex(/^\d+(\.\d+)?$/);
|
|
4
|
+
const signedDecimalStringSchema = z.string().regex(/^-?\d+(\.\d+)?$/);
|
|
5
|
+
const iataCodeSchema = z.string().length(3);
|
|
6
|
+
const carrierCodeSchema = z.string().min(2).max(3);
|
|
7
|
+
const currencyCodeSchema = z.string().length(3);
|
|
8
|
+
const providerDataSchema = z.record(z.string(), z.unknown());
|
|
9
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
10
|
+
export const cabinClassSchema = z.enum(["economy", "premium_economy", "business", "first"]);
|
|
11
|
+
export const passengerTypeSchema = z.enum(["adult", "child", "infant", "senior", "youth"]);
|
|
12
|
+
export const paymentIntentTypeSchema = z.enum(["hold", "card", "ticket_on_credit"]);
|
|
13
|
+
export const flightOrderStatusSchema = z.enum([
|
|
14
|
+
"pending",
|
|
15
|
+
"confirmed",
|
|
16
|
+
"ticketed",
|
|
17
|
+
"cancelled",
|
|
18
|
+
"failed",
|
|
19
|
+
]);
|
|
20
|
+
export const flightCancelReasonSchema = z.enum([
|
|
21
|
+
"customer_request",
|
|
22
|
+
"schedule_change",
|
|
23
|
+
"operational",
|
|
24
|
+
"fraud",
|
|
25
|
+
]);
|
|
26
|
+
export const flightModifyReasonSchema = z.enum([
|
|
27
|
+
"customer_request",
|
|
28
|
+
"schedule_change",
|
|
29
|
+
"name_correction",
|
|
30
|
+
"disruption",
|
|
31
|
+
"operational",
|
|
32
|
+
]);
|
|
33
|
+
export const flightRefundReasonSchema = z.enum([
|
|
34
|
+
"customer_request",
|
|
35
|
+
"schedule_change",
|
|
36
|
+
"disruption",
|
|
37
|
+
"duplicate_booking",
|
|
38
|
+
"medical",
|
|
39
|
+
"other",
|
|
40
|
+
]);
|
|
41
|
+
export const ssrCodeSchema = z.enum([
|
|
42
|
+
"WCHR",
|
|
43
|
+
"WCHS",
|
|
44
|
+
"WCHC",
|
|
45
|
+
"BLND",
|
|
46
|
+
"DEAF",
|
|
47
|
+
"MAAS",
|
|
48
|
+
"UMNR",
|
|
49
|
+
"INFT",
|
|
50
|
+
"PETC",
|
|
51
|
+
"VGML",
|
|
52
|
+
"KSML",
|
|
53
|
+
"MOML",
|
|
54
|
+
"OTHER",
|
|
55
|
+
]);
|
|
56
|
+
export const checkInStatusSchema = z.enum(["initiated", "checked_in", "failed"]);
|
|
57
|
+
export const flightAdapterEnvironmentSchema = z.enum(["sandbox", "production"]);
|
|
58
|
+
export const flightCapabilitySchema = z.enum(Object.values(FLIGHT_CAPABILITIES));
|
|
59
|
+
export const moneySchema = z.object({
|
|
60
|
+
amount: decimalStringSchema,
|
|
61
|
+
currency: currencyCodeSchema,
|
|
62
|
+
});
|
|
63
|
+
const signedMoneySchema = moneySchema.extend({ amount: signedDecimalStringSchema });
|
|
64
|
+
export const flightContactSchema = z.object({
|
|
65
|
+
email: z.string().optional(),
|
|
66
|
+
phone: z.string().optional(),
|
|
67
|
+
});
|
|
68
|
+
export const pointOfSaleSchema = z.string();
|
|
69
|
+
export const flightSegmentEndpointSchema = z.object({
|
|
70
|
+
iataCode: iataCodeSchema,
|
|
71
|
+
terminal: z.string().optional(),
|
|
72
|
+
at: z.string(),
|
|
73
|
+
});
|
|
74
|
+
export const flightSegmentSchema = z.object({
|
|
75
|
+
segmentId: z.string(),
|
|
76
|
+
carrierCode: carrierCodeSchema,
|
|
77
|
+
flightNumber: z.string(),
|
|
78
|
+
operatingCarrierCode: carrierCodeSchema.optional(),
|
|
79
|
+
operatingFlightNumber: z.string().optional(),
|
|
80
|
+
departure: flightSegmentEndpointSchema,
|
|
81
|
+
arrival: flightSegmentEndpointSchema,
|
|
82
|
+
duration: z.string().optional(),
|
|
83
|
+
aircraft: z.string().optional(),
|
|
84
|
+
cabin: cabinClassSchema,
|
|
85
|
+
fareClass: z.string().optional(),
|
|
86
|
+
fareBasis: z.string().optional(),
|
|
87
|
+
status: z.string().optional(),
|
|
88
|
+
providerData: providerDataSchema.optional(),
|
|
89
|
+
});
|
|
90
|
+
export const flightItinerarySchema = z.object({
|
|
91
|
+
segments: z.array(flightSegmentSchema),
|
|
92
|
+
duration: z.string().optional(),
|
|
93
|
+
});
|
|
94
|
+
export const itinerarySchema = flightItinerarySchema;
|
|
95
|
+
export const fareBreakdownSchema = z.object({
|
|
96
|
+
passengerType: passengerTypeSchema,
|
|
97
|
+
passengerCount: z.number().int().min(0),
|
|
98
|
+
baseFare: moneySchema,
|
|
99
|
+
taxes: moneySchema,
|
|
100
|
+
fees: moneySchema.optional(),
|
|
101
|
+
total: moneySchema,
|
|
102
|
+
fareFamily: z.string().optional(),
|
|
103
|
+
});
|
|
104
|
+
export const fareBundleInclusionsSchema = z.object({
|
|
105
|
+
cabinBag: z
|
|
106
|
+
.object({
|
|
107
|
+
included: z.boolean(),
|
|
108
|
+
weightKg: z.number().optional(),
|
|
109
|
+
})
|
|
110
|
+
.optional(),
|
|
111
|
+
checkedBag: z
|
|
112
|
+
.object({
|
|
113
|
+
included: z.boolean(),
|
|
114
|
+
pieces: z.number().optional(),
|
|
115
|
+
weightKg: z.number().optional(),
|
|
116
|
+
})
|
|
117
|
+
.optional(),
|
|
118
|
+
seatSelection: z.enum(["none", "standard", "free"]).optional(),
|
|
119
|
+
priorityBoarding: z.boolean().optional(),
|
|
120
|
+
loungeAccess: z.boolean().optional(),
|
|
121
|
+
refundable: z.boolean().optional(),
|
|
122
|
+
changeable: z.boolean().optional(),
|
|
123
|
+
notes: z.array(z.string()).optional(),
|
|
124
|
+
});
|
|
125
|
+
export const fareBundleSchema = z.object({
|
|
126
|
+
id: z.string(),
|
|
127
|
+
label: z.string(),
|
|
128
|
+
tier: z.enum(["basic", "standard", "plus", "premium"]),
|
|
129
|
+
priceDelta: moneySchema,
|
|
130
|
+
recommended: z.boolean().optional(),
|
|
131
|
+
inclusions: fareBundleInclusionsSchema,
|
|
132
|
+
providerData: providerDataSchema.optional(),
|
|
133
|
+
});
|
|
134
|
+
export const flightOfferSchema = z.object({
|
|
135
|
+
offerId: z.string(),
|
|
136
|
+
source: z.string(),
|
|
137
|
+
itineraries: z.array(flightItinerarySchema),
|
|
138
|
+
fareBreakdowns: z.array(fareBreakdownSchema),
|
|
139
|
+
totalPrice: moneySchema,
|
|
140
|
+
validatingCarrier: z.string().optional(),
|
|
141
|
+
expiresAt: z.string().optional(),
|
|
142
|
+
lastTicketingDate: z.string().optional(),
|
|
143
|
+
instantTicketing: z.boolean().optional(),
|
|
144
|
+
fareBundles: z.array(fareBundleSchema).optional(),
|
|
145
|
+
providerData: providerDataSchema.optional(),
|
|
146
|
+
});
|
|
147
|
+
export const flightSliceSchema = z.object({
|
|
148
|
+
origin: iataCodeSchema,
|
|
149
|
+
destination: iataCodeSchema,
|
|
150
|
+
departureDate: z.string(),
|
|
151
|
+
departureTimeWindow: z
|
|
152
|
+
.object({
|
|
153
|
+
earliest: z.string().optional(),
|
|
154
|
+
latest: z.string().optional(),
|
|
155
|
+
})
|
|
156
|
+
.optional(),
|
|
157
|
+
});
|
|
158
|
+
export const passengerCountsSchema = z.object({
|
|
159
|
+
adults: z.number().int().min(0),
|
|
160
|
+
children: z.number().int().min(0).optional(),
|
|
161
|
+
infants: z.number().int().min(0).optional(),
|
|
162
|
+
});
|
|
163
|
+
export const flightSearchPaginationSchema = z.object({
|
|
164
|
+
limit: z.number().int().min(1).optional(),
|
|
165
|
+
cursor: z.string().optional(),
|
|
166
|
+
});
|
|
167
|
+
export const flightSearchPaginationMetaSchema = z.object({
|
|
168
|
+
total: z.number().int().min(0),
|
|
169
|
+
cursor: z.string().optional(),
|
|
170
|
+
hasMore: z.boolean(),
|
|
171
|
+
});
|
|
172
|
+
export const flightSearchOptionsSchema = z.object({
|
|
173
|
+
directOnly: z.boolean().optional(),
|
|
174
|
+
maxStops: z.number().int().min(0).optional(),
|
|
175
|
+
minConnectionMinutes: z.number().int().min(0).optional(),
|
|
176
|
+
includeCarriers: z.array(carrierCodeSchema).optional(),
|
|
177
|
+
excludeCarriers: z.array(carrierCodeSchema).optional(),
|
|
178
|
+
maxPrice: z.number().min(0).optional(),
|
|
179
|
+
});
|
|
180
|
+
export const flightSearchRequestSchema = z.object({
|
|
181
|
+
slices: z.array(flightSliceSchema),
|
|
182
|
+
passengers: passengerCountsSchema,
|
|
183
|
+
cabin: cabinClassSchema.optional(),
|
|
184
|
+
searchOptions: flightSearchOptionsSchema.optional(),
|
|
185
|
+
pagination: flightSearchPaginationSchema.optional(),
|
|
186
|
+
});
|
|
187
|
+
export const flightSearchResponseSchema = z.object({
|
|
188
|
+
offers: z.array(flightOfferSchema),
|
|
189
|
+
pagination: flightSearchPaginationMetaSchema.optional(),
|
|
190
|
+
providerData: providerDataSchema.optional(),
|
|
191
|
+
});
|
|
192
|
+
export const flightPriceRequestSchema = z.object({
|
|
193
|
+
offerId: z.string(),
|
|
194
|
+
offer: flightOfferSchema.optional(),
|
|
195
|
+
});
|
|
196
|
+
export const flightPriceResponseSchema = z.object({
|
|
197
|
+
offer: flightOfferSchema,
|
|
198
|
+
valid: z.boolean(),
|
|
199
|
+
invalidReason: z.string().optional(),
|
|
200
|
+
});
|
|
201
|
+
export const billingAddressSchema = z.object({
|
|
202
|
+
line1: z.string(),
|
|
203
|
+
line2: z.string().optional(),
|
|
204
|
+
city: z.string(),
|
|
205
|
+
region: z.string().optional(),
|
|
206
|
+
postalCode: z.string().optional(),
|
|
207
|
+
countryCode: z.string(),
|
|
208
|
+
});
|
|
209
|
+
export const paymentIntentSchema = z.discriminatedUnion("type", [
|
|
210
|
+
z.object({ type: z.literal("hold") }),
|
|
211
|
+
z.object({
|
|
212
|
+
type: z.literal("card"),
|
|
213
|
+
token: z.string(),
|
|
214
|
+
cardholderName: z.string().optional(),
|
|
215
|
+
billingAddress: billingAddressSchema.optional(),
|
|
216
|
+
}),
|
|
217
|
+
z.object({
|
|
218
|
+
type: z.literal("ticket_on_credit"),
|
|
219
|
+
iataCode: z.string().optional(),
|
|
220
|
+
}),
|
|
221
|
+
]);
|
|
222
|
+
export const travelDocumentSchema = z.object({
|
|
223
|
+
type: z.enum(["passport", "national_id", "visa"]),
|
|
224
|
+
number: z.string(),
|
|
225
|
+
countryOfIssue: z.string(),
|
|
226
|
+
countryOfNationality: z.string().optional(),
|
|
227
|
+
expiryDate: z.string().optional(),
|
|
228
|
+
});
|
|
229
|
+
export const flightPassengerSchema = z.object({
|
|
230
|
+
passengerId: z.string(),
|
|
231
|
+
type: passengerTypeSchema,
|
|
232
|
+
firstName: z.string(),
|
|
233
|
+
middleName: z.string().optional(),
|
|
234
|
+
lastName: z.string(),
|
|
235
|
+
dateOfBirth: z.string(),
|
|
236
|
+
gender: z.enum(["M", "F", "X"]).optional(),
|
|
237
|
+
email: z.string().optional(),
|
|
238
|
+
phone: z.string().optional(),
|
|
239
|
+
documents: z.array(travelDocumentSchema).optional(),
|
|
240
|
+
});
|
|
241
|
+
export const ancillarySelectionSchema = z.object({
|
|
242
|
+
baggage: z
|
|
243
|
+
.array(z.object({
|
|
244
|
+
passengerId: z.string(),
|
|
245
|
+
sliceIndex: z.number().int().min(0),
|
|
246
|
+
optionId: z.string(),
|
|
247
|
+
quantity: z.number().int().min(1).optional(),
|
|
248
|
+
}))
|
|
249
|
+
.optional(),
|
|
250
|
+
assistance: z
|
|
251
|
+
.array(z.object({
|
|
252
|
+
passengerId: z.string(),
|
|
253
|
+
optionId: z.string(),
|
|
254
|
+
}))
|
|
255
|
+
.optional(),
|
|
256
|
+
extras: z
|
|
257
|
+
.array(z.object({
|
|
258
|
+
passengerId: z.string(),
|
|
259
|
+
sliceIndex: z.number().int().min(0),
|
|
260
|
+
optionId: z.string(),
|
|
261
|
+
quantity: z.number().int().min(1).optional(),
|
|
262
|
+
}))
|
|
263
|
+
.optional(),
|
|
264
|
+
seats: z
|
|
265
|
+
.array(z.object({
|
|
266
|
+
passengerId: z.string(),
|
|
267
|
+
segmentId: z.string(),
|
|
268
|
+
seatNumber: z.string(),
|
|
269
|
+
}))
|
|
270
|
+
.optional(),
|
|
271
|
+
fareBundle: z
|
|
272
|
+
.array(z.object({
|
|
273
|
+
passengerId: z.string(),
|
|
274
|
+
sliceIndex: z.number().int().min(0),
|
|
275
|
+
bundleId: z.string(),
|
|
276
|
+
}))
|
|
277
|
+
.optional(),
|
|
278
|
+
});
|
|
279
|
+
export const flightBookRequestSchema = z.object({
|
|
280
|
+
offerId: z.string(),
|
|
281
|
+
offer: flightOfferSchema.optional(),
|
|
282
|
+
passengers: z.array(flightPassengerSchema),
|
|
283
|
+
contact: flightContactSchema.optional(),
|
|
284
|
+
paymentIntent: paymentIntentSchema.optional(),
|
|
285
|
+
ancillaries: ancillarySelectionSchema.optional(),
|
|
286
|
+
});
|
|
287
|
+
export const flightTicketSchema = z.object({
|
|
288
|
+
ticketNumber: z.string(),
|
|
289
|
+
passengerId: z.string(),
|
|
290
|
+
segmentIds: z.array(z.string()),
|
|
291
|
+
status: z.string().optional(),
|
|
292
|
+
});
|
|
293
|
+
export const flightOrderSchema = z.object({
|
|
294
|
+
orderId: z.string(),
|
|
295
|
+
pnr: z.string().optional(),
|
|
296
|
+
status: flightOrderStatusSchema,
|
|
297
|
+
offer: flightOfferSchema,
|
|
298
|
+
passengers: z.array(flightPassengerSchema),
|
|
299
|
+
contact: flightContactSchema.optional(),
|
|
300
|
+
tickets: z.array(flightTicketSchema).optional(),
|
|
301
|
+
totalPrice: moneySchema,
|
|
302
|
+
paymentDeadline: z.string().optional(),
|
|
303
|
+
createdAt: z.string(),
|
|
304
|
+
updatedAt: z.string().optional(),
|
|
305
|
+
providerData: providerDataSchema.optional(),
|
|
306
|
+
});
|
|
307
|
+
export const flightBookResponseSchema = z.object({
|
|
308
|
+
order: flightOrderSchema,
|
|
309
|
+
});
|
|
310
|
+
export const flightGetOrderResponseSchema = z.object({
|
|
311
|
+
order: flightOrderSchema,
|
|
312
|
+
});
|
|
313
|
+
export const flightCancelResponseSchema = z.object({
|
|
314
|
+
order: flightOrderSchema,
|
|
315
|
+
refundedAmount: moneySchema.optional(),
|
|
316
|
+
});
|
|
317
|
+
export const flightOrdersListQuerySchema = z.object({
|
|
318
|
+
cursor: z.string().optional(),
|
|
319
|
+
limit: z.number().int().min(1).optional(),
|
|
320
|
+
status: z.array(flightOrderStatusSchema).optional(),
|
|
321
|
+
search: z.string().optional(),
|
|
322
|
+
});
|
|
323
|
+
export const flightOrdersListResponseSchema = z.object({
|
|
324
|
+
orders: z.array(flightOrderSchema),
|
|
325
|
+
pagination: z.object({
|
|
326
|
+
total: z.number().int().min(0),
|
|
327
|
+
hasMore: z.boolean(),
|
|
328
|
+
cursor: z.string().optional(),
|
|
329
|
+
}),
|
|
330
|
+
});
|
|
331
|
+
export const ancillaryBaggageOptionSchema = z.object({
|
|
332
|
+
id: z.string(),
|
|
333
|
+
label: z.string(),
|
|
334
|
+
category: z.enum(["checked", "cabin", "personal_item", "sports", "oversized"]),
|
|
335
|
+
weightKg: z.number().optional(),
|
|
336
|
+
dimensions: z
|
|
337
|
+
.object({
|
|
338
|
+
lengthCm: z.number().optional(),
|
|
339
|
+
widthCm: z.number().optional(),
|
|
340
|
+
heightCm: z.number().optional(),
|
|
341
|
+
})
|
|
342
|
+
.optional(),
|
|
343
|
+
price: moneySchema,
|
|
344
|
+
recommended: z.boolean().optional(),
|
|
345
|
+
providerData: providerDataSchema.optional(),
|
|
346
|
+
});
|
|
347
|
+
export const ancillaryAssistanceOptionSchema = z.object({
|
|
348
|
+
id: z.string(),
|
|
349
|
+
label: z.string(),
|
|
350
|
+
category: z.enum(["wheelchair", "visual", "hearing", "cognitive", "medical", "other"]),
|
|
351
|
+
price: moneySchema.optional(),
|
|
352
|
+
notes: z.string().optional(),
|
|
353
|
+
});
|
|
354
|
+
export const ancillaryExtraOptionSchema = z.object({
|
|
355
|
+
id: z.string(),
|
|
356
|
+
label: z.string(),
|
|
357
|
+
category: z.string(),
|
|
358
|
+
price: moneySchema,
|
|
359
|
+
pricingScope: z.enum(["per_passenger", "per_booking"]).optional(),
|
|
360
|
+
});
|
|
361
|
+
export const ancillaryCatalogSchema = z.object({
|
|
362
|
+
baggage: z.array(ancillaryBaggageOptionSchema),
|
|
363
|
+
assistance: z.array(ancillaryAssistanceOptionSchema),
|
|
364
|
+
extras: z.array(ancillaryExtraOptionSchema),
|
|
365
|
+
});
|
|
366
|
+
export const ancillaryRequestSchema = z.object({
|
|
367
|
+
offerId: z.string(),
|
|
368
|
+
offer: flightOfferSchema.optional(),
|
|
369
|
+
});
|
|
370
|
+
export const ancillaryResponseSchema = z.object({
|
|
371
|
+
catalog: ancillaryCatalogSchema,
|
|
372
|
+
validUntil: z.string().optional(),
|
|
373
|
+
});
|
|
374
|
+
export const seatSchema = z.object({
|
|
375
|
+
seatNumber: z.string(),
|
|
376
|
+
row: z.number().int().min(1),
|
|
377
|
+
column: z.string(),
|
|
378
|
+
status: z.enum(["available", "blocked", "unavailable", "selected"]),
|
|
379
|
+
category: z.enum(["standard", "preferred", "extra_legroom", "exit_row", "premium", "bulkhead"]),
|
|
380
|
+
price: moneySchema.optional(),
|
|
381
|
+
notes: z.string().optional(),
|
|
382
|
+
window: z.boolean().optional(),
|
|
383
|
+
aisle: z.boolean().optional(),
|
|
384
|
+
providerData: providerDataSchema.optional(),
|
|
385
|
+
});
|
|
386
|
+
export const seatRowSchema = z.object({
|
|
387
|
+
row: z.number().int().min(1),
|
|
388
|
+
seats: z.array(seatSchema),
|
|
389
|
+
});
|
|
390
|
+
export const seatMapSchema = z.object({
|
|
391
|
+
segmentId: z.string(),
|
|
392
|
+
aircraft: z.string().optional(),
|
|
393
|
+
cabin: cabinClassSchema,
|
|
394
|
+
columnLayout: z.array(z.string().nullable()),
|
|
395
|
+
rows: z.array(seatRowSchema),
|
|
396
|
+
providerData: providerDataSchema.optional(),
|
|
397
|
+
});
|
|
398
|
+
export const seatMapRequestSchema = z.object({
|
|
399
|
+
offerId: z.string(),
|
|
400
|
+
segmentId: z.string(),
|
|
401
|
+
offer: flightOfferSchema.optional(),
|
|
402
|
+
});
|
|
403
|
+
export const seatMapResponseSchema = z.object({
|
|
404
|
+
seatMap: seatMapSchema,
|
|
405
|
+
validUntil: z.string().optional(),
|
|
406
|
+
});
|
|
407
|
+
export const seatAssignmentSchema = z.object({
|
|
408
|
+
passengerId: z.string(),
|
|
409
|
+
segmentId: z.string(),
|
|
410
|
+
seatNumber: z.string(),
|
|
411
|
+
price: moneySchema.optional(),
|
|
412
|
+
providerData: providerDataSchema.optional(),
|
|
413
|
+
});
|
|
414
|
+
export const seatSelectionRequestSchema = z.object({
|
|
415
|
+
orderId: z.string(),
|
|
416
|
+
selections: z.array(seatAssignmentSchema),
|
|
417
|
+
});
|
|
418
|
+
export const seatSelectionResponseSchema = z.object({
|
|
419
|
+
order: flightOrderSchema,
|
|
420
|
+
selections: z.array(seatAssignmentSchema),
|
|
421
|
+
additionalAmount: moneySchema.optional(),
|
|
422
|
+
});
|
|
423
|
+
export const flightBoardingPassSchema = z.object({
|
|
424
|
+
passengerId: z.string(),
|
|
425
|
+
segmentId: z.string(),
|
|
426
|
+
boardingPassId: z.string().optional(),
|
|
427
|
+
seatNumber: z.string().optional(),
|
|
428
|
+
sequenceNumber: z.string().optional(),
|
|
429
|
+
zone: z.string().optional(),
|
|
430
|
+
providerData: providerDataSchema.optional(),
|
|
431
|
+
});
|
|
432
|
+
export const checkInRequestSchema = z.object({
|
|
433
|
+
orderId: z.string(),
|
|
434
|
+
passengerIds: z.array(z.string()).optional(),
|
|
435
|
+
segmentIds: z.array(z.string()).optional(),
|
|
436
|
+
});
|
|
437
|
+
export const checkInResponseSchema = z.object({
|
|
438
|
+
order: flightOrderSchema,
|
|
439
|
+
status: checkInStatusSchema,
|
|
440
|
+
boardingPasses: z.array(flightBoardingPassSchema).optional(),
|
|
441
|
+
});
|
|
442
|
+
export const flightModifyRequestSchema = z.object({
|
|
443
|
+
orderId: z.string(),
|
|
444
|
+
offer: flightOfferSchema.optional(),
|
|
445
|
+
passengers: z.array(flightPassengerSchema).optional(),
|
|
446
|
+
ancillaries: ancillarySelectionSchema.optional(),
|
|
447
|
+
reason: flightModifyReasonSchema.optional(),
|
|
448
|
+
});
|
|
449
|
+
export const flightModifyResponseSchema = z.object({
|
|
450
|
+
order: flightOrderSchema,
|
|
451
|
+
priceDifference: signedMoneySchema.optional(),
|
|
452
|
+
penalties: z.array(moneySchema).optional(),
|
|
453
|
+
});
|
|
454
|
+
export const flightRefundRequestSchema = z.object({
|
|
455
|
+
orderId: z.string(),
|
|
456
|
+
reason: flightRefundReasonSchema.optional(),
|
|
457
|
+
amount: moneySchema.optional(),
|
|
458
|
+
});
|
|
459
|
+
export const flightRefundResponseSchema = z.object({
|
|
460
|
+
order: flightOrderSchema,
|
|
461
|
+
refundId: z.string().optional(),
|
|
462
|
+
refundedAmount: moneySchema,
|
|
463
|
+
penalties: z.array(moneySchema).optional(),
|
|
464
|
+
});
|
|
465
|
+
export const flightVoidResponseSchema = z.object({
|
|
466
|
+
order: flightOrderSchema,
|
|
467
|
+
voidId: z.string().optional(),
|
|
468
|
+
voidedAt: z.string(),
|
|
469
|
+
});
|
|
470
|
+
export const ssrRequestSchema = z.object({
|
|
471
|
+
orderId: z.string(),
|
|
472
|
+
code: ssrCodeSchema,
|
|
473
|
+
passengerIds: z.array(z.string()).optional(),
|
|
474
|
+
segmentIds: z.array(z.string()).optional(),
|
|
475
|
+
text: z.string().optional(),
|
|
476
|
+
});
|
|
477
|
+
export const ssrResponseSchema = z.object({
|
|
478
|
+
order: flightOrderSchema,
|
|
479
|
+
ssrId: z.string().optional(),
|
|
480
|
+
status: z.enum(["requested", "confirmed", "rejected"]),
|
|
481
|
+
});
|
|
482
|
+
export const adapterLoggerSchema = z.custom((value) => isRecord(value) &&
|
|
483
|
+
typeof value.debug === "function" &&
|
|
484
|
+
typeof value.info === "function" &&
|
|
485
|
+
typeof value.warn === "function" &&
|
|
486
|
+
typeof value.error === "function");
|
|
487
|
+
export const abortSignalSchema = z.custom((value) => isRecord(value) &&
|
|
488
|
+
typeof value.aborted === "boolean" &&
|
|
489
|
+
typeof value.addEventListener === "function" &&
|
|
490
|
+
typeof value.removeEventListener === "function");
|
|
491
|
+
export const flightAdapterContextSchema = z.object({
|
|
492
|
+
connectionId: z.string(),
|
|
493
|
+
credentials: z.record(z.string(), z.string()).optional(),
|
|
494
|
+
pointOfSale: pointOfSaleSchema.optional(),
|
|
495
|
+
correlationId: z.string().optional(),
|
|
496
|
+
requestId: z.string().optional(),
|
|
497
|
+
idempotencyKey: z.string().optional(),
|
|
498
|
+
logger: adapterLoggerSchema.optional(),
|
|
499
|
+
signal: abortSignalSchema.optional(),
|
|
500
|
+
environment: flightAdapterEnvironmentSchema.optional(),
|
|
501
|
+
deps: z.record(z.string(), z.unknown()).optional(),
|
|
502
|
+
});
|
|
503
|
+
export const flightAdapterCapabilitiesSchema = z.object({
|
|
504
|
+
provider: z.string(),
|
|
505
|
+
declared: z.array(flightCapabilitySchema),
|
|
506
|
+
maxSlicesPerSearch: z.number().int().min(1).optional(),
|
|
507
|
+
defaultTimeoutMs: z.number().int().min(1).optional(),
|
|
508
|
+
});
|