@shophost/rest-api 2.0.34 → 2.0.36

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 (220) hide show
  1. package/LICENSE +17 -13
  2. package/README.md +76 -66
  3. package/package.json +2 -2
  4. package/scripts/minify-dist.mjs +45 -0
  5. package/src/app.js +1 -53
  6. package/src/app.js.map +1 -1
  7. package/src/core/auth/auth.schema.js +1 -41
  8. package/src/core/auth/auth.util.js +1 -44
  9. package/src/core/auth/better-auth.lib.js +1 -100
  10. package/src/core/auth/generate-password-hash.util.js +1 -30
  11. package/src/core/auth/headers.schema.js +1 -22
  12. package/src/core/auth/user.schema.js +1 -30
  13. package/src/core/db/__generated__/client/browser.js +1 -18
  14. package/src/core/db/__generated__/client/client.js +1 -35
  15. package/src/core/db/__generated__/client/commonInputTypes.js +1 -11
  16. package/src/core/db/__generated__/client/enums.js +1 -200
  17. package/src/core/db/__generated__/client/internal/class.js +769 -55
  18. package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +2 -2
  19. package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -541
  20. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -512
  21. package/src/core/db/__generated__/client/models/Account.d.ts +0 -5
  22. package/src/core/db/__generated__/client/models/Account.js +1 -2
  23. package/src/core/db/__generated__/client/models/Address.d.ts +0 -5
  24. package/src/core/db/__generated__/client/models/Address.js +1 -2
  25. package/src/core/db/__generated__/client/models/Campaign.d.ts +0 -5
  26. package/src/core/db/__generated__/client/models/Campaign.js +1 -2
  27. package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +0 -5
  28. package/src/core/db/__generated__/client/models/ClosingTimes.js +1 -2
  29. package/src/core/db/__generated__/client/models/File.d.ts +0 -5
  30. package/src/core/db/__generated__/client/models/File.js +1 -2
  31. package/src/core/db/__generated__/client/models/Invitation.d.ts +0 -5
  32. package/src/core/db/__generated__/client/models/Invitation.js +1 -2
  33. package/src/core/db/__generated__/client/models/LegalEntity.d.ts +0 -5
  34. package/src/core/db/__generated__/client/models/LegalEntity.js +1 -2
  35. package/src/core/db/__generated__/client/models/Manufacturer.d.ts +0 -5
  36. package/src/core/db/__generated__/client/models/Manufacturer.js +1 -2
  37. package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +0 -5
  38. package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +1 -2
  39. package/src/core/db/__generated__/client/models/Member.d.ts +0 -5
  40. package/src/core/db/__generated__/client/models/Member.js +1 -2
  41. package/src/core/db/__generated__/client/models/Modifier.d.ts +0 -5
  42. package/src/core/db/__generated__/client/models/Modifier.js +1 -2
  43. package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +0 -5
  44. package/src/core/db/__generated__/client/models/ModifierGroup.js +1 -2
  45. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +0 -5
  46. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +1 -2
  47. package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +0 -5
  48. package/src/core/db/__generated__/client/models/OpeningTimes.js +1 -2
  49. package/src/core/db/__generated__/client/models/Order.d.ts +0 -5
  50. package/src/core/db/__generated__/client/models/Order.js +1 -2
  51. package/src/core/db/__generated__/client/models/OrderItem.d.ts +0 -5
  52. package/src/core/db/__generated__/client/models/OrderItem.js +1 -2
  53. package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +0 -5
  54. package/src/core/db/__generated__/client/models/OrderItemTranslation.js +1 -2
  55. package/src/core/db/__generated__/client/models/Organization.d.ts +0 -5
  56. package/src/core/db/__generated__/client/models/Organization.js +1 -2
  57. package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +0 -5
  58. package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +1 -2
  59. package/src/core/db/__generated__/client/models/Payment.d.ts +0 -5
  60. package/src/core/db/__generated__/client/models/Payment.js +1 -2
  61. package/src/core/db/__generated__/client/models/PaymentSession.d.ts +0 -5
  62. package/src/core/db/__generated__/client/models/PaymentSession.js +1 -2
  63. package/src/core/db/__generated__/client/models/Product.d.ts +0 -5
  64. package/src/core/db/__generated__/client/models/Product.js +1 -2
  65. package/src/core/db/__generated__/client/models/ProductCategory.d.ts +0 -5
  66. package/src/core/db/__generated__/client/models/ProductCategory.js +1 -2
  67. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +0 -5
  68. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +1 -2
  69. package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +0 -5
  70. package/src/core/db/__generated__/client/models/ProductSnapshot.js +1 -2
  71. package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +0 -5
  72. package/src/core/db/__generated__/client/models/ProductTranslation.js +1 -2
  73. package/src/core/db/__generated__/client/models/Reservation.d.ts +0 -5
  74. package/src/core/db/__generated__/client/models/Reservation.js +1 -2
  75. package/src/core/db/__generated__/client/models/Session.d.ts +0 -5
  76. package/src/core/db/__generated__/client/models/Session.js +1 -2
  77. package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +0 -5
  78. package/src/core/db/__generated__/client/models/ShippingMethod.js +1 -2
  79. package/src/core/db/__generated__/client/models/ShippingZone.d.ts +0 -5
  80. package/src/core/db/__generated__/client/models/ShippingZone.js +1 -2
  81. package/src/core/db/__generated__/client/models/User.d.ts +0 -5
  82. package/src/core/db/__generated__/client/models/User.js +1 -2
  83. package/src/core/db/__generated__/client/models/Verification.d.ts +0 -5
  84. package/src/core/db/__generated__/client/models/Verification.js +1 -2
  85. package/src/core/db/__generated__/client/models.js +1 -2
  86. package/src/core/db/index.js +1 -2
  87. package/src/core/email/components.d.ts +16 -0
  88. package/src/core/email/components.js +1 -0
  89. package/src/core/email/components.js.map +1 -0
  90. package/src/core/exceptions/http-exception.js +1 -9
  91. package/src/core/hono/hono.js +1 -123
  92. package/src/core/lib/prisma.d.ts +8 -8
  93. package/src/core/lib/prisma.js +1 -11
  94. package/src/core/logging/pino.js +1 -5
  95. package/src/core/notifications/email.service.js +1 -116
  96. package/src/core/openapi/openapi.lib.js +1 -26
  97. package/src/core/types/google-maps.types.js +1 -2
  98. package/src/core/utils/currency.util.js +1 -11
  99. package/src/core/utils/env.util.js +1 -8
  100. package/src/core/utils/object.util.js +1 -39
  101. package/src/core/utils/translations.util.js +0 -1
  102. package/src/core/utils/zod.util.js +1 -85
  103. package/src/db.js +1 -3
  104. package/src/features/access/access.handler.js +1 -91
  105. package/src/features/access/access.route.js +1 -220
  106. package/src/features/access/access.schema.js +1 -108
  107. package/src/features/access/access.service.js +1 -294
  108. package/src/features/analytics/analytics.handler.d.ts +2 -0
  109. package/src/features/analytics/analytics.handler.js +1 -0
  110. package/src/features/analytics/analytics.handler.js.map +1 -0
  111. package/src/features/analytics/analytics.route.d.ts +3 -0
  112. package/src/features/analytics/analytics.route.js +1 -0
  113. package/src/features/analytics/analytics.route.js.map +1 -0
  114. package/src/features/analytics/analytics.schema.d.ts +86 -0
  115. package/src/features/analytics/analytics.schema.js +1 -0
  116. package/src/features/analytics/analytics.schema.js.map +1 -0
  117. package/src/features/analytics/analytics.service.d.ts +45 -0
  118. package/src/features/analytics/analytics.service.js +1 -0
  119. package/src/features/analytics/analytics.service.js.map +1 -0
  120. package/src/features/cart/cart.handler.js +1 -17
  121. package/src/features/cart/cart.route.js +1 -32
  122. package/src/features/cart/cart.schema.d.ts +1 -1
  123. package/src/features/cart/cart.schema.js +1 -39
  124. package/src/features/cart/cart.service.d.ts +1 -1
  125. package/src/features/cart/cart.service.js +1 -97
  126. package/src/features/cart/cart.util.js +1 -76
  127. package/src/features/file/file.handler.js +1 -23
  128. package/src/features/file/file.route.js +1 -34
  129. package/src/features/file/file.schema.js +1 -77
  130. package/src/features/file/file.service.js +1 -66
  131. package/src/features/health/health.handler.js +1 -10
  132. package/src/features/health/health.route.js +1 -25
  133. package/src/features/index.d.ts +1 -0
  134. package/src/features/index.js +1 -16
  135. package/src/features/index.js.map +1 -1
  136. package/src/features/location/location.handler.js +1 -25
  137. package/src/features/location/location.route.js +1 -56
  138. package/src/features/location/location.schema.js +1 -50
  139. package/src/features/location/location.service.js +1 -141
  140. package/src/features/manufacturer/manufacturer.handler.js +1 -53
  141. package/src/features/manufacturer/manufacturer.route.js +1 -97
  142. package/src/features/manufacturer/manufacturer.schema.js +1 -125
  143. package/src/features/manufacturer/manufacturer.service.js +1 -190
  144. package/src/features/order/emails/order-confirmation.email.js +1 -229
  145. package/src/features/order/emails/order-confirmation.email.js.map +1 -1
  146. package/src/features/order/emails/order-notification.email.js +1 -229
  147. package/src/features/order/emails/order-notification.email.js.map +1 -1
  148. package/src/features/order/fulfilment.schema.js +1 -3
  149. package/src/features/order/order.handler.js +1 -54
  150. package/src/features/order/order.route.js +1 -111
  151. package/src/features/order/order.schema.d.ts +4 -4
  152. package/src/features/order/order.schema.js +1 -158
  153. package/src/features/order/order.service.d.ts +4 -4
  154. package/src/features/order/order.service.js +1 -306
  155. package/src/features/order/recipient.schema.js +1 -38
  156. package/src/features/organization/legal-entity.schema.js +1 -83
  157. package/src/features/organization/organization-configuration.schema.js +1 -115
  158. package/src/features/organization/organization.handler.js +1 -48
  159. package/src/features/organization/organization.route.js +1 -84
  160. package/src/features/organization/organization.schema.js +1 -64
  161. package/src/features/organization/organization.service.js +1 -334
  162. package/src/features/payment/payment.handler.js +1 -16
  163. package/src/features/payment/payment.route.js +1 -22
  164. package/src/features/payment/payment.schema.d.ts +3 -3
  165. package/src/features/payment/payment.schema.js +1 -46
  166. package/src/features/payment/payment.service.d.ts +1 -1
  167. package/src/features/payment/payment.service.js +1 -100
  168. package/src/features/payment/stripe.service.js +1 -164
  169. package/src/features/product/product-modifier.schema.js +1 -84
  170. package/src/features/product/product.handler.js +1 -87
  171. package/src/features/product/product.route.js +1 -179
  172. package/src/features/product/product.schema.d.ts +3 -3
  173. package/src/features/product/product.schema.js +1 -143
  174. package/src/features/product/product.service.d.ts +2 -2
  175. package/src/features/product/product.service.js +1 -440
  176. package/src/features/product-category/product-category.handler.js +1 -59
  177. package/src/features/product-category/product-category.route.js +1 -139
  178. package/src/features/product-category/product-category.schema.js +1 -86
  179. package/src/features/product-category/product-category.service.js +1 -220
  180. package/src/features/reservation/emails/reservation-cancellation.email.js +1 -82
  181. package/src/features/reservation/emails/reservation-cancellation.email.js.map +1 -1
  182. package/src/features/reservation/emails/reservation-confirmation.email.js +1 -82
  183. package/src/features/reservation/emails/reservation-confirmation.email.js.map +1 -1
  184. package/src/features/reservation/emails/reservation-notification.email.js +1 -93
  185. package/src/features/reservation/emails/reservation-notification.email.js.map +1 -1
  186. package/src/features/reservation/reservation.handler.js +1 -65
  187. package/src/features/reservation/reservation.route.js +1 -167
  188. package/src/features/reservation/reservation.schema.d.ts +1 -1
  189. package/src/features/reservation/reservation.schema.js +1 -51
  190. package/src/features/reservation/reservation.service.js +1 -231
  191. package/src/features/shipping/shipping.handler.js +1 -32
  192. package/src/features/shipping/shipping.route.js +1 -51
  193. package/src/features/shipping/shipping.service.js +1 -96
  194. package/src/features/shipping-method/shipping-method.handler.js +1 -60
  195. package/src/features/shipping-method/shipping-method.route.js +1 -144
  196. package/src/features/shipping-method/shipping-method.schema.js +1 -48
  197. package/src/features/shipping-method/shipping-method.service.js +1 -229
  198. package/src/features/shipping-method/shipping-zone.schema.js +1 -31
  199. package/src/features/webhook/webhook.handler.js +1 -50
  200. package/src/features/webhook/webhook.route.js +1 -33
  201. package/src/index.js +1 -6
  202. package/src/integrations/next.js +1 -82
  203. package/src/schemas/address.schema.js +1 -112
  204. package/src/schemas/currency.schema.js +1 -118
  205. package/src/schemas/error.schema.js +1 -12
  206. package/src/schemas/index.d.ts +1 -0
  207. package/src/schemas/index.js +1 -29
  208. package/src/schemas/index.js.map +1 -1
  209. package/src/schemas/locales.schema.js +1 -238
  210. package/src/schemas/number.schema.js +1 -29
  211. package/src/schemas/pagination.schema.js +1 -54
  212. package/src/schemas/params.schema.js +1 -20
  213. package/src/schemas/queries.schema.js +1 -6
  214. package/src/test/global-setup.js +1 -37
  215. package/src/test/integration/api-fixtures.js +1 -160
  216. package/src/test/integration/seed.js +1 -368
  217. package/src/test/integration/test-helpers.d.ts +2 -0
  218. package/src/test/integration/test-helpers.js +1 -154
  219. package/src/test/integration/test-helpers.js.map +1 -1
  220. package/src/test/setup-test-env.js +1 -7
@@ -1,118 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const currencyOptions = [
3
- { value: "USD", label: "United States Dollar" },
4
- { value: "EUR", label: "Euro" },
5
- { value: "GBP", label: "British Pound Sterling" },
6
- { value: "JPY", label: "Japanese Yen" },
7
- { value: "AUD", label: "Australian Dollar" },
8
- { value: "CAD", label: "Canadian Dollar" },
9
- { value: "CHF", label: "Swiss Franc" },
10
- { value: "CNY", label: "Chinese Yuan" },
11
- { value: "SEK", label: "Swedish Krona" },
12
- { value: "NZD", label: "New Zealand Dollar" },
13
- { value: "MXN", label: "Mexican Peso" },
14
- { value: "SGD", label: "Singapore Dollar" },
15
- { value: "HKD", label: "Hong Kong Dollar" },
16
- { value: "NOK", label: "Norwegian Krone" },
17
- { value: "KRW", label: "South Korean Won" },
18
- { value: "TRY", label: "Turkish Lira" },
19
- { value: "RUB", label: "Russian Ruble" },
20
- { value: "INR", label: "Indian Rupee" },
21
- { value: "BRL", label: "Brazilian Real" },
22
- { value: "ZAR", label: "South African Rand" },
23
- { value: "DKK", label: "Danish Krone" },
24
- { value: "PLN", label: "Polish Złoty" },
25
- { value: "THB", label: "Thai Baht" },
26
- { value: "IDR", label: "Indonesian Rupiah" },
27
- { value: "HUF", label: "Hungarian Forint" },
28
- { value: "CZK", label: "Czech Koruna" },
29
- { value: "ILS", label: "Israeli New Shekel" },
30
- { value: "PHP", label: "Philippine Peso" },
31
- { value: "AED", label: "United Arab Emirates Dirham" },
32
- { value: "COP", label: "Colombian Peso" },
33
- { value: "SAR", label: "Saudi Riyal" },
34
- { value: "MYR", label: "Malaysian Ringgit" },
35
- { value: "RON", label: "Romanian Leu" },
36
- ];
37
- /**
38
- * @swagger
39
- * components:
40
- * schemas:
41
- * Currency:
42
- * type: string
43
- * enum:
44
- * - USD
45
- * - EUR
46
- * - GBP
47
- * - JPY
48
- * - AUD
49
- * - CAD
50
- * - CHF
51
- * - CNY
52
- * - SEK
53
- * - NZD
54
- * - MXN
55
- * - SGD
56
- * - HKD
57
- * - NOK
58
- * - KRW
59
- * - TRY
60
- * - RUB
61
- * - INR
62
- * - BRL
63
- * - ZAR
64
- * - DKK
65
- * - PLN
66
- * - THB
67
- * - IDR
68
- * - HUF
69
- * - CZK
70
- * - ILS
71
- * - PHP
72
- * - AED
73
- * - COP
74
- * - SAR
75
- * - MYR
76
- * - RON
77
- * description: The currency code for the transaction.
78
- */
79
- export const currency = z
80
- .enum([
81
- "USD",
82
- "EUR",
83
- "GBP",
84
- "JPY",
85
- "AUD",
86
- "CAD",
87
- "CHF",
88
- "CNY",
89
- "SEK",
90
- "NZD",
91
- "MXN",
92
- "SGD",
93
- "HKD",
94
- "NOK",
95
- "KRW",
96
- "TRY",
97
- "RUB",
98
- "INR",
99
- "BRL",
100
- "ZAR",
101
- "DKK",
102
- "PLN",
103
- "THB",
104
- "IDR",
105
- "HUF",
106
- "CZK",
107
- "ILS",
108
- "PHP",
109
- "AED",
110
- "COP",
111
- "SAR",
112
- "MYR",
113
- "RON",
114
- ])
115
- .openapi({
116
- description: "The currency code for the transaction.",
117
- });
118
- //# sourceMappingURL=currency.schema.js.map
1
+ import{z as l}from"@hono/zod-openapi";export const currencyOptions=[{value:"USD",label:"United States Dollar"},{value:"EUR",label:"Euro"},{value:"GBP",label:"British Pound Sterling"},{value:"JPY",label:"Japanese Yen"},{value:"AUD",label:"Australian Dollar"},{value:"CAD",label:"Canadian Dollar"},{value:"CHF",label:"Swiss Franc"},{value:"CNY",label:"Chinese Yuan"},{value:"SEK",label:"Swedish Krona"},{value:"NZD",label:"New Zealand Dollar"},{value:"MXN",label:"Mexican Peso"},{value:"SGD",label:"Singapore Dollar"},{value:"HKD",label:"Hong Kong Dollar"},{value:"NOK",label:"Norwegian Krone"},{value:"KRW",label:"South Korean Won"},{value:"TRY",label:"Turkish Lira"},{value:"RUB",label:"Russian Ruble"},{value:"INR",label:"Indian Rupee"},{value:"BRL",label:"Brazilian Real"},{value:"ZAR",label:"South African Rand"},{value:"DKK",label:"Danish Krone"},{value:"PLN",label:"Polish Z\u0142oty"},{value:"THB",label:"Thai Baht"},{value:"IDR",label:"Indonesian Rupiah"},{value:"HUF",label:"Hungarian Forint"},{value:"CZK",label:"Czech Koruna"},{value:"ILS",label:"Israeli New Shekel"},{value:"PHP",label:"Philippine Peso"},{value:"AED",label:"United Arab Emirates Dirham"},{value:"COP",label:"Colombian Peso"},{value:"SAR",label:"Saudi Riyal"},{value:"MYR",label:"Malaysian Ringgit"},{value:"RON",label:"Romanian Leu"}],currency=l.enum(["USD","EUR","GBP","JPY","AUD","CAD","CHF","CNY","SEK","NZD","MXN","SGD","HKD","NOK","KRW","TRY","RUB","INR","BRL","ZAR","DKK","PLN","THB","IDR","HUF","CZK","ILS","PHP","AED","COP","SAR","MYR","RON"]).openapi({description:"The currency code for the transaction."});
@@ -1,12 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const ErrorSchema = z.object({
3
- status: z.number().openapi({
4
- example: 404,
5
- description: "The HTTP status code",
6
- }),
7
- message: z.string().openapi({
8
- example: "Not found",
9
- description: "The error message",
10
- }),
11
- });
12
- //# sourceMappingURL=error.schema.js.map
1
+ import{z as e}from"@hono/zod-openapi";export const ErrorSchema=e.object({status:e.number().openapi({example:404,description:"The HTTP status code"}),message:e.string().openapi({example:"Not found",description:"The error message"})});
@@ -1,3 +1,4 @@
1
+ export * from "../features/analytics/analytics.schema";
1
2
  export * from "../features/access/access.schema";
2
3
  export * from "../features/cart/cart.schema";
3
4
  export * from "./error.schema";
@@ -1,29 +1 @@
1
- export * from "../features/access/access.schema";
2
- export * from "../features/cart/cart.schema";
3
- export * from "./error.schema";
4
- export * from "../core/auth/headers.schema";
5
- export * from "../features/product/product.schema";
6
- export * from "../core/auth/user.schema";
7
- export * from "./pagination.schema";
8
- export * from "../features/order/order.schema";
9
- export * from "../features/organization/organization.schema";
10
- export * from "../features/shipping-method/shipping-method.schema";
11
- export * from "../features/product-category/product-category.schema";
12
- export * from "../features/shipping-method/shipping-zone.schema";
13
- export * from "../features/product/product-modifier.schema";
14
- export * from "../features/organization/organization-configuration.schema";
15
- export * from "./number.schema";
16
- export * from "../features/manufacturer/manufacturer.schema";
17
- export * from "./locales.schema";
18
- export * from "../features/organization/legal-entity.schema";
19
- export * from "../features/order/fulfilment.schema";
20
- export * from "../features/file/file.schema";
21
- export * from "../features/order/recipient.schema";
22
- export * from "./currency.schema";
23
- export * from "../core/auth/auth.schema";
24
- export * from "./address.schema";
25
- export * from "./params.schema";
26
- export * from "../features/location/location.schema";
27
- export * from "../features/payment/payment.schema";
28
- export * from "../features/reservation/reservation.schema";
29
- //# sourceMappingURL=index.js.map
1
+ export*from"../features/analytics/analytics.schema";export*from"../features/access/access.schema";export*from"../features/cart/cart.schema";export*from"./error.schema";export*from"../core/auth/headers.schema";export*from"../features/product/product.schema";export*from"../core/auth/user.schema";export*from"./pagination.schema";export*from"../features/order/order.schema";export*from"../features/organization/organization.schema";export*from"../features/shipping-method/shipping-method.schema";export*from"../features/product-category/product-category.schema";export*from"../features/shipping-method/shipping-zone.schema";export*from"../features/product/product-modifier.schema";export*from"../features/organization/organization-configuration.schema";export*from"./number.schema";export*from"../features/manufacturer/manufacturer.schema";export*from"./locales.schema";export*from"../features/organization/legal-entity.schema";export*from"../features/order/fulfilment.schema";export*from"../features/file/file.schema";export*from"../features/order/recipient.schema";export*from"./currency.schema";export*from"../core/auth/auth.schema";export*from"./address.schema";export*from"./params.schema";export*from"../features/location/location.schema";export*from"../features/payment/payment.schema";export*from"../features/reservation/reservation.schema";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/rest-api/src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,kDAAkD,CAAC;AACjE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iBAAiB,CAAC;AAChC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/rest-api/src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,kDAAkD,CAAC;AACjE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iBAAiB,CAAC;AAChC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC"}
@@ -1,238 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const localeMap = new Map([
3
- ["af", "Afrikaans"],
4
- ["sq", "Albanian"],
5
- ["ar_dz", "Arabic (Algeria)"],
6
- ["ar_bh", "Arabic (Bahrain)"],
7
- ["ar_eg", "Arabic (Egypt)"],
8
- ["ar_iq", "Arabic (Iraq)"],
9
- ["ar_jo", "Arabic (Jordan)"],
10
- ["ar_kw", "Arabic (Kuwait)"],
11
- ["ar_lb", "Arabic (Lebanon)"],
12
- ["ar_ly", "Arabic (Libya)"],
13
- ["ar_ma", "Arabic (Morocco)"],
14
- ["ar_om", "Arabic (Oman)"],
15
- ["ar_qa", "Arabic (Qatar)"],
16
- ["ar_sa", "Arabic (Saudi Arabia)"],
17
- ["ar_sy", "Arabic (Syria)"],
18
- ["ar_tn", "Arabic (Tunisia)"],
19
- ["ar_ae", "Arabic (U.A.E.)"],
20
- ["ar_ye", "Arabic (Yemen)"],
21
- ["eu", "Basque"],
22
- ["be", "Belarusian"],
23
- ["bg", "Bulgarian"],
24
- ["ca", "Catalan"],
25
- ["zh_hk", "Chinese (Hong Kong)"],
26
- ["zh_cn", "Chinese (PRC)"],
27
- ["zh_sg", "Chinese (Singapore)"],
28
- ["zh_tw", "Chinese (Taiwan)"],
29
- ["hr", "Croatian"],
30
- ["cs", "Czech"],
31
- ["da", "Danish"],
32
- ["nl_be", "Dutch (Belgium)"],
33
- ["nl", "Dutch (Standard)"],
34
- ["en", "English"],
35
- ["en_au", "English (Australia)"],
36
- ["en_bz", "English (Belize)"],
37
- ["en_ca", "English (Canada)"],
38
- ["en_ie", "English (Ireland)"],
39
- ["en_jm", "English (Jamaica)"],
40
- ["en_nz", "English (New Zealand)"],
41
- ["en_za", "English (South Africa)"],
42
- ["en_tt", "English (Trinidad)"],
43
- ["en_gb", "English (United Kingdom)"],
44
- ["en_us", "English (United States)"],
45
- ["et", "Estonian"],
46
- ["fo", "Faeroese"],
47
- ["fa", "Farsi"],
48
- ["fi", "Finnish"],
49
- ["fr_be", "French (Belgium)"],
50
- ["fr_ca", "French (Canada)"],
51
- ["fr_lu", "French (Luxembourg)"],
52
- ["fr", "French (Standard)"],
53
- ["fr_ch", "French (Switzerland)"],
54
- ["gd", "Gaelic (Scotland)"],
55
- ["de_at", "German (Austria)"],
56
- ["de_li", "German (Liechtenstein)"],
57
- ["de_lu", "German (Luxembourg)"],
58
- ["de", "German (Standard)"],
59
- ["de_ch", "German (Switzerland)"],
60
- ["el", "Greek"],
61
- ["he", "Hebrew"],
62
- ["hi", "Hindi"],
63
- ["hu", "Hungarian"],
64
- ["is", "Icelandic"],
65
- ["id", "Indonesian"],
66
- ["ga", "Irish"],
67
- ["it", "Italian (Standard)"],
68
- ["it_ch", "Italian (Switzerland)"],
69
- ["ja", "Japanese"],
70
- ["ko", "Korean"],
71
- ["ku", "Kurdish"],
72
- ["lv", "Latvian"],
73
- ["lt", "Lithuanian"],
74
- ["mk", "Macedonian (FYROM)"],
75
- ["ml", "Malayalam"],
76
- ["ms", "Malaysian"],
77
- ["mt", "Maltese"],
78
- ["no", "Norwegian"],
79
- ["nb", "Norwegian (Bokmål)"],
80
- ["nn", "Norwegian (Nynorsk)"],
81
- ["pl", "Polish"],
82
- ["pt_br", "Portuguese (Brazil)"],
83
- ["pt", "Portuguese (Portugal)"],
84
- ["pa", "Punjabi"],
85
- ["rm", "Rhaeto-Romanic"],
86
- ["ro", "Romanian"],
87
- ["ro_md", "Romanian (Republic of Moldova)"],
88
- ["ru", "Russian"],
89
- ["ru_md", "Russian (Republic of Moldova)"],
90
- ["sr", "Serbian"],
91
- ["sk", "Slovak"],
92
- ["sl", "Slovenian"],
93
- ["sb", "Sorbian"],
94
- ["es_ar", "Spanish (Argentina)"],
95
- ["es_bo", "Spanish (Bolivia)"],
96
- ["es_cl", "Spanish (Chile)"],
97
- ["es_co", "Spanish (Colombia)"],
98
- ["es_cr", "Spanish (Costa Rica)"],
99
- ["es_do", "Spanish (Dominican Republic)"],
100
- ["es_ec", "Spanish (Ecuador)"],
101
- ["es_sv", "Spanish (El Salvador)"],
102
- ["es_gt", "Spanish (Guatemala)"],
103
- ["es_hn", "Spanish (Honduras)"],
104
- ["es_mx", "Spanish (Mexico)"],
105
- ["es", "Spanish (Spain)"],
106
- ["sv", "Swedish"],
107
- ["sv_fi", "Swedish (Finland)"],
108
- ["th", "Thai"],
109
- ["tr", "Turkish"],
110
- ["uk", "Ukrainian"],
111
- ["ur", "Urdu"],
112
- ["vi", "Vietnamese"],
113
- ["cy", "Welsh"],
114
- ["ji", "Yiddish"],
115
- ["zu", "Zulu"],
116
- ]);
117
- export const localeOptions = Array.from(localeMap.entries()).map(([value, label]) => ({ value, label }));
118
- export const locale = z
119
- .enum([
120
- "af",
121
- "sq",
122
- "ar_dz",
123
- "ar_bh",
124
- "ar_eg",
125
- "ar_iq",
126
- "ar_jo",
127
- "ar_kw",
128
- "ar_lb",
129
- "ar_ly",
130
- "ar_ma",
131
- "ar_om",
132
- "ar_qa",
133
- "ar_sa",
134
- "ar_sy",
135
- "ar_tn",
136
- "ar_ae",
137
- "ar_ye",
138
- "eu",
139
- "be",
140
- "bg",
141
- "ca",
142
- "zh_hk",
143
- "zh_cn",
144
- "zh_sg",
145
- "zh_tw",
146
- "hr",
147
- "cs",
148
- "da",
149
- "nl_be",
150
- "nl",
151
- "en",
152
- "en_au",
153
- "en_bz",
154
- "en_ca",
155
- "en_ie",
156
- "en_jm",
157
- "en_nz",
158
- "en_za",
159
- "en_tt",
160
- "en_gb",
161
- "en_us",
162
- "et",
163
- "fo",
164
- "fa",
165
- "fi",
166
- "fr_be",
167
- "fr_ca",
168
- "fr_lu",
169
- "fr",
170
- "fr_ch",
171
- "gd",
172
- "de_at",
173
- "de_li",
174
- "de_lu",
175
- "de",
176
- "de_ch",
177
- "el",
178
- "he",
179
- "hi",
180
- "hu",
181
- "is",
182
- "id",
183
- "ga",
184
- "it",
185
- "it_ch",
186
- "ja",
187
- "ko",
188
- "ku",
189
- "lv",
190
- "lt",
191
- "mk",
192
- "ml",
193
- "ms",
194
- "mt",
195
- "no",
196
- "nb",
197
- "nn",
198
- "pl",
199
- "pt_br",
200
- "pt",
201
- "pa",
202
- "rm",
203
- "ro",
204
- "ro_md",
205
- "ru",
206
- "ru_md",
207
- "sr",
208
- "sk",
209
- "sl",
210
- "sb",
211
- "es_ar",
212
- "es_bo",
213
- "es_cl",
214
- "es_co",
215
- "es_cr",
216
- "es_do",
217
- "es_ec",
218
- "es_sv",
219
- "es_gt",
220
- "es_hn",
221
- "es_mx",
222
- "es",
223
- "sv",
224
- "sv_fi",
225
- "th",
226
- "tr",
227
- "uk",
228
- "ur",
229
- "vi",
230
- "cy",
231
- "ji",
232
- "zu",
233
- ])
234
- .openapi({
235
- description: "Enum for locale values",
236
- example: "en",
237
- });
238
- //# sourceMappingURL=locales.schema.js.map
1
+ import{z as n}from"@hono/zod-openapi";export const localeMap=new Map([["af","Afrikaans"],["sq","Albanian"],["ar_dz","Arabic (Algeria)"],["ar_bh","Arabic (Bahrain)"],["ar_eg","Arabic (Egypt)"],["ar_iq","Arabic (Iraq)"],["ar_jo","Arabic (Jordan)"],["ar_kw","Arabic (Kuwait)"],["ar_lb","Arabic (Lebanon)"],["ar_ly","Arabic (Libya)"],["ar_ma","Arabic (Morocco)"],["ar_om","Arabic (Oman)"],["ar_qa","Arabic (Qatar)"],["ar_sa","Arabic (Saudi Arabia)"],["ar_sy","Arabic (Syria)"],["ar_tn","Arabic (Tunisia)"],["ar_ae","Arabic (U.A.E.)"],["ar_ye","Arabic (Yemen)"],["eu","Basque"],["be","Belarusian"],["bg","Bulgarian"],["ca","Catalan"],["zh_hk","Chinese (Hong Kong)"],["zh_cn","Chinese (PRC)"],["zh_sg","Chinese (Singapore)"],["zh_tw","Chinese (Taiwan)"],["hr","Croatian"],["cs","Czech"],["da","Danish"],["nl_be","Dutch (Belgium)"],["nl","Dutch (Standard)"],["en","English"],["en_au","English (Australia)"],["en_bz","English (Belize)"],["en_ca","English (Canada)"],["en_ie","English (Ireland)"],["en_jm","English (Jamaica)"],["en_nz","English (New Zealand)"],["en_za","English (South Africa)"],["en_tt","English (Trinidad)"],["en_gb","English (United Kingdom)"],["en_us","English (United States)"],["et","Estonian"],["fo","Faeroese"],["fa","Farsi"],["fi","Finnish"],["fr_be","French (Belgium)"],["fr_ca","French (Canada)"],["fr_lu","French (Luxembourg)"],["fr","French (Standard)"],["fr_ch","French (Switzerland)"],["gd","Gaelic (Scotland)"],["de_at","German (Austria)"],["de_li","German (Liechtenstein)"],["de_lu","German (Luxembourg)"],["de","German (Standard)"],["de_ch","German (Switzerland)"],["el","Greek"],["he","Hebrew"],["hi","Hindi"],["hu","Hungarian"],["is","Icelandic"],["id","Indonesian"],["ga","Irish"],["it","Italian (Standard)"],["it_ch","Italian (Switzerland)"],["ja","Japanese"],["ko","Korean"],["ku","Kurdish"],["lv","Latvian"],["lt","Lithuanian"],["mk","Macedonian (FYROM)"],["ml","Malayalam"],["ms","Malaysian"],["mt","Maltese"],["no","Norwegian"],["nb","Norwegian (Bokm\xE5l)"],["nn","Norwegian (Nynorsk)"],["pl","Polish"],["pt_br","Portuguese (Brazil)"],["pt","Portuguese (Portugal)"],["pa","Punjabi"],["rm","Rhaeto-Romanic"],["ro","Romanian"],["ro_md","Romanian (Republic of Moldova)"],["ru","Russian"],["ru_md","Russian (Republic of Moldova)"],["sr","Serbian"],["sk","Slovak"],["sl","Slovenian"],["sb","Sorbian"],["es_ar","Spanish (Argentina)"],["es_bo","Spanish (Bolivia)"],["es_cl","Spanish (Chile)"],["es_co","Spanish (Colombia)"],["es_cr","Spanish (Costa Rica)"],["es_do","Spanish (Dominican Republic)"],["es_ec","Spanish (Ecuador)"],["es_sv","Spanish (El Salvador)"],["es_gt","Spanish (Guatemala)"],["es_hn","Spanish (Honduras)"],["es_mx","Spanish (Mexico)"],["es","Spanish (Spain)"],["sv","Swedish"],["sv_fi","Swedish (Finland)"],["th","Thai"],["tr","Turkish"],["uk","Ukrainian"],["ur","Urdu"],["vi","Vietnamese"],["cy","Welsh"],["ji","Yiddish"],["zu","Zulu"]]),localeOptions=Array.from(localeMap.entries()).map(([a,e])=>({value:a,label:e})),locale=n.enum(["af","sq","ar_dz","ar_bh","ar_eg","ar_iq","ar_jo","ar_kw","ar_lb","ar_ly","ar_ma","ar_om","ar_qa","ar_sa","ar_sy","ar_tn","ar_ae","ar_ye","eu","be","bg","ca","zh_hk","zh_cn","zh_sg","zh_tw","hr","cs","da","nl_be","nl","en","en_au","en_bz","en_ca","en_ie","en_jm","en_nz","en_za","en_tt","en_gb","en_us","et","fo","fa","fi","fr_be","fr_ca","fr_lu","fr","fr_ch","gd","de_at","de_li","de_lu","de","de_ch","el","he","hi","hu","is","id","ga","it","it_ch","ja","ko","ku","lv","lt","mk","ml","ms","mt","no","nb","nn","pl","pt_br","pt","pa","rm","ro","ro_md","ru","ru_md","sr","sk","sl","sb","es_ar","es_bo","es_cl","es_co","es_cr","es_do","es_ec","es_sv","es_gt","es_hn","es_mx","es","sv","sv_fi","th","tr","uk","ur","vi","cy","ji","zu"]).openapi({description:"Enum for locale values",example:"en"});
@@ -1,29 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const optionalNumber = z
3
- .union([z.string(), z.number(), z.null()]) // Accept string, number, or null as input
4
- .optional() // Still allow undefined
5
- .transform((val) => {
6
- // Handle null/undefined/empty cases
7
- if (val === null || val === undefined || val === "")
8
- return null;
9
- // If already a number, use it directly
10
- if (typeof val === "number")
11
- return val;
12
- // Convert string to number
13
- const num = Number(val);
14
- return isNaN(num) ? val : num;
15
- })
16
- .pipe(z
17
- .number()
18
- .nonnegative({ message: "This field must be a positive number" })
19
- .nullable() // Output can be null
20
- .refine((val) => val === null || val >= 0, {
21
- message: "Price must be positive",
22
- }));
23
- export const requiredNumber = z.coerce
24
- .number()
25
- .min(0.1, "This field must be positive")
26
- .refine((value) => /^\d+(\.\d{1,2})?$/.test(value.toString()), {
27
- message: "This field can have a maximum of two decimal points",
28
- });
29
- //# sourceMappingURL=number.schema.js.map
1
+ import{z as n}from"@hono/zod-openapi";export const optionalNumber=n.union([n.string(),n.number(),n.null()]).optional().transform(e=>{if(e==null||e==="")return null;if(typeof e=="number")return e;const i=Number(e);return isNaN(i)?e:i}).pipe(n.number().nonnegative({message:"This field must be a positive number"}).nullable().refine(e=>e===null||e>=0,{message:"Price must be positive"})),requiredNumber=n.coerce.number().min(.1,"This field must be positive").refine(e=>/^\d+(\.\d{1,2})?$/.test(e.toString()),{message:"This field can have a maximum of two decimal points"});
@@ -1,54 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { locale } from "./locales.schema";
3
- export const PaginationQuerySchema = z.object({
4
- page: z.coerce.number().optional().default(1).openapi({
5
- example: 1,
6
- description: "Page number",
7
- }),
8
- limit: z.coerce.number().optional().default(10).openapi({
9
- example: 50,
10
- description: "Number of items per page",
11
- }),
12
- search: z.string().optional().openapi({
13
- example: "Apple",
14
- description: "Search query",
15
- }),
16
- published: z.coerce.boolean().optional().openapi({
17
- example: true,
18
- description: "Whether to filter by published items",
19
- }),
20
- locale: locale.optional(),
21
- });
22
- export const PaginationMetaSchema = z
23
- .object({
24
- isFirstPage: z.boolean().openapi({
25
- example: true,
26
- description: "Whether the current page is the first page",
27
- }),
28
- isLastPage: z.boolean().openapi({
29
- example: false,
30
- description: "Whether the current page is the last page",
31
- }),
32
- currentPage: z.number().openapi({
33
- example: 1,
34
- description: "The current page number",
35
- }),
36
- previousPage: z.number().nullable().openapi({
37
- example: 0,
38
- description: "The previous page number",
39
- }),
40
- nextPage: z.number().nullable().openapi({
41
- example: 2,
42
- description: "The next page number",
43
- }),
44
- pageCount: z.number().openapi({
45
- example: 5,
46
- description: "The total number of pages",
47
- }),
48
- totalCount: z.number().openapi({
49
- example: 50,
50
- description: "The total number of items",
51
- }),
52
- })
53
- .openapi("PaginationMeta");
54
- //# sourceMappingURL=pagination.schema.js.map
1
+ import{z as e}from"@hono/zod-openapi";import{locale as p}from"./locales.schema";export const PaginationQuerySchema=e.object({page:e.coerce.number().optional().default(1).openapi({example:1,description:"Page number"}),limit:e.coerce.number().optional().default(10).openapi({example:50,description:"Number of items per page"}),search:e.string().optional().openapi({example:"Apple",description:"Search query"}),published:e.coerce.boolean().optional().openapi({example:!0,description:"Whether to filter by published items"}),locale:p.optional()}),PaginationMetaSchema=e.object({isFirstPage:e.boolean().openapi({example:!0,description:"Whether the current page is the first page"}),isLastPage:e.boolean().openapi({example:!1,description:"Whether the current page is the last page"}),currentPage:e.number().openapi({example:1,description:"The current page number"}),previousPage:e.number().nullable().openapi({example:0,description:"The previous page number"}),nextPage:e.number().nullable().openapi({example:2,description:"The next page number"}),pageCount:e.number().openapi({example:5,description:"The total number of pages"}),totalCount:e.number().openapi({example:50,description:"The total number of items"})}).openapi("PaginationMeta");
@@ -1,20 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const OrganizationParams = z
3
- .object({
4
- organizationId: z
5
- .string()
6
- .cuid()
7
- .min(1, "organizationId is required")
8
- .openapi({
9
- example: "ckel0e8qw00004n5p5w6fznym",
10
- description: "The organization ID",
11
- }),
12
- })
13
- .openapi("OrganizationParams");
14
- export const OrganizationWithIdParams = OrganizationParams.extend({
15
- id: z.string().cuid().min(1, "id is required").openapi({
16
- example: "ckel0e8qw00004n5p5w6fznym",
17
- description: "The organization ID",
18
- }),
19
- }).openapi("OrganizationWithIdParams");
20
- //# sourceMappingURL=params.schema.js.map
1
+ import{z as i}from"@hono/zod-openapi";export const OrganizationParams=i.object({organizationId:i.string().cuid().min(1,"organizationId is required").openapi({example:"ckel0e8qw00004n5p5w6fznym",description:"The organization ID"})}).openapi("OrganizationParams"),OrganizationWithIdParams=OrganizationParams.extend({id:i.string().cuid().min(1,"id is required").openapi({example:"ckel0e8qw00004n5p5w6fznym",description:"The organization ID"})}).openapi("OrganizationWithIdParams");
@@ -1,6 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { locale } from "./locales.schema";
3
- export const GetResourceQuerySchema = z.object({
4
- locale: locale.optional().nullable(),
5
- });
6
- //# sourceMappingURL=queries.schema.js.map
1
+ import{z as o}from"@hono/zod-openapi";import{locale as e}from"./locales.schema";export const GetResourceQuerySchema=o.object({locale:e.optional().nullable()});
@@ -1,37 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { execSync } from "node:child_process";
3
- import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- const TEST_DATABASE_URL = "postgresql://shophost:shophost@localhost:5555/shophost_test";
6
- const currentDir = path.dirname(fileURLToPath(import.meta.url));
7
- const packageRoot = path.resolve(currentDir, "../..");
8
- export function setup() {
9
- return __awaiter(this, void 0, void 0, function* () {
10
- process.env.DATABASE_URL = TEST_DATABASE_URL;
11
- // Push schema to Docker PostgreSQL
12
- execSync("pnpm exec prisma db push --accept-data-loss", {
13
- cwd: packageRoot,
14
- env: Object.assign(Object.assign({}, process.env), { DATABASE_URL: TEST_DATABASE_URL }),
15
- stdio: "pipe",
16
- });
17
- const { PrismaPg } = yield import("@prisma/adapter-pg");
18
- const { createPrismaClient } = yield import("../core/lib/prisma");
19
- const prisma = createPrismaClient({
20
- adapter: new PrismaPg({ connectionString: TEST_DATABASE_URL }),
21
- log: ["warn", "error"],
22
- });
23
- // Truncate everything first to start clean
24
- try {
25
- const { TABLES } = yield import("./integration/seed");
26
- const tableNames = TABLES.map((t) => `"${t}"`).join(", ");
27
- yield prisma.$executeRawUnsafe(`TRUNCATE TABLE ${tableNames} CASCADE`);
28
- }
29
- catch (_a) {
30
- // Tables might not exist on first run, that's fine
31
- }
32
- const { seedDatabase } = yield import("./integration/seed");
33
- yield seedDatabase(prisma);
34
- yield prisma.$disconnect();
35
- });
36
- }
37
- //# sourceMappingURL=global-setup.js.map
1
+ import{__awaiter as p}from"tslib";import{execSync as m}from"node:child_process";import s from"node:path";import{fileURLToPath as d}from"node:url";const e="postgresql://shophost:shophost@localhost:5555/shophost_test",l=s.dirname(d(import.meta.url)),A=s.resolve(l,"../..");export function setup(){return p(this,void 0,void 0,function*(){process.env.DATABASE_URL=e,m("pnpm exec prisma db push --accept-data-loss",{cwd:A,env:Object.assign(Object.assign({},process.env),{DATABASE_URL:e}),stdio:"pipe"});const{PrismaPg:i}=yield import("@prisma/adapter-pg"),{createPrismaClient:r}=yield import("../core/lib/prisma"),t=r({adapter:new i({connectionString:e}),log:["warn","error"]});try{const{TABLES:o}=yield import("./integration/seed"),a=o.map(c=>`"${c}"`).join(", ");yield t.$executeRawUnsafe(`TRUNCATE TABLE ${a} CASCADE`)}catch{}const{seedDatabase:n}=yield import("./integration/seed");yield n(t),yield t.$disconnect()})}