@unchainedshop/api 4.4.0 → 4.6.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/README.md +204 -0
- package/lib/api-index.js +3 -0
- package/lib/chat/generateImageHandler.d.ts +7 -1
- package/lib/chat/generateImageHandler.js +4 -5
- package/lib/context.js +2 -13
- package/lib/errors.d.ts +1 -0
- package/lib/errors.js +2 -1
- package/lib/events.js +0 -2
- package/lib/express/chatHandler.js +4 -4
- package/lib/express/createERCMetadataMiddleware.js +1 -1
- package/lib/express/index.js +23 -9
- package/lib/fastify/chatHandler.js +4 -4
- package/lib/fastify/ercMetadataHandler.js +1 -1
- package/lib/fastify/index.js +9 -3
- package/lib/loaders/assortmentMediaTextLoader.js +1 -1
- package/lib/loaders/assortmentMediasLoader.js +1 -1
- package/lib/loaders/assortmentTextLoader.js +1 -1
- package/lib/loaders/countryLoader.js +1 -1
- package/lib/loaders/currencyLoader.js +1 -1
- package/lib/loaders/deliveryProviderLoader.js +1 -1
- package/lib/loaders/fileLoader.js +1 -1
- package/lib/loaders/filterTextLoader.js +1 -1
- package/lib/loaders/languageLoader.js +1 -1
- package/lib/loaders/orderLoader.js +1 -1
- package/lib/loaders/paymentProviderLoader.js +1 -1
- package/lib/loaders/productBySKULoader.js +2 -4
- package/lib/loaders/productLoader.js +1 -3
- package/lib/loaders/productMediaTextLoader.js +1 -1
- package/lib/loaders/productMediasLoader.js +1 -1
- package/lib/loaders/productProxiesLoader.js +2 -10
- package/lib/loaders/productTextLoader.js +1 -1
- package/lib/loaders/productVariationByKeyLoader.js +1 -1
- package/lib/loaders/productVariationLoader.js +1 -1
- package/lib/loaders/productVariationTextLoader.js +1 -1
- package/lib/loaders/quotationLoader.js +1 -1
- package/lib/loaders/userLoader.js +1 -1
- package/lib/loaders/warehousingProviderLoader.js +1 -1
- package/lib/mcp/tools/assortment/handlers/addAssortmentFilter.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/addAssortmentLink.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/addAssortmentMedia.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/addAssortmentProduct.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/createAssortment.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/getAssortment.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/getAssortmentChildren.d.ts +0 -2
- package/lib/mcp/tools/assortment/handlers/getAssortmentFilters.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/getAssortmentLinks.d.ts +0 -2
- package/lib/mcp/tools/assortment/handlers/getAssortmentMedia.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/getAssortmentProducts.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/index.d.ts +0 -2
- package/lib/mcp/tools/assortment/handlers/index.js +0 -2
- package/lib/mcp/tools/assortment/handlers/listAssortments.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/reorderAssortmentLinks.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/searchAssortmentProducts.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/updateAssortment.d.ts +0 -1
- package/lib/mcp/tools/assortment/handlers/updateAssortmentStatus.d.ts +0 -1
- package/lib/mcp/tools/assortment/schemas.d.ts +0 -5
- package/lib/mcp/tools/assortment/schemas.js +0 -4
- package/lib/mcp/tools/order/handlers/confirmOrder.d.ts +1 -1
- package/lib/mcp/tools/order/handlers/deliverOrder.d.ts +1 -1
- package/lib/mcp/tools/order/handlers/getOrder.d.ts +1 -1
- package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +6 -6
- package/lib/mcp/tools/order/handlers/getTopCustomers.js +5 -55
- package/lib/mcp/tools/order/handlers/getTopProducts.d.ts +3 -3
- package/lib/mcp/tools/order/handlers/getTopProducts.js +4 -43
- package/lib/mcp/tools/order/handlers/getUserCart.d.ts +1 -1
- package/lib/mcp/tools/order/handlers/listOrders.d.ts +1 -1
- package/lib/mcp/tools/order/handlers/payOrder.d.ts +1 -1
- package/lib/mcp/tools/order/handlers/rejectOrder.d.ts +1 -1
- package/lib/mcp/tools/provider/handlers/listProviders.js +4 -8
- package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +2 -2
- package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +2 -2
- package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +2 -2
- package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +2 -2
- package/lib/mcp/tools/quotation/handlers/rejectQuotation.js +1 -1
- package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +2 -2
- package/lib/mcp/tools/quotation/index.js +1 -1
- package/lib/mcp/tools/quotation/schemas.d.ts +5 -5
- package/lib/mcp/tools/quotation/schemas.js +3 -3
- package/lib/mcp/tools/system/schemas.d.ts +6 -6
- package/lib/mcp/tools/system/schemas.js +14 -7
- package/lib/mcp/tools/users/handlers/addUserEmail.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/createUser.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/enrollUser.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/getUser.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/getUserOrders.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/getUserQuotations.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/listUsers.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/setUserTags.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +1 -1
- package/lib/mcp/tools/users/handlers/updateUser.d.ts +1 -1
- package/lib/mcp/utils/getNormalizedAssortmentDetails.d.ts +0 -1
- package/lib/mcp/utils/getNormalizedOrderDetails.d.ts +1 -1
- package/lib/mcp/utils/getNormalizedQuotationDetails.d.ts +2 -2
- package/lib/mcp/utils/getNormalizedUserDetails.d.ts +1 -1
- package/lib/mongo-store.d.ts +9 -5
- package/lib/mongo-store.js +31 -25
- package/lib/resolvers/mutations/accounts/addWeb3Address.d.ts +2 -2
- package/lib/resolvers/mutations/accounts/addWeb3Address.js +1 -14
- package/lib/resolvers/mutations/accounts/addWebAuthnCredentials.d.ts +2 -2
- package/lib/resolvers/mutations/accounts/addWebAuthnCredentials.js +2 -6
- package/lib/resolvers/mutations/accounts/createUser.js +3 -1
- package/lib/resolvers/mutations/accounts/createWebAuthnCredentialCreationOptions.d.ts +1 -4
- package/lib/resolvers/mutations/accounts/createWebAuthnCredentialRequestOptions.d.ts +1 -4
- package/lib/resolvers/mutations/accounts/forgotPassword.js +4 -4
- package/lib/resolvers/mutations/accounts/loginAsGuest.js +1 -3
- package/lib/resolvers/mutations/accounts/removeWeb3Address.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/removeWeb3Address.js +3 -7
- package/lib/resolvers/mutations/accounts/removeWebAuthnCredentials.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/removeWebAuthnCredentials.js +1 -5
- package/lib/resolvers/mutations/accounts/verifyWeb3Address.d.ts +2 -2
- package/lib/resolvers/mutations/accounts/verifyWeb3Address.js +8 -89
- package/lib/resolvers/mutations/filters/removeFilter.d.ts +2 -2
- package/lib/resolvers/mutations/filters/removeFilter.js +3 -5
- package/lib/resolvers/mutations/index.d.ts +0 -1
- package/lib/resolvers/mutations/index.js +0 -2
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.js +23 -31
- package/lib/resolvers/mutations/orders/removeCartDiscount.d.ts +2 -2
- package/lib/resolvers/mutations/orders/removeCartDiscount.js +9 -14
- package/lib/resolvers/mutations/orders/updateCart.js +2 -8
- package/lib/resolvers/mutations/quotations/rejectQuotation.js +1 -1
- package/lib/resolvers/mutations/users/removeUser.d.ts +1 -1
- package/lib/resolvers/mutations/users/removeUser.js +2 -3
- package/lib/resolvers/mutations/warehousing/exportToken.js +9 -17
- package/lib/resolvers/queries/payment/paymentProvidersCount.d.ts +3 -3
- package/lib/resolvers/queries/payment/paymentProvidersCount.js +1 -1
- package/lib/resolvers/queries/shopInfo.js +4 -36
- package/lib/resolvers/type/delivery-provider-interface.d.ts +1 -7
- package/lib/resolvers/type/delivery-provider-interface.js +10 -20
- package/lib/resolvers/type/delivery-provider-pickup-types.d.ts +1 -7
- package/lib/resolvers/type/delivery-provider-shipping-types.d.ts +1 -7
- package/lib/resolvers/type/delivery-provider-types.d.ts +1 -7
- package/lib/resolvers/type/index.d.ts +33 -54
- package/lib/resolvers/type/media-types.d.ts +1 -1
- package/lib/resolvers/type/media-types.js +7 -5
- package/lib/resolvers/type/order/order-item-types.d.ts +2 -9
- package/lib/resolvers/type/order/order-item-types.js +2 -37
- package/lib/resolvers/type/order/order-statistics-types.d.ts +10 -10
- package/lib/resolvers/type/order/order-statistics-types.js +10 -64
- package/lib/resolvers/type/payment/payment-provider-types.d.ts +1 -7
- package/lib/resolvers/type/payment/payment-provider-types.js +7 -17
- package/lib/resolvers/type/price-types.d.ts +0 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +9 -32
- package/lib/resolvers/type/product/product-plan-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-types.js +7 -17
- package/lib/resolvers/type/shop-types.js +2 -5
- package/lib/resolvers/type/token-types.d.ts +3 -3
- package/lib/resolvers/type/token-types.js +4 -25
- package/lib/resolvers/type/user-types.js +1 -4
- package/lib/resolvers/type/webauthn-credentials-types.d.ts +10 -1
- package/lib/roles/index.d.ts +2 -1
- package/lib/roles/index.js +7 -1
- package/lib/schema/mutation.js +1 -7
- package/lib/schema/types/assortment.js +0 -1
- package/lib/schema/types/order/order.js +2 -2
- package/lib/schema/types/quotation.js +2 -2
- package/lib/utils/getConfiguredTags.d.ts +1 -0
- package/lib/utils/getConfiguredTags.js +9 -0
- package/package.json +14 -23
- package/lib/mcp/tools/assortment/handlers/setAssortmentBase.d.ts +0 -28
- package/lib/mcp/tools/assortment/handlers/setAssortmentBase.js +0 -11
- package/lib/resolvers/mutations/assortments/setBaseAssortment.d.ts +0 -4
- package/lib/resolvers/mutations/assortments/setBaseAssortment.js +0 -11
|
@@ -50,23 +50,13 @@ export const Product = {
|
|
|
50
50
|
async reviewsCount(product, params, { modules }) {
|
|
51
51
|
return modules.products.reviews.count({ ...params, productId: product._id });
|
|
52
52
|
},
|
|
53
|
-
async siblings(product, params, {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
:
|
|
59
|
-
|
|
60
|
-
return [];
|
|
61
|
-
const productIds = await modules.assortments.products.findSiblings({
|
|
62
|
-
productId,
|
|
63
|
-
assortmentIds,
|
|
64
|
-
});
|
|
65
|
-
return modules.products.findProducts({
|
|
66
|
-
productIds,
|
|
67
|
-
includeDrafts: includeInactive,
|
|
68
|
-
limit,
|
|
69
|
-
offset,
|
|
53
|
+
async siblings(product, params, { services }) {
|
|
54
|
+
return services.products.findProductSiblings({
|
|
55
|
+
product,
|
|
56
|
+
assortmentId: params.assortmentId,
|
|
57
|
+
limit: params.limit,
|
|
58
|
+
offset: params.offset,
|
|
59
|
+
includeInactive: params.includeInactive,
|
|
70
60
|
});
|
|
71
61
|
},
|
|
72
62
|
status(product, _, { modules }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkAction } from "../../acl.js";
|
|
2
|
-
import {
|
|
2
|
+
import { actions, getPublicRoles } from "../../roles/index.js";
|
|
3
3
|
export const Shop = {
|
|
4
4
|
_id() {
|
|
5
5
|
return 'root';
|
|
@@ -12,9 +12,6 @@ export const Shop = {
|
|
|
12
12
|
},
|
|
13
13
|
userRoles: async (_root, _params, context) => {
|
|
14
14
|
await checkAction(context, actions.manageUsers);
|
|
15
|
-
return
|
|
16
|
-
.map((i) => i?.name)
|
|
17
|
-
.filter(Boolean)
|
|
18
|
-
.filter((name) => name.substring(0, 2) !== '__');
|
|
15
|
+
return getPublicRoles();
|
|
19
16
|
},
|
|
20
17
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Context } from '../../context.ts';
|
|
2
|
-
import {
|
|
2
|
+
import type { TokenSurrogate } from '@unchainedshop/core-warehousing';
|
|
3
3
|
export declare const Token: {
|
|
4
4
|
product: (token: TokenSurrogate, params: never, { loaders }: Context) => Promise<import("@unchainedshop/core-products").Product>;
|
|
5
5
|
user: (token: TokenSurrogate, params: never, { loaders }: Context) => Promise<import("@unchainedshop/core-users").User | null>;
|
|
6
|
-
status: (token: TokenSurrogate, params: never, {
|
|
6
|
+
status: (token: TokenSurrogate, params: never, { services }: Context) => Promise<import("@unchainedshop/core-warehousing").TokenStatus>;
|
|
7
7
|
ercMetadata: (token: TokenSurrogate, { forceLocale }: {
|
|
8
8
|
forceLocale: string;
|
|
9
9
|
}, context: Context) => Promise<any>;
|
|
10
|
-
isInvalidateable: (token: TokenSurrogate, _params: never,
|
|
10
|
+
isInvalidateable: (token: TokenSurrogate, _params: never, { services }: Context) => Promise<boolean>;
|
|
11
11
|
accessKey: (token: TokenSurrogate, params: never, requestContext: Context) => Promise<string | null>;
|
|
12
12
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { TokenStatus, WarehousingProviderType, } from '@unchainedshop/core-warehousing';
|
|
2
|
-
import { WorkStatus } from '@unchainedshop/core-worker';
|
|
3
1
|
import { checkAction } from "../../acl.js";
|
|
4
2
|
import { actions } from "../../roles/index.js";
|
|
5
|
-
import { WarehousingDirector } from '@unchainedshop/core';
|
|
6
3
|
export const Token = {
|
|
7
4
|
product: async (token, params, { loaders }) => {
|
|
8
5
|
return loaders.productLoader.load({ productId: token.productId });
|
|
@@ -12,17 +9,8 @@ export const Token = {
|
|
|
12
9
|
return null;
|
|
13
10
|
return loaders.userLoader.load({ userId: token.userId });
|
|
14
11
|
},
|
|
15
|
-
status: async (token, params, {
|
|
16
|
-
|
|
17
|
-
return TokenStatus.DECENTRALIZED;
|
|
18
|
-
}
|
|
19
|
-
const workItems = await modules.worker.findWorkQueue({
|
|
20
|
-
types: ['EXPORT_TOKEN'],
|
|
21
|
-
status: [WorkStatus.NEW, WorkStatus.ALLOCATED],
|
|
22
|
-
});
|
|
23
|
-
if (workItems.find((item) => item.input?.token?._id === token._id))
|
|
24
|
-
return TokenStatus.EXPORTING;
|
|
25
|
-
return TokenStatus.CENTRALIZED;
|
|
12
|
+
status: async (token, params, { services }) => {
|
|
13
|
+
return services.warehousing.resolveTokenStatus({ token });
|
|
26
14
|
},
|
|
27
15
|
ercMetadata: async (token, { forceLocale }, context) => {
|
|
28
16
|
const { loaders, services } = context;
|
|
@@ -33,17 +21,8 @@ export const Token = {
|
|
|
33
21
|
locale: forceLocale ? new Intl.Locale(forceLocale) : context.locale,
|
|
34
22
|
});
|
|
35
23
|
},
|
|
36
|
-
isInvalidateable: async (token, _params,
|
|
37
|
-
|
|
38
|
-
const product = await loaders.productLoader.load({ productId: token.productId });
|
|
39
|
-
const virtualProviders = (await context.modules.warehousing.allProviders()).filter(({ type }) => type === WarehousingProviderType.VIRTUAL);
|
|
40
|
-
const isInvalidateable = await WarehousingDirector.isInvalidateable(virtualProviders, {
|
|
41
|
-
token,
|
|
42
|
-
product,
|
|
43
|
-
quantity: token?.quantity || 1,
|
|
44
|
-
referenceDate: new Date(),
|
|
45
|
-
}, context);
|
|
46
|
-
return !!isInvalidateable;
|
|
24
|
+
isInvalidateable: async (token, _params, { services }) => {
|
|
25
|
+
return services.warehousing.isTokenInvalidateable({ token });
|
|
47
26
|
},
|
|
48
27
|
accessKey: async (token, params, requestContext) => {
|
|
49
28
|
const { modules } = requestContext;
|
|
@@ -2,9 +2,6 @@ import { Roles, permissions } from '@unchainedshop/roles';
|
|
|
2
2
|
import { checkAction, checkTypeResolver } from "../../acl.js";
|
|
3
3
|
import { actions } from "../../roles/index.js";
|
|
4
4
|
const { viewUserPrivateInfos, viewUserPublicInfos, viewUserOrders, viewUserEnrollments, viewUserQuotations, viewUserProductReviews, } = actions;
|
|
5
|
-
const getPrimaryEmail = (user) => {
|
|
6
|
-
return (user.emails || []).toSorted((left, right) => Number(right.verified) - Number(left.verified))?.[0];
|
|
7
|
-
};
|
|
8
5
|
export const User = {
|
|
9
6
|
_id: checkTypeResolver(viewUserPublicInfos, '_id'),
|
|
10
7
|
created: checkTypeResolver(viewUserPrivateInfos, 'created'),
|
|
@@ -27,7 +24,7 @@ export const User = {
|
|
|
27
24
|
},
|
|
28
25
|
primaryEmail: async (user, params, context) => {
|
|
29
26
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
30
|
-
return
|
|
27
|
+
return context.modules.users.primaryEmail(user);
|
|
31
28
|
},
|
|
32
29
|
isInitialPassword: async (user, params, context) => {
|
|
33
30
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
@@ -23,5 +23,14 @@ export declare const WebAuthnCredentials: {
|
|
|
23
23
|
aaguid: string;
|
|
24
24
|
counter: number;
|
|
25
25
|
mdsMetadata: any;
|
|
26
|
-
}, _: never, { modules }: Context): Promise<
|
|
26
|
+
}, _: never, { modules }: Context): Promise<{
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
description?: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
authenticatorGetInfo?: {
|
|
31
|
+
versions?: string[];
|
|
32
|
+
extensions?: string[];
|
|
33
|
+
options?: Record<string, boolean>;
|
|
34
|
+
};
|
|
35
|
+
} | null>;
|
|
27
36
|
};
|
package/lib/roles/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ declare const configureRoles: ({ additionalRoles, additionalActions, }: {
|
|
|
12
12
|
LOGGEDIN: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
13
13
|
ALL: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
declare const getPublicRoles: () => string[];
|
|
16
|
+
export { allRoles, actions, configureRoles, getPublicRoles };
|
package/lib/roles/index.js
CHANGED
|
@@ -137,4 +137,10 @@ const configureRoles = ({ additionalRoles, additionalActions, }) => {
|
|
|
137
137
|
admin(allRoles.ADMIN, actions);
|
|
138
138
|
return allRoles;
|
|
139
139
|
};
|
|
140
|
-
|
|
140
|
+
const getPublicRoles = () => {
|
|
141
|
+
return Object.values(allRoles)
|
|
142
|
+
.map((role) => role?.name)
|
|
143
|
+
.filter(Boolean)
|
|
144
|
+
.filter((name) => !name.startsWith('__'));
|
|
145
|
+
};
|
|
146
|
+
export { allRoles, actions, configureRoles, getPublicRoles };
|
package/lib/schema/mutation.js
CHANGED
|
@@ -627,12 +627,6 @@ export default [
|
|
|
627
627
|
"""
|
|
628
628
|
updateAssortment(assortment: UpdateAssortmentInput!, assortmentId: ID!): Assortment!
|
|
629
629
|
|
|
630
|
-
"""
|
|
631
|
-
Makes the assortment provided as the base assortment and make
|
|
632
|
-
any other existing base assortment regular assortments.
|
|
633
|
-
"""
|
|
634
|
-
setBaseAssortment(assortmentId: ID!): Assortment!
|
|
635
|
-
|
|
636
630
|
"""
|
|
637
631
|
Removes assortment with the provided ID
|
|
638
632
|
"""
|
|
@@ -789,7 +783,7 @@ export default [
|
|
|
789
783
|
verifyQuotation(quotationId: ID!, quotationContext: JSON): Quotation!
|
|
790
784
|
|
|
791
785
|
"""
|
|
792
|
-
Reject an RFP, this is possible as long as a quotation is not
|
|
786
|
+
Reject an RFP, this is possible as long as a quotation is not fulfilled
|
|
793
787
|
"""
|
|
794
788
|
rejectQuotation(quotationId: ID!, quotationContext: JSON): Quotation!
|
|
795
789
|
|
|
@@ -24,7 +24,7 @@ export default [
|
|
|
24
24
|
"""
|
|
25
25
|
Order has been fulfilled completely (all positions in delivery)
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
FULFILLED
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
enum OrderPriceCategory {
|
|
@@ -69,7 +69,7 @@ export default [
|
|
|
69
69
|
delivery: OrderDelivery
|
|
70
70
|
discounts: [OrderDiscount!]
|
|
71
71
|
enrollment: Enrollment
|
|
72
|
-
|
|
72
|
+
fulfilled: DateTime
|
|
73
73
|
items: [OrderItem!]
|
|
74
74
|
ordered: DateTime
|
|
75
75
|
orderNumber: String
|
|
@@ -24,7 +24,7 @@ export default [
|
|
|
24
24
|
"""
|
|
25
25
|
Quotation has been used to order the product
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
FULFILLED
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
enum QuotationDocumentType {
|
|
@@ -52,7 +52,7 @@ export default [
|
|
|
52
52
|
updated: DateTime
|
|
53
53
|
isExpired(referenceDate: Timestamp): Boolean
|
|
54
54
|
quotationNumber: String
|
|
55
|
-
|
|
55
|
+
fulfilled: DateTime
|
|
56
56
|
rejected: DateTime
|
|
57
57
|
country: Country
|
|
58
58
|
currency: Currency
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getConfiguredTags(existingTagsFn: () => Promise<string[]>, envVar: string, configDefault: string[] | undefined): Promise<string[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export async function getConfiguredTags(existingTagsFn, envVar, configDefault) {
|
|
2
|
+
const existingTags = await existingTagsFn();
|
|
3
|
+
const envTags = (process.env[envVar] || '')
|
|
4
|
+
.split(',')
|
|
5
|
+
.map((t) => t.trim())
|
|
6
|
+
.filter(Boolean);
|
|
7
|
+
const normalizedDefaultTags = envTags?.length ? envTags : (configDefault || []).filter(Boolean);
|
|
8
|
+
return Array.from(new Set(normalizedDefaultTags.concat(existingTags)));
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/api",
|
|
3
|
-
"
|
|
3
|
+
"description": "GraphQL API layer for the Unchained Engine with Express/Fastify adapters and MCP server",
|
|
4
|
+
"version": "4.6.0",
|
|
4
5
|
"main": "lib/api-index.js",
|
|
5
6
|
"types": "lib/api-index.d.ts",
|
|
6
7
|
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
9
11
|
"import": "./lib/api-index.js",
|
|
@@ -58,15 +60,13 @@
|
|
|
58
60
|
},
|
|
59
61
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
60
62
|
"peerDependencies": {
|
|
61
|
-
"@ai-sdk/mcp": "^
|
|
63
|
+
"@ai-sdk/mcp": "^1",
|
|
62
64
|
"@fastify/cookie": ">= 11 < 12",
|
|
63
65
|
"@fastify/multipart": ">= 9 < 10",
|
|
64
66
|
"@fastify/session": ">= 11 < 12",
|
|
65
|
-
"@fastify/static": ">=
|
|
67
|
+
"@fastify/static": ">= 9 < 10",
|
|
66
68
|
"@modelcontextprotocol/sdk": ">= 1 < 2",
|
|
67
|
-
"
|
|
68
|
-
"@noble/hashes": "^2.0.0",
|
|
69
|
-
"ai": ">= 5 < 6",
|
|
69
|
+
"ai": ">= 6 < 7",
|
|
70
70
|
"express": ">= 5 < 6",
|
|
71
71
|
"express-session": ">= 1.18 < 2",
|
|
72
72
|
"fastify": ">= 5.2 < 6",
|
|
@@ -113,41 +113,32 @@
|
|
|
113
113
|
},
|
|
114
114
|
"passport": {
|
|
115
115
|
"optional": true
|
|
116
|
-
},
|
|
117
|
-
"@noble/curves": {
|
|
118
|
-
"optional": true
|
|
119
|
-
},
|
|
120
|
-
"@noble/hashes": {
|
|
121
|
-
"optional": true
|
|
122
116
|
}
|
|
123
117
|
},
|
|
124
118
|
"dependencies": {
|
|
125
|
-
"@unchainedshop/core": "^4.
|
|
126
|
-
"@unchainedshop/events": "^4.
|
|
127
|
-
"@unchainedshop/logger": "^4.
|
|
128
|
-
"@unchainedshop/roles": "^4.
|
|
129
|
-
"@unchainedshop/utils": "^4.
|
|
119
|
+
"@unchainedshop/core": "^4.6.0",
|
|
120
|
+
"@unchainedshop/events": "^4.6.0",
|
|
121
|
+
"@unchainedshop/logger": "^4.6.0",
|
|
122
|
+
"@unchainedshop/roles": "^4.6.0",
|
|
123
|
+
"@unchainedshop/utils": "^4.6.0",
|
|
130
124
|
"dataloader": "^2.2.3",
|
|
131
125
|
"expiry-map": "^2.0.0",
|
|
132
126
|
"graphql-scalars": "^1.24.2",
|
|
133
127
|
"mime": ">= 4 < 5",
|
|
134
|
-
"moniker": "0.1.2",
|
|
135
128
|
"p-memoize": "^8.0.0",
|
|
136
129
|
"zod": "^3.25.76 || ^4"
|
|
137
130
|
},
|
|
138
131
|
"devDependencies": {
|
|
139
|
-
"@ai-sdk/mcp": "^0.
|
|
132
|
+
"@ai-sdk/mcp": "^1.0.5",
|
|
140
133
|
"@fastify/cookie": "^11.0.2",
|
|
141
134
|
"@fastify/multipart": "^9.0.3",
|
|
142
135
|
"@fastify/session": "^11.1.0",
|
|
143
|
-
"@fastify/static": "^
|
|
136
|
+
"@fastify/static": "^9.0.0",
|
|
144
137
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
145
|
-
"@noble/curves": "^2.0.0",
|
|
146
|
-
"@noble/hashes": "^2.0.0",
|
|
147
138
|
"@types/express": "^5.0.3",
|
|
148
139
|
"@types/express-session": "^1.18.2",
|
|
149
140
|
"@types/node": "^25.0.0",
|
|
150
|
-
"ai": "^
|
|
141
|
+
"ai": "^6.0.14",
|
|
151
142
|
"express": "^5.1.0",
|
|
152
143
|
"express-session": "^1.18.1",
|
|
153
144
|
"fastify": "^5.4.0",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Context } from '../../../../context.ts';
|
|
2
|
-
import type { Params } from '../schemas.ts';
|
|
3
|
-
export default function setAssortmentBase(context: Context, params: Params<'SET_BASE'>): Promise<{
|
|
4
|
-
assortment: {
|
|
5
|
-
texts: import("@unchainedshop/core-assortments").AssortmentText;
|
|
6
|
-
media: {
|
|
7
|
-
mediaId: string;
|
|
8
|
-
}[] | ({
|
|
9
|
-
file: any;
|
|
10
|
-
mediaId: string;
|
|
11
|
-
} | null)[];
|
|
12
|
-
childrenCount: number;
|
|
13
|
-
filters: import("@unchainedshop/core-assortments").AssortmentFilter[];
|
|
14
|
-
links: import("@unchainedshop/core-assortments").AssortmentLink[];
|
|
15
|
-
products: import("@unchainedshop/core-assortments").AssortmentProduct[];
|
|
16
|
-
isActive: boolean;
|
|
17
|
-
isBase: boolean;
|
|
18
|
-
isRoot: boolean;
|
|
19
|
-
meta?: any;
|
|
20
|
-
sequence: number;
|
|
21
|
-
slugs?: string[] | undefined;
|
|
22
|
-
tags: string[];
|
|
23
|
-
created: Date;
|
|
24
|
-
updated?: Date | undefined;
|
|
25
|
-
deleted?: (Date | null) | undefined;
|
|
26
|
-
_id: string;
|
|
27
|
-
} | null;
|
|
28
|
-
}>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AssortmentNotFoundError } from "../../../../errors.js";
|
|
2
|
-
import { getNormalizedAssortmentDetails } from "../../../utils/getNormalizedAssortmentDetails.js";
|
|
3
|
-
export default async function setAssortmentBase(context, params) {
|
|
4
|
-
const { modules } = context;
|
|
5
|
-
const { assortmentId } = params;
|
|
6
|
-
const existingAssortment = await modules.assortments.findAssortment({ assortmentId });
|
|
7
|
-
if (!existingAssortment)
|
|
8
|
-
throw new AssortmentNotFoundError({ assortmentId });
|
|
9
|
-
await modules.assortments.setBase(assortmentId);
|
|
10
|
-
return { assortment: await getNormalizedAssortmentDetails({ assortmentId }, context) };
|
|
11
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Context } from '../../../context.ts';
|
|
2
|
-
export default function setBaseAssortment(root: never, { assortmentId }: {
|
|
3
|
-
assortmentId: string;
|
|
4
|
-
}, { modules, userId }: Context): Promise<import("mongodb").WithId<import("@unchainedshop/core-assortments").Assortment> | null>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { AssortmentNotFoundError, InvalidIdError } from "../../../errors.js";
|
|
3
|
-
export default async function setBaseAssortment(root, { assortmentId }, { modules, userId }) {
|
|
4
|
-
log(`mutation setBaseAssortment ${assortmentId}`, { userId });
|
|
5
|
-
if (!assortmentId)
|
|
6
|
-
throw new InvalidIdError({ assortmentId });
|
|
7
|
-
if (!(await modules.assortments.assortmentExists({ assortmentId })))
|
|
8
|
-
throw new AssortmentNotFoundError({ assortmentId });
|
|
9
|
-
await modules.assortments.setBase(assortmentId);
|
|
10
|
-
return modules.assortments.findAssortment({ assortmentId });
|
|
11
|
-
}
|