@open-loyalty/mcp-server 1.5.3 → 1.7.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/config.d.ts +4 -0
- package/dist/config.js +11 -0
- package/dist/index.js +0 -8
- package/dist/server.js +13 -0
- package/dist/tools/achievement/handlers.js +47 -0
- package/dist/tools/achievement/index.d.ts +11 -4
- package/dist/tools/achievement/index.js +12 -1
- package/dist/tools/achievement/schemas.d.ts +4 -4
- package/dist/tools/achievement/schemas.js +13 -12
- package/dist/tools/admin/handlers.d.ts +48 -0
- package/dist/tools/admin/handlers.js +159 -0
- package/dist/tools/admin/index.d.ts +86 -0
- package/dist/tools/admin/index.js +64 -0
- package/dist/tools/admin/schemas.d.ts +40 -0
- package/dist/tools/admin/schemas.js +40 -0
- package/dist/tools/analytics/handlers.d.ts +42 -0
- package/dist/tools/analytics/handlers.js +282 -0
- package/dist/tools/analytics/index.d.ts +108 -0
- package/dist/tools/analytics/index.js +91 -0
- package/dist/tools/analytics/schemas.d.ts +42 -0
- package/dist/tools/analytics/schemas.js +47 -0
- package/dist/tools/apikey/handlers.d.ts +15 -0
- package/dist/tools/apikey/handlers.js +53 -0
- package/dist/tools/apikey/index.d.ts +41 -0
- package/dist/tools/apikey/index.js +38 -0
- package/dist/tools/apikey/schemas.d.ts +31 -0
- package/dist/tools/apikey/schemas.js +15 -0
- package/dist/tools/audit/handlers.d.ts +20 -0
- package/dist/tools/audit/handlers.js +82 -0
- package/dist/tools/audit/index.d.ts +36 -0
- package/dist/tools/audit/index.js +28 -0
- package/dist/tools/audit/schemas.d.ts +62 -0
- package/dist/tools/audit/schemas.js +18 -0
- package/dist/tools/badge/handlers.d.ts +45 -0
- package/dist/tools/badge/handlers.js +135 -0
- package/dist/tools/badge/index.d.ts +68 -0
- package/dist/tools/badge/index.js +47 -0
- package/dist/tools/badge/schemas.d.ts +37 -0
- package/dist/tools/badge/schemas.js +31 -0
- package/dist/tools/campaign/handlers.js +61 -0
- package/dist/tools/campaign/index.d.ts +12 -0
- package/dist/tools/campaign/index.js +20 -1
- package/dist/tools/campaign/member-handlers.js +37 -1
- package/dist/tools/campaign/schemas.js +16 -14
- package/dist/tools/custom-event/handlers.d.ts +98 -0
- package/dist/tools/custom-event/handlers.js +238 -0
- package/dist/tools/custom-event/index.d.ts +139 -0
- package/dist/tools/custom-event/index.js +78 -0
- package/dist/tools/custom-event/schemas.d.ts +87 -0
- package/dist/tools/custom-event/schemas.js +59 -0
- package/dist/tools/export/handlers.d.ts +29 -0
- package/dist/tools/export/handlers.js +128 -0
- package/dist/tools/export/index.d.ts +56 -0
- package/dist/tools/export/index.js +46 -0
- package/dist/tools/export/schemas.d.ts +42 -0
- package/dist/tools/export/schemas.js +41 -0
- package/dist/tools/import/handlers.d.ts +22 -0
- package/dist/tools/import/handlers.js +123 -0
- package/dist/tools/import/index.d.ts +45 -0
- package/dist/tools/import/index.js +41 -0
- package/dist/tools/import/schemas.d.ts +57 -0
- package/dist/tools/import/schemas.js +39 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +11 -11
- package/dist/tools/member/handlers.js +30 -0
- package/dist/tools/member/index.d.ts +10 -0
- package/dist/tools/member/index.js +10 -0
- package/dist/tools/member/schemas.js +13 -13
- package/dist/tools/points/handlers.js +73 -0
- package/dist/tools/points/index.d.ts +6 -0
- package/dist/tools/points/index.js +6 -0
- package/dist/tools/points/schemas.js +1 -1
- package/dist/tools/referral/index.d.ts +3 -0
- package/dist/tools/referral/index.js +3 -0
- package/dist/tools/reward/handlers.js +21 -13
- package/dist/tools/reward/index.d.ts +9 -0
- package/dist/tools/reward/index.js +12 -1
- package/dist/tools/reward/schemas.js +2 -2
- package/dist/tools/role/handlers.d.ts +35 -0
- package/dist/tools/role/handlers.js +127 -0
- package/dist/tools/role/index.d.ts +99 -0
- package/dist/tools/role/index.js +65 -0
- package/dist/tools/role/schemas.d.ts +56 -0
- package/dist/tools/role/schemas.js +35 -0
- package/dist/tools/segment/handlers.js +68 -1
- package/dist/tools/segment/index.d.ts +9 -0
- package/dist/tools/segment/index.js +13 -0
- package/dist/tools/segment/schemas.js +8 -5
- package/dist/tools/store/handlers.d.ts +25 -0
- package/dist/tools/store/handlers.js +89 -0
- package/dist/tools/store/index.d.ts +55 -0
- package/dist/tools/store/index.js +46 -0
- package/dist/tools/store/schemas.d.ts +38 -0
- package/dist/tools/store/schemas.js +23 -0
- package/dist/tools/tierset/handlers.js +92 -1
- package/dist/tools/tierset/index.d.ts +6 -0
- package/dist/tools/tierset/index.js +8 -1
- package/dist/tools/transaction/handlers.js +40 -0
- package/dist/tools/transaction/index.d.ts +4 -0
- package/dist/tools/transaction/index.js +4 -0
- package/dist/tools/transaction/schemas.js +3 -3
- package/dist/tools/wallet-type/index.d.ts +4 -0
- package/dist/tools/wallet-type/index.js +5 -1
- package/dist/tools/webhook/handlers.d.ts +34 -0
- package/dist/tools/webhook/handlers.js +147 -0
- package/dist/tools/webhook/index.d.ts +97 -0
- package/dist/tools/webhook/index.js +65 -0
- package/dist/tools/webhook/schemas.d.ts +72 -0
- package/dist/tools/{webhook.js → webhook/schemas.js} +0 -140
- package/dist/types/schemas/tierset.js +3 -1
- package/package.json +1 -1
- package/dist/tools/admin.d.ts +0 -165
- package/dist/tools/admin.js +0 -205
- package/dist/tools/analytics.d.ts +0 -180
- package/dist/tools/analytics.js +0 -255
- package/dist/tools/apikey.d.ts +0 -79
- package/dist/tools/apikey.js +0 -85
- package/dist/tools/audit.d.ts +0 -111
- package/dist/tools/audit.js +0 -94
- package/dist/tools/badge.d.ts +0 -143
- package/dist/tools/badge.js +0 -174
- package/dist/tools/custom-event.d.ts +0 -315
- package/dist/tools/custom-event.js +0 -271
- package/dist/tools/export.d.ts +0 -118
- package/dist/tools/export.js +0 -152
- package/dist/tools/import.d.ts +0 -116
- package/dist/tools/import.js +0 -143
- package/dist/tools/role.d.ts +0 -180
- package/dist/tools/role.js +0 -173
- package/dist/tools/store.d.ts +0 -109
- package/dist/tools/store.js +0 -125
- package/dist/tools/webhook.d.ts +0 -192
package/dist/tools/analytics.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { apiGet } from "../client/http.js";
|
|
3
|
-
import { formatApiError } from "../utils/errors.js";
|
|
4
|
-
import { getStoreCode } from "../config.js";
|
|
5
|
-
// Input Schemas
|
|
6
|
-
export const AnalyticsTiersInputSchema = {
|
|
7
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
8
|
-
};
|
|
9
|
-
export const AnalyticsMembersInputSchema = {
|
|
10
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
11
|
-
withTransaction: z.boolean().optional().describe("Filter: true for members with transactions, false for members without, omit for all."),
|
|
12
|
-
};
|
|
13
|
-
export const AnalyticsPointsInputSchema = {
|
|
14
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
15
|
-
};
|
|
16
|
-
export const AnalyticsTransactionsInputSchema = {
|
|
17
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
18
|
-
};
|
|
19
|
-
export const AnalyticsReferralsInputSchema = {
|
|
20
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
21
|
-
};
|
|
22
|
-
export const AnalyticsCampaignsInputSchema = {
|
|
23
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
24
|
-
page: z.number().optional().describe("Page number (default: 1)."),
|
|
25
|
-
perPage: z.number().optional().describe("Items per page (default: 25)."),
|
|
26
|
-
executedAt: z.string().optional().describe("Filter by execution date (ISO format)."),
|
|
27
|
-
};
|
|
28
|
-
export const AnalyticsDashboardInputSchema = {
|
|
29
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
30
|
-
dataType: z.enum([
|
|
31
|
-
"registeredMembers", "activeMembers", "revenue", "avgSpending",
|
|
32
|
-
"transactions", "avgTransactionValue", "avgNumberOfTransactions"
|
|
33
|
-
]).describe("REQUIRED: Type of data to retrieve. Options: registeredMembers, activeMembers, revenue, avgSpending, transactions, avgTransactionValue, avgNumberOfTransactions."),
|
|
34
|
-
aggregationType: z.enum(["day", "week", "month"]).optional().describe("Aggregation granularity."),
|
|
35
|
-
intervalStartDate: z.string().optional().describe("Start date (YYYY-MM-DD format)."),
|
|
36
|
-
intervalEndDate: z.string().optional().describe("End date (YYYY-MM-DD format)."),
|
|
37
|
-
};
|
|
38
|
-
export const AnalyticsUnitsInputSchema = {
|
|
39
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
40
|
-
walletTypeCode: z.string().describe("Wallet type code (e.g., 'default' or 'points')."),
|
|
41
|
-
dataType: z.enum([
|
|
42
|
-
"unitsIssued", "unitsSpent", "unitsExpired", "unitsPending", "unitsActive"
|
|
43
|
-
]).optional().describe("Type of data to retrieve."),
|
|
44
|
-
aggregationType: z.enum(["day", "week", "month"]).optional().describe("Aggregation granularity."),
|
|
45
|
-
intervalStartDate: z.string().optional().describe("Start date (YYYY-MM-DD format)."),
|
|
46
|
-
intervalEndDate: z.string().optional().describe("End date (YYYY-MM-DD format)."),
|
|
47
|
-
};
|
|
48
|
-
export const AnalyticsCampaignDetailInputSchema = {
|
|
49
|
-
storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
|
|
50
|
-
campaignId: z.string().describe("The campaign ID to get analytics for."),
|
|
51
|
-
};
|
|
52
|
-
// Handler functions
|
|
53
|
-
export async function analyticsTiers(input) {
|
|
54
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
55
|
-
try {
|
|
56
|
-
const response = await apiGet(`/${storeCode}/analytics/levels`);
|
|
57
|
-
return response;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
throw formatApiError(error, "ol_analytics_tiers");
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export async function analyticsMembers(input) {
|
|
64
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
65
|
-
const params = new URLSearchParams();
|
|
66
|
-
if (input.withTransaction !== undefined) {
|
|
67
|
-
params.append("withTransaction", String(input.withTransaction));
|
|
68
|
-
}
|
|
69
|
-
const queryString = params.toString();
|
|
70
|
-
const url = `/${storeCode}/analytics/members${queryString ? `?${queryString}` : ""}`;
|
|
71
|
-
try {
|
|
72
|
-
const response = await apiGet(url);
|
|
73
|
-
return response;
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
throw formatApiError(error, "ol_analytics_members");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export async function analyticsPoints(input) {
|
|
80
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
81
|
-
try {
|
|
82
|
-
const response = await apiGet(`/${storeCode}/analytics/points`);
|
|
83
|
-
return response;
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
throw formatApiError(error, "ol_analytics_points");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
export async function analyticsTransactions(input) {
|
|
90
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
91
|
-
try {
|
|
92
|
-
const response = await apiGet(`/${storeCode}/analytics/transactions`);
|
|
93
|
-
return response;
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
throw formatApiError(error, "ol_analytics_transactions");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export async function analyticsReferrals(input) {
|
|
100
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
101
|
-
try {
|
|
102
|
-
const response = await apiGet(`/${storeCode}/analytics/referrals`);
|
|
103
|
-
return response;
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
throw formatApiError(error, "ol_analytics_referrals");
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
export async function analyticsCampaigns(input) {
|
|
110
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
111
|
-
const params = new URLSearchParams();
|
|
112
|
-
if (input.page)
|
|
113
|
-
params.append("_page", String(input.page));
|
|
114
|
-
if (input.perPage)
|
|
115
|
-
params.append("_itemsOnPage", String(input.perPage));
|
|
116
|
-
if (input.executedAt)
|
|
117
|
-
params.append("executedAt", input.executedAt);
|
|
118
|
-
const queryString = params.toString();
|
|
119
|
-
const url = `/${storeCode}/analytics/campaigns${queryString ? `?${queryString}` : ""}`;
|
|
120
|
-
try {
|
|
121
|
-
const response = await apiGet(url);
|
|
122
|
-
return response;
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
throw formatApiError(error, "ol_analytics_campaigns");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export async function analyticsDashboard(input) {
|
|
129
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
130
|
-
const params = new URLSearchParams();
|
|
131
|
-
if (input.dataType)
|
|
132
|
-
params.append("dataType", input.dataType);
|
|
133
|
-
if (input.aggregationType)
|
|
134
|
-
params.append("aggregationType", input.aggregationType);
|
|
135
|
-
if (input.intervalStartDate)
|
|
136
|
-
params.append("intervalStartDate", input.intervalStartDate);
|
|
137
|
-
if (input.intervalEndDate)
|
|
138
|
-
params.append("intervalEndDate", input.intervalEndDate);
|
|
139
|
-
const queryString = params.toString();
|
|
140
|
-
const url = `/${storeCode}/analytics/dashboard/general-overview${queryString ? `?${queryString}` : ""}`;
|
|
141
|
-
try {
|
|
142
|
-
const response = await apiGet(url);
|
|
143
|
-
return response;
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
throw formatApiError(error, "ol_analytics_dashboard");
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
export async function analyticsUnits(input) {
|
|
150
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
151
|
-
const params = new URLSearchParams();
|
|
152
|
-
if (input.dataType)
|
|
153
|
-
params.append("dataType", input.dataType);
|
|
154
|
-
if (input.aggregationType)
|
|
155
|
-
params.append("aggregationType", input.aggregationType);
|
|
156
|
-
if (input.intervalStartDate)
|
|
157
|
-
params.append("intervalStartDate", input.intervalStartDate);
|
|
158
|
-
if (input.intervalEndDate)
|
|
159
|
-
params.append("intervalEndDate", input.intervalEndDate);
|
|
160
|
-
const queryString = params.toString();
|
|
161
|
-
const url = `/${storeCode}/analytics/units-overview/${input.walletTypeCode}${queryString ? `?${queryString}` : ""}`;
|
|
162
|
-
try {
|
|
163
|
-
const response = await apiGet(url);
|
|
164
|
-
return response;
|
|
165
|
-
}
|
|
166
|
-
catch (error) {
|
|
167
|
-
throw formatApiError(error, "ol_analytics_units");
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
export async function analyticsCampaignDetail(input) {
|
|
171
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
172
|
-
try {
|
|
173
|
-
// API endpoint uses /campaigns (plural) with campaign ID as query param
|
|
174
|
-
const response = await apiGet(`/${storeCode}/analytics/campaigns?campaignId=${input.campaignId}`);
|
|
175
|
-
return response;
|
|
176
|
-
}
|
|
177
|
-
catch (error) {
|
|
178
|
-
throw formatApiError(error, "ol_analytics_campaign_detail");
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// Tool definitions
|
|
182
|
-
export const analyticsToolDefinitions = [
|
|
183
|
-
{
|
|
184
|
-
name: "ol_analytics_tiers",
|
|
185
|
-
title: "Get Tier Analytics",
|
|
186
|
-
description: "Get tier (level) analytics showing member distribution across tiers. Returns tier IDs, names, and member counts for each tier level.",
|
|
187
|
-
readOnly: true,
|
|
188
|
-
inputSchema: AnalyticsTiersInputSchema,
|
|
189
|
-
handler: analyticsTiers,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: "ol_analytics_members",
|
|
193
|
-
title: "Get Member Analytics",
|
|
194
|
-
description: "Get member analytics showing registration trends. Returns member counts by time intervals (1 day, 7 days, 30 days, 365 days). Filter by transaction status to see engaged vs unengaged members.",
|
|
195
|
-
readOnly: true,
|
|
196
|
-
inputSchema: AnalyticsMembersInputSchema,
|
|
197
|
-
handler: analyticsMembers,
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: "ol_analytics_points",
|
|
201
|
-
title: "Get Points Analytics",
|
|
202
|
-
description: "Get points analytics showing program health. Returns total active points, points spent, points issued, expired points, and pending points. Use to monitor points economy.",
|
|
203
|
-
readOnly: true,
|
|
204
|
-
inputSchema: AnalyticsPointsInputSchema,
|
|
205
|
-
handler: analyticsPoints,
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
name: "ol_analytics_transactions",
|
|
209
|
-
title: "Get Transaction Analytics",
|
|
210
|
-
description: "Get transaction analytics showing purchase trends. Returns transaction counts by intervals, total count, total amount, and average values. Use to monitor sales performance.",
|
|
211
|
-
readOnly: true,
|
|
212
|
-
inputSchema: AnalyticsTransactionsInputSchema,
|
|
213
|
-
handler: analyticsTransactions,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: "ol_analytics_referrals",
|
|
217
|
-
title: "Get Referral Analytics",
|
|
218
|
-
description: "Get referral program analytics showing referral activity. Returns total referral count. Use to monitor referral program performance.",
|
|
219
|
-
readOnly: true,
|
|
220
|
-
inputSchema: AnalyticsReferralsInputSchema,
|
|
221
|
-
handler: analyticsReferrals,
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: "ol_analytics_campaigns",
|
|
225
|
-
title: "Get Campaign Analytics",
|
|
226
|
-
description: "Get campaign analytics showing execution counts per campaign. Returns list of campaigns with their execution counts. Use to identify most successful campaigns.",
|
|
227
|
-
readOnly: true,
|
|
228
|
-
inputSchema: AnalyticsCampaignsInputSchema,
|
|
229
|
-
handler: analyticsCampaigns,
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "ol_analytics_dashboard",
|
|
233
|
-
title: "Get Dashboard Overview",
|
|
234
|
-
description: "Get dashboard overview metrics with time-series data. Returns key metrics (registered members, active members, revenue, avg spending, transactions) with optional date range and aggregation. Use for high-level program dashboards.",
|
|
235
|
-
readOnly: true,
|
|
236
|
-
inputSchema: AnalyticsDashboardInputSchema,
|
|
237
|
-
handler: analyticsDashboard,
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
name: "ol_analytics_units",
|
|
241
|
-
title: "Get Units Overview",
|
|
242
|
-
description: "Get wallet-specific analytics (units overview). Returns units issued, spent, expired, pending, active, plus redemption and breakage rates. Requires walletTypeCode parameter. Use for detailed points economy analysis.",
|
|
243
|
-
readOnly: true,
|
|
244
|
-
inputSchema: AnalyticsUnitsInputSchema,
|
|
245
|
-
handler: analyticsUnits,
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "ol_analytics_campaign_detail",
|
|
249
|
-
title: "Get Campaign Detail Analytics",
|
|
250
|
-
description: "Get detailed analytics for a specific campaign. Returns campaign-specific performance metrics. Use after analytics_campaigns to drill into individual campaign performance.",
|
|
251
|
-
readOnly: true,
|
|
252
|
-
inputSchema: AnalyticsCampaignDetailInputSchema,
|
|
253
|
-
handler: analyticsCampaignDetail,
|
|
254
|
-
},
|
|
255
|
-
];
|
package/dist/tools/apikey.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export interface ApiKey {
|
|
3
|
-
apiKeyId: string;
|
|
4
|
-
token?: string;
|
|
5
|
-
adminId: string;
|
|
6
|
-
name: string;
|
|
7
|
-
legacy?: boolean;
|
|
8
|
-
expirationDate?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ApiKeyListResponse {
|
|
11
|
-
items: ApiKey[];
|
|
12
|
-
total?: {
|
|
13
|
-
all?: number | string;
|
|
14
|
-
filtered?: number | string;
|
|
15
|
-
estimated?: boolean;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const ApiKeyCreateInputSchema: {
|
|
19
|
-
adminId: z.ZodString;
|
|
20
|
-
name: z.ZodOptional<z.ZodString>;
|
|
21
|
-
expirationDate: z.ZodOptional<z.ZodString>;
|
|
22
|
-
};
|
|
23
|
-
export declare const ApiKeyListInputSchema: {
|
|
24
|
-
adminId: z.ZodString;
|
|
25
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
26
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
};
|
|
28
|
-
export declare const ApiKeyDeleteInputSchema: {
|
|
29
|
-
adminId: z.ZodString;
|
|
30
|
-
apiKeyId: z.ZodString;
|
|
31
|
-
};
|
|
32
|
-
export declare function apiKeyCreate(input: {
|
|
33
|
-
adminId: string;
|
|
34
|
-
name?: string;
|
|
35
|
-
expirationDate?: string;
|
|
36
|
-
}): Promise<ApiKey>;
|
|
37
|
-
export declare function apiKeyList(input: {
|
|
38
|
-
adminId: string;
|
|
39
|
-
page?: number;
|
|
40
|
-
perPage?: number;
|
|
41
|
-
}): Promise<ApiKeyListResponse>;
|
|
42
|
-
export declare function apiKeyDelete(input: {
|
|
43
|
-
adminId: string;
|
|
44
|
-
apiKeyId: string;
|
|
45
|
-
}): Promise<void>;
|
|
46
|
-
export declare const apiKeyToolDefinitions: readonly [{
|
|
47
|
-
readonly name: "ol_apikey_create";
|
|
48
|
-
readonly title: "Create API Key";
|
|
49
|
-
readonly description: "Create a new API key for an admin user. CRITICAL: The API token is ONLY returned at creation time. Store it securely immediately - it cannot be retrieved later. Returns apiKeyId, token, adminId, name, and expirationDate.";
|
|
50
|
-
readonly readOnly: false;
|
|
51
|
-
readonly inputSchema: {
|
|
52
|
-
adminId: z.ZodString;
|
|
53
|
-
name: z.ZodOptional<z.ZodString>;
|
|
54
|
-
expirationDate: z.ZodOptional<z.ZodString>;
|
|
55
|
-
};
|
|
56
|
-
readonly handler: typeof apiKeyCreate;
|
|
57
|
-
}, {
|
|
58
|
-
readonly name: "ol_apikey_list";
|
|
59
|
-
readonly title: "List API Keys";
|
|
60
|
-
readonly description: "List API keys for an admin user. Returns list of API keys with apiKeyId, adminId, name, and expirationDate. Note: tokens are not returned in list responses for security.";
|
|
61
|
-
readonly readOnly: true;
|
|
62
|
-
readonly inputSchema: {
|
|
63
|
-
adminId: z.ZodString;
|
|
64
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
66
|
-
};
|
|
67
|
-
readonly handler: typeof apiKeyList;
|
|
68
|
-
}, {
|
|
69
|
-
readonly name: "ol_apikey_delete";
|
|
70
|
-
readonly title: "Delete API Key (Permanent)";
|
|
71
|
-
readonly description: "Delete an API key. Returns void on success (204 No Content). The API key will be immediately invalidated.";
|
|
72
|
-
readonly readOnly: false;
|
|
73
|
-
readonly destructive: true;
|
|
74
|
-
readonly inputSchema: {
|
|
75
|
-
adminId: z.ZodString;
|
|
76
|
-
apiKeyId: z.ZodString;
|
|
77
|
-
};
|
|
78
|
-
readonly handler: typeof apiKeyDelete;
|
|
79
|
-
}];
|
package/dist/tools/apikey.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { apiGet, apiPost, apiDelete } from "../client/http.js";
|
|
3
|
-
import { formatApiError } from "../utils/errors.js";
|
|
4
|
-
// Input Schemas
|
|
5
|
-
export const ApiKeyCreateInputSchema = {
|
|
6
|
-
adminId: z.string().describe("The admin ID (UUID) to create API key for."),
|
|
7
|
-
name: z.string().optional().describe("Name/description for the API key."),
|
|
8
|
-
expirationDate: z.string().optional().describe("Expiration date (ISO format: YYYY-MM-DD)."),
|
|
9
|
-
};
|
|
10
|
-
export const ApiKeyListInputSchema = {
|
|
11
|
-
adminId: z.string().describe("The admin ID (UUID) to list API keys for."),
|
|
12
|
-
page: z.number().optional().describe("Page number (default: 1)."),
|
|
13
|
-
perPage: z.number().optional().describe("Items per page (default: 25)."),
|
|
14
|
-
};
|
|
15
|
-
export const ApiKeyDeleteInputSchema = {
|
|
16
|
-
adminId: z.string().describe("The admin ID (UUID) that owns the API key."),
|
|
17
|
-
apiKeyId: z.string().describe("The API key ID to delete."),
|
|
18
|
-
};
|
|
19
|
-
// Handler functions
|
|
20
|
-
export async function apiKeyCreate(input) {
|
|
21
|
-
const payload = {};
|
|
22
|
-
if (input.name)
|
|
23
|
-
payload.name = input.name;
|
|
24
|
-
if (input.expirationDate)
|
|
25
|
-
payload.expirationDate = input.expirationDate;
|
|
26
|
-
try {
|
|
27
|
-
const response = await apiPost(`/admin/${input.adminId}/api-key`, { apiKey: payload });
|
|
28
|
-
return response;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
throw formatApiError(error, "ol_apikey_create");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export async function apiKeyList(input) {
|
|
35
|
-
const params = new URLSearchParams();
|
|
36
|
-
if (input.page)
|
|
37
|
-
params.append("_page", String(input.page));
|
|
38
|
-
if (input.perPage)
|
|
39
|
-
params.append("_itemsOnPage", String(input.perPage));
|
|
40
|
-
const queryString = params.toString();
|
|
41
|
-
const url = `/admin/${input.adminId}/api-key${queryString ? `?${queryString}` : ""}`;
|
|
42
|
-
try {
|
|
43
|
-
const response = await apiGet(url);
|
|
44
|
-
return response;
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
throw formatApiError(error, "ol_apikey_list");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export async function apiKeyDelete(input) {
|
|
51
|
-
try {
|
|
52
|
-
await apiDelete(`/admin/${input.adminId}/api-key/${input.apiKeyId}`);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
throw formatApiError(error, "ol_apikey_delete");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Tool definitions
|
|
59
|
-
export const apiKeyToolDefinitions = [
|
|
60
|
-
{
|
|
61
|
-
name: "ol_apikey_create",
|
|
62
|
-
title: "Create API Key",
|
|
63
|
-
description: "Create a new API key for an admin user. CRITICAL: The API token is ONLY returned at creation time. Store it securely immediately - it cannot be retrieved later. Returns apiKeyId, token, adminId, name, and expirationDate.",
|
|
64
|
-
readOnly: false,
|
|
65
|
-
inputSchema: ApiKeyCreateInputSchema,
|
|
66
|
-
handler: apiKeyCreate,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "ol_apikey_list",
|
|
70
|
-
title: "List API Keys",
|
|
71
|
-
description: "List API keys for an admin user. Returns list of API keys with apiKeyId, adminId, name, and expirationDate. Note: tokens are not returned in list responses for security.",
|
|
72
|
-
readOnly: true,
|
|
73
|
-
inputSchema: ApiKeyListInputSchema,
|
|
74
|
-
handler: apiKeyList,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "ol_apikey_delete",
|
|
78
|
-
title: "Delete API Key (Permanent)",
|
|
79
|
-
description: "Delete an API key. Returns void on success (204 No Content). The API key will be immediately invalidated.",
|
|
80
|
-
readOnly: false,
|
|
81
|
-
destructive: true,
|
|
82
|
-
inputSchema: ApiKeyDeleteInputSchema,
|
|
83
|
-
handler: apiKeyDelete,
|
|
84
|
-
},
|
|
85
|
-
];
|
package/dist/tools/audit.d.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export interface AuditLogStore {
|
|
3
|
-
storeId: string;
|
|
4
|
-
code: string;
|
|
5
|
-
currency?: string;
|
|
6
|
-
name: string;
|
|
7
|
-
active?: boolean;
|
|
8
|
-
createdAt?: string;
|
|
9
|
-
updatedAt?: string;
|
|
10
|
-
createdBy?: string;
|
|
11
|
-
updatedBy?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface AuditLogEntry {
|
|
14
|
-
auditLogId: string;
|
|
15
|
-
store?: AuditLogStore;
|
|
16
|
-
eventType: string;
|
|
17
|
-
entityType: string;
|
|
18
|
-
entityId: string;
|
|
19
|
-
username: string;
|
|
20
|
-
userId?: string;
|
|
21
|
-
userType?: string;
|
|
22
|
-
ip?: string;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
}
|
|
25
|
-
export interface AuditLogListResponse {
|
|
26
|
-
items: AuditLogEntry[];
|
|
27
|
-
total?: Record<string, unknown>;
|
|
28
|
-
}
|
|
29
|
-
export interface AuditExport {
|
|
30
|
-
exportId: string;
|
|
31
|
-
status: string;
|
|
32
|
-
createdAt: string;
|
|
33
|
-
finishedAt?: string;
|
|
34
|
-
criteria?: string;
|
|
35
|
-
exportedRows?: number;
|
|
36
|
-
message?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface AuditExportListResponse {
|
|
39
|
-
items: AuditExport[];
|
|
40
|
-
total?: {
|
|
41
|
-
all?: number;
|
|
42
|
-
filtered?: number;
|
|
43
|
-
estimated?: boolean;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export declare const AuditListInputSchema: {
|
|
47
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
48
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
eventType: z.ZodOptional<z.ZodString>;
|
|
50
|
-
entityId: z.ZodOptional<z.ZodString>;
|
|
51
|
-
entityType: z.ZodOptional<z.ZodString>;
|
|
52
|
-
username: z.ZodOptional<z.ZodString>;
|
|
53
|
-
dateFrom: z.ZodOptional<z.ZodString>;
|
|
54
|
-
dateTo: z.ZodOptional<z.ZodString>;
|
|
55
|
-
store: z.ZodOptional<z.ZodString>;
|
|
56
|
-
};
|
|
57
|
-
export declare const AuditExportInputSchema: {
|
|
58
|
-
dateFrom: z.ZodOptional<z.ZodString>;
|
|
59
|
-
dateTo: z.ZodOptional<z.ZodString>;
|
|
60
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
62
|
-
};
|
|
63
|
-
export declare function auditList(input: {
|
|
64
|
-
page?: number;
|
|
65
|
-
perPage?: number;
|
|
66
|
-
eventType?: string;
|
|
67
|
-
entityId?: string;
|
|
68
|
-
entityType?: string;
|
|
69
|
-
username?: string;
|
|
70
|
-
dateFrom?: string;
|
|
71
|
-
dateTo?: string;
|
|
72
|
-
store?: string;
|
|
73
|
-
}): Promise<AuditLogListResponse>;
|
|
74
|
-
export declare function auditExport(input: {
|
|
75
|
-
dateFrom?: string;
|
|
76
|
-
dateTo?: string;
|
|
77
|
-
page?: number;
|
|
78
|
-
perPage?: number;
|
|
79
|
-
}): Promise<{
|
|
80
|
-
exportId: string;
|
|
81
|
-
}>;
|
|
82
|
-
export declare const auditToolDefinitions: readonly [{
|
|
83
|
-
readonly name: "ol_audit_list";
|
|
84
|
-
readonly title: "List Audit Logs";
|
|
85
|
-
readonly description: "List audit log entries with optional filtering. Returns paginated list of audit entries with auditLogId, eventType, entityType, entityId, username, timestamp, and details. Audit logs track all administrative actions. Use for compliance and troubleshooting.";
|
|
86
|
-
readonly readOnly: true;
|
|
87
|
-
readonly inputSchema: {
|
|
88
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
89
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
90
|
-
eventType: z.ZodOptional<z.ZodString>;
|
|
91
|
-
entityId: z.ZodOptional<z.ZodString>;
|
|
92
|
-
entityType: z.ZodOptional<z.ZodString>;
|
|
93
|
-
username: z.ZodOptional<z.ZodString>;
|
|
94
|
-
dateFrom: z.ZodOptional<z.ZodString>;
|
|
95
|
-
dateTo: z.ZodOptional<z.ZodString>;
|
|
96
|
-
store: z.ZodOptional<z.ZodString>;
|
|
97
|
-
};
|
|
98
|
-
readonly handler: typeof auditList;
|
|
99
|
-
}, {
|
|
100
|
-
readonly name: "ol_audit_export";
|
|
101
|
-
readonly title: "Export Audit Logs";
|
|
102
|
-
readonly description: "Create an export of system logs. Returns exportId that can be used to track export status. The export will be processed asynchronously. Use date filters to scope the export range.";
|
|
103
|
-
readonly readOnly: false;
|
|
104
|
-
readonly inputSchema: {
|
|
105
|
-
dateFrom: z.ZodOptional<z.ZodString>;
|
|
106
|
-
dateTo: z.ZodOptional<z.ZodString>;
|
|
107
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
108
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
109
|
-
};
|
|
110
|
-
readonly handler: typeof auditExport;
|
|
111
|
-
}];
|
package/dist/tools/audit.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { apiGet, apiPost } from "../client/http.js";
|
|
3
|
-
import { formatApiError } from "../utils/errors.js";
|
|
4
|
-
// Input Schemas
|
|
5
|
-
export const AuditListInputSchema = {
|
|
6
|
-
page: z.number().optional().describe("Page number (default: 1)."),
|
|
7
|
-
perPage: z.number().optional().describe("Items per page (default: 25)."),
|
|
8
|
-
eventType: z.string().optional().describe("Filter by event type."),
|
|
9
|
-
entityId: z.string().optional().describe("Filter by entity ID."),
|
|
10
|
-
entityType: z.string().optional().describe("Filter by entity type (e.g., MEMBER, CAMPAIGN)."),
|
|
11
|
-
username: z.string().optional().describe("Filter by username who performed the action."),
|
|
12
|
-
dateFrom: z.string().optional().describe("Filter by creation date from (ISO format)."),
|
|
13
|
-
dateTo: z.string().optional().describe("Filter by creation date to (ISO format)."),
|
|
14
|
-
store: z.string().optional().describe("Filter by store code."),
|
|
15
|
-
};
|
|
16
|
-
export const AuditExportInputSchema = {
|
|
17
|
-
dateFrom: z.string().optional().describe("Export logs from this date (ISO format)."),
|
|
18
|
-
dateTo: z.string().optional().describe("Export logs to this date (ISO format)."),
|
|
19
|
-
page: z.number().optional().describe("Page number for export."),
|
|
20
|
-
perPage: z.number().optional().describe("Items per page for export."),
|
|
21
|
-
};
|
|
22
|
-
// Handler functions
|
|
23
|
-
export async function auditList(input) {
|
|
24
|
-
const params = new URLSearchParams();
|
|
25
|
-
if (input.page)
|
|
26
|
-
params.append("_page", String(input.page));
|
|
27
|
-
if (input.perPage)
|
|
28
|
-
params.append("_itemsOnPage", String(input.perPage));
|
|
29
|
-
if (input.eventType)
|
|
30
|
-
params.append("eventType", input.eventType);
|
|
31
|
-
if (input.entityId)
|
|
32
|
-
params.append("entityId", input.entityId);
|
|
33
|
-
if (input.entityType)
|
|
34
|
-
params.append("entityType", input.entityType);
|
|
35
|
-
if (input.username)
|
|
36
|
-
params.append("username", input.username);
|
|
37
|
-
if (input.dateFrom)
|
|
38
|
-
params.append("createdAt[gte]", input.dateFrom);
|
|
39
|
-
if (input.dateTo)
|
|
40
|
-
params.append("createdAt[lte]", input.dateTo);
|
|
41
|
-
if (input.store)
|
|
42
|
-
params.append("store", input.store);
|
|
43
|
-
const queryString = params.toString();
|
|
44
|
-
const url = `/audit/log${queryString ? `?${queryString}` : ""}`;
|
|
45
|
-
try {
|
|
46
|
-
const response = await apiGet(url);
|
|
47
|
-
return response;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
throw formatApiError(error, "ol_audit_list");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export async function auditExport(input) {
|
|
54
|
-
const payload = {};
|
|
55
|
-
const systemLogPayload = {};
|
|
56
|
-
if (input.dateFrom || input.dateTo) {
|
|
57
|
-
systemLogPayload.createdAt = {};
|
|
58
|
-
if (input.dateFrom)
|
|
59
|
-
systemLogPayload.createdAt.gte = input.dateFrom;
|
|
60
|
-
if (input.dateTo)
|
|
61
|
-
systemLogPayload.createdAt.lte = input.dateTo;
|
|
62
|
-
}
|
|
63
|
-
if (input.page)
|
|
64
|
-
systemLogPayload._page = input.page;
|
|
65
|
-
if (input.perPage)
|
|
66
|
-
systemLogPayload._itemsOnPage = input.perPage;
|
|
67
|
-
payload.systemLog = systemLogPayload;
|
|
68
|
-
try {
|
|
69
|
-
const response = await apiPost("/system-log/export", payload);
|
|
70
|
-
return response;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
throw formatApiError(error, "ol_audit_export");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Tool definitions
|
|
77
|
-
export const auditToolDefinitions = [
|
|
78
|
-
{
|
|
79
|
-
name: "ol_audit_list",
|
|
80
|
-
title: "List Audit Logs",
|
|
81
|
-
description: "List audit log entries with optional filtering. Returns paginated list of audit entries with auditLogId, eventType, entityType, entityId, username, timestamp, and details. Audit logs track all administrative actions. Use for compliance and troubleshooting.",
|
|
82
|
-
readOnly: true,
|
|
83
|
-
inputSchema: AuditListInputSchema,
|
|
84
|
-
handler: auditList,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "ol_audit_export",
|
|
88
|
-
title: "Export Audit Logs",
|
|
89
|
-
description: "Create an export of system logs. Returns exportId that can be used to track export status. The export will be processed asynchronously. Use date filters to scope the export range.",
|
|
90
|
-
readOnly: false,
|
|
91
|
-
inputSchema: AuditExportInputSchema,
|
|
92
|
-
handler: auditExport,
|
|
93
|
-
},
|
|
94
|
-
];
|