@medusajs/medusa 1.1.52 → 1.1.56
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.
- package/CHANGELOG.md +162 -0
- package/cli.js +0 -0
- package/dist/api/index.d.ts +18 -0
- package/dist/api/index.js +42 -25
- package/dist/api/index.js.map +1 -0
- package/dist/api/middlewares/authenticate-customer.d.ts +2 -0
- package/dist/api/middlewares/authenticate-customer.js +17 -26
- package/dist/api/middlewares/authenticate-customer.js.map +1 -0
- package/dist/api/middlewares/authenticate.d.ts +2 -0
- package/dist/api/middlewares/authenticate.js +10 -18
- package/dist/api/middlewares/authenticate.js.map +1 -0
- package/dist/api/middlewares/await-middleware.d.ts +2 -0
- package/dist/api/middlewares/await-middleware.js +35 -12
- package/dist/api/middlewares/await-middleware.js.map +1 -0
- package/dist/api/middlewares/error-handler.d.ts +2 -0
- package/dist/api/middlewares/error-handler.js +43 -57
- package/dist/api/middlewares/error-handler.js.map +1 -0
- package/dist/api/middlewares/index.d.ts +11 -0
- package/dist/api/middlewares/index.js +14 -22
- package/dist/api/middlewares/index.js.map +1 -0
- package/dist/api/middlewares/normalized-query.d.ts +2 -0
- package/dist/api/middlewares/normalized-query.js +33 -30
- package/dist/api/middlewares/normalized-query.js.map +1 -0
- package/dist/api/routes/admin/apps/authorize-app.d.ts +43 -0
- package/dist/api/routes/admin/apps/authorize-app.js +121 -67
- package/dist/api/routes/admin/apps/authorize-app.js.map +1 -0
- package/dist/api/routes/admin/apps/index.d.ts +9 -0
- package/dist/api/routes/admin/apps/index.js +13 -21
- package/dist/api/routes/admin/apps/index.js.map +1 -0
- package/dist/api/routes/admin/apps/list.d.ts +20 -0
- package/dist/api/routes/admin/apps/list.js +68 -51
- package/dist/api/routes/admin/apps/list.js.map +1 -0
- package/dist/api/routes/admin/auth/create-session.d.ts +27 -0
- package/dist/api/routes/admin/auth/create-session.js +103 -83
- package/dist/api/routes/admin/auth/create-session.js.map +1 -0
- package/dist/api/routes/admin/auth/delete-session.d.ts +14 -0
- package/dist/api/routes/admin/auth/delete-session.js +46 -37
- package/dist/api/routes/admin/auth/delete-session.js.map +1 -0
- package/dist/api/routes/admin/auth/get-session.d.ts +20 -0
- package/dist/api/routes/admin/auth/get-session.js +63 -45
- package/dist/api/routes/admin/auth/get-session.js.map +1 -0
- package/dist/api/routes/admin/auth/index.d.ts +9 -0
- package/dist/api/routes/admin/auth/index.js +27 -22
- package/dist/api/routes/admin/auth/index.js.map +1 -0
- package/dist/api/routes/admin/collections/create-collection.d.ts +41 -0
- package/dist/api/routes/admin/collections/create-collection.js +90 -73
- package/dist/api/routes/admin/collections/create-collection.js.map +1 -0
- package/dist/api/routes/admin/collections/delete-collection.d.ts +28 -0
- package/dist/api/routes/admin/collections/delete-collection.js +56 -51
- package/dist/api/routes/admin/collections/delete-collection.js.map +1 -0
- package/dist/api/routes/admin/collections/get-collection.d.ts +22 -0
- package/dist/api/routes/admin/collections/get-collection.js +52 -50
- package/dist/api/routes/admin/collections/get-collection.js.map +1 -0
- package/dist/api/routes/admin/collections/index.d.ts +19 -0
- package/dist/api/routes/admin/collections/index.js +35 -28
- package/dist/api/routes/admin/collections/index.js.map +1 -0
- package/dist/api/routes/admin/collections/list-collections.d.ts +27 -0
- package/dist/api/routes/admin/collections/list-collections.js +118 -61
- package/dist/api/routes/admin/collections/list-collections.js.map +1 -0
- package/dist/api/routes/admin/collections/update-collection.d.ts +41 -0
- package/dist/api/routes/admin/collections/update-collection.js +92 -74
- package/dist/api/routes/admin/collections/update-collection.js.map +1 -0
- package/dist/api/routes/admin/customers/create-customer.d.ts +34 -0
- package/dist/api/routes/admin/customers/create-customer.js +99 -70
- package/dist/api/routes/admin/customers/create-customer.js.map +1 -0
- package/dist/api/routes/admin/customers/get-customer.d.ts +22 -0
- package/dist/api/routes/admin/customers/get-customer.js +54 -52
- package/dist/api/routes/admin/customers/get-customer.js.map +1 -0
- package/dist/api/routes/admin/customers/index.d.ts +15 -0
- package/dist/api/routes/admin/customers/index.js +29 -23
- package/dist/api/routes/admin/customers/index.js.map +1 -0
- package/dist/api/routes/admin/customers/list-customers.d.ts +26 -0
- package/dist/api/routes/admin/customers/list-customers.js +145 -78
- package/dist/api/routes/admin/customers/list-customers.js.map +1 -0
- package/dist/api/routes/admin/customers/update-customer.d.ts +53 -0
- package/dist/api/routes/admin/customers/update-customer.js +122 -91
- package/dist/api/routes/admin/customers/update-customer.js.map +1 -0
- package/dist/api/routes/admin/discounts/add-region.d.ts +23 -0
- package/dist/api/routes/admin/discounts/add-region.js +60 -61
- package/dist/api/routes/admin/discounts/add-region.js.map +1 -0
- package/dist/api/routes/admin/discounts/add-valid-product.d.ts +23 -0
- package/dist/api/routes/admin/discounts/add-valid-product.js +62 -63
- package/dist/api/routes/admin/discounts/add-valid-product.js.map +1 -0
- package/dist/api/routes/admin/discounts/create-discount.d.ts +79 -0
- package/dist/api/routes/admin/discounts/create-discount.js +171 -88
- package/dist/api/routes/admin/discounts/create-discount.js.map +1 -0
- package/dist/api/routes/admin/discounts/create-dynamic-code.d.ts +29 -0
- package/dist/api/routes/admin/discounts/create-dynamic-code.js +95 -76
- package/dist/api/routes/admin/discounts/create-dynamic-code.js.map +1 -0
- package/dist/api/routes/admin/discounts/delete-discount.d.ts +28 -0
- package/dist/api/routes/admin/discounts/delete-discount.js +56 -51
- package/dist/api/routes/admin/discounts/delete-discount.js.map +1 -0
- package/dist/api/routes/admin/discounts/delete-dynamic-code.d.ts +23 -0
- package/dist/api/routes/admin/discounts/delete-dynamic-code.js +58 -58
- package/dist/api/routes/admin/discounts/delete-dynamic-code.js.map +1 -0
- package/dist/api/routes/admin/discounts/get-discount-by-code.d.ts +22 -0
- package/dist/api/routes/admin/discounts/get-discount-by-code.js +53 -52
- package/dist/api/routes/admin/discounts/get-discount-by-code.js.map +1 -0
- package/dist/api/routes/admin/discounts/get-discount.d.ts +22 -0
- package/dist/api/routes/admin/discounts/get-discount.js +56 -55
- package/dist/api/routes/admin/discounts/get-discount.js.map +1 -0
- package/dist/api/routes/admin/discounts/index.d.ts +26 -0
- package/dist/api/routes/admin/discounts/index.js +73 -38
- package/dist/api/routes/admin/discounts/index.js.map +1 -0
- package/dist/api/routes/admin/discounts/list-discounts.d.ts +35 -0
- package/dist/api/routes/admin/discounts/list-discounts.js +157 -86
- package/dist/api/routes/admin/discounts/list-discounts.js.map +1 -0
- package/dist/api/routes/admin/discounts/remove-region.d.ts +23 -0
- package/dist/api/routes/admin/discounts/remove-region.js +60 -61
- package/dist/api/routes/admin/discounts/remove-region.js.map +1 -0
- package/dist/api/routes/admin/discounts/remove-valid-product.d.ts +23 -0
- package/dist/api/routes/admin/discounts/remove-valid-product.js +60 -61
- package/dist/api/routes/admin/discounts/remove-valid-product.js.map +1 -0
- package/dist/api/routes/admin/discounts/update-discount.d.ts +74 -0
- package/dist/api/routes/admin/discounts/update-discount.js +181 -99
- package/dist/api/routes/admin/discounts/update-discount.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/create-draft-order.d.ts +127 -0
- package/dist/api/routes/admin/draft-orders/create-draft-order.js +215 -99
- package/dist/api/routes/admin/draft-orders/create-draft-order.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/create-line-item.d.ts +49 -0
- package/dist/api/routes/admin/draft-orders/create-line-item.js +158 -150
- package/dist/api/routes/admin/draft-orders/create-line-item.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/delete-draft-order.d.ts +28 -0
- package/dist/api/routes/admin/draft-orders/delete-draft-order.js +56 -51
- package/dist/api/routes/admin/draft-orders/delete-draft-order.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/delete-line-item.d.ts +23 -0
- package/dist/api/routes/admin/draft-orders/delete-line-item.js +85 -103
- package/dist/api/routes/admin/draft-orders/delete-line-item.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/get-draft-order.d.ts +22 -0
- package/dist/api/routes/admin/draft-orders/get-draft-order.js +65 -65
- package/dist/api/routes/admin/draft-orders/get-draft-order.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/index.d.ts +29 -0
- package/dist/api/routes/admin/draft-orders/index.js +87 -41
- package/dist/api/routes/admin/draft-orders/index.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/list-draft-orders.d.ts +25 -0
- package/dist/api/routes/admin/draft-orders/list-draft-orders.js +126 -80
- package/dist/api/routes/admin/draft-orders/list-draft-orders.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/register-payment.d.ts +22 -0
- package/dist/api/routes/admin/draft-orders/register-payment.js +110 -113
- package/dist/api/routes/admin/draft-orders/register-payment.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/update-draft-order.d.ts +69 -0
- package/dist/api/routes/admin/draft-orders/update-draft-order.js +151 -114
- package/dist/api/routes/admin/draft-orders/update-draft-order.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/update-line-item.d.ts +43 -0
- package/dist/api/routes/admin/draft-orders/update-line-item.js +165 -159
- package/dist/api/routes/admin/draft-orders/update-line-item.js.map +1 -0
- package/dist/api/routes/admin/gift-cards/create-gift-card.d.ts +50 -0
- package/dist/api/routes/admin/gift-cards/create-gift-card.js +116 -88
- package/dist/api/routes/admin/gift-cards/create-gift-card.js.map +1 -0
- package/dist/api/routes/admin/gift-cards/delete-gift-card.d.ts +28 -0
- package/dist/api/routes/admin/gift-cards/delete-gift-card.js +56 -51
- package/dist/api/routes/admin/gift-cards/delete-gift-card.js.map +1 -0
- package/dist/api/routes/admin/gift-cards/get-gift-card.d.ts +22 -0
- package/dist/api/routes/admin/gift-cards/get-gift-card.js +56 -55
- package/dist/api/routes/admin/gift-cards/get-gift-card.js.map +1 -0
- package/dist/api/routes/admin/gift-cards/index.d.ts +19 -0
- package/dist/api/routes/admin/gift-cards/index.js +59 -32
- package/dist/api/routes/admin/gift-cards/index.js.map +1 -0
- package/dist/api/routes/admin/gift-cards/list-gift-cards.d.ts +27 -0
- package/dist/api/routes/admin/gift-cards/list-gift-cards.js +108 -70
- package/dist/api/routes/admin/gift-cards/list-gift-cards.js.map +1 -0
- package/dist/api/routes/admin/gift-cards/update-gift-card.d.ts +52 -0
- package/dist/api/routes/admin/gift-cards/update-gift-card.js +107 -80
- package/dist/api/routes/admin/gift-cards/update-gift-card.js.map +1 -0
- package/dist/api/routes/admin/index.d.ts +2 -0
- package/dist/api/routes/admin/index.js +67 -97
- package/dist/api/routes/admin/index.js.map +1 -0
- package/dist/api/routes/admin/notes/create-note.d.ts +40 -0
- package/dist/api/routes/admin/notes/create-note.js +93 -74
- package/dist/api/routes/admin/notes/create-note.js.map +1 -0
- package/dist/api/routes/admin/notes/delete-note.d.ts +26 -0
- package/dist/api/routes/admin/notes/delete-note.js +52 -50
- package/dist/api/routes/admin/notes/delete-note.js.map +1 -0
- package/dist/api/routes/admin/notes/get-note.d.ts +22 -0
- package/dist/api/routes/admin/notes/get-note.js +53 -53
- package/dist/api/routes/admin/notes/get-note.js.map +1 -0
- package/dist/api/routes/admin/notes/index.d.ts +17 -0
- package/dist/api/routes/admin/notes/index.js +32 -24
- package/dist/api/routes/admin/notes/index.js.map +1 -0
- package/dist/api/routes/admin/notes/list-notes.d.ts +31 -0
- package/dist/api/routes/admin/notes/list-notes.js +109 -62
- package/dist/api/routes/admin/notes/list-notes.js.map +1 -0
- package/dist/api/routes/admin/notes/update-note.d.ts +36 -0
- package/dist/api/routes/admin/notes/update-note.js +80 -67
- package/dist/api/routes/admin/notes/update-note.js.map +1 -0
- package/dist/api/routes/admin/notifications/index.d.ts +14 -0
- package/dist/api/routes/admin/notifications/index.js +42 -37
- package/dist/api/routes/admin/notifications/index.js.map +1 -0
- package/dist/api/routes/admin/notifications/list-notifications.d.ts +43 -0
- package/dist/api/routes/admin/notifications/list-notifications.js +201 -111
- package/dist/api/routes/admin/notifications/list-notifications.js.map +1 -0
- package/dist/api/routes/admin/notifications/resend-notification.d.ts +33 -0
- package/dist/api/routes/admin/notifications/resend-notification.js +99 -82
- package/dist/api/routes/admin/notifications/resend-notification.js.map +1 -0
- package/dist/api/routes/admin/orders/add-shipping-method.d.ts +30 -0
- package/dist/api/routes/admin/orders/add-shipping-method.js +99 -82
- package/dist/api/routes/admin/orders/add-shipping-method.js.map +1 -0
- package/dist/api/routes/admin/orders/archive-order.d.ts +22 -0
- package/dist/api/routes/admin/orders/archive-order.js +76 -56
- package/dist/api/routes/admin/orders/archive-order.js.map +1 -0
- package/dist/api/routes/admin/orders/cancel-claim.d.ts +23 -0
- package/dist/api/routes/admin/orders/cancel-claim.js +70 -80
- package/dist/api/routes/admin/orders/cancel-claim.js.map +1 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment-claim.d.ts +24 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment-claim.js +76 -94
- package/dist/api/routes/admin/orders/cancel-fulfillment-claim.js.map +1 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment-swap.d.ts +24 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment-swap.js +75 -93
- package/dist/api/routes/admin/orders/cancel-fulfillment-swap.js.map +1 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment.d.ts +23 -0
- package/dist/api/routes/admin/orders/cancel-fulfillment.js +68 -78
- package/dist/api/routes/admin/orders/cancel-fulfillment.js.map +1 -0
- package/dist/api/routes/admin/orders/cancel-order.d.ts +22 -0
- package/dist/api/routes/admin/orders/cancel-order.js +59 -59
- package/dist/api/routes/admin/orders/cancel-order.js.map +1 -0
- package/dist/api/routes/admin/orders/cancel-swap.d.ts +23 -0
- package/dist/api/routes/admin/orders/cancel-swap.js +69 -79
- package/dist/api/routes/admin/orders/cancel-swap.js.map +1 -0
- package/dist/api/routes/admin/orders/capture-payment.d.ts +22 -0
- package/dist/api/routes/admin/orders/capture-payment.js +59 -59
- package/dist/api/routes/admin/orders/capture-payment.js.map +1 -0
- package/dist/api/routes/admin/orders/complete-order.d.ts +22 -0
- package/dist/api/routes/admin/orders/complete-order.js +76 -56
- package/dist/api/routes/admin/orders/complete-order.js.map +1 -0
- package/dist/api/routes/admin/orders/create-claim-shipment.d.ts +42 -0
- package/dist/api/routes/admin/orders/create-claim-shipment.js +96 -82
- package/dist/api/routes/admin/orders/create-claim-shipment.js.map +1 -0
- package/dist/api/routes/admin/orders/create-claim.d.ts +157 -0
- package/dist/api/routes/admin/orders/create-claim.js +451 -427
- package/dist/api/routes/admin/orders/create-claim.js.map +1 -0
- package/dist/api/routes/admin/orders/create-fulfillment.d.ts +55 -0
- package/dist/api/routes/admin/orders/create-fulfillment.js +122 -84
- package/dist/api/routes/admin/orders/create-fulfillment.js.map +1 -0
- package/dist/api/routes/admin/orders/create-order.d.ts +123 -0
- package/dist/api/routes/admin/orders/create-order.js +275 -90
- package/dist/api/routes/admin/orders/create-order.js.map +1 -0
- package/dist/api/routes/admin/orders/create-shipment.d.ts +45 -0
- package/dist/api/routes/admin/orders/create-shipment.js +100 -84
- package/dist/api/routes/admin/orders/create-shipment.js.map +1 -0
- package/dist/api/routes/admin/orders/create-swap-shipment.d.ts +46 -0
- package/dist/api/routes/admin/orders/create-swap-shipment.js +101 -85
- package/dist/api/routes/admin/orders/create-swap-shipment.js.map +1 -0
- package/dist/api/routes/admin/orders/create-swap.d.ts +111 -0
- package/dist/api/routes/admin/orders/create-swap.js +316 -296
- package/dist/api/routes/admin/orders/create-swap.js.map +1 -0
- package/dist/api/routes/admin/orders/delete-metadata.d.ts +23 -0
- package/dist/api/routes/admin/orders/delete-metadata.js +58 -58
- package/dist/api/routes/admin/orders/delete-metadata.js.map +1 -0
- package/dist/api/routes/admin/orders/fulfill-claim.d.ts +38 -0
- package/dist/api/routes/admin/orders/fulfill-claim.js +104 -101
- package/dist/api/routes/admin/orders/fulfill-claim.js.map +1 -0
- package/dist/api/routes/admin/orders/fulfill-swap.d.ts +38 -0
- package/dist/api/routes/admin/orders/fulfill-swap.js +105 -104
- package/dist/api/routes/admin/orders/fulfill-swap.js.map +1 -0
- package/dist/api/routes/admin/orders/get-order.d.ts +22 -0
- package/dist/api/routes/admin/orders/get-order.js +56 -55
- package/dist/api/routes/admin/orders/get-order.js.map +1 -0
- package/dist/api/routes/admin/orders/index.d.ts +45 -0
- package/dist/api/routes/admin/orders/index.js +292 -170
- package/dist/api/routes/admin/orders/index.js.map +1 -0
- package/dist/api/routes/admin/orders/list-orders.d.ts +49 -0
- package/dist/api/routes/admin/orders/list-orders.js +191 -139
- package/dist/api/routes/admin/orders/list-orders.js.map +1 -0
- package/dist/api/routes/admin/orders/process-swap-payment.d.ts +23 -0
- package/dist/api/routes/admin/orders/process-swap-payment.js +71 -85
- package/dist/api/routes/admin/orders/process-swap-payment.js.map +1 -0
- package/dist/api/routes/admin/orders/receive-swap.d.ts +46 -0
- package/dist/api/routes/admin/orders/receive-swap.js +121 -105
- package/dist/api/routes/admin/orders/receive-swap.js.map +1 -0
- package/dist/api/routes/admin/orders/refund-payment.d.ts +48 -0
- package/dist/api/routes/admin/orders/refund-payment.js +103 -81
- package/dist/api/routes/admin/orders/refund-payment.js.map +1 -0
- package/dist/api/routes/admin/orders/request-return.d.ts +78 -0
- package/dist/api/routes/admin/orders/request-return.js +293 -325
- package/dist/api/routes/admin/orders/request-return.js.map +1 -0
- package/dist/api/routes/admin/orders/update-claim.d.ts +109 -0
- package/dist/api/routes/admin/orders/update-claim.js +194 -97
- package/dist/api/routes/admin/orders/update-claim.js.map +1 -0
- package/dist/api/routes/admin/orders/update-order.d.ts +106 -0
- package/dist/api/routes/admin/orders/update-order.js +260 -93
- package/dist/api/routes/admin/orders/update-order.js.map +1 -0
- package/dist/api/routes/admin/products/add-option.d.ts +32 -0
- package/dist/api/routes/admin/products/add-option.js +85 -76
- package/dist/api/routes/admin/products/add-option.js.map +1 -0
- package/dist/api/routes/admin/products/create-product.d.ts +256 -0
- package/dist/api/routes/admin/products/create-product.js +484 -257
- package/dist/api/routes/admin/products/create-product.js.map +1 -0
- package/dist/api/routes/admin/products/create-variant.d.ts +139 -0
- package/dist/api/routes/admin/products/create-variant.js +222 -103
- package/dist/api/routes/admin/products/create-variant.js.map +1 -0
- package/dist/api/routes/admin/products/delete-option.d.ts +31 -0
- package/dist/api/routes/admin/products/delete-option.js +65 -64
- package/dist/api/routes/admin/products/delete-option.js.map +1 -0
- package/dist/api/routes/admin/products/delete-product.d.ts +28 -0
- package/dist/api/routes/admin/products/delete-product.js +56 -51
- package/dist/api/routes/admin/products/delete-product.js.map +1 -0
- package/dist/api/routes/admin/products/delete-variant.d.ts +29 -0
- package/dist/api/routes/admin/products/delete-variant.js +66 -65
- package/dist/api/routes/admin/products/delete-variant.js.map +1 -0
- package/dist/api/routes/admin/products/get-product.d.ts +22 -0
- package/dist/api/routes/admin/products/get-product.js +56 -47
- package/dist/api/routes/admin/products/get-product.js.map +1 -0
- package/dist/api/routes/admin/products/get-variants.d.ts +24 -0
- package/dist/api/routes/admin/products/get-variants.js +52 -42
- package/dist/api/routes/admin/products/get-variants.js.map +1 -0
- package/dist/api/routes/admin/products/index.d.ts +37 -0
- package/dist/api/routes/admin/products/index.js +100 -43
- package/dist/api/routes/admin/products/index.js.map +1 -0
- package/dist/api/routes/admin/products/list-products.d.ts +79 -0
- package/dist/api/routes/admin/products/list-products.js +285 -125
- package/dist/api/routes/admin/products/list-products.js.map +1 -0
- package/dist/api/routes/admin/products/list-tag-usage-count.d.ts +2 -0
- package/dist/api/routes/admin/products/list-tag-usage-count.js +50 -49
- package/dist/api/routes/admin/products/list-tag-usage-count.js.map +1 -0
- package/dist/api/routes/admin/products/list-types.d.ts +22 -0
- package/dist/api/routes/admin/products/list-types.js +51 -49
- package/dist/api/routes/admin/products/list-types.js.map +1 -0
- package/dist/api/routes/admin/products/set-metadata.d.ts +40 -0
- package/dist/api/routes/admin/products/set-metadata.js +124 -80
- package/dist/api/routes/admin/products/set-metadata.js.map +1 -0
- package/dist/api/routes/admin/products/update-option.d.ts +36 -0
- package/dist/api/routes/admin/products/update-option.js +87 -76
- package/dist/api/routes/admin/products/update-option.js.map +1 -0
- package/dist/api/routes/admin/products/update-product.d.ts +249 -0
- package/dist/api/routes/admin/products/update-product.js +367 -151
- package/dist/api/routes/admin/products/update-product.js.map +1 -0
- package/dist/api/routes/admin/products/update-variant.d.ts +105 -0
- package/dist/api/routes/admin/products/update-variant.js +227 -104
- package/dist/api/routes/admin/products/update-variant.js.map +1 -0
- package/dist/api/routes/admin/regions/add-country.d.ts +35 -0
- package/dist/api/routes/admin/regions/add-country.js +87 -76
- package/dist/api/routes/admin/regions/add-country.js.map +1 -0
- package/dist/api/routes/admin/regions/add-fulfillment-provider.d.ts +35 -0
- package/dist/api/routes/admin/regions/add-fulfillment-provider.js +87 -76
- package/dist/api/routes/admin/regions/add-fulfillment-provider.js.map +1 -0
- package/dist/api/routes/admin/regions/add-payment-provider.d.ts +35 -0
- package/dist/api/routes/admin/regions/add-payment-provider.js +87 -76
- package/dist/api/routes/admin/regions/add-payment-provider.js.map +1 -0
- package/dist/api/routes/admin/regions/create-region.d.ts +65 -0
- package/dist/api/routes/admin/regions/create-region.js +115 -82
- package/dist/api/routes/admin/regions/create-region.js.map +1 -0
- package/dist/api/routes/admin/regions/delete-metadata.d.ts +23 -0
- package/dist/api/routes/admin/regions/delete-metadata.js +60 -61
- package/dist/api/routes/admin/regions/delete-metadata.js.map +1 -0
- package/dist/api/routes/admin/regions/delete-region.d.ts +28 -0
- package/dist/api/routes/admin/regions/delete-region.js +56 -53
- package/dist/api/routes/admin/regions/delete-region.js.map +1 -0
- package/dist/api/routes/admin/regions/get-fulfillment-options.d.ts +24 -0
- package/dist/api/routes/admin/regions/get-fulfillment-options.js +62 -62
- package/dist/api/routes/admin/regions/get-fulfillment-options.js.map +1 -0
- package/dist/api/routes/admin/regions/get-region.d.ts +22 -0
- package/dist/api/routes/admin/regions/get-region.js +57 -58
- package/dist/api/routes/admin/regions/get-region.js.map +1 -0
- package/dist/api/routes/admin/regions/index.d.ts +21 -0
- package/dist/api/routes/admin/regions/index.js +67 -45
- package/dist/api/routes/admin/regions/index.js.map +1 -0
- package/dist/api/routes/admin/regions/list-regions.d.ts +39 -0
- package/dist/api/routes/admin/regions/list-regions.js +113 -64
- package/dist/api/routes/admin/regions/list-regions.js.map +1 -0
- package/dist/api/routes/admin/regions/remove-country.d.ts +23 -0
- package/dist/api/routes/admin/regions/remove-country.js +60 -63
- package/dist/api/routes/admin/regions/remove-country.js.map +1 -0
- package/dist/api/routes/admin/regions/remove-fulfillment-provider.d.ts +23 -0
- package/dist/api/routes/admin/regions/remove-fulfillment-provider.js +60 -63
- package/dist/api/routes/admin/regions/remove-fulfillment-provider.js.map +1 -0
- package/dist/api/routes/admin/regions/remove-payment-provider.d.ts +23 -0
- package/dist/api/routes/admin/regions/remove-payment-provider.js +61 -64
- package/dist/api/routes/admin/regions/remove-payment-provider.js.map +1 -0
- package/dist/api/routes/admin/regions/set-metadata.d.ts +28 -0
- package/dist/api/routes/admin/regions/set-metadata.js +109 -74
- package/dist/api/routes/admin/regions/set-metadata.js.map +1 -0
- package/dist/api/routes/admin/regions/update-region.d.ts +63 -0
- package/dist/api/routes/admin/regions/update-region.js +119 -83
- package/dist/api/routes/admin/regions/update-region.js.map +1 -0
- package/dist/api/routes/admin/return-reasons/create-reason.d.ts +50 -0
- package/dist/api/routes/admin/return-reasons/create-reason.js +107 -80
- package/dist/api/routes/admin/return-reasons/create-reason.js.map +1 -0
- package/dist/api/routes/admin/return-reasons/delete-reason.d.ts +28 -0
- package/dist/api/routes/admin/return-reasons/delete-reason.js +56 -51
- package/dist/api/routes/admin/return-reasons/delete-reason.js.map +1 -0
- package/dist/api/routes/admin/return-reasons/get-reason.d.ts +22 -0
- package/dist/api/routes/admin/return-reasons/get-reason.js +56 -57
- package/dist/api/routes/admin/return-reasons/get-reason.js.map +1 -0
- package/dist/api/routes/admin/return-reasons/index.d.ts +12 -0
- package/dist/api/routes/admin/return-reasons/index.js +57 -48
- package/dist/api/routes/admin/return-reasons/index.js.map +1 -0
- package/dist/api/routes/admin/return-reasons/list-reasons.d.ts +22 -0
- package/dist/api/routes/admin/return-reasons/list-reasons.js +56 -59
- package/dist/api/routes/admin/return-reasons/list-reasons.js.map +1 -0
- package/dist/api/routes/admin/return-reasons/update-reason.d.ts +42 -0
- package/dist/api/routes/admin/return-reasons/update-reason.js +100 -82
- package/dist/api/routes/admin/return-reasons/update-reason.js.map +1 -0
- package/dist/api/routes/admin/returns/cancel-return.d.ts +21 -0
- package/dist/api/routes/admin/returns/cancel-return.js +73 -96
- package/dist/api/routes/admin/returns/cancel-return.js.map +1 -0
- package/dist/api/routes/admin/returns/index.d.ts +16 -0
- package/dist/api/routes/admin/returns/index.js +30 -26
- package/dist/api/routes/admin/returns/index.js.map +1 -0
- package/dist/api/routes/admin/returns/list-returns.d.ts +28 -0
- package/dist/api/routes/admin/returns/list-returns.js +113 -72
- package/dist/api/routes/admin/returns/list-returns.js.map +1 -0
- package/dist/api/routes/admin/returns/receive-return.d.ts +50 -0
- package/dist/api/routes/admin/returns/receive-return.js +139 -127
- package/dist/api/routes/admin/returns/receive-return.js.map +1 -0
- package/dist/api/routes/admin/shipping-options/create-shipping-option.d.ts +2 -0
- package/dist/api/routes/admin/shipping-options/create-shipping-option.js +87 -104
- package/dist/api/routes/admin/shipping-options/create-shipping-option.js.map +1 -0
- package/dist/api/routes/admin/shipping-options/delete-shipping-option.d.ts +2 -0
- package/dist/api/routes/admin/shipping-options/delete-shipping-option.js +55 -51
- package/dist/api/routes/admin/shipping-options/delete-shipping-option.js.map +1 -0
- package/dist/api/routes/admin/shipping-options/get-shipping-option.d.ts +2 -0
- package/dist/api/routes/admin/shipping-options/get-shipping-option.js +51 -50
- package/dist/api/routes/admin/shipping-options/get-shipping-option.js.map +1 -0
- package/dist/api/routes/admin/shipping-options/index.d.ts +4 -0
- package/dist/api/routes/admin/shipping-options/index.js +34 -28
- package/dist/api/routes/admin/shipping-options/index.js.map +1 -0
- package/dist/api/routes/admin/shipping-options/list-shipping-options.d.ts +2 -0
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js +59 -57
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js.map +1 -0
- package/dist/api/routes/admin/shipping-options/update-shipping-option.d.ts +2 -0
- package/dist/api/routes/admin/shipping-options/update-shipping-option.js +77 -86
- package/dist/api/routes/admin/shipping-options/update-shipping-option.js.map +1 -0
- package/dist/api/routes/admin/shipping-profiles/create-shipping-profile.d.ts +33 -0
- package/dist/api/routes/admin/shipping-profiles/create-shipping-profile.js +78 -66
- package/dist/api/routes/admin/shipping-profiles/create-shipping-profile.js.map +1 -0
- package/dist/api/routes/admin/shipping-profiles/delete-shipping-profile.d.ts +28 -0
- package/dist/api/routes/admin/shipping-profiles/delete-shipping-profile.js +56 -51
- package/dist/api/routes/admin/shipping-profiles/delete-shipping-profile.js.map +1 -0
- package/dist/api/routes/admin/shipping-profiles/get-shipping-profile.d.ts +22 -0
- package/dist/api/routes/admin/shipping-profiles/get-shipping-profile.js +56 -55
- package/dist/api/routes/admin/shipping-profiles/get-shipping-profile.js.map +1 -0
- package/dist/api/routes/admin/shipping-profiles/index.d.ts +17 -0
- package/dist/api/routes/admin/shipping-profiles/index.js +44 -28
- package/dist/api/routes/admin/shipping-profiles/index.js.map +1 -0
- package/dist/api/routes/admin/shipping-profiles/list-shipping-profiles.d.ts +22 -0
- package/dist/api/routes/admin/shipping-profiles/list-shipping-profiles.js +51 -49
- package/dist/api/routes/admin/shipping-profiles/list-shipping-profiles.js.map +1 -0
- package/dist/api/routes/admin/shipping-profiles/update-shipping-profile.d.ts +32 -0
- package/dist/api/routes/admin/shipping-profiles/update-shipping-profile.js +81 -71
- package/dist/api/routes/admin/shipping-profiles/update-shipping-profile.js.map +1 -0
- package/dist/api/routes/admin/store/add-currency.d.ts +22 -0
- package/dist/api/routes/admin/store/add-currency.js +52 -50
- package/dist/api/routes/admin/store/add-currency.js.map +1 -0
- package/dist/api/routes/admin/store/get-store.d.ts +20 -0
- package/dist/api/routes/admin/store/get-store.js +61 -64
- package/dist/api/routes/admin/store/get-store.js.map +1 -0
- package/dist/api/routes/admin/store/index.d.ts +9 -0
- package/dist/api/routes/admin/store/index.js +16 -24
- package/dist/api/routes/admin/store/index.js.map +1 -0
- package/dist/api/routes/admin/store/list-payment-providers.d.ts +22 -0
- package/dist/api/routes/admin/store/list-payment-providers.js +51 -49
- package/dist/api/routes/admin/store/list-payment-providers.js.map +1 -0
- package/dist/api/routes/admin/store/remove-currency.d.ts +22 -0
- package/dist/api/routes/admin/store/remove-currency.js +52 -50
- package/dist/api/routes/admin/store/remove-currency.js.map +1 -0
- package/dist/api/routes/admin/store/update-store.d.ts +41 -0
- package/dist/api/routes/admin/store/update-store.js +98 -70
- package/dist/api/routes/admin/store/update-store.js.map +1 -0
- package/dist/api/routes/admin/swaps/get-swap.d.ts +22 -0
- package/dist/api/routes/admin/swaps/get-swap.js +56 -55
- package/dist/api/routes/admin/swaps/get-swap.js.map +1 -0
- package/dist/api/routes/admin/swaps/index.d.ts +14 -0
- package/dist/api/routes/admin/swaps/index.js +65 -33
- package/dist/api/routes/admin/swaps/index.js.map +1 -0
- package/dist/api/routes/admin/swaps/list-swaps.d.ts +26 -0
- package/dist/api/routes/admin/swaps/list-swaps.js +105 -71
- package/dist/api/routes/admin/swaps/list-swaps.js.map +1 -0
- package/dist/api/routes/admin/uploads/create-upload.d.ts +2 -0
- package/dist/api/routes/admin/uploads/create-upload.js +68 -76
- package/dist/api/routes/admin/uploads/create-upload.js.map +1 -0
- package/dist/api/routes/admin/uploads/delete-upload.d.ts +2 -0
- package/dist/api/routes/admin/uploads/delete-upload.js +57 -48
- package/dist/api/routes/admin/uploads/delete-upload.js.map +1 -0
- package/dist/api/routes/admin/uploads/index.d.ts +2 -0
- package/dist/api/routes/admin/uploads/index.js +15 -26
- package/dist/api/routes/admin/uploads/index.js.map +1 -0
- package/dist/api/routes/admin/users/create-user.d.ts +42 -0
- package/dist/api/routes/admin/users/create-user.js +123 -70
- package/dist/api/routes/admin/users/create-user.js.map +1 -0
- package/dist/api/routes/admin/users/delete-user.d.ts +28 -0
- package/dist/api/routes/admin/users/delete-user.js +81 -43
- package/dist/api/routes/admin/users/delete-user.js.map +1 -0
- package/dist/api/routes/admin/users/get-user.d.ts +22 -0
- package/dist/api/routes/admin/users/get-user.js +71 -50
- package/dist/api/routes/admin/users/get-user.js.map +1 -0
- package/dist/api/routes/admin/users/index.d.ts +2 -0
- package/dist/api/routes/admin/users/index.js +18 -26
- package/dist/api/routes/admin/users/index.js.map +1 -0
- package/dist/api/routes/admin/users/list-users.d.ts +22 -0
- package/dist/api/routes/admin/users/list-users.js +70 -49
- package/dist/api/routes/admin/users/list-users.js.map +1 -0
- package/dist/api/routes/admin/users/reset-password-token.d.ts +27 -0
- package/dist/api/routes/admin/users/reset-password-token.js +103 -67
- package/dist/api/routes/admin/users/reset-password-token.js.map +1 -0
- package/dist/api/routes/admin/users/reset-password.d.ts +43 -0
- package/dist/api/routes/admin/users/reset-password.js +130 -89
- package/dist/api/routes/admin/users/reset-password.js.map +1 -0
- package/dist/api/routes/admin/users/update-user.d.ts +28 -0
- package/dist/api/routes/admin/users/update-user.js +104 -67
- package/dist/api/routes/admin/users/update-user.js.map +1 -0
- package/dist/api/routes/admin/variants/index.d.ts +11 -0
- package/dist/api/routes/admin/variants/index.js +63 -28
- package/dist/api/routes/admin/variants/index.js.map +1 -0
- package/dist/api/routes/admin/variants/list-variants.d.ts +31 -0
- package/dist/api/routes/admin/variants/list-variants.js +108 -71
- package/dist/api/routes/admin/variants/list-variants.js.map +1 -0
- package/dist/api/routes/store/auth/create-session.d.ts +26 -0
- package/dist/api/routes/store/auth/create-session.js +99 -88
- package/dist/api/routes/store/auth/create-session.js.map +1 -0
- package/dist/api/routes/store/auth/delete-session.d.ts +13 -0
- package/dist/api/routes/store/auth/delete-session.js +45 -35
- package/dist/api/routes/store/auth/delete-session.js.map +1 -0
- package/dist/api/routes/store/auth/exists.d.ts +21 -0
- package/dist/api/routes/store/auth/exists.js +60 -55
- package/dist/api/routes/store/auth/exists.js.map +1 -0
- package/dist/api/routes/store/auth/get-session.d.ts +20 -0
- package/dist/api/routes/store/auth/get-session.js +58 -64
- package/dist/api/routes/store/auth/get-session.js.map +1 -0
- package/dist/api/routes/store/auth/index.d.ts +13 -0
- package/dist/api/routes/store/auth/index.js +29 -23
- package/dist/api/routes/store/auth/index.js.map +1 -0
- package/dist/api/routes/store/carts/add-shipping-method.d.ts +27 -0
- package/dist/api/routes/store/carts/add-shipping-method.js +112 -120
- package/dist/api/routes/store/carts/add-shipping-method.js.map +1 -0
- package/dist/api/routes/store/carts/complete-cart.d.ts +35 -0
- package/dist/api/routes/store/carts/complete-cart.js +293 -392
- package/dist/api/routes/store/carts/complete-cart.js.map +1 -0
- package/dist/api/routes/store/carts/create-cart.d.ts +57 -0
- package/dist/api/routes/store/carts/create-cart.js +199 -205
- package/dist/api/routes/store/carts/create-cart.js.map +1 -0
- package/dist/api/routes/store/carts/create-line-item.d.ts +30 -0
- package/dist/api/routes/store/carts/create-line-item.js +126 -132
- package/dist/api/routes/store/carts/create-line-item.js.map +1 -0
- package/dist/api/routes/store/carts/create-payment-sessions.d.ts +21 -0
- package/dist/api/routes/store/carts/create-payment-sessions.js +58 -59
- package/dist/api/routes/store/carts/create-payment-sessions.js.map +1 -0
- package/dist/api/routes/store/carts/delete-discount.d.ts +22 -0
- package/dist/api/routes/store/carts/delete-discount.js +85 -101
- package/dist/api/routes/store/carts/delete-discount.js.map +1 -0
- package/dist/api/routes/store/carts/delete-line-item.d.ts +22 -0
- package/dist/api/routes/store/carts/delete-line-item.js +85 -101
- package/dist/api/routes/store/carts/delete-line-item.js.map +1 -0
- package/dist/api/routes/store/carts/delete-payment-session.d.ts +22 -0
- package/dist/api/routes/store/carts/delete-payment-session.js +59 -61
- package/dist/api/routes/store/carts/delete-payment-session.js.map +1 -0
- package/dist/api/routes/store/carts/get-cart.d.ts +21 -0
- package/dist/api/routes/store/carts/get-cart.js +72 -79
- package/dist/api/routes/store/carts/get-cart.js.map +1 -0
- package/dist/api/routes/store/carts/index.d.ts +20 -0
- package/dist/api/routes/store/carts/index.js +104 -67
- package/dist/api/routes/store/carts/index.js.map +1 -0
- package/dist/api/routes/store/carts/refresh-payment-session.d.ts +22 -0
- package/dist/api/routes/store/carts/refresh-payment-session.js +71 -59
- package/dist/api/routes/store/carts/refresh-payment-session.js.map +1 -0
- package/dist/api/routes/store/carts/set-payment-session.d.ts +25 -0
- package/dist/api/routes/store/carts/set-payment-session.js +84 -77
- package/dist/api/routes/store/carts/set-payment-session.js.map +1 -0
- package/dist/api/routes/store/carts/update-cart.d.ts +87 -0
- package/dist/api/routes/store/carts/update-cart.js +168 -109
- package/dist/api/routes/store/carts/update-cart.js.map +1 -0
- package/dist/api/routes/store/carts/update-line-item.d.ts +26 -0
- package/dist/api/routes/store/carts/update-line-item.js +128 -155
- package/dist/api/routes/store/carts/update-line-item.js.map +1 -0
- package/dist/api/routes/store/carts/update-payment-method.d.ts +38 -0
- package/dist/api/routes/store/carts/update-payment-method.js +119 -77
- package/dist/api/routes/store/carts/update-payment-method.js.map +1 -0
- package/dist/api/routes/store/carts/update-payment-session.d.ts +26 -0
- package/dist/api/routes/store/carts/update-payment-session.js +87 -81
- package/dist/api/routes/store/carts/update-payment-session.js.map +1 -0
- package/dist/api/routes/store/collections/get-collection.d.ts +21 -0
- package/dist/api/routes/store/collections/get-collection.js +73 -0
- package/dist/api/routes/store/collections/get-collection.js.map +1 -0
- package/dist/api/routes/store/collections/index.d.ts +14 -0
- package/dist/api/routes/store/collections/index.js +30 -0
- package/dist/api/routes/store/collections/index.js.map +1 -0
- package/dist/api/routes/store/collections/list-collections.d.ts +26 -0
- package/dist/api/routes/store/collections/list-collections.js +136 -0
- package/dist/api/routes/store/collections/list-collections.js.map +1 -0
- package/dist/api/routes/store/customers/create-address.d.ts +35 -0
- package/dist/api/routes/store/customers/create-address.js +91 -80
- package/dist/api/routes/store/customers/create-address.js.map +1 -0
- package/dist/api/routes/store/customers/create-customer.d.ts +32 -0
- package/dist/api/routes/store/customers/create-customer.js +110 -90
- package/dist/api/routes/store/customers/create-customer.js.map +1 -0
- package/dist/api/routes/store/customers/delete-address.d.ts +22 -0
- package/dist/api/routes/store/customers/delete-address.js +62 -63
- package/dist/api/routes/store/customers/delete-address.js.map +1 -0
- package/dist/api/routes/store/customers/get-customer.d.ts +20 -0
- package/dist/api/routes/store/customers/get-customer.js +56 -55
- package/dist/api/routes/store/customers/get-customer.js.map +1 -0
- package/dist/api/routes/store/customers/get-payment-methods.d.ts +28 -0
- package/dist/api/routes/store/customers/get-payment-methods.js +77 -95
- package/dist/api/routes/store/customers/get-payment-methods.js.map +1 -0
- package/dist/api/routes/store/customers/index.d.ts +27 -0
- package/dist/api/routes/store/customers/index.js +104 -63
- package/dist/api/routes/store/customers/index.js.map +1 -0
- package/dist/api/routes/store/customers/list-orders.d.ts +42 -0
- package/dist/api/routes/store/customers/list-orders.js +155 -99
- package/dist/api/routes/store/customers/list-orders.js.map +1 -0
- package/dist/api/routes/store/customers/reset-password-token.d.ts +18 -0
- package/dist/api/routes/store/customers/reset-password-token.js +84 -68
- package/dist/api/routes/store/customers/reset-password-token.js.map +1 -0
- package/dist/api/routes/store/customers/reset-password.d.ts +28 -0
- package/dist/api/routes/store/customers/reset-password.js +102 -86
- package/dist/api/routes/store/customers/reset-password.js.map +1 -0
- package/dist/api/routes/store/customers/update-address.d.ts +34 -0
- package/dist/api/routes/store/customers/update-address.js +90 -78
- package/dist/api/routes/store/customers/update-address.js.map +1 -0
- package/dist/api/routes/store/customers/update-customer.d.ts +57 -0
- package/dist/api/routes/store/customers/update-customer.js +118 -84
- package/dist/api/routes/store/customers/update-customer.js.map +1 -0
- package/dist/api/routes/store/gift-cards/get-gift-card.d.ts +29 -0
- package/dist/api/routes/store/gift-cards/get-gift-card.js +64 -57
- package/dist/api/routes/store/gift-cards/get-gift-card.js.map +1 -0
- package/dist/api/routes/store/gift-cards/index.d.ts +11 -0
- package/dist/api/routes/store/gift-cards/index.js +28 -28
- package/dist/api/routes/store/gift-cards/index.js.map +1 -0
- package/dist/api/routes/store/index.d.ts +2 -0
- package/dist/api/routes/store/index.js +44 -63
- package/dist/api/routes/store/index.js.map +1 -0
- package/dist/api/routes/store/orders/get-order-by-cart.d.ts +21 -0
- package/dist/api/routes/store/orders/get-order-by-cart.js +55 -55
- package/dist/api/routes/store/orders/get-order-by-cart.js.map +1 -0
- package/dist/api/routes/store/orders/get-order.d.ts +21 -0
- package/dist/api/routes/store/orders/get-order.js +55 -56
- package/dist/api/routes/store/orders/get-order.js.map +1 -0
- package/dist/api/routes/store/orders/index.d.ts +12 -0
- package/dist/api/routes/store/orders/index.js +111 -42
- package/dist/api/routes/store/orders/index.js.map +1 -0
- package/dist/api/routes/store/orders/lookup-order.d.ts +30 -0
- package/dist/api/routes/store/orders/lookup-order.js +110 -90
- package/dist/api/routes/store/orders/lookup-order.js.map +1 -0
- package/dist/api/routes/store/products/get-product.d.ts +21 -0
- package/dist/api/routes/store/products/get-product.js +54 -46
- package/dist/api/routes/store/products/get-product.js.map +1 -0
- package/dist/api/routes/store/products/index.d.ts +18 -0
- package/dist/api/routes/store/products/index.js +39 -24
- package/dist/api/routes/store/products/index.js.map +1 -0
- package/dist/api/routes/store/products/list-products.d.ts +35 -0
- package/dist/api/routes/store/products/list-products.js +123 -71
- package/dist/api/routes/store/products/list-products.js.map +1 -0
- package/dist/api/routes/store/products/search.d.ts +8 -0
- package/dist/api/routes/store/products/search.js +116 -83
- package/dist/api/routes/store/products/search.js.map +1 -0
- package/dist/api/routes/store/regions/get-region.d.ts +21 -0
- package/dist/api/routes/store/regions/get-region.js +53 -44
- package/dist/api/routes/store/regions/get-region.js.map +1 -0
- package/dist/api/routes/store/regions/index.d.ts +11 -0
- package/dist/api/routes/store/regions/index.js +25 -21
- package/dist/api/routes/store/regions/index.js.map +1 -0
- package/dist/api/routes/store/regions/list-regions.d.ts +34 -0
- package/dist/api/routes/store/regions/list-regions.js +92 -50
- package/dist/api/routes/store/regions/list-regions.js.map +1 -0
- package/dist/api/routes/store/return-reasons/get-reason.d.ts +21 -0
- package/dist/api/routes/store/return-reasons/get-reason.js +56 -58
- package/dist/api/routes/store/return-reasons/get-reason.js.map +1 -0
- package/dist/api/routes/store/return-reasons/index.d.ts +13 -0
- package/dist/api/routes/store/return-reasons/index.js +46 -33
- package/dist/api/routes/store/return-reasons/index.js.map +1 -0
- package/dist/api/routes/store/return-reasons/list-reasons.d.ts +21 -0
- package/dist/api/routes/store/return-reasons/list-reasons.js +56 -60
- package/dist/api/routes/store/return-reasons/list-reasons.js.map +1 -0
- package/dist/api/routes/store/returns/create-return.d.ts +67 -0
- package/dist/api/routes/store/returns/create-return.js +271 -290
- package/dist/api/routes/store/returns/create-return.js.map +1 -0
- package/dist/api/routes/store/returns/index.d.ts +7 -0
- package/dist/api/routes/store/returns/index.js +23 -20
- package/dist/api/routes/store/returns/index.js.map +1 -0
- package/dist/api/routes/store/shipping-options/index.d.ts +8 -0
- package/dist/api/routes/store/shipping-options/index.js +25 -21
- package/dist/api/routes/store/shipping-options/index.js.map +1 -0
- package/dist/api/routes/store/shipping-options/list-options.d.ts +30 -0
- package/dist/api/routes/store/shipping-options/list-options.js +105 -84
- package/dist/api/routes/store/shipping-options/list-options.js.map +1 -0
- package/dist/api/routes/store/shipping-options/list-shipping-options.d.ts +23 -0
- package/dist/api/routes/store/shipping-options/list-shipping-options.js +59 -75
- package/dist/api/routes/store/shipping-options/list-shipping-options.js.map +1 -0
- package/dist/api/routes/store/swaps/create-swap.d.ts +88 -0
- package/dist/api/routes/store/swaps/create-swap.js +283 -292
- package/dist/api/routes/store/swaps/create-swap.js.map +1 -0
- package/dist/api/routes/store/swaps/get-swap-by-cart.d.ts +21 -0
- package/dist/api/routes/store/swaps/get-swap-by-cart.js +51 -50
- package/dist/api/routes/store/swaps/get-swap-by-cart.js.map +1 -0
- package/dist/api/routes/store/swaps/index.d.ts +10 -0
- package/dist/api/routes/store/swaps/index.js +52 -25
- package/dist/api/routes/store/swaps/index.js.map +1 -0
- package/dist/api/routes/store/variants/get-variant.d.ts +21 -0
- package/dist/api/routes/store/variants/get-variant.js +54 -54
- package/dist/api/routes/store/variants/get-variant.js.map +1 -0
- package/dist/api/routes/store/variants/index.d.ts +13 -0
- package/dist/api/routes/store/variants/index.js +27 -23
- package/dist/api/routes/store/variants/index.js.map +1 -0
- package/dist/api/routes/store/variants/list-variants.d.ts +32 -0
- package/dist/api/routes/store/variants/list-variants.js +115 -65
- package/dist/api/routes/store/variants/list-variants.js.map +1 -0
- package/dist/bin/medusa.d.ts +2 -0
- package/dist/bin/medusa.js +2 -3
- package/dist/bin/medusa.js.map +1 -0
- package/dist/commands/develop.d.ts +4 -0
- package/dist/commands/develop.js +103 -73
- package/dist/commands/develop.js.map +1 -0
- package/dist/commands/migrate.d.ts +4 -0
- package/dist/commands/migrate.js +91 -96
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/seed.d.ts +6 -0
- package/dist/commands/seed.js +334 -450
- package/dist/commands/seed.js.map +1 -0
- package/dist/commands/start.d.ts +4 -0
- package/dist/commands/start.js +82 -98
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/user.d.ts +7 -0
- package/dist/commands/user.js +82 -81
- package/dist/commands/user.js.map +1 -0
- package/dist/commands/utils/get-migrations.d.ts +2 -0
- package/dist/commands/utils/get-migrations.js +107 -125
- package/dist/commands/utils/get-migrations.js.map +1 -0
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.js +33 -44
- package/dist/config/index.js.map +1 -0
- package/dist/helpers/test-request.d.ts +11 -0
- package/dist/helpers/test-request.js +156 -167
- package/dist/helpers/test-request.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +114 -396
- package/dist/index.js.map +1 -0
- package/dist/loaders/api.d.ts +6 -0
- package/dist/loaders/api.js +56 -46
- package/dist/loaders/api.js.map +1 -0
- package/dist/loaders/database.d.ts +5 -0
- package/dist/loaders/database.js +75 -72
- package/dist/loaders/database.js.map +1 -0
- package/dist/loaders/defaults.d.ts +4 -0
- package/dist/loaders/defaults.js +250 -274
- package/dist/loaders/defaults.js.map +1 -0
- package/dist/loaders/express.d.ts +5 -0
- package/dist/loaders/express.js +78 -77
- package/dist/loaders/express.js.map +1 -0
- package/dist/loaders/index.d.ts +9 -0
- package/dist/loaders/index.js +232 -288
- package/dist/loaders/index.js.map +1 -0
- package/dist/loaders/logger.d.ts +1 -0
- package/dist/loaders/logger.js +7 -12
- package/dist/loaders/logger.js.map +1 -0
- package/dist/loaders/models.d.ts +6 -0
- package/dist/loaders/models.js +51 -61
- package/dist/loaders/models.js.map +1 -0
- package/dist/loaders/passport.d.ts +5 -0
- package/dist/loaders/passport.js +103 -151
- package/dist/loaders/passport.js.map +1 -0
- package/dist/loaders/plugins.d.ts +11 -0
- package/dist/loaders/plugins.js +410 -559
- package/dist/loaders/plugins.js.map +1 -0
- package/dist/loaders/redis.d.ts +6 -0
- package/dist/loaders/redis.js +71 -63
- package/dist/loaders/redis.js.map +1 -0
- package/dist/loaders/repositories.d.ts +4 -0
- package/dist/loaders/repositories.js +43 -46
- package/dist/loaders/repositories.js.map +1 -0
- package/dist/loaders/search-index.d.ts +4 -0
- package/dist/loaders/search-index.js +121 -119
- package/dist/loaders/search-index.js.map +1 -0
- package/dist/loaders/services.d.ts +5 -0
- package/dist/loaders/services.js +24 -43
- package/dist/loaders/services.js.map +1 -0
- package/dist/loaders/subscribers.d.ts +4 -0
- package/dist/loaders/subscribers.js +21 -35
- package/dist/loaders/subscribers.js.map +1 -0
- package/dist/migrations/1611063162649-initial_schema.d.ts +6 -0
- package/dist/migrations/1611063162649-initial_schema.js +1173 -1550
- package/dist/migrations/1611063162649-initial_schema.js.map +1 -0
- package/dist/migrations/1611063174563-countries_currencies.d.ts +5 -0
- package/dist/migrations/1611063174563-countries_currencies.js +204 -202
- package/dist/migrations/1611063174563-countries_currencies.js.map +1 -0
- package/dist/migrations/1612284947120-claims.d.ts +6 -0
- package/dist/migrations/1612284947120-claims.js +309 -398
- package/dist/migrations/1612284947120-claims.js.map +1 -0
- package/dist/migrations/1612353094577-indexes.d.ts +6 -0
- package/dist/migrations/1612353094577-indexes.js +333 -430
- package/dist/migrations/1612353094577-indexes.js.map +1 -0
- package/dist/migrations/1613146953072-notifications.d.ts +6 -0
- package/dist/migrations/1613146953072-notifications.js +111 -134
- package/dist/migrations/1613146953072-notifications.js.map +1 -0
- package/dist/migrations/1613146953073-product_type_category_tags.d.ts +6 -0
- package/dist/migrations/1613146953073-product_type_category_tags.js +147 -182
- package/dist/migrations/1613146953073-product_type_category_tags.js.map +1 -0
- package/dist/migrations/1613384784316-draft_orders.d.ts +6 -0
- package/dist/migrations/1613384784316-draft_orders.js +177 -222
- package/dist/migrations/1613384784316-draft_orders.js.map +1 -0
- package/dist/migrations/1613656135167-tracking_links.d.ts +6 -0
- package/dist/migrations/1613656135167-tracking_links.js +75 -86
- package/dist/migrations/1613656135167-tracking_links.js.map +1 -0
- package/dist/migrations/1614684597235-cart_context.d.ts +6 -0
- package/dist/migrations/1614684597235-cart_context.js +69 -78
- package/dist/migrations/1614684597235-cart_context.js.map +1 -0
- package/dist/migrations/1615891636559-return_reason.d.ts +6 -0
- package/dist/migrations/1615891636559-return_reason.js +93 -110
- package/dist/migrations/1615891636559-return_reason.js.map +1 -0
- package/dist/migrations/1615970124120-discount_usage_count.d.ts +6 -0
- package/dist/migrations/1615970124120-discount_usage_count.js +69 -78
- package/dist/migrations/1615970124120-discount_usage_count.js.map +1 -0
- package/dist/migrations/1617002207608-discount_usage.d.ts +6 -0
- package/dist/migrations/1617002207608-discount_usage.js +99 -118
- package/dist/migrations/1617002207608-discount_usage.js.map +1 -0
- package/dist/migrations/1619108646647-nullable_password.d.ts +5 -0
- package/dist/migrations/1619108646647-nullable_password.js +68 -75
- package/dist/migrations/1619108646647-nullable_password.js.map +1 -0
- package/dist/migrations/1623231564533-no_notification.d.ts +6 -0
- package/dist/migrations/1623231564533-no_notification.js +99 -118
- package/dist/migrations/1623231564533-no_notification.js.map +1 -0
- package/dist/migrations/1624287602631-gc_remove_unique_order.d.ts +6 -0
- package/dist/migrations/1624287602631-gc_remove_unique_order.js +87 -102
- package/dist/migrations/1624287602631-gc_remove_unique_order.js.map +1 -0
- package/dist/migrations/1624610325746-soft_deleting_unique_constraints.d.ts +6 -0
- package/dist/migrations/1624610325746-soft_deleting_unique_constraints.js +147 -182
- package/dist/migrations/1624610325746-soft_deleting_unique_constraints.js.map +1 -0
- package/dist/migrations/1625560513367-ensure_cancellation_fields_exist.d.ts +6 -0
- package/dist/migrations/1625560513367-ensure_cancellation_fields_exist.js +105 -126
- package/dist/migrations/1625560513367-ensure_cancellation_fields_exist.js.map +1 -0
- package/dist/migrations/1627995307200-add_discountable_to_product.d.ts +6 -0
- package/dist/migrations/1627995307200-add_discountable_to_product.js +69 -78
- package/dist/migrations/1627995307200-add_discountable_to_product.js.map +1 -0
- package/dist/migrations/1630505790603-allow_backorder_swaps.d.ts +6 -0
- package/dist/migrations/1630505790603-allow_backorder_swaps.js +99 -118
- package/dist/migrations/1630505790603-allow_backorder_swaps.js.map +1 -0
- package/dist/migrations/1631104895519-rank_column_with_default_value.d.ts +6 -0
- package/dist/migrations/1631104895519-rank_column_with_default_value.js +93 -110
- package/dist/migrations/1631104895519-rank_column_with_default_value.js.map +1 -0
- package/dist/migrations/1631261634964-enforce_uniqueness.d.ts +6 -0
- package/dist/migrations/1631261634964-enforce_uniqueness.js +147 -182
- package/dist/migrations/1631261634964-enforce_uniqueness.js.map +1 -0
- package/dist/migrations/1631696624528-valid_duration_for_discount.d.ts +6 -0
- package/dist/migrations/1631696624528-valid_duration_for_discount.js +69 -78
- package/dist/migrations/1631696624528-valid_duration_for_discount.js.map +1 -0
- package/dist/migrations/1631800727788-nested_return_reasons.d.ts +5 -0
- package/dist/migrations/1631800727788-nested_return_reasons.js +71 -79
- package/dist/migrations/1631800727788-nested_return_reasons.js.map +1 -0
- package/dist/migrations/1631864388026-status_on_product.d.ts +6 -0
- package/dist/migrations/1631864388026-status_on_product.js +84 -98
- package/dist/migrations/1631864388026-status_on_product.js.map +1 -0
- package/dist/migrations/1632220294687-add_notes.d.ts +6 -0
- package/dist/migrations/1632220294687-add_notes.js +81 -94
- package/dist/migrations/1632220294687-add_notes.js.map +1 -0
- package/dist/migrations/1632828114899-delete_date_on_shipping_option_requirements.d.ts +6 -0
- package/dist/migrations/1632828114899-delete_date_on_shipping_option_requirements.js +69 -78
- package/dist/migrations/1632828114899-delete_date_on_shipping_option_requirements.js.map +1 -0
- package/dist/migrations/1633614437919-add_custom_shipping_options.d.ts +6 -0
- package/dist/migrations/1633614437919-add_custom_shipping_options.js +129 -158
- package/dist/migrations/1633614437919-add_custom_shipping_options.js.map +1 -0
- package/dist/models/address.d.ts +50 -0
- package/dist/models/address.js +138 -194
- package/dist/models/address.js.map +1 -0
- package/dist/models/cart.d.ts +138 -0
- package/dist/models/cart.js +290 -334
- package/dist/models/cart.js.map +1 -0
- package/dist/models/claim-image.d.ts +36 -0
- package/dist/models/claim-image.js +69 -108
- package/dist/models/claim-image.js.map +1 -0
- package/dist/models/claim-item.d.ts +85 -0
- package/dist/models/claim-item.js +125 -207
- package/dist/models/claim-item.js.map +1 -0
- package/dist/models/claim-order.d.ts +136 -0
- package/dist/models/claim-order.js +154 -280
- package/dist/models/claim-order.js.map +1 -0
- package/dist/models/claim-tag.d.ts +37 -0
- package/dist/models/claim-tag.js +59 -88
- package/dist/models/claim-tag.js.map +1 -0
- package/dist/models/country.d.ts +36 -0
- package/dist/models/country.js +57 -86
- package/dist/models/country.js.map +1 -0
- package/dist/models/currency.d.ts +25 -0
- package/dist/models/currency.js +37 -50
- package/dist/models/currency.js.map +1 -0
- package/dist/models/custom-shipping-option.d.ts +51 -0
- package/dist/models/custom-shipping-option.js +82 -129
- package/dist/models/custom-shipping-option.js.map +1 -0
- package/dist/models/customer.d.ts +60 -0
- package/dist/models/customer.js +99 -173
- package/dist/models/customer.js.map +1 -0
- package/dist/models/discount-rule.d.ts +72 -0
- package/dist/models/discount-rule.js +98 -149
- package/dist/models/discount-rule.js.map +1 -0
- package/dist/models/discount.d.ts +83 -0
- package/dist/models/discount.js +129 -210
- package/dist/models/discount.js.map +1 -0
- package/dist/models/draft-order.d.ts +71 -0
- package/dist/models/draft-order.js +154 -208
- package/dist/models/draft-order.js.map +1 -0
- package/dist/models/fulfillment-item.d.ts +29 -0
- package/dist/models/fulfillment-item.js +45 -70
- package/dist/models/fulfillment-item.js.map +1 -0
- package/dist/models/fulfillment-provider.d.ts +17 -0
- package/dist/models/fulfillment-provider.js +29 -40
- package/dist/models/fulfillment-provider.js.map +1 -0
- package/dist/models/fulfillment.d.ts +89 -0
- package/dist/models/fulfillment.js +128 -239
- package/dist/models/fulfillment.js.map +1 -0
- package/dist/models/gift-card-transaction.d.ts +39 -0
- package/dist/models/gift-card-transaction.js +68 -99
- package/dist/models/gift-card-transaction.js.map +1 -0
- package/dist/models/gift-card.d.ts +70 -0
- package/dist/models/gift-card.js +100 -157
- package/dist/models/gift-card.js.map +1 -0
- package/dist/models/idempotency-key.d.ts +13 -0
- package/dist/models/idempotency-key.js +73 -123
- package/dist/models/idempotency-key.js.map +1 -0
- package/dist/models/image.d.ts +37 -0
- package/dist/models/image.js +58 -88
- package/dist/models/image.js.map +1 -0
- package/dist/models/line-item.d.ts +111 -0
- package/dist/models/line-item.js +157 -281
- package/dist/models/line-item.js.map +1 -0
- package/dist/models/money-amount.d.ts +59 -0
- package/dist/models/money-amount.js +93 -154
- package/dist/models/money-amount.js.map +1 -0
- package/dist/models/note.d.ts +52 -0
- package/dist/models/note.js +80 -121
- package/dist/models/note.js.map +1 -0
- package/dist/models/notification-provider.d.ts +17 -0
- package/dist/models/notification-provider.js +29 -40
- package/dist/models/notification-provider.js.map +1 -0
- package/dist/models/notification.d.ts +110 -0
- package/dist/models/notification.js +104 -168
- package/dist/models/notification.js.map +1 -0
- package/dist/models/oauth.d.ts +9 -0
- package/dist/models/oauth.js +59 -87
- package/dist/models/oauth.js.map +1 -0
- package/dist/models/order.d.ts +245 -0
- package/dist/models/order.js +327 -528
- package/dist/models/order.js.map +1 -0
- package/dist/models/payment-provider.d.ts +17 -0
- package/dist/models/payment-provider.js +29 -40
- package/dist/models/payment-provider.js.map +1 -0
- package/dist/models/payment-session.d.ts +60 -0
- package/dist/models/payment-session.js +85 -133
- package/dist/models/payment-session.js.map +1 -0
- package/dist/models/payment.d.ts +79 -0
- package/dist/models/payment.js +122 -212
- package/dist/models/payment.js.map +1 -0
- package/dist/models/product-collection.d.ts +48 -0
- package/dist/models/product-collection.js +75 -117
- package/dist/models/product-collection.js.map +1 -0
- package/dist/models/product-option-value.d.ts +49 -0
- package/dist/models/product-option-value.js +83 -130
- package/dist/models/product-option-value.js.map +1 -0
- package/dist/models/product-option.d.ts +50 -0
- package/dist/models/product-option.js +73 -120
- package/dist/models/product-option.js.map +1 -0
- package/dist/models/product-tag.d.ts +37 -0
- package/dist/models/product-tag.js +58 -88
- package/dist/models/product-tag.js.map +1 -0
- package/dist/models/product-type.d.ts +37 -0
- package/dist/models/product-type.js +58 -88
- package/dist/models/product-type.js.map +1 -0
- package/dist/models/product-variant.d.ts +118 -0
- package/dist/models/product-variant.js +147 -285
- package/dist/models/product-variant.js.map +1 -0
- package/dist/models/product.d.ts +148 -0
- package/dist/models/product.js +204 -357
- package/dist/models/product.js.map +1 -0
- package/dist/models/refund.d.ts +60 -0
- package/dist/models/refund.js +81 -135
- package/dist/models/refund.js.map +1 -0
- package/dist/models/region.d.ts +72 -0
- package/dist/models/region.js +113 -181
- package/dist/models/region.js.map +1 -0
- package/dist/models/return-item.d.ts +56 -0
- package/dist/models/return-item.js +76 -136
- package/dist/models/return-item.js.map +1 -0
- package/dist/models/return-reason.d.ts +48 -0
- package/dist/models/return-reason.js +82 -136
- package/dist/models/return-reason.js.map +1 -0
- package/dist/models/return.d.ts +91 -0
- package/dist/models/return.js +126 -230
- package/dist/models/return.js.map +1 -0
- package/dist/models/shipping-method.d.ts +62 -0
- package/dist/models/shipping-method.js +114 -187
- package/dist/models/shipping-method.js.map +1 -0
- package/dist/models/shipping-option-requirement.d.ts +36 -0
- package/dist/models/shipping-option-requirement.js +64 -98
- package/dist/models/shipping-option-requirement.js.map +1 -0
- package/dist/models/shipping-option.d.ts +90 -0
- package/dist/models/shipping-option.js +120 -204
- package/dist/models/shipping-option.js.map +1 -0
- package/dist/models/shipping-profile.d.ts +65 -0
- package/dist/models/shipping-profile.js +76 -128
- package/dist/models/shipping-profile.js.map +1 -0
- package/dist/models/staged-job.d.ts +6 -0
- package/dist/models/staged-job.js +44 -61
- package/dist/models/staged-job.js.map +1 -0
- package/dist/models/store.d.ts +49 -0
- package/dist/models/store.js +85 -136
- package/dist/models/store.js.map +1 -0
- package/dist/models/swap.d.ts +147 -0
- package/dist/models/swap.js +158 -309
- package/dist/models/swap.js.map +1 -0
- package/dist/models/tracking-link.d.ts +48 -0
- package/dist/models/tracking-link.js +76 -124
- package/dist/models/tracking-link.js.map +1 -0
- package/dist/models/user.d.ts +43 -0
- package/dist/models/user.js +75 -123
- package/dist/models/user.js.map +1 -0
- package/dist/repositories/address.d.ts +4 -0
- package/dist/repositories/address.js +36 -38
- package/dist/repositories/address.js.map +1 -0
- package/dist/repositories/cart.d.ts +6 -0
- package/dist/repositories/cart.js +180 -184
- package/dist/repositories/cart.js.map +1 -0
- package/dist/repositories/claim-image.d.ts +4 -0
- package/dist/repositories/claim-image.js +36 -38
- package/dist/repositories/claim-image.js.map +1 -0
- package/dist/repositories/claim-item.d.ts +4 -0
- package/dist/repositories/claim-item.js +36 -38
- package/dist/repositories/claim-item.js.map +1 -0
- package/dist/repositories/claim-tag.d.ts +4 -0
- package/dist/repositories/claim-tag.js +36 -38
- package/dist/repositories/claim-tag.js.map +1 -0
- package/dist/repositories/claim.d.ts +4 -0
- package/dist/repositories/claim.js +36 -38
- package/dist/repositories/claim.js.map +1 -0
- package/dist/repositories/country.d.ts +4 -0
- package/dist/repositories/country.js +36 -38
- package/dist/repositories/country.js.map +1 -0
- package/dist/repositories/currency.d.ts +4 -0
- package/dist/repositories/currency.js +36 -38
- package/dist/repositories/currency.js.map +1 -0
- package/dist/repositories/custom-shipping-option.d.ts +4 -0
- package/dist/repositories/custom-shipping-option.js +36 -38
- package/dist/repositories/custom-shipping-option.js.map +1 -0
- package/dist/repositories/customer.d.ts +4 -0
- package/dist/repositories/customer.js +36 -38
- package/dist/repositories/customer.js.map +1 -0
- package/dist/repositories/discount-rule.d.ts +4 -0
- package/dist/repositories/discount-rule.js +36 -38
- package/dist/repositories/discount-rule.js.map +1 -0
- package/dist/repositories/discount.d.ts +4 -0
- package/dist/repositories/discount.js +36 -38
- package/dist/repositories/discount.js.map +1 -0
- package/dist/repositories/draft-order.d.ts +4 -0
- package/dist/repositories/draft-order.js +36 -38
- package/dist/repositories/draft-order.js.map +1 -0
- package/dist/repositories/fulfillment-provider.d.ts +4 -0
- package/dist/repositories/fulfillment-provider.js +36 -38
- package/dist/repositories/fulfillment-provider.js.map +1 -0
- package/dist/repositories/fulfillment.d.ts +4 -0
- package/dist/repositories/fulfillment.js +36 -38
- package/dist/repositories/fulfillment.js.map +1 -0
- package/dist/repositories/gift-card-transaction.d.ts +4 -0
- package/dist/repositories/gift-card-transaction.js +36 -38
- package/dist/repositories/gift-card-transaction.js.map +1 -0
- package/dist/repositories/gift-card.d.ts +6 -0
- package/dist/repositories/gift-card.js +187 -200
- package/dist/repositories/gift-card.js.map +1 -0
- package/dist/repositories/idempotency-key.d.ts +4 -0
- package/dist/repositories/idempotency-key.js +36 -38
- package/dist/repositories/idempotency-key.js.map +1 -0
- package/dist/repositories/image.d.ts +4 -0
- package/dist/repositories/image.js +36 -38
- package/dist/repositories/image.js.map +1 -0
- package/dist/repositories/line-item.d.ts +4 -0
- package/dist/repositories/line-item.js +36 -38
- package/dist/repositories/line-item.js.map +1 -0
- package/dist/repositories/money-amount.d.ts +4 -0
- package/dist/repositories/money-amount.js +36 -38
- package/dist/repositories/money-amount.js.map +1 -0
- package/dist/repositories/note.d.ts +4 -0
- package/dist/repositories/note.js +36 -38
- package/dist/repositories/note.js.map +1 -0
- package/dist/repositories/notification-provider.d.ts +4 -0
- package/dist/repositories/notification-provider.js +36 -38
- package/dist/repositories/notification-provider.js.map +1 -0
- package/dist/repositories/notification.d.ts +4 -0
- package/dist/repositories/notification.js +36 -38
- package/dist/repositories/notification.js.map +1 -0
- package/dist/repositories/oauth.d.ts +4 -0
- package/dist/repositories/oauth.js +36 -38
- package/dist/repositories/oauth.js.map +1 -0
- package/dist/repositories/order.d.ts +6 -0
- package/dist/repositories/order.js +178 -184
- package/dist/repositories/order.js.map +1 -0
- package/dist/repositories/payment-provider.d.ts +4 -0
- package/dist/repositories/payment-provider.js +36 -38
- package/dist/repositories/payment-provider.js.map +1 -0
- package/dist/repositories/payment-session.d.ts +4 -0
- package/dist/repositories/payment-session.js +36 -38
- package/dist/repositories/payment-session.js.map +1 -0
- package/dist/repositories/payment.d.ts +4 -0
- package/dist/repositories/payment.js +36 -38
- package/dist/repositories/payment.js.map +1 -0
- package/dist/repositories/product-collection.d.ts +4 -0
- package/dist/repositories/product-collection.js +36 -38
- package/dist/repositories/product-collection.js.map +1 -0
- package/dist/repositories/product-option-value.d.ts +4 -0
- package/dist/repositories/product-option-value.js +36 -38
- package/dist/repositories/product-option-value.js.map +1 -0
- package/dist/repositories/product-option.d.ts +4 -0
- package/dist/repositories/product-option.js +36 -38
- package/dist/repositories/product-option.js.map +1 -0
- package/dist/repositories/product-tag.d.ts +4 -0
- package/dist/repositories/product-tag.js +36 -38
- package/dist/repositories/product-tag.js.map +1 -0
- package/dist/repositories/product-type.d.ts +4 -0
- package/dist/repositories/product-type.js +36 -38
- package/dist/repositories/product-type.js.map +1 -0
- package/dist/repositories/product-variant.d.ts +4 -0
- package/dist/repositories/product-variant.js +36 -38
- package/dist/repositories/product-variant.js.map +1 -0
- package/dist/repositories/product.d.ts +24 -0
- package/dist/repositories/product.js +351 -264
- package/dist/repositories/product.js.map +1 -0
- package/dist/repositories/refund.d.ts +4 -0
- package/dist/repositories/refund.js +36 -38
- package/dist/repositories/refund.js.map +1 -0
- package/dist/repositories/region.d.ts +4 -0
- package/dist/repositories/region.js +36 -38
- package/dist/repositories/region.js.map +1 -0
- package/dist/repositories/return-item.d.ts +4 -0
- package/dist/repositories/return-item.js +36 -38
- package/dist/repositories/return-item.js.map +1 -0
- package/dist/repositories/return-reason.d.ts +4 -0
- package/dist/repositories/return-reason.js +36 -38
- package/dist/repositories/return-reason.js.map +1 -0
- package/dist/repositories/return.d.ts +4 -0
- package/dist/repositories/return.js +36 -38
- package/dist/repositories/return.js.map +1 -0
- package/dist/repositories/shipping-method.d.ts +4 -0
- package/dist/repositories/shipping-method.js +36 -38
- package/dist/repositories/shipping-method.js.map +1 -0
- package/dist/repositories/shipping-option-requirement.d.ts +4 -0
- package/dist/repositories/shipping-option-requirement.js +36 -38
- package/dist/repositories/shipping-option-requirement.js.map +1 -0
- package/dist/repositories/shipping-option.d.ts +4 -0
- package/dist/repositories/shipping-option.js +36 -38
- package/dist/repositories/shipping-option.js.map +1 -0
- package/dist/repositories/shipping-profile.d.ts +4 -0
- package/dist/repositories/shipping-profile.js +36 -38
- package/dist/repositories/shipping-profile.js.map +1 -0
- package/dist/repositories/staged-job.d.ts +4 -0
- package/dist/repositories/staged-job.js +36 -38
- package/dist/repositories/staged-job.js.map +1 -0
- package/dist/repositories/store.d.ts +4 -0
- package/dist/repositories/store.js +36 -38
- package/dist/repositories/store.js.map +1 -0
- package/dist/repositories/swap.d.ts +6 -0
- package/dist/repositories/swap.js +178 -184
- package/dist/repositories/swap.js.map +1 -0
- package/dist/repositories/tracking-link.d.ts +4 -0
- package/dist/repositories/tracking-link.js +36 -38
- package/dist/repositories/tracking-link.js.map +1 -0
- package/dist/repositories/user.d.ts +4 -0
- package/dist/repositories/user.js +36 -38
- package/dist/repositories/user.js.map +1 -0
- package/dist/scripts/mongo-sql-migration.d.ts +2 -0
- package/dist/scripts/mongo-sql-migration.js +1544 -2413
- package/dist/scripts/mongo-sql-migration.js.map +1 -0
- package/dist/services/auth.d.ts +51 -0
- package/dist/services/auth.js +197 -313
- package/dist/services/auth.js.map +1 -0
- package/dist/services/cart.d.ts +315 -0
- package/dist/services/cart.js +1989 -3283
- package/dist/services/cart.js.map +1 -0
- package/dist/services/claim-item.d.ts +52 -0
- package/dist/services/claim-item.js +382 -612
- package/dist/services/claim-item.js.map +1 -0
- package/dist/services/claim.d.ts +105 -0
- package/dist/services/claim.js +983 -1581
- package/dist/services/claim.js.map +1 -0
- package/dist/services/custom-shipping-option.d.ts +39 -0
- package/dist/services/custom-shipping-option.js +147 -232
- package/dist/services/custom-shipping-option.js.map +1 -0
- package/dist/services/customer.d.ts +135 -0
- package/dist/services/customer.js +657 -1164
- package/dist/services/customer.js.map +1 -0
- package/dist/services/discount.d.ts +140 -0
- package/dist/services/discount.js +633 -1169
- package/dist/services/discount.js.map +1 -0
- package/dist/services/draft-order.d.ts +99 -0
- package/dist/services/draft-order.js +488 -795
- package/dist/services/draft-order.js.map +1 -0
- package/dist/services/event-bus.d.ts +87 -0
- package/dist/services/event-bus.js +290 -420
- package/dist/services/event-bus.js.map +1 -0
- package/dist/services/fulfillment-provider.d.ts +32 -0
- package/dist/services/fulfillment-provider.js +211 -410
- package/dist/services/fulfillment-provider.js.map +1 -0
- package/dist/services/fulfillment.d.ts +101 -0
- package/dist/services/fulfillment.js +358 -569
- package/dist/services/fulfillment.js.map +1 -0
- package/dist/services/gift-card.d.ts +69 -0
- package/dist/services/gift-card.js +390 -619
- package/dist/services/gift-card.js.map +1 -0
- package/dist/services/idempotency-key.d.ts +64 -0
- package/dist/services/idempotency-key.js +289 -473
- package/dist/services/idempotency-key.js.map +1 -0
- package/dist/services/index.d.ts +37 -0
- package/dist/services/index.js +81 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/inventory.d.ts +30 -0
- package/dist/services/inventory.js +135 -193
- package/dist/services/inventory.js.map +1 -0
- package/dist/services/line-item.d.ts +64 -0
- package/dist/services/line-item.js +304 -477
- package/dist/services/line-item.js.map +1 -0
- package/dist/services/middleware.d.ts +56 -0
- package/dist/services/middleware.js +112 -122
- package/dist/services/middleware.js.map +1 -0
- package/dist/services/note.d.ts +67 -0
- package/dist/services/note.js +227 -390
- package/dist/services/note.js.map +1 -0
- package/dist/services/notification.d.ts +90 -0
- package/dist/services/notification.js +291 -435
- package/dist/services/notification.js.map +1 -0
- package/dist/services/oauth.d.ts +21 -0
- package/dist/services/oauth.js +181 -294
- package/dist/services/oauth.js.map +1 -0
- package/dist/services/order.d.ts +289 -0
- package/dist/services/order.js +1837 -2969
- package/dist/services/order.js.map +1 -0
- package/dist/services/payment-provider.d.ts +67 -0
- package/dist/services/payment-provider.js +572 -1115
- package/dist/services/payment-provider.js.map +1 -0
- package/dist/services/product-collection.d.ts +64 -0
- package/dist/services/product-collection.js +260 -353
- package/dist/services/product-collection.js.map +1 -0
- package/dist/services/product-variant.d.ts +141 -0
- package/dist/services/product-variant.js +712 -1330
- package/dist/services/product-variant.js.map +1 -0
- package/dist/services/product.d.ts +182 -0
- package/dist/services/product.js +1021 -1653
- package/dist/services/product.js.map +1 -0
- package/dist/services/query-builder.d.ts +10 -0
- package/dist/services/query-builder.js +71 -92
- package/dist/services/query-builder.js.map +1 -0
- package/dist/services/region.d.ts +149 -0
- package/dist/services/region.js +739 -1297
- package/dist/services/region.js.map +1 -0
- package/dist/services/return-reason.d.ts +30 -0
- package/dist/services/return-reason.js +188 -326
- package/dist/services/return-reason.js.map +1 -0
- package/dist/services/return.d.ts +122 -0
- package/dist/services/return.js +708 -1085
- package/dist/services/return.js.map +1 -0
- package/dist/services/search.d.ts +22 -0
- package/dist/services/search.js +54 -88
- package/dist/services/search.js.map +1 -0
- package/dist/services/shipping-option.d.ts +212 -0
- package/dist/services/shipping-option.js +729 -1352
- package/dist/services/shipping-option.js.map +1 -0
- package/dist/services/shipping-profile.d.ts +125 -0
- package/dist/services/shipping-profile.js +627 -1088
- package/dist/services/shipping-profile.js.map +1 -0
- package/dist/services/store.d.ts +67 -0
- package/dist/services/store.js +334 -548
- package/dist/services/store.js.map +1 -0
- package/dist/services/swap.d.ts +239 -0
- package/dist/services/swap.js +1445 -2322
- package/dist/services/swap.js.map +1 -0
- package/dist/services/system-payment-provider.d.ts +20 -0
- package/dist/services/system-payment-provider.js +132 -289
- package/dist/services/system-payment-provider.js.map +1 -0
- package/dist/services/totals.d.ts +94 -0
- package/dist/services/totals.js +378 -457
- package/dist/services/totals.js.map +1 -0
- package/dist/services/transaction.d.ts +6 -0
- package/dist/services/transaction.js +72 -69
- package/dist/services/transaction.js.map +1 -0
- package/dist/services/user.d.ts +110 -0
- package/dist/services/user.js +375 -696
- package/dist/services/user.js.map +1 -0
- package/dist/subscribers/notification.d.ts +10 -0
- package/dist/subscribers/notification.js +16 -28
- package/dist/subscribers/notification.js.map +1 -0
- package/dist/subscribers/order.d.ts +23 -0
- package/dist/subscribers/order.js +137 -183
- package/dist/subscribers/order.js.map +1 -0
- package/dist/subscribers/product.d.ts +16 -0
- package/dist/subscribers/product.js +149 -173
- package/dist/subscribers/product.js.map +1 -0
- package/dist/types/auth.d.ts +7 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/common.d.ts +65 -0
- package/dist/types/common.js +218 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/customers.d.ts +3 -0
- package/dist/types/customers.js +25 -0
- package/dist/types/customers.js.map +1 -0
- package/dist/types/discount.d.ts +8 -0
- package/dist/types/discount.js +10 -0
- package/dist/types/discount.js.map +1 -0
- package/dist/types/draft-orders.d.ts +3 -0
- package/dist/types/draft-orders.js +3 -0
- package/dist/types/draft-orders.js.map +1 -0
- package/dist/types/note.d.ts +15 -0
- package/dist/types/note.js +3 -0
- package/dist/types/note.js.map +1 -0
- package/dist/types/orders.d.ts +24 -0
- package/dist/types/orders.js +160 -0
- package/dist/types/orders.js.map +1 -0
- package/dist/types/product-variant.d.ts +79 -0
- package/dist/types/product-variant.js +107 -0
- package/dist/types/product-variant.js.map +1 -0
- package/dist/types/user.d.ts +19 -0
- package/dist/types/user.js +3 -0
- package/dist/types/user.js.map +1 -0
- package/dist/types/validators/xor.d.ts +5 -0
- package/dist/types/validators/xor.js +29 -0
- package/dist/types/validators/xor.js.map +1 -0
- package/dist/utils/countries.d.ts +6 -0
- package/dist/utils/countries.js +404 -1256
- package/dist/utils/countries.js.map +1 -0
- package/dist/utils/currencies.d.ts +1899 -0
- package/dist/utils/currencies.js +1074 -1077
- package/dist/utils/currencies.js.map +1 -0
- package/dist/utils/db-aware-column.d.ts +4 -0
- package/dist/utils/db-aware-column.js +53 -69
- package/dist/utils/db-aware-column.js.map +1 -0
- package/dist/utils/format-registration-name.d.ts +9 -0
- package/dist/utils/format-registration-name.js +31 -45
- package/dist/utils/format-registration-name.js.map +1 -0
- package/dist/utils/manual-auto-increment.d.ts +1 -0
- package/dist/utils/manual-auto-increment.js +89 -66
- package/dist/utils/manual-auto-increment.js.map +1 -0
- package/dist/utils/naming-strategy.d.ts +4 -0
- package/dist/utils/naming-strategy.js +34 -47
- package/dist/utils/naming-strategy.js.map +1 -0
- package/dist/utils/validator.d.ts +3 -0
- package/dist/utils/validator.js +135 -0
- package/dist/utils/validator.js.map +1 -0
- package/dist/utils/validators/date-transform.d.ts +3 -0
- package/dist/utils/validators/date-transform.js +9 -0
- package/dist/utils/validators/date-transform.js.map +1 -0
- package/dist/utils/validators/greater-than.d.ts +2 -0
- package/dist/utils/validators/greater-than.js +43 -0
- package/dist/utils/validators/greater-than.js.map +1 -0
- package/dist/utils/validators/is-type.d.ts +2 -0
- package/dist/utils/validators/is-type.js +152 -0
- package/dist/utils/validators/is-type.js.map +1 -0
- package/dist/utils/validators/iso8601-duration.d.ts +2 -0
- package/dist/utils/validators/iso8601-duration.js +25 -0
- package/dist/utils/validators/iso8601-duration.js.map +1 -0
- package/index.d.ts +1 -0
- package/package.json +15 -10
- package/dist/repositories/__mocks__/cart.js +0 -439
- package/dist/repositories/__mocks__/customer.js +0 -64
- package/dist/repositories/__mocks__/discount.js +0 -179
- package/dist/repositories/__mocks__/document.js +0 -21
- package/dist/repositories/__mocks__/dynamic-discount-code.js +0 -34
- package/dist/repositories/__mocks__/order.js +0 -500
- package/dist/repositories/__mocks__/product-variant.js +0 -117
- package/dist/repositories/__mocks__/product.js +0 -117
- package/dist/repositories/__mocks__/region.js +0 -79
- package/dist/repositories/__mocks__/shipping-option.js +0 -67
- package/dist/repositories/__mocks__/shipping-profile.js +0 -64
- package/dist/repositories/__mocks__/store.js +0 -25
- package/dist/repositories/__mocks__/user.js +0 -41
- package/dist/services/__mocks__/auth.js +0 -32
- package/dist/services/__mocks__/cart.js +0 -405
- package/dist/services/__mocks__/claim.js +0 -35
- package/dist/services/__mocks__/customer.js +0 -88
- package/dist/services/__mocks__/discount.js +0 -197
- package/dist/services/__mocks__/document.js +0 -28
- package/dist/services/__mocks__/event-bus.js +0 -19
- package/dist/services/__mocks__/fulfillment-provider.js +0 -85
- package/dist/services/__mocks__/fulfillment.js +0 -43
- package/dist/services/__mocks__/idempotency-key.js +0 -93
- package/dist/services/__mocks__/inventory.js +0 -25
- package/dist/services/__mocks__/line-item.js +0 -70
- package/dist/services/__mocks__/middleware.js +0 -18
- package/dist/services/__mocks__/order.js +0 -233
- package/dist/services/__mocks__/payment-provider.js +0 -67
- package/dist/services/__mocks__/product-collection.js +0 -54
- package/dist/services/__mocks__/product-variant.js +0 -292
- package/dist/services/__mocks__/product.js +0 -199
- package/dist/services/__mocks__/query-builder.js +0 -17
- package/dist/services/__mocks__/region.js +0 -114
- package/dist/services/__mocks__/return.js +0 -36
- package/dist/services/__mocks__/shipping-option.js +0 -154
- package/dist/services/__mocks__/shipping-profile.js +0 -173
- package/dist/services/__mocks__/store.js +0 -35
- package/dist/services/__mocks__/swap.js +0 -59
- package/dist/services/__mocks__/totals.js +0 -45
- package/dist/services/__mocks__/user.js +0 -134
- package/yarn-error.log +0 -8319
|
@@ -1,137 +1,166 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (_) try {
|
|
44
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
65
|
+
var t = {};
|
|
66
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
67
|
+
t[p] = s[p];
|
|
68
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
69
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
71
|
+
t[p[i]] = s[p[i]];
|
|
72
|
+
}
|
|
73
|
+
return t;
|
|
74
|
+
};
|
|
75
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
76
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
77
|
+
if (!m) return o;
|
|
78
|
+
var i = m.call(o), r, ar = [], e;
|
|
79
|
+
try {
|
|
80
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
81
|
+
}
|
|
82
|
+
catch (error) { e = { error: error }; }
|
|
83
|
+
finally {
|
|
84
|
+
try {
|
|
85
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
86
|
+
}
|
|
87
|
+
finally { if (e) throw e.error; }
|
|
88
|
+
}
|
|
89
|
+
return ar;
|
|
90
|
+
};
|
|
91
|
+
var __values = (this && this.__values) || function(o) {
|
|
92
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
93
|
+
if (m) return m.call(o);
|
|
94
|
+
if (o && typeof o.length === "number") return {
|
|
95
|
+
next: function () {
|
|
96
|
+
if (o && i >= o.length) o = void 0;
|
|
97
|
+
return { value: o && o[i++], done: !o };
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
101
|
+
};
|
|
102
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
103
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
104
|
+
};
|
|
105
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
106
|
+
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
107
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
108
|
+
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
109
|
+
var medusa_interfaces_1 = require("medusa-interfaces");
|
|
110
|
+
var scrypt_kdf_1 = __importDefault(require("scrypt-kdf"));
|
|
111
|
+
var typeorm_1 = require("typeorm");
|
|
52
112
|
/**
|
|
53
113
|
* Provides layer to manipulate customers.
|
|
54
114
|
* @implements {BaseService}
|
|
55
115
|
*/
|
|
56
|
-
var CustomerService =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/** @private @const {EntityManager} */
|
|
71
|
-
|
|
72
|
-
_this.manager_ = manager;
|
|
73
|
-
/** @private @const {CustomerRepository} */
|
|
74
|
-
|
|
75
|
-
_this.customerRepository_ = customerRepository;
|
|
76
|
-
/** @private @const {EventBus} */
|
|
77
|
-
|
|
78
|
-
_this.eventBus_ = eventBusService;
|
|
79
|
-
/** @private @const {AddressRepository} */
|
|
80
|
-
|
|
81
|
-
_this.addressRepository_ = addressRepository;
|
|
82
|
-
return _this;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
(0, _createClass2["default"])(CustomerService, [{
|
|
86
|
-
key: "withTransaction",
|
|
87
|
-
value: function withTransaction(transactionManager) {
|
|
88
|
-
if (!transactionManager) {
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var cloned = new CustomerService({
|
|
93
|
-
manager: transactionManager,
|
|
94
|
-
customerRepository: this.customerRepository_,
|
|
95
|
-
eventBusService: this.eventBus_,
|
|
96
|
-
addressRepository: this.addressRepository_
|
|
97
|
-
});
|
|
98
|
-
cloned.transactionManager_ = transactionManager;
|
|
99
|
-
return cloned;
|
|
116
|
+
var CustomerService = /** @class */ (function (_super) {
|
|
117
|
+
__extends(CustomerService, _super);
|
|
118
|
+
function CustomerService(_a) {
|
|
119
|
+
var manager = _a.manager, customerRepository = _a.customerRepository, eventBusService = _a.eventBusService, addressRepository = _a.addressRepository;
|
|
120
|
+
var _this = _super.call(this) || this;
|
|
121
|
+
/** @private @const {EntityManager} */
|
|
122
|
+
_this.manager_ = manager;
|
|
123
|
+
/** @private @const {CustomerRepository} */
|
|
124
|
+
_this.customerRepository_ = customerRepository;
|
|
125
|
+
/** @private @const {EventBus} */
|
|
126
|
+
_this.eventBus_ = eventBusService;
|
|
127
|
+
/** @private @const {AddressRepository} */
|
|
128
|
+
_this.addressRepository_ = addressRepository;
|
|
129
|
+
return _this;
|
|
100
130
|
}
|
|
131
|
+
CustomerService.prototype.withTransaction = function (transactionManager) {
|
|
132
|
+
if (!transactionManager) {
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
var cloned = new CustomerService({
|
|
136
|
+
manager: transactionManager,
|
|
137
|
+
customerRepository: this.customerRepository_,
|
|
138
|
+
eventBusService: this.eventBus_,
|
|
139
|
+
addressRepository: this.addressRepository_,
|
|
140
|
+
});
|
|
141
|
+
cloned.transactionManager_ = transactionManager;
|
|
142
|
+
return cloned;
|
|
143
|
+
};
|
|
101
144
|
/**
|
|
102
145
|
* Used to validate customer email.
|
|
103
146
|
* @param {string} email - email to validate
|
|
104
147
|
* @return {string} the validated email
|
|
105
148
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}, {
|
|
123
|
-
key: "validateBillingAddress_",
|
|
124
|
-
value: function validateBillingAddress_(address) {
|
|
125
|
-
var _Validator$address$va = _medusaCoreUtils.Validator.address().validate(address),
|
|
126
|
-
value = _Validator$address$va.value,
|
|
127
|
-
error = _Validator$address$va.error;
|
|
128
|
-
|
|
129
|
-
if (error) {
|
|
130
|
-
throw new _medusaCoreUtils.MedusaError(_medusaCoreUtils.MedusaError.Types.INVALID_DATA, "The address is not valid");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
149
|
+
CustomerService.prototype.validateEmail_ = function (email) {
|
|
150
|
+
var schema = medusa_core_utils_1.Validator.string().email().required();
|
|
151
|
+
var _a = schema.validate(email), value = _a.value, error = _a.error;
|
|
152
|
+
if (error) {
|
|
153
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "The email is not valid");
|
|
154
|
+
}
|
|
155
|
+
return value.toLowerCase();
|
|
156
|
+
};
|
|
157
|
+
CustomerService.prototype.validateBillingAddress_ = function (address) {
|
|
158
|
+
var _a = medusa_core_utils_1.Validator.address().validate(address), value = _a.value, error = _a.error;
|
|
159
|
+
if (error) {
|
|
160
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "The address is not valid");
|
|
161
|
+
}
|
|
162
|
+
return value;
|
|
163
|
+
};
|
|
135
164
|
/**
|
|
136
165
|
* Generate a JSON Web token, that will be sent to a customer, that wishes to
|
|
137
166
|
* reset password.
|
|
@@ -141,434 +170,224 @@ var CustomerService = /*#__PURE__*/function (_BaseService) {
|
|
|
141
170
|
* @param {string} customerId - the customer to reset the password for
|
|
142
171
|
* @return {string} the generated JSON web token
|
|
143
172
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
173
|
+
CustomerService.prototype.generateResetPasswordToken = function (customerId) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
+
var customer, secret, expiry, payload, token;
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0: return [4 /*yield*/, this.retrieve(customerId, {
|
|
179
|
+
select: [
|
|
180
|
+
"id",
|
|
181
|
+
"has_account",
|
|
182
|
+
"password_hash",
|
|
183
|
+
"email",
|
|
184
|
+
"first_name",
|
|
185
|
+
"last_name",
|
|
186
|
+
],
|
|
187
|
+
})];
|
|
188
|
+
case 1:
|
|
189
|
+
customer = _a.sent();
|
|
190
|
+
if (!customer.has_account) {
|
|
191
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_ALLOWED, "You must have an account to reset the password. Create an account first");
|
|
192
|
+
}
|
|
193
|
+
secret = customer.password_hash;
|
|
194
|
+
expiry = Math.floor(Date.now() / 1000) + 60 * 15 // 15 minutes ahead
|
|
195
|
+
;
|
|
196
|
+
payload = { customer_id: customer.id, exp: expiry };
|
|
197
|
+
token = jsonwebtoken_1.default.sign(payload, secret);
|
|
198
|
+
// Notify subscribers
|
|
199
|
+
this.eventBus_.emit(CustomerService.Events.PASSWORD_RESET, {
|
|
200
|
+
id: customerId,
|
|
201
|
+
email: customer.email,
|
|
202
|
+
first_name: customer.first_name,
|
|
203
|
+
last_name: customer.last_name,
|
|
204
|
+
token: token,
|
|
205
|
+
});
|
|
206
|
+
return [2 /*return*/, token];
|
|
165
207
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
case 5:
|
|
170
|
-
secret = customer.password_hash;
|
|
171
|
-
expiry = Math.floor(Date.now() / 1000) + 60 * 15; // 15 minutes ahead
|
|
172
|
-
|
|
173
|
-
payload = {
|
|
174
|
-
customer_id: customer.id,
|
|
175
|
-
exp: expiry
|
|
176
|
-
};
|
|
177
|
-
token = _jsonwebtoken["default"].sign(payload, secret); // Notify subscribers
|
|
178
|
-
|
|
179
|
-
this.eventBus_.emit(CustomerService.Events.PASSWORD_RESET, {
|
|
180
|
-
id: customerId,
|
|
181
|
-
email: customer.email,
|
|
182
|
-
first_name: customer.first_name,
|
|
183
|
-
last_name: customer.last_name,
|
|
184
|
-
token: token
|
|
185
|
-
});
|
|
186
|
-
return _context.abrupt("return", token);
|
|
187
|
-
|
|
188
|
-
case 11:
|
|
189
|
-
case "end":
|
|
190
|
-
return _context.stop();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}, _callee, this);
|
|
194
|
-
}));
|
|
195
|
-
|
|
196
|
-
function generateResetPasswordToken(_x) {
|
|
197
|
-
return _generateResetPasswordToken.apply(this, arguments);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return generateResetPasswordToken;
|
|
201
|
-
}()
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
};
|
|
202
211
|
/**
|
|
203
212
|
* @param {Object} selector - the query object for find
|
|
204
213
|
* @param {Object} config - the config object containing query settings
|
|
205
214
|
* @return {Promise} the result of the find operation
|
|
206
215
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
config,
|
|
214
|
-
customerRepo,
|
|
215
|
-
q,
|
|
216
|
-
query,
|
|
217
|
-
where,
|
|
218
|
-
_args2 = arguments;
|
|
219
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
220
|
-
while (1) {
|
|
221
|
-
switch (_context2.prev = _context2.next) {
|
|
222
|
-
case 0:
|
|
223
|
-
selector = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
224
|
-
config = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {
|
|
225
|
-
relations: [],
|
|
226
|
-
skip: 0,
|
|
227
|
-
take: 50
|
|
228
|
-
};
|
|
216
|
+
CustomerService.prototype.list = function (selector, config) {
|
|
217
|
+
if (selector === void 0) { selector = {}; }
|
|
218
|
+
if (config === void 0) { config = { relations: [], skip: 0, take: 50 }; }
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
var customerRepo, q, query, where_1;
|
|
221
|
+
return __generator(this, function (_a) {
|
|
229
222
|
customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
230
|
-
|
|
231
223
|
if ("q" in selector) {
|
|
232
|
-
|
|
233
|
-
|
|
224
|
+
q = selector.q;
|
|
225
|
+
delete selector.q;
|
|
234
226
|
}
|
|
235
|
-
|
|
236
227
|
query = this.buildQuery_(selector, config);
|
|
237
|
-
|
|
238
228
|
if (q) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}).orWhere({
|
|
252
|
-
last_name: (0, _typeorm.ILike)("%".concat(q, "%"))
|
|
253
|
-
});
|
|
254
|
-
}));
|
|
255
|
-
};
|
|
229
|
+
where_1 = query.where;
|
|
230
|
+
delete where_1.email;
|
|
231
|
+
delete where_1.first_name;
|
|
232
|
+
delete where_1.last_name;
|
|
233
|
+
query.where = function (qb) {
|
|
234
|
+
qb.where(where_1);
|
|
235
|
+
qb.andWhere(new typeorm_1.Brackets(function (qb) {
|
|
236
|
+
qb.where({ email: (0, typeorm_1.ILike)("%".concat(q, "%")) })
|
|
237
|
+
.orWhere({ first_name: (0, typeorm_1.ILike)("%".concat(q, "%")) })
|
|
238
|
+
.orWhere({ last_name: (0, typeorm_1.ILike)("%".concat(q, "%")) });
|
|
239
|
+
}));
|
|
240
|
+
};
|
|
256
241
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
order: {
|
|
298
|
-
created_at: "DESC"
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
302
|
-
|
|
303
|
-
if ("q" in selector) {
|
|
304
|
-
q = selector.q;
|
|
305
|
-
delete selector.q;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
query = this.buildQuery_(selector, config);
|
|
309
|
-
|
|
310
|
-
if (q) {
|
|
311
|
-
where = query.where;
|
|
312
|
-
delete where.email;
|
|
313
|
-
delete where.first_name;
|
|
314
|
-
delete where.last_name;
|
|
315
|
-
|
|
316
|
-
query.where = function (qb) {
|
|
317
|
-
qb.where(where);
|
|
318
|
-
qb.andWhere(new _typeorm.Brackets(function (qb) {
|
|
319
|
-
qb.where({
|
|
320
|
-
email: (0, _typeorm.ILike)("%".concat(q, "%"))
|
|
321
|
-
}).orWhere({
|
|
322
|
-
first_name: (0, _typeorm.ILike)("%".concat(q, "%"))
|
|
323
|
-
}).orWhere({
|
|
324
|
-
last_name: (0, _typeorm.ILike)("%".concat(q, "%"))
|
|
325
|
-
});
|
|
326
|
-
}));
|
|
327
|
-
};
|
|
242
|
+
return [2 /*return*/, customerRepo.find(query)];
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* @param {Object} selector - the query object for find
|
|
248
|
+
* @param {FindConfig<Customer>} config - the config object containing query settings
|
|
249
|
+
* @return {Promise} the result of the find operation
|
|
250
|
+
*/
|
|
251
|
+
CustomerService.prototype.listAndCount = function (selector, config) {
|
|
252
|
+
if (config === void 0) { config = { relations: [], skip: 0, take: 50, order: { created_at: "DESC" } }; }
|
|
253
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
254
|
+
var customerRepo, q, query, where_2, _a, customers, count;
|
|
255
|
+
return __generator(this, function (_b) {
|
|
256
|
+
switch (_b.label) {
|
|
257
|
+
case 0:
|
|
258
|
+
customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
259
|
+
if ("q" in selector) {
|
|
260
|
+
q = selector.q;
|
|
261
|
+
delete selector.q;
|
|
262
|
+
}
|
|
263
|
+
query = this.buildQuery_(selector, config);
|
|
264
|
+
if (q) {
|
|
265
|
+
where_2 = query.where;
|
|
266
|
+
delete where_2.email;
|
|
267
|
+
delete where_2.first_name;
|
|
268
|
+
delete where_2.last_name;
|
|
269
|
+
query.where = function (qb) {
|
|
270
|
+
qb.where(where_2);
|
|
271
|
+
qb.andWhere(new typeorm_1.Brackets(function (qb) {
|
|
272
|
+
qb.where({ email: (0, typeorm_1.ILike)("%".concat(q, "%")) })
|
|
273
|
+
.orWhere({ first_name: (0, typeorm_1.ILike)("%".concat(q, "%")) })
|
|
274
|
+
.orWhere({ last_name: (0, typeorm_1.ILike)("%".concat(q, "%")) });
|
|
275
|
+
}));
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return [4 /*yield*/, customerRepo.findAndCount(query)];
|
|
279
|
+
case 1:
|
|
280
|
+
_a = __read.apply(void 0, [_b.sent(), 2]), customers = _a[0], count = _a[1];
|
|
281
|
+
return [2 /*return*/, [customers, count]];
|
|
328
282
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
case 7:
|
|
334
|
-
_yield$customerRepo$f = _context3.sent;
|
|
335
|
-
_yield$customerRepo$f2 = (0, _slicedToArray2["default"])(_yield$customerRepo$f, 2);
|
|
336
|
-
customers = _yield$customerRepo$f2[0];
|
|
337
|
-
count = _yield$customerRepo$f2[1];
|
|
338
|
-
return _context3.abrupt("return", [customers, count]);
|
|
339
|
-
|
|
340
|
-
case 12:
|
|
341
|
-
case "end":
|
|
342
|
-
return _context3.stop();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}, _callee3, this);
|
|
346
|
-
}));
|
|
347
|
-
|
|
348
|
-
function listAndCount(_x2) {
|
|
349
|
-
return _listAndCount.apply(this, arguments);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
return listAndCount;
|
|
353
|
-
}()
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
};
|
|
354
286
|
/**
|
|
355
287
|
* Return the total number of documents in database
|
|
356
288
|
* @return {Promise} the result of the count operation
|
|
357
289
|
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
var customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
363
|
-
return customerRepo.count({});
|
|
364
|
-
}
|
|
290
|
+
CustomerService.prototype.count = function () {
|
|
291
|
+
var customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
292
|
+
return customerRepo.count({});
|
|
293
|
+
};
|
|
365
294
|
/**
|
|
366
295
|
* Gets a customer by id.
|
|
367
296
|
* @param {string} customerId - the id of the customer to get.
|
|
368
297
|
* @param {Object} config - the config object containing query settings
|
|
369
298
|
* @return {Promise<Customer>} the customer document.
|
|
370
299
|
*/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
validatedId = this.validateId_(customerId);
|
|
389
|
-
query = this.buildQuery_({
|
|
390
|
-
id: validatedId
|
|
391
|
-
}, config);
|
|
392
|
-
_context4.next = 6;
|
|
393
|
-
return customerRepo.findOne(query);
|
|
394
|
-
|
|
395
|
-
case 6:
|
|
396
|
-
customer = _context4.sent;
|
|
397
|
-
|
|
398
|
-
if (customer) {
|
|
399
|
-
_context4.next = 9;
|
|
400
|
-
break;
|
|
300
|
+
CustomerService.prototype.retrieve = function (customerId, config) {
|
|
301
|
+
if (config === void 0) { config = {}; }
|
|
302
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
303
|
+
var customerRepo, validatedId, query, customer;
|
|
304
|
+
return __generator(this, function (_a) {
|
|
305
|
+
switch (_a.label) {
|
|
306
|
+
case 0:
|
|
307
|
+
customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
308
|
+
validatedId = this.validateId_(customerId);
|
|
309
|
+
query = this.buildQuery_({ id: validatedId }, config);
|
|
310
|
+
return [4 /*yield*/, customerRepo.findOne(query)];
|
|
311
|
+
case 1:
|
|
312
|
+
customer = _a.sent();
|
|
313
|
+
if (!customer) {
|
|
314
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "Customer with ".concat(customerId, " was not found"));
|
|
315
|
+
}
|
|
316
|
+
return [2 /*return*/, customer];
|
|
401
317
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
case 9:
|
|
406
|
-
return _context4.abrupt("return", customer);
|
|
407
|
-
|
|
408
|
-
case 10:
|
|
409
|
-
case "end":
|
|
410
|
-
return _context4.stop();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}, _callee4, this);
|
|
414
|
-
}));
|
|
415
|
-
|
|
416
|
-
function retrieve(_x3) {
|
|
417
|
-
return _retrieve.apply(this, arguments);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return retrieve;
|
|
421
|
-
}()
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
};
|
|
422
321
|
/**
|
|
423
322
|
* Gets a customer by email.
|
|
424
323
|
* @param {string} email - the email of the customer to get.
|
|
425
324
|
* @param {Object} config - the config object containing query settings
|
|
426
325
|
* @return {Promise<Customer>} the customer document.
|
|
427
326
|
*/
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
query = this.buildQuery_({
|
|
445
|
-
email: email.toLowerCase()
|
|
446
|
-
}, config);
|
|
447
|
-
_context5.next = 5;
|
|
448
|
-
return customerRepo.findOne(query);
|
|
449
|
-
|
|
450
|
-
case 5:
|
|
451
|
-
customer = _context5.sent;
|
|
452
|
-
|
|
453
|
-
if (customer) {
|
|
454
|
-
_context5.next = 8;
|
|
455
|
-
break;
|
|
327
|
+
CustomerService.prototype.retrieveByEmail = function (email, config) {
|
|
328
|
+
if (config === void 0) { config = {}; }
|
|
329
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
330
|
+
var customerRepo, query, customer;
|
|
331
|
+
return __generator(this, function (_a) {
|
|
332
|
+
switch (_a.label) {
|
|
333
|
+
case 0:
|
|
334
|
+
customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
335
|
+
query = this.buildQuery_({ email: email.toLowerCase() }, config);
|
|
336
|
+
return [4 /*yield*/, customerRepo.findOne(query)];
|
|
337
|
+
case 1:
|
|
338
|
+
customer = _a.sent();
|
|
339
|
+
if (!customer) {
|
|
340
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "Customer with email ".concat(email, " was not found"));
|
|
341
|
+
}
|
|
342
|
+
return [2 /*return*/, customer];
|
|
456
343
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
case 8:
|
|
461
|
-
return _context5.abrupt("return", customer);
|
|
462
|
-
|
|
463
|
-
case 9:
|
|
464
|
-
case "end":
|
|
465
|
-
return _context5.stop();
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}, _callee5, this);
|
|
469
|
-
}));
|
|
470
|
-
|
|
471
|
-
function retrieveByEmail(_x4) {
|
|
472
|
-
return _retrieveByEmail.apply(this, arguments);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
return retrieveByEmail;
|
|
476
|
-
}()
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
};
|
|
477
347
|
/**
|
|
478
348
|
* Gets a customer by phone.
|
|
479
349
|
* @param {string} phone - the phone of the customer to get.
|
|
480
350
|
* @param {Object} config - the config object containing query settings
|
|
481
351
|
* @return {Promise<Customer>} the customer document.
|
|
482
352
|
*/
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
query = this.buildQuery_({
|
|
500
|
-
phone: phone
|
|
501
|
-
}, config);
|
|
502
|
-
_context6.next = 5;
|
|
503
|
-
return customerRepo.findOne(query);
|
|
504
|
-
|
|
505
|
-
case 5:
|
|
506
|
-
customer = _context6.sent;
|
|
507
|
-
|
|
508
|
-
if (customer) {
|
|
509
|
-
_context6.next = 8;
|
|
510
|
-
break;
|
|
353
|
+
CustomerService.prototype.retrieveByPhone = function (phone, config) {
|
|
354
|
+
if (config === void 0) { config = {}; }
|
|
355
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
356
|
+
var customerRepo, query, customer;
|
|
357
|
+
return __generator(this, function (_a) {
|
|
358
|
+
switch (_a.label) {
|
|
359
|
+
case 0:
|
|
360
|
+
customerRepo = this.manager_.getCustomRepository(this.customerRepository_);
|
|
361
|
+
query = this.buildQuery_({ phone: phone }, config);
|
|
362
|
+
return [4 /*yield*/, customerRepo.findOne(query)];
|
|
363
|
+
case 1:
|
|
364
|
+
customer = _a.sent();
|
|
365
|
+
if (!customer) {
|
|
366
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "Customer with phone ".concat(phone, " was not found"));
|
|
367
|
+
}
|
|
368
|
+
return [2 /*return*/, customer];
|
|
511
369
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
case 8:
|
|
516
|
-
return _context6.abrupt("return", customer);
|
|
517
|
-
|
|
518
|
-
case 9:
|
|
519
|
-
case "end":
|
|
520
|
-
return _context6.stop();
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}, _callee6, this);
|
|
524
|
-
}));
|
|
525
|
-
|
|
526
|
-
function retrieveByPhone(_x5) {
|
|
527
|
-
return _retrieveByPhone.apply(this, arguments);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
return retrieveByPhone;
|
|
531
|
-
}()
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
};
|
|
532
373
|
/**
|
|
533
374
|
* Hashes a password
|
|
534
375
|
* @param {string} password - the value to hash
|
|
535
376
|
* @return {Promise<string>} hashed password
|
|
536
377
|
*/
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
r: 1,
|
|
551
|
-
p: 1
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
case 2:
|
|
555
|
-
buf = _context7.sent;
|
|
556
|
-
return _context7.abrupt("return", buf.toString("base64"));
|
|
557
|
-
|
|
558
|
-
case 4:
|
|
559
|
-
case "end":
|
|
560
|
-
return _context7.stop();
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}, _callee7);
|
|
564
|
-
}));
|
|
565
|
-
|
|
566
|
-
function hashPassword_(_x6) {
|
|
567
|
-
return _hashPassword_.apply(this, arguments);
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
return hashPassword_;
|
|
571
|
-
}()
|
|
378
|
+
CustomerService.prototype.hashPassword_ = function (password) {
|
|
379
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
380
|
+
var buf;
|
|
381
|
+
return __generator(this, function (_a) {
|
|
382
|
+
switch (_a.label) {
|
|
383
|
+
case 0: return [4 /*yield*/, scrypt_kdf_1.default.kdf(password, { logN: 1, r: 1, p: 1 })];
|
|
384
|
+
case 1:
|
|
385
|
+
buf = _a.sent();
|
|
386
|
+
return [2 /*return*/, buf.toString("base64")];
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
};
|
|
572
391
|
/**
|
|
573
392
|
* Creates a customer from an email - customers can have accounts associated,
|
|
574
393
|
* e.g. to login and view order history, etc. If a password is provided the
|
|
@@ -577,133 +396,71 @@ var CustomerService = /*#__PURE__*/function (_BaseService) {
|
|
|
577
396
|
* @param {object} customer - the customer to create
|
|
578
397
|
* @return {Promise} the result of create
|
|
579
398
|
*/
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
399
|
+
CustomerService.prototype.create = function (customer) {
|
|
400
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
401
|
+
var _this = this;
|
|
402
|
+
return __generator(this, function (_a) {
|
|
403
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
404
|
+
var customerRepository, email, billing_address, password, existing, hashedPassword, toUpdate, updated, hashedPassword, created, result;
|
|
405
|
+
return __generator(this, function (_a) {
|
|
406
|
+
switch (_a.label) {
|
|
407
|
+
case 0:
|
|
408
|
+
customerRepository = manager.getCustomRepository(this.customerRepository_);
|
|
409
|
+
email = customer.email, billing_address = customer.billing_address, password = customer.password;
|
|
410
|
+
customer.email = this.validateEmail_(email);
|
|
411
|
+
if (billing_address) {
|
|
412
|
+
customer.billing_address = this.validateBillingAddress_(billing_address);
|
|
413
|
+
}
|
|
414
|
+
return [4 /*yield*/, this.retrieveByEmail(email).catch(function (err) { return undefined; })];
|
|
415
|
+
case 1:
|
|
416
|
+
existing = _a.sent();
|
|
417
|
+
if (existing && existing.has_account) {
|
|
418
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.DUPLICATE_ERROR, "A customer with the given email already has an account. Log in instead");
|
|
419
|
+
}
|
|
420
|
+
if (!(existing && password && !existing.has_account)) return [3 /*break*/, 5];
|
|
421
|
+
return [4 /*yield*/, this.hashPassword_(password)];
|
|
422
|
+
case 2:
|
|
423
|
+
hashedPassword = _a.sent();
|
|
424
|
+
customer.password_hash = hashedPassword;
|
|
425
|
+
customer.has_account = true;
|
|
426
|
+
delete customer.password;
|
|
427
|
+
toUpdate = __assign(__assign({}, existing), customer);
|
|
428
|
+
return [4 /*yield*/, customerRepository.save(toUpdate)];
|
|
429
|
+
case 3:
|
|
430
|
+
updated = _a.sent();
|
|
431
|
+
return [4 /*yield*/, this.eventBus_
|
|
432
|
+
.withTransaction(manager)
|
|
433
|
+
.emit(CustomerService.Events.UPDATED, updated)];
|
|
434
|
+
case 4:
|
|
435
|
+
_a.sent();
|
|
436
|
+
return [2 /*return*/, updated];
|
|
437
|
+
case 5:
|
|
438
|
+
if (!password) return [3 /*break*/, 7];
|
|
439
|
+
return [4 /*yield*/, this.hashPassword_(password)];
|
|
440
|
+
case 6:
|
|
441
|
+
hashedPassword = _a.sent();
|
|
442
|
+
customer.password_hash = hashedPassword;
|
|
443
|
+
customer.has_account = true;
|
|
444
|
+
delete customer.password;
|
|
445
|
+
_a.label = 7;
|
|
446
|
+
case 7: return [4 /*yield*/, customerRepository.create(customer)];
|
|
447
|
+
case 8:
|
|
448
|
+
created = _a.sent();
|
|
449
|
+
return [4 /*yield*/, customerRepository.save(created)];
|
|
450
|
+
case 9:
|
|
451
|
+
result = _a.sent();
|
|
452
|
+
return [4 /*yield*/, this.eventBus_
|
|
453
|
+
.withTransaction(manager)
|
|
454
|
+
.emit(CustomerService.Events.CREATED, result)];
|
|
455
|
+
case 10:
|
|
456
|
+
_a.sent();
|
|
457
|
+
return [2 /*return*/, result];
|
|
618
458
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
_context8.next = 25;
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
_context8.next = 12;
|
|
629
|
-
return _this2.hashPassword_(password);
|
|
630
|
-
|
|
631
|
-
case 12:
|
|
632
|
-
hashedPassword = _context8.sent;
|
|
633
|
-
customer.password_hash = hashedPassword;
|
|
634
|
-
customer.has_account = true;
|
|
635
|
-
delete customer.password;
|
|
636
|
-
toUpdate = _objectSpread(_objectSpread({}, existing), customer);
|
|
637
|
-
_context8.next = 19;
|
|
638
|
-
return customerRepository.save(toUpdate);
|
|
639
|
-
|
|
640
|
-
case 19:
|
|
641
|
-
updated = _context8.sent;
|
|
642
|
-
_context8.next = 22;
|
|
643
|
-
return _this2.eventBus_.withTransaction(manager).emit(CustomerService.Events.UPDATED, updated);
|
|
644
|
-
|
|
645
|
-
case 22:
|
|
646
|
-
return _context8.abrupt("return", updated);
|
|
647
|
-
|
|
648
|
-
case 25:
|
|
649
|
-
if (!password) {
|
|
650
|
-
_context8.next = 32;
|
|
651
|
-
break;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
_context8.next = 28;
|
|
655
|
-
return _this2.hashPassword_(password);
|
|
656
|
-
|
|
657
|
-
case 28:
|
|
658
|
-
_hashedPassword = _context8.sent;
|
|
659
|
-
customer.password_hash = _hashedPassword;
|
|
660
|
-
customer.has_account = true;
|
|
661
|
-
delete customer.password;
|
|
662
|
-
|
|
663
|
-
case 32:
|
|
664
|
-
_context8.next = 34;
|
|
665
|
-
return customerRepository.create(customer);
|
|
666
|
-
|
|
667
|
-
case 34:
|
|
668
|
-
created = _context8.sent;
|
|
669
|
-
_context8.next = 37;
|
|
670
|
-
return customerRepository.save(created);
|
|
671
|
-
|
|
672
|
-
case 37:
|
|
673
|
-
result = _context8.sent;
|
|
674
|
-
_context8.next = 40;
|
|
675
|
-
return _this2.eventBus_.withTransaction(manager).emit(CustomerService.Events.CREATED, result);
|
|
676
|
-
|
|
677
|
-
case 40:
|
|
678
|
-
return _context8.abrupt("return", result);
|
|
679
|
-
|
|
680
|
-
case 41:
|
|
681
|
-
case "end":
|
|
682
|
-
return _context8.stop();
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}, _callee8);
|
|
686
|
-
}));
|
|
687
|
-
|
|
688
|
-
return function (_x8) {
|
|
689
|
-
return _ref2.apply(this, arguments);
|
|
690
|
-
};
|
|
691
|
-
}()));
|
|
692
|
-
|
|
693
|
-
case 1:
|
|
694
|
-
case "end":
|
|
695
|
-
return _context9.stop();
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}, _callee9, this);
|
|
699
|
-
}));
|
|
700
|
-
|
|
701
|
-
function create(_x7) {
|
|
702
|
-
return _create.apply(this, arguments);
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
return create;
|
|
706
|
-
}()
|
|
459
|
+
});
|
|
460
|
+
}); })];
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
};
|
|
707
464
|
/**
|
|
708
465
|
* Updates a customer.
|
|
709
466
|
* @param {string} customerId - the id of the variant. Must be a string that
|
|
@@ -711,107 +468,70 @@ var CustomerService = /*#__PURE__*/function (_BaseService) {
|
|
|
711
468
|
* @param {object} update - an object with the update values.
|
|
712
469
|
* @return {Promise} resolves to the update result.
|
|
713
470
|
*/
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
471
|
+
CustomerService.prototype.update = function (customerId, update) {
|
|
472
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
473
|
+
var _this = this;
|
|
474
|
+
return __generator(this, function (_a) {
|
|
475
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
476
|
+
var customerRepository, addrRepo, customer, email, password, metadata, billing_address, billing_address_id, rest, address, _a, _b, _c, key, value, _d, updated;
|
|
477
|
+
var e_1, _e;
|
|
478
|
+
return __generator(this, function (_f) {
|
|
479
|
+
switch (_f.label) {
|
|
480
|
+
case 0:
|
|
481
|
+
customerRepository = manager.getCustomRepository(this.customerRepository_);
|
|
482
|
+
addrRepo = manager.getCustomRepository(this.addressRepository_);
|
|
483
|
+
return [4 /*yield*/, this.retrieve(customerId)];
|
|
484
|
+
case 1:
|
|
485
|
+
customer = _f.sent();
|
|
486
|
+
email = update.email, password = update.password, metadata = update.metadata, billing_address = update.billing_address, billing_address_id = update.billing_address_id, rest = __rest(update, ["email", "password", "metadata", "billing_address", "billing_address_id"]);
|
|
487
|
+
if (metadata) {
|
|
488
|
+
customer.metadata = this.setMetadata_(customer, metadata);
|
|
489
|
+
}
|
|
490
|
+
if (email) {
|
|
491
|
+
customer.email = this.validateEmail_(email);
|
|
492
|
+
}
|
|
493
|
+
if (!("billing_address_id" in update || "billing_address" in update)) return [3 /*break*/, 3];
|
|
494
|
+
address = billing_address_id || billing_address;
|
|
495
|
+
if (!(typeof address !== "undefined")) return [3 /*break*/, 3];
|
|
496
|
+
return [4 /*yield*/, this.updateBillingAddress_(customer, address, addrRepo)];
|
|
497
|
+
case 2:
|
|
498
|
+
_f.sent();
|
|
499
|
+
_f.label = 3;
|
|
500
|
+
case 3:
|
|
501
|
+
try {
|
|
502
|
+
for (_a = __values(Object.entries(rest)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
503
|
+
_c = __read(_b.value, 2), key = _c[0], value = _c[1];
|
|
504
|
+
customer[key] = value;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
508
|
+
finally {
|
|
509
|
+
try {
|
|
510
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
511
|
+
}
|
|
512
|
+
finally { if (e_1) throw e_1.error; }
|
|
513
|
+
}
|
|
514
|
+
if (!password) return [3 /*break*/, 5];
|
|
515
|
+
_d = customer;
|
|
516
|
+
return [4 /*yield*/, this.hashPassword_(password)];
|
|
517
|
+
case 4:
|
|
518
|
+
_d.password_hash = _f.sent();
|
|
519
|
+
_f.label = 5;
|
|
520
|
+
case 5: return [4 /*yield*/, customerRepository.save(customer)];
|
|
521
|
+
case 6:
|
|
522
|
+
updated = _f.sent();
|
|
523
|
+
return [4 /*yield*/, this.eventBus_
|
|
524
|
+
.withTransaction(manager)
|
|
525
|
+
.emit(CustomerService.Events.UPDATED, updated)];
|
|
526
|
+
case 7:
|
|
527
|
+
_f.sent();
|
|
528
|
+
return [2 /*return*/, updated];
|
|
744
529
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
if (!("billing_address_id" in _update || "billing_address" in _update)) {
|
|
751
|
-
_context10.next = 12;
|
|
752
|
-
break;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
address = billing_address_id || billing_address;
|
|
756
|
-
_context10.next = 12;
|
|
757
|
-
return _this3.updateBillingAddress_(customer, address, addrRepo);
|
|
758
|
-
|
|
759
|
-
case 12:
|
|
760
|
-
for (_i = 0, _Object$entries = Object.entries(rest); _i < _Object$entries.length; _i++) {
|
|
761
|
-
_Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
762
|
-
customer[key] = value;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
if (!password) {
|
|
766
|
-
_context10.next = 17;
|
|
767
|
-
break;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
_context10.next = 16;
|
|
771
|
-
return _this3.hashPassword_(password);
|
|
772
|
-
|
|
773
|
-
case 16:
|
|
774
|
-
customer.password_hash = _context10.sent;
|
|
775
|
-
|
|
776
|
-
case 17:
|
|
777
|
-
_context10.next = 19;
|
|
778
|
-
return customerRepository.save(customer);
|
|
779
|
-
|
|
780
|
-
case 19:
|
|
781
|
-
updated = _context10.sent;
|
|
782
|
-
_context10.next = 22;
|
|
783
|
-
return _this3.eventBus_.withTransaction(manager).emit(CustomerService.Events.UPDATED, updated);
|
|
784
|
-
|
|
785
|
-
case 22:
|
|
786
|
-
return _context10.abrupt("return", updated);
|
|
787
|
-
|
|
788
|
-
case 23:
|
|
789
|
-
case "end":
|
|
790
|
-
return _context10.stop();
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
}, _callee10);
|
|
794
|
-
}));
|
|
795
|
-
|
|
796
|
-
return function (_x11) {
|
|
797
|
-
return _ref3.apply(this, arguments);
|
|
798
|
-
};
|
|
799
|
-
}()));
|
|
800
|
-
|
|
801
|
-
case 1:
|
|
802
|
-
case "end":
|
|
803
|
-
return _context11.stop();
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}, _callee11, this);
|
|
807
|
-
}));
|
|
808
|
-
|
|
809
|
-
function update(_x9, _x10) {
|
|
810
|
-
return _update2.apply(this, arguments);
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
return update;
|
|
814
|
-
}()
|
|
530
|
+
});
|
|
531
|
+
}); })];
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
};
|
|
815
535
|
/**
|
|
816
536
|
* Updates the customers' billing address.
|
|
817
537
|
* @param {Customer} customer - the Customer to update
|
|
@@ -819,395 +539,193 @@ var CustomerService = /*#__PURE__*/function (_BaseService) {
|
|
|
819
539
|
* @param {Object} addrRepo - address repository
|
|
820
540
|
* @return {Promise} the result of the update operation
|
|
821
541
|
*/
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
customer.billing_address_id = addressOrId.id;
|
|
865
|
-
_context12.next = 25;
|
|
866
|
-
break;
|
|
867
|
-
|
|
868
|
-
case 12:
|
|
869
|
-
if (!customer.billing_address_id) {
|
|
870
|
-
_context12.next = 20;
|
|
871
|
-
break;
|
|
542
|
+
CustomerService.prototype.updateBillingAddress_ = function (customer, addressOrId, addrRepo) {
|
|
543
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
544
|
+
var addr, created, saved;
|
|
545
|
+
return __generator(this, function (_a) {
|
|
546
|
+
switch (_a.label) {
|
|
547
|
+
case 0:
|
|
548
|
+
if (addressOrId === null) {
|
|
549
|
+
customer.billing_address_id = null;
|
|
550
|
+
return [2 /*return*/];
|
|
551
|
+
}
|
|
552
|
+
if (!(typeof addressOrId === "string")) return [3 /*break*/, 2];
|
|
553
|
+
return [4 /*yield*/, addrRepo.findOne({
|
|
554
|
+
where: { id: addressOrId },
|
|
555
|
+
})];
|
|
556
|
+
case 1:
|
|
557
|
+
addressOrId = _a.sent();
|
|
558
|
+
_a.label = 2;
|
|
559
|
+
case 2:
|
|
560
|
+
addressOrId.country_code = addressOrId.country_code.toLowerCase();
|
|
561
|
+
if (!addressOrId.id) return [3 /*break*/, 3];
|
|
562
|
+
customer.billing_address_id = addressOrId.id;
|
|
563
|
+
return [3 /*break*/, 8];
|
|
564
|
+
case 3:
|
|
565
|
+
if (!customer.billing_address_id) return [3 /*break*/, 6];
|
|
566
|
+
return [4 /*yield*/, addrRepo.findOne({
|
|
567
|
+
where: { id: customer.billing_address_id },
|
|
568
|
+
})];
|
|
569
|
+
case 4:
|
|
570
|
+
addr = _a.sent();
|
|
571
|
+
return [4 /*yield*/, addrRepo.save(__assign(__assign({}, addr), addressOrId))];
|
|
572
|
+
case 5:
|
|
573
|
+
_a.sent();
|
|
574
|
+
return [3 /*break*/, 8];
|
|
575
|
+
case 6:
|
|
576
|
+
created = addrRepo.create(__assign({}, addressOrId));
|
|
577
|
+
return [4 /*yield*/, addrRepo.save(created)];
|
|
578
|
+
case 7:
|
|
579
|
+
saved = _a.sent();
|
|
580
|
+
customer.billing_address = saved;
|
|
581
|
+
_a.label = 8;
|
|
582
|
+
case 8: return [2 /*return*/];
|
|
872
583
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
return updateBillingAddress_;
|
|
912
|
-
}()
|
|
913
|
-
}, {
|
|
914
|
-
key: "updateAddress",
|
|
915
|
-
value: function () {
|
|
916
|
-
var _updateAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(customerId, addressId, address) {
|
|
917
|
-
var _this4 = this;
|
|
918
|
-
|
|
919
|
-
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
920
|
-
while (1) {
|
|
921
|
-
switch (_context14.prev = _context14.next) {
|
|
922
|
-
case 0:
|
|
923
|
-
return _context14.abrupt("return", this.atomicPhase_( /*#__PURE__*/function () {
|
|
924
|
-
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(manager) {
|
|
925
|
-
var addressRepo, toUpdate, _i2, _Object$entries2, _Object$entries2$_i, key, value, result;
|
|
926
|
-
|
|
927
|
-
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
928
|
-
while (1) {
|
|
929
|
-
switch (_context13.prev = _context13.next) {
|
|
930
|
-
case 0:
|
|
931
|
-
addressRepo = manager.getCustomRepository(_this4.addressRepository_);
|
|
932
|
-
address.country_code = address.country_code.toLowerCase();
|
|
933
|
-
_context13.next = 4;
|
|
934
|
-
return addressRepo.findOne({
|
|
935
|
-
where: {
|
|
936
|
-
id: addressId,
|
|
937
|
-
customer_id: customerId
|
|
938
|
-
}
|
|
939
|
-
});
|
|
940
|
-
|
|
941
|
-
case 4:
|
|
942
|
-
toUpdate = _context13.sent;
|
|
943
|
-
|
|
944
|
-
_this4.validateBillingAddress_(address);
|
|
945
|
-
|
|
946
|
-
for (_i2 = 0, _Object$entries2 = Object.entries(address); _i2 < _Object$entries2.length; _i2++) {
|
|
947
|
-
_Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i2], 2), key = _Object$entries2$_i[0], value = _Object$entries2$_i[1];
|
|
948
|
-
toUpdate[key] = value;
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
CustomerService.prototype.updateAddress = function (customerId, addressId, address) {
|
|
588
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
589
|
+
var _this = this;
|
|
590
|
+
return __generator(this, function (_a) {
|
|
591
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
592
|
+
var addressRepo, toUpdate, _a, _b, _c, key, value, result;
|
|
593
|
+
var e_2, _d;
|
|
594
|
+
return __generator(this, function (_e) {
|
|
595
|
+
switch (_e.label) {
|
|
596
|
+
case 0:
|
|
597
|
+
addressRepo = manager.getCustomRepository(this.addressRepository_);
|
|
598
|
+
address.country_code = address.country_code.toLowerCase();
|
|
599
|
+
return [4 /*yield*/, addressRepo.findOne({
|
|
600
|
+
where: { id: addressId, customer_id: customerId },
|
|
601
|
+
})];
|
|
602
|
+
case 1:
|
|
603
|
+
toUpdate = _e.sent();
|
|
604
|
+
this.validateBillingAddress_(address);
|
|
605
|
+
try {
|
|
606
|
+
for (_a = __values(Object.entries(address)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
607
|
+
_c = __read(_b.value, 2), key = _c[0], value = _c[1];
|
|
608
|
+
toUpdate[key] = value;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
612
|
+
finally {
|
|
613
|
+
try {
|
|
614
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
615
|
+
}
|
|
616
|
+
finally { if (e_2) throw e_2.error; }
|
|
617
|
+
}
|
|
618
|
+
result = addressRepo.save(toUpdate);
|
|
619
|
+
return [2 /*return*/, result];
|
|
949
620
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
return updateAddress;
|
|
980
|
-
}()
|
|
981
|
-
}, {
|
|
982
|
-
key: "removeAddress",
|
|
983
|
-
value: function () {
|
|
984
|
-
var _removeAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(customerId, addressId) {
|
|
985
|
-
var _this5 = this;
|
|
986
|
-
|
|
987
|
-
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
988
|
-
while (1) {
|
|
989
|
-
switch (_context16.prev = _context16.next) {
|
|
990
|
-
case 0:
|
|
991
|
-
return _context16.abrupt("return", this.atomicPhase_( /*#__PURE__*/function () {
|
|
992
|
-
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(manager) {
|
|
993
|
-
var addressRepo, address;
|
|
994
|
-
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
995
|
-
while (1) {
|
|
996
|
-
switch (_context15.prev = _context15.next) {
|
|
997
|
-
case 0:
|
|
998
|
-
addressRepo = manager.getCustomRepository(_this5.addressRepository_); // Should not fail, if user does not exist, since delete is idempotent
|
|
999
|
-
|
|
1000
|
-
_context15.next = 3;
|
|
1001
|
-
return addressRepo.findOne({
|
|
1002
|
-
where: {
|
|
1003
|
-
id: addressId,
|
|
1004
|
-
customer_id: customerId
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
1007
|
-
|
|
1008
|
-
case 3:
|
|
1009
|
-
address = _context15.sent;
|
|
1010
|
-
|
|
1011
|
-
if (address) {
|
|
1012
|
-
_context15.next = 6;
|
|
1013
|
-
break;
|
|
621
|
+
});
|
|
622
|
+
}); })];
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
CustomerService.prototype.removeAddress = function (customerId, addressId) {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
628
|
+
var _this = this;
|
|
629
|
+
return __generator(this, function (_a) {
|
|
630
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
631
|
+
var addressRepo, address;
|
|
632
|
+
return __generator(this, function (_a) {
|
|
633
|
+
switch (_a.label) {
|
|
634
|
+
case 0:
|
|
635
|
+
addressRepo = manager.getCustomRepository(this.addressRepository_);
|
|
636
|
+
return [4 /*yield*/, addressRepo.findOne({
|
|
637
|
+
where: { id: addressId, customer_id: customerId },
|
|
638
|
+
})];
|
|
639
|
+
case 1:
|
|
640
|
+
address = _a.sent();
|
|
641
|
+
if (!address) {
|
|
642
|
+
return [2 /*return*/, Promise.resolve()];
|
|
643
|
+
}
|
|
644
|
+
return [4 /*yield*/, addressRepo.softRemove(address)];
|
|
645
|
+
case 2:
|
|
646
|
+
_a.sent();
|
|
647
|
+
return [2 /*return*/, Promise.resolve()];
|
|
1014
648
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
return _regenerator["default"].wrap(function _callee18$(_context18) {
|
|
1059
|
-
while (1) {
|
|
1060
|
-
switch (_context18.prev = _context18.next) {
|
|
1061
|
-
case 0:
|
|
1062
|
-
return _context18.abrupt("return", this.atomicPhase_( /*#__PURE__*/function () {
|
|
1063
|
-
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(manager) {
|
|
1064
|
-
var addressRepository, customer, shouldAdd, created, result;
|
|
1065
|
-
return _regenerator["default"].wrap(function _callee17$(_context17) {
|
|
1066
|
-
while (1) {
|
|
1067
|
-
switch (_context17.prev = _context17.next) {
|
|
1068
|
-
case 0:
|
|
1069
|
-
addressRepository = manager.getCustomRepository(_this6.addressRepository_);
|
|
1070
|
-
address.country_code = address.country_code.toLowerCase();
|
|
1071
|
-
_context17.next = 4;
|
|
1072
|
-
return _this6.retrieve(customerId, {
|
|
1073
|
-
relations: ["shipping_addresses"]
|
|
1074
|
-
});
|
|
1075
|
-
|
|
1076
|
-
case 4:
|
|
1077
|
-
customer = _context17.sent;
|
|
1078
|
-
|
|
1079
|
-
_this6.validateBillingAddress_(address);
|
|
1080
|
-
|
|
1081
|
-
shouldAdd = !customer.shipping_addresses.find(function (a) {
|
|
1082
|
-
return a.country_code.toLowerCase() === address.country_code.toLowerCase() && a.address_1 === address.address_1 && a.address_2 === address.address_2 && a.city === address.city && a.phone === address.phone && a.postal_code === address.postal_code && a.province === address.province && a.first_name === address.first_name && a.last_name === address.last_name;
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1085
|
-
if (!shouldAdd) {
|
|
1086
|
-
_context17.next = 17;
|
|
1087
|
-
break;
|
|
649
|
+
});
|
|
650
|
+
}); })];
|
|
651
|
+
});
|
|
652
|
+
});
|
|
653
|
+
};
|
|
654
|
+
CustomerService.prototype.addAddress = function (customerId, address) {
|
|
655
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
656
|
+
var _this = this;
|
|
657
|
+
return __generator(this, function (_a) {
|
|
658
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
659
|
+
var addressRepository, customer, shouldAdd, created, result;
|
|
660
|
+
return __generator(this, function (_a) {
|
|
661
|
+
switch (_a.label) {
|
|
662
|
+
case 0:
|
|
663
|
+
addressRepository = manager.getCustomRepository(this.addressRepository_);
|
|
664
|
+
address.country_code = address.country_code.toLowerCase();
|
|
665
|
+
return [4 /*yield*/, this.retrieve(customerId, {
|
|
666
|
+
relations: ["shipping_addresses"],
|
|
667
|
+
})];
|
|
668
|
+
case 1:
|
|
669
|
+
customer = _a.sent();
|
|
670
|
+
this.validateBillingAddress_(address);
|
|
671
|
+
shouldAdd = !customer.shipping_addresses.find(function (a) {
|
|
672
|
+
return a.country_code.toLowerCase() === address.country_code.toLowerCase() &&
|
|
673
|
+
a.address_1 === address.address_1 &&
|
|
674
|
+
a.address_2 === address.address_2 &&
|
|
675
|
+
a.city === address.city &&
|
|
676
|
+
a.phone === address.phone &&
|
|
677
|
+
a.postal_code === address.postal_code &&
|
|
678
|
+
a.province === address.province &&
|
|
679
|
+
a.first_name === address.first_name &&
|
|
680
|
+
a.last_name === address.last_name;
|
|
681
|
+
});
|
|
682
|
+
if (!shouldAdd) return [3 /*break*/, 4];
|
|
683
|
+
return [4 /*yield*/, addressRepository.create(__assign({ customer_id: customerId }, address))];
|
|
684
|
+
case 2:
|
|
685
|
+
created = _a.sent();
|
|
686
|
+
return [4 /*yield*/, addressRepository.save(created)];
|
|
687
|
+
case 3:
|
|
688
|
+
result = _a.sent();
|
|
689
|
+
return [2 /*return*/, result];
|
|
690
|
+
case 4: return [2 /*return*/, customer];
|
|
1088
691
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
case 10:
|
|
1096
|
-
created = _context17.sent;
|
|
1097
|
-
_context17.next = 13;
|
|
1098
|
-
return addressRepository.save(created);
|
|
1099
|
-
|
|
1100
|
-
case 13:
|
|
1101
|
-
result = _context17.sent;
|
|
1102
|
-
return _context17.abrupt("return", result);
|
|
1103
|
-
|
|
1104
|
-
case 17:
|
|
1105
|
-
return _context17.abrupt("return", customer);
|
|
1106
|
-
|
|
1107
|
-
case 18:
|
|
1108
|
-
case "end":
|
|
1109
|
-
return _context17.stop();
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}, _callee17);
|
|
1113
|
-
}));
|
|
1114
|
-
|
|
1115
|
-
return function (_x24) {
|
|
1116
|
-
return _ref6.apply(this, arguments);
|
|
1117
|
-
};
|
|
1118
|
-
}()));
|
|
1119
|
-
|
|
1120
|
-
case 1:
|
|
1121
|
-
case "end":
|
|
1122
|
-
return _context18.stop();
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}, _callee18, this);
|
|
1126
|
-
}));
|
|
1127
|
-
|
|
1128
|
-
function addAddress(_x22, _x23) {
|
|
1129
|
-
return _addAddress.apply(this, arguments);
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
return addAddress;
|
|
1133
|
-
}()
|
|
692
|
+
});
|
|
693
|
+
}); })];
|
|
694
|
+
});
|
|
695
|
+
});
|
|
696
|
+
};
|
|
1134
697
|
/**
|
|
1135
698
|
* Deletes a customer from a given customer id.
|
|
1136
699
|
* @param {string} customerId - the id of the customer to delete. Must be
|
|
1137
700
|
* castable as an ObjectId
|
|
1138
701
|
* @return {Promise} the result of the delete operation.
|
|
1139
702
|
*/
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
_context19.next = 3;
|
|
1161
|
-
return customerRepo.findOne({
|
|
1162
|
-
where: {
|
|
1163
|
-
id: customerId
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1166
|
-
|
|
1167
|
-
case 3:
|
|
1168
|
-
customer = _context19.sent;
|
|
1169
|
-
|
|
1170
|
-
if (customer) {
|
|
1171
|
-
_context19.next = 6;
|
|
1172
|
-
break;
|
|
703
|
+
CustomerService.prototype.delete = function (customerId) {
|
|
704
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
705
|
+
var _this = this;
|
|
706
|
+
return __generator(this, function (_a) {
|
|
707
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
708
|
+
var customerRepo, customer;
|
|
709
|
+
return __generator(this, function (_a) {
|
|
710
|
+
switch (_a.label) {
|
|
711
|
+
case 0:
|
|
712
|
+
customerRepo = manager.getCustomRepository(this.customerRepository_);
|
|
713
|
+
return [4 /*yield*/, customerRepo.findOne({ where: { id: customerId } })];
|
|
714
|
+
case 1:
|
|
715
|
+
customer = _a.sent();
|
|
716
|
+
if (!customer) {
|
|
717
|
+
return [2 /*return*/, Promise.resolve()];
|
|
718
|
+
}
|
|
719
|
+
return [4 /*yield*/, customerRepo.softRemove(customer)];
|
|
720
|
+
case 2:
|
|
721
|
+
_a.sent();
|
|
722
|
+
return [2 /*return*/, Promise.resolve()];
|
|
1173
723
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
return customerRepo.softRemove(customer);
|
|
1180
|
-
|
|
1181
|
-
case 8:
|
|
1182
|
-
return _context19.abrupt("return", Promise.resolve());
|
|
1183
|
-
|
|
1184
|
-
case 9:
|
|
1185
|
-
case "end":
|
|
1186
|
-
return _context19.stop();
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
}, _callee19);
|
|
1190
|
-
}));
|
|
1191
|
-
|
|
1192
|
-
return function (_x26) {
|
|
1193
|
-
return _ref7.apply(this, arguments);
|
|
1194
|
-
};
|
|
1195
|
-
}()));
|
|
1196
|
-
|
|
1197
|
-
case 1:
|
|
1198
|
-
case "end":
|
|
1199
|
-
return _context20.stop();
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
}, _callee20, this);
|
|
1203
|
-
}));
|
|
1204
|
-
|
|
1205
|
-
function _delete(_x25) {
|
|
1206
|
-
return _delete2.apply(this, arguments);
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
return _delete;
|
|
1210
|
-
}()
|
|
724
|
+
});
|
|
725
|
+
}); })];
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
};
|
|
1211
729
|
/**
|
|
1212
730
|
* Decorates a customer.
|
|
1213
731
|
* @param {Customer} customer - the cart to decorate.
|
|
@@ -1215,55 +733,30 @@ var CustomerService = /*#__PURE__*/function (_BaseService) {
|
|
|
1215
733
|
* @param {string[]} expandFields - fields to expand.
|
|
1216
734
|
* @return {Customer} return the decorated customer.
|
|
1217
735
|
*/
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
case 8:
|
|
1246
|
-
case "end":
|
|
1247
|
-
return _context21.stop();
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
}, _callee21, this);
|
|
1251
|
-
}));
|
|
1252
|
-
|
|
1253
|
-
function decorate(_x27) {
|
|
1254
|
-
return _decorate.apply(this, arguments);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
return decorate;
|
|
1258
|
-
}()
|
|
1259
|
-
}]);
|
|
1260
|
-
return CustomerService;
|
|
1261
|
-
}(_medusaInterfaces.BaseService);
|
|
1262
|
-
|
|
1263
|
-
(0, _defineProperty2["default"])(CustomerService, "Events", {
|
|
1264
|
-
PASSWORD_RESET: "customer.password_reset",
|
|
1265
|
-
CREATED: "customer.created",
|
|
1266
|
-
UPDATED: "customer.updated"
|
|
1267
|
-
});
|
|
1268
|
-
var _default = CustomerService;
|
|
1269
|
-
exports["default"] = _default;
|
|
736
|
+
CustomerService.prototype.decorate = function (customer, fields, expandFields) {
|
|
737
|
+
if (fields === void 0) { fields = []; }
|
|
738
|
+
if (expandFields === void 0) { expandFields = []; }
|
|
739
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
740
|
+
var requiredFields, decorated, final;
|
|
741
|
+
return __generator(this, function (_a) {
|
|
742
|
+
switch (_a.label) {
|
|
743
|
+
case 0:
|
|
744
|
+
requiredFields = ["_id", "metadata"];
|
|
745
|
+
decorated = lodash_1.default.pick(customer, fields.concat(requiredFields));
|
|
746
|
+
return [4 /*yield*/, this.runDecorators_(decorated)];
|
|
747
|
+
case 1:
|
|
748
|
+
final = _a.sent();
|
|
749
|
+
return [2 /*return*/, final];
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
};
|
|
754
|
+
CustomerService.Events = {
|
|
755
|
+
PASSWORD_RESET: "customer.password_reset",
|
|
756
|
+
CREATED: "customer.created",
|
|
757
|
+
UPDATED: "customer.updated",
|
|
758
|
+
};
|
|
759
|
+
return CustomerService;
|
|
760
|
+
}(medusa_interfaces_1.BaseService));
|
|
761
|
+
exports.default = CustomerService;
|
|
762
|
+
//# sourceMappingURL=customer.js.map
|