@medusajs/medusa 1.3.2 → 1.3.3
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 +43 -0
- package/dist/api/index.d.ts +15 -14
- package/dist/api/index.js +15 -14
- package/dist/api/index.js.map +1 -1
- package/dist/api/middlewares/authenticate-customer.d.ts +2 -1
- package/dist/api/middlewares/authenticate-customer.js +1 -2
- package/dist/api/middlewares/authenticate-customer.js.map +1 -1
- package/dist/api/middlewares/authenticate.d.ts +2 -1
- package/dist/api/middlewares/authenticate.js.map +1 -1
- package/dist/api/middlewares/await-middleware.d.ts +3 -1
- package/dist/api/middlewares/await-middleware.js +2 -31
- package/dist/api/middlewares/await-middleware.js.map +1 -1
- package/dist/api/middlewares/error-handler.d.ts +3 -1
- package/dist/api/middlewares/error-handler.js.map +1 -1
- package/dist/api/middlewares/feature-flag-enabled.d.ts +2 -0
- package/dist/api/middlewares/feature-flag-enabled.js +57 -0
- package/dist/api/middlewares/feature-flag-enabled.js.map +1 -0
- package/dist/api/middlewares/index.d.ts +10 -10
- package/dist/api/middlewares/index.js +5 -1
- package/dist/api/middlewares/index.js.map +1 -1
- package/dist/api/middlewares/normalized-query.d.ts +6 -1
- package/dist/api/middlewares/normalized-query.js +5 -2
- package/dist/api/middlewares/normalized-query.js.map +1 -1
- package/dist/api/middlewares/transform-body.d.ts +4 -0
- package/dist/api/middlewares/transform-body.js +66 -0
- package/dist/api/middlewares/transform-body.js.map +1 -0
- package/dist/api/middlewares/transform-query.d.ts +6 -0
- package/dist/api/middlewares/transform-query.js +86 -0
- package/dist/api/middlewares/transform-query.js.map +1 -0
- package/dist/api/routes/admin/batch/cancel-batch-job.d.ts +22 -0
- package/dist/api/routes/admin/batch/cancel-batch-job.js +74 -0
- package/dist/api/routes/admin/batch/cancel-batch-job.js.map +1 -0
- package/dist/api/routes/admin/batch/confirm-batch-job.d.ts +22 -0
- package/dist/api/routes/admin/batch/confirm-batch-job.js +74 -0
- package/dist/api/routes/admin/batch/confirm-batch-job.js.map +1 -0
- package/dist/api/routes/admin/batch/create-batch-job.d.ts +30 -0
- package/dist/api/routes/admin/batch/create-batch-job.js +125 -0
- package/dist/api/routes/admin/batch/create-batch-job.js.map +1 -0
- package/dist/api/routes/admin/batch/get-batch-job.d.ts +22 -0
- package/dist/api/routes/admin/batch/get-batch-job.js +67 -0
- package/dist/api/routes/admin/batch/get-batch-job.js.map +1 -0
- package/dist/api/routes/admin/batch/index.d.ts +4 -0
- package/dist/api/routes/admin/batch/index.js +36 -7
- package/dist/api/routes/admin/batch/index.js.map +1 -1
- package/dist/api/routes/admin/batch/list-batch-jobs.d.ts +15 -7
- package/dist/api/routes/admin/batch/list-batch-jobs.js +61 -46
- package/dist/api/routes/admin/batch/list-batch-jobs.js.map +1 -1
- package/dist/api/routes/admin/collections/add-products.d.ts +2 -1
- package/dist/api/routes/admin/collections/add-products.js +4 -7
- package/dist/api/routes/admin/collections/add-products.js.map +1 -1
- package/dist/api/routes/admin/collections/create-collection.d.ts +2 -1
- package/dist/api/routes/admin/collections/create-collection.js +6 -8
- package/dist/api/routes/admin/collections/create-collection.js.map +1 -1
- package/dist/api/routes/admin/collections/delete-collection.d.ts +2 -1
- package/dist/api/routes/admin/collections/delete-collection.js.map +1 -1
- package/dist/api/routes/admin/collections/get-collection.d.ts +2 -1
- package/dist/api/routes/admin/collections/get-collection.js +4 -5
- package/dist/api/routes/admin/collections/get-collection.js.map +1 -1
- package/dist/api/routes/admin/collections/index.js +32 -12
- package/dist/api/routes/admin/collections/index.js.map +1 -1
- package/dist/api/routes/admin/collections/list-collections.d.ts +2 -1
- package/dist/api/routes/admin/collections/list-collections.js +9 -19
- package/dist/api/routes/admin/collections/list-collections.js.map +1 -1
- package/dist/api/routes/admin/collections/remove-products.d.ts +2 -1
- package/dist/api/routes/admin/collections/remove-products.js +5 -8
- package/dist/api/routes/admin/collections/remove-products.js.map +1 -1
- package/dist/api/routes/admin/collections/update-collection.d.ts +2 -1
- package/dist/api/routes/admin/collections/update-collection.js +5 -8
- package/dist/api/routes/admin/collections/update-collection.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/add-customers-batch.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/add-customers-batch.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/create-customer-group.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group-customers.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group-customers.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group.js +3 -17
- package/dist/api/routes/admin/customer-groups/get-customer-group.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/index.js +29 -11
- package/dist/api/routes/admin/customer-groups/index.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/list-customer-groups.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js +10 -45
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/update-customer-group.d.ts +2 -1
- package/dist/api/routes/admin/customer-groups/update-customer-group.js.map +1 -1
- package/dist/api/routes/admin/customers/create-customer.d.ts +1 -1
- package/dist/api/routes/admin/customers/create-customer.js.map +1 -1
- package/dist/api/routes/admin/customers/update-customer.d.ts +1 -1
- package/dist/api/routes/admin/customers/update-customer.js.map +1 -1
- package/dist/api/routes/admin/discounts/add-valid-product.d.ts +23 -0
- package/dist/api/routes/admin/discounts/add-valid-product.js +82 -0
- package/dist/api/routes/admin/discounts/add-valid-product.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 +82 -0
- package/dist/api/routes/admin/discounts/remove-valid-product.js.map +1 -0
- package/dist/api/routes/admin/draft-orders/index.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/index.js +1 -0
- package/dist/api/routes/admin/draft-orders/index.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/list-draft-orders.js +7 -6
- package/dist/api/routes/admin/draft-orders/list-draft-orders.js.map +1 -1
- package/dist/api/routes/admin/gift-cards/create-gift-card.d.ts +2 -2
- package/dist/api/routes/admin/gift-cards/create-gift-card.js +0 -1
- package/dist/api/routes/admin/gift-cards/create-gift-card.js.map +1 -1
- package/dist/api/routes/admin/gift-cards/index.d.ts +1 -1
- package/dist/api/routes/admin/gift-cards/index.js +19 -5
- package/dist/api/routes/admin/gift-cards/index.js.map +1 -1
- package/dist/api/routes/admin/gift-cards/list-gift-cards.js +24 -18
- package/dist/api/routes/admin/gift-cards/list-gift-cards.js.map +1 -1
- package/dist/api/routes/admin/gift-cards/update-gift-card.d.ts +1 -1
- package/dist/api/routes/admin/gift-cards/update-gift-card.js.map +1 -1
- package/dist/api/routes/admin/orders/create-claim.d.ts +4 -14
- package/dist/api/routes/admin/orders/create-claim.js +3 -14
- package/dist/api/routes/admin/orders/create-claim.js.map +1 -1
- package/dist/api/routes/admin/orders/fulfill-claim.d.ts +1 -1
- package/dist/api/routes/admin/orders/fulfill-claim.js.map +1 -1
- package/dist/api/routes/admin/orders/update-claim.d.ts +1 -1
- package/dist/api/routes/admin/orders/update-claim.js.map +1 -1
- package/dist/api/routes/admin/price-lists/create-price-list.d.ts +2 -1
- package/dist/api/routes/admin/price-lists/create-price-list.js +4 -7
- package/dist/api/routes/admin/price-lists/create-price-list.js.map +1 -1
- package/dist/api/routes/admin/price-lists/index.js +26 -7
- package/dist/api/routes/admin/price-lists/index.js.map +1 -1
- package/dist/api/routes/admin/price-lists/list-price-list-products.d.ts +3 -7
- package/dist/api/routes/admin/price-lists/list-price-list-products.js +21 -59
- package/dist/api/routes/admin/price-lists/list-price-list-products.js.map +1 -1
- package/dist/api/routes/admin/price-lists/list-price-lists.d.ts +2 -1
- package/dist/api/routes/admin/price-lists/list-price-lists.js +8 -40
- package/dist/api/routes/admin/price-lists/list-price-lists.js.map +1 -1
- package/dist/api/routes/admin/products/add-option.js +26 -6
- package/dist/api/routes/admin/products/add-option.js.map +1 -1
- package/dist/api/routes/admin/products/create-product.d.ts +3 -3
- package/dist/api/routes/admin/products/create-product.js +13 -9
- package/dist/api/routes/admin/products/create-product.js.map +1 -1
- package/dist/api/routes/admin/products/delete-variant.js +26 -6
- package/dist/api/routes/admin/products/delete-variant.js.map +1 -1
- package/dist/api/routes/admin/products/get-product.js +24 -4
- package/dist/api/routes/admin/products/get-product.js.map +1 -1
- package/dist/api/routes/admin/products/get-variants.d.ts +24 -0
- package/dist/api/routes/admin/products/get-variants.js +76 -0
- package/dist/api/routes/admin/products/get-variants.js.map +1 -0
- package/dist/api/routes/admin/products/index.d.ts +3 -2
- package/dist/api/routes/admin/products/index.js +1 -4
- package/dist/api/routes/admin/products/index.js.map +1 -1
- package/dist/api/routes/admin/products/list-products.d.ts +1 -6
- package/dist/api/routes/admin/products/list-products.js +3 -9
- package/dist/api/routes/admin/products/list-products.js.map +1 -1
- package/dist/api/routes/admin/products/update-product.d.ts +3 -3
- package/dist/api/routes/admin/products/update-product.js +28 -7
- package/dist/api/routes/admin/products/update-product.js.map +1 -1
- package/dist/api/routes/admin/products/update-variant.js +27 -10
- package/dist/api/routes/admin/products/update-variant.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js +6 -2
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js.map +1 -1
- package/dist/api/routes/admin/store/get-store.js +4 -2
- package/dist/api/routes/admin/store/get-store.js.map +1 -1
- package/dist/api/routes/admin/store/update-store.d.ts +1 -0
- package/dist/api/routes/admin/store/update-store.js +5 -0
- package/dist/api/routes/admin/store/update-store.js.map +1 -1
- package/dist/api/routes/admin/uploads/create-upload.d.ts +1 -1
- package/dist/api/routes/admin/uploads/create-upload.js +5 -5
- package/dist/api/routes/admin/uploads/create-upload.js.map +1 -1
- package/dist/api/routes/admin/uploads/delete-upload.d.ts +4 -1
- package/dist/api/routes/admin/uploads/delete-upload.js +29 -11
- package/dist/api/routes/admin/uploads/delete-upload.js.map +1 -1
- package/dist/api/routes/admin/uploads/get-download-url.d.ts +28 -0
- package/dist/api/routes/admin/uploads/get-download-url.js +99 -0
- package/dist/api/routes/admin/uploads/get-download-url.js.map +1 -0
- package/dist/api/routes/admin/uploads/index.d.ts +10 -3
- package/dist/api/routes/admin/uploads/index.js +19 -4
- package/dist/api/routes/admin/uploads/index.js.map +1 -1
- package/dist/api/routes/store/carts/add-shipping-method.js +6 -2
- package/dist/api/routes/store/carts/add-shipping-method.js.map +1 -1
- package/dist/api/routes/store/carts/calculate-taxes.js +9 -2
- package/dist/api/routes/store/carts/calculate-taxes.js.map +1 -1
- package/dist/api/routes/store/carts/create-cart.js +6 -2
- package/dist/api/routes/store/carts/create-cart.js.map +1 -1
- package/dist/api/routes/store/carts/create-line-item.js +6 -2
- package/dist/api/routes/store/carts/create-line-item.js.map +1 -1
- package/dist/api/routes/store/carts/create-payment-sessions.js +6 -2
- package/dist/api/routes/store/carts/create-payment-sessions.js.map +1 -1
- package/dist/api/routes/store/carts/decorate-line-items-with-totals.d.ts +5 -0
- package/dist/api/routes/store/carts/decorate-line-items-with-totals.js +71 -0
- package/dist/api/routes/store/carts/decorate-line-items-with-totals.js.map +1 -0
- package/dist/api/routes/store/carts/delete-discount.js +6 -2
- package/dist/api/routes/store/carts/delete-discount.js.map +1 -1
- package/dist/api/routes/store/carts/delete-line-item.js +6 -2
- package/dist/api/routes/store/carts/delete-line-item.js.map +1 -1
- package/dist/api/routes/store/carts/delete-payment-session.js +6 -2
- package/dist/api/routes/store/carts/delete-payment-session.js.map +1 -1
- package/dist/api/routes/store/carts/get-cart.js +6 -2
- package/dist/api/routes/store/carts/get-cart.js.map +1 -1
- package/dist/api/routes/store/carts/refresh-payment-session.js +6 -2
- package/dist/api/routes/store/carts/refresh-payment-session.js.map +1 -1
- package/dist/api/routes/store/carts/set-payment-session.js +6 -2
- package/dist/api/routes/store/carts/set-payment-session.js.map +1 -1
- package/dist/api/routes/store/carts/update-cart.js +6 -2
- package/dist/api/routes/store/carts/update-cart.js.map +1 -1
- package/dist/api/routes/store/carts/update-line-item.js +6 -2
- package/dist/api/routes/store/carts/update-line-item.js.map +1 -1
- package/dist/api/routes/store/carts/update-payment-method.d.ts +38 -0
- package/dist/api/routes/store/carts/update-payment-method.js +122 -0
- package/dist/api/routes/store/carts/update-payment-method.js.map +1 -0
- package/dist/api/routes/store/carts/update-payment-session.js +6 -2
- package/dist/api/routes/store/carts/update-payment-session.js.map +1 -1
- package/dist/api/routes/store/customers/get-payment-methods.js +6 -7
- package/dist/api/routes/store/customers/get-payment-methods.js.map +1 -1
- package/dist/api/routes/store/customers/index.d.ts +1 -1
- package/dist/api/routes/store/customers/index.js.map +1 -1
- package/dist/api/routes/store/customers/update-address.js +1 -1
- package/dist/api/routes/store/customers/update-address.js.map +1 -1
- package/dist/api/routes/store/customers/update-customer.d.ts +1 -1
- package/dist/api/routes/store/customers/update-customer.js.map +1 -1
- package/dist/api/routes/store/gift-cards/index.d.ts +1 -1
- package/dist/api/routes/store/gift-cards/index.js +6 -1
- package/dist/api/routes/store/gift-cards/index.js.map +1 -1
- package/dist/api/routes/store/products/get-product.js +51 -12
- package/dist/api/routes/store/products/get-product.js.map +1 -1
- package/dist/api/routes/store/products/list-products.js +30 -7
- package/dist/api/routes/store/products/list-products.js.map +1 -1
- package/dist/api/routes/store/shipping-options/list-options.js +6 -2
- package/dist/api/routes/store/shipping-options/list-options.js.map +1 -1
- package/dist/api/routes/store/shipping-options/list-shipping-options.js +8 -2
- package/dist/api/routes/store/shipping-options/list-shipping-options.js.map +1 -1
- package/dist/api/routes/store/variants/get-variant.js +51 -12
- package/dist/api/routes/store/variants/get-variant.js.map +1 -1
- package/dist/api/routes/store/variants/list-variants.js +29 -6
- package/dist/api/routes/store/variants/list-variants.js.map +1 -1
- package/dist/commands/migrate.js +29 -14
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/seed.js +14 -10
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/start.js +1 -1
- package/dist/commands/utils/get-migrations.d.ts +2 -1
- package/dist/commands/utils/get-migrations.js +95 -36
- package/dist/commands/utils/get-migrations.js.map +1 -1
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.js +40 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controllers/products/admin-list-products.js +16 -8
- package/dist/controllers/products/admin-list-products.js.map +1 -1
- package/dist/helpers/test-request.js +21 -15
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/interfaces/abstract-parser.d.ts +25 -0
- package/dist/interfaces/abstract-parser.js +14 -0
- package/dist/interfaces/abstract-parser.js.map +1 -0
- package/dist/interfaces/base-service.d.ts +66 -0
- package/dist/interfaces/base-service.js +377 -0
- package/dist/interfaces/base-service.js.map +1 -0
- package/dist/interfaces/batch-job-strategy.d.ts +34 -0
- package/dist/interfaces/batch-job-strategy.js +182 -0
- package/dist/interfaces/batch-job-strategy.js.map +1 -0
- package/dist/interfaces/csv-parser.d.ts +46 -0
- package/dist/interfaces/csv-parser.js +15 -0
- package/dist/interfaces/csv-parser.js.map +1 -0
- package/dist/interfaces/file-service.d.ts +66 -0
- package/dist/interfaces/file-service.js +32 -0
- package/dist/interfaces/file-service.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +2 -0
- package/dist/interfaces/index.js.map +1 -1
- package/dist/loaders/config.js +3 -2
- package/dist/loaders/config.js.map +1 -1
- package/dist/loaders/feature-flags/index.d.ts +6 -0
- package/dist/loaders/feature-flags/index.js +71 -0
- package/dist/loaders/feature-flags/index.js.map +1 -0
- package/dist/loaders/index.d.ts +1 -1
- package/dist/loaders/index.js +8 -5
- package/dist/loaders/index.js.map +1 -1
- package/dist/loaders/plugins.d.ts +4 -3
- package/dist/loaders/plugins.js +71 -34
- package/dist/loaders/plugins.js.map +1 -1
- package/dist/loaders/redis.d.ts +1 -1
- package/dist/loaders/redis.js.map +1 -1
- package/dist/loaders/search-index.js +1 -0
- package/dist/loaders/search-index.js.map +1 -1
- package/dist/loaders/strategies.d.ts +2 -2
- package/dist/loaders/strategies.js +21 -7
- package/dist/loaders/strategies.js.map +1 -1
- package/dist/migrations/1649775522087-add_batch_job_model.js +4 -4
- package/dist/migrations/1649775522087-add_batch_job_model.js.map +1 -1
- package/dist/models/batch-job.d.ts +45 -4
- package/dist/models/batch-job.js +94 -7
- package/dist/models/batch-job.js.map +1 -1
- package/dist/models/customer.d.ts +1 -1
- package/dist/models/customer.js +1 -1
- package/dist/models/customer.js.map +1 -1
- package/dist/models/draft-order.d.ts +1 -2
- package/dist/models/draft-order.js +2 -2
- package/dist/models/draft-order.js.map +1 -1
- package/dist/models/line-item.d.ts +9 -2
- package/dist/models/line-item.js +2 -2
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/product.d.ts +17 -17
- package/dist/models/product.js +34 -34
- package/dist/models/product.js.map +1 -1
- package/dist/models/shipping-method.d.ts +1 -1
- package/dist/models/shipping-method.js +1 -1
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/shipping-option.d.ts +1 -1
- package/dist/models/shipping-option.js +1 -1
- package/dist/models/shipping-option.js.map +1 -1
- package/dist/repositories/customer.d.ts +2 -1
- package/dist/repositories/customer.js +18 -7
- package/dist/repositories/customer.js.map +1 -1
- package/dist/repositories/gift-card.d.ts +5 -1
- package/dist/repositories/gift-card.js +124 -29
- package/dist/repositories/gift-card.js.map +1 -1
- package/dist/repositories/image.d.ts +1 -0
- package/dist/repositories/image.js +100 -0
- package/dist/repositories/image.js.map +1 -1
- package/dist/repositories/price-list.js.map +1 -1
- package/dist/repositories/product-tag.d.ts +6 -0
- package/dist/repositories/product-tag.js +113 -0
- package/dist/repositories/product-tag.js.map +1 -1
- package/dist/repositories/product-type.d.ts +5 -0
- package/dist/repositories/product-type.js +64 -0
- package/dist/repositories/product-type.js.map +1 -1
- package/dist/repositories/product-variant.js +4 -5
- package/dist/repositories/product-variant.js.map +1 -1
- package/dist/repositories/product.d.ts +14 -17
- package/dist/repositories/product.js +64 -2
- package/dist/repositories/product.js.map +1 -1
- package/dist/repositories/tax-rate.d.ts +1 -1
- package/dist/repositories/tax-rate.js +2 -9
- package/dist/repositories/tax-rate.js.map +1 -1
- package/dist/services/auth.d.ts +16 -7
- package/dist/services/auth.js +130 -93
- package/dist/services/auth.js.map +1 -1
- package/dist/services/batch-job.d.ts +30 -5
- package/dist/services/batch-job.js +437 -2
- package/dist/services/batch-job.js.map +1 -1
- package/dist/services/cart.js +34 -13
- package/dist/services/cart.js.map +1 -1
- package/dist/services/claim-item.d.ts +23 -27
- package/dist/services/claim-item.js +217 -247
- package/dist/services/claim-item.js.map +1 -1
- package/dist/services/claim.d.ts +89 -71
- package/dist/services/claim.js +911 -879
- package/dist/services/claim.js.map +1 -1
- package/dist/services/csv-parser.d.ts +17 -0
- package/dist/services/csv-parser.js +319 -0
- package/dist/services/csv-parser.js.map +1 -0
- package/dist/services/custom-shipping-option.d.ts +30 -32
- package/dist/services/custom-shipping-option.js +78 -74
- package/dist/services/custom-shipping-option.js.map +1 -1
- package/dist/services/customer.d.ts +48 -50
- package/dist/services/customer.js +465 -428
- package/dist/services/customer.js.map +1 -1
- package/dist/services/discount-condition.d.ts +13 -13
- package/dist/services/discount-condition.js +5 -16
- package/dist/services/discount-condition.js.map +1 -1
- package/dist/services/discount.d.ts +22 -16
- package/dist/services/discount.js +530 -484
- package/dist/services/discount.js.map +1 -1
- package/dist/services/draft-order.d.ts +69 -66
- package/dist/services/draft-order.js +375 -353
- package/dist/services/draft-order.js.map +1 -1
- package/dist/services/event-bus.d.ts +72 -56
- package/dist/services/event-bus.js +122 -99
- package/dist/services/event-bus.js.map +1 -1
- package/dist/services/file.d.ts +14 -0
- package/dist/services/file.js +43 -0
- package/dist/services/file.js.map +1 -0
- package/dist/services/fulfillment.d.ts +63 -64
- package/dist/services/fulfillment.js +200 -194
- package/dist/services/fulfillment.js.map +1 -1
- package/dist/services/gift-card.d.ts +54 -45
- package/dist/services/gift-card.js +239 -221
- package/dist/services/gift-card.js.map +1 -1
- package/dist/services/idempotency-key.d.ts +1 -5
- package/dist/services/idempotency-key.js +2 -5
- package/dist/services/idempotency-key.js.map +1 -1
- package/dist/services/index.d.ts +11 -9
- package/dist/services/index.js +23 -19
- package/dist/services/index.js.map +1 -1
- package/dist/services/line-item.d.ts +3 -2
- package/dist/services/line-item.js +9 -7
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/price-list.d.ts +4 -1
- package/dist/services/price-list.js +7 -4
- package/dist/services/price-list.js.map +1 -1
- package/dist/services/pricing.d.ts +101 -0
- package/dist/services/pricing.js +588 -0
- package/dist/services/pricing.js.map +1 -0
- package/dist/services/product-variant.d.ts +0 -11
- package/dist/services/product-variant.js +28 -138
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/product.d.ts +107 -145
- package/dist/services/product.js +708 -1036
- package/dist/services/product.js.map +1 -1
- package/dist/services/region.js +4 -4
- package/dist/services/region.js.map +1 -1
- package/dist/services/shipping-option.d.ts +43 -108
- package/dist/services/shipping-option.js +305 -352
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/shipping-profile.d.ts +2 -2
- package/dist/services/shipping-profile.js +1 -1
- package/dist/services/store.d.ts +36 -45
- package/dist/services/store.js +207 -217
- package/dist/services/store.js.map +1 -1
- package/dist/services/strategy-resolver.d.ts +13 -0
- package/dist/services/strategy-resolver.js +40 -0
- package/dist/services/strategy-resolver.js.map +1 -0
- package/dist/services/tax-provider.d.ts +7 -3
- package/dist/services/tax-provider.js +6 -6
- package/dist/services/tax-provider.js.map +1 -1
- package/dist/services/tax-rate.d.ts +1 -1
- package/dist/services/tax-rate.js +2 -2
- package/dist/services/tax-rate.js.map +1 -1
- package/dist/services/totals.js.map +1 -1
- package/dist/services/user.d.ts +8 -9
- package/dist/services/user.js +216 -168
- package/dist/services/user.js.map +1 -1
- package/dist/strategies/__fixtures__/order-export-data.d.ts +3 -0
- package/dist/strategies/__fixtures__/order-export-data.js +70 -0
- package/dist/strategies/__fixtures__/order-export-data.js.map +1 -0
- package/dist/strategies/__fixtures__/product-export-data.d.ts +319 -0
- package/dist/strategies/__fixtures__/product-export-data.js +401 -0
- package/dist/strategies/__fixtures__/product-export-data.js.map +1 -0
- package/dist/strategies/batch-jobs/order/export.d.ts +36 -0
- package/dist/strategies/batch-jobs/order/export.js +351 -0
- package/dist/strategies/batch-jobs/order/export.js.map +1 -0
- package/dist/strategies/batch-jobs/order/index.d.ts +29 -0
- package/dist/strategies/batch-jobs/order/index.js +115 -0
- package/dist/strategies/batch-jobs/order/index.js.map +1 -0
- package/dist/strategies/batch-jobs/product/export.d.ts +36 -0
- package/dist/strategies/batch-jobs/product/export.js +546 -0
- package/dist/strategies/batch-jobs/product/export.js.map +1 -0
- package/dist/strategies/batch-jobs/product/index.d.ts +45 -0
- package/dist/strategies/batch-jobs/product/index.js +272 -0
- package/dist/strategies/batch-jobs/product/index.js.map +1 -0
- package/dist/subscribers/batch-job.d.ts +17 -0
- package/dist/subscribers/batch-job.js +96 -0
- package/dist/subscribers/batch-job.js.map +1 -0
- package/dist/types/batch-job.d.ts +23 -2
- package/dist/types/batch-job.js +4 -1
- package/dist/types/batch-job.js.map +1 -1
- package/dist/types/claim.d.ts +67 -0
- package/dist/types/claim.js +3 -0
- package/dist/types/claim.js.map +1 -0
- package/dist/types/common.d.ts +27 -3
- package/dist/types/common.js.map +1 -1
- package/dist/types/customers.d.ts +24 -0
- package/dist/types/customers.js.map +1 -1
- package/dist/types/discount.d.ts +2 -1
- package/dist/types/discount.js.map +1 -1
- package/dist/types/feature-flags.d.ts +9 -0
- package/dist/types/feature-flags.js +3 -0
- package/dist/types/feature-flags.js.map +1 -0
- package/dist/types/fulfillment.d.ts +27 -0
- package/dist/types/fulfillment.js +3 -0
- package/dist/types/fulfillment.js.map +1 -0
- package/dist/types/gift-card.d.ts +21 -0
- package/dist/types/gift-card.js +3 -0
- package/dist/types/gift-card.js.map +1 -0
- package/dist/types/global.d.ts +12 -1
- package/dist/types/price-list.d.ts +9 -0
- package/dist/types/pricing.d.ts +30 -0
- package/dist/types/pricing.js +3 -0
- package/dist/types/pricing.js.map +1 -0
- package/dist/types/product-variant.d.ts +4 -3
- package/dist/types/product-variant.js.map +1 -1
- package/dist/types/product.d.ts +110 -8
- package/dist/types/product.js +8 -11
- package/dist/types/product.js.map +1 -1
- package/dist/types/shipping-options.d.ts +62 -0
- package/dist/types/shipping-options.js +3 -0
- package/dist/types/shipping-options.js.map +1 -0
- package/dist/types/store.d.ts +9 -0
- package/dist/types/store.js +3 -0
- package/dist/types/store.js.map +1 -0
- package/dist/utils/build-query.d.ts +7 -7
- package/dist/utils/build-query.js +9 -5
- package/dist/utils/build-query.js.map +1 -1
- package/dist/utils/countries.d.ts +3 -2
- package/dist/utils/countries.js.map +1 -1
- package/dist/utils/currencies.d.ts +10 -1899
- package/dist/utils/currencies.js.map +1 -1
- package/dist/utils/db-aware-column.js +2 -2
- package/dist/utils/db-aware-column.js.map +1 -1
- package/dist/utils/feature-flag-decorators.d.ts +4 -0
- package/dist/utils/feature-flag-decorators.js +52 -0
- package/dist/utils/feature-flag-decorators.js.map +1 -0
- package/dist/utils/flag-router.d.ts +7 -0
- package/dist/utils/flag-router.js +19 -0
- package/dist/utils/flag-router.js.map +1 -0
- package/dist/utils/format-registration-name.d.ts +4 -4
- package/dist/utils/format-registration-name.js +7 -10
- package/dist/utils/format-registration-name.js.map +1 -1
- package/dist/utils/get-query-config.d.ts +4 -6
- package/dist/utils/get-query-config.js +46 -1
- package/dist/utils/get-query-config.js.map +1 -1
- package/dist/utils/omit-relation-if-exists.d.ts +7 -0
- package/dist/utils/omit-relation-if-exists.js +16 -0
- package/dist/utils/omit-relation-if-exists.js.map +1 -0
- package/dist/utils/set-metadata.d.ts +6 -6
- package/dist/utils/set-metadata.js +5 -5
- package/dist/utils/set-metadata.js.map +1 -1
- package/dist/utils/sleep.d.ts +1 -0
- package/dist/utils/sleep.js +50 -0
- package/dist/utils/sleep.js.map +1 -0
- package/package.json +6 -4
- package/yarn-error.log +29038 -0
package/dist/services/user.js
CHANGED
|
@@ -104,9 +104,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
104
104
|
};
|
|
105
105
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
106
106
|
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
107
|
-
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
108
|
-
var medusa_interfaces_1 = require("medusa-interfaces");
|
|
109
107
|
var scrypt_kdf_1 = __importDefault(require("scrypt-kdf"));
|
|
108
|
+
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
109
|
+
var interfaces_1 = require("../interfaces");
|
|
110
|
+
var utils_1 = require("../utils");
|
|
110
111
|
/**
|
|
111
112
|
* Provides layer to manipulate users.
|
|
112
113
|
* @extends BaseService
|
|
@@ -115,27 +116,12 @@ var UserService = /** @class */ (function (_super) {
|
|
|
115
116
|
__extends(UserService, _super);
|
|
116
117
|
function UserService(_a) {
|
|
117
118
|
var userRepository = _a.userRepository, eventBusService = _a.eventBusService, manager = _a.manager;
|
|
118
|
-
var _this = _super.call(this) || this;
|
|
119
|
-
/** @private @const {UserRepository} */
|
|
119
|
+
var _this = _super.call(this, { userRepository: userRepository, eventBusService: eventBusService, manager: manager }) || this;
|
|
120
120
|
_this.userRepository_ = userRepository;
|
|
121
|
-
/** @private @const {EventBus} */
|
|
122
121
|
_this.eventBus_ = eventBusService;
|
|
123
|
-
/** @private @const {EntityManager} */
|
|
124
122
|
_this.manager_ = manager;
|
|
125
123
|
return _this;
|
|
126
124
|
}
|
|
127
|
-
UserService.prototype.withTransaction = function (transactionManager) {
|
|
128
|
-
if (!transactionManager) {
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
var cloned = new UserService({
|
|
132
|
-
manager: transactionManager,
|
|
133
|
-
userRepository: this.userRepository_,
|
|
134
|
-
eventBusService: this.eventBus_,
|
|
135
|
-
});
|
|
136
|
-
cloned.transactionManager_ = transactionManager;
|
|
137
|
-
return cloned;
|
|
138
|
-
};
|
|
139
125
|
/**
|
|
140
126
|
* Used to validate user email.
|
|
141
127
|
* @param {string} email - email to validate
|
|
@@ -157,10 +143,22 @@ var UserService = /** @class */ (function (_super) {
|
|
|
157
143
|
UserService.prototype.list = function (selector, config) {
|
|
158
144
|
if (config === void 0) { config = {}; }
|
|
159
145
|
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
-
var
|
|
146
|
+
var _this = this;
|
|
161
147
|
return __generator(this, function (_a) {
|
|
162
|
-
|
|
163
|
-
|
|
148
|
+
switch (_a.label) {
|
|
149
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (transactionManager) { return __awaiter(_this, void 0, void 0, function () {
|
|
150
|
+
var userRepo;
|
|
151
|
+
return __generator(this, function (_a) {
|
|
152
|
+
switch (_a.label) {
|
|
153
|
+
case 0:
|
|
154
|
+
userRepo = transactionManager.getCustomRepository(this.userRepository_);
|
|
155
|
+
return [4 /*yield*/, userRepo.find((0, utils_1.buildQuery)(selector, config))];
|
|
156
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}); })];
|
|
160
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
161
|
+
}
|
|
164
162
|
});
|
|
165
163
|
});
|
|
166
164
|
};
|
|
@@ -174,20 +172,27 @@ var UserService = /** @class */ (function (_super) {
|
|
|
174
172
|
UserService.prototype.retrieve = function (userId, config) {
|
|
175
173
|
if (config === void 0) { config = {}; }
|
|
176
174
|
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
-
var
|
|
175
|
+
var _this = this;
|
|
178
176
|
return __generator(this, function (_a) {
|
|
179
177
|
switch (_a.label) {
|
|
180
|
-
case 0:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
178
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (transactionManager) { return __awaiter(_this, void 0, void 0, function () {
|
|
179
|
+
var userRepo, query, user;
|
|
180
|
+
return __generator(this, function (_a) {
|
|
181
|
+
switch (_a.label) {
|
|
182
|
+
case 0:
|
|
183
|
+
userRepo = transactionManager.getCustomRepository(this.userRepository_);
|
|
184
|
+
query = (0, utils_1.buildQuery)({ id: userId }, config);
|
|
185
|
+
return [4 /*yield*/, userRepo.findOne(query)];
|
|
186
|
+
case 1:
|
|
187
|
+
user = _a.sent();
|
|
188
|
+
if (!user) {
|
|
189
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "User with id: ".concat(userId, " was not found"));
|
|
190
|
+
}
|
|
191
|
+
return [2 /*return*/, user];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}); })];
|
|
195
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
191
196
|
}
|
|
192
197
|
});
|
|
193
198
|
});
|
|
@@ -202,21 +207,29 @@ var UserService = /** @class */ (function (_super) {
|
|
|
202
207
|
UserService.prototype.retrieveByApiToken = function (apiToken, relations) {
|
|
203
208
|
if (relations === void 0) { relations = []; }
|
|
204
209
|
return __awaiter(this, void 0, void 0, function () {
|
|
205
|
-
var
|
|
210
|
+
var _this = this;
|
|
206
211
|
return __generator(this, function (_a) {
|
|
207
212
|
switch (_a.label) {
|
|
208
|
-
case 0:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (transactionManager) { return __awaiter(_this, void 0, void 0, function () {
|
|
214
|
+
var userRepo, user;
|
|
215
|
+
return __generator(this, function (_a) {
|
|
216
|
+
switch (_a.label) {
|
|
217
|
+
case 0:
|
|
218
|
+
userRepo = transactionManager.getCustomRepository(this.userRepository_);
|
|
219
|
+
return [4 /*yield*/, userRepo.findOne({
|
|
220
|
+
where: { api_token: apiToken },
|
|
221
|
+
relations: relations,
|
|
222
|
+
})];
|
|
223
|
+
case 1:
|
|
224
|
+
user = _a.sent();
|
|
225
|
+
if (!user) {
|
|
226
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "User with api token: ".concat(apiToken, " was not found"));
|
|
227
|
+
}
|
|
228
|
+
return [2 /*return*/, user];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}); })];
|
|
232
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
220
233
|
}
|
|
221
234
|
});
|
|
222
235
|
});
|
|
@@ -231,19 +244,27 @@ var UserService = /** @class */ (function (_super) {
|
|
|
231
244
|
UserService.prototype.retrieveByEmail = function (email, config) {
|
|
232
245
|
if (config === void 0) { config = {}; }
|
|
233
246
|
return __awaiter(this, void 0, void 0, function () {
|
|
234
|
-
var
|
|
247
|
+
var _this = this;
|
|
235
248
|
return __generator(this, function (_a) {
|
|
236
249
|
switch (_a.label) {
|
|
237
|
-
case 0:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (transactionManager) { return __awaiter(_this, void 0, void 0, function () {
|
|
251
|
+
var userRepo, query, user;
|
|
252
|
+
return __generator(this, function (_a) {
|
|
253
|
+
switch (_a.label) {
|
|
254
|
+
case 0:
|
|
255
|
+
userRepo = transactionManager.getCustomRepository(this.userRepository_);
|
|
256
|
+
query = (0, utils_1.buildQuery)({ email: email.toLowerCase() }, config);
|
|
257
|
+
return [4 /*yield*/, userRepo.findOne(query)];
|
|
258
|
+
case 1:
|
|
259
|
+
user = _a.sent();
|
|
260
|
+
if (!user) {
|
|
261
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "User with email: ".concat(email, " was not found"));
|
|
262
|
+
}
|
|
263
|
+
return [2 /*return*/, user];
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}); })];
|
|
267
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
247
268
|
}
|
|
248
269
|
});
|
|
249
270
|
});
|
|
@@ -277,27 +298,31 @@ var UserService = /** @class */ (function (_super) {
|
|
|
277
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
278
299
|
var _this = this;
|
|
279
300
|
return __generator(this, function (_a) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
switch (_a.label) {
|
|
302
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
303
|
+
var userRepo, createData, validatedEmail, hashedPassword, created;
|
|
304
|
+
return __generator(this, function (_a) {
|
|
305
|
+
switch (_a.label) {
|
|
306
|
+
case 0:
|
|
307
|
+
userRepo = manager.getCustomRepository(this.userRepository_);
|
|
308
|
+
createData = __assign({}, user);
|
|
309
|
+
validatedEmail = this.validateEmail_(user.email);
|
|
310
|
+
if (!password) return [3 /*break*/, 2];
|
|
311
|
+
return [4 /*yield*/, this.hashPassword_(password)];
|
|
312
|
+
case 1:
|
|
313
|
+
hashedPassword = _a.sent();
|
|
314
|
+
createData.password_hash = hashedPassword;
|
|
315
|
+
_a.label = 2;
|
|
316
|
+
case 2:
|
|
317
|
+
createData.email = validatedEmail;
|
|
318
|
+
created = userRepo.create(createData);
|
|
319
|
+
return [4 /*yield*/, userRepo.save(created)];
|
|
320
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}); })];
|
|
324
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
325
|
+
}
|
|
301
326
|
});
|
|
302
327
|
});
|
|
303
328
|
};
|
|
@@ -311,44 +336,47 @@ var UserService = /** @class */ (function (_super) {
|
|
|
311
336
|
return __awaiter(this, void 0, void 0, function () {
|
|
312
337
|
var _this = this;
|
|
313
338
|
return __generator(this, function (_a) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
try {
|
|
336
|
-
for (_a = __values(Object.entries(rest)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
337
|
-
_c = __read(_b.value, 2), key = _c[0], value = _c[1];
|
|
338
|
-
user[key] = value;
|
|
339
|
+
switch (_a.label) {
|
|
340
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
341
|
+
var userRepo, user, email, password_hash, metadata, rest, _a, _b, _c, key, value;
|
|
342
|
+
var e_1, _d;
|
|
343
|
+
return __generator(this, function (_e) {
|
|
344
|
+
switch (_e.label) {
|
|
345
|
+
case 0:
|
|
346
|
+
userRepo = manager.getCustomRepository(this.userRepository_);
|
|
347
|
+
return [4 /*yield*/, this.retrieve(userId)];
|
|
348
|
+
case 1:
|
|
349
|
+
user = _e.sent();
|
|
350
|
+
email = update.email, password_hash = update.password_hash, metadata = update.metadata, rest = __rest(update, ["email", "password_hash", "metadata"]);
|
|
351
|
+
if (email) {
|
|
352
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "You are not allowed to update email");
|
|
353
|
+
}
|
|
354
|
+
if (password_hash) {
|
|
355
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "Use dedicated methods, `setPassword`, `generateResetPasswordToken` for password operations");
|
|
356
|
+
}
|
|
357
|
+
if (metadata) {
|
|
358
|
+
user.metadata = (0, utils_1.setMetadata)(user, metadata);
|
|
339
359
|
}
|
|
340
|
-
}
|
|
341
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
342
|
-
finally {
|
|
343
360
|
try {
|
|
344
|
-
|
|
361
|
+
for (_a = __values(Object.entries(rest)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
362
|
+
_c = __read(_b.value, 2), key = _c[0], value = _c[1];
|
|
363
|
+
user[key] = value;
|
|
364
|
+
}
|
|
345
365
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
366
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
367
|
+
finally {
|
|
368
|
+
try {
|
|
369
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
370
|
+
}
|
|
371
|
+
finally { if (e_1) throw e_1.error; }
|
|
372
|
+
}
|
|
373
|
+
return [4 /*yield*/, userRepo.save(user)];
|
|
374
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}); })];
|
|
378
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
379
|
+
}
|
|
352
380
|
});
|
|
353
381
|
});
|
|
354
382
|
};
|
|
@@ -362,25 +390,28 @@ var UserService = /** @class */ (function (_super) {
|
|
|
362
390
|
return __awaiter(this, void 0, void 0, function () {
|
|
363
391
|
var _this = this;
|
|
364
392
|
return __generator(this, function (_a) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
393
|
+
switch (_a.label) {
|
|
394
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
395
|
+
var userRepo, user;
|
|
396
|
+
return __generator(this, function (_a) {
|
|
397
|
+
switch (_a.label) {
|
|
398
|
+
case 0:
|
|
399
|
+
userRepo = manager.getCustomRepository(this.userRepository_);
|
|
400
|
+
return [4 /*yield*/, userRepo.findOne({ where: { id: userId } })];
|
|
401
|
+
case 1:
|
|
402
|
+
user = _a.sent();
|
|
403
|
+
if (!user) {
|
|
404
|
+
return [2 /*return*/, Promise.resolve()];
|
|
405
|
+
}
|
|
406
|
+
return [4 /*yield*/, userRepo.softRemove(user)];
|
|
407
|
+
case 2:
|
|
408
|
+
_a.sent();
|
|
375
409
|
return [2 /*return*/, Promise.resolve()];
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
}); })];
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}); })];
|
|
413
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
414
|
+
}
|
|
384
415
|
});
|
|
385
416
|
});
|
|
386
417
|
};
|
|
@@ -396,26 +427,30 @@ var UserService = /** @class */ (function (_super) {
|
|
|
396
427
|
return __awaiter(this, void 0, void 0, function () {
|
|
397
428
|
var _this = this;
|
|
398
429
|
return __generator(this, function (_a) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
430
|
+
switch (_a.label) {
|
|
431
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
432
|
+
var userRepo, user, hashedPassword;
|
|
433
|
+
return __generator(this, function (_a) {
|
|
434
|
+
switch (_a.label) {
|
|
435
|
+
case 0:
|
|
436
|
+
userRepo = manager.getCustomRepository(this.userRepository_);
|
|
437
|
+
return [4 /*yield*/, this.retrieve(userId)];
|
|
438
|
+
case 1:
|
|
439
|
+
user = _a.sent();
|
|
440
|
+
return [4 /*yield*/, this.hashPassword_(password)];
|
|
441
|
+
case 2:
|
|
442
|
+
hashedPassword = _a.sent();
|
|
443
|
+
if (!hashedPassword) {
|
|
444
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.DB_ERROR, "An error occured while hashing password");
|
|
445
|
+
}
|
|
446
|
+
user.password_hash = hashedPassword;
|
|
447
|
+
return [4 /*yield*/, userRepo.save(user)];
|
|
448
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}); })];
|
|
452
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
453
|
+
}
|
|
419
454
|
});
|
|
420
455
|
});
|
|
421
456
|
};
|
|
@@ -430,24 +465,37 @@ var UserService = /** @class */ (function (_super) {
|
|
|
430
465
|
*/
|
|
431
466
|
UserService.prototype.generateResetPasswordToken = function (userId) {
|
|
432
467
|
return __awaiter(this, void 0, void 0, function () {
|
|
433
|
-
var
|
|
468
|
+
var _this = this;
|
|
434
469
|
return __generator(this, function (_a) {
|
|
435
470
|
switch (_a.label) {
|
|
436
|
-
case 0: return [4 /*yield*/, this.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
471
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (transactionManager) { return __awaiter(_this, void 0, void 0, function () {
|
|
472
|
+
var user, secret, expiry, payload, token;
|
|
473
|
+
return __generator(this, function (_a) {
|
|
474
|
+
switch (_a.label) {
|
|
475
|
+
case 0: return [4 /*yield*/, this.retrieve(userId, {
|
|
476
|
+
select: ["id", "email", "password_hash"],
|
|
477
|
+
})];
|
|
478
|
+
case 1:
|
|
479
|
+
user = _a.sent();
|
|
480
|
+
secret = user.password_hash;
|
|
481
|
+
expiry = Math.floor(Date.now() / 1000) + 60 * 15;
|
|
482
|
+
payload = { user_id: user.id, email: user.email, exp: expiry };
|
|
483
|
+
token = jsonwebtoken_1.default.sign(payload, secret);
|
|
484
|
+
// Notify subscribers
|
|
485
|
+
return [4 /*yield*/, this.eventBus_
|
|
486
|
+
.withTransaction(transactionManager)
|
|
487
|
+
.emit(UserService.Events.PASSWORD_RESET, {
|
|
488
|
+
email: user.email,
|
|
489
|
+
token: token,
|
|
490
|
+
})];
|
|
491
|
+
case 2:
|
|
492
|
+
// Notify subscribers
|
|
493
|
+
_a.sent();
|
|
494
|
+
return [2 /*return*/, token];
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}); })];
|
|
498
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
451
499
|
}
|
|
452
500
|
});
|
|
453
501
|
});
|
|
@@ -456,6 +504,6 @@ var UserService = /** @class */ (function (_super) {
|
|
|
456
504
|
PASSWORD_RESET: "user.password_reset",
|
|
457
505
|
};
|
|
458
506
|
return UserService;
|
|
459
|
-
}(
|
|
507
|
+
}(interfaces_1.TransactionBaseService));
|
|
460
508
|
exports.default = UserService;
|
|
461
509
|
//# sourceMappingURL=user.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/services/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/services/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA8B;AAC9B,0DAA+B;AAC/B,uDAA0D;AAW1D,4CAAsD;AACtD,kCAAkD;AAQlD;;;GAGG;AACH;IAA0B,+BAAmC;IAU3D,qBAAY,EAA8D;YAA5D,cAAc,oBAAA,EAAE,eAAe,qBAAA,EAAE,OAAO,aAAA;QAAtD,YACE,kBAAM,EAAE,cAAc,gBAAA,EAAE,eAAe,iBAAA,EAAE,OAAO,SAAA,EAAE,CAAC,SAKpD;QAHC,KAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,KAAI,CAAC,SAAS,GAAG,eAAe,CAAA;QAChC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;;IACzB,CAAC;IAED;;;;OAIG;IACH,oCAAc,GAAd,UAAe,KAAa;QAC1B,IAAM,MAAM,GAAG,6BAAS,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAA;QAC9C,IAAA,KAAmB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAvC,KAAK,WAAA,EAAE,KAAK,WAA2B,CAAA;QAC/C,IAAI,KAAK,EAAE;YACT,MAAM,IAAI,+BAAW,CACnB,+BAAW,CAAC,KAAK,CAAC,YAAY,EA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aAAa,CAAA;wCAC3B,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;wCAChD,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;wCAC9D,KAAK,GAAG,sBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;wCAEvC,qBAAqB;wCACrB,qBAAM,IAAI,CAAC,SAAS;iDACjB,eAAe,CAAC,kBAAkB,CAAC;iDACnC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE;gDACvC,KAAK,EAAE,IAAI,CAAC,KAAK;gDACjB,KAAK,OAAA;6CACN,CAAC,EAAA;;wCANJ,qBAAqB;wCACrB,SAKI,CAAA;wCAEJ,sBAAO,KAAK,EAAA;;;6BACb,CAAC,EAAA;4BAlBF,sBAAO,SAkBL,EAAA;;;;KACH;IAzSM,kBAAM,GAAG;QACd,cAAc,EAAE,qBAAqB;KACtC,CAAA;IAwSH,kBAAC;CAAA,AA3SD,CAA0B,mCAAsB,GA2S/C;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ordersToExport = void 0;
|
|
4
|
+
var models_1 = require("../../models");
|
|
5
|
+
var createdAtDate = new Date("2019-01-01T00:00:00.000Z");
|
|
6
|
+
exports.ordersToExport = [
|
|
7
|
+
{
|
|
8
|
+
id: "order_1",
|
|
9
|
+
created_at: createdAtDate,
|
|
10
|
+
display_id: 123,
|
|
11
|
+
status: models_1.OrderStatus.PENDING,
|
|
12
|
+
fulfillment_status: models_1.FulfillmentStatus.PARTIALLY_FULFILLED,
|
|
13
|
+
payment_status: models_1.PaymentStatus.CAPTURED,
|
|
14
|
+
subtotal: 10,
|
|
15
|
+
shipping_total: 10,
|
|
16
|
+
discount_total: 0,
|
|
17
|
+
gift_card_total: 0,
|
|
18
|
+
refunded_total: 0,
|
|
19
|
+
tax_total: 5,
|
|
20
|
+
total: 25,
|
|
21
|
+
currency_code: "usd",
|
|
22
|
+
region_id: "region_1",
|
|
23
|
+
shipping_address: {
|
|
24
|
+
id: "address_1",
|
|
25
|
+
address_1: "123 Main St",
|
|
26
|
+
address_2: "",
|
|
27
|
+
city: "New York",
|
|
28
|
+
country_code: "US",
|
|
29
|
+
postal_code: "10001",
|
|
30
|
+
},
|
|
31
|
+
customer: {
|
|
32
|
+
id: "customer_1",
|
|
33
|
+
first_name: "John",
|
|
34
|
+
last_name: "Doe",
|
|
35
|
+
email: "John@Doe.com",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "order_2",
|
|
40
|
+
created_at: createdAtDate,
|
|
41
|
+
display_id: 124,
|
|
42
|
+
status: models_1.OrderStatus.COMPLETED,
|
|
43
|
+
fulfillment_status: models_1.FulfillmentStatus.FULFILLED,
|
|
44
|
+
payment_status: models_1.PaymentStatus.CAPTURED,
|
|
45
|
+
subtotal: 125,
|
|
46
|
+
shipping_total: 10,
|
|
47
|
+
discount_total: 0,
|
|
48
|
+
gift_card_total: 0,
|
|
49
|
+
refunded_total: 0,
|
|
50
|
+
tax_total: 0,
|
|
51
|
+
total: 135,
|
|
52
|
+
currency_code: "eur",
|
|
53
|
+
region_id: "region_2",
|
|
54
|
+
shipping_address: {
|
|
55
|
+
id: "address_2",
|
|
56
|
+
address_1: "Hovedgaden 1",
|
|
57
|
+
address_2: "",
|
|
58
|
+
city: "Copenhagen",
|
|
59
|
+
country_code: "DK",
|
|
60
|
+
postal_code: "1150",
|
|
61
|
+
},
|
|
62
|
+
customer: {
|
|
63
|
+
id: "customer_2",
|
|
64
|
+
first_name: "Jane",
|
|
65
|
+
last_name: "Doe",
|
|
66
|
+
email: "Jane@Doe.com",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
//# sourceMappingURL=order-export-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-export-data.js","sourceRoot":"","sources":["../../../src/strategies/__fixtures__/order-export-data.ts"],"names":[],"mappings":";;;AACA,uCAKqB;AAErB,IAAM,aAAa,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAA;AAE7C,QAAA,cAAc,GAAyB;IAClD;QACE,EAAE,EAAE,SAAS;QACb,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,GAAG;QACf,MAAM,EAAE,oBAAW,CAAC,OAAO;QAC3B,kBAAkB,EAAE,0BAAiB,CAAC,mBAAmB;QACzD,cAAc,EAAE,sBAAa,CAAC,QAAQ;QACtC,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;QAClB,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,CAAC;QAClB,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,KAAK;QACpB,SAAS,EAAE,UAAU;QACrB,gBAAgB,EAAE;YAChB,EAAE,EAAE,WAAW;YACf,SAAS,EAAE,aAAa;YACxB,SAAS,EAAE,EAAE;YACb,IAAI,EAAE,UAAU;YAChB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,OAAO;SACrB;QACD,QAAQ,EAAE;YACR,EAAE,EAAE,YAAY;YAChB,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,cAAc;SACtB;KACF;IACD;QACE,EAAE,EAAE,SAAS;QACb,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,GAAG;QACf,MAAM,EAAE,oBAAW,CAAC,SAAS;QAC7B,kBAAkB,EAAE,0BAAiB,CAAC,SAAS;QAC/C,cAAc,EAAE,sBAAa,CAAC,QAAQ;QACtC,QAAQ,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