@voyant-travel/inventory 0.1.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.
Files changed (311) hide show
  1. package/LICENSE +201 -0
  2. package/dist/action-ledger-drift.d.ts +29 -0
  3. package/dist/action-ledger-drift.d.ts.map +1 -0
  4. package/dist/action-ledger-drift.js +338 -0
  5. package/dist/action-ledger.d.ts +104 -0
  6. package/dist/action-ledger.d.ts.map +1 -0
  7. package/dist/action-ledger.js +100 -0
  8. package/dist/authoring/builder.d.ts +37 -0
  9. package/dist/authoring/builder.d.ts.map +1 -0
  10. package/dist/authoring/builder.js +248 -0
  11. package/dist/authoring/clone-content.d.ts +38 -0
  12. package/dist/authoring/clone-content.d.ts.map +1 -0
  13. package/dist/authoring/clone-content.js +367 -0
  14. package/dist/authoring/clone-pricing.d.ts +9 -0
  15. package/dist/authoring/clone-pricing.d.ts.map +1 -0
  16. package/dist/authoring/clone-pricing.js +242 -0
  17. package/dist/authoring/clone.d.ts +45 -0
  18. package/dist/authoring/clone.d.ts.map +1 -0
  19. package/dist/authoring/clone.js +142 -0
  20. package/dist/authoring/errors.d.ts +21 -0
  21. package/dist/authoring/errors.d.ts.map +1 -0
  22. package/dist/authoring/errors.js +13 -0
  23. package/dist/authoring/extension.d.ts +248 -0
  24. package/dist/authoring/extension.d.ts.map +1 -0
  25. package/dist/authoring/extension.js +116 -0
  26. package/dist/authoring/index.d.ts +12 -0
  27. package/dist/authoring/index.d.ts.map +1 -0
  28. package/dist/authoring/index.js +11 -0
  29. package/dist/authoring/schema.d.ts +85 -0
  30. package/dist/authoring/schema.d.ts.map +1 -0
  31. package/dist/authoring/schema.js +16 -0
  32. package/dist/authoring/service.d.ts +28 -0
  33. package/dist/authoring/service.d.ts.map +1 -0
  34. package/dist/authoring/service.js +66 -0
  35. package/dist/authoring/spec.d.ts +524 -0
  36. package/dist/authoring/spec.d.ts.map +1 -0
  37. package/dist/authoring/spec.js +167 -0
  38. package/dist/authoring/validate.d.ts +17 -0
  39. package/dist/authoring/validate.d.ts.map +1 -0
  40. package/dist/authoring/validate.js +83 -0
  41. package/dist/authoring.d.ts +2 -0
  42. package/dist/authoring.d.ts.map +1 -0
  43. package/dist/authoring.js +1 -0
  44. package/dist/booking-engine/handler-support.d.ts +91 -0
  45. package/dist/booking-engine/handler-support.d.ts.map +1 -0
  46. package/dist/booking-engine/handler-support.js +355 -0
  47. package/dist/booking-engine/handler.d.ts +404 -0
  48. package/dist/booking-engine/handler.d.ts.map +1 -0
  49. package/dist/booking-engine/handler.js +398 -0
  50. package/dist/booking-engine/index.d.ts +8 -0
  51. package/dist/booking-engine/index.d.ts.map +1 -0
  52. package/dist/booking-engine/index.js +7 -0
  53. package/dist/booking-engine.d.ts +2 -0
  54. package/dist/booking-engine.d.ts.map +1 -0
  55. package/dist/booking-engine.js +1 -0
  56. package/dist/booking-extension.d.ts +278 -0
  57. package/dist/booking-extension.d.ts.map +1 -0
  58. package/dist/booking-extension.js +161 -0
  59. package/dist/catalog-policy-departures.d.ts +52 -0
  60. package/dist/catalog-policy-departures.d.ts.map +1 -0
  61. package/dist/catalog-policy-departures.js +169 -0
  62. package/dist/catalog-policy-destinations.d.ts +43 -0
  63. package/dist/catalog-policy-destinations.d.ts.map +1 -0
  64. package/dist/catalog-policy-destinations.js +165 -0
  65. package/dist/catalog-policy-pricing.d.ts +55 -0
  66. package/dist/catalog-policy-pricing.d.ts.map +1 -0
  67. package/dist/catalog-policy-pricing.js +109 -0
  68. package/dist/catalog-policy-promotions.d.ts +52 -0
  69. package/dist/catalog-policy-promotions.d.ts.map +1 -0
  70. package/dist/catalog-policy-promotions.js +270 -0
  71. package/dist/catalog-policy-taxonomy.d.ts +51 -0
  72. package/dist/catalog-policy-taxonomy.d.ts.map +1 -0
  73. package/dist/catalog-policy-taxonomy.js +191 -0
  74. package/dist/catalog-policy.d.ts +33 -0
  75. package/dist/catalog-policy.d.ts.map +1 -0
  76. package/dist/catalog-policy.js +733 -0
  77. package/dist/content-shape.d.ts +15 -0
  78. package/dist/content-shape.d.ts.map +1 -0
  79. package/dist/content-shape.js +28 -0
  80. package/dist/draft-shape.d.ts +43 -0
  81. package/dist/draft-shape.d.ts.map +1 -0
  82. package/dist/draft-shape.js +48 -0
  83. package/dist/events.d.ts +37 -0
  84. package/dist/events.d.ts.map +1 -0
  85. package/dist/events.js +32 -0
  86. package/dist/extras/catalog-policy.d.ts +30 -0
  87. package/dist/extras/catalog-policy.d.ts.map +1 -0
  88. package/dist/extras/catalog-policy.js +319 -0
  89. package/dist/extras/content-shape.d.ts +5 -0
  90. package/dist/extras/content-shape.d.ts.map +1 -0
  91. package/dist/extras/content-shape.js +13 -0
  92. package/dist/extras/draft-shape.d.ts +34 -0
  93. package/dist/extras/draft-shape.d.ts.map +1 -0
  94. package/dist/extras/draft-shape.js +69 -0
  95. package/dist/extras/routes.d.ts +380 -0
  96. package/dist/extras/routes.d.ts.map +1 -0
  97. package/dist/extras/routes.js +59 -0
  98. package/dist/extras/schema-sourced-content.d.ts +254 -0
  99. package/dist/extras/schema-sourced-content.d.ts.map +1 -0
  100. package/dist/extras/schema-sourced-content.js +45 -0
  101. package/dist/extras/schema.d.ts +628 -0
  102. package/dist/extras/schema.d.ts.map +1 -0
  103. package/dist/extras/schema.js +87 -0
  104. package/dist/extras/service-catalog-plane.d.ts +77 -0
  105. package/dist/extras/service-catalog-plane.d.ts.map +1 -0
  106. package/dist/extras/service-catalog-plane.js +219 -0
  107. package/dist/extras/service-content-synthesizer.d.ts +41 -0
  108. package/dist/extras/service-content-synthesizer.d.ts.map +1 -0
  109. package/dist/extras/service-content-synthesizer.js +138 -0
  110. package/dist/extras/service-content.d.ts +48 -0
  111. package/dist/extras/service-content.d.ts.map +1 -0
  112. package/dist/extras/service-content.js +253 -0
  113. package/dist/extras/service.d.ts +185 -0
  114. package/dist/extras/service.d.ts.map +1 -0
  115. package/dist/extras/service.js +96 -0
  116. package/dist/extras/validation.d.ts +437 -0
  117. package/dist/extras/validation.d.ts.map +1 -0
  118. package/dist/extras/validation.js +149 -0
  119. package/dist/extras.d.ts +267 -0
  120. package/dist/extras.d.ts.map +1 -0
  121. package/dist/extras.js +19 -0
  122. package/dist/index.d.ts +22 -0
  123. package/dist/index.d.ts.map +1 -0
  124. package/dist/index.js +32 -0
  125. package/dist/interface.d.ts +5869 -0
  126. package/dist/interface.d.ts.map +1 -0
  127. package/dist/interface.js +54 -0
  128. package/dist/public-routes.d.ts +2 -0
  129. package/dist/public-routes.d.ts.map +1 -0
  130. package/dist/public-routes.js +1 -0
  131. package/dist/public-validation.d.ts +2 -0
  132. package/dist/public-validation.d.ts.map +1 -0
  133. package/dist/public-validation.js +1 -0
  134. package/dist/read-model.d.ts +25 -0
  135. package/dist/read-model.d.ts.map +1 -0
  136. package/dist/read-model.js +99 -0
  137. package/dist/route-env.d.ts +22 -0
  138. package/dist/route-env.d.ts.map +1 -0
  139. package/dist/route-env.js +1 -0
  140. package/dist/routes-associations.d.ts +164 -0
  141. package/dist/routes-associations.d.ts.map +1 -0
  142. package/dist/routes-associations.js +100 -0
  143. package/dist/routes-catalog.d.ts +436 -0
  144. package/dist/routes-catalog.d.ts.map +1 -0
  145. package/dist/routes-catalog.js +104 -0
  146. package/dist/routes-configuration.d.ts +773 -0
  147. package/dist/routes-configuration.d.ts.map +1 -0
  148. package/dist/routes-configuration.js +364 -0
  149. package/dist/routes-content.d.ts +74 -0
  150. package/dist/routes-content.d.ts.map +1 -0
  151. package/dist/routes-content.js +117 -0
  152. package/dist/routes-core.d.ts +331 -0
  153. package/dist/routes-core.d.ts.map +1 -0
  154. package/dist/routes-core.js +95 -0
  155. package/dist/routes-itinerary.d.ts +759 -0
  156. package/dist/routes-itinerary.d.ts.map +1 -0
  157. package/dist/routes-itinerary.js +387 -0
  158. package/dist/routes-maintenance.d.ts +32 -0
  159. package/dist/routes-maintenance.d.ts.map +1 -0
  160. package/dist/routes-maintenance.js +14 -0
  161. package/dist/routes-media.d.ts +634 -0
  162. package/dist/routes-media.d.ts.map +1 -0
  163. package/dist/routes-media.js +245 -0
  164. package/dist/routes-merchandising.d.ts +1120 -0
  165. package/dist/routes-merchandising.d.ts.map +1 -0
  166. package/dist/routes-merchandising.js +377 -0
  167. package/dist/routes-options.d.ts +363 -0
  168. package/dist/routes-options.d.ts.map +1 -0
  169. package/dist/routes-options.js +173 -0
  170. package/dist/routes-public.d.ts +776 -0
  171. package/dist/routes-public.d.ts.map +1 -0
  172. package/dist/routes-public.js +119 -0
  173. package/dist/routes-translations.d.ts +489 -0
  174. package/dist/routes-translations.d.ts.map +1 -0
  175. package/dist/routes-translations.js +258 -0
  176. package/dist/routes.d.ts +5097 -0
  177. package/dist/routes.d.ts.map +1 -0
  178. package/dist/routes.js +64 -0
  179. package/dist/schema-core.d.ts +1238 -0
  180. package/dist/schema-core.d.ts.map +1 -0
  181. package/dist/schema-core.js +157 -0
  182. package/dist/schema-itinerary.d.ts +1169 -0
  183. package/dist/schema-itinerary.d.ts.map +1 -0
  184. package/dist/schema-itinerary.js +130 -0
  185. package/dist/schema-relations.d.ts +117 -0
  186. package/dist/schema-relations.d.ts.map +1 -0
  187. package/dist/schema-relations.js +192 -0
  188. package/dist/schema-settings.d.ts +1800 -0
  189. package/dist/schema-settings.d.ts.map +1 -0
  190. package/dist/schema-settings.js +220 -0
  191. package/dist/schema-shared.d.ts +15 -0
  192. package/dist/schema-shared.d.ts.map +1 -0
  193. package/dist/schema-shared.js +91 -0
  194. package/dist/schema-sourced-content.d.ts +262 -0
  195. package/dist/schema-sourced-content.d.ts.map +1 -0
  196. package/dist/schema-sourced-content.js +69 -0
  197. package/dist/schema-taxonomy.d.ts +1363 -0
  198. package/dist/schema-taxonomy.d.ts.map +1 -0
  199. package/dist/schema-taxonomy.js +203 -0
  200. package/dist/schema.d.ts +10 -0
  201. package/dist/schema.d.ts.map +1 -0
  202. package/dist/schema.js +9 -0
  203. package/dist/service-aggregates.d.ts +29 -0
  204. package/dist/service-aggregates.d.ts.map +1 -0
  205. package/dist/service-aggregates.js +56 -0
  206. package/dist/service-catalog-plane-destinations.d.ts +30 -0
  207. package/dist/service-catalog-plane-destinations.d.ts.map +1 -0
  208. package/dist/service-catalog-plane-destinations.js +143 -0
  209. package/dist/service-catalog-plane-taxonomy.d.ts +73 -0
  210. package/dist/service-catalog-plane-taxonomy.d.ts.map +1 -0
  211. package/dist/service-catalog-plane-taxonomy.js +242 -0
  212. package/dist/service-catalog-plane.d.ts +179 -0
  213. package/dist/service-catalog-plane.d.ts.map +1 -0
  214. package/dist/service-catalog-plane.js +431 -0
  215. package/dist/service-catalog.d.ts +251 -0
  216. package/dist/service-catalog.d.ts.map +1 -0
  217. package/dist/service-catalog.js +517 -0
  218. package/dist/service-configuration.d.ts +261 -0
  219. package/dist/service-configuration.d.ts.map +1 -0
  220. package/dist/service-configuration.js +343 -0
  221. package/dist/service-content-owned.d.ts +68 -0
  222. package/dist/service-content-owned.d.ts.map +1 -0
  223. package/dist/service-content-owned.js +329 -0
  224. package/dist/service-content-synthesizer.d.ts +90 -0
  225. package/dist/service-content-synthesizer.d.ts.map +1 -0
  226. package/dist/service-content-synthesizer.js +178 -0
  227. package/dist/service-content.d.ts +106 -0
  228. package/dist/service-content.d.ts.map +1 -0
  229. package/dist/service-content.js +388 -0
  230. package/dist/service-core.d.ts +194 -0
  231. package/dist/service-core.d.ts.map +1 -0
  232. package/dist/service-core.js +213 -0
  233. package/dist/service-delivery-formats.d.ts +58 -0
  234. package/dist/service-delivery-formats.d.ts.map +1 -0
  235. package/dist/service-delivery-formats.js +107 -0
  236. package/dist/service-destinations.d.ts +223 -0
  237. package/dist/service-destinations.d.ts.map +1 -0
  238. package/dist/service-destinations.js +310 -0
  239. package/dist/service-itinerary-history.d.ts +457 -0
  240. package/dist/service-itinerary-history.d.ts.map +1 -0
  241. package/dist/service-itinerary-history.js +135 -0
  242. package/dist/service-itinerary.d.ts +1149 -0
  243. package/dist/service-itinerary.d.ts.map +1 -0
  244. package/dist/service-itinerary.js +419 -0
  245. package/dist/service-media.d.ts +272 -0
  246. package/dist/service-media.d.ts.map +1 -0
  247. package/dist/service-media.js +320 -0
  248. package/dist/service-merchandising.d.ts +184 -0
  249. package/dist/service-merchandising.d.ts.map +1 -0
  250. package/dist/service-merchandising.js +181 -0
  251. package/dist/service-option-translations.d.ts +268 -0
  252. package/dist/service-option-translations.d.ts.map +1 -0
  253. package/dist/service-option-translations.js +300 -0
  254. package/dist/service-options.d.ts +181 -0
  255. package/dist/service-options.d.ts.map +1 -0
  256. package/dist/service-options.js +179 -0
  257. package/dist/service-product-destinations.d.ts +37 -0
  258. package/dist/service-product-destinations.d.ts.map +1 -0
  259. package/dist/service-product-destinations.js +94 -0
  260. package/dist/service-public.d.ts +664 -0
  261. package/dist/service-public.d.ts.map +1 -0
  262. package/dist/service-public.js +374 -0
  263. package/dist/service-taxonomy.d.ts +197 -0
  264. package/dist/service-taxonomy.d.ts.map +1 -0
  265. package/dist/service-taxonomy.js +221 -0
  266. package/dist/service.d.ts +3929 -0
  267. package/dist/service.d.ts.map +1 -0
  268. package/dist/service.js +28 -0
  269. package/dist/tasks/brochure-printers.d.ts +31 -0
  270. package/dist/tasks/brochure-printers.d.ts.map +1 -0
  271. package/dist/tasks/brochure-printers.js +149 -0
  272. package/dist/tasks/brochure-templates.d.ts +36 -0
  273. package/dist/tasks/brochure-templates.d.ts.map +1 -0
  274. package/dist/tasks/brochure-templates.js +110 -0
  275. package/dist/tasks/brochures.d.ts +43 -0
  276. package/dist/tasks/brochures.d.ts.map +1 -0
  277. package/dist/tasks/brochures.js +72 -0
  278. package/dist/tasks/generate-pdf.d.ts +8 -0
  279. package/dist/tasks/generate-pdf.d.ts.map +1 -0
  280. package/dist/tasks/generate-pdf.js +106 -0
  281. package/dist/tasks/index.d.ts +5 -0
  282. package/dist/tasks/index.d.ts.map +1 -0
  283. package/dist/tasks/index.js +4 -0
  284. package/dist/tasks/pdf-text.d.ts +2 -0
  285. package/dist/tasks/pdf-text.d.ts.map +1 -0
  286. package/dist/tasks/pdf-text.js +40 -0
  287. package/dist/tasks.d.ts +2 -0
  288. package/dist/tasks.d.ts.map +1 -0
  289. package/dist/tasks.js +1 -0
  290. package/dist/validation-catalog.d.ts +2 -0
  291. package/dist/validation-catalog.d.ts.map +1 -0
  292. package/dist/validation-catalog.js +3 -0
  293. package/dist/validation-config.d.ts +2 -0
  294. package/dist/validation-config.d.ts.map +1 -0
  295. package/dist/validation-config.js +3 -0
  296. package/dist/validation-content.d.ts +2 -0
  297. package/dist/validation-content.d.ts.map +1 -0
  298. package/dist/validation-content.js +3 -0
  299. package/dist/validation-core.d.ts +2 -0
  300. package/dist/validation-core.d.ts.map +1 -0
  301. package/dist/validation-core.js +3 -0
  302. package/dist/validation-public.d.ts +2 -0
  303. package/dist/validation-public.d.ts.map +1 -0
  304. package/dist/validation-public.js +3 -0
  305. package/dist/validation-shared.d.ts +2 -0
  306. package/dist/validation-shared.d.ts.map +1 -0
  307. package/dist/validation-shared.js +3 -0
  308. package/dist/validation.d.ts +2 -0
  309. package/dist/validation.d.ts.map +1 -0
  310. package/dist/validation.js +3 -0
  311. package/package.json +204 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAqBjE,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE;QACR,mEAAmE;QACnE,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,CAAA;IACD,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AA2DD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkF5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
@@ -0,0 +1,119 @@
1
+ import { parseQuery } from "@voyant-travel/hono";
2
+ import { Hono } from "hono";
3
+ import { z } from "zod";
4
+ import { productDocKey, productDocVariant, readThroughProductDoc, readThroughSlugMapping, } from "./read-model.js";
5
+ import { publicProductsService } from "./service-public.js";
6
+ import { publicCatalogCategoryListQuerySchema, publicCatalogDestinationListQuerySchema, publicCatalogProductListQuerySchema, publicCatalogProductLookupBySlugQuerySchema, publicCatalogTagListQuerySchema, } from "./validation-public.js";
7
+ import { booleanQueryParam } from "./validation-shared.js";
8
+ /** The KV binding is optional — deployments without it serve live. */
9
+ function readModelKv(c) {
10
+ return c.env?.CACHE;
11
+ }
12
+ /**
13
+ * Shared edge/CDN policy for the public catalog reads. These endpoints are
14
+ * not personalized (they never read the authenticated identity), so short
15
+ * shared caching keeps storefront list traffic off Worker isolates (#1686).
16
+ * Applied per-handler on successful responses only — a framework-level
17
+ * cache middleware lives in `@voyant-travel/hono` and supersedes this later.
18
+ */
19
+ const PUBLIC_CACHE_CONTROL = "public, s-maxage=60, stale-while-revalidate=300";
20
+ function setPublicCacheHeaders(c) {
21
+ c.header("Cache-Control", PUBLIC_CACHE_CONTROL);
22
+ }
23
+ /**
24
+ * Pagination guard for public list endpoints: clamps out-of-range or
25
+ * malformed `limit` values to `[1, maxLimit]` instead of rejecting the
26
+ * request, so no public list can run unbounded (#1686).
27
+ */
28
+ function clampedLimitParam(defaultLimit, maxLimit) {
29
+ return z.coerce
30
+ .number()
31
+ .int()
32
+ .default(defaultLimit)
33
+ .catch(defaultLimit)
34
+ .transform((value) => Math.min(Math.max(value, 1), maxLimit));
35
+ }
36
+ const PRODUCT_LIST_DEFAULT_LIMIT = 20;
37
+ const PUBLIC_LIST_MAX_LIMIT = 100;
38
+ const trimmedProductListQuerySchema = publicCatalogProductListQuerySchema.extend({
39
+ limit: clampedLimitParam(PRODUCT_LIST_DEFAULT_LIMIT, PUBLIC_LIST_MAX_LIMIT),
40
+ /**
41
+ * The list payload excludes heavy richtext content (`inclusionsHtml`,
42
+ * `exclusionsHtml`, `termsHtml`, full-length `description`) by default.
43
+ * `?includeContent=true` opts back into the full content shape.
44
+ */
45
+ includeContent: booleanQueryParam.optional(),
46
+ });
47
+ const clampedCategoryListQuerySchema = publicCatalogCategoryListQuerySchema.extend({
48
+ limit: clampedLimitParam(PUBLIC_LIST_MAX_LIMIT, PUBLIC_LIST_MAX_LIMIT),
49
+ });
50
+ const clampedTagListQuerySchema = publicCatalogTagListQuerySchema.extend({
51
+ limit: clampedLimitParam(PUBLIC_LIST_MAX_LIMIT, PUBLIC_LIST_MAX_LIMIT),
52
+ });
53
+ const clampedDestinationListQuerySchema = publicCatalogDestinationListQuerySchema.extend({
54
+ limit: clampedLimitParam(PUBLIC_LIST_MAX_LIMIT, PUBLIC_LIST_MAX_LIMIT),
55
+ });
56
+ export const publicProductRoutes = new Hono()
57
+ .get("/", async (c) => {
58
+ const query = await parseQuery(c, trimmedProductListQuerySchema);
59
+ const result = await publicProductsService.listCatalogProducts(c.get("db"), query);
60
+ setPublicCacheHeaders(c);
61
+ return c.json(result);
62
+ })
63
+ .get("/slug/:slug", async (c) => {
64
+ const query = await parseQuery(c, publicCatalogProductLookupBySlugQuerySchema);
65
+ const kv = readModelKv(c);
66
+ const slug = c.req.param("slug");
67
+ // Resolve slug → id through the short-lived KV mapping so both detail
68
+ // routes share one id-keyed document per variant.
69
+ const productId = await readThroughSlugMapping(kv, slug, async () => {
70
+ const row = await publicProductsService.getCatalogProductBySlug(c.get("db"), slug, query);
71
+ return row ? (row.id ?? null) : null;
72
+ });
73
+ if (!productId) {
74
+ return c.json({ error: "Catalog product not found" }, 404);
75
+ }
76
+ const { data } = await readThroughProductDoc(kv, productDocKey(productId, productDocVariant(query)), () => publicProductsService.getCatalogProductById(c.get("db"), productId, query));
77
+ if (!data) {
78
+ return c.json({ error: "Catalog product not found" }, 404);
79
+ }
80
+ setPublicCacheHeaders(c);
81
+ return c.json({ data });
82
+ })
83
+ .get("/categories", async (c) => {
84
+ const query = await parseQuery(c, clampedCategoryListQuerySchema);
85
+ const result = await publicProductsService.listCatalogCategories(c.get("db"), query);
86
+ setPublicCacheHeaders(c);
87
+ return c.json(result);
88
+ })
89
+ .get("/tags", async (c) => {
90
+ const query = await parseQuery(c, clampedTagListQuerySchema);
91
+ const result = await publicProductsService.listCatalogTags(c.get("db"), query);
92
+ setPublicCacheHeaders(c);
93
+ return c.json(result);
94
+ })
95
+ .get("/destinations", async (c) => {
96
+ const query = await parseQuery(c, clampedDestinationListQuerySchema);
97
+ const result = await publicProductsService.listCatalogDestinations(c.get("db"), query);
98
+ setPublicCacheHeaders(c);
99
+ return c.json(result);
100
+ })
101
+ .get("/:id", async (c) => {
102
+ const query = await parseQuery(c, publicCatalogProductLookupBySlugQuerySchema);
103
+ const productId = c.req.param("id");
104
+ const { data } = await readThroughProductDoc(readModelKv(c), productDocKey(productId, productDocVariant(query)), () => publicProductsService.getCatalogProductById(c.get("db"), productId, query));
105
+ if (!data) {
106
+ return c.json({ error: "Catalog product not found" }, 404);
107
+ }
108
+ setPublicCacheHeaders(c);
109
+ return c.json({ data });
110
+ })
111
+ .get("/:id/brochure", async (c) => {
112
+ const query = await parseQuery(c, publicCatalogProductLookupBySlugQuerySchema);
113
+ const row = await publicProductsService.getCatalogProductBrochure(c.get("db"), c.req.param("id"), query);
114
+ if (!row) {
115
+ return c.json({ error: "Catalog product brochure not found" }, 404);
116
+ }
117
+ setPublicCacheHeaders(c);
118
+ return c.json({ data: row });
119
+ });
@@ -0,0 +1,489 @@
1
+ import type { Env } from "./route-env.js";
2
+ export declare const productTranslationRoutes: import("hono/hono-base").HonoBase<Env, {
3
+ "/translations": {
4
+ $get: {
5
+ input: {};
6
+ output: {
7
+ data: {
8
+ id: string;
9
+ productId: string;
10
+ languageTag: string;
11
+ slug: string | null;
12
+ name: string;
13
+ shortDescription: string | null;
14
+ description: string | null;
15
+ inclusionsHtml: string | null;
16
+ exclusionsHtml: string | null;
17
+ termsHtml: string | null;
18
+ seoTitle: string | null;
19
+ seoDescription: string | null;
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ }[];
23
+ total: number;
24
+ limit: number;
25
+ offset: number;
26
+ };
27
+ outputFormat: "json";
28
+ status: import("hono/utils/http-status").ContentfulStatusCode;
29
+ };
30
+ };
31
+ } & {
32
+ "/translations/:translationId": {
33
+ $get: {
34
+ input: {
35
+ param: {
36
+ translationId: string;
37
+ };
38
+ };
39
+ output: {
40
+ error: string;
41
+ };
42
+ outputFormat: "json";
43
+ status: 404;
44
+ } | {
45
+ input: {
46
+ param: {
47
+ translationId: string;
48
+ };
49
+ };
50
+ output: {
51
+ data: {
52
+ id: string;
53
+ productId: string;
54
+ languageTag: string;
55
+ slug: string | null;
56
+ name: string;
57
+ shortDescription: string | null;
58
+ description: string | null;
59
+ inclusionsHtml: string | null;
60
+ exclusionsHtml: string | null;
61
+ termsHtml: string | null;
62
+ seoTitle: string | null;
63
+ seoDescription: string | null;
64
+ createdAt: string;
65
+ updatedAt: string;
66
+ };
67
+ };
68
+ outputFormat: "json";
69
+ status: import("hono/utils/http-status").ContentfulStatusCode;
70
+ };
71
+ };
72
+ } & {
73
+ "/:id/translations": {
74
+ $post: {
75
+ input: {
76
+ param: {
77
+ id: string;
78
+ };
79
+ };
80
+ output: {
81
+ error: string;
82
+ };
83
+ outputFormat: "json";
84
+ status: 404;
85
+ } | {
86
+ input: {
87
+ param: {
88
+ id: string;
89
+ };
90
+ };
91
+ output: {
92
+ data: {
93
+ id: string;
94
+ name: string;
95
+ description: string | null;
96
+ inclusionsHtml: string | null;
97
+ exclusionsHtml: string | null;
98
+ termsHtml: string | null;
99
+ createdAt: string;
100
+ updatedAt: string;
101
+ productId: string;
102
+ languageTag: string;
103
+ slug: string | null;
104
+ seoTitle: string | null;
105
+ seoDescription: string | null;
106
+ shortDescription: string | null;
107
+ };
108
+ };
109
+ outputFormat: "json";
110
+ status: 201;
111
+ };
112
+ };
113
+ } & {
114
+ "/translations/:translationId": {
115
+ $patch: {
116
+ input: {
117
+ param: {
118
+ translationId: string;
119
+ };
120
+ };
121
+ output: {
122
+ error: string;
123
+ };
124
+ outputFormat: "json";
125
+ status: 404;
126
+ } | {
127
+ input: {
128
+ param: {
129
+ translationId: string;
130
+ };
131
+ };
132
+ output: {
133
+ data: {
134
+ id: string;
135
+ productId: string;
136
+ languageTag: string;
137
+ slug: string | null;
138
+ name: string;
139
+ shortDescription: string | null;
140
+ description: string | null;
141
+ inclusionsHtml: string | null;
142
+ exclusionsHtml: string | null;
143
+ termsHtml: string | null;
144
+ seoTitle: string | null;
145
+ seoDescription: string | null;
146
+ createdAt: string;
147
+ updatedAt: string;
148
+ };
149
+ };
150
+ outputFormat: "json";
151
+ status: import("hono/utils/http-status").ContentfulStatusCode;
152
+ };
153
+ };
154
+ } & {
155
+ "/translations/:translationId": {
156
+ $delete: {
157
+ input: {
158
+ param: {
159
+ translationId: string;
160
+ };
161
+ };
162
+ output: {
163
+ error: string;
164
+ };
165
+ outputFormat: "json";
166
+ status: 404;
167
+ } | {
168
+ input: {
169
+ param: {
170
+ translationId: string;
171
+ };
172
+ };
173
+ output: {
174
+ success: true;
175
+ };
176
+ outputFormat: "json";
177
+ status: 200;
178
+ };
179
+ };
180
+ } & {
181
+ "/option-translations": {
182
+ $get: {
183
+ input: {};
184
+ output: {
185
+ data: {
186
+ id: string;
187
+ optionId: string;
188
+ languageTag: string;
189
+ name: string;
190
+ shortDescription: string | null;
191
+ description: string | null;
192
+ createdAt: string;
193
+ updatedAt: string;
194
+ }[];
195
+ total: number;
196
+ limit: number;
197
+ offset: number;
198
+ };
199
+ outputFormat: "json";
200
+ status: import("hono/utils/http-status").ContentfulStatusCode;
201
+ };
202
+ };
203
+ } & {
204
+ "/option-translations/:translationId": {
205
+ $get: {
206
+ input: {
207
+ param: {
208
+ translationId: string;
209
+ };
210
+ };
211
+ output: {
212
+ error: string;
213
+ };
214
+ outputFormat: "json";
215
+ status: 404;
216
+ } | {
217
+ input: {
218
+ param: {
219
+ translationId: string;
220
+ };
221
+ };
222
+ output: {
223
+ data: {
224
+ id: string;
225
+ optionId: string;
226
+ languageTag: string;
227
+ name: string;
228
+ shortDescription: string | null;
229
+ description: string | null;
230
+ createdAt: string;
231
+ updatedAt: string;
232
+ };
233
+ };
234
+ outputFormat: "json";
235
+ status: import("hono/utils/http-status").ContentfulStatusCode;
236
+ };
237
+ };
238
+ } & {
239
+ "/options/:optionId/translations": {
240
+ $post: {
241
+ input: {
242
+ param: {
243
+ optionId: string;
244
+ };
245
+ };
246
+ output: {
247
+ error: string;
248
+ };
249
+ outputFormat: "json";
250
+ status: 404;
251
+ } | {
252
+ input: {
253
+ param: {
254
+ optionId: string;
255
+ };
256
+ };
257
+ output: {
258
+ data: {
259
+ id: string;
260
+ name: string;
261
+ description: string | null;
262
+ createdAt: string;
263
+ updatedAt: string;
264
+ languageTag: string;
265
+ optionId: string;
266
+ shortDescription: string | null;
267
+ };
268
+ };
269
+ outputFormat: "json";
270
+ status: 201;
271
+ };
272
+ };
273
+ } & {
274
+ "/option-translations/:translationId": {
275
+ $patch: {
276
+ input: {
277
+ param: {
278
+ translationId: string;
279
+ };
280
+ };
281
+ output: {
282
+ error: string;
283
+ };
284
+ outputFormat: "json";
285
+ status: 404;
286
+ } | {
287
+ input: {
288
+ param: {
289
+ translationId: string;
290
+ };
291
+ };
292
+ output: {
293
+ data: {
294
+ id: string;
295
+ optionId: string;
296
+ languageTag: string;
297
+ name: string;
298
+ shortDescription: string | null;
299
+ description: string | null;
300
+ createdAt: string;
301
+ updatedAt: string;
302
+ };
303
+ };
304
+ outputFormat: "json";
305
+ status: import("hono/utils/http-status").ContentfulStatusCode;
306
+ };
307
+ };
308
+ } & {
309
+ "/option-translations/:translationId": {
310
+ $delete: {
311
+ input: {
312
+ param: {
313
+ translationId: string;
314
+ };
315
+ };
316
+ output: {
317
+ error: string;
318
+ };
319
+ outputFormat: "json";
320
+ status: 404;
321
+ } | {
322
+ input: {
323
+ param: {
324
+ translationId: string;
325
+ };
326
+ };
327
+ output: {
328
+ success: true;
329
+ };
330
+ outputFormat: "json";
331
+ status: 200;
332
+ };
333
+ };
334
+ } & {
335
+ "/unit-translations": {
336
+ $get: {
337
+ input: {};
338
+ output: {
339
+ data: {
340
+ id: string;
341
+ unitId: string;
342
+ languageTag: string;
343
+ name: string;
344
+ shortDescription: string | null;
345
+ description: string | null;
346
+ createdAt: string;
347
+ updatedAt: string;
348
+ }[];
349
+ total: number;
350
+ limit: number;
351
+ offset: number;
352
+ };
353
+ outputFormat: "json";
354
+ status: import("hono/utils/http-status").ContentfulStatusCode;
355
+ };
356
+ };
357
+ } & {
358
+ "/unit-translations/:translationId": {
359
+ $get: {
360
+ input: {
361
+ param: {
362
+ translationId: string;
363
+ };
364
+ };
365
+ output: {
366
+ error: string;
367
+ };
368
+ outputFormat: "json";
369
+ status: 404;
370
+ } | {
371
+ input: {
372
+ param: {
373
+ translationId: string;
374
+ };
375
+ };
376
+ output: {
377
+ data: {
378
+ id: string;
379
+ unitId: string;
380
+ languageTag: string;
381
+ name: string;
382
+ shortDescription: string | null;
383
+ description: string | null;
384
+ createdAt: string;
385
+ updatedAt: string;
386
+ };
387
+ };
388
+ outputFormat: "json";
389
+ status: import("hono/utils/http-status").ContentfulStatusCode;
390
+ };
391
+ };
392
+ } & {
393
+ "/units/:unitId/translations": {
394
+ $post: {
395
+ input: {
396
+ param: {
397
+ unitId: string;
398
+ };
399
+ };
400
+ output: {
401
+ error: string;
402
+ };
403
+ outputFormat: "json";
404
+ status: 404;
405
+ } | {
406
+ input: {
407
+ param: {
408
+ unitId: string;
409
+ };
410
+ };
411
+ output: {
412
+ data: {
413
+ id: string;
414
+ name: string;
415
+ description: string | null;
416
+ createdAt: string;
417
+ updatedAt: string;
418
+ languageTag: string;
419
+ shortDescription: string | null;
420
+ unitId: string;
421
+ };
422
+ };
423
+ outputFormat: "json";
424
+ status: 201;
425
+ };
426
+ };
427
+ } & {
428
+ "/unit-translations/:translationId": {
429
+ $patch: {
430
+ input: {
431
+ param: {
432
+ translationId: string;
433
+ };
434
+ };
435
+ output: {
436
+ error: string;
437
+ };
438
+ outputFormat: "json";
439
+ status: 404;
440
+ } | {
441
+ input: {
442
+ param: {
443
+ translationId: string;
444
+ };
445
+ };
446
+ output: {
447
+ data: {
448
+ id: string;
449
+ unitId: string;
450
+ languageTag: string;
451
+ name: string;
452
+ shortDescription: string | null;
453
+ description: string | null;
454
+ createdAt: string;
455
+ updatedAt: string;
456
+ };
457
+ };
458
+ outputFormat: "json";
459
+ status: import("hono/utils/http-status").ContentfulStatusCode;
460
+ };
461
+ };
462
+ } & {
463
+ "/unit-translations/:translationId": {
464
+ $delete: {
465
+ input: {
466
+ param: {
467
+ translationId: string;
468
+ };
469
+ };
470
+ output: {
471
+ error: string;
472
+ };
473
+ outputFormat: "json";
474
+ status: 404;
475
+ } | {
476
+ input: {
477
+ param: {
478
+ translationId: string;
479
+ };
480
+ };
481
+ output: {
482
+ success: true;
483
+ };
484
+ outputFormat: "json";
485
+ status: 200;
486
+ };
487
+ };
488
+ }, "/", "/unit-translations/:translationId">;
489
+ //# sourceMappingURL=routes-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-translations.d.ts","sourceRoot":"","sources":["../src/routes-translations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CA+TjC,CAAA"}