@closerepo/notification-contracts 1.10.0 → 1.11.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 CHANGED
@@ -6,6 +6,7 @@ declare const notificationDeliveryContractVersionV3: 3;
6
6
  declare const notificationDeliveryContractVersionV4: 4;
7
7
  declare const notificationDeliveryContractVersionV5: 5;
8
8
  declare const notificationDeliveryContractVersionV7: 7;
9
+ declare const notificationDeliveryContractVersionV8: 8;
9
10
  declare const notificationDeliveryMaximumDestinationsV1 = 20;
10
11
  declare const notificationDeliveryRequestMaximumUtf8BytesV1: number;
11
12
  declare const notificationDeliveryMaximumDeadlineMillisecondsV1: number;
@@ -30,6 +31,8 @@ declare const notificationDestinationFailureCodesV1: readonly ["provider_timeout
30
31
  declare const notificationDeliveryRejectionCodesV1: readonly ["invalid_request", "request_too_large", "producer_scope_mismatch", "route_not_allowed", "event_identity_conflict", "route_not_found", "route_empty", "delivery_deadline_invalid"];
31
32
  declare const notificationValidationIssueCodesV1: readonly ["invalid_type", "invalid_value", "too_small", "too_big", "invalid_format", "unrecognized_keys", "custom"];
32
33
  declare const notificationMessageVariantKeys: readonly ["source", "zh-CN"];
34
+ declare const notificationDeliveryChannelKeys: readonly ["qq", "tg", "wechat", "lark"];
35
+ type NotificationDeliveryChannelKey = (typeof notificationDeliveryChannelKeys)[number];
33
36
  declare const notificationDeliveryRequestV1Schema: z.ZodObject<{
34
37
  message: z.ZodObject<{
35
38
  type: z.ZodLiteral<"link_summary">;
@@ -537,6 +540,149 @@ declare const notificationDeliveryRequestV7Schema: z.ZodObject<{
537
540
  }, z.core.$strict>;
538
541
  }, z.core.$strict>;
539
542
  type NotificationDeliveryRequestV7 = z.infer<typeof notificationDeliveryRequestV7Schema>;
543
+ /** Frozen channel copy shares message bodies and links; omitted channels use default variants. */
544
+ declare const notificationDeliveryRequestV8Schema: z.ZodObject<{
545
+ contractVersion: z.ZodLiteral<8>;
546
+ message: z.ZodObject<{
547
+ type: z.ZodLiteral<"structured_notification">;
548
+ links: z.ZodArray<z.ZodObject<{
549
+ key: z.ZodString;
550
+ url: z.ZodString;
551
+ }, z.core.$strict>>;
552
+ bodies: z.ZodArray<z.ZodObject<{
553
+ key: z.ZodString;
554
+ value: z.ZodString;
555
+ }, z.core.$strict>>;
556
+ variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
557
+ key: z.ZodLiteral<"source">;
558
+ title: z.ZodString;
559
+ locale: z.ZodLiteral<"und">;
560
+ linkLabels: z.ZodArray<z.ZodObject<{
561
+ key: z.ZodString;
562
+ label: z.ZodString;
563
+ }, z.core.$strict>>;
564
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
565
+ key: z.ZodString;
566
+ type: z.ZodLiteral<"text">;
567
+ label: z.ZodOptional<z.ZodString>;
568
+ value: z.ZodString;
569
+ }, z.core.$strict>, z.ZodObject<{
570
+ key: z.ZodString;
571
+ type: z.ZodLiteral<"fields">;
572
+ items: z.ZodArray<z.ZodObject<{
573
+ label: z.ZodString;
574
+ value: z.ZodString;
575
+ }, z.core.$strict>>;
576
+ }, z.core.$strict>], "type">>;
577
+ bodyRefs: z.ZodArray<z.ZodObject<{
578
+ key: z.ZodString;
579
+ label: z.ZodString;
580
+ }, z.core.$strict>>;
581
+ footer: z.ZodOptional<z.ZodString>;
582
+ }, z.core.$strict>, z.ZodObject<{
583
+ key: z.ZodLiteral<"zh-CN">;
584
+ title: z.ZodString;
585
+ locale: z.ZodLiteral<"zh-CN">;
586
+ linkLabels: z.ZodArray<z.ZodObject<{
587
+ key: z.ZodString;
588
+ label: z.ZodString;
589
+ }, z.core.$strict>>;
590
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
591
+ key: z.ZodString;
592
+ type: z.ZodLiteral<"text">;
593
+ label: z.ZodOptional<z.ZodString>;
594
+ value: z.ZodString;
595
+ }, z.core.$strict>, z.ZodObject<{
596
+ key: z.ZodString;
597
+ type: z.ZodLiteral<"fields">;
598
+ items: z.ZodArray<z.ZodObject<{
599
+ label: z.ZodString;
600
+ value: z.ZodString;
601
+ }, z.core.$strict>>;
602
+ }, z.core.$strict>], "type">>;
603
+ bodyRefs: z.ZodArray<z.ZodObject<{
604
+ key: z.ZodString;
605
+ label: z.ZodString;
606
+ }, z.core.$strict>>;
607
+ footer: z.ZodOptional<z.ZodString>;
608
+ }, z.core.$strict>], "key">>;
609
+ channelVariants: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
610
+ qq: "qq";
611
+ tg: "tg";
612
+ wechat: "wechat";
613
+ lark: "lark";
614
+ }> & z.core.$partial, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
615
+ key: z.ZodLiteral<"source">;
616
+ title: z.ZodString;
617
+ locale: z.ZodLiteral<"und">;
618
+ linkLabels: z.ZodArray<z.ZodObject<{
619
+ key: z.ZodString;
620
+ label: z.ZodString;
621
+ }, z.core.$strict>>;
622
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
623
+ key: z.ZodString;
624
+ type: z.ZodLiteral<"text">;
625
+ label: z.ZodOptional<z.ZodString>;
626
+ value: z.ZodString;
627
+ }, z.core.$strict>, z.ZodObject<{
628
+ key: z.ZodString;
629
+ type: z.ZodLiteral<"fields">;
630
+ items: z.ZodArray<z.ZodObject<{
631
+ label: z.ZodString;
632
+ value: z.ZodString;
633
+ }, z.core.$strict>>;
634
+ }, z.core.$strict>], "type">>;
635
+ bodyRefs: z.ZodArray<z.ZodObject<{
636
+ key: z.ZodString;
637
+ label: z.ZodString;
638
+ }, z.core.$strict>>;
639
+ footer: z.ZodOptional<z.ZodString>;
640
+ }, z.core.$strict>, z.ZodObject<{
641
+ key: z.ZodLiteral<"zh-CN">;
642
+ title: z.ZodString;
643
+ locale: z.ZodLiteral<"zh-CN">;
644
+ linkLabels: z.ZodArray<z.ZodObject<{
645
+ key: z.ZodString;
646
+ label: z.ZodString;
647
+ }, z.core.$strict>>;
648
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
649
+ key: z.ZodString;
650
+ type: z.ZodLiteral<"text">;
651
+ label: z.ZodOptional<z.ZodString>;
652
+ value: z.ZodString;
653
+ }, z.core.$strict>, z.ZodObject<{
654
+ key: z.ZodString;
655
+ type: z.ZodLiteral<"fields">;
656
+ items: z.ZodArray<z.ZodObject<{
657
+ label: z.ZodString;
658
+ value: z.ZodString;
659
+ }, z.core.$strict>>;
660
+ }, z.core.$strict>], "type">>;
661
+ bodyRefs: z.ZodArray<z.ZodObject<{
662
+ key: z.ZodString;
663
+ label: z.ZodString;
664
+ }, z.core.$strict>>;
665
+ footer: z.ZodOptional<z.ZodString>;
666
+ }, z.core.$strict>], "key">>>>;
667
+ }, z.core.$strict>;
668
+ routeKeys: z.ZodArray<z.ZodString>;
669
+ eventType: z.ZodLiteral<"notification.delivery.requested">;
670
+ eventId: z.ZodString;
671
+ producer: z.ZodObject<{
672
+ key: z.ZodString;
673
+ environment: z.ZodString;
674
+ }, z.core.$strict>;
675
+ occurredAt: z.ZodString;
676
+ requestedAt: z.ZodString;
677
+ deliverBy: z.ZodString;
678
+ subject: z.ZodObject<{
679
+ type: z.ZodString;
680
+ id: z.ZodString;
681
+ revision: z.ZodNumber;
682
+ }, z.core.$strict>;
683
+ }, z.core.$strict>;
684
+ type NotificationDeliveryRequestV8 = z.infer<typeof notificationDeliveryRequestV8Schema>;
685
+ type NotificationMessageVariantsV6 = NotificationDeliveryRequestV6['message']['variants'];
540
686
  /** Reads routing facts from current envelopes and historical single-route records. */
541
687
  declare function notificationRouteKeys(value: {
542
688
  routeKey: string;
@@ -1044,6 +1190,145 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
1044
1190
  id: z.ZodString;
1045
1191
  revision: z.ZodNumber;
1046
1192
  }, z.core.$strict>;
1193
+ }, z.core.$strict>, z.ZodObject<{
1194
+ contractVersion: z.ZodLiteral<8>;
1195
+ message: z.ZodObject<{
1196
+ type: z.ZodLiteral<"structured_notification">;
1197
+ links: z.ZodArray<z.ZodObject<{
1198
+ key: z.ZodString;
1199
+ url: z.ZodString;
1200
+ }, z.core.$strict>>;
1201
+ bodies: z.ZodArray<z.ZodObject<{
1202
+ key: z.ZodString;
1203
+ value: z.ZodString;
1204
+ }, z.core.$strict>>;
1205
+ variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1206
+ key: z.ZodLiteral<"source">;
1207
+ title: z.ZodString;
1208
+ locale: z.ZodLiteral<"und">;
1209
+ linkLabels: z.ZodArray<z.ZodObject<{
1210
+ key: z.ZodString;
1211
+ label: z.ZodString;
1212
+ }, z.core.$strict>>;
1213
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1214
+ key: z.ZodString;
1215
+ type: z.ZodLiteral<"text">;
1216
+ label: z.ZodOptional<z.ZodString>;
1217
+ value: z.ZodString;
1218
+ }, z.core.$strict>, z.ZodObject<{
1219
+ key: z.ZodString;
1220
+ type: z.ZodLiteral<"fields">;
1221
+ items: z.ZodArray<z.ZodObject<{
1222
+ label: z.ZodString;
1223
+ value: z.ZodString;
1224
+ }, z.core.$strict>>;
1225
+ }, z.core.$strict>], "type">>;
1226
+ bodyRefs: z.ZodArray<z.ZodObject<{
1227
+ key: z.ZodString;
1228
+ label: z.ZodString;
1229
+ }, z.core.$strict>>;
1230
+ footer: z.ZodOptional<z.ZodString>;
1231
+ }, z.core.$strict>, z.ZodObject<{
1232
+ key: z.ZodLiteral<"zh-CN">;
1233
+ title: z.ZodString;
1234
+ locale: z.ZodLiteral<"zh-CN">;
1235
+ linkLabels: z.ZodArray<z.ZodObject<{
1236
+ key: z.ZodString;
1237
+ label: z.ZodString;
1238
+ }, z.core.$strict>>;
1239
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1240
+ key: z.ZodString;
1241
+ type: z.ZodLiteral<"text">;
1242
+ label: z.ZodOptional<z.ZodString>;
1243
+ value: z.ZodString;
1244
+ }, z.core.$strict>, z.ZodObject<{
1245
+ key: z.ZodString;
1246
+ type: z.ZodLiteral<"fields">;
1247
+ items: z.ZodArray<z.ZodObject<{
1248
+ label: z.ZodString;
1249
+ value: z.ZodString;
1250
+ }, z.core.$strict>>;
1251
+ }, z.core.$strict>], "type">>;
1252
+ bodyRefs: z.ZodArray<z.ZodObject<{
1253
+ key: z.ZodString;
1254
+ label: z.ZodString;
1255
+ }, z.core.$strict>>;
1256
+ footer: z.ZodOptional<z.ZodString>;
1257
+ }, z.core.$strict>], "key">>;
1258
+ channelVariants: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
1259
+ qq: "qq";
1260
+ tg: "tg";
1261
+ wechat: "wechat";
1262
+ lark: "lark";
1263
+ }> & z.core.$partial, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1264
+ key: z.ZodLiteral<"source">;
1265
+ title: z.ZodString;
1266
+ locale: z.ZodLiteral<"und">;
1267
+ linkLabels: z.ZodArray<z.ZodObject<{
1268
+ key: z.ZodString;
1269
+ label: z.ZodString;
1270
+ }, z.core.$strict>>;
1271
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1272
+ key: z.ZodString;
1273
+ type: z.ZodLiteral<"text">;
1274
+ label: z.ZodOptional<z.ZodString>;
1275
+ value: z.ZodString;
1276
+ }, z.core.$strict>, z.ZodObject<{
1277
+ key: z.ZodString;
1278
+ type: z.ZodLiteral<"fields">;
1279
+ items: z.ZodArray<z.ZodObject<{
1280
+ label: z.ZodString;
1281
+ value: z.ZodString;
1282
+ }, z.core.$strict>>;
1283
+ }, z.core.$strict>], "type">>;
1284
+ bodyRefs: z.ZodArray<z.ZodObject<{
1285
+ key: z.ZodString;
1286
+ label: z.ZodString;
1287
+ }, z.core.$strict>>;
1288
+ footer: z.ZodOptional<z.ZodString>;
1289
+ }, z.core.$strict>, z.ZodObject<{
1290
+ key: z.ZodLiteral<"zh-CN">;
1291
+ title: z.ZodString;
1292
+ locale: z.ZodLiteral<"zh-CN">;
1293
+ linkLabels: z.ZodArray<z.ZodObject<{
1294
+ key: z.ZodString;
1295
+ label: z.ZodString;
1296
+ }, z.core.$strict>>;
1297
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1298
+ key: z.ZodString;
1299
+ type: z.ZodLiteral<"text">;
1300
+ label: z.ZodOptional<z.ZodString>;
1301
+ value: z.ZodString;
1302
+ }, z.core.$strict>, z.ZodObject<{
1303
+ key: z.ZodString;
1304
+ type: z.ZodLiteral<"fields">;
1305
+ items: z.ZodArray<z.ZodObject<{
1306
+ label: z.ZodString;
1307
+ value: z.ZodString;
1308
+ }, z.core.$strict>>;
1309
+ }, z.core.$strict>], "type">>;
1310
+ bodyRefs: z.ZodArray<z.ZodObject<{
1311
+ key: z.ZodString;
1312
+ label: z.ZodString;
1313
+ }, z.core.$strict>>;
1314
+ footer: z.ZodOptional<z.ZodString>;
1315
+ }, z.core.$strict>], "key">>>>;
1316
+ }, z.core.$strict>;
1317
+ routeKeys: z.ZodArray<z.ZodString>;
1318
+ eventType: z.ZodLiteral<"notification.delivery.requested">;
1319
+ eventId: z.ZodString;
1320
+ producer: z.ZodObject<{
1321
+ key: z.ZodString;
1322
+ environment: z.ZodString;
1323
+ }, z.core.$strict>;
1324
+ occurredAt: z.ZodString;
1325
+ requestedAt: z.ZodString;
1326
+ deliverBy: z.ZodString;
1327
+ subject: z.ZodObject<{
1328
+ type: z.ZodString;
1329
+ id: z.ZodString;
1330
+ revision: z.ZodNumber;
1331
+ }, z.core.$strict>;
1047
1332
  }, z.core.$strict>]>;
1048
1333
  declare const notificationDeliveryReceiptV1Schema: z.ZodObject<{
1049
1334
  contractVersion: z.ZodLiteral<1>;
@@ -2303,4 +2588,4 @@ interface NotificationMessageDeliveryServiceV4 {
2303
2588
  /** Multi-route message delivery; historical requests and receipts remain supported. */
2304
2589
  interface NotificationMessageDeliveryServiceV5 extends NotificationMessageDeliveryServiceV4 {}
2305
2590
  //#endregion
2306
- export { CreatorDraftTaskV1, LocalTaskDeliverResultV1, LocalTaskDeliveryReceiptV1, LocalTaskDeliveryRequest, LocalTaskDeliveryRequestV1, LocalTaskDeliveryServiceV1, LocalTaskGetReceiptResultV1, NotificationDeliverResultV1, NotificationDeliverResultV2, NotificationDeliveryReceiptV1, NotificationDeliveryReceiptV2, NotificationDeliveryReceiptV3, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryRequestV4, NotificationDeliveryRequestV5, NotificationDeliveryRequestV6, NotificationDeliveryRequestV7, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationDeliveryServiceV3, NotificationGetReceiptResultV1, NotificationGetReceiptResultV2, NotificationMessageBody, NotificationMessageDeliveryServiceV4, NotificationMessageDeliveryServiceV5, NotificationMessageReceipt, NotificationMessageVariantKey, NotificationSharedMessageBody, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, localTaskDeliveryContractVersionV1, localTaskDeliveryMaximumDeadlineMillisecondsV1, localTaskDeliveryRequestMaximumUtf8BytesV1, localTaskDeliveryRequestSchema, localTaskDeliveryRequestV1Schema, notificationDeliverResultV1Schema, notificationDeliverResultV2Schema, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryContractVersionV4, notificationDeliveryContractVersionV5, notificationDeliveryContractVersionV7, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryMaximumDeadlineMillisecondsV4, notificationDeliveryMaximumDeadlineMillisecondsV5, notificationDeliveryMaximumDestinationsV1, notificationDeliveryReasonsV1, notificationDeliveryReasonsV2, notificationDeliveryReceiptV1Schema, notificationDeliveryReceiptV2Schema, notificationDeliveryReceiptV3Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestMaximumUtf8BytesV4, notificationDeliveryRequestMaximumUtf8BytesV5, notificationDeliveryRequestSchema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryRequestV4Schema, notificationDeliveryRequestV5Schema, notificationDeliveryRequestV6Schema, notificationDeliveryRequestV7Schema, notificationDeliveryStatesV1, notificationDeliveryStatesV2, notificationDestinationFailureCodesV1, notificationDestinationStatesV1, notificationDestinationStatesV2, notificationGetReceiptResultV1Schema, notificationGetReceiptResultV2Schema, notificationMessageReceiptSchema, notificationMessageVariantKeys, notificationRouteKeys, notificationValidationIssueCodesV1, safeDeliveryCauseSchema };
2591
+ export { CreatorDraftTaskV1, LocalTaskDeliverResultV1, LocalTaskDeliveryReceiptV1, LocalTaskDeliveryRequest, LocalTaskDeliveryRequestV1, LocalTaskDeliveryServiceV1, LocalTaskGetReceiptResultV1, NotificationDeliverResultV1, NotificationDeliverResultV2, NotificationDeliveryChannelKey, NotificationDeliveryReceiptV1, NotificationDeliveryReceiptV2, NotificationDeliveryReceiptV3, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryRequestV4, NotificationDeliveryRequestV5, NotificationDeliveryRequestV6, NotificationDeliveryRequestV7, NotificationDeliveryRequestV8, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationDeliveryServiceV3, NotificationGetReceiptResultV1, NotificationGetReceiptResultV2, NotificationMessageBody, NotificationMessageDeliveryServiceV4, NotificationMessageDeliveryServiceV5, NotificationMessageReceipt, NotificationMessageVariantKey, NotificationMessageVariantsV6, NotificationSharedMessageBody, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, localTaskDeliveryContractVersionV1, localTaskDeliveryMaximumDeadlineMillisecondsV1, localTaskDeliveryRequestMaximumUtf8BytesV1, localTaskDeliveryRequestSchema, localTaskDeliveryRequestV1Schema, notificationDeliverResultV1Schema, notificationDeliverResultV2Schema, notificationDeliveryChannelKeys, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryContractVersionV4, notificationDeliveryContractVersionV5, notificationDeliveryContractVersionV7, notificationDeliveryContractVersionV8, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryMaximumDeadlineMillisecondsV4, notificationDeliveryMaximumDeadlineMillisecondsV5, notificationDeliveryMaximumDestinationsV1, notificationDeliveryReasonsV1, notificationDeliveryReasonsV2, notificationDeliveryReceiptV1Schema, notificationDeliveryReceiptV2Schema, notificationDeliveryReceiptV3Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestMaximumUtf8BytesV4, notificationDeliveryRequestMaximumUtf8BytesV5, notificationDeliveryRequestSchema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryRequestV4Schema, notificationDeliveryRequestV5Schema, notificationDeliveryRequestV6Schema, notificationDeliveryRequestV7Schema, notificationDeliveryRequestV8Schema, notificationDeliveryStatesV1, notificationDeliveryStatesV2, notificationDestinationFailureCodesV1, notificationDestinationStatesV1, notificationDestinationStatesV2, notificationGetReceiptResultV1Schema, notificationGetReceiptResultV2Schema, notificationMessageReceiptSchema, notificationMessageVariantKeys, notificationRouteKeys, notificationValidationIssueCodesV1, safeDeliveryCauseSchema };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{z as e}from"zod";const t=1,n=2,r=3,i=4,a=5,o=7,ee=20,s=32*1024,c=1380*60*1e3,te=s,ne=c,l=s,u=c,d=s,f=c,p=s,m=c,re=1,h=32*1024,ie=10080*60*1e3,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=[...g,`unconfirmed`],y=[..._,`delivery_unconfirmed`],b=[`pending`,`delivering`,`delivered`,`failed`,`expired`],x=[...b,`unconfirmed`],S=[`provider_timeout`,`provider_rate_limited`,`provider_unavailable`,`provider_rejected`,`destination_configuration_unavailable`,`delivery_interrupted`,`retry_exhausted`],C=[`invalid_request`,`request_too_large`,`producer_scope_mismatch`,`route_not_allowed`,`event_identity_conflict`,`route_not_found`,`route_empty`,`delivery_deadline_invalid`],w=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],ae=[`source`,`zh-CN`],oe=new TextEncoder,T=/^[a-z][a-z0-9-]{0,62}$/,se=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,ce=/^[A-Z0-9][\w.:-]{0,127}$/i;function le(e){return[...e].length}function E(t){return e.string().refine(e=>le(e)>0,{message:`too_small`}).refine(e=>le(e)<=t,{message:`too_big`})}const D=e.string().datetime({offset:!0}),O=e.object({key:e.string().regex(T),environment:e.string().regex(T)}).strict(),k=e.object({type:e.string().regex(T),id:e.string().regex(ce),revision:e.number().int().positive()}).strict(),A=e.string().min(1).max(127).regex(se),j=e.object({label:E(48),url:E(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(),M={eventType:e.literal(`notification.delivery.requested`),eventId:e.string().uuid(),producer:O,routeKey:A,occurredAt:D,requestedAt:D,deliverBy:D,subject:k},ue=e.object({contractVersion:e.literal(1),...M,message:e.object({type:e.literal(`link_summary`),title:E(160),summary:E(1200),facts:e.array(e.object({label:E(48),value:E(500)}).strict()).max(10),primaryLink:j,sourceLink:j.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`]}),oe.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const P=ue.superRefine((e,t)=>N(e,t,c,s)),F={title:E(160),summary:E(1200),facts:e.array(e.object({label:E(48),value:E(500)}).strict()).max(10)},de=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()]),fe=e.array(de).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`})}),I=e.object({contractVersion:e.literal(2),...M,message:e.object({type:e.literal(`localized_link_summary`),variants:fe,primaryLink:j,sourceLink:j.optional()}).strict()}).strict().superRefine((e,t)=>N(e,t,ne,te)),pe=e.discriminatedUnion(`type`,[e.object({key:e.string().regex(T),type:e.literal(`text`),label:E(48).optional(),value:E(4e3)}).strict(),e.object({key:e.string().regex(T),type:e.literal(`fields`),items:e.array(e.object({label:E(48),value:E(1200)}).strict()).min(1).max(20)}).strict()]),L=e.array(pe).max(30).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_section_duplicate`})}),R=L.min(1),z=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),title:E(160),sections:R}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),title:E(160),sections:R}).strict()]),B=(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)),ee=r.sections.filter(e=>!n||e.type!==`text`||o.has(e.key)).map(e=>`${e.key}:${e.type}`),s=i.sections.filter(e=>!n||e.type!==`text`||a.has(e.key)).map(e=>`${e.key}:${e.type}`);JSON.stringify(ee)!==JSON.stringify(s)&&t.addIssue({code:`custom`,message:`message_variant_structure_mismatch`,path:[e.indexOf(i),`sections`]})}},me=e.array(z).min(1).max(2).superRefine(B),V=e.object({contractVersion:e.literal(3),...M,message:e.object({type:e.literal(`structured_notification`),variants:me,links:e.array(e.object({key:e.string().regex(T),...j.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(),H=V.superRefine((e,t)=>N(e,t,u,l)),U=e.object({label:E(48).optional(),value:E(d)}).strict(),he=e.discriminatedUnion(`key`,[z.options[0].extend({body:U}),z.options[1].extend({body:U})]),W=V.extend({contractVersion:e.literal(4),message:V.shape.message.extend({variants:e.array(he).min(1).max(2).superRefine(B)})}).superRefine((e,t)=>N(e,t,f,d)),G=e.discriminatedUnion(`key`,[z.options[0].extend({bodyLabel:E(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(T),label:E(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`})})}),z.options[1].extend({bodyLabel:E(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(T),label:E(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`})})})]),ge=e.object({value:E(p)}).strict(),K=e.object({contractVersion:e.literal(5),...M,message:e.object({type:e.literal(`structured_notification`),variants:e.array(G).min(1).max(2).superRefine(B),links:e.array(e.object({key:e.string().regex(T),url:j.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:ge}).strict()}).strict().superRefine((e,t)=>{N(e,t,m,p);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`]})}}),q=e.object({...K.shape,contractVersion:e.literal(6),message:K.shape.message.omit({body:!0}).extend({bodies:e.array(e.object({key:e.string().regex(T),value:E(p)}).strict()).max(2),variants:e.array(e.discriminatedUnion(`key`,[G.options[0].omit({bodyLabel:!0}).extend({sections:L,bodyRefs:e.array(e.object({key:e.string().regex(T),label:E(48)}).strict()).max(2),footer:E(500).optional()}),G.options[1].omit({bodyLabel:!0}).extend({sections:L,bodyRefs:e.array(e.object({key:e.string().regex(T),label:E(48)}).strict()).max(2),footer:E(500).optional()})])).min(1).max(2).superRefine((e,t)=>B(e,t,!0))})}).strict().superRefine(J);function J(e,t){N(e,t,m,p);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`});for(let i of e.message.variants){let e=i.bodyRefs.map(e=>e.key);(new Set(e).size!==e.length||e.some(e=>!n.includes(e)))&&t.addIssue({code:`custom`,message:`message_body_reference_invalid`}),JSON.stringify(i.linkLabels.map(e=>e.key))!==JSON.stringify(r)&&t.addIssue({code:`custom`,message:`message_variant_link_labels_mismatch`})}}const _e=e.array(A).min(1).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`route_key_duplicate`})}),{routeKey:ve,...ye}=q.shape,be=q.shape.message,xe=e.object({...ye,contractVersion:e.literal(7),routeKeys:_e,message:be}).strict().superRefine(J);function Se(e){return`routeKeys`in e?[...e.routeKeys].sort():[e.routeKey]}const Ce=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:E(h),sourceUrl:j.shape.url.optional()}).strict(),we=e.object({contractVersion:e.literal(1),eventType:e.literal(`local-task.delivery.requested`),eventId:e.string().uuid(),producer:O,routeKey:A,occurredAt:D,requestedAt:D,deliverBy:D,subject:k.extend({type:e.literal(`creator-event`)}),task:Ce}).strict().superRefine((e,t)=>N(e,t,ie,h)),Te=we,Ee=e.union([P,I,H,W,K,q,xe]),De=e.object({destinationKey:e.string().min(1),state:e.enum(b),attempts:e.number().int().min(0).max(4),failureCode:e.enum(S).nullable(),lastAttemptAt:D.nullable(),nextAttemptAt:D.nullable(),leaseExpiresAt:D.nullable()}).strict(),Y=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:O,routeKey:A,subject:k,state:e.enum(g),reason:e.enum(_),terminal:e.boolean(),acceptedAt:D,updatedAt:D,deliverBy:D,terminalAt:D.nullable(),destinations:e.array(De).min(1).max(20)}).strict(),X=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(),Oe=X.extend({cause:X.extend({cause:X.extend({cause:X.optional()}).optional()}).optional()}),ke=De.extend({state:e.enum(x),attempts:e.number().int().min(0),revision:e.number().int().min(0),cause:Oe.nullable(),unconfirmedAt:D.nullable()}),Z=Y.extend({contractVersion:e.literal(2),state:e.enum(v),reason:e.enum(y),revision:e.number().int().min(0),destinations:e.array(ke).min(1).max(20)}),Ae=Z.omit({routeKey:!0}).extend({contractVersion:e.literal(3),routeKeys:_e}),Q=e.union([Y,Z,Ae]),je=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(w)}).strict(),Me=e.object({code:e.literal(`invalid_request`),issues:e.array(je).max(20).optional()}).strict(),Ne=e.object({code:e.enum(C.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([Me,Ne]),Pe=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Y}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),Fe=e.discriminatedUnion(`status`,[e.object({status:e.literal(`found`),receipt:Y}).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()]),Ie=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{re as localTaskDeliveryContractVersionV1,ie as localTaskDeliveryMaximumDeadlineMillisecondsV1,h as localTaskDeliveryRequestMaximumUtf8BytesV1,Te as localTaskDeliveryRequestSchema,we as localTaskDeliveryRequestV1Schema,Pe as notificationDeliverResultV1Schema,Ie as notificationDeliverResultV2Schema,t as notificationDeliveryContractVersionV1,n as notificationDeliveryContractVersionV2,r as notificationDeliveryContractVersionV3,i as notificationDeliveryContractVersionV4,a as notificationDeliveryContractVersionV5,o as notificationDeliveryContractVersionV7,c as notificationDeliveryMaximumDeadlineMillisecondsV1,ne as notificationDeliveryMaximumDeadlineMillisecondsV2,u as notificationDeliveryMaximumDeadlineMillisecondsV3,f as notificationDeliveryMaximumDeadlineMillisecondsV4,m as notificationDeliveryMaximumDeadlineMillisecondsV5,ee as notificationDeliveryMaximumDestinationsV1,_ as notificationDeliveryReasonsV1,y as notificationDeliveryReasonsV2,Y as notificationDeliveryReceiptV1Schema,Z as notificationDeliveryReceiptV2Schema,Ae as notificationDeliveryReceiptV3Schema,C as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,s as notificationDeliveryRequestMaximumUtf8BytesV1,te as notificationDeliveryRequestMaximumUtf8BytesV2,l as notificationDeliveryRequestMaximumUtf8BytesV3,d as notificationDeliveryRequestMaximumUtf8BytesV4,p as notificationDeliveryRequestMaximumUtf8BytesV5,Ee as notificationDeliveryRequestSchema,P as notificationDeliveryRequestV1Schema,I as notificationDeliveryRequestV2Schema,H as notificationDeliveryRequestV3Schema,W as notificationDeliveryRequestV4Schema,K as notificationDeliveryRequestV5Schema,q as notificationDeliveryRequestV6Schema,xe as notificationDeliveryRequestV7Schema,g as notificationDeliveryStatesV1,v as notificationDeliveryStatesV2,S as notificationDestinationFailureCodesV1,b as notificationDestinationStatesV1,x as notificationDestinationStatesV2,Fe as notificationGetReceiptResultV1Schema,Le as notificationGetReceiptResultV2Schema,Q as notificationMessageReceiptSchema,ae as notificationMessageVariantKeys,Se as notificationRouteKeys,w as notificationValidationIssueCodesV1,Oe as safeDeliveryCauseSchema};
1
+ import{z as e}from"zod";const t=1,n=2,r=3,i=4,a=5,o=7,s=8,ee=20,c=32*1024,l=1380*60*1e3,te=c,ne=l,re=c,ie=l,u=c,d=l,f=c,p=l,ae=1,m=32*1024,oe=10080*60*1e3,h=[`pending`,`delivering`,`partial`,`delivered`,`failed`,`expired`],g=[`accepted`,`enqueue_retry_wait`,`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`delivery_deadline_exceeded`,`destination_configuration_unavailable`],se=[...h,`unconfirmed`],_=[...g,`delivery_unconfirmed`],v=[`pending`,`delivering`,`delivered`,`failed`,`expired`],y=[...v,`unconfirmed`],b=[`provider_timeout`,`provider_rate_limited`,`provider_unavailable`,`provider_rejected`,`destination_configuration_unavailable`,`delivery_interrupted`,`retry_exhausted`],x=[`invalid_request`,`request_too_large`,`producer_scope_mismatch`,`route_not_allowed`,`event_identity_conflict`,`route_not_found`,`route_empty`,`delivery_deadline_invalid`],S=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],ce=[`source`,`zh-CN`],C=[`qq`,`tg`,`wechat`,`lark`],le=new TextEncoder,w=/^[a-z][a-z0-9-]{0,62}$/,ue=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,de=/^[A-Z0-9][\w.:-]{0,127}$/i;function fe(e){return[...e].length}function T(t){return e.string().refine(e=>fe(e)>0,{message:`too_small`}).refine(e=>fe(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(de),revision:e.number().int().positive()}).strict(),k=e.string().min(1).max(127).regex(ue),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},pe=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`]}),le.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const N=pe.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)},me=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()]),he=e.array(me).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:he,primaryLink:A,sourceLink:A.optional()}).strict()}).strict().superRefine((e,t)=>M(e,t,ne,te)),ge=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(ge).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`]})}},_e=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:_e,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(),V=B.superRefine((e,t)=>M(e,t,ie,re)),H=e.object({label:T(48).optional(),value:T(u)}).strict(),ve=e.discriminatedUnion(`key`,[R.options[0].extend({body:H}),R.options[1].extend({body:H})]),ye=B.extend({contractVersion:e.literal(4),message:B.shape.message.extend({variants:e.array(ve).min(1).max(2).superRefine(z)})}).superRefine((e,t)=>M(e,t,d,u)),U=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`})})})]),be=e.object({value:T(f)}).strict(),W=e.object({contractVersion:e.literal(5),...j,message:e.object({type:e.literal(`structured_notification`),variants:e.array(U).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:be}).strict()}).strict().superRefine((e,t)=>{M(e,t,p,f);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`]})}}),G=e.object({...W.shape,contractVersion:e.literal(6),message:W.shape.message.omit({body:!0}).extend({bodies:e.array(e.object({key:e.string().regex(w),value:T(f)}).strict()).max(2),variants:e.array(e.discriminatedUnion(`key`,[U.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()}),U.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(K);function K(e,t){M(e,t,p,f);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`}),xe(e.message.variants,n,r,t)}function xe(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 Se=e.array(k).min(1).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`route_key_duplicate`})}),{routeKey:Ce,...we}=G.shape,q=G.shape.message,J=e.object({...we,contractVersion:e.literal(7),routeKeys:Se,message:q}).strict().superRefine(K),Te=e.object({...J.shape,contractVersion:e.literal(8),message:q.extend({channelVariants:e.partialRecord(e.enum(C),q.shape.variants).optional()})}).strict().superRefine((e,t)=>{K(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}),xe(o,r,i,t,s)}});function Ee(e){return`routeKeys`in e?[...e.routeKeys].sort():[e.routeKey]}const De=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(m),sourceUrl:A.shape.url.optional()}).strict(),Oe=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:De}).strict().superRefine((e,t)=>M(e,t,oe,m)),ke=Oe,Ae=e.union([N,F,V,ye,W,G,J,Te]),je=e.object({destinationKey:e.string().min(1),state:e.enum(v),attempts:e.number().int().min(0).max(4),failureCode:e.enum(b).nullable(),lastAttemptAt:E.nullable(),nextAttemptAt:E.nullable(),leaseExpiresAt:E.nullable()}).strict(),Y=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:D,routeKey:k,subject:O,state:e.enum(h),reason:e.enum(g),terminal:e.boolean(),acceptedAt:E,updatedAt:E,deliverBy:E,terminalAt:E.nullable(),destinations:e.array(je).min(1).max(20)}).strict(),X=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(),Me=X.extend({cause:X.extend({cause:X.extend({cause:X.optional()}).optional()}).optional()}),Ne=je.extend({state:e.enum(y),attempts:e.number().int().min(0),revision:e.number().int().min(0),cause:Me.nullable(),unconfirmedAt:E.nullable()}),Z=Y.extend({contractVersion:e.literal(2),state:e.enum(se),reason:e.enum(_),revision:e.number().int().min(0),destinations:e.array(Ne).min(1).max(20)}),Pe=Z.omit({routeKey:!0}).extend({contractVersion:e.literal(3),routeKeys:Se}),Q=e.union([Y,Z,Pe]),Fe=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(S)}).strict(),Ie=e.object({code:e.literal(`invalid_request`),issues:e.array(Fe).max(20).optional()}).strict(),Le=e.object({code:e.enum(x.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([Ie,Le]),Re=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Y}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),ze=e.discriminatedUnion(`status`,[e.object({status:e.literal(`found`),receipt:Y}).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()]),Be=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Q}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),Ve=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{ae as localTaskDeliveryContractVersionV1,oe as localTaskDeliveryMaximumDeadlineMillisecondsV1,m as localTaskDeliveryRequestMaximumUtf8BytesV1,ke as localTaskDeliveryRequestSchema,Oe as localTaskDeliveryRequestV1Schema,Re as notificationDeliverResultV1Schema,Be as notificationDeliverResultV2Schema,C as notificationDeliveryChannelKeys,t as notificationDeliveryContractVersionV1,n as notificationDeliveryContractVersionV2,r as notificationDeliveryContractVersionV3,i as notificationDeliveryContractVersionV4,a as notificationDeliveryContractVersionV5,o as notificationDeliveryContractVersionV7,s as notificationDeliveryContractVersionV8,l as notificationDeliveryMaximumDeadlineMillisecondsV1,ne as notificationDeliveryMaximumDeadlineMillisecondsV2,ie as notificationDeliveryMaximumDeadlineMillisecondsV3,d as notificationDeliveryMaximumDeadlineMillisecondsV4,p as notificationDeliveryMaximumDeadlineMillisecondsV5,ee as notificationDeliveryMaximumDestinationsV1,g as notificationDeliveryReasonsV1,_ as notificationDeliveryReasonsV2,Y as notificationDeliveryReceiptV1Schema,Z as notificationDeliveryReceiptV2Schema,Pe as notificationDeliveryReceiptV3Schema,x as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,c as notificationDeliveryRequestMaximumUtf8BytesV1,te as notificationDeliveryRequestMaximumUtf8BytesV2,re as notificationDeliveryRequestMaximumUtf8BytesV3,u as notificationDeliveryRequestMaximumUtf8BytesV4,f as notificationDeliveryRequestMaximumUtf8BytesV5,Ae as notificationDeliveryRequestSchema,N as notificationDeliveryRequestV1Schema,F as notificationDeliveryRequestV2Schema,V as notificationDeliveryRequestV3Schema,ye as notificationDeliveryRequestV4Schema,W as notificationDeliveryRequestV5Schema,G as notificationDeliveryRequestV6Schema,J as notificationDeliveryRequestV7Schema,Te as notificationDeliveryRequestV8Schema,h as notificationDeliveryStatesV1,se as notificationDeliveryStatesV2,b as notificationDestinationFailureCodesV1,v as notificationDestinationStatesV1,y as notificationDestinationStatesV2,ze as notificationGetReceiptResultV1Schema,Ve as notificationGetReceiptResultV2Schema,Q as notificationMessageReceiptSchema,ce as notificationMessageVariantKeys,Ee as notificationRouteKeys,S as notificationValidationIssueCodesV1,Me as safeDeliveryCauseSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@closerepo/notification-contracts",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {