@open-loyalty/mcp-server 1.0.3 → 1.3.1

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.
Files changed (142) hide show
  1. package/README.md +180 -177
  2. package/dist/auth/provider.js +2 -14
  3. package/dist/auth/storage.js +22 -0
  4. package/dist/client/http.d.ts +5 -0
  5. package/dist/client/http.js +62 -3
  6. package/dist/config.d.ts +6 -5
  7. package/dist/config.js +15 -11
  8. package/dist/http.js +170 -65
  9. package/dist/instructions.d.ts +5 -0
  10. package/dist/instructions.js +420 -0
  11. package/dist/prompts/fan-engagement-setup.d.ts +107 -0
  12. package/dist/prompts/fan-engagement-setup.js +492 -0
  13. package/dist/server.d.ts +1 -1
  14. package/dist/server.js +68 -278
  15. package/dist/tools/achievement/handlers.d.ts +117 -0
  16. package/dist/tools/achievement/handlers.js +161 -0
  17. package/dist/tools/achievement/index.d.ts +479 -0
  18. package/dist/tools/achievement/index.js +74 -0
  19. package/dist/tools/achievement/schemas.d.ts +433 -0
  20. package/dist/tools/achievement/schemas.js +142 -0
  21. package/dist/tools/achievement.d.ts +155 -121
  22. package/dist/tools/achievement.js +82 -39
  23. package/dist/tools/admin.d.ts +18 -6
  24. package/dist/tools/admin.js +24 -12
  25. package/dist/tools/analytics.d.ts +29 -11
  26. package/dist/tools/analytics.js +58 -48
  27. package/dist/tools/apikey.d.ts +10 -3
  28. package/dist/tools/apikey.js +13 -6
  29. package/dist/tools/audit.d.ts +6 -2
  30. package/dist/tools/audit.js +8 -4
  31. package/dist/tools/badge.d.ts +14 -6
  32. package/dist/tools/badge.js +36 -27
  33. package/dist/tools/campaign/handlers.d.ts +42 -0
  34. package/dist/tools/campaign/handlers.js +223 -0
  35. package/dist/tools/campaign/index.d.ts +783 -0
  36. package/dist/tools/campaign/index.js +112 -0
  37. package/dist/tools/campaign/member-handlers.d.ts +60 -0
  38. package/dist/tools/campaign/member-handlers.js +159 -0
  39. package/dist/tools/campaign/schemas.d.ts +704 -0
  40. package/dist/tools/campaign/schemas.js +259 -0
  41. package/dist/tools/campaign/types.d.ts +161 -0
  42. package/dist/tools/campaign/types.js +2 -0
  43. package/dist/tools/campaign.d.ts +41 -16
  44. package/dist/tools/campaign.js +38 -25
  45. package/dist/tools/custom-event.d.ts +315 -0
  46. package/dist/tools/custom-event.js +270 -0
  47. package/dist/tools/export.d.ts +12 -4
  48. package/dist/tools/export.js +25 -20
  49. package/dist/tools/import.d.ts +9 -3
  50. package/dist/tools/import.js +33 -21
  51. package/dist/tools/index.d.ts +3 -11
  52. package/dist/tools/index.js +17 -475
  53. package/dist/tools/member/handlers.d.ts +111 -0
  54. package/dist/tools/member/handlers.js +206 -0
  55. package/dist/tools/member/index.d.ts +169 -0
  56. package/dist/tools/member/index.js +92 -0
  57. package/dist/tools/member/schemas.d.ts +89 -0
  58. package/dist/tools/member/schemas.js +65 -0
  59. package/dist/tools/member.d.ts +21 -0
  60. package/dist/tools/member.js +56 -62
  61. package/dist/tools/points.d.ts +19 -6
  62. package/dist/tools/points.js +51 -49
  63. package/dist/tools/referral/handlers.d.ts +47 -0
  64. package/dist/tools/referral/handlers.js +115 -0
  65. package/dist/tools/referral/index.d.ts +44 -0
  66. package/dist/tools/referral/index.js +44 -0
  67. package/dist/tools/referral/schemas.d.ts +34 -0
  68. package/dist/tools/referral/schemas.js +52 -0
  69. package/dist/tools/reward/handlers.d.ts +110 -0
  70. package/dist/tools/reward/handlers.js +289 -0
  71. package/dist/tools/reward/index.d.ts +177 -0
  72. package/dist/tools/reward/index.js +90 -0
  73. package/dist/tools/reward/schemas.d.ts +116 -0
  74. package/dist/tools/reward/schemas.js +91 -0
  75. package/dist/tools/reward.d.ts +18 -0
  76. package/dist/tools/reward.js +56 -66
  77. package/dist/tools/role.d.ts +26 -7
  78. package/dist/tools/role.js +25 -12
  79. package/dist/tools/segment/handlers.d.ts +87 -0
  80. package/dist/tools/segment/handlers.js +174 -0
  81. package/dist/tools/segment/index.d.ts +395 -0
  82. package/dist/tools/segment/index.js +87 -0
  83. package/dist/tools/segment/schemas.d.ts +337 -0
  84. package/dist/tools/segment/schemas.js +79 -0
  85. package/dist/tools/segment.d.ts +29 -10
  86. package/dist/tools/segment.js +84 -50
  87. package/dist/tools/store.d.ts +12 -4
  88. package/dist/tools/store.js +16 -8
  89. package/dist/tools/tierset.d.ts +19 -7
  90. package/dist/tools/tierset.js +44 -35
  91. package/dist/tools/transaction.d.ts +16 -8
  92. package/dist/tools/transaction.js +25 -21
  93. package/dist/tools/wallet-type.d.ts +7 -3
  94. package/dist/tools/wallet-type.js +14 -12
  95. package/dist/tools/webhook.d.ts +23 -10
  96. package/dist/tools/webhook.js +135 -33
  97. package/dist/types/schemas/achievement.d.ts +12 -309
  98. package/dist/types/schemas/achievement.js +0 -13
  99. package/dist/types/schemas/admin.d.ts +10 -97
  100. package/dist/types/schemas/admin.js +0 -38
  101. package/dist/types/schemas/badge.d.ts +0 -37
  102. package/dist/types/schemas/badge.js +0 -11
  103. package/dist/types/schemas/campaign.d.ts +64 -832
  104. package/dist/types/schemas/campaign.js +2 -25
  105. package/dist/types/schemas/common.d.ts +5 -0
  106. package/dist/types/schemas/common.js +5 -0
  107. package/dist/types/schemas/export.d.ts +0 -17
  108. package/dist/types/schemas/export.js +0 -7
  109. package/dist/types/schemas/member.d.ts +37 -176
  110. package/dist/types/schemas/member.js +0 -27
  111. package/dist/types/schemas/points.d.ts +0 -63
  112. package/dist/types/schemas/points.js +0 -22
  113. package/dist/types/schemas/reward.d.ts +71 -68
  114. package/dist/types/schemas/reward.js +8 -28
  115. package/dist/types/schemas/role.d.ts +0 -100
  116. package/dist/types/schemas/role.js +0 -29
  117. package/dist/types/schemas/segment.d.ts +0 -58
  118. package/dist/types/schemas/segment.js +0 -17
  119. package/dist/types/schemas/tierset.d.ts +0 -176
  120. package/dist/types/schemas/tierset.js +0 -27
  121. package/dist/types/schemas/transaction.d.ts +23 -254
  122. package/dist/types/schemas/transaction.js +0 -7
  123. package/dist/types/schemas/wallet-type.d.ts +8 -8
  124. package/dist/types/schemas/wallet-type.js +1 -1
  125. package/dist/types/schemas/webhook.d.ts +0 -58
  126. package/dist/types/schemas/webhook.js +0 -12
  127. package/dist/utils/errors.js +30 -3
  128. package/dist/utils/payload.d.ts +12 -0
  129. package/dist/utils/payload.js +14 -0
  130. package/dist/workflows/app-login-streak.d.ts +39 -0
  131. package/dist/workflows/app-login-streak.js +298 -0
  132. package/dist/workflows/early-arrival.d.ts +33 -0
  133. package/dist/workflows/early-arrival.js +148 -0
  134. package/dist/workflows/index.d.ts +101 -0
  135. package/dist/workflows/index.js +208 -0
  136. package/dist/workflows/match-attendance.d.ts +45 -0
  137. package/dist/workflows/match-attendance.js +308 -0
  138. package/dist/workflows/sportsbar-visit.d.ts +41 -0
  139. package/dist/workflows/sportsbar-visit.js +284 -0
  140. package/dist/workflows/vod-watching.d.ts +43 -0
  141. package/dist/workflows/vod-watching.js +326 -0
  142. package/package.json +10 -2
@@ -0,0 +1,479 @@
1
+ import { achievementList, achievementCreate, achievementGet, achievementUpdate, achievementPatch, achievementGetMemberProgress, achievementListMemberAchievements } from "./handlers.js";
2
+ export { AchievementListInputSchema, AchievementCreateInputSchema, AchievementGetInputSchema, AchievementUpdateInputSchema, AchievementPatchInputSchema, AchievementGetMemberProgressInputSchema, AchievementListMemberAchievementsInputSchema, } from "./schemas.js";
3
+ export { achievementList, achievementCreate, achievementGet, achievementUpdate, achievementPatch, achievementGetMemberProgress, achievementListMemberAchievements, } from "./handlers.js";
4
+ export type { AchievementMemberProgress } from "./handlers.js";
5
+ export declare const achievementToolDefinitions: readonly [{
6
+ readonly name: "ol_achievement_list";
7
+ readonly title: "List Achievements";
8
+ readonly description: "List achievements. Achievements gamify member behavior by setting goals (e.g., 'Make 5 purchases this month'). Returns achievementId, name, active status, and associated badge. Use achievement_get for full rules and configuration.";
9
+ readonly readOnly: true;
10
+ readonly inputSchema: {
11
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
12
+ page: import("zod").ZodOptional<import("zod").ZodNumber>;
13
+ perPage: import("zod").ZodOptional<import("zod").ZodNumber>;
14
+ active: import("zod").ZodOptional<import("zod").ZodBoolean>;
15
+ name: import("zod").ZodOptional<import("zod").ZodString>;
16
+ };
17
+ readonly handler: typeof achievementList;
18
+ }, {
19
+ readonly name: "ol_achievement_create";
20
+ readonly title: "Create Achievement";
21
+ readonly description: string;
22
+ readonly readOnly: false;
23
+ readonly inputSchema: {
24
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
25
+ translations: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
26
+ name: import("zod").ZodString;
27
+ description: import("zod").ZodOptional<import("zod").ZodString>;
28
+ }, "strip", import("zod").ZodTypeAny, {
29
+ name: string;
30
+ description?: string | undefined;
31
+ }, {
32
+ name: string;
33
+ description?: string | undefined;
34
+ }>>;
35
+ active: import("zod").ZodOptional<import("zod").ZodBoolean>;
36
+ activity: import("zod").ZodOptional<import("zod").ZodObject<{
37
+ startsAt: import("zod").ZodOptional<import("zod").ZodString>;
38
+ endsAt: import("zod").ZodOptional<import("zod").ZodString>;
39
+ operator: import("zod").ZodOptional<import("zod").ZodString>;
40
+ }, "strip", import("zod").ZodTypeAny, {
41
+ operator?: string | undefined;
42
+ startsAt?: string | undefined;
43
+ endsAt?: string | undefined;
44
+ }, {
45
+ operator?: string | undefined;
46
+ startsAt?: string | undefined;
47
+ endsAt?: string | undefined;
48
+ }>>;
49
+ limit: import("zod").ZodOptional<import("zod").ZodObject<{
50
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
51
+ interval: import("zod").ZodOptional<import("zod").ZodObject<{
52
+ type: import("zod").ZodString;
53
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
54
+ }, "strip", import("zod").ZodTypeAny, {
55
+ type: string;
56
+ value?: number | undefined;
57
+ }, {
58
+ type: string;
59
+ value?: number | undefined;
60
+ }>>;
61
+ }, "strip", import("zod").ZodTypeAny, {
62
+ value?: number | undefined;
63
+ interval?: {
64
+ type: string;
65
+ value?: number | undefined;
66
+ } | undefined;
67
+ }, {
68
+ value?: number | undefined;
69
+ interval?: {
70
+ type: string;
71
+ value?: number | undefined;
72
+ } | undefined;
73
+ }>>;
74
+ rules: import("zod").ZodArray<import("zod").ZodObject<{
75
+ achievementRuleId: import("zod").ZodOptional<import("zod").ZodString>;
76
+ translations: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
77
+ name: import("zod").ZodString;
78
+ description: import("zod").ZodOptional<import("zod").ZodString>;
79
+ }, "strip", import("zod").ZodTypeAny, {
80
+ name: string;
81
+ description?: string | undefined;
82
+ }, {
83
+ name: string;
84
+ description?: string | undefined;
85
+ }>>>;
86
+ trigger: import("zod").ZodEnum<["transaction", "custom_event", "points_transfer", "reward_redemption", "referral", "achievement", "tier_change", "profile_update"]>;
87
+ type: import("zod").ZodEnum<["direct", "referral"]>;
88
+ event: import("zod").ZodOptional<import("zod").ZodString>;
89
+ completeRule: import("zod").ZodObject<{
90
+ periodGoal: import("zod").ZodUnion<[import("zod").ZodNumber, import("zod").ZodString]>;
91
+ period: import("zod").ZodObject<{
92
+ type: import("zod").ZodEnum<["day", "week", "month", "year", "last_day", "calendarDays", "calendarWeeks", "calendarMonths", "calendarYears"]>;
93
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
94
+ consecutive: import("zod").ZodNumber;
95
+ }, "strip", import("zod").ZodTypeAny, {
96
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
97
+ consecutive: number;
98
+ value?: number | undefined;
99
+ }, {
100
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
101
+ consecutive: number;
102
+ value?: number | undefined;
103
+ }>;
104
+ uniqueAttribute: import("zod").ZodOptional<import("zod").ZodString>;
105
+ }, "strip", import("zod").ZodTypeAny, {
106
+ periodGoal: string | number;
107
+ period: {
108
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
109
+ consecutive: number;
110
+ value?: number | undefined;
111
+ };
112
+ uniqueAttribute?: string | undefined;
113
+ }, {
114
+ periodGoal: string | number;
115
+ period: {
116
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
117
+ consecutive: number;
118
+ value?: number | undefined;
119
+ };
120
+ uniqueAttribute?: string | undefined;
121
+ }>;
122
+ aggregation: import("zod").ZodObject<{
123
+ type: import("zod").ZodEnum<["quantity"]>;
124
+ }, "strip", import("zod").ZodTypeAny, {
125
+ type: "quantity";
126
+ }, {
127
+ type: "quantity";
128
+ }>;
129
+ conditions: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>, "many">>;
130
+ limit: import("zod").ZodOptional<import("zod").ZodObject<{
131
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
132
+ interval: import("zod").ZodOptional<import("zod").ZodObject<{
133
+ type: import("zod").ZodString;
134
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
135
+ }, "strip", import("zod").ZodTypeAny, {
136
+ type: string;
137
+ value?: number | undefined;
138
+ }, {
139
+ type: string;
140
+ value?: number | undefined;
141
+ }>>;
142
+ }, "strip", import("zod").ZodTypeAny, {
143
+ value?: number | undefined;
144
+ interval?: {
145
+ type: string;
146
+ value?: number | undefined;
147
+ } | undefined;
148
+ }, {
149
+ value?: number | undefined;
150
+ interval?: {
151
+ type: string;
152
+ value?: number | undefined;
153
+ } | undefined;
154
+ }>>;
155
+ uniqueReferee: import("zod").ZodOptional<import("zod").ZodBoolean>;
156
+ }, "strip", import("zod").ZodTypeAny, {
157
+ type: "direct" | "referral";
158
+ trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
159
+ completeRule: {
160
+ periodGoal: string | number;
161
+ period: {
162
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
163
+ consecutive: number;
164
+ value?: number | undefined;
165
+ };
166
+ uniqueAttribute?: string | undefined;
167
+ };
168
+ aggregation: {
169
+ type: "quantity";
170
+ };
171
+ conditions?: Record<string, unknown>[] | undefined;
172
+ translations?: Record<string, {
173
+ name: string;
174
+ description?: string | undefined;
175
+ }> | undefined;
176
+ event?: string | undefined;
177
+ achievementRuleId?: string | undefined;
178
+ limit?: {
179
+ value?: number | undefined;
180
+ interval?: {
181
+ type: string;
182
+ value?: number | undefined;
183
+ } | undefined;
184
+ } | undefined;
185
+ uniqueReferee?: boolean | undefined;
186
+ }, {
187
+ type: "direct" | "referral";
188
+ trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
189
+ completeRule: {
190
+ periodGoal: string | number;
191
+ period: {
192
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
193
+ consecutive: number;
194
+ value?: number | undefined;
195
+ };
196
+ uniqueAttribute?: string | undefined;
197
+ };
198
+ aggregation: {
199
+ type: "quantity";
200
+ };
201
+ conditions?: Record<string, unknown>[] | undefined;
202
+ translations?: Record<string, {
203
+ name: string;
204
+ description?: string | undefined;
205
+ }> | undefined;
206
+ event?: string | undefined;
207
+ achievementRuleId?: string | undefined;
208
+ limit?: {
209
+ value?: number | undefined;
210
+ interval?: {
211
+ type: string;
212
+ value?: number | undefined;
213
+ } | undefined;
214
+ } | undefined;
215
+ uniqueReferee?: boolean | undefined;
216
+ }>, "many">;
217
+ badgeTypeId: import("zod").ZodOptional<import("zod").ZodString>;
218
+ };
219
+ readonly handler: typeof achievementCreate;
220
+ }, {
221
+ readonly name: "ol_achievement_get";
222
+ readonly title: "Get Achievement Details";
223
+ readonly description: "Get achievement details including all rules, conditions, activity period, limits, and completions count.";
224
+ readonly readOnly: true;
225
+ readonly inputSchema: {
226
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
227
+ achievementId: import("zod").ZodString;
228
+ };
229
+ readonly handler: typeof achievementGet;
230
+ }, {
231
+ readonly name: "ol_achievement_update";
232
+ readonly title: "Update Achievement";
233
+ readonly description: "Update achievement configuration. Requires full achievement object (translations, rules). Use achievement_get first to retrieve current configuration.";
234
+ readonly readOnly: false;
235
+ readonly inputSchema: {
236
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
237
+ achievementId: import("zod").ZodString;
238
+ translations: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
239
+ name: import("zod").ZodString;
240
+ description: import("zod").ZodOptional<import("zod").ZodString>;
241
+ }, "strip", import("zod").ZodTypeAny, {
242
+ name: string;
243
+ description?: string | undefined;
244
+ }, {
245
+ name: string;
246
+ description?: string | undefined;
247
+ }>>;
248
+ active: import("zod").ZodOptional<import("zod").ZodBoolean>;
249
+ activity: import("zod").ZodOptional<import("zod").ZodObject<{
250
+ startsAt: import("zod").ZodOptional<import("zod").ZodString>;
251
+ endsAt: import("zod").ZodOptional<import("zod").ZodString>;
252
+ operator: import("zod").ZodOptional<import("zod").ZodString>;
253
+ }, "strip", import("zod").ZodTypeAny, {
254
+ operator?: string | undefined;
255
+ startsAt?: string | undefined;
256
+ endsAt?: string | undefined;
257
+ }, {
258
+ operator?: string | undefined;
259
+ startsAt?: string | undefined;
260
+ endsAt?: string | undefined;
261
+ }>>;
262
+ limit: import("zod").ZodOptional<import("zod").ZodObject<{
263
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
264
+ interval: import("zod").ZodOptional<import("zod").ZodObject<{
265
+ type: import("zod").ZodString;
266
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
267
+ }, "strip", import("zod").ZodTypeAny, {
268
+ type: string;
269
+ value?: number | undefined;
270
+ }, {
271
+ type: string;
272
+ value?: number | undefined;
273
+ }>>;
274
+ }, "strip", import("zod").ZodTypeAny, {
275
+ value?: number | undefined;
276
+ interval?: {
277
+ type: string;
278
+ value?: number | undefined;
279
+ } | undefined;
280
+ }, {
281
+ value?: number | undefined;
282
+ interval?: {
283
+ type: string;
284
+ value?: number | undefined;
285
+ } | undefined;
286
+ }>>;
287
+ rules: import("zod").ZodArray<import("zod").ZodObject<{
288
+ achievementRuleId: import("zod").ZodOptional<import("zod").ZodString>;
289
+ translations: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
290
+ name: import("zod").ZodString;
291
+ description: import("zod").ZodOptional<import("zod").ZodString>;
292
+ }, "strip", import("zod").ZodTypeAny, {
293
+ name: string;
294
+ description?: string | undefined;
295
+ }, {
296
+ name: string;
297
+ description?: string | undefined;
298
+ }>>>;
299
+ trigger: import("zod").ZodEnum<["transaction", "custom_event", "points_transfer", "reward_redemption", "referral", "achievement", "tier_change", "profile_update"]>;
300
+ type: import("zod").ZodEnum<["direct", "referral"]>;
301
+ event: import("zod").ZodOptional<import("zod").ZodString>;
302
+ completeRule: import("zod").ZodObject<{
303
+ periodGoal: import("zod").ZodUnion<[import("zod").ZodNumber, import("zod").ZodString]>;
304
+ period: import("zod").ZodObject<{
305
+ type: import("zod").ZodEnum<["day", "week", "month", "year", "last_day", "calendarDays", "calendarWeeks", "calendarMonths", "calendarYears"]>;
306
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
307
+ consecutive: import("zod").ZodNumber;
308
+ }, "strip", import("zod").ZodTypeAny, {
309
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
310
+ consecutive: number;
311
+ value?: number | undefined;
312
+ }, {
313
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
314
+ consecutive: number;
315
+ value?: number | undefined;
316
+ }>;
317
+ uniqueAttribute: import("zod").ZodOptional<import("zod").ZodString>;
318
+ }, "strip", import("zod").ZodTypeAny, {
319
+ periodGoal: string | number;
320
+ period: {
321
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
322
+ consecutive: number;
323
+ value?: number | undefined;
324
+ };
325
+ uniqueAttribute?: string | undefined;
326
+ }, {
327
+ periodGoal: string | number;
328
+ period: {
329
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
330
+ consecutive: number;
331
+ value?: number | undefined;
332
+ };
333
+ uniqueAttribute?: string | undefined;
334
+ }>;
335
+ aggregation: import("zod").ZodObject<{
336
+ type: import("zod").ZodEnum<["quantity"]>;
337
+ }, "strip", import("zod").ZodTypeAny, {
338
+ type: "quantity";
339
+ }, {
340
+ type: "quantity";
341
+ }>;
342
+ conditions: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>, "many">>;
343
+ limit: import("zod").ZodOptional<import("zod").ZodObject<{
344
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
345
+ interval: import("zod").ZodOptional<import("zod").ZodObject<{
346
+ type: import("zod").ZodString;
347
+ value: import("zod").ZodOptional<import("zod").ZodNumber>;
348
+ }, "strip", import("zod").ZodTypeAny, {
349
+ type: string;
350
+ value?: number | undefined;
351
+ }, {
352
+ type: string;
353
+ value?: number | undefined;
354
+ }>>;
355
+ }, "strip", import("zod").ZodTypeAny, {
356
+ value?: number | undefined;
357
+ interval?: {
358
+ type: string;
359
+ value?: number | undefined;
360
+ } | undefined;
361
+ }, {
362
+ value?: number | undefined;
363
+ interval?: {
364
+ type: string;
365
+ value?: number | undefined;
366
+ } | undefined;
367
+ }>>;
368
+ uniqueReferee: import("zod").ZodOptional<import("zod").ZodBoolean>;
369
+ }, "strip", import("zod").ZodTypeAny, {
370
+ type: "direct" | "referral";
371
+ trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
372
+ completeRule: {
373
+ periodGoal: string | number;
374
+ period: {
375
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
376
+ consecutive: number;
377
+ value?: number | undefined;
378
+ };
379
+ uniqueAttribute?: string | undefined;
380
+ };
381
+ aggregation: {
382
+ type: "quantity";
383
+ };
384
+ conditions?: Record<string, unknown>[] | undefined;
385
+ translations?: Record<string, {
386
+ name: string;
387
+ description?: string | undefined;
388
+ }> | undefined;
389
+ event?: string | undefined;
390
+ achievementRuleId?: string | undefined;
391
+ limit?: {
392
+ value?: number | undefined;
393
+ interval?: {
394
+ type: string;
395
+ value?: number | undefined;
396
+ } | undefined;
397
+ } | undefined;
398
+ uniqueReferee?: boolean | undefined;
399
+ }, {
400
+ type: "direct" | "referral";
401
+ trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
402
+ completeRule: {
403
+ periodGoal: string | number;
404
+ period: {
405
+ type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
406
+ consecutive: number;
407
+ value?: number | undefined;
408
+ };
409
+ uniqueAttribute?: string | undefined;
410
+ };
411
+ aggregation: {
412
+ type: "quantity";
413
+ };
414
+ conditions?: Record<string, unknown>[] | undefined;
415
+ translations?: Record<string, {
416
+ name: string;
417
+ description?: string | undefined;
418
+ }> | undefined;
419
+ event?: string | undefined;
420
+ achievementRuleId?: string | undefined;
421
+ limit?: {
422
+ value?: number | undefined;
423
+ interval?: {
424
+ type: string;
425
+ value?: number | undefined;
426
+ } | undefined;
427
+ } | undefined;
428
+ uniqueReferee?: boolean | undefined;
429
+ }>, "many">;
430
+ badgeTypeId: import("zod").ZodOptional<import("zod").ZodString>;
431
+ };
432
+ readonly handler: typeof achievementUpdate;
433
+ }, {
434
+ readonly name: "ol_achievement_patch";
435
+ readonly title: "Patch Achievement";
436
+ readonly description: "Partial update of achievement. Use for simple changes like activating/deactivating or updating translations without providing full rules.";
437
+ readonly readOnly: false;
438
+ readonly inputSchema: {
439
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
440
+ achievementId: import("zod").ZodString;
441
+ active: import("zod").ZodOptional<import("zod").ZodBoolean>;
442
+ translations: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
443
+ name: import("zod").ZodOptional<import("zod").ZodString>;
444
+ description: import("zod").ZodOptional<import("zod").ZodString>;
445
+ }, "strip", import("zod").ZodTypeAny, {
446
+ name?: string | undefined;
447
+ description?: string | undefined;
448
+ }, {
449
+ name?: string | undefined;
450
+ description?: string | undefined;
451
+ }>>>;
452
+ };
453
+ readonly handler: typeof achievementPatch;
454
+ }, {
455
+ readonly name: "ol_achievement_get_member_progress";
456
+ readonly title: "Get Member Achievement Progress";
457
+ readonly description: "Get member's progress on a specific achievement. Returns completedCount, and for each rule: periodGoal, currentPeriodValue, and consecutive period tracking.";
458
+ readonly readOnly: true;
459
+ readonly inputSchema: {
460
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
461
+ memberId: import("zod").ZodString;
462
+ achievementId: import("zod").ZodString;
463
+ };
464
+ readonly handler: typeof achievementGetMemberProgress;
465
+ }, {
466
+ readonly name: "ol_achievement_list_member_achievements";
467
+ readonly title: "List Member Achievements";
468
+ readonly description: "List all achievements with member's progress. Returns each achievement's status, completion count, and per-rule progress. Use for displaying gamification dashboard.";
469
+ readonly readOnly: true;
470
+ readonly inputSchema: {
471
+ storeCode: import("zod").ZodOptional<import("zod").ZodString>;
472
+ memberId: import("zod").ZodString;
473
+ page: import("zod").ZodOptional<import("zod").ZodNumber>;
474
+ perPage: import("zod").ZodOptional<import("zod").ZodNumber>;
475
+ name: import("zod").ZodOptional<import("zod").ZodString>;
476
+ achievementId: import("zod").ZodOptional<import("zod").ZodString>;
477
+ };
478
+ readonly handler: typeof achievementListMemberAchievements;
479
+ }];
@@ -0,0 +1,74 @@
1
+ import { AchievementListInputSchema, AchievementCreateInputSchema, AchievementGetInputSchema, AchievementUpdateInputSchema, AchievementPatchInputSchema, AchievementGetMemberProgressInputSchema, AchievementListMemberAchievementsInputSchema, } from "./schemas.js";
2
+ import { achievementList, achievementCreate, achievementGet, achievementUpdate, achievementPatch, achievementGetMemberProgress, achievementListMemberAchievements, } from "./handlers.js";
3
+ // Re-export for backward compatibility
4
+ export { AchievementListInputSchema, AchievementCreateInputSchema, AchievementGetInputSchema, AchievementUpdateInputSchema, AchievementPatchInputSchema, AchievementGetMemberProgressInputSchema, AchievementListMemberAchievementsInputSchema, } from "./schemas.js";
5
+ export { achievementList, achievementCreate, achievementGet, achievementUpdate, achievementPatch, achievementGetMemberProgress, achievementListMemberAchievements, } from "./handlers.js";
6
+ // Tool definitions
7
+ export const achievementToolDefinitions = [
8
+ {
9
+ name: "ol_achievement_list",
10
+ title: "List Achievements",
11
+ description: "List achievements. Achievements gamify member behavior by setting goals (e.g., 'Make 5 purchases this month'). Returns achievementId, name, active status, and associated badge. Use achievement_get for full rules and configuration.",
12
+ readOnly: true,
13
+ inputSchema: AchievementListInputSchema,
14
+ handler: achievementList,
15
+ },
16
+ {
17
+ name: "ol_achievement_create",
18
+ title: "Create Achievement",
19
+ description: "Create achievement with rules that track member progress. " +
20
+ "REQUIRED fields in each rule: " +
21
+ "1. type: 'direct' (or 'referral'), " +
22
+ "2. trigger: event type (transaction, custom_event, points_transfer, etc.), " +
23
+ "3. aggregation: { type: 'quantity' } (only 'quantity' is supported), " +
24
+ "4. completeRule: { periodGoal: number, period: { type: 'day', consecutive: 1 } }. " +
25
+ "period.type must be one of: day, week, month, year, last_day, calendarDays, calendarWeeks, calendarMonths, calendarYears. " +
26
+ "All-time tracking uses type='day' with consecutive=1. " +
27
+ "For custom_event trigger, also include event: 'your_event_code'. " +
28
+ "Example - Count 5 custom events: { type: 'direct', trigger: 'custom_event', event: 'app_checkin', aggregation: { type: 'quantity' }, completeRule: { periodGoal: 5, period: { type: 'day', consecutive: 1 } } }. " +
29
+ "For streaks, use consecutive > 1 with limit: { value: 1, interval: { type: 'calendarDays', value: 1 } }.",
30
+ readOnly: false,
31
+ inputSchema: AchievementCreateInputSchema,
32
+ handler: achievementCreate,
33
+ },
34
+ {
35
+ name: "ol_achievement_get",
36
+ title: "Get Achievement Details",
37
+ description: "Get achievement details including all rules, conditions, activity period, limits, and completions count.",
38
+ readOnly: true,
39
+ inputSchema: AchievementGetInputSchema,
40
+ handler: achievementGet,
41
+ },
42
+ {
43
+ name: "ol_achievement_update",
44
+ title: "Update Achievement",
45
+ description: "Update achievement configuration. Requires full achievement object (translations, rules). Use achievement_get first to retrieve current configuration.",
46
+ readOnly: false,
47
+ inputSchema: AchievementUpdateInputSchema,
48
+ handler: achievementUpdate,
49
+ },
50
+ {
51
+ name: "ol_achievement_patch",
52
+ title: "Patch Achievement",
53
+ description: "Partial update of achievement. Use for simple changes like activating/deactivating or updating translations without providing full rules.",
54
+ readOnly: false,
55
+ inputSchema: AchievementPatchInputSchema,
56
+ handler: achievementPatch,
57
+ },
58
+ {
59
+ name: "ol_achievement_get_member_progress",
60
+ title: "Get Member Achievement Progress",
61
+ description: "Get member's progress on a specific achievement. Returns completedCount, and for each rule: periodGoal, currentPeriodValue, and consecutive period tracking.",
62
+ readOnly: true,
63
+ inputSchema: AchievementGetMemberProgressInputSchema,
64
+ handler: achievementGetMemberProgress,
65
+ },
66
+ {
67
+ name: "ol_achievement_list_member_achievements",
68
+ title: "List Member Achievements",
69
+ description: "List all achievements with member's progress. Returns each achievement's status, completion count, and per-rule progress. Use for displaying gamification dashboard.",
70
+ readOnly: true,
71
+ inputSchema: AchievementListMemberAchievementsInputSchema,
72
+ handler: achievementListMemberAchievements,
73
+ },
74
+ ];