@samva/webhooks 0.35.0 → 0.37.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/effect.js +4 -4
- package/dist/errors.d.ts +5 -5
- package/dist/{json-schemas.gen-BHKhYQV4.js → json-schemas.gen-C5nX_b5f.js} +247 -20
- package/dist/promise.js +2 -2
- package/dist/{protocol-D6py4UMl.js → protocol-IJ8lllqW.js} +173 -197
- package/dist/protocol.d.ts +0 -29
- package/dist/protocol.js +1 -1
- package/dist/schemas.gen.d.ts +118 -18
- package/dist/schemas.gen.js +236 -160
- package/dist/types.gen.d.ts +84 -9
- package/package.json +1 -1
|
@@ -219,117 +219,138 @@ const validate1315 = (value) => typeof value === "string" && (value === "active"
|
|
|
219
219
|
const validate1319 = (value) => validate1320(value) || validate6(value);
|
|
220
220
|
const validate1320 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "sequence") && Object.hasOwn(value, "startsAt") && Object.hasOwn(value, "endsAt") && Object.hasOwn(value, "allowanceRecipients") && Object.hasOwn(value, "dailyGrowthPercent") && Object.hasOwn(value, "targetDailyRecipients") && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "sequence") || validate15(value["sequence"])) && (!Object.hasOwn(value, "startsAt") || validate2(value["startsAt"])) && (!Object.hasOwn(value, "endsAt") || validate2(value["endsAt"])) && (!Object.hasOwn(value, "allowanceRecipients") || validate15(value["allowanceRecipients"])) && (!Object.hasOwn(value, "dailyGrowthPercent") || validate15(value["dailyGrowthPercent"])) && (!Object.hasOwn(value, "targetDailyRecipients") || validate15(value["targetDailyRecipients"]));
|
|
221
221
|
const validate1330 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1331(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1333(value["data"]));
|
|
222
|
-
const validate1331 = (value) => typeof value === "string" && value === "
|
|
223
|
-
const validate1333 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
const
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
const
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const validate1423 = (value) => validate1424(value) || validate6(value);
|
|
253
|
-
const validate1424 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "metadata") && (!Object.hasOwn(value, "id") || validate1425(value["id"])) && (!Object.hasOwn(value, "metadata") || validate1426(value["metadata"]));
|
|
254
|
-
const validate1425 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wasl_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
255
|
-
const validate1426 = (value) => isObject(value) && isObject(value);
|
|
222
|
+
const validate1331 = (value) => typeof value === "string" && value === "email.sending.paused";
|
|
223
|
+
const validate1333 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "organizationId") || validate851(value["organizationId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "channel") || validate852(value["channel"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
|
|
224
|
+
const validate1335 = (value) => validate1336(value) || validate6(value);
|
|
225
|
+
const validate1336 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^ns_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
226
|
+
const validate1340 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1341(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1333(value["data"]));
|
|
227
|
+
const validate1341 = (value) => typeof value === "string" && value === "email.sending.resumed";
|
|
228
|
+
const validate1350 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1351(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1353(value["data"]));
|
|
229
|
+
const validate1351 = (value) => typeof value === "string" && value === "template.registration.updated";
|
|
230
|
+
const validate1353 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "templateId") && Object.hasOwn(value, "publicationId") && Object.hasOwn(value, "target") && Object.hasOwn(value, "name") && Object.hasOwn(value, "language") && Object.hasOwn(value, "status") && Object.hasOwn(value, "category") && Object.hasOwn(value, "providerCategory") && Object.hasOwn(value, "providerTemplateId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "submittedAt") && Object.hasOwn(value, "statusChangedAt") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "previousStatus") && (!Object.hasOwn(value, "id") || validate1354(value["id"])) && (!Object.hasOwn(value, "templateId") || validate1355(value["templateId"])) && (!Object.hasOwn(value, "publicationId") || validate1356(value["publicationId"])) && (!Object.hasOwn(value, "target") || validate1357(value["target"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "language") || validate2(value["language"])) && (!Object.hasOwn(value, "status") || validate1367(value["status"])) && (!Object.hasOwn(value, "category") || validate1368(value["category"])) && (!Object.hasOwn(value, "providerCategory") || validate1369(value["providerCategory"])) && (!Object.hasOwn(value, "providerTemplateId") || validate8(value["providerTemplateId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "submittedAt") || validate8(value["submittedAt"])) && (!Object.hasOwn(value, "statusChangedAt") || validate2(value["statusChangedAt"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"])) && (!Object.hasOwn(value, "organizationId") || validate851(value["organizationId"])) && (!Object.hasOwn(value, "previousStatus") || validate1367(value["previousStatus"]));
|
|
231
|
+
const validate1354 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^treg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
232
|
+
const validate1355 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
233
|
+
const validate1356 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^tpub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
234
|
+
const validate1357 = (value) => validate1358(value) || validate1361(value);
|
|
235
|
+
const validate1358 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "provider") && Object.hasOwn(value, "wabaId") && (!Object.hasOwn(value, "provider") || validate1359(value["provider"])) && (!Object.hasOwn(value, "wabaId") || validate2(value["wabaId"]));
|
|
236
|
+
const validate1359 = (value) => typeof value === "string" && value === "whatsapp";
|
|
237
|
+
const validate1361 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "provider") && Object.hasOwn(value, "entityId") && Object.hasOwn(value, "headerId") && (!Object.hasOwn(value, "provider") || validate1362(value["provider"])) && (!Object.hasOwn(value, "entityId") || validate2(value["entityId"])) && (!Object.hasOwn(value, "headerId") || validate2(value["headerId"]));
|
|
238
|
+
const validate1362 = (value) => typeof value === "string" && value === "dlt";
|
|
239
|
+
const validate1367 = (value) => typeof value === "string" && (value === "draft" || value === "submitted" || value === "approved" || value === "rejected" || value === "paused" || value === "disabled");
|
|
240
|
+
const validate1368 = (value) => typeof value === "string" && (value === "marketing" || value === "utility" || value === "authentication" || value === "transactional" || value === "service_implicit" || value === "service_explicit" || value === "promotional");
|
|
241
|
+
const validate1369 = (value) => validate1368(value) || validate6(value);
|
|
242
|
+
const validate1386 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1387(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1389(value["data"]));
|
|
243
|
+
const validate1387 = (value) => typeof value === "string" && value === "flow.registration.updated";
|
|
244
|
+
const validate1389 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "flowId") && Object.hasOwn(value, "versionId") && Object.hasOwn(value, "versionNumber") && Object.hasOwn(value, "wabaId") && Object.hasOwn(value, "providerFlowId") && Object.hasOwn(value, "name") && Object.hasOwn(value, "status") && Object.hasOwn(value, "validationErrors") && Object.hasOwn(value, "endpointAlerts") && Object.hasOwn(value, "publishedAt") && Object.hasOwn(value, "statusChangedAt") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "previousStatus") && (!Object.hasOwn(value, "id") || validate1390(value["id"])) && (!Object.hasOwn(value, "flowId") || validate746(value["flowId"])) && (!Object.hasOwn(value, "versionId") || validate752(value["versionId"])) && (!Object.hasOwn(value, "versionNumber") || validate1275(value["versionNumber"])) && (!Object.hasOwn(value, "wabaId") || validate2(value["wabaId"])) && (!Object.hasOwn(value, "providerFlowId") || validate8(value["providerFlowId"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "status") || validate1399(value["status"])) && (!Object.hasOwn(value, "validationErrors") || validate1400(value["validationErrors"])) && (!Object.hasOwn(value, "endpointAlerts") || validate1407(value["endpointAlerts"])) && (!Object.hasOwn(value, "publishedAt") || validate8(value["publishedAt"])) && (!Object.hasOwn(value, "statusChangedAt") || validate2(value["statusChangedAt"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"])) && (!Object.hasOwn(value, "organizationId") || validate851(value["organizationId"])) && (!Object.hasOwn(value, "previousStatus") || validate1425(value["previousStatus"]));
|
|
245
|
+
const validate1390 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wafreg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
246
|
+
const validate1399 = (value) => typeof value === "string" && (value === "draft" || value === "published" || value === "throttled" || value === "blocked" || value === "deprecated");
|
|
247
|
+
const validate1400 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1401);
|
|
248
|
+
const validate1401 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "error") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "error") || validate2(value["error"])) && (!Object.hasOwn(value, "message") || validate2(value["message"])) && (!Object.hasOwn(value, "path") || validate2(value["path"])) && (!Object.hasOwn(value, "line") || validate1275(value["line"])) && (!Object.hasOwn(value, "column") || validate1275(value["column"]));
|
|
249
|
+
const validate1407 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1408);
|
|
250
|
+
const validate1408 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "message") && Object.hasOwn(value, "value") && Object.hasOwn(value, "threshold") && Object.hasOwn(value, "activatedAt") && (!Object.hasOwn(value, "kind") || validate2(value["kind"])) && (!Object.hasOwn(value, "message") || validate2(value["message"])) && (!Object.hasOwn(value, "value") || validate14(value["value"])) && (!Object.hasOwn(value, "threshold") || validate14(value["threshold"])) && (!Object.hasOwn(value, "activatedAt") || validate2(value["activatedAt"]));
|
|
251
|
+
const validate1425 = (value) => validate1399(value) || validate6(value);
|
|
256
252
|
const validate1428 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1429(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1431(value["data"]));
|
|
257
|
-
const validate1429 = (value) => typeof value === "string" && value === "
|
|
258
|
-
const validate1431 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "
|
|
259
|
-
const validate1436 = (value) =>
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
const
|
|
276
|
-
const
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
const
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
const
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
const
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
const
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
const
|
|
302
|
-
const
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
const
|
|
308
|
-
const
|
|
309
|
-
const
|
|
310
|
-
const
|
|
253
|
+
const validate1429 = (value) => typeof value === "string" && value === "whatsapp.number.connected";
|
|
254
|
+
const validate1431 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "businessAccountId") && Object.hasOwn(value, "phoneNumber") && Object.hasOwn(value, "phoneNumberId") && Object.hasOwn(value, "whatsappBusinessAccountId") && Object.hasOwn(value, "displayName") && Object.hasOwn(value, "verificationStatus") && Object.hasOwn(value, "reconnected") && Object.hasOwn(value, "setupLink") && (!Object.hasOwn(value, "organizationId") || validate851(value["organizationId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "businessAccountId") || validate1436(value["businessAccountId"])) && (!Object.hasOwn(value, "phoneNumber") || validate2(value["phoneNumber"])) && (!Object.hasOwn(value, "phoneNumberId") || validate2(value["phoneNumberId"])) && (!Object.hasOwn(value, "whatsappBusinessAccountId") || validate2(value["whatsappBusinessAccountId"])) && (!Object.hasOwn(value, "displayName") || validate2(value["displayName"])) && (!Object.hasOwn(value, "verificationStatus") || validate1441(value["verificationStatus"])) && (!Object.hasOwn(value, "reconnected") || validate33(value["reconnected"])) && (!Object.hasOwn(value, "setupLink") || validate1443(value["setupLink"]));
|
|
255
|
+
const validate1436 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^waba_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
256
|
+
const validate1441 = (value) => typeof value === "string" && (value === "pending" || value === "verified" || value === "failed" || value === "suspended");
|
|
257
|
+
const validate1443 = (value) => validate1444(value) || validate6(value);
|
|
258
|
+
const validate1444 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "metadata") && (!Object.hasOwn(value, "id") || validate1445(value["id"])) && (!Object.hasOwn(value, "metadata") || validate1446(value["metadata"]));
|
|
259
|
+
const validate1445 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wasl_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
260
|
+
const validate1446 = (value) => isObject(value) && isObject(value);
|
|
261
|
+
const validate1448 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1449(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1451(value["data"]));
|
|
262
|
+
const validate1449 = (value) => typeof value === "string" && value === "mailbox.message.received";
|
|
263
|
+
const validate1451 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "message") || validate1456(value["message"])) && (!Object.hasOwn(value, "thread") || validate1490(value["thread"]));
|
|
264
|
+
const validate1456 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "from") && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "text") && Object.hasOwn(value, "replyText") && Object.hasOwn(value, "attachments") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "id") || validate779(value["id"])) && (!Object.hasOwn(value, "campaign") || validate592(value["campaign"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "threadId") || validate1464(value["threadId"])) && (!Object.hasOwn(value, "from") || validate1465(value["from"])) && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "text") || validate8(value["text"])) && (!Object.hasOwn(value, "replyText") || validate8(value["replyText"])) && (!Object.hasOwn(value, "attachments") || validate1483(value["attachments"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
|
|
265
|
+
const validate1464 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
266
|
+
const validate1465 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "address") && (!Object.hasOwn(value, "address") || validate2(value["address"])) && (!Object.hasOwn(value, "name") || validate8(value["name"]));
|
|
267
|
+
const validate1483 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1484);
|
|
268
|
+
const validate1484 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "filename") && Object.hasOwn(value, "contentType") && Object.hasOwn(value, "size") && (!Object.hasOwn(value, "id") || validate1485(value["id"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"])) && (!Object.hasOwn(value, "contentType") || validate2(value["contentType"])) && (!Object.hasOwn(value, "size") || validate15(value["size"]));
|
|
269
|
+
const validate1485 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^att_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
270
|
+
const validate1490 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "preview") && (!Object.hasOwn(value, "id") || validate1464(value["id"])) && (!Object.hasOwn(value, "endpointId") || validate1492(value["endpointId"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "preview") || validate8(value["preview"]));
|
|
271
|
+
const validate1492 = (value) => validate1493(value) || validate6(value);
|
|
272
|
+
const validate1493 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
273
|
+
const validate1501 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1502(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1504(value["data"]));
|
|
274
|
+
const validate1502 = (value) => typeof value === "string" && value === "mailbox.message.sent";
|
|
275
|
+
const validate1504 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "actionId") || validate1509(value["actionId"])) && (!Object.hasOwn(value, "state") || validate1510(value["state"])) && (!Object.hasOwn(value, "acceptedAt") || validate2(value["acceptedAt"])) && (!Object.hasOwn(value, "actor") || validate1512(value["actor"])) && (!Object.hasOwn(value, "message") || validate1456(value["message"]));
|
|
276
|
+
const validate1509 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
277
|
+
const validate1510 = (value) => typeof value === "string" && value === "completed";
|
|
278
|
+
const validate1512 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && Object.hasOwn(value, "source") && (!Object.hasOwn(value, "kind") || validate1513(value["kind"])) && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "displayName") || validate8(value["displayName"])) && (!Object.hasOwn(value, "source") || validate1518(value["source"]));
|
|
279
|
+
const validate1513 = (value) => typeof value === "string" && (value === "user" || value === "apiKey" || value === "extension" || value === "externalAgent" || value === "samvaAgent" || value === "system");
|
|
280
|
+
const validate1518 = (value) => typeof value === "string" && (value === "humanUi" || value === "externalApi" || value === "externalAgent" || value === "extension" || value === "samvaManagedAgent" || value === "system");
|
|
281
|
+
const validate1553 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1554(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1556(value["data"]));
|
|
282
|
+
const validate1554 = (value) => typeof value === "string" && value === "mailbox.action.pending_approval";
|
|
283
|
+
const validate1556 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "draft") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1561(value["action"])) && (!Object.hasOwn(value, "draft") || validate1631(value["draft"])) && (!Object.hasOwn(value, "tool") || validate1641(value["tool"]));
|
|
284
|
+
const validate1561 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "reviewRound") && Object.hasOwn(value, "decision") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1509(value["id"])) && (!Object.hasOwn(value, "type") || validate1563(value["type"])) && (!Object.hasOwn(value, "reviewRound") || validate1564(value["reviewRound"])) && (!Object.hasOwn(value, "state") || validate1565(value["state"])) && (!Object.hasOwn(value, "decision") || validate1566(value["decision"])) && (!Object.hasOwn(value, "threadId") || validate1617(value["threadId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "proposedBy") || validate1512(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
|
|
285
|
+
const validate1563 = (value) => typeof value === "string" && (value === "sendMessage" || value === "reply" || value === "updateDraft" || value === "createNote" || value === "assignThread" || value === "changeThreadState" || value === "call" || value === "extensionRequest" || value === "toolCall" || value === "handoff");
|
|
286
|
+
const validate1564 = (value) => typeof value === "number" && Number.isInteger(value) && typeof value === "number" && value <= 9007199254740991 && typeof value === "number" && value > 0;
|
|
287
|
+
const validate1565 = (value) => typeof value === "string" && value === "approvalRequired";
|
|
288
|
+
const validate1566 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "reviewRound") && Object.hasOwn(value, "requirement") && Object.hasOwn(value, "decider") && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "scopes") && (!Object.hasOwn(value, "id") || validate1567(value["id"])) && (!Object.hasOwn(value, "reviewRound") || validate1564(value["reviewRound"])) && (!Object.hasOwn(value, "requirement") || validate1569(value["requirement"])) && (!Object.hasOwn(value, "decider") || validate1570(value["decider"])) && (!Object.hasOwn(value, "outcome") || validate1571(value["outcome"])) && (!Object.hasOwn(value, "reason") || validate1572(value["reason"])) && (!Object.hasOwn(value, "scopes") || validate1573(value["scopes"])) && (!Object.hasOwn(value, "rule") || validate1577(value["rule"])) && (!Object.hasOwn(value, "guard") || validate1584(value["guard"])) && (!Object.hasOwn(value, "guardReason") || validate1584(value["guardReason"])) && (!Object.hasOwn(value, "resolution") || validate1590(value["resolution"]));
|
|
289
|
+
const validate1567 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^pdec_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
290
|
+
const validate1569 = (value) => typeof value === "string" && (value === "run" || value === "model" || value === "person" || value === "never");
|
|
291
|
+
const validate1570 = (value) => typeof value === "string" && (value === "rule" || value === "model" || value === "person" || value === "agent");
|
|
292
|
+
const validate1571 = (value) => typeof value === "string" && (value === "allow" || value === "hold" || value === "refuse");
|
|
293
|
+
const validate1572 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1;
|
|
294
|
+
const validate1573 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1574);
|
|
295
|
+
const validate1574 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && (!Object.hasOwn(value, "kind") || validate1575(value["kind"])) && (!Object.hasOwn(value, "id") || validate1572(value["id"]));
|
|
296
|
+
const validate1575 = (value) => typeof value === "string" && (value === "organization" || value === "mailbox" || value === "agent" || value === "apiKey");
|
|
297
|
+
const validate1577 = (value) => validate1578(value) || validate6(value);
|
|
298
|
+
const validate1578 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "scope") && Object.hasOwn(value, "index") && (!Object.hasOwn(value, "scope") || validate1574(value["scope"])) && (!Object.hasOwn(value, "index") || validate1582(value["index"]));
|
|
299
|
+
const validate1582 = (value) => typeof value === "number" && Number.isInteger(value) && typeof value === "number" && value >= 0 && typeof value === "number" && value <= 9007199254740991;
|
|
300
|
+
const validate1584 = (value) => validate1572(value) || validate6(value);
|
|
301
|
+
const validate1590 = (value) => validate1591(value) || validate6(value);
|
|
302
|
+
const validate1591 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "by") && Object.hasOwn(value, "at") && Object.hasOwn(value, "as") && (!Object.hasOwn(value, "by") || validate1592(value["by"])) && (!Object.hasOwn(value, "at") || validate2(value["at"])) && (!Object.hasOwn(value, "as") || validate1594(value["as"])) && (!Object.hasOwn(value, "diff") || validate1595(value["diff"]));
|
|
303
|
+
const validate1592 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^user_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
304
|
+
const validate1594 = (value) => typeof value === "string" && (value === "approved" || value === "edited" || value === "denied" || value === "alwaysAllowed");
|
|
305
|
+
const validate1595 = (value) => validate1596(value) || validate6(value);
|
|
306
|
+
const validate1596 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "text") || validate1597(value["text"])) && (!Object.hasOwn(value, "html") || validate1597(value["html"]));
|
|
307
|
+
const validate1597 = (value) => validate1598(value) || validate6(value);
|
|
308
|
+
const validate1598 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "before") && Object.hasOwn(value, "after") && (!Object.hasOwn(value, "before") || validate8(value["before"])) && (!Object.hasOwn(value, "after") || validate8(value["after"]));
|
|
309
|
+
const validate1617 = (value) => validate1464(value) || validate6(value);
|
|
310
|
+
const validate1631 = (value) => validate1632(value) || validate6(value);
|
|
311
|
+
const validate1632 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"]));
|
|
312
|
+
const validate1641 = (value) => validate1642(value) || validate6(value);
|
|
313
|
+
const validate1642 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "name") && Object.hasOwn(value, "argumentsHash") && Object.hasOwn(value, "arguments") && (!Object.hasOwn(value, "name") || validate1643(value["name"])) && (!Object.hasOwn(value, "argumentsHash") || validate1644(value["argumentsHash"])) && (!Object.hasOwn(value, "arguments") || validate12(value["arguments"]));
|
|
314
|
+
const validate1643 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 128;
|
|
315
|
+
const validate1644 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^[0-9a-f]{64}$", "u")).test(value);
|
|
316
|
+
const validate1647 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1648(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1650(value["data"]));
|
|
317
|
+
const validate1648 = (value) => typeof value === "string" && value === "mailbox.action.resolved";
|
|
318
|
+
const validate1650 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "resolution") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1655(value["action"])) && (!Object.hasOwn(value, "resolution") || validate1670(value["resolution"]));
|
|
319
|
+
const validate1655 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "reviewRound") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1509(value["id"])) && (!Object.hasOwn(value, "type") || validate1563(value["type"])) && (!Object.hasOwn(value, "reviewRound") || validate1564(value["reviewRound"])) && (!Object.hasOwn(value, "threadId") || validate1617(value["threadId"])) && (!Object.hasOwn(value, "proposedBy") || validate1512(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
|
|
320
|
+
const validate1670 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "resolvedAt") && Object.hasOwn(value, "reason") && (!Object.hasOwn(value, "outcome") || validate1671(value["outcome"])) && (!Object.hasOwn(value, "actor") || validate1512(value["actor"])) && (!Object.hasOwn(value, "resolvedAt") || validate2(value["resolvedAt"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"]));
|
|
321
|
+
const validate1671 = (value) => typeof value === "string" && (value === "approved" || value === "denied" || value === "cancelled");
|
|
322
|
+
const validate1683 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1684(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1686(value["data"]));
|
|
323
|
+
const validate1684 = (value) => typeof value === "string" && value === "mailbox.message.quarantined";
|
|
324
|
+
const validate1686 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "source") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "disposition") || validate1691(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1692(value["reason"])) && (!Object.hasOwn(value, "source") || validate1693(value["source"])) && (!Object.hasOwn(value, "message") || validate1694(value["message"]));
|
|
325
|
+
const validate1691 = (value) => typeof value === "string" && (value === "quarantined" || value === "isolated");
|
|
326
|
+
const validate1692 = (value) => typeof value === "string" && (value === "spam" || value === "dmarc" || value === "virus" || value === "virus_unscanned" || value === "phishing" || value === "fraud" || value === "prompt_injection");
|
|
327
|
+
const validate1693 = (value) => typeof value === "string" && (value === "receipt" || value === "classifier");
|
|
328
|
+
const validate1694 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "from") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "receivedAt") && (!Object.hasOwn(value, "id") || validate779(value["id"])) && (!Object.hasOwn(value, "from") || validate1465(value["from"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "receivedAt") || validate2(value["receivedAt"]));
|
|
311
329
|
const validate1705 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1706(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1708(value["data"]));
|
|
312
|
-
const validate1706 = (value) => typeof value === "string" && value === "mailbox.message.
|
|
313
|
-
const validate1708 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
const
|
|
318
|
-
const
|
|
319
|
-
const
|
|
320
|
-
const
|
|
321
|
-
const
|
|
322
|
-
const
|
|
323
|
-
const
|
|
324
|
-
const
|
|
325
|
-
const
|
|
326
|
-
const
|
|
327
|
-
const
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
const
|
|
330
|
+
const validate1706 = (value) => typeof value === "string" && value === "mailbox.message.released";
|
|
331
|
+
const validate1708 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "releasedBy") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "releasedBy") || validate1512(value["releasedBy"])) && (!Object.hasOwn(value, "reason") || validate1692(value["reason"])) && (!Object.hasOwn(value, "message") || validate1456(value["message"])) && (!Object.hasOwn(value, "thread") || validate1490(value["thread"]));
|
|
332
|
+
const validate1766 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1767(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1769(value["data"]));
|
|
333
|
+
const validate1767 = (value) => typeof value === "string" && value === "mailbox.message.discarded";
|
|
334
|
+
const validate1769 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "discardedBy") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "discardedBy") || validate1512(value["discardedBy"])) && (!Object.hasOwn(value, "disposition") || validate1691(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1692(value["reason"])) && (!Object.hasOwn(value, "message") || validate1694(value["message"]));
|
|
335
|
+
const validate1794 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1795(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1797(value["data"]));
|
|
336
|
+
const validate1795 = (value) => typeof value === "string" && value === "mailbox.message.delivered";
|
|
337
|
+
const validate1797 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "status") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "threadId") || validate1464(value["threadId"])) && (!Object.hasOwn(value, "actionId") || validate1509(value["actionId"])) && (!Object.hasOwn(value, "messageId") || validate779(value["messageId"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "status") || validate1808(value["status"]));
|
|
338
|
+
const validate1808 = (value) => typeof value === "string" && value === "delivered";
|
|
339
|
+
const validate1809 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1810(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1812(value["data"]));
|
|
340
|
+
const validate1810 = (value) => typeof value === "string" && value === "mailbox.message.read";
|
|
341
|
+
const validate1812 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "status") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "threadId") || validate1464(value["threadId"])) && (!Object.hasOwn(value, "actionId") || validate1509(value["actionId"])) && (!Object.hasOwn(value, "messageId") || validate779(value["messageId"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "status") || validate1823(value["status"]));
|
|
342
|
+
const validate1823 = (value) => typeof value === "string" && value === "read";
|
|
343
|
+
const validate1824 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1825(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1827(value["data"]));
|
|
344
|
+
const validate1825 = (value) => typeof value === "string" && value === "mailbox.message.failed";
|
|
345
|
+
const validate1827 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "status") && Object.hasOwn(value, "error") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1335(value["namespaceId"])) && (!Object.hasOwn(value, "threadId") || validate1464(value["threadId"])) && (!Object.hasOwn(value, "actionId") || validate1509(value["actionId"])) && (!Object.hasOwn(value, "messageId") || validate779(value["messageId"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "status") || validate1838(value["status"])) && (!Object.hasOwn(value, "error") || validate1839(value["error"]));
|
|
346
|
+
const validate1838 = (value) => typeof value === "string" && value === "failed";
|
|
347
|
+
const validate1839 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "code") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "code") || validate8(value["code"])) && (!Object.hasOwn(value, "message") || validate8(value["message"]));
|
|
348
|
+
const validate1846 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1847(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1849(value["data"]));
|
|
349
|
+
const validate1847 = (value) => typeof value === "string" && value === "journey.webhook";
|
|
350
|
+
const validate1849 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "journeyId") && Object.hasOwn(value, "journeyVersion") && Object.hasOwn(value, "runId") && Object.hasOwn(value, "nodeId") && Object.hasOwn(value, "contact") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "organizationId") || validate851(value["organizationId"])) && (!Object.hasOwn(value, "journeyId") || validate1851(value["journeyId"])) && (!Object.hasOwn(value, "journeyVersion") || validate1275(value["journeyVersion"])) && (!Object.hasOwn(value, "runId") || validate1853(value["runId"])) && (!Object.hasOwn(value, "nodeId") || validate2(value["nodeId"])) && (!Object.hasOwn(value, "contact") || validate1855(value["contact"])) && (!Object.hasOwn(value, "data") || validate12(value["data"]));
|
|
351
|
+
const validate1851 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrny_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
352
|
+
const validate1853 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
353
|
+
const validate1855 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "externalId") && Object.hasOwn(value, "email") && (!Object.hasOwn(value, "id") || validate950(value["id"])) && (!Object.hasOwn(value, "externalId") || validate8(value["externalId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"]));
|
|
333
354
|
/** Narrow an event to a structurally valid payload known to this package. */
|
|
334
355
|
const isKnownEvent = (value) => {
|
|
335
356
|
switch (value.type) {
|
|
@@ -358,20 +379,22 @@ const isKnownEvent = (value) => {
|
|
|
358
379
|
case "webhook.test": return validate1260(value);
|
|
359
380
|
case "domain.updated": return validate1264(value);
|
|
360
381
|
case "domain.warming.updated": return validate1306(value);
|
|
361
|
-
case "
|
|
362
|
-
case "
|
|
363
|
-
case "
|
|
364
|
-
case "
|
|
365
|
-
case "
|
|
366
|
-
case "mailbox.
|
|
367
|
-
case "mailbox.
|
|
368
|
-
case "mailbox.
|
|
369
|
-
case "mailbox.
|
|
370
|
-
case "mailbox.message.
|
|
371
|
-
case "mailbox.message.
|
|
372
|
-
case "mailbox.message.
|
|
373
|
-
case "mailbox.message.
|
|
374
|
-
case "
|
|
382
|
+
case "email.sending.paused": return validate1330(value);
|
|
383
|
+
case "email.sending.resumed": return validate1340(value);
|
|
384
|
+
case "template.registration.updated": return validate1350(value);
|
|
385
|
+
case "flow.registration.updated": return validate1386(value);
|
|
386
|
+
case "whatsapp.number.connected": return validate1428(value);
|
|
387
|
+
case "mailbox.message.received": return validate1448(value);
|
|
388
|
+
case "mailbox.message.sent": return validate1501(value);
|
|
389
|
+
case "mailbox.action.pending_approval": return validate1553(value);
|
|
390
|
+
case "mailbox.action.resolved": return validate1647(value);
|
|
391
|
+
case "mailbox.message.quarantined": return validate1683(value);
|
|
392
|
+
case "mailbox.message.released": return validate1705(value);
|
|
393
|
+
case "mailbox.message.discarded": return validate1766(value);
|
|
394
|
+
case "mailbox.message.delivered": return validate1794(value);
|
|
395
|
+
case "mailbox.message.read": return validate1809(value);
|
|
396
|
+
case "mailbox.message.failed": return validate1824(value);
|
|
397
|
+
case "journey.webhook": return validate1846(value);
|
|
375
398
|
default: return false;
|
|
376
399
|
}
|
|
377
400
|
};
|
|
@@ -403,20 +426,22 @@ const validateEvent = (value) => {
|
|
|
403
426
|
case "webhook.test": return validate1260(value);
|
|
404
427
|
case "domain.updated": return validate1264(value);
|
|
405
428
|
case "domain.warming.updated": return validate1306(value);
|
|
406
|
-
case "
|
|
407
|
-
case "
|
|
408
|
-
case "
|
|
409
|
-
case "
|
|
410
|
-
case "
|
|
411
|
-
case "mailbox.
|
|
412
|
-
case "mailbox.
|
|
413
|
-
case "mailbox.
|
|
414
|
-
case "mailbox.
|
|
415
|
-
case "mailbox.message.
|
|
416
|
-
case "mailbox.message.
|
|
417
|
-
case "mailbox.message.
|
|
418
|
-
case "mailbox.message.
|
|
419
|
-
case "
|
|
429
|
+
case "email.sending.paused": return validate1330(value);
|
|
430
|
+
case "email.sending.resumed": return validate1340(value);
|
|
431
|
+
case "template.registration.updated": return validate1350(value);
|
|
432
|
+
case "flow.registration.updated": return validate1386(value);
|
|
433
|
+
case "whatsapp.number.connected": return validate1428(value);
|
|
434
|
+
case "mailbox.message.received": return validate1448(value);
|
|
435
|
+
case "mailbox.message.sent": return validate1501(value);
|
|
436
|
+
case "mailbox.action.pending_approval": return validate1553(value);
|
|
437
|
+
case "mailbox.action.resolved": return validate1647(value);
|
|
438
|
+
case "mailbox.message.quarantined": return validate1683(value);
|
|
439
|
+
case "mailbox.message.released": return validate1705(value);
|
|
440
|
+
case "mailbox.message.discarded": return validate1766(value);
|
|
441
|
+
case "mailbox.message.delivered": return validate1794(value);
|
|
442
|
+
case "mailbox.message.read": return validate1809(value);
|
|
443
|
+
case "mailbox.message.failed": return validate1824(value);
|
|
444
|
+
case "journey.webhook": return validate1846(value);
|
|
420
445
|
default: return true;
|
|
421
446
|
}
|
|
422
447
|
};
|
|
@@ -477,8 +502,8 @@ var WebhookTimestampError = class extends WebhookVerificationError {
|
|
|
477
502
|
}
|
|
478
503
|
};
|
|
479
504
|
/**
|
|
480
|
-
* No signature in the `webhook-signature` header matches the delivery
|
|
481
|
-
*
|
|
505
|
+
* No signature in the `webhook-signature` header matches the delivery. Treat the request as forged
|
|
506
|
+
* and reject it. When genuine deliveries fail, the usual
|
|
482
507
|
* causes are the wrong endpoint secret or a body that was parsed and re-serialized before
|
|
483
508
|
* verification instead of passed through as the exact bytes received.
|
|
484
509
|
*/
|
|
@@ -497,9 +522,9 @@ var MalformedWebhookPayloadError = class extends WebhookVerificationError {
|
|
|
497
522
|
}
|
|
498
523
|
};
|
|
499
524
|
/**
|
|
500
|
-
* The runtime's Web Crypto implementation could not import a key or compute a signature,
|
|
501
|
-
*
|
|
502
|
-
*
|
|
525
|
+
* The runtime's Web Crypto implementation could not import a key or compute a signature, or the
|
|
526
|
+
* Effect entrypoint could not read the request body. Points at the runtime or its configuration
|
|
527
|
+
* rather than at the delivery.
|
|
503
528
|
*/
|
|
504
529
|
var WebhookCryptoError = class extends WebhookVerificationError {
|
|
505
530
|
constructor(options) {
|
|
@@ -527,10 +552,6 @@ const WEBHOOK_SIGNATURE_HEADER = "webhook-signature";
|
|
|
527
552
|
*/
|
|
528
553
|
const DEFAULT_TOLERANCE_SECONDS = 300;
|
|
529
554
|
const SECRET_PREFIX = "whsec_";
|
|
530
|
-
const ASYMMETRIC_ALGORITHM = {
|
|
531
|
-
name: "RSASSA-PKCS1-v1_5",
|
|
532
|
-
hash: "SHA-256"
|
|
533
|
-
};
|
|
534
555
|
const MINIMUM_SECRET_BYTES = 24;
|
|
535
556
|
const MAXIMUM_SECRET_BYTES = 64;
|
|
536
557
|
const GENERATED_SECRET_BYTES = 32;
|
|
@@ -569,13 +590,6 @@ const importHmacKey = async (secret) => {
|
|
|
569
590
|
throw new WebhookCryptoError({ detail: `Unable to import webhook signing key: ${cause instanceof Error ? cause.message : String(cause)}` });
|
|
570
591
|
}
|
|
571
592
|
};
|
|
572
|
-
const importVerificationKey = async (publicKey) => {
|
|
573
|
-
try {
|
|
574
|
-
return await crypto.subtle.importKey("spki", toCryptoBytes(base64ToBytes(publicKey.trim())), ASYMMETRIC_ALGORITHM, false, ["verify"]);
|
|
575
|
-
} catch {
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
593
|
const signedBytes = (id, timestamp, body) => {
|
|
580
594
|
const prefix = encoder.encode(`${id}.${timestamp}.`);
|
|
581
595
|
const material = new Uint8Array(prefix.byteLength + body.byteLength);
|
|
@@ -591,21 +605,14 @@ const hmac = async (secret, id, timestamp, body) => {
|
|
|
591
605
|
throw new WebhookCryptoError({ detail: `Unable to sign webhook: ${cause instanceof Error ? cause.message : String(cause)}` });
|
|
592
606
|
}
|
|
593
607
|
};
|
|
594
|
-
const asymmetricMatch = async (key, candidate, content) => {
|
|
595
|
-
try {
|
|
596
|
-
return await crypto.subtle.verify(ASYMMETRIC_ALGORITHM, key, toCryptoBytes(candidate), content);
|
|
597
|
-
} catch {
|
|
598
|
-
return false;
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
608
|
const timingSafeEqual = (left, right) => {
|
|
602
609
|
if (left.byteLength !== right.byteLength) return false;
|
|
603
610
|
let difference = 0;
|
|
604
611
|
for (let index = 0; index < left.byteLength; index += 1) difference |= (left[index] ?? 0) ^ (right[index] ?? 0);
|
|
605
612
|
return difference === 0;
|
|
606
613
|
};
|
|
607
|
-
const signatureCandidates = (header
|
|
608
|
-
if (version !==
|
|
614
|
+
const signatureCandidates = (header) => header.split(" ").map((candidate) => candidate.split(",", 2)).flatMap(([version, encoded]) => {
|
|
615
|
+
if (version !== "v1" || encoded === void 0) return [];
|
|
609
616
|
try {
|
|
610
617
|
return [base64ToBytes(encoded)];
|
|
611
618
|
} catch {
|
|
@@ -634,14 +641,6 @@ const generateWebhookSecret = () => {
|
|
|
634
641
|
return `${SECRET_PREFIX}${bytesToBase64(bytes)}`;
|
|
635
642
|
};
|
|
636
643
|
/**
|
|
637
|
-
* Builds the bytes every signature version covers: `<id>.<timestamp>.<body>`. Use it to verify a
|
|
638
|
-
* signature with your own crypto code; {@link verifyWebhookAt} and
|
|
639
|
-
* {@link verifyWebhookAtWithPublicKeys} build it for you.
|
|
640
|
-
*/
|
|
641
|
-
const webhookSignedContent = (input) => signedBytes(input.id, input.timestamp, toBytes(input.body));
|
|
642
|
-
/** Formats raw signature bytes as one `<version>,<base64>` entry of the `webhook-signature` header. */
|
|
643
|
-
const encodeWebhookSignature = (version, signature) => `${version},${bytesToBase64(signature)}`;
|
|
644
|
-
/**
|
|
645
644
|
* Computes the `v1` HMAC-SHA256 signature Samva sends, formatted as one `webhook-signature`
|
|
646
645
|
* entry. Use it to produce signed test deliveries for your handler.
|
|
647
646
|
*
|
|
@@ -652,7 +651,7 @@ const encodeWebhookSignature = (version, signature) => `${version},${bytesToBase
|
|
|
652
651
|
const signWebhook = async (input) => {
|
|
653
652
|
const timestamp = String(input.timestamp);
|
|
654
653
|
const signature = await hmac(input.secret, input.id, timestamp, toBytes(input.body));
|
|
655
|
-
return
|
|
654
|
+
return `v1,${bytesToBase64(signature)}`;
|
|
656
655
|
};
|
|
657
656
|
const requireHeader = (header, value) => {
|
|
658
657
|
if (value === null || value === void 0) throw new InvalidWebhookHeadersError({
|
|
@@ -702,30 +701,7 @@ const verifyWebhookAt = async (input) => {
|
|
|
702
701
|
const { id, timestamp, signature } = freshHeaders(input);
|
|
703
702
|
const body = toBytes(input.body);
|
|
704
703
|
const expected = await hmac(input.secret, id, timestamp, body);
|
|
705
|
-
if (!signatureCandidates(signature
|
|
706
|
-
return {
|
|
707
|
-
id,
|
|
708
|
-
event: parseEvent(body)
|
|
709
|
-
};
|
|
710
|
-
};
|
|
711
|
-
/**
|
|
712
|
-
* Verifies a `v2` (RSASSA-PKCS1-v1_5, SHA-256) delivery against one or more public keys, each a
|
|
713
|
-
* Base64-encoded SPKI DER key. Pass several keys during a key rotation; the delivery verifies when
|
|
714
|
-
* any `v2` signature entry matches any key.
|
|
715
|
-
*
|
|
716
|
-
* Header, timestamp, and envelope checks match {@link verifyWebhookAt}. Keys that fail to import
|
|
717
|
-
* are skipped. Rejects with {@link WebhookSignatureError} when `publicKeys` is empty or nothing
|
|
718
|
-
* matches, and {@link WebhookCryptoError} when none of the keys imports.
|
|
719
|
-
*/
|
|
720
|
-
const verifyWebhookAtWithPublicKeys = async (input) => {
|
|
721
|
-
const { id, timestamp, signature } = freshHeaders(input);
|
|
722
|
-
if (input.publicKeys.length === 0) throw new WebhookSignatureError({ detail: "No webhook verification key is available" });
|
|
723
|
-
const keys = (await Promise.all(input.publicKeys.map(importVerificationKey))).filter((key) => key !== void 0);
|
|
724
|
-
if (keys.length === 0) throw new WebhookCryptoError({ detail: "Unable to import any webhook verification key: keys must be Base64 SPKI DER" });
|
|
725
|
-
const body = toBytes(input.body);
|
|
726
|
-
const content = toCryptoBytes(signedBytes(id, timestamp, body));
|
|
727
|
-
const candidates = signatureCandidates(signature, "v2");
|
|
728
|
-
if (!(await Promise.all(keys.flatMap((key) => candidates.map((candidate) => asymmetricMatch(key, candidate, content))))).includes(true)) throw new WebhookSignatureError({ detail: "Webhook signature verification failed" });
|
|
704
|
+
if (!signatureCandidates(signature).some((candidate) => timingSafeEqual(expected, candidate))) throw new WebhookSignatureError({ detail: "Webhook signature verification failed" });
|
|
729
705
|
return {
|
|
730
706
|
id,
|
|
731
707
|
event: parseEvent(body)
|
|
@@ -742,6 +718,6 @@ const readWebhookHeaders = (headers) => requireHeaders({
|
|
|
742
718
|
timestamp: headers.get(WEBHOOK_TIMESTAMP_HEADER),
|
|
743
719
|
signature: headers.get(WEBHOOK_SIGNATURE_HEADER)
|
|
744
720
|
});
|
|
745
|
-
export {
|
|
721
|
+
export { generateWebhookSecret as a, verifyWebhookAt as c, MalformedWebhookPayloadError as d, WebhookCryptoError as f, isKnownEvent as g, WebhookVerificationError as h, WEBHOOK_TIMESTAMP_HEADER as i, InvalidWebhookHeadersError as l, WebhookTimestampError as m, WEBHOOK_ID_HEADER as n, readWebhookHeaders as o, WebhookSignatureError as p, WEBHOOK_SIGNATURE_HEADER as r, signWebhook as s, DEFAULT_TOLERANCE_SECONDS as t, InvalidWebhookSecretError as u };
|
|
746
722
|
|
|
747
|
-
//# sourceMappingURL=protocol-
|
|
723
|
+
//# sourceMappingURL=protocol-IJ8lllqW.js.map
|