@open-loyalty/mcp-server 1.0.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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +654 -0
  3. package/dist/client/http.d.ts +8 -0
  4. package/dist/client/http.js +69 -0
  5. package/dist/config.d.ts +17 -0
  6. package/dist/config.js +40 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +20 -0
  9. package/dist/server.d.ts +4 -0
  10. package/dist/server.js +334 -0
  11. package/dist/tools/achievement.d.ts +983 -0
  12. package/dist/tools/achievement.js +311 -0
  13. package/dist/tools/admin.d.ts +153 -0
  14. package/dist/tools/admin.js +193 -0
  15. package/dist/tools/analytics.d.ts +162 -0
  16. package/dist/tools/analytics.js +245 -0
  17. package/dist/tools/apikey.d.ts +72 -0
  18. package/dist/tools/apikey.js +78 -0
  19. package/dist/tools/audit.d.ts +107 -0
  20. package/dist/tools/audit.js +90 -0
  21. package/dist/tools/badge.d.ts +135 -0
  22. package/dist/tools/badge.js +165 -0
  23. package/dist/tools/campaign.d.ts +1775 -0
  24. package/dist/tools/campaign.js +724 -0
  25. package/dist/tools/export.d.ts +110 -0
  26. package/dist/tools/export.js +147 -0
  27. package/dist/tools/import.d.ts +110 -0
  28. package/dist/tools/import.js +126 -0
  29. package/dist/tools/index.d.ts +22 -0
  30. package/dist/tools/index.js +527 -0
  31. package/dist/tools/member.d.ts +345 -0
  32. package/dist/tools/member.js +358 -0
  33. package/dist/tools/member.test.d.ts +1 -0
  34. package/dist/tools/member.test.js +213 -0
  35. package/dist/tools/points.d.ts +188 -0
  36. package/dist/tools/points.js +306 -0
  37. package/dist/tools/points.test.d.ts +1 -0
  38. package/dist/tools/points.test.js +292 -0
  39. package/dist/tools/reward.d.ts +261 -0
  40. package/dist/tools/reward.js +371 -0
  41. package/dist/tools/reward.test.d.ts +1 -0
  42. package/dist/tools/reward.test.js +240 -0
  43. package/dist/tools/role.d.ts +161 -0
  44. package/dist/tools/role.js +160 -0
  45. package/dist/tools/segment.d.ts +797 -0
  46. package/dist/tools/segment.js +299 -0
  47. package/dist/tools/store.d.ts +101 -0
  48. package/dist/tools/store.js +117 -0
  49. package/dist/tools/tierset.d.ts +288 -0
  50. package/dist/tools/tierset.js +244 -0
  51. package/dist/tools/transaction.d.ts +357 -0
  52. package/dist/tools/transaction.js +242 -0
  53. package/dist/tools/transaction.test.d.ts +1 -0
  54. package/dist/tools/transaction.test.js +235 -0
  55. package/dist/tools/wallet-type.d.ts +32 -0
  56. package/dist/tools/wallet-type.js +58 -0
  57. package/dist/tools/webhook.d.ts +179 -0
  58. package/dist/tools/webhook.js +171 -0
  59. package/dist/types/schemas/achievement.d.ts +1116 -0
  60. package/dist/types/schemas/achievement.js +172 -0
  61. package/dist/types/schemas/admin.d.ts +263 -0
  62. package/dist/types/schemas/admin.js +99 -0
  63. package/dist/types/schemas/analytics.d.ts +542 -0
  64. package/dist/types/schemas/analytics.js +130 -0
  65. package/dist/types/schemas/badge.d.ts +131 -0
  66. package/dist/types/schemas/badge.js +48 -0
  67. package/dist/types/schemas/campaign.d.ts +2005 -0
  68. package/dist/types/schemas/campaign.js +189 -0
  69. package/dist/types/schemas/common.d.ts +52 -0
  70. package/dist/types/schemas/common.js +26 -0
  71. package/dist/types/schemas/export.d.ts +127 -0
  72. package/dist/types/schemas/export.js +43 -0
  73. package/dist/types/schemas/import.d.ts +344 -0
  74. package/dist/types/schemas/import.js +68 -0
  75. package/dist/types/schemas/member.d.ts +443 -0
  76. package/dist/types/schemas/member.js +92 -0
  77. package/dist/types/schemas/points.d.ts +188 -0
  78. package/dist/types/schemas/points.js +54 -0
  79. package/dist/types/schemas/reward.d.ts +278 -0
  80. package/dist/types/schemas/reward.js +69 -0
  81. package/dist/types/schemas/role.d.ts +260 -0
  82. package/dist/types/schemas/role.js +75 -0
  83. package/dist/types/schemas/segment.d.ts +592 -0
  84. package/dist/types/schemas/segment.js +114 -0
  85. package/dist/types/schemas/tierset.d.ts +552 -0
  86. package/dist/types/schemas/tierset.js +87 -0
  87. package/dist/types/schemas/transaction.d.ts +1022 -0
  88. package/dist/types/schemas/transaction.js +63 -0
  89. package/dist/types/schemas/wallet-type.d.ts +99 -0
  90. package/dist/types/schemas/wallet-type.js +17 -0
  91. package/dist/types/schemas/webhook.d.ts +195 -0
  92. package/dist/types/schemas/webhook.js +39 -0
  93. package/dist/utils/cursor.d.ts +84 -0
  94. package/dist/utils/cursor.js +117 -0
  95. package/dist/utils/errors.d.ts +12 -0
  96. package/dist/utils/errors.js +69 -0
  97. package/dist/utils/pagination.d.ts +39 -0
  98. package/dist/utils/pagination.js +77 -0
  99. package/package.json +65 -0
@@ -0,0 +1,344 @@
1
+ import { z } from "zod";
2
+ export declare const ImportTypeEnum: z.ZodEnum<["member", "groupValue", "segmentMembers", "unitTransferAdding", "unitTransferSpending", "transaction", "campaignCode", "rewardCoupon"]>;
3
+ export type ImportType = z.infer<typeof ImportTypeEnum>;
4
+ export declare const ImportStatusEnum: z.ZodEnum<["pending", "processing", "succeed", "failed"]>;
5
+ export type ImportStatus = z.infer<typeof ImportStatusEnum>;
6
+ export declare const ImportEntityDataSchema: z.ZodObject<{
7
+ email: z.ZodOptional<z.ZodString>;
8
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
9
+ phone: z.ZodOptional<z.ZodString>;
10
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
11
+ email: z.ZodOptional<z.ZodString>;
12
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
13
+ phone: z.ZodOptional<z.ZodString>;
14
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
15
+ email: z.ZodOptional<z.ZodString>;
16
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
17
+ phone: z.ZodOptional<z.ZodString>;
18
+ }, z.ZodTypeAny, "passthrough">>;
19
+ export type ImportEntityData = z.infer<typeof ImportEntityDataSchema>;
20
+ export declare const ImportEntitySchema: z.ZodObject<{
21
+ id: z.ZodOptional<z.ZodString>;
22
+ data: z.ZodOptional<z.ZodObject<{
23
+ email: z.ZodOptional<z.ZodString>;
24
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
25
+ phone: z.ZodOptional<z.ZodString>;
26
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
27
+ email: z.ZodOptional<z.ZodString>;
28
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
29
+ phone: z.ZodOptional<z.ZodString>;
30
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
31
+ email: z.ZodOptional<z.ZodString>;
32
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
33
+ phone: z.ZodOptional<z.ZodString>;
34
+ }, z.ZodTypeAny, "passthrough">>>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ data?: z.objectOutputType<{
37
+ email: z.ZodOptional<z.ZodString>;
38
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
39
+ phone: z.ZodOptional<z.ZodString>;
40
+ }, z.ZodTypeAny, "passthrough"> | undefined;
41
+ id?: string | undefined;
42
+ }, {
43
+ data?: z.objectInputType<{
44
+ email: z.ZodOptional<z.ZodString>;
45
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
46
+ phone: z.ZodOptional<z.ZodString>;
47
+ }, z.ZodTypeAny, "passthrough"> | undefined;
48
+ id?: string | undefined;
49
+ }>;
50
+ export type ImportEntity = z.infer<typeof ImportEntitySchema>;
51
+ export declare const ImportItemSchema: z.ZodObject<{
52
+ importId: z.ZodOptional<z.ZodString>;
53
+ status: z.ZodOptional<z.ZodEnum<["pending", "processing", "succeed", "failed"]>>;
54
+ createdAt: z.ZodOptional<z.ZodString>;
55
+ updatedAt: z.ZodOptional<z.ZodString>;
56
+ message: z.ZodOptional<z.ZodString>;
57
+ entity: z.ZodOptional<z.ZodObject<{
58
+ id: z.ZodOptional<z.ZodString>;
59
+ data: z.ZodOptional<z.ZodObject<{
60
+ email: z.ZodOptional<z.ZodString>;
61
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
62
+ phone: z.ZodOptional<z.ZodString>;
63
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
64
+ email: z.ZodOptional<z.ZodString>;
65
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
66
+ phone: z.ZodOptional<z.ZodString>;
67
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
68
+ email: z.ZodOptional<z.ZodString>;
69
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
70
+ phone: z.ZodOptional<z.ZodString>;
71
+ }, z.ZodTypeAny, "passthrough">>>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ data?: z.objectOutputType<{
74
+ email: z.ZodOptional<z.ZodString>;
75
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
76
+ phone: z.ZodOptional<z.ZodString>;
77
+ }, z.ZodTypeAny, "passthrough"> | undefined;
78
+ id?: string | undefined;
79
+ }, {
80
+ data?: z.objectInputType<{
81
+ email: z.ZodOptional<z.ZodString>;
82
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
83
+ phone: z.ZodOptional<z.ZodString>;
84
+ }, z.ZodTypeAny, "passthrough"> | undefined;
85
+ id?: string | undefined;
86
+ }>>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ message?: string | undefined;
89
+ status?: "pending" | "failed" | "processing" | "succeed" | undefined;
90
+ createdAt?: string | undefined;
91
+ updatedAt?: string | undefined;
92
+ importId?: string | undefined;
93
+ entity?: {
94
+ data?: z.objectOutputType<{
95
+ email: z.ZodOptional<z.ZodString>;
96
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
97
+ phone: z.ZodOptional<z.ZodString>;
98
+ }, z.ZodTypeAny, "passthrough"> | undefined;
99
+ id?: string | undefined;
100
+ } | undefined;
101
+ }, {
102
+ message?: string | undefined;
103
+ status?: "pending" | "failed" | "processing" | "succeed" | undefined;
104
+ createdAt?: string | undefined;
105
+ updatedAt?: string | undefined;
106
+ importId?: string | undefined;
107
+ entity?: {
108
+ data?: z.objectInputType<{
109
+ email: z.ZodOptional<z.ZodString>;
110
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
111
+ phone: z.ZodOptional<z.ZodString>;
112
+ }, z.ZodTypeAny, "passthrough"> | undefined;
113
+ id?: string | undefined;
114
+ } | undefined;
115
+ }>;
116
+ export type ImportItem = z.infer<typeof ImportItemSchema>;
117
+ export declare const ImportSchema: z.ZodObject<{
118
+ importId: z.ZodString;
119
+ type: z.ZodOptional<z.ZodEnum<["member", "groupValue", "segmentMembers", "unitTransferAdding", "unitTransferSpending", "transaction", "campaignCode", "rewardCoupon"]>>;
120
+ uploadedDate: z.ZodOptional<z.ZodString>;
121
+ fileName: z.ZodOptional<z.ZodString>;
122
+ itemsToImport: z.ZodOptional<z.ZodNumber>;
123
+ user: z.ZodOptional<z.ZodString>;
124
+ errorMessage: z.ZodOptional<z.ZodString>;
125
+ additionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ importId: string;
128
+ type?: "transaction" | "member" | "groupValue" | "segmentMembers" | "unitTransferAdding" | "unitTransferSpending" | "campaignCode" | "rewardCoupon" | undefined;
129
+ user?: string | undefined;
130
+ uploadedDate?: string | undefined;
131
+ fileName?: string | undefined;
132
+ itemsToImport?: number | undefined;
133
+ errorMessage?: string | undefined;
134
+ additionalData?: Record<string, string> | undefined;
135
+ }, {
136
+ importId: string;
137
+ type?: "transaction" | "member" | "groupValue" | "segmentMembers" | "unitTransferAdding" | "unitTransferSpending" | "campaignCode" | "rewardCoupon" | undefined;
138
+ user?: string | undefined;
139
+ uploadedDate?: string | undefined;
140
+ fileName?: string | undefined;
141
+ itemsToImport?: number | undefined;
142
+ errorMessage?: string | undefined;
143
+ additionalData?: Record<string, string> | undefined;
144
+ }>;
145
+ export type Import = z.infer<typeof ImportSchema>;
146
+ export declare const ImportListResponseSchema: z.ZodObject<{
147
+ items: z.ZodArray<z.ZodObject<{
148
+ importId: z.ZodString;
149
+ type: z.ZodOptional<z.ZodEnum<["member", "groupValue", "segmentMembers", "unitTransferAdding", "unitTransferSpending", "transaction", "campaignCode", "rewardCoupon"]>>;
150
+ uploadedDate: z.ZodOptional<z.ZodString>;
151
+ fileName: z.ZodOptional<z.ZodString>;
152
+ itemsToImport: z.ZodOptional<z.ZodNumber>;
153
+ user: z.ZodOptional<z.ZodString>;
154
+ errorMessage: z.ZodOptional<z.ZodString>;
155
+ additionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ importId: string;
158
+ type?: "transaction" | "member" | "groupValue" | "segmentMembers" | "unitTransferAdding" | "unitTransferSpending" | "campaignCode" | "rewardCoupon" | undefined;
159
+ user?: string | undefined;
160
+ uploadedDate?: string | undefined;
161
+ fileName?: string | undefined;
162
+ itemsToImport?: number | undefined;
163
+ errorMessage?: string | undefined;
164
+ additionalData?: Record<string, string> | undefined;
165
+ }, {
166
+ importId: string;
167
+ type?: "transaction" | "member" | "groupValue" | "segmentMembers" | "unitTransferAdding" | "unitTransferSpending" | "campaignCode" | "rewardCoupon" | undefined;
168
+ user?: string | undefined;
169
+ uploadedDate?: string | undefined;
170
+ fileName?: string | undefined;
171
+ itemsToImport?: number | undefined;
172
+ errorMessage?: string | undefined;
173
+ additionalData?: Record<string, string> | undefined;
174
+ }>, "many">;
175
+ total: z.ZodOptional<z.ZodObject<{
176
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
177
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
178
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNumber]>>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ all?: string | number | undefined;
181
+ filtered?: string | number | undefined;
182
+ estimated?: number | boolean | undefined;
183
+ }, {
184
+ all?: string | number | undefined;
185
+ filtered?: string | number | undefined;
186
+ estimated?: number | boolean | undefined;
187
+ }>>;
188
+ }, "strip", z.ZodTypeAny, {
189
+ items: {
190
+ importId: string;
191
+ type?: "transaction" | "member" | "groupValue" | "segmentMembers" | "unitTransferAdding" | "unitTransferSpending" | "campaignCode" | "rewardCoupon" | undefined;
192
+ user?: string | undefined;
193
+ uploadedDate?: string | undefined;
194
+ fileName?: string | undefined;
195
+ itemsToImport?: number | undefined;
196
+ errorMessage?: string | undefined;
197
+ additionalData?: Record<string, string> | undefined;
198
+ }[];
199
+ total?: {
200
+ all?: string | number | undefined;
201
+ filtered?: string | number | undefined;
202
+ estimated?: number | boolean | undefined;
203
+ } | undefined;
204
+ }, {
205
+ items: {
206
+ importId: string;
207
+ type?: "transaction" | "member" | "groupValue" | "segmentMembers" | "unitTransferAdding" | "unitTransferSpending" | "campaignCode" | "rewardCoupon" | undefined;
208
+ user?: string | undefined;
209
+ uploadedDate?: string | undefined;
210
+ fileName?: string | undefined;
211
+ itemsToImport?: number | undefined;
212
+ errorMessage?: string | undefined;
213
+ additionalData?: Record<string, string> | undefined;
214
+ }[];
215
+ total?: {
216
+ all?: string | number | undefined;
217
+ filtered?: string | number | undefined;
218
+ estimated?: number | boolean | undefined;
219
+ } | undefined;
220
+ }>;
221
+ export type ImportListResponse = z.infer<typeof ImportListResponseSchema>;
222
+ export declare const ImportDetailsResponseSchema: z.ZodObject<{
223
+ items: z.ZodArray<z.ZodObject<{
224
+ importId: z.ZodOptional<z.ZodString>;
225
+ status: z.ZodOptional<z.ZodEnum<["pending", "processing", "succeed", "failed"]>>;
226
+ createdAt: z.ZodOptional<z.ZodString>;
227
+ updatedAt: z.ZodOptional<z.ZodString>;
228
+ message: z.ZodOptional<z.ZodString>;
229
+ entity: z.ZodOptional<z.ZodObject<{
230
+ id: z.ZodOptional<z.ZodString>;
231
+ data: z.ZodOptional<z.ZodObject<{
232
+ email: z.ZodOptional<z.ZodString>;
233
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
234
+ phone: z.ZodOptional<z.ZodString>;
235
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
236
+ email: z.ZodOptional<z.ZodString>;
237
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
238
+ phone: z.ZodOptional<z.ZodString>;
239
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
240
+ email: z.ZodOptional<z.ZodString>;
241
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
242
+ phone: z.ZodOptional<z.ZodString>;
243
+ }, z.ZodTypeAny, "passthrough">>>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ data?: z.objectOutputType<{
246
+ email: z.ZodOptional<z.ZodString>;
247
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
248
+ phone: z.ZodOptional<z.ZodString>;
249
+ }, z.ZodTypeAny, "passthrough"> | undefined;
250
+ id?: string | undefined;
251
+ }, {
252
+ data?: z.objectInputType<{
253
+ email: z.ZodOptional<z.ZodString>;
254
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
255
+ phone: z.ZodOptional<z.ZodString>;
256
+ }, z.ZodTypeAny, "passthrough"> | undefined;
257
+ id?: string | undefined;
258
+ }>>;
259
+ }, "strip", z.ZodTypeAny, {
260
+ message?: string | undefined;
261
+ status?: "pending" | "failed" | "processing" | "succeed" | undefined;
262
+ createdAt?: string | undefined;
263
+ updatedAt?: string | undefined;
264
+ importId?: string | undefined;
265
+ entity?: {
266
+ data?: z.objectOutputType<{
267
+ email: z.ZodOptional<z.ZodString>;
268
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
269
+ phone: z.ZodOptional<z.ZodString>;
270
+ }, z.ZodTypeAny, "passthrough"> | undefined;
271
+ id?: string | undefined;
272
+ } | undefined;
273
+ }, {
274
+ message?: string | undefined;
275
+ status?: "pending" | "failed" | "processing" | "succeed" | undefined;
276
+ createdAt?: string | undefined;
277
+ updatedAt?: string | undefined;
278
+ importId?: string | undefined;
279
+ entity?: {
280
+ data?: z.objectInputType<{
281
+ email: z.ZodOptional<z.ZodString>;
282
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
283
+ phone: z.ZodOptional<z.ZodString>;
284
+ }, z.ZodTypeAny, "passthrough"> | undefined;
285
+ id?: string | undefined;
286
+ } | undefined;
287
+ }>, "many">;
288
+ total: z.ZodOptional<z.ZodObject<{
289
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
290
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
291
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNumber]>>;
292
+ }, "strip", z.ZodTypeAny, {
293
+ all?: string | number | undefined;
294
+ filtered?: string | number | undefined;
295
+ estimated?: number | boolean | undefined;
296
+ }, {
297
+ all?: string | number | undefined;
298
+ filtered?: string | number | undefined;
299
+ estimated?: number | boolean | undefined;
300
+ }>>;
301
+ }, "strip", z.ZodTypeAny, {
302
+ items: {
303
+ message?: string | undefined;
304
+ status?: "pending" | "failed" | "processing" | "succeed" | undefined;
305
+ createdAt?: string | undefined;
306
+ updatedAt?: string | undefined;
307
+ importId?: string | undefined;
308
+ entity?: {
309
+ data?: z.objectOutputType<{
310
+ email: z.ZodOptional<z.ZodString>;
311
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
312
+ phone: z.ZodOptional<z.ZodString>;
313
+ }, z.ZodTypeAny, "passthrough"> | undefined;
314
+ id?: string | undefined;
315
+ } | undefined;
316
+ }[];
317
+ total?: {
318
+ all?: string | number | undefined;
319
+ filtered?: string | number | undefined;
320
+ estimated?: number | boolean | undefined;
321
+ } | undefined;
322
+ }, {
323
+ items: {
324
+ message?: string | undefined;
325
+ status?: "pending" | "failed" | "processing" | "succeed" | undefined;
326
+ createdAt?: string | undefined;
327
+ updatedAt?: string | undefined;
328
+ importId?: string | undefined;
329
+ entity?: {
330
+ data?: z.objectInputType<{
331
+ email: z.ZodOptional<z.ZodString>;
332
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
333
+ phone: z.ZodOptional<z.ZodString>;
334
+ }, z.ZodTypeAny, "passthrough"> | undefined;
335
+ id?: string | undefined;
336
+ } | undefined;
337
+ }[];
338
+ total?: {
339
+ all?: string | number | undefined;
340
+ filtered?: string | number | undefined;
341
+ estimated?: number | boolean | undefined;
342
+ } | undefined;
343
+ }>;
344
+ export type ImportDetailsResponse = z.infer<typeof ImportDetailsResponseSchema>;
@@ -0,0 +1,68 @@
1
+ import { z } from "zod";
2
+ // Import type enum
3
+ export const ImportTypeEnum = z.enum([
4
+ "member",
5
+ "groupValue",
6
+ "segmentMembers",
7
+ "unitTransferAdding",
8
+ "unitTransferSpending",
9
+ "transaction",
10
+ "campaignCode",
11
+ "rewardCoupon",
12
+ ]);
13
+ // Import status enum
14
+ export const ImportStatusEnum = z.enum([
15
+ "pending",
16
+ "processing",
17
+ "succeed",
18
+ "failed",
19
+ ]);
20
+ // Import entity data (for import items)
21
+ export const ImportEntityDataSchema = z.object({
22
+ email: z.string().optional(),
23
+ loyaltyCardNumber: z.string().optional(),
24
+ phone: z.string().optional(),
25
+ }).passthrough();
26
+ // Import entity (individual item in import)
27
+ export const ImportEntitySchema = z.object({
28
+ id: z.string().optional(),
29
+ data: ImportEntityDataSchema.optional(),
30
+ });
31
+ // Import item (individual row in import details)
32
+ export const ImportItemSchema = z.object({
33
+ importId: z.string().optional().describe("Import ID for this item."),
34
+ status: ImportStatusEnum.optional().describe("Status: pending, processing, succeed, failed."),
35
+ createdAt: z.string().optional().describe("Creation timestamp."),
36
+ updatedAt: z.string().optional().describe("Last update timestamp."),
37
+ message: z.string().optional().describe("Status message or error description."),
38
+ entity: ImportEntitySchema.optional().describe("Entity data for this import item."),
39
+ });
40
+ // Import (top-level import record)
41
+ export const ImportSchema = z.object({
42
+ importId: z.string().describe("Unique import ID (UUID)."),
43
+ type: ImportTypeEnum.optional().describe("Import type."),
44
+ uploadedDate: z.string().optional().describe("Upload timestamp."),
45
+ fileName: z.string().optional().describe("Original file name."),
46
+ itemsToImport: z.number().optional().describe("Number of items in import."),
47
+ user: z.string().optional().describe("User who initiated the import."),
48
+ errorMessage: z.string().optional().describe("Error message if import failed."),
49
+ additionalData: z.record(z.string()).optional().describe("Additional metadata."),
50
+ });
51
+ // Import list response
52
+ export const ImportListResponseSchema = z.object({
53
+ items: z.array(ImportSchema),
54
+ total: z.object({
55
+ all: z.union([z.number(), z.string()]).optional(),
56
+ filtered: z.union([z.number(), z.string()]).optional(),
57
+ estimated: z.union([z.boolean(), z.number()]).optional(),
58
+ }).optional(),
59
+ });
60
+ // Import details response (items within an import)
61
+ export const ImportDetailsResponseSchema = z.object({
62
+ items: z.array(ImportItemSchema),
63
+ total: z.object({
64
+ all: z.union([z.number(), z.string()]).optional(),
65
+ filtered: z.union([z.number(), z.string()]).optional(),
66
+ estimated: z.union([z.boolean(), z.number()]).optional(),
67
+ }).optional(),
68
+ });