@yoryoboy/bi-mcp 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp-use.json +2 -2
- package/dist/src/services/mercadolibre/__tests__/mercadolibre-payments.test.js +137 -0
- package/dist/src/services/mercadolibre/__tests__/mercadolibre-payments.test.js.map +7 -0
- package/dist/src/services/mercadolibre/mercadolibre-api.js +2 -2
- package/dist/src/services/mercadolibre/mercadolibre-api.js.map +2 -2
- package/dist/src/services/mercadolibre/mercadolibre-billing.js +93 -1
- package/dist/src/services/mercadolibre/mercadolibre-billing.js.map +2 -2
- package/dist/src/services/mercadolibre/mercadolibre-payments.js +60 -0
- package/dist/src/services/mercadolibre/mercadolibre-payments.js.map +7 -0
- package/dist/src/tools/mercadolibre/get-billing-provisions-by-order.js +284 -0
- package/dist/src/tools/mercadolibre/get-billing-provisions-by-order.js.map +7 -0
- package/dist/src/tools/mercadolibre/get-full-storage-charges.js +183 -0
- package/dist/src/tools/mercadolibre/get-full-storage-charges.js.map +7 -0
- package/dist/src/tools/mercadolibre/get-payment-details.js +322 -0
- package/dist/src/tools/mercadolibre/get-payment-details.js.map +7 -0
- package/dist/src/tools/mercadolibre/index.js +20 -0
- package/dist/src/tools/mercadolibre/index.js.map +2 -2
- package/dist/tests/meli/mercadolibre-billing-provisions.test.js +176 -0
- package/dist/tests/meli/mercadolibre-billing-provisions.test.js.map +2 -2
- package/dist/tests/meli/mercadolibre-payment-details.test.js +356 -0
- package/dist/tests/meli/mercadolibre-payment-details.test.js.map +7 -0
- package/dist/tests/meli/mercadolibre-payments.test.js +62 -0
- package/dist/tests/meli/mercadolibre-payments.test.js.map +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { error, object } from "mcp-use/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import {
|
|
4
|
+
formatMercadoLibreError
|
|
5
|
+
} from "../../services/mercadolibre/mercadolibre-api.js";
|
|
6
|
+
import {
|
|
7
|
+
getMercadoLibreBillingProvisionsByOrder
|
|
8
|
+
} from "../../services/mercadolibre/mercadolibre-billing.js";
|
|
9
|
+
import { stripNulls } from "../../utils/strip-payload.js";
|
|
10
|
+
import {
|
|
11
|
+
asRecord,
|
|
12
|
+
normalizeScalarString,
|
|
13
|
+
toNumber
|
|
14
|
+
} from "./helpers.js";
|
|
15
|
+
import { resolveMercadoLibreProfileOrSelection } from "./profile-resolution.js";
|
|
16
|
+
const meliGetBillingProvisionsByOrderSchema = z.object({
|
|
17
|
+
profileId: z.string().trim().min(1).describe("Explicit MercadoLibre profile id to use."),
|
|
18
|
+
orderIds: z.array(z.string().trim().min(1).describe("MercadoLibre order id.")).min(1).describe("One or more MercadoLibre order IDs to fetch billing provisions for.")
|
|
19
|
+
});
|
|
20
|
+
const ordersSchema = [
|
|
21
|
+
"order_id",
|
|
22
|
+
"sale_fee",
|
|
23
|
+
"payment_info_count",
|
|
24
|
+
"detail_count",
|
|
25
|
+
"document_id",
|
|
26
|
+
"currency_id",
|
|
27
|
+
"marketplace"
|
|
28
|
+
];
|
|
29
|
+
const paymentInfoSchema = [
|
|
30
|
+
"order_id",
|
|
31
|
+
"payment_id",
|
|
32
|
+
"payment_type",
|
|
33
|
+
"payment_method_id",
|
|
34
|
+
"installments",
|
|
35
|
+
"transaction_amount",
|
|
36
|
+
"total_paid_amount",
|
|
37
|
+
"shipping_cost",
|
|
38
|
+
"coupon_amount",
|
|
39
|
+
"status",
|
|
40
|
+
"status_detail"
|
|
41
|
+
];
|
|
42
|
+
const detailsSchema = [
|
|
43
|
+
"order_id",
|
|
44
|
+
"detail_id",
|
|
45
|
+
"detail_type",
|
|
46
|
+
"detail_sub_type",
|
|
47
|
+
"transaction_detail",
|
|
48
|
+
"detail_amount",
|
|
49
|
+
"currency_id",
|
|
50
|
+
"concept_type",
|
|
51
|
+
"operation_id",
|
|
52
|
+
"shipping_id",
|
|
53
|
+
"pack_id",
|
|
54
|
+
"inventory_id"
|
|
55
|
+
];
|
|
56
|
+
const detailsSalesSchema = [
|
|
57
|
+
"detail_id",
|
|
58
|
+
"order_id",
|
|
59
|
+
"operation_id",
|
|
60
|
+
"sale_date_time",
|
|
61
|
+
"payer_nickname",
|
|
62
|
+
"transaction_amount"
|
|
63
|
+
];
|
|
64
|
+
const detailsItemsSchema = [
|
|
65
|
+
"detail_id",
|
|
66
|
+
"item_id",
|
|
67
|
+
"item_title",
|
|
68
|
+
"item_amount",
|
|
69
|
+
"item_price",
|
|
70
|
+
"item_kit_id",
|
|
71
|
+
"store_id",
|
|
72
|
+
"order_id"
|
|
73
|
+
];
|
|
74
|
+
function asRecordArray(value) {
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
return value.filter(
|
|
77
|
+
(entry) => entry != null && typeof entry === "object" && !Array.isArray(entry)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const record = asRecord(value);
|
|
81
|
+
return Object.keys(record).length > 0 ? [record] : [];
|
|
82
|
+
}
|
|
83
|
+
function projectOrderRow(row) {
|
|
84
|
+
const paymentInfo = asRecordArray(row.payment_info);
|
|
85
|
+
const details = asRecordArray(row.details);
|
|
86
|
+
const firstDetail = details[0] ?? {};
|
|
87
|
+
const orderId = normalizeScalarString(row.order_id) || normalizeScalarString(asRecord(row.payment_info).order_id) || normalizeScalarString(firstDetail.order_id) || null;
|
|
88
|
+
const documentInfo = asRecord(row.document_info);
|
|
89
|
+
const currencyInfo = asRecord(row.currency_info);
|
|
90
|
+
const marketplaceInfo = asRecord(row.marketplace_info);
|
|
91
|
+
return [
|
|
92
|
+
orderId,
|
|
93
|
+
// 0: order_id
|
|
94
|
+
row.sale_fee == null ? null : toNumber(row.sale_fee),
|
|
95
|
+
// 1: sale_fee
|
|
96
|
+
paymentInfo.length,
|
|
97
|
+
// 2: payment_info_count
|
|
98
|
+
details.length,
|
|
99
|
+
// 3: detail_count
|
|
100
|
+
normalizeScalarString(documentInfo.document_id ?? row.document_id) || null,
|
|
101
|
+
// 4: document_id
|
|
102
|
+
normalizeScalarString(currencyInfo.currency_id ?? row.currency_id) || null,
|
|
103
|
+
// 5: currency_id
|
|
104
|
+
normalizeScalarString(marketplaceInfo.marketplace ?? row.marketplace) || null
|
|
105
|
+
// 6: marketplace
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
function projectPaymentRow(orderId, payment) {
|
|
109
|
+
return [
|
|
110
|
+
orderId,
|
|
111
|
+
// 0: order_id
|
|
112
|
+
normalizeScalarString(payment.payment_id ?? payment.id) || null,
|
|
113
|
+
// 1: payment_id
|
|
114
|
+
normalizeScalarString(payment.payment_type) || null,
|
|
115
|
+
// 2: payment_type
|
|
116
|
+
normalizeScalarString(payment.payment_method_id) || null,
|
|
117
|
+
// 3: payment_method_id
|
|
118
|
+
toNumber(payment.installments),
|
|
119
|
+
// 4: installments
|
|
120
|
+
toNumber(payment.transaction_amount),
|
|
121
|
+
// 5: transaction_amount
|
|
122
|
+
toNumber(payment.total_paid_amount),
|
|
123
|
+
// 6: total_paid_amount
|
|
124
|
+
toNumber(payment.shipping_cost),
|
|
125
|
+
// 7: shipping_cost
|
|
126
|
+
toNumber(payment.coupon_amount),
|
|
127
|
+
// 8: coupon_amount
|
|
128
|
+
normalizeScalarString(payment.status) || null,
|
|
129
|
+
// 9: status
|
|
130
|
+
normalizeScalarString(payment.status_detail) || null
|
|
131
|
+
// 10: status_detail
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
function projectDetailRow(orderId, detail) {
|
|
135
|
+
return [
|
|
136
|
+
orderId,
|
|
137
|
+
// 0: order_id
|
|
138
|
+
normalizeScalarString(detail.detail_id) || null,
|
|
139
|
+
// 1: detail_id
|
|
140
|
+
normalizeScalarString(detail.detail_type) || null,
|
|
141
|
+
// 2: detail_type
|
|
142
|
+
normalizeScalarString(detail.detail_sub_type) || null,
|
|
143
|
+
// 3: detail_sub_type
|
|
144
|
+
normalizeScalarString(detail.transaction_detail) || null,
|
|
145
|
+
// 4: transaction_detail
|
|
146
|
+
toNumber(detail.detail_amount),
|
|
147
|
+
// 5: detail_amount
|
|
148
|
+
normalizeScalarString(detail.currency_id) || null,
|
|
149
|
+
// 6: currency_id
|
|
150
|
+
normalizeScalarString(detail.concept_type) || null,
|
|
151
|
+
// 7: concept_type
|
|
152
|
+
normalizeScalarString(detail.operation_id) || null,
|
|
153
|
+
// 8: operation_id
|
|
154
|
+
normalizeScalarString(detail.shipping_id) || null,
|
|
155
|
+
// 9: shipping_id
|
|
156
|
+
normalizeScalarString(detail.pack_id) || null,
|
|
157
|
+
// 10: pack_id
|
|
158
|
+
normalizeScalarString(detail.inventory_id) || null
|
|
159
|
+
// 11: inventory_id
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
function projectSalesRow(detailId, sale) {
|
|
163
|
+
return [
|
|
164
|
+
detailId,
|
|
165
|
+
// 0: detail_id
|
|
166
|
+
normalizeScalarString(sale.order_id) || null,
|
|
167
|
+
// 1: order_id
|
|
168
|
+
normalizeScalarString(sale.operation_id) || null,
|
|
169
|
+
// 2: operation_id
|
|
170
|
+
normalizeScalarString(sale.sale_date_time) || null,
|
|
171
|
+
// 3: sale_date_time
|
|
172
|
+
normalizeScalarString(sale.payer_nickname) || null,
|
|
173
|
+
// 4: payer_nickname
|
|
174
|
+
toNumber(sale.transaction_amount)
|
|
175
|
+
// 5: transaction_amount
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
function projectItemsRow(detailId, item) {
|
|
179
|
+
return [
|
|
180
|
+
detailId,
|
|
181
|
+
// 0: detail_id
|
|
182
|
+
normalizeScalarString(item.item_id) || null,
|
|
183
|
+
// 1: item_id
|
|
184
|
+
normalizeScalarString(item.item_title) || null,
|
|
185
|
+
// 2: item_title
|
|
186
|
+
toNumber(item.item_amount),
|
|
187
|
+
// 3: item_amount
|
|
188
|
+
toNumber(item.item_price),
|
|
189
|
+
// 4: item_price
|
|
190
|
+
normalizeScalarString(item.item_kit_id) || null,
|
|
191
|
+
// 5: item_kit_id
|
|
192
|
+
normalizeScalarString(item.store_id) || null,
|
|
193
|
+
// 6: store_id
|
|
194
|
+
normalizeScalarString(item.order_id) || null
|
|
195
|
+
// 7: order_id
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
async function meliGetBillingProvisionsByOrderHandler(params) {
|
|
199
|
+
try {
|
|
200
|
+
const profileResolution = await resolveMercadoLibreProfileOrSelection(params.profileId);
|
|
201
|
+
if (!profileResolution.ok) {
|
|
202
|
+
return profileResolution.response;
|
|
203
|
+
}
|
|
204
|
+
const profileId = profileResolution.value.profileId;
|
|
205
|
+
const result = await getMercadoLibreBillingProvisionsByOrder(profileId, {
|
|
206
|
+
orderIds: params.orderIds
|
|
207
|
+
});
|
|
208
|
+
const orderRows = [];
|
|
209
|
+
const paymentRows = [];
|
|
210
|
+
const detailRows = [];
|
|
211
|
+
const salesRows = [];
|
|
212
|
+
const itemsRows = [];
|
|
213
|
+
for (const row of result.results) {
|
|
214
|
+
const orderId = normalizeScalarString(row.order_id) || null;
|
|
215
|
+
orderRows.push(projectOrderRow(row));
|
|
216
|
+
const paymentInfoRows = asRecordArray(row.payment_info);
|
|
217
|
+
for (const paymentInfo of paymentInfoRows) {
|
|
218
|
+
paymentRows.push(projectPaymentRow(orderId, paymentInfo));
|
|
219
|
+
}
|
|
220
|
+
const details = asRecordArray(row.details);
|
|
221
|
+
for (const detail of details) {
|
|
222
|
+
const detailId = normalizeScalarString(detail.detail_id) || null;
|
|
223
|
+
detailRows.push(projectDetailRow(orderId, detail));
|
|
224
|
+
const detailSales = asRecordArray(detail.sales_info ?? detail.details_sales);
|
|
225
|
+
for (const ds of detailSales) {
|
|
226
|
+
salesRows.push(projectSalesRow(detailId, ds));
|
|
227
|
+
}
|
|
228
|
+
const detailItems = asRecordArray(detail.items_info ?? detail.details_items);
|
|
229
|
+
for (const di of detailItems) {
|
|
230
|
+
itemsRows.push(projectItemsRow(detailId, di));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const saleFeeNote = "sale_fee may be null for some orders depending on how Mercado Libre settles the billing provision. Preserve it as nullable in downstream analysis.";
|
|
235
|
+
const metadata = {
|
|
236
|
+
order_ids_requested: result.order_ids_requested,
|
|
237
|
+
order_ids_found: result.order_ids_found,
|
|
238
|
+
order_ids_not_found: result.order_ids_not_found,
|
|
239
|
+
request_chunks_total: result.chunks_total,
|
|
240
|
+
request_chunks_succeeded: result.chunks_succeeded,
|
|
241
|
+
request_chunks_failed: result.chunks_failed,
|
|
242
|
+
coverage_complete: result.coverage_complete,
|
|
243
|
+
endpoint: "/billing/integration/group/ML/order/details",
|
|
244
|
+
sale_fee_note: saleFeeNote
|
|
245
|
+
};
|
|
246
|
+
if (result.failures.length > 0) {
|
|
247
|
+
metadata.failures = result.failures;
|
|
248
|
+
}
|
|
249
|
+
const stripped = stripNulls({
|
|
250
|
+
profile_id: profileId,
|
|
251
|
+
endpoint: "/billing/integration/group/ML/order/details",
|
|
252
|
+
metadata
|
|
253
|
+
});
|
|
254
|
+
stripped.orders_schema = ordersSchema;
|
|
255
|
+
stripped.orders = orderRows;
|
|
256
|
+
stripped.payment_info_schema = paymentInfoSchema;
|
|
257
|
+
stripped.payment_info = paymentRows;
|
|
258
|
+
stripped.details_schema = detailsSchema;
|
|
259
|
+
stripped.details = detailRows;
|
|
260
|
+
stripped.details_sales_schema = detailsSalesSchema;
|
|
261
|
+
stripped.details_sales = salesRows;
|
|
262
|
+
stripped.details_items_schema = detailsItemsSchema;
|
|
263
|
+
stripped.details_items = itemsRows;
|
|
264
|
+
const meta = stripped.metadata;
|
|
265
|
+
meta.order_ids_requested = result.order_ids_requested;
|
|
266
|
+
meta.order_ids_found = result.order_ids_found;
|
|
267
|
+
meta.order_ids_not_found = result.order_ids_not_found;
|
|
268
|
+
return object(stripped);
|
|
269
|
+
} catch (err) {
|
|
270
|
+
return error(
|
|
271
|
+
formatMercadoLibreError(err, "Failed to get MercadoLibre billing provisions by order")
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
export {
|
|
276
|
+
detailsItemsSchema,
|
|
277
|
+
detailsSalesSchema,
|
|
278
|
+
detailsSchema,
|
|
279
|
+
meliGetBillingProvisionsByOrderHandler,
|
|
280
|
+
meliGetBillingProvisionsByOrderSchema,
|
|
281
|
+
ordersSchema,
|
|
282
|
+
paymentInfoSchema
|
|
283
|
+
};
|
|
284
|
+
//# sourceMappingURL=get-billing-provisions-by-order.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/tools/mercadolibre/get-billing-provisions-by-order.ts"],
|
|
4
|
+
"sourcesContent": ["import { error, object } from \"mcp-use/server\";\nimport { z } from \"zod\";\n\nimport {\n formatMercadoLibreError,\n} from \"../../services/mercadolibre/mercadolibre-api.js\";\nimport {\n getMercadoLibreBillingProvisionsByOrder,\n} from \"../../services/mercadolibre/mercadolibre-billing.js\";\nimport { stripNulls } from \"../../utils/strip-payload.js\";\nimport {\n asRecord,\n normalizeScalarString,\n toNumber,\n} from \"./helpers.js\";\nimport { resolveMercadoLibreProfileOrSelection } from \"./profile-resolution.js\";\n\n// \u2500\u2500 Schema \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const meliGetBillingProvisionsByOrderSchema = z.object({\n profileId: z.string().trim().min(1).describe(\"Explicit MercadoLibre profile id to use.\"),\n orderIds: z\n .array(z.string().trim().min(1).describe(\"MercadoLibre order id.\"))\n .min(1)\n .describe(\"One or more MercadoLibre order IDs to fetch billing provisions for.\"),\n});\n\n// \u2500\u2500 Compact schemas \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Top-level order info returned by the official by-order endpoint. */\nexport const ordersSchema = [\n \"order_id\",\n \"sale_fee\",\n \"payment_info_count\",\n \"detail_count\",\n \"document_id\",\n \"currency_id\",\n \"marketplace\",\n] as const;\n\n/** Payment info per order. */\nexport const paymentInfoSchema = [\n \"order_id\",\n \"payment_id\",\n \"payment_type\",\n \"payment_method_id\",\n \"installments\",\n \"transaction_amount\",\n \"total_paid_amount\",\n \"shipping_cost\",\n \"coupon_amount\",\n \"status\",\n \"status_detail\",\n] as const;\n\n/** Detail-level charges within an order. */\nexport const detailsSchema = [\n \"order_id\",\n \"detail_id\",\n \"detail_type\",\n \"detail_sub_type\",\n \"transaction_detail\",\n \"detail_amount\",\n \"currency_id\",\n \"concept_type\",\n \"operation_id\",\n \"shipping_id\",\n \"pack_id\",\n \"inventory_id\",\n] as const;\n\n/** Sales info within details (multiplicity). */\nexport const detailsSalesSchema = [\n \"detail_id\",\n \"order_id\",\n \"operation_id\",\n \"sale_date_time\",\n \"payer_nickname\",\n \"transaction_amount\",\n] as const;\n\n/** Items info within details (multiplicity). */\nexport const detailsItemsSchema = [\n \"detail_id\",\n \"item_id\",\n \"item_title\",\n \"item_amount\",\n \"item_price\",\n \"item_kit_id\",\n \"store_id\",\n \"order_id\",\n] as const;\n\n// \u2500\u2500 Row projectors \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ntype OrderRow = (string | number | null)[];\ntype PaymentRow = (string | number | null)[];\ntype DetailRow = (string | number | null)[];\ntype SalesRow = (string | number | null)[];\ntype ItemsRow = (string | number | null)[];\n\nfunction asRecordArray(value: unknown): Record<string, unknown>[] {\n if (Array.isArray(value)) {\n return value.filter(\n (entry): entry is Record<string, unknown> =>\n entry != null && typeof entry === \"object\" && !Array.isArray(entry)\n ) as Record<string, unknown>[];\n }\n\n const record = asRecord(value);\n return Object.keys(record).length > 0 ? [record] : [];\n}\n\nfunction projectOrderRow(row: Record<string, unknown>): OrderRow {\n const paymentInfo = asRecordArray(row.payment_info);\n const details = asRecordArray(row.details);\n const firstDetail = details[0] ?? {};\n const orderId =\n normalizeScalarString(row.order_id) ||\n normalizeScalarString(asRecord(row.payment_info).order_id) ||\n normalizeScalarString(firstDetail.order_id) ||\n null;\n const documentInfo = asRecord(row.document_info);\n const currencyInfo = asRecord(row.currency_info);\n const marketplaceInfo = asRecord(row.marketplace_info);\n\n return [\n orderId, // 0: order_id\n row.sale_fee == null ? null : toNumber(row.sale_fee), // 1: sale_fee\n paymentInfo.length, // 2: payment_info_count\n details.length, // 3: detail_count\n normalizeScalarString(documentInfo.document_id ?? row.document_id) || null, // 4: document_id\n normalizeScalarString(currencyInfo.currency_id ?? row.currency_id) || null, // 5: currency_id\n normalizeScalarString(marketplaceInfo.marketplace ?? row.marketplace) || null, // 6: marketplace\n ];\n}\n\nfunction projectPaymentRow(orderId: string | null, payment: Record<string, unknown>): PaymentRow {\n return [\n orderId, // 0: order_id\n normalizeScalarString(payment.payment_id ?? payment.id) || null, // 1: payment_id\n normalizeScalarString(payment.payment_type) || null, // 2: payment_type\n normalizeScalarString(payment.payment_method_id) || null, // 3: payment_method_id\n toNumber(payment.installments), // 4: installments\n toNumber(payment.transaction_amount), // 5: transaction_amount\n toNumber(payment.total_paid_amount), // 6: total_paid_amount\n toNumber(payment.shipping_cost), // 7: shipping_cost\n toNumber(payment.coupon_amount), // 8: coupon_amount\n normalizeScalarString(payment.status) || null, // 9: status\n normalizeScalarString(payment.status_detail) || null, // 10: status_detail\n ];\n}\n\nfunction projectDetailRow(orderId: string | null, detail: Record<string, unknown>): DetailRow {\n return [\n orderId, // 0: order_id\n normalizeScalarString(detail.detail_id) || null, // 1: detail_id\n normalizeScalarString(detail.detail_type) || null, // 2: detail_type\n normalizeScalarString(detail.detail_sub_type) || null, // 3: detail_sub_type\n normalizeScalarString(detail.transaction_detail) || null, // 4: transaction_detail\n toNumber(detail.detail_amount), // 5: detail_amount\n normalizeScalarString(detail.currency_id) || null, // 6: currency_id\n normalizeScalarString(detail.concept_type) || null, // 7: concept_type\n normalizeScalarString(detail.operation_id) || null, // 8: operation_id\n normalizeScalarString(detail.shipping_id) || null, // 9: shipping_id\n normalizeScalarString(detail.pack_id) || null, // 10: pack_id\n normalizeScalarString(detail.inventory_id) || null, // 11: inventory_id\n ];\n}\n\nfunction projectSalesRow(detailId: string | null, sale: Record<string, unknown>): SalesRow {\n return [\n detailId, // 0: detail_id\n normalizeScalarString(sale.order_id) || null, // 1: order_id\n normalizeScalarString(sale.operation_id) || null, // 2: operation_id\n normalizeScalarString(sale.sale_date_time) || null, // 3: sale_date_time\n normalizeScalarString(sale.payer_nickname) || null, // 4: payer_nickname\n toNumber(sale.transaction_amount), // 5: transaction_amount\n ];\n}\n\nfunction projectItemsRow(detailId: string | null, item: Record<string, unknown>): ItemsRow {\n return [\n detailId, // 0: detail_id\n normalizeScalarString(item.item_id) || null, // 1: item_id\n normalizeScalarString(item.item_title) || null, // 2: item_title\n toNumber(item.item_amount), // 3: item_amount\n toNumber(item.item_price), // 4: item_price\n normalizeScalarString(item.item_kit_id) || null, // 5: item_kit_id\n normalizeScalarString(item.store_id) || null, // 6: store_id\n normalizeScalarString(item.order_id) || null, // 7: order_id\n ];\n}\n\n// \u2500\u2500 Handler \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport async function meliGetBillingProvisionsByOrderHandler(\n params: z.infer<typeof meliGetBillingProvisionsByOrderSchema>\n) {\n try {\n const profileResolution = await resolveMercadoLibreProfileOrSelection(params.profileId);\n if (!profileResolution.ok) {\n return profileResolution.response;\n }\n\n const profileId = profileResolution.value.profileId;\n\n const result = await getMercadoLibreBillingProvisionsByOrder(profileId, {\n orderIds: params.orderIds,\n });\n\n // \u2500\u2500 Accumulate compact rows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n const orderRows: OrderRow[] = [];\n const paymentRows: PaymentRow[] = [];\n const detailRows: DetailRow[] = [];\n const salesRows: SalesRow[] = [];\n const itemsRows: ItemsRow[] = [];\n\n for (const row of result.results) {\n const orderId = normalizeScalarString(row.order_id) || null;\n\n // \u2500\u2500 Order row \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n orderRows.push(projectOrderRow(row));\n\n // \u2500\u2500 Payment info rows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const paymentInfoRows = asRecordArray(row.payment_info);\n for (const paymentInfo of paymentInfoRows) {\n paymentRows.push(projectPaymentRow(orderId, paymentInfo));\n }\n\n // \u2500\u2500 Details + secondary blocks \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const details = asRecordArray(row.details);\n for (const detail of details) {\n const detailId = normalizeScalarString(detail.detail_id) || null;\n detailRows.push(projectDetailRow(orderId, detail));\n\n // \u2500\u2500 Details sales \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const detailSales = asRecordArray(detail.sales_info ?? detail.details_sales);\n for (const ds of detailSales) {\n salesRows.push(projectSalesRow(detailId, ds));\n }\n\n // \u2500\u2500 Details items \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const detailItems = asRecordArray(detail.items_info ?? detail.details_items);\n for (const di of detailItems) {\n itemsRows.push(projectItemsRow(detailId, di));\n }\n }\n }\n\n // \u2500\u2500 Build metadata \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n const saleFeeNote =\n \"sale_fee may be null for some orders depending on how Mercado Libre settles the billing provision. \" +\n \"Preserve it as nullable in downstream analysis.\";\n\n const metadata: Record<string, unknown> = {\n order_ids_requested: result.order_ids_requested,\n order_ids_found: result.order_ids_found,\n order_ids_not_found: result.order_ids_not_found,\n request_chunks_total: result.chunks_total,\n request_chunks_succeeded: result.chunks_succeeded,\n request_chunks_failed: result.chunks_failed,\n coverage_complete: result.coverage_complete,\n endpoint: \"/billing/integration/group/ML/order/details\",\n sale_fee_note: saleFeeNote,\n };\n\n if (result.failures.length > 0) {\n metadata.failures = result.failures;\n }\n\n // Build response \u2014 stripNulls top-level, then add back compact arrays\n const stripped = stripNulls({\n profile_id: profileId,\n endpoint: \"/billing/integration/group/ML/order/details\",\n metadata,\n }) as Record<string, unknown>;\n\n // Always attach compact blocks (preserve positional contract)\n stripped.orders_schema = ordersSchema;\n stripped.orders = orderRows;\n stripped.payment_info_schema = paymentInfoSchema;\n stripped.payment_info = paymentRows;\n stripped.details_schema = detailsSchema;\n stripped.details = detailRows;\n stripped.details_sales_schema = detailsSalesSchema;\n stripped.details_sales = salesRows;\n stripped.details_items_schema = detailsItemsSchema;\n stripped.details_items = itemsRows;\n\n // Ensure metadata arrays survive stripNulls\n const meta = stripped.metadata as Record<string, unknown>;\n meta.order_ids_requested = result.order_ids_requested;\n meta.order_ids_found = result.order_ids_found;\n meta.order_ids_not_found = result.order_ids_not_found;\n\n return object(stripped);\n } catch (err) {\n return error(\n formatMercadoLibreError(err, \"Failed to get MercadoLibre billing provisions by order\")\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,OACK;AACP;AAAA,EACE;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6CAA6C;AAI/C,MAAM,wCAAwC,EAAE,OAAO;AAAA,EAC5D,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,0CAA0C;AAAA,EACvF,UAAU,EACP,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,wBAAwB,CAAC,EACjE,IAAI,CAAC,EACL,SAAS,qEAAqE;AACnF,CAAC;AAKM,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AkB,OAAO;AAC9B,SAAK,sBAAsB,OAAO;AAElC,WAAO,OAAO,QAAQ;AAAA,EACxB,SAAS,KAAK;AACZ,WAAO;AAAA,MACL,wBAAwB,KAAK,wDAAwD;AAAA,IACvF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { error, object } from "mcp-use/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import {
|
|
4
|
+
formatMercadoLibreError
|
|
5
|
+
} from "../../services/mercadolibre/mercadolibre-api.js";
|
|
6
|
+
import {
|
|
7
|
+
getMercadoLibreBillingProvisions
|
|
8
|
+
} from "../../services/mercadolibre/mercadolibre-billing.js";
|
|
9
|
+
import { stripNulls } from "../../utils/strip-payload.js";
|
|
10
|
+
import {
|
|
11
|
+
normalizeString,
|
|
12
|
+
toNumber
|
|
13
|
+
} from "./helpers.js";
|
|
14
|
+
import { resolveMercadoLibreProfileOrSelection } from "./profile-resolution.js";
|
|
15
|
+
import { mercadolibreProfileIdSchemaField } from "./write-helpers.js";
|
|
16
|
+
const meliGetFullStorageChargesSchema = z.object({
|
|
17
|
+
profileId: mercadolibreProfileIdSchemaField,
|
|
18
|
+
periodKey: z.string().regex(/^\d{4}-\d{2}-01$/).describe("Billing period key in YYYY-MM-01 format (month start only)."),
|
|
19
|
+
documentType: z.enum(["BILL", "CREDIT_NOTE"]).default("BILL").optional().describe("Document type: BILL or CREDIT_NOTE. Defaults to BILL.")
|
|
20
|
+
});
|
|
21
|
+
const detailsFullSchema = [
|
|
22
|
+
// ── charge_info (12 columns) ──
|
|
23
|
+
"detail_id",
|
|
24
|
+
// 0
|
|
25
|
+
"creation_date_time",
|
|
26
|
+
// 1
|
|
27
|
+
"detail_type",
|
|
28
|
+
// 2
|
|
29
|
+
"detail_sub_type",
|
|
30
|
+
// 3
|
|
31
|
+
"concept_type",
|
|
32
|
+
// 4
|
|
33
|
+
"transaction_detail",
|
|
34
|
+
// 5
|
|
35
|
+
"detail_amount",
|
|
36
|
+
// 6
|
|
37
|
+
"payment_id",
|
|
38
|
+
// 7
|
|
39
|
+
"charge_bonified_id",
|
|
40
|
+
// 8
|
|
41
|
+
"legal_document_number",
|
|
42
|
+
// 9
|
|
43
|
+
"legal_document_status",
|
|
44
|
+
// 10
|
|
45
|
+
"legal_document_status_description",
|
|
46
|
+
// 11
|
|
47
|
+
// ── document_info (1 column) ──
|
|
48
|
+
"document_id",
|
|
49
|
+
// 12
|
|
50
|
+
// ── fulfillment_info (14 columns) ──
|
|
51
|
+
"ff_type",
|
|
52
|
+
// 13
|
|
53
|
+
"ff_amount",
|
|
54
|
+
// 14
|
|
55
|
+
"ff_amount_per_unit",
|
|
56
|
+
// 15
|
|
57
|
+
"ff_sku",
|
|
58
|
+
// 16
|
|
59
|
+
"ff_ean",
|
|
60
|
+
// 17
|
|
61
|
+
"ff_item_id",
|
|
62
|
+
// 18
|
|
63
|
+
"ff_item_title",
|
|
64
|
+
// 19
|
|
65
|
+
"ff_variation",
|
|
66
|
+
// 20
|
|
67
|
+
"ff_quantity",
|
|
68
|
+
// 21
|
|
69
|
+
"ff_item_quantity",
|
|
70
|
+
// 22
|
|
71
|
+
"ff_inventory_id",
|
|
72
|
+
// 23
|
|
73
|
+
"ff_warehouse_id",
|
|
74
|
+
// 24
|
|
75
|
+
"ff_source_id",
|
|
76
|
+
// 25
|
|
77
|
+
"ff_volume_type"
|
|
78
|
+
// 26
|
|
79
|
+
];
|
|
80
|
+
function projectFullDetailRow(row) {
|
|
81
|
+
const chargeInfo = row.charge_info ?? {};
|
|
82
|
+
const docInfo = row.document_info ?? {};
|
|
83
|
+
const ffInfo = row.fulfillment_info ?? {};
|
|
84
|
+
return [
|
|
85
|
+
// ── charge_info ──
|
|
86
|
+
normalizeString(chargeInfo.detail_id) || null,
|
|
87
|
+
normalizeString(chargeInfo.creation_date_time) || null,
|
|
88
|
+
normalizeString(chargeInfo.detail_type) || null,
|
|
89
|
+
normalizeString(chargeInfo.detail_sub_type) || null,
|
|
90
|
+
normalizeString(chargeInfo.concept_type) || null,
|
|
91
|
+
normalizeString(chargeInfo.transaction_detail) || null,
|
|
92
|
+
toNumber(chargeInfo.detail_amount),
|
|
93
|
+
normalizeString(chargeInfo.payment_id) || null,
|
|
94
|
+
normalizeString(chargeInfo.charge_bonified_id) || null,
|
|
95
|
+
normalizeString(chargeInfo.legal_document_number) || null,
|
|
96
|
+
normalizeString(chargeInfo.legal_document_status) || null,
|
|
97
|
+
normalizeString(chargeInfo.legal_document_status_description) || null,
|
|
98
|
+
// ── document_info ──
|
|
99
|
+
normalizeString(docInfo.document_id) || null,
|
|
100
|
+
// ── fulfillment_info ──
|
|
101
|
+
normalizeString(ffInfo.type) || null,
|
|
102
|
+
toNumber(ffInfo.amount),
|
|
103
|
+
toNumber(ffInfo.amount_per_unit),
|
|
104
|
+
normalizeString(ffInfo.sku) || null,
|
|
105
|
+
normalizeString(ffInfo.ean) || null,
|
|
106
|
+
normalizeString(ffInfo.item_id) || null,
|
|
107
|
+
normalizeString(ffInfo.item_title) || null,
|
|
108
|
+
normalizeString(ffInfo.variation) || null,
|
|
109
|
+
toNumber(ffInfo.quantity),
|
|
110
|
+
toNumber(ffInfo.item_quantity),
|
|
111
|
+
normalizeString(ffInfo.inventory_id) || null,
|
|
112
|
+
normalizeString(ffInfo.warehouse_id) || null,
|
|
113
|
+
normalizeString(ffInfo.source_id) || null,
|
|
114
|
+
normalizeString(ffInfo.volume_type) || null
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
const RATE_LIMIT_NOTE = "MELI billing Full endpoint has a rate limit of approximately 5 requests per minute. This tool fetches all pages with from_id cursor at limit=1000. If coverage is incomplete, use the continuation_from_id to resume via meli_get_billing_provisions_summary.";
|
|
118
|
+
async function meliGetFullStorageChargesHandler(params) {
|
|
119
|
+
try {
|
|
120
|
+
const profileResolution = await resolveMercadoLibreProfileOrSelection(params.profileId);
|
|
121
|
+
if (!profileResolution.ok) {
|
|
122
|
+
return profileResolution.response;
|
|
123
|
+
}
|
|
124
|
+
const profileId = profileResolution.value.profileId;
|
|
125
|
+
const documentType = params.documentType ?? "BILL";
|
|
126
|
+
const result = await getMercadoLibreBillingProvisions(profileId, {
|
|
127
|
+
periodKey: params.periodKey,
|
|
128
|
+
scope: "full",
|
|
129
|
+
documentType
|
|
130
|
+
});
|
|
131
|
+
const compactRows = [];
|
|
132
|
+
for (const row of result.rows) {
|
|
133
|
+
compactRows.push(projectFullDetailRow(row));
|
|
134
|
+
}
|
|
135
|
+
const metadata = {
|
|
136
|
+
total_reported: result.detail_count_total,
|
|
137
|
+
pages_requested: result.pages_requested,
|
|
138
|
+
pages_succeeded: result.pages_succeeded,
|
|
139
|
+
pages_failed: result.pages_failed,
|
|
140
|
+
coverage_complete: result.coverage_complete,
|
|
141
|
+
rate_limit_note: RATE_LIMIT_NOTE
|
|
142
|
+
};
|
|
143
|
+
if (!result.coverage_complete && result.last_id_seen) {
|
|
144
|
+
metadata.continuation_from_id = result.last_id_seen;
|
|
145
|
+
}
|
|
146
|
+
if (result.failures.length > 0) {
|
|
147
|
+
metadata.failures = result.failures;
|
|
148
|
+
}
|
|
149
|
+
const stripped = stripNulls({
|
|
150
|
+
profile_id: profileId,
|
|
151
|
+
period_key: params.periodKey,
|
|
152
|
+
scope: "full",
|
|
153
|
+
document_type: documentType,
|
|
154
|
+
metadata
|
|
155
|
+
});
|
|
156
|
+
stripped.details_schema = detailsFullSchema;
|
|
157
|
+
stripped.details = compactRows;
|
|
158
|
+
const meta = stripped.metadata;
|
|
159
|
+
meta.total_reported = result.detail_count_total;
|
|
160
|
+
meta.pages_requested = result.pages_requested;
|
|
161
|
+
meta.pages_succeeded = result.pages_succeeded;
|
|
162
|
+
meta.pages_failed = result.pages_failed;
|
|
163
|
+
meta.coverage_complete = result.coverage_complete;
|
|
164
|
+
meta.rate_limit_note = RATE_LIMIT_NOTE;
|
|
165
|
+
if (!result.coverage_complete && result.last_id_seen) {
|
|
166
|
+
meta.continuation_from_id = result.last_id_seen;
|
|
167
|
+
}
|
|
168
|
+
if (result.failures.length > 0) {
|
|
169
|
+
meta.failures = result.failures;
|
|
170
|
+
}
|
|
171
|
+
return object(stripped);
|
|
172
|
+
} catch (err) {
|
|
173
|
+
return error(
|
|
174
|
+
formatMercadoLibreError(err, "Failed to get MercadoLibre Full storage charges")
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export {
|
|
179
|
+
detailsFullSchema,
|
|
180
|
+
meliGetFullStorageChargesHandler,
|
|
181
|
+
meliGetFullStorageChargesSchema
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=get-full-storage-charges.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/tools/mercadolibre/get-full-storage-charges.ts"],
|
|
4
|
+
"sourcesContent": ["import { error, object } from \"mcp-use/server\";\nimport { z } from \"zod\";\n\nimport {\n formatMercadoLibreError,\n} from \"../../services/mercadolibre/mercadolibre-api.js\";\nimport {\n getMercadoLibreBillingProvisions,\n} from \"../../services/mercadolibre/mercadolibre-billing.js\";\nimport { stripNulls } from \"../../utils/strip-payload.js\";\nimport {\n normalizeString,\n toNumber,\n} from \"./helpers.js\";\nimport { resolveMercadoLibreProfileOrSelection } from \"./profile-resolution.js\";\nimport { mercadolibreProfileIdSchemaField } from \"./write-helpers.js\";\n\n// \u2500\u2500 Schema \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const meliGetFullStorageChargesSchema = z.object({\n profileId: mercadolibreProfileIdSchemaField,\n periodKey: z\n .string()\n .regex(/^\\d{4}-\\d{2}-01$/)\n .describe(\"Billing period key in YYYY-MM-01 format (month start only).\"),\n documentType: z\n .enum([\"BILL\", \"CREDIT_NOTE\"])\n .default(\"BILL\")\n .optional()\n .describe(\"Document type: BILL or CREDIT_NOTE. Defaults to BILL.\"),\n});\n\n// \u2500\u2500 Compact schema for Full storage charges \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//\n// The Full endpoint returns a different payload shape from standard billing\n// provisions: charge_info, fulfillment_info, document_info\n// (no sales_info, items_info, currency_info, marketplace_info).\n//\n// Column order is stable and positional \u2014 consumers reconstruct rows from\n// details_schema + details arrays.\n\nexport const detailsFullSchema = [\n // \u2500\u2500 charge_info (12 columns) \u2500\u2500\n \"detail_id\", // 0\n \"creation_date_time\", // 1\n \"detail_type\", // 2\n \"detail_sub_type\", // 3\n \"concept_type\", // 4\n \"transaction_detail\", // 5\n \"detail_amount\", // 6\n \"payment_id\", // 7\n \"charge_bonified_id\", // 8\n \"legal_document_number\", // 9\n \"legal_document_status\", // 10\n \"legal_document_status_description\", // 11\n // \u2500\u2500 document_info (1 column) \u2500\u2500\n \"document_id\", // 12\n // \u2500\u2500 fulfillment_info (14 columns) \u2500\u2500\n \"ff_type\", // 13\n \"ff_amount\", // 14\n \"ff_amount_per_unit\", // 15\n \"ff_sku\", // 16\n \"ff_ean\", // 17\n \"ff_item_id\", // 18\n \"ff_item_title\", // 19\n \"ff_variation\", // 20\n \"ff_quantity\", // 21\n \"ff_item_quantity\", // 22\n \"ff_inventory_id\", // 23\n \"ff_warehouse_id\", // 24\n \"ff_source_id\", // 25\n \"ff_volume_type\", // 26\n] as const;\n\ntype FullDetailRow = (string | number | null)[];\n\n/**\n * Project a raw MELI Full billing detail row into a positional compact array.\n * The order matches `detailsFullSchema`.\n *\n * Fields come from:\n * - charge_info: detail_id, creation_date_time, detail_type, detail_sub_type,\n * concept_type, transaction_detail, detail_amount, payment_id,\n * charge_bonified_id, legal_document_number, legal_document_status,\n * legal_document_status_description\n * - document_info: document_id\n * - fulfillment_info: type, amount, amount_per_unit, sku, ean, item_id,\n * item_title, variation, quantity, item_quantity, inventory_id,\n * warehouse_id, source_id, volume_type\n */\nfunction projectFullDetailRow(row: Record<string, unknown>): FullDetailRow {\n const chargeInfo = (row.charge_info as Record<string, unknown>) ?? {};\n const docInfo = (row.document_info as Record<string, unknown>) ?? {};\n const ffInfo = (row.fulfillment_info as Record<string, unknown>) ?? {};\n\n return [\n // \u2500\u2500 charge_info \u2500\u2500\n normalizeString(chargeInfo.detail_id) || null,\n normalizeString(chargeInfo.creation_date_time) || null,\n normalizeString(chargeInfo.detail_type) || null,\n normalizeString(chargeInfo.detail_sub_type) || null,\n normalizeString(chargeInfo.concept_type) || null,\n normalizeString(chargeInfo.transaction_detail) || null,\n toNumber(chargeInfo.detail_amount),\n normalizeString(chargeInfo.payment_id) || null,\n normalizeString(chargeInfo.charge_bonified_id) || null,\n normalizeString(chargeInfo.legal_document_number) || null,\n normalizeString(chargeInfo.legal_document_status) || null,\n normalizeString(chargeInfo.legal_document_status_description) || null,\n // \u2500\u2500 document_info \u2500\u2500\n normalizeString(docInfo.document_id) || null,\n // \u2500\u2500 fulfillment_info \u2500\u2500\n normalizeString(ffInfo.type) || null,\n toNumber(ffInfo.amount),\n toNumber(ffInfo.amount_per_unit),\n normalizeString(ffInfo.sku) || null,\n normalizeString(ffInfo.ean) || null,\n normalizeString(ffInfo.item_id) || null,\n normalizeString(ffInfo.item_title) || null,\n normalizeString(ffInfo.variation) || null,\n toNumber(ffInfo.quantity),\n toNumber(ffInfo.item_quantity),\n normalizeString(ffInfo.inventory_id) || null,\n normalizeString(ffInfo.warehouse_id) || null,\n normalizeString(ffInfo.source_id) || null,\n normalizeString(ffInfo.volume_type) || null,\n ];\n}\n\n// \u2500\u2500 Handler \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst RATE_LIMIT_NOTE =\n \"MELI billing Full endpoint has a rate limit of approximately 5 requests per minute. \" +\n \"This tool fetches all pages with from_id cursor at limit=1000. \" +\n \"If coverage is incomplete, use the continuation_from_id to resume via meli_get_billing_provisions_summary.\";\n\nexport async function meliGetFullStorageChargesHandler(\n params: z.infer<typeof meliGetFullStorageChargesSchema>\n) {\n try {\n const profileResolution = await resolveMercadoLibreProfileOrSelection(params.profileId);\n if (!profileResolution.ok) {\n return profileResolution.response;\n }\n\n const profileId = profileResolution.value.profileId;\n const documentType = params.documentType ?? \"BILL\";\n\n const result = await getMercadoLibreBillingProvisions(profileId, {\n periodKey: params.periodKey,\n scope: \"full\",\n documentType,\n });\n\n // \u2500\u2500 Project compact rows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const compactRows: FullDetailRow[] = [];\n for (const row of result.rows) {\n compactRows.push(projectFullDetailRow(row));\n }\n\n // \u2500\u2500 Build metadata \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const metadata: Record<string, unknown> = {\n total_reported: result.detail_count_total,\n pages_requested: result.pages_requested,\n pages_succeeded: result.pages_succeeded,\n pages_failed: result.pages_failed,\n coverage_complete: result.coverage_complete,\n rate_limit_note: RATE_LIMIT_NOTE,\n };\n\n if (!result.coverage_complete && result.last_id_seen) {\n metadata.continuation_from_id = result.last_id_seen;\n }\n\n if (result.failures.length > 0) {\n metadata.failures = result.failures;\n }\n\n // \u2500\u2500 Build response \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const stripped = stripNulls({\n profile_id: profileId,\n period_key: params.periodKey,\n scope: \"full\",\n document_type: documentType,\n metadata,\n }) as Record<string, unknown>;\n\n // Always attach compact blocks (preserve positional contract)\n stripped.details_schema = detailsFullSchema;\n stripped.details = compactRows;\n\n // Ensure metadata arrays survive stripNulls\n const meta = stripped.metadata as Record<string, unknown>;\n meta.total_reported = result.detail_count_total;\n meta.pages_requested = result.pages_requested;\n meta.pages_succeeded = result.pages_succeeded;\n meta.pages_failed = result.pages_failed;\n meta.coverage_complete = result.coverage_complete;\n meta.rate_limit_note = RATE_LIMIT_NOTE;\n if (!result.coverage_complete && result.last_id_seen) {\n meta.continuation_from_id = result.last_id_seen;\n }\n if (result.failures.length > 0) {\n meta.failures = result.failures;\n }\n\n return object(stripped);\n } catch (err) {\n return error(\n formatMercadoLibreError(err, \"Failed to get MercadoLibre Full storage charges\")\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,OACK;AACP;AAAA,EACE;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6CAA6C;AACtD,SAAS,wCAAwC;AAI1C,MAAM,kCAAkC,EAAE,OAAO;AAAA,EACtD,WAAW;AAAA,EACX,WAAW,EACR,OAAO,EACP,MAAM,kBAAkB,EACxB,SAAS,6DAA6D;AAAA,EACzE,cAAc,EACX,KAAK,CAAC,QAAQ,aAAa,CAAC,EAC5B,QAAQ,MAAM,EACd,SAAS,EACT,SAAS,uDAAuD;AACrE,CAAC;AAWM,MAAM,oBAAoB;AAAA;AAAA,EAE/B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA,EAEA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAkBA,SAAS,qBAAqB,KAA6C;AACzE,QAAM,aAAc,IAAI,eAA2C,CAAC;AACpE,QAAM,UAAW,IAAI,iBAA6C,CAAC;AACnE,QAAM,SAAU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