@medusajs/core-flows 0.0.2-next-20231124140416
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/dist/definition/cart/create-cart.d.ts +9 -0
- package/dist/definition/cart/create-cart.js +148 -0
- package/dist/definition/cart/create-cart.js.map +1 -0
- package/dist/definition/cart/index.d.ts +1 -0
- package/dist/definition/cart/index.js +18 -0
- package/dist/definition/cart/index.js.map +1 -0
- package/dist/definition/index.d.ts +4 -0
- package/dist/definition/index.js +21 -0
- package/dist/definition/index.js.map +1 -0
- package/dist/definition/inventory/create-inventory-item.d.ts +14 -0
- package/dist/definition/inventory/create-inventory-item.js +41 -0
- package/dist/definition/inventory/create-inventory-item.js.map +1 -0
- package/dist/definition/inventory/index.d.ts +1 -0
- package/dist/definition/inventory/index.js +18 -0
- package/dist/definition/inventory/index.js.map +1 -0
- package/dist/definition/price-list/create-price-lists.d.ts +13 -0
- package/dist/definition/price-list/create-price-lists.js +55 -0
- package/dist/definition/price-list/create-price-lists.js.map +1 -0
- package/dist/definition/price-list/index.d.ts +6 -0
- package/dist/definition/price-list/index.js +23 -0
- package/dist/definition/price-list/index.js.map +1 -0
- package/dist/definition/price-list/remove-price-list-prices.d.ts +11 -0
- package/dist/definition/price-list/remove-price-list-prices.js +50 -0
- package/dist/definition/price-list/remove-price-list-prices.js.map +1 -0
- package/dist/definition/price-list/remove-price-lists.d.ts +12 -0
- package/dist/definition/price-list/remove-price-lists.js +40 -0
- package/dist/definition/price-list/remove-price-lists.js.map +1 -0
- package/dist/definition/price-list/remove-product-prices.d.ts +11 -0
- package/dist/definition/price-list/remove-product-prices.js +51 -0
- package/dist/definition/price-list/remove-product-prices.js.map +1 -0
- package/dist/definition/price-list/remove-variant-prices.d.ts +11 -0
- package/dist/definition/price-list/remove-variant-prices.js +51 -0
- package/dist/definition/price-list/remove-variant-prices.js.map +1 -0
- package/dist/definition/price-list/update-price-lists.d.ts +13 -0
- package/dist/definition/price-list/update-price-lists.js +51 -0
- package/dist/definition/price-list/update-price-lists.js.map +1 -0
- package/dist/definition/product/create-product-variants.d.ts +15 -0
- package/dist/definition/product/create-product-variants.js +91 -0
- package/dist/definition/product/create-product-variants.js.map +1 -0
- package/dist/definition/product/create-products.d.ts +18 -0
- package/dist/definition/product/create-products.js +211 -0
- package/dist/definition/product/create-products.js.map +1 -0
- package/dist/definition/product/index.d.ts +4 -0
- package/dist/definition/product/index.js +34 -0
- package/dist/definition/product/index.js.map +1 -0
- package/dist/definition/product/prepare-create-inventory-items.d.ts +23 -0
- package/dist/definition/product/prepare-create-inventory-items.js +28 -0
- package/dist/definition/product/prepare-create-inventory-items.js.map +1 -0
- package/dist/definition/product/update-product-variants.d.ts +15 -0
- package/dist/definition/product/update-product-variants.js +81 -0
- package/dist/definition/product/update-product-variants.js.map +1 -0
- package/dist/definition/product/update-products.d.ts +19 -0
- package/dist/definition/product/update-products.js +328 -0
- package/dist/definition/product/update-products.js.map +1 -0
- package/dist/definitions.d.ts +27 -0
- package/dist/definitions.js +37 -0
- package/dist/definitions.js.map +1 -0
- package/dist/handlers/address/find-or-create-addresses.d.ts +24 -0
- package/dist/handlers/address/find-or-create-addresses.js +66 -0
- package/dist/handlers/address/find-or-create-addresses.js.map +1 -0
- package/dist/handlers/address/index.d.ts +1 -0
- package/dist/handlers/address/index.js +18 -0
- package/dist/handlers/address/index.js.map +1 -0
- package/dist/handlers/cart/attach-line-items-to-cart.d.ts +21 -0
- package/dist/handlers/cart/attach-line-items-to-cart.js +35 -0
- package/dist/handlers/cart/attach-line-items-to-cart.js.map +1 -0
- package/dist/handlers/cart/create-cart.d.ts +36 -0
- package/dist/handlers/cart/create-cart.js +27 -0
- package/dist/handlers/cart/create-cart.js.map +1 -0
- package/dist/handlers/cart/index.d.ts +4 -0
- package/dist/handlers/cart/index.js +21 -0
- package/dist/handlers/cart/index.js.map +1 -0
- package/dist/handlers/cart/remove-cart.d.ts +14 -0
- package/dist/handlers/cart/remove-cart.js +17 -0
- package/dist/handlers/cart/remove-cart.js.map +1 -0
- package/dist/handlers/cart/retrieve-cart.d.ts +22 -0
- package/dist/handlers/cart/retrieve-cart.js +18 -0
- package/dist/handlers/cart/retrieve-cart.js.map +1 -0
- package/dist/handlers/common/index.d.ts +1 -0
- package/dist/handlers/common/index.js +18 -0
- package/dist/handlers/common/index.js.map +1 -0
- package/dist/handlers/common/set-context.d.ts +17 -0
- package/dist/handlers/common/set-context.js +16 -0
- package/dist/handlers/common/set-context.js.map +1 -0
- package/dist/handlers/customer/find-or-create-customer.d.ts +19 -0
- package/dist/handlers/customer/find-or-create-customer.js +38 -0
- package/dist/handlers/customer/find-or-create-customer.js.map +1 -0
- package/dist/handlers/customer/index.d.ts +1 -0
- package/dist/handlers/customer/index.js +18 -0
- package/dist/handlers/customer/index.js.map +1 -0
- package/dist/handlers/index.d.ts +10 -0
- package/dist/handlers/index.js +37 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/inventory/attach-inventory-items.d.ts +16 -0
- package/dist/handlers/inventory/attach-inventory-items.js +23 -0
- package/dist/handlers/inventory/attach-inventory-items.js.map +1 -0
- package/dist/handlers/inventory/create-inventory-items.d.ts +17 -0
- package/dist/handlers/inventory/create-inventory-items.js +31 -0
- package/dist/handlers/inventory/create-inventory-items.js.map +1 -0
- package/dist/handlers/inventory/detach-inventory-items.d.ts +16 -0
- package/dist/handlers/inventory/detach-inventory-items.js +22 -0
- package/dist/handlers/inventory/detach-inventory-items.js.map +1 -0
- package/dist/handlers/inventory/index.d.ts +5 -0
- package/dist/handlers/inventory/index.js +22 -0
- package/dist/handlers/inventory/index.js.map +1 -0
- package/dist/handlers/inventory/remove-inventory-items.d.ts +14 -0
- package/dist/handlers/inventory/remove-inventory-items.js +18 -0
- package/dist/handlers/inventory/remove-inventory-items.js.map +1 -0
- package/dist/handlers/inventory/restore-inventory-items.d.ts +12 -0
- package/dist/handlers/inventory/restore-inventory-items.js +18 -0
- package/dist/handlers/inventory/restore-inventory-items.js.map +1 -0
- package/dist/handlers/middlewares/create-products-prepare-create-prices-compensation.d.ts +26 -0
- package/dist/handlers/middlewares/create-products-prepare-create-prices-compensation.js +31 -0
- package/dist/handlers/middlewares/create-products-prepare-create-prices-compensation.js.map +1 -0
- package/dist/handlers/middlewares/extract-variants.d.ts +18 -0
- package/dist/handlers/middlewares/extract-variants.js +23 -0
- package/dist/handlers/middlewares/extract-variants.js.map +1 -0
- package/dist/handlers/middlewares/index.d.ts +6 -0
- package/dist/handlers/middlewares/index.js +23 -0
- package/dist/handlers/middlewares/index.js.map +1 -0
- package/dist/handlers/middlewares/map-data.d.ts +11 -0
- package/dist/handlers/middlewares/map-data.js +19 -0
- package/dist/handlers/middlewares/map-data.js.map +1 -0
- package/dist/handlers/middlewares/update-products-extract-created-variants.d.ts +19 -0
- package/dist/handlers/middlewares/update-products-extract-created-variants.js +27 -0
- package/dist/handlers/middlewares/update-products-extract-created-variants.js.map +1 -0
- package/dist/handlers/middlewares/update-products-extract-deleted-variants.d.ts +19 -0
- package/dist/handlers/middlewares/update-products-extract-deleted-variants.js +29 -0
- package/dist/handlers/middlewares/update-products-extract-deleted-variants.js.map +1 -0
- package/dist/handlers/middlewares/use-variants-inventory-items.d.ts +24 -0
- package/dist/handlers/middlewares/use-variants-inventory-items.js +31 -0
- package/dist/handlers/middlewares/use-variants-inventory-items.js.map +1 -0
- package/dist/handlers/price-list/create-price-list.d.ts +18 -0
- package/dist/handlers/price-list/create-price-list.js +18 -0
- package/dist/handlers/price-list/create-price-list.js.map +1 -0
- package/dist/handlers/price-list/index.d.ts +10 -0
- package/dist/handlers/price-list/index.js +27 -0
- package/dist/handlers/price-list/index.js.map +1 -0
- package/dist/handlers/price-list/prepare-create-price-list.d.ts +17 -0
- package/dist/handlers/price-list/prepare-create-price-list.js +57 -0
- package/dist/handlers/price-list/prepare-create-price-list.js.map +1 -0
- package/dist/handlers/price-list/prepare-remove-price-list-prices.d.ts +15 -0
- package/dist/handlers/price-list/prepare-remove-price-list-prices.js +23 -0
- package/dist/handlers/price-list/prepare-remove-price-list-prices.js.map +1 -0
- package/dist/handlers/price-list/prepare-remove-product-prices.d.ts +10 -0
- package/dist/handlers/price-list/prepare-remove-product-prices.js +35 -0
- package/dist/handlers/price-list/prepare-remove-product-prices.js.map +1 -0
- package/dist/handlers/price-list/prepare-remove-variant-prices.d.ts +10 -0
- package/dist/handlers/price-list/prepare-remove-variant-prices.js +33 -0
- package/dist/handlers/price-list/prepare-remove-variant-prices.js.map +1 -0
- package/dist/handlers/price-list/prepare-update-price-lists.d.ts +15 -0
- package/dist/handlers/price-list/prepare-update-price-lists.js +58 -0
- package/dist/handlers/price-list/prepare-update-price-lists.js.map +1 -0
- package/dist/handlers/price-list/remove-price-list.d.ts +14 -0
- package/dist/handlers/price-list/remove-price-list.js +14 -0
- package/dist/handlers/price-list/remove-price-list.js.map +1 -0
- package/dist/handlers/price-list/remove-price-set-price-list-prices.d.ts +5 -0
- package/dist/handlers/price-list/remove-price-set-price-list-prices.js +25 -0
- package/dist/handlers/price-list/remove-price-set-price-list-prices.js.map +1 -0
- package/dist/handlers/price-list/remove-prices.d.ts +13 -0
- package/dist/handlers/price-list/remove-prices.js +17 -0
- package/dist/handlers/price-list/remove-prices.js.map +1 -0
- package/dist/handlers/price-list/update-price-lists.d.ts +15 -0
- package/dist/handlers/price-list/update-price-lists.js +38 -0
- package/dist/handlers/price-list/update-price-lists.js.map +1 -0
- package/dist/handlers/product/attach-sales-channel-to-products.d.ts +18 -0
- package/dist/handlers/product/attach-sales-channel-to-products.js +30 -0
- package/dist/handlers/product/attach-sales-channel-to-products.js.map +1 -0
- package/dist/handlers/product/attach-shipping-profile-to-products.d.ts +18 -0
- package/dist/handlers/product/attach-shipping-profile-to-products.js +28 -0
- package/dist/handlers/product/attach-shipping-profile-to-products.js.map +1 -0
- package/dist/handlers/product/create-product-variants-prepare-data.d.ts +21 -0
- package/dist/handlers/product/create-product-variants-prepare-data.js +35 -0
- package/dist/handlers/product/create-product-variants-prepare-data.js.map +1 -0
- package/dist/handlers/product/create-product-variants.d.ts +23 -0
- package/dist/handlers/product/create-product-variants.js +22 -0
- package/dist/handlers/product/create-product-variants.js.map +1 -0
- package/dist/handlers/product/create-products-prepare-data.d.ts +28 -0
- package/dist/handlers/product/create-products-prepare-data.js +77 -0
- package/dist/handlers/product/create-products-prepare-data.js.map +1 -0
- package/dist/handlers/product/create-products.d.ts +12 -0
- package/dist/handlers/product/create-products.js +14 -0
- package/dist/handlers/product/create-products.js.map +1 -0
- package/dist/handlers/product/detach-sales-channel-from-products.d.ts +18 -0
- package/dist/handlers/product/detach-sales-channel-from-products.js +30 -0
- package/dist/handlers/product/detach-sales-channel-from-products.js.map +1 -0
- package/dist/handlers/product/detach-shipping-profile-from-products.d.ts +18 -0
- package/dist/handlers/product/detach-shipping-profile-from-products.js +28 -0
- package/dist/handlers/product/detach-shipping-profile-from-products.js.map +1 -0
- package/dist/handlers/product/index.d.ts +19 -0
- package/dist/handlers/product/index.js +36 -0
- package/dist/handlers/product/index.js.map +1 -0
- package/dist/handlers/product/list-products.d.ts +13 -0
- package/dist/handlers/product/list-products.js +31 -0
- package/dist/handlers/product/list-products.js.map +1 -0
- package/dist/handlers/product/remove-product-variants.d.ts +13 -0
- package/dist/handlers/product/remove-product-variants.js +16 -0
- package/dist/handlers/product/remove-product-variants.js.map +1 -0
- package/dist/handlers/product/remove-products.d.ts +13 -0
- package/dist/handlers/product/remove-products.js +16 -0
- package/dist/handlers/product/remove-products.js.map +1 -0
- package/dist/handlers/product/revert-update-products.d.ts +14 -0
- package/dist/handlers/product/revert-update-products.js +20 -0
- package/dist/handlers/product/revert-update-products.js.map +1 -0
- package/dist/handlers/product/revert-variant-prices.d.ts +14 -0
- package/dist/handlers/product/revert-variant-prices.js +28 -0
- package/dist/handlers/product/revert-variant-prices.js.map +1 -0
- package/dist/handlers/product/update-product-variants-prepare-data.d.ts +21 -0
- package/dist/handlers/product/update-product-variants-prepare-data.js +48 -0
- package/dist/handlers/product/update-product-variants-prepare-data.js.map +1 -0
- package/dist/handlers/product/update-product-variants.d.ts +12 -0
- package/dist/handlers/product/update-product-variants.js +23 -0
- package/dist/handlers/product/update-product-variants.js.map +1 -0
- package/dist/handlers/product/update-products-prepare-data.d.ts +25 -0
- package/dist/handlers/product/update-products-prepare-data.js +65 -0
- package/dist/handlers/product/update-products-prepare-data.js.map +1 -0
- package/dist/handlers/product/update-products-variants-prices.d.ts +18 -0
- package/dist/handlers/product/update-products-variants-prices.js +90 -0
- package/dist/handlers/product/update-products-variants-prices.js.map +1 -0
- package/dist/handlers/product/update-products.d.ts +12 -0
- package/dist/handlers/product/update-products.js +29 -0
- package/dist/handlers/product/update-products.js.map +1 -0
- package/dist/handlers/product/upsert-variant-prices.d.ts +25 -0
- package/dist/handlers/product/upsert-variant-prices.js +122 -0
- package/dist/handlers/product/upsert-variant-prices.js.map +1 -0
- package/dist/handlers/region/find-region.d.ts +17 -0
- package/dist/handlers/region/find-region.js +29 -0
- package/dist/handlers/region/find-region.js.map +1 -0
- package/dist/handlers/region/index.d.ts +1 -0
- package/dist/handlers/region/index.js +18 -0
- package/dist/handlers/region/index.js.map +1 -0
- package/dist/handlers/sales-channel/find-sales-channel.d.ts +20 -0
- package/dist/handlers/sales-channel/find-sales-channel.js +41 -0
- package/dist/handlers/sales-channel/find-sales-channel.js.map +1 -0
- package/dist/handlers/sales-channel/index.d.ts +1 -0
- package/dist/handlers/sales-channel/index.js +18 -0
- package/dist/handlers/sales-channel/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareRemovePriceListPrices = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
async function prepareRemovePriceListPrices({ container, data, }) {
|
|
6
|
+
const pricingService = container.resolve(modules_sdk_1.ModuleRegistrationName.PRICING);
|
|
7
|
+
const { price_list_id: priceListId, money_amount_ids: moneyAmountIdsToDelete, } = data;
|
|
8
|
+
const moneyAmounts = await pricingService.listMoneyAmounts({ id: moneyAmountIdsToDelete }, {
|
|
9
|
+
relations: [
|
|
10
|
+
"price_set_money_amount",
|
|
11
|
+
"price_set_money_amount.price_list",
|
|
12
|
+
],
|
|
13
|
+
});
|
|
14
|
+
const moneyAmountIds = moneyAmounts
|
|
15
|
+
.filter((moneyAmount) => moneyAmount?.price_set_money_amount?.price_list?.id === priceListId)
|
|
16
|
+
.map((ma) => ma.id);
|
|
17
|
+
return { moneyAmountIds, priceListId };
|
|
18
|
+
}
|
|
19
|
+
exports.prepareRemovePriceListPrices = prepareRemovePriceListPrices;
|
|
20
|
+
prepareRemovePriceListPrices.aliases = {
|
|
21
|
+
payload: "payload",
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=prepare-remove-price-list-prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-remove-price-list-prices.js","sourceRoot":"","sources":["../../../src/handlers/price-list/prepare-remove-price-list-prices.ts"],"names":[],"mappings":";;;AAAA,uDAA8D;AASvD,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,IAAI,GAIJ;IACA,MAAM,cAAc,GAA0B,SAAS,CAAC,OAAO,CAC7D,oCAAsB,CAAC,OAAO,CAC/B,CAAA;IAED,MAAM,EACJ,aAAa,EAAE,WAAW,EAC1B,gBAAgB,EAAE,sBAAsB,GACzC,GAAG,IAAI,CAAA;IAER,MAAM,YAAY,GAAG,MAAM,cAAc,CAAC,gBAAgB,CACxD,EAAE,EAAE,EAAE,sBAAsB,EAAE,EAC9B;QACE,SAAS,EAAE;YACT,wBAAwB;YACxB,mCAAmC;SACpC;KACF,CACF,CAAA;IAED,MAAM,cAAc,GAAG,YAAY;SAChC,MAAM,CACL,CAAC,WAAW,EAAE,EAAE,CACd,WAAW,EAAE,sBAAsB,EAAE,UAAU,EAAE,EAAE,KAAK,WAAW,CACtE;SACA,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAErB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,CAAA;AACxC,CAAC;AAlCD,oEAkCC;AAED,4BAA4B,CAAC,OAAO,GAAG;IACrC,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
2
|
+
type Result = {
|
|
3
|
+
priceSetIds: string[];
|
|
4
|
+
priceListId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function prepareRemoveProductPrices({ container, data, }: WorkflowArguments<{
|
|
7
|
+
product_ids: string[];
|
|
8
|
+
price_list_id: string;
|
|
9
|
+
}>): Promise<Result | void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareRemoveProductPrices = void 0;
|
|
4
|
+
const prepare_create_price_list_1 = require("./prepare-create-price-list");
|
|
5
|
+
async function prepareRemoveProductPrices({ container, data, }) {
|
|
6
|
+
const remoteQuery = container.resolve("remoteQuery");
|
|
7
|
+
const { price_list_id, product_ids } = data;
|
|
8
|
+
const variables = {
|
|
9
|
+
id: product_ids,
|
|
10
|
+
};
|
|
11
|
+
const query = {
|
|
12
|
+
product: {
|
|
13
|
+
__args: variables,
|
|
14
|
+
...defaultAdminProductRemoteQueryObject,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const productsWithVariantPriceSets = await remoteQuery(query);
|
|
18
|
+
const priceSetIds = productsWithVariantPriceSets
|
|
19
|
+
.map(({ variants }) => variants.map(({ price }) => price.price_set_id))
|
|
20
|
+
.flat();
|
|
21
|
+
return { priceSetIds, priceListId: price_list_id };
|
|
22
|
+
}
|
|
23
|
+
exports.prepareRemoveProductPrices = prepareRemoveProductPrices;
|
|
24
|
+
prepare_create_price_list_1.prepareCreatePriceLists.aliases = {
|
|
25
|
+
payload: "payload",
|
|
26
|
+
};
|
|
27
|
+
const defaultAdminProductRemoteQueryObject = {
|
|
28
|
+
fields: ["id"],
|
|
29
|
+
variants: {
|
|
30
|
+
price: {
|
|
31
|
+
fields: ["variant_id", "price_set_id"],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=prepare-remove-product-prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-remove-product-prices.js","sourceRoot":"","sources":["../../../src/handlers/price-list/prepare-remove-product-prices.ts"],"names":[],"mappings":";;;AACA,2EAAqE;AAO9D,KAAK,UAAU,0BAA0B,CAAC,EAC/C,SAAS,EACT,IAAI,GAIJ;IACA,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAEpD,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IAE3C,MAAM,SAAS,GAAG;QAChB,EAAE,EAAE,WAAW;KAChB,CAAA;IAED,MAAM,KAAK,GAAG;QACZ,OAAO,EAAE;YACP,MAAM,EAAE,SAAS;YACjB,GAAG,oCAAoC;SACxC;KACF,CAAA;IAED,MAAM,4BAA4B,GAAkB,MAAM,WAAW,CAAC,KAAK,CAAC,CAAA;IAE5E,MAAM,WAAW,GAAG,4BAA4B;SAC7C,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SACtE,IAAI,EAAE,CAAA;IAET,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA;AACpD,CAAC;AA7BD,gEA6BC;AAED,mDAAuB,CAAC,OAAO,GAAG;IAChC,OAAO,EAAE,SAAS;CACnB,CAAA;AAaD,MAAM,oCAAoC,GAAG;IAC3C,MAAM,EAAE,CAAC,IAAI,CAAC;IACd,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,MAAM,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;SACvC;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
2
|
+
type Result = {
|
|
3
|
+
priceSetIds: string[];
|
|
4
|
+
priceListId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function prepareRemoveVariantPrices({ container, data, }: WorkflowArguments<{
|
|
7
|
+
variant_ids: string[];
|
|
8
|
+
price_list_id: string;
|
|
9
|
+
}>): Promise<Result | void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareRemoveVariantPrices = void 0;
|
|
4
|
+
const prepare_create_price_list_1 = require("./prepare-create-price-list");
|
|
5
|
+
async function prepareRemoveVariantPrices({ container, data, }) {
|
|
6
|
+
const remoteQuery = container.resolve("remoteQuery");
|
|
7
|
+
const { price_list_id, variant_ids } = data;
|
|
8
|
+
const variables = {
|
|
9
|
+
variant_id: variant_ids,
|
|
10
|
+
};
|
|
11
|
+
const query = {
|
|
12
|
+
product_variant_price_set: {
|
|
13
|
+
__args: variables,
|
|
14
|
+
fields: ["variant_id", "price_set_id"],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const productsWithVariantPriceSets = await remoteQuery(query);
|
|
18
|
+
const priceSetIds = productsWithVariantPriceSets.map((variantPriceSet) => variantPriceSet.price_set_id);
|
|
19
|
+
return { priceSetIds, priceListId: price_list_id };
|
|
20
|
+
}
|
|
21
|
+
exports.prepareRemoveVariantPrices = prepareRemoveVariantPrices;
|
|
22
|
+
prepare_create_price_list_1.prepareCreatePriceLists.aliases = {
|
|
23
|
+
payload: "payload",
|
|
24
|
+
};
|
|
25
|
+
const defaultAdminProductRemoteQueryObject = {
|
|
26
|
+
fields: ["id"],
|
|
27
|
+
variants: {
|
|
28
|
+
price: {
|
|
29
|
+
fields: ["variant_id", "price_set_id"],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=prepare-remove-variant-prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-remove-variant-prices.js","sourceRoot":"","sources":["../../../src/handlers/price-list/prepare-remove-variant-prices.ts"],"names":[],"mappings":";;;AACA,2EAAqE;AAO9D,KAAK,UAAU,0BAA0B,CAAC,EAC/C,SAAS,EACT,IAAI,GAIJ;IACA,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAEpD,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IAE3C,MAAM,SAAS,GAAG;QAChB,UAAU,EAAE,WAAW;KACxB,CAAA;IAED,MAAM,KAAK,GAAG;QACZ,yBAAyB,EAAE;YACzB,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;SACvC;KACF,CAAA;IAED,MAAM,4BAA4B,GAAkB,MAAM,WAAW,CAAC,KAAK,CAAC,CAAA;IAE5E,MAAM,WAAW,GAAG,4BAA4B,CAAC,GAAG,CAClD,CAAC,eAAe,EAAE,EAAE,CAAC,eAAe,CAAC,YAAY,CAClD,CAAA;IAED,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA;AACpD,CAAC;AA7BD,gEA6BC;AAED,mDAAuB,CAAC,OAAO,GAAG;IAChC,OAAO,EAAE,SAAS;CACnB,CAAA;AAOD,MAAM,oCAAoC,GAAG;IAC3C,MAAM,EAAE,CAAC,IAAI,CAAC;IACd,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,MAAM,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;SACvC;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PriceListPriceDTO, UpdatePriceListDTO, WorkflowTypes } from "@medusajs/types";
|
|
2
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
3
|
+
type Result = {
|
|
4
|
+
priceLists: UpdatePriceListDTO[];
|
|
5
|
+
priceListPricesMap: Map<string, PriceListPriceDTO[]>;
|
|
6
|
+
};
|
|
7
|
+
export declare function prepareUpdatePriceLists({ container, data, }: WorkflowArguments<{
|
|
8
|
+
price_lists: WorkflowTypes.PriceListWorkflow.UpdatePriceListWorkflowDTO[];
|
|
9
|
+
}>): Promise<Result>;
|
|
10
|
+
export declare namespace prepareUpdatePriceLists {
|
|
11
|
+
var aliases: {
|
|
12
|
+
payload: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareUpdatePriceLists = void 0;
|
|
4
|
+
async function prepareUpdatePriceLists({ container, data, }) {
|
|
5
|
+
const { price_lists: priceListsData } = data;
|
|
6
|
+
const remoteQuery = container.resolve("remoteQuery");
|
|
7
|
+
const variantPriceSetMap = new Map();
|
|
8
|
+
const priceListPricesMap = new Map();
|
|
9
|
+
const variantIds = priceListsData
|
|
10
|
+
.map((priceListData) => priceListData.prices?.map((p) => p.variant_id))
|
|
11
|
+
.flat();
|
|
12
|
+
const variables = {
|
|
13
|
+
variant_id: variantIds,
|
|
14
|
+
};
|
|
15
|
+
const query = {
|
|
16
|
+
product_variant_price_set: {
|
|
17
|
+
__args: variables,
|
|
18
|
+
fields: ["variant_id", "price_set_id"],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const variantPriceSets = await remoteQuery(query);
|
|
22
|
+
for (const { variant_id, price_set_id } of variantPriceSets) {
|
|
23
|
+
variantPriceSetMap.set(variant_id, price_set_id);
|
|
24
|
+
}
|
|
25
|
+
const priceLists = priceListsData.map((priceListData) => {
|
|
26
|
+
const priceListPrices = [];
|
|
27
|
+
priceListData.prices?.forEach((price) => {
|
|
28
|
+
const { variant_id, ...priceData } = price;
|
|
29
|
+
if (!variant_id) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
priceListPrices.push({
|
|
33
|
+
id: priceData.id,
|
|
34
|
+
price_set_id: variantPriceSetMap.get(variant_id),
|
|
35
|
+
currency_code: priceData.currency_code,
|
|
36
|
+
amount: priceData.amount,
|
|
37
|
+
min_quantity: priceData.min_quantity,
|
|
38
|
+
max_quantity: priceData.max_quantity,
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
});
|
|
42
|
+
priceListPricesMap.set(priceListData.id, priceListPrices);
|
|
43
|
+
delete priceListData?.prices;
|
|
44
|
+
const priceListDataClone = {
|
|
45
|
+
...priceListData,
|
|
46
|
+
};
|
|
47
|
+
if (priceListData.name) {
|
|
48
|
+
priceListDataClone.title = priceListData.name;
|
|
49
|
+
}
|
|
50
|
+
return priceListDataClone;
|
|
51
|
+
});
|
|
52
|
+
return { priceLists, priceListPricesMap };
|
|
53
|
+
}
|
|
54
|
+
exports.prepareUpdatePriceLists = prepareUpdatePriceLists;
|
|
55
|
+
prepareUpdatePriceLists.aliases = {
|
|
56
|
+
payload: "prepare",
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=prepare-update-price-lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-update-price-lists.js","sourceRoot":"","sources":["../../../src/handlers/price-list/prepare-update-price-lists.ts"],"names":[],"mappings":";;;AAYO,KAAK,UAAU,uBAAuB,CAAC,EAC5C,SAAS,EACT,IAAI,GAGJ;IACA,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAC5C,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAEpD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAA;IACpD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAA+B,CAAA;IAEjE,MAAM,UAAU,GAAG,cAAc;SAC9B,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;SACtE,IAAI,EAAE,CAAA;IAET,MAAM,SAAS,GAAG;QAChB,UAAU,EAAE,UAAU;KACvB,CAAA;IAED,MAAM,KAAK,GAAG;QACZ,yBAAyB,EAAE;YACzB,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;SACvC;KACF,CAAA;IAED,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,CAAA;IAEjD,KAAK,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,gBAAgB,EAAE;QAC3D,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;KACjD;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE;QACtD,MAAM,eAAe,GAAwB,EAAE,CAAA;QAE/C,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACtC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;YAC1C,IAAI,CAAC,UAAU,EAAE;gBACf,OAAM;aACP;YAED,eAAe,CAAC,IAAI,CAAC;gBACnB,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,YAAY,EAAE,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAW;gBAC1D,aAAa,EAAE,SAAS,CAAC,aAAuB;gBAChD,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,YAAY,EAAE,SAAS,CAAC,YAAY;aACrC,CAAC,CAAA;YAEF,OAAM;QACR,CAAC,CAAC,CAAA;QAEF,kBAAkB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAA;QAEzD,OAAO,aAAa,EAAE,MAAM,CAAA;QAE5B,MAAM,kBAAkB,GAAuB;YAC7C,GAAG,aAAa;SACjB,CAAA;QAED,IAAI,aAAa,CAAC,IAAI,EAAE;YACtB,kBAAkB,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAA;SAC9C;QAED,OAAO,kBAAkB,CAAA;IAC3B,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAA;AAC3C,CAAC;AAtED,0DAsEC;AAED,uBAAuB,CAAC,OAAO,GAAG;IAChC,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PriceListDTO } from "@medusajs/types";
|
|
2
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
3
|
+
export declare function removePriceLists({ container, data, }: WorkflowArguments<{
|
|
4
|
+
price_lists: {
|
|
5
|
+
price_list: PriceListDTO;
|
|
6
|
+
}[];
|
|
7
|
+
}>): Promise<{
|
|
8
|
+
price_list: PriceListDTO;
|
|
9
|
+
}[]>;
|
|
10
|
+
export declare namespace removePriceLists {
|
|
11
|
+
var aliases: {
|
|
12
|
+
priceLists: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removePriceLists = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
async function removePriceLists({ container, data, }) {
|
|
6
|
+
const pricingService = container.resolve(modules_sdk_1.ModuleRegistrationName.PRICING);
|
|
7
|
+
await pricingService.deletePriceLists(data.price_lists.map(({ price_list }) => price_list.id));
|
|
8
|
+
return data.price_lists;
|
|
9
|
+
}
|
|
10
|
+
exports.removePriceLists = removePriceLists;
|
|
11
|
+
removePriceLists.aliases = {
|
|
12
|
+
priceLists: "priceLists",
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=remove-price-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-price-list.js","sourceRoot":"","sources":["../../../src/handlers/price-list/remove-price-list.ts"],"names":[],"mappings":";;;AAEA,uDAA8D;AAGvD,KAAK,UAAU,gBAAgB,CAAC,EACrC,SAAS,EACT,IAAI,GAKJ;IAKA,MAAM,cAAc,GAA0B,SAAS,CAAC,OAAO,CAC7D,oCAAsB,CAAC,OAAO,CAC/B,CAAA;IAED,MAAM,cAAe,CAAC,gBAAgB,CACpC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CACxD,CAAA;IAED,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC;AArBD,4CAqBC;AAED,gBAAgB,CAAC,OAAO,GAAG;IACzB,UAAU,EAAE,YAAY;CACzB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removePriceListPriceSetPrices = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const prepare_create_price_list_1 = require("./prepare-create-price-list");
|
|
6
|
+
async function removePriceListPriceSetPrices({ container, data, }) {
|
|
7
|
+
const { priceSetIds, priceListId } = data;
|
|
8
|
+
const pricingService = container.resolve(modules_sdk_1.ModuleRegistrationName.PRICING);
|
|
9
|
+
const priceSetMoneyAmounts = await pricingService.listPriceSetMoneyAmounts({
|
|
10
|
+
price_set_id: priceSetIds,
|
|
11
|
+
price_list_id: [priceListId],
|
|
12
|
+
}, {
|
|
13
|
+
relations: ["money_amount"],
|
|
14
|
+
});
|
|
15
|
+
const moneyAmountIDs = priceSetMoneyAmounts
|
|
16
|
+
.map((priceSetMoneyAmount) => priceSetMoneyAmount.money_amount?.id)
|
|
17
|
+
.filter((moneyAmountId) => !!moneyAmountId);
|
|
18
|
+
await pricingService.deleteMoneyAmounts(moneyAmountIDs);
|
|
19
|
+
return moneyAmountIDs;
|
|
20
|
+
}
|
|
21
|
+
exports.removePriceListPriceSetPrices = removePriceListPriceSetPrices;
|
|
22
|
+
prepare_create_price_list_1.prepareCreatePriceLists.aliases = {
|
|
23
|
+
payload: "payload",
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=remove-price-set-price-list-prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-price-set-price-list-prices.js","sourceRoot":"","sources":["../../../src/handlers/price-list/remove-price-set-price-list-prices.ts"],"names":[],"mappings":";;;AAAA,uDAA8D;AAG9D,2EAAqE;AAE9D,KAAK,UAAU,6BAA6B,CAAC,EAClD,SAAS,EACT,IAAI,GAIJ;IACA,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IACzC,MAAM,cAAc,GAA0B,SAAS,CAAC,OAAO,CAC7D,oCAAsB,CAAC,OAAO,CAC/B,CAAA;IAED,MAAM,oBAAoB,GAAG,MAAM,cAAc,CAAC,wBAAwB,CACxE;QACE,YAAY,EAAE,WAAW;QACzB,aAAa,EAAE,CAAC,WAAW,CAAC;KAC7B,EACD;QACE,SAAS,EAAE,CAAC,cAAc,CAAC;KAC5B,CACF,CAAA;IAED,MAAM,cAAc,GAAG,oBAAoB;SACxC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC,YAAY,EAAE,EAAE,CAAC;SAClE,MAAM,CAAC,CAAC,aAAa,EAA2B,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAA;IAEtE,MAAM,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IAEvD,OAAO,cAAc,CAAA;AACvB,CAAC;AA7BD,sEA6BC;AAED,mDAAuB,CAAC,OAAO,GAAG;IAChC,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
2
|
+
type Result = {
|
|
3
|
+
deletedPriceIds: string[];
|
|
4
|
+
};
|
|
5
|
+
export declare function removePrices({ container, data, }: WorkflowArguments<{
|
|
6
|
+
moneyAmountIds: string[];
|
|
7
|
+
}>): Promise<Result>;
|
|
8
|
+
export declare namespace removePrices {
|
|
9
|
+
var aliases: {
|
|
10
|
+
payload: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removePrices = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
async function removePrices({ container, data, }) {
|
|
6
|
+
const { moneyAmountIds } = data;
|
|
7
|
+
const pricingService = container.resolve(modules_sdk_1.ModuleRegistrationName.PRICING);
|
|
8
|
+
await pricingService.deleteMoneyAmounts(moneyAmountIds);
|
|
9
|
+
return {
|
|
10
|
+
deletedPriceIds: moneyAmountIds,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.removePrices = removePrices;
|
|
14
|
+
removePrices.aliases = {
|
|
15
|
+
payload: "payload",
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=remove-prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-prices.js","sourceRoot":"","sources":["../../../src/handlers/price-list/remove-prices.ts"],"names":[],"mappings":";;;AAAA,uDAA8D;AAQvD,KAAK,UAAU,YAAY,CAAC,EACjC,SAAS,EACT,IAAI,GAGJ;IACA,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAC/B,MAAM,cAAc,GAA0B,SAAS,CAAC,OAAO,CAC7D,oCAAsB,CAAC,OAAO,CAC/B,CAAA;IAED,MAAM,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IAEvD,OAAO;QACL,eAAe,EAAE,cAAc;KAChC,CAAA;AACH,CAAC;AAhBD,oCAgBC;AAED,YAAY,CAAC,OAAO,GAAG;IACrB,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PriceListDTO, PriceListPriceDTO, UpdatePriceListDTO } from "@medusajs/types";
|
|
2
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
3
|
+
type Result = {
|
|
4
|
+
priceLists: PriceListDTO[];
|
|
5
|
+
};
|
|
6
|
+
export declare function updatePriceLists({ container, data, }: WorkflowArguments<{
|
|
7
|
+
priceLists: UpdatePriceListDTO[];
|
|
8
|
+
priceListPricesMap: Map<string, PriceListPriceDTO[]>;
|
|
9
|
+
}>): Promise<Result>;
|
|
10
|
+
export declare namespace updatePriceLists {
|
|
11
|
+
var aliases: {
|
|
12
|
+
payload: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatePriceLists = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
async function updatePriceLists({ container, data, }) {
|
|
6
|
+
const { priceLists: priceListsData, priceListPricesMap } = data;
|
|
7
|
+
const pricingService = container.resolve(modules_sdk_1.ModuleRegistrationName.PRICING);
|
|
8
|
+
const priceLists = await pricingService.updatePriceLists(priceListsData);
|
|
9
|
+
const addPriceListPricesData = [];
|
|
10
|
+
const moneyAmountsToUpdate = [];
|
|
11
|
+
for (const [priceListId, prices] of priceListPricesMap.entries()) {
|
|
12
|
+
const moneyAmountsToCreate = [];
|
|
13
|
+
for (const price of prices) {
|
|
14
|
+
if (price.id) {
|
|
15
|
+
moneyAmountsToUpdate.push(price);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
moneyAmountsToCreate.push(price);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
addPriceListPricesData.push({
|
|
22
|
+
priceListId,
|
|
23
|
+
prices: moneyAmountsToCreate,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (addPriceListPricesData.length) {
|
|
27
|
+
await pricingService.addPriceListPrices(addPriceListPricesData);
|
|
28
|
+
}
|
|
29
|
+
if (moneyAmountsToUpdate.length) {
|
|
30
|
+
await pricingService.updateMoneyAmounts(moneyAmountsToUpdate);
|
|
31
|
+
}
|
|
32
|
+
return { priceLists };
|
|
33
|
+
}
|
|
34
|
+
exports.updatePriceLists = updatePriceLists;
|
|
35
|
+
updatePriceLists.aliases = {
|
|
36
|
+
payload: "updatePriceLists",
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=update-price-lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-price-lists.js","sourceRoot":"","sources":["../../../src/handlers/price-list/update-price-lists.ts"],"names":[],"mappings":";;;AASA,uDAA8D;AAOvD,KAAK,UAAU,gBAAgB,CAAC,EACrC,SAAS,EACT,IAAI,GAIJ;IACA,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAA;IAC/D,MAAM,cAAc,GAA0B,SAAS,CAAC,OAAO,CAC7D,oCAAsB,CAAC,OAAO,CAC/B,CAAA;IAED,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAA;IACxE,MAAM,sBAAsB,GAA4B,EAAE,CAAA;IAC1D,MAAM,oBAAoB,GAA2B,EAAE,CAAA;IAEvD,KAAK,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE;QAChE,MAAM,oBAAoB,GAAwB,EAAE,CAAA;QAEpD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,IAAI,KAAK,CAAC,EAAE,EAAE;gBACZ,oBAAoB,CAAC,IAAI,CAAC,KAA6B,CAAC,CAAA;aACzD;iBAAM;gBACL,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;aACjC;SACF;QAED,sBAAsB,CAAC,IAAI,CAAC;YAC1B,WAAW;YACX,MAAM,EAAE,oBAAoB;SAC7B,CAAC,CAAA;KACH;IAED,IAAI,sBAAsB,CAAC,MAAM,EAAE;QACjC,MAAM,cAAc,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;KAChE;IAED,IAAI,oBAAoB,CAAC,MAAM,EAAE;QAC/B,MAAM,cAAc,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;KAC9D;IAED,OAAO,EAAE,UAAU,EAAE,CAAA;AACvB,CAAC;AA1CD,4CA0CC;AAED,gBAAgB,CAAC,OAAO,GAAG;IACzB,OAAO,EAAE,kBAAkB;CAC5B,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
2
|
+
type ProductHandle = string;
|
|
3
|
+
type SalesChannelId = string;
|
|
4
|
+
type PartialProduct = {
|
|
5
|
+
handle: string;
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
type HandlerInput = {
|
|
9
|
+
productsHandleSalesChannelsMap: Map<ProductHandle, SalesChannelId[]>;
|
|
10
|
+
products: PartialProduct[];
|
|
11
|
+
};
|
|
12
|
+
export declare function attachSalesChannelToProducts({ container, context, data, }: WorkflowArguments<HandlerInput>): Promise<void>;
|
|
13
|
+
export declare namespace attachSalesChannelToProducts {
|
|
14
|
+
var aliases: {
|
|
15
|
+
products: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.attachSalesChannelToProducts = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
|
5
|
+
async function attachSalesChannelToProducts({ container, context, data, }) {
|
|
6
|
+
const { manager } = context;
|
|
7
|
+
const productsHandleSalesChannelsMap = data.productsHandleSalesChannelsMap;
|
|
8
|
+
const products = data.products;
|
|
9
|
+
const salesChannelService = container.resolve("salesChannelService");
|
|
10
|
+
const salesChannelServiceTx = salesChannelService.withTransaction(manager);
|
|
11
|
+
const salesChannelIdProductIdsMap = new Map();
|
|
12
|
+
products.forEach((product) => {
|
|
13
|
+
const salesChannelIds = productsHandleSalesChannelsMap.get(product.handle);
|
|
14
|
+
if (salesChannelIds) {
|
|
15
|
+
salesChannelIds.forEach((salesChannelId) => {
|
|
16
|
+
const productIds = salesChannelIdProductIdsMap.get(salesChannelId) || [];
|
|
17
|
+
productIds.push(product.id);
|
|
18
|
+
salesChannelIdProductIdsMap.set(salesChannelId, productIds);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
await (0, utils_1.promiseAll)(Array.from(salesChannelIdProductIdsMap.entries()).map(async ([salesChannelId, productIds]) => {
|
|
23
|
+
return await salesChannelServiceTx.addProducts(salesChannelId, productIds);
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
exports.attachSalesChannelToProducts = attachSalesChannelToProducts;
|
|
27
|
+
attachSalesChannelToProducts.aliases = {
|
|
28
|
+
products: "products",
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=attach-sales-channel-to-products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach-sales-channel-to-products.js","sourceRoot":"","sources":["../../../src/handlers/product/attach-sales-channel-to-products.ts"],"names":[],"mappings":";;;AACA,2CAA4C;AAYrC,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,OAAO,EACP,IAAI,GAC4B;IAChC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAC3B,MAAM,8BAA8B,GAAG,IAAI,CAAC,8BAA8B,CAAA;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAE9B,MAAM,mBAAmB,GAAG,SAAS,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACpE,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAE1E,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAmC,CAAA;IAC9E,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,MAAM,eAAe,GAAG,8BAA8B,CAAC,GAAG,CAAC,OAAO,CAAC,MAAO,CAAC,CAAA;QAC3E,IAAI,eAAe,EAAE;YACnB,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;gBACzC,MAAM,UAAU,GAAG,2BAA2B,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAA;gBACxE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;gBAC3B,2BAA2B,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;YAC7D,CAAC,CAAC,CAAA;SACH;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,IAAA,kBAAU,EACd,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CACnD,KAAK,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,EAAE,EAAE;QACrC,OAAO,MAAM,qBAAqB,CAAC,WAAW,CAC5C,cAAc,EACd,UAAU,CACX,CAAA;IACH,CAAC,CACF,CACF,CAAA;AACH,CAAC;AAlCD,oEAkCC;AAED,4BAA4B,CAAC,OAAO,GAAG;IACrC,QAAQ,EAAE,UAAU;CACrB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
2
|
+
type ProductHandle = string;
|
|
3
|
+
type ShippingProfileId = string;
|
|
4
|
+
type PartialProduct = {
|
|
5
|
+
handle: string;
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
type handlerInput = {
|
|
9
|
+
productsHandleShippingProfileIdMap: Map<ProductHandle, ShippingProfileId>;
|
|
10
|
+
products: PartialProduct[];
|
|
11
|
+
};
|
|
12
|
+
export declare function attachShippingProfileToProducts({ container, context, data, }: WorkflowArguments<handlerInput>): Promise<void>;
|
|
13
|
+
export declare namespace attachShippingProfileToProducts {
|
|
14
|
+
var aliases: {
|
|
15
|
+
products: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.attachShippingProfileToProducts = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
|
5
|
+
async function attachShippingProfileToProducts({ container, context, data, }) {
|
|
6
|
+
const { manager } = context;
|
|
7
|
+
const productsHandleShippingProfileIdMap = data.productsHandleShippingProfileIdMap;
|
|
8
|
+
const products = data.products;
|
|
9
|
+
const shippingProfileService = container.resolve("shippingProfileService");
|
|
10
|
+
const shippingProfileServiceTx = shippingProfileService.withTransaction(manager);
|
|
11
|
+
const profileIdProductIdsMap = new Map();
|
|
12
|
+
products.forEach((product) => {
|
|
13
|
+
const profileId = productsHandleShippingProfileIdMap.get(product.handle);
|
|
14
|
+
if (profileId) {
|
|
15
|
+
const productIds = profileIdProductIdsMap.get(profileId) || [];
|
|
16
|
+
productIds.push(product.id);
|
|
17
|
+
profileIdProductIdsMap.set(profileId, productIds);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
await (0, utils_1.promiseAll)(Array.from(profileIdProductIdsMap.entries()).map(async ([profileId, productIds]) => {
|
|
21
|
+
return await shippingProfileServiceTx.addProducts(profileId, productIds);
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
exports.attachShippingProfileToProducts = attachShippingProfileToProducts;
|
|
25
|
+
attachShippingProfileToProducts.aliases = {
|
|
26
|
+
products: "products",
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=attach-shipping-profile-to-products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach-shipping-profile-to-products.js","sourceRoot":"","sources":["../../../src/handlers/product/attach-shipping-profile-to-products.ts"],"names":[],"mappings":";;;AACA,2CAA4C;AAUrC,KAAK,UAAU,+BAA+B,CAAC,EACpD,SAAS,EACT,OAAO,EACP,IAAI,GAC4B;IAChC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAE3B,MAAM,kCAAkC,GACtC,IAAI,CAAC,kCAAkC,CAAA;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAE9B,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;IAC1E,MAAM,wBAAwB,GAC5B,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAEjD,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAsC,CAAA;IAC5E,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,MAAM,SAAS,GAAG,kCAAkC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAO,CAAC,CAAA;QACzE,IAAI,SAAS,EAAE;YACb,MAAM,UAAU,GAAG,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;YAC9D,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YAC3B,sBAAsB,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;SAClD;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,IAAA,kBAAU,EACd,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAC9C,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,EAAE;QAChC,OAAO,MAAM,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAC1E,CAAC,CACF,CACF,CAAA;AACH,CAAC;AAhCD,0EAgCC;AAED,+BAA+B,CAAC,OAAO,GAAG;IACxC,QAAQ,EAAE,UAAU;CACrB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ProductWorkflow, WorkflowTypes } from "@medusajs/types";
|
|
2
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
3
|
+
type VariantPrice = {
|
|
4
|
+
region_id?: string;
|
|
5
|
+
currency_code?: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
min_quantity?: number;
|
|
8
|
+
max_quantity?: number;
|
|
9
|
+
};
|
|
10
|
+
export type CreateProductVariantsPreparedData = {
|
|
11
|
+
productVariants: ProductWorkflow.CreateProductVariantsInputDTO[];
|
|
12
|
+
variantIndexPricesMap: Map<number, VariantPrice[]>;
|
|
13
|
+
productVariantsMap: Map<string, ProductWorkflow.CreateProductVariantsInputDTO[]>;
|
|
14
|
+
};
|
|
15
|
+
export declare function createProductVariantsPrepareData({ container, data, }: WorkflowArguments<WorkflowTypes.ProductWorkflow.CreateProductVariantsWorkflowInputDTO>): Promise<CreateProductVariantsPreparedData>;
|
|
16
|
+
export declare namespace createProductVariantsPrepareData {
|
|
17
|
+
var aliases: {
|
|
18
|
+
payload: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProductVariantsPrepareData = void 0;
|
|
4
|
+
async function createProductVariantsPrepareData({ container, data, }) {
|
|
5
|
+
const featureFlagRouter = container.resolve("featureFlagRouter");
|
|
6
|
+
const productVariants = data.productVariants || [];
|
|
7
|
+
const variantIndexPricesMap = new Map();
|
|
8
|
+
const productVariantsMap = new Map();
|
|
9
|
+
for (const [index, productVariantData] of productVariants.entries()) {
|
|
10
|
+
if (!productVariantData.product_id) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
variantIndexPricesMap.set(index, productVariantData.prices || []);
|
|
14
|
+
delete productVariantData.prices;
|
|
15
|
+
const productVariants = productVariantsMap.get(productVariantData.product_id);
|
|
16
|
+
if (productVariants) {
|
|
17
|
+
productVariants.push(productVariantData);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
productVariantsMap.set(productVariantData.product_id, [
|
|
21
|
+
productVariantData,
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
productVariants,
|
|
27
|
+
variantIndexPricesMap,
|
|
28
|
+
productVariantsMap,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.createProductVariantsPrepareData = createProductVariantsPrepareData;
|
|
32
|
+
createProductVariantsPrepareData.aliases = {
|
|
33
|
+
payload: "payload",
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=create-product-variants-prepare-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-product-variants-prepare-data.js","sourceRoot":"","sources":["../../../src/handlers/product/create-product-variants-prepare-data.ts"],"names":[],"mappings":";;;AAqBO,KAAK,UAAU,gCAAgC,CAAC,EACrD,SAAS,EACT,IAAI,GACmF;IACvF,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAChE,MAAM,eAAe,GACnB,IAAI,CAAC,eAAe,IAAI,EAAE,CAAA;IAE5B,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA0B,CAAA;IAC/D,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAG/B,CAAA;IAEH,KAAK,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,eAAe,CAAC,OAAO,EAAE,EAAE;QACnE,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE;YAClC,SAAQ;SACT;QAED,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;QAEjE,OAAO,kBAAkB,CAAC,MAAM,CAAA;QAEhC,MAAM,eAAe,GAAG,kBAAkB,CAAC,GAAG,CAC5C,kBAAkB,CAAC,UAAU,CAC9B,CAAA;QAED,IAAI,eAAe,EAAE;YACnB,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;SACzC;aAAM;YACL,kBAAkB,CAAC,GAAG,CAAC,kBAAkB,CAAC,UAAU,EAAE;gBACpD,kBAAkB;aACnB,CAAC,CAAA;SACH;KACF;IAED,OAAO;QACL,eAAe;QACf,qBAAqB;QACrB,kBAAkB;KACnB,CAAA;AACH,CAAC;AAzCD,4EAyCC;AAED,gCAAgC,CAAC,OAAO,GAAG;IACzC,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ProductTypes } from "@medusajs/types";
|
|
2
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
3
|
+
type VariantPrice = {
|
|
4
|
+
region_id?: string;
|
|
5
|
+
currency_code?: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
min_quantity?: number;
|
|
8
|
+
max_quantity?: number;
|
|
9
|
+
};
|
|
10
|
+
type HandlerInput = {
|
|
11
|
+
productVariantsMap: Map<string, ProductTypes.CreateProductVariantDTO[]>;
|
|
12
|
+
variantIndexPricesMap: Map<number, VariantPrice[]>;
|
|
13
|
+
};
|
|
14
|
+
export declare function createProductVariants({ container, data, }: WorkflowArguments<HandlerInput>): Promise<{
|
|
15
|
+
productVariants: ProductTypes.ProductVariantDTO[];
|
|
16
|
+
variantPricesMap: Map<string, VariantPrice[]>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare namespace createProductVariants {
|
|
19
|
+
var aliases: {
|
|
20
|
+
payload: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProductVariants = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
async function createProductVariants({ container, data, }) {
|
|
6
|
+
const { productVariantsMap, variantIndexPricesMap } = data;
|
|
7
|
+
const variantPricesMap = new Map();
|
|
8
|
+
const productModuleService = container.resolve(modules_sdk_1.ModulesDefinition[modules_sdk_1.Modules.PRODUCT].registrationName);
|
|
9
|
+
const productVariants = await productModuleService.createVariants([...productVariantsMap.values()].flat());
|
|
10
|
+
productVariants.forEach((variant, index) => {
|
|
11
|
+
variantPricesMap.set(variant.id, variantIndexPricesMap.get(index) || []);
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
productVariants,
|
|
15
|
+
variantPricesMap,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.createProductVariants = createProductVariants;
|
|
19
|
+
createProductVariants.aliases = {
|
|
20
|
+
payload: "payload",
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=create-product-variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-product-variants.js","sourceRoot":"","sources":["../../../src/handlers/product/create-product-variants.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAiB3D,KAAK,UAAU,qBAAqB,CAAC,EAC1C,SAAS,EACT,IAAI,GAC4B;IAIhC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAA;IAC1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA0B,CAAA;IAC1D,MAAM,oBAAoB,GACxB,SAAS,CAAC,OAAO,CAAC,+BAAiB,CAAC,qBAAO,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAA;IAExE,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAAC,cAAc,CAC/D,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CACxC,CAAA;IAED,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACzC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,eAAe;QACf,gBAAgB;KACjB,CAAA;AACH,CAAC;AAxBD,sDAwBC;AAED,qBAAqB,CAAC,OAAO,GAAG;IAC9B,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ProductTypes, WorkflowTypes } from "@medusajs/types";
|
|
2
|
+
import { WorkflowArguments } from "@medusajs/workflows-sdk";
|
|
3
|
+
type ShippingProfileId = string;
|
|
4
|
+
type SalesChannelId = string;
|
|
5
|
+
type ProductHandle = string;
|
|
6
|
+
type VariantIndexAndPrices = {
|
|
7
|
+
index: number;
|
|
8
|
+
prices: {
|
|
9
|
+
region_id?: string;
|
|
10
|
+
currency_code?: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
min_quantity?: number;
|
|
13
|
+
max_quantity?: number;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
export type CreateProductsPreparedData = {
|
|
17
|
+
products: ProductTypes.CreateProductDTO[];
|
|
18
|
+
productsHandleShippingProfileIdMap: Map<ProductHandle, ShippingProfileId>;
|
|
19
|
+
productsHandleSalesChannelsMap: Map<ProductHandle, SalesChannelId[]>;
|
|
20
|
+
productsHandleVariantsIndexPricesMap: Map<ProductHandle, VariantIndexAndPrices[]>;
|
|
21
|
+
};
|
|
22
|
+
export declare function createProductsPrepareData({ container, context, data, }: WorkflowArguments<WorkflowTypes.ProductWorkflow.CreateProductsWorkflowInputDTO>): Promise<CreateProductsPreparedData>;
|
|
23
|
+
export declare namespace createProductsPrepareData {
|
|
24
|
+
var aliases: {
|
|
25
|
+
payload: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {};
|