@closerepo/notification-contracts 1.12.0 → 1.13.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 +24 -24
- package/dist/index.js +1 -1
- package/dist/render.d.ts +1315 -0
- package/dist/render.js +23 -0
- package/package.json +8 -2
package/dist/index.d.ts
CHANGED
|
@@ -424,7 +424,7 @@ declare const notificationDeliveryRequestV6Schema: z.ZodObject<{
|
|
|
424
424
|
}, z.core.$strict>], "type">>;
|
|
425
425
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
426
426
|
key: z.ZodString;
|
|
427
|
-
label: z.ZodString
|
|
427
|
+
label: z.ZodOptional<z.ZodString>;
|
|
428
428
|
}, z.core.$strict>>;
|
|
429
429
|
footer: z.ZodOptional<z.ZodString>;
|
|
430
430
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -450,7 +450,7 @@ declare const notificationDeliveryRequestV6Schema: z.ZodObject<{
|
|
|
450
450
|
}, z.core.$strict>], "type">>;
|
|
451
451
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
452
452
|
key: z.ZodString;
|
|
453
|
-
label: z.ZodString
|
|
453
|
+
label: z.ZodOptional<z.ZodString>;
|
|
454
454
|
}, z.core.$strict>>;
|
|
455
455
|
footer: z.ZodOptional<z.ZodString>;
|
|
456
456
|
}, z.core.$strict>], "key">>;
|
|
@@ -508,7 +508,7 @@ declare const notificationDeliveryRequestV7Schema: z.ZodObject<{
|
|
|
508
508
|
}, z.core.$strict>], "type">>;
|
|
509
509
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
510
510
|
key: z.ZodString;
|
|
511
|
-
label: z.ZodString
|
|
511
|
+
label: z.ZodOptional<z.ZodString>;
|
|
512
512
|
}, z.core.$strict>>;
|
|
513
513
|
footer: z.ZodOptional<z.ZodString>;
|
|
514
514
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -534,7 +534,7 @@ declare const notificationDeliveryRequestV7Schema: z.ZodObject<{
|
|
|
534
534
|
}, z.core.$strict>], "type">>;
|
|
535
535
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
536
536
|
key: z.ZodString;
|
|
537
|
-
label: z.ZodString
|
|
537
|
+
label: z.ZodOptional<z.ZodString>;
|
|
538
538
|
}, z.core.$strict>>;
|
|
539
539
|
footer: z.ZodOptional<z.ZodString>;
|
|
540
540
|
}, z.core.$strict>], "key">>;
|
|
@@ -591,7 +591,7 @@ declare const notificationDeliveryRequestV8Schema: z.ZodObject<{
|
|
|
591
591
|
}, z.core.$strict>], "type">>;
|
|
592
592
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
593
593
|
key: z.ZodString;
|
|
594
|
-
label: z.ZodString
|
|
594
|
+
label: z.ZodOptional<z.ZodString>;
|
|
595
595
|
}, z.core.$strict>>;
|
|
596
596
|
footer: z.ZodOptional<z.ZodString>;
|
|
597
597
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -617,7 +617,7 @@ declare const notificationDeliveryRequestV8Schema: z.ZodObject<{
|
|
|
617
617
|
}, z.core.$strict>], "type">>;
|
|
618
618
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
619
619
|
key: z.ZodString;
|
|
620
|
-
label: z.ZodString
|
|
620
|
+
label: z.ZodOptional<z.ZodString>;
|
|
621
621
|
}, z.core.$strict>>;
|
|
622
622
|
footer: z.ZodOptional<z.ZodString>;
|
|
623
623
|
}, z.core.$strict>], "key">>;
|
|
@@ -649,7 +649,7 @@ declare const notificationDeliveryRequestV8Schema: z.ZodObject<{
|
|
|
649
649
|
}, z.core.$strict>], "type">>;
|
|
650
650
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
651
651
|
key: z.ZodString;
|
|
652
|
-
label: z.ZodString
|
|
652
|
+
label: z.ZodOptional<z.ZodString>;
|
|
653
653
|
}, z.core.$strict>>;
|
|
654
654
|
footer: z.ZodOptional<z.ZodString>;
|
|
655
655
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -675,7 +675,7 @@ declare const notificationDeliveryRequestV8Schema: z.ZodObject<{
|
|
|
675
675
|
}, z.core.$strict>], "type">>;
|
|
676
676
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
677
677
|
key: z.ZodString;
|
|
678
|
-
label: z.ZodString
|
|
678
|
+
label: z.ZodOptional<z.ZodString>;
|
|
679
679
|
}, z.core.$strict>>;
|
|
680
680
|
footer: z.ZodOptional<z.ZodString>;
|
|
681
681
|
}, z.core.$strict>], "key">>>>;
|
|
@@ -751,7 +751,7 @@ declare const notificationDeliveryRequestV9Schema: z.ZodObject<{
|
|
|
751
751
|
}, z.core.$strict>], "type">>;
|
|
752
752
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
753
753
|
key: z.ZodString;
|
|
754
|
-
label: z.ZodString
|
|
754
|
+
label: z.ZodOptional<z.ZodString>;
|
|
755
755
|
}, z.core.$strict>>;
|
|
756
756
|
footer: z.ZodOptional<z.ZodString>;
|
|
757
757
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -777,7 +777,7 @@ declare const notificationDeliveryRequestV9Schema: z.ZodObject<{
|
|
|
777
777
|
}, z.core.$strict>], "type">>;
|
|
778
778
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
779
779
|
key: z.ZodString;
|
|
780
|
-
label: z.ZodString
|
|
780
|
+
label: z.ZodOptional<z.ZodString>;
|
|
781
781
|
}, z.core.$strict>>;
|
|
782
782
|
footer: z.ZodOptional<z.ZodString>;
|
|
783
783
|
}, z.core.$strict>], "key">>;
|
|
@@ -809,7 +809,7 @@ declare const notificationDeliveryRequestV9Schema: z.ZodObject<{
|
|
|
809
809
|
}, z.core.$strict>], "type">>;
|
|
810
810
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
811
811
|
key: z.ZodString;
|
|
812
|
-
label: z.ZodString
|
|
812
|
+
label: z.ZodOptional<z.ZodString>;
|
|
813
813
|
}, z.core.$strict>>;
|
|
814
814
|
footer: z.ZodOptional<z.ZodString>;
|
|
815
815
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -835,7 +835,7 @@ declare const notificationDeliveryRequestV9Schema: z.ZodObject<{
|
|
|
835
835
|
}, z.core.$strict>], "type">>;
|
|
836
836
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
837
837
|
key: z.ZodString;
|
|
838
|
-
label: z.ZodString
|
|
838
|
+
label: z.ZodOptional<z.ZodString>;
|
|
839
839
|
}, z.core.$strict>>;
|
|
840
840
|
footer: z.ZodOptional<z.ZodString>;
|
|
841
841
|
}, z.core.$strict>], "key">>>>;
|
|
@@ -1239,7 +1239,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1239
1239
|
}, z.core.$strict>], "type">>;
|
|
1240
1240
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1241
1241
|
key: z.ZodString;
|
|
1242
|
-
label: z.ZodString
|
|
1242
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1243
1243
|
}, z.core.$strict>>;
|
|
1244
1244
|
footer: z.ZodOptional<z.ZodString>;
|
|
1245
1245
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1265,7 +1265,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1265
1265
|
}, z.core.$strict>], "type">>;
|
|
1266
1266
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1267
1267
|
key: z.ZodString;
|
|
1268
|
-
label: z.ZodString
|
|
1268
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1269
1269
|
}, z.core.$strict>>;
|
|
1270
1270
|
footer: z.ZodOptional<z.ZodString>;
|
|
1271
1271
|
}, z.core.$strict>], "key">>;
|
|
@@ -1321,7 +1321,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1321
1321
|
}, z.core.$strict>], "type">>;
|
|
1322
1322
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1323
1323
|
key: z.ZodString;
|
|
1324
|
-
label: z.ZodString
|
|
1324
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1325
1325
|
}, z.core.$strict>>;
|
|
1326
1326
|
footer: z.ZodOptional<z.ZodString>;
|
|
1327
1327
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1347,7 +1347,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1347
1347
|
}, z.core.$strict>], "type">>;
|
|
1348
1348
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1349
1349
|
key: z.ZodString;
|
|
1350
|
-
label: z.ZodString
|
|
1350
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1351
1351
|
}, z.core.$strict>>;
|
|
1352
1352
|
footer: z.ZodOptional<z.ZodString>;
|
|
1353
1353
|
}, z.core.$strict>], "key">>;
|
|
@@ -1401,7 +1401,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1401
1401
|
}, z.core.$strict>], "type">>;
|
|
1402
1402
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1403
1403
|
key: z.ZodString;
|
|
1404
|
-
label: z.ZodString
|
|
1404
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1405
1405
|
}, z.core.$strict>>;
|
|
1406
1406
|
footer: z.ZodOptional<z.ZodString>;
|
|
1407
1407
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1427,7 +1427,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1427
1427
|
}, z.core.$strict>], "type">>;
|
|
1428
1428
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1429
1429
|
key: z.ZodString;
|
|
1430
|
-
label: z.ZodString
|
|
1430
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1431
1431
|
}, z.core.$strict>>;
|
|
1432
1432
|
footer: z.ZodOptional<z.ZodString>;
|
|
1433
1433
|
}, z.core.$strict>], "key">>;
|
|
@@ -1459,7 +1459,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1459
1459
|
}, z.core.$strict>], "type">>;
|
|
1460
1460
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1461
1461
|
key: z.ZodString;
|
|
1462
|
-
label: z.ZodString
|
|
1462
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1463
1463
|
}, z.core.$strict>>;
|
|
1464
1464
|
footer: z.ZodOptional<z.ZodString>;
|
|
1465
1465
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1485,7 +1485,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1485
1485
|
}, z.core.$strict>], "type">>;
|
|
1486
1486
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1487
1487
|
key: z.ZodString;
|
|
1488
|
-
label: z.ZodString
|
|
1488
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1489
1489
|
}, z.core.$strict>>;
|
|
1490
1490
|
footer: z.ZodOptional<z.ZodString>;
|
|
1491
1491
|
}, z.core.$strict>], "key">>>>;
|
|
@@ -1550,7 +1550,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1550
1550
|
}, z.core.$strict>], "type">>;
|
|
1551
1551
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1552
1552
|
key: z.ZodString;
|
|
1553
|
-
label: z.ZodString
|
|
1553
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1554
1554
|
}, z.core.$strict>>;
|
|
1555
1555
|
footer: z.ZodOptional<z.ZodString>;
|
|
1556
1556
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1576,7 +1576,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1576
1576
|
}, z.core.$strict>], "type">>;
|
|
1577
1577
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1578
1578
|
key: z.ZodString;
|
|
1579
|
-
label: z.ZodString
|
|
1579
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1580
1580
|
}, z.core.$strict>>;
|
|
1581
1581
|
footer: z.ZodOptional<z.ZodString>;
|
|
1582
1582
|
}, z.core.$strict>], "key">>;
|
|
@@ -1608,7 +1608,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1608
1608
|
}, z.core.$strict>], "type">>;
|
|
1609
1609
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1610
1610
|
key: z.ZodString;
|
|
1611
|
-
label: z.ZodString
|
|
1611
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1612
1612
|
}, z.core.$strict>>;
|
|
1613
1613
|
footer: z.ZodOptional<z.ZodString>;
|
|
1614
1614
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1634,7 +1634,7 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
1634
1634
|
}, z.core.$strict>], "type">>;
|
|
1635
1635
|
bodyRefs: z.ZodArray<z.ZodObject<{
|
|
1636
1636
|
key: z.ZodString;
|
|
1637
|
-
label: z.ZodString
|
|
1637
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1638
1638
|
}, z.core.$strict>>;
|
|
1639
1639
|
footer: z.ZodOptional<z.ZodString>;
|
|
1640
1640
|
}, z.core.$strict>], "key">>>>;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=e.strictObject({eventId:e.uuid(),deliverBy:e.iso.datetime(),locale:e.string().min(1).max(35),contentLocale:e.string().min(1).max(35),title:e.string().trim().min(1).max(512),body:e.string(),url:e.url().refine(e=>new URL(e).protocol===`https:`,`notification_https_target_required`)}),n=1,r=2,i=3,a=4,o=5,s=7,ee=8,te=9,ne=20,c=32*1024,l=1380*60*1e3,u=c,d=l,f=c,re=l,p=c,ie=l,m=c,ae=64*1024,h=l,oe=1,g=32*1024,_=10080*60*1e3,v=[`pending`,`delivering`,`partial`,`delivered`,`failed`,`expired`],y=[`accepted`,`enqueue_retry_wait`,`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`delivery_deadline_exceeded`,`destination_configuration_unavailable`],b=[...v,`unconfirmed`],x=[...y,`delivery_unconfirmed`],S=[`pending`,`delivering`,`delivered`,`failed`,`expired`],se=[...S,`unconfirmed`],ce=[`provider_timeout`,`provider_rate_limited`,`provider_unavailable`,`provider_rejected`,`destination_configuration_unavailable`,`delivery_interrupted`,`retry_exhausted`],le=[`invalid_request`,`request_too_large`,`producer_scope_mismatch`,`route_not_allowed`,`event_identity_conflict`,`route_not_found`,`route_empty`,`delivery_deadline_invalid`],ue=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],de=[`source`,`zh-CN`],C=[`qq`,`tg`,`wechat`,`lark`],fe=new TextEncoder,w=/^[a-z][a-z0-9-]{0,62}$/,pe=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,me=/^[A-Z0-9][\w.:-]{0,127}$/i;function he(e){return[...e].length}function T(t){return e.string().refine(e=>he(e)>0,{message:`too_small`}).refine(e=>he(e)<=t,{message:`too_big`})}const E=e.string().datetime({offset:!0}),D=e.object({key:e.string().regex(w),environment:e.string().regex(w)}).strict(),O=e.object({type:e.string().regex(w),id:e.string().regex(me),revision:e.number().int().positive()}).strict(),k=e.string().min(1).max(127).regex(pe),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},ge=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 M(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`]}),fe.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const N=ge.superRefine((e,t)=>M(e,t,l,c)),P={title:T(160),summary:T(1200),facts:e.array(e.object({label:T(48),value:T(500)}).strict()).max(10)},_e=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),...P}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),...P}).strict()]),ve=e.array(_e).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`})}),F=e.object({contractVersion:e.literal(2),...j,message:e.object({type:e.literal(`localized_link_summary`),variants:ve,primaryLink:A,sourceLink:A.optional()}).strict()}).strict().superRefine((e,t)=>M(e,t,d,u)),ye=e.discriminatedUnion(`type`,[e.object({key:e.string().regex(w),type:e.literal(`text`),label:T(48).optional(),value:T(4e3)}).strict(),e.object({key:e.string().regex(w),type:e.literal(`fields`),items:e.array(e.object({label:T(48),value:T(1200)}).strict()).min(1).max(20)}).strict()]),I=e.array(ye).max(30).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_section_duplicate`})}),L=I.min(1),R=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),title:T(160),sections:L}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),title:T(160),sections:L}).strict()]),z=(e,t,n=!1)=>{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 r=e.find(e=>e.key===`source`),i=e.find(e=>e.key===`zh-CN`);if(r&&i){let a=new Set(r.sections.map(e=>e.key)),o=new Set(i.sections.map(e=>e.key)),s=r.sections.filter(e=>!n||e.type!==`text`||o.has(e.key)).map(e=>`${e.key}:${e.type}`),ee=i.sections.filter(e=>!n||e.type!==`text`||a.has(e.key)).map(e=>`${e.key}:${e.type}`);JSON.stringify(s)!==JSON.stringify(ee)&&t.addIssue({code:`custom`,message:`message_variant_structure_mismatch`,path:[e.indexOf(i),`sections`]})}},be=e.array(R).min(1).max(2).superRefine(z),B=e.object({contractVersion:e.literal(3),...j,message:e.object({type:e.literal(`structured_notification`),variants:be,links:e.array(e.object({key:e.string().regex(w),...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(),xe=B.superRefine((e,t)=>M(e,t,re,f)),Se=e.object({label:T(48).optional(),value:T(p)}).strict(),Ce=e.discriminatedUnion(`key`,[R.options[0].extend({body:Se}),R.options[1].extend({body:Se})]),we=B.extend({contractVersion:e.literal(4),message:B.shape.message.extend({variants:e.array(Ce).min(1).max(2).superRefine(z)})}).superRefine((e,t)=>M(e,t,ie,p)),V=e.discriminatedUnion(`key`,[R.options[0].extend({bodyLabel:T(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(w),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`})})}),R.options[1].extend({bodyLabel:T(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(w),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`})})})]),Te=e.object({value:T(m)}).strict(),H=e.object({contractVersion:e.literal(5),...j,message:e.object({type:e.literal(`structured_notification`),variants:e.array(V).min(1).max(2).superRefine(z),links:e.array(e.object({key:e.string().regex(w),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:Te}).strict()}).strict().superRefine((e,t)=>{M(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`]})}}),U=e.object({...H.shape,contractVersion:e.literal(6),message:H.shape.message.omit({body:!0}).extend({bodies:e.array(e.object({key:e.string().regex(w),value:T(m)}).strict()).max(2),variants:e.array(e.discriminatedUnion(`key`,[V.options[0].omit({bodyLabel:!0}).extend({sections:I,bodyRefs:e.array(e.object({key:e.string().regex(w),label:T(48)}).strict()).max(2),footer:T(500).optional()}),V.options[1].omit({bodyLabel:!0}).extend({sections:I,bodyRefs:e.array(e.object({key:e.string().regex(w),label:T(48)}).strict()).max(2),footer:T(500).optional()})])).min(1).max(2).superRefine((e,t)=>z(e,t,!0))})}).strict().superRefine(W);function W(e,t){M(e,t,h,m);let n=e.message.bodies.map(e=>e.key),r=e.message.links.map(e=>e.key);new Set(n).size!==n.length&&t.addIssue({code:`custom`,message:`message_body_duplicate`}),Ee(e.message.variants,n,r,t)}function Ee(e,t,n,r,i){for(let[a,o]of e.entries()){let e=o.bodyRefs.map(e=>e.key);(new Set(e).size!==e.length||e.some(e=>!t.includes(e)))&&r.addIssue({code:`custom`,message:`message_body_reference_invalid`,...i?{path:[...i,a,`bodyRefs`]}:{}}),JSON.stringify(o.linkLabels.map(e=>e.key))!==JSON.stringify(n)&&r.addIssue({code:`custom`,message:`message_variant_link_labels_mismatch`,...i?{path:[...i,a,`linkLabels`]}:{}})}}const De=e.array(k).min(1).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`route_key_duplicate`})}),{routeKey:Oe,...ke}=U.shape,G=U.shape.message,K=e.object({...ke,contractVersion:e.literal(7),routeKeys:De,message:G}).strict().superRefine(W),q=e.object({...K.shape,contractVersion:e.literal(8),message:G.extend({channelVariants:e.partialRecord(e.enum(C),G.shape.variants).optional()})}).strict().superRefine((e,t)=>{W(e,t);let n=e.message.variants.map(e=>`${e.key}:${e.locale}`).sort(),r=e.message.bodies.map(e=>e.key),i=e.message.links.map(e=>e.key);for(let a of C){let o=e.message.channelVariants?.[a];if(!o)continue;let s=[`message`,`channelVariants`,a];JSON.stringify(o.map(e=>`${e.key}:${e.locale}`).sort())!==JSON.stringify(n)&&t.addIssue({code:`custom`,message:`message_channel_variant_languages_mismatch`,path:s}),Ee(o,r,i,t,s)}}),Ae=e.object({locale:T(35),contentLocale:T(35),title:T(160).refine(e=>e.trim().length>0,`browser_message_title_blank`),body:e.string().max(8192),url:A.shape.url}).strict(),je=e.object({...q.shape,contractVersion:e.literal(9),audience:e.object({topics:e.array(T(128)).min(1).max(2).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`audience_topic_duplicate`})})}).strict().optional(),browserMessages:e.array(Ae).min(1).max(5).superRefine((e,t)=>{new Set(e.map(e=>e.locale)).size!==e.length&&t.addIssue({code:`custom`,message:`browser_message_locale_duplicate`})}).optional()}).strict().superRefine((e,t)=>{let{audience:n,browserMessages:r,...i}=e,a=q.safeParse({...i,contractVersion:8});if(a.success)M(e,t,h,ae);else for(let e of a.error.issues)t.addIssue({...e});r!==void 0&&n===void 0&&t.addIssue({code:`custom`,message:`browser_message_audience_missing`,path:[`audience`]})});function Me(e){return`routeKeys`in e?[...e.routeKeys].sort():[e.routeKey]}const Ne=e.object({type:e.literal(`creator.draft.v1`),templateId:e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),signalType:e.string().regex(/^[a-z][a-z0-9_]*$/),sourceTextZh:T(g),sourceUrl:A.shape.url.optional()}).strict(),Pe=e.object({contractVersion:e.literal(1),eventType:e.literal(`local-task.delivery.requested`),eventId:e.string().uuid(),producer:D,routeKey:k,occurredAt:E,requestedAt:E,deliverBy:E,subject:O.extend({type:e.literal(`creator-event`)}),task:Ne}).strict().superRefine((e,t)=>M(e,t,_,g)),Fe=Pe,Ie=e.union([N,F,xe,we,H,U,K,q,je]),Le=e.object({destinationKey:e.string().min(1),state:e.enum(S),attempts:e.number().int().min(0).max(4),failureCode:e.enum(ce).nullable(),lastAttemptAt:E.nullable(),nextAttemptAt:E.nullable(),leaseExpiresAt:E.nullable()}).strict(),J=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:D,routeKey:k,subject:O,state:e.enum(v),reason:e.enum(y),terminal:e.boolean(),acceptedAt:E,updatedAt:E,deliverBy:E,terminalAt:E.nullable(),destinations:e.array(Le).min(1).max(20)}).strict(),Y=e.object({name:e.string().min(1).max(100),message:e.string().max(500).optional(),code:e.union([e.string().max(100),e.number()]).optional(),status:e.union([e.string().max(100),e.number()]).optional()}).strict(),X=Y.extend({cause:Y.extend({cause:Y.extend({cause:Y.optional()}).optional()}).optional()}),Re=Le.extend({state:e.enum(se),attempts:e.number().int().min(0),revision:e.number().int().min(0),cause:X.nullable(),unconfirmedAt:E.nullable()}),Z=J.extend({contractVersion:e.literal(2),state:e.enum(b),reason:e.enum(x),revision:e.number().int().min(0),destinations:e.array(Re).min(1).max(20)}),ze=Z.omit({routeKey:!0}).extend({contractVersion:e.literal(3),routeKeys:De}),Q=e.union([J,Z,ze]),Be=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(ue)}).strict(),Ve=e.object({code:e.literal(`invalid_request`),issues:e.array(Be).max(20).optional()}).strict(),He=e.object({code:e.enum(le.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([Ve,He]),Ue=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:J}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),We=e.discriminatedUnion(`status`,[e.object({status:e.literal(`found`),receipt:J}).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()]),Ge=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Q}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),Ke=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{oe as localTaskDeliveryContractVersionV1,_ as localTaskDeliveryMaximumDeadlineMillisecondsV1,g as localTaskDeliveryRequestMaximumUtf8BytesV1,Fe as localTaskDeliveryRequestSchema,Pe as localTaskDeliveryRequestV1Schema,Ae as notificationBrowserMessageSchema,t as notificationBrowserPayloadSchema,Ue as notificationDeliverResultV1Schema,Ge as notificationDeliverResultV2Schema,C as notificationDeliveryChannelKeys,n as notificationDeliveryContractVersionV1,r as notificationDeliveryContractVersionV2,i as notificationDeliveryContractVersionV3,a as notificationDeliveryContractVersionV4,o as notificationDeliveryContractVersionV5,s as notificationDeliveryContractVersionV7,ee as notificationDeliveryContractVersionV8,te as notificationDeliveryContractVersionV9,l as notificationDeliveryMaximumDeadlineMillisecondsV1,d as notificationDeliveryMaximumDeadlineMillisecondsV2,re as notificationDeliveryMaximumDeadlineMillisecondsV3,ie as notificationDeliveryMaximumDeadlineMillisecondsV4,h as notificationDeliveryMaximumDeadlineMillisecondsV5,ne as notificationDeliveryMaximumDestinationsV1,y as notificationDeliveryReasonsV1,x as notificationDeliveryReasonsV2,J as notificationDeliveryReceiptV1Schema,Z as notificationDeliveryReceiptV2Schema,ze as notificationDeliveryReceiptV3Schema,le as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,c as notificationDeliveryRequestMaximumUtf8BytesV1,u as notificationDeliveryRequestMaximumUtf8BytesV2,f as notificationDeliveryRequestMaximumUtf8BytesV3,p as notificationDeliveryRequestMaximumUtf8BytesV4,m as notificationDeliveryRequestMaximumUtf8BytesV5,ae as notificationDeliveryRequestMaximumUtf8BytesV9,Ie as notificationDeliveryRequestSchema,N as notificationDeliveryRequestV1Schema,F as notificationDeliveryRequestV2Schema,xe as notificationDeliveryRequestV3Schema,we as notificationDeliveryRequestV4Schema,H as notificationDeliveryRequestV5Schema,U as notificationDeliveryRequestV6Schema,K as notificationDeliveryRequestV7Schema,q as notificationDeliveryRequestV8Schema,je as notificationDeliveryRequestV9Schema,v as notificationDeliveryStatesV1,b as notificationDeliveryStatesV2,ce as notificationDestinationFailureCodesV1,S as notificationDestinationStatesV1,se as notificationDestinationStatesV2,We as notificationGetReceiptResultV1Schema,Ke as notificationGetReceiptResultV2Schema,Q as notificationMessageReceiptSchema,de as notificationMessageVariantKeys,Me as notificationRouteKeys,ue as notificationValidationIssueCodesV1,X as safeDeliveryCauseSchema};
|
|
1
|
+
import{z as e}from"zod";const t=e.strictObject({eventId:e.uuid(),deliverBy:e.iso.datetime(),locale:e.string().min(1).max(35),contentLocale:e.string().min(1).max(35),title:e.string().trim().min(1).max(512),body:e.string(),url:e.url().refine(e=>new URL(e).protocol===`https:`,`notification_https_target_required`)}),n=1,r=2,i=3,a=4,o=5,s=7,ee=8,te=9,ne=20,c=32*1024,l=1380*60*1e3,u=c,d=l,f=c,re=l,p=c,ie=l,m=c,ae=64*1024,h=l,oe=1,g=32*1024,_=10080*60*1e3,v=[`pending`,`delivering`,`partial`,`delivered`,`failed`,`expired`],y=[`accepted`,`enqueue_retry_wait`,`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`delivery_deadline_exceeded`,`destination_configuration_unavailable`],b=[...v,`unconfirmed`],x=[...y,`delivery_unconfirmed`],S=[`pending`,`delivering`,`delivered`,`failed`,`expired`],se=[...S,`unconfirmed`],ce=[`provider_timeout`,`provider_rate_limited`,`provider_unavailable`,`provider_rejected`,`destination_configuration_unavailable`,`delivery_interrupted`,`retry_exhausted`],le=[`invalid_request`,`request_too_large`,`producer_scope_mismatch`,`route_not_allowed`,`event_identity_conflict`,`route_not_found`,`route_empty`,`delivery_deadline_invalid`],ue=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],de=[`source`,`zh-CN`],C=[`qq`,`tg`,`wechat`,`lark`],fe=new TextEncoder,w=/^[a-z][a-z0-9-]{0,62}$/,pe=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,me=/^[A-Z0-9][\w.:-]{0,127}$/i;function he(e){return[...e].length}function T(t){return e.string().refine(e=>he(e)>0,{message:`too_small`}).refine(e=>he(e)<=t,{message:`too_big`})}const E=e.string().datetime({offset:!0}),D=e.object({key:e.string().regex(w),environment:e.string().regex(w)}).strict(),O=e.object({type:e.string().regex(w),id:e.string().regex(me),revision:e.number().int().positive()}).strict(),k=e.string().min(1).max(127).regex(pe),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},ge=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 M(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`]}),fe.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const N=ge.superRefine((e,t)=>M(e,t,l,c)),P={title:T(160),summary:T(1200),facts:e.array(e.object({label:T(48),value:T(500)}).strict()).max(10)},_e=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),...P}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),...P}).strict()]),ve=e.array(_e).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`})}),F=e.object({contractVersion:e.literal(2),...j,message:e.object({type:e.literal(`localized_link_summary`),variants:ve,primaryLink:A,sourceLink:A.optional()}).strict()}).strict().superRefine((e,t)=>M(e,t,d,u)),ye=e.discriminatedUnion(`type`,[e.object({key:e.string().regex(w),type:e.literal(`text`),label:T(48).optional(),value:T(4e3)}).strict(),e.object({key:e.string().regex(w),type:e.literal(`fields`),items:e.array(e.object({label:T(48),value:T(1200)}).strict()).min(1).max(20)}).strict()]),I=e.array(ye).max(30).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_section_duplicate`})}),L=I.min(1),R=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),title:T(160),sections:L}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),title:T(160),sections:L}).strict()]),z=(e,t,n=!1)=>{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 r=e.find(e=>e.key===`source`),i=e.find(e=>e.key===`zh-CN`);if(r&&i){let a=new Set(r.sections.map(e=>e.key)),o=new Set(i.sections.map(e=>e.key)),s=r.sections.filter(e=>!n||e.type!==`text`||o.has(e.key)).map(e=>`${e.key}:${e.type}`),ee=i.sections.filter(e=>!n||e.type!==`text`||a.has(e.key)).map(e=>`${e.key}:${e.type}`);JSON.stringify(s)!==JSON.stringify(ee)&&t.addIssue({code:`custom`,message:`message_variant_structure_mismatch`,path:[e.indexOf(i),`sections`]})}},be=e.array(R).min(1).max(2).superRefine(z),B=e.object({contractVersion:e.literal(3),...j,message:e.object({type:e.literal(`structured_notification`),variants:be,links:e.array(e.object({key:e.string().regex(w),...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(),xe=B.superRefine((e,t)=>M(e,t,re,f)),Se=e.object({label:T(48).optional(),value:T(p)}).strict(),Ce=e.discriminatedUnion(`key`,[R.options[0].extend({body:Se}),R.options[1].extend({body:Se})]),we=B.extend({contractVersion:e.literal(4),message:B.shape.message.extend({variants:e.array(Ce).min(1).max(2).superRefine(z)})}).superRefine((e,t)=>M(e,t,ie,p)),V=e.discriminatedUnion(`key`,[R.options[0].extend({bodyLabel:T(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(w),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`})})}),R.options[1].extend({bodyLabel:T(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(w),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`})})})]),Te=e.object({value:T(m)}).strict(),H=e.object({contractVersion:e.literal(5),...j,message:e.object({type:e.literal(`structured_notification`),variants:e.array(V).min(1).max(2).superRefine(z),links:e.array(e.object({key:e.string().regex(w),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:Te}).strict()}).strict().superRefine((e,t)=>{M(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`]})}}),U=e.object({...H.shape,contractVersion:e.literal(6),message:H.shape.message.omit({body:!0}).extend({bodies:e.array(e.object({key:e.string().regex(w),value:T(m)}).strict()).max(2),variants:e.array(e.discriminatedUnion(`key`,[V.options[0].omit({bodyLabel:!0}).extend({sections:I,bodyRefs:e.array(e.object({key:e.string().regex(w),label:T(48).optional()}).strict()).max(2),footer:T(500).optional()}),V.options[1].omit({bodyLabel:!0}).extend({sections:I,bodyRefs:e.array(e.object({key:e.string().regex(w),label:T(48).optional()}).strict()).max(2),footer:T(500).optional()})])).min(1).max(2).superRefine((e,t)=>z(e,t,!0))})}).strict().superRefine(W);function W(e,t){M(e,t,h,m);let n=e.message.bodies.map(e=>e.key),r=e.message.links.map(e=>e.key);new Set(n).size!==n.length&&t.addIssue({code:`custom`,message:`message_body_duplicate`}),Ee(e.message.variants,n,r,t)}function Ee(e,t,n,r,i){for(let[a,o]of e.entries()){let e=o.bodyRefs.map(e=>e.key);(new Set(e).size!==e.length||e.some(e=>!t.includes(e)))&&r.addIssue({code:`custom`,message:`message_body_reference_invalid`,...i?{path:[...i,a,`bodyRefs`]}:{}}),JSON.stringify(o.linkLabels.map(e=>e.key))!==JSON.stringify(n)&&r.addIssue({code:`custom`,message:`message_variant_link_labels_mismatch`,...i?{path:[...i,a,`linkLabels`]}:{}})}}const De=e.array(k).min(1).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`route_key_duplicate`})}),{routeKey:Oe,...ke}=U.shape,G=U.shape.message,K=e.object({...ke,contractVersion:e.literal(7),routeKeys:De,message:G}).strict().superRefine(W),q=e.object({...K.shape,contractVersion:e.literal(8),message:G.extend({channelVariants:e.partialRecord(e.enum(C),G.shape.variants).optional()})}).strict().superRefine((e,t)=>{W(e,t);let n=e.message.variants.map(e=>`${e.key}:${e.locale}`).sort(),r=e.message.bodies.map(e=>e.key),i=e.message.links.map(e=>e.key);for(let a of C){let o=e.message.channelVariants?.[a];if(!o)continue;let s=[`message`,`channelVariants`,a];JSON.stringify(o.map(e=>`${e.key}:${e.locale}`).sort())!==JSON.stringify(n)&&t.addIssue({code:`custom`,message:`message_channel_variant_languages_mismatch`,path:s}),Ee(o,r,i,t,s)}}),Ae=e.object({locale:T(35),contentLocale:T(35),title:T(160).refine(e=>e.trim().length>0,`browser_message_title_blank`),body:e.string().max(8192),url:A.shape.url}).strict(),je=e.object({...q.shape,contractVersion:e.literal(9),audience:e.object({topics:e.array(T(128)).min(1).max(2).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`audience_topic_duplicate`})})}).strict().optional(),browserMessages:e.array(Ae).min(1).max(5).superRefine((e,t)=>{new Set(e.map(e=>e.locale)).size!==e.length&&t.addIssue({code:`custom`,message:`browser_message_locale_duplicate`})}).optional()}).strict().superRefine((e,t)=>{let{audience:n,browserMessages:r,...i}=e,a=q.safeParse({...i,contractVersion:8});if(a.success)M(e,t,h,ae);else for(let e of a.error.issues)t.addIssue({...e});r!==void 0&&n===void 0&&t.addIssue({code:`custom`,message:`browser_message_audience_missing`,path:[`audience`]})});function Me(e){return`routeKeys`in e?[...e.routeKeys].sort():[e.routeKey]}const Ne=e.object({type:e.literal(`creator.draft.v1`),templateId:e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),signalType:e.string().regex(/^[a-z][a-z0-9_]*$/),sourceTextZh:T(g),sourceUrl:A.shape.url.optional()}).strict(),Pe=e.object({contractVersion:e.literal(1),eventType:e.literal(`local-task.delivery.requested`),eventId:e.string().uuid(),producer:D,routeKey:k,occurredAt:E,requestedAt:E,deliverBy:E,subject:O.extend({type:e.literal(`creator-event`)}),task:Ne}).strict().superRefine((e,t)=>M(e,t,_,g)),Fe=Pe,Ie=e.union([N,F,xe,we,H,U,K,q,je]),Le=e.object({destinationKey:e.string().min(1),state:e.enum(S),attempts:e.number().int().min(0).max(4),failureCode:e.enum(ce).nullable(),lastAttemptAt:E.nullable(),nextAttemptAt:E.nullable(),leaseExpiresAt:E.nullable()}).strict(),J=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:D,routeKey:k,subject:O,state:e.enum(v),reason:e.enum(y),terminal:e.boolean(),acceptedAt:E,updatedAt:E,deliverBy:E,terminalAt:E.nullable(),destinations:e.array(Le).min(1).max(20)}).strict(),Y=e.object({name:e.string().min(1).max(100),message:e.string().max(500).optional(),code:e.union([e.string().max(100),e.number()]).optional(),status:e.union([e.string().max(100),e.number()]).optional()}).strict(),X=Y.extend({cause:Y.extend({cause:Y.extend({cause:Y.optional()}).optional()}).optional()}),Re=Le.extend({state:e.enum(se),attempts:e.number().int().min(0),revision:e.number().int().min(0),cause:X.nullable(),unconfirmedAt:E.nullable()}),Z=J.extend({contractVersion:e.literal(2),state:e.enum(b),reason:e.enum(x),revision:e.number().int().min(0),destinations:e.array(Re).min(1).max(20)}),ze=Z.omit({routeKey:!0}).extend({contractVersion:e.literal(3),routeKeys:De}),Q=e.union([J,Z,ze]),Be=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(ue)}).strict(),Ve=e.object({code:e.literal(`invalid_request`),issues:e.array(Be).max(20).optional()}).strict(),He=e.object({code:e.enum(le.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([Ve,He]),Ue=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:J}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),We=e.discriminatedUnion(`status`,[e.object({status:e.literal(`found`),receipt:J}).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()]),Ge=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Q}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),Ke=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{oe as localTaskDeliveryContractVersionV1,_ as localTaskDeliveryMaximumDeadlineMillisecondsV1,g as localTaskDeliveryRequestMaximumUtf8BytesV1,Fe as localTaskDeliveryRequestSchema,Pe as localTaskDeliveryRequestV1Schema,Ae as notificationBrowserMessageSchema,t as notificationBrowserPayloadSchema,Ue as notificationDeliverResultV1Schema,Ge as notificationDeliverResultV2Schema,C as notificationDeliveryChannelKeys,n as notificationDeliveryContractVersionV1,r as notificationDeliveryContractVersionV2,i as notificationDeliveryContractVersionV3,a as notificationDeliveryContractVersionV4,o as notificationDeliveryContractVersionV5,s as notificationDeliveryContractVersionV7,ee as notificationDeliveryContractVersionV8,te as notificationDeliveryContractVersionV9,l as notificationDeliveryMaximumDeadlineMillisecondsV1,d as notificationDeliveryMaximumDeadlineMillisecondsV2,re as notificationDeliveryMaximumDeadlineMillisecondsV3,ie as notificationDeliveryMaximumDeadlineMillisecondsV4,h as notificationDeliveryMaximumDeadlineMillisecondsV5,ne as notificationDeliveryMaximumDestinationsV1,y as notificationDeliveryReasonsV1,x as notificationDeliveryReasonsV2,J as notificationDeliveryReceiptV1Schema,Z as notificationDeliveryReceiptV2Schema,ze as notificationDeliveryReceiptV3Schema,le as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,c as notificationDeliveryRequestMaximumUtf8BytesV1,u as notificationDeliveryRequestMaximumUtf8BytesV2,f as notificationDeliveryRequestMaximumUtf8BytesV3,p as notificationDeliveryRequestMaximumUtf8BytesV4,m as notificationDeliveryRequestMaximumUtf8BytesV5,ae as notificationDeliveryRequestMaximumUtf8BytesV9,Ie as notificationDeliveryRequestSchema,N as notificationDeliveryRequestV1Schema,F as notificationDeliveryRequestV2Schema,xe as notificationDeliveryRequestV3Schema,we as notificationDeliveryRequestV4Schema,H as notificationDeliveryRequestV5Schema,U as notificationDeliveryRequestV6Schema,K as notificationDeliveryRequestV7Schema,q as notificationDeliveryRequestV8Schema,je as notificationDeliveryRequestV9Schema,v as notificationDeliveryStatesV1,b as notificationDeliveryStatesV2,ce as notificationDestinationFailureCodesV1,S as notificationDestinationStatesV1,se as notificationDestinationStatesV2,We as notificationGetReceiptResultV1Schema,Ke as notificationGetReceiptResultV2Schema,Q as notificationMessageReceiptSchema,de as notificationMessageVariantKeys,Me as notificationRouteKeys,ue as notificationValidationIssueCodesV1,X as safeDeliveryCauseSchema};
|