@voyantjs/notifications 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,655 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import type { NotificationProvider } from "./types.js";
3
+ type Env = {
4
+ Bindings: Record<string, unknown>;
5
+ Variables: {
6
+ db: PostgresJsDatabase;
7
+ userId?: string;
8
+ };
9
+ };
10
+ export declare function createNotificationsRoutes(options?: {
11
+ providers?: ReadonlyArray<NotificationProvider>;
12
+ resolveProviders?: (bindings: Record<string, unknown>) => ReadonlyArray<NotificationProvider>;
13
+ }): import("hono/hono-base").HonoBase<Env, {
14
+ "/templates": {
15
+ $get: {
16
+ input: {};
17
+ output: {
18
+ data: {
19
+ id: string;
20
+ slug: string;
21
+ name: string;
22
+ channel: "email" | "sms";
23
+ provider: string | null;
24
+ status: "draft" | "active" | "archived";
25
+ subjectTemplate: string | null;
26
+ htmlTemplate: string | null;
27
+ textTemplate: string | null;
28
+ fromAddress: string | null;
29
+ isSystem: boolean;
30
+ metadata: {
31
+ [x: string]: import("hono/utils/types").JSONValue;
32
+ } | null;
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }[];
36
+ total: number;
37
+ limit: number;
38
+ offset: number;
39
+ };
40
+ outputFormat: "json";
41
+ status: import("hono/utils/http-status").ContentfulStatusCode;
42
+ };
43
+ };
44
+ } & {
45
+ "/templates": {
46
+ $post: {
47
+ input: {};
48
+ output: {
49
+ data: {
50
+ id: string;
51
+ name: string;
52
+ status: "draft" | "active" | "archived";
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ metadata: {
56
+ [x: string]: import("hono/utils/types").JSONValue;
57
+ } | null;
58
+ channel: "email" | "sms";
59
+ provider: string | null;
60
+ slug: string;
61
+ subjectTemplate: string | null;
62
+ htmlTemplate: string | null;
63
+ textTemplate: string | null;
64
+ fromAddress: string | null;
65
+ isSystem: boolean;
66
+ } | null;
67
+ };
68
+ outputFormat: "json";
69
+ status: 201;
70
+ };
71
+ };
72
+ } & {
73
+ "/templates/:id": {
74
+ $get: {
75
+ input: {
76
+ param: {
77
+ id: string;
78
+ };
79
+ };
80
+ output: {
81
+ error: string;
82
+ };
83
+ outputFormat: "json";
84
+ status: 404;
85
+ } | {
86
+ input: {
87
+ param: {
88
+ id: string;
89
+ };
90
+ };
91
+ output: {
92
+ data: {
93
+ id: string;
94
+ slug: string;
95
+ name: string;
96
+ channel: "email" | "sms";
97
+ provider: string | null;
98
+ status: "draft" | "active" | "archived";
99
+ subjectTemplate: string | null;
100
+ htmlTemplate: string | null;
101
+ textTemplate: string | null;
102
+ fromAddress: string | null;
103
+ isSystem: boolean;
104
+ metadata: {
105
+ [x: string]: import("hono/utils/types").JSONValue;
106
+ } | null;
107
+ createdAt: string;
108
+ updatedAt: string;
109
+ };
110
+ };
111
+ outputFormat: "json";
112
+ status: import("hono/utils/http-status").ContentfulStatusCode;
113
+ };
114
+ };
115
+ } & {
116
+ "/templates/:id": {
117
+ $patch: {
118
+ input: {
119
+ param: {
120
+ id: string;
121
+ };
122
+ };
123
+ output: {
124
+ error: string;
125
+ };
126
+ outputFormat: "json";
127
+ status: 404;
128
+ } | {
129
+ input: {
130
+ param: {
131
+ id: string;
132
+ };
133
+ };
134
+ output: {
135
+ data: {
136
+ id: string;
137
+ slug: string;
138
+ name: string;
139
+ channel: "email" | "sms";
140
+ provider: string | null;
141
+ status: "draft" | "active" | "archived";
142
+ subjectTemplate: string | null;
143
+ htmlTemplate: string | null;
144
+ textTemplate: string | null;
145
+ fromAddress: string | null;
146
+ isSystem: boolean;
147
+ metadata: {
148
+ [x: string]: import("hono/utils/types").JSONValue;
149
+ } | null;
150
+ createdAt: string;
151
+ updatedAt: string;
152
+ };
153
+ };
154
+ outputFormat: "json";
155
+ status: import("hono/utils/http-status").ContentfulStatusCode;
156
+ };
157
+ };
158
+ } & {
159
+ "/deliveries": {
160
+ $get: {
161
+ input: {};
162
+ output: {
163
+ data: {
164
+ id: string;
165
+ templateId: string | null;
166
+ templateSlug: string | null;
167
+ targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
168
+ targetId: string | null;
169
+ personId: string | null;
170
+ organizationId: string | null;
171
+ bookingId: string | null;
172
+ invoiceId: string | null;
173
+ paymentSessionId: string | null;
174
+ channel: "email" | "sms";
175
+ provider: string;
176
+ providerMessageId: string | null;
177
+ status: "cancelled" | "pending" | "failed" | "sent";
178
+ toAddress: string;
179
+ fromAddress: string | null;
180
+ subject: string | null;
181
+ htmlBody: string | null;
182
+ textBody: string | null;
183
+ payloadData: {
184
+ [x: string]: import("hono/utils/types").JSONValue;
185
+ } | null;
186
+ metadata: {
187
+ [x: string]: import("hono/utils/types").JSONValue;
188
+ } | null;
189
+ errorMessage: string | null;
190
+ scheduledFor: string | null;
191
+ sentAt: string | null;
192
+ failedAt: string | null;
193
+ createdAt: string;
194
+ updatedAt: string;
195
+ }[];
196
+ total: number;
197
+ limit: number;
198
+ offset: number;
199
+ };
200
+ outputFormat: "json";
201
+ status: import("hono/utils/http-status").ContentfulStatusCode;
202
+ };
203
+ };
204
+ } & {
205
+ "/deliveries/:id": {
206
+ $get: {
207
+ input: {
208
+ param: {
209
+ id: string;
210
+ };
211
+ };
212
+ output: {
213
+ error: string;
214
+ };
215
+ outputFormat: "json";
216
+ status: 404;
217
+ } | {
218
+ input: {
219
+ param: {
220
+ id: string;
221
+ };
222
+ };
223
+ output: {
224
+ data: {
225
+ id: string;
226
+ templateId: string | null;
227
+ templateSlug: string | null;
228
+ targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
229
+ targetId: string | null;
230
+ personId: string | null;
231
+ organizationId: string | null;
232
+ bookingId: string | null;
233
+ invoiceId: string | null;
234
+ paymentSessionId: string | null;
235
+ channel: "email" | "sms";
236
+ provider: string;
237
+ providerMessageId: string | null;
238
+ status: "cancelled" | "pending" | "failed" | "sent";
239
+ toAddress: string;
240
+ fromAddress: string | null;
241
+ subject: string | null;
242
+ htmlBody: string | null;
243
+ textBody: string | null;
244
+ payloadData: {
245
+ [x: string]: import("hono/utils/types").JSONValue;
246
+ } | null;
247
+ metadata: {
248
+ [x: string]: import("hono/utils/types").JSONValue;
249
+ } | null;
250
+ errorMessage: string | null;
251
+ scheduledFor: string | null;
252
+ sentAt: string | null;
253
+ failedAt: string | null;
254
+ createdAt: string;
255
+ updatedAt: string;
256
+ };
257
+ };
258
+ outputFormat: "json";
259
+ status: import("hono/utils/http-status").ContentfulStatusCode;
260
+ };
261
+ };
262
+ } & {
263
+ "/reminder-rules": {
264
+ $get: {
265
+ input: {};
266
+ output: {
267
+ data: {
268
+ id: string;
269
+ slug: string;
270
+ name: string;
271
+ status: "draft" | "active" | "archived";
272
+ targetType: "booking_payment_schedule";
273
+ channel: "email" | "sms";
274
+ provider: string | null;
275
+ templateId: string | null;
276
+ templateSlug: string | null;
277
+ relativeDaysFromDueDate: number;
278
+ isSystem: boolean;
279
+ metadata: {
280
+ [x: string]: import("hono/utils/types").JSONValue;
281
+ } | null;
282
+ createdAt: string;
283
+ updatedAt: string;
284
+ }[];
285
+ total: number;
286
+ limit: number;
287
+ offset: number;
288
+ };
289
+ outputFormat: "json";
290
+ status: import("hono/utils/http-status").ContentfulStatusCode;
291
+ };
292
+ };
293
+ } & {
294
+ "/reminder-rules": {
295
+ $post: {
296
+ input: {};
297
+ output: {
298
+ data: {
299
+ id: string;
300
+ name: string;
301
+ status: "draft" | "active" | "archived";
302
+ createdAt: string;
303
+ updatedAt: string;
304
+ metadata: {
305
+ [x: string]: import("hono/utils/types").JSONValue;
306
+ } | null;
307
+ channel: "email" | "sms";
308
+ provider: string | null;
309
+ targetType: "booking_payment_schedule";
310
+ templateId: string | null;
311
+ slug: string;
312
+ isSystem: boolean;
313
+ templateSlug: string | null;
314
+ relativeDaysFromDueDate: number;
315
+ } | null;
316
+ };
317
+ outputFormat: "json";
318
+ status: 201;
319
+ };
320
+ };
321
+ } & {
322
+ "/reminder-rules/:id": {
323
+ $get: {
324
+ input: {
325
+ param: {
326
+ id: string;
327
+ };
328
+ };
329
+ output: {
330
+ error: string;
331
+ };
332
+ outputFormat: "json";
333
+ status: 404;
334
+ } | {
335
+ input: {
336
+ param: {
337
+ id: string;
338
+ };
339
+ };
340
+ output: {
341
+ data: {
342
+ id: string;
343
+ slug: string;
344
+ name: string;
345
+ status: "draft" | "active" | "archived";
346
+ targetType: "booking_payment_schedule";
347
+ channel: "email" | "sms";
348
+ provider: string | null;
349
+ templateId: string | null;
350
+ templateSlug: string | null;
351
+ relativeDaysFromDueDate: number;
352
+ isSystem: boolean;
353
+ metadata: {
354
+ [x: string]: import("hono/utils/types").JSONValue;
355
+ } | null;
356
+ createdAt: string;
357
+ updatedAt: string;
358
+ };
359
+ };
360
+ outputFormat: "json";
361
+ status: import("hono/utils/http-status").ContentfulStatusCode;
362
+ };
363
+ };
364
+ } & {
365
+ "/reminder-rules/:id": {
366
+ $patch: {
367
+ input: {
368
+ param: {
369
+ id: string;
370
+ };
371
+ };
372
+ output: {
373
+ error: string;
374
+ };
375
+ outputFormat: "json";
376
+ status: 404;
377
+ } | {
378
+ input: {
379
+ param: {
380
+ id: string;
381
+ };
382
+ };
383
+ output: {
384
+ data: {
385
+ id: string;
386
+ slug: string;
387
+ name: string;
388
+ status: "draft" | "active" | "archived";
389
+ targetType: "booking_payment_schedule";
390
+ channel: "email" | "sms";
391
+ provider: string | null;
392
+ templateId: string | null;
393
+ templateSlug: string | null;
394
+ relativeDaysFromDueDate: number;
395
+ isSystem: boolean;
396
+ metadata: {
397
+ [x: string]: import("hono/utils/types").JSONValue;
398
+ } | null;
399
+ createdAt: string;
400
+ updatedAt: string;
401
+ };
402
+ };
403
+ outputFormat: "json";
404
+ status: import("hono/utils/http-status").ContentfulStatusCode;
405
+ };
406
+ };
407
+ } & {
408
+ "/reminder-runs": {
409
+ $get: {
410
+ input: {};
411
+ output: {
412
+ data: {
413
+ id: string;
414
+ reminderRuleId: string;
415
+ targetType: "booking_payment_schedule";
416
+ targetId: string;
417
+ dedupeKey: string;
418
+ bookingId: string | null;
419
+ personId: string | null;
420
+ organizationId: string | null;
421
+ paymentSessionId: string | null;
422
+ notificationDeliveryId: string | null;
423
+ status: "failed" | "sent" | "processing" | "skipped";
424
+ recipient: string | null;
425
+ scheduledFor: string;
426
+ processedAt: string;
427
+ errorMessage: string | null;
428
+ metadata: {
429
+ [x: string]: import("hono/utils/types").JSONValue;
430
+ } | null;
431
+ createdAt: string;
432
+ updatedAt: string;
433
+ }[];
434
+ total: number;
435
+ limit: number;
436
+ offset: number;
437
+ };
438
+ outputFormat: "json";
439
+ status: import("hono/utils/http-status").ContentfulStatusCode;
440
+ };
441
+ };
442
+ } & {
443
+ "/reminders/run-due": {
444
+ $post: {
445
+ input: {};
446
+ output: {
447
+ data: {
448
+ processed: number;
449
+ sent: number;
450
+ skipped: number;
451
+ failed: number;
452
+ };
453
+ };
454
+ outputFormat: "json";
455
+ status: import("hono/utils/http-status").ContentfulStatusCode;
456
+ } | {
457
+ input: {};
458
+ output: {
459
+ error: string;
460
+ };
461
+ outputFormat: "json";
462
+ status: 400;
463
+ };
464
+ };
465
+ } & {
466
+ "/payment-sessions/:id/send": {
467
+ $post: {
468
+ input: {
469
+ param: {
470
+ id: string;
471
+ };
472
+ };
473
+ output: {
474
+ error: string;
475
+ };
476
+ outputFormat: "json";
477
+ status: 404;
478
+ } | {
479
+ input: {
480
+ param: {
481
+ id: string;
482
+ };
483
+ };
484
+ output: {
485
+ data: {
486
+ id: string;
487
+ templateId: string | null;
488
+ templateSlug: string | null;
489
+ targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
490
+ targetId: string | null;
491
+ personId: string | null;
492
+ organizationId: string | null;
493
+ bookingId: string | null;
494
+ invoiceId: string | null;
495
+ paymentSessionId: string | null;
496
+ channel: "email" | "sms";
497
+ provider: string;
498
+ providerMessageId: string | null;
499
+ status: "cancelled" | "pending" | "failed" | "sent";
500
+ toAddress: string;
501
+ fromAddress: string | null;
502
+ subject: string | null;
503
+ htmlBody: string | null;
504
+ textBody: string | null;
505
+ payloadData: {
506
+ [x: string]: import("hono/utils/types").JSONValue;
507
+ } | null;
508
+ metadata: {
509
+ [x: string]: import("hono/utils/types").JSONValue;
510
+ } | null;
511
+ errorMessage: string | null;
512
+ scheduledFor: string | null;
513
+ sentAt: string | null;
514
+ failedAt: string | null;
515
+ createdAt: string;
516
+ updatedAt: string;
517
+ };
518
+ };
519
+ outputFormat: "json";
520
+ status: 201;
521
+ } | {
522
+ input: {
523
+ param: {
524
+ id: string;
525
+ };
526
+ };
527
+ output: {
528
+ error: string;
529
+ };
530
+ outputFormat: "json";
531
+ status: 400;
532
+ };
533
+ };
534
+ } & {
535
+ "/invoices/:id/send": {
536
+ $post: {
537
+ input: {
538
+ param: {
539
+ id: string;
540
+ };
541
+ };
542
+ output: {
543
+ error: string;
544
+ };
545
+ outputFormat: "json";
546
+ status: 404;
547
+ } | {
548
+ input: {
549
+ param: {
550
+ id: string;
551
+ };
552
+ };
553
+ output: {
554
+ data: {
555
+ id: string;
556
+ templateId: string | null;
557
+ templateSlug: string | null;
558
+ targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
559
+ targetId: string | null;
560
+ personId: string | null;
561
+ organizationId: string | null;
562
+ bookingId: string | null;
563
+ invoiceId: string | null;
564
+ paymentSessionId: string | null;
565
+ channel: "email" | "sms";
566
+ provider: string;
567
+ providerMessageId: string | null;
568
+ status: "cancelled" | "pending" | "failed" | "sent";
569
+ toAddress: string;
570
+ fromAddress: string | null;
571
+ subject: string | null;
572
+ htmlBody: string | null;
573
+ textBody: string | null;
574
+ payloadData: {
575
+ [x: string]: import("hono/utils/types").JSONValue;
576
+ } | null;
577
+ metadata: {
578
+ [x: string]: import("hono/utils/types").JSONValue;
579
+ } | null;
580
+ errorMessage: string | null;
581
+ scheduledFor: string | null;
582
+ sentAt: string | null;
583
+ failedAt: string | null;
584
+ createdAt: string;
585
+ updatedAt: string;
586
+ };
587
+ };
588
+ outputFormat: "json";
589
+ status: 201;
590
+ } | {
591
+ input: {
592
+ param: {
593
+ id: string;
594
+ };
595
+ };
596
+ output: {
597
+ error: string;
598
+ };
599
+ outputFormat: "json";
600
+ status: 400;
601
+ };
602
+ };
603
+ } & {
604
+ "/send": {
605
+ $post: {
606
+ input: {};
607
+ output: {
608
+ data: {
609
+ id: string;
610
+ templateId: string | null;
611
+ templateSlug: string | null;
612
+ targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
613
+ targetId: string | null;
614
+ personId: string | null;
615
+ organizationId: string | null;
616
+ bookingId: string | null;
617
+ invoiceId: string | null;
618
+ paymentSessionId: string | null;
619
+ channel: "email" | "sms";
620
+ provider: string;
621
+ providerMessageId: string | null;
622
+ status: "cancelled" | "pending" | "failed" | "sent";
623
+ toAddress: string;
624
+ fromAddress: string | null;
625
+ subject: string | null;
626
+ htmlBody: string | null;
627
+ textBody: string | null;
628
+ payloadData: {
629
+ [x: string]: import("hono/utils/types").JSONValue;
630
+ } | null;
631
+ metadata: {
632
+ [x: string]: import("hono/utils/types").JSONValue;
633
+ } | null;
634
+ errorMessage: string | null;
635
+ scheduledFor: string | null;
636
+ sentAt: string | null;
637
+ failedAt: string | null;
638
+ createdAt: string;
639
+ updatedAt: string;
640
+ } | null;
641
+ };
642
+ outputFormat: "json";
643
+ status: 201;
644
+ } | {
645
+ input: {};
646
+ output: {
647
+ error: string;
648
+ };
649
+ outputFormat: "json";
650
+ status: 400;
651
+ };
652
+ };
653
+ }, "/", "/send">;
654
+ export {};
655
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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