@yoryoboy/bi-mcp 1.14.0 → 1.14.2
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/dist/.tsbuildinfo +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-use.json +2 -2
- package/dist/src/services/vtex/__tests__/vtex-payments.test.js +12 -9
- package/dist/src/services/vtex/__tests__/vtex-payments.test.js.map +2 -2
- package/dist/src/services/vtex/vtex-payments.js +11 -5
- package/dist/src/services/vtex/vtex-payments.js.map +2 -2
- package/dist/src/tools/vtex/__tests__/commercial-conditions.test.js +4 -173
- package/dist/src/tools/vtex/__tests__/commercial-conditions.test.js.map +2 -2
- package/dist/src/tools/vtex/__tests__/payment-rules.test.js +1 -0
- package/dist/src/tools/vtex/__tests__/payment-rules.test.js.map +2 -2
- package/dist/src/tools/vtex/catalog-admin-products-skus.js +1 -1
- package/dist/src/tools/vtex/catalog-admin-products-skus.js.map +1 -1
- package/dist/src/tools/vtex/commercial-conditions.js +35 -150
- package/dist/src/tools/vtex/commercial-conditions.js.map +2 -2
- package/dist/src/tools/vtex/create-sku.js +1 -1
- package/dist/src/tools/vtex/create-sku.js.map +1 -1
- package/dist/src/tools/vtex/payment-rules.js +81 -38
- package/dist/src/tools/vtex/payment-rules.js.map +2 -2
- package/dist/tests/vtex/vtex-commercial-conditions-docs.test.js +12 -4
- package/dist/tests/vtex/vtex-commercial-conditions-docs.test.js.map +2 -2
- package/dist/tests/vtex/vtex-commercial-conditions-surface.test.js +121 -12
- package/dist/tests/vtex/vtex-commercial-conditions-surface.test.js.map +2 -2
- package/dist/tests/vtex/vtex-commercial-conditions-workflow.test.js +15 -23
- package/dist/tests/vtex/vtex-commercial-conditions-workflow.test.js.map +2 -2
- package/package.json +1 -1
|
@@ -5,24 +5,11 @@ import {
|
|
|
5
5
|
getCommercialCondition,
|
|
6
6
|
listCommercialConditions
|
|
7
7
|
} from "../../services/vtex/vtex-payments.js";
|
|
8
|
-
import {
|
|
9
|
-
createCommercialCondition,
|
|
10
|
-
deleteCommercialCondition,
|
|
11
|
-
updateCommercialCondition
|
|
12
|
-
} from "../../services/vtex/vtex-payments-write.js";
|
|
13
8
|
import { toSnakeCaseKeys } from "../../utils/case-conversion.js";
|
|
14
9
|
import { stripNulls } from "../../utils/strip-payload.js";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
handleVtexWriteError,
|
|
19
|
-
requireExplicitConfirmation,
|
|
20
|
-
resolveVtexWriteProfile
|
|
21
|
-
} from "./write-helpers.js";
|
|
22
|
-
const commercialConditionWarnings = {
|
|
23
|
-
delete: "Deleting a commercial condition can break linked payment rules and installment visibility until dependent rules are updated."
|
|
24
|
-
};
|
|
25
|
-
const requiredProfileIdSchemaField = z.string().trim().min(1).describe("Explicit VTEX profile id to use for this operation.");
|
|
10
|
+
import { vtexProfileIdSchemaField } from "./write-helpers.js";
|
|
11
|
+
const requiredProfileIdSchemaField = vtexProfileIdSchemaField.unwrap().describe("Explicit VTEX profile id to use for this operation.");
|
|
12
|
+
const commercialConditionActionSchema = z.enum(["list", "get"]).describe("Action to perform for VTEX commercial conditions.");
|
|
26
13
|
const commercialConditionIdSchemaField = z.number().int().positive().describe("Positive VTEX commercial condition identifier.");
|
|
27
14
|
const conditionRowsSchema = ["id", "name", "is_active"];
|
|
28
15
|
function readValue(record, ...keys) {
|
|
@@ -43,47 +30,39 @@ const getActionSchema = z.object({
|
|
|
43
30
|
profileId: requiredProfileIdSchemaField,
|
|
44
31
|
commercialConditionId: commercialConditionIdSchemaField
|
|
45
32
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
commercialConditionId: commercialConditionIdSchemaField,
|
|
57
|
-
name: z.string().trim().min(1).optional().describe("Updated commercial condition name."),
|
|
58
|
-
description: z.string().trim().min(1).optional().describe("Updated internal description."),
|
|
59
|
-
isActive: z.boolean().optional().describe("Updated condition active flag.")
|
|
60
|
-
}).refine((value) => value.name !== void 0 || value.description !== void 0 || value.isActive !== void 0, {
|
|
61
|
-
message: "At least one commercial condition field must be provided.",
|
|
62
|
-
path: ["name"]
|
|
63
|
-
});
|
|
64
|
-
const deleteActionSchema = z.object({
|
|
65
|
-
action: z.literal("delete"),
|
|
33
|
+
function getCommercialConditionsActionSchema(action) {
|
|
34
|
+
switch (action) {
|
|
35
|
+
case "list":
|
|
36
|
+
return listActionSchema;
|
|
37
|
+
case "get":
|
|
38
|
+
return getActionSchema;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const commercialConditionsSchema = z.object({
|
|
42
|
+
action: commercialConditionActionSchema,
|
|
66
43
|
profileId: requiredProfileIdSchemaField,
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
search: z.string().trim().min(1).optional().describe("Optional text filter for condition name lookup."),
|
|
45
|
+
commercialConditionId: commercialConditionIdSchemaField.optional()
|
|
46
|
+
}).superRefine((value, ctx) => {
|
|
47
|
+
const validation = getCommercialConditionsActionSchema(value.action).safeParse(value);
|
|
48
|
+
if (validation.success) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
for (const issue of validation.error.issues) {
|
|
52
|
+
ctx.addIssue(issue);
|
|
53
|
+
}
|
|
69
54
|
});
|
|
70
|
-
const commercialConditionsSchema = z.discriminatedUnion("action", [
|
|
71
|
-
listActionSchema,
|
|
72
|
-
getActionSchema,
|
|
73
|
-
createActionSchema,
|
|
74
|
-
updateActionSchema,
|
|
75
|
-
deleteActionSchema
|
|
76
|
-
]);
|
|
77
55
|
async function commercialConditionsHandler(params) {
|
|
78
56
|
switch (params.action) {
|
|
79
57
|
case "list": {
|
|
58
|
+
const validatedParams = listActionSchema.parse(params);
|
|
80
59
|
try {
|
|
81
|
-
const conditions = await listCommercialConditions(
|
|
60
|
+
const conditions = await listCommercialConditions(validatedParams.profileId, validatedParams.search);
|
|
82
61
|
return object({
|
|
83
62
|
metadata: stripNulls({
|
|
84
63
|
total: conditions.length,
|
|
85
|
-
profile_id:
|
|
86
|
-
search:
|
|
64
|
+
profile_id: validatedParams.profileId,
|
|
65
|
+
search: validatedParams.search
|
|
87
66
|
}),
|
|
88
67
|
conditions_schema: conditionRowsSchema,
|
|
89
68
|
conditions: conditions.map((condition) => [
|
|
@@ -97,120 +76,26 @@ async function commercialConditionsHandler(params) {
|
|
|
97
76
|
}
|
|
98
77
|
}
|
|
99
78
|
case "get": {
|
|
79
|
+
const validatedParams = getActionSchema.parse(params);
|
|
100
80
|
try {
|
|
101
|
-
const condition = await getCommercialCondition(
|
|
81
|
+
const condition = await getCommercialCondition(
|
|
82
|
+
validatedParams.profileId,
|
|
83
|
+
validatedParams.commercialConditionId
|
|
84
|
+
);
|
|
102
85
|
return object({
|
|
103
|
-
profile_id:
|
|
104
|
-
commercial_condition_id:
|
|
86
|
+
profile_id: validatedParams.profileId,
|
|
87
|
+
commercial_condition_id: validatedParams.commercialConditionId,
|
|
105
88
|
condition: toSnakeCaseKeys(condition)
|
|
106
89
|
});
|
|
107
90
|
} catch (err) {
|
|
108
91
|
return error(
|
|
109
92
|
formatVtexError(
|
|
110
93
|
err,
|
|
111
|
-
`Failed to fetch VTEX commercial condition ${
|
|
94
|
+
`Failed to fetch VTEX commercial condition ${validatedParams.commercialConditionId}`
|
|
112
95
|
)
|
|
113
96
|
);
|
|
114
97
|
}
|
|
115
98
|
}
|
|
116
|
-
case "create": {
|
|
117
|
-
try {
|
|
118
|
-
const profileResolution = await resolveVtexWriteProfile(params.profileId);
|
|
119
|
-
if (!profileResolution.ok) {
|
|
120
|
-
return profileResolution.response;
|
|
121
|
-
}
|
|
122
|
-
const created = await createCommercialCondition(profileResolution.value.profileId, {
|
|
123
|
-
Name: params.name,
|
|
124
|
-
...params.description !== void 0 ? { Description: params.description } : {},
|
|
125
|
-
...params.isActive !== void 0 ? { IsActive: params.isActive } : {}
|
|
126
|
-
});
|
|
127
|
-
return buildWriteSuccessResponse({
|
|
128
|
-
profileId: profileResolution.value.profileId,
|
|
129
|
-
operation: "commercial_conditions_create",
|
|
130
|
-
resourceId: created.id == null ? void 0 : String(created.id),
|
|
131
|
-
riskLevel: "low",
|
|
132
|
-
message: "Commercial condition created. You can now link it to payment rules or SKU assignments as needed.",
|
|
133
|
-
before: null,
|
|
134
|
-
after: created
|
|
135
|
-
});
|
|
136
|
-
} catch (err) {
|
|
137
|
-
return handleVtexWriteError(err, "Failed to create VTEX commercial condition");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
case "update": {
|
|
141
|
-
try {
|
|
142
|
-
const profileResolution = await resolveVtexWriteProfile(params.profileId);
|
|
143
|
-
if (!profileResolution.ok) {
|
|
144
|
-
return profileResolution.response;
|
|
145
|
-
}
|
|
146
|
-
const before = await getCommercialCondition(
|
|
147
|
-
profileResolution.value.profileId,
|
|
148
|
-
params.commercialConditionId
|
|
149
|
-
);
|
|
150
|
-
const updated = await updateCommercialCondition(
|
|
151
|
-
profileResolution.value.profileId,
|
|
152
|
-
params.commercialConditionId,
|
|
153
|
-
{
|
|
154
|
-
...params.name !== void 0 ? { Name: params.name } : {},
|
|
155
|
-
...params.description !== void 0 ? { Description: params.description } : {},
|
|
156
|
-
...params.isActive !== void 0 ? { IsActive: params.isActive } : {}
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
return buildWriteSuccessResponse({
|
|
160
|
-
profileId: profileResolution.value.profileId,
|
|
161
|
-
operation: "commercial_conditions_update",
|
|
162
|
-
resourceId: String(params.commercialConditionId),
|
|
163
|
-
riskLevel: "medium",
|
|
164
|
-
message: "Commercial condition updated. Review linked payment rules and checkout behavior to confirm the intended installment strategy.",
|
|
165
|
-
before,
|
|
166
|
-
after: updated
|
|
167
|
-
});
|
|
168
|
-
} catch (err) {
|
|
169
|
-
return handleVtexWriteError(
|
|
170
|
-
err,
|
|
171
|
-
`Failed to update VTEX commercial condition ${params.commercialConditionId}`
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
case "delete": {
|
|
176
|
-
const confirmationResponse = requireExplicitConfirmation(
|
|
177
|
-
params.confirmed,
|
|
178
|
-
"commercial_conditions_delete",
|
|
179
|
-
{
|
|
180
|
-
commercial_condition_id: params.commercialConditionId,
|
|
181
|
-
warnings: [commercialConditionWarnings.delete]
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
if (confirmationResponse) {
|
|
185
|
-
return confirmationResponse;
|
|
186
|
-
}
|
|
187
|
-
try {
|
|
188
|
-
const profileResolution = await resolveVtexWriteProfile(params.profileId);
|
|
189
|
-
if (!profileResolution.ok) {
|
|
190
|
-
return profileResolution.response;
|
|
191
|
-
}
|
|
192
|
-
await deleteCommercialCondition(
|
|
193
|
-
profileResolution.value.profileId,
|
|
194
|
-
params.commercialConditionId
|
|
195
|
-
);
|
|
196
|
-
return buildWriteSuccessResponse({
|
|
197
|
-
profileId: profileResolution.value.profileId,
|
|
198
|
-
operation: "commercial_conditions_delete",
|
|
199
|
-
resourceId: String(params.commercialConditionId),
|
|
200
|
-
riskLevel: "high",
|
|
201
|
-
confirmed: true,
|
|
202
|
-
message: "Commercial condition deleted. Confirm linked payment rules and SKU assignments still reflect the intended installment strategy.",
|
|
203
|
-
warnings: [commercialConditionWarnings.delete],
|
|
204
|
-
before: null,
|
|
205
|
-
after: null
|
|
206
|
-
});
|
|
207
|
-
} catch (err) {
|
|
208
|
-
return handleVtexWriteError(
|
|
209
|
-
err,
|
|
210
|
-
`Failed to delete VTEX commercial condition ${params.commercialConditionId}`
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
99
|
}
|
|
215
100
|
}
|
|
216
101
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/tools/vtex/commercial-conditions.ts"],
|
|
4
|
-
"sourcesContent": ["import { error, object } from \"mcp-use/server\";\nimport { z } from \"zod\";\n\nimport { formatVtexError } from \"../../services/vtex/vtex-api.js\";\nimport {\n getCommercialCondition,\n listCommercialConditions,\n} from \"../../services/vtex/vtex-payments.js\";\nimport {
|
|
5
|
-
"mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,SAAS,SAAS;AAElB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP
|
|
4
|
+
"sourcesContent": ["import { error, object } from \"mcp-use/server\";\nimport { z } from \"zod\";\n\nimport { formatVtexError } from \"../../services/vtex/vtex-api.js\";\nimport {\n getCommercialCondition,\n listCommercialConditions,\n} from \"../../services/vtex/vtex-payments.js\";\nimport { toSnakeCaseKeys } from \"../../utils/case-conversion.js\";\nimport { stripNulls } from \"../../utils/strip-payload.js\";\nimport { vtexProfileIdSchemaField } from \"./write-helpers.js\";\n\nconst requiredProfileIdSchemaField = vtexProfileIdSchemaField\n .unwrap()\n .describe(\"Explicit VTEX profile id to use for this operation.\");\n\nconst commercialConditionActionSchema = z\n .enum([\"list\", \"get\"])\n .describe(\"Action to perform for VTEX commercial conditions.\");\n\nconst commercialConditionIdSchemaField = z\n .number()\n .int()\n .positive()\n .describe(\"Positive VTEX commercial condition identifier.\");\n\nconst conditionRowsSchema = [\"id\", \"name\", \"is_active\"] as const;\n\nfunction readValue(record: Record<string, unknown>, ...keys: string[]): unknown {\n for (const key of keys) {\n if (key in record) {\n return record[key];\n }\n }\n\n return undefined;\n}\n\nconst listActionSchema = z.object({\n action: z.literal(\"list\"),\n profileId: requiredProfileIdSchemaField,\n search: z.string().trim().min(1).optional().describe(\"Optional text filter for condition name lookup.\"),\n});\n\nconst getActionSchema = z.object({\n action: z.literal(\"get\"),\n profileId: requiredProfileIdSchemaField,\n commercialConditionId: commercialConditionIdSchemaField,\n});\n\nfunction getCommercialConditionsActionSchema(\n action: z.infer<typeof commercialConditionActionSchema>\n) {\n switch (action) {\n case \"list\":\n return listActionSchema;\n case \"get\":\n return getActionSchema;\n }\n}\n\nexport const commercialConditionsSchema = z\n .object({\n action: commercialConditionActionSchema,\n profileId: requiredProfileIdSchemaField,\n search: z.string().trim().min(1).optional().describe(\"Optional text filter for condition name lookup.\"),\n commercialConditionId: commercialConditionIdSchemaField.optional(),\n })\n .superRefine((value, ctx) => {\n const validation = getCommercialConditionsActionSchema(value.action).safeParse(value);\n if (validation.success) {\n return;\n }\n\n for (const issue of validation.error.issues) {\n ctx.addIssue(issue as Parameters<typeof ctx.addIssue>[0]);\n }\n });\n\nexport async function commercialConditionsHandler(params: z.infer<typeof commercialConditionsSchema>) {\n switch (params.action) {\n case \"list\": {\n const validatedParams = listActionSchema.parse(params);\n\n try {\n const conditions = await listCommercialConditions(validatedParams.profileId, validatedParams.search);\n\n return object({\n metadata: stripNulls({\n total: conditions.length,\n profile_id: validatedParams.profileId,\n search: validatedParams.search,\n }),\n conditions_schema: conditionRowsSchema,\n conditions: conditions.map((condition) => [\n readValue(condition, \"id\", \"Id\"),\n readValue(condition, \"name\", \"Name\"),\n readValue(condition, \"isActive\", \"IsActive\", \"is_active\"),\n ]),\n });\n } catch (err) {\n return error(formatVtexError(err, \"Failed to list VTEX commercial conditions\"));\n }\n }\n\n case \"get\": {\n const validatedParams = getActionSchema.parse(params);\n\n try {\n const condition = await getCommercialCondition(\n validatedParams.profileId,\n validatedParams.commercialConditionId\n );\n\n return object({\n profile_id: validatedParams.profileId,\n commercial_condition_id: validatedParams.commercialConditionId,\n condition: toSnakeCaseKeys(condition),\n });\n } catch (err) {\n return error(\n formatVtexError(\n err,\n `Failed to fetch VTEX commercial condition ${validatedParams.commercialConditionId}`\n )\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,SAAS,SAAS;AAElB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SA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S,KAA2C;AAAA,EAC1D;AACF,CAAC;AAEH,eAAsB,4BAA4B,QAAoD;AACpG,UAAQ,OAAO,QAAQ;AAAA,IACrB,KAAK,QAAQ;AACX,YAAM,kBAAkB,iBAAiB,MAAM,MAAM;AAErD,UAAI;AACF,cAAM,aAAa,MAAM,yBAAyB,gBAAgB,WAAW,gBAAgB,MAAM;AAEnG,eAAO,OAAO;AAAA,UACZ,UAAU,WAAW;AAAA,YACnB,OAAO,WAAW;AAAA,YAClB,YAAY,gBAAgB;AAAA,YAC5B,QAAQ,gBAAgB;AAAA,UAC1B,CAAC;AAAA,UACD,mBAAmB;AAAA,UACnB,YAAY,WAAW,IAAI,CAAC,cAAc;AAAA,YACxC,UAAU,WAAW,MAAM,IAAI;AAAA,YAC/B,UAAU,WAAW,QAAQ,MAAM;AAAA,YACnC,UAAU,WAAW,YAAY,YAAY,WAAW;AAAA,UAC1D,CAAC;AAAA,QACH,CAAC;AAAA,MACH,SAAS,KAAK;AACZ,eAAO,MAAM,gBAAgB,KAAK,2CAA2C,CAAC;AAAA,MAChF;AAAA,IACF;AAAA,IAEA,KAAK,OAAO;AACV,YAAM,kBAAkB,gBAAgB,MAAM,MAAM;AAEpD,UAAI;AACF,cAAM,YAAY,MAAM;AAAA,UACtB,gBAAgB;AAAA,UAChB,gBAAgB;AAAA,QAClB;AAEA,eAAO,OAAO;AAAA,UACZ,YAAY,gBAAgB;AAAA,UAC5B,yBAAyB,gBAAgB;AAAA,UACzC,WAAW,gBAAgB,SAAS;AAAA,QACtC,CAAC;AAAA,MACH,SAAS,KAAK;AACZ,eAAO;AAAA,UACL;AAAA,YACE;AAAA,YACA,6CAA6C,gBAAgB,qBAAqB;AAAA,UACpF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,7 +26,7 @@ const createSkuSchema = z.object({
|
|
|
26
26
|
unitMultiplier: z.number().positive().optional().describe("Unit multiplier."),
|
|
27
27
|
manufacturerCode: z.string().optional().describe("Manufacturer code."),
|
|
28
28
|
commercialConditionId: z.number().int().positive().optional().describe(
|
|
29
|
-
"Commercial condition ID. Use vtex_commercial_conditions to
|
|
29
|
+
"Commercial condition ID. Use vtex_commercial_conditions to inspect available condition IDs and vtex_payment_rules to configure linked installment/payment behavior."
|
|
30
30
|
)
|
|
31
31
|
});
|
|
32
32
|
async function createSkuHandler({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/tools/vtex/create-sku.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from \"zod\";\n\nimport { createSku, createSkuEan } from \"../../services/vtex/vtex-catalog-write.js\";\nimport {\n buildWriteSuccessResponse,\n handleVtexWriteError,\n resolveVtexWriteProfile,\n vtexProfileIdSchemaField,\n} from \"./write-helpers.js\";\n\nexport const createSkuSchema = z.object({\n profileId: vtexProfileIdSchemaField,\n productId: z.number().int().positive().describe(\"Parent product ID.\"),\n name: z.string().min(1).describe(\"SKU name.\"),\n refId: z.string().min(1).describe(\"Internal SKU reference code.\"),\n ean: z.string().optional().describe(\"Optional EAN to attach after SKU creation.\"),\n packagedHeight: z.number().nonnegative().describe(\"Packaged height.\"),\n packagedLength: z.number().nonnegative().describe(\"Packaged length.\"),\n packagedWidth: z.number().nonnegative().describe(\"Packaged width.\"),\n packagedWeightKg: z.number().nonnegative().describe(\"Packaged weight in kg.\"),\n height: z.number().nonnegative().optional().describe(\"Physical height.\"),\n length: z.number().nonnegative().optional().describe(\"Physical length.\"),\n width: z.number().nonnegative().optional().describe(\"Physical width.\"),\n weightKg: z.number().nonnegative().optional().describe(\"Physical weight in kg.\"),\n isActive: z\n .boolean()\n .optional()\n .describe(\"Whether the SKU should be created as active. VTEX recommends false during creation.\"),\n activateIfPossible: z\n .boolean()\n .optional()\n .describe(\"Whether VTEX should auto-activate the SKU when an image or active component exists.\"),\n measurementUnit: z.string().optional().describe(\"Measurement unit, for example `un`.\"),\n unitMultiplier: z.number().positive().optional().describe(\"Unit multiplier.\"),\n manufacturerCode: z.string().optional().describe(\"Manufacturer code.\"),\n commercialConditionId: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n \"Commercial condition ID. Use vtex_commercial_conditions to
|
|
4
|
+
"sourcesContent": ["import { z } from \"zod\";\n\nimport { createSku, createSkuEan } from \"../../services/vtex/vtex-catalog-write.js\";\nimport {\n buildWriteSuccessResponse,\n handleVtexWriteError,\n resolveVtexWriteProfile,\n vtexProfileIdSchemaField,\n} from \"./write-helpers.js\";\n\nexport const createSkuSchema = z.object({\n profileId: vtexProfileIdSchemaField,\n productId: z.number().int().positive().describe(\"Parent product ID.\"),\n name: z.string().min(1).describe(\"SKU name.\"),\n refId: z.string().min(1).describe(\"Internal SKU reference code.\"),\n ean: z.string().optional().describe(\"Optional EAN to attach after SKU creation.\"),\n packagedHeight: z.number().nonnegative().describe(\"Packaged height.\"),\n packagedLength: z.number().nonnegative().describe(\"Packaged length.\"),\n packagedWidth: z.number().nonnegative().describe(\"Packaged width.\"),\n packagedWeightKg: z.number().nonnegative().describe(\"Packaged weight in kg.\"),\n height: z.number().nonnegative().optional().describe(\"Physical height.\"),\n length: z.number().nonnegative().optional().describe(\"Physical length.\"),\n width: z.number().nonnegative().optional().describe(\"Physical width.\"),\n weightKg: z.number().nonnegative().optional().describe(\"Physical weight in kg.\"),\n isActive: z\n .boolean()\n .optional()\n .describe(\"Whether the SKU should be created as active. VTEX recommends false during creation.\"),\n activateIfPossible: z\n .boolean()\n .optional()\n .describe(\"Whether VTEX should auto-activate the SKU when an image or active component exists.\"),\n measurementUnit: z.string().optional().describe(\"Measurement unit, for example `un`.\"),\n unitMultiplier: z.number().positive().optional().describe(\"Unit multiplier.\"),\n manufacturerCode: z.string().optional().describe(\"Manufacturer code.\"),\n commercialConditionId: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n \"Commercial condition ID. Use vtex_commercial_conditions to inspect available condition IDs and vtex_payment_rules to configure linked installment/payment behavior.\"\n ),\n});\n\nexport async function createSkuHandler({\n profileId,\n productId,\n name,\n refId,\n ean,\n packagedHeight,\n packagedLength,\n packagedWidth,\n packagedWeightKg,\n height,\n length,\n width,\n weightKg,\n isActive,\n activateIfPossible,\n measurementUnit,\n unitMultiplier,\n manufacturerCode,\n commercialConditionId,\n}: z.infer<typeof createSkuSchema>) {\n try {\n const profileResolution = await resolveVtexWriteProfile(profileId);\n if (!profileResolution.ok) {\n return profileResolution.response;\n }\n\n const resolvedProfileId = profileResolution.value.profileId;\n const payload: Record<string, unknown> = {\n ProductId: productId,\n Name: name,\n RefId: refId,\n PackagedHeight: packagedHeight,\n PackagedLength: packagedLength,\n PackagedWidth: packagedWidth,\n PackagedWeightKg: packagedWeightKg,\n ActivateIfPossible: activateIfPossible ?? true,\n IsActive: isActive ?? false,\n };\n\n if (height !== undefined) payload.Height = height;\n if (length !== undefined) payload.Length = length;\n if (width !== undefined) payload.Width = width;\n if (weightKg !== undefined) payload.WeightKg = weightKg;\n if (measurementUnit !== undefined) payload.MeasurementUnit = measurementUnit;\n if (unitMultiplier !== undefined) payload.UnitMultiplier = unitMultiplier;\n if (manufacturerCode !== undefined) payload.ManufacturerCode = manufacturerCode;\n if (commercialConditionId !== undefined) payload.CommercialConditionId = commercialConditionId;\n\n const createdSku = await createSku(resolvedProfileId, payload);\n const resourceId = createdSku.Id == null ? undefined : String(createdSku.Id);\n\n if (resourceId && ean?.trim()) {\n await createSkuEan(resolvedProfileId, resourceId, ean.trim());\n createdSku.Eans = [ean.trim()];\n }\n\n return buildWriteSuccessResponse({\n profileId: resolvedProfileId,\n operation: \"create_sku\",\n resourceId,\n riskLevel: \"low\",\n message: \"SKU created successfully.\",\n before: null,\n after: createdSku,\n details: {\n product_id: productId,\n sku_id: resourceId,\n },\n });\n } catch (err) {\n return handleVtexWriteError(err, \"Failed to create SKU in VTEX\");\n }\n}\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,S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cAAc,KAAK,KAAK,GAAG;AAC7B,YAAM,aAAa,mBAAmB,YAAY,IAAI,KAAK,CAAC;AAC5D,iBAAW,OAAO,CAAC,IAAI,KAAK,CAAC;AAAA,IAC/B;AAEA,WAAO,0BAA0B;AAAA,MAC/B,WAAW;AAAA,MACX,WAAW;AAAA,MACX;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,SAAS;AAAA,QACP,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,WAAO,qBAAqB,KAAK,8BAA8B;AAAA,EACjE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,9 +14,11 @@ import {
|
|
|
14
14
|
confirmationSchemaField,
|
|
15
15
|
handleVtexWriteError,
|
|
16
16
|
requireExplicitConfirmation,
|
|
17
|
-
resolveVtexWriteProfile
|
|
17
|
+
resolveVtexWriteProfile,
|
|
18
|
+
vtexProfileIdSchemaField
|
|
18
19
|
} from "./write-helpers.js";
|
|
19
|
-
const requiredProfileIdSchemaField =
|
|
20
|
+
const requiredProfileIdSchemaField = vtexProfileIdSchemaField.unwrap().describe("Explicit VTEX profile id to use for this operation.");
|
|
21
|
+
const paymentRuleActionSchema = z.enum(["list", "get", "create", "update", "delete"]).describe("Action to perform for VTEX payment rules.");
|
|
20
22
|
const positiveIntegerSchemaField = (description) => z.number().int().positive().describe(description);
|
|
21
23
|
const installmentsSchemaField = z.array(
|
|
22
24
|
z.object({
|
|
@@ -89,25 +91,54 @@ const deleteActionSchema = z.object({
|
|
|
89
91
|
ruleId: positiveIntegerSchemaField("Positive VTEX payment rule identifier."),
|
|
90
92
|
confirmed: confirmationSchemaField
|
|
91
93
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
function getPaymentRulesActionSchema(action) {
|
|
95
|
+
switch (action) {
|
|
96
|
+
case "list":
|
|
97
|
+
return listActionSchema;
|
|
98
|
+
case "get":
|
|
99
|
+
return getActionSchema;
|
|
100
|
+
case "create":
|
|
101
|
+
return createActionSchema;
|
|
102
|
+
case "update":
|
|
103
|
+
return updateActionSchema;
|
|
104
|
+
case "delete":
|
|
105
|
+
return deleteActionSchema;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const paymentRulesSchema = z.object({
|
|
109
|
+
action: paymentRuleActionSchema,
|
|
110
|
+
profileId: requiredProfileIdSchemaField,
|
|
111
|
+
commercialConditionId: positiveIntegerSchemaField(
|
|
112
|
+
"Commercial condition identifier linked to this payment rule."
|
|
113
|
+
).optional(),
|
|
114
|
+
ruleId: positiveIntegerSchemaField("Positive VTEX payment rule identifier.").optional(),
|
|
115
|
+
paymentSystem: z.string().trim().min(1).optional().describe("VTEX payment system identifier."),
|
|
116
|
+
salesChannel: z.string().trim().min(1).optional().describe("Optional VTEX sales channel identifier."),
|
|
117
|
+
restrictedByCondition: z.boolean().optional().describe("Whether checkout should restrict this rule to the linked commercial condition."),
|
|
118
|
+
installments: installmentsSchemaField.optional(),
|
|
119
|
+
confirmed: confirmationSchemaField
|
|
120
|
+
}).superRefine((value, ctx) => {
|
|
121
|
+
const validation = getPaymentRulesActionSchema(value.action).safeParse(value);
|
|
122
|
+
if (validation.success) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
for (const issue of validation.error.issues) {
|
|
126
|
+
ctx.addIssue(issue);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
99
129
|
async function paymentRulesHandler(params) {
|
|
100
130
|
switch (params.action) {
|
|
101
131
|
case "list": {
|
|
132
|
+
const validatedParams = listActionSchema.parse(params);
|
|
102
133
|
try {
|
|
103
|
-
const rules = await listPaymentRules(
|
|
104
|
-
commercialConditionId:
|
|
134
|
+
const rules = await listPaymentRules(validatedParams.profileId, {
|
|
135
|
+
commercialConditionId: validatedParams.commercialConditionId
|
|
105
136
|
});
|
|
106
137
|
return object({
|
|
107
138
|
metadata: stripNulls({
|
|
108
139
|
total: rules.length,
|
|
109
|
-
profile_id:
|
|
110
|
-
filters:
|
|
140
|
+
profile_id: validatedParams.profileId,
|
|
141
|
+
filters: validatedParams.commercialConditionId === void 0 ? void 0 : { commercial_condition_id: validatedParams.commercialConditionId }
|
|
111
142
|
}),
|
|
112
143
|
payment_rules_schema: paymentRuleRowsSchema,
|
|
113
144
|
payment_rules: rules.map((rule) => [
|
|
@@ -128,29 +159,33 @@ async function paymentRulesHandler(params) {
|
|
|
128
159
|
}
|
|
129
160
|
}
|
|
130
161
|
case "get": {
|
|
162
|
+
const validatedParams = getActionSchema.parse(params);
|
|
131
163
|
try {
|
|
132
|
-
const rule = await getPaymentRule(
|
|
164
|
+
const rule = await getPaymentRule(validatedParams.profileId, validatedParams.ruleId);
|
|
133
165
|
return object({
|
|
134
|
-
profile_id:
|
|
135
|
-
rule_id:
|
|
166
|
+
profile_id: validatedParams.profileId,
|
|
167
|
+
rule_id: validatedParams.ruleId,
|
|
136
168
|
payment_rule: toSnakeCaseKeys(rule)
|
|
137
169
|
});
|
|
138
170
|
} catch (err) {
|
|
139
|
-
return error(
|
|
171
|
+
return error(
|
|
172
|
+
formatVtexError(err, `Failed to fetch VTEX payment rule ${validatedParams.ruleId}`)
|
|
173
|
+
);
|
|
140
174
|
}
|
|
141
175
|
}
|
|
142
176
|
case "create": {
|
|
177
|
+
const validatedParams = createActionSchema.parse(params);
|
|
143
178
|
try {
|
|
144
|
-
const profileResolution = await resolveVtexWriteProfile(
|
|
179
|
+
const profileResolution = await resolveVtexWriteProfile(validatedParams.profileId);
|
|
145
180
|
if (!profileResolution.ok) {
|
|
146
181
|
return profileResolution.response;
|
|
147
182
|
}
|
|
148
183
|
const created = await createPaymentRule(profileResolution.value.profileId, {
|
|
149
|
-
commercialConditionId:
|
|
150
|
-
paymentSystem:
|
|
151
|
-
...
|
|
152
|
-
...
|
|
153
|
-
installments:
|
|
184
|
+
commercialConditionId: validatedParams.commercialConditionId,
|
|
185
|
+
paymentSystem: validatedParams.paymentSystem,
|
|
186
|
+
...validatedParams.salesChannel !== void 0 ? { salesChannel: validatedParams.salesChannel } : {},
|
|
187
|
+
...validatedParams.restrictedByCondition !== void 0 ? { restrictedByCondition: validatedParams.restrictedByCondition } : {},
|
|
188
|
+
installments: validatedParams.installments
|
|
154
189
|
});
|
|
155
190
|
return buildWriteSuccessResponse({
|
|
156
191
|
profileId: profileResolution.value.profileId,
|
|
@@ -166,49 +201,54 @@ async function paymentRulesHandler(params) {
|
|
|
166
201
|
}
|
|
167
202
|
}
|
|
168
203
|
case "update": {
|
|
204
|
+
const validatedParams = updateActionSchema.parse(params);
|
|
169
205
|
try {
|
|
170
|
-
const profileResolution = await resolveVtexWriteProfile(
|
|
206
|
+
const profileResolution = await resolveVtexWriteProfile(validatedParams.profileId);
|
|
171
207
|
if (!profileResolution.ok) {
|
|
172
208
|
return profileResolution.response;
|
|
173
209
|
}
|
|
174
|
-
const updated = await updatePaymentRule(profileResolution.value.profileId,
|
|
175
|
-
...
|
|
176
|
-
...
|
|
177
|
-
...
|
|
178
|
-
...
|
|
179
|
-
...
|
|
210
|
+
const updated = await updatePaymentRule(profileResolution.value.profileId, validatedParams.ruleId, {
|
|
211
|
+
...validatedParams.commercialConditionId !== void 0 ? { commercialConditionId: validatedParams.commercialConditionId } : {},
|
|
212
|
+
...validatedParams.paymentSystem !== void 0 ? { paymentSystem: validatedParams.paymentSystem } : {},
|
|
213
|
+
...validatedParams.salesChannel !== void 0 ? { salesChannel: validatedParams.salesChannel } : {},
|
|
214
|
+
...validatedParams.restrictedByCondition !== void 0 ? { restrictedByCondition: validatedParams.restrictedByCondition } : {},
|
|
215
|
+
...validatedParams.installments !== void 0 ? { installments: validatedParams.installments } : {}
|
|
180
216
|
});
|
|
181
217
|
return buildWriteSuccessResponse({
|
|
182
218
|
profileId: profileResolution.value.profileId,
|
|
183
219
|
operation: "payment_rules_update",
|
|
184
|
-
resourceId: String(
|
|
220
|
+
resourceId: String(validatedParams.ruleId),
|
|
185
221
|
riskLevel: "medium",
|
|
186
222
|
message: "Payment rule updated. Review checkout installments to confirm the expected payment options.",
|
|
187
223
|
before: null,
|
|
188
224
|
after: updated
|
|
189
225
|
});
|
|
190
226
|
} catch (err) {
|
|
191
|
-
return handleVtexWriteError(
|
|
227
|
+
return handleVtexWriteError(
|
|
228
|
+
err,
|
|
229
|
+
`Failed to update VTEX payment rule ${validatedParams.ruleId}`
|
|
230
|
+
);
|
|
192
231
|
}
|
|
193
232
|
}
|
|
194
233
|
case "delete": {
|
|
195
|
-
const
|
|
196
|
-
|
|
234
|
+
const validatedParams = deleteActionSchema.parse(params);
|
|
235
|
+
const confirmationResponse = requireExplicitConfirmation(validatedParams.confirmed, "payment_rules_delete", {
|
|
236
|
+
rule_id: validatedParams.ruleId,
|
|
197
237
|
warnings: [paymentRuleWarnings.delete]
|
|
198
238
|
});
|
|
199
239
|
if (confirmationResponse) {
|
|
200
240
|
return confirmationResponse;
|
|
201
241
|
}
|
|
202
242
|
try {
|
|
203
|
-
const profileResolution = await resolveVtexWriteProfile(
|
|
243
|
+
const profileResolution = await resolveVtexWriteProfile(validatedParams.profileId);
|
|
204
244
|
if (!profileResolution.ok) {
|
|
205
245
|
return profileResolution.response;
|
|
206
246
|
}
|
|
207
|
-
await deletePaymentRule(profileResolution.value.profileId,
|
|
247
|
+
await deletePaymentRule(profileResolution.value.profileId, validatedParams.ruleId);
|
|
208
248
|
return buildWriteSuccessResponse({
|
|
209
249
|
profileId: profileResolution.value.profileId,
|
|
210
250
|
operation: "payment_rules_delete",
|
|
211
|
-
resourceId: String(
|
|
251
|
+
resourceId: String(validatedParams.ruleId),
|
|
212
252
|
riskLevel: "high",
|
|
213
253
|
confirmed: true,
|
|
214
254
|
message: "Payment rule deleted. Verify checkout no longer exposes the removed installment option to affected shoppers.",
|
|
@@ -217,7 +257,10 @@ async function paymentRulesHandler(params) {
|
|
|
217
257
|
after: null
|
|
218
258
|
});
|
|
219
259
|
} catch (err) {
|
|
220
|
-
return handleVtexWriteError(
|
|
260
|
+
return handleVtexWriteError(
|
|
261
|
+
err,
|
|
262
|
+
`Failed to delete VTEX payment rule ${validatedParams.ruleId}`
|
|
263
|
+
);
|
|
221
264
|
}
|
|
222
265
|
}
|
|
223
266
|
}
|