@closerepo/notification-contracts 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +300 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,18 @@ import { z } from "zod";
|
|
|
3
3
|
declare const notificationDeliveryContractVersionV1: 1;
|
|
4
4
|
declare const notificationDeliveryContractVersionV2: 2;
|
|
5
5
|
declare const notificationDeliveryContractVersionV3: 3;
|
|
6
|
+
declare const notificationDeliveryContractVersionV4: 4;
|
|
7
|
+
declare const notificationDeliveryContractVersionV5: 5;
|
|
6
8
|
declare const notificationDeliveryRequestMaximumUtf8BytesV1: number;
|
|
7
9
|
declare const notificationDeliveryMaximumDeadlineMillisecondsV1: number;
|
|
8
10
|
declare const notificationDeliveryRequestMaximumUtf8BytesV2: number;
|
|
9
11
|
declare const notificationDeliveryMaximumDeadlineMillisecondsV2: number;
|
|
10
12
|
declare const notificationDeliveryRequestMaximumUtf8BytesV3: number;
|
|
11
13
|
declare const notificationDeliveryMaximumDeadlineMillisecondsV3: number;
|
|
14
|
+
declare const notificationDeliveryRequestMaximumUtf8BytesV4: number;
|
|
15
|
+
declare const notificationDeliveryMaximumDeadlineMillisecondsV4: number;
|
|
16
|
+
declare const notificationDeliveryRequestMaximumUtf8BytesV5: number;
|
|
17
|
+
declare const notificationDeliveryMaximumDeadlineMillisecondsV5: number;
|
|
12
18
|
declare const notificationDeliveryStatesV1: readonly ["pending", "delivering", "partial", "delivered", "failed", "expired"];
|
|
13
19
|
declare const notificationDeliveryReasonsV1: readonly ["accepted", "enqueue_retry_wait", "in_progress", "partial_delivery", "complete", "retry_exhausted", "delivery_deadline_exceeded", "destination_configuration_unavailable"];
|
|
14
20
|
declare const notificationDestinationStatesV1: readonly ["pending", "delivering", "delivered", "failed", "expired"];
|
|
@@ -208,6 +214,155 @@ declare const notificationDeliveryRequestV3Schema: z.ZodObject<{
|
|
|
208
214
|
}, z.core.$strict>;
|
|
209
215
|
contractVersion: z.ZodLiteral<3>;
|
|
210
216
|
}, z.core.$strict>;
|
|
217
|
+
declare const notificationMessageBodySchema: z.ZodObject<{
|
|
218
|
+
label: z.ZodOptional<z.ZodString>;
|
|
219
|
+
value: z.ZodString;
|
|
220
|
+
}, z.core.$strict>;
|
|
221
|
+
declare const notificationDeliveryRequestV4Schema: z.ZodObject<{
|
|
222
|
+
eventType: z.ZodLiteral<"notification.delivery.requested">;
|
|
223
|
+
eventId: z.ZodString;
|
|
224
|
+
producer: z.ZodObject<{
|
|
225
|
+
key: z.ZodString;
|
|
226
|
+
environment: z.ZodString;
|
|
227
|
+
}, z.core.$strict>;
|
|
228
|
+
routeKey: z.ZodString;
|
|
229
|
+
occurredAt: z.ZodString;
|
|
230
|
+
requestedAt: z.ZodString;
|
|
231
|
+
deliverBy: z.ZodString;
|
|
232
|
+
subject: z.ZodObject<{
|
|
233
|
+
type: z.ZodString;
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
revision: z.ZodNumber;
|
|
236
|
+
}, z.core.$strict>;
|
|
237
|
+
contractVersion: z.ZodLiteral<4>;
|
|
238
|
+
message: z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"structured_notification">;
|
|
240
|
+
links: z.ZodArray<z.ZodObject<{
|
|
241
|
+
label: z.ZodString;
|
|
242
|
+
url: z.ZodString;
|
|
243
|
+
key: z.ZodString;
|
|
244
|
+
}, z.core.$strict>>;
|
|
245
|
+
variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
246
|
+
key: z.ZodLiteral<"source">;
|
|
247
|
+
locale: z.ZodLiteral<"und">;
|
|
248
|
+
title: z.ZodString;
|
|
249
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
250
|
+
key: z.ZodString;
|
|
251
|
+
type: z.ZodLiteral<"text">;
|
|
252
|
+
label: z.ZodOptional<z.ZodString>;
|
|
253
|
+
value: z.ZodString;
|
|
254
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
255
|
+
key: z.ZodString;
|
|
256
|
+
type: z.ZodLiteral<"fields">;
|
|
257
|
+
items: z.ZodArray<z.ZodObject<{
|
|
258
|
+
label: z.ZodString;
|
|
259
|
+
value: z.ZodString;
|
|
260
|
+
}, z.core.$strict>>;
|
|
261
|
+
}, z.core.$strict>], "type">>;
|
|
262
|
+
body: z.ZodObject<{
|
|
263
|
+
label: z.ZodOptional<z.ZodString>;
|
|
264
|
+
value: z.ZodString;
|
|
265
|
+
}, z.core.$strict>;
|
|
266
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
267
|
+
key: z.ZodLiteral<"zh-CN">;
|
|
268
|
+
locale: z.ZodLiteral<"zh-CN">;
|
|
269
|
+
title: z.ZodString;
|
|
270
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
271
|
+
key: z.ZodString;
|
|
272
|
+
type: z.ZodLiteral<"text">;
|
|
273
|
+
label: z.ZodOptional<z.ZodString>;
|
|
274
|
+
value: z.ZodString;
|
|
275
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
276
|
+
key: z.ZodString;
|
|
277
|
+
type: z.ZodLiteral<"fields">;
|
|
278
|
+
items: z.ZodArray<z.ZodObject<{
|
|
279
|
+
label: z.ZodString;
|
|
280
|
+
value: z.ZodString;
|
|
281
|
+
}, z.core.$strict>>;
|
|
282
|
+
}, z.core.$strict>], "type">>;
|
|
283
|
+
body: z.ZodObject<{
|
|
284
|
+
label: z.ZodOptional<z.ZodString>;
|
|
285
|
+
value: z.ZodString;
|
|
286
|
+
}, z.core.$strict>;
|
|
287
|
+
}, z.core.$strict>], "key">>;
|
|
288
|
+
}, z.core.$strict>;
|
|
289
|
+
}, z.core.$strict>;
|
|
290
|
+
declare const sharedNotificationBodySchema: z.ZodObject<{
|
|
291
|
+
value: z.ZodString;
|
|
292
|
+
}, z.core.$strict>;
|
|
293
|
+
declare const notificationDeliveryRequestV5Schema: z.ZodObject<{
|
|
294
|
+
message: z.ZodObject<{
|
|
295
|
+
type: z.ZodLiteral<"structured_notification">;
|
|
296
|
+
variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
297
|
+
key: z.ZodLiteral<"source">;
|
|
298
|
+
locale: z.ZodLiteral<"und">;
|
|
299
|
+
title: z.ZodString;
|
|
300
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
301
|
+
key: z.ZodString;
|
|
302
|
+
type: z.ZodLiteral<"text">;
|
|
303
|
+
label: z.ZodOptional<z.ZodString>;
|
|
304
|
+
value: z.ZodString;
|
|
305
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
306
|
+
key: z.ZodString;
|
|
307
|
+
type: z.ZodLiteral<"fields">;
|
|
308
|
+
items: z.ZodArray<z.ZodObject<{
|
|
309
|
+
label: z.ZodString;
|
|
310
|
+
value: z.ZodString;
|
|
311
|
+
}, z.core.$strict>>;
|
|
312
|
+
}, z.core.$strict>], "type">>;
|
|
313
|
+
bodyLabel: z.ZodOptional<z.ZodString>;
|
|
314
|
+
linkLabels: z.ZodArray<z.ZodObject<{
|
|
315
|
+
key: z.ZodString;
|
|
316
|
+
label: z.ZodString;
|
|
317
|
+
}, z.core.$strict>>;
|
|
318
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
319
|
+
key: z.ZodLiteral<"zh-CN">;
|
|
320
|
+
locale: z.ZodLiteral<"zh-CN">;
|
|
321
|
+
title: z.ZodString;
|
|
322
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
323
|
+
key: z.ZodString;
|
|
324
|
+
type: z.ZodLiteral<"text">;
|
|
325
|
+
label: z.ZodOptional<z.ZodString>;
|
|
326
|
+
value: z.ZodString;
|
|
327
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
328
|
+
key: z.ZodString;
|
|
329
|
+
type: z.ZodLiteral<"fields">;
|
|
330
|
+
items: z.ZodArray<z.ZodObject<{
|
|
331
|
+
label: z.ZodString;
|
|
332
|
+
value: z.ZodString;
|
|
333
|
+
}, z.core.$strict>>;
|
|
334
|
+
}, z.core.$strict>], "type">>;
|
|
335
|
+
bodyLabel: z.ZodOptional<z.ZodString>;
|
|
336
|
+
linkLabels: z.ZodArray<z.ZodObject<{
|
|
337
|
+
key: z.ZodString;
|
|
338
|
+
label: z.ZodString;
|
|
339
|
+
}, z.core.$strict>>;
|
|
340
|
+
}, z.core.$strict>], "key">>;
|
|
341
|
+
links: z.ZodArray<z.ZodObject<{
|
|
342
|
+
key: z.ZodString;
|
|
343
|
+
url: z.ZodString;
|
|
344
|
+
}, z.core.$strict>>;
|
|
345
|
+
body: z.ZodObject<{
|
|
346
|
+
value: z.ZodString;
|
|
347
|
+
}, z.core.$strict>;
|
|
348
|
+
}, z.core.$strict>;
|
|
349
|
+
eventType: z.ZodLiteral<"notification.delivery.requested">;
|
|
350
|
+
eventId: z.ZodString;
|
|
351
|
+
producer: z.ZodObject<{
|
|
352
|
+
key: z.ZodString;
|
|
353
|
+
environment: z.ZodString;
|
|
354
|
+
}, z.core.$strict>;
|
|
355
|
+
routeKey: z.ZodString;
|
|
356
|
+
occurredAt: z.ZodString;
|
|
357
|
+
requestedAt: z.ZodString;
|
|
358
|
+
deliverBy: z.ZodString;
|
|
359
|
+
subject: z.ZodObject<{
|
|
360
|
+
type: z.ZodString;
|
|
361
|
+
id: z.ZodString;
|
|
362
|
+
revision: z.ZodNumber;
|
|
363
|
+
}, z.core.$strict>;
|
|
364
|
+
contractVersion: z.ZodLiteral<5>;
|
|
365
|
+
}, z.core.$strict>;
|
|
211
366
|
declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
212
367
|
message: z.ZodObject<{
|
|
213
368
|
type: z.ZodLiteral<"link_summary">;
|
|
@@ -349,6 +504,146 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
349
504
|
revision: z.ZodNumber;
|
|
350
505
|
}, z.core.$strict>;
|
|
351
506
|
contractVersion: z.ZodLiteral<3>;
|
|
507
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
508
|
+
eventType: z.ZodLiteral<"notification.delivery.requested">;
|
|
509
|
+
eventId: z.ZodString;
|
|
510
|
+
producer: z.ZodObject<{
|
|
511
|
+
key: z.ZodString;
|
|
512
|
+
environment: z.ZodString;
|
|
513
|
+
}, z.core.$strict>;
|
|
514
|
+
routeKey: z.ZodString;
|
|
515
|
+
occurredAt: z.ZodString;
|
|
516
|
+
requestedAt: z.ZodString;
|
|
517
|
+
deliverBy: z.ZodString;
|
|
518
|
+
subject: z.ZodObject<{
|
|
519
|
+
type: z.ZodString;
|
|
520
|
+
id: z.ZodString;
|
|
521
|
+
revision: z.ZodNumber;
|
|
522
|
+
}, z.core.$strict>;
|
|
523
|
+
contractVersion: z.ZodLiteral<4>;
|
|
524
|
+
message: z.ZodObject<{
|
|
525
|
+
type: z.ZodLiteral<"structured_notification">;
|
|
526
|
+
links: z.ZodArray<z.ZodObject<{
|
|
527
|
+
label: z.ZodString;
|
|
528
|
+
url: z.ZodString;
|
|
529
|
+
key: z.ZodString;
|
|
530
|
+
}, z.core.$strict>>;
|
|
531
|
+
variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
532
|
+
key: z.ZodLiteral<"source">;
|
|
533
|
+
locale: z.ZodLiteral<"und">;
|
|
534
|
+
title: z.ZodString;
|
|
535
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
536
|
+
key: z.ZodString;
|
|
537
|
+
type: z.ZodLiteral<"text">;
|
|
538
|
+
label: z.ZodOptional<z.ZodString>;
|
|
539
|
+
value: z.ZodString;
|
|
540
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
541
|
+
key: z.ZodString;
|
|
542
|
+
type: z.ZodLiteral<"fields">;
|
|
543
|
+
items: z.ZodArray<z.ZodObject<{
|
|
544
|
+
label: z.ZodString;
|
|
545
|
+
value: z.ZodString;
|
|
546
|
+
}, z.core.$strict>>;
|
|
547
|
+
}, z.core.$strict>], "type">>;
|
|
548
|
+
body: z.ZodObject<{
|
|
549
|
+
label: z.ZodOptional<z.ZodString>;
|
|
550
|
+
value: z.ZodString;
|
|
551
|
+
}, z.core.$strict>;
|
|
552
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
553
|
+
key: z.ZodLiteral<"zh-CN">;
|
|
554
|
+
locale: z.ZodLiteral<"zh-CN">;
|
|
555
|
+
title: z.ZodString;
|
|
556
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
557
|
+
key: z.ZodString;
|
|
558
|
+
type: z.ZodLiteral<"text">;
|
|
559
|
+
label: z.ZodOptional<z.ZodString>;
|
|
560
|
+
value: z.ZodString;
|
|
561
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
562
|
+
key: z.ZodString;
|
|
563
|
+
type: z.ZodLiteral<"fields">;
|
|
564
|
+
items: z.ZodArray<z.ZodObject<{
|
|
565
|
+
label: z.ZodString;
|
|
566
|
+
value: z.ZodString;
|
|
567
|
+
}, z.core.$strict>>;
|
|
568
|
+
}, z.core.$strict>], "type">>;
|
|
569
|
+
body: z.ZodObject<{
|
|
570
|
+
label: z.ZodOptional<z.ZodString>;
|
|
571
|
+
value: z.ZodString;
|
|
572
|
+
}, z.core.$strict>;
|
|
573
|
+
}, z.core.$strict>], "key">>;
|
|
574
|
+
}, z.core.$strict>;
|
|
575
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
576
|
+
message: z.ZodObject<{
|
|
577
|
+
type: z.ZodLiteral<"structured_notification">;
|
|
578
|
+
variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
579
|
+
key: z.ZodLiteral<"source">;
|
|
580
|
+
locale: z.ZodLiteral<"und">;
|
|
581
|
+
title: z.ZodString;
|
|
582
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
583
|
+
key: z.ZodString;
|
|
584
|
+
type: z.ZodLiteral<"text">;
|
|
585
|
+
label: z.ZodOptional<z.ZodString>;
|
|
586
|
+
value: z.ZodString;
|
|
587
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
588
|
+
key: z.ZodString;
|
|
589
|
+
type: z.ZodLiteral<"fields">;
|
|
590
|
+
items: z.ZodArray<z.ZodObject<{
|
|
591
|
+
label: z.ZodString;
|
|
592
|
+
value: z.ZodString;
|
|
593
|
+
}, z.core.$strict>>;
|
|
594
|
+
}, z.core.$strict>], "type">>;
|
|
595
|
+
bodyLabel: z.ZodOptional<z.ZodString>;
|
|
596
|
+
linkLabels: z.ZodArray<z.ZodObject<{
|
|
597
|
+
key: z.ZodString;
|
|
598
|
+
label: z.ZodString;
|
|
599
|
+
}, z.core.$strict>>;
|
|
600
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
601
|
+
key: z.ZodLiteral<"zh-CN">;
|
|
602
|
+
locale: z.ZodLiteral<"zh-CN">;
|
|
603
|
+
title: z.ZodString;
|
|
604
|
+
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
605
|
+
key: z.ZodString;
|
|
606
|
+
type: z.ZodLiteral<"text">;
|
|
607
|
+
label: z.ZodOptional<z.ZodString>;
|
|
608
|
+
value: z.ZodString;
|
|
609
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
610
|
+
key: z.ZodString;
|
|
611
|
+
type: z.ZodLiteral<"fields">;
|
|
612
|
+
items: z.ZodArray<z.ZodObject<{
|
|
613
|
+
label: z.ZodString;
|
|
614
|
+
value: z.ZodString;
|
|
615
|
+
}, z.core.$strict>>;
|
|
616
|
+
}, z.core.$strict>], "type">>;
|
|
617
|
+
bodyLabel: z.ZodOptional<z.ZodString>;
|
|
618
|
+
linkLabels: z.ZodArray<z.ZodObject<{
|
|
619
|
+
key: z.ZodString;
|
|
620
|
+
label: z.ZodString;
|
|
621
|
+
}, z.core.$strict>>;
|
|
622
|
+
}, z.core.$strict>], "key">>;
|
|
623
|
+
links: z.ZodArray<z.ZodObject<{
|
|
624
|
+
key: z.ZodString;
|
|
625
|
+
url: z.ZodString;
|
|
626
|
+
}, z.core.$strict>>;
|
|
627
|
+
body: z.ZodObject<{
|
|
628
|
+
value: z.ZodString;
|
|
629
|
+
}, z.core.$strict>;
|
|
630
|
+
}, z.core.$strict>;
|
|
631
|
+
eventType: z.ZodLiteral<"notification.delivery.requested">;
|
|
632
|
+
eventId: z.ZodString;
|
|
633
|
+
producer: z.ZodObject<{
|
|
634
|
+
key: z.ZodString;
|
|
635
|
+
environment: z.ZodString;
|
|
636
|
+
}, z.core.$strict>;
|
|
637
|
+
routeKey: z.ZodString;
|
|
638
|
+
occurredAt: z.ZodString;
|
|
639
|
+
requestedAt: z.ZodString;
|
|
640
|
+
deliverBy: z.ZodString;
|
|
641
|
+
subject: z.ZodObject<{
|
|
642
|
+
type: z.ZodString;
|
|
643
|
+
id: z.ZodString;
|
|
644
|
+
revision: z.ZodNumber;
|
|
645
|
+
}, z.core.$strict>;
|
|
646
|
+
contractVersion: z.ZodLiteral<5>;
|
|
352
647
|
}, z.core.$strict>]>;
|
|
353
648
|
declare const notificationDeliveryReceiptV1Schema: z.ZodObject<{
|
|
354
649
|
contractVersion: z.ZodLiteral<1>;
|
|
@@ -598,10 +893,14 @@ declare const notificationGetReceiptResultV1Schema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
598
893
|
type NotificationDeliveryRequestV1 = z.infer<typeof notificationDeliveryRequestV1Schema>;
|
|
599
894
|
type NotificationDeliveryRequestV2 = z.infer<typeof notificationDeliveryRequestV2Schema>;
|
|
600
895
|
type NotificationDeliveryRequestV3 = z.infer<typeof notificationDeliveryRequestV3Schema>;
|
|
896
|
+
type NotificationDeliveryRequestV4 = z.infer<typeof notificationDeliveryRequestV4Schema>;
|
|
897
|
+
type NotificationDeliveryRequestV5 = z.infer<typeof notificationDeliveryRequestV5Schema>;
|
|
601
898
|
type NotificationDeliveryRequest = z.infer<typeof notificationDeliveryRequestSchema>;
|
|
602
899
|
type NotificationMessageVariantKey = (typeof notificationMessageVariantKeys)[number];
|
|
603
900
|
type NotificationStructuredMessageSection = z.infer<typeof structuredMessageSectionSchema>;
|
|
604
901
|
type NotificationStructuredMessageVariant = z.infer<typeof structuredNotificationVariantSchema>;
|
|
902
|
+
type NotificationMessageBody = z.infer<typeof notificationMessageBodySchema>;
|
|
903
|
+
type NotificationSharedMessageBody = z.infer<typeof sharedNotificationBodySchema>;
|
|
605
904
|
type NotificationDeliveryReceiptV1 = z.infer<typeof notificationDeliveryReceiptV1Schema>;
|
|
606
905
|
type NotificationDeliveryRejectionV1 = z.infer<typeof notificationDeliveryRejectionV1Schema>;
|
|
607
906
|
type NotificationDeliverResultV1 = z.infer<typeof notificationDeliverResultV1Schema>;
|
|
@@ -617,4 +916,4 @@ interface NotificationDeliveryServiceV2 {
|
|
|
617
916
|
getReceipt: (eventId: string) => Promise<NotificationGetReceiptResultV1>;
|
|
618
917
|
}
|
|
619
918
|
//#endregion
|
|
620
|
-
export { NotificationDeliverResultV1, NotificationDeliveryReceiptV1, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationGetReceiptResultV1, NotificationMessageVariantKey, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, notificationDeliverResultV1Schema, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryReasonsV1, notificationDeliveryReceiptV1Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestSchema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryStatesV1, notificationDestinationFailureCodesV1, notificationDestinationStatesV1, notificationGetReceiptResultV1Schema, notificationMessageVariantKeys, notificationValidationIssueCodesV1 };
|
|
919
|
+
export { NotificationDeliverResultV1, NotificationDeliveryReceiptV1, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryRequestV4, NotificationDeliveryRequestV5, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationGetReceiptResultV1, NotificationMessageBody, NotificationMessageVariantKey, NotificationSharedMessageBody, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, notificationDeliverResultV1Schema, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryContractVersionV4, notificationDeliveryContractVersionV5, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryMaximumDeadlineMillisecondsV4, notificationDeliveryMaximumDeadlineMillisecondsV5, notificationDeliveryReasonsV1, notificationDeliveryReceiptV1Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestMaximumUtf8BytesV4, notificationDeliveryRequestMaximumUtf8BytesV5, notificationDeliveryRequestSchema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryRequestV4Schema, notificationDeliveryRequestV5Schema, notificationDeliveryStatesV1, notificationDestinationFailureCodesV1, notificationDestinationStatesV1, notificationGetReceiptResultV1Schema, notificationMessageVariantKeys, notificationValidationIssueCodesV1 };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=1,n=2,r=3,i=32*1024,
|
|
1
|
+
import{z as e}from"zod";const t=1,n=2,r=3,i=4,a=5,o=32*1024,s=1380*60*1e3,c=o,l=s,u=o,d=s,f=o,p=s,m=o,h=s,g=[`pending`,`delivering`,`partial`,`delivered`,`failed`,`expired`],_=[`accepted`,`enqueue_retry_wait`,`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`delivery_deadline_exceeded`,`destination_configuration_unavailable`],v=[`pending`,`delivering`,`delivered`,`failed`,`expired`],y=[`provider_timeout`,`provider_rate_limited`,`provider_unavailable`,`provider_rejected`,`destination_configuration_unavailable`,`delivery_interrupted`,`retry_exhausted`],b=[`invalid_request`,`request_too_large`,`producer_scope_mismatch`,`route_not_allowed`,`event_identity_conflict`,`route_not_found`,`route_empty`,`delivery_deadline_invalid`],x=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],S=[`source`,`zh-CN`],ee=new TextEncoder,C=/^[a-z][a-z0-9-]{0,62}$/,te=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,ne=/^[A-Z0-9][\w.:-]{0,127}$/i;function w(e){return[...e].length}function T(t){return e.string().refine(e=>w(e)>0,{message:`too_small`}).refine(e=>w(e)<=t,{message:`too_big`})}const E=e.string().datetime({offset:!0}),D=e.object({key:e.string().regex(C),environment:e.string().regex(C)}).strict(),O=e.object({type:e.string().regex(C),id:e.string().regex(ne),revision:e.number().int().positive()}).strict(),k=e.string().min(1).max(127).regex(te),A=e.object({label:T(48),url:T(2048).refine(e=>[...e].every(e=>{let t=e.codePointAt(0);return t!==void 0&&t>31&&t!==127}),{message:`invalid_https_url`}).refine(e=>{try{return new URL(e).protocol===`https:`}catch{return!1}},{message:`invalid_https_url`})}).strict(),j={eventType:e.literal(`notification.delivery.requested`),eventId:e.string().uuid(),producer:D,routeKey:k,occurredAt:E,requestedAt:E,deliverBy:E,subject:O},M=e.object({contractVersion:e.literal(1),...j,message:e.object({type:e.literal(`link_summary`),title:T(160),summary:T(1200),facts:e.array(e.object({label:T(48),value:T(500)}).strict()).max(10),primaryLink:A,sourceLink:A.optional()}).strict()}).strict();function N(e,t,n,r){let i=Date.parse(e.requestedAt),a=Date.parse(e.deliverBy);(!Number.isFinite(i)||!Number.isFinite(a)||a<=i||a-i>n)&&t.addIssue({code:`custom`,message:`delivery_deadline_invalid`,path:[`deliverBy`]}),ee.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const P=M.superRefine((e,t)=>N(e,t,s,o)),F={title:T(160),summary:T(1200),facts:e.array(e.object({label:T(48),value:T(500)}).strict()).max(10)},I=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),...F}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),...F}).strict()]),L=e.array(I).min(1).max(2).superRefine((e,t)=>{e.filter(e=>e.key===`source`).length!==1&&t.addIssue({code:`custom`,message:`source_variant_required_once`}),new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_variant_duplicate`})}),R=e.object({contractVersion:e.literal(2),...j,message:e.object({type:e.literal(`localized_link_summary`),variants:L,primaryLink:A,sourceLink:A.optional()}).strict()}).strict().superRefine((e,t)=>N(e,t,l,c)),z=e.discriminatedUnion(`type`,[e.object({key:e.string().regex(C),type:e.literal(`text`),label:T(48).optional(),value:T(4e3)}).strict(),e.object({key:e.string().regex(C),type:e.literal(`fields`),items:e.array(e.object({label:T(48),value:T(1200)}).strict()).min(1).max(20)}).strict()]),B=e.array(z).min(1).max(30).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_section_duplicate`})}),V=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),title:T(160),sections:B}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),title:T(160),sections:B}).strict()]),H=(e,t)=>{e.filter(e=>e.key===`source`).length!==1&&t.addIssue({code:`custom`,message:`source_variant_required_once`}),new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_variant_duplicate`});let n=e.find(e=>e.key===`source`),r=e.find(e=>e.key===`zh-CN`);if(n&&r){let i=n.sections.map(e=>`${e.key}:${e.type}`),a=r.sections.map(e=>`${e.key}:${e.type}`);JSON.stringify(i)!==JSON.stringify(a)&&t.addIssue({code:`custom`,message:`message_variant_structure_mismatch`,path:[e.indexOf(r),`sections`]})}},U=e.array(V).min(1).max(2).superRefine(H),W=e.object({contractVersion:e.literal(3),...j,message:e.object({type:e.literal(`structured_notification`),variants:U,links:e.array(e.object({key:e.string().regex(C),...A.shape}).strict()).max(10).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_link_duplicate`})})}).strict()}).strict(),G=W.superRefine((e,t)=>N(e,t,d,u)),K=e.object({label:T(48).optional(),value:T(f)}).strict(),q=e.discriminatedUnion(`key`,[V.options[0].extend({body:K}),V.options[1].extend({body:K})]),J=W.extend({contractVersion:e.literal(4),message:W.shape.message.extend({variants:e.array(q).min(1).max(2).superRefine(H)})}).superRefine((e,t)=>N(e,t,p,f)),Y=e.discriminatedUnion(`key`,[V.options[0].extend({bodyLabel:T(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(C),label:T(48)}).strict()).max(10).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_link_label_duplicate`})})}),V.options[1].extend({bodyLabel:T(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(C),label:T(48)}).strict()).max(10).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_link_label_duplicate`})})})]),X=e.object({value:T(m)}).strict(),Z=e.object({contractVersion:e.literal(5),...j,message:e.object({type:e.literal(`structured_notification`),variants:e.array(Y).min(1).max(2).superRefine(H),links:e.array(e.object({key:e.string().regex(C),url:A.shape.url}).strict()).max(10).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_link_duplicate`})}),body:X}).strict()}).strict().superRefine((e,t)=>{N(e,t,h,m);let n=e.message.links.map(e=>e.key);for(let[r,i]of e.message.variants.entries()){let e=i.linkLabels.map(e=>e.key);JSON.stringify(e)!==JSON.stringify(n)&&t.addIssue({code:`custom`,message:`message_variant_link_labels_mismatch`,path:[`message`,`variants`,r,`linkLabels`]})}}),re=e.union([P,R,G,J,Z]),ie=e.object({destinationKey:e.string().min(1),state:e.enum(v),attempts:e.number().int().min(0).max(4),failureCode:e.enum(y).nullable(),lastAttemptAt:E.nullable(),nextAttemptAt:E.nullable(),leaseExpiresAt:E.nullable()}).strict(),Q=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:D,routeKey:k,subject:O,state:e.enum(g),reason:e.enum(_),terminal:e.boolean(),acceptedAt:E,updatedAt:E,deliverBy:E,terminalAt:E.nullable(),destinations:e.array(ie).min(1).max(20)}).strict(),ae=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(x)}).strict(),oe=e.object({code:e.literal(`invalid_request`),issues:e.array(ae).max(20).optional()}).strict(),se=e.object({code:e.enum(b.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([oe,se]),ce=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Q}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),le=e.discriminatedUnion(`status`,[e.object({status:e.literal(`found`),receipt:Q}).strict(),e.object({status:e.literal(`not_found`)}).strict(),e.object({status:e.literal(`unavailable`),error:e.object({code:e.literal(`receipt_unavailable`)}).strict()}).strict()]);export{ce as notificationDeliverResultV1Schema,t as notificationDeliveryContractVersionV1,n as notificationDeliveryContractVersionV2,r as notificationDeliveryContractVersionV3,i as notificationDeliveryContractVersionV4,a as notificationDeliveryContractVersionV5,s as notificationDeliveryMaximumDeadlineMillisecondsV1,l as notificationDeliveryMaximumDeadlineMillisecondsV2,d as notificationDeliveryMaximumDeadlineMillisecondsV3,p as notificationDeliveryMaximumDeadlineMillisecondsV4,h as notificationDeliveryMaximumDeadlineMillisecondsV5,_ as notificationDeliveryReasonsV1,Q as notificationDeliveryReceiptV1Schema,b as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,o as notificationDeliveryRequestMaximumUtf8BytesV1,c as notificationDeliveryRequestMaximumUtf8BytesV2,u as notificationDeliveryRequestMaximumUtf8BytesV3,f as notificationDeliveryRequestMaximumUtf8BytesV4,m as notificationDeliveryRequestMaximumUtf8BytesV5,re as notificationDeliveryRequestSchema,P as notificationDeliveryRequestV1Schema,R as notificationDeliveryRequestV2Schema,G as notificationDeliveryRequestV3Schema,J as notificationDeliveryRequestV4Schema,Z as notificationDeliveryRequestV5Schema,g as notificationDeliveryStatesV1,y as notificationDestinationFailureCodesV1,v as notificationDestinationStatesV1,le as notificationGetReceiptResultV1Schema,S as notificationMessageVariantKeys,x as notificationValidationIssueCodesV1};
|