@shophost/rest-api 2.0.32 → 2.0.33

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 (348) hide show
  1. package/package.json +13 -14
  2. package/src/app.js +53 -1
  3. package/src/app.js.map +1 -0
  4. package/src/core/auth/auth.schema.js +41 -1
  5. package/src/core/auth/auth.schema.js.map +1 -0
  6. package/src/core/auth/auth.util.js +44 -1
  7. package/src/core/auth/auth.util.js.map +1 -0
  8. package/src/core/auth/better-auth.lib.js +100 -1
  9. package/src/core/auth/better-auth.lib.js.map +1 -0
  10. package/src/core/auth/generate-password-hash.util.d.ts +3 -0
  11. package/src/core/auth/generate-password-hash.util.js +30 -1
  12. package/src/core/auth/generate-password-hash.util.js.map +1 -0
  13. package/src/core/auth/headers.schema.js +22 -1
  14. package/src/core/auth/headers.schema.js.map +1 -0
  15. package/src/core/auth/user.schema.js +30 -1
  16. package/src/core/auth/user.schema.js.map +1 -0
  17. package/src/core/db/__generated__/client/browser.d.ts +128 -0
  18. package/src/core/db/__generated__/client/browser.js +18 -1
  19. package/src/core/db/__generated__/client/browser.js.map +1 -0
  20. package/src/core/db/__generated__/client/client.d.ts +143 -0
  21. package/src/core/db/__generated__/client/client.js +35 -1
  22. package/src/core/db/__generated__/client/client.js.map +1 -0
  23. package/src/core/db/__generated__/client/commonInputTypes.js +11 -1
  24. package/src/core/db/__generated__/client/commonInputTypes.js.map +1 -0
  25. package/src/core/db/__generated__/client/enums.js +200 -1
  26. package/src/core/db/__generated__/client/enums.js.map +1 -0
  27. package/src/core/db/__generated__/client/internal/class.d.ts +343 -0
  28. package/src/core/db/__generated__/client/internal/class.js +55 -1
  29. package/src/core/db/__generated__/client/internal/class.js.map +1 -0
  30. package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +234 -0
  31. package/src/core/db/__generated__/client/internal/prismaNamespace.js +541 -1
  32. package/src/core/db/__generated__/client/internal/prismaNamespace.js.map +1 -0
  33. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +15 -0
  34. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +512 -1
  35. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js.map +1 -0
  36. package/src/core/db/__generated__/client/models/Account.d.ts +633 -0
  37. package/src/core/db/__generated__/client/models/Account.js +2 -1
  38. package/src/core/db/__generated__/client/models/Account.js.map +1 -0
  39. package/src/core/db/__generated__/client/models/Address.d.ts +706 -0
  40. package/src/core/db/__generated__/client/models/Address.js +2 -1
  41. package/src/core/db/__generated__/client/models/Address.js.map +1 -0
  42. package/src/core/db/__generated__/client/models/Campaign.d.ts +643 -0
  43. package/src/core/db/__generated__/client/models/Campaign.js +2 -1
  44. package/src/core/db/__generated__/client/models/Campaign.js.map +1 -0
  45. package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +639 -0
  46. package/src/core/db/__generated__/client/models/ClosingTimes.js +2 -1
  47. package/src/core/db/__generated__/client/models/ClosingTimes.js.map +1 -0
  48. package/src/core/db/__generated__/client/models/File.d.ts +757 -0
  49. package/src/core/db/__generated__/client/models/File.js +2 -1
  50. package/src/core/db/__generated__/client/models/File.js.map +1 -0
  51. package/src/core/db/__generated__/client/models/Invitation.d.ts +633 -0
  52. package/src/core/db/__generated__/client/models/Invitation.js +2 -1
  53. package/src/core/db/__generated__/client/models/Invitation.js.map +1 -0
  54. package/src/core/db/__generated__/client/models/LegalEntity.d.ts +657 -0
  55. package/src/core/db/__generated__/client/models/LegalEntity.js +2 -1
  56. package/src/core/db/__generated__/client/models/LegalEntity.js.map +1 -0
  57. package/src/core/db/__generated__/client/models/Manufacturer.d.ts +684 -0
  58. package/src/core/db/__generated__/client/models/Manufacturer.js +2 -1
  59. package/src/core/db/__generated__/client/models/Manufacturer.js.map +1 -0
  60. package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +633 -0
  61. package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +2 -1
  62. package/src/core/db/__generated__/client/models/ManufacturerTranslation.js.map +1 -0
  63. package/src/core/db/__generated__/client/models/Member.d.ts +633 -0
  64. package/src/core/db/__generated__/client/models/Member.js +2 -1
  65. package/src/core/db/__generated__/client/models/Member.js.map +1 -0
  66. package/src/core/db/__generated__/client/models/Modifier.d.ts +667 -0
  67. package/src/core/db/__generated__/client/models/Modifier.js +2 -1
  68. package/src/core/db/__generated__/client/models/Modifier.js.map +1 -0
  69. package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +691 -0
  70. package/src/core/db/__generated__/client/models/ModifierGroup.js +2 -1
  71. package/src/core/db/__generated__/client/models/ModifierGroup.js.map +1 -0
  72. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +633 -0
  73. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +2 -1
  74. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js.map +1 -0
  75. package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +639 -0
  76. package/src/core/db/__generated__/client/models/OpeningTimes.js +2 -1
  77. package/src/core/db/__generated__/client/models/OpeningTimes.js.map +1 -0
  78. package/src/core/db/__generated__/client/models/Order.d.ts +705 -0
  79. package/src/core/db/__generated__/client/models/Order.js +2 -1
  80. package/src/core/db/__generated__/client/models/Order.js.map +1 -0
  81. package/src/core/db/__generated__/client/models/OrderItem.d.ts +691 -0
  82. package/src/core/db/__generated__/client/models/OrderItem.js +2 -1
  83. package/src/core/db/__generated__/client/models/OrderItem.js.map +1 -0
  84. package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +633 -0
  85. package/src/core/db/__generated__/client/models/OrderItemTranslation.js +2 -1
  86. package/src/core/db/__generated__/client/models/OrderItemTranslation.js.map +1 -0
  87. package/src/core/db/__generated__/client/models/Organization.d.ts +816 -0
  88. package/src/core/db/__generated__/client/models/Organization.js +2 -1
  89. package/src/core/db/__generated__/client/models/Organization.js.map +1 -0
  90. package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +681 -0
  91. package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +2 -1
  92. package/src/core/db/__generated__/client/models/OrganizationConfiguration.js.map +1 -0
  93. package/src/core/db/__generated__/client/models/Payment.d.ts +673 -0
  94. package/src/core/db/__generated__/client/models/Payment.js +2 -1
  95. package/src/core/db/__generated__/client/models/Payment.js.map +1 -0
  96. package/src/core/db/__generated__/client/models/PaymentSession.d.ts +643 -0
  97. package/src/core/db/__generated__/client/models/PaymentSession.js +2 -1
  98. package/src/core/db/__generated__/client/models/PaymentSession.js.map +1 -0
  99. package/src/core/db/__generated__/client/models/Product.d.ts +751 -0
  100. package/src/core/db/__generated__/client/models/Product.js +2 -1
  101. package/src/core/db/__generated__/client/models/Product.js.map +1 -0
  102. package/src/core/db/__generated__/client/models/ProductCategory.d.ts +694 -0
  103. package/src/core/db/__generated__/client/models/ProductCategory.js +2 -1
  104. package/src/core/db/__generated__/client/models/ProductCategory.js.map +1 -0
  105. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +633 -0
  106. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +2 -1
  107. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js.map +1 -0
  108. package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +669 -0
  109. package/src/core/db/__generated__/client/models/ProductSnapshot.js +2 -1
  110. package/src/core/db/__generated__/client/models/ProductSnapshot.js.map +1 -0
  111. package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +633 -0
  112. package/src/core/db/__generated__/client/models/ProductTranslation.js +2 -1
  113. package/src/core/db/__generated__/client/models/ProductTranslation.js.map +1 -0
  114. package/src/core/db/__generated__/client/models/Reservation.d.ts +655 -0
  115. package/src/core/db/__generated__/client/models/Reservation.js +2 -1
  116. package/src/core/db/__generated__/client/models/Reservation.js.map +1 -0
  117. package/src/core/db/__generated__/client/models/Session.d.ts +633 -0
  118. package/src/core/db/__generated__/client/models/Session.js +2 -1
  119. package/src/core/db/__generated__/client/models/Session.js.map +1 -0
  120. package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +684 -0
  121. package/src/core/db/__generated__/client/models/ShippingMethod.js +2 -1
  122. package/src/core/db/__generated__/client/models/ShippingMethod.js.map +1 -0
  123. package/src/core/db/__generated__/client/models/ShippingZone.d.ts +643 -0
  124. package/src/core/db/__generated__/client/models/ShippingZone.js +2 -1
  125. package/src/core/db/__generated__/client/models/ShippingZone.js.map +1 -0
  126. package/src/core/db/__generated__/client/models/User.d.ts +741 -0
  127. package/src/core/db/__generated__/client/models/User.js +2 -1
  128. package/src/core/db/__generated__/client/models/User.js.map +1 -0
  129. package/src/core/db/__generated__/client/models/Verification.d.ts +597 -0
  130. package/src/core/db/__generated__/client/models/Verification.js +2 -1
  131. package/src/core/db/__generated__/client/models/Verification.js.map +1 -0
  132. package/src/core/db/__generated__/client/models.js +2 -1
  133. package/src/core/db/__generated__/client/models.js.map +1 -0
  134. package/src/core/db/index.js +2 -1
  135. package/src/core/db/index.js.map +1 -0
  136. package/src/core/exceptions/http-exception.js +9 -1
  137. package/src/core/exceptions/http-exception.js.map +1 -0
  138. package/src/core/hono/hono.js +123 -1
  139. package/src/core/hono/hono.js.map +1 -0
  140. package/src/core/lib/prisma.js +11 -1
  141. package/src/core/lib/prisma.js.map +1 -0
  142. package/src/core/logging/pino.js +5 -1
  143. package/src/core/logging/pino.js.map +1 -0
  144. package/src/core/notifications/email.service.d.ts +15 -0
  145. package/src/core/notifications/email.service.js +116 -1
  146. package/src/core/notifications/email.service.js.map +1 -0
  147. package/src/core/openapi/openapi.lib.js +26 -1
  148. package/src/core/openapi/openapi.lib.js.map +1 -0
  149. package/src/core/types/google-maps.types.js +2 -1
  150. package/src/core/types/google-maps.types.js.map +1 -0
  151. package/src/core/utils/currency.util.js +11 -1
  152. package/src/core/utils/currency.util.js.map +1 -0
  153. package/src/core/utils/env.util.js +8 -1
  154. package/src/core/utils/env.util.js.map +1 -0
  155. package/src/core/utils/object.util.d.ts +10 -0
  156. package/src/core/utils/object.util.js +39 -1
  157. package/src/core/utils/object.util.js.map +1 -0
  158. package/src/core/utils/translations.util.js +2 -0
  159. package/src/core/utils/translations.util.js.map +1 -0
  160. package/src/core/utils/zod.util.d.ts +12 -0
  161. package/src/core/utils/zod.util.js +85 -1
  162. package/src/core/utils/zod.util.js.map +1 -0
  163. package/src/db.js +3 -1
  164. package/src/db.js.map +1 -0
  165. package/src/features/access/access.handler.js +91 -1
  166. package/src/features/access/access.handler.js.map +1 -0
  167. package/src/features/access/access.route.js +220 -1
  168. package/src/features/access/access.route.js.map +1 -0
  169. package/src/features/access/access.schema.js +108 -1
  170. package/src/features/access/access.schema.js.map +1 -0
  171. package/src/features/access/access.service.js +294 -1
  172. package/src/features/access/access.service.js.map +1 -0
  173. package/src/features/cart/cart.handler.js +17 -1
  174. package/src/features/cart/cart.handler.js.map +1 -0
  175. package/src/features/cart/cart.route.js +32 -1
  176. package/src/features/cart/cart.route.js.map +1 -0
  177. package/src/features/cart/cart.schema.js +39 -1
  178. package/src/features/cart/cart.schema.js.map +1 -0
  179. package/src/features/cart/cart.service.d.ts +7 -0
  180. package/src/features/cart/cart.service.js +97 -1
  181. package/src/features/cart/cart.service.js.map +1 -0
  182. package/src/features/cart/cart.util.js +76 -1
  183. package/src/features/cart/cart.util.js.map +1 -0
  184. package/src/features/file/file.handler.js +23 -1
  185. package/src/features/file/file.handler.js.map +1 -0
  186. package/src/features/file/file.route.js +34 -1
  187. package/src/features/file/file.route.js.map +1 -0
  188. package/src/features/file/file.schema.js +77 -1
  189. package/src/features/file/file.schema.js.map +1 -0
  190. package/src/features/file/file.service.d.ts +6 -0
  191. package/src/features/file/file.service.js +66 -1
  192. package/src/features/file/file.service.js.map +1 -0
  193. package/src/features/health/health.handler.js +10 -1
  194. package/src/features/health/health.handler.js.map +1 -0
  195. package/src/features/health/health.route.js +25 -1
  196. package/src/features/health/health.route.js.map +1 -0
  197. package/src/features/index.js +16 -1
  198. package/src/features/index.js.map +1 -0
  199. package/src/features/location/location.handler.js +25 -1
  200. package/src/features/location/location.handler.js.map +1 -0
  201. package/src/features/location/location.route.js +56 -1
  202. package/src/features/location/location.route.js.map +1 -0
  203. package/src/features/location/location.schema.js +50 -1
  204. package/src/features/location/location.schema.js.map +1 -0
  205. package/src/features/location/location.service.d.ts +3 -0
  206. package/src/features/location/location.service.js +141 -1
  207. package/src/features/location/location.service.js.map +1 -0
  208. package/src/features/manufacturer/manufacturer.handler.js +53 -1
  209. package/src/features/manufacturer/manufacturer.handler.js.map +1 -0
  210. package/src/features/manufacturer/manufacturer.route.js +97 -1
  211. package/src/features/manufacturer/manufacturer.route.js.map +1 -0
  212. package/src/features/manufacturer/manufacturer.schema.js +125 -1
  213. package/src/features/manufacturer/manufacturer.schema.js.map +1 -0
  214. package/src/features/manufacturer/manufacturer.service.d.ts +19 -0
  215. package/src/features/manufacturer/manufacturer.service.js +190 -1
  216. package/src/features/manufacturer/manufacturer.service.js.map +1 -0
  217. package/src/features/order/emails/order-confirmation.email.js +229 -1
  218. package/src/features/order/emails/order-confirmation.email.js.map +1 -0
  219. package/src/features/order/emails/order-notification.email.js +229 -1
  220. package/src/features/order/emails/order-notification.email.js.map +1 -0
  221. package/src/features/order/fulfilment.schema.js +3 -1
  222. package/src/features/order/fulfilment.schema.js.map +1 -0
  223. package/src/features/order/order.handler.js +54 -1
  224. package/src/features/order/order.handler.js.map +1 -0
  225. package/src/features/order/order.route.js +111 -1
  226. package/src/features/order/order.route.js.map +1 -0
  227. package/src/features/order/order.schema.js +158 -1
  228. package/src/features/order/order.schema.js.map +1 -0
  229. package/src/features/order/order.service.d.ts +15 -0
  230. package/src/features/order/order.service.js +306 -1
  231. package/src/features/order/order.service.js.map +1 -0
  232. package/src/features/order/recipient.schema.js +38 -1
  233. package/src/features/order/recipient.schema.js.map +1 -0
  234. package/src/features/organization/legal-entity.schema.js +83 -1
  235. package/src/features/organization/legal-entity.schema.js.map +1 -0
  236. package/src/features/organization/organization-configuration.schema.js +115 -1
  237. package/src/features/organization/organization-configuration.schema.js.map +1 -0
  238. package/src/features/organization/organization.handler.js +48 -1
  239. package/src/features/organization/organization.handler.js.map +1 -0
  240. package/src/features/organization/organization.route.js +84 -1
  241. package/src/features/organization/organization.route.js.map +1 -0
  242. package/src/features/organization/organization.schema.js +64 -1
  243. package/src/features/organization/organization.schema.js.map +1 -0
  244. package/src/features/organization/organization.service.d.ts +15 -0
  245. package/src/features/organization/organization.service.js +334 -1
  246. package/src/features/organization/organization.service.js.map +1 -0
  247. package/src/features/payment/payment.handler.js +16 -1
  248. package/src/features/payment/payment.handler.js.map +1 -0
  249. package/src/features/payment/payment.route.js +22 -1
  250. package/src/features/payment/payment.route.js.map +1 -0
  251. package/src/features/payment/payment.schema.js +46 -1
  252. package/src/features/payment/payment.schema.js.map +1 -0
  253. package/src/features/payment/payment.service.js +100 -1
  254. package/src/features/payment/payment.service.js.map +1 -0
  255. package/src/features/payment/stripe.service.js +164 -1
  256. package/src/features/payment/stripe.service.js.map +1 -0
  257. package/src/features/product/product-modifier.schema.js +84 -1
  258. package/src/features/product/product-modifier.schema.js.map +1 -0
  259. package/src/features/product/product.handler.js +87 -1
  260. package/src/features/product/product.handler.js.map +1 -0
  261. package/src/features/product/product.route.js +179 -1
  262. package/src/features/product/product.route.js.map +1 -0
  263. package/src/features/product/product.schema.js +143 -1
  264. package/src/features/product/product.schema.js.map +1 -0
  265. package/src/features/product/product.service.d.ts +25 -0
  266. package/src/features/product/product.service.js +440 -1
  267. package/src/features/product/product.service.js.map +1 -0
  268. package/src/features/product-category/product-category.handler.js +59 -1
  269. package/src/features/product-category/product-category.handler.js.map +1 -0
  270. package/src/features/product-category/product-category.route.js +139 -1
  271. package/src/features/product-category/product-category.route.js.map +1 -0
  272. package/src/features/product-category/product-category.schema.js +86 -1
  273. package/src/features/product-category/product-category.schema.js.map +1 -0
  274. package/src/features/product-category/product-category.service.d.ts +22 -0
  275. package/src/features/product-category/product-category.service.js +220 -1
  276. package/src/features/product-category/product-category.service.js.map +1 -0
  277. package/src/features/reservation/emails/reservation-cancellation.email.js +82 -1
  278. package/src/features/reservation/emails/reservation-cancellation.email.js.map +1 -0
  279. package/src/features/reservation/emails/reservation-confirmation.email.js +82 -1
  280. package/src/features/reservation/emails/reservation-confirmation.email.js.map +1 -0
  281. package/src/features/reservation/emails/reservation-notification.email.js +93 -1
  282. package/src/features/reservation/emails/reservation-notification.email.js.map +1 -0
  283. package/src/features/reservation/reservation.handler.js +65 -1
  284. package/src/features/reservation/reservation.handler.js.map +1 -0
  285. package/src/features/reservation/reservation.route.js +167 -1
  286. package/src/features/reservation/reservation.route.js.map +1 -0
  287. package/src/features/reservation/reservation.schema.js +51 -1
  288. package/src/features/reservation/reservation.schema.js.map +1 -0
  289. package/src/features/reservation/reservation.service.d.ts +18 -0
  290. package/src/features/reservation/reservation.service.js +231 -1
  291. package/src/features/reservation/reservation.service.js.map +1 -0
  292. package/src/features/shipping/shipping.handler.js +32 -1
  293. package/src/features/shipping/shipping.handler.js.map +1 -0
  294. package/src/features/shipping/shipping.route.js +51 -1
  295. package/src/features/shipping/shipping.route.js.map +1 -0
  296. package/src/features/shipping/shipping.service.d.ts +7 -0
  297. package/src/features/shipping/shipping.service.js +96 -1
  298. package/src/features/shipping/shipping.service.js.map +1 -0
  299. package/src/features/shipping-method/shipping-method.handler.js +60 -1
  300. package/src/features/shipping-method/shipping-method.handler.js.map +1 -0
  301. package/src/features/shipping-method/shipping-method.route.js +144 -1
  302. package/src/features/shipping-method/shipping-method.route.js.map +1 -0
  303. package/src/features/shipping-method/shipping-method.schema.js +48 -1
  304. package/src/features/shipping-method/shipping-method.schema.js.map +1 -0
  305. package/src/features/shipping-method/shipping-method.service.d.ts +25 -0
  306. package/src/features/shipping-method/shipping-method.service.js +229 -1
  307. package/src/features/shipping-method/shipping-method.service.js.map +1 -0
  308. package/src/features/shipping-method/shipping-zone.schema.js +31 -1
  309. package/src/features/shipping-method/shipping-zone.schema.js.map +1 -0
  310. package/src/features/webhook/webhook.handler.js +50 -1
  311. package/src/features/webhook/webhook.handler.js.map +1 -0
  312. package/src/features/webhook/webhook.route.js +33 -1
  313. package/src/features/webhook/webhook.route.js.map +1 -0
  314. package/src/index.js +6 -1
  315. package/src/index.js.map +1 -0
  316. package/src/integrations/next.js +82 -1
  317. package/src/integrations/next.js.map +1 -0
  318. package/src/schemas/address.schema.d.ts +8 -0
  319. package/src/schemas/address.schema.js +112 -1
  320. package/src/schemas/address.schema.js.map +1 -0
  321. package/src/schemas/currency.schema.d.ts +42 -0
  322. package/src/schemas/currency.schema.js +118 -1
  323. package/src/schemas/currency.schema.js.map +1 -0
  324. package/src/schemas/error.schema.js +12 -1
  325. package/src/schemas/error.schema.js.map +1 -0
  326. package/src/schemas/index.js +29 -1
  327. package/src/schemas/index.js.map +1 -0
  328. package/src/schemas/locales.schema.js +238 -1
  329. package/src/schemas/locales.schema.js.map +1 -0
  330. package/src/schemas/number.schema.js +29 -1
  331. package/src/schemas/number.schema.js.map +1 -0
  332. package/src/schemas/pagination.schema.js +54 -1
  333. package/src/schemas/pagination.schema.js.map +1 -0
  334. package/src/schemas/params.schema.js +20 -1
  335. package/src/schemas/params.schema.js.map +1 -0
  336. package/src/schemas/queries.schema.js +6 -1
  337. package/src/schemas/queries.schema.js.map +1 -0
  338. package/src/test/global-setup.js +37 -1
  339. package/src/test/global-setup.js.map +1 -0
  340. package/src/test/integration/api-fixtures.js +160 -1
  341. package/src/test/integration/api-fixtures.js.map +1 -0
  342. package/src/test/integration/seed.js +368 -1
  343. package/src/test/integration/seed.js.map +1 -0
  344. package/src/test/integration/test-helpers.js +154 -1
  345. package/src/test/integration/test-helpers.js.map +1 -0
  346. package/src/test/setup-test-env.js +7 -1
  347. package/src/test/setup-test-env.js.map +1 -0
  348. package/scripts/minify.mjs +0 -123
@@ -1 +1,23 @@
1
- import{__awaiter as e}from"tslib";import{createApiRouter as o}from"../../core/hono/hono";import{fileRoute as r}from"./file.route";import{FileService as i}from"./file.service";export const buildFileHandler=n=>{const t=o();return t.openapi(r.getVercelToken,o=>e(void 0,void 0,void 0,function*(){const e=o.req.valid("json"),r=new i(n),t=yield r.getVercelToken(e,o.req.raw);return o.json(t,200)})),t.openapi(r.createTemporaryFile,o=>e(void 0,void 0,void 0,function*(){const e=o.req.valid("json"),r=o.get("auth"),t=yield r.getCurrentUser(),l=new i(n),d=yield l.createTemporaryFile(t.id,e);return o.json(d,201)})),t};
1
+ import { __awaiter } from "tslib";
2
+ import { createApiRouter } from "../../core/hono/hono";
3
+ import { fileRoute } from "./file.route";
4
+ import { FileService } from "./file.service";
5
+ export const buildFileHandler = (prisma) => {
6
+ const app = createApiRouter();
7
+ app.openapi(fileRoute.getVercelToken, (c) => __awaiter(void 0, void 0, void 0, function* () {
8
+ const body = c.req.valid("json");
9
+ const service = new FileService(prisma);
10
+ const tokenResponse = yield service.getVercelToken(body, c.req.raw);
11
+ return c.json(tokenResponse, 200);
12
+ }));
13
+ app.openapi(fileRoute.createTemporaryFile, (c) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const body = c.req.valid("json");
15
+ const auth = c.get("auth");
16
+ const user = yield auth.getCurrentUser();
17
+ const service = new FileService(prisma);
18
+ const file = yield service.createTemporaryFile(user.id, body);
19
+ return c.json(file, 201);
20
+ }));
21
+ return app;
22
+ };
23
+ //# sourceMappingURL=file.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.handler.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/file/file.handler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAwB,EAAE,EAAE;IAC3D,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAE9B,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,CAAO,CAAM,EAAE,EAAE;QACrD,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAU,CAAC,CAAC;QAE3E,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC,CAAC;IAEH,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAO,CAAM,EAAE,EAAE;QAC1D,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAEzC,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAE9D,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAA,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -1 +1,34 @@
1
- import{createApiRoute as e}from"../../core/hono/hono";import{CreateTemporaryFileSchema as r,FileSchema as o,GetVercelTokenBody as t,GetVercelTokenResponse as s,HeaderSchema as a}from"../../schemas";const n=e({body:r,description:"Creates a temporary file record and returns its ID",headers:a,method:"POST",operationId:"createTemporaryFile",path:"/files",responses:{201:o},summary:"Create Temporary File",tags:["File"]}),i=e({body:t,description:"Returns a Vercel token",headers:a,method:"POST",operationId:"getVercelToken",path:"/files/token/vercel",responses:{200:s,204:null},summary:"Get Vercel Token",tags:["File"]});export const fileRoute={createTemporaryFile:n,getVercelToken:i};
1
+ import { createApiRoute } from "../../core/hono/hono";
2
+ import { CreateTemporaryFileSchema, FileSchema, GetVercelTokenBody, GetVercelTokenResponse, HeaderSchema, } from "../../schemas";
3
+ const createTemporaryFileRoute = createApiRoute({
4
+ body: CreateTemporaryFileSchema,
5
+ description: "Creates a temporary file record and returns its ID",
6
+ headers: HeaderSchema,
7
+ method: "POST",
8
+ operationId: "createTemporaryFile",
9
+ path: "/files",
10
+ responses: {
11
+ 201: FileSchema,
12
+ },
13
+ summary: "Create Temporary File",
14
+ tags: ["File"],
15
+ });
16
+ const getVercelTokenRoute = createApiRoute({
17
+ body: GetVercelTokenBody,
18
+ description: "Returns a Vercel token",
19
+ headers: HeaderSchema,
20
+ method: "POST",
21
+ operationId: "getVercelToken",
22
+ path: "/files/token/vercel",
23
+ responses: {
24
+ 200: GetVercelTokenResponse,
25
+ 204: null,
26
+ },
27
+ summary: "Get Vercel Token",
28
+ tags: ["File"],
29
+ });
30
+ export const fileRoute = {
31
+ createTemporaryFile: createTemporaryFileRoute,
32
+ getVercelToken: getVercelTokenRoute,
33
+ };
34
+ //# sourceMappingURL=file.route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.route.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/file/file.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,MAAM,wBAAwB,GAAG,cAAc,CAAC;IAC9C,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,oDAAoD;IACjE,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,qBAAqB;IAClC,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE;QACT,GAAG,EAAE,UAAU;KAChB;IACD,OAAO,EAAE,uBAAuB;IAChC,IAAI,EAAE,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,cAAc,CAAC;IACzC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,wBAAwB;IACrC,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,qBAAqB;IAC3B,SAAS,EAAE;QACT,GAAG,EAAE,sBAAsB;QAC3B,GAAG,EAAE,IAAI;KACV;IACD,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,mBAAmB,EAAE,wBAAwB;IAC7C,cAAc,EAAE,mBAAmB;CACpC,CAAC"}
@@ -1 +1,77 @@
1
- import{z as e}from"@hono/zod-openapi";const i=e.object({type:e.literal("blob.generate-client-token"),payload:e.object({pathname:e.string(),callbackUrl:e.string(),multipart:e.boolean(),clientPayload:e.string().nullable()})}),t=e.object({type:e.literal("blob.upload-completed"),payload:e.object({blob:e.any(),tokenPayload:e.string().nullable().optional()})});export const GetVercelTokenBody=e.discriminatedUnion("type",[i,t]);export const GetVercelTokenResponse=e.discriminatedUnion("type",[e.object({type:e.literal("blob.generate-client-token"),clientToken:e.string()}),e.object({type:e.literal("blob.upload-completed"),response:e.literal("ok")})]);export const CreateTemporaryFileSchema=e.object({mimeType:e.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:e.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:e.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"}),organizationId:e.string().optional().openapi({example:"clm1234567890abcdef",description:"ID of the organization"})});export const FileSchema=e.object({id:e.string().min(1,"ID is required").openapi({example:"clf9876543210abcdef",description:"ID of the file"}),url:e.string().min(1,"Path is required").openapi({example:"/path/to/file",description:"Path of the file"}),mimeType:e.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:e.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:e.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"})}).openapi("UploadedFile");
1
+ import { z } from "@hono/zod-openapi";
2
+ const GenerateClientTokenEventSchema = z.object({
3
+ type: z.literal("blob.generate-client-token"),
4
+ payload: z.object({
5
+ pathname: z.string(),
6
+ callbackUrl: z.string(),
7
+ multipart: z.boolean(),
8
+ clientPayload: z.string().nullable(),
9
+ }),
10
+ });
11
+ // Schema for UploadCompletedEvent
12
+ const UploadCompletedEventSchema = z.object({
13
+ type: z.literal("blob.upload-completed"),
14
+ payload: z.object({
15
+ // Replace z.any() with an appropriate schema for PutBlobResult if available
16
+ blob: z.any(),
17
+ tokenPayload: z.string().nullable().optional(),
18
+ }),
19
+ });
20
+ // Discriminated union schema for HandleUploadBody
21
+ export const GetVercelTokenBody = z.discriminatedUnion("type", [
22
+ GenerateClientTokenEventSchema,
23
+ UploadCompletedEventSchema,
24
+ ]);
25
+ export const GetVercelTokenResponse = z.discriminatedUnion("type", [
26
+ z.object({
27
+ type: z.literal("blob.generate-client-token"),
28
+ clientToken: z.string(),
29
+ }),
30
+ z.object({
31
+ type: z.literal("blob.upload-completed"),
32
+ response: z.literal("ok"),
33
+ }),
34
+ ]);
35
+ export const CreateTemporaryFileSchema = z.object({
36
+ mimeType: z.string().min(1, "MIME type is required").openapi({
37
+ example: "image/png",
38
+ description: "MIME type of the file",
39
+ }),
40
+ size: z.number().min(1, "Size is required").openapi({
41
+ example: 1024,
42
+ description: "Size of the file in bytes",
43
+ }),
44
+ filename: z.string().min(1, "Filename is required").openapi({
45
+ example: "example.png",
46
+ description: "Name of the file",
47
+ }),
48
+ organizationId: z.string().optional().openapi({
49
+ example: "clm1234567890abcdef",
50
+ description: "ID of the organization",
51
+ }),
52
+ });
53
+ export const FileSchema = z
54
+ .object({
55
+ id: z.string().min(1, "ID is required").openapi({
56
+ example: "clf9876543210abcdef",
57
+ description: "ID of the file",
58
+ }),
59
+ url: z.string().min(1, "Path is required").openapi({
60
+ example: "/path/to/file",
61
+ description: "Path of the file",
62
+ }),
63
+ mimeType: z.string().min(1, "MIME type is required").openapi({
64
+ example: "image/png",
65
+ description: "MIME type of the file",
66
+ }),
67
+ size: z.number().min(1, "Size is required").openapi({
68
+ example: 1024,
69
+ description: "Size of the file in bytes",
70
+ }),
71
+ filename: z.string().min(1, "Filename is required").openapi({
72
+ example: "example.png",
73
+ description: "Name of the file",
74
+ }),
75
+ })
76
+ .openapi("UploadedFile");
77
+ //# sourceMappingURL=file.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.schema.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/file/file.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC;IAC7C,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;QACtB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACrC,CAAC;CACH,CAAC,CAAC;AAEH,kCAAkC;AAClC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,4EAA4E;QAC5E,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE;QACb,Y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,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC;QAC5C,OAAO,EAAE,qBAAqB;QAC9B,WAAW,EAAE,wBAAwB;KACtC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC;QAC9C,OAAO,EAAE,qBAAqB;QAC9B,WAAW,EAAE,gBAAgB;KAC9B,CAAC;IACF,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,OAAO,CAAC;QACjD,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,kBAAkB;KAChC,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,OAAO,CAAC;QAC3D,OAAO,EAAE,WAAW;QACpB,WAAW,EAAE,uBAAuB;KACrC,CAAC;IACF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,OAAO,CAAC;QAClD,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,2BAA2B;KACzC,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,OAAO,CAAC;QAC1D,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,kBAAkB;KAChC,CAAC;CACH,CAAC;KACD,OAAO,CAAC,cAAc,CAAC,CAAC"}
@@ -4,6 +4,9 @@ import { CreateTemporaryFileSchema, GetVercelTokenBody } from "../../schemas";
4
4
  declare class FileService {
5
5
  private readonly prisma;
6
6
  constructor(prisma: PrismaClientType);
7
+ /**
8
+ * Get Vercel token for file upload
9
+ */
7
10
  getVercelToken(body: z.infer<typeof GetVercelTokenBody>, request: any): Promise<{
8
11
  type: "blob.generate-client-token";
9
12
  clientToken: string;
@@ -11,6 +14,9 @@ declare class FileService {
11
14
  type: "blob.upload-completed";
12
15
  response: "ok";
13
16
  }>;
17
+ /**
18
+ * Create a temporary file record
19
+ */
14
20
  createTemporaryFile(userId: string, body: z.infer<typeof CreateTemporaryFileSchema>): Promise<{
15
21
  id: string;
16
22
  url: string;
@@ -1 +1,66 @@
1
- import{__awaiter as e}from"tslib";import{handleUpload as o}from"@vercel/blob/client";import{logger as t}from"../../core/logging/pino";import{FileSchema as r,GetVercelTokenResponse as i}from"../../schemas";class a{constructor(e){this.prisma=e}getVercelToken(r,a){return e(this,void 0,void 0,function*(){const n=yield o({body:r,request:a,onBeforeGenerateToken:()=>e(this,void 0,void 0,function*(){if("blob.generate-client-token"!==r.type)throw new Error("Invalid type");if(!r.payload.clientPayload)throw new Error("clientPayload is required");return yield a.auth.getCurrentUser(),{addRandomSuffix:!0,allowedContentTypes:["image/jpeg","image/png","image/gif"],tokenPayload:r.payload.clientPayload}}),onUploadCompleted:o=>e(this,[o],void 0,function*({blob:e,tokenPayload:o}){if(t.info({blob:e,tokenPayload:o},"blob upload completed"),!o)throw new Error("tokenPayload is required");const{fileId:r}=JSON.parse(o);yield this.prisma.file.update({where:{id:r},data:{filename:e.pathname,url:e.url,mimeType:e.contentType,status:"completed"}})})});return i.parse(n)})}createTemporaryFile(o,t){return e(this,void 0,void 0,function*(){const e=yield this.prisma.file.create({data:Object.assign(Object.assign({},t),{url:"-",createdBy:o})});return r.parse(e)})}}export{a as FileService};
1
+ import { __awaiter } from "tslib";
2
+ import { handleUpload } from "@vercel/blob/client";
3
+ import { logger } from "../../core/logging/pino";
4
+ import { FileSchema, GetVercelTokenResponse, } from "../../schemas";
5
+ class FileService {
6
+ constructor(prisma) {
7
+ this.prisma = prisma;
8
+ }
9
+ /**
10
+ * Get Vercel token for file upload
11
+ */
12
+ getVercelToken(body, request) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ const jsonResponse = yield handleUpload({
15
+ body: body,
16
+ request,
17
+ onBeforeGenerateToken: () => __awaiter(this, void 0, void 0, function* () {
18
+ if (body.type !== "blob.generate-client-token") {
19
+ throw new Error("Invalid type");
20
+ }
21
+ if (!body.payload.clientPayload) {
22
+ throw new Error("clientPayload is required");
23
+ }
24
+ yield request.auth.getCurrentUser();
25
+ return {
26
+ addRandomSuffix: true,
27
+ allowedContentTypes: ["image/jpeg", "image/png", "image/gif"],
28
+ tokenPayload: body.payload.clientPayload,
29
+ };
30
+ }),
31
+ onUploadCompleted: (_a) => __awaiter(this, [_a], void 0, function* ({ blob, tokenPayload }) {
32
+ logger.info({ blob, tokenPayload }, "blob upload completed");
33
+ if (!tokenPayload) {
34
+ throw new Error("tokenPayload is required");
35
+ }
36
+ const { fileId } = JSON.parse(tokenPayload);
37
+ yield this.prisma.file.update({
38
+ where: {
39
+ id: fileId,
40
+ },
41
+ data: {
42
+ filename: blob.pathname,
43
+ url: blob.url,
44
+ mimeType: blob.contentType,
45
+ status: "completed",
46
+ },
47
+ });
48
+ }),
49
+ });
50
+ return GetVercelTokenResponse.parse(jsonResponse);
51
+ });
52
+ }
53
+ /**
54
+ * Create a temporary file record
55
+ */
56
+ createTemporaryFile(userId, body) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const file = yield this.prisma.file.create({
59
+ data: Object.assign(Object.assign({}, body), { url: "-", createdBy: userId }),
60
+ });
61
+ return FileSchema.parse(file);
62
+ });
63
+ }
64
+ }
65
+ export { FileService };
66
+ //# sourceMappingURL=file.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.service.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/file/file.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAGrE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,E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,MAAM;yBACX;wBACD,IAAI,EAAE;4BACJ,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,GAAG,EAAE,IAAI,CAAC,GAAG;4BACb,QAAQ,EAAE,IAAI,CAAC,WAAW;4BAC1B,MAAM,EAAE,WAAW;yBACpB;qBACF,CAAC,CAAC;gBACL,CAAC,CAAA;aACF,CAAC,CAAC;YAEH,OAAO,sBAAsB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACpD,CAAC;KAAA;IAED;;OAEG;IACU,mBAAmB,CAC9B,MAAc,EACd,IAA+C;;YAE/C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;gBACzC,IAAI,kCACC,IAAI,KACP,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,MAAM,GAClB;aACF,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1 +1,10 @@
1
- import{createApiRouter as o}from"../../core/hono/hono";import{healthRoute as r}from"./health.route";export const buildHealthHandler=()=>{const n=o();return n.openapi(r.ping,o=>o.json({ok:!0},200)),n};
1
+ import { createApiRouter } from "../../core/hono/hono";
2
+ import { healthRoute } from "./health.route";
3
+ export const buildHealthHandler = () => {
4
+ const app = createApiRouter();
5
+ app.openapi(healthRoute.ping, (c) => {
6
+ return c.json({ ok: true }, 200);
7
+ });
8
+ return app;
9
+ };
10
+ //# sourceMappingURL=health.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.handler.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/health/health.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAE9B,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAM,EAAE,EAAE;QACvC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -1 +1,25 @@
1
- import{z as e}from"@hono/zod-openapi";import{createApiRoute as o}from"../../core/hono/hono";import{ErrorSchema as i,HeaderSchema as t}from"../../schemas";const a=o({description:"Pings the relevancy score service to check its availability",headers:t,method:"GET",operationId:"ping",path:"/ping",responses:{200:e.object({ok:e.boolean().openapi({description:"Indicates if the service is available",example:!0})}),500:i},summary:"Ping",tags:["Health"]});export const healthRoute={ping:a};
1
+ import { z } from "@hono/zod-openapi";
2
+ import { createApiRoute } from "../../core/hono/hono";
3
+ import { ErrorSchema, HeaderSchema } from "../../schemas";
4
+ const pingRoute = createApiRoute({
5
+ description: "Pings the relevancy score service to check its availability",
6
+ headers: HeaderSchema,
7
+ method: "GET",
8
+ operationId: "ping",
9
+ path: "/ping",
10
+ responses: {
11
+ 200: z.object({
12
+ ok: z.boolean().openapi({
13
+ description: "Indicates if the service is available",
14
+ example: true,
15
+ }),
16
+ }),
17
+ 500: ErrorSchema,
18
+ },
19
+ summary: "Ping",
20
+ tags: ["Health"],
21
+ });
22
+ export const healthRoute = {
23
+ ping: pingRoute,
24
+ };
25
+ //# sourceMappingURL=health.route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.route.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/health/health.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,SAAS,GAAG,cAAc,CAAC;IAC/B,WAAW,EAAE,6DAA6D;IAC1E,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,OAAO;IACb,SAAS,EAAE;QACT,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;YACZ,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC;gBACtB,WAAW,EAAE,uCAAuC;gBACpD,OAAO,EAAE,IAAI;aACd,CAAC;SACH,CAAC;QACF,GAAG,EAAE,WAAW;KACjB;IACD,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,CAAC,QAAQ,CAAC;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,SAAS;CAChB,CAAC"}
@@ -1 +1,16 @@
1
- export{buildAccessHandler}from"./access/access.handler";export{buildCartHandler}from"./cart/cart.handler";export{buildFileHandler}from"./file/file.handler";export{buildHealthHandler}from"./health/health.handler";export{buildLocationHandler}from"./location/location.handler";export{buildManufacturerHandler}from"./manufacturer/manufacturer.handler";export{buildOrderHandler}from"./order/order.handler";export{buildOrganizationHandler}from"./organization/organization.handler";export{buildPaymentHandler}from"./payment/payment.handler";export{buildProductCategoryHandler}from"./product-category/product-category.handler";export{buildProductHandler}from"./product/product.handler";export{buildReservationHandler}from"./reservation/reservation.handler";export{buildShippingHandler}from"./shipping/shipping.handler";export{buildShippingMethodHandler}from"./shipping-method/shipping-method.handler";export{buildWebhookHandler}from"./webhook/webhook.handler";
1
+ export { buildAccessHandler } from "./access/access.handler";
2
+ export { buildCartHandler } from "./cart/cart.handler";
3
+ export { buildFileHandler } from "./file/file.handler";
4
+ export { buildHealthHandler } from "./health/health.handler";
5
+ export { buildLocationHandler } from "./location/location.handler";
6
+ export { buildManufacturerHandler } from "./manufacturer/manufacturer.handler";
7
+ export { buildOrderHandler } from "./order/order.handler";
8
+ export { buildOrganizationHandler } from "./organization/organization.handler";
9
+ export { buildPaymentHandler } from "./payment/payment.handler";
10
+ export { buildProductCategoryHandler } from "./product-category/product-category.handler";
11
+ export { buildProductHandler } from "./product/product.handler";
12
+ export { buildReservationHandler } from "./reservation/reservation.handler";
13
+ export { buildShippingHandler } from "./shipping/shipping.handler";
14
+ export { buildShippingMethodHandler } from "./shipping-method/shipping-method.handler";
15
+ export { buildWebhookHandler } from "./webhook/webhook.handler";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/rest-api/src/features/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1 +1,25 @@
1
- import{__awaiter as o}from"tslib";import{createApiRouter as e}from"../../core/hono/hono";import{locationRoute as t}from"./location.route";import{LocationService as i}from"./location.service";export const buildLocationHandler=r=>{const n=e();return n.openapi(t.getPredictions,e=>o(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("query");yield o.getCurrentUser();const n=new i(r.google.key),a=yield n.getPredictions(t.query,t.radius);return e.json(a,200)})),n.openapi(t.getPlaceDetails,e=>o(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param");yield o.getCurrentUser();const n=new i(r.google.key),a=yield n.getPlaceDetails(t.placeId);return e.json(a,200)})),n};
1
+ import { __awaiter } from "tslib";
2
+ import { createApiRouter } from "../../core/hono/hono";
3
+ import { locationRoute } from "./location.route";
4
+ import { LocationService } from "./location.service";
5
+ export const buildLocationHandler = (options) => {
6
+ const app = createApiRouter();
7
+ app.openapi(locationRoute.getPredictions, (c) => __awaiter(void 0, void 0, void 0, function* () {
8
+ const auth = c.get("auth");
9
+ const query = c.req.valid("query");
10
+ yield auth.getCurrentUser();
11
+ const service = new LocationService(options.google.key);
12
+ const predictions = yield service.getPredictions(query.query, query.radius);
13
+ return c.json(predictions, 200);
14
+ }));
15
+ app.openapi(locationRoute.getPlaceDetails, (c) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const auth = c.get("auth");
17
+ const params = c.req.valid("param");
18
+ yield auth.getCurrentUser();
19
+ const service = new LocationService(options.google.key);
20
+ const placeDetails = yield service.getPlaceDetails(params.placeId);
21
+ return c.json(placeDetails, 200);
22
+ }));
23
+ return app;
24
+ };
25
+ //# sourceMappingURL=location.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.handler.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/location/location.handler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;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C,CAAA,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -1 +1,56 @@
1
- import{z as e}from"@hono/zod-openapi";import{createApiRoute as a}from"../../core/hono/hono";import{ErrorSchema as o,HeaderSchema as t,PlaceDetailsSchema as r,PlaceSchema as s}from"../../schemas";const i=a({description:"Returns a list of places for autocompletion based on a search query",headers:t,method:"GET",operationId:"getPredictions",path:"/places/prediction",query:e.object({query:e.string().openapi({description:"Search query",example:"123 Main St"}),radius:e.coerce.number().default(1e4).openapi({description:"Search radius in meters",example:1e4})}),responses:{200:e.array(s),400:o,401:o},summary:"Get Places Predictions",tags:["Location"]}),p=a({description:"Returns details for a specific place based on its placeId",headers:t,method:"GET",operationId:"getPlaceDetails",path:"/places/:placeId",pathParams:e.object({placeId:e.string().openapi({description:"The Google Place ID for the address",example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",param:{in:"path",name:"placeId"}})}),responses:{200:r,400:o,401:o},summary:"Get Place Details",tags:["Location"]});export const locationRoute={getPredictions:i,getPlaceDetails:p};
1
+ import { z } from "@hono/zod-openapi";
2
+ import { createApiRoute } from "../../core/hono/hono";
3
+ import { ErrorSchema, HeaderSchema, PlaceDetailsSchema, PlaceSchema, } from "../../schemas";
4
+ const getPredictionsRoute = createApiRoute({
5
+ description: "Returns a list of places for autocompletion based on a search query",
6
+ headers: HeaderSchema,
7
+ method: "GET",
8
+ operationId: "getPredictions",
9
+ path: "/places/prediction",
10
+ query: z.object({
11
+ query: z.string().openapi({
12
+ description: "Search query",
13
+ example: "123 Main St",
14
+ }),
15
+ radius: z.coerce.number().default(10000).openapi({
16
+ description: "Search radius in meters",
17
+ example: 10000,
18
+ }),
19
+ }),
20
+ responses: {
21
+ 200: z.array(PlaceSchema),
22
+ 400: ErrorSchema,
23
+ 401: ErrorSchema,
24
+ },
25
+ summary: "Get Places Predictions",
26
+ tags: ["Location"],
27
+ });
28
+ const getPlaceDetailsRoute = createApiRoute({
29
+ description: "Returns details for a specific place based on its placeId",
30
+ headers: HeaderSchema,
31
+ method: "GET",
32
+ operationId: "getPlaceDetails",
33
+ path: "/places/:placeId",
34
+ pathParams: z.object({
35
+ placeId: z.string().openapi({
36
+ description: "The Google Place ID for the address",
37
+ example: "ChIJN1t_tKlj4AR4GeTYWZ7frY",
38
+ param: {
39
+ in: "path",
40
+ name: "placeId",
41
+ },
42
+ }),
43
+ }),
44
+ responses: {
45
+ 200: PlaceDetailsSchema,
46
+ 400: ErrorSchema,
47
+ 401: ErrorSchema,
48
+ },
49
+ summary: "Get Place Details",
50
+ tags: ["Location"],
51
+ });
52
+ export const locationRoute = {
53
+ getPredictions: getPredictionsRoute,
54
+ getPlaceDetails: getPlaceDetailsRoute,
55
+ };
56
+ //# sourceMappingURL=location.route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.route.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/location/location.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,WAAW,GACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,mBAAmB,GAAG,cAAc,CAAC;IACzC,WAAW,EACT,qEAAqE;IACvE,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC;YACxB,WAAW,EAAE,cAAc;YAC3B,OAAO,EAAE,aAAa;SACvB,CAAC;QACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YAC/C,WAAW,EAAE,yBAAyB;YACtC,OAAO,EAAE,KAAK;SACf,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QACzB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;KACjB;IACD,OAAO,EAAE,wBAAwB;IACjC,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,cAAc,CAAC;IAC1C,WAAW,EAAE,2DAA2D;IACxE,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,kBAAkB;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC;YAC1B,WAAW,EAAE,qCAAqC;YAClD,OAAO,EAAE,4BAA4B;YACrC,KAAK,EAAE;gBACL,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,SAAS;aAChB;SACF,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,GAAG,EAAE,kBAAkB;QACvB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;KACjB;IACD,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc,EAAE,mBAAmB;IACnC,eAAe,EAAE,oBAAoB;CACtC,CAAC"}
@@ -1 +1,50 @@
1
- import{z as e}from"@hono/zod-openapi";export const PlaceSchema=e.object({placeId:e.string().openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"}),text:e.string().openapi({example:"123 Main Street, New York, USA",description:"The description of the place"}),addressLineOne:e.string().openapi({example:"123 Main Street",description:"The first line of the address"}),addressLineTwo:e.string().optional().openapi({example:"Suite 100",description:"The second line of the address"}),latitude:e.number().optional().openapi({example:40.712776,description:"The latitude of the coordinate"}),longitude:e.number().optional().openapi({example:-74.005974,description:"The longitude of the coordinate"})}).openapi("Place");export const PlaceDetailsSchema=e.object({addressLineOne:e.string().openapi({example:"123 Main Street",description:"The first line of the address"}),zipCode:e.string().optional().openapi({example:"12345",description:"The postal code of the address"}),city:e.string().openapi({example:"New York",description:"The city of the address"}),country:e.string().openapi({example:"USA",description:"The ISO 3166-1 alpha-2 country code"})}).openapi("PlaceDetails");
1
+ import { z } from "@hono/zod-openapi";
2
+ export const PlaceSchema = z
3
+ .object({
4
+ placeId: z.string().openapi({
5
+ example: "ChIJN1t_tKlj4AR4GeTYWZ7frY",
6
+ description: "The Google Place ID for the address",
7
+ }),
8
+ text: z.string().openapi({
9
+ example: "123 Main Street, New York, USA",
10
+ description: "The description of the place",
11
+ }),
12
+ addressLineOne: z.string().openapi({
13
+ example: "123 Main Street",
14
+ description: "The first line of the address",
15
+ }),
16
+ addressLineTwo: z.string().optional().openapi({
17
+ example: "Suite 100",
18
+ description: "The second line of the address",
19
+ }),
20
+ latitude: z.number().optional().openapi({
21
+ example: 40.712776,
22
+ description: "The latitude of the coordinate",
23
+ }),
24
+ longitude: z.number().optional().openapi({
25
+ example: -74.005974,
26
+ description: "The longitude of the coordinate",
27
+ }),
28
+ })
29
+ .openapi("Place");
30
+ export const PlaceDetailsSchema = z
31
+ .object({
32
+ addressLineOne: z.string().openapi({
33
+ example: "123 Main Street",
34
+ description: "The first line of the address",
35
+ }),
36
+ zipCode: z.string().optional().openapi({
37
+ example: "12345",
38
+ description: "The postal code of the address",
39
+ }),
40
+ city: z.string().openapi({
41
+ example: "New York",
42
+ description: "The city of the address",
43
+ }),
44
+ country: z.string().openapi({
45
+ example: "USA",
46
+ description: "The ISO 3166-1 alpha-2 country code",
47
+ }),
48
+ })
49
+ .openapi("PlaceDetails");
50
+ //# sourceMappingURL=location.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.schema.js","sourceRoot":"","sources":["../../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,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC;QACrC,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,gCAAgC;KAC9C,CAAC;IACF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC;QACvB,OAAO,EAAE,UAAU;QACnB,WAAW,EAAE,yBAAyB;KACvC,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC;QAC1B,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,qCAAqC;KACnD,CAAC;CACH,CAAC;KACD,OAAO,CAAC,cAAc,CAAC,CAAC"}
@@ -6,6 +6,9 @@ declare class LocationService {
6
6
  readonly apiKey: string;
7
7
  private client;
8
8
  constructor(apiKey: string);
9
+ /**
10
+ * Get a list of places for autocompletion based on a search query
11
+ */
9
12
  getPredictions(query: string, radius: number): Promise<{
10
13
  placeId: string;
11
14
  text: string;