@stubbedev/trimit-mcp 0.1.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/LICENSE +21 -0
- package/README.md +230 -0
- package/dist/categories/customers.js +187 -0
- package/dist/categories/exported.js +105 -0
- package/dist/categories/index.js +9 -0
- package/dist/categories/inventory.js +63 -0
- package/dist/categories/masterdata.js +246 -0
- package/dist/categories/metadata.js +27 -0
- package/dist/categories/postedsales.js +155 -0
- package/dist/categories/products.js +176 -0
- package/dist/categories/salesdocs.js +395 -0
- package/dist/categories/standard.js +228 -0
- package/dist/common.js +91 -0
- package/dist/index.js +10 -0
- package/dist/registry.js +27 -0
- package/dist/server.js +706 -0
- package/package.json +56 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TRIMIT_AUTH, buildHeaders, buildOdataQuery, fetchExample, trimitBase } from "../common.js";
|
|
3
|
+
const CATEGORY = "masterdata";
|
|
4
|
+
export const masterdataTools = [
|
|
5
|
+
{
|
|
6
|
+
name: "trimit_masterdata_get_campaigns",
|
|
7
|
+
description: "List TRIMIT Campaigns. Expands defaultDimensions and priceGroupParameters by default. Fields: id, number, description, salespersonCode, statusCode, startingDate, endingDate, activated, lastDateModified.",
|
|
8
|
+
category: CATEGORY,
|
|
9
|
+
zodShape: {
|
|
10
|
+
filter: z.string().optional(),
|
|
11
|
+
select: z.array(z.string()).optional(),
|
|
12
|
+
expand: z.string().optional().describe("Default: 'defaultDimensions,priceGroupParameters'"),
|
|
13
|
+
top: z.number().optional(),
|
|
14
|
+
skip: z.number().optional(),
|
|
15
|
+
},
|
|
16
|
+
handler: (args) => {
|
|
17
|
+
const expand = args.expand ?? "defaultDimensions,priceGroupParameters";
|
|
18
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
19
|
+
const endpoint = `${trimitBase()}/campaigns${qs}`;
|
|
20
|
+
return {
|
|
21
|
+
endpoint,
|
|
22
|
+
method: "GET",
|
|
23
|
+
headers: buildHeaders(),
|
|
24
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
25
|
+
queryParams: params,
|
|
26
|
+
body: null,
|
|
27
|
+
description: "List TRIMIT Campaigns with default dimensions and price group parameters.",
|
|
28
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
29
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
30
|
+
auth: TRIMIT_AUTH,
|
|
31
|
+
notes: "lastDateModified is your incremental sync cursor — filter on it for deltas (BC has no /delta endpoint here).",
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "trimit_masterdata_get_customer_price_groups",
|
|
37
|
+
description: "List Customer Price Groups with priceGroupParameters expanded. Supports $schemaversion=1.0.",
|
|
38
|
+
category: CATEGORY,
|
|
39
|
+
zodShape: {
|
|
40
|
+
filter: z.string().optional(),
|
|
41
|
+
select: z.array(z.string()).optional(),
|
|
42
|
+
expand: z.string().optional().describe("Default: 'priceGroupParameters'"),
|
|
43
|
+
schemaVersion: z.string().optional().describe("e.g. '1.0'"),
|
|
44
|
+
top: z.number().optional(),
|
|
45
|
+
skip: z.number().optional(),
|
|
46
|
+
},
|
|
47
|
+
handler: (args) => {
|
|
48
|
+
const expand = args.expand ?? "priceGroupParameters";
|
|
49
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
50
|
+
let endpoint = `${trimitBase()}/customerPriceGroups${qs}`;
|
|
51
|
+
if (args.schemaVersion) {
|
|
52
|
+
const sep = endpoint.includes("?") ? "&" : "?";
|
|
53
|
+
endpoint = `${endpoint}${sep}$schemaversion=${args.schemaVersion}`;
|
|
54
|
+
params["$schemaversion"] = args.schemaVersion;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
endpoint,
|
|
58
|
+
method: "GET",
|
|
59
|
+
headers: buildHeaders(),
|
|
60
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
61
|
+
queryParams: params,
|
|
62
|
+
body: null,
|
|
63
|
+
description: "Customer Price Groups list.",
|
|
64
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
65
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
66
|
+
auth: TRIMIT_AUTH,
|
|
67
|
+
notes: null,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "trimit_masterdata_get_price_group_parameters",
|
|
73
|
+
description: "List Customer Price Group Parameters table directly. Recommended Data-Access-Intent: ReadOnly for large reads.",
|
|
74
|
+
category: CATEGORY,
|
|
75
|
+
zodShape: {
|
|
76
|
+
filter: z.string().optional(),
|
|
77
|
+
select: z.array(z.string()).optional(),
|
|
78
|
+
top: z.number().optional(),
|
|
79
|
+
skip: z.number().optional(),
|
|
80
|
+
readOnly: z.boolean().optional().describe("Send Data-Access-Intent: ReadOnly header. Default true."),
|
|
81
|
+
},
|
|
82
|
+
handler: (args) => {
|
|
83
|
+
const { qs, params } = buildOdataQuery(args);
|
|
84
|
+
const endpoint = `${trimitBase()}/priceGroupParameters${qs}`;
|
|
85
|
+
const extra = args.readOnly !== false ? { "Data-Access-Intent": "ReadOnly" } : undefined;
|
|
86
|
+
return {
|
|
87
|
+
endpoint,
|
|
88
|
+
method: "GET",
|
|
89
|
+
headers: buildHeaders(extra),
|
|
90
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
91
|
+
queryParams: params,
|
|
92
|
+
body: null,
|
|
93
|
+
description: "Read price group parameters.",
|
|
94
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
95
|
+
codeExample: fetchExample(endpoint, "GET", null, extra),
|
|
96
|
+
auth: TRIMIT_AUTH,
|
|
97
|
+
notes: "Data-Access-Intent: ReadOnly routes the request to a read replica when BC supports it — lower latency for analytics-style reads.",
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "trimit_masterdata_get_vardim_combinations",
|
|
103
|
+
description: "List allowed VarDim Combinations (overall + subordinate variant dimension pairings).",
|
|
104
|
+
category: CATEGORY,
|
|
105
|
+
zodShape: {
|
|
106
|
+
filter: z.string().optional(),
|
|
107
|
+
select: z.array(z.string()).optional(),
|
|
108
|
+
top: z.number().optional(),
|
|
109
|
+
skip: z.number().optional(),
|
|
110
|
+
},
|
|
111
|
+
handler: (args) => {
|
|
112
|
+
const { qs, params } = buildOdataQuery(args);
|
|
113
|
+
const endpoint = `${trimitBase()}/VarDimCombinations${qs}`;
|
|
114
|
+
return {
|
|
115
|
+
endpoint,
|
|
116
|
+
method: "GET",
|
|
117
|
+
headers: buildHeaders(),
|
|
118
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
119
|
+
queryParams: params,
|
|
120
|
+
body: null,
|
|
121
|
+
description: "VarDim combinations (allowed variant dimension pairs).",
|
|
122
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
123
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
124
|
+
auth: TRIMIT_AUTH,
|
|
125
|
+
notes: null,
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "trimit_masterdata_get_vardim_types",
|
|
131
|
+
description: "List VarDim Types (variant dimension definitions). Use $expand=vardimtypevalues to include values.",
|
|
132
|
+
category: CATEGORY,
|
|
133
|
+
zodShape: {
|
|
134
|
+
filter: z.string().optional().describe("e.g. \"No eq 'GL01'\""),
|
|
135
|
+
select: z.array(z.string()).optional(),
|
|
136
|
+
expand: z.string().optional().describe("e.g. 'vardimtypevalues'"),
|
|
137
|
+
top: z.number().optional(),
|
|
138
|
+
skip: z.number().optional(),
|
|
139
|
+
},
|
|
140
|
+
handler: (args) => {
|
|
141
|
+
const { qs, params } = buildOdataQuery(args);
|
|
142
|
+
const endpoint = `${trimitBase()}/vardimtypes${qs}`;
|
|
143
|
+
return {
|
|
144
|
+
endpoint,
|
|
145
|
+
method: "GET",
|
|
146
|
+
headers: buildHeaders(),
|
|
147
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
148
|
+
queryParams: params,
|
|
149
|
+
body: null,
|
|
150
|
+
description: "VarDim types.",
|
|
151
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
152
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
153
|
+
auth: TRIMIT_AUTH,
|
|
154
|
+
notes: null,
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "trimit_masterdata_get_vardim_type_values",
|
|
160
|
+
description: "List VarDim Type values (concrete variant dimension options).",
|
|
161
|
+
category: CATEGORY,
|
|
162
|
+
zodShape: {
|
|
163
|
+
filter: z.string().optional().describe("e.g. \"value eq 'GB33'\""),
|
|
164
|
+
select: z.array(z.string()).optional(),
|
|
165
|
+
top: z.number().optional(),
|
|
166
|
+
skip: z.number().optional(),
|
|
167
|
+
},
|
|
168
|
+
handler: (args) => {
|
|
169
|
+
const { qs, params } = buildOdataQuery(args);
|
|
170
|
+
const endpoint = `${trimitBase()}/vardimtypevalues${qs}`;
|
|
171
|
+
return {
|
|
172
|
+
endpoint,
|
|
173
|
+
method: "GET",
|
|
174
|
+
headers: buildHeaders(),
|
|
175
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
176
|
+
queryParams: params,
|
|
177
|
+
body: null,
|
|
178
|
+
description: "VarDim type values.",
|
|
179
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
180
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
181
|
+
auth: TRIMIT_AUTH,
|
|
182
|
+
notes: null,
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "trimit_masterdata_get_item_attributes",
|
|
188
|
+
description: "List BC Item Attributes and their values.",
|
|
189
|
+
category: CATEGORY,
|
|
190
|
+
zodShape: {
|
|
191
|
+
filter: z.string().optional(),
|
|
192
|
+
select: z.array(z.string()).optional(),
|
|
193
|
+
top: z.number().optional(),
|
|
194
|
+
skip: z.number().optional(),
|
|
195
|
+
readOnly: z.boolean().optional().describe("Send Data-Access-Intent: ReadOnly header. Default true."),
|
|
196
|
+
},
|
|
197
|
+
handler: (args) => {
|
|
198
|
+
const { qs, params } = buildOdataQuery(args);
|
|
199
|
+
const endpoint = `${trimitBase()}/itemAttributes${qs}`;
|
|
200
|
+
const extra = args.readOnly !== false ? { "Data-Access-Intent": "ReadOnly" } : undefined;
|
|
201
|
+
return {
|
|
202
|
+
endpoint,
|
|
203
|
+
method: "GET",
|
|
204
|
+
headers: buildHeaders(extra),
|
|
205
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
206
|
+
queryParams: params,
|
|
207
|
+
body: null,
|
|
208
|
+
description: "Item attributes.",
|
|
209
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
210
|
+
codeExample: fetchExample(endpoint, "GET", null, extra),
|
|
211
|
+
auth: TRIMIT_AUTH,
|
|
212
|
+
notes: null,
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "trimit_masterdata_get_collections",
|
|
218
|
+
description: "List TRIMIT Collections (seasonal / grouping). Expand deliveryPeriods for delivery cycle data.",
|
|
219
|
+
category: CATEGORY,
|
|
220
|
+
zodShape: {
|
|
221
|
+
filter: z.string().optional(),
|
|
222
|
+
select: z.array(z.string()).optional(),
|
|
223
|
+
expand: z.string().optional().describe("Default: 'deliveryPeriods'"),
|
|
224
|
+
top: z.number().optional(),
|
|
225
|
+
skip: z.number().optional(),
|
|
226
|
+
},
|
|
227
|
+
handler: (args) => {
|
|
228
|
+
const expand = args.expand ?? "deliveryPeriods";
|
|
229
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
230
|
+
const endpoint = `${trimitBase()}/collections${qs}`;
|
|
231
|
+
return {
|
|
232
|
+
endpoint,
|
|
233
|
+
method: "GET",
|
|
234
|
+
headers: buildHeaders(),
|
|
235
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
236
|
+
queryParams: params,
|
|
237
|
+
body: null,
|
|
238
|
+
description: "TRIMIT Collections.",
|
|
239
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
240
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
241
|
+
auth: TRIMIT_AUTH,
|
|
242
|
+
notes: null,
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HOST, TRIMIT_API_PATH, TRIMIT_AUTH, buildHeaders, fetchExample } from "../common.js";
|
|
2
|
+
const CATEGORY = "metadata";
|
|
3
|
+
export const metadataTools = [
|
|
4
|
+
{
|
|
5
|
+
name: "trimit_metadata_get",
|
|
6
|
+
description: "Get the CSDL/EDMX $metadata document for the TRIMIT Integration API (v1.1). Use for client codegen.",
|
|
7
|
+
category: CATEGORY,
|
|
8
|
+
zodShape: {},
|
|
9
|
+
handler: () => {
|
|
10
|
+
const endpoint = `${HOST}/{tenant}/{environment}/${TRIMIT_API_PATH}/$metadata`;
|
|
11
|
+
const extra = { Accept: "application/xml" };
|
|
12
|
+
return {
|
|
13
|
+
endpoint,
|
|
14
|
+
method: "GET",
|
|
15
|
+
headers: buildHeaders(extra),
|
|
16
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}" },
|
|
17
|
+
queryParams: {},
|
|
18
|
+
body: null,
|
|
19
|
+
description: "TRIMIT $metadata — XML EDMX schema for the integration API.",
|
|
20
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
21
|
+
codeExample: fetchExample(endpoint, "GET", null, extra),
|
|
22
|
+
auth: TRIMIT_AUTH,
|
|
23
|
+
notes: "Different document from the BC standard /api/v2.0/$metadata — this one lists only TRIMIT entities.",
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TRIMIT_AUTH, buildHeaders, buildOdataQuery, fetchExample, trimitBase } from "../common.js";
|
|
3
|
+
const CATEGORY = "postedsales";
|
|
4
|
+
export const postedsalesTools = [
|
|
5
|
+
{
|
|
6
|
+
name: "trimit_postedsales_list_documents",
|
|
7
|
+
description: "List posted sales documents (union of posted invoices + posted credit memos).",
|
|
8
|
+
category: CATEGORY,
|
|
9
|
+
zodShape: {
|
|
10
|
+
filter: z.string().optional(),
|
|
11
|
+
select: z.array(z.string()).optional(),
|
|
12
|
+
expand: z.string().optional().describe("Default: 'postedSalesDocumentLines'"),
|
|
13
|
+
top: z.number().optional(),
|
|
14
|
+
skip: z.number().optional(),
|
|
15
|
+
},
|
|
16
|
+
handler: (args) => {
|
|
17
|
+
const expand = args.expand ?? "postedSalesDocumentLines";
|
|
18
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
19
|
+
const endpoint = `${trimitBase()}/postedSalesDocuments${qs}`;
|
|
20
|
+
return {
|
|
21
|
+
endpoint,
|
|
22
|
+
method: "GET",
|
|
23
|
+
headers: buildHeaders(),
|
|
24
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
25
|
+
queryParams: params,
|
|
26
|
+
body: null,
|
|
27
|
+
description: "Posted sales documents.",
|
|
28
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
29
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
30
|
+
auth: TRIMIT_AUTH,
|
|
31
|
+
notes: null,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "trimit_postedsales_list_invoices",
|
|
37
|
+
description: "List posted sales invoices (Sales Invoice Header).",
|
|
38
|
+
category: CATEGORY,
|
|
39
|
+
zodShape: {
|
|
40
|
+
filter: z.string().optional(),
|
|
41
|
+
select: z.array(z.string()).optional(),
|
|
42
|
+
expand: z.string().optional().describe("Default: 'postedSalesInvoiceLines,trackingLines'"),
|
|
43
|
+
top: z.number().optional(),
|
|
44
|
+
skip: z.number().optional(),
|
|
45
|
+
},
|
|
46
|
+
handler: (args) => {
|
|
47
|
+
const expand = args.expand ?? "postedSalesInvoiceLines,trackingLines";
|
|
48
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
49
|
+
const endpoint = `${trimitBase()}/postedSalesInvoices${qs}`;
|
|
50
|
+
return {
|
|
51
|
+
endpoint,
|
|
52
|
+
method: "GET",
|
|
53
|
+
headers: buildHeaders(),
|
|
54
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
55
|
+
queryParams: params,
|
|
56
|
+
body: null,
|
|
57
|
+
description: "Posted sales invoices.",
|
|
58
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
59
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
60
|
+
auth: TRIMIT_AUTH,
|
|
61
|
+
notes: null,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "trimit_postedsales_list_credit_memos",
|
|
67
|
+
description: "List posted sales credit memos.",
|
|
68
|
+
category: CATEGORY,
|
|
69
|
+
zodShape: {
|
|
70
|
+
filter: z.string().optional(),
|
|
71
|
+
select: z.array(z.string()).optional(),
|
|
72
|
+
expand: z.string().optional().describe("Default: 'postedSalesCreditMemoLines,trackingLines'"),
|
|
73
|
+
top: z.number().optional(),
|
|
74
|
+
skip: z.number().optional(),
|
|
75
|
+
},
|
|
76
|
+
handler: (args) => {
|
|
77
|
+
const expand = args.expand ?? "postedSalesCreditMemoLines,trackingLines";
|
|
78
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
79
|
+
const endpoint = `${trimitBase()}/postedSalesCreditMemos${qs}`;
|
|
80
|
+
return {
|
|
81
|
+
endpoint,
|
|
82
|
+
method: "GET",
|
|
83
|
+
headers: buildHeaders(),
|
|
84
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
85
|
+
queryParams: params,
|
|
86
|
+
body: null,
|
|
87
|
+
description: "Posted credit memos.",
|
|
88
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
89
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
90
|
+
auth: TRIMIT_AUTH,
|
|
91
|
+
notes: null,
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "trimit_postedsales_list_return_receipts",
|
|
97
|
+
description: "List posted sales return receipts (Return Receipt Header).",
|
|
98
|
+
category: CATEGORY,
|
|
99
|
+
zodShape: {
|
|
100
|
+
filter: z.string().optional(),
|
|
101
|
+
select: z.array(z.string()).optional(),
|
|
102
|
+
expand: z.string().optional().describe("Default: 'postedSalesReturnReceiptLines'"),
|
|
103
|
+
top: z.number().optional(),
|
|
104
|
+
skip: z.number().optional(),
|
|
105
|
+
},
|
|
106
|
+
handler: (args) => {
|
|
107
|
+
const expand = args.expand ?? "postedSalesReturnReceiptLines";
|
|
108
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
109
|
+
const endpoint = `${trimitBase()}/postedSalesReturnReceipts${qs}`;
|
|
110
|
+
return {
|
|
111
|
+
endpoint,
|
|
112
|
+
method: "GET",
|
|
113
|
+
headers: buildHeaders(),
|
|
114
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
115
|
+
queryParams: params,
|
|
116
|
+
body: null,
|
|
117
|
+
description: "Posted return receipts (read-only).",
|
|
118
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
119
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
120
|
+
auth: TRIMIT_AUTH,
|
|
121
|
+
notes: null,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "trimit_postedsales_list_shipments",
|
|
127
|
+
description: "List posted sales shipments with tracking lines.",
|
|
128
|
+
category: CATEGORY,
|
|
129
|
+
zodShape: {
|
|
130
|
+
filter: z.string().optional(),
|
|
131
|
+
select: z.array(z.string()).optional(),
|
|
132
|
+
expand: z.string().optional().describe("Default: 'postedSalesShipmentLines,trackingLines'"),
|
|
133
|
+
top: z.number().optional(),
|
|
134
|
+
skip: z.number().optional(),
|
|
135
|
+
},
|
|
136
|
+
handler: (args) => {
|
|
137
|
+
const expand = args.expand ?? "postedSalesShipmentLines,trackingLines";
|
|
138
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
139
|
+
const endpoint = `${trimitBase()}/postedSalesShipments${qs}`;
|
|
140
|
+
return {
|
|
141
|
+
endpoint,
|
|
142
|
+
method: "GET",
|
|
143
|
+
headers: buildHeaders(),
|
|
144
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
145
|
+
queryParams: params,
|
|
146
|
+
body: null,
|
|
147
|
+
description: "Posted shipments.",
|
|
148
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
149
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
150
|
+
auth: TRIMIT_AUTH,
|
|
151
|
+
notes: "trackingLines contain serial / package tracking data when configured in BC.",
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
];
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TRIMIT_AUTH, buildHeaders, buildOdataQuery, fetchExample, trimitBase } from "../common.js";
|
|
3
|
+
const CATEGORY = "products";
|
|
4
|
+
const MASTERS_DEFAULT_EXPAND = [
|
|
5
|
+
"masterDescriptions",
|
|
6
|
+
"masterDefDims",
|
|
7
|
+
"masterAttributes",
|
|
8
|
+
"masterStatGroups",
|
|
9
|
+
"masterVarDims",
|
|
10
|
+
"masterCollections",
|
|
11
|
+
"masterCompositions",
|
|
12
|
+
"masterAddInfos",
|
|
13
|
+
"masterCarelabels",
|
|
14
|
+
"masterAddTags",
|
|
15
|
+
"masterSustainabilities",
|
|
16
|
+
"masterMeasureCharts",
|
|
17
|
+
"masterItems",
|
|
18
|
+
"masterInventories",
|
|
19
|
+
"masterImages",
|
|
20
|
+
"masterPrices",
|
|
21
|
+
"masterChoicelists",
|
|
22
|
+
"configuredFields",
|
|
23
|
+
].join(",");
|
|
24
|
+
const ITEMS_DEFAULT_EXPAND = [
|
|
25
|
+
"unitOfMeasure",
|
|
26
|
+
"extendedDescriptions",
|
|
27
|
+
"defaultDimensions",
|
|
28
|
+
"attributes",
|
|
29
|
+
"itemStatGroups",
|
|
30
|
+
"picture",
|
|
31
|
+
"itemCompositions",
|
|
32
|
+
"itemAddInfos",
|
|
33
|
+
"itemCarelabels",
|
|
34
|
+
"itemAddTags",
|
|
35
|
+
"itemSustainabilities",
|
|
36
|
+
"itemInventories",
|
|
37
|
+
"itemPrices",
|
|
38
|
+
"configuredFields",
|
|
39
|
+
].join(",");
|
|
40
|
+
const PRODUCTS_DEFAULT_EXPAND = [
|
|
41
|
+
"productDescriptions",
|
|
42
|
+
"productDefDims",
|
|
43
|
+
"productAttributes",
|
|
44
|
+
"productStatGroups",
|
|
45
|
+
"productVarDims",
|
|
46
|
+
"productCollections",
|
|
47
|
+
"productCompositions",
|
|
48
|
+
"productAddInfos",
|
|
49
|
+
"productCarelabels",
|
|
50
|
+
"productAddTags",
|
|
51
|
+
"productSustainabilities",
|
|
52
|
+
"productMeasureCharts",
|
|
53
|
+
"productItems",
|
|
54
|
+
"productPrices",
|
|
55
|
+
"configuredFields",
|
|
56
|
+
].join(",");
|
|
57
|
+
export const productsTools = [
|
|
58
|
+
{
|
|
59
|
+
name: "trimit_products_get_masters",
|
|
60
|
+
description: "List TRIMIT Masters (style/master products). Wide $expand by default — covers descriptions, dimensions, attributes, statistics groups, variants, collections, compositions, additional info, care labels, tags, sustainabilities, measure charts, items, inventories, images, prices, choicelists, and configuredFields.",
|
|
61
|
+
category: CATEGORY,
|
|
62
|
+
zodShape: {
|
|
63
|
+
filter: z.string().optional(),
|
|
64
|
+
select: z.array(z.string()).optional(),
|
|
65
|
+
expand: z.string().optional().describe(`Default expand: ${MASTERS_DEFAULT_EXPAND}`),
|
|
66
|
+
top: z.number().optional(),
|
|
67
|
+
skip: z.number().optional(),
|
|
68
|
+
},
|
|
69
|
+
handler: (args) => {
|
|
70
|
+
const expand = args.expand ?? MASTERS_DEFAULT_EXPAND;
|
|
71
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
72
|
+
const endpoint = `${trimitBase()}/masters${qs}`;
|
|
73
|
+
return {
|
|
74
|
+
endpoint,
|
|
75
|
+
method: "GET",
|
|
76
|
+
headers: buildHeaders(),
|
|
77
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
78
|
+
queryParams: params,
|
|
79
|
+
body: null,
|
|
80
|
+
description: "TRIMIT Masters (style headers).",
|
|
81
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
82
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
83
|
+
auth: TRIMIT_AUTH,
|
|
84
|
+
notes: "Key fields: number (master code), noSystem (SKU template), masterItems → SKU variants. Heavy payload — narrow with $select and trimmed $expand for production traffic.",
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "trimit_products_get_items",
|
|
90
|
+
description: "List TRIMIT-enriched items (SKUs) with picture, prices, attributes, compositions, inventories, configured fields, and more.",
|
|
91
|
+
category: CATEGORY,
|
|
92
|
+
zodShape: {
|
|
93
|
+
filter: z.string().optional(),
|
|
94
|
+
select: z.array(z.string()).optional(),
|
|
95
|
+
expand: z.string().optional().describe(`Default expand: ${ITEMS_DEFAULT_EXPAND}`),
|
|
96
|
+
top: z.number().optional(),
|
|
97
|
+
skip: z.number().optional(),
|
|
98
|
+
},
|
|
99
|
+
handler: (args) => {
|
|
100
|
+
const expand = args.expand ?? ITEMS_DEFAULT_EXPAND;
|
|
101
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
102
|
+
const endpoint = `${trimitBase()}/items${qs}`;
|
|
103
|
+
return {
|
|
104
|
+
endpoint,
|
|
105
|
+
method: "GET",
|
|
106
|
+
headers: buildHeaders(),
|
|
107
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
108
|
+
queryParams: params,
|
|
109
|
+
body: null,
|
|
110
|
+
description: "TRIMIT items list with full expand.",
|
|
111
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
112
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
113
|
+
auth: TRIMIT_AUTH,
|
|
114
|
+
notes: "Different resource from /companies(...)/items in the Standard API — same name, but this one has TRIMIT extensions (variants link, sustainabilities, configuredFields).",
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "trimit_products_get_products",
|
|
120
|
+
description: "Curated product list (Masters + Items from configured BC categories). Suitable for storefront sync.",
|
|
121
|
+
category: CATEGORY,
|
|
122
|
+
zodShape: {
|
|
123
|
+
filter: z.string().optional(),
|
|
124
|
+
select: z.array(z.string()).optional(),
|
|
125
|
+
expand: z.string().optional().describe(`Default expand: ${PRODUCTS_DEFAULT_EXPAND}`),
|
|
126
|
+
top: z.number().optional(),
|
|
127
|
+
skip: z.number().optional(),
|
|
128
|
+
},
|
|
129
|
+
handler: (args) => {
|
|
130
|
+
const expand = args.expand ?? PRODUCTS_DEFAULT_EXPAND;
|
|
131
|
+
const { qs, params } = buildOdataQuery({ ...args, expand });
|
|
132
|
+
const endpoint = `${trimitBase()}/products${qs}`;
|
|
133
|
+
return {
|
|
134
|
+
endpoint,
|
|
135
|
+
method: "GET",
|
|
136
|
+
headers: buildHeaders(),
|
|
137
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
138
|
+
queryParams: params,
|
|
139
|
+
body: null,
|
|
140
|
+
description: "TRIMIT Products feed.",
|
|
141
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
142
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
143
|
+
auth: TRIMIT_AUTH,
|
|
144
|
+
notes: "Filter on lastDateModified for delta sync. Configure which BC categories feed this endpoint in TRIMIT setup.",
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "trimit_products_get_categories",
|
|
150
|
+
description: "List TRIMIT Categories used to drive the /products feed.",
|
|
151
|
+
category: CATEGORY,
|
|
152
|
+
zodShape: {
|
|
153
|
+
filter: z.string().optional(),
|
|
154
|
+
select: z.array(z.string()).optional(),
|
|
155
|
+
top: z.number().optional(),
|
|
156
|
+
skip: z.number().optional(),
|
|
157
|
+
},
|
|
158
|
+
handler: (args) => {
|
|
159
|
+
const { qs, params } = buildOdataQuery(args);
|
|
160
|
+
const endpoint = `${trimitBase()}/categories${qs}`;
|
|
161
|
+
return {
|
|
162
|
+
endpoint,
|
|
163
|
+
method: "GET",
|
|
164
|
+
headers: buildHeaders(),
|
|
165
|
+
pathParams: { tenant: "{tenant}", environment: "{environment}", companyId: "{companyId}" },
|
|
166
|
+
queryParams: params,
|
|
167
|
+
body: null,
|
|
168
|
+
description: "TRIMIT Categories.",
|
|
169
|
+
docsUrl: "https://apidocs.trimit.com/",
|
|
170
|
+
codeExample: fetchExample(endpoint, "GET", null),
|
|
171
|
+
auth: TRIMIT_AUTH,
|
|
172
|
+
notes: null,
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
];
|