@closerepo/notification-contracts 1.3.1 → 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 +154 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare const notificationDeliveryContractVersionV1: 1;
|
|
|
4
4
|
declare const notificationDeliveryContractVersionV2: 2;
|
|
5
5
|
declare const notificationDeliveryContractVersionV3: 3;
|
|
6
6
|
declare const notificationDeliveryContractVersionV4: 4;
|
|
7
|
+
declare const notificationDeliveryContractVersionV5: 5;
|
|
7
8
|
declare const notificationDeliveryRequestMaximumUtf8BytesV1: number;
|
|
8
9
|
declare const notificationDeliveryMaximumDeadlineMillisecondsV1: number;
|
|
9
10
|
declare const notificationDeliveryRequestMaximumUtf8BytesV2: number;
|
|
@@ -12,6 +13,8 @@ declare const notificationDeliveryRequestMaximumUtf8BytesV3: number;
|
|
|
12
13
|
declare const notificationDeliveryMaximumDeadlineMillisecondsV3: number;
|
|
13
14
|
declare const notificationDeliveryRequestMaximumUtf8BytesV4: number;
|
|
14
15
|
declare const notificationDeliveryMaximumDeadlineMillisecondsV4: number;
|
|
16
|
+
declare const notificationDeliveryRequestMaximumUtf8BytesV5: number;
|
|
17
|
+
declare const notificationDeliveryMaximumDeadlineMillisecondsV5: number;
|
|
15
18
|
declare const notificationDeliveryStatesV1: readonly ["pending", "delivering", "partial", "delivered", "failed", "expired"];
|
|
16
19
|
declare const notificationDeliveryReasonsV1: readonly ["accepted", "enqueue_retry_wait", "in_progress", "partial_delivery", "complete", "retry_exhausted", "delivery_deadline_exceeded", "destination_configuration_unavailable"];
|
|
17
20
|
declare const notificationDestinationStatesV1: readonly ["pending", "delivering", "delivered", "failed", "expired"];
|
|
@@ -284,6 +287,82 @@ declare const notificationDeliveryRequestV4Schema: z.ZodObject<{
|
|
|
284
287
|
}, z.core.$strict>], "key">>;
|
|
285
288
|
}, z.core.$strict>;
|
|
286
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>;
|
|
287
366
|
declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
288
367
|
message: z.ZodObject<{
|
|
289
368
|
type: z.ZodLiteral<"link_summary">;
|
|
@@ -493,6 +572,78 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
493
572
|
}, z.core.$strict>;
|
|
494
573
|
}, z.core.$strict>], "key">>;
|
|
495
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>;
|
|
496
647
|
}, z.core.$strict>]>;
|
|
497
648
|
declare const notificationDeliveryReceiptV1Schema: z.ZodObject<{
|
|
498
649
|
contractVersion: z.ZodLiteral<1>;
|
|
@@ -743,11 +894,13 @@ type NotificationDeliveryRequestV1 = z.infer<typeof notificationDeliveryRequestV
|
|
|
743
894
|
type NotificationDeliveryRequestV2 = z.infer<typeof notificationDeliveryRequestV2Schema>;
|
|
744
895
|
type NotificationDeliveryRequestV3 = z.infer<typeof notificationDeliveryRequestV3Schema>;
|
|
745
896
|
type NotificationDeliveryRequestV4 = z.infer<typeof notificationDeliveryRequestV4Schema>;
|
|
897
|
+
type NotificationDeliveryRequestV5 = z.infer<typeof notificationDeliveryRequestV5Schema>;
|
|
746
898
|
type NotificationDeliveryRequest = z.infer<typeof notificationDeliveryRequestSchema>;
|
|
747
899
|
type NotificationMessageVariantKey = (typeof notificationMessageVariantKeys)[number];
|
|
748
900
|
type NotificationStructuredMessageSection = z.infer<typeof structuredMessageSectionSchema>;
|
|
749
901
|
type NotificationStructuredMessageVariant = z.infer<typeof structuredNotificationVariantSchema>;
|
|
750
902
|
type NotificationMessageBody = z.infer<typeof notificationMessageBodySchema>;
|
|
903
|
+
type NotificationSharedMessageBody = z.infer<typeof sharedNotificationBodySchema>;
|
|
751
904
|
type NotificationDeliveryReceiptV1 = z.infer<typeof notificationDeliveryReceiptV1Schema>;
|
|
752
905
|
type NotificationDeliveryRejectionV1 = z.infer<typeof notificationDeliveryRejectionV1Schema>;
|
|
753
906
|
type NotificationDeliverResultV1 = z.infer<typeof notificationDeliverResultV1Schema>;
|
|
@@ -763,4 +916,4 @@ interface NotificationDeliveryServiceV2 {
|
|
|
763
916
|
getReceipt: (eventId: string) => Promise<NotificationGetReceiptResultV1>;
|
|
764
917
|
}
|
|
765
918
|
//#endregion
|
|
766
|
-
export { NotificationDeliverResultV1, NotificationDeliveryReceiptV1, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryRequestV4, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationGetReceiptResultV1, NotificationMessageBody, NotificationMessageVariantKey, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, notificationDeliverResultV1Schema, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryContractVersionV4, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryMaximumDeadlineMillisecondsV4, notificationDeliveryReasonsV1, notificationDeliveryReceiptV1Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestMaximumUtf8BytesV4, notificationDeliveryRequestSchema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryRequestV4Schema, 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=4,a=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};
|