@medusajs/medusa 1.1.63 → 1.2.0
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 +31 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/routes/admin/collections/add-products.d.ts +32 -0
- package/dist/api/routes/admin/{product-tags/update-collection.js → collections/add-products.js} +25 -45
- package/dist/api/routes/admin/collections/add-products.js.map +1 -0
- package/dist/api/routes/admin/collections/index.d.ts +2 -0
- package/dist/api/routes/admin/collections/index.js +11 -1
- package/dist/api/routes/admin/collections/index.js.map +1 -1
- package/dist/api/routes/admin/collections/remove-products.d.ts +32 -0
- package/dist/api/routes/admin/{product-tags/create-collection.js → collections/remove-products.js} +35 -49
- package/dist/api/routes/admin/collections/remove-products.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +27 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.js +103 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +28 -0
- package/dist/api/routes/admin/{product-tags/delete-collection.js → customer-groups/delete-customer-group.js} +25 -25
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +27 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js +106 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +25 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.js +113 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/index.d.ts +13 -0
- package/dist/api/routes/admin/customer-groups/index.js +31 -0
- package/dist/api/routes/admin/customer-groups/index.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.d.ts +28 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.js +124 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customers/get-customer.js +18 -5
- package/dist/api/routes/admin/customers/get-customer.js.map +1 -1
- package/dist/api/routes/admin/customers/index.d.ts +1 -0
- package/dist/api/routes/admin/customers/index.js +2 -0
- package/dist/api/routes/admin/customers/index.js.map +1 -1
- package/dist/api/routes/admin/customers/update-customer.d.ts +14 -0
- package/dist/api/routes/admin/customers/update-customer.js +49 -10
- package/dist/api/routes/admin/customers/update-customer.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/create-draft-order.d.ts +3 -3
- package/dist/api/routes/admin/draft-orders/create-draft-order.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/create-line-item.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/create-line-item.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/update-line-item.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/update-line-item.js.map +1 -1
- package/dist/api/routes/admin/index.js +6 -0
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/orders/add-shipping-method.d.ts +1 -1
- package/dist/api/routes/admin/orders/add-shipping-method.js.map +1 -1
- package/dist/api/routes/admin/orders/create-claim.js +9 -1
- package/dist/api/routes/admin/orders/create-claim.js.map +1 -1
- package/dist/api/routes/admin/orders/create-swap-shipment.js +1 -0
- package/dist/api/routes/admin/orders/create-swap-shipment.js.map +1 -1
- package/dist/api/routes/admin/orders/create-swap.js +7 -1
- package/dist/api/routes/admin/orders/create-swap.js.map +1 -1
- package/dist/api/routes/admin/orders/index.d.ts +0 -1
- package/dist/api/routes/admin/orders/index.js +2 -5
- package/dist/api/routes/admin/orders/index.js.map +1 -1
- package/dist/api/routes/admin/product-types/index.d.ts +15 -0
- package/dist/api/routes/admin/product-types/index.js +40 -0
- package/dist/api/routes/admin/product-types/index.js.map +1 -0
- package/dist/api/routes/admin/product-types/list-product-types.d.ts +39 -0
- package/dist/api/routes/admin/{product-tags/list-collections.js → product-types/list-product-types.js} +72 -76
- package/dist/api/routes/admin/product-types/list-product-types.js.map +1 -0
- package/dist/api/routes/admin/regions/index.js +3 -0
- package/dist/api/routes/admin/regions/index.js.map +1 -1
- package/dist/api/routes/admin/regions/list-regions.d.ts +27 -3
- package/dist/api/routes/admin/regions/list-regions.js +91 -11
- package/dist/api/routes/admin/regions/list-regions.js.map +1 -1
- package/dist/api/routes/admin/regions/update-region.d.ts +12 -0
- package/dist/api/routes/admin/regions/update-region.js +24 -0
- package/dist/api/routes/admin/regions/update-region.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/index.d.ts +2 -2
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js +23 -7
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js.map +1 -1
- package/dist/api/routes/admin/store/index.d.ts +4 -1
- package/dist/api/routes/admin/store/index.js +1 -0
- package/dist/api/routes/admin/store/index.js.map +1 -1
- package/dist/api/routes/admin/store/list-tax-providers.d.ts +22 -0
- package/dist/api/routes/admin/{product-tags/get-collection.js → store/list-tax-providers.js} +21 -22
- package/dist/api/routes/admin/store/list-tax-providers.js.map +1 -0
- package/dist/api/routes/admin/swaps/index.js +0 -6
- package/dist/api/routes/admin/swaps/index.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js +4 -59
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-products.js +4 -55
- package/dist/api/routes/admin/tax-rates/add-to-products.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +4 -59
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js +14 -113
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/index.d.ts +3 -0
- package/dist/api/routes/admin/tax-rates/index.js +18 -3
- package/dist/api/routes/admin/tax-rates/index.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/list-tax-rates.d.ts +2 -2
- package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.js +122 -0
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/remove-from-products.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/remove-from-products.js +122 -0
- package/dist/api/routes/admin/tax-rates/remove-from-products.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js +122 -0
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/update-tax-rate.js +15 -116
- package/dist/api/routes/admin/tax-rates/update-tax-rate.js.map +1 -1
- package/dist/api/routes/store/carts/add-shipping-method.d.ts +1 -1
- package/dist/api/routes/store/carts/add-shipping-method.js.map +1 -1
- package/dist/api/routes/store/carts/complete-cart.js +11 -247
- package/dist/api/routes/store/carts/complete-cart.js.map +1 -1
- package/dist/api/routes/store/carts/index.js +2 -0
- package/dist/api/routes/store/carts/index.js.map +1 -1
- package/dist/api/routes/store/swaps/create-swap.js +7 -1
- package/dist/api/routes/store/swaps/create-swap.js.map +1 -1
- package/dist/db-subscribers/region.d.ts +6 -0
- package/dist/db-subscribers/region.js +84 -0
- package/dist/db-subscribers/region.js.map +1 -0
- package/dist/entity-subscribers/region.d.ts +6 -0
- package/dist/entity-subscribers/region.js +27 -0
- package/dist/entity-subscribers/region.js.map +1 -0
- package/dist/helpers/test-request.js +2 -0
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/index.d.ts +59 -50
- package/dist/index.js +60 -101
- package/dist/index.js.map +1 -1
- package/dist/loaders/db-subscribers.d.ts +6 -0
- package/dist/loaders/db-subscribers.js +53 -0
- package/dist/loaders/db-subscribers.js.map +1 -0
- package/dist/loaders/index.d.ts +2 -1
- package/dist/loaders/index.js +17 -4
- package/dist/loaders/index.js.map +1 -1
- package/dist/loaders/models.js.map +1 -1
- package/dist/loaders/passport.js.map +1 -1
- package/dist/loaders/plugins.js +26 -0
- package/dist/loaders/plugins.js.map +1 -1
- package/dist/loaders/services.d.ts +2 -1
- package/dist/loaders/services.js +9 -7
- package/dist/loaders/services.js.map +1 -1
- package/dist/migrations/1641636508055-new_tax_system.js +9 -9
- package/dist/migrations/1641636508055-new_tax_system.js.map +1 -1
- package/dist/migrations/1644943746861-customer_groups.d.ts +6 -0
- package/dist/migrations/1644943746861-customer_groups.js +107 -0
- package/dist/migrations/1644943746861-customer_groups.js.map +1 -0
- package/dist/models/cart.d.ts +2 -1
- package/dist/models/cart.js +1 -0
- package/dist/models/cart.js.map +1 -1
- package/dist/models/customer-group.d.ts +11 -0
- package/dist/models/customer-group.js +81 -0
- package/dist/models/customer-group.js.map +1 -0
- package/dist/models/customer.d.ts +2 -0
- package/dist/models/customer.js +18 -1
- package/dist/models/customer.js.map +1 -1
- package/dist/models/line-item.d.ts +3 -0
- package/dist/models/line-item.js +9 -0
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order.d.ts +2 -1
- package/dist/models/order.js +3 -2
- package/dist/models/order.js.map +1 -1
- package/dist/models/product-tax-rate.d.ts +0 -1
- package/dist/models/product-tax-rate.js +5 -7
- package/dist/models/product-tax-rate.js.map +1 -1
- package/dist/models/product-type-tax-rate.d.ts +0 -1
- package/dist/models/product-type-tax-rate.js +2 -6
- package/dist/models/product-type-tax-rate.js.map +1 -1
- package/dist/models/product.d.ts +1 -1
- package/dist/models/product.js +2 -2
- package/dist/models/product.js.map +1 -1
- package/dist/models/region.d.ts +7 -0
- package/dist/models/region.js +31 -2
- package/dist/models/region.js.map +1 -1
- package/dist/models/shipping-method.d.ts +2 -0
- package/dist/models/shipping-method.js +7 -0
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/shipping-tax-rate.d.ts +0 -1
- package/dist/models/shipping-tax-rate.js +2 -6
- package/dist/models/shipping-tax-rate.js.map +1 -1
- package/dist/models/swap.d.ts +1 -1
- package/dist/models/swap.js +1 -1
- package/dist/models/swap.js.map +1 -1
- package/dist/repositories/customer-group.d.ts +5 -0
- package/dist/repositories/customer-group.js +91 -0
- package/dist/repositories/customer-group.js.map +1 -0
- package/dist/repositories/line-item.d.ts +12 -0
- package/dist/repositories/line-item.js +61 -0
- package/dist/repositories/line-item.js.map +1 -1
- package/dist/repositories/money-amount.d.ts +6 -0
- package/dist/repositories/money-amount.js +97 -0
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/repositories/product.d.ts +2 -0
- package/dist/repositories/product.js +32 -0
- package/dist/repositories/product.js.map +1 -1
- package/dist/repositories/tax-provider.d.ts +4 -0
- package/dist/repositories/tax-provider.js +38 -0
- package/dist/repositories/tax-provider.js.map +1 -0
- package/dist/repositories/tax-rate.d.ts +7 -4
- package/dist/repositories/tax-rate.js +96 -21
- package/dist/repositories/tax-rate.js.map +1 -1
- package/dist/services/cart.d.ts +92 -114
- package/dist/services/cart.js +142 -144
- package/dist/services/cart.js.map +1 -1
- package/dist/services/claim.d.ts +22 -33
- package/dist/services/claim.js +106 -95
- package/dist/services/claim.js.map +1 -1
- package/dist/services/customer-group.d.ts +54 -0
- package/dist/services/customer-group.js +265 -0
- package/dist/services/customer-group.js.map +1 -0
- package/dist/services/customer.d.ts +3 -1
- package/dist/services/customer.js +28 -17
- package/dist/services/customer.js.map +1 -1
- package/dist/services/fulfillment.js +1 -1
- package/dist/services/fulfillment.js.map +1 -1
- package/dist/services/gift-card.js +1 -1
- package/dist/services/gift-card.js.map +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +9 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/invite.d.ts +3 -3
- package/dist/services/invite.js +4 -2
- package/dist/services/invite.js.map +1 -1
- package/dist/services/line-item.d.ts +12 -1
- package/dist/services/line-item.js +49 -1
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/order.d.ts +6 -2
- package/dist/services/order.js +186 -80
- package/dist/services/order.js.map +1 -1
- package/dist/services/product-collection.d.ts +2 -0
- package/dist/services/product-collection.js +49 -0
- package/dist/services/product-collection.js.map +1 -1
- package/dist/services/product-type.d.ts +15 -0
- package/dist/services/product-type.js +44 -0
- package/dist/services/product-type.js.map +1 -1
- package/dist/services/product-variant.d.ts +2 -1
- package/dist/services/product-variant.js +96 -85
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/product.js +3 -1
- package/dist/services/product.js.map +1 -1
- package/dist/services/region.d.ts +4 -1
- package/dist/services/region.js +25 -10
- package/dist/services/region.js.map +1 -1
- package/dist/services/return.d.ts +3 -1
- package/dist/services/return.js +37 -26
- package/dist/services/return.js.map +1 -1
- package/dist/services/shipping-option.d.ts +7 -4
- package/dist/services/shipping-option.js +22 -5
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/swap.d.ts +5 -22
- package/dist/services/swap.js +308 -454
- package/dist/services/swap.js.map +1 -1
- package/dist/services/tax-provider.d.ts +3 -0
- package/dist/services/tax-provider.js +10 -0
- package/dist/services/tax-provider.js.map +1 -1
- package/dist/services/tax-rate.d.ts +13 -6
- package/dist/services/tax-rate.js +235 -41
- package/dist/services/tax-rate.js.map +1 -1
- package/dist/services/totals.d.ts +194 -59
- package/dist/services/totals.js +581 -106
- package/dist/services/totals.js.map +1 -1
- package/dist/subscribers/region.d.ts +14 -0
- package/dist/subscribers/region.js +65 -0
- package/dist/subscribers/region.js.map +1 -0
- package/dist/types/cart.d.ts +2 -1
- package/dist/types/cart.js +6 -1
- package/dist/types/cart.js.map +1 -1
- package/dist/types/common.d.ts +5 -1
- package/dist/types/common.js +22 -7
- package/dist/types/common.js.map +1 -1
- package/dist/types/customer-groups.d.ts +11 -0
- package/dist/types/customer-groups.js +43 -0
- package/dist/types/customer-groups.js.map +1 -0
- package/dist/types/orders.d.ts +2 -0
- package/dist/types/orders.js +6 -1
- package/dist/types/orders.js.map +1 -1
- package/dist/types/product.d.ts +6 -0
- package/dist/types/product.js +25 -1
- package/dist/types/product.js.map +1 -1
- package/dist/utils/format-registration-name.js +3 -0
- package/dist/utils/format-registration-name.js.map +1 -1
- package/package.json +5 -4
- package/yarn-error.log +5 -79
- package/dist/api/routes/admin/product-tags/create-collection.d.ts +0 -41
- package/dist/api/routes/admin/product-tags/create-collection.js.map +0 -1
- package/dist/api/routes/admin/product-tags/delete-collection.d.ts +0 -28
- package/dist/api/routes/admin/product-tags/delete-collection.js.map +0 -1
- package/dist/api/routes/admin/product-tags/get-collection.d.ts +0 -22
- package/dist/api/routes/admin/product-tags/get-collection.js.map +0 -1
- package/dist/api/routes/admin/product-tags/list-collections.d.ts +0 -40
- package/dist/api/routes/admin/product-tags/list-collections.js.map +0 -1
- package/dist/api/routes/admin/product-tags/update-collection.d.ts +0 -41
- package/dist/api/routes/admin/product-tags/update-collection.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-shipping-options.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/shipping-options/list-shipping-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-shipping-options.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/shipping-options/list-shipping-options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA6C;AAC7C,mDAAiE;AACjE,sBAAmD;AACnD,yDAAuD;AACvD,sEAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACJ,qBAAM,IAAA,qBAAS,EACrC,6BAA6B,EAC7B,GAAG,CAAC,KAAK,CACV,EAAA;;gBAHK,eAAe,GAAG,SAGvB;gBAEK,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAA;gBAC1C,qBAAM,aAAa,CAAC,YAAY,CAAC,eAAe,EAAE;wBACtE,MAAM,EAAE,gBAAa;wBACrB,SAAS,EAAE,mBAAgB;qBAC5B,CAAC,EAAA;;gBAHI,KAAA,sBAAgB,SAGpB,KAAA,EAHK,IAAI,QAAA,EAAE,KAAK,QAAA;gBAKlB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,OAAA,EAAE,CAAC,CAAA;;;;KACxD,EAAA;AAED;IAAA;IAcA,CAAC;IAXC;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,0BAAQ,GAAE;;oEACO;IAKlB;QAHC,IAAA,4BAAU,GAAE;QACZ,IAAA,2BAAS,GAAE;QACX,IAAA,6BAAS,EAAC,UAAC,EAAS;gBAAP,KAAK,WAAA;YAAO,OAAA,kCAAqB,CAAC,GAAG,CAAC,KAAK,CAAC;QAAhC,CAAgC,CAAC;;oEACzC;IAKlB;QAHC,IAAA,4BAAU,GAAE;QACZ,IAAA,2BAAS,GAAE;QACX,IAAA,6BAAS,EAAC,UAAC,EAAS;gBAAP,KAAK,WAAA;YAAO,OAAA,kCAAqB,CAAC,GAAG,CAAC,KAAK,CAAC;QAAhC,CAAgC,CAAC;;qEACxC;IACrB,oCAAC;CAAA,AAdD,IAcC;AAdY,sEAA6B"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { Store, PaymentProvider } from "./../../../../";
|
|
1
|
+
import { Store, PaymentProvider, TaxProvider } from "./../../../../";
|
|
2
2
|
declare const _default: (app: any) => any;
|
|
3
3
|
export default _default;
|
|
4
4
|
export declare type AdminStoresRes = {
|
|
5
5
|
store: Store;
|
|
6
6
|
};
|
|
7
|
+
export declare type AdminTaxProvidersList = {
|
|
8
|
+
tax_providers: TaxProvider[];
|
|
9
|
+
};
|
|
7
10
|
export declare type AdminPaymentProvidersList = {
|
|
8
11
|
payment_providers: PaymentProvider[];
|
|
9
12
|
};
|
|
@@ -20,6 +20,7 @@ exports.default = (function (app) {
|
|
|
20
20
|
app.use("/store", route);
|
|
21
21
|
route.get("/", middlewares_1.default.wrap(require("./get-store").default));
|
|
22
22
|
route.get("/payment-providers", middlewares_1.default.wrap(require("./list-payment-providers").default));
|
|
23
|
+
route.get("/tax-providers", middlewares_1.default.wrap(require("./list-tax-providers").default));
|
|
23
24
|
route.post("/", middlewares_1.default.wrap(require("./update-store").default));
|
|
24
25
|
route.post("/currencies/:currency_code", middlewares_1.default.wrap(require("./add-currency").default));
|
|
25
26
|
route.delete("/currencies/:currency_code", middlewares_1.default.wrap(require("./remove-currency").default));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAgC;AAEhC,qEAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAExB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAChE,KAAK,CAAC,GAAG,CACP,oBAAoB,EACpB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,CAC9D,CAAA;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IACpE,KAAK,CAAC,IAAI,CACR,4BAA4B,EAC5B,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CACpD,CAAA;IACD,KAAK,CAAC,MAAM,CACV,4BAA4B,EAC5B,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CACvD,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAgC;AAEhC,qEAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAExB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAChE,KAAK,CAAC,GAAG,CACP,oBAAoB,EACpB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,CAC9D,CAAA;IACD,KAAK,CAAC,GAAG,CACP,gBAAgB,EAChB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,CAC1D,CAAA;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IACpE,KAAK,CAAC,IAAI,CACR,4BAA4B,EAC5B,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CACpD,CAAA;IACD,KAAK,CAAC,MAAM,CACV,4BAA4B,EAC5B,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CACvD,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;AAcD,iDAA8B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* @oas [get] /store/tax-providers
|
|
4
|
+
* operationId: "GetStoreTaxProviders"
|
|
5
|
+
* summary: "Retrieve configured Tax Providers"
|
|
6
|
+
* description: "Retrieves the configured Tax Providers"
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* tags:
|
|
9
|
+
* - Store
|
|
10
|
+
* responses:
|
|
11
|
+
* 200:
|
|
12
|
+
* description: OK
|
|
13
|
+
* content:
|
|
14
|
+
* application/json:
|
|
15
|
+
* schema:
|
|
16
|
+
* properties:
|
|
17
|
+
* tax_providers:
|
|
18
|
+
* type: array
|
|
19
|
+
* items:
|
|
20
|
+
* $ref: "#/components/schemas/store"
|
|
21
|
+
*/
|
|
22
|
+
export default _default;
|
package/dist/api/routes/admin/{product-tags/get-collection.js → store/list-tax-providers.js}
RENAMED
|
@@ -37,38 +37,37 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
/**
|
|
40
|
-
* @oas [get] /
|
|
41
|
-
* operationId: "
|
|
42
|
-
* summary: "Retrieve
|
|
43
|
-
* description: "Retrieves
|
|
40
|
+
* @oas [get] /store/tax-providers
|
|
41
|
+
* operationId: "GetStoreTaxProviders"
|
|
42
|
+
* summary: "Retrieve configured Tax Providers"
|
|
43
|
+
* description: "Retrieves the configured Tax Providers"
|
|
44
44
|
* x-authenticated: true
|
|
45
|
-
* parameters:
|
|
46
|
-
* - (path) id=* {string} The id of the Product Collection
|
|
47
45
|
* tags:
|
|
48
|
-
* -
|
|
46
|
+
* - Store
|
|
49
47
|
* responses:
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
48
|
+
* 200:
|
|
49
|
+
* description: OK
|
|
50
|
+
* content:
|
|
51
|
+
* application/json:
|
|
52
|
+
* schema:
|
|
53
|
+
* properties:
|
|
54
|
+
* tax_providers:
|
|
55
|
+
* type: array
|
|
56
|
+
* items:
|
|
57
|
+
* $ref: "#/components/schemas/store"
|
|
58
58
|
*/
|
|
59
59
|
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
-
var
|
|
60
|
+
var taxProviderService, taxProviders;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
switch (_a.label) {
|
|
63
63
|
case 0:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return [4 /*yield*/, productCollectionService.retrieve(id)];
|
|
64
|
+
taxProviderService = req.scope.resolve("taxProviderService");
|
|
65
|
+
return [4 /*yield*/, taxProviderService.list()];
|
|
67
66
|
case 1:
|
|
68
|
-
|
|
69
|
-
res.status(200).json({
|
|
67
|
+
taxProviders = _a.sent();
|
|
68
|
+
res.status(200).json({ tax_providers: taxProviders });
|
|
70
69
|
return [2 /*return*/];
|
|
71
70
|
}
|
|
72
71
|
});
|
|
73
72
|
}); });
|
|
74
|
-
//# sourceMappingURL=
|
|
73
|
+
//# sourceMappingURL=list-tax-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-tax-providers.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/store/list-tax-providers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACtB,kBAAkB,GACtB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;gBACpB,qBAAM,kBAAkB,CAAC,IAAI,EAAE,EAAA;;gBAA9C,YAAY,GAAG,SAA+B;gBACpD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAA;;;;KACtD,EAAA"}
|
|
@@ -38,12 +38,6 @@ exports.defaultAdminSwapRelations = [
|
|
|
38
38
|
"shipping_address",
|
|
39
39
|
"shipping_methods",
|
|
40
40
|
"cart",
|
|
41
|
-
"cart.items",
|
|
42
|
-
"cart.region",
|
|
43
|
-
"cart.shipping_methods",
|
|
44
|
-
"cart.gift_cards",
|
|
45
|
-
"cart.discounts",
|
|
46
|
-
"cart.payment",
|
|
47
41
|
];
|
|
48
42
|
exports.defaultAdminSwapFields = [
|
|
49
43
|
"id",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/swaps/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAgC;AAGhC,qEAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAExB;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAEjE;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAElE,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;AAEY,QAAA,yBAAyB,GAAG;IACvC,OAAO;IACP,kBAAkB;IAClB,cAAc;IACd,cAAc;IACd,SAAS;IACT,kBAAkB;IAClB,kBAAkB;IAClB,MAAM;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/swaps/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAgC;AAGhC,qEAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAExB;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAEjE;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAElE,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;AAEY,QAAA,yBAAyB,GAAG;IACvC,OAAO;IACP,kBAAkB;IAClB,cAAc;IACd,cAAc;IACd,SAAS;IACT,kBAAkB;IAClB,kBAAkB;IAClB,MAAM;CACP,CAAA;AAEY,QAAA,sBAAsB,GAAG;IACpC,IAAI;IACJ,oBAAoB;IACpB,gBAAgB;IAChB,UAAU;IACV,gBAAgB;IAChB,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,qBAAqB;IACrB,qBAAqB;IACrB,sBAAsB;IACtB,YAAY;CACb,CAAA;AAUD,6CAA0B;AAC1B,+CAA4B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
2
|
/**
|
|
3
|
-
* @oas [post] /tax-rates/:id/product-types
|
|
3
|
+
* @oas [post] /tax-rates/:id/product-types/batch
|
|
4
4
|
* operationId: "PostTaxRatesTaxRateProductTypes"
|
|
5
5
|
* summary: "Add Tax Rate to Product Types"
|
|
6
6
|
* description: "Associates a Tax Rate with a list of Product Types"
|
|
@@ -44,38 +44,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
44
44
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
48
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
49
|
-
if (!m) return o;
|
|
50
|
-
var i = m.call(o), r, ar = [], e;
|
|
51
|
-
try {
|
|
52
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
53
|
-
}
|
|
54
|
-
catch (error) { e = { error: error }; }
|
|
55
|
-
finally {
|
|
56
|
-
try {
|
|
57
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
58
|
-
}
|
|
59
|
-
finally { if (e) throw e.error; }
|
|
60
|
-
}
|
|
61
|
-
return ar;
|
|
62
|
-
};
|
|
63
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
64
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
65
|
-
if (ar || !(i in from)) {
|
|
66
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
67
|
-
ar[i] = from[i];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
71
|
-
};
|
|
72
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
48
|
exports.AdminPostTaxRatesTaxRateProductTypesParams = exports.AdminPostTaxRatesTaxRateProductTypesReq = void 0;
|
|
74
49
|
var get_query_config_1 = require("./utils/get-query-config");
|
|
75
50
|
var class_validator_1 = require("class-validator");
|
|
76
51
|
var validator_1 = require("../../../../utils/validator");
|
|
77
52
|
/**
|
|
78
|
-
* @oas [post] /tax-rates/:id/product-types
|
|
53
|
+
* @oas [post] /tax-rates/:id/product-types/batch
|
|
79
54
|
* operationId: "PostTaxRatesTaxRateProductTypes"
|
|
80
55
|
* summary: "Add Tax Rate to Product Types"
|
|
81
56
|
* description: "Associates a Tax Rate with a list of Product Types"
|
|
@@ -95,7 +70,7 @@ var validator_1 = require("../../../../utils/validator");
|
|
|
95
70
|
* $ref: "#/components/schemas/tax_rate"
|
|
96
71
|
*/
|
|
97
72
|
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
-
var value, query, rateService,
|
|
73
|
+
var value, query, rateService, config, rate, data;
|
|
99
74
|
return __generator(this, function (_a) {
|
|
100
75
|
switch (_a.label) {
|
|
101
76
|
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesTaxRateProductTypesReq, req.body)];
|
|
@@ -105,42 +80,12 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
|
|
|
105
80
|
case 2:
|
|
106
81
|
query = _a.sent();
|
|
107
82
|
rateService = req.scope.resolve("taxRateService");
|
|
108
|
-
productTypeService = req.scope.resolve("productTypeService");
|
|
109
|
-
_a.label = 3;
|
|
110
|
-
case 3:
|
|
111
|
-
_a.trys.push([3, 5, , 8]);
|
|
112
83
|
return [4 /*yield*/, rateService.addToProductType(req.params.id, value.product_types)];
|
|
113
|
-
case
|
|
114
|
-
_a.sent();
|
|
115
|
-
return [3 /*break*/, 8];
|
|
116
|
-
case 5:
|
|
117
|
-
err_1 = _a.sent();
|
|
118
|
-
if (!(err_1.code === "23503")) return [3 /*break*/, 7];
|
|
119
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
120
|
-
// either it is a product type or the tax rate itself. Using Promise.all
|
|
121
|
-
// will try to retrieve all of the resources and will fail when something
|
|
122
|
-
// is not found.
|
|
123
|
-
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
124
|
-
rateService.retrieve(req.params.id, {
|
|
125
|
-
select: ["id"],
|
|
126
|
-
})
|
|
127
|
-
], __read(value.product_types.map(function (id) {
|
|
128
|
-
return productTypeService.retrieve(id, {
|
|
129
|
-
select: ["id"],
|
|
130
|
-
});
|
|
131
|
-
})), false))];
|
|
132
|
-
case 6:
|
|
133
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
134
|
-
// either it is a product type or the tax rate itself. Using Promise.all
|
|
135
|
-
// will try to retrieve all of the resources and will fail when something
|
|
136
|
-
// is not found.
|
|
84
|
+
case 3:
|
|
137
85
|
_a.sent();
|
|
138
|
-
_a.label = 7;
|
|
139
|
-
case 7: throw err_1;
|
|
140
|
-
case 8:
|
|
141
86
|
config = (0, get_query_config_1.getRetrieveConfig)(query.fields, query.expand);
|
|
142
87
|
return [4 /*yield*/, rateService.retrieve(req.params.id, config)];
|
|
143
|
-
case
|
|
88
|
+
case 4:
|
|
144
89
|
rate = _a.sent();
|
|
145
90
|
data = (0, get_query_config_1.pickByConfig)(rate, config);
|
|
146
91
|
res.json({ tax_rate: data });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-to-product-types.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-product-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-to-product-types.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-product-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0E;AAC1E,mDAAqD;AAIrD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACd,qBAAM,IAAA,qBAAS,EAC3B,uCAAuC,EACvC,GAAG,CAAC,IAAI,CACT,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEa,qBAAM,IAAA,qBAAS,EAC3B,0CAA0C,EAC1C,GAAG,CAAC,KAAK,CACV,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEK,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBAEvE,qBAAM,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC,EAAA;;gBAAtE,SAAsE,CAAA;gBAEhE,MAAM,GAAG,IAAA,oCAAiB,EAC9B,KAAK,CAAC,MAA2B,EACjC,KAAK,CAAC,MAAM,CACb,CAAA;gBACY,qBAAM,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAA;;gBAAxD,IAAI,GAAG,SAAiD;gBACxD,IAAI,GAAG,IAAA,+BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;gBAEvC,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;;KAC7B,EAAA;AAED;IAAA;IAGA,CAAC;IADC;QADC,IAAA,yBAAO,GAAE;;kFACa;IACzB,8CAAC;CAAA,AAHD,IAGC;AAHY,0FAAuC;AAKpD;IAAA;IAQA,CAAC;IALC;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;8EACI;IAIjB;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;8EACI;IACnB,iDAAC;CAAA,AARD,IAQC;AARY,gGAA0C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
2
|
/**
|
|
3
|
-
* @oas [post] /tax-rates/:id/products
|
|
3
|
+
* @oas [post] /tax-rates/:id/products/batch
|
|
4
4
|
* operationId: "PostTaxRatesTaxRateProducts"
|
|
5
5
|
* summary: "Add Tax Rate to Products"
|
|
6
6
|
* description: "Associates a Tax Rate with a list of Products"
|
|
@@ -44,38 +44,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
44
44
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
48
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
49
|
-
if (!m) return o;
|
|
50
|
-
var i = m.call(o), r, ar = [], e;
|
|
51
|
-
try {
|
|
52
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
53
|
-
}
|
|
54
|
-
catch (error) { e = { error: error }; }
|
|
55
|
-
finally {
|
|
56
|
-
try {
|
|
57
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
58
|
-
}
|
|
59
|
-
finally { if (e) throw e.error; }
|
|
60
|
-
}
|
|
61
|
-
return ar;
|
|
62
|
-
};
|
|
63
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
64
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
65
|
-
if (ar || !(i in from)) {
|
|
66
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
67
|
-
ar[i] = from[i];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
71
|
-
};
|
|
72
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
48
|
exports.AdminPostTaxRatesTaxRateProductsParams = exports.AdminPostTaxRatesTaxRateProductsReq = void 0;
|
|
74
49
|
var get_query_config_1 = require("./utils/get-query-config");
|
|
75
50
|
var class_validator_1 = require("class-validator");
|
|
76
51
|
var validator_1 = require("../../../../utils/validator");
|
|
77
52
|
/**
|
|
78
|
-
* @oas [post] /tax-rates/:id/products
|
|
53
|
+
* @oas [post] /tax-rates/:id/products/batch
|
|
79
54
|
* operationId: "PostTaxRatesTaxRateProducts"
|
|
80
55
|
* summary: "Add Tax Rate to Products"
|
|
81
56
|
* description: "Associates a Tax Rate with a list of Products"
|
|
@@ -95,7 +70,7 @@ var validator_1 = require("../../../../utils/validator");
|
|
|
95
70
|
* $ref: "#/components/schemas/tax_rate"
|
|
96
71
|
*/
|
|
97
72
|
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
-
var value, query,
|
|
73
|
+
var value, query, rateService, config, rate, data;
|
|
99
74
|
return __generator(this, function (_a) {
|
|
100
75
|
switch (_a.label) {
|
|
101
76
|
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesTaxRateProductsReq, req.body)];
|
|
@@ -104,39 +79,13 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
|
|
|
104
79
|
return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesTaxRateProductsParams, req.query)];
|
|
105
80
|
case 2:
|
|
106
81
|
query = _a.sent();
|
|
107
|
-
productService = req.scope.resolve("productService");
|
|
108
82
|
rateService = req.scope.resolve("taxRateService");
|
|
109
|
-
_a.label = 3;
|
|
110
|
-
case 3:
|
|
111
|
-
_a.trys.push([3, 5, , 8]);
|
|
112
83
|
return [4 /*yield*/, rateService.addToProduct(req.params.id, value.products)];
|
|
113
|
-
case
|
|
114
|
-
_a.sent();
|
|
115
|
-
return [3 /*break*/, 8];
|
|
116
|
-
case 5:
|
|
117
|
-
err_1 = _a.sent();
|
|
118
|
-
if (!(err_1.code === "23503")) return [3 /*break*/, 7];
|
|
119
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
120
|
-
// either it is a product or the tax rate itself. Using Promise.all
|
|
121
|
-
// will try to retrieve all of the resources and will fail when
|
|
122
|
-
// something is not found.
|
|
123
|
-
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
124
|
-
rateService.retrieve(req.params.id, { select: ["id"] })
|
|
125
|
-
], __read(value.products.map(function (id) {
|
|
126
|
-
return productService.retrieve(id, { select: ["id"] });
|
|
127
|
-
})), false))];
|
|
128
|
-
case 6:
|
|
129
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
130
|
-
// either it is a product or the tax rate itself. Using Promise.all
|
|
131
|
-
// will try to retrieve all of the resources and will fail when
|
|
132
|
-
// something is not found.
|
|
84
|
+
case 3:
|
|
133
85
|
_a.sent();
|
|
134
|
-
_a.label = 7;
|
|
135
|
-
case 7: throw err_1;
|
|
136
|
-
case 8:
|
|
137
86
|
config = (0, get_query_config_1.getRetrieveConfig)(query.fields, query.expand);
|
|
138
87
|
return [4 /*yield*/, rateService.retrieve(req.params.id, config)];
|
|
139
|
-
case
|
|
88
|
+
case 4:
|
|
140
89
|
rate = _a.sent();
|
|
141
90
|
data = (0, get_query_config_1.pickByConfig)(rate, config);
|
|
142
91
|
res.json({ tax_rate: data });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-to-products.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-products.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-to-products.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-products.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0E;AAC1E,mDAAqD;AAIrD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACd,qBAAM,IAAA,qBAAS,EAAC,mCAAmC,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAtE,KAAK,GAAG,SAA8D;gBAE9D,qBAAM,IAAA,qBAAS,EAC3B,sCAAsC,EACtC,GAAG,CAAC,KAAK,CACV,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEK,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBAEvE,qBAAM,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAA;;gBAA7D,SAA6D,CAAA;gBAEvD,MAAM,GAAG,IAAA,oCAAiB,EAC9B,KAAK,CAAC,MAA2B,EACjC,KAAK,CAAC,MAAM,CACb,CAAA;gBACY,qBAAM,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAA;;gBAAxD,IAAI,GAAG,SAAiD;gBACxD,IAAI,GAAG,IAAA,+BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;gBAEvC,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;;KAC7B,EAAA;AAED;IAAA;IAGA,CAAC;IADC;QADC,IAAA,yBAAO,GAAE;;yEACQ;IACpB,0CAAC;CAAA,AAHD,IAGC;AAHY,kFAAmC;AAKhD;IAAA;IAQA,CAAC;IALC;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;0EACI;IAIjB;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;0EACI;IACnB,6CAAC;CAAA,AARD,IAQC;AARY,wFAAsC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
2
|
/**
|
|
3
|
-
* @oas [post] /tax-rates/:id/
|
|
3
|
+
* @oas [post] /tax-rates/:id/shipping-options/batch
|
|
4
4
|
* operationId: "PostTaxRatesTaxRateShippingOptions"
|
|
5
5
|
* summary: "Add Tax Rate to Product Types"
|
|
6
6
|
* description: "Associates a Tax Rate with a list of Product Types"
|
|
@@ -44,38 +44,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
44
44
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
48
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
49
|
-
if (!m) return o;
|
|
50
|
-
var i = m.call(o), r, ar = [], e;
|
|
51
|
-
try {
|
|
52
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
53
|
-
}
|
|
54
|
-
catch (error) { e = { error: error }; }
|
|
55
|
-
finally {
|
|
56
|
-
try {
|
|
57
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
58
|
-
}
|
|
59
|
-
finally { if (e) throw e.error; }
|
|
60
|
-
}
|
|
61
|
-
return ar;
|
|
62
|
-
};
|
|
63
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
64
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
65
|
-
if (ar || !(i in from)) {
|
|
66
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
67
|
-
ar[i] = from[i];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
71
|
-
};
|
|
72
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
48
|
exports.AdminPostTaxRatesTaxRateShippingOptionsParams = exports.AdminPostTaxRatesTaxRateShippingOptionsReq = void 0;
|
|
74
49
|
var get_query_config_1 = require("./utils/get-query-config");
|
|
75
50
|
var class_validator_1 = require("class-validator");
|
|
76
51
|
var validator_1 = require("../../../../utils/validator");
|
|
77
52
|
/**
|
|
78
|
-
* @oas [post] /tax-rates/:id/
|
|
53
|
+
* @oas [post] /tax-rates/:id/shipping-options/batch
|
|
79
54
|
* operationId: "PostTaxRatesTaxRateShippingOptions"
|
|
80
55
|
* summary: "Add Tax Rate to Product Types"
|
|
81
56
|
* description: "Associates a Tax Rate with a list of Product Types"
|
|
@@ -95,7 +70,7 @@ var validator_1 = require("../../../../utils/validator");
|
|
|
95
70
|
* $ref: "#/components/schemas/tax_rate"
|
|
96
71
|
*/
|
|
97
72
|
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
-
var value, query, rateService,
|
|
73
|
+
var value, query, rateService, config, rate, data;
|
|
99
74
|
return __generator(this, function (_a) {
|
|
100
75
|
switch (_a.label) {
|
|
101
76
|
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesTaxRateShippingOptionsReq, req.body)];
|
|
@@ -105,42 +80,12 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
|
|
|
105
80
|
case 2:
|
|
106
81
|
query = _a.sent();
|
|
107
82
|
rateService = req.scope.resolve("taxRateService");
|
|
108
|
-
optionService = req.scope.resolve("shippingOptionService");
|
|
109
|
-
_a.label = 3;
|
|
110
|
-
case 3:
|
|
111
|
-
_a.trys.push([3, 5, , 8]);
|
|
112
83
|
return [4 /*yield*/, rateService.addToShippingOption(req.params.id, value.shipping_options)];
|
|
113
|
-
case
|
|
114
|
-
_a.sent();
|
|
115
|
-
return [3 /*break*/, 8];
|
|
116
|
-
case 5:
|
|
117
|
-
err_1 = _a.sent();
|
|
118
|
-
if (!(err_1.code === "23503")) return [3 /*break*/, 7];
|
|
119
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
120
|
-
// either it is a product type or the tax rate itself. Using Promise.all
|
|
121
|
-
// will try to retrieve all of the resources and will fail when something
|
|
122
|
-
// is not found.
|
|
123
|
-
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
124
|
-
rateService.retrieve(req.params.id, {
|
|
125
|
-
select: ["id"],
|
|
126
|
-
})
|
|
127
|
-
], __read(value.shipping_options.map(function (id) {
|
|
128
|
-
return optionService.retrieve(id, {
|
|
129
|
-
select: ["id"],
|
|
130
|
-
});
|
|
131
|
-
})), false))];
|
|
132
|
-
case 6:
|
|
133
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
134
|
-
// either it is a product type or the tax rate itself. Using Promise.all
|
|
135
|
-
// will try to retrieve all of the resources and will fail when something
|
|
136
|
-
// is not found.
|
|
84
|
+
case 3:
|
|
137
85
|
_a.sent();
|
|
138
|
-
_a.label = 7;
|
|
139
|
-
case 7: throw err_1;
|
|
140
|
-
case 8:
|
|
141
86
|
config = (0, get_query_config_1.getRetrieveConfig)(query.fields, query.expand);
|
|
142
87
|
return [4 /*yield*/, rateService.retrieve(req.params.id, config)];
|
|
143
|
-
case
|
|
88
|
+
case 4:
|
|
144
89
|
rate = _a.sent();
|
|
145
90
|
data = (0, get_query_config_1.pickByConfig)(rate, config);
|
|
146
91
|
res.json({ tax_rate: data });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-to-shipping-options.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-shipping-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-to-shipping-options.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-shipping-options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0E;AAC1E,mDAAqD;AAIrD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACd,qBAAM,IAAA,qBAAS,EAC3B,0CAA0C,EAC1C,GAAG,CAAC,IAAI,CACT,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEa,qBAAM,IAAA,qBAAS,EAC3B,6CAA6C,EAC7C,GAAG,CAAC,KAAK,CACV,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEK,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBACvE,qBAAM,WAAW,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAA;;gBAA5E,SAA4E,CAAA;gBAEtE,MAAM,GAAG,IAAA,oCAAiB,EAC9B,KAAK,CAAC,MAA2B,EACjC,KAAK,CAAC,MAAM,CACb,CAAA;gBACY,qBAAM,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAA;;gBAAxD,IAAI,GAAG,SAAiD;gBACxD,IAAI,GAAG,IAAA,+BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;gBAEvC,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;;KAC7B,EAAA;AAED;IAAA;IAGA,CAAC;IADC;QADC,IAAA,yBAAO,GAAE;;wFACgB;IAC5B,iDAAC;CAAA,AAHD,IAGC;AAHY,gGAA0C;AAKvD;IAAA;IAQA,CAAC;IALC;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;iFACI;IAIjB;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;iFACI;IACnB,oDAAC;CAAA,AARD,IAQC;AARY,sGAA6C"}
|