shred-api-client 1.14.3 → 1.14.4-rc.2

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 (114) hide show
  1. package/dist/api/AppConfig.api.d.ts +2 -2
  2. package/dist/api/AppConfig.api.js +25 -2
  3. package/dist/api/Email.api.d.ts +3 -3
  4. package/dist/api/Email.api.js +25 -2
  5. package/dist/api/Goal.api.d.ts +10 -0
  6. package/dist/api/Goal.api.js +42 -0
  7. package/dist/api/Note.api.d.ts +0 -0
  8. package/dist/api/Note.api.js +1 -0
  9. package/dist/api/Notification.api.d.ts +8 -8
  10. package/dist/api/Notification.api.js +32 -9
  11. package/dist/api/Project.api.d.ts +8 -8
  12. package/dist/api/Project.api.js +38 -18
  13. package/dist/api/Prompt.api.d.ts +6 -6
  14. package/dist/api/Prompt.api.js +6 -6
  15. package/dist/api/Subscription.api.d.ts +6 -6
  16. package/dist/api/Subscription.api.js +12 -12
  17. package/dist/api/Tenant.api.d.ts +7 -7
  18. package/dist/api/Tenant.api.js +7 -7
  19. package/dist/api/Track.api.d.ts +3 -3
  20. package/dist/api/Track.api.js +2 -2
  21. package/dist/api/User.api.d.ts +6 -6
  22. package/dist/api/User.api.js +15 -15
  23. package/dist/index.d.ts +13 -5
  24. package/dist/index.js +26 -16
  25. package/dist/model/Api.d.ts +20 -39
  26. package/dist/model/Api.js +3 -1
  27. package/dist/model/app-config/AppConfig.api.d.ts +9 -0
  28. package/dist/model/{AppConfig.schema.js → app-config/AppConfig.api.js} +2 -3
  29. package/dist/model/app-config/index.d.ts +1 -0
  30. package/dist/model/app-config/index.js +17 -0
  31. package/dist/model/asset/index.d.ts +2 -0
  32. package/dist/model/asset/index.js +5 -0
  33. package/dist/model/core/APIResponse.d.ts +6 -0
  34. package/dist/model/core/APIResponse.js +2 -0
  35. package/dist/model/core/Query.d.ts +15 -0
  36. package/dist/model/core/Query.js +2 -0
  37. package/dist/model/core/index.d.ts +2 -0
  38. package/dist/model/core/index.js +18 -0
  39. package/dist/model/email/Email.api.d.ts +11 -0
  40. package/dist/model/{Email.schema.js → email/Email.api.js} +2 -3
  41. package/dist/model/email/Email.schema.d.ts +15 -0
  42. package/dist/model/email/Email.schema.js +9 -0
  43. package/dist/model/email/index.d.ts +3 -0
  44. package/dist/model/email/index.js +20 -0
  45. package/dist/model/exceptions/index.d.ts +3 -2
  46. package/dist/model/exceptions/index.js +2 -1
  47. package/dist/model/goal/Goal.api.d.ts +11 -0
  48. package/dist/model/goal/Goal.api.js +6 -0
  49. package/dist/model/goal/Goal.schema.d.ts +154 -0
  50. package/dist/model/goal/Goal.schema.js +26 -0
  51. package/dist/model/goal/index.d.ts +3 -0
  52. package/dist/model/goal/index.js +22 -0
  53. package/dist/model/note/Note.api.d.ts +26 -0
  54. package/dist/model/note/Note.api.js +21 -0
  55. package/dist/model/note/Note.schema.d.ts +141 -0
  56. package/dist/model/note/Note.schema.js +30 -0
  57. package/dist/model/note/index.d.ts +2 -0
  58. package/dist/model/note/index.js +6 -0
  59. package/dist/model/notification/Notification.api.d.ts +47 -0
  60. package/dist/model/notification/Notification.api.js +13 -0
  61. package/dist/model/notification/Notification.schema.d.ts +454 -0
  62. package/dist/model/notification/Notification.schema.js +111 -0
  63. package/dist/model/notification/index.d.ts +3 -0
  64. package/dist/model/notification/index.js +30 -0
  65. package/dist/model/project/Project.api.d.ts +66 -0
  66. package/dist/model/project/Project.api.js +20 -0
  67. package/dist/model/project/Project.schema.d.ts +206 -0
  68. package/dist/model/{Project.schema.js → project/Project.schema.js} +31 -52
  69. package/dist/model/project/index.d.ts +3 -0
  70. package/dist/model/project/index.js +24 -0
  71. package/dist/model/{Prompt.schema.d.ts → prompt/Prompt.api.d.ts} +4 -24
  72. package/dist/model/{Prompt.schema.js → prompt/Prompt.api.js} +2 -3
  73. package/dist/model/prompt/Prompt.schema.d.ts +165 -0
  74. package/dist/model/prompt/Prompt.schema.js +24 -0
  75. package/dist/model/prompt/index.d.ts +3 -0
  76. package/dist/model/prompt/index.js +22 -0
  77. package/dist/model/{Subscription.schema.d.ts → subscription/Subscription.api.d.ts} +4 -51
  78. package/dist/model/{Subscription.schema.js → subscription/Subscription.api.js} +2 -8
  79. package/dist/model/subscription/Subscription.schema.d.ts +314 -0
  80. package/dist/model/subscription/Subscription.schema.js +53 -0
  81. package/dist/model/subscription/index.d.ts +3 -0
  82. package/dist/model/subscription/index.js +25 -0
  83. package/dist/model/{Tenant.schema.d.ts → tenant/Tenant.api.d.ts} +4 -29
  84. package/dist/model/{Tenant.schema.js → tenant/Tenant.api.js} +2 -3
  85. package/dist/model/tenant/Tenant.schema.d.ts +342 -0
  86. package/dist/model/tenant/Tenant.schema.js +29 -0
  87. package/dist/model/tenant/index.d.ts +3 -0
  88. package/dist/model/tenant/index.js +21 -0
  89. package/dist/model/track/Track.api.d.ts +10 -0
  90. package/dist/model/{Track.schema.js → track/Track.api.js} +2 -3
  91. package/dist/model/track/Track.schema.d.ts +44 -0
  92. package/dist/model/track/Track.schema.js +14 -0
  93. package/dist/model/track/index.d.ts +3 -0
  94. package/dist/model/track/index.js +21 -0
  95. package/dist/model/user/User.api.d.ts +80 -0
  96. package/dist/model/user/User.api.js +20 -0
  97. package/dist/model/user/User.schema.d.ts +117 -0
  98. package/dist/model/user/User.schema.js +42 -0
  99. package/dist/model/user/index.d.ts +3 -0
  100. package/dist/model/user/index.js +23 -0
  101. package/dist/util/parseQuery.d.ts +2 -2
  102. package/package.json +1 -1
  103. package/dist/model/AppConfig.schema.d.ts +0 -10
  104. package/dist/model/Email.schema.d.ts +0 -17
  105. package/dist/model/Notification.schema.d.ts +0 -112
  106. package/dist/model/Notification.schema.js +0 -38
  107. package/dist/model/Project.schema.d.ts +0 -152
  108. package/dist/model/Track.schema.d.ts +0 -20
  109. package/dist/model/User.schema.d.ts +0 -253
  110. package/dist/model/User.schema.js +0 -97
  111. package/dist/namespace.d.ts +0 -259
  112. package/dist/namespace.js +0 -53
  113. package/dist/model/{Asset.schema.d.ts → asset/Asset.schema.d.ts} +4 -4
  114. /package/dist/model/{Asset.schema.js → asset/Asset.schema.js} +0 -0
@@ -0,0 +1,454 @@
1
+ import { z } from "zod";
2
+ export declare enum Frequency {
3
+ DAILY = "daily",
4
+ WEEKLY = "weekly",
5
+ MONTHLY = "monthly"
6
+ }
7
+ export declare enum WeekDay {
8
+ MONDAY = 1,
9
+ TUESDAY = 2,
10
+ WEDNESDAY = 3,
11
+ THURSDAY = 4,
12
+ FRIDAY = 5,
13
+ SATURDAY = 6,
14
+ SUNDAY = 7
15
+ }
16
+ export declare enum CriteriaType {
17
+ AllUsers = "allUsers",
18
+ NoProjects = "noProjects",
19
+ NoSubscription = "noSubscription",
20
+ UsersFromTier = "usersFromTier"
21
+ }
22
+ export declare enum TransportType {
23
+ Push = "push",
24
+ Email = "email"
25
+ }
26
+ export declare enum Status {
27
+ SCHEDULED = "scheduled",
28
+ RUNNING = "running",
29
+ COMPLETED = "completed",
30
+ FAILED = "failed",
31
+ PAUSED = "paused",
32
+ CANCELLED = "cancelled",
33
+ ACTIVE = "active",
34
+ EXPIRED = "expired"
35
+ }
36
+ export declare const NotificationItemSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ userId: z.ZodString;
39
+ triggerId: z.ZodOptional<z.ZodString>;
40
+ title: z.ZodString;
41
+ body: z.ZodString;
42
+ status: z.ZodEnum<["failed", "delivered", "deleted"]>;
43
+ deliveredAt: z.ZodNumber;
44
+ openedAt: z.ZodOptional<z.ZodNumber>;
45
+ deletedAt: z.ZodOptional<z.ZodNumber>;
46
+ cta: z.ZodOptional<z.ZodObject<{
47
+ label: z.ZodString;
48
+ url: z.ZodString;
49
+ }, "strip", z.ZodTypeAny, {
50
+ label: string;
51
+ url: string;
52
+ }, {
53
+ label: string;
54
+ url: string;
55
+ }>>;
56
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
57
+ error: z.ZodOptional<z.ZodString>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ id: string;
60
+ userId: string;
61
+ title: string;
62
+ body: string;
63
+ status: "failed" | "delivered" | "deleted";
64
+ deliveredAt: number;
65
+ metadata: Record<string, string | number>;
66
+ triggerId?: string | undefined;
67
+ openedAt?: number | undefined;
68
+ deletedAt?: number | undefined;
69
+ cta?: {
70
+ label: string;
71
+ url: string;
72
+ } | undefined;
73
+ error?: string | undefined;
74
+ }, {
75
+ id: string;
76
+ userId: string;
77
+ title: string;
78
+ body: string;
79
+ status: "failed" | "delivered" | "deleted";
80
+ deliveredAt: number;
81
+ metadata: Record<string, string | number>;
82
+ triggerId?: string | undefined;
83
+ openedAt?: number | undefined;
84
+ deletedAt?: number | undefined;
85
+ cta?: {
86
+ label: string;
87
+ url: string;
88
+ } | undefined;
89
+ error?: string | undefined;
90
+ }>;
91
+ export declare const NotificationDetailSchema: z.ZodObject<Pick<{
92
+ id: z.ZodString;
93
+ userId: z.ZodString;
94
+ triggerId: z.ZodOptional<z.ZodString>;
95
+ title: z.ZodString;
96
+ body: z.ZodString;
97
+ status: z.ZodEnum<["failed", "delivered", "deleted"]>;
98
+ deliveredAt: z.ZodNumber;
99
+ openedAt: z.ZodOptional<z.ZodNumber>;
100
+ deletedAt: z.ZodOptional<z.ZodNumber>;
101
+ cta: z.ZodOptional<z.ZodObject<{
102
+ label: z.ZodString;
103
+ url: z.ZodString;
104
+ }, "strip", z.ZodTypeAny, {
105
+ label: string;
106
+ url: string;
107
+ }, {
108
+ label: string;
109
+ url: string;
110
+ }>>;
111
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
112
+ error: z.ZodOptional<z.ZodString>;
113
+ }, "userId" | "title" | "body" | "metadata">, "strip", z.ZodTypeAny, {
114
+ userId: string;
115
+ title: string;
116
+ body: string;
117
+ metadata: Record<string, string | number>;
118
+ }, {
119
+ userId: string;
120
+ title: string;
121
+ body: string;
122
+ metadata: Record<string, string | number>;
123
+ }>;
124
+ export declare const CriteriaSchema: z.ZodObject<{
125
+ type: z.ZodNativeEnum<typeof CriteriaType>;
126
+ params: z.ZodRecord<z.ZodString, z.ZodAny>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ params: Record<string, any>;
129
+ type: CriteriaType;
130
+ }, {
131
+ params: Record<string, any>;
132
+ type: CriteriaType;
133
+ }>;
134
+ export declare const HistorySchema: z.ZodObject<{
135
+ batchId: z.ZodString;
136
+ executedAt: z.ZodNumber;
137
+ timezone: z.ZodString;
138
+ status: z.ZodEnum<["success", "failed", "info", "warn"]>;
139
+ users: z.ZodObject<{
140
+ total: z.ZodNumber;
141
+ success: z.ZodNumber;
142
+ error: z.ZodNumber;
143
+ }, "strip", z.ZodTypeAny, {
144
+ error: number;
145
+ success: number;
146
+ total: number;
147
+ }, {
148
+ error: number;
149
+ success: number;
150
+ total: number;
151
+ }>;
152
+ errorList: z.ZodOptional<z.ZodArray<z.ZodObject<{
153
+ token: z.ZodString;
154
+ error: z.ZodString;
155
+ }, "strip", z.ZodTypeAny, {
156
+ token: string;
157
+ error: string;
158
+ }, {
159
+ token: string;
160
+ error: string;
161
+ }>, "many">>;
162
+ executionTimeDuration: z.ZodOptional<z.ZodNumber>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ status: "failed" | "success" | "info" | "warn";
165
+ batchId: string;
166
+ executedAt: number;
167
+ timezone: string;
168
+ users: {
169
+ error: number;
170
+ success: number;
171
+ total: number;
172
+ };
173
+ errorList?: {
174
+ token: string;
175
+ error: string;
176
+ }[] | undefined;
177
+ executionTimeDuration?: number | undefined;
178
+ }, {
179
+ status: "failed" | "success" | "info" | "warn";
180
+ batchId: string;
181
+ executedAt: number;
182
+ timezone: string;
183
+ users: {
184
+ error: number;
185
+ success: number;
186
+ total: number;
187
+ };
188
+ errorList?: {
189
+ token: string;
190
+ error: string;
191
+ }[] | undefined;
192
+ executionTimeDuration?: number | undefined;
193
+ }>;
194
+ export declare const RecurrenceRuleSchema: z.ZodObject<{
195
+ frequency: z.ZodNativeEnum<typeof Frequency>;
196
+ interval: z.ZodNumber;
197
+ weekDays: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof WeekDay>, "many">>;
198
+ dayOfMonth: z.ZodOptional<z.ZodNumber>;
199
+ endDate: z.ZodOptional<z.ZodString>;
200
+ ocurrences: z.ZodOptional<z.ZodNumber>;
201
+ }, "strip", z.ZodTypeAny, {
202
+ frequency: Frequency;
203
+ interval: number;
204
+ weekDays?: WeekDay[] | undefined;
205
+ dayOfMonth?: number | undefined;
206
+ endDate?: string | undefined;
207
+ ocurrences?: number | undefined;
208
+ }, {
209
+ frequency: Frequency;
210
+ interval: number;
211
+ weekDays?: WeekDay[] | undefined;
212
+ dayOfMonth?: number | undefined;
213
+ endDate?: string | undefined;
214
+ ocurrences?: number | undefined;
215
+ }>;
216
+ export declare const TriggerSchema: z.ZodObject<{
217
+ id: z.ZodString;
218
+ title: z.ZodString;
219
+ description: z.ZodString;
220
+ transportType: z.ZodArray<z.ZodNativeEnum<typeof TransportType>, "many">;
221
+ notification: z.ZodObject<Pick<{
222
+ id: z.ZodString;
223
+ userId: z.ZodString;
224
+ triggerId: z.ZodOptional<z.ZodString>;
225
+ title: z.ZodString;
226
+ body: z.ZodString;
227
+ status: z.ZodEnum<["failed", "delivered", "deleted"]>;
228
+ deliveredAt: z.ZodNumber;
229
+ openedAt: z.ZodOptional<z.ZodNumber>;
230
+ deletedAt: z.ZodOptional<z.ZodNumber>;
231
+ cta: z.ZodOptional<z.ZodObject<{
232
+ label: z.ZodString;
233
+ url: z.ZodString;
234
+ }, "strip", z.ZodTypeAny, {
235
+ label: string;
236
+ url: string;
237
+ }, {
238
+ label: string;
239
+ url: string;
240
+ }>>;
241
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
242
+ error: z.ZodOptional<z.ZodString>;
243
+ }, "userId" | "title" | "body" | "metadata">, "strip", z.ZodTypeAny, {
244
+ userId: string;
245
+ title: string;
246
+ body: string;
247
+ metadata: Record<string, string | number>;
248
+ }, {
249
+ userId: string;
250
+ title: string;
251
+ body: string;
252
+ metadata: Record<string, string | number>;
253
+ }>;
254
+ history: z.ZodOptional<z.ZodArray<z.ZodObject<{
255
+ batchId: z.ZodString;
256
+ executedAt: z.ZodNumber;
257
+ timezone: z.ZodString;
258
+ status: z.ZodEnum<["success", "failed", "info", "warn"]>;
259
+ users: z.ZodObject<{
260
+ total: z.ZodNumber;
261
+ success: z.ZodNumber;
262
+ error: z.ZodNumber;
263
+ }, "strip", z.ZodTypeAny, {
264
+ error: number;
265
+ success: number;
266
+ total: number;
267
+ }, {
268
+ error: number;
269
+ success: number;
270
+ total: number;
271
+ }>;
272
+ errorList: z.ZodOptional<z.ZodArray<z.ZodObject<{
273
+ token: z.ZodString;
274
+ error: z.ZodString;
275
+ }, "strip", z.ZodTypeAny, {
276
+ token: string;
277
+ error: string;
278
+ }, {
279
+ token: string;
280
+ error: string;
281
+ }>, "many">>;
282
+ executionTimeDuration: z.ZodOptional<z.ZodNumber>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ status: "failed" | "success" | "info" | "warn";
285
+ batchId: string;
286
+ executedAt: number;
287
+ timezone: string;
288
+ users: {
289
+ error: number;
290
+ success: number;
291
+ total: number;
292
+ };
293
+ errorList?: {
294
+ token: string;
295
+ error: string;
296
+ }[] | undefined;
297
+ executionTimeDuration?: number | undefined;
298
+ }, {
299
+ status: "failed" | "success" | "info" | "warn";
300
+ batchId: string;
301
+ executedAt: number;
302
+ timezone: string;
303
+ users: {
304
+ error: number;
305
+ success: number;
306
+ total: number;
307
+ };
308
+ errorList?: {
309
+ token: string;
310
+ error: string;
311
+ }[] | undefined;
312
+ executionTimeDuration?: number | undefined;
313
+ }>, "many">>;
314
+ status: z.ZodNativeEnum<typeof Status>;
315
+ recurrence: z.ZodOptional<z.ZodObject<{
316
+ frequency: z.ZodNativeEnum<typeof Frequency>;
317
+ interval: z.ZodNumber;
318
+ weekDays: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof WeekDay>, "many">>;
319
+ dayOfMonth: z.ZodOptional<z.ZodNumber>;
320
+ endDate: z.ZodOptional<z.ZodString>;
321
+ ocurrences: z.ZodOptional<z.ZodNumber>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ frequency: Frequency;
324
+ interval: number;
325
+ weekDays?: WeekDay[] | undefined;
326
+ dayOfMonth?: number | undefined;
327
+ endDate?: string | undefined;
328
+ ocurrences?: number | undefined;
329
+ }, {
330
+ frequency: Frequency;
331
+ interval: number;
332
+ weekDays?: WeekDay[] | undefined;
333
+ dayOfMonth?: number | undefined;
334
+ endDate?: string | undefined;
335
+ ocurrences?: number | undefined;
336
+ }>>;
337
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
338
+ tenantIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
339
+ executionDate: z.ZodOptional<z.ZodString>;
340
+ timeOfDay: z.ZodString;
341
+ criteria: z.ZodObject<{
342
+ type: z.ZodNativeEnum<typeof CriteriaType>;
343
+ params: z.ZodRecord<z.ZodString, z.ZodAny>;
344
+ }, "strip", z.ZodTypeAny, {
345
+ params: Record<string, any>;
346
+ type: CriteriaType;
347
+ }, {
348
+ params: Record<string, any>;
349
+ type: CriteriaType;
350
+ }>;
351
+ nextExecution: z.ZodOptional<z.ZodNumber>;
352
+ createdAt: z.ZodOptional<z.ZodNumber>;
353
+ modified: z.ZodOptional<z.ZodNumber>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ id: string;
356
+ title: string;
357
+ status: Status;
358
+ description: string;
359
+ transportType: TransportType[];
360
+ notification: {
361
+ userId: string;
362
+ title: string;
363
+ body: string;
364
+ metadata: Record<string, string | number>;
365
+ };
366
+ timeOfDay: string;
367
+ criteria: {
368
+ params: Record<string, any>;
369
+ type: CriteriaType;
370
+ };
371
+ timezone?: string | null | undefined;
372
+ history?: {
373
+ status: "failed" | "success" | "info" | "warn";
374
+ batchId: string;
375
+ executedAt: number;
376
+ timezone: string;
377
+ users: {
378
+ error: number;
379
+ success: number;
380
+ total: number;
381
+ };
382
+ errorList?: {
383
+ token: string;
384
+ error: string;
385
+ }[] | undefined;
386
+ executionTimeDuration?: number | undefined;
387
+ }[] | undefined;
388
+ recurrence?: {
389
+ frequency: Frequency;
390
+ interval: number;
391
+ weekDays?: WeekDay[] | undefined;
392
+ dayOfMonth?: number | undefined;
393
+ endDate?: string | undefined;
394
+ ocurrences?: number | undefined;
395
+ } | undefined;
396
+ tenantIds?: string[] | undefined;
397
+ executionDate?: string | undefined;
398
+ nextExecution?: number | undefined;
399
+ createdAt?: number | undefined;
400
+ modified?: number | undefined;
401
+ }, {
402
+ id: string;
403
+ title: string;
404
+ status: Status;
405
+ description: string;
406
+ transportType: TransportType[];
407
+ notification: {
408
+ userId: string;
409
+ title: string;
410
+ body: string;
411
+ metadata: Record<string, string | number>;
412
+ };
413
+ timeOfDay: string;
414
+ criteria: {
415
+ params: Record<string, any>;
416
+ type: CriteriaType;
417
+ };
418
+ timezone?: string | null | undefined;
419
+ history?: {
420
+ status: "failed" | "success" | "info" | "warn";
421
+ batchId: string;
422
+ executedAt: number;
423
+ timezone: string;
424
+ users: {
425
+ error: number;
426
+ success: number;
427
+ total: number;
428
+ };
429
+ errorList?: {
430
+ token: string;
431
+ error: string;
432
+ }[] | undefined;
433
+ executionTimeDuration?: number | undefined;
434
+ }[] | undefined;
435
+ recurrence?: {
436
+ frequency: Frequency;
437
+ interval: number;
438
+ weekDays?: WeekDay[] | undefined;
439
+ dayOfMonth?: number | undefined;
440
+ endDate?: string | undefined;
441
+ ocurrences?: number | undefined;
442
+ } | undefined;
443
+ tenantIds?: string[] | undefined;
444
+ executionDate?: string | undefined;
445
+ nextExecution?: number | undefined;
446
+ createdAt?: number | undefined;
447
+ modified?: number | undefined;
448
+ }>;
449
+ export type NotificationItem = z.infer<typeof NotificationItemSchema>;
450
+ export type NotificationDetail = z.infer<typeof NotificationDetailSchema>;
451
+ export type Trigger = z.infer<typeof TriggerSchema>;
452
+ export type RecurrenceRule = z.infer<typeof RecurrenceRuleSchema>;
453
+ export type History = z.infer<typeof HistorySchema>;
454
+ export type Criteria = z.infer<typeof CriteriaSchema>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TriggerSchema = exports.RecurrenceRuleSchema = exports.HistorySchema = exports.CriteriaSchema = exports.NotificationDetailSchema = exports.NotificationItemSchema = exports.Status = exports.TransportType = exports.CriteriaType = exports.WeekDay = exports.Frequency = void 0;
4
+ const zod_1 = require("zod");
5
+ var Frequency;
6
+ (function (Frequency) {
7
+ Frequency["DAILY"] = "daily";
8
+ Frequency["WEEKLY"] = "weekly";
9
+ Frequency["MONTHLY"] = "monthly";
10
+ })(Frequency || (exports.Frequency = Frequency = {}));
11
+ var WeekDay;
12
+ (function (WeekDay) {
13
+ WeekDay[WeekDay["MONDAY"] = 1] = "MONDAY";
14
+ WeekDay[WeekDay["TUESDAY"] = 2] = "TUESDAY";
15
+ WeekDay[WeekDay["WEDNESDAY"] = 3] = "WEDNESDAY";
16
+ WeekDay[WeekDay["THURSDAY"] = 4] = "THURSDAY";
17
+ WeekDay[WeekDay["FRIDAY"] = 5] = "FRIDAY";
18
+ WeekDay[WeekDay["SATURDAY"] = 6] = "SATURDAY";
19
+ WeekDay[WeekDay["SUNDAY"] = 7] = "SUNDAY";
20
+ })(WeekDay || (exports.WeekDay = WeekDay = {}));
21
+ var CriteriaType;
22
+ (function (CriteriaType) {
23
+ CriteriaType["AllUsers"] = "allUsers";
24
+ CriteriaType["NoProjects"] = "noProjects";
25
+ CriteriaType["NoSubscription"] = "noSubscription";
26
+ CriteriaType["UsersFromTier"] = "usersFromTier";
27
+ })(CriteriaType || (exports.CriteriaType = CriteriaType = {}));
28
+ var TransportType;
29
+ (function (TransportType) {
30
+ TransportType["Push"] = "push";
31
+ TransportType["Email"] = "email";
32
+ })(TransportType || (exports.TransportType = TransportType = {}));
33
+ var Status;
34
+ (function (Status) {
35
+ Status["SCHEDULED"] = "scheduled";
36
+ Status["RUNNING"] = "running";
37
+ Status["COMPLETED"] = "completed";
38
+ Status["FAILED"] = "failed";
39
+ Status["PAUSED"] = "paused";
40
+ Status["CANCELLED"] = "cancelled";
41
+ Status["ACTIVE"] = "active";
42
+ Status["EXPIRED"] = "expired";
43
+ })(Status || (exports.Status = Status = {}));
44
+ exports.NotificationItemSchema = zod_1.z.object({
45
+ id: zod_1.z.string(),
46
+ userId: zod_1.z.string(),
47
+ triggerId: zod_1.z.string().optional(),
48
+ title: zod_1.z.string(),
49
+ body: zod_1.z.string(),
50
+ status: zod_1.z.enum(["failed", "delivered", "deleted"]),
51
+ deliveredAt: zod_1.z.number(),
52
+ openedAt: zod_1.z.number().optional(),
53
+ deletedAt: zod_1.z.number().optional(),
54
+ cta: zod_1.z.object({ label: zod_1.z.string(), url: zod_1.z.string().url() }).optional(),
55
+ metadata: zod_1.z.record(zod_1.z.union([zod_1.z.string(), zod_1.z.number()])),
56
+ error: zod_1.z.string().optional(),
57
+ });
58
+ exports.NotificationDetailSchema = exports.NotificationItemSchema.pick({
59
+ title: true,
60
+ body: true,
61
+ userId: true,
62
+ metadata: true,
63
+ });
64
+ exports.CriteriaSchema = zod_1.z.object({
65
+ type: zod_1.z.nativeEnum(CriteriaType),
66
+ params: zod_1.z.record(zod_1.z.any()),
67
+ });
68
+ exports.HistorySchema = zod_1.z.object({
69
+ batchId: zod_1.z.string(),
70
+ executedAt: zod_1.z.number(),
71
+ timezone: zod_1.z.string(),
72
+ status: zod_1.z.enum(["success", "failed", "info", "warn"]),
73
+ users: zod_1.z.object({
74
+ total: zod_1.z.number(),
75
+ success: zod_1.z.number(),
76
+ error: zod_1.z.number(),
77
+ }),
78
+ errorList: zod_1.z
79
+ .array(zod_1.z.object({
80
+ token: zod_1.z.string(),
81
+ error: zod_1.z.string(),
82
+ }))
83
+ .optional(),
84
+ executionTimeDuration: zod_1.z.number().optional(),
85
+ });
86
+ exports.RecurrenceRuleSchema = zod_1.z.object({
87
+ frequency: zod_1.z.nativeEnum(Frequency),
88
+ interval: zod_1.z.number(),
89
+ weekDays: zod_1.z.array(zod_1.z.nativeEnum(WeekDay)).optional(),
90
+ dayOfMonth: zod_1.z.number().optional(),
91
+ endDate: zod_1.z.string().optional(),
92
+ ocurrences: zod_1.z.number().optional(),
93
+ });
94
+ exports.TriggerSchema = zod_1.z.object({
95
+ id: zod_1.z.string(),
96
+ title: zod_1.z.string(),
97
+ description: zod_1.z.string(),
98
+ transportType: zod_1.z.array(zod_1.z.nativeEnum(TransportType)),
99
+ notification: exports.NotificationDetailSchema,
100
+ history: zod_1.z.array(exports.HistorySchema).optional(),
101
+ status: zod_1.z.nativeEnum(Status),
102
+ recurrence: exports.RecurrenceRuleSchema.optional(),
103
+ timezone: zod_1.z.string().nullable().optional(),
104
+ tenantIds: zod_1.z.array(zod_1.z.string()).optional(),
105
+ executionDate: zod_1.z.string().optional(),
106
+ timeOfDay: zod_1.z.string(),
107
+ criteria: exports.CriteriaSchema,
108
+ nextExecution: zod_1.z.number().optional(),
109
+ createdAt: zod_1.z.number().optional(),
110
+ modified: zod_1.z.number().optional(),
111
+ });
@@ -0,0 +1,3 @@
1
+ export type { Trigger, NotificationDetail, NotificationItem, RecurrenceRule, History, Criteria, } from "./Notification.schema";
2
+ export { TriggerSchema, NotificationDetailSchema, NotificationItemSchema, RecurrenceRuleSchema, CriteriaSchema, HistorySchema, Frequency, WeekDay, CriteriaType, TransportType, Status, } from "./Notification.schema";
3
+ export * from "./Notification.api";
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Status = exports.TransportType = exports.CriteriaType = exports.WeekDay = exports.Frequency = exports.HistorySchema = exports.CriteriaSchema = exports.RecurrenceRuleSchema = exports.NotificationItemSchema = exports.NotificationDetailSchema = exports.TriggerSchema = void 0;
18
+ var Notification_schema_1 = require("./Notification.schema");
19
+ Object.defineProperty(exports, "TriggerSchema", { enumerable: true, get: function () { return Notification_schema_1.TriggerSchema; } });
20
+ Object.defineProperty(exports, "NotificationDetailSchema", { enumerable: true, get: function () { return Notification_schema_1.NotificationDetailSchema; } });
21
+ Object.defineProperty(exports, "NotificationItemSchema", { enumerable: true, get: function () { return Notification_schema_1.NotificationItemSchema; } });
22
+ Object.defineProperty(exports, "RecurrenceRuleSchema", { enumerable: true, get: function () { return Notification_schema_1.RecurrenceRuleSchema; } });
23
+ Object.defineProperty(exports, "CriteriaSchema", { enumerable: true, get: function () { return Notification_schema_1.CriteriaSchema; } });
24
+ Object.defineProperty(exports, "HistorySchema", { enumerable: true, get: function () { return Notification_schema_1.HistorySchema; } });
25
+ Object.defineProperty(exports, "Frequency", { enumerable: true, get: function () { return Notification_schema_1.Frequency; } });
26
+ Object.defineProperty(exports, "WeekDay", { enumerable: true, get: function () { return Notification_schema_1.WeekDay; } });
27
+ Object.defineProperty(exports, "CriteriaType", { enumerable: true, get: function () { return Notification_schema_1.CriteriaType; } });
28
+ Object.defineProperty(exports, "TransportType", { enumerable: true, get: function () { return Notification_schema_1.TransportType; } });
29
+ Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return Notification_schema_1.Status; } });
30
+ __exportStar(require("./Notification.api"), exports);
@@ -0,0 +1,66 @@
1
+ import Context from "../Context";
2
+ import { Project, ProjectCreation, SendToApproval, Approve } from "./Project.schema";
3
+ import * as Core from "../core";
4
+ export interface IAPI {
5
+ find: (context: Context, projectId: string) => Promise<Project>;
6
+ create: (context: Context, data: ProjectCreation) => Promise<Project>;
7
+ review: (context: Context, projectId: string, revision: string) => Promise<boolean>;
8
+ cancel: (context: Context, projectId: string) => Promise<boolean>;
9
+ list: (context: Context, query: Core.QueryOptions<Project>) => Promise<Project[]>;
10
+ start: (context: Context, projectId: string) => Promise<boolean>;
11
+ sendToApproval: (context: Context, projectId: string, data: SendToApproval) => Promise<boolean>;
12
+ approve: (context: Context, projectId: string, data: Approve) => Promise<boolean>;
13
+ deny: (context: Context, projectId: string, denyFeedback: string, categories?: string[]) => Promise<boolean>;
14
+ unschedule: (context: Context, projectId: string) => Promise<boolean>;
15
+ rollback: (context: Context, projectId: string) => Promise<boolean>;
16
+ }
17
+ export declare const Endpoints: {
18
+ List: {
19
+ uri: string;
20
+ method: string;
21
+ };
22
+ CreateProject: {
23
+ uri: string;
24
+ method: string;
25
+ };
26
+ FindOne: {
27
+ uri: string;
28
+ method: string;
29
+ };
30
+ GetGoals: {
31
+ uri: string;
32
+ method: string;
33
+ };
34
+ Review: {
35
+ uri: string;
36
+ method: string;
37
+ };
38
+ Cancel: {
39
+ uri: string;
40
+ method: string;
41
+ };
42
+ StartEdition: {
43
+ uri: string;
44
+ method: string;
45
+ };
46
+ SendToApproval: {
47
+ uri: string;
48
+ method: string;
49
+ };
50
+ Approve: {
51
+ uri: string;
52
+ method: string;
53
+ };
54
+ Unschedule: {
55
+ uri: string;
56
+ method: string;
57
+ };
58
+ Rollback: {
59
+ uri: string;
60
+ method: string;
61
+ };
62
+ Deny: {
63
+ uri: string;
64
+ method: string;
65
+ };
66
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Endpoints = void 0;
4
+ exports.Endpoints = {
5
+ List: { uri: "/projects/list", method: "GET" },
6
+ CreateProject: { uri: "/projects/create", method: "POST" },
7
+ FindOne: { uri: `/projects/:projectId/`, method: "GET" },
8
+ GetGoals: { uri: `/projects/goals/list/`, method: "GET" },
9
+ Review: { uri: "/projects/:projectId/review/", method: "POST" },
10
+ Cancel: { uri: "/projects/:projectId/cancel/", method: "DELETE" },
11
+ StartEdition: { uri: "/projects/:projectId/start/", method: "PUT" },
12
+ SendToApproval: {
13
+ uri: "/projects/:projectId/sendToApproval/",
14
+ method: "PUT",
15
+ },
16
+ Approve: { uri: "/projects/:projectId/approve/", method: "POST" },
17
+ Unschedule: { uri: "/projects/:projectId/unschedule/", method: "POST" },
18
+ Rollback: { uri: "/projects/:projectId/rollback/", method: "POST" },
19
+ Deny: { uri: "/projects/:projectId/deny/", method: "POST" },
20
+ };