@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,231 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { z } from "@hono/zod-openapi";
3
- import { customAlphabet } from "nanoid";
4
- import { HttpException } from "../../core/exceptions/http-exception";
5
- import { EmailService } from "../../core/notifications/email.service";
6
- import { PaginationMetaSchema, ReservationSchema, } from "../../schemas";
7
- const nanoid = customAlphabet("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
8
- class ReservationService {
9
- constructor(prisma, resendApiKey) {
10
- this.prisma = prisma;
11
- this.emailService = new EmailService(resendApiKey);
12
- }
13
- /**
14
- * Create a new reservation
15
- */
16
- createReservation(organizationId, user, body) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const organization = yield this.prisma.organization.findFirst({
19
- where: {
20
- id: organizationId,
21
- },
22
- });
23
- if (!organization) {
24
- throw new HttpException(404, "Organization not found");
25
- }
26
- // Create the reservation
27
- const reservation = yield this.prisma.reservation.create({
28
- data: Object.assign({ referenceId: nanoid(), firstname: body.firstname, lastname: body.lastname, guests: body.guests, phone: body.phone, date: body.date, organization: {
29
- connect: {
30
- id: organizationId,
31
- },
32
- } }, (user
33
- ? {
34
- user: {
35
- connect: {
36
- id: user.id,
37
- },
38
- },
39
- }
40
- : {})),
41
- include: {
42
- organization: {
43
- include: {
44
- address: true,
45
- configuration: true,
46
- logoFile: true,
47
- members: {
48
- include: {
49
- user: true,
50
- },
51
- },
52
- },
53
- },
54
- user: true,
55
- },
56
- });
57
- for (const member of reservation.organization.members) {
58
- yield this.emailService.sendReservationNotificationEmail(member.user, reservation);
59
- }
60
- return ReservationSchema.parse(reservation);
61
- });
62
- }
63
- /**
64
- * Get a specific reservation by ID
65
- */
66
- getReservation(user, organizationId, reservationId) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- const reservation = yield this.prisma.reservation.findUnique({
69
- where: {
70
- id: reservationId,
71
- organizationId: organizationId,
72
- user: {
73
- id: user.id,
74
- },
75
- },
76
- });
77
- if (!reservation) {
78
- throw new HttpException(404, "Reservation not found");
79
- }
80
- return ReservationSchema.parse(reservation);
81
- });
82
- }
83
- /**
84
- * Get all reservations for an organization
85
- */
86
- getReservations(organizationId, query) {
87
- return __awaiter(this, void 0, void 0, function* () {
88
- const { page = 1, limit = 10, search } = query;
89
- // Fetch reservations with pagination
90
- const [list, meta] = yield this.prisma.reservation
91
- .paginate({
92
- orderBy: {
93
- createdAt: "desc",
94
- },
95
- where: Object.assign({ organizationId }, (search && {
96
- OR: [
97
- {
98
- firstname: {
99
- contains: search,
100
- mode: "insensitive",
101
- },
102
- },
103
- {
104
- lastname: {
105
- contains: search,
106
- mode: "insensitive",
107
- },
108
- },
109
- {
110
- referenceId: {
111
- contains: search,
112
- mode: "insensitive",
113
- },
114
- },
115
- ],
116
- })),
117
- include: {
118
- user: true,
119
- },
120
- })
121
- .withPages({
122
- page,
123
- limit,
124
- });
125
- return z
126
- .object({
127
- meta: PaginationMetaSchema,
128
- list: z.array(ReservationSchema),
129
- })
130
- .parse({
131
- meta,
132
- list,
133
- });
134
- });
135
- }
136
- /**
137
- * Get all reservations for a user
138
- */
139
- getUserReservations(userId, organizationId) {
140
- return __awaiter(this, void 0, void 0, function* () {
141
- const reservations = yield this.prisma.reservation.findMany({
142
- where: {
143
- organizationId: organizationId,
144
- userId: userId,
145
- },
146
- });
147
- return z.array(ReservationSchema).parse(reservations);
148
- });
149
- }
150
- /**
151
- * Update reservation status
152
- */
153
- updateStatus(organizationId, reservationId, operation) {
154
- return __awaiter(this, void 0, void 0, function* () {
155
- const reservation = yield this.prisma.reservation.findUnique({
156
- where: {
157
- id: reservationId,
158
- organizationId: organizationId,
159
- },
160
- });
161
- if (!reservation) {
162
- throw new HttpException(404, "Reservation not found");
163
- }
164
- let updateData = {};
165
- switch (operation) {
166
- case "accept":
167
- updateData = {
168
- acceptedAt: new Date(),
169
- };
170
- break;
171
- case "cancel":
172
- updateData = {
173
- cancelledAt: new Date(),
174
- };
175
- break;
176
- }
177
- const updatedReservation = yield this.prisma.reservation.update({
178
- where: {
179
- id: reservationId,
180
- },
181
- data: updateData,
182
- include: {
183
- organization: {
184
- include: {
185
- address: true,
186
- configuration: true,
187
- logoFile: true,
188
- members: {
189
- include: {
190
- user: true,
191
- },
192
- },
193
- },
194
- },
195
- user: true,
196
- },
197
- });
198
- if (operation === "cancel") {
199
- yield this.emailService.sendReservationCancellationEmail(updatedReservation);
200
- }
201
- if (operation === "accept") {
202
- yield this.emailService.sendReservationConfirmationEmail(updatedReservation);
203
- }
204
- return ReservationSchema.parse(updatedReservation);
205
- });
206
- }
207
- /**
208
- * Delete a reservation
209
- */
210
- deleteReservation(organizationId, reservationId) {
211
- return __awaiter(this, void 0, void 0, function* () {
212
- const reservation = yield this.prisma.reservation.findUnique({
213
- where: {
214
- id: reservationId,
215
- organizationId: organizationId,
216
- },
217
- });
218
- if (!reservation) {
219
- throw new HttpException(404, "Reservation not found");
220
- }
221
- yield this.prisma.reservation.delete({
222
- where: {
223
- id: reservationId,
224
- },
225
- });
226
- return;
227
- });
228
- }
229
- }
230
- export { ReservationService };
231
- //# sourceMappingURL=reservation.service.js.map
1
+ import{__awaiter as s}from"tslib";import{z as c}from"@hono/zod-openapi";import{customAlphabet as m}from"nanoid";import{HttpException as d}from"../../core/exceptions/http-exception";import{EmailService as l}from"../../core/notifications/email.service";import{PaginationMetaSchema as v,ReservationSchema as o}from"../../schemas";const h=m("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ",6);class f{constructor(t,e){this.prisma=t,this.emailService=new l(e)}createReservation(t,e,i){return s(this,void 0,void 0,function*(){if(!(yield this.prisma.organization.findFirst({where:{id:t}})))throw new d(404,"Organization not found");const r=yield this.prisma.reservation.create({data:Object.assign({referenceId:h(),firstname:i.firstname,lastname:i.lastname,guests:i.guests,phone:i.phone,date:i.date,organization:{connect:{id:t}}},e?{user:{connect:{id:e.id}}}:{}),include:{organization:{include:{address:!0,configuration:!0,logoFile:!0,members:{include:{user:!0}}}},user:!0}});for(const n of r.organization.members)yield this.emailService.sendReservationNotificationEmail(n.user,r);return o.parse(r)})}getReservation(t,e,i){return s(this,void 0,void 0,function*(){const a=yield this.prisma.reservation.findUnique({where:{id:i,organizationId:e,user:{id:t.id}}});if(!a)throw new d(404,"Reservation not found");return o.parse(a)})}getReservations(t,e){return s(this,void 0,void 0,function*(){const{page:i=1,limit:a=10,search:r}=e,[n,u]=yield this.prisma.reservation.paginate({orderBy:{createdAt:"desc"},where:Object.assign({organizationId:t},r&&{OR:[{firstname:{contains:r,mode:"insensitive"}},{lastname:{contains:r,mode:"insensitive"}},{referenceId:{contains:r,mode:"insensitive"}}]}),include:{user:!0}}).withPages({page:i,limit:a});return c.object({meta:v,list:c.array(o)}).parse({meta:u,list:n})})}getUserReservations(t,e){return s(this,void 0,void 0,function*(){const i=yield this.prisma.reservation.findMany({where:{organizationId:e,userId:t}});return c.array(o).parse(i)})}updateStatus(t,e,i){return s(this,void 0,void 0,function*(){if(!(yield this.prisma.reservation.findUnique({where:{id:e,organizationId:t}})))throw new d(404,"Reservation not found");let r={};switch(i){case"accept":r={acceptedAt:new Date};break;case"cancel":r={cancelledAt:new Date};break}const n=yield this.prisma.reservation.update({where:{id:e},data:r,include:{organization:{include:{address:!0,configuration:!0,logoFile:!0,members:{include:{user:!0}}}},user:!0}});return i==="cancel"&&(yield this.emailService.sendReservationCancellationEmail(n)),i==="accept"&&(yield this.emailService.sendReservationConfirmationEmail(n)),o.parse(n)})}deleteReservation(t,e){return s(this,void 0,void 0,function*(){if(!(yield this.prisma.reservation.findUnique({where:{id:e,organizationId:t}})))throw new d(404,"Reservation not found");yield this.prisma.reservation.delete({where:{id:e}})})}}export{f as ReservationService};
@@ -1,32 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { createApiRouter } from "../../core/hono/hono";
3
- import { shippingRoute } from "./shipping.route";
4
- import { ShippingService } from "./shipping.service";
5
- export const buildShippingHandler = (prisma, googleMapsApiKey) => {
6
- const app = createApiRouter();
7
- app.openapi(shippingRoute.createShippingAddress, (c) => __awaiter(void 0, void 0, void 0, function* () {
8
- const auth = c.get("auth");
9
- const body = c.req.valid("json");
10
- const user = yield auth.getCurrentUser();
11
- const service = new ShippingService(prisma, googleMapsApiKey);
12
- const shippingAddress = yield service.createShippingAddress(user.id, body, true);
13
- return c.json(shippingAddress, 201);
14
- }));
15
- app.openapi(shippingRoute.getShippingAddress, (c) => __awaiter(void 0, void 0, void 0, function* () {
16
- const auth = c.get("auth");
17
- const user = yield auth.getCurrentUser();
18
- const service = new ShippingService(prisma, googleMapsApiKey);
19
- const shippingAddress = yield service.findShippingAddress(user.id, true);
20
- return c.json(shippingAddress, 200);
21
- }));
22
- app.openapi(shippingRoute.updateShippingAddress, (c) => __awaiter(void 0, void 0, void 0, function* () {
23
- const auth = c.get("auth");
24
- const body = c.req.valid("json");
25
- const user = yield auth.getCurrentUser();
26
- const service = new ShippingService(prisma, googleMapsApiKey);
27
- const shippingAddress = yield service.updateShippingAddress(user.id, body);
28
- return c.json(shippingAddress, 200);
29
- }));
30
- return app;
31
- };
32
- //# sourceMappingURL=shipping.handler.js.map
1
+ import{__awaiter as u}from"tslib";import{createApiRouter as v}from"../../core/hono/hono";import{shippingRoute as c}from"./shipping.route";import{ShippingService as h}from"./shipping.service";export const buildShippingHandler=(s,d)=>{const t=v();return t.openapi(c.createShippingAddress,e=>u(void 0,void 0,void 0,function*(){const n=e.get("auth"),i=e.req.valid("json"),r=yield n.getCurrentUser(),p=yield new h(s,d).createShippingAddress(r.id,i,!0);return e.json(p,201)})),t.openapi(c.getShippingAddress,e=>u(void 0,void 0,void 0,function*(){const i=yield e.get("auth").getCurrentUser(),o=yield new h(s,d).findShippingAddress(i.id,!0);return e.json(o,200)})),t.openapi(c.updateShippingAddress,e=>u(void 0,void 0,void 0,function*(){const n=e.get("auth"),i=e.req.valid("json"),r=yield n.getCurrentUser(),p=yield new h(s,d).updateShippingAddress(r.id,i);return e.json(p,200)})),t};
@@ -1,51 +1 @@
1
- import { createApiRoute } from "../../core/hono/hono";
2
- import { CreateShippingAddressSchema, ErrorSchema, HeaderSchema, ShippingAddressSchema, UpdateShippingAddressSchema, } from "../../schemas";
3
- const getShippingAddressRoute = createApiRoute({
4
- description: "Get the default shipping address for the user",
5
- headers: HeaderSchema,
6
- method: "GET",
7
- operationId: "getShippingAddress",
8
- path: "/shipping",
9
- responses: {
10
- 200: ShippingAddressSchema.nullable(),
11
- 401: ErrorSchema,
12
- },
13
- summary: "Get Shipping Address",
14
- tags: ["Shipping"],
15
- });
16
- const createShippingAddressRoute = createApiRoute({
17
- body: CreateShippingAddressSchema,
18
- description: "Creates a new shipping address for the user",
19
- headers: HeaderSchema,
20
- method: "POST",
21
- operationId: "createShippingAddress",
22
- path: "/shipping",
23
- responses: {
24
- 201: ShippingAddressSchema,
25
- 400: ErrorSchema,
26
- 401: ErrorSchema,
27
- },
28
- summary: "Create Shipping Address",
29
- tags: ["Shipping"],
30
- });
31
- const updateShippingAddressRoute = createApiRoute({
32
- body: UpdateShippingAddressSchema,
33
- description: "Updates the shipping address for the user",
34
- headers: HeaderSchema,
35
- method: "PUT",
36
- operationId: "updateShippingAddress",
37
- path: "/shipping",
38
- responses: {
39
- 200: ShippingAddressSchema,
40
- 400: ErrorSchema,
41
- 401: ErrorSchema,
42
- },
43
- summary: "Update Shipping Address",
44
- tags: ["Shipping"],
45
- });
46
- export const shippingRoute = {
47
- getShippingAddress: getShippingAddressRoute,
48
- createShippingAddress: createShippingAddressRoute,
49
- updateShippingAddress: updateShippingAddressRoute,
50
- };
51
- //# sourceMappingURL=shipping.route.js.map
1
+ import{createApiRoute as s}from"../../core/hono/hono";import{CreateShippingAddressSchema as d,ErrorSchema as e,HeaderSchema as p,ShippingAddressSchema as i,UpdateShippingAddressSchema as r}from"../../schemas";const t=s({description:"Get the default shipping address for the user",headers:p,method:"GET",operationId:"getShippingAddress",path:"/shipping",responses:{200:i.nullable(),401:e},summary:"Get Shipping Address",tags:["Shipping"]}),h=s({body:d,description:"Creates a new shipping address for the user",headers:p,method:"POST",operationId:"createShippingAddress",path:"/shipping",responses:{201:i,400:e,401:e},summary:"Create Shipping Address",tags:["Shipping"]}),a=s({body:r,description:"Updates the shipping address for the user",headers:p,method:"PUT",operationId:"updateShippingAddress",path:"/shipping",responses:{200:i,400:e,401:e},summary:"Update Shipping Address",tags:["Shipping"]});export const shippingRoute={getShippingAddress:t,createShippingAddress:h,updateShippingAddress:a};
@@ -1,96 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { HttpException } from "../../core/exceptions/http-exception";
3
- import { ShippingAddressSchema, } from "../../schemas";
4
- import { LocationService } from "../location/location.service";
5
- class ShippingService {
6
- constructor(prisma, googleMapsApiKey) {
7
- this.prisma = prisma;
8
- this.locationService = new LocationService(googleMapsApiKey);
9
- }
10
- /**
11
- * Find a shipping method by ID and organization ID
12
- * @throws HttpException with 404 status if shipping method is not found
13
- */
14
- findShippingAddress(userId, isDefault) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const shippingAddress = yield this.prisma.address.findFirst({
17
- where: {
18
- users: {
19
- some: {
20
- id: userId,
21
- },
22
- },
23
- isDefault,
24
- },
25
- });
26
- if (!shippingAddress) {
27
- return null;
28
- }
29
- return ShippingAddressSchema.parse(shippingAddress);
30
- });
31
- }
32
- /**
33
- * Create a new shipping address for the user
34
- */
35
- createShippingAddress(userId, body, isDefault) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const placeDetails = yield this.locationService.getPlaceDetails(body.placeId);
38
- const shippingMethod = yield this.prisma.address.create({
39
- data: {
40
- firstname: body.firstname,
41
- lastname: body.lastname,
42
- phone: body.phone,
43
- addressLineOne: body.addressLineOne,
44
- addressLineTwo: body.addressLineTwo,
45
- doorNumber: body.doorNumber,
46
- placeId: body.placeId,
47
- deliveryInstructions: body.deliveryInstructions,
48
- city: body.city,
49
- country: body.country,
50
- zipCode: body.zipCode,
51
- createdBy: userId,
52
- latitude: placeDetails.latitude,
53
- longitude: placeDetails.longitude,
54
- isDefault,
55
- users: {
56
- connect: {
57
- id: userId,
58
- },
59
- },
60
- },
61
- });
62
- return ShippingAddressSchema.parse(shippingMethod);
63
- });
64
- }
65
- updateShippingAddress(userId, body) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const defaultShippingAddress = yield this.findShippingAddress(userId, true);
68
- if (!defaultShippingAddress) {
69
- throw new HttpException(400, "No default shipping address found");
70
- }
71
- const placeDetails = yield this.locationService.getPlaceDetails(body.placeId);
72
- const shippingAddress = yield this.prisma.address.update({
73
- where: { id: defaultShippingAddress.id },
74
- data: {
75
- firstname: body.firstname,
76
- lastname: body.lastname,
77
- phone: body.phone,
78
- addressLineOne: body.addressLineOne,
79
- addressLineTwo: body.addressLineTwo,
80
- doorNumber: body.doorNumber,
81
- placeId: body.placeId,
82
- deliveryInstructions: body.deliveryInstructions,
83
- city: body.city,
84
- country: body.country,
85
- zipCode: body.zipCode,
86
- latitude: placeDetails.latitude,
87
- longitude: placeDetails.longitude,
88
- createdBy: userId,
89
- },
90
- });
91
- return ShippingAddressSchema.parse(shippingAddress);
92
- });
93
- }
94
- }
95
- export { ShippingService };
96
- //# sourceMappingURL=shipping.service.js.map
1
+ import{__awaiter as n}from"tslib";import{HttpException as a}from"../../core/exceptions/http-exception";import{ShippingAddressSchema as d}from"../../schemas";import{LocationService as p}from"../location/location.service";class c{constructor(i,e){this.prisma=i,this.locationService=new p(e)}findShippingAddress(i,e){return n(this,void 0,void 0,function*(){const t=yield this.prisma.address.findFirst({where:{users:{some:{id:i}},isDefault:e}});return t?d.parse(t):null})}createShippingAddress(i,e,t){return n(this,void 0,void 0,function*(){const s=yield this.locationService.getPlaceDetails(e.placeId),r=yield this.prisma.address.create({data:{firstname:e.firstname,lastname:e.lastname,phone:e.phone,addressLineOne:e.addressLineOne,addressLineTwo:e.addressLineTwo,doorNumber:e.doorNumber,placeId:e.placeId,deliveryInstructions:e.deliveryInstructions,city:e.city,country:e.country,zipCode:e.zipCode,createdBy:i,latitude:s.latitude,longitude:s.longitude,isDefault:t,users:{connect:{id:i}}}});return d.parse(r)})}updateShippingAddress(i,e){return n(this,void 0,void 0,function*(){const t=yield this.findShippingAddress(i,!0);if(!t)throw new a(400,"No default shipping address found");const s=yield this.locationService.getPlaceDetails(e.placeId),r=yield this.prisma.address.update({where:{id:t.id},data:{firstname:e.firstname,lastname:e.lastname,phone:e.phone,addressLineOne:e.addressLineOne,addressLineTwo:e.addressLineTwo,doorNumber:e.doorNumber,placeId:e.placeId,deliveryInstructions:e.deliveryInstructions,city:e.city,country:e.country,zipCode:e.zipCode,latitude:s.latitude,longitude:s.longitude,createdBy:i}});return d.parse(r)})}}export{c as ShippingService};
@@ -1,60 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { createApiRouter } from "../../core/hono/hono";
3
- import { shippingMethodRoute } from "./shipping-method.route";
4
- import { ShippingMethodService } from "./shipping-method.service";
5
- export const buildShippingMethodHandler = (prisma) => {
6
- const app = createApiRouter();
7
- app.openapi(shippingMethodRoute.createShippingMethod, (c) => __awaiter(void 0, void 0, void 0, function* () {
8
- const auth = c.get("auth");
9
- const params = c.req.valid("param");
10
- const body = c.req.valid("json");
11
- const user = yield auth.isGranted("create");
12
- const service = new ShippingMethodService(prisma);
13
- const shippingMethod = yield service.createShippingMethod(params.organizationId, user.id, body);
14
- return c.json(shippingMethod, 201);
15
- }));
16
- app.openapi(shippingMethodRoute.getShippingMethod, (c) => __awaiter(void 0, void 0, void 0, function* () {
17
- const auth = c.get("auth");
18
- const params = c.req.valid("param");
19
- yield auth.isGranted("read");
20
- const service = new ShippingMethodService(prisma);
21
- const shippingMethod = yield service.getShippingMethod(params.organizationId, params.id);
22
- return c.json(shippingMethod, 200);
23
- }));
24
- app.openapi(shippingMethodRoute.accessEligibility, (c) => __awaiter(void 0, void 0, void 0, function* () {
25
- const auth = c.get("auth");
26
- const params = c.req.valid("param");
27
- const user = yield auth.getCurrentUser();
28
- const service = new ShippingMethodService(prisma);
29
- const shippingMethods = yield service.accessEligibility(user, params.organizationId);
30
- return c.json(shippingMethods, 200);
31
- }));
32
- app.openapi(shippingMethodRoute.getShippingMethods, (c) => __awaiter(void 0, void 0, void 0, function* () {
33
- const auth = c.get("auth");
34
- const params = c.req.valid("param");
35
- const query = c.req.valid("query");
36
- yield auth.isGranted("read");
37
- const service = new ShippingMethodService(prisma);
38
- const result = yield service.getShippingMethods(params.organizationId, Object.assign({}, query));
39
- return c.json(result, 200);
40
- }));
41
- app.openapi(shippingMethodRoute.updateShippingMethod, (c) => __awaiter(void 0, void 0, void 0, function* () {
42
- const auth = c.get("auth");
43
- const params = c.req.valid("param");
44
- const body = c.req.valid("json");
45
- const user = yield auth.isGranted("update");
46
- const service = new ShippingMethodService(prisma);
47
- const updatedShippingMethod = yield service.updateShippingMethod(params.organizationId, params.id, user.id, body);
48
- return c.json(updatedShippingMethod, 200);
49
- }));
50
- app.openapi(shippingMethodRoute.deleteShippingMethod, (c) => __awaiter(void 0, void 0, void 0, function* () {
51
- const auth = c.get("auth");
52
- const params = c.req.valid("param");
53
- const user = yield auth.isGranted("delete");
54
- const service = new ShippingMethodService(prisma);
55
- yield service.deleteShippingMethod(params.organizationId, params.id, user.id);
56
- return c.body(null, 204);
57
- }));
58
- return app;
59
- };
60
- //# sourceMappingURL=shipping-method.handler.js.map
1
+ import{__awaiter as a}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{shippingMethodRoute as s}from"./shipping-method.route";import{ShippingMethodService as p}from"./shipping-method.service";export const buildShippingMethodHandler=r=>{const d=u();return d.openapi(s.createShippingMethod,e=>a(void 0,void 0,void 0,function*(){const t=e.get("auth"),i=e.req.valid("param"),o=e.req.valid("json"),n=yield t.isGranted("create"),c=yield new p(r).createShippingMethod(i.organizationId,n.id,o);return e.json(c,201)})),d.openapi(s.getShippingMethod,e=>a(void 0,void 0,void 0,function*(){const t=e.get("auth"),i=e.req.valid("param");yield t.isGranted("read");const n=yield new p(r).getShippingMethod(i.organizationId,i.id);return e.json(n,200)})),d.openapi(s.accessEligibility,e=>a(void 0,void 0,void 0,function*(){const t=e.get("auth"),i=e.req.valid("param"),o=yield t.getCurrentUser(),h=yield new p(r).accessEligibility(o,i.organizationId);return e.json(h,200)})),d.openapi(s.getShippingMethods,e=>a(void 0,void 0,void 0,function*(){const t=e.get("auth"),i=e.req.valid("param"),o=e.req.valid("query");yield t.isGranted("read");const h=yield new p(r).getShippingMethods(i.organizationId,Object.assign({},o));return e.json(h,200)})),d.openapi(s.updateShippingMethod,e=>a(void 0,void 0,void 0,function*(){const t=e.get("auth"),i=e.req.valid("param"),o=e.req.valid("json"),n=yield t.isGranted("update"),c=yield new p(r).updateShippingMethod(i.organizationId,i.id,n.id,o);return e.json(c,200)})),d.openapi(s.deleteShippingMethod,e=>a(void 0,void 0,void 0,function*(){const t=e.get("auth"),i=e.req.valid("param"),o=yield t.isGranted("delete");return yield new p(r).deleteShippingMethod(i.organizationId,i.id,o.id),e.body(null,204)})),d};
@@ -1,144 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { createApiRoute } from "../../core/hono/hono";
3
- import { CreateShippingMethodSchema, ErrorSchema, HeaderSchema, OrganizationParams, OrganizationWithIdParams, PaginationMetaSchema, PaginationQuerySchema, ShippingMethodSchema, UpdateShippingMethodSchema, } from "../../schemas";
4
- const shippingMethodPathParams = z.object({
5
- id: z.string().openapi({
6
- description: "ID of the shipping method",
7
- example: "clf9876543210abcdef",
8
- param: {
9
- in: "path",
10
- name: "id",
11
- },
12
- }),
13
- organizationId: z.string().openapi({
14
- description: "ID of the organization",
15
- example: "cju0z9k4z0000l1qg5z1z1z1z",
16
- param: {
17
- in: "path",
18
- name: "organizationId",
19
- },
20
- }),
21
- });
22
- const getShippingMethodRoute = createApiRoute({
23
- headers: HeaderSchema,
24
- method: "GET",
25
- operationId: "getShippingMethod",
26
- path: "/:organizationId/shipping-methods/:id",
27
- pathParams: OrganizationWithIdParams,
28
- responses: {
29
- 200: ShippingMethodSchema,
30
- 401: ErrorSchema,
31
- 404: ErrorSchema,
32
- },
33
- summary: "Get Shipping Method",
34
- tags: ["ShippingMethod"],
35
- });
36
- const accessEligibilityRoute = createApiRoute({
37
- description: "Fetches a list of published shipping methods a user can use",
38
- headers: HeaderSchema,
39
- method: "GET",
40
- operationId: "accessEligibility",
41
- path: "/:organizationId/shipping-methods/access/eligibility",
42
- pathParams: OrganizationParams,
43
- responses: {
44
- 200: z.array(ShippingMethodSchema),
45
- },
46
- summary: "Get Eligible Shipping Methods",
47
- tags: ["ShippingMethod"],
48
- });
49
- const getShippingMethodsRoute = createApiRoute({
50
- description: "Fetches a paginated list of shipping methods for an organization",
51
- headers: HeaderSchema,
52
- method: "GET",
53
- operationId: "getShippingMethods",
54
- path: "/:organizationId/shipping-methods",
55
- pathParams: z.object({
56
- organizationId: z.string().openapi({
57
- description: "ID of the organization",
58
- example: "cju0z9k4z0000l1qg5z1z1z1z",
59
- param: {
60
- in: "path",
61
- name: "organizationId",
62
- },
63
- }),
64
- }),
65
- query: PaginationQuerySchema,
66
- responses: {
67
- 200: z.object({
68
- list: z.array(ShippingMethodSchema),
69
- meta: PaginationMetaSchema,
70
- }),
71
- 400: ErrorSchema,
72
- 401: ErrorSchema,
73
- },
74
- summary: "Get Shipping Methods",
75
- tags: ["ShippingMethod"],
76
- });
77
- const createShippingMethodRoute = createApiRoute({
78
- body: CreateShippingMethodSchema,
79
- description: "Creates a new shipping method for an organization",
80
- headers: HeaderSchema,
81
- method: "POST",
82
- operationId: "createShippingMethod",
83
- path: "/:organizationId/shipping-methods",
84
- pathParams: z.object({
85
- organizationId: z.string().openapi({
86
- description: "ID of the organization",
87
- example: "cju0z9k4z0000l1qg5z1z1z1z",
88
- param: {
89
- in: "path",
90
- name: "organizationId",
91
- },
92
- }),
93
- }),
94
- responses: {
95
- 201: ShippingMethodSchema,
96
- 400: ErrorSchema,
97
- 401: ErrorSchema,
98
- 404: ErrorSchema,
99
- },
100
- summary: "Create Shipping Method",
101
- tags: ["ShippingMethod"],
102
- });
103
- const updateShippingMethodRoute = createApiRoute({
104
- body: UpdateShippingMethodSchema,
105
- description: "Updates an existing shipping method",
106
- headers: HeaderSchema,
107
- method: "PUT",
108
- operationId: "updateShippingMethod",
109
- path: "/:organizationId/shipping-methods/:id",
110
- pathParams: shippingMethodPathParams,
111
- responses: {
112
- 200: ShippingMethodSchema,
113
- 400: ErrorSchema,
114
- 401: ErrorSchema,
115
- 404: ErrorSchema,
116
- },
117
- summary: "Update Shipping Method",
118
- tags: ["ShippingMethod"],
119
- });
120
- const deleteShippingMethodRoute = createApiRoute({
121
- description: "Soft deletes a shipping method",
122
- headers: HeaderSchema,
123
- method: "DELETE",
124
- operationId: "deleteShippingMethod",
125
- path: "/:organizationId/shipping-methods/:id",
126
- pathParams: shippingMethodPathParams,
127
- responses: {
128
- 204: null,
129
- 400: ErrorSchema,
130
- 401: ErrorSchema,
131
- 404: ErrorSchema,
132
- },
133
- summary: "Delete Shipping Method",
134
- tags: ["ShippingMethod"],
135
- });
136
- export const shippingMethodRoute = {
137
- getShippingMethod: getShippingMethodRoute,
138
- accessEligibility: accessEligibilityRoute,
139
- getShippingMethods: getShippingMethodsRoute,
140
- createShippingMethod: createShippingMethodRoute,
141
- updateShippingMethod: updateShippingMethodRoute,
142
- deleteShippingMethod: deleteShippingMethodRoute,
143
- };
144
- //# sourceMappingURL=shipping-method.route.js.map
1
+ import{z as e}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{CreateShippingMethodSchema as n,ErrorSchema as i,HeaderSchema as a,OrganizationParams as h,OrganizationWithIdParams as s,PaginationMetaSchema as d,PaginationQuerySchema as r,ShippingMethodSchema as o,UpdateShippingMethodSchema as g}from"../../schemas";const p=e.object({id:e.string().openapi({description:"ID of the shipping method",example:"clf9876543210abcdef",param:{in:"path",name:"id"}}),organizationId:e.string().openapi({description:"ID of the organization",example:"cju0z9k4z0000l1qg5z1z1z1z",param:{in:"path",name:"organizationId"}})}),m=t({headers:a,method:"GET",operationId:"getShippingMethod",path:"/:organizationId/shipping-methods/:id",pathParams:s,responses:{200:o,401:i,404:i},summary:"Get Shipping Method",tags:["ShippingMethod"]}),c=t({description:"Fetches a list of published shipping methods a user can use",headers:a,method:"GET",operationId:"accessEligibility",path:"/:organizationId/shipping-methods/access/eligibility",pathParams:h,responses:{200:e.array(o)},summary:"Get Eligible Shipping Methods",tags:["ShippingMethod"]}),S=t({description:"Fetches a paginated list of shipping methods for an organization",headers:a,method:"GET",operationId:"getShippingMethods",path:"/:organizationId/shipping-methods",pathParams:e.object({organizationId:e.string().openapi({description:"ID of the organization",example:"cju0z9k4z0000l1qg5z1z1z1z",param:{in:"path",name:"organizationId"}})}),query:r,responses:{200:e.object({list:e.array(o),meta:d}),400:i,401:i},summary:"Get Shipping Methods",tags:["ShippingMethod"]}),z=t({body:n,description:"Creates a new shipping method for an organization",headers:a,method:"POST",operationId:"createShippingMethod",path:"/:organizationId/shipping-methods",pathParams:e.object({organizationId:e.string().openapi({description:"ID of the organization",example:"cju0z9k4z0000l1qg5z1z1z1z",param:{in:"path",name:"organizationId"}})}),responses:{201:o,400:i,401:i,404:i},summary:"Create Shipping Method",tags:["ShippingMethod"]}),M=t({body:g,description:"Updates an existing shipping method",headers:a,method:"PUT",operationId:"updateShippingMethod",path:"/:organizationId/shipping-methods/:id",pathParams:p,responses:{200:o,400:i,401:i,404:i},summary:"Update Shipping Method",tags:["ShippingMethod"]}),l=t({description:"Soft deletes a shipping method",headers:a,method:"DELETE",operationId:"deleteShippingMethod",path:"/:organizationId/shipping-methods/:id",pathParams:p,responses:{204:null,400:i,401:i,404:i},summary:"Delete Shipping Method",tags:["ShippingMethod"]});export const shippingMethodRoute={getShippingMethod:m,accessEligibility:c,getShippingMethods:S,createShippingMethod:z,updateShippingMethod:M,deleteShippingMethod:l};