@closerepo/notification-contracts 1.14.0 → 1.15.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
@@ -22,6 +22,7 @@ declare const notificationDeliveryContractVersionV7: 7;
22
22
  declare const notificationDeliveryContractVersionV8: 8;
23
23
  declare const notificationDeliveryContractVersionV9: 9;
24
24
  declare const notificationDeliveryContractVersionV10: 10;
25
+ declare const notificationDeliveryContractVersionV11: 11;
25
26
  declare const notificationDeliveryMaximumDestinationsV1 = 20;
26
27
  declare const notificationDeliveryRequestMaximumUtf8BytesV1: number;
27
28
  declare const notificationDeliveryMaximumDeadlineMillisecondsV1: number;
@@ -34,6 +35,7 @@ declare const notificationDeliveryMaximumDeadlineMillisecondsV4: number;
34
35
  declare const notificationDeliveryRequestMaximumUtf8BytesV5: number;
35
36
  declare const notificationDeliveryRequestMaximumUtf8BytesV9: number;
36
37
  declare const notificationDeliveryRequestMaximumUtf8BytesV10: number;
38
+ declare const notificationDeliveryRequestMaximumUtf8BytesV11: number;
37
39
  declare const notificationDeliveryMaximumDeadlineMillisecondsV5: number;
38
40
  declare const localTaskDeliveryContractVersionV1: 1;
39
41
  declare const localTaskDeliveryRequestMaximumUtf8BytesV1: number;
@@ -1056,6 +1058,242 @@ declare const notificationDeliveryRequestV10Schema: z.ZodObject<{
1056
1058
  }, z.core.$strict>;
1057
1059
  type NotificationDeliveryRequestV10 = z.infer<typeof notificationDeliveryRequestV10Schema>;
1058
1060
  type NotificationMessageVariantsV10 = NotificationDeliveryRequestV10['message']['variants'];
1061
+ /** Producer-owned delivery formats frozen with each newly generated notification. */
1062
+ declare const notificationChannelFormatsSchema: z.ZodObject<{
1063
+ qq: z.ZodOptional<z.ZodEnum<{
1064
+ auto: "auto";
1065
+ markdown: "markdown";
1066
+ plain_text: "plain_text";
1067
+ }>>;
1068
+ tg: z.ZodOptional<z.ZodEnum<{
1069
+ auto: "auto";
1070
+ plain_text: "plain_text";
1071
+ rich_text: "rich_text";
1072
+ }>>;
1073
+ }, z.core.$strict>;
1074
+ type NotificationChannelFormats = z.infer<typeof notificationChannelFormatsSchema>;
1075
+ /** V11 freezes channel presentation while retaining shared body and link identities. */
1076
+ declare const notificationDeliveryRequestV11Schema: z.ZodObject<{
1077
+ contractVersion: z.ZodLiteral<11>;
1078
+ message: z.ZodObject<{
1079
+ type: z.ZodLiteral<"structured_notification">;
1080
+ links: z.ZodArray<z.ZodObject<{
1081
+ key: z.ZodString;
1082
+ url: z.ZodString;
1083
+ }, z.core.$strict>>;
1084
+ bodies: z.ZodArray<z.ZodObject<{
1085
+ key: z.ZodString;
1086
+ value: z.ZodString;
1087
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1088
+ offset: z.ZodNumber;
1089
+ length: z.ZodNumber;
1090
+ }, z.core.$strict>>>;
1091
+ }, z.core.$strict>>;
1092
+ variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1093
+ key: z.ZodLiteral<"source">;
1094
+ title: z.ZodString;
1095
+ locale: z.ZodLiteral<"und">;
1096
+ linkLabels: z.ZodArray<z.ZodObject<{
1097
+ key: z.ZodString;
1098
+ label: z.ZodString;
1099
+ }, z.core.$strict>>;
1100
+ bodyRefs: z.ZodArray<z.ZodObject<{
1101
+ key: z.ZodString;
1102
+ label: z.ZodOptional<z.ZodString>;
1103
+ }, z.core.$strict>>;
1104
+ footer: z.ZodOptional<z.ZodString>;
1105
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1106
+ offset: z.ZodNumber;
1107
+ length: z.ZodNumber;
1108
+ }, z.core.$strict>>>;
1109
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1110
+ key: z.ZodString;
1111
+ type: z.ZodLiteral<"text">;
1112
+ label: z.ZodOptional<z.ZodString>;
1113
+ value: z.ZodString;
1114
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1115
+ offset: z.ZodNumber;
1116
+ length: z.ZodNumber;
1117
+ }, z.core.$strict>>>;
1118
+ }, z.core.$strict>, z.ZodObject<{
1119
+ key: z.ZodString;
1120
+ type: z.ZodLiteral<"fields">;
1121
+ items: z.ZodArray<z.ZodObject<{
1122
+ label: z.ZodString;
1123
+ value: z.ZodString;
1124
+ }, z.core.$strict>>;
1125
+ }, z.core.$strict>], "type">>;
1126
+ }, z.core.$strict>, z.ZodObject<{
1127
+ key: z.ZodLiteral<"zh-CN">;
1128
+ title: z.ZodString;
1129
+ locale: z.ZodLiteral<"zh-CN">;
1130
+ linkLabels: z.ZodArray<z.ZodObject<{
1131
+ key: z.ZodString;
1132
+ label: z.ZodString;
1133
+ }, z.core.$strict>>;
1134
+ bodyRefs: z.ZodArray<z.ZodObject<{
1135
+ key: z.ZodString;
1136
+ label: z.ZodOptional<z.ZodString>;
1137
+ }, z.core.$strict>>;
1138
+ footer: z.ZodOptional<z.ZodString>;
1139
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1140
+ offset: z.ZodNumber;
1141
+ length: z.ZodNumber;
1142
+ }, z.core.$strict>>>;
1143
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1144
+ key: z.ZodString;
1145
+ type: z.ZodLiteral<"text">;
1146
+ label: z.ZodOptional<z.ZodString>;
1147
+ value: z.ZodString;
1148
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1149
+ offset: z.ZodNumber;
1150
+ length: z.ZodNumber;
1151
+ }, z.core.$strict>>>;
1152
+ }, z.core.$strict>, z.ZodObject<{
1153
+ key: z.ZodString;
1154
+ type: z.ZodLiteral<"fields">;
1155
+ items: z.ZodArray<z.ZodObject<{
1156
+ label: z.ZodString;
1157
+ value: z.ZodString;
1158
+ }, z.core.$strict>>;
1159
+ }, z.core.$strict>], "type">>;
1160
+ }, z.core.$strict>], "key">>;
1161
+ channelVariants: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
1162
+ qq: "qq";
1163
+ tg: "tg";
1164
+ wechat: "wechat";
1165
+ lark: "lark";
1166
+ }> & z.core.$partial, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1167
+ key: z.ZodLiteral<"source">;
1168
+ title: z.ZodString;
1169
+ locale: z.ZodLiteral<"und">;
1170
+ linkLabels: z.ZodArray<z.ZodObject<{
1171
+ key: z.ZodString;
1172
+ label: z.ZodString;
1173
+ }, z.core.$strict>>;
1174
+ bodyRefs: z.ZodArray<z.ZodObject<{
1175
+ key: z.ZodString;
1176
+ label: z.ZodOptional<z.ZodString>;
1177
+ }, z.core.$strict>>;
1178
+ footer: z.ZodOptional<z.ZodString>;
1179
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1180
+ offset: z.ZodNumber;
1181
+ length: z.ZodNumber;
1182
+ }, z.core.$strict>>>;
1183
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1184
+ key: z.ZodString;
1185
+ type: z.ZodLiteral<"text">;
1186
+ label: z.ZodOptional<z.ZodString>;
1187
+ value: z.ZodString;
1188
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1189
+ offset: z.ZodNumber;
1190
+ length: z.ZodNumber;
1191
+ }, z.core.$strict>>>;
1192
+ }, z.core.$strict>, z.ZodObject<{
1193
+ key: z.ZodString;
1194
+ type: z.ZodLiteral<"fields">;
1195
+ items: z.ZodArray<z.ZodObject<{
1196
+ label: z.ZodString;
1197
+ value: z.ZodString;
1198
+ }, z.core.$strict>>;
1199
+ }, z.core.$strict>], "type">>;
1200
+ }, z.core.$strict>, z.ZodObject<{
1201
+ key: z.ZodLiteral<"zh-CN">;
1202
+ title: z.ZodString;
1203
+ locale: z.ZodLiteral<"zh-CN">;
1204
+ linkLabels: z.ZodArray<z.ZodObject<{
1205
+ key: z.ZodString;
1206
+ label: z.ZodString;
1207
+ }, z.core.$strict>>;
1208
+ bodyRefs: z.ZodArray<z.ZodObject<{
1209
+ key: z.ZodString;
1210
+ label: z.ZodOptional<z.ZodString>;
1211
+ }, z.core.$strict>>;
1212
+ footer: z.ZodOptional<z.ZodString>;
1213
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1214
+ offset: z.ZodNumber;
1215
+ length: z.ZodNumber;
1216
+ }, z.core.$strict>>>;
1217
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1218
+ key: z.ZodString;
1219
+ type: z.ZodLiteral<"text">;
1220
+ label: z.ZodOptional<z.ZodString>;
1221
+ value: z.ZodString;
1222
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1223
+ offset: z.ZodNumber;
1224
+ length: z.ZodNumber;
1225
+ }, z.core.$strict>>>;
1226
+ }, z.core.$strict>, z.ZodObject<{
1227
+ key: z.ZodString;
1228
+ type: z.ZodLiteral<"fields">;
1229
+ items: z.ZodArray<z.ZodObject<{
1230
+ label: z.ZodString;
1231
+ value: z.ZodString;
1232
+ }, z.core.$strict>>;
1233
+ }, z.core.$strict>], "type">>;
1234
+ }, z.core.$strict>], "key">>>>;
1235
+ channelFormats: z.ZodOptional<z.ZodObject<{
1236
+ qq: z.ZodOptional<z.ZodEnum<{
1237
+ auto: "auto";
1238
+ markdown: "markdown";
1239
+ plain_text: "plain_text";
1240
+ }>>;
1241
+ tg: z.ZodOptional<z.ZodEnum<{
1242
+ auto: "auto";
1243
+ plain_text: "plain_text";
1244
+ rich_text: "rich_text";
1245
+ }>>;
1246
+ }, z.core.$strict>>;
1247
+ channelBodies: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
1248
+ qq: "qq";
1249
+ tg: "tg";
1250
+ wechat: "wechat";
1251
+ lark: "lark";
1252
+ }> & z.core.$partial, z.ZodArray<z.ZodObject<{
1253
+ key: z.ZodString;
1254
+ value: z.ZodString;
1255
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1256
+ offset: z.ZodNumber;
1257
+ length: z.ZodNumber;
1258
+ }, z.core.$strict>>>;
1259
+ }, z.core.$strict>>>>;
1260
+ channelLinks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
1261
+ qq: "qq";
1262
+ tg: "tg";
1263
+ wechat: "wechat";
1264
+ lark: "lark";
1265
+ }> & z.core.$partial, z.ZodArray<z.ZodObject<{
1266
+ key: z.ZodString;
1267
+ url: z.ZodString;
1268
+ }, z.core.$strict>>>>;
1269
+ }, z.core.$strict>;
1270
+ audience: z.ZodOptional<z.ZodObject<{
1271
+ topics: z.ZodArray<z.ZodString>;
1272
+ }, z.core.$strict>>;
1273
+ browserMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
1274
+ locale: z.ZodString;
1275
+ contentLocale: z.ZodString;
1276
+ title: z.ZodString;
1277
+ body: z.ZodString;
1278
+ url: z.ZodString;
1279
+ }, z.core.$strict>>>;
1280
+ routeKeys: z.ZodArray<z.ZodString>;
1281
+ eventType: z.ZodLiteral<"notification.delivery.requested">;
1282
+ eventId: z.ZodString;
1283
+ producer: z.ZodObject<{
1284
+ key: z.ZodString;
1285
+ environment: z.ZodString;
1286
+ }, z.core.$strict>;
1287
+ occurredAt: z.ZodString;
1288
+ requestedAt: z.ZodString;
1289
+ deliverBy: z.ZodString;
1290
+ subject: z.ZodObject<{
1291
+ type: z.ZodString;
1292
+ id: z.ZodString;
1293
+ revision: z.ZodNumber;
1294
+ }, z.core.$strict>;
1295
+ }, z.core.$strict>;
1296
+ type NotificationDeliveryRequestV11 = z.infer<typeof notificationDeliveryRequestV11Schema>;
1059
1297
  /** Reads routing facts from current envelopes and historical single-route records. */
1060
1298
  declare function notificationRouteKeys(value: {
1061
1299
  routeKey: string;
@@ -2036,6 +2274,225 @@ declare const notificationDeliveryRequestSchema: z.ZodUnion<readonly [z.ZodObjec
2036
2274
  id: z.ZodString;
2037
2275
  revision: z.ZodNumber;
2038
2276
  }, z.core.$strict>;
2277
+ }, z.core.$strict>, z.ZodObject<{
2278
+ contractVersion: z.ZodLiteral<11>;
2279
+ message: z.ZodObject<{
2280
+ type: z.ZodLiteral<"structured_notification">;
2281
+ links: z.ZodArray<z.ZodObject<{
2282
+ key: z.ZodString;
2283
+ url: z.ZodString;
2284
+ }, z.core.$strict>>;
2285
+ bodies: z.ZodArray<z.ZodObject<{
2286
+ key: z.ZodString;
2287
+ value: z.ZodString;
2288
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2289
+ offset: z.ZodNumber;
2290
+ length: z.ZodNumber;
2291
+ }, z.core.$strict>>>;
2292
+ }, z.core.$strict>>;
2293
+ variants: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2294
+ key: z.ZodLiteral<"source">;
2295
+ title: z.ZodString;
2296
+ locale: z.ZodLiteral<"und">;
2297
+ linkLabels: z.ZodArray<z.ZodObject<{
2298
+ key: z.ZodString;
2299
+ label: z.ZodString;
2300
+ }, z.core.$strict>>;
2301
+ bodyRefs: z.ZodArray<z.ZodObject<{
2302
+ key: z.ZodString;
2303
+ label: z.ZodOptional<z.ZodString>;
2304
+ }, z.core.$strict>>;
2305
+ footer: z.ZodOptional<z.ZodString>;
2306
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2307
+ offset: z.ZodNumber;
2308
+ length: z.ZodNumber;
2309
+ }, z.core.$strict>>>;
2310
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2311
+ key: z.ZodString;
2312
+ type: z.ZodLiteral<"text">;
2313
+ label: z.ZodOptional<z.ZodString>;
2314
+ value: z.ZodString;
2315
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2316
+ offset: z.ZodNumber;
2317
+ length: z.ZodNumber;
2318
+ }, z.core.$strict>>>;
2319
+ }, z.core.$strict>, z.ZodObject<{
2320
+ key: z.ZodString;
2321
+ type: z.ZodLiteral<"fields">;
2322
+ items: z.ZodArray<z.ZodObject<{
2323
+ label: z.ZodString;
2324
+ value: z.ZodString;
2325
+ }, z.core.$strict>>;
2326
+ }, z.core.$strict>], "type">>;
2327
+ }, z.core.$strict>, z.ZodObject<{
2328
+ key: z.ZodLiteral<"zh-CN">;
2329
+ title: z.ZodString;
2330
+ locale: z.ZodLiteral<"zh-CN">;
2331
+ linkLabels: z.ZodArray<z.ZodObject<{
2332
+ key: z.ZodString;
2333
+ label: z.ZodString;
2334
+ }, z.core.$strict>>;
2335
+ bodyRefs: z.ZodArray<z.ZodObject<{
2336
+ key: z.ZodString;
2337
+ label: z.ZodOptional<z.ZodString>;
2338
+ }, z.core.$strict>>;
2339
+ footer: z.ZodOptional<z.ZodString>;
2340
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2341
+ offset: z.ZodNumber;
2342
+ length: z.ZodNumber;
2343
+ }, z.core.$strict>>>;
2344
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2345
+ key: z.ZodString;
2346
+ type: z.ZodLiteral<"text">;
2347
+ label: z.ZodOptional<z.ZodString>;
2348
+ value: z.ZodString;
2349
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2350
+ offset: z.ZodNumber;
2351
+ length: z.ZodNumber;
2352
+ }, z.core.$strict>>>;
2353
+ }, z.core.$strict>, z.ZodObject<{
2354
+ key: z.ZodString;
2355
+ type: z.ZodLiteral<"fields">;
2356
+ items: z.ZodArray<z.ZodObject<{
2357
+ label: z.ZodString;
2358
+ value: z.ZodString;
2359
+ }, z.core.$strict>>;
2360
+ }, z.core.$strict>], "type">>;
2361
+ }, z.core.$strict>], "key">>;
2362
+ channelVariants: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
2363
+ qq: "qq";
2364
+ tg: "tg";
2365
+ wechat: "wechat";
2366
+ lark: "lark";
2367
+ }> & z.core.$partial, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2368
+ key: z.ZodLiteral<"source">;
2369
+ title: z.ZodString;
2370
+ locale: z.ZodLiteral<"und">;
2371
+ linkLabels: z.ZodArray<z.ZodObject<{
2372
+ key: z.ZodString;
2373
+ label: z.ZodString;
2374
+ }, z.core.$strict>>;
2375
+ bodyRefs: z.ZodArray<z.ZodObject<{
2376
+ key: z.ZodString;
2377
+ label: z.ZodOptional<z.ZodString>;
2378
+ }, z.core.$strict>>;
2379
+ footer: z.ZodOptional<z.ZodString>;
2380
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2381
+ offset: z.ZodNumber;
2382
+ length: z.ZodNumber;
2383
+ }, z.core.$strict>>>;
2384
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2385
+ key: z.ZodString;
2386
+ type: z.ZodLiteral<"text">;
2387
+ label: z.ZodOptional<z.ZodString>;
2388
+ value: z.ZodString;
2389
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2390
+ offset: z.ZodNumber;
2391
+ length: z.ZodNumber;
2392
+ }, z.core.$strict>>>;
2393
+ }, z.core.$strict>, z.ZodObject<{
2394
+ key: z.ZodString;
2395
+ type: z.ZodLiteral<"fields">;
2396
+ items: z.ZodArray<z.ZodObject<{
2397
+ label: z.ZodString;
2398
+ value: z.ZodString;
2399
+ }, z.core.$strict>>;
2400
+ }, z.core.$strict>], "type">>;
2401
+ }, z.core.$strict>, z.ZodObject<{
2402
+ key: z.ZodLiteral<"zh-CN">;
2403
+ title: z.ZodString;
2404
+ locale: z.ZodLiteral<"zh-CN">;
2405
+ linkLabels: z.ZodArray<z.ZodObject<{
2406
+ key: z.ZodString;
2407
+ label: z.ZodString;
2408
+ }, z.core.$strict>>;
2409
+ bodyRefs: z.ZodArray<z.ZodObject<{
2410
+ key: z.ZodString;
2411
+ label: z.ZodOptional<z.ZodString>;
2412
+ }, z.core.$strict>>;
2413
+ footer: z.ZodOptional<z.ZodString>;
2414
+ titleQuotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2415
+ offset: z.ZodNumber;
2416
+ length: z.ZodNumber;
2417
+ }, z.core.$strict>>>;
2418
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2419
+ key: z.ZodString;
2420
+ type: z.ZodLiteral<"text">;
2421
+ label: z.ZodOptional<z.ZodString>;
2422
+ value: z.ZodString;
2423
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2424
+ offset: z.ZodNumber;
2425
+ length: z.ZodNumber;
2426
+ }, z.core.$strict>>>;
2427
+ }, z.core.$strict>, z.ZodObject<{
2428
+ key: z.ZodString;
2429
+ type: z.ZodLiteral<"fields">;
2430
+ items: z.ZodArray<z.ZodObject<{
2431
+ label: z.ZodString;
2432
+ value: z.ZodString;
2433
+ }, z.core.$strict>>;
2434
+ }, z.core.$strict>], "type">>;
2435
+ }, z.core.$strict>], "key">>>>;
2436
+ channelFormats: z.ZodOptional<z.ZodObject<{
2437
+ qq: z.ZodOptional<z.ZodEnum<{
2438
+ auto: "auto";
2439
+ markdown: "markdown";
2440
+ plain_text: "plain_text";
2441
+ }>>;
2442
+ tg: z.ZodOptional<z.ZodEnum<{
2443
+ auto: "auto";
2444
+ plain_text: "plain_text";
2445
+ rich_text: "rich_text";
2446
+ }>>;
2447
+ }, z.core.$strict>>;
2448
+ channelBodies: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
2449
+ qq: "qq";
2450
+ tg: "tg";
2451
+ wechat: "wechat";
2452
+ lark: "lark";
2453
+ }> & z.core.$partial, z.ZodArray<z.ZodObject<{
2454
+ key: z.ZodString;
2455
+ value: z.ZodString;
2456
+ quotes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2457
+ offset: z.ZodNumber;
2458
+ length: z.ZodNumber;
2459
+ }, z.core.$strict>>>;
2460
+ }, z.core.$strict>>>>;
2461
+ channelLinks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
2462
+ qq: "qq";
2463
+ tg: "tg";
2464
+ wechat: "wechat";
2465
+ lark: "lark";
2466
+ }> & z.core.$partial, z.ZodArray<z.ZodObject<{
2467
+ key: z.ZodString;
2468
+ url: z.ZodString;
2469
+ }, z.core.$strict>>>>;
2470
+ }, z.core.$strict>;
2471
+ audience: z.ZodOptional<z.ZodObject<{
2472
+ topics: z.ZodArray<z.ZodString>;
2473
+ }, z.core.$strict>>;
2474
+ browserMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
2475
+ locale: z.ZodString;
2476
+ contentLocale: z.ZodString;
2477
+ title: z.ZodString;
2478
+ body: z.ZodString;
2479
+ url: z.ZodString;
2480
+ }, z.core.$strict>>>;
2481
+ routeKeys: z.ZodArray<z.ZodString>;
2482
+ eventType: z.ZodLiteral<"notification.delivery.requested">;
2483
+ eventId: z.ZodString;
2484
+ producer: z.ZodObject<{
2485
+ key: z.ZodString;
2486
+ environment: z.ZodString;
2487
+ }, z.core.$strict>;
2488
+ occurredAt: z.ZodString;
2489
+ requestedAt: z.ZodString;
2490
+ deliverBy: z.ZodString;
2491
+ subject: z.ZodObject<{
2492
+ type: z.ZodString;
2493
+ id: z.ZodString;
2494
+ revision: z.ZodNumber;
2495
+ }, z.core.$strict>;
2039
2496
  }, z.core.$strict>]>;
2040
2497
  declare const notificationDeliveryReceiptV1Schema: z.ZodObject<{
2041
2498
  contractVersion: z.ZodLiteral<1>;
@@ -3295,4 +3752,4 @@ interface NotificationMessageDeliveryServiceV4 {
3295
3752
  /** Multi-route message delivery; historical requests and receipts remain supported. */
3296
3753
  interface NotificationMessageDeliveryServiceV5 extends NotificationMessageDeliveryServiceV4 {}
3297
3754
  //#endregion
3298
- export { CreatorDraftTaskV1, LocalTaskDeliverResultV1, LocalTaskDeliveryReceiptV1, LocalTaskDeliveryRequest, LocalTaskDeliveryRequestV1, LocalTaskDeliveryServiceV1, LocalTaskGetReceiptResultV1, NotificationBrowserMessage, type NotificationBrowserPayload, NotificationDeliverResultV1, NotificationDeliverResultV2, NotificationDeliveryChannelKey, NotificationDeliveryReceiptV1, NotificationDeliveryReceiptV2, NotificationDeliveryReceiptV3, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV10, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryRequestV4, NotificationDeliveryRequestV5, NotificationDeliveryRequestV6, NotificationDeliveryRequestV7, NotificationDeliveryRequestV8, NotificationDeliveryRequestV9, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationDeliveryServiceV3, NotificationGetReceiptResultV1, NotificationGetReceiptResultV2, NotificationMessageBody, NotificationMessageDeliveryServiceV4, NotificationMessageDeliveryServiceV5, NotificationMessageReceipt, NotificationMessageVariantKey, NotificationMessageVariantsV10, NotificationMessageVariantsV6, NotificationQuoteRange, NotificationSharedMessageBody, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, localTaskDeliveryContractVersionV1, localTaskDeliveryMaximumDeadlineMillisecondsV1, localTaskDeliveryRequestMaximumUtf8BytesV1, localTaskDeliveryRequestSchema, localTaskDeliveryRequestV1Schema, notificationBrowserMessageSchema, notificationBrowserPayloadSchema, notificationDeliverResultV1Schema, notificationDeliverResultV2Schema, notificationDeliveryChannelKeys, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV10, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryContractVersionV4, notificationDeliveryContractVersionV5, notificationDeliveryContractVersionV7, notificationDeliveryContractVersionV8, notificationDeliveryContractVersionV9, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryMaximumDeadlineMillisecondsV4, notificationDeliveryMaximumDeadlineMillisecondsV5, notificationDeliveryMaximumDestinationsV1, notificationDeliveryReasonsV1, notificationDeliveryReasonsV2, notificationDeliveryReceiptV1Schema, notificationDeliveryReceiptV2Schema, notificationDeliveryReceiptV3Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV10, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestMaximumUtf8BytesV4, notificationDeliveryRequestMaximumUtf8BytesV5, notificationDeliveryRequestMaximumUtf8BytesV9, notificationDeliveryRequestSchema, notificationDeliveryRequestV10Schema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryRequestV4Schema, notificationDeliveryRequestV5Schema, notificationDeliveryRequestV6Schema, notificationDeliveryRequestV7Schema, notificationDeliveryRequestV8Schema, notificationDeliveryRequestV9Schema, notificationDeliveryStatesV1, notificationDeliveryStatesV2, notificationDestinationFailureCodesV1, notificationDestinationStatesV1, notificationDestinationStatesV2, notificationGetReceiptResultV1Schema, notificationGetReceiptResultV2Schema, notificationMessageReceiptSchema, notificationMessageVariantKeys, notificationQuoteRangeSchema, notificationRouteKeys, notificationValidationIssueCodesV1, safeDeliveryCauseSchema };
3755
+ export { CreatorDraftTaskV1, LocalTaskDeliverResultV1, LocalTaskDeliveryReceiptV1, LocalTaskDeliveryRequest, LocalTaskDeliveryRequestV1, LocalTaskDeliveryServiceV1, LocalTaskGetReceiptResultV1, NotificationBrowserMessage, type NotificationBrowserPayload, NotificationChannelFormats, NotificationDeliverResultV1, NotificationDeliverResultV2, NotificationDeliveryChannelKey, NotificationDeliveryReceiptV1, NotificationDeliveryReceiptV2, NotificationDeliveryReceiptV3, NotificationDeliveryRejectionV1, NotificationDeliveryRequest, NotificationDeliveryRequestV1, NotificationDeliveryRequestV10, NotificationDeliveryRequestV11, NotificationDeliveryRequestV2, NotificationDeliveryRequestV3, NotificationDeliveryRequestV4, NotificationDeliveryRequestV5, NotificationDeliveryRequestV6, NotificationDeliveryRequestV7, NotificationDeliveryRequestV8, NotificationDeliveryRequestV9, NotificationDeliveryServiceV1, NotificationDeliveryServiceV2, NotificationDeliveryServiceV3, NotificationGetReceiptResultV1, NotificationGetReceiptResultV2, NotificationMessageBody, NotificationMessageDeliveryServiceV4, NotificationMessageDeliveryServiceV5, NotificationMessageReceipt, NotificationMessageVariantKey, NotificationMessageVariantsV10, NotificationMessageVariantsV6, NotificationQuoteRange, NotificationSharedMessageBody, NotificationStructuredMessageSection, NotificationStructuredMessageVariant, localTaskDeliveryContractVersionV1, localTaskDeliveryMaximumDeadlineMillisecondsV1, localTaskDeliveryRequestMaximumUtf8BytesV1, localTaskDeliveryRequestSchema, localTaskDeliveryRequestV1Schema, notificationBrowserMessageSchema, notificationBrowserPayloadSchema, notificationChannelFormatsSchema, notificationDeliverResultV1Schema, notificationDeliverResultV2Schema, notificationDeliveryChannelKeys, notificationDeliveryContractVersionV1, notificationDeliveryContractVersionV10, notificationDeliveryContractVersionV11, notificationDeliveryContractVersionV2, notificationDeliveryContractVersionV3, notificationDeliveryContractVersionV4, notificationDeliveryContractVersionV5, notificationDeliveryContractVersionV7, notificationDeliveryContractVersionV8, notificationDeliveryContractVersionV9, notificationDeliveryMaximumDeadlineMillisecondsV1, notificationDeliveryMaximumDeadlineMillisecondsV2, notificationDeliveryMaximumDeadlineMillisecondsV3, notificationDeliveryMaximumDeadlineMillisecondsV4, notificationDeliveryMaximumDeadlineMillisecondsV5, notificationDeliveryMaximumDestinationsV1, notificationDeliveryReasonsV1, notificationDeliveryReasonsV2, notificationDeliveryReceiptV1Schema, notificationDeliveryReceiptV2Schema, notificationDeliveryReceiptV3Schema, notificationDeliveryRejectionCodesV1, notificationDeliveryRejectionV1Schema, notificationDeliveryRequestMaximumUtf8BytesV1, notificationDeliveryRequestMaximumUtf8BytesV10, notificationDeliveryRequestMaximumUtf8BytesV11, notificationDeliveryRequestMaximumUtf8BytesV2, notificationDeliveryRequestMaximumUtf8BytesV3, notificationDeliveryRequestMaximumUtf8BytesV4, notificationDeliveryRequestMaximumUtf8BytesV5, notificationDeliveryRequestMaximumUtf8BytesV9, notificationDeliveryRequestSchema, notificationDeliveryRequestV10Schema, notificationDeliveryRequestV11Schema, notificationDeliveryRequestV1Schema, notificationDeliveryRequestV2Schema, notificationDeliveryRequestV3Schema, notificationDeliveryRequestV4Schema, notificationDeliveryRequestV5Schema, notificationDeliveryRequestV6Schema, notificationDeliveryRequestV7Schema, notificationDeliveryRequestV8Schema, notificationDeliveryRequestV9Schema, notificationDeliveryStatesV1, notificationDeliveryStatesV2, notificationDestinationFailureCodesV1, notificationDestinationStatesV1, notificationDestinationStatesV2, notificationGetReceiptResultV1Schema, notificationGetReceiptResultV2Schema, notificationMessageReceiptSchema, notificationMessageVariantKeys, notificationQuoteRangeSchema, notificationRouteKeys, notificationValidationIssueCodesV1, safeDeliveryCauseSchema };
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=10,re=20,c=32*1024,l=1380*60*1e3,ie=c,u=l,ae=c,oe=l,d=c,se=l,f=c,p=64*1024,ce=p,m=l,le=1,h=32*1024,ue=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`],de=[...g,`unconfirmed`],fe=[..._,`delivery_unconfirmed`],v=[`pending`,`delivering`,`delivered`,`failed`,`expired`],pe=[...v,`unconfirmed`],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`],me=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],he=[`source`,`zh-CN`],x=[`qq`,`tg`,`wechat`,`lark`],ge=new TextEncoder,S=/^[a-z][a-z0-9-]{0,62}$/,_e=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,ve=/^[A-Z0-9][\w.:-]{0,127}$/i;function ye(e){return[...e].length}function C(t){return e.string().refine(e=>ye(e)>0,{message:`too_small`}).refine(e=>ye(e)<=t,{message:`too_big`})}const w=e.string().datetime({offset:!0}),T=e.object({key:e.string().regex(S),environment:e.string().regex(S)}).strict(),E=e.object({type:e.string().regex(S),id:e.string().regex(ve),revision:e.number().int().positive()}).strict(),D=e.string().min(1).max(127).regex(_e),O=e.object({label:C(48),url:C(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(),k={eventType:e.literal(`notification.delivery.requested`),eventId:e.string().uuid(),producer:T,routeKey:D,occurredAt:w,requestedAt:w,deliverBy:w,subject:E},be=e.object({contractVersion:e.literal(1),...k,message:e.object({type:e.literal(`link_summary`),title:C(160),summary:C(1200),facts:e.array(e.object({label:C(48),value:C(500)}).strict()).max(10),primaryLink:O,sourceLink:O.optional()}).strict()}).strict();function A(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`]}),ge.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const xe=be.superRefine((e,t)=>A(e,t,l,c)),Se={title:C(160),summary:C(1200),facts:e.array(e.object({label:C(48),value:C(500)}).strict()).max(10)},Ce=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),...Se}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),...Se}).strict()]),we=e.array(Ce).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`})}),Te=e.object({contractVersion:e.literal(2),...k,message:e.object({type:e.literal(`localized_link_summary`),variants:we,primaryLink:O,sourceLink:O.optional()}).strict()}).strict().superRefine((e,t)=>A(e,t,u,ie)),j=e.discriminatedUnion(`type`,[e.object({key:e.string().regex(S),type:e.literal(`text`),label:C(48).optional(),value:C(4e3)}).strict(),e.object({key:e.string().regex(S),type:e.literal(`fields`),items:e.array(e.object({label:C(48),value:C(1200)}).strict()).min(1).max(20)}).strict()]),M=e.array(j).max(30).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_section_duplicate`})}),N=M.min(1),P=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),title:C(160),sections:N}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),title:C(160),sections:N}).strict()]),F=(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`]})}},Ee=e.array(P).min(1).max(2).superRefine(F),I=e.object({contractVersion:e.literal(3),...k,message:e.object({type:e.literal(`structured_notification`),variants:Ee,links:e.array(e.object({key:e.string().regex(S),...O.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(),L=I.superRefine((e,t)=>A(e,t,oe,ae)),De=e.object({label:C(48).optional(),value:C(d)}).strict(),Oe=e.discriminatedUnion(`key`,[P.options[0].extend({body:De}),P.options[1].extend({body:De})]),R=I.extend({contractVersion:e.literal(4),message:I.shape.message.extend({variants:e.array(Oe).min(1).max(2).superRefine(F)})}).superRefine((e,t)=>A(e,t,se,d)),z=e.discriminatedUnion(`key`,[P.options[0].extend({bodyLabel:C(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(S),label:C(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`})})}),P.options[1].extend({bodyLabel:C(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(S),label:C(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`})})})]),ke=e.object({value:C(f)}).strict(),B=e.object({contractVersion:e.literal(5),...k,message:e.object({type:e.literal(`structured_notification`),variants:e.array(z).min(1).max(2).superRefine(F),links:e.array(e.object({key:e.string().regex(S),url:O.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:ke}).strict()}).strict().superRefine((e,t)=>{A(e,t,m,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`]})}}),V=e.object({...B.shape,contractVersion:e.literal(6),message:B.shape.message.omit({body:!0}).extend({bodies:e.array(e.object({key:e.string().regex(S),value:C(f)}).strict()).max(2),variants:e.array(e.discriminatedUnion(`key`,[z.options[0].omit({bodyLabel:!0}).extend({sections:M,bodyRefs:e.array(e.object({key:e.string().regex(S),label:C(48).optional()}).strict()).max(2),footer:C(500).optional()}),z.options[1].omit({bodyLabel:!0}).extend({sections:M,bodyRefs:e.array(e.object({key:e.string().regex(S),label:C(48).optional()}).strict()).max(2),footer:C(500).optional()})])).min(1).max(2).superRefine((e,t)=>F(e,t,!0))})}).strict().superRefine(H);function H(e,t){A(e,t,m,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`}),Ae(e.message.variants,n,r,t)}function Ae(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 je=e.array(D).min(1).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`route_key_duplicate`})}),{routeKey:Me,...Ne}=V.shape,U=V.shape.message,W=e.object({...Ne,contractVersion:e.literal(7),routeKeys:je,message:U}).strict().superRefine(H),G=e.object({...W.shape,contractVersion:e.literal(8),message:U.extend({channelVariants:e.partialRecord(e.enum(x),U.shape.variants).optional()})}).strict().superRefine((e,t)=>{H(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 x){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}),Ae(o,r,i,t,s)}}),Pe=e.object({locale:C(35),contentLocale:C(35),title:C(160).refine(e=>e.trim().length>0,`browser_message_title_blank`),body:e.string().max(8192),url:O.shape.url}).strict(),K=e.object({...G.shape,contractVersion:e.literal(9),audience:e.object({topics:e.array(C(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(Pe).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=G.safeParse({...i,contractVersion:8});if(a.success)A(e,t,m,p);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`]})}),q=e.object({offset:e.number().int().nonnegative(),length:e.number().int().positive()}).strict();function J(e,t,n,r){let i=t?.map((e,t)=>({...e,index:t})).sort((e,t)=>e.offset-t.offset)??[],a=t=>!(t>0&&t<e.length&&/[\uD800-\uDBFF]/u.test(e.charAt(t-1))&&/[\uDC00-\uDFFF]/u.test(e.charAt(t))),o=0;for(let t of i){let i=t.offset+t.length;i>e.length?n.addIssue({code:`custom`,message:`quote_range_out_of_bounds`,path:[...r,t.index]}):(!a(t.offset)||!a(i))&&n.addIssue({code:`custom`,message:`quote_range_splits_code_point`,path:[...r,t.index]}),t.offset<o&&n.addIssue({code:`custom`,message:`quote_range_overlap`,path:[...r,t.index]}),o=Math.max(o,i)}}const Fe=j.options[0].extend({quotes:e.array(q).optional()}).superRefine((e,t)=>J(e.value,e.quotes,t,[`quotes`])),Ie=e.discriminatedUnion(`type`,[Fe,j.options[1]]),Le=e.array(Ie).max(30),Re={titleQuotes:e.array(q).optional(),sections:Le},ze=e.array(e.discriminatedUnion(`key`,[U.shape.variants.element.options[0].extend(Re),U.shape.variants.element.options[1].extend(Re)])).min(1).max(2).superRefine((e,t)=>{for(let[n,r]of e.entries())J(r.title,r.titleQuotes,t,[n,`titleQuotes`])}),Be=G.shape.message.extend({bodies:e.array(U.shape.bodies.element.extend({quotes:e.array(q).optional()}).superRefine((e,t)=>J(e.value,e.quotes,t,[`quotes`]))).max(2),variants:ze,channelVariants:e.partialRecord(e.enum(x),ze).optional()});function Ve(e){let{titleQuotes:t,...n}=e;return{...n,sections:n.sections.map(e=>{if(e.type!==`text`)return e;let{quotes:t,...n}=e;return n})}}const He=e.object({...K.shape,contractVersion:e.literal(10),message:Be}).strict().superRefine((e,t)=>{let n=K.safeParse({...e,contractVersion:9,message:{...e.message,bodies:e.message.bodies.map(({quotes:e,...t})=>t),variants:e.message.variants.map(Ve),...e.message.channelVariants===void 0?{}:{channelVariants:Object.fromEntries(Object.entries(e.message.channelVariants).map(([e,t])=>[e,t.map(Ve)]))}}});if(!n.success){for(let e of n.error.issues)t.addIssue({...e});return}let{audience:r,browserMessages:i,...a}=e;A(a,t,m,f),A(e,t,m,ce)});function Ue(e){return`routeKeys`in e?[...e.routeKeys].sort():[e.routeKey]}const We=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:C(h),sourceUrl:O.shape.url.optional()}).strict(),Ge=e.object({contractVersion:e.literal(1),eventType:e.literal(`local-task.delivery.requested`),eventId:e.string().uuid(),producer:T,routeKey:D,occurredAt:w,requestedAt:w,deliverBy:w,subject:E.extend({type:e.literal(`creator-event`)}),task:We}).strict().superRefine((e,t)=>A(e,t,ue,h)),Ke=Ge,qe=e.union([xe,Te,L,R,B,V,W,G,K,He]),Je=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:w.nullable(),nextAttemptAt:w.nullable(),leaseExpiresAt:w.nullable()}).strict(),Y=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:T,routeKey:D,subject:E,state:e.enum(g),reason:e.enum(_),terminal:e.boolean(),acceptedAt:w,updatedAt:w,deliverBy:w,terminalAt:w.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(),Ye=X.extend({cause:X.extend({cause:X.extend({cause:X.optional()}).optional()}).optional()}),Xe=Je.extend({state:e.enum(pe),attempts:e.number().int().min(0),revision:e.number().int().min(0),cause:Ye.nullable(),unconfirmedAt:w.nullable()}),Z=Y.extend({contractVersion:e.literal(2),state:e.enum(de),reason:e.enum(fe),revision:e.number().int().min(0),destinations:e.array(Xe).min(1).max(20)}),Ze=Z.omit({routeKey:!0}).extend({contractVersion:e.literal(3),routeKeys:je}),Q=e.union([Y,Z,Ze]),Qe=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(me)}).strict(),$e=e.object({code:e.literal(`invalid_request`),issues:e.array(Qe).max(20).optional()}).strict(),et=e.object({code:e.enum(b.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([$e,et]),tt=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Y}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),nt=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()]),rt=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Q}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),it=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{le as localTaskDeliveryContractVersionV1,ue as localTaskDeliveryMaximumDeadlineMillisecondsV1,h as localTaskDeliveryRequestMaximumUtf8BytesV1,Ke as localTaskDeliveryRequestSchema,Ge as localTaskDeliveryRequestV1Schema,Pe as notificationBrowserMessageSchema,t as notificationBrowserPayloadSchema,tt as notificationDeliverResultV1Schema,rt as notificationDeliverResultV2Schema,x as notificationDeliveryChannelKeys,n as notificationDeliveryContractVersionV1,ne as notificationDeliveryContractVersionV10,r as notificationDeliveryContractVersionV2,i as notificationDeliveryContractVersionV3,a as notificationDeliveryContractVersionV4,o as notificationDeliveryContractVersionV5,s as notificationDeliveryContractVersionV7,ee as notificationDeliveryContractVersionV8,te as notificationDeliveryContractVersionV9,l as notificationDeliveryMaximumDeadlineMillisecondsV1,u as notificationDeliveryMaximumDeadlineMillisecondsV2,oe as notificationDeliveryMaximumDeadlineMillisecondsV3,se as notificationDeliveryMaximumDeadlineMillisecondsV4,m as notificationDeliveryMaximumDeadlineMillisecondsV5,re as notificationDeliveryMaximumDestinationsV1,_ as notificationDeliveryReasonsV1,fe as notificationDeliveryReasonsV2,Y as notificationDeliveryReceiptV1Schema,Z as notificationDeliveryReceiptV2Schema,Ze as notificationDeliveryReceiptV3Schema,b as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,c as notificationDeliveryRequestMaximumUtf8BytesV1,ce as notificationDeliveryRequestMaximumUtf8BytesV10,ie as notificationDeliveryRequestMaximumUtf8BytesV2,ae as notificationDeliveryRequestMaximumUtf8BytesV3,d as notificationDeliveryRequestMaximumUtf8BytesV4,f as notificationDeliveryRequestMaximumUtf8BytesV5,p as notificationDeliveryRequestMaximumUtf8BytesV9,qe as notificationDeliveryRequestSchema,He as notificationDeliveryRequestV10Schema,xe as notificationDeliveryRequestV1Schema,Te as notificationDeliveryRequestV2Schema,L as notificationDeliveryRequestV3Schema,R as notificationDeliveryRequestV4Schema,B as notificationDeliveryRequestV5Schema,V as notificationDeliveryRequestV6Schema,W as notificationDeliveryRequestV7Schema,G as notificationDeliveryRequestV8Schema,K as notificationDeliveryRequestV9Schema,g as notificationDeliveryStatesV1,de as notificationDeliveryStatesV2,y as notificationDestinationFailureCodesV1,v as notificationDestinationStatesV1,pe as notificationDestinationStatesV2,nt as notificationGetReceiptResultV1Schema,it as notificationGetReceiptResultV2Schema,Q as notificationMessageReceiptSchema,he as notificationMessageVariantKeys,q as notificationQuoteRangeSchema,Ue as notificationRouteKeys,me as notificationValidationIssueCodesV1,Ye 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,c=8,ee=9,te=10,ne=11,re=20,l=32*1024,u=1380*60*1e3,ie=l,ae=u,oe=l,se=u,d=l,ce=u,f=l,p=64*1024,m=p,h=m,g=u,le=1,_=32*1024,ue=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`],de=[...v,`unconfirmed`],fe=[...y,`delivery_unconfirmed`],b=[`pending`,`delivering`,`delivered`,`failed`,`expired`],pe=[...b,`unconfirmed`],me=[`provider_timeout`,`provider_rate_limited`,`provider_unavailable`,`provider_rejected`,`destination_configuration_unavailable`,`delivery_interrupted`,`retry_exhausted`],he=[`invalid_request`,`request_too_large`,`producer_scope_mismatch`,`route_not_allowed`,`event_identity_conflict`,`route_not_found`,`route_empty`,`delivery_deadline_invalid`],ge=[`invalid_type`,`invalid_value`,`too_small`,`too_big`,`invalid_format`,`unrecognized_keys`,`custom`],_e=[`source`,`zh-CN`],x=[`qq`,`tg`,`wechat`,`lark`],ve=new TextEncoder,S=/^[a-z][a-z0-9-]{0,62}$/,ye=/^[a-z][a-z0-9-]{0,31}(?:\.[a-z][a-z0-9-]{0,31}){1,3}$/,be=/^[A-Z0-9][\w.:-]{0,127}$/i;function xe(e){return[...e].length}function C(t){return e.string().refine(e=>xe(e)>0,{message:`too_small`}).refine(e=>xe(e)<=t,{message:`too_big`})}const w=e.string().datetime({offset:!0}),T=e.object({key:e.string().regex(S),environment:e.string().regex(S)}).strict(),E=e.object({type:e.string().regex(S),id:e.string().regex(be),revision:e.number().int().positive()}).strict(),D=e.string().min(1).max(127).regex(ye),O=e.object({label:C(48),url:C(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(),k={eventType:e.literal(`notification.delivery.requested`),eventId:e.string().uuid(),producer:T,routeKey:D,occurredAt:w,requestedAt:w,deliverBy:w,subject:E},Se=e.object({contractVersion:e.literal(1),...k,message:e.object({type:e.literal(`link_summary`),title:C(160),summary:C(1200),facts:e.array(e.object({label:C(48),value:C(500)}).strict()).max(10),primaryLink:O,sourceLink:O.optional()}).strict()}).strict();function A(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`]}),ve.encode(JSON.stringify(e)).byteLength>r&&t.addIssue({code:`custom`,message:`request_too_large`})}const j=Se.superRefine((e,t)=>A(e,t,u,l)),Ce={title:C(160),summary:C(1200),facts:e.array(e.object({label:C(48),value:C(500)}).strict()).max(10)},we=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),...Ce}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),...Ce}).strict()]),Te=e.array(we).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`})}),Ee=e.object({contractVersion:e.literal(2),...k,message:e.object({type:e.literal(`localized_link_summary`),variants:Te,primaryLink:O,sourceLink:O.optional()}).strict()}).strict().superRefine((e,t)=>A(e,t,ae,ie)),M=e.discriminatedUnion(`type`,[e.object({key:e.string().regex(S),type:e.literal(`text`),label:C(48).optional(),value:C(4e3)}).strict(),e.object({key:e.string().regex(S),type:e.literal(`fields`),items:e.array(e.object({label:C(48),value:C(1200)}).strict()).min(1).max(20)}).strict()]),N=e.array(M).max(30).superRefine((e,t)=>{new Set(e.map(e=>e.key)).size!==e.length&&t.addIssue({code:`custom`,message:`message_section_duplicate`})}),De=N.min(1),P=e.discriminatedUnion(`key`,[e.object({key:e.literal(`source`),locale:e.literal(`und`),title:C(160),sections:De}).strict(),e.object({key:e.literal(`zh-CN`),locale:e.literal(`zh-CN`),title:C(160),sections:De}).strict()]),F=(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}`),c=i.sections.filter(e=>!n||e.type!==`text`||a.has(e.key)).map(e=>`${e.key}:${e.type}`);JSON.stringify(s)!==JSON.stringify(c)&&t.addIssue({code:`custom`,message:`message_variant_structure_mismatch`,path:[e.indexOf(i),`sections`]})}},Oe=e.array(P).min(1).max(2).superRefine(F),I=e.object({contractVersion:e.literal(3),...k,message:e.object({type:e.literal(`structured_notification`),variants:Oe,links:e.array(e.object({key:e.string().regex(S),...O.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(),ke=I.superRefine((e,t)=>A(e,t,se,oe)),Ae=e.object({label:C(48).optional(),value:C(d)}).strict(),je=e.discriminatedUnion(`key`,[P.options[0].extend({body:Ae}),P.options[1].extend({body:Ae})]),Me=I.extend({contractVersion:e.literal(4),message:I.shape.message.extend({variants:e.array(je).min(1).max(2).superRefine(F)})}).superRefine((e,t)=>A(e,t,ce,d)),L=e.discriminatedUnion(`key`,[P.options[0].extend({bodyLabel:C(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(S),label:C(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`})})}),P.options[1].extend({bodyLabel:C(48).optional(),linkLabels:e.array(e.object({key:e.string().regex(S),label:C(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`})})})]),Ne=e.object({value:C(f)}).strict(),R=e.object({contractVersion:e.literal(5),...k,message:e.object({type:e.literal(`structured_notification`),variants:e.array(L).min(1).max(2).superRefine(F),links:e.array(e.object({key:e.string().regex(S),url:O.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:Ne}).strict()}).strict().superRefine((e,t)=>{A(e,t,g,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`]})}}),z=e.object({...R.shape,contractVersion:e.literal(6),message:R.shape.message.omit({body:!0}).extend({bodies:e.array(e.object({key:e.string().regex(S),value:C(f)}).strict()).max(2),variants:e.array(e.discriminatedUnion(`key`,[L.options[0].omit({bodyLabel:!0}).extend({sections:N,bodyRefs:e.array(e.object({key:e.string().regex(S),label:C(48).optional()}).strict()).max(2),footer:C(500).optional()}),L.options[1].omit({bodyLabel:!0}).extend({sections:N,bodyRefs:e.array(e.object({key:e.string().regex(S),label:C(48).optional()}).strict()).max(2),footer:C(500).optional()})])).min(1).max(2).superRefine((e,t)=>F(e,t,!0))})}).strict().superRefine(B);function B(e,t){A(e,t,g,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`}),Pe(e.message.variants,n,r,t)}function Pe(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 Fe=e.array(D).min(1).superRefine((e,t)=>{new Set(e).size!==e.length&&t.addIssue({code:`custom`,message:`route_key_duplicate`})}),{routeKey:Ie,...Le}=z.shape,V=z.shape.message,H=e.object({...Le,contractVersion:e.literal(7),routeKeys:Fe,message:V}).strict().superRefine(B),U=e.object({...H.shape,contractVersion:e.literal(8),message:V.extend({channelVariants:e.partialRecord(e.enum(x),V.shape.variants).optional()})}).strict().superRefine((e,t)=>{B(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 x){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}),Pe(o,r,i,t,s)}}),Re=e.object({locale:C(35),contentLocale:C(35),title:C(160).refine(e=>e.trim().length>0,`browser_message_title_blank`),body:e.string().max(8192),url:O.shape.url}).strict(),W=e.object({...U.shape,contractVersion:e.literal(9),audience:e.object({topics:e.array(C(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(Re).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=U.safeParse({...i,contractVersion:8});if(a.success)A(e,t,g,p);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`]})}),G=e.object({offset:e.number().int().nonnegative(),length:e.number().int().positive()}).strict();function K(e,t,n,r){let i=t?.map((e,t)=>({...e,index:t})).sort((e,t)=>e.offset-t.offset)??[],a=t=>!(t>0&&t<e.length&&/[\uD800-\uDBFF]/u.test(e.charAt(t-1))&&/[\uDC00-\uDFFF]/u.test(e.charAt(t))),o=0;for(let t of i){let i=t.offset+t.length;i>e.length?n.addIssue({code:`custom`,message:`quote_range_out_of_bounds`,path:[...r,t.index]}):(!a(t.offset)||!a(i))&&n.addIssue({code:`custom`,message:`quote_range_splits_code_point`,path:[...r,t.index]}),t.offset<o&&n.addIssue({code:`custom`,message:`quote_range_overlap`,path:[...r,t.index]}),o=Math.max(o,i)}}const ze=M.options[0].extend({quotes:e.array(G).optional()}).superRefine((e,t)=>K(e.value,e.quotes,t,[`quotes`])),Be=e.discriminatedUnion(`type`,[ze,M.options[1]]),Ve=e.array(Be).max(30),He={titleQuotes:e.array(G).optional(),sections:Ve},Ue=e.array(e.discriminatedUnion(`key`,[V.shape.variants.element.options[0].extend(He),V.shape.variants.element.options[1].extend(He)])).min(1).max(2).superRefine((e,t)=>{for(let[n,r]of e.entries())K(r.title,r.titleQuotes,t,[n,`titleQuotes`])}),q=U.shape.message.extend({bodies:e.array(V.shape.bodies.element.extend({quotes:e.array(G).optional()}).superRefine((e,t)=>K(e.value,e.quotes,t,[`quotes`]))).max(2),variants:Ue,channelVariants:e.partialRecord(e.enum(x),Ue).optional()});function We(e){let{titleQuotes:t,...n}=e;return{...n,sections:n.sections.map(e=>{if(e.type!==`text`)return e;let{quotes:t,...n}=e;return n})}}const J=e.object({...W.shape,contractVersion:e.literal(10),message:q}).strict().superRefine((e,t)=>{let n=W.safeParse({...e,contractVersion:9,message:{...e.message,bodies:e.message.bodies.map(({quotes:e,...t})=>t),variants:e.message.variants.map(We),...e.message.channelVariants===void 0?{}:{channelVariants:Object.fromEntries(Object.entries(e.message.channelVariants).map(([e,t])=>[e,t.map(We)]))}}});if(!n.success){for(let e of n.error.issues)t.addIssue({...e});return}let{audience:r,browserMessages:i,...a}=e;A(a,t,g,f),A(e,t,g,m)}),Ge=e.object({qq:e.enum([`auto`,`markdown`,`plain_text`]).optional(),tg:e.enum([`auto`,`rich_text`,`plain_text`]).optional()}).strict(),Ke=e.object({...J.shape,contractVersion:e.literal(11),message:q.extend({channelFormats:Ge.optional(),channelBodies:e.partialRecord(e.enum(x),q.shape.bodies).optional(),channelLinks:e.partialRecord(e.enum(x),q.shape.links).optional()})}).strict().superRefine((e,t)=>{let{channelFormats:n,channelBodies:r,channelLinks:i,...a}=e.message,o=J.safeParse({...e,contractVersion:10,message:a});if(!o.success){for(let e of o.error.issues)t.addIssue({...e});return}let s=a.bodies.map(e=>e.key).sort(),c=a.links.map(e=>e.key);for(let n of x){let r=e.message.channelBodies?.[n],i=e.message.channelLinks?.[n];r!==void 0&&JSON.stringify(r.map(e=>e.key).sort())!==JSON.stringify(s)&&t.addIssue({code:`custom`,message:`message_channel_body_keys_mismatch`,path:[`message`,`channelBodies`,n]}),i!==void 0&&JSON.stringify(i.map(e=>e.key))!==JSON.stringify(c)&&t.addIssue({code:`custom`,message:`message_channel_link_keys_mismatch`,path:[`message`,`channelLinks`,n]})}A(e,t,g,h)});function qe(e){return`routeKeys`in e?[...e.routeKeys].sort():[e.routeKey]}const Je=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:C(_),sourceUrl:O.shape.url.optional()}).strict(),Ye=e.object({contractVersion:e.literal(1),eventType:e.literal(`local-task.delivery.requested`),eventId:e.string().uuid(),producer:T,routeKey:D,occurredAt:w,requestedAt:w,deliverBy:w,subject:E.extend({type:e.literal(`creator-event`)}),task:Je}).strict().superRefine((e,t)=>A(e,t,ue,_)),Xe=Ye,Ze=e.union([j,Ee,ke,Me,R,z,H,U,W,J,Ke]),Qe=e.object({destinationKey:e.string().min(1),state:e.enum(b),attempts:e.number().int().min(0).max(4),failureCode:e.enum(me).nullable(),lastAttemptAt:w.nullable(),nextAttemptAt:w.nullable(),leaseExpiresAt:w.nullable()}).strict(),Y=e.object({contractVersion:e.literal(1),eventId:e.string().uuid(),producer:T,routeKey:D,subject:E,state:e.enum(v),reason:e.enum(y),terminal:e.boolean(),acceptedAt:w,updatedAt:w,deliverBy:w,terminalAt:w.nullable(),destinations:e.array(Qe).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(),$e=X.extend({cause:X.extend({cause:X.extend({cause:X.optional()}).optional()}).optional()}),et=Qe.extend({state:e.enum(pe),attempts:e.number().int().min(0),revision:e.number().int().min(0),cause:$e.nullable(),unconfirmedAt:w.nullable()}),Z=Y.extend({contractVersion:e.literal(2),state:e.enum(de),reason:e.enum(fe),revision:e.number().int().min(0),destinations:e.array(et).min(1).max(20)}),tt=Z.omit({routeKey:!0}).extend({contractVersion:e.literal(3),routeKeys:Fe}),Q=e.union([Y,Z,tt]),nt=e.object({path:e.array(e.union([e.string(),e.number().int().min(0)])).max(16),code:e.enum(ge)}).strict(),rt=e.object({code:e.literal(`invalid_request`),issues:e.array(nt).max(20).optional()}).strict(),it=e.object({code:e.enum(he.filter(e=>e!==`invalid_request`))}).strict(),$=e.union([rt,it]),at=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Y}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),ot=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()]),st=e.discriminatedUnion(`status`,[e.object({status:e.literal(`accepted`),receipt:Q}).strict(),e.object({status:e.literal(`rejected`),error:$}).strict()]),ct=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{le as localTaskDeliveryContractVersionV1,ue as localTaskDeliveryMaximumDeadlineMillisecondsV1,_ as localTaskDeliveryRequestMaximumUtf8BytesV1,Xe as localTaskDeliveryRequestSchema,Ye as localTaskDeliveryRequestV1Schema,Re as notificationBrowserMessageSchema,t as notificationBrowserPayloadSchema,Ge as notificationChannelFormatsSchema,at as notificationDeliverResultV1Schema,st as notificationDeliverResultV2Schema,x as notificationDeliveryChannelKeys,n as notificationDeliveryContractVersionV1,te as notificationDeliveryContractVersionV10,ne as notificationDeliveryContractVersionV11,r as notificationDeliveryContractVersionV2,i as notificationDeliveryContractVersionV3,a as notificationDeliveryContractVersionV4,o as notificationDeliveryContractVersionV5,s as notificationDeliveryContractVersionV7,c as notificationDeliveryContractVersionV8,ee as notificationDeliveryContractVersionV9,u as notificationDeliveryMaximumDeadlineMillisecondsV1,ae as notificationDeliveryMaximumDeadlineMillisecondsV2,se as notificationDeliveryMaximumDeadlineMillisecondsV3,ce as notificationDeliveryMaximumDeadlineMillisecondsV4,g as notificationDeliveryMaximumDeadlineMillisecondsV5,re as notificationDeliveryMaximumDestinationsV1,y as notificationDeliveryReasonsV1,fe as notificationDeliveryReasonsV2,Y as notificationDeliveryReceiptV1Schema,Z as notificationDeliveryReceiptV2Schema,tt as notificationDeliveryReceiptV3Schema,he as notificationDeliveryRejectionCodesV1,$ as notificationDeliveryRejectionV1Schema,l as notificationDeliveryRequestMaximumUtf8BytesV1,m as notificationDeliveryRequestMaximumUtf8BytesV10,h as notificationDeliveryRequestMaximumUtf8BytesV11,ie as notificationDeliveryRequestMaximumUtf8BytesV2,oe as notificationDeliveryRequestMaximumUtf8BytesV3,d as notificationDeliveryRequestMaximumUtf8BytesV4,f as notificationDeliveryRequestMaximumUtf8BytesV5,p as notificationDeliveryRequestMaximumUtf8BytesV9,Ze as notificationDeliveryRequestSchema,J as notificationDeliveryRequestV10Schema,Ke as notificationDeliveryRequestV11Schema,j as notificationDeliveryRequestV1Schema,Ee as notificationDeliveryRequestV2Schema,ke as notificationDeliveryRequestV3Schema,Me as notificationDeliveryRequestV4Schema,R as notificationDeliveryRequestV5Schema,z as notificationDeliveryRequestV6Schema,H as notificationDeliveryRequestV7Schema,U as notificationDeliveryRequestV8Schema,W as notificationDeliveryRequestV9Schema,v as notificationDeliveryStatesV1,de as notificationDeliveryStatesV2,me as notificationDestinationFailureCodesV1,b as notificationDestinationStatesV1,pe as notificationDestinationStatesV2,ot as notificationGetReceiptResultV1Schema,ct as notificationGetReceiptResultV2Schema,Q as notificationMessageReceiptSchema,_e as notificationMessageVariantKeys,G as notificationQuoteRangeSchema,qe as notificationRouteKeys,ge as notificationValidationIssueCodesV1,$e as safeDeliveryCauseSchema};