@unchainedshop/api 1.2.43 → 1.2.45
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/api-index.js +1 -1
- package/lib/api-index.js.map +1 -1
- package/lib/loaders/index.js +49 -0
- package/lib/loaders/index.js.map +1 -1
- package/lib/resolvers/queries/products/productCatalogPrices.d.ts +1 -1
- package/lib/resolvers/queries/products/productCatalogPrices.js +5 -2
- package/lib/resolvers/queries/products/productCatalogPrices.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.js +13 -6
- package/lib/resolvers/type/assortment/assortment-filter-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-link-types.js +14 -6
- package/lib/resolvers/type/assortment/assortment-link-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-product-types.js +14 -6
- package/lib/resolvers/type/assortment/assortment-product-types.js.map +1 -1
- package/lib/resolvers/type/bookmark-types.js +6 -2
- package/lib/resolvers/type/bookmark-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js +6 -2
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js.map +1 -1
- package/lib/resolvers/type/order/order-item-types.js +13 -6
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/product/product-bundle-item-types.js +4 -2
- package/lib/resolvers/type/product/product-bundle-item-types.js.map +1 -1
- package/lib/resolvers/type/product/product-review-types.js +6 -2
- package/lib/resolvers/type/product/product-review-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js +4 -2
- package/lib/resolvers/type/product/product-variation-assignment-types.js.map +1 -1
- package/lib/resolvers/type/quotation-types.js +7 -3
- package/lib/resolvers/type/quotation-types.js.map +1 -1
- package/package.json +9 -9
- package/src/api-index.ts +1 -1
- package/src/loaders/index.ts +62 -3
- package/src/resolvers/queries/products/productCatalogPrices.ts +5 -2
- package/src/resolvers/type/assortment/assortment-filter-types.ts +11 -6
- package/src/resolvers/type/assortment/assortment-link-types.ts +12 -6
- package/src/resolvers/type/assortment/assortment-product-types.ts +12 -6
- package/src/resolvers/type/bookmark-types.ts +7 -2
- package/src/resolvers/type/enrollment/enrollment-plan-tyes.ts +6 -2
- package/src/resolvers/type/order/order-item-types.ts +13 -6
- package/src/resolvers/type/product/product-bundle-item-types.ts +4 -2
- package/src/resolvers/type/product/product-review-types.ts +6 -2
- package/src/resolvers/type/product/product-variation-assignment-types.ts +4 -2
- package/src/resolvers/type/quotation-types.ts +6 -3
package/lib/api-index.js
CHANGED
|
@@ -7,7 +7,7 @@ export * as errors from './errors';
|
|
|
7
7
|
export { hashPassword } from './hashPassword';
|
|
8
8
|
export * as roles from './roles';
|
|
9
9
|
export { createContextResolver, getCurrentContextResolver, setCurrentContextResolver };
|
|
10
|
-
const UNCHAINED_API_VERSION = '1.2.
|
|
10
|
+
const UNCHAINED_API_VERSION = '1.2.44'; // eslint-disable-line
|
|
11
11
|
export const startAPIServer = (options) => {
|
|
12
12
|
const { unchainedAPI, roles, expressApp, context: customContext, ...apolloServerOptions } = options || {};
|
|
13
13
|
const contextResolver = createContextResolver(unchainedAPI, roles, UNCHAINED_API_VERSION);
|
package/lib/api-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-index.js","sourceRoot":"","sources":["../src/api-index.ts"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAExG,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO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,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAE5D,OAAO;QACL,mBAAmB;QACnB,gBAAgB;KACjB,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/loaders/index.js
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import DataLoader from 'dataloader';
|
|
2
2
|
import { systemLocale } from '@unchainedshop/utils';
|
|
3
3
|
import localePkg from 'locale';
|
|
4
|
+
import { ProductStatus } from '@unchainedshop/core-products';
|
|
4
5
|
const { Locale } = localePkg;
|
|
5
6
|
export default async (req, unchainedAPI) => {
|
|
6
7
|
return {
|
|
8
|
+
assortmentLoader: new DataLoader(async (queries) => {
|
|
9
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
10
|
+
const assortments = await unchainedAPI.modules.assortments.findAssortments({
|
|
11
|
+
assortmentIds,
|
|
12
|
+
includeInactive: true,
|
|
13
|
+
includeLeaves: true,
|
|
14
|
+
});
|
|
15
|
+
return queries.map(({ assortmentId, includeInactive }) => {
|
|
16
|
+
return assortments.find((assortment) => {
|
|
17
|
+
if (assortment._id !== assortmentId)
|
|
18
|
+
return false;
|
|
19
|
+
if (!includeInactive) {
|
|
20
|
+
return assortment.isActive === true;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}),
|
|
7
26
|
assortmentTextLoader: new DataLoader(async (queries) => {
|
|
8
27
|
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
9
28
|
const texts = await unchainedAPI.modules.assortments.texts.findTexts({ assortmentId: { $in: assortmentIds } }, {
|
|
@@ -26,6 +45,19 @@ export default async (req, unchainedAPI) => {
|
|
|
26
45
|
return assortmentText || assortmentTexts[0];
|
|
27
46
|
});
|
|
28
47
|
}),
|
|
48
|
+
filterLoader: new DataLoader(async (queries) => {
|
|
49
|
+
const filterIds = [...new Set(queries.map((q) => q.filterId).filter(Boolean))];
|
|
50
|
+
const filters = await unchainedAPI.modules.filters.findFilters({
|
|
51
|
+
filterIds,
|
|
52
|
+
});
|
|
53
|
+
return queries.map(({ filterId }) => {
|
|
54
|
+
return filters.find((product) => {
|
|
55
|
+
if (product._id !== filterId)
|
|
56
|
+
return false;
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}),
|
|
29
61
|
filterTextLoader: new DataLoader(async (queries) => {
|
|
30
62
|
const filterIds = [...new Set(queries.map((q) => q.filterId).filter(Boolean))];
|
|
31
63
|
const texts = await unchainedAPI.modules.filters.texts.findTexts({ filterId: { $in: filterIds } }, {
|
|
@@ -48,6 +80,23 @@ export default async (req, unchainedAPI) => {
|
|
|
48
80
|
return filterText || filterTexts[0];
|
|
49
81
|
});
|
|
50
82
|
}),
|
|
83
|
+
productLoader: new DataLoader(async (queries) => {
|
|
84
|
+
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
85
|
+
const products = await unchainedAPI.modules.products.findProducts({
|
|
86
|
+
productIds,
|
|
87
|
+
includeDrafts: true,
|
|
88
|
+
});
|
|
89
|
+
return queries.map(({ productId, includeDrafts }) => {
|
|
90
|
+
return products.find((product) => {
|
|
91
|
+
if (product._id !== productId)
|
|
92
|
+
return false;
|
|
93
|
+
if (!includeDrafts) {
|
|
94
|
+
return product.status === ProductStatus.ACTIVE;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}),
|
|
51
100
|
productTextLoader: new DataLoader(async (queries) => {
|
|
52
101
|
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
53
102
|
const texts = await unchainedAPI.modules.products.texts.findTexts({ productId: { $in: productIds } }, {
|
package/lib/loaders/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,C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M,SAAS,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;gBAC1E,IAAI,CAAC,YAAY,CAAC,MAAM;oBAAE,OAAO,IAAI,CAAC;gBACtC,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,QAAQ,EAAE,GAAG,mBAAmB,CAAC,CAAC;gBAEzF,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAc,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE;oBAC1E,IAAI,GAAG;wBAAE,OAAO,GAAG,CAAC;oBACpB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,YAAY,CAAC,CAAC;gBAC7D,CAAC,EAAE,IAAI,CAAC,CAAC;gBACT,OAAO,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACL,CAAC,CACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Context, Root } from '@unchainedshop/types/api';
|
|
2
2
|
export default function productCatalogPrices(root: Root, { productId }: {
|
|
3
3
|
productId: string;
|
|
4
|
-
}, { modules, userId }: Context): Promise<import("@unchainedshop/types/products").ProductPrice[]>;
|
|
4
|
+
}, { modules, loaders, userId }: Context): Promise<import("@unchainedshop/types/products").ProductPrice[]>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { InvalidIdError } from '../../../errors';
|
|
3
|
-
export default async function productCatalogPrices(root, { productId }, { modules, userId }) {
|
|
3
|
+
export default async function productCatalogPrices(root, { productId }, { modules, loaders, userId }) {
|
|
4
4
|
log(`query productCatalogPrices ${productId}`, { userId });
|
|
5
5
|
if (!productId)
|
|
6
6
|
throw new InvalidIdError({ productId });
|
|
7
|
-
const product = await
|
|
7
|
+
const product = await loaders.productLoader.load({
|
|
8
|
+
productId,
|
|
9
|
+
includeDrafts: true,
|
|
10
|
+
});
|
|
8
11
|
if (!product)
|
|
9
12
|
return null;
|
|
10
13
|
return modules.products.prices.catalogPrices(product);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productCatalogPrices.js","sourceRoot":"","sources":["../../../../src/resolvers/queries/products/productCatalogPrices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,oBAAoB,CAChD,IAAU,EACV,EAAE,SAAS,EAAyB,EACpC,EAAE,OAAO,EAAE,MAAM,EAAW;
|
|
1
|
+
{"version":3,"file":"productCatalogPrices.js","sourceRoot":"","sources":["../../../../src/resolvers/queries/products/productCatalogPrices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,oBAAoB,CAChD,IAAU,EACV,EAAE,SAAS,EAAyB,EACpC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAW;IAErC,GAAG,CAAC,8BAA8B,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAE3D,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,cAAc,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;QAC/C,SAAS;QACT,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IACH,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export const AssortmentFilter = {
|
|
2
|
-
assortment: (obj, _, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
assortment: async (obj, _, { loaders }) => {
|
|
3
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
4
|
+
assortmentId: obj.assortmentId,
|
|
5
|
+
includeInactive: true,
|
|
6
|
+
});
|
|
7
|
+
return assortment;
|
|
8
|
+
},
|
|
9
|
+
filter: async (obj, _, { loaders }) => {
|
|
10
|
+
const filter = await loaders.filterLoader.load({
|
|
11
|
+
filterId: obj.filterId,
|
|
12
|
+
});
|
|
13
|
+
return filter;
|
|
14
|
+
},
|
|
8
15
|
};
|
|
9
16
|
//# sourceMappingURL=assortment-filter-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assortment-filter-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/assortment/assortment-filter-types.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,gBAAgB,GAAgC;IAC3D,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"assortment-filter-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/assortment/assortment-filter-types.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,gBAAgB,GAAgC;IAC3D,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACrD,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC;YAC7C,QAAQ,EAAE,GAAG,CAAC,QAAQ;SACvB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
export const AssortmentLink = {
|
|
2
|
-
child: (obj, _, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
child: async (obj, _, { loaders }) => {
|
|
3
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
4
|
+
assortmentId: obj.childAssortmentId,
|
|
5
|
+
includeInactive: true,
|
|
6
|
+
});
|
|
7
|
+
return assortment;
|
|
8
|
+
},
|
|
9
|
+
parent: async (obj, _, { loaders }) => {
|
|
10
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
11
|
+
assortmentId: obj.parentAssortmentId,
|
|
12
|
+
includeInactive: true,
|
|
13
|
+
});
|
|
14
|
+
return assortment;
|
|
15
|
+
},
|
|
8
16
|
};
|
|
9
17
|
//# sourceMappingURL=assortment-link-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assortment-link-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/assortment/assortment-link-types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"assortment-link-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/assortment/assortment-link-types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACrD,YAAY,EAAE,GAAG,CAAC,iBAAiB;YACnC,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACrD,YAAY,EAAE,GAAG,CAAC,kBAAkB;YACpC,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
export const AssortmentProduct = {
|
|
2
|
-
assortment: (obj, _, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
assortment: async (obj, _, { loaders }) => {
|
|
3
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
4
|
+
assortmentId: obj.assortmentId,
|
|
5
|
+
includeInactive: true,
|
|
6
|
+
});
|
|
7
|
+
return assortment;
|
|
8
|
+
},
|
|
9
|
+
product: async (obj, _, { loaders }) => {
|
|
10
|
+
const product = await loaders.productLoader.load({
|
|
11
|
+
productId: obj.productId,
|
|
12
|
+
includeDrafts: true,
|
|
13
|
+
});
|
|
14
|
+
return product;
|
|
15
|
+
},
|
|
8
16
|
};
|
|
9
17
|
//# sourceMappingURL=assortment-product-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assortment-product-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/assortment/assortment-product-types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"assortment-product-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/assortment/assortment-product-types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACrD,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export const Bookmark = {
|
|
2
|
-
product: async (obj, _, {
|
|
3
|
-
|
|
2
|
+
product: async (obj, _, { loaders }) => {
|
|
3
|
+
const product = await loaders.productLoader.load({
|
|
4
|
+
productId: obj.productId,
|
|
5
|
+
includeDrafts: true,
|
|
6
|
+
});
|
|
7
|
+
return product;
|
|
4
8
|
},
|
|
5
9
|
user: async (obj, _, { modules }) => {
|
|
6
10
|
return modules.users.findUserById(obj.userId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookmark-types.js","sourceRoot":"","sources":["../../../src/resolvers/type/bookmark-types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,QAAQ,GAAwB;IAC3C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrC,OAAO,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"bookmark-types.js","sourceRoot":"","sources":["../../../src/resolvers/type/bookmark-types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,QAAQ,GAAwB;IAC3C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAClC,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACF,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export const EnrollmentPlan = {
|
|
2
|
-
product: async (plan, _, {
|
|
3
|
-
|
|
2
|
+
product: async (plan, _, { loaders }) => {
|
|
3
|
+
const product = await loaders.productLoader.load({
|
|
4
|
+
productId: plan.productId,
|
|
5
|
+
includeDrafts: true,
|
|
6
|
+
});
|
|
7
|
+
return product;
|
|
4
8
|
},
|
|
5
9
|
};
|
|
6
10
|
//# sourceMappingURL=enrollment-plan-tyes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment-plan-tyes.js","sourceRoot":"","sources":["../../../../src/resolvers/type/enrollment/enrollment-plan-tyes.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,OAAO,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"enrollment-plan-tyes.js","sourceRoot":"","sources":["../../../../src/resolvers/type/enrollment/enrollment-plan-tyes.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
|
|
@@ -19,7 +19,7 @@ export const OrderItem = {
|
|
|
19
19
|
}
|
|
20
20
|
return [];
|
|
21
21
|
},
|
|
22
|
-
dispatches: async (obj, _, { modules }) => {
|
|
22
|
+
dispatches: async (obj, _, { modules, loaders }) => {
|
|
23
23
|
const scheduling = obj.scheduling || [];
|
|
24
24
|
const order = await modules.orders.findOrder({ orderId: obj.orderId });
|
|
25
25
|
const { countryCode, userId } = order;
|
|
@@ -29,8 +29,9 @@ export const OrderItem = {
|
|
|
29
29
|
const deliveryProvider = await modules.delivery.findProvider({
|
|
30
30
|
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
31
31
|
});
|
|
32
|
-
const product = await
|
|
32
|
+
const product = await loaders.productLoader.load({
|
|
33
33
|
productId: obj.productId,
|
|
34
|
+
includeDrafts: true,
|
|
34
35
|
});
|
|
35
36
|
return Promise.all(scheduling.map(async (schedule) => {
|
|
36
37
|
const warehousingProvider = await modules.warehousing.findProvider({
|
|
@@ -54,13 +55,19 @@ export const OrderItem = {
|
|
|
54
55
|
order: async (obj, _, { modules }) => {
|
|
55
56
|
return modules.orders.findOrder({ orderId: obj.orderId });
|
|
56
57
|
},
|
|
57
|
-
originalProduct: async (obj, _, {
|
|
58
|
-
|
|
58
|
+
originalProduct: async (obj, _, { loaders }) => {
|
|
59
|
+
const product = await loaders.productLoader.load({
|
|
59
60
|
productId: obj.originalProductId,
|
|
61
|
+
includeDrafts: true,
|
|
60
62
|
});
|
|
63
|
+
return product;
|
|
61
64
|
},
|
|
62
|
-
product: async (obj, _, {
|
|
63
|
-
|
|
65
|
+
product: async (obj, _, { loaders }) => {
|
|
66
|
+
const product = await loaders.productLoader.load({
|
|
67
|
+
productId: obj.productId,
|
|
68
|
+
includeDrafts: true,
|
|
69
|
+
});
|
|
70
|
+
return product;
|
|
64
71
|
},
|
|
65
72
|
quotation: async (obj, _, { modules }) => {
|
|
66
73
|
if (!obj.quotationId)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-item-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/order/order-item-types.ts"],"names":[],"mappings":"AAQA,OAAO,MAAM,MAAM,QAAQ,CAAC;AA0B5B,MAAM,eAAe,GAAG,KAAK,EAAE,aAA4B,EAAE,OAAgB,EAAE,EAAE;IAC/E,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;QAC3C,OAAO,EAAE,aAAa,CAAC,OAAO;KAC/B,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEnG,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAyB;IAC7C,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEzD,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE;YAC1B,yDAAyD;YACzD,OAAO,YAAY,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBACtD,IAAI,EAAE,GAAG;gBACT,GAAG,QAAQ;aACZ,CAAC,CAAC,CAAC;SACL;QACD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R,UAAU,CAAC,QAAQ,CAAC;qBACpB,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;qBAC7D,MAAM,CAAC,KAAK,CAAC;gBAChB,MAAM;gBACN,QAAQ;aACT,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEzD,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE;YAC1B,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC;gBACnC,WAAW,EAAE,KAAK;aACnB,CAAC,CAAC;YACH,OAAO;gBACL,GAAG,EAAE,MAAM;qBACR,UAAU,CAAC,QAAQ,CAAC;qBACpB,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;qBACzE,MAAM,CAAC,KAAK,CAAC;gBAChB,QAAQ,EAAE,YAAY,CAAC,QAAQ;gBAC/B,GAAG,KAAK;aACT,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export const ProductBundleItem = {
|
|
2
|
-
product: async (productItem, _, {
|
|
3
|
-
|
|
2
|
+
product: async (productItem, _, { loaders }) => {
|
|
3
|
+
const product = await loaders.productLoader.load({
|
|
4
4
|
productId: productItem.productId,
|
|
5
|
+
includeDrafts: true,
|
|
5
6
|
});
|
|
7
|
+
return product;
|
|
6
8
|
},
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=product-bundle-item-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-bundle-item-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-bundle-item-types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC7C,OAAO,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"product-bundle-item-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-bundle-item-types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
|
|
@@ -2,8 +2,12 @@ export const ProductReview = {
|
|
|
2
2
|
author: async (obj, _, { modules }) => {
|
|
3
3
|
return modules.users.findUserById(obj.authorId);
|
|
4
4
|
},
|
|
5
|
-
product: async (
|
|
6
|
-
|
|
5
|
+
product: async (review, _, { loaders }) => {
|
|
6
|
+
const product = await loaders.productLoader.load({
|
|
7
|
+
productId: review.productId,
|
|
8
|
+
includeDrafts: true,
|
|
9
|
+
});
|
|
10
|
+
return product;
|
|
7
11
|
},
|
|
8
12
|
ownVotes: async (obj, _, { modules, userId }) => {
|
|
9
13
|
return modules.products.reviews.votes.ownVotes(obj, { userId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-review-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-review-types.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"product-review-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-review-types.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IAC/E,CAAC;CACF,CAAC"}
|
|
@@ -9,10 +9,12 @@ export const ProductVariationAssignment = {
|
|
|
9
9
|
product,
|
|
10
10
|
}));
|
|
11
11
|
},
|
|
12
|
-
product: async ({ assignment }, _, {
|
|
13
|
-
|
|
12
|
+
product: async ({ assignment }, _, { loaders }) => {
|
|
13
|
+
const product = await loaders.productLoader.load({
|
|
14
14
|
productId: assignment.productId,
|
|
15
|
+
includeDrafts: true,
|
|
15
16
|
});
|
|
17
|
+
return product;
|
|
16
18
|
},
|
|
17
19
|
};
|
|
18
20
|
//# sourceMappingURL=product-variation-assignment-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-variation-assignment-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-variation-assignment-types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAA0C;IAC/E,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE;QAC/B,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxD,GAAG;YACH,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;YAC7B,OAAO;SACR,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,OAAO,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"product-variation-assignment-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-variation-assignment-types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAA0C;IAC/E,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE;QAC/B,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxD,GAAG;YACH,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;YAC7B,OAAO;SACR,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
|
|
@@ -12,9 +12,13 @@ export const Quotation = {
|
|
|
12
12
|
},
|
|
13
13
|
}),
|
|
14
14
|
isExpired: (obj, { referenceDate }, { modules }) => modules.quotations.isExpired(obj, { referenceDate }),
|
|
15
|
-
product: (obj, _, {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
product: async (obj, _, { loaders }) => {
|
|
16
|
+
const product = await loaders.productLoader.load({
|
|
17
|
+
productId: obj.productId,
|
|
18
|
+
includeDrafts: true,
|
|
19
|
+
});
|
|
20
|
+
return product;
|
|
21
|
+
},
|
|
18
22
|
status: (obj, _, { modules }) => modules.quotations.normalizedStatus(obj),
|
|
19
23
|
user: (obj, _, { modules }) => modules.users.findUserById(obj.userId),
|
|
20
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotation-types.js","sourceRoot":"","sources":["../../../src/resolvers/type/quotation-types.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,SAAS,GAAyB;IAC7C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;IAEnG,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;IAEnG,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CACxC,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAC/B;QACE,IAAI,EAAE;YACJ,WAAW,EAAE,GAAG,CAAC,GAAG;YACpB,IAAI;SACL;KACF,EACD;QACE,IAAI,EAAE;YACJ,WAAW,EAAE,CAAC,CAAC;SAChB;KACF,CACF;IAEH,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CACjD,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,CAAC;IAEtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"quotation-types.js","sourceRoot":"","sources":["../../../src/resolvers/type/quotation-types.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,SAAS,GAAyB;IAC7C,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AAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;CACtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.45",
|
|
4
4
|
"main": "lib/api-index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/api-index.js",
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
"graphql": "^15.x"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@unchainedshop/core": "^1.2.
|
|
38
|
-
"@unchainedshop/events": "^1.2.
|
|
39
|
-
"@unchainedshop/logger": "^1.2.
|
|
40
|
-
"@unchainedshop/roles": "^1.2.
|
|
41
|
-
"@unchainedshop/utils": "^1.2.
|
|
37
|
+
"@unchainedshop/core": "^1.2.45",
|
|
38
|
+
"@unchainedshop/events": "^1.2.45",
|
|
39
|
+
"@unchainedshop/logger": "^1.2.45",
|
|
40
|
+
"@unchainedshop/roles": "^1.2.45",
|
|
41
|
+
"@unchainedshop/utils": "^1.2.45",
|
|
42
42
|
"accounting": "0.4.1",
|
|
43
43
|
"dataloader": "^2.1.0",
|
|
44
44
|
"graphql-scalars": "^1.20.0",
|
|
45
45
|
"graphql-upload": "^13.0.0",
|
|
46
46
|
"locale": "0.1.0",
|
|
47
47
|
"lodash.isnumber": "3.0.3",
|
|
48
|
-
"lru-cache": "^7.14.
|
|
48
|
+
"lru-cache": "^7.14.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/graphql-upload": "^8.0.12",
|
|
52
52
|
"@types/locale": "^0.1.1",
|
|
53
53
|
"@types/node": "^16.18.3",
|
|
54
|
-
"@unchainedshop/types": "^1.2.
|
|
54
|
+
"@unchainedshop/types": "^1.2.45",
|
|
55
55
|
"apollo-server-express": "^2.26.0",
|
|
56
56
|
"graphql": "^15.8.0",
|
|
57
|
-
"jest": "^29.
|
|
57
|
+
"jest": "^29.3.1",
|
|
58
58
|
"ts-jest": "^29.0.3",
|
|
59
59
|
"typescript": "^4.8.4"
|
|
60
60
|
}
|
package/src/api-index.ts
CHANGED
|
@@ -12,7 +12,7 @@ export * as roles from './roles';
|
|
|
12
12
|
|
|
13
13
|
export { createContextResolver, getCurrentContextResolver, setCurrentContextResolver };
|
|
14
14
|
|
|
15
|
-
const UNCHAINED_API_VERSION = '1.2.
|
|
15
|
+
const UNCHAINED_API_VERSION = '1.2.44'; // eslint-disable-line
|
|
16
16
|
|
|
17
17
|
export const startAPIServer = (
|
|
18
18
|
options: UnchainedServerOptions,
|
package/src/loaders/index.ts
CHANGED
|
@@ -3,10 +3,11 @@ import DataLoader from 'dataloader';
|
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
4
|
import { systemLocale } from '@unchainedshop/utils';
|
|
5
5
|
import localePkg from 'locale';
|
|
6
|
-
import { AssortmentText } from '@unchainedshop/types/assortments';
|
|
7
|
-
import { FilterText } from '@unchainedshop/types/filters';
|
|
8
|
-
import { ProductText } from '@unchainedshop/types/products';
|
|
6
|
+
import { Assortment, AssortmentText } from '@unchainedshop/types/assortments';
|
|
7
|
+
import { Filter, FilterText } from '@unchainedshop/types/filters';
|
|
8
|
+
import { Product, ProductText } from '@unchainedshop/types/products';
|
|
9
9
|
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
10
|
+
import { ProductStatus } from '@unchainedshop/core-products';
|
|
10
11
|
|
|
11
12
|
const { Locale } = localePkg;
|
|
12
13
|
|
|
@@ -15,6 +16,28 @@ export default async (
|
|
|
15
16
|
unchainedAPI: UnchainedCore,
|
|
16
17
|
): Promise<UnchainedLoaders['loaders']> => {
|
|
17
18
|
return {
|
|
19
|
+
assortmentLoader: new DataLoader<{ assortmentId: string; includeInactive: boolean }, Assortment>(
|
|
20
|
+
async (queries) => {
|
|
21
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
22
|
+
|
|
23
|
+
const assortments = await unchainedAPI.modules.assortments.findAssortments({
|
|
24
|
+
assortmentIds,
|
|
25
|
+
includeInactive: true,
|
|
26
|
+
includeLeaves: true,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return queries.map(({ assortmentId, includeInactive }) => {
|
|
30
|
+
return assortments.find((assortment) => {
|
|
31
|
+
if (assortment._id !== assortmentId) return false;
|
|
32
|
+
if (!includeInactive) {
|
|
33
|
+
return assortment.isActive === true;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
),
|
|
40
|
+
|
|
18
41
|
assortmentTextLoader: new DataLoader<{ assortmentId: string; locale: string }, AssortmentText>(
|
|
19
42
|
async (queries) => {
|
|
20
43
|
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
@@ -45,6 +68,21 @@ export default async (
|
|
|
45
68
|
},
|
|
46
69
|
),
|
|
47
70
|
|
|
71
|
+
filterLoader: new DataLoader<{ filterId: string }, Filter>(async (queries) => {
|
|
72
|
+
const filterIds = [...new Set(queries.map((q) => q.filterId).filter(Boolean))];
|
|
73
|
+
|
|
74
|
+
const filters = await unchainedAPI.modules.filters.findFilters({
|
|
75
|
+
filterIds,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return queries.map(({ filterId }) => {
|
|
79
|
+
return filters.find((product) => {
|
|
80
|
+
if (product._id !== filterId) return false;
|
|
81
|
+
return true;
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}),
|
|
85
|
+
|
|
48
86
|
filterTextLoader: new DataLoader<
|
|
49
87
|
{ filterId: string; filterOptionValue?: string; locale: string },
|
|
50
88
|
FilterText
|
|
@@ -78,6 +116,27 @@ export default async (
|
|
|
78
116
|
});
|
|
79
117
|
}),
|
|
80
118
|
|
|
119
|
+
productLoader: new DataLoader<{ productId: string; includeDrafts: boolean }, Product>(
|
|
120
|
+
async (queries) => {
|
|
121
|
+
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
122
|
+
|
|
123
|
+
const products = await unchainedAPI.modules.products.findProducts({
|
|
124
|
+
productIds,
|
|
125
|
+
includeDrafts: true,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return queries.map(({ productId, includeDrafts }) => {
|
|
129
|
+
return products.find((product) => {
|
|
130
|
+
if (product._id !== productId) return false;
|
|
131
|
+
if (!includeDrafts) {
|
|
132
|
+
return product.status === ProductStatus.ACTIVE;
|
|
133
|
+
}
|
|
134
|
+
return true;
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
),
|
|
139
|
+
|
|
81
140
|
productTextLoader: new DataLoader<{ productId: string; locale: string }, ProductText>(
|
|
82
141
|
async (queries) => {
|
|
83
142
|
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
@@ -5,13 +5,16 @@ import { InvalidIdError } from '../../../errors';
|
|
|
5
5
|
export default async function productCatalogPrices(
|
|
6
6
|
root: Root,
|
|
7
7
|
{ productId }: { productId: string },
|
|
8
|
-
{ modules, userId }: Context,
|
|
8
|
+
{ modules, loaders, userId }: Context,
|
|
9
9
|
) {
|
|
10
10
|
log(`query productCatalogPrices ${productId}`, { userId });
|
|
11
11
|
|
|
12
12
|
if (!productId) throw new InvalidIdError({ productId });
|
|
13
13
|
|
|
14
|
-
const product = await
|
|
14
|
+
const product = await loaders.productLoader.load({
|
|
15
|
+
productId,
|
|
16
|
+
includeDrafts: true,
|
|
17
|
+
});
|
|
15
18
|
if (!product) return null;
|
|
16
19
|
|
|
17
20
|
return modules.products.prices.catalogPrices(product);
|
|
@@ -10,13 +10,18 @@ type AssortmentFilterHelperTypes = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const AssortmentFilter: AssortmentFilterHelperTypes = {
|
|
13
|
-
assortment: (obj, _, {
|
|
14
|
-
|
|
13
|
+
assortment: async (obj, _, { loaders }) => {
|
|
14
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
15
15
|
assortmentId: obj.assortmentId,
|
|
16
|
-
|
|
16
|
+
includeInactive: true,
|
|
17
|
+
});
|
|
18
|
+
return assortment;
|
|
19
|
+
},
|
|
17
20
|
|
|
18
|
-
filter: (obj, _, {
|
|
19
|
-
|
|
21
|
+
filter: async (obj, _, { loaders }) => {
|
|
22
|
+
const filter = await loaders.filterLoader.load({
|
|
20
23
|
filterId: obj.filterId,
|
|
21
|
-
})
|
|
24
|
+
});
|
|
25
|
+
return filter;
|
|
26
|
+
},
|
|
22
27
|
};
|
|
@@ -9,13 +9,19 @@ type AssortmentLinkHelperTypes = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const AssortmentLink: AssortmentLinkHelperTypes = {
|
|
12
|
-
child: (obj, _, {
|
|
13
|
-
|
|
12
|
+
child: async (obj, _, { loaders }) => {
|
|
13
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
14
14
|
assortmentId: obj.childAssortmentId,
|
|
15
|
-
|
|
15
|
+
includeInactive: true,
|
|
16
|
+
});
|
|
17
|
+
return assortment;
|
|
18
|
+
},
|
|
16
19
|
|
|
17
|
-
parent: (obj, _, {
|
|
18
|
-
|
|
20
|
+
parent: async (obj, _, { loaders }) => {
|
|
21
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
19
22
|
assortmentId: obj.parentAssortmentId,
|
|
20
|
-
|
|
23
|
+
includeInactive: true,
|
|
24
|
+
});
|
|
25
|
+
return assortment;
|
|
26
|
+
},
|
|
21
27
|
};
|
|
@@ -13,13 +13,19 @@ type AssortmentProductHelperTypes = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const AssortmentProduct: AssortmentProductHelperTypes = {
|
|
16
|
-
assortment: (obj, _, {
|
|
17
|
-
|
|
16
|
+
assortment: async (obj, _, { loaders }) => {
|
|
17
|
+
const assortment = await loaders.assortmentLoader.load({
|
|
18
18
|
assortmentId: obj.assortmentId,
|
|
19
|
-
|
|
19
|
+
includeInactive: true,
|
|
20
|
+
});
|
|
21
|
+
return assortment;
|
|
22
|
+
},
|
|
20
23
|
|
|
21
|
-
product: (obj, _, {
|
|
22
|
-
|
|
24
|
+
product: async (obj, _, { loaders }) => {
|
|
25
|
+
const product = await loaders.productLoader.load({
|
|
23
26
|
productId: obj.productId,
|
|
24
|
-
|
|
27
|
+
includeDrafts: true,
|
|
28
|
+
});
|
|
29
|
+
return product;
|
|
30
|
+
},
|
|
25
31
|
};
|
|
@@ -11,9 +11,14 @@ export interface BookmarkHelperTypes {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const Bookmark: BookmarkHelperTypes = {
|
|
14
|
-
product: async (obj, _, {
|
|
15
|
-
|
|
14
|
+
product: async (obj, _, { loaders }) => {
|
|
15
|
+
const product = await loaders.productLoader.load({
|
|
16
|
+
productId: obj.productId,
|
|
17
|
+
includeDrafts: true,
|
|
18
|
+
});
|
|
19
|
+
return product;
|
|
16
20
|
},
|
|
21
|
+
|
|
17
22
|
user: async (obj, _, { modules }) => {
|
|
18
23
|
return modules.users.findUserById(obj.userId);
|
|
19
24
|
},
|
|
@@ -9,7 +9,11 @@ type EnrollmentPlanHelperTypes = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const EnrollmentPlan: EnrollmentPlanHelperTypes = {
|
|
12
|
-
product: async (plan, _, {
|
|
13
|
-
|
|
12
|
+
product: async (plan, _, { loaders }) => {
|
|
13
|
+
const product = await loaders.productLoader.load({
|
|
14
|
+
productId: plan.productId,
|
|
15
|
+
includeDrafts: true,
|
|
16
|
+
});
|
|
17
|
+
return product;
|
|
14
18
|
},
|
|
15
19
|
};
|
|
@@ -57,7 +57,7 @@ export const OrderItem: OrderItemHelperTypes = {
|
|
|
57
57
|
return [];
|
|
58
58
|
},
|
|
59
59
|
|
|
60
|
-
dispatches: async (obj, _, { modules }) => {
|
|
60
|
+
dispatches: async (obj, _, { modules, loaders }) => {
|
|
61
61
|
const scheduling = obj.scheduling || [];
|
|
62
62
|
const order = await modules.orders.findOrder({ orderId: obj.orderId });
|
|
63
63
|
const { countryCode, userId } = order;
|
|
@@ -68,8 +68,9 @@ export const OrderItem: OrderItemHelperTypes = {
|
|
|
68
68
|
const deliveryProvider = await modules.delivery.findProvider({
|
|
69
69
|
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
70
70
|
});
|
|
71
|
-
const product = await
|
|
71
|
+
const product = await loaders.productLoader.load({
|
|
72
72
|
productId: obj.productId,
|
|
73
|
+
includeDrafts: true,
|
|
73
74
|
});
|
|
74
75
|
|
|
75
76
|
return Promise.all(
|
|
@@ -99,14 +100,20 @@ export const OrderItem: OrderItemHelperTypes = {
|
|
|
99
100
|
return modules.orders.findOrder({ orderId: obj.orderId });
|
|
100
101
|
},
|
|
101
102
|
|
|
102
|
-
originalProduct: async (obj, _, {
|
|
103
|
-
|
|
103
|
+
originalProduct: async (obj, _, { loaders }) => {
|
|
104
|
+
const product = await loaders.productLoader.load({
|
|
104
105
|
productId: obj.originalProductId,
|
|
106
|
+
includeDrafts: true,
|
|
105
107
|
});
|
|
108
|
+
return product;
|
|
106
109
|
},
|
|
107
110
|
|
|
108
|
-
product: async (obj, _, {
|
|
109
|
-
|
|
111
|
+
product: async (obj, _, { loaders }) => {
|
|
112
|
+
const product = await loaders.productLoader.load({
|
|
113
|
+
productId: obj.productId,
|
|
114
|
+
includeDrafts: true,
|
|
115
|
+
});
|
|
116
|
+
return product;
|
|
110
117
|
},
|
|
111
118
|
|
|
112
119
|
quotation: async (obj, _, { modules }) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ProductBundleItemHelperTypes } from '@unchainedshop/types/products';
|
|
2
2
|
|
|
3
3
|
export const ProductBundleItem: ProductBundleItemHelperTypes = {
|
|
4
|
-
product: async (productItem, _, {
|
|
5
|
-
|
|
4
|
+
product: async (productItem, _, { loaders }) => {
|
|
5
|
+
const product = await loaders.productLoader.load({
|
|
6
6
|
productId: productItem.productId,
|
|
7
|
+
includeDrafts: true,
|
|
7
8
|
});
|
|
9
|
+
return product;
|
|
8
10
|
},
|
|
9
11
|
};
|
|
@@ -20,8 +20,12 @@ export const ProductReview: ProductReviewHelperTypes = {
|
|
|
20
20
|
return modules.users.findUserById(obj.authorId);
|
|
21
21
|
},
|
|
22
22
|
|
|
23
|
-
product: async (
|
|
24
|
-
|
|
23
|
+
product: async (review, _, { loaders }) => {
|
|
24
|
+
const product = await loaders.productLoader.load({
|
|
25
|
+
productId: review.productId,
|
|
26
|
+
includeDrafts: true,
|
|
27
|
+
});
|
|
28
|
+
return product;
|
|
25
29
|
},
|
|
26
30
|
|
|
27
31
|
ownVotes: async (obj, _, { modules, userId }) => {
|
|
@@ -11,9 +11,11 @@ export const ProductVariationAssignment: ProductVariationAssignmentHelperTypes =
|
|
|
11
11
|
product,
|
|
12
12
|
}));
|
|
13
13
|
},
|
|
14
|
-
product: async ({ assignment }, _, {
|
|
15
|
-
|
|
14
|
+
product: async ({ assignment }, _, { loaders }) => {
|
|
15
|
+
const product = await loaders.productLoader.load({
|
|
16
16
|
productId: assignment.productId,
|
|
17
|
+
includeDrafts: true,
|
|
17
18
|
});
|
|
19
|
+
return product;
|
|
18
20
|
},
|
|
19
21
|
};
|
|
@@ -41,10 +41,13 @@ export const Quotation: QuotationHelperTypes = {
|
|
|
41
41
|
isExpired: (obj, { referenceDate }, { modules }) =>
|
|
42
42
|
modules.quotations.isExpired(obj, { referenceDate }),
|
|
43
43
|
|
|
44
|
-
product: (obj, _, {
|
|
45
|
-
|
|
44
|
+
product: async (obj, _, { loaders }) => {
|
|
45
|
+
const product = await loaders.productLoader.load({
|
|
46
46
|
productId: obj.productId,
|
|
47
|
-
|
|
47
|
+
includeDrafts: true,
|
|
48
|
+
});
|
|
49
|
+
return product;
|
|
50
|
+
},
|
|
48
51
|
|
|
49
52
|
status: (obj, _, { modules }) => modules.quotations.normalizedStatus(obj),
|
|
50
53
|
|