@unchainedshop/api 2.8.17 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +2 -2
- package/lib/errors.d.ts +1 -0
- package/lib/errors.js +1 -0
- package/lib/errors.js.map +1 -1
- package/lib/resolvers/mutations/index.d.ts +1 -0
- package/lib/resolvers/mutations/index.js +2 -0
- package/lib/resolvers/mutations/index.js.map +1 -1
- package/lib/resolvers/mutations/warehousing/invalidateToken.d.ts +4 -0
- package/lib/resolvers/mutations/warehousing/invalidateToken.js +26 -0
- package/lib/resolvers/mutations/warehousing/invalidateToken.js.map +1 -0
- package/lib/resolvers/queries/index.d.ts +1 -0
- package/lib/resolvers/queries/index.js +2 -0
- package/lib/resolvers/queries/index.js.map +1 -1
- package/lib/resolvers/queries/warehousing/tokens.d.ts +5 -0
- package/lib/resolvers/queries/warehousing/tokens.js +6 -0
- package/lib/resolvers/queries/warehousing/tokens.js.map +1 -0
- package/lib/resolvers/type/index.d.ts +367 -9
- package/lib/resolvers/type/order/order-item-types.d.ts +15 -17
- package/lib/resolvers/type/order/order-item-types.js +28 -23
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-types.d.ts +15 -19
- package/lib/resolvers/type/order/order-types.js +48 -28
- package/lib/resolvers/type/order/order-types.js.map +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts +34 -2
- package/lib/resolvers/type/product/product-bundle-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts +62 -2
- package/lib/resolvers/type/product/product-configurable-types.js +10 -10
- package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts +53 -2
- package/lib/resolvers/type/product/product-plan-types.js +9 -9
- package/lib/resolvers/type/product/product-plan-types.js.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts +85 -2
- package/lib/resolvers/type/product/product-simple-types.js +7 -7
- package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts +67 -2
- package/lib/resolvers/type/product/product-tokenized-types.js +19 -10
- package/lib/resolvers/type/product/product-tokenized-types.js.map +1 -1
- package/lib/resolvers/type/product/product-types.d.ts +38 -2
- package/lib/resolvers/type/product/product-types.js +15 -15
- package/lib/resolvers/type/product/product-types.js.map +1 -1
- package/lib/resolvers/type/token-types.d.ts +9 -12
- package/lib/resolvers/type/token-types.js +22 -3
- package/lib/resolvers/type/token-types.js.map +1 -1
- package/lib/roles/all.js +38 -17
- package/lib/roles/all.js.map +1 -1
- package/lib/roles/index.js +1 -0
- package/lib/roles/index.js.map +1 -1
- package/lib/roles/loggedIn.js +9 -14
- package/lib/roles/loggedIn.js.map +1 -1
- package/lib/schema/mutation.js +5 -1
- package/lib/schema/mutation.js.map +1 -1
- package/lib/schema/query.js +5 -0
- package/lib/schema/query.js.map +1 -1
- package/lib/schema/types/order/item.js +1 -0
- package/lib/schema/types/order/item.js.map +1 -1
- package/lib/schema/types/product/tokenized-product.js +2 -0
- package/lib/schema/types/product/tokenized-product.js.map +1 -1
- package/lib/schema/types/warehousing.js +9 -2
- package/lib/schema/types/warehousing.js.map +1 -1
- package/package.json +8 -8
- package/src/errors.ts +2 -0
- package/src/resolvers/mutations/index.ts +2 -0
- package/src/resolvers/mutations/warehousing/invalidateToken.ts +42 -0
- package/src/resolvers/queries/index.ts +2 -1
- package/src/resolvers/queries/warehousing/tokens.ts +18 -0
- package/src/resolvers/type/order/order-item-types.ts +59 -49
- package/src/resolvers/type/order/order-types.ts +58 -54
- package/src/resolvers/type/product/product-bundle-types.ts +3 -3
- package/src/resolvers/type/product/product-configurable-types.ts +79 -19
- package/src/resolvers/type/product/product-plan-types.ts +34 -15
- package/src/resolvers/type/product/product-simple-types.ts +41 -10
- package/src/resolvers/type/product/product-tokenized-types.ts +43 -13
- package/src/resolvers/type/product/product-types.ts +77 -18
- package/src/resolvers/type/token-types.ts +35 -20
- package/src/roles/all.ts +46 -17
- package/src/roles/index.ts +1 -0
- package/src/roles/loggedIn.ts +10 -24
- package/src/schema/mutation.ts +5 -1
- package/src/schema/query.ts +5 -0
- package/src/schema/types/order/item.ts +1 -0
- package/src/schema/types/product/tokenized-product.ts +2 -0
- package/src/schema/types/warehousing.ts +9 -2
|
@@ -9,25 +9,21 @@ import { OrderDiscount } from '@unchainedshop/types/orders.discounts.js';
|
|
|
9
9
|
import { OrderPayment } from '@unchainedshop/types/orders.payments.js';
|
|
10
10
|
import { OrderPosition } from '@unchainedshop/types/orders.positions.js';
|
|
11
11
|
import { OrderPrice } from '@unchainedshop/types/orders.pricing.js';
|
|
12
|
-
import { PaymentProvider } from '@unchainedshop/types/payments.js';
|
|
13
12
|
import { User } from '@unchainedshop/types/user.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
payment:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
total: HelperType<{
|
|
13
|
+
export declare const Order: {
|
|
14
|
+
supportedDeliveryProviders(order: OrderType, _: any, context: Context): Promise<Array<DeliveryProvider>>;
|
|
15
|
+
supportedPaymentProviders(order: OrderType, _: any, context: Context): Promise<import("@unchainedshop/types/payments.js").PaymentProvider[]>;
|
|
16
|
+
currency(order: OrderType, _: any, { modules }: Context): Promise<Currency>;
|
|
17
|
+
country(order: OrderType, _: any, { modules }: Context): Promise<Country>;
|
|
18
|
+
discounts(order: OrderType, _: any, { modules }: Context): Promise<Array<OrderDiscount>>;
|
|
19
|
+
delivery(order: OrderType, _: any, { modules }: Context): Promise<OrderDelivery>;
|
|
20
|
+
enrollment(order: OrderType, _: any, { modules }: Context): Promise<Enrollment>;
|
|
21
|
+
items(order: OrderType, _: any, { modules }: Context): Promise<Array<OrderPosition>>;
|
|
22
|
+
payment(order: OrderType, _: any, { modules }: Context): Promise<OrderPayment>;
|
|
23
|
+
status(order: OrderType): string;
|
|
24
|
+
total(order: OrderType, params: {
|
|
27
25
|
category: string;
|
|
28
26
|
useNetPrice: boolean;
|
|
29
|
-
}, Promise<OrderPrice
|
|
30
|
-
user:
|
|
31
|
-
}
|
|
32
|
-
export declare const Order: OrderHelperTypes;
|
|
33
|
-
export {};
|
|
27
|
+
}, { modules }: Context): Promise<OrderPrice>;
|
|
28
|
+
user(order: OrderType, _: any, { modules }: Context): Promise<User>;
|
|
29
|
+
};
|
|
@@ -1,46 +1,66 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
export const Order = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
async supportedDeliveryProviders(order, _, context) {
|
|
4
|
+
return context.modules.delivery.findSupported({
|
|
5
|
+
order,
|
|
6
|
+
}, context);
|
|
7
|
+
},
|
|
8
|
+
async supportedPaymentProviders(order, _, context) {
|
|
9
|
+
return context.modules.payment.paymentProviders.findSupported({
|
|
10
|
+
order,
|
|
11
|
+
}, context);
|
|
12
|
+
},
|
|
13
|
+
async currency(order, _, { modules }) {
|
|
14
|
+
return modules.currencies.findCurrency({ isoCode: order.currency });
|
|
15
|
+
},
|
|
16
|
+
async country(order, _, { modules }) {
|
|
17
|
+
return modules.countries.findCountry({ isoCode: order.countryCode });
|
|
18
|
+
},
|
|
19
|
+
async discounts(order, _, { modules }) {
|
|
20
|
+
return modules.orders.discounts.findOrderDiscounts({ orderId: order._id });
|
|
21
|
+
},
|
|
22
|
+
async delivery(order, _, { modules }) {
|
|
23
|
+
return modules.orders.deliveries.findDelivery({
|
|
24
|
+
orderDeliveryId: order.deliveryId,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
async enrollment(order, _, { modules }) {
|
|
28
|
+
return modules.enrollments.findEnrollment({
|
|
29
|
+
orderId: order._id,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async items(order, _, { modules }) {
|
|
33
|
+
return modules.orders.positions.findOrderPositions({
|
|
34
|
+
orderId: order._id,
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
async payment(order, _, { modules }) {
|
|
38
|
+
return modules.orders.payments.findOrderPayment({
|
|
39
|
+
orderPaymentId: order.paymentId,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
status(order) {
|
|
43
|
+
if (order.status === null) {
|
|
26
44
|
return 'OPEN';
|
|
27
45
|
}
|
|
28
|
-
return
|
|
46
|
+
return order.status;
|
|
29
47
|
},
|
|
30
|
-
|
|
31
|
-
const pricingSheet = modules.orders.pricingSheet(
|
|
48
|
+
async total(order, params, { modules }) {
|
|
49
|
+
const pricingSheet = modules.orders.pricingSheet(order);
|
|
32
50
|
if (pricingSheet.isValid()) {
|
|
33
51
|
const price = pricingSheet.total(params);
|
|
34
52
|
return {
|
|
35
53
|
_id: crypto
|
|
36
54
|
.createHash('sha256')
|
|
37
|
-
.update([
|
|
55
|
+
.update([order._id, JSON.stringify(params), JSON.stringify(price)].join(''))
|
|
38
56
|
.digest('hex'),
|
|
39
57
|
...price,
|
|
40
58
|
};
|
|
41
59
|
}
|
|
42
60
|
return null;
|
|
43
61
|
},
|
|
44
|
-
|
|
62
|
+
async user(order, _, { modules }) {
|
|
63
|
+
return modules.users.findUserById(order.userId);
|
|
64
|
+
},
|
|
45
65
|
};
|
|
46
66
|
//# sourceMappingURL=order-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/order/order-types.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAA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AAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;qBAC3E,MAAM,CAAC,KAAK,CAAC;gBAChB,GAAG,KAAK;aACT,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAgB,EAAE,CAAC,EAAE,EAAE,OAAO,EAAW;QAClD,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;CACF,CAAC"}
|
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const BundleProduct:
|
|
1
|
+
import { ProductBundleItem } from '@unchainedshop/types/products.js';
|
|
2
|
+
export declare const BundleProduct: {
|
|
3
|
+
bundleItems(product: any): Array<ProductBundleItem>;
|
|
4
|
+
__resolveType: (product: import("@unchainedshop/types/products.js").Product) => string;
|
|
5
|
+
assortmentPaths(product: import("@unchainedshop/types/products.js").Product, params: {
|
|
6
|
+
forceLocale?: string;
|
|
7
|
+
}, { modules }: import("@unchainedshop/types/api.js").Context): Promise<{
|
|
8
|
+
links: import("@unchainedshop/types/assortments.js").AssortmentPathLink[];
|
|
9
|
+
}[]>;
|
|
10
|
+
media(product: import("@unchainedshop/types/products.js").Product, params: {
|
|
11
|
+
limit: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
}, { modules }: import("@unchainedshop/types/api.js").Context): Promise<import("@unchainedshop/types/products.media.js").ProductMedia[]>;
|
|
15
|
+
reviews(product: import("@unchainedshop/types/products.js").Product, { limit, offset, sort, queryString, }: {
|
|
16
|
+
queryString?: string;
|
|
17
|
+
limit?: number;
|
|
18
|
+
offset?: number;
|
|
19
|
+
sort?: import("@unchainedshop/types/api.js").SortOption[];
|
|
20
|
+
}, { modules }: import("@unchainedshop/types/api.js").Context): Promise<import("@unchainedshop/types/products.reviews.js").ProductReview[]>;
|
|
21
|
+
reviewsCount(product: import("@unchainedshop/types/products.js").Product, params: {
|
|
22
|
+
queryString?: string;
|
|
23
|
+
}, { modules }: import("@unchainedshop/types/api.js").Context): Promise<number>;
|
|
24
|
+
siblings(product: import("@unchainedshop/types/products.js").Product, params: {
|
|
25
|
+
assortmentId?: string;
|
|
26
|
+
limit: number;
|
|
27
|
+
offset: number;
|
|
28
|
+
includeInactive: boolean;
|
|
29
|
+
}, { modules }: import("@unchainedshop/types/api.js").Context): Promise<import("@unchainedshop/types/products.js").Product[]>;
|
|
30
|
+
status(product: import("@unchainedshop/types/products.js").Product, _: any, { modules }: import("@unchainedshop/types/api.js").Context): import("@unchainedshop/core-products").ProductStatus;
|
|
31
|
+
texts(product: import("@unchainedshop/types/products.js").Product, { forceLocale, }: {
|
|
32
|
+
forceLocale?: string;
|
|
33
|
+
}, requestContext: import("@unchainedshop/types/api.js").Context): Promise<import("@unchainedshop/types/products.js").ProductText>;
|
|
34
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-bundle-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-bundle-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"product-bundle-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-bundle-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,OAAO;IAEV,WAAW,CAAC,OAAO;QACjB,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,CAAC;CACF,CAAC"}
|
|
@@ -1,2 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Product as ProductType, ProductAssignment, ProductConfiguration, ProductPriceRange } from '@unchainedshop/types/products.js';
|
|
2
|
+
import { Context } from '@unchainedshop/types/api.js';
|
|
3
|
+
import { ProductVariation } from '@unchainedshop/types/products.variations.js';
|
|
4
|
+
export declare const ConfigurableProduct: {
|
|
5
|
+
assignments(product: ProductType, params: {
|
|
6
|
+
includeInactive: boolean;
|
|
7
|
+
}, { modules }: Context): Promise<{
|
|
8
|
+
assignment: ProductAssignment;
|
|
9
|
+
product: ProductType;
|
|
10
|
+
}[]>;
|
|
11
|
+
products(product: ProductType, { vectors, includeInactive, }: {
|
|
12
|
+
vectors: Array<ProductConfiguration>;
|
|
13
|
+
includeInactive: boolean;
|
|
14
|
+
}, { modules }: Context): Promise<ProductType[]>;
|
|
15
|
+
catalogPriceRange(product: ProductType, { quantity, vectors, currency: forcedCurrencyCode, includeInactive, }: {
|
|
16
|
+
currency?: string;
|
|
17
|
+
includeInactive: boolean;
|
|
18
|
+
quantity: number;
|
|
19
|
+
vectors: Array<ProductConfiguration>;
|
|
20
|
+
}, requestContext: Context): Promise<ProductPriceRange>;
|
|
21
|
+
variations(product: ProductType, { limit, offset, }: {
|
|
22
|
+
limit: number;
|
|
23
|
+
offset: number;
|
|
24
|
+
}, { modules }: Context): Promise<Array<ProductVariation>>;
|
|
25
|
+
simulatedPriceRange(product: ProductType, { currency: forcedCurrencyCode, quantity, useNetPrice, vectors, includeInactive, }: {
|
|
26
|
+
currency?: string;
|
|
27
|
+
includeInactive: boolean;
|
|
28
|
+
quantity?: number;
|
|
29
|
+
vectors: Array<ProductConfiguration>;
|
|
30
|
+
useNetPrice: boolean;
|
|
31
|
+
}, requestContext: Context): Promise<ProductPriceRange>;
|
|
32
|
+
__resolveType: (product: ProductType) => string;
|
|
33
|
+
assortmentPaths(product: ProductType, params: {
|
|
34
|
+
forceLocale?: string;
|
|
35
|
+
}, { modules }: Context): Promise<{
|
|
36
|
+
links: import("@unchainedshop/types/assortments.js").AssortmentPathLink[];
|
|
37
|
+
}[]>;
|
|
38
|
+
media(product: ProductType, params: {
|
|
39
|
+
limit: number;
|
|
40
|
+
offset: number;
|
|
41
|
+
tags?: string[];
|
|
42
|
+
}, { modules }: Context): Promise<import("@unchainedshop/types/products.media.js").ProductMedia[]>;
|
|
43
|
+
reviews(product: ProductType, { limit, offset, sort, queryString, }: {
|
|
44
|
+
queryString?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
offset?: number;
|
|
47
|
+
sort?: import("@unchainedshop/types/api.js").SortOption[];
|
|
48
|
+
}, { modules }: Context): Promise<import("@unchainedshop/types/products.reviews.js").ProductReview[]>;
|
|
49
|
+
reviewsCount(product: ProductType, params: {
|
|
50
|
+
queryString?: string;
|
|
51
|
+
}, { modules }: Context): Promise<number>;
|
|
52
|
+
siblings(product: ProductType, params: {
|
|
53
|
+
assortmentId?: string;
|
|
54
|
+
limit: number;
|
|
55
|
+
offset: number;
|
|
56
|
+
includeInactive: boolean;
|
|
57
|
+
}, { modules }: Context): Promise<ProductType[]>;
|
|
58
|
+
status(product: ProductType, _: any, { modules }: Context): import("@unchainedshop/core-products").ProductStatus;
|
|
59
|
+
texts(product: ProductType, { forceLocale, }: {
|
|
60
|
+
forceLocale?: string;
|
|
61
|
+
}, requestContext: Context): Promise<import("@unchainedshop/types/products.js").ProductText>;
|
|
62
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Product } from './product-types.js';
|
|
2
2
|
export const ConfigurableProduct = {
|
|
3
3
|
...Product,
|
|
4
|
-
|
|
5
|
-
return modules.products.proxyAssignments(
|
|
4
|
+
async assignments(product, params, { modules }) {
|
|
5
|
+
return modules.products.proxyAssignments(product, params);
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
return modules.products.proxyProducts(
|
|
7
|
+
async products(product, { vectors, includeInactive, }, { modules }) {
|
|
8
|
+
return modules.products.proxyProducts(product, vectors, {
|
|
9
9
|
includeInactive,
|
|
10
10
|
});
|
|
11
11
|
},
|
|
12
|
-
|
|
12
|
+
async catalogPriceRange(product, { quantity, vectors, currency: forcedCurrencyCode, includeInactive, }, requestContext) {
|
|
13
13
|
const { countryContext, modules } = requestContext;
|
|
14
14
|
const currencyCode = forcedCurrencyCode ||
|
|
15
15
|
(await requestContext.services.countries.resolveDefaultCurrencyCode({
|
|
16
16
|
isoCode: countryContext,
|
|
17
17
|
}, requestContext));
|
|
18
|
-
return modules.products.prices.catalogPriceRange(
|
|
18
|
+
return modules.products.prices.catalogPriceRange(product, {
|
|
19
19
|
quantity,
|
|
20
20
|
vectors,
|
|
21
21
|
includeInactive,
|
|
@@ -23,20 +23,20 @@ export const ConfigurableProduct = {
|
|
|
23
23
|
currency: currencyCode,
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
async variations(product, { limit = 10, offset = 0, }, { modules }) {
|
|
27
27
|
return modules.products.variations.findProductVariations({
|
|
28
|
-
productId:
|
|
28
|
+
productId: product._id,
|
|
29
29
|
limit,
|
|
30
30
|
offset,
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
|
-
async simulatedPriceRange(
|
|
33
|
+
async simulatedPriceRange(product, { currency: forcedCurrencyCode, quantity, useNetPrice, vectors, includeInactive, }, requestContext) {
|
|
34
34
|
const { countryContext, modules } = requestContext;
|
|
35
35
|
const currency = forcedCurrencyCode ||
|
|
36
36
|
(await requestContext.services.countries.resolveDefaultCurrencyCode({
|
|
37
37
|
isoCode: countryContext,
|
|
38
38
|
}, requestContext));
|
|
39
|
-
return modules.products.prices.simulatedPriceRange(
|
|
39
|
+
return modules.products.prices.simulatedPriceRange(product, {
|
|
40
40
|
quantity,
|
|
41
41
|
currency,
|
|
42
42
|
userId: requestContext.userId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-configurable-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-configurable-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-configurable-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-configurable-types.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,OAAO;IAEV,KAAK,CAAC,WAAW,CACf,OAAoB,EACpB,MAEC,EACD,EAAE,OAAO,EAAW;QAOpB,OAAO,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,OAAoB,EACpB,EACE,OAAO,EACP,eAAe,GAIhB,EACD,EAAE,OAAO,EAAW;QAEpB,OAAO,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE;YACtD,eAAe;SAChB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAoB,EACpB,EACE,QAAQ,EACR,OAAO,EACP,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,GAMhB,EACD,cAAuB;QAEvB,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QACnD,MAAM,YAAY,GAChB,kBAAkB;YAClB,CAAC,MAAM,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,0BAA0B,CACjE;gBACE,OAAO,EAAE,cAAc;aACxB,EACD,cAAc,CACf,CAAC,CAAC;QACL,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE;YACxD,QAAQ;YACR,OAAO;YACP,eAAe;YACf,OAAO,EAAE,cAAc;YACvB,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CACd,OAAoB,EACpB,EACE,KAAK,GAAG,EAAE,EACV,MAAM,GAAG,CAAC,GAIX,EACD,EAAE,OAAO,EAAW;QAEpB,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;YACvD,SAAS,EAAE,OAAO,CAAC,GAAG;YACtB,KAAK;YACL,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,OAAoB,EACpB,EACE,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,eAAe,GAOhB,EACD,cAAuB;QAEvB,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QACnD,MAAM,QAAQ,GACZ,kBAAkB;YAClB,CAAC,MAAM,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,0BAA0B,CACjE;gBACE,OAAO,EAAE,cAAc;aACxB,EACD,cAAc,CACf,CAAC,CAAC;QACL,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAChD,OAAO,EACP;YACE,QAAQ;YACR,QAAQ;YACR,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,OAAO,EAAE,cAAc;YACvB,WAAW;YACX,OAAO;YACP,eAAe;SAChB,EACD,cAAc,CACf,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ProductPrice, Product as ProductType } from '@unchainedshop/types/products.js';
|
|
2
|
+
import { Context } from '@unchainedshop/types/api.js';
|
|
3
|
+
export declare const PlanProduct: {
|
|
4
|
+
catalogPrice(product: ProductType, { quantity, currency: forcedCurrencyCode }: {
|
|
5
|
+
quantity?: number;
|
|
6
|
+
currency?: string;
|
|
7
|
+
}, requestContext: Context): Promise<ProductPrice>;
|
|
8
|
+
simulatedPrice(obj: ProductType, { currency: forcedCurrencyCode, quantity, useNetPrice, }: {
|
|
9
|
+
quantity?: number;
|
|
10
|
+
currency?: string;
|
|
11
|
+
useNetPrice?: boolean;
|
|
12
|
+
}, requestContext: Context): Promise<ProductPrice>;
|
|
13
|
+
leveledCatalogPrices(obj: ProductType, { currency: forcedCurrencyCode }: {
|
|
14
|
+
currency?: string;
|
|
15
|
+
}, requestContext: Context): Promise<Array<{
|
|
16
|
+
minQuantity: number;
|
|
17
|
+
maxQuantity: number;
|
|
18
|
+
price: ProductPrice;
|
|
19
|
+
}>>;
|
|
20
|
+
salesUnit({ commerce }: ProductType): string;
|
|
21
|
+
salesQuantityPerUnit({ commerce }: ProductType): string;
|
|
22
|
+
defaultOrderQuantity({ commerce }: ProductType): number;
|
|
23
|
+
__resolveType: (product: ProductType) => string;
|
|
24
|
+
assortmentPaths(product: ProductType, params: {
|
|
25
|
+
forceLocale?: string;
|
|
26
|
+
}, { modules }: Context): Promise<{
|
|
27
|
+
links: import("@unchainedshop/types/assortments.js").AssortmentPathLink[];
|
|
28
|
+
}[]>;
|
|
29
|
+
media(product: ProductType, params: {
|
|
30
|
+
limit: number;
|
|
31
|
+
offset: number;
|
|
32
|
+
tags?: string[];
|
|
33
|
+
}, { modules }: Context): Promise<import("@unchainedshop/types/products.media.js").ProductMedia[]>;
|
|
34
|
+
reviews(product: ProductType, { limit, offset, sort, queryString, }: {
|
|
35
|
+
queryString?: string;
|
|
36
|
+
limit?: number;
|
|
37
|
+
offset?: number;
|
|
38
|
+
sort?: import("@unchainedshop/types/api.js").SortOption[];
|
|
39
|
+
}, { modules }: Context): Promise<import("@unchainedshop/types/products.reviews.js").ProductReview[]>;
|
|
40
|
+
reviewsCount(product: ProductType, params: {
|
|
41
|
+
queryString?: string;
|
|
42
|
+
}, { modules }: Context): Promise<number>;
|
|
43
|
+
siblings(product: ProductType, params: {
|
|
44
|
+
assortmentId?: string;
|
|
45
|
+
limit: number;
|
|
46
|
+
offset: number;
|
|
47
|
+
includeInactive: boolean;
|
|
48
|
+
}, { modules }: Context): Promise<ProductType[]>;
|
|
49
|
+
status(product: ProductType, _: any, { modules }: Context): import("@unchainedshop/core-products").ProductStatus;
|
|
50
|
+
texts(product: ProductType, { forceLocale, }: {
|
|
51
|
+
forceLocale?: string;
|
|
52
|
+
}, requestContext: Context): Promise<import("@unchainedshop/types/products.js").ProductText>;
|
|
53
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Product } from './product-types.js';
|
|
2
2
|
export const PlanProduct = {
|
|
3
3
|
...Product,
|
|
4
|
-
|
|
4
|
+
async catalogPrice(product, { quantity, currency: forcedCurrencyCode }, requestContext) {
|
|
5
5
|
const { modules, countryContext } = requestContext;
|
|
6
6
|
const currencyCode = forcedCurrencyCode ||
|
|
7
7
|
(await requestContext.services.countries.resolveDefaultCurrencyCode({
|
|
@@ -13,7 +13,7 @@ export const PlanProduct = {
|
|
|
13
13
|
quantity,
|
|
14
14
|
});
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
async simulatedPrice(obj, { currency: forcedCurrencyCode, quantity, useNetPrice, }, requestContext) {
|
|
17
17
|
const { countryContext, modules } = requestContext;
|
|
18
18
|
const currency = forcedCurrencyCode ||
|
|
19
19
|
(await requestContext.services.countries.resolveDefaultCurrencyCode({
|
|
@@ -21,7 +21,7 @@ export const PlanProduct = {
|
|
|
21
21
|
}, requestContext));
|
|
22
22
|
return modules.products.prices.userPrice(obj, { quantity, userId: requestContext.userId, currency, country: countryContext, useNetPrice }, requestContext);
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
async leveledCatalogPrices(obj, { currency: forcedCurrencyCode }, requestContext) {
|
|
25
25
|
const { countryContext, modules } = requestContext;
|
|
26
26
|
const currency = forcedCurrencyCode ||
|
|
27
27
|
(await requestContext.services.countries.resolveDefaultCurrencyCode({
|
|
@@ -29,14 +29,14 @@ export const PlanProduct = {
|
|
|
29
29
|
}, requestContext));
|
|
30
30
|
return modules.products.prices.catalogPricesLeveled(obj, { currency, country: countryContext });
|
|
31
31
|
},
|
|
32
|
-
salesUnit(
|
|
33
|
-
return
|
|
32
|
+
salesUnit({ commerce }) {
|
|
33
|
+
return commerce?.salesUnit;
|
|
34
34
|
},
|
|
35
|
-
salesQuantityPerUnit(
|
|
36
|
-
return
|
|
35
|
+
salesQuantityPerUnit({ commerce }) {
|
|
36
|
+
return commerce?.salesQuantityPerUnit;
|
|
37
37
|
},
|
|
38
|
-
defaultOrderQuantity(
|
|
39
|
-
return
|
|
38
|
+
defaultOrderQuantity({ commerce }) {
|
|
39
|
+
return commerce?.defaultOrderQuantity;
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=product-plan-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-plan-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-plan-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-plan-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-plan-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,OAAO;IAEV,KAAK,CAAC,YAAY,CAChB,OAAoB,EACpB,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAA4C,EACpF,cAAuB;QAEvB,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,cAAc,CAAC;QACnD,MAAM,YAAY,GAChB,kBAAkB;YAClB,CAAC,MAAM,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,0BAA0B,CACjE;gBACE,OAAO,EAAE,cAAc;aACxB,EACD,cAAc,CACf,CAAC,CAAC;QACL,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE;YAC5C,OAAO,EAAE,cAAc;YACvB,QAAQ,EAAE,YAAY;YACtB,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,GAAgB,EAChB,EACE,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EACR,WAAW,GACqD,EAClE,cAAuB;QAEvB,MAAM,EAAE,c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ply } from '@unchainedshop/types/products.js';
|
|
2
|
+
import { WarehousingProvider } from '@unchainedshop/types/warehousing.js';
|
|
3
|
+
import { Context } from '@unchainedshop/types/api.js';
|
|
4
|
+
import { DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
5
|
+
import { DeliveryProvider } from '@unchainedshop/types/delivery.js';
|
|
6
|
+
export declare const SimpleProduct: {
|
|
7
|
+
simulatedDispatches(obj: Product, params: {
|
|
8
|
+
referenceDate: Date;
|
|
9
|
+
quantity: number;
|
|
10
|
+
deliveryProviderType: DeliveryProviderType;
|
|
11
|
+
}, requestContext: Context): Promise<Array<{
|
|
12
|
+
_id: string;
|
|
13
|
+
deliveryProvider?: DeliveryProvider;
|
|
14
|
+
warehousingProvider?: WarehousingProvider;
|
|
15
|
+
shipping?: Date;
|
|
16
|
+
earliestDelivery?: Date;
|
|
17
|
+
}>>;
|
|
18
|
+
simulatedStocks(obj: Product, params: {
|
|
19
|
+
referenceDate: Date;
|
|
20
|
+
deliveryProviderType: DeliveryProviderType;
|
|
21
|
+
}, requestContext: Context): Promise<Array<{
|
|
22
|
+
_id: string;
|
|
23
|
+
deliveryProvider?: DeliveryProvider;
|
|
24
|
+
warehousingProvider?: WarehousingProvider;
|
|
25
|
+
quantity?: number;
|
|
26
|
+
}>>;
|
|
27
|
+
baseUnit({ warehousing }: {
|
|
28
|
+
warehousing: any;
|
|
29
|
+
}): string;
|
|
30
|
+
sku({ warehousing }: {
|
|
31
|
+
warehousing: any;
|
|
32
|
+
}): string;
|
|
33
|
+
dimensions({ supply }: {
|
|
34
|
+
supply: any;
|
|
35
|
+
}): ProductSupply;
|
|
36
|
+
catalogPrice(product: Product, { quantity, currency: forcedCurrencyCode }: {
|
|
37
|
+
quantity?: number;
|
|
38
|
+
currency?: string;
|
|
39
|
+
}, requestContext: Context): Promise<import("@unchainedshop/types/products.js").ProductPrice>;
|
|
40
|
+
simulatedPrice(obj: Product, { currency: forcedCurrencyCode, quantity, useNetPrice, }: {
|
|
41
|
+
quantity?: number;
|
|
42
|
+
currency?: string;
|
|
43
|
+
useNetPrice?: boolean;
|
|
44
|
+
}, requestContext: Context): Promise<import("@unchainedshop/types/products.js").ProductPrice>;
|
|
45
|
+
leveledCatalogPrices(obj: Product, { currency: forcedCurrencyCode }: {
|
|
46
|
+
currency?: string;
|
|
47
|
+
}, requestContext: Context): Promise<{
|
|
48
|
+
minQuantity: number;
|
|
49
|
+
maxQuantity: number;
|
|
50
|
+
price: import("@unchainedshop/types/products.js").ProductPrice;
|
|
51
|
+
}[]>;
|
|
52
|
+
salesUnit({ commerce }: Product): string;
|
|
53
|
+
salesQuantityPerUnit({ commerce }: Product): string;
|
|
54
|
+
defaultOrderQuantity({ commerce }: Product): number;
|
|
55
|
+
__resolveType: (product: Product) => string;
|
|
56
|
+
assortmentPaths(product: Product, params: {
|
|
57
|
+
forceLocale?: string;
|
|
58
|
+
}, { modules }: Context): Promise<{
|
|
59
|
+
links: import("@unchainedshop/types/assortments.js").AssortmentPathLink[];
|
|
60
|
+
}[]>;
|
|
61
|
+
media(product: Product, params: {
|
|
62
|
+
limit: number;
|
|
63
|
+
offset: number;
|
|
64
|
+
tags?: string[];
|
|
65
|
+
}, { modules }: Context): Promise<import("@unchainedshop/types/products.media.js").ProductMedia[]>;
|
|
66
|
+
reviews(product: Product, { limit, offset, sort, queryString, }: {
|
|
67
|
+
queryString?: string;
|
|
68
|
+
limit?: number;
|
|
69
|
+
offset?: number;
|
|
70
|
+
sort?: import("@unchainedshop/types/api.js").SortOption[];
|
|
71
|
+
}, { modules }: Context): Promise<import("@unchainedshop/types/products.reviews.js").ProductReview[]>;
|
|
72
|
+
reviewsCount(product: Product, params: {
|
|
73
|
+
queryString?: string;
|
|
74
|
+
}, { modules }: Context): Promise<number>;
|
|
75
|
+
siblings(product: Product, params: {
|
|
76
|
+
assortmentId?: string;
|
|
77
|
+
limit: number;
|
|
78
|
+
offset: number;
|
|
79
|
+
includeInactive: boolean;
|
|
80
|
+
}, { modules }: Context): Promise<Product[]>;
|
|
81
|
+
status(product: Product, _: any, { modules }: Context): import("@unchainedshop/core-products").ProductStatus;
|
|
82
|
+
texts(product: Product, { forceLocale, }: {
|
|
83
|
+
forceLocale?: string;
|
|
84
|
+
}, requestContext: Context): Promise<import("@unchainedshop/types/products.js").ProductText>;
|
|
85
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlanProduct } from './product-plan-types.js';
|
|
2
2
|
export const SimpleProduct = {
|
|
3
3
|
...PlanProduct,
|
|
4
|
-
|
|
4
|
+
async simulatedDispatches(obj, params, requestContext) {
|
|
5
5
|
const { deliveryProviderType, referenceDate, quantity } = params;
|
|
6
6
|
const { modules } = requestContext;
|
|
7
7
|
const deliveryProviders = await modules.delivery.findProviders({
|
|
@@ -30,7 +30,7 @@ export const SimpleProduct = {
|
|
|
30
30
|
return result.concat(result, mappedWarehousingProviders);
|
|
31
31
|
}, Promise.resolve([]));
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
async simulatedStocks(obj, params, requestContext) {
|
|
34
34
|
const { modules } = requestContext;
|
|
35
35
|
const { referenceDate, deliveryProviderType } = params;
|
|
36
36
|
const deliveryProviders = await modules.delivery.findProviders({
|
|
@@ -58,13 +58,13 @@ export const SimpleProduct = {
|
|
|
58
58
|
return result.concat(result, mappedWarehousingProviders);
|
|
59
59
|
}, Promise.resolve([]));
|
|
60
60
|
},
|
|
61
|
-
baseUnit
|
|
62
|
-
return
|
|
61
|
+
baseUnit({ warehousing }) {
|
|
62
|
+
return warehousing?.baseUnit;
|
|
63
63
|
},
|
|
64
|
-
sku
|
|
65
|
-
return
|
|
64
|
+
sku({ warehousing }) {
|
|
65
|
+
return warehousing?.sku;
|
|
66
66
|
},
|
|
67
|
-
dimensions
|
|
67
|
+
dimensions({ supply }) {
|
|
68
68
|
if (!supply)
|
|
69
69
|
return null;
|
|
70
70
|
const { weightInGram, heightInMillimeters, lengthInMillimeters, widthInMillimeters } = supply;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-simple-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-simple-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-simple-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-simple-types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,WAAW;IAEd,KAAK,CAAC,mBAAmB,CACvB,GAAY,EACZ,MAA6F,EAC7F,cAAuB;QAUvB,MAAM,EAAE,oBAAoB,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QACjE,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QAEnC,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC7D,IAAI,EAAE,oBAAoB;SAC3B,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE;YACpE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC;YAE/B,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,aAAa,CAClE;gBACE,OAAO,EAAE,GAAG;gBACZ,gBAAgB;aACjB,EACD,cAAc,CACf,CAAC;YAEF,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,GAAG,CAClD,oBAAoB,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE;gBACrD,MAAM,kBAAkB,GAAuB;oBAC7C,gBAAgB;oBAChB,OAAO,EAAE,GAAG;oBACZ,QAAQ;oBACR,aAAa;iBACd,CAAC;gBAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAC1D,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,CACf,CAAC;gBAEF,OAAO;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