@voyantjs/travel-composer 0.55.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 +38 -0
- package/dist/catalog-component-adapter.d.ts +16 -0
- package/dist/catalog-component-adapter.d.ts.map +1 -0
- package/dist/catalog-component-adapter.js +34 -0
- package/dist/cruise-extension.d.ts +48 -0
- package/dist/cruise-extension.d.ts.map +1 -0
- package/dist/cruise-extension.js +66 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/mcp-tools.d.ts +157 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +109 -0
- package/dist/routes.d.ts +1988 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +239 -0
- package/dist/schema.d.ts +1228 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +163 -0
- package/dist/service-cancellation.d.ts +6 -0
- package/dist/service-cancellation.d.ts.map +1 -0
- package/dist/service-cancellation.js +251 -0
- package/dist/service-checkout.d.ts +6 -0
- package/dist/service-checkout.d.ts.map +1 -0
- package/dist/service-checkout.js +328 -0
- package/dist/service-drafts.d.ts +13 -0
- package/dist/service-drafts.d.ts.map +1 -0
- package/dist/service-drafts.js +223 -0
- package/dist/service-helpers.d.ts +17 -0
- package/dist/service-helpers.d.ts.map +1 -0
- package/dist/service-helpers.js +161 -0
- package/dist/service-internals.d.ts +11 -0
- package/dist/service-internals.d.ts.map +1 -0
- package/dist/service-internals.js +72 -0
- package/dist/service-pricing.d.ts +8 -0
- package/dist/service-pricing.d.ts.map +1 -0
- package/dist/service-pricing.js +142 -0
- package/dist/service-reservation.d.ts +5 -0
- package/dist/service-reservation.d.ts.map +1 -0
- package/dist/service-reservation.js +447 -0
- package/dist/service-trips.d.ts +14 -0
- package/dist/service-trips.d.ts.map +1 -0
- package/dist/service-trips.js +377 -0
- package/dist/service-types.d.ts +252 -0
- package/dist/service-types.d.ts.map +1 -0
- package/dist/service-types.js +6 -0
- package/dist/service.d.ts +33 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +35 -0
- package/dist/traveler-party-validation.d.ts +3 -0
- package/dist/traveler-party-validation.d.ts.map +1 -0
- package/dist/traveler-party-validation.js +68 -0
- package/dist/validation.d.ts +363 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +226 -0
- package/package.json +88 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { asc, eq, inArray } from "drizzle-orm";
|
|
2
|
+
import { tripComponents, tripEnvelopes } from "./schema.js";
|
|
3
|
+
import { assertTripComponentCanBeUpdated, assertTripComponentCanReceiveRefs, } from "./service-helpers.js";
|
|
4
|
+
import { createComponentEvent, statusToEventType } from "./service-internals.js";
|
|
5
|
+
import { TravelComposerInvariantError } from "./service-types.js";
|
|
6
|
+
import { assertTripTravelerPartyComplete } from "./traveler-party-validation.js";
|
|
7
|
+
export async function createTrip(db, input) {
|
|
8
|
+
assertTripTravelerPartyComplete(input.travelerParty, "Trip creation");
|
|
9
|
+
const values = {
|
|
10
|
+
title: input.title,
|
|
11
|
+
description: input.description,
|
|
12
|
+
travelerParty: input.travelerParty,
|
|
13
|
+
constraints: input.constraints,
|
|
14
|
+
createdBy: input.createdBy,
|
|
15
|
+
updatedBy: input.createdBy,
|
|
16
|
+
};
|
|
17
|
+
const [envelope] = (await db.insert(tripEnvelopes).values(values).returning());
|
|
18
|
+
if (!envelope)
|
|
19
|
+
throw new Error("createTrip: insert returned no envelope");
|
|
20
|
+
return { envelope, components: [] };
|
|
21
|
+
}
|
|
22
|
+
export async function getTrip(db, envelopeId) {
|
|
23
|
+
const [envelope] = (await db
|
|
24
|
+
.select()
|
|
25
|
+
.from(tripEnvelopes)
|
|
26
|
+
.where(eq(tripEnvelopes.id, envelopeId))
|
|
27
|
+
.limit(1));
|
|
28
|
+
if (!envelope)
|
|
29
|
+
return null;
|
|
30
|
+
const components = (await db
|
|
31
|
+
.select()
|
|
32
|
+
.from(tripComponents)
|
|
33
|
+
.where(eq(tripComponents.envelopeId, envelopeId))
|
|
34
|
+
.orderBy(asc(tripComponents.sequence), asc(tripComponents.createdAt)));
|
|
35
|
+
return { envelope, components };
|
|
36
|
+
}
|
|
37
|
+
export async function listTrips(db, input = {
|
|
38
|
+
limit: 50,
|
|
39
|
+
offset: 0,
|
|
40
|
+
sortBy: "updatedAt",
|
|
41
|
+
sortDir: "desc",
|
|
42
|
+
}) {
|
|
43
|
+
const allEnvelopes = (await db.select().from(tripEnvelopes));
|
|
44
|
+
const needsComponents = input.productId !== undefined ||
|
|
45
|
+
input.hospitalityId !== undefined ||
|
|
46
|
+
input.cruiseId !== undefined ||
|
|
47
|
+
input.hasFlight === true;
|
|
48
|
+
// When a component-based filter is active we have to know each envelope's
|
|
49
|
+
// components *before* paging, so fetch them up front. Otherwise we keep the
|
|
50
|
+
// cheap path that only loads components for the visible page.
|
|
51
|
+
const allComponents = needsComponents
|
|
52
|
+
? (await db
|
|
53
|
+
.select()
|
|
54
|
+
.from(tripComponents)
|
|
55
|
+
.orderBy(asc(tripComponents.sequence), asc(tripComponents.createdAt)))
|
|
56
|
+
: [];
|
|
57
|
+
const allComponentsByEnvelope = new Map();
|
|
58
|
+
if (needsComponents) {
|
|
59
|
+
for (const component of allComponents) {
|
|
60
|
+
if (component.status === "removed")
|
|
61
|
+
continue;
|
|
62
|
+
const bucket = allComponentsByEnvelope.get(component.envelopeId) ?? [];
|
|
63
|
+
bucket.push(component);
|
|
64
|
+
allComponentsByEnvelope.set(component.envelopeId, bucket);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const normalizedSearch = input.search?.toLowerCase();
|
|
68
|
+
const createdFromMs = parseDateMs(input.createdFrom);
|
|
69
|
+
const createdToMs = parseEndDateMs(input.createdTo);
|
|
70
|
+
const filtered = allEnvelopes.filter((envelope) => {
|
|
71
|
+
if (input.status && envelope.status !== input.status)
|
|
72
|
+
return false;
|
|
73
|
+
if (normalizedSearch) {
|
|
74
|
+
const matches = [envelope.id, envelope.title, envelope.description]
|
|
75
|
+
.filter((value) => typeof value === "string")
|
|
76
|
+
.some((value) => value.toLowerCase().includes(normalizedSearch));
|
|
77
|
+
if (!matches)
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (input.totalMinCents !== undefined) {
|
|
81
|
+
const total = envelope.aggregateTotalAmountCents ?? null;
|
|
82
|
+
if (total === null || total < input.totalMinCents)
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (input.totalMaxCents !== undefined) {
|
|
86
|
+
const total = envelope.aggregateTotalAmountCents ?? null;
|
|
87
|
+
if (total === null || total > input.totalMaxCents)
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (createdFromMs !== null) {
|
|
91
|
+
const ts = envelope.createdAt?.getTime() ?? null;
|
|
92
|
+
if (ts === null || ts < createdFromMs)
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (createdToMs !== null) {
|
|
96
|
+
const ts = envelope.createdAt?.getTime() ?? null;
|
|
97
|
+
if (ts === null || ts > createdToMs)
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (needsComponents) {
|
|
101
|
+
const envelopeComponents = allComponentsByEnvelope.get(envelope.id) ?? [];
|
|
102
|
+
if (input.productId &&
|
|
103
|
+
!envelopeComponents.some((component) => component.entityModule === "products" && component.entityId === input.productId)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (input.hospitalityId &&
|
|
107
|
+
!envelopeComponents.some((component) => component.entityModule === "hospitality" && component.entityId === input.hospitalityId)) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (input.cruiseId &&
|
|
111
|
+
!envelopeComponents.some((component) => component.entityModule === "cruises" && component.entityId === input.cruiseId)) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (input.hasFlight === true &&
|
|
115
|
+
!envelopeComponents.some((component) => component.kind === "flight_placeholder" || component.kind === "flight_order")) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
});
|
|
121
|
+
const sortDirection = input.sortDir === "asc" ? 1 : -1;
|
|
122
|
+
filtered.sort((a, b) => {
|
|
123
|
+
const compare = compareEnvelopes(a, b, input.sortBy);
|
|
124
|
+
if (compare !== 0)
|
|
125
|
+
return compare * sortDirection;
|
|
126
|
+
const updatedDelta = (b.updatedAt?.getTime() ?? 0) - (a.updatedAt?.getTime() ?? 0);
|
|
127
|
+
if (updatedDelta !== 0)
|
|
128
|
+
return updatedDelta;
|
|
129
|
+
return (b.createdAt?.getTime() ?? 0) - (a.createdAt?.getTime() ?? 0);
|
|
130
|
+
});
|
|
131
|
+
const page = filtered.slice(input.offset, input.offset + input.limit);
|
|
132
|
+
const envelopeIds = page.map((envelope) => envelope.id);
|
|
133
|
+
const components = needsComponents
|
|
134
|
+
? envelopeIds.flatMap((id) => allComponentsByEnvelope.get(id) ?? [])
|
|
135
|
+
: envelopeIds.length > 0
|
|
136
|
+
? (await db
|
|
137
|
+
.select()
|
|
138
|
+
.from(tripComponents)
|
|
139
|
+
.where(inArray(tripComponents.envelopeId, envelopeIds))
|
|
140
|
+
.orderBy(asc(tripComponents.sequence), asc(tripComponents.createdAt)))
|
|
141
|
+
: [];
|
|
142
|
+
const componentsByEnvelope = new Map();
|
|
143
|
+
for (const component of components) {
|
|
144
|
+
const bucket = componentsByEnvelope.get(component.envelopeId) ?? [];
|
|
145
|
+
bucket.push(component);
|
|
146
|
+
componentsByEnvelope.set(component.envelopeId, bucket);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
data: page.map((envelope) => ({
|
|
150
|
+
envelope,
|
|
151
|
+
components: componentsByEnvelope.get(envelope.id) ?? [],
|
|
152
|
+
})),
|
|
153
|
+
total: filtered.length,
|
|
154
|
+
limit: input.limit,
|
|
155
|
+
offset: input.offset,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function parseDateMs(value) {
|
|
159
|
+
if (!value)
|
|
160
|
+
return null;
|
|
161
|
+
const ts = new Date(value).getTime();
|
|
162
|
+
return Number.isFinite(ts) ? ts : null;
|
|
163
|
+
}
|
|
164
|
+
function parseEndDateMs(value) {
|
|
165
|
+
if (!value)
|
|
166
|
+
return null;
|
|
167
|
+
// Date-only `YYYY-MM-DD` strings should match the whole day. Use the end
|
|
168
|
+
// of that day in UTC so callers comparing `createdAt <= createdTo` get the
|
|
169
|
+
// intuitive inclusive behaviour.
|
|
170
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
171
|
+
const ts = new Date(`${value}T23:59:59.999Z`).getTime();
|
|
172
|
+
return Number.isFinite(ts) ? ts : null;
|
|
173
|
+
}
|
|
174
|
+
const ts = new Date(value).getTime();
|
|
175
|
+
return Number.isFinite(ts) ? ts : null;
|
|
176
|
+
}
|
|
177
|
+
export async function updateTrip(db, envelopeId, input) {
|
|
178
|
+
if (input.travelerParty !== undefined) {
|
|
179
|
+
assertTripTravelerPartyComplete(input.travelerParty, "Trip update");
|
|
180
|
+
}
|
|
181
|
+
const updates = {
|
|
182
|
+
updatedAt: new Date(),
|
|
183
|
+
};
|
|
184
|
+
if (input.title !== undefined)
|
|
185
|
+
updates.title = input.title;
|
|
186
|
+
if (input.description !== undefined)
|
|
187
|
+
updates.description = input.description;
|
|
188
|
+
if (input.travelerParty !== undefined)
|
|
189
|
+
updates.travelerParty = input.travelerParty;
|
|
190
|
+
if (input.constraints !== undefined)
|
|
191
|
+
updates.constraints = input.constraints;
|
|
192
|
+
if (input.status !== undefined)
|
|
193
|
+
updates.status = input.status;
|
|
194
|
+
if (input.updatedBy !== undefined)
|
|
195
|
+
updates.updatedBy = input.updatedBy;
|
|
196
|
+
const [row] = (await db
|
|
197
|
+
.update(tripEnvelopes)
|
|
198
|
+
.set(updates)
|
|
199
|
+
.where(eq(tripEnvelopes.id, envelopeId))
|
|
200
|
+
.returning());
|
|
201
|
+
return row ?? null;
|
|
202
|
+
}
|
|
203
|
+
export async function addComponent(db, input) {
|
|
204
|
+
const values = {
|
|
205
|
+
envelopeId: input.envelopeId,
|
|
206
|
+
sequence: input.sequence,
|
|
207
|
+
kind: input.kind,
|
|
208
|
+
description: input.description,
|
|
209
|
+
entityModule: input.catalogRef?.entityModule,
|
|
210
|
+
entityId: input.catalogRef?.entityId,
|
|
211
|
+
sourceKind: input.catalogRef?.sourceKind,
|
|
212
|
+
sourceConnectionId: input.catalogRef?.sourceConnectionId,
|
|
213
|
+
sourceRef: input.catalogRef?.sourceRef,
|
|
214
|
+
componentCurrency: input.estimatedPricing?.currency,
|
|
215
|
+
componentSubtotalAmountCents: input.estimatedPricing?.subtotalAmountCents,
|
|
216
|
+
componentTaxAmountCents: input.estimatedPricing?.taxAmountCents,
|
|
217
|
+
componentTotalAmountCents: input.estimatedPricing?.totalAmountCents,
|
|
218
|
+
pricingSnapshot: input.estimatedPricing,
|
|
219
|
+
metadata: input.metadata,
|
|
220
|
+
};
|
|
221
|
+
const [component] = (await db
|
|
222
|
+
.insert(tripComponents)
|
|
223
|
+
.values(values)
|
|
224
|
+
.returning());
|
|
225
|
+
if (!component)
|
|
226
|
+
throw new Error("addComponent: insert returned no component");
|
|
227
|
+
await createComponentEvent(db, {
|
|
228
|
+
envelopeId: component.envelopeId,
|
|
229
|
+
componentId: component.id,
|
|
230
|
+
eventType: "created",
|
|
231
|
+
toStatus: component.status,
|
|
232
|
+
payload: {},
|
|
233
|
+
});
|
|
234
|
+
return component;
|
|
235
|
+
}
|
|
236
|
+
export async function updateComponent(db, componentId, input) {
|
|
237
|
+
const existing = await getTripComponentOrThrow(db, componentId);
|
|
238
|
+
assertTripComponentCanBeUpdated(existing, input);
|
|
239
|
+
const updates = {
|
|
240
|
+
updatedAt: new Date(),
|
|
241
|
+
...toCatalogRefPatch(input.catalogRef),
|
|
242
|
+
};
|
|
243
|
+
if (input.sequence !== undefined)
|
|
244
|
+
updates.sequence = input.sequence;
|
|
245
|
+
if (input.status !== undefined)
|
|
246
|
+
updates.status = input.status;
|
|
247
|
+
if (input.description !== undefined)
|
|
248
|
+
updates.description = input.description;
|
|
249
|
+
if (input.metadata !== undefined)
|
|
250
|
+
updates.metadata = input.metadata;
|
|
251
|
+
if (input.warningCodes !== undefined)
|
|
252
|
+
updates.warningCodes = input.warningCodes;
|
|
253
|
+
const [component] = (await db
|
|
254
|
+
.update(tripComponents)
|
|
255
|
+
.set(updates)
|
|
256
|
+
.where(eq(tripComponents.id, componentId))
|
|
257
|
+
.returning());
|
|
258
|
+
if (!component)
|
|
259
|
+
return null;
|
|
260
|
+
await createComponentEvent(db, {
|
|
261
|
+
envelopeId: component.envelopeId,
|
|
262
|
+
componentId: component.id,
|
|
263
|
+
eventType: input.status ? statusToEventType(input.status) : "updated",
|
|
264
|
+
fromStatus: existing.status,
|
|
265
|
+
toStatus: component.status,
|
|
266
|
+
payload: {},
|
|
267
|
+
});
|
|
268
|
+
return component;
|
|
269
|
+
}
|
|
270
|
+
export async function updateComponentRefs(db, componentId, input) {
|
|
271
|
+
const existing = await getTripComponentOrThrow(db, componentId);
|
|
272
|
+
assertTripComponentCanReceiveRefs(existing, input);
|
|
273
|
+
const updates = {
|
|
274
|
+
updatedAt: new Date(),
|
|
275
|
+
};
|
|
276
|
+
if (input.bookingDraftId !== undefined)
|
|
277
|
+
updates.bookingDraftId = input.bookingDraftId;
|
|
278
|
+
if (input.catalogQuoteId !== undefined)
|
|
279
|
+
updates.catalogQuoteId = input.catalogQuoteId;
|
|
280
|
+
if (input.committedRef?.bookingId !== undefined)
|
|
281
|
+
updates.bookingId = input.committedRef.bookingId;
|
|
282
|
+
if (input.committedRef?.bookingGroupId !== undefined) {
|
|
283
|
+
updates.bookingGroupId = input.committedRef.bookingGroupId;
|
|
284
|
+
}
|
|
285
|
+
if (input.committedRef?.orderId !== undefined)
|
|
286
|
+
updates.orderId = input.committedRef.orderId;
|
|
287
|
+
if (input.committedRef?.paymentSessionId !== undefined) {
|
|
288
|
+
updates.paymentSessionId = input.committedRef.paymentSessionId;
|
|
289
|
+
}
|
|
290
|
+
if (input.committedRef?.providerRef !== undefined) {
|
|
291
|
+
updates.providerRef = input.committedRef.providerRef;
|
|
292
|
+
}
|
|
293
|
+
if (input.committedRef?.supplierRef !== undefined) {
|
|
294
|
+
updates.supplierRef = input.committedRef.supplierRef;
|
|
295
|
+
}
|
|
296
|
+
const [component] = (await db
|
|
297
|
+
.update(tripComponents)
|
|
298
|
+
.set(updates)
|
|
299
|
+
.where(eq(tripComponents.id, componentId))
|
|
300
|
+
.returning());
|
|
301
|
+
return component ?? null;
|
|
302
|
+
}
|
|
303
|
+
export async function removeComponent(db, componentId) {
|
|
304
|
+
return updateComponent(db, componentId, { status: "removed" });
|
|
305
|
+
}
|
|
306
|
+
export async function reorderComponents(db, input) {
|
|
307
|
+
const rows = (await db
|
|
308
|
+
.select()
|
|
309
|
+
.from(tripComponents)
|
|
310
|
+
.where(inArray(tripComponents.id, input.componentIds)));
|
|
311
|
+
const found = new Set(rows.map((row) => row.id));
|
|
312
|
+
const missing = input.componentIds.filter((id) => !found.has(id));
|
|
313
|
+
if (missing.length > 0) {
|
|
314
|
+
throw new TravelComposerInvariantError(`Cannot reorder missing trip components: ${missing.join(", ")}`);
|
|
315
|
+
}
|
|
316
|
+
for (const row of rows) {
|
|
317
|
+
if (row.envelopeId !== input.envelopeId) {
|
|
318
|
+
throw new TravelComposerInvariantError(`Trip component ${row.id} does not belong to envelope ${input.envelopeId}`);
|
|
319
|
+
}
|
|
320
|
+
if (row.status === "removed") {
|
|
321
|
+
throw new TravelComposerInvariantError(`Trip component ${row.id} is removed`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const updated = [];
|
|
325
|
+
for (const [sequence, componentId] of input.componentIds.entries()) {
|
|
326
|
+
const [row] = (await db
|
|
327
|
+
.update(tripComponents)
|
|
328
|
+
.set({ sequence, updatedAt: new Date() })
|
|
329
|
+
.where(eq(tripComponents.id, componentId))
|
|
330
|
+
.returning());
|
|
331
|
+
if (row)
|
|
332
|
+
updated.push(row);
|
|
333
|
+
}
|
|
334
|
+
return updated.sort((a, b) => a.sequence - b.sequence);
|
|
335
|
+
}
|
|
336
|
+
function compareEnvelopes(a, b, field) {
|
|
337
|
+
switch (field) {
|
|
338
|
+
case "createdAt":
|
|
339
|
+
return (a.createdAt?.getTime() ?? 0) - (b.createdAt?.getTime() ?? 0);
|
|
340
|
+
case "status":
|
|
341
|
+
return a.status.localeCompare(b.status);
|
|
342
|
+
case "total":
|
|
343
|
+
return (a.aggregateTotalAmountCents ?? 0) - (b.aggregateTotalAmountCents ?? 0);
|
|
344
|
+
default:
|
|
345
|
+
return (a.updatedAt?.getTime() ?? 0) - (b.updatedAt?.getTime() ?? 0);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function toCatalogRefPatch(input) {
|
|
349
|
+
if (input === undefined)
|
|
350
|
+
return {};
|
|
351
|
+
if (input === null) {
|
|
352
|
+
return {
|
|
353
|
+
entityModule: null,
|
|
354
|
+
entityId: null,
|
|
355
|
+
sourceKind: null,
|
|
356
|
+
sourceConnectionId: null,
|
|
357
|
+
sourceRef: null,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
entityModule: input.entityModule,
|
|
362
|
+
entityId: input.entityId,
|
|
363
|
+
sourceKind: input.sourceKind,
|
|
364
|
+
sourceConnectionId: input.sourceConnectionId ?? null,
|
|
365
|
+
sourceRef: input.sourceRef ?? null,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async function getTripComponentOrThrow(db, id) {
|
|
369
|
+
const [component] = (await db
|
|
370
|
+
.select()
|
|
371
|
+
.from(tripComponents)
|
|
372
|
+
.where(eq(tripComponents.id, id))
|
|
373
|
+
.limit(1));
|
|
374
|
+
if (!component)
|
|
375
|
+
throw new TravelComposerInvariantError(`Trip component ${id} was not found`);
|
|
376
|
+
return component;
|
|
377
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type { BookingDraftV1, QuoteResponseV1 } from "@voyantjs/catalog/booking-engine";
|
|
2
|
+
import type { CatalogComponentBookingDraftOverrides } from "./catalog-component-adapter.js";
|
|
3
|
+
import type { TripComponent, TripEnvelope } from "./schema.js";
|
|
4
|
+
import type { PriceTripInput, StartTripCheckoutInput, TripComponentStatus } from "./validation.js";
|
|
5
|
+
export interface Trip {
|
|
6
|
+
envelope: TripEnvelope;
|
|
7
|
+
components: TripComponent[];
|
|
8
|
+
}
|
|
9
|
+
export interface TripListResult {
|
|
10
|
+
data: Trip[];
|
|
11
|
+
total: number;
|
|
12
|
+
limit: number;
|
|
13
|
+
offset: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PriceTripResult {
|
|
16
|
+
envelope: TripEnvelope;
|
|
17
|
+
components: TripComponent[];
|
|
18
|
+
pricing: {
|
|
19
|
+
currency: string;
|
|
20
|
+
subtotalAmountCents: number;
|
|
21
|
+
taxAmountCents: number;
|
|
22
|
+
totalAmountCents: number;
|
|
23
|
+
componentCount: number;
|
|
24
|
+
pricedComponentCount: number;
|
|
25
|
+
warnings?: string[];
|
|
26
|
+
};
|
|
27
|
+
warnings: string[];
|
|
28
|
+
failures: Array<{
|
|
29
|
+
componentId: string;
|
|
30
|
+
reason: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface CatalogComponentQuoteInput {
|
|
34
|
+
component: TripComponent;
|
|
35
|
+
bookingDraft: BookingDraftV1;
|
|
36
|
+
scope: PriceTripInput["scope"];
|
|
37
|
+
ttlMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface PriceTripDeps {
|
|
40
|
+
quoteCatalogComponent: (input: CatalogComponentQuoteInput) => Promise<QuoteResponseV1>;
|
|
41
|
+
componentBookingDraftOverrides?: Record<string, CatalogComponentBookingDraftOverrides>;
|
|
42
|
+
}
|
|
43
|
+
export interface ReserveComponentInput {
|
|
44
|
+
envelope: TripEnvelope;
|
|
45
|
+
component: TripComponent;
|
|
46
|
+
}
|
|
47
|
+
export interface ReserveComponentResult {
|
|
48
|
+
status: "held" | "booked";
|
|
49
|
+
bookingId?: string;
|
|
50
|
+
bookingGroupId?: string;
|
|
51
|
+
orderId?: string;
|
|
52
|
+
paymentSessionId?: string;
|
|
53
|
+
providerRef?: string;
|
|
54
|
+
supplierRef?: string;
|
|
55
|
+
holdToken?: string;
|
|
56
|
+
holdExpiresAt?: string;
|
|
57
|
+
warnings?: string[];
|
|
58
|
+
}
|
|
59
|
+
export type ReserveComponentPreflightStatus = "ok" | "price_changed" | "unavailable" | "expired";
|
|
60
|
+
export interface ReserveComponentPreflightResult {
|
|
61
|
+
status: ReserveComponentPreflightStatus;
|
|
62
|
+
reason?: string;
|
|
63
|
+
warnings?: string[];
|
|
64
|
+
details?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
export interface ReleaseReservedComponentInput {
|
|
67
|
+
component: TripComponent;
|
|
68
|
+
reserveResult: ReserveComponentResult;
|
|
69
|
+
}
|
|
70
|
+
export interface ReleaseReservedComponentResult {
|
|
71
|
+
released: boolean;
|
|
72
|
+
reason?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface ReserveTripDeps {
|
|
75
|
+
quoteCatalogComponentBeforeReserve?: (input: CatalogComponentQuoteInput) => Promise<QuoteResponseV1>;
|
|
76
|
+
validateNonCatalogComponentBeforeReserve?: (input: ReserveComponentInput) => Promise<ReserveComponentPreflightResult | null | undefined>;
|
|
77
|
+
reserveCatalogComponent: (input: ReserveComponentInput) => Promise<ReserveComponentResult>;
|
|
78
|
+
reserveNonCatalogComponent?: (input: ReserveComponentInput) => Promise<ReserveComponentResult | null | undefined>;
|
|
79
|
+
releaseCatalogComponent?: (input: ReleaseReservedComponentInput) => Promise<ReleaseReservedComponentResult>;
|
|
80
|
+
}
|
|
81
|
+
export interface ReserveTripResult {
|
|
82
|
+
envelope: TripEnvelope;
|
|
83
|
+
components: TripComponent[];
|
|
84
|
+
reserved: Array<{
|
|
85
|
+
componentId: string;
|
|
86
|
+
status: "held" | "booked";
|
|
87
|
+
}>;
|
|
88
|
+
failures: Array<{
|
|
89
|
+
componentId: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
code?: string;
|
|
92
|
+
details?: Record<string, unknown>;
|
|
93
|
+
}>;
|
|
94
|
+
compensations: Array<{
|
|
95
|
+
componentId: string;
|
|
96
|
+
status: "released" | "release_failed" | "release_not_configured";
|
|
97
|
+
reason?: string;
|
|
98
|
+
}>;
|
|
99
|
+
warnings: string[];
|
|
100
|
+
}
|
|
101
|
+
export type CheckoutHandoffKind = "card_redirect" | "payment_session" | "bank_transfer_instructions" | "hold_placed" | "inquiry_received";
|
|
102
|
+
export interface ComponentCheckoutInput {
|
|
103
|
+
envelope: TripEnvelope;
|
|
104
|
+
component: TripComponent;
|
|
105
|
+
intent: StartTripCheckoutInput["intent"];
|
|
106
|
+
request: StartTripCheckoutInput["request"];
|
|
107
|
+
}
|
|
108
|
+
export interface ComponentCheckoutResult {
|
|
109
|
+
kind: CheckoutHandoffKind;
|
|
110
|
+
status?: "checkout_started" | "booked";
|
|
111
|
+
bookingId?: string;
|
|
112
|
+
bookingGroupId?: string;
|
|
113
|
+
orderId?: string;
|
|
114
|
+
paymentSessionId?: string;
|
|
115
|
+
providerRef?: string;
|
|
116
|
+
supplierRef?: string;
|
|
117
|
+
checkoutUrl?: string | null;
|
|
118
|
+
externalReference?: string | null;
|
|
119
|
+
bankTransferInstructions?: Record<string, unknown> | null;
|
|
120
|
+
expiresAt?: string | null;
|
|
121
|
+
warnings?: string[];
|
|
122
|
+
}
|
|
123
|
+
export interface TripCheckoutInput {
|
|
124
|
+
trip: Trip;
|
|
125
|
+
intent: StartTripCheckoutInput["intent"];
|
|
126
|
+
request: StartTripCheckoutInput["request"];
|
|
127
|
+
}
|
|
128
|
+
export interface TripCheckoutResult {
|
|
129
|
+
kind: CheckoutHandoffKind;
|
|
130
|
+
status?: "checkout_started" | "booked";
|
|
131
|
+
paymentSessionId?: string;
|
|
132
|
+
checkoutUrl?: string | null;
|
|
133
|
+
bankTransferInstructions?: Record<string, unknown> | null;
|
|
134
|
+
expiresAt?: string | null;
|
|
135
|
+
warnings?: string[];
|
|
136
|
+
}
|
|
137
|
+
export interface StartCheckoutDeps {
|
|
138
|
+
startTripCheckout?: (input: TripCheckoutInput) => Promise<TripCheckoutResult>;
|
|
139
|
+
startComponentCheckout: (input: ComponentCheckoutInput) => Promise<ComponentCheckoutResult>;
|
|
140
|
+
}
|
|
141
|
+
export interface StartedTripComponentCheckout {
|
|
142
|
+
componentId: string;
|
|
143
|
+
kind: CheckoutHandoffKind;
|
|
144
|
+
bookingId: string | null;
|
|
145
|
+
orderId: string | null;
|
|
146
|
+
paymentSessionId: string | null;
|
|
147
|
+
checkoutUrl: string | null;
|
|
148
|
+
bankTransferInstructions: Record<string, unknown> | null;
|
|
149
|
+
expiresAt: string | null;
|
|
150
|
+
}
|
|
151
|
+
export interface StartCheckoutTarget {
|
|
152
|
+
envelopeId: string;
|
|
153
|
+
status: "checkout_started";
|
|
154
|
+
currency: string;
|
|
155
|
+
totalAmountCents: number;
|
|
156
|
+
paymentSessionId: string | null;
|
|
157
|
+
checkoutUrl: string | null;
|
|
158
|
+
holdExpiresAt: string | null;
|
|
159
|
+
}
|
|
160
|
+
export interface StartCheckoutResult {
|
|
161
|
+
envelope: TripEnvelope;
|
|
162
|
+
components: TripComponent[];
|
|
163
|
+
target: StartCheckoutTarget;
|
|
164
|
+
componentCheckouts: StartedTripComponentCheckout[];
|
|
165
|
+
failures: Array<{
|
|
166
|
+
componentId: string;
|
|
167
|
+
reason: string;
|
|
168
|
+
}>;
|
|
169
|
+
warnings: string[];
|
|
170
|
+
}
|
|
171
|
+
export interface CompleteTripCheckoutInput {
|
|
172
|
+
envelopeId?: string;
|
|
173
|
+
paymentSessionId?: string;
|
|
174
|
+
paidAt?: string;
|
|
175
|
+
actorId?: string | null;
|
|
176
|
+
payload?: Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
export interface CompleteTripCheckoutResult {
|
|
179
|
+
envelope: TripEnvelope;
|
|
180
|
+
components: TripComponent[];
|
|
181
|
+
updatedComponentIds: string[];
|
|
182
|
+
alreadyCompleted: boolean;
|
|
183
|
+
}
|
|
184
|
+
export type ComponentCancellationAction = "cancel" | "no_op" | "staff_remediation";
|
|
185
|
+
export interface ComponentCancellationPreviewInput {
|
|
186
|
+
envelope: TripEnvelope;
|
|
187
|
+
component: TripComponent;
|
|
188
|
+
reason?: string;
|
|
189
|
+
requestedAt: Date;
|
|
190
|
+
request: Record<string, unknown>;
|
|
191
|
+
}
|
|
192
|
+
export interface ComponentCancellationPreview {
|
|
193
|
+
componentId: string;
|
|
194
|
+
action: ComponentCancellationAction;
|
|
195
|
+
currentStatus: TripComponentStatus;
|
|
196
|
+
staffActionRequired: boolean;
|
|
197
|
+
reason?: string;
|
|
198
|
+
refundAmountCents?: number;
|
|
199
|
+
refundCurrency?: string;
|
|
200
|
+
penaltyAmountCents?: number;
|
|
201
|
+
supplierCancellationDeadline?: string | null;
|
|
202
|
+
policySummary?: string | null;
|
|
203
|
+
snapshot?: Record<string, unknown>;
|
|
204
|
+
}
|
|
205
|
+
export interface PreviewTripCancellationDeps {
|
|
206
|
+
previewComponentCancellation?: (input: ComponentCancellationPreviewInput) => Promise<ComponentCancellationPreview>;
|
|
207
|
+
}
|
|
208
|
+
export interface TripCancellationPreviewResult {
|
|
209
|
+
envelope: TripEnvelope;
|
|
210
|
+
components: TripComponent[];
|
|
211
|
+
preview: {
|
|
212
|
+
envelopeId: string;
|
|
213
|
+
selectedComponentIds: string[];
|
|
214
|
+
currency: string | null;
|
|
215
|
+
estimatedRefundAmountCents: number;
|
|
216
|
+
estimatedPenaltyAmountCents: number;
|
|
217
|
+
staffActionRequired: boolean;
|
|
218
|
+
components: ComponentCancellationPreview[];
|
|
219
|
+
warnings: string[];
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export interface CancelComponentInput extends ComponentCancellationPreviewInput {
|
|
223
|
+
preview: ComponentCancellationPreview;
|
|
224
|
+
}
|
|
225
|
+
export interface CancelComponentResult {
|
|
226
|
+
status: "cancelled" | "refused" | "failed";
|
|
227
|
+
refundAmountCents?: number;
|
|
228
|
+
refundCurrency?: string;
|
|
229
|
+
reason?: string;
|
|
230
|
+
snapshot?: Record<string, unknown>;
|
|
231
|
+
}
|
|
232
|
+
export interface CancelTripComponentsDeps extends PreviewTripCancellationDeps {
|
|
233
|
+
cancelComponent?: (input: CancelComponentInput) => Promise<CancelComponentResult>;
|
|
234
|
+
}
|
|
235
|
+
export interface CancelTripComponentsResult extends TripCancellationPreviewResult {
|
|
236
|
+
cancelled: Array<{
|
|
237
|
+
componentId: string;
|
|
238
|
+
status: "cancelled";
|
|
239
|
+
}>;
|
|
240
|
+
remediation: Array<{
|
|
241
|
+
componentId: string;
|
|
242
|
+
reason: string;
|
|
243
|
+
}>;
|
|
244
|
+
skipped: Array<{
|
|
245
|
+
componentId: string;
|
|
246
|
+
reason: string;
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
export declare class TravelComposerInvariantError extends Error {
|
|
250
|
+
constructor(message: string);
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=service-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../src/service-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvF,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAA;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAElG,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,YAA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
|
+
export { cancelComponents, previewCancellation } from "./service-cancellation.js";
|
|
3
|
+
export { completeTripCheckout, startCheckout } from "./service-checkout.js";
|
|
4
|
+
export { aggregateComponentPricing, assertTripComponentCanBeReserved, assertTripComponentCanBeUpdated, assertTripComponentCanReceiveRefs, assertTripComponentCanStartCheckout, checkoutResultToComponentPatch, hasCommittedComponentReference, pricingSnapshotFromBreakdown, reserveResultToComponentPatch, shouldReplayCheckout, shouldReplayReserve, taxLinesFromBreakdown, } from "./service-helpers.js";
|
|
5
|
+
export { applyQuoteToComponent, priceTrip } from "./service-pricing.js";
|
|
6
|
+
export { reserveTrip } from "./service-reservation.js";
|
|
7
|
+
export { addComponent, createTrip, getTrip, listTrips, removeComponent, reorderComponents, updateComponent, updateComponentRefs, updateTrip, } from "./service-trips.js";
|
|
8
|
+
export type { CancelComponentInput, CancelComponentResult, CancelTripComponentsDeps, CancelTripComponentsResult, CatalogComponentQuoteInput, CheckoutHandoffKind, CompleteTripCheckoutInput, CompleteTripCheckoutResult, ComponentCancellationAction, ComponentCancellationPreview, ComponentCancellationPreviewInput, ComponentCheckoutInput, ComponentCheckoutResult, PreviewTripCancellationDeps, PriceTripDeps, PriceTripResult, ReleaseReservedComponentInput, ReleaseReservedComponentResult, ReserveComponentInput, ReserveComponentPreflightResult, ReserveComponentPreflightStatus, ReserveComponentResult, ReserveTripDeps, ReserveTripResult, StartCheckoutDeps, StartCheckoutResult, StartCheckoutTarget, StartedTripComponentCheckout, Trip, TripCancellationPreviewResult, TripCheckoutInput, TripCheckoutResult, TripListResult, } from "./service-types.js";
|
|
9
|
+
export { TravelComposerInvariantError } from "./service-types.js";
|
|
10
|
+
import { cancelComponents, previewCancellation } from "./service-cancellation.js";
|
|
11
|
+
import { completeTripCheckout, startCheckout } from "./service-checkout.js";
|
|
12
|
+
import { priceTrip } from "./service-pricing.js";
|
|
13
|
+
import { reserveTrip } from "./service-reservation.js";
|
|
14
|
+
import { addComponent, createTrip, getTrip, listTrips, removeComponent, reorderComponents, updateComponent, updateComponentRefs, updateTrip } from "./service-trips.js";
|
|
15
|
+
export declare const travelComposerService: {
|
|
16
|
+
getStatus(): TravelComposerStatus;
|
|
17
|
+
createTrip: typeof createTrip;
|
|
18
|
+
getTrip: typeof getTrip;
|
|
19
|
+
listTrips: typeof listTrips;
|
|
20
|
+
updateTrip: typeof updateTrip;
|
|
21
|
+
addComponent: typeof addComponent;
|
|
22
|
+
updateComponent: typeof updateComponent;
|
|
23
|
+
updateComponentRefs: typeof updateComponentRefs;
|
|
24
|
+
removeComponent: typeof removeComponent;
|
|
25
|
+
reorderComponents: typeof reorderComponents;
|
|
26
|
+
priceTrip: typeof priceTrip;
|
|
27
|
+
reserveTrip: typeof reserveTrip;
|
|
28
|
+
startCheckout: typeof startCheckout;
|
|
29
|
+
completeTripCheckout: typeof completeTripCheckout;
|
|
30
|
+
previewCancellation: typeof previewCancellation;
|
|
31
|
+
cancelComponents: typeof cancelComponents;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=service.d.ts.map
|