@voyant-travel/charters 0.118.0 → 0.118.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.map +1 -1
- package/dist/routes-public.js +13 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAYjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;KACvB,CAAA;CACF,CAAA;AAgBD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAyM7B,CAAA;AAEJ,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAA"}
|
package/dist/routes-public.js
CHANGED
|
@@ -7,6 +7,10 @@ import { chartersService } from "./service.js";
|
|
|
7
7
|
import { composePerSuiteQuote, composeWholeYachtQuote, pricingService } from "./service-pricing.js";
|
|
8
8
|
import { productListQuerySchema, voyageListQuerySchema } from "./validation-core.js";
|
|
9
9
|
import { currencyCodeSchema } from "./validation-shared.js";
|
|
10
|
+
const PUBLIC_CACHE_CONTROL = "public, s-maxage=60, stale-while-revalidate=300";
|
|
11
|
+
function cachePublicRead(c) {
|
|
12
|
+
c.header("Cache-Control", PUBLIC_CACHE_CONTROL);
|
|
13
|
+
}
|
|
10
14
|
const perSuiteQuotePayload = z.object({
|
|
11
15
|
suiteId: z.string(),
|
|
12
16
|
currency: currencyCodeSchema,
|
|
@@ -55,6 +59,7 @@ export const chartersPublicRoutes = new Hono()
|
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
61
|
}
|
|
62
|
+
cachePublicRead(c);
|
|
58
63
|
return c.json({
|
|
59
64
|
data: [...localItems, ...adapterItems],
|
|
60
65
|
total: local.total + adapterItems.length,
|
|
@@ -75,6 +80,7 @@ export const chartersPublicRoutes = new Hono()
|
|
|
75
80
|
const yacht = product.defaultYachtRef
|
|
76
81
|
? await adapter.fetchYacht(product.defaultYachtRef)
|
|
77
82
|
: null;
|
|
83
|
+
cachePublicRead(c);
|
|
78
84
|
return c.json({
|
|
79
85
|
data: {
|
|
80
86
|
source: "external",
|
|
@@ -93,6 +99,7 @@ export const chartersPublicRoutes = new Hono()
|
|
|
93
99
|
});
|
|
94
100
|
if (!detail || detail.status !== "live")
|
|
95
101
|
return c.json({ error: "not_found" }, 404);
|
|
102
|
+
cachePublicRead(c);
|
|
96
103
|
return c.json({ data: detail });
|
|
97
104
|
}
|
|
98
105
|
// parsed.kind === "invalid": treat the raw param as a slug lookup
|
|
@@ -110,11 +117,13 @@ export const chartersPublicRoutes = new Hono()
|
|
|
110
117
|
});
|
|
111
118
|
if (!detail || detail.status !== "live")
|
|
112
119
|
return c.json({ error: "not_found" }, 404);
|
|
120
|
+
cachePublicRead(c);
|
|
113
121
|
return c.json({ data: detail });
|
|
114
122
|
})
|
|
115
123
|
.get("/voyages", async (c) => {
|
|
116
124
|
const query = parseQuery(c, voyageListQuerySchema);
|
|
117
125
|
const result = await chartersService.listVoyages(c.get("db"), query);
|
|
126
|
+
cachePublicRead(c);
|
|
118
127
|
return c.json(result);
|
|
119
128
|
})
|
|
120
129
|
.get("/voyages/:key", async (c) => {
|
|
@@ -133,6 +142,7 @@ export const chartersPublicRoutes = new Hono()
|
|
|
133
142
|
adapter.fetchVoyageSuites(ref),
|
|
134
143
|
adapter.fetchVoyageSchedule(ref),
|
|
135
144
|
]);
|
|
145
|
+
cachePublicRead(c);
|
|
136
146
|
return c.json({
|
|
137
147
|
data: {
|
|
138
148
|
source: "external",
|
|
@@ -150,6 +160,7 @@ export const chartersPublicRoutes = new Hono()
|
|
|
150
160
|
});
|
|
151
161
|
if (!row)
|
|
152
162
|
return c.json({ error: "not_found" }, 404);
|
|
163
|
+
cachePublicRead(c);
|
|
153
164
|
return c.json({ data: row });
|
|
154
165
|
})
|
|
155
166
|
.post("/voyages/:key/quote/per-suite", async (c) => {
|
|
@@ -225,10 +236,12 @@ export const chartersPublicRoutes = new Hono()
|
|
|
225
236
|
const yacht = await adapter.fetchYacht({ externalId: parsed.ref });
|
|
226
237
|
if (!yacht)
|
|
227
238
|
return c.json({ error: "not_found" }, 404);
|
|
239
|
+
cachePublicRead(c);
|
|
228
240
|
return c.json({ data: yacht });
|
|
229
241
|
}
|
|
230
242
|
const row = await chartersService.getYachtById(c.get("db"), parsed.id);
|
|
231
243
|
if (!row)
|
|
232
244
|
return c.json({ error: "not_found" }, 404);
|
|
245
|
+
cachePublicRead(c);
|
|
233
246
|
return c.json({ data: row });
|
|
234
247
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/charters",
|
|
3
|
-
"version": "0.118.
|
|
3
|
+
"version": "0.118.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"drizzle-orm": "^0.45.2",
|
|
75
75
|
"hono": "^4.12.10",
|
|
76
76
|
"zod": "^4.3.6",
|
|
77
|
-
"@voyant-travel/bookings": "^0.120.
|
|
77
|
+
"@voyant-travel/bookings": "^0.120.2",
|
|
78
78
|
"@voyant-travel/charters-contracts": "^0.104.1",
|
|
79
79
|
"@voyant-travel/core": "^0.109.0",
|
|
80
|
-
"@voyant-travel/db": "^0.108.
|
|
81
|
-
"@voyant-travel/hono": "^0.110.
|
|
82
|
-
"@voyant-travel/catalog": "^0.118.
|
|
80
|
+
"@voyant-travel/db": "^0.108.1",
|
|
81
|
+
"@voyant-travel/hono": "^0.110.3",
|
|
82
|
+
"@voyant-travel/catalog": "^0.118.1"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"typescript": "^6.0.2",
|