@unchainedshop/api 3.1.12 → 3.1.13
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/errors.d.ts +1 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -0
- package/lib/errors.js.map +1 -1
- package/lib/express/chatRouter.d.ts +3 -0
- package/lib/express/chatRouter.d.ts.map +1 -0
- package/lib/express/chatRouter.js +86 -0
- package/lib/express/chatRouter.js.map +1 -0
- package/lib/express/createApolloMiddleware.d.ts +4 -0
- package/lib/express/createApolloMiddleware.d.ts.map +1 -0
- package/lib/express/createApolloMiddleware.js +36 -0
- package/lib/express/createApolloMiddleware.js.map +1 -0
- package/lib/express/createSingleSignOnMiddleware.d.ts +5 -0
- package/lib/express/createSingleSignOnMiddleware.d.ts.map +1 -0
- package/lib/express/createSingleSignOnMiddleware.js +71 -0
- package/lib/express/createSingleSignOnMiddleware.js.map +1 -0
- package/lib/hashPassword.d.ts +2 -0
- package/lib/hashPassword.d.ts.map +1 -0
- package/lib/hashPassword.js +5 -0
- package/lib/hashPassword.js.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.js +1 -1
- package/lib/loaders/assortmentMediaTextLoader.js.map +1 -1
- package/lib/loaders/assortmentTextLoader.js +1 -1
- package/lib/loaders/assortmentTextLoader.js.map +1 -1
- package/lib/loaders/filterTextLoader.js +1 -1
- package/lib/loaders/filterTextLoader.js.map +1 -1
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js.map +1 -1
- package/lib/loaders/productMediaTextLoader.d.ts.map +1 -1
- package/lib/loaders/productMediaTextLoader.js +1 -1
- package/lib/loaders/productMediaTextLoader.js.map +1 -1
- package/lib/loaders/productTextLoader.d.ts.map +1 -1
- package/lib/loaders/productTextLoader.js +1 -1
- package/lib/loaders/productTextLoader.js.map +1 -1
- package/lib/mcp/index.d.ts.map +1 -1
- package/lib/mcp/index.js +1 -1
- package/lib/mcp/index.js.map +1 -1
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts +52 -0
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts.map +1 -0
- package/lib/mcp/tools/addProductAssignmentHandler.js +97 -0
- package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -0
- package/lib/mcp/tools/countriesHandler.d.ts +60 -0
- package/lib/mcp/tools/countriesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/countriesHandler.js +48 -0
- package/lib/mcp/tools/countriesHandler.js.map +1 -0
- package/lib/mcp/tools/countryHandler.d.ts +20 -0
- package/lib/mcp/tools/countryHandler.d.ts.map +1 -0
- package/lib/mcp/tools/countryHandler.js +34 -0
- package/lib/mcp/tools/countryHandler.js.map +1 -0
- package/lib/mcp/tools/createProduct.d.ts +138 -0
- package/lib/mcp/tools/createProduct.d.ts.map +1 -0
- package/lib/mcp/tools/createProduct.js +60 -0
- package/lib/mcp/tools/createProduct.js.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts +84 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.js +67 -0
- package/lib/mcp/tools/createProductVariationHandler.js.map +1 -0
- package/lib/mcp/tools/currenciesHandler.d.ts +60 -0
- package/lib/mcp/tools/currenciesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/currenciesHandler.js +50 -0
- package/lib/mcp/tools/currenciesHandler.js.map +1 -0
- package/lib/mcp/tools/currencyHandler.d.ts +20 -0
- package/lib/mcp/tools/currencyHandler.d.ts.map +1 -0
- package/lib/mcp/tools/currencyHandler.js +34 -0
- package/lib/mcp/tools/currencyHandler.js.map +1 -0
- package/lib/mcp/tools/getProduct.d.ts +0 -3
- package/lib/mcp/tools/getProduct.d.ts.map +1 -1
- package/lib/mcp/tools/getProduct.js +0 -324
- package/lib/mcp/tools/getProduct.js.map +1 -1
- package/lib/mcp/tools/languageHandler.d.ts +20 -0
- package/lib/mcp/tools/languageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/languageHandler.js +31 -0
- package/lib/mcp/tools/languageHandler.js.map +1 -0
- package/lib/mcp/tools/languagesHandler.d.ts +60 -0
- package/lib/mcp/tools/languagesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/languagesHandler.js +42 -0
- package/lib/mcp/tools/languagesHandler.js.map +1 -0
- package/lib/mcp/tools/listProducts.d.ts.map +1 -1
- package/lib/mcp/tools/listProducts.js +0 -13
- package/lib/mcp/tools/listProducts.js.map +1 -1
- package/lib/mcp/tools/normalizeMediaUrl.d.ts +3 -0
- package/lib/mcp/tools/normalizeMediaUrl.d.ts.map +1 -0
- package/lib/mcp/tools/normalizeMediaUrl.js +21 -0
- package/lib/mcp/tools/normalizeMediaUrl.js.map +1 -0
- package/lib/mcp/tools/productsCountHandler.d.ts +32 -0
- package/lib/mcp/tools/productsCountHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productsCountHandler.js +33 -0
- package/lib/mcp/tools/productsCountHandler.js.map +1 -0
- package/lib/mcp/tools/publishProduct.d.ts +20 -0
- package/lib/mcp/tools/publishProduct.d.ts.map +1 -0
- package/lib/mcp/tools/publishProduct.js +40 -0
- package/lib/mcp/tools/publishProduct.js.map +1 -0
- package/lib/mcp/tools/removeProduct.d.ts +20 -0
- package/lib/mcp/tools/removeProduct.d.ts.map +1 -0
- package/lib/mcp/tools/removeProduct.js +34 -0
- package/lib/mcp/tools/removeProduct.js.map +1 -0
- package/lib/mcp/tools/removeProductVariationHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductVariationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductVariationHandler.js +43 -0
- package/lib/mcp/tools/removeProductVariationHandler.js.map +1 -0
- package/lib/mcp/tools/unPublishProduct.d.ts +20 -0
- package/lib/mcp/tools/unPublishProduct.d.ts.map +1 -0
- package/lib/mcp/tools/unPublishProduct.js +40 -0
- package/lib/mcp/tools/unPublishProduct.js.map +1 -0
- package/lib/mcp/tools/updateProduct.d.ts +56 -0
- package/lib/mcp/tools/updateProduct.d.ts.map +1 -0
- package/lib/mcp/tools/updateProduct.js +44 -0
- package/lib/mcp/tools/updateProduct.js.map +1 -0
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts +166 -0
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductCommerceHandler.js +64 -0
- package/lib/mcp/tools/updateProductCommerceHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductPlanHandler.d.ts +72 -0
- package/lib/mcp/tools/updateProductPlanHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductPlanHandler.js +51 -0
- package/lib/mcp/tools/updateProductPlanHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts +64 -0
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductSupplyHandler.js +52 -0
- package/lib/mcp/tools/updateProductSupplyHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductTextsHandler.d.ts +114 -0
- package/lib/mcp/tools/updateProductTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductTextsHandler.js +50 -0
- package/lib/mcp/tools/updateProductTextsHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts +72 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.js +49 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts +48 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.js +45 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.js.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts +26 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js +36 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -0
- package/lib/mcp/utils/normalizeMediaUrl.d.ts +3 -0
- package/lib/mcp/utils/normalizeMediaUrl.d.ts.map +1 -0
- package/lib/mcp/utils/normalizeMediaUrl.js +21 -0
- package/lib/mcp/utils/normalizeMediaUrl.js.map +1 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts +3 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js +6 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js.map +1 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.js +27 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.js +20 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts +7 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js +30 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js.map +1 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts +8 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js +25 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js.map +1 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +5 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js +20 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js +13 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js.map +1 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts +6 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts.map +1 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +18 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -0
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js +3 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/addProductMedia.d.ts +6 -0
- package/lib/resolvers/mutations/products/addProductMedia.d.ts.map +1 -0
- package/lib/resolvers/mutations/products/addProductMedia.js +18 -0
- package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts +6 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts.map +1 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.js +22 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -0
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts +7 -0
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts.map +1 -0
- package/lib/resolvers/mutations/utils/getOrderCart.js +13 -0
- package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -0
- package/lib/resolvers/type/dispatch-types.d.ts +15 -0
- package/lib/resolvers/type/dispatch-types.d.ts.map +1 -0
- package/lib/resolvers/type/dispatch-types.js +16 -0
- package/lib/resolvers/type/dispatch-types.js.map +1 -0
- package/lib/resolvers/type/oauth-account.d.ts +6 -0
- package/lib/resolvers/type/oauth-account.d.ts.map +1 -0
- package/lib/resolvers/type/oauth-account.js +7 -0
- package/lib/resolvers/type/oauth-account.js.map +1 -0
- package/lib/resolvers/type/oauth-provider.d.ts +6 -0
- package/lib/resolvers/type/oauth-provider.d.ts.map +1 -0
- package/lib/resolvers/type/oauth-provider.js +6 -0
- package/lib/resolvers/type/oauth-provider.js.map +1 -0
- package/lib/resolvers/type/stock-types.d.ts +14 -0
- package/lib/resolvers/type/stock-types.d.ts.map +1 -0
- package/lib/resolvers/type/stock-types.js +15 -0
- package/lib/resolvers/type/stock-types.js.map +1 -0
- package/lib/user-context.d.ts +7 -0
- package/lib/user-context.d.ts.map +1 -0
- package/lib/user-context.js +76 -0
- package/lib/user-context.js.map +1 -0
- package/package.json +13 -13
- package/src/errors.ts +5 -0
- package/src/loaders/buildLocaleMap.test.ts +14 -25
- package/src/loaders/buildLocaleMap.ts +1 -1
- package/src/loaders/buildTextMap.test.ts +9 -10
- package/src/loaders/index.ts +0 -1
- package/src/resolvers/mutations/products/addProductAssignment.ts +8 -1
- package/lib/express/mcpHandler.d.ts.map +0 -1
- package/lib/express/mcpHandler.js +0 -68
- package/lib/express/mcpHandler.js.map +0 -1
- package/lib/fastify/createMCPMiddleware.d.ts +0 -2
- package/lib/fastify/createMCPMiddleware.d.ts.map +0 -1
- package/lib/fastify/createMCPMiddleware.js +0 -2
- package/lib/fastify/createMCPMiddleware.js.map +0 -1
- package/lib/fastify/index copy.d.ts.map +0 -1
- package/lib/fastify/index copy.js +0 -157
- package/lib/fastify/index copy.js.map +0 -1
- package/lib/fastify/mcpHandler.d.ts +0 -8
- package/lib/fastify/mcpHandler.d.ts.map +0 -1
- package/lib/fastify/mcpHandler.js +0 -46
- package/lib/fastify/mcpHandler.js.map +0 -1
- package/lib/mcp/server.d.ts +0 -4
- package/lib/mcp/server.d.ts.map +0 -1
- package/lib/mcp/server.js +0 -60
- package/lib/mcp/server.js.map +0 -1
- package/lib/mcp/types.d.ts +0 -27
- package/lib/mcp/types.d.ts.map +0 -1
- package/lib/mcp/types.js +0 -5
- package/lib/mcp/types.js.map +0 -1
- package/lib/mcp/utils/html.d.ts +0 -16
- package/lib/mcp/utils/html.d.ts.map +0 -1
- package/lib/mcp/utils/html.js +0 -102
- package/lib/mcp/utils/html.js.map +0 -1
- package/lib/middleware/accountLockout.d.ts.map +0 -1
- package/lib/middleware/accountLockout.js +0 -84
- package/lib/middleware/accountLockout.js.map +0 -1
- package/lib/middleware/rateLimiter.d.ts.map +0 -1
- package/lib/middleware/rateLimiter.js +0 -91
- package/lib/middleware/rateLimiter.js.map +0 -1
- package/lib/plugins/inputValidation.d.ts.map +0 -1
- package/lib/plugins/inputValidation.js +0 -95
- package/lib/plugins/inputValidation.js.map +0 -1
- package/lib/utils/inputValidation.d.ts.map +0 -1
- package/lib/utils/inputValidation.js +0 -51
- package/lib/utils/inputValidation.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const ListCurrenciesSchema: {
|
|
4
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
includeInactive: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
value: z.ZodEnum<["ASC" | "DESC", ...("ASC" | "DESC")[]]>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
key?: string;
|
|
13
|
+
value?: "ASC" | "DESC";
|
|
14
|
+
}, {
|
|
15
|
+
key?: string;
|
|
16
|
+
value?: "ASC" | "DESC";
|
|
17
|
+
}>, "many">>;
|
|
18
|
+
};
|
|
19
|
+
export declare const ListCurrenciesZodSchema: z.ZodObject<{
|
|
20
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
includeInactive: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
24
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
key: z.ZodString;
|
|
26
|
+
value: z.ZodEnum<["ASC" | "DESC", ...("ASC" | "DESC")[]]>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
key?: string;
|
|
29
|
+
value?: "ASC" | "DESC";
|
|
30
|
+
}, {
|
|
31
|
+
key?: string;
|
|
32
|
+
value?: "ASC" | "DESC";
|
|
33
|
+
}>, "many">>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
sort?: {
|
|
36
|
+
key?: string;
|
|
37
|
+
value?: "ASC" | "DESC";
|
|
38
|
+
}[];
|
|
39
|
+
includeInactive?: boolean;
|
|
40
|
+
queryString?: string;
|
|
41
|
+
limit?: number;
|
|
42
|
+
offset?: number;
|
|
43
|
+
}, {
|
|
44
|
+
sort?: {
|
|
45
|
+
key?: string;
|
|
46
|
+
value?: "ASC" | "DESC";
|
|
47
|
+
}[];
|
|
48
|
+
includeInactive?: boolean;
|
|
49
|
+
queryString?: string;
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
}>;
|
|
53
|
+
export type ListCurrenciesParams = z.infer<typeof ListCurrenciesZodSchema>;
|
|
54
|
+
export declare function currenciesHandler(context: Context, params: ListCurrenciesParams): Promise<{
|
|
55
|
+
content: {
|
|
56
|
+
type: "text";
|
|
57
|
+
text: string;
|
|
58
|
+
}[];
|
|
59
|
+
}>;
|
|
60
|
+
//# sourceMappingURL=currenciesHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currenciesHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/currenciesHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAQ3C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;CAahC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAiC,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB;;;;;GAkCrF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SortDirection } from '@unchainedshop/utils';
|
|
3
|
+
const sortDirectionKeys = Object.keys(SortDirection);
|
|
4
|
+
export const ListCurrenciesSchema = {
|
|
5
|
+
limit: z.number().int().min(1).max(100).default(50),
|
|
6
|
+
offset: z.number().int().min(0).default(0),
|
|
7
|
+
includeInactive: z.boolean().default(false),
|
|
8
|
+
queryString: z.string().min(1).optional(),
|
|
9
|
+
sort: z
|
|
10
|
+
.array(z.object({
|
|
11
|
+
key: z.string().min(1),
|
|
12
|
+
value: z.enum(sortDirectionKeys).describe("Sort direction, e.g., 'ASC' or 'DESC'"),
|
|
13
|
+
}))
|
|
14
|
+
.optional(),
|
|
15
|
+
};
|
|
16
|
+
export const ListCurrenciesZodSchema = z.object(ListCurrenciesSchema);
|
|
17
|
+
export async function currenciesHandler(context, params) {
|
|
18
|
+
const { limit, offset, includeInactive, queryString, sort } = params;
|
|
19
|
+
const { modules } = context;
|
|
20
|
+
try {
|
|
21
|
+
const currencies = await modules.currencies.findCurrencies({
|
|
22
|
+
limit,
|
|
23
|
+
offset,
|
|
24
|
+
includeInactive,
|
|
25
|
+
queryString,
|
|
26
|
+
sort: sort,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: JSON.stringify({
|
|
33
|
+
currencies,
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: `Error retrieving currencies: ${error.message}`,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=currenciesHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currenciesHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/currenciesHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAGlD,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,IAAI,EAAE,CAAC;SACJ,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACtB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;KACnF,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAItE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAgB,EAAE,MAA4B;IACpF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAErE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;YACzD,KAAK;YACL,MAAM;YACN,eAAe;YACf,WAAW;YACX,IAAI,EAAE,IAAa;SACpB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,UAAU;qBACX,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gCAAiC,KAAe,CAAC,OAAO,EAAE;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const CurrencySchema: {
|
|
4
|
+
currencyId: z.ZodString;
|
|
5
|
+
};
|
|
6
|
+
export declare const CurrencyZodSchema: z.ZodObject<{
|
|
7
|
+
currencyId: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
currencyId?: string;
|
|
10
|
+
}, {
|
|
11
|
+
currencyId?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type CurrencyParams = z.infer<typeof CurrencyZodSchema>;
|
|
14
|
+
export declare function currencyHandler(context: Context, params: CurrencyParams): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=currencyHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/currencyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,cAAc;;CAE1B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;EAA2B,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc;;;;;GA2B7E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CurrencyNotFoundError } from '../../errors.js';
|
|
3
|
+
export const CurrencySchema = {
|
|
4
|
+
currencyId: z.string().min(1).describe('The ID of the currency to fetch'),
|
|
5
|
+
};
|
|
6
|
+
export const CurrencyZodSchema = z.object(CurrencySchema);
|
|
7
|
+
export async function currencyHandler(context, params) {
|
|
8
|
+
const { currencyId } = params;
|
|
9
|
+
const { modules } = context;
|
|
10
|
+
try {
|
|
11
|
+
const currency = await modules.currencies.findCurrency({ currencyId });
|
|
12
|
+
if (!currency)
|
|
13
|
+
throw new CurrencyNotFoundError({ currencyId });
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
type: 'text',
|
|
18
|
+
text: JSON.stringify({ currency }),
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: `Error retrieving currency: ${error.message}`,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=currencyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencyHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/currencyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;CAC1E,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAI1D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAgB,EAAE,MAAsB;IAC5E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAEvE,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,qBAAqB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAE/D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;iBACnC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA+B,KAAe,CAAC,OAAO,EAAE;iBAC/D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProduct.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/getProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"getProduct.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/getProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;EAK7B,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEnE;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB;;;;;GA4FjF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
// import { escapeHtml } from '../utils/html.js';
|
|
3
2
|
/**
|
|
4
3
|
* Zod schema for the get_product tool (as raw object for MCP)
|
|
5
4
|
*/
|
|
@@ -75,16 +74,6 @@ export async function getProductHandler(context, params) {
|
|
|
75
74
|
const reviewsCount = await context.modules.products.reviews.count({
|
|
76
75
|
productId: product._id,
|
|
77
76
|
});
|
|
78
|
-
// Generate rich HTML visualization
|
|
79
|
-
// const htmlContent = generateProductDetailHTML(product, {
|
|
80
|
-
// productTexts,
|
|
81
|
-
// media,
|
|
82
|
-
// pricing,
|
|
83
|
-
// variations,
|
|
84
|
-
// // bundleItems,
|
|
85
|
-
// // assortmentLinks,
|
|
86
|
-
// reviewsCount,
|
|
87
|
-
// });
|
|
88
77
|
return {
|
|
89
78
|
content: [
|
|
90
79
|
{
|
|
@@ -95,19 +84,9 @@ export async function getProductHandler(context, params) {
|
|
|
95
84
|
media,
|
|
96
85
|
pricing,
|
|
97
86
|
variations,
|
|
98
|
-
// bundleItems,
|
|
99
|
-
// assortmentLinks,
|
|
100
87
|
reviewsCount,
|
|
101
88
|
}),
|
|
102
89
|
},
|
|
103
|
-
// {
|
|
104
|
-
// type: 'resource' as const,
|
|
105
|
-
// resource: {
|
|
106
|
-
// text: htmlContent,
|
|
107
|
-
// uri: `data:text/html;charset=UTF-8,${encodeURIComponent(htmlContent)}`,
|
|
108
|
-
// mimeType: 'text/html',
|
|
109
|
-
// },
|
|
110
|
-
// },
|
|
111
90
|
],
|
|
112
91
|
};
|
|
113
92
|
}
|
|
@@ -122,307 +101,4 @@ export async function getProductHandler(context, params) {
|
|
|
122
101
|
};
|
|
123
102
|
}
|
|
124
103
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Generate rich HTML visualization for product details
|
|
127
|
-
*/
|
|
128
|
-
// function generateProductDetailHTML(
|
|
129
|
-
// product: any,
|
|
130
|
-
// data: {
|
|
131
|
-
// productTexts?: any;
|
|
132
|
-
// media?: any[];
|
|
133
|
-
// pricing?: any;
|
|
134
|
-
// variations?: any[];
|
|
135
|
-
// bundleItems?: any[];
|
|
136
|
-
// assortmentLinks?: any[];
|
|
137
|
-
// reviewsCount?: number;
|
|
138
|
-
// },
|
|
139
|
-
// ): string {
|
|
140
|
-
// const { productTexts, media, pricing, variations, bundleItems, assortmentLinks, reviewsCount } = data;
|
|
141
|
-
// // Get primary information
|
|
142
|
-
// const title = productTexts?.title || product.title || 'Untitled Product';
|
|
143
|
-
// const subtitle = productTexts?.subtitle || '';
|
|
144
|
-
// const description = productTexts?.description || '';
|
|
145
|
-
// const sku = product.warehousing?.sku || 'N/A';
|
|
146
|
-
// const status = product.status || 'DRAFT';
|
|
147
|
-
// const type = product.type || 'SIMPLE_PRODUCT';
|
|
148
|
-
// // Status color mapping
|
|
149
|
-
// const statusColor =
|
|
150
|
-
// status === 'ACTIVE'
|
|
151
|
-
// ? '#28a745'
|
|
152
|
-
// : status === 'DRAFT'
|
|
153
|
-
// ? '#ffc107'
|
|
154
|
-
// : status === 'DELETED'
|
|
155
|
-
// ? '#dc3545'
|
|
156
|
-
// : '#6c757d';
|
|
157
|
-
// // Get primary image
|
|
158
|
-
// const primaryImage = media?.find((m) => m.tags?.includes('hero')) || media?.[0];
|
|
159
|
-
// const primaryImageUrl = primaryImage?.file?.url || primaryImage?.url;
|
|
160
|
-
// // Format price
|
|
161
|
-
// const priceDisplay = pricing?.price
|
|
162
|
-
// ? `${(pricing.price.amount / 100).toFixed(2)} ${pricing.price.currency}`
|
|
163
|
-
// : 'Price not available';
|
|
164
|
-
// // Format dates
|
|
165
|
-
// const createdDate = product.created ? new Date(product.created).toLocaleDateString() : 'N/A';
|
|
166
|
-
// const updatedDate = product.updated ? new Date(product.updated).toLocaleDateString() : 'N/A';
|
|
167
|
-
// return `
|
|
168
|
-
// <!DOCTYPE html>
|
|
169
|
-
// <html>
|
|
170
|
-
// <head>
|
|
171
|
-
// <meta charset="UTF-8" />
|
|
172
|
-
// <meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
173
|
-
// <title>Product Details: ${escapeHtml(title)}</title>
|
|
174
|
-
// </head>
|
|
175
|
-
// <body>
|
|
176
|
-
// <div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui; max-width: 800px; margin: 0 auto; padding: 20px;">
|
|
177
|
-
// <!-- Main Product Card -->
|
|
178
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 16px; overflow: hidden;">
|
|
179
|
-
// <div style="padding: 20px; border-bottom: 1px solid #e9ecef;">
|
|
180
|
-
// <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px;">
|
|
181
|
-
// <h2 style="margin: 0; color: #343a40; font-size: 24px;">${escapeHtml(title)}</h2>
|
|
182
|
-
// <span style="padding: 6px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; background: ${statusColor}; color: white;">${status}</span>
|
|
183
|
-
// </div>
|
|
184
|
-
// ${subtitle ? `<p style="margin: 0; color: #6c757d; font-size: 16px;">${escapeHtml(subtitle)}</p>` : ''}
|
|
185
|
-
// <div style="margin-top: 12px; display: flex; gap: 16px; font-size: 14px; color: #6c757d; flex-wrap: wrap;">
|
|
186
|
-
// <span><strong>ID:</strong> ${escapeHtml(product._id?.toString() || 'N/A')}</span>
|
|
187
|
-
// <span><strong>SKU:</strong> ${escapeHtml(sku)}</span>
|
|
188
|
-
// <span><strong>Type:</strong> ${escapeHtml(type)}</span>
|
|
189
|
-
// </div>
|
|
190
|
-
// </div>
|
|
191
|
-
// <!-- Product Image -->
|
|
192
|
-
// ${
|
|
193
|
-
// primaryImageUrl
|
|
194
|
-
// ? `
|
|
195
|
-
// <div style="padding: 20px; text-align: center; background: #f8f9fa;">
|
|
196
|
-
// <img src="${escapeHtml(primaryImageUrl)}"
|
|
197
|
-
// style="max-width: 100%; max-height: 300px; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);"
|
|
198
|
-
// onerror="this.style.display='none'; this.nextElementSibling.style.display='block'" />
|
|
199
|
-
// <div style="display: none; padding: 60px; color: #6c757d; font-size: 18px;">Image not available</div>
|
|
200
|
-
// </div>
|
|
201
|
-
// `
|
|
202
|
-
// : `
|
|
203
|
-
// <div style="padding: 60px; text-align: center; background: #f8f9fa; color: #6c757d; font-size: 18px;">
|
|
204
|
-
// No image available
|
|
205
|
-
// </div>
|
|
206
|
-
// `
|
|
207
|
-
// }
|
|
208
|
-
// </div>
|
|
209
|
-
// <!-- Information Grid -->
|
|
210
|
-
// <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;">
|
|
211
|
-
// <!-- Basic Information -->
|
|
212
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px;">
|
|
213
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Basic Information</h3>
|
|
214
|
-
// <div style="space-y: 8px;">
|
|
215
|
-
// <div style="margin-bottom: 8px;">
|
|
216
|
-
// <span style="font-weight: 500; color: #343a40;">Sequence:</span>
|
|
217
|
-
// <span style="color: #6c757d; margin-left: 8px;">${product.sequence || 'N/A'}</span>
|
|
218
|
-
// </div>
|
|
219
|
-
// <div style="margin-bottom: 8px;">
|
|
220
|
-
// <span style="font-weight: 500; color: #343a40;">Created:</span>
|
|
221
|
-
// <span style="color: #6c757d; margin-left: 8px;">${createdDate}</span>
|
|
222
|
-
// </div>
|
|
223
|
-
// <div style="margin-bottom: 8px;">
|
|
224
|
-
// <span style="font-weight: 500; color: #343a40;">Updated:</span>
|
|
225
|
-
// <span style="color: #6c757d; margin-left: 8px;">${updatedDate}</span>
|
|
226
|
-
// </div>
|
|
227
|
-
// ${
|
|
228
|
-
// product.tags?.length
|
|
229
|
-
// ? `
|
|
230
|
-
// <div style="margin-bottom: 8px;">
|
|
231
|
-
// <span style="font-weight: 500; color: #343a40;">Tags:</span>
|
|
232
|
-
// <div style="margin-top: 4px;">
|
|
233
|
-
// ${product.tags
|
|
234
|
-
// .map(
|
|
235
|
-
// (tag: string) =>
|
|
236
|
-
// `<span style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; margin-right: 4px; font-size: 12px;">${escapeHtml(tag)}</span>`,
|
|
237
|
-
// )
|
|
238
|
-
// .join('')}
|
|
239
|
-
// </div>
|
|
240
|
-
// </div>
|
|
241
|
-
// `
|
|
242
|
-
// : ''
|
|
243
|
-
// }
|
|
244
|
-
// </div>
|
|
245
|
-
// </div>
|
|
246
|
-
// <!-- Pricing Information -->
|
|
247
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px;">
|
|
248
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Pricing</h3>
|
|
249
|
-
// <div style="space-y: 8px;">
|
|
250
|
-
// <div style="margin-bottom: 8px;">
|
|
251
|
-
// <span style="font-weight: 500; color: #343a40;">Current Price:</span>
|
|
252
|
-
// <span style="color: #6c757d; margin-left: 8px;">${escapeHtml(priceDisplay)}</span>
|
|
253
|
-
// </div>
|
|
254
|
-
// ${
|
|
255
|
-
// pricing?.taxIncluded !== undefined
|
|
256
|
-
// ? `
|
|
257
|
-
// <div style="margin-bottom: 8px;">
|
|
258
|
-
// <span style="font-weight: 500; color: #343a40;">Tax Included:</span>
|
|
259
|
-
// <span style="color: #6c757d; margin-left: 8px;">${pricing.taxIncluded ? 'Yes' : 'No'}</span>
|
|
260
|
-
// </div>
|
|
261
|
-
// `
|
|
262
|
-
// : ''
|
|
263
|
-
// }
|
|
264
|
-
// ${
|
|
265
|
-
// variations?.length
|
|
266
|
-
// ? `
|
|
267
|
-
// <div style="margin-bottom: 8px;">
|
|
268
|
-
// <span style="font-weight: 500; color: #343a40;">Variations:</span>
|
|
269
|
-
// <span style="color: #6c757d; margin-left: 8px;">${variations.length} variation(s)</span>
|
|
270
|
-
// </div>
|
|
271
|
-
// `
|
|
272
|
-
// : ''
|
|
273
|
-
// }
|
|
274
|
-
// </div>
|
|
275
|
-
// </div>
|
|
276
|
-
// </div>
|
|
277
|
-
// ${
|
|
278
|
-
// description
|
|
279
|
-
// ? `
|
|
280
|
-
// <!-- Description -->
|
|
281
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 16px;">
|
|
282
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Description</h3>
|
|
283
|
-
// <div style="color: #343a40; line-height: 1.6;">${escapeHtml(description)}</div>
|
|
284
|
-
// </div>
|
|
285
|
-
// `
|
|
286
|
-
// : ''
|
|
287
|
-
// }
|
|
288
|
-
// ${
|
|
289
|
-
// media?.length > 1
|
|
290
|
-
// ? `
|
|
291
|
-
// <!-- Media Gallery -->
|
|
292
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 16px;">
|
|
293
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Media Gallery (${media.length} items)</h3>
|
|
294
|
-
// <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px;">
|
|
295
|
-
// ${media
|
|
296
|
-
// .map(
|
|
297
|
-
// (item: any) => `
|
|
298
|
-
// <div style="position: relative;">
|
|
299
|
-
// ${
|
|
300
|
-
// item.file?.url || item.url
|
|
301
|
-
// ? `
|
|
302
|
-
// <img src="${escapeHtml(item.file?.url || item.url)}"
|
|
303
|
-
// style="width: 100%; height: 120px; object-fit: cover; border-radius: 4px; border: 1px solid #e9ecef;"
|
|
304
|
-
// onerror="this.style.display='none'; this.nextElementSibling.style.display='flex'" />
|
|
305
|
-
// <div style="display: none; width: 100%; height: 120px; background: #f8f9fa; border-radius: 4px; align-items: center; justify-content: center; color: #6c757d; font-size: 12px;">No preview</div>
|
|
306
|
-
// `
|
|
307
|
-
// : `
|
|
308
|
-
// <div style="width: 100%; height: 120px; background: #f8f9fa; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #6c757d; font-size: 12px;">No preview</div>
|
|
309
|
-
// `
|
|
310
|
-
// }
|
|
311
|
-
// ${
|
|
312
|
-
// item.tags?.length
|
|
313
|
-
// ? `
|
|
314
|
-
// <div style="position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,0.7); color: white; padding: 2px 6px; border-radius: 3px; font-size: 10px;">
|
|
315
|
-
// ${item.tags.slice(0, 2).join(', ')}
|
|
316
|
-
// </div>
|
|
317
|
-
// `
|
|
318
|
-
// : ''
|
|
319
|
-
// }
|
|
320
|
-
// </div>
|
|
321
|
-
// `,
|
|
322
|
-
// )
|
|
323
|
-
// .join('')}
|
|
324
|
-
// </div>
|
|
325
|
-
// </div>
|
|
326
|
-
// `
|
|
327
|
-
// : ''
|
|
328
|
-
// }
|
|
329
|
-
// ${
|
|
330
|
-
// bundleItems?.length
|
|
331
|
-
// ? `
|
|
332
|
-
// <!-- Bundle Items -->
|
|
333
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 16px;">
|
|
334
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Bundle Items (${bundleItems.length})</h3>
|
|
335
|
-
// <div style="space-y: 8px;">
|
|
336
|
-
// ${bundleItems
|
|
337
|
-
// .map(
|
|
338
|
-
// (item: any) => `
|
|
339
|
-
// <div style="padding: 8px; background: #f8f9fa; border-radius: 4px; margin-bottom: 8px;">
|
|
340
|
-
// <div style="font-weight: 500; color: #343a40;">${escapeHtml(item.product?.title || 'Bundle Item')}</div>
|
|
341
|
-
// <div style="font-size: 12px; color: #6c757d;">Quantity: ${item.quantity || 1}</div>
|
|
342
|
-
// </div>
|
|
343
|
-
// `,
|
|
344
|
-
// )
|
|
345
|
-
// .join('')}
|
|
346
|
-
// </div>
|
|
347
|
-
// </div>
|
|
348
|
-
// `
|
|
349
|
-
// : ''
|
|
350
|
-
// }
|
|
351
|
-
// ${
|
|
352
|
-
// variations?.length
|
|
353
|
-
// ? `
|
|
354
|
-
// <!-- Variations -->
|
|
355
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 16px;">
|
|
356
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Product Variations (${variations.length})</h3>
|
|
357
|
-
// <div style="space-y: 8px;">
|
|
358
|
-
// ${variations
|
|
359
|
-
// .map(
|
|
360
|
-
// (variation: any) => `
|
|
361
|
-
// <div style="padding: 8px; background: #f8f9fa; border-radius: 4px; margin-bottom: 8px;">
|
|
362
|
-
// <div style="font-weight: 500; color: #343a40;">${escapeHtml(variation.key || 'Variation')}</div>
|
|
363
|
-
// <div style="font-size: 12px; color: #6c757d;">Type: ${variation.type || 'N/A'}</div>
|
|
364
|
-
// </div>
|
|
365
|
-
// `,
|
|
366
|
-
// )
|
|
367
|
-
// .join('')}
|
|
368
|
-
// </div>
|
|
369
|
-
// </div>
|
|
370
|
-
// `
|
|
371
|
-
// : ''
|
|
372
|
-
// }
|
|
373
|
-
// <!-- Additional Information -->
|
|
374
|
-
// <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px;">
|
|
375
|
-
// <!-- Technical Details -->
|
|
376
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px;">
|
|
377
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Technical Details</h3>
|
|
378
|
-
// <div style="space-y: 8px;">
|
|
379
|
-
// <div style="margin-bottom: 8px;">
|
|
380
|
-
// <span style="font-weight: 500; color: #343a40;">Reviews:</span>
|
|
381
|
-
// <span style="color: #6c757d; margin-left: 8px;">${reviewsCount || 0} review(s)</span>
|
|
382
|
-
// </div>
|
|
383
|
-
// <div style="margin-bottom: 8px;">
|
|
384
|
-
// <span style="font-weight: 500; color: #343a40;">Assortments:</span>
|
|
385
|
-
// <span style="color: #6c757d; margin-left: 8px;">${assortmentLinks?.length || 0} membership(s)</span>
|
|
386
|
-
// </div>
|
|
387
|
-
// <div style="margin-bottom: 8px;">
|
|
388
|
-
// <span style="font-weight: 500; color: #343a40;">Media Count:</span>
|
|
389
|
-
// <span style="color: #6c757d; margin-left: 8px;">${media?.length || 0} item(s)</span>
|
|
390
|
-
// </div>
|
|
391
|
-
// </div>
|
|
392
|
-
// </div>
|
|
393
|
-
// <!-- Localization -->
|
|
394
|
-
// <div style="background: white; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px;">
|
|
395
|
-
// <h3 style="margin: 0 0 16px 0; color: #0066cc; font-size: 18px;">Localization</h3>
|
|
396
|
-
// <div style="space-y: 8px;">
|
|
397
|
-
// <div style="margin-bottom: 8px;">
|
|
398
|
-
// <span style="font-weight: 500; color: #343a40;">Current Locale:</span>
|
|
399
|
-
// <span style="color: #6c757d; margin-left: 8px;">${escapeHtml(productTexts?.locale || 'N/A')}</span>
|
|
400
|
-
// </div>
|
|
401
|
-
// ${
|
|
402
|
-
// productTexts?.vendor
|
|
403
|
-
// ? `
|
|
404
|
-
// <div style="margin-bottom: 8px;">
|
|
405
|
-
// <span style="font-weight: 500; color: #343a40;">Vendor:</span>
|
|
406
|
-
// <span style="color: #6c757d; margin-left: 8px;">${escapeHtml(productTexts.vendor)}</span>
|
|
407
|
-
// </div>
|
|
408
|
-
// `
|
|
409
|
-
// : ''
|
|
410
|
-
// }
|
|
411
|
-
// ${
|
|
412
|
-
// productTexts?.brand
|
|
413
|
-
// ? `
|
|
414
|
-
// <div style="margin-bottom: 8px;">
|
|
415
|
-
// <span style="font-weight: 500; color: #343a40;">Brand:</span>
|
|
416
|
-
// <span style="color: #6c757d; margin-left: 8px;">${escapeHtml(productTexts.brand)}</span>
|
|
417
|
-
// </div>
|
|
418
|
-
// `
|
|
419
|
-
// : ''
|
|
420
|
-
// }
|
|
421
|
-
// </div>
|
|
422
|
-
// </div>
|
|
423
|
-
// </div>
|
|
424
|
-
// </div>
|
|
425
|
-
// </body>
|
|
426
|
-
// </html>`;
|
|
427
|
-
// }
|
|
428
104
|
//# sourceMappingURL=getProduct.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProduct.js","sourceRoot":"","sources":["../../../src/mcp/tools/getProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"getProduct.js","sourceRoot":"","sources":["../../../src/mcp/tools/getProduct.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const LanguageSchema: {
|
|
4
|
+
languageId: z.ZodString;
|
|
5
|
+
};
|
|
6
|
+
export declare const LanguageZodSchema: z.ZodObject<{
|
|
7
|
+
languageId: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
languageId?: string;
|
|
10
|
+
}, {
|
|
11
|
+
languageId?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type LanguageParams = z.infer<typeof LanguageZodSchema>;
|
|
14
|
+
export declare function languageHandler(context: Context, params: LanguageParams): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=languageHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languageHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/languageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,cAAc;;CAE1B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;EAA2B,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc;;;;;GAyB7E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const LanguageSchema = {
|
|
3
|
+
languageId: z.string().min(1).describe('The ID of the language to fetch'),
|
|
4
|
+
};
|
|
5
|
+
export const LanguageZodSchema = z.object(LanguageSchema);
|
|
6
|
+
export async function languageHandler(context, params) {
|
|
7
|
+
const { languageId } = params;
|
|
8
|
+
const { modules } = context;
|
|
9
|
+
try {
|
|
10
|
+
const language = await modules.languages.findLanguage({ languageId });
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: 'text',
|
|
15
|
+
text: JSON.stringify({ language }),
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: `Error retrieving language: ${error.message}`,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=languageHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languageHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/languageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;CAC1E,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAI1D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAgB,EAAE,MAAsB;IAC5E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAEtE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;iBACnC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA+B,KAAe,CAAC,OAAO,EAAE;iBAC/D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|