@voyant-travel/commerce 0.2.1 → 0.2.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../../src/pricing/routes-public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../../src/pricing/routes-public.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAavD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAsB5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
|
@@ -3,12 +3,22 @@ import { Hono } from "hono";
|
|
|
3
3
|
import { notFound } from "./routes-shared.js";
|
|
4
4
|
import { publicPricingService } from "./service-public.js";
|
|
5
5
|
import { publicAvailabilitySnapshotQuerySchema, publicProductPricingQuerySchema, } from "./validation-public.js";
|
|
6
|
+
const PUBLIC_CACHE_CONTROL = "public, s-maxage=60, stale-while-revalidate=300";
|
|
7
|
+
function cachePublicRead(c) {
|
|
8
|
+
c.header("Cache-Control", PUBLIC_CACHE_CONTROL);
|
|
9
|
+
}
|
|
6
10
|
export const publicPricingRoutes = new Hono()
|
|
7
11
|
.get("/products/:productId/pricing", async (c) => {
|
|
8
12
|
const snapshot = await publicPricingService.getProductPricingSnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicProductPricingQuerySchema));
|
|
9
|
-
|
|
13
|
+
if (!snapshot)
|
|
14
|
+
return notFound(c, "Public pricing snapshot not found");
|
|
15
|
+
cachePublicRead(c);
|
|
16
|
+
return c.json({ data: snapshot });
|
|
10
17
|
})
|
|
11
18
|
.get("/products/:productId/availability", async (c) => {
|
|
12
19
|
const snapshot = await publicPricingService.getAvailabilitySnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicAvailabilitySnapshotQuerySchema));
|
|
13
|
-
|
|
20
|
+
if (!snapshot)
|
|
21
|
+
return notFound(c, "Public availability snapshot not found");
|
|
22
|
+
cachePublicRead(c);
|
|
23
|
+
return c.json(snapshot);
|
|
14
24
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/commerce",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"hono": "^4.12.10",
|
|
21
21
|
"rrule": "^2.8.1",
|
|
22
22
|
"zod": "^4.3.6",
|
|
23
|
-
"@voyant-travel/catalog": "^0.118.
|
|
23
|
+
"@voyant-travel/catalog": "^0.118.1",
|
|
24
24
|
"@voyant-travel/core": "^0.109.0",
|
|
25
25
|
"@voyant-travel/db": "^0.108.1",
|
|
26
|
-
"@voyant-travel/distribution": "^0.110.
|
|
27
|
-
"@voyant-travel/hono": "^0.110.
|
|
28
|
-
"@voyant-travel/products-contracts": "^0.105.
|
|
29
|
-
"@voyant-travel/workflows": "^0.
|
|
26
|
+
"@voyant-travel/distribution": "^0.110.4",
|
|
27
|
+
"@voyant-travel/hono": "^0.110.3",
|
|
28
|
+
"@voyant-travel/products-contracts": "^0.105.5",
|
|
29
|
+
"@voyant-travel/workflows": "^0.109.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "^6.0.2",
|