@voyant-travel/storefront 0.121.0 → 0.121.2
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/dist/routes-public.d.ts +11 -11
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +23 -17
- package/package.json +14 -14
package/dist/routes-public.d.ts
CHANGED
|
@@ -1278,6 +1278,17 @@ export declare function createStorefrontPublicRoutes(options?: StorefrontService
|
|
|
1278
1278
|
} & {
|
|
1279
1279
|
"/offers/:slug": {
|
|
1280
1280
|
$get: {
|
|
1281
|
+
input: {
|
|
1282
|
+
param: {
|
|
1283
|
+
slug: string;
|
|
1284
|
+
};
|
|
1285
|
+
};
|
|
1286
|
+
output: {
|
|
1287
|
+
error: string;
|
|
1288
|
+
};
|
|
1289
|
+
outputFormat: "json";
|
|
1290
|
+
status: 404;
|
|
1291
|
+
} | {
|
|
1281
1292
|
input: {
|
|
1282
1293
|
param: {
|
|
1283
1294
|
slug: string;
|
|
@@ -1306,17 +1317,6 @@ export declare function createStorefrontPublicRoutes(options?: StorefrontService
|
|
|
1306
1317
|
};
|
|
1307
1318
|
outputFormat: "json";
|
|
1308
1319
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1309
|
-
} | {
|
|
1310
|
-
input: {
|
|
1311
|
-
param: {
|
|
1312
|
-
slug: string;
|
|
1313
|
-
};
|
|
1314
|
-
};
|
|
1315
|
-
output: {
|
|
1316
|
-
error: string;
|
|
1317
|
-
};
|
|
1318
|
-
outputFormat: "json";
|
|
1319
|
-
status: 404;
|
|
1320
1320
|
};
|
|
1321
1321
|
};
|
|
1322
1322
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,O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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA2W9E;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
package/dist/routes-public.js
CHANGED
|
@@ -15,6 +15,9 @@ import { storefrontTransportEligibilityInputSchema } from "./validation-transpor
|
|
|
15
15
|
* to success responses only.
|
|
16
16
|
*/
|
|
17
17
|
const PUBLIC_CACHE_CONTROL = "public, s-maxage=60, stale-while-revalidate=300";
|
|
18
|
+
function setPublicCacheHeaders(c) {
|
|
19
|
+
c.header("Cache-Control", PUBLIC_CACHE_CONTROL);
|
|
20
|
+
}
|
|
18
21
|
/**
|
|
19
22
|
* KV read-model TTL for the departure list (RFC voyant#1687 Phase 2.2).
|
|
20
23
|
* Departure availability shifts with every booking, so unlike the
|
|
@@ -144,14 +147,14 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
144
147
|
const departure = await storefrontService.getDeparture(c.get("db"), c.req.param("departureId"));
|
|
145
148
|
if (!departure)
|
|
146
149
|
return c.json({ error: "Storefront departure not found" }, 404);
|
|
147
|
-
c
|
|
150
|
+
setPublicCacheHeaders(c);
|
|
148
151
|
return c.json({ data: departure });
|
|
149
152
|
})
|
|
150
153
|
.get("/products/:productId/departures", async (c) => {
|
|
151
154
|
const productId = c.req.param("productId");
|
|
152
155
|
const query = await parseQuery(c, storefrontDepartureListQuerySchema);
|
|
153
156
|
const result = await readThroughDepartures(c, departuresDocKey(productId, query), () => storefrontService.listProductDepartures(c.get("db"), productId, query));
|
|
154
|
-
c
|
|
157
|
+
setPublicCacheHeaders(c);
|
|
155
158
|
return c.json(result);
|
|
156
159
|
})
|
|
157
160
|
.post("/departures/:departureId/price", async (c) => {
|
|
@@ -301,14 +304,14 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
301
304
|
})
|
|
302
305
|
.get("/products/:productId/extensions", async (c) => {
|
|
303
306
|
const query = await parseQuery(c, storefrontProductExtensionsQuerySchema);
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
});
|
|
307
|
+
const extensions = await storefrontService.getProductExtensions(c.get("db"), c.req.param("productId"), query.optionId);
|
|
308
|
+
setPublicCacheHeaders(c);
|
|
309
|
+
return c.json({ data: extensions });
|
|
307
310
|
})
|
|
308
311
|
.get("/products/:productId/availability", async (c) => {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
});
|
|
312
|
+
const availability = await storefrontService.getProductAvailabilitySummary(c.get("db"), c.req.param("productId"), await parseQuery(c, storefrontProductAvailabilitySummaryQuerySchema));
|
|
313
|
+
setPublicCacheHeaders(c);
|
|
314
|
+
return c.json({ data: availability });
|
|
312
315
|
})
|
|
313
316
|
.get("/products/:productId/departures/:departureId/itinerary", async (c) => {
|
|
314
317
|
const itinerary = await storefrontService.getDepartureItinerary(c.get("db"), {
|
|
@@ -317,19 +320,19 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
317
320
|
});
|
|
318
321
|
if (!itinerary)
|
|
319
322
|
return c.json({ error: "Storefront itinerary not found" }, 404);
|
|
320
|
-
c
|
|
323
|
+
setPublicCacheHeaders(c);
|
|
321
324
|
return c.json({ data: itinerary });
|
|
322
325
|
})
|
|
323
326
|
.get("/products/:productId/offers", async (c) => {
|
|
324
327
|
const query = await parseQuery(c, storefrontPromotionalOfferListQuerySchema);
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
context: getRequestContext(c),
|
|
331
|
-
}),
|
|
328
|
+
const offers = await storefrontService.listApplicableOffers({
|
|
329
|
+
productId: c.req.param("productId"),
|
|
330
|
+
departureId: query.departureId,
|
|
331
|
+
locale: query.locale,
|
|
332
|
+
context: getRequestContext(c),
|
|
332
333
|
});
|
|
334
|
+
setPublicCacheHeaders(c);
|
|
335
|
+
return c.json({ data: offers });
|
|
333
336
|
})
|
|
334
337
|
.get("/offers/:slug", async (c) => {
|
|
335
338
|
const query = await parseQuery(c, storefrontPromotionalOfferListQuerySchema);
|
|
@@ -338,7 +341,10 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
338
341
|
locale: query.locale,
|
|
339
342
|
context: getRequestContext(c),
|
|
340
343
|
});
|
|
341
|
-
|
|
344
|
+
if (!offer)
|
|
345
|
+
return c.json({ error: "Storefront offer not found" }, 404);
|
|
346
|
+
setPublicCacheHeaders(c);
|
|
347
|
+
return c.json({ data: offer });
|
|
342
348
|
})
|
|
343
349
|
.post("/offers/:slug/apply", async (c) => {
|
|
344
350
|
const result = await storefrontService.applyOffer({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/storefront",
|
|
3
|
-
"version": "0.121.
|
|
3
|
+
"version": "0.121.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -90,19 +90,19 @@
|
|
|
90
90
|
"drizzle-orm": "^0.45.2",
|
|
91
91
|
"hono": "^4.12.10",
|
|
92
92
|
"zod": "^4.3.6",
|
|
93
|
-
"@voyant-travel/bookings": "^0.120.
|
|
94
|
-
"@voyant-travel/commerce": "^0.2.
|
|
93
|
+
"@voyant-travel/bookings": "^0.120.2",
|
|
94
|
+
"@voyant-travel/commerce": "^0.2.3",
|
|
95
95
|
"@voyant-travel/core": "^0.109.0",
|
|
96
|
-
"@voyant-travel/db": "^0.108.
|
|
97
|
-
"@voyant-travel/finance": "^0.120.
|
|
98
|
-
"@voyant-travel/hono": "^0.110.
|
|
99
|
-
"@voyant-travel/
|
|
100
|
-
"@voyant-travel/
|
|
96
|
+
"@voyant-travel/db": "^0.108.1",
|
|
97
|
+
"@voyant-travel/finance": "^0.120.1",
|
|
98
|
+
"@voyant-travel/hono": "^0.110.3",
|
|
99
|
+
"@voyant-travel/relationships-contracts": "^0.107.0",
|
|
100
|
+
"@voyant-travel/utils": "^0.105.2"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@voyant-travel/identity": "^0.120.
|
|
104
|
-
"@voyant-travel/
|
|
105
|
-
"@voyant-travel/
|
|
103
|
+
"@voyant-travel/identity": "^0.120.1",
|
|
104
|
+
"@voyant-travel/legal": "^0.120.2",
|
|
105
|
+
"@voyant-travel/relationships": "^0.119.3"
|
|
106
106
|
},
|
|
107
107
|
"peerDependenciesMeta": {
|
|
108
108
|
"@voyant-travel/identity": {
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"typescript": "^6.0.2",
|
|
120
120
|
"vitest": "^4.1.2",
|
|
121
|
+
"@voyant-travel/identity": "^0.120.1",
|
|
121
122
|
"@voyant-travel/inventory": "^0.2.0",
|
|
122
|
-
"@voyant-travel/legal": "^0.120.
|
|
123
|
-
"@voyant-travel/operations": "^0.1.0",
|
|
124
|
-
"@voyant-travel/identity": "^0.120.0",
|
|
123
|
+
"@voyant-travel/legal": "^0.120.2",
|
|
125
124
|
"@voyant-travel/relationships": "^0.119.3",
|
|
125
|
+
"@voyant-travel/operations": "^0.1.0",
|
|
126
126
|
"@voyant-travel/voyant-typescript-config": "^0.1.0"
|
|
127
127
|
},
|
|
128
128
|
"files": [
|