@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":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAc9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADr3B,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { getProductAggregates } from "./service-aggregates.js";
2
+ import { configurationProductsService } from "./service-configuration.js";
3
+ import { coreProductsService } from "./service-core.js";
4
+ import { deliveryFormatProductsService } from "./service-delivery-formats.js";
5
+ import { destinationProductsService } from "./service-destinations.js";
6
+ import { itineraryProductsService } from "./service-itinerary.js";
7
+ import { itineraryHistoryProductsService } from "./service-itinerary-history.js";
8
+ import { mediaProductsService } from "./service-media.js";
9
+ import { merchandisingProductsService } from "./service-merchandising.js";
10
+ import { optionTranslationProductsService } from "./service-option-translations.js";
11
+ import { optionProductsService } from "./service-options.js";
12
+ import { productDestinationProductsService } from "./service-product-destinations.js";
13
+ import { taxonomyProductsService } from "./service-taxonomy.js";
14
+ export const productsService = {
15
+ getProductAggregates,
16
+ ...coreProductsService,
17
+ ...configurationProductsService,
18
+ ...deliveryFormatProductsService,
19
+ ...merchandisingProductsService,
20
+ ...destinationProductsService,
21
+ ...productDestinationProductsService,
22
+ ...optionProductsService,
23
+ ...optionTranslationProductsService,
24
+ ...itineraryProductsService,
25
+ ...itineraryHistoryProductsService,
26
+ ...taxonomyProductsService,
27
+ ...mediaProductsService,
28
+ };
@@ -0,0 +1,31 @@
1
+ import type { StructuredTemplateBodyFormat } from "@voyant-travel/utils/template-renderer";
2
+ import type { ProductBrochureTemplateContext, RenderedProductBrochureTemplate } from "./brochure-templates.js";
3
+ export interface ProductBrochurePrinterContext {
4
+ template: RenderedProductBrochureTemplate;
5
+ context: ProductBrochureTemplateContext;
6
+ }
7
+ export interface PrintedProductBrochureArtifact {
8
+ body: Uint8Array;
9
+ mimeType?: string | null;
10
+ fileSize?: number | null;
11
+ metadata?: Record<string, unknown> | null;
12
+ }
13
+ export type ProductBrochurePrinter = (input: ProductBrochurePrinterContext) => Promise<PrintedProductBrochureArtifact>;
14
+ export interface CloudflareBrowserBrochurePrinterOptions {
15
+ accountId: string;
16
+ apiToken: string;
17
+ apiBaseUrl?: string;
18
+ addStyleTag?: Array<{
19
+ content?: string;
20
+ url?: string;
21
+ }>;
22
+ pdfOptions?: Record<string, unknown>;
23
+ gotoOptions?: Record<string, unknown>;
24
+ viewport?: Record<string, unknown>;
25
+ setExtraHTTPHeaders?: Record<string, string>;
26
+ }
27
+ export declare function brochureBodyToHtml(body: string, bodyFormat: StructuredTemplateBodyFormat, title: string): string;
28
+ export declare function createBasicPdfProductBrochurePrinter(): ProductBrochurePrinter;
29
+ export declare function createCloudflareBrowserProductBrochurePrinter(options: CloudflareBrowserBrochurePrinterOptions): ProductBrochurePrinter;
30
+ export declare function createCloudflareBrowserProductBrochurePrinterFromEnv(env?: Record<string, string | undefined>): ProductBrochurePrinter;
31
+ //# sourceMappingURL=brochure-printers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brochure-printers.d.ts","sourceRoot":"","sources":["../../src/tasks/brochure-printers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AgB,oCAAoC,IAAI,sBAAsB,CAmB7E;AAED,wBAAgB,6CAA6C,CAC3D,OAAO,EAAE,uCAAuC,GAC/C,sBAAsB,CA6CxB;AAED,wBAAgB,oDAAoD,CAClE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACvC,sBAAsB,CAkBxB"}
@@ -0,0 +1,149 @@
1
+ import { renderPdfDocument } from "@voyant-travel/utils/pdf-renderer";
2
+ import { marked } from "marked";
3
+ import sanitizeHtml from "sanitize-html";
4
+ function escapeHtml(value) {
5
+ return value
6
+ .replaceAll("&", "&amp;")
7
+ .replaceAll("<", "&lt;")
8
+ .replaceAll(">", "&gt;")
9
+ .replaceAll('"', "&quot;")
10
+ .replaceAll("'", "&#39;");
11
+ }
12
+ function renderMarkdownBrochureBody(body) {
13
+ return sanitizeHtml(marked(body, { async: false }), {
14
+ allowedTags: [
15
+ "a",
16
+ "b",
17
+ "blockquote",
18
+ "br",
19
+ "code",
20
+ "del",
21
+ "div",
22
+ "em",
23
+ "h1",
24
+ "h2",
25
+ "h3",
26
+ "h4",
27
+ "h5",
28
+ "h6",
29
+ "hr",
30
+ "i",
31
+ "li",
32
+ "ol",
33
+ "p",
34
+ "pre",
35
+ "s",
36
+ "span",
37
+ "strong",
38
+ "table",
39
+ "tbody",
40
+ "td",
41
+ "tfoot",
42
+ "th",
43
+ "thead",
44
+ "tr",
45
+ "u",
46
+ "ul",
47
+ ],
48
+ allowedAttributes: {
49
+ a: ["href", "name", "rel", "target", "title"],
50
+ "*": ["class", "title"],
51
+ },
52
+ allowedSchemes: ["http", "https", "mailto", "tel"],
53
+ allowedSchemesAppliedToAttributes: ["href"],
54
+ allowProtocolRelative: false,
55
+ disallowedTagsMode: "discard",
56
+ });
57
+ }
58
+ export function brochureBodyToHtml(body, bodyFormat, title) {
59
+ let content;
60
+ if (bodyFormat === "html") {
61
+ content = body;
62
+ }
63
+ else if (bodyFormat === "markdown") {
64
+ content = renderMarkdownBrochureBody(body);
65
+ }
66
+ else {
67
+ content = `<pre style="white-space: pre-wrap; font-family: system-ui, sans-serif;">${escapeHtml(body)}</pre>`;
68
+ }
69
+ return [
70
+ "<!doctype html>",
71
+ '<html lang="en">',
72
+ "<head>",
73
+ '<meta charset="utf-8" />',
74
+ `<title>${escapeHtml(title)}</title>`,
75
+ '<meta name="viewport" content="width=device-width, initial-scale=1" />',
76
+ "</head>",
77
+ `<body>${content}</body>`,
78
+ "</html>",
79
+ ].join("");
80
+ }
81
+ export function createBasicPdfProductBrochurePrinter() {
82
+ return async ({ template, context }) => {
83
+ const body = await renderPdfDocument({
84
+ title: template.title,
85
+ content: template.body,
86
+ format: template.bodyFormat,
87
+ metadataLines: [`Product ID: ${context.product.id}`, ...template.metadataLines],
88
+ });
89
+ return {
90
+ body,
91
+ mimeType: "application/pdf",
92
+ fileSize: body.byteLength,
93
+ metadata: {
94
+ renderer: "voyant-basic-pdf",
95
+ bodyFormat: template.bodyFormat,
96
+ },
97
+ };
98
+ };
99
+ }
100
+ export function createCloudflareBrowserProductBrochurePrinter(options) {
101
+ const apiBaseUrl = options.apiBaseUrl?.replace(/\/$/, "") || "https://api.cloudflare.com/client/v4";
102
+ return async ({ template, context }) => {
103
+ const response = await fetch(`${apiBaseUrl}/accounts/${options.accountId}/browser-rendering/pdf`, {
104
+ method: "POST",
105
+ headers: {
106
+ Authorization: `Bearer ${options.apiToken}`,
107
+ "Content-Type": "application/json",
108
+ },
109
+ body: JSON.stringify({
110
+ html: brochureBodyToHtml(template.body, template.bodyFormat, template.title),
111
+ addStyleTag: options.addStyleTag,
112
+ pdfOptions: options.pdfOptions,
113
+ gotoOptions: options.gotoOptions,
114
+ viewport: options.viewport,
115
+ setExtraHTTPHeaders: options.setExtraHTTPHeaders,
116
+ }),
117
+ });
118
+ if (!response.ok) {
119
+ const errorBody = await response.text().catch(() => "");
120
+ throw new Error(`Cloudflare Browser brochure print failed: ${response.status} ${response.statusText}${errorBody ? ` - ${errorBody}` : ""}`);
121
+ }
122
+ const body = new Uint8Array(await response.arrayBuffer());
123
+ return {
124
+ body,
125
+ mimeType: "application/pdf",
126
+ fileSize: body.byteLength,
127
+ metadata: {
128
+ renderer: "cloudflare-browser",
129
+ bodyFormat: template.bodyFormat,
130
+ browserMsUsed: response.headers.get("X-Browser-Ms-Used"),
131
+ productId: context.product.id,
132
+ },
133
+ };
134
+ };
135
+ }
136
+ export function createCloudflareBrowserProductBrochurePrinterFromEnv(env) {
137
+ const resolvedEnv = env ??
138
+ globalThis.process?.env ??
139
+ {};
140
+ const accountId = resolvedEnv.CLOUDFLARE_ACCOUNT_ID?.trim();
141
+ const apiToken = resolvedEnv.CLOUDFLARE_API_TOKEN?.trim();
142
+ if (!accountId || !apiToken) {
143
+ throw new Error("createCloudflareBrowserProductBrochurePrinterFromEnv requires CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN.");
144
+ }
145
+ return createCloudflareBrowserProductBrochurePrinter({
146
+ accountId,
147
+ apiToken,
148
+ });
149
+ }
@@ -0,0 +1,36 @@
1
+ import { type StructuredTemplateBodyFormat } from "@voyant-travel/utils/template-renderer";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ import { productDayServices, productDays, products } from "../schema.js";
4
+ type ProductDayRecord = typeof productDays.$inferSelect;
5
+ type ProductDayServiceRecord = typeof productDayServices.$inferSelect;
6
+ type ProductRecord = typeof products.$inferSelect;
7
+ export interface ProductBrochureDayContext extends ProductDayRecord {
8
+ services: Array<ProductDayServiceRecord>;
9
+ }
10
+ export interface ProductBrochureTemplateContext {
11
+ product: ProductRecord;
12
+ days: ProductBrochureDayContext[];
13
+ generatedAt: Date;
14
+ }
15
+ type TemplateResolver<T> = T | ((context: ProductBrochureTemplateContext) => Promise<T> | T);
16
+ export interface ProductBrochureTemplateDefinition {
17
+ bodyFormat: StructuredTemplateBodyFormat;
18
+ body: TemplateResolver<string>;
19
+ variables?: Record<string, unknown> | ((context: ProductBrochureTemplateContext) => Promise<Record<string, unknown>> | Record<string, unknown>);
20
+ title?: TemplateResolver<string>;
21
+ filename?: TemplateResolver<string>;
22
+ metadataLines?: TemplateResolver<string[]>;
23
+ }
24
+ export interface RenderedProductBrochureTemplate {
25
+ body: string;
26
+ bodyFormat: StructuredTemplateBodyFormat;
27
+ title: string;
28
+ filename: string;
29
+ variables: Record<string, unknown>;
30
+ metadataLines: string[];
31
+ }
32
+ export declare function loadProductBrochureTemplateContext(db: PostgresJsDatabase, productId: string): Promise<ProductBrochureTemplateContext>;
33
+ export declare function createDefaultProductBrochureTemplate(): ProductBrochureTemplateDefinition;
34
+ export declare function renderProductBrochureTemplate(template: ProductBrochureTemplateDefinition, context: ProductBrochureTemplateContext): Promise<RenderedProductBrochureTemplate>;
35
+ export {};
36
+ //# sourceMappingURL=brochure-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brochure-templates.d.ts","sourceRoot":"","sources":["../../src/tasks/brochure-templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,wCAAwC,CAAA;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAsB,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5F,KAAK,gBAAgB,GAAG,OAAO,WAAW,CAAC,YAAY,CAAA;AACvD,KAAK,uBAAuB,GAAG,OAAO,kBAAkB,CAAC,YAAY,CAAA;AACrE,KAAK,aAAa,GAAG,OAAO,QAAQ,CAAC,YAAY,CAAA;AAEjD,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE,QAAQ,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAA;CACzC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,aAAa,CAAA;IACtB,IAAI,EAAE,yBAAyB,EAAE,CAAA;IACjC,WAAW,EAAE,IAAI,CAAA;CAClB;AAED,KAAK,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 import { and, asc, eq } from "drizzle-orm";
3
+ import { productDayServices, productDays, productItineraries, products } from "../schema.js";
4
+ async function resolveTemplateValue(value, context) {
5
+ if (typeof value === "function") {
6
+ return await value(context);
7
+ }
8
+ return value;
9
+ }
10
+ function normalizeFilename(value, productName) {
11
+ const fallback = `${productName.replace(/[^a-zA-Z0-9]/g, "_")}.pdf`;
12
+ const trimmed = value?.trim();
13
+ return trimmed || fallback;
14
+ }
15
+ export async function loadProductBrochureTemplateContext(db, productId) {
16
+ const [product] = await db.select().from(products).where(eq(products.id, productId)).limit(1);
17
+ if (!product) {
18
+ throw new Error(`Product not found: ${productId}`);
19
+ }
20
+ const [defaultItinerary] = await db
21
+ .select({ id: productItineraries.id })
22
+ .from(productItineraries)
23
+ .where(and(eq(productItineraries.productId, productId), eq(productItineraries.isDefault, true)))
24
+ .limit(1);
25
+ if (!defaultItinerary) {
26
+ return {
27
+ product,
28
+ days: [],
29
+ generatedAt: new Date(),
30
+ };
31
+ }
32
+ const days = await db
33
+ .select()
34
+ .from(productDays)
35
+ .where(eq(productDays.itineraryId, defaultItinerary.id))
36
+ .orderBy(asc(productDays.dayNumber));
37
+ const daysWithServices = await Promise.all(days.map(async (day) => {
38
+ const services = await db
39
+ .select()
40
+ .from(productDayServices)
41
+ .where(eq(productDayServices.dayId, day.id))
42
+ .orderBy(asc(productDayServices.sortOrder));
43
+ return {
44
+ ...day,
45
+ services,
46
+ };
47
+ }));
48
+ return {
49
+ product,
50
+ days: daysWithServices,
51
+ generatedAt: new Date(),
52
+ };
53
+ }
54
+ export function createDefaultProductBrochureTemplate() {
55
+ return {
56
+ bodyFormat: "markdown",
57
+ title: ({ product }) => product.name,
58
+ filename: ({ product }) => `${product.name.replace(/[^a-zA-Z0-9]/g, "_")}.pdf`,
59
+ metadataLines: ({ product, generatedAt }) => [
60
+ `Product ID: ${product.id}`,
61
+ `Generated: ${generatedAt.toISOString()}`,
62
+ ],
63
+ body: [
64
+ "# {{ product.name }}",
65
+ "",
66
+ "{% if product.startDate or product.endDate %}",
67
+ "Dates: {{ product.startDate | default: 'TBD' }} - {{ product.endDate | default: 'TBD' }}",
68
+ "{% endif %}",
69
+ "{% if product.pax %}",
70
+ "Travelers: {{ product.pax }}",
71
+ "{% endif %}",
72
+ "{% if product.sellAmountCents %}",
73
+ "Total: {{ product.sellAmountCents | divided_by: 100.0 }} {{ product.sellCurrency }}",
74
+ "{% endif %}",
75
+ "",
76
+ "{% if product.description %}{{ product.description }}{% endif %}",
77
+ "",
78
+ "{% for day in days %}",
79
+ "## Day {{ day.dayNumber }}{% if day.title %}: {{ day.title }}{% endif %}",
80
+ "{% if day.location %}Location: {{ day.location }}{% endif %}",
81
+ "{% if day.description %}{{ day.description }}{% endif %}",
82
+ "",
83
+ "{% for service in day.services %}",
84
+ "- {{ service.name }} ({{ service.serviceType }}){% if service.quantity > 1 %} x{{ service.quantity }}{% endif %}",
85
+ "{% if service.notes %} {{ service.notes }}{% endif %}",
86
+ "{% endfor %}",
87
+ "",
88
+ "{% endfor %}",
89
+ ].join("\n"),
90
+ };
91
+ }
92
+ export async function renderProductBrochureTemplate(template, context) {
93
+ const rawBody = (await resolveTemplateValue(template.body, context)) ?? "";
94
+ const variables = (await resolveTemplateValue(template.variables, context)) ?? {
95
+ product: context.product,
96
+ days: context.days,
97
+ generatedAt: context.generatedAt.toISOString(),
98
+ };
99
+ const title = (await resolveTemplateValue(template.title, context))?.trim() || context.product.name;
100
+ const filename = normalizeFilename(await resolveTemplateValue(template.filename, context), context.product.name);
101
+ const metadataLines = (await resolveTemplateValue(template.metadataLines, context)) ?? [];
102
+ return {
103
+ body: renderStructuredTemplate(rawBody, template.bodyFormat, variables),
104
+ bodyFormat: template.bodyFormat,
105
+ title,
106
+ filename,
107
+ variables,
108
+ metadataLines,
109
+ };
110
+ }
@@ -0,0 +1,43 @@
1
+ import type { StorageProvider } from "@voyant-travel/storage";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ import { type ProductBrochurePrinter } from "./brochure-printers.js";
4
+ import { type ProductBrochureTemplateDefinition } from "./brochure-templates.js";
5
+ export interface GenerateAndStoreProductBrochureOptions {
6
+ storage: StorageProvider;
7
+ template?: ProductBrochureTemplateDefinition;
8
+ printer?: ProductBrochurePrinter;
9
+ keyPrefix?: string;
10
+ filename?: string | ((generated: {
11
+ productId: string;
12
+ filename: string;
13
+ }) => string);
14
+ signedUrlExpiresIn?: number;
15
+ maxSizeBytes?: number;
16
+ }
17
+ export declare function generateAndStoreProductBrochure(db: PostgresJsDatabase, productId: string, options: GenerateAndStoreProductBrochureOptions): Promise<{
18
+ brochure: {
19
+ id: string;
20
+ name: string;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ productId: string;
24
+ sortOrder: number;
25
+ dayId: string | null;
26
+ mediaType: "image" | "video" | "document";
27
+ isBrochure: boolean;
28
+ isBrochureCurrent: boolean;
29
+ url: string;
30
+ storageKey: string | null;
31
+ mimeType: string | null;
32
+ fileSize: number | null;
33
+ altText: string | null;
34
+ isCover: boolean;
35
+ brochureVersion: number | null;
36
+ };
37
+ filename: string;
38
+ metadata: Record<string, unknown> | null;
39
+ sizeBytes: number;
40
+ storageKey: string;
41
+ url: string;
42
+ }>;
43
+ //# sourceMappingURL=brochures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brochures.d.ts","sourceRoot":"","sources":["../../src/tasks/brochures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGL,KAAK,iCAAiC,EAEvC,MAAM,yBAAyB,CAAA;AAGhC,MAAM,WAAW,sCAAsC;IACrD,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,CAAC,EAAE,iCAAiC,CAAA;IAC5C,OAAO,CAAC,EAAE,sBAAsB,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,CAAA;IACpF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;GAiFhD"}
@@ -0,0 +1,72 @@
1
+ import { productsService } from "../service.js";
2
+ import { createBasicPdfProductBrochurePrinter, } from "./brochure-printers.js";
3
+ import { createDefaultProductBrochureTemplate, loadProductBrochureTemplateContext, renderProductBrochureTemplate, } from "./brochure-templates.js";
4
+ import { generateProductPdf } from "./generate-pdf.js";
5
+ export async function generateAndStoreProductBrochure(db, productId, options) {
6
+ let filename;
7
+ let pdfBytes;
8
+ let sizeBytes;
9
+ let mimeType = "application/pdf";
10
+ let metadata = null;
11
+ if (options.template || options.printer) {
12
+ const templateContext = await loadProductBrochureTemplateContext(db, productId);
13
+ const rendered = await renderProductBrochureTemplate(options.template ?? createDefaultProductBrochureTemplate(), templateContext);
14
+ const printer = options.printer ?? createBasicPdfProductBrochurePrinter();
15
+ const printed = await printer({
16
+ template: rendered,
17
+ context: templateContext,
18
+ });
19
+ filename =
20
+ typeof options.filename === "function"
21
+ ? options.filename({ productId, filename: rendered.filename })
22
+ : options.filename?.trim() || rendered.filename;
23
+ pdfBytes = printed.body;
24
+ sizeBytes = printed.fileSize ?? printed.body.byteLength;
25
+ mimeType = printed.mimeType ?? mimeType;
26
+ metadata = printed.metadata ?? null;
27
+ }
28
+ else {
29
+ const generated = await generateProductPdf(db, productId);
30
+ filename =
31
+ typeof options.filename === "function"
32
+ ? options.filename({ productId, filename: generated.filename })
33
+ : options.filename?.trim() || generated.filename;
34
+ pdfBytes = generated.pdfBytes;
35
+ sizeBytes = generated.sizeBytes;
36
+ }
37
+ if (options.maxSizeBytes != null && sizeBytes > options.maxSizeBytes) {
38
+ throw new Error(`Generated brochure is too large (${sizeBytes} bytes). Max allowed is ${options.maxSizeBytes} bytes.`);
39
+ }
40
+ const keyPrefix = options.keyPrefix?.trim() || `brochures/products/${productId}`;
41
+ const uploaded = await options.storage.upload(pdfBytes, {
42
+ key: `${keyPrefix.replace(/\/$/, "")}/${filename}`,
43
+ contentType: mimeType,
44
+ });
45
+ const url = uploaded.url ||
46
+ (options.signedUrlExpiresIn
47
+ ? await options.storage.signedUrl(uploaded.key, options.signedUrlExpiresIn)
48
+ : null);
49
+ if (!url) {
50
+ throw new Error("Brochure upload did not return a public or signed URL.");
51
+ }
52
+ const brochure = await productsService.upsertBrochure(db, productId, {
53
+ name: filename,
54
+ url,
55
+ storageKey: uploaded.key,
56
+ mimeType,
57
+ fileSize: sizeBytes,
58
+ altText: null,
59
+ sortOrder: 0,
60
+ });
61
+ if (!brochure) {
62
+ throw new Error(`Unable to persist brochure for product ${productId}.`);
63
+ }
64
+ return {
65
+ brochure,
66
+ filename,
67
+ metadata,
68
+ sizeBytes,
69
+ storageKey: uploaded.key,
70
+ url,
71
+ };
72
+ }
@@ -0,0 +1,8 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ export type GenerateProductPdfResult = {
3
+ pdfBytes: Uint8Array;
4
+ filename: string;
5
+ sizeBytes: number;
6
+ };
7
+ export declare function generateProductPdf(db: PostgresJsDatabase, productId: string): Promise<GenerateProductPdfResult>;
8
+ //# sourceMappingURL=generate-pdf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-pdf.d.ts","sourceRoot":"","sources":["../../src/tasks/generate-pdf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,UAAU,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,wBAAwB,CAAC,CA2HnC"}
@@ -0,0 +1,106 @@
1
+ import { and, asc, eq } from "drizzle-orm";
2
+ import { PDFDocument, rgb, StandardFonts } from "pdf-lib";
3
+ import { productDayServices, productDays, productItineraries, products } from "../schema.js";
4
+ import { plainTextForPdf } from "./pdf-text.js";
5
+ export async function generateProductPdf(db, productId) {
6
+ // 1. Fetch product
7
+ const [product] = await db.select().from(products).where(eq(products.id, productId)).limit(1);
8
+ if (!product) {
9
+ throw new Error(`Product not found: ${productId}`);
10
+ }
11
+ const [defaultItinerary] = await db
12
+ .select({ id: productItineraries.id })
13
+ .from(productItineraries)
14
+ .where(and(eq(productItineraries.productId, productId), eq(productItineraries.isDefault, true)))
15
+ .limit(1);
16
+ // 2. Fetch days with services
17
+ const days = defaultItinerary
18
+ ? await db
19
+ .select()
20
+ .from(productDays)
21
+ .where(eq(productDays.itineraryId, defaultItinerary.id))
22
+ .orderBy(asc(productDays.dayNumber))
23
+ : [];
24
+ const daysWithServices = await Promise.all(days.map(async (day) => {
25
+ const services = await db
26
+ .select()
27
+ .from(productDayServices)
28
+ .where(eq(productDayServices.dayId, day.id))
29
+ .orderBy(asc(productDayServices.sortOrder));
30
+ return { ...day, services };
31
+ }));
32
+ // 3. Generate PDF
33
+ const pdfDoc = await PDFDocument.create();
34
+ const font = await pdfDoc.embedFont(StandardFonts.Helvetica);
35
+ const boldFont = await pdfDoc.embedFont(StandardFonts.HelveticaBold);
36
+ const PAGE_WIDTH = 595.28;
37
+ const PAGE_HEIGHT = 841.89;
38
+ const MARGIN = 50;
39
+ const LINE_HEIGHT = 16;
40
+ let page = pdfDoc.addPage([PAGE_WIDTH, PAGE_HEIGHT]);
41
+ let y = PAGE_HEIGHT - MARGIN;
42
+ function ensureSpace(needed) {
43
+ if (y - needed < MARGIN) {
44
+ page = pdfDoc.addPage([PAGE_WIDTH, PAGE_HEIGHT]);
45
+ y = PAGE_HEIGHT - MARGIN;
46
+ }
47
+ }
48
+ function drawText(text, options) {
49
+ const f = options.font ?? font;
50
+ const size = options.size ?? 10;
51
+ const x = options.x ?? MARGIN;
52
+ ensureSpace(LINE_HEIGHT);
53
+ page.drawText(text, { x, y, size, font: f, color: rgb(0.1, 0.1, 0.1) });
54
+ y -= LINE_HEIGHT;
55
+ }
56
+ // Title
57
+ drawText(product.name, { font: boldFont, size: 20 });
58
+ y -= 8;
59
+ // Status & dates
60
+ if (product.startDate || product.endDate) {
61
+ drawText(`Dates: ${product.startDate ?? "TBD"} — ${product.endDate ?? "TBD"}`, { size: 10 });
62
+ }
63
+ if (product.pax) {
64
+ drawText(`Travelers: ${product.pax}`, { size: 10 });
65
+ }
66
+ if (product.sellAmountCents != null) {
67
+ const amount = (product.sellAmountCents / 100).toFixed(2);
68
+ drawText(`Total: ${amount} ${product.sellCurrency}`, { font: boldFont, size: 12 });
69
+ }
70
+ if (product.description) {
71
+ y -= 8;
72
+ drawText(plainTextForPdf(product.description), { size: 10 });
73
+ }
74
+ y -= 16;
75
+ // Days
76
+ for (const day of daysWithServices) {
77
+ ensureSpace(LINE_HEIGHT * 3);
78
+ // Day header
79
+ const dayTitle = day.title ? `Day ${day.dayNumber}: ${day.title}` : `Day ${day.dayNumber}`;
80
+ drawText(dayTitle, { font: boldFont, size: 13 });
81
+ if (day.location) {
82
+ drawText(`Location: ${day.location}`, { size: 9 });
83
+ }
84
+ if (day.description) {
85
+ drawText(plainTextForPdf(day.description), { size: 9 });
86
+ }
87
+ // Services
88
+ for (const svc of day.services) {
89
+ ensureSpace(LINE_HEIGHT * 2);
90
+ const costStr = `${(svc.costAmountCents / 100).toFixed(2)} ${svc.costCurrency}`;
91
+ const qty = svc.quantity > 1 ? ` x${svc.quantity}` : "";
92
+ drawText(` • ${svc.name} (${svc.serviceType})${qty} — ${costStr}`, { size: 9 });
93
+ if (svc.notes) {
94
+ drawText(` ${svc.notes}`, { size: 8 });
95
+ }
96
+ }
97
+ y -= 8;
98
+ }
99
+ // 4. Serialize to bytes
100
+ const pdfBytes = await pdfDoc.save();
101
+ return {
102
+ pdfBytes,
103
+ filename: `${product.name.replace(/[^a-zA-Z0-9]/g, "_")}.pdf`,
104
+ sizeBytes: pdfBytes.length,
105
+ };
106
+ }
@@ -0,0 +1,5 @@
1
+ export { brochureBodyToHtml, type CloudflareBrowserBrochurePrinterOptions, createBasicPdfProductBrochurePrinter, createCloudflareBrowserProductBrochurePrinter, createCloudflareBrowserProductBrochurePrinterFromEnv, type PrintedProductBrochureArtifact, type ProductBrochurePrinter, type ProductBrochurePrinterContext, } from "./brochure-printers.js";
2
+ export { createDefaultProductBrochureTemplate, loadProductBrochureTemplateContext, type ProductBrochureDayContext, type ProductBrochureTemplateContext, type ProductBrochureTemplateDefinition, type RenderedProductBrochureTemplate, renderProductBrochureTemplate, } from "./brochure-templates.js";
3
+ export { type GenerateAndStoreProductBrochureOptions, generateAndStoreProductBrochure, } from "./brochures.js";
4
+ export { type GenerateProductPdfResult, generateProductPdf } from "./generate-pdf.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,uCAAuC,EAC5C,oCAAoC,EACpC,6CAA6C,EAC7C,oDAAoD,EACpD,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,oCAAoC,EACpC,kCAAkC,EAClC,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,6BAA6B,GAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,KAAK,sCAAsC,EAC3C,+BAA+B,GAChC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,KAAK,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { brochureBodyToHtml, createBasicPdfProductBrochurePrinter, createCloudflareBrowserProductBrochurePrinter, createCloudflareBrowserProductBrochurePrinterFromEnv, } from "./brochure-printers.js";
2
+ export { createDefaultProductBrochureTemplate, loadProductBrochureTemplateContext, renderProductBrochureTemplate, } from "./brochure-templates.js";
3
+ export { generateAndStoreProductBrochure, } from "./brochures.js";
4
+ export { generateProductPdf } from "./generate-pdf.js";
@@ -0,0 +1,2 @@
1
+ export declare function plainTextForPdf(value: string): string;
2
+ //# sourceMappingURL=pdf-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-text.d.ts","sourceRoot":"","sources":["../../src/tasks/pdf-text.ts"],"names":[],"mappings":"AAyBA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,UAwB5C"}