@unchainedshop/api 4.5.0 → 4.6.1
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/chat/generateImageHandler.d.ts +7 -1
- package/lib/chat/generateImageHandler.js +4 -5
- 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/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 +1 -1
- package/lib/mcp/tools/order/handlers/getTopCustomers.js +1 -1
- package/lib/mcp/tools/order/handlers/getTopProducts.js +1 -1
- 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/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/forgotPassword.js +4 -4
- package/lib/resolvers/mutations/index.d.ts +0 -1
- package/lib/resolvers/mutations/index.js +0 -2
- 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 +1 -2
- package/lib/resolvers/type/order/order-statistics-types.js +2 -2
- 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/package.json +13 -12
- 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
package/lib/mongo-store.js
CHANGED
|
@@ -6,15 +6,15 @@ import { createLogger } from '@unchainedshop/logger';
|
|
|
6
6
|
const logger = createLogger('unchained:api');
|
|
7
7
|
const noop = () => { };
|
|
8
8
|
const unit = (a) => a;
|
|
9
|
-
function defaultSerializeFunction(
|
|
9
|
+
function defaultSerializeFunction(sessionData) {
|
|
10
10
|
const obj = {};
|
|
11
|
-
|
|
12
|
-
for (prop in session) {
|
|
11
|
+
for (const prop in sessionData) {
|
|
13
12
|
if (prop === 'cookie') {
|
|
14
|
-
|
|
13
|
+
const cookie = sessionData.cookie;
|
|
14
|
+
obj.cookie = cookie.toJSON ? cookie.toJSON() : sessionData.cookie;
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
obj[prop] =
|
|
17
|
+
obj[prop] = sessionData[prop];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return obj;
|
|
@@ -135,12 +135,15 @@ export default class MongoStore extends session.Store {
|
|
|
135
135
|
}
|
|
136
136
|
return util.promisify(this.crypto.get).bind(this.crypto);
|
|
137
137
|
}
|
|
138
|
-
async decryptSession(
|
|
139
|
-
if (this.crypto &&
|
|
140
|
-
const
|
|
141
|
-
|
|
138
|
+
async decryptSession(internalSession) {
|
|
139
|
+
if (this.crypto && internalSession) {
|
|
140
|
+
const encryptedData = typeof internalSession.session === 'string'
|
|
141
|
+
? internalSession.session
|
|
142
|
+
: JSON.stringify(internalSession.session);
|
|
143
|
+
const plaintext = await this.cryptoGet(this.options.crypto.secret, encryptedData).catch((err) => {
|
|
144
|
+
throw new Error(err.message);
|
|
142
145
|
});
|
|
143
|
-
|
|
146
|
+
internalSession.session = JSON.parse(plaintext);
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
get(sid, callback) {
|
|
@@ -148,16 +151,17 @@ export default class MongoStore extends session.Store {
|
|
|
148
151
|
try {
|
|
149
152
|
logger.debug(`MongoStore#get=${sid}`);
|
|
150
153
|
const collection = await this.collectionP;
|
|
151
|
-
const
|
|
154
|
+
const internalSession = await collection.findOne({
|
|
152
155
|
_id: this.computeStorageId(sid),
|
|
153
156
|
$or: [{ expires: { $exists: false } }, { expires: { $gt: new Date() } }],
|
|
154
157
|
});
|
|
155
|
-
if (this.crypto &&
|
|
156
|
-
await this.decryptSession(
|
|
158
|
+
if (this.crypto && internalSession) {
|
|
159
|
+
await this.decryptSession(internalSession).catch((err) => callback(err));
|
|
157
160
|
}
|
|
158
|
-
const s =
|
|
159
|
-
if (this.options.touchAfter > 0 &&
|
|
160
|
-
s.lastModified =
|
|
161
|
+
const s = internalSession && this.transformFunctions.unserialize(internalSession.session);
|
|
162
|
+
if (this.options.touchAfter > 0 && internalSession?.lastModified) {
|
|
163
|
+
s.lastModified =
|
|
164
|
+
internalSession.lastModified;
|
|
161
165
|
}
|
|
162
166
|
this.emit('get', sid);
|
|
163
167
|
callback(null, s === undefined ? null : s);
|
|
@@ -171,8 +175,9 @@ export default class MongoStore extends session.Store {
|
|
|
171
175
|
(async () => {
|
|
172
176
|
try {
|
|
173
177
|
logger.debug(`MongoStore#set=${sid}`);
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
const sessionWithMeta = session;
|
|
179
|
+
if (this.options.touchAfter > 0 && sessionWithMeta.lastModified) {
|
|
180
|
+
delete sessionWithMeta.lastModified;
|
|
176
181
|
}
|
|
177
182
|
const s = {
|
|
178
183
|
_id: this.computeStorageId(sid),
|
|
@@ -189,8 +194,9 @@ export default class MongoStore extends session.Store {
|
|
|
189
194
|
}
|
|
190
195
|
if (this.crypto) {
|
|
191
196
|
const cryptoSet = util.promisify(this.crypto.set).bind(this.crypto);
|
|
192
|
-
const
|
|
193
|
-
|
|
197
|
+
const sessionString = typeof s.session === 'string' ? s.session : JSON.stringify(s.session);
|
|
198
|
+
const data = await cryptoSet(this.options.crypto.secret, sessionString).catch((err) => {
|
|
199
|
+
throw new Error(err.message);
|
|
194
200
|
});
|
|
195
201
|
s.session = data;
|
|
196
202
|
}
|
|
@@ -255,15 +261,15 @@ export default class MongoStore extends session.Store {
|
|
|
255
261
|
try {
|
|
256
262
|
logger.debug('MongoStore#all()');
|
|
257
263
|
const collection = await this.collectionP;
|
|
258
|
-
const
|
|
264
|
+
const internalSessions = collection.find({
|
|
259
265
|
$or: [{ expires: { $exists: false } }, { expires: { $gt: new Date() } }],
|
|
260
266
|
});
|
|
261
267
|
const results = [];
|
|
262
|
-
for await (const
|
|
263
|
-
if (this.crypto &&
|
|
264
|
-
await this.decryptSession(
|
|
268
|
+
for await (const internalSession of internalSessions) {
|
|
269
|
+
if (this.crypto && internalSession) {
|
|
270
|
+
await this.decryptSession(internalSession);
|
|
265
271
|
}
|
|
266
|
-
results.push(this.transformFunctions.unserialize(
|
|
272
|
+
results.push(this.transformFunctions.unserialize(internalSession.session));
|
|
267
273
|
}
|
|
268
274
|
this.emit('all', results);
|
|
269
275
|
callback(null, results);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { UserNotFoundError } from "../../../errors.js";
|
|
3
2
|
export default async function forgotPassword(root, { email }, { modules, userId }) {
|
|
4
|
-
log('mutation forgotPassword', {
|
|
3
|
+
log('mutation forgotPassword', { userId });
|
|
5
4
|
const user = await modules.users.findUserByEmail(email);
|
|
6
|
-
if (!user)
|
|
7
|
-
|
|
5
|
+
if (!user) {
|
|
6
|
+
return { success: true };
|
|
7
|
+
}
|
|
8
8
|
try {
|
|
9
9
|
await modules.users.sendResetPasswordEmail(user._id, email);
|
|
10
10
|
return {
|
|
@@ -120,7 +120,6 @@ declare const _default: {
|
|
|
120
120
|
createAssortment: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
121
121
|
prepareAssortmentMediaUpload: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
122
122
|
updateAssortment: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
123
|
-
setBaseAssortment: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
124
123
|
removeAssortment: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
125
124
|
reorderAssortmentMedia: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
126
125
|
removeAssortmentMedia: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
@@ -98,7 +98,6 @@ import updateFilterTexts from "./filters/updateFilterTexts.js";
|
|
|
98
98
|
import removeFilterOption from "./filters/removeFilterOption.js";
|
|
99
99
|
import createAssortment from "./assortments/createAssortment.js";
|
|
100
100
|
import updateAssortment from "./assortments/updateAssortment.js";
|
|
101
|
-
import setBaseAssortment from "./assortments/setBaseAssortment.js";
|
|
102
101
|
import removeAssortment from "./assortments/removeAssortment.js";
|
|
103
102
|
import updateAssortmentTexts from "./assortments/updateAssortmentTexts.js";
|
|
104
103
|
import addAssortmentProduct from "./assortments/addAssortmentProduct.js";
|
|
@@ -278,7 +277,6 @@ export default {
|
|
|
278
277
|
createAssortment: acl(actions.manageAssortments)(createAssortment),
|
|
279
278
|
prepareAssortmentMediaUpload: acl(actions.manageAssortments)(prepareAssortmentMediaUpload),
|
|
280
279
|
updateAssortment: acl(actions.manageAssortments)(updateAssortment),
|
|
281
|
-
setBaseAssortment: acl(actions.manageAssortments)(setBaseAssortment),
|
|
282
280
|
removeAssortment: acl(actions.manageAssortments)(removeAssortment),
|
|
283
281
|
reorderAssortmentMedia: acl(actions.manageAssortments)(reorderAssortmentMedia),
|
|
284
282
|
removeAssortmentMedia: acl(actions.manageAssortments)(removeAssortmentMedia),
|
|
@@ -10,7 +10,7 @@ export default async function rejectQuotation(root, params, context) {
|
|
|
10
10
|
const quotation = await modules.quotations.findQuotation({ quotationId });
|
|
11
11
|
if (!quotation)
|
|
12
12
|
throw new QuotationNotFoundError({ quotationId });
|
|
13
|
-
if (quotation.status === QuotationStatus.
|
|
13
|
+
if (quotation.status === QuotationStatus.FULFILLED) {
|
|
14
14
|
throw new QuotationWrongStatusError({ status: quotation.status });
|
|
15
15
|
}
|
|
16
16
|
return services.quotations.rejectQuotation(quotation, transactionContext);
|
|
@@ -2,4 +2,4 @@ import type { Context } from '../../../context.ts';
|
|
|
2
2
|
export default function removeUser(root: never, params: {
|
|
3
3
|
userId: string;
|
|
4
4
|
removeUserReviews?: boolean;
|
|
5
|
-
},
|
|
5
|
+
}, { modules, services, userId: currentUserId }: Context): Promise<import("mongodb").WithId<import("@unchainedshop/core-users").User> | null>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { UserNotFoundError } from "../../../errors.js";
|
|
3
|
-
export default async function removeUser(root, params,
|
|
4
|
-
const { modules, services, userId: currentUserId } = unchainedAPI;
|
|
3
|
+
export default async function removeUser(root, params, { modules, services, userId: currentUserId }) {
|
|
5
4
|
const { userId: paramUserId, removeUserReviews = false } = params;
|
|
6
5
|
const normalizedUserId = paramUserId || currentUserId;
|
|
7
6
|
log(`mutation removeUser ${normalizedUserId}`, { userId: currentUserId });
|
|
@@ -3,10 +3,10 @@ export const OrderStatistics = {
|
|
|
3
3
|
checkoutCount: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.countByDateField('ordered', dateRange),
|
|
4
4
|
rejectCount: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.countByDateField('rejected', dateRange),
|
|
5
5
|
confirmCount: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.countByDateField('confirmed', dateRange),
|
|
6
|
-
fulfillCount: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.countByDateField('
|
|
6
|
+
fulfillCount: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.countByDateField('fulfilled', dateRange),
|
|
7
7
|
newRecords: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.aggregateByDateField('created', dateRange, { includeCarts: true }),
|
|
8
8
|
checkoutRecords: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.aggregateByDateField('ordered', dateRange),
|
|
9
9
|
rejectRecords: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.aggregateByDateField('rejected', dateRange),
|
|
10
10
|
confirmRecords: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.aggregateByDateField('confirmed', dateRange),
|
|
11
|
-
fulfilledRecords: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.aggregateByDateField('
|
|
11
|
+
fulfilledRecords: async ({ dateRange }, _p, { modules }) => modules.orders.statistics.aggregateByDateField('fulfilled', dateRange),
|
|
12
12
|
};
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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.1",
|
|
4
5
|
"main": "lib/api-index.js",
|
|
5
6
|
"types": "lib/api-index.d.ts",
|
|
6
7
|
"type": "module",
|
|
@@ -59,13 +60,13 @@
|
|
|
59
60
|
},
|
|
60
61
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
61
62
|
"peerDependencies": {
|
|
62
|
-
"@ai-sdk/mcp": "^
|
|
63
|
+
"@ai-sdk/mcp": "^1",
|
|
63
64
|
"@fastify/cookie": ">= 11 < 12",
|
|
64
65
|
"@fastify/multipart": ">= 9 < 10",
|
|
65
66
|
"@fastify/session": ">= 11 < 12",
|
|
66
|
-
"@fastify/static": ">=
|
|
67
|
+
"@fastify/static": ">= 9 < 10",
|
|
67
68
|
"@modelcontextprotocol/sdk": ">= 1 < 2",
|
|
68
|
-
"ai": ">=
|
|
69
|
+
"ai": ">= 6 < 7",
|
|
69
70
|
"express": ">= 5 < 6",
|
|
70
71
|
"express-session": ">= 1.18 < 2",
|
|
71
72
|
"fastify": ">= 5.2 < 6",
|
|
@@ -115,11 +116,11 @@
|
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
"dependencies": {
|
|
118
|
-
"@unchainedshop/core": "^4.
|
|
119
|
-
"@unchainedshop/events": "^4.
|
|
120
|
-
"@unchainedshop/logger": "^4.
|
|
121
|
-
"@unchainedshop/roles": "^4.
|
|
122
|
-
"@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",
|
|
123
124
|
"dataloader": "^2.2.3",
|
|
124
125
|
"expiry-map": "^2.0.0",
|
|
125
126
|
"graphql-scalars": "^1.24.2",
|
|
@@ -128,16 +129,16 @@
|
|
|
128
129
|
"zod": "^3.25.76 || ^4"
|
|
129
130
|
},
|
|
130
131
|
"devDependencies": {
|
|
131
|
-
"@ai-sdk/mcp": "^0.
|
|
132
|
+
"@ai-sdk/mcp": "^1.0.5",
|
|
132
133
|
"@fastify/cookie": "^11.0.2",
|
|
133
134
|
"@fastify/multipart": "^9.0.3",
|
|
134
135
|
"@fastify/session": "^11.1.0",
|
|
135
|
-
"@fastify/static": "^
|
|
136
|
+
"@fastify/static": "^9.0.0",
|
|
136
137
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
137
138
|
"@types/express": "^5.0.3",
|
|
138
139
|
"@types/express-session": "^1.18.2",
|
|
139
140
|
"@types/node": "^25.0.0",
|
|
140
|
-
"ai": "^
|
|
141
|
+
"ai": "^6.0.14",
|
|
141
142
|
"express": "^5.1.0",
|
|
142
143
|
"express-session": "^1.18.1",
|
|
143
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
|
-
}
|