@unchainedshop/api 3.1.8 → 3.1.9
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/lib/loaders/assortmentLinkLoader.d.ts +12 -0
- package/lib/loaders/assortmentLinkLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinkLoader.js +23 -0
- package/lib/loaders/assortmentLinkLoader.js.map +1 -0
- package/lib/loaders/assortmentLinksLoader.d.ts +14 -0
- package/lib/loaders/assortmentLinksLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinksLoader.js +38 -0
- package/lib/loaders/assortmentLinksLoader.js.map +1 -0
- package/lib/loaders/assortmentLoader.d.ts +10 -0
- package/lib/loaders/assortmentLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLoader.js +15 -0
- package/lib/loaders/assortmentLoader.js.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.js +20 -0
- package/lib/loaders/assortmentMediaTextLoader.js.map +1 -0
- package/lib/loaders/assortmentMediasLoader.d.ts +10 -0
- package/lib/loaders/assortmentMediasLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediasLoader.js +18 -0
- package/lib/loaders/assortmentMediasLoader.js.map +1 -0
- package/lib/loaders/assortmentProductLoader.d.ts +12 -0
- package/lib/loaders/assortmentProductLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductLoader.js +14 -0
- package/lib/loaders/assortmentProductLoader.js.map +1 -0
- package/lib/loaders/assortmentProductsLoader.d.ts +10 -0
- package/lib/loaders/assortmentProductsLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductsLoader.js +18 -0
- package/lib/loaders/assortmentProductsLoader.js.map +1 -0
- package/lib/loaders/assortmentTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentTextLoader.js +20 -0
- package/lib/loaders/assortmentTextLoader.js.map +1 -0
- package/lib/loaders/buildTextMap.d.ts +6 -0
- package/lib/loaders/buildTextMap.d.ts.map +1 -0
- package/lib/loaders/buildTextMap.js +16 -0
- package/lib/loaders/buildTextMap.js.map +1 -0
- package/lib/loaders/countryLoader.d.ts +10 -0
- package/lib/loaders/countryLoader.d.ts.map +1 -0
- package/lib/loaders/countryLoader.js +14 -0
- package/lib/loaders/countryLoader.js.map +1 -0
- package/lib/loaders/currencyLoader copy.d.ts +10 -0
- package/lib/loaders/currencyLoader copy.d.ts.map +1 -0
- package/lib/loaders/currencyLoader copy.js +14 -0
- package/lib/loaders/currencyLoader copy.js.map +1 -0
- package/lib/loaders/currencyLoader.d.ts +10 -0
- package/lib/loaders/currencyLoader.d.ts.map +1 -0
- package/lib/loaders/currencyLoader.js +14 -0
- package/lib/loaders/currencyLoader.js.map +1 -0
- package/lib/loaders/currencyLoaderByIsoCode.d.ts +10 -0
- package/lib/loaders/currencyLoaderByIsoCode.d.ts.map +1 -0
- package/lib/loaders/currencyLoaderByIsoCode.js +13 -0
- package/lib/loaders/currencyLoaderByIsoCode.js.map +1 -0
- package/lib/loaders/fileLoader.d.ts +10 -0
- package/lib/loaders/fileLoader.d.ts.map +1 -0
- package/lib/loaders/fileLoader.js +13 -0
- package/lib/loaders/fileLoader.js.map +1 -0
- package/lib/loaders/filterLoader.d.ts +10 -0
- package/lib/loaders/filterLoader.d.ts.map +1 -0
- package/lib/loaders/filterLoader.js +14 -0
- package/lib/loaders/filterLoader.js.map +1 -0
- package/lib/loaders/filterTextLoader.d.ts +14 -0
- package/lib/loaders/filterTextLoader.d.ts.map +1 -0
- package/lib/loaders/filterTextLoader.js +20 -0
- package/lib/loaders/filterTextLoader.js.map +1 -0
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +6 -35
- package/lib/loaders/index.js.map +1 -1
- package/lib/loaders/productLoader.d.ts +10 -0
- package/lib/loaders/productLoader.d.ts.map +1 -0
- package/lib/loaders/productLoader.js +16 -0
- package/lib/loaders/productLoader.js.map +1 -0
- package/lib/loaders/productLoaderBySKU.d.ts +10 -0
- package/lib/loaders/productLoaderBySKU.d.ts.map +1 -0
- package/lib/loaders/productLoaderBySKU.js +16 -0
- package/lib/loaders/productLoaderBySKU.js.map +1 -0
- package/lib/loaders/productMediaTextLoader.d.ts +12 -0
- package/lib/loaders/productMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/productMediaTextLoader.js +20 -0
- package/lib/loaders/productMediaTextLoader.js.map +1 -0
- package/lib/loaders/productMediasLoader.d.ts +10 -0
- package/lib/loaders/productMediasLoader.d.ts.map +1 -0
- package/lib/loaders/productMediasLoader.js +18 -0
- package/lib/loaders/productMediasLoader.js.map +1 -0
- package/lib/loaders/productTextLoader.d.ts +12 -0
- package/lib/loaders/productTextLoader.d.ts.map +1 -0
- package/lib/loaders/productTextLoader.js +20 -0
- package/lib/loaders/productTextLoader.js.map +1 -0
- package/lib/loaders/userLoader copy.d.ts +10 -0
- package/lib/loaders/userLoader copy.d.ts.map +1 -0
- package/lib/loaders/userLoader copy.js +13 -0
- package/lib/loaders/userLoader copy.js.map +1 -0
- package/lib/loaders/userLoader.d.ts +10 -0
- package/lib/loaders/userLoader.d.ts.map +1 -0
- package/lib/loaders/userLoader.js +13 -0
- package/lib/loaders/userLoader.js.map +1 -0
- package/lib/loaders/utils.d.ts +7 -0
- package/lib/loaders/utils.d.ts.map +1 -0
- package/lib/loaders/utils.js +30 -0
- package/lib/loaders/utils.js.map +1 -0
- package/lib/resolvers/type/assortment/assortment-types.d.ts +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
- package/lib/resolvers/type/bookmark-types.d.ts.map +1 -1
- package/lib/resolvers/type/bookmark-types.js +1 -0
- package/lib/resolvers/type/bookmark-types.js.map +1 -1
- package/lib/resolvers/type/country-types.d.ts.map +1 -1
- package/lib/resolvers/type/country-types.js +1 -0
- package/lib/resolvers/type/country-types.js.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.js +1 -0
- package/lib/resolvers/type/delivery-provider-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js +1 -0
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js +1 -0
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.js +1 -0
- package/lib/resolvers/type/enrollment/enrollment-period-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.js +3 -0
- package/lib/resolvers/type/enrollment/enrollment-types.js.map +1 -1
- package/lib/resolvers/type/index.d.ts +1 -1
- package/lib/resolvers/type/index.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.js +1 -0
- package/lib/resolvers/type/order/order-delivery-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +3 -0
- package/lib/resolvers/type/order/order-delivery-pickup-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.js +2 -0
- package/lib/resolvers/type/order/order-delivery-shipping-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.js +1 -0
- package/lib/resolvers/type/order/order-delivery-types.js.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.js +3 -0
- package/lib/resolvers/type/order/order-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.js +1 -0
- package/lib/resolvers/type/order/order-global-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.js +1 -0
- package/lib/resolvers/type/order/order-item-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-types.js +8 -0
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.js +2 -0
- package/lib/resolvers/type/order/order-payment-card-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js +3 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.js +2 -0
- package/lib/resolvers/type/order/order-payment-generic-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.js +2 -0
- package/lib/resolvers/type/order/order-payment-invoice-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.js +1 -0
- package/lib/resolvers/type/order/order-payment-types.js.map +1 -1
- package/lib/resolvers/type/order/order-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-types.js +8 -0
- package/lib/resolvers/type/order/order-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.js +3 -0
- package/lib/resolvers/type/payment/payment-credentials-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.js +1 -0
- package/lib/resolvers/type/payment/payment-provider-types.js.map +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.js +2 -0
- package/lib/resolvers/type/product/product-catalog-price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +1 -0
- package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-review-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-review-types.js +1 -0
- package/lib/resolvers/type/product/product-review-types.js.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.js +2 -0
- package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.js +2 -0
- package/lib/resolvers/type/product/product-tokenized-types.js.map +1 -1
- package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-types.js +2 -0
- package/lib/resolvers/type/product/product-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.js +2 -0
- package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-option-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-option-types.js +1 -0
- package/lib/resolvers/type/product/product-variation-option-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.js +1 -0
- package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
- package/lib/resolvers/type/product-search-result-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.js +3 -0
- package/lib/resolvers/type/quotation-types.js.map +1 -1
- package/lib/resolvers/type/shop-types.d.ts.map +1 -1
- package/lib/resolvers/type/shop-types.js +2 -0
- package/lib/resolvers/type/shop-types.js.map +1 -1
- package/lib/resolvers/type/token-types.d.ts.map +1 -1
- package/lib/resolvers/type/token-types.js +7 -0
- package/lib/resolvers/type/token-types.js.map +1 -1
- package/lib/resolvers/type/user-types.d.ts.map +1 -1
- package/lib/resolvers/type/user-types.js +9 -0
- package/lib/resolvers/type/user-types.js.map +1 -1
- package/lib/resolvers/type/work-types.d.ts.map +1 -1
- package/lib/resolvers/type/work-types.js +1 -0
- package/lib/resolvers/type/work-types.js.map +1 -1
- package/package.json +1 -1
- package/src/loaders/buildTextMap.ts +19 -0
- package/src/loaders/index.ts +6 -40
- package/src/resolvers/type/assortment/assortment-types.ts +1 -1
- package/src/resolvers/type/bookmark-types.ts +1 -0
- package/src/resolvers/type/country-types.ts +1 -0
- package/src/resolvers/type/delivery-provider-types.ts +2 -0
- package/src/resolvers/type/enrollment/enrollment-delivery-types.ts +1 -0
- package/src/resolvers/type/enrollment/enrollment-payment-types.ts +1 -0
- package/src/resolvers/type/enrollment/enrollment-period-types.ts +1 -0
- package/src/resolvers/type/enrollment/enrollment-types.ts +3 -0
- package/src/resolvers/type/order/order-delivery-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-delivery-pickup-types.ts +3 -0
- package/src/resolvers/type/order/order-delivery-shipping-types.ts +2 -0
- package/src/resolvers/type/order/order-delivery-types.ts +1 -0
- package/src/resolvers/type/order/order-discount-types.ts +3 -0
- package/src/resolvers/type/order/order-global-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-item-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-item-types.ts +9 -0
- package/src/resolvers/type/order/order-payment-card-types.ts +3 -0
- package/src/resolvers/type/order/order-payment-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-payment-generic-types.ts +2 -0
- package/src/resolvers/type/order/order-payment-invoice-types.ts +2 -0
- package/src/resolvers/type/order/order-payment-types.ts +1 -0
- package/src/resolvers/type/order/order-types.ts +8 -0
- package/src/resolvers/type/payment/payment-credentials-types.ts +3 -0
- package/src/resolvers/type/payment/payment-provider-types.ts +2 -0
- package/src/resolvers/type/product/product-catalog-price-types.ts +2 -0
- package/src/resolvers/type/product/product-configurable-types.ts +1 -0
- package/src/resolvers/type/product/product-review-types.ts +1 -0
- package/src/resolvers/type/product/product-simple-types.ts +2 -0
- package/src/resolvers/type/product/product-tokenized-types.ts +2 -0
- package/src/resolvers/type/product/product-types.ts +2 -0
- package/src/resolvers/type/product/product-variation-assignment-vector.ts +2 -0
- package/src/resolvers/type/product/product-variation-option-types.ts +1 -0
- package/src/resolvers/type/product/product-variation-types.ts +1 -0
- package/src/resolvers/type/quotation-types.ts +3 -0
- package/src/resolvers/type/shop-types.ts +2 -0
- package/src/resolvers/type/token-types.ts +7 -0
- package/src/resolvers/type/user-types.ts +18 -0
- package/src/resolvers/type/work-types.ts +2 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentLink } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
parentAssortmentId: string;
|
|
6
|
+
childAssortmentId: string;
|
|
7
|
+
}, AssortmentLink, {
|
|
8
|
+
parentAssortmentId: string;
|
|
9
|
+
childAssortmentId: string;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=assortmentLinkLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentLinkLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentLinkLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;wBACJ,MAAM;uBAAqB,MAAM;;wBAAjC,MAAM;uBAAqB,MAAM;;AADxE,wBA2BI"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const parentAssortmentIds = [...new Set(queries.map((q) => q.parentAssortmentId).filter(Boolean))];
|
|
4
|
+
const links = await unchainedAPI.modules.assortments.links.findLinks({
|
|
5
|
+
parentAssortmentIds,
|
|
6
|
+
});
|
|
7
|
+
const assortmentLinkMap = {};
|
|
8
|
+
for (const link of links) {
|
|
9
|
+
if (!assortmentLinkMap[link.parentAssortmentId]) {
|
|
10
|
+
assortmentLinkMap[link.parentAssortmentId] = [link];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
assortmentLinkMap[link.parentAssortmentId].push(link);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return queries.map((q) => {
|
|
17
|
+
if (q.childAssortmentId) {
|
|
18
|
+
return assortmentLinkMap[q.parentAssortmentId].find((link) => link.childAssortmentId === q.childAssortmentId);
|
|
19
|
+
}
|
|
20
|
+
return assortmentLinkMap[q.parentAssortmentId][0];
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=assortmentLinkLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentLinkLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentLinkLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CACZ,KAAK,EAAE,OAAO,EAAE,EAAE;IAChB,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEnG,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;QACnE,mBAAmB;KACpB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAChD,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;YACxB,OAAO,iBAAiB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,IAAI,CACjD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,CAAC,iBAAiB,CACzD,CAAC;QACJ,CAAC;QACD,OAAO,iBAAiB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentLink } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
parentAssortmentId?: string;
|
|
6
|
+
childAssortmentId?: string;
|
|
7
|
+
assortmentId?: string;
|
|
8
|
+
}, AssortmentLink[], {
|
|
9
|
+
parentAssortmentId?: string;
|
|
10
|
+
childAssortmentId?: string;
|
|
11
|
+
assortmentId?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=assortmentLinksLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentLinksLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentLinksLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;yBAEhB,MAAM;wBAAsB,MAAM;mBAAiB,MAAM;;yBAAzD,MAAM;wBAAsB,MAAM;mBAAiB,MAAM;;AAFpF,wBAyCK"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const parentAssortmentIds = queries.flatMap((q) => q.parentAssortmentId).filter(Boolean);
|
|
4
|
+
const childAssortmentIds = queries.flatMap((q) => q.childAssortmentId).filter(Boolean);
|
|
5
|
+
const assortmentIds = queries.flatMap((q) => q.assortmentId).filter(Boolean);
|
|
6
|
+
const allLinks = await unchainedAPI.modules.assortments.links.findLinks({
|
|
7
|
+
assortmentIds: [...new Set([...parentAssortmentIds, ...childAssortmentIds, ...assortmentIds])],
|
|
8
|
+
});
|
|
9
|
+
const parentAssortmentLinkMap = {};
|
|
10
|
+
const childAssortmentLinkMap = {};
|
|
11
|
+
for (const link of allLinks) {
|
|
12
|
+
if (!parentAssortmentLinkMap[link.parentAssortmentId]) {
|
|
13
|
+
parentAssortmentLinkMap[link.parentAssortmentId] = [link];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
parentAssortmentLinkMap[link.parentAssortmentId].push(link);
|
|
17
|
+
}
|
|
18
|
+
if (!childAssortmentLinkMap[link.childAssortmentId]) {
|
|
19
|
+
childAssortmentLinkMap[link.childAssortmentId] = [link];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
childAssortmentLinkMap[link.childAssortmentId].push(link);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return queries.map((q) => {
|
|
26
|
+
if (q.parentAssortmentId) {
|
|
27
|
+
return parentAssortmentLinkMap[q.parentAssortmentId] || [];
|
|
28
|
+
}
|
|
29
|
+
else if (q.childAssortmentId) {
|
|
30
|
+
return childAssortmentLinkMap[q.childAssortmentId] || [];
|
|
31
|
+
}
|
|
32
|
+
return [
|
|
33
|
+
...(parentAssortmentLinkMap[q.assortmentId] || []),
|
|
34
|
+
...(childAssortmentLinkMap[q.assortmentId] || []),
|
|
35
|
+
];
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=assortmentLinksLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentLinksLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentLinksLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAGZ,KAAK,EAAE,OAAO,EAAE,EAAE;IAClB,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzF,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvF,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE7E,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;QACtE,aAAa,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,mBAAmB,EAAE,GAAG,kBAAkB,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC;KAC/F,CAAC,CAAC;IAEH,MAAM,uBAAuB,GAAG,EAAE,CAAC;IACnC,MAAM,sBAAsB,GAAG,EAAE,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACtD,uBAAuB,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACN,uBAAuB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACpD,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;YACzB,OAAO,uBAAuB,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC7D,CAAC;aAAM,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;YAC/B,OAAO,sBAAsB,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAC3D,CAAC;QACD,OAAO;YACL,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;YAClD,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;SAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Assortment } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
assortmentId: string;
|
|
6
|
+
}, Assortment, {
|
|
7
|
+
assortmentId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=assortmentLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;kBACV,MAAM;;kBAAN,MAAM;;AADvC,wBAeK"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
4
|
+
const assortments = await unchainedAPI.modules.assortments.findAssortments({
|
|
5
|
+
assortmentIds,
|
|
6
|
+
includeInactive: true,
|
|
7
|
+
includeLeaves: true,
|
|
8
|
+
});
|
|
9
|
+
const assortmentMap = {};
|
|
10
|
+
for (const assortment of assortments) {
|
|
11
|
+
assortmentMap[assortment._id] = assortment;
|
|
12
|
+
}
|
|
13
|
+
return queries.map((q) => assortmentMap[q.assortmentId]);
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=assortmentLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAuC,KAAK,EAAE,OAAO,EAAE,EAAE;IACrE,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvF,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC;QACzE,aAAa;QACb,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;IAC7C,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentMediaText } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
assortmentMediaId: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
}, AssortmentMediaText, {
|
|
8
|
+
assortmentMediaId: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=assortmentMediaTextLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentMediaTextLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentMediaTextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAGpB,cAAc,aAAa;uBACL,MAAM;YAAU,MAAM;;uBAAtB,MAAM;YAAU,MAAM;;AAD5D,wBAuBK"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
import { buildLocaleMap } from './utils.js';
|
|
3
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
4
|
+
const assortmentMediaIds = [...new Set(queries.map((q) => q.assortmentMediaId).filter(Boolean))];
|
|
5
|
+
const texts = await unchainedAPI.modules.assortments.media.texts.findMediaTexts({ assortmentMediaId: { $in: assortmentMediaIds } }, {
|
|
6
|
+
sort: {
|
|
7
|
+
assortmentMediaId: 1,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
const localeMap = buildLocaleMap(queries, texts);
|
|
11
|
+
const textsMap = {};
|
|
12
|
+
for (const text of texts) {
|
|
13
|
+
const localesForText = localeMap[text.locale] || [];
|
|
14
|
+
for (const locale of localesForText) {
|
|
15
|
+
textsMap[locale + text.assortmentMediaId] = text;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return queries.map((q) => textsMap[q.locale + q.assortmentMediaId]);
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=assortmentMediaTextLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentMediaTextLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentMediaTextLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAqE,KAAK,EAAE,OAAO,EAAE,EAAE;IACnG,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEjG,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAC7E,EAAE,iBAAiB,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,EAAE,EAClD;QACE,IAAI,EAAE;YACJ,iBAAiB,EAAE,CAAC;SACrB;KACF,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACpD,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;YACpC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;QACnD,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentMediaType } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
assortmentId?: string;
|
|
6
|
+
}, AssortmentMediaType[], {
|
|
7
|
+
assortmentId?: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=assortmentMediasLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentMediasLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentMediasLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;mBACT,MAAM;;mBAAN,MAAM;;AADxC,wBAgBK"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
4
|
+
const assortmentMediaItems = await unchainedAPI.modules.assortments.media.findAssortmentMedias({
|
|
5
|
+
assortmentId: { $in: assortmentIds },
|
|
6
|
+
});
|
|
7
|
+
const assortmentMediaMap = {};
|
|
8
|
+
for (const assortmentMedia of assortmentMediaItems) {
|
|
9
|
+
if (!assortmentMediaMap[assortmentMedia.assortmentId]) {
|
|
10
|
+
assortmentMediaMap[assortmentMedia.assortmentId] = [assortmentMedia];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
assortmentMediaMap[assortmentMedia.assortmentId].push(assortmentMedia);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return queries.map((q) => assortmentMediaMap[q.assortmentId] || []);
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=assortmentMediasLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentMediasLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentMediasLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAmD,KAAK,EAAE,OAAO,EAAE,EAAE;IACjF,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACvF,MAAM,oBAAoB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC;QAC7F,YAAY,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE;KACrC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,EAAE,CAAC;IAC9B,KAAK,MAAM,eAAe,IAAI,oBAAoB,EAAE,CAAC;QACnD,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;YACtD,kBAAkB,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACN,kBAAkB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentProduct } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
assortmentId: string;
|
|
6
|
+
productId: string;
|
|
7
|
+
}, AssortmentProduct, {
|
|
8
|
+
assortmentId: string;
|
|
9
|
+
productId: string;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=assortmentProductLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentProductLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentProductLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;kBACV,MAAM;eAAa,MAAM;;kBAAzB,MAAM;eAAa,MAAM;;AAD1D,wBAcK"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
4
|
+
const assortmentProducts = await unchainedAPI.modules.assortments.products.findAssortmentProducts({
|
|
5
|
+
assortmentIds,
|
|
6
|
+
});
|
|
7
|
+
const assortmentProductMap = {};
|
|
8
|
+
for (const assortmentProduct of assortmentProducts) {
|
|
9
|
+
assortmentProductMap[assortmentProduct.assortmentId + assortmentProduct.productId] =
|
|
10
|
+
assortmentProduct;
|
|
11
|
+
}
|
|
12
|
+
return queries.map((q) => assortmentProductMap[q.assortmentId + q.productId]);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=assortmentProductLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentProductLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentProductLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAiE,KAAK,EAAE,OAAO,EAAE,EAAE;IAC/F,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvF,MAAM,kBAAkB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAChG,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,oBAAoB,GAAG,EAAE,CAAC;IAChC,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE,CAAC;QACnD,oBAAoB,CAAC,iBAAiB,CAAC,YAAY,GAAG,iBAAiB,CAAC,SAAS,CAAC;YAChF,iBAAiB,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentProduct } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
productId: string;
|
|
6
|
+
}, AssortmentProduct[], {
|
|
7
|
+
productId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=assortmentProductsLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentProductsLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentProductsLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;eACb,MAAM;;eAAN,MAAM;;AADpC,wBAiBK"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
4
|
+
const assortmentProducts = await unchainedAPI.modules.assortments.products.findAssortmentProducts({
|
|
5
|
+
productIds,
|
|
6
|
+
});
|
|
7
|
+
const assortmentProductsMap = {};
|
|
8
|
+
for (const assortmentProduct of assortmentProducts) {
|
|
9
|
+
if (!assortmentProductsMap[assortmentProduct.productId]) {
|
|
10
|
+
assortmentProductsMap[assortmentProduct.productId] = [assortmentProduct];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
assortmentProductsMap[assortmentProduct.productId].push(assortmentProduct);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return queries.map((q) => assortmentProductsMap[q.productId] || []);
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=assortmentProductsLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentProductsLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentProductsLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA6C,KAAK,EAAE,OAAO,EAAE,EAAE;IAC3E,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEjF,MAAM,kBAAkB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAChG,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,qBAAqB,GAAG,EAAE,CAAC;IACjC,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE,CAAC;QACnD,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,qBAAqB,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3E,CAAC;aAAM,CAAC;YACN,qBAAqB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentText } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
assortmentId: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
}, AssortmentText, {
|
|
8
|
+
assortmentId: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=assortmentTextLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentTextLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/assortmentTextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,UAAU,MAAM,YAAY,CAAC;yBAGpB,cAAc,aAAa;kBACV,MAAM;YAAU,MAAM;;kBAAtB,MAAM;YAAU,MAAM;;AADvD,wBAuBK"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
import { buildLocaleMap } from './utils.js';
|
|
3
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
4
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
5
|
+
const texts = await unchainedAPI.modules.assortments.texts.findTexts({ assortmentId: { $in: assortmentIds } }, {
|
|
6
|
+
sort: {
|
|
7
|
+
assortmentId: 1,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
const localeMap = buildLocaleMap(queries, texts);
|
|
11
|
+
const textsMap = {};
|
|
12
|
+
for (const text of texts) {
|
|
13
|
+
const localesForText = localeMap[text.locale] || [];
|
|
14
|
+
for (const locale of localesForText) {
|
|
15
|
+
textsMap[locale + text.assortmentId] = text;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return queries.map((q) => textsMap[q.locale + q.assortmentId]);
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=assortmentTextLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assortmentTextLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentTextLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA2D,KAAK,EAAE,OAAO,EAAE,EAAE;IACzF,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvF,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAClE,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EACxC;QACE,IAAI,EAAE;YACJ,YAAY,EAAE,CAAC;SAChB;KACF,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACpD,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;YACpC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type ArrayElement<T> = T extends (infer U)[] ? U : never;
|
|
2
|
+
export default function buildTextMap<T extends Array<{
|
|
3
|
+
locale?: string;
|
|
4
|
+
}>>(localeMap: Record<string, string[]>, texts: Readonly<T>, buildId: (item: ArrayElement<T>) => string): {};
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=buildTextMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTextMap.d.ts","sourceRoot":"","sources":["../../src/loaders/buildTextMap.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACvE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACnC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,MAa3C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function buildTextMap(localeMap, texts, buildId) {
|
|
2
|
+
const textsMap = {};
|
|
3
|
+
for (const [originLocale, localesForText] of Object.entries(localeMap)) {
|
|
4
|
+
for (const text of texts) {
|
|
5
|
+
if (originLocale !== text.locale)
|
|
6
|
+
continue;
|
|
7
|
+
for (const locale of localesForText) {
|
|
8
|
+
if (textsMap[locale + buildId(text)])
|
|
9
|
+
continue;
|
|
10
|
+
textsMap[locale + buildId(text)] = text;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return textsMap;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=buildTextMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTextMap.js","sourceRoot":"","sources":["../../src/loaders/buildTextMap.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAmC,EACnC,KAAkB,EAClB,OAA0C;IAE1C,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACvE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,YAAY,KAAK,IAAI,CAAC,MAAM;gBAAE,SAAS;YAC3C,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;gBACpC,IAAI,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,IAAW,CAAC,CAAC;oBAAE,SAAS;gBACtD,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,IAAW,CAAC,CAAC,GAAG,IAAI,CAAC;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Country } from '@unchainedshop/core-countries';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
isoCode: string;
|
|
6
|
+
}, Country, {
|
|
7
|
+
isoCode: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=countryLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/countryLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;aACf,MAAM;;aAAN,MAAM;;AADlC,wBAeK"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const isoCodes = [...new Set(queries.map((q) => q.isoCode).filter(Boolean))]; // you don't need lodash, _.unique my ass
|
|
4
|
+
const countries = await unchainedAPI.modules.countries.findCountries({
|
|
5
|
+
isoCode: { $in: isoCodes },
|
|
6
|
+
includeInactive: true,
|
|
7
|
+
});
|
|
8
|
+
const countryMap = {};
|
|
9
|
+
for (const country of countries) {
|
|
10
|
+
countryMap[country.isoCode] = country;
|
|
11
|
+
}
|
|
12
|
+
return queries.map((q) => countryMap[q.isoCode]);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=countryLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryLoader.js","sourceRoot":"","sources":["../../src/loaders/countryLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA+B,KAAK,EAAE,OAAO,EAAE,EAAE;IAC7D,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;IAEvH,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;QACnE,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;QAC1B,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;QAChC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxC,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Currency } from '@unchainedshop/core-currencies';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
isoCode: string;
|
|
6
|
+
}, Currency, {
|
|
7
|
+
isoCode: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=currencyLoader%20copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyLoader copy.d.ts","sourceRoot":"","sources":["../../src/loaders/currencyLoader copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;aACf,MAAM;;aAAN,MAAM;;AADlC,wBAeK"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const isoCodes = [...new Set(queries.map((q) => q.isoCode).filter(Boolean))]; // you don't need lodash, _.unique my ass
|
|
4
|
+
const currencies = await unchainedAPI.modules.currencies.findCurrencies({
|
|
5
|
+
isoCode: { $in: isoCodes },
|
|
6
|
+
includeInactive: true,
|
|
7
|
+
});
|
|
8
|
+
const currencyMap = {};
|
|
9
|
+
for (const currency of currencies) {
|
|
10
|
+
currencyMap[currency._id] = currency;
|
|
11
|
+
}
|
|
12
|
+
return queries.map((q) => currencyMap[q.isoCode]);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=currencyLoader%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyLoader copy.js","sourceRoot":"","sources":["../../src/loaders/currencyLoader copy.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAgC,KAAK,EAAE,OAAO,EAAE,EAAE;IAC9D,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;IAEvH,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;QACtE,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;QAC1B,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACvC,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Currency } from '@unchainedshop/core-currencies';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
isoCode: string;
|
|
6
|
+
}, Currency, {
|
|
7
|
+
isoCode: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=currencyLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/currencyLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;aACf,MAAM;;aAAN,MAAM;;AADlC,wBAeK"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const isoCodes = [...new Set(queries.map((q) => q.isoCode).filter(Boolean))]; // you don't need lodash, _.unique my ass
|
|
4
|
+
const currencies = await unchainedAPI.modules.currencies.findCurrencies({
|
|
5
|
+
isoCode: { $in: isoCodes },
|
|
6
|
+
includeInactive: true,
|
|
7
|
+
});
|
|
8
|
+
const currencyMap = {};
|
|
9
|
+
for (const currency of currencies) {
|
|
10
|
+
currencyMap[currency.isoCode] = currency;
|
|
11
|
+
}
|
|
12
|
+
return queries.map((q) => currencyMap[q.isoCode]);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=currencyLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyLoader.js","sourceRoot":"","sources":["../../src/loaders/currencyLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAgC,KAAK,EAAE,OAAO,EAAE,EAAE;IAC9D,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;IAEvH,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;QACtE,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;QAC1B,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;IAC3C,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { User } from '@unchainedshop/core-users';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
currencyId: string;
|
|
6
|
+
}, User, {
|
|
7
|
+
currencyId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=currencyLoaderByIsoCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyLoaderByIsoCode.d.ts","sourceRoot":"","sources":["../../src/loaders/currencyLoaderByIsoCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;gBACZ,MAAM;;gBAAN,MAAM;;AADrC,wBAcK"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const currencyIds = [...new Set(queries.map((q) => q.currencyId).filter(Boolean))]; // you don't need lodash, _.unique my ass
|
|
4
|
+
const users = await unchainedAPI.modules.users.findUsers({
|
|
5
|
+
_id: { $in: currencyIds },
|
|
6
|
+
});
|
|
7
|
+
const userMap = {};
|
|
8
|
+
for (const user of users) {
|
|
9
|
+
userMap[user._id] = user;
|
|
10
|
+
}
|
|
11
|
+
return queries.map((q) => userMap[q.currencyId]);
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=currencyLoaderByIsoCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyLoaderByIsoCode.js","sourceRoot":"","sources":["../../src/loaders/currencyLoaderByIsoCode.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA+B,KAAK,EAAE,OAAO,EAAE,EAAE;IAC7D,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;IAE7H,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QACvD,GAAG,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE;KAC1B,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { File } from '@unchainedshop/core-files';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
fileId: string;
|
|
6
|
+
}, File, {
|
|
7
|
+
fileId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=fileLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/fileLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;YAChB,MAAM;;YAAN,MAAM;;AADjC,wBAcK"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const fileIds = [...new Set(queries.map((q) => q.fileId).filter(Boolean))]; // you don't need lodash, _.unique my ass
|
|
4
|
+
const files = await unchainedAPI.modules.files.findFiles({
|
|
5
|
+
_id: { $in: fileIds },
|
|
6
|
+
});
|
|
7
|
+
const fileMap = {};
|
|
8
|
+
for (const file of files) {
|
|
9
|
+
fileMap[file._id] = file;
|
|
10
|
+
}
|
|
11
|
+
return queries.map((q) => fileMap[q.fileId]);
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=fileLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileLoader.js","sourceRoot":"","sources":["../../src/loaders/fileLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA2B,KAAK,EAAE,OAAO,EAAE,EAAE;IACzD,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;IAErH,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QACvD,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;KACtB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Filter } from '@unchainedshop/core-filters';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
declare const _default: (unchainedAPI: UnchainedCore) => DataLoader<{
|
|
5
|
+
filterId: string;
|
|
6
|
+
}, Filter, {
|
|
7
|
+
filterId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=filterLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/filterLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,UAAU,MAAM,YAAY,CAAC;yBAEpB,cAAc,aAAa;cACd,MAAM;;cAAN,MAAM;;AADnC,wBAeK"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
3
|
+
const filterIds = [...new Set(queries.map((q) => q.filterId).filter(Boolean))];
|
|
4
|
+
const filters = await unchainedAPI.modules.filters.findFilters({
|
|
5
|
+
filterIds,
|
|
6
|
+
includeInactive: true,
|
|
7
|
+
});
|
|
8
|
+
const filterMap = {};
|
|
9
|
+
for (const filter of filters) {
|
|
10
|
+
filterMap[filter._id] = filter;
|
|
11
|
+
}
|
|
12
|
+
return queries.map((q) => filterMap[q.filterId]);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=filterLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterLoader.js","sourceRoot":"","sources":["../../src/loaders/filterLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA+B,KAAK,EAAE,OAAO,EAAE,EAAE;IAC7D,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE/E,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7D,SAAS;QACT,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACjC,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
|