@zyphr-dev/node-sdk 0.1.22 → 0.1.24

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.js CHANGED
@@ -1386,6 +1386,38 @@ function BatchPublishWaaSEvents201ResponseToJSONTyped(value, ignoreDiscriminator
1386
1386
  };
1387
1387
  }
1388
1388
 
1389
+ // src/src/models/BatchRecipient.ts
1390
+ function instanceOfBatchRecipient(value) {
1391
+ if (!("email" in value) || value["email"] === void 0) return false;
1392
+ return true;
1393
+ }
1394
+ function BatchRecipientFromJSON(json) {
1395
+ return BatchRecipientFromJSONTyped(json, false);
1396
+ }
1397
+ function BatchRecipientFromJSONTyped(json, ignoreDiscriminator) {
1398
+ if (json == null) {
1399
+ return json;
1400
+ }
1401
+ return {
1402
+ "email": json["email"],
1403
+ "name": json["name"] == null ? void 0 : json["name"],
1404
+ "variables": json["variables"] == null ? void 0 : json["variables"]
1405
+ };
1406
+ }
1407
+ function BatchRecipientToJSON(json) {
1408
+ return BatchRecipientToJSONTyped(json, false);
1409
+ }
1410
+ function BatchRecipientToJSONTyped(value, ignoreDiscriminator = false) {
1411
+ if (value == null) {
1412
+ return value;
1413
+ }
1414
+ return {
1415
+ "email": value["email"],
1416
+ "name": value["name"],
1417
+ "variables": value["variables"]
1418
+ };
1419
+ }
1420
+
1389
1421
  // src/src/models/BulkRetryWebhookDeliveriesRequest.ts
1390
1422
  var BulkRetryWebhookDeliveriesRequestStatusEnum = {
1391
1423
  FAILED: "failed",
@@ -2125,8 +2157,7 @@ function CreateTemplateRequestFromJSONTyped(json, ignoreDiscriminator) {
2125
2157
  "description": json["description"] == null ? void 0 : json["description"],
2126
2158
  "subject": json["subject"] == null ? void 0 : json["subject"],
2127
2159
  "html": json["html"] == null ? void 0 : json["html"],
2128
- "text": json["text"] == null ? void 0 : json["text"],
2129
- "variables": json["variables"] == null ? void 0 : json["variables"]
2160
+ "text": json["text"] == null ? void 0 : json["text"]
2130
2161
  };
2131
2162
  }
2132
2163
  function CreateTemplateRequestToJSON(json) {
@@ -2141,8 +2172,7 @@ function CreateTemplateRequestToJSONTyped(value, ignoreDiscriminator = false) {
2141
2172
  "description": value["description"],
2142
2173
  "subject": value["subject"],
2143
2174
  "html": value["html"],
2144
- "text": value["text"],
2145
- "variables": value["variables"]
2175
+ "text": value["text"]
2146
2176
  };
2147
2177
  }
2148
2178
 
@@ -7195,92 +7225,50 @@ function RevokeSessionRequestToJSONTyped(value, ignoreDiscriminator = false) {
7195
7225
  };
7196
7226
  }
7197
7227
 
7198
- // src/src/models/SendEmailRequest.ts
7199
- function instanceOfSendEmailRequest(value) {
7228
+ // src/src/models/SendBatchEmailRequest.ts
7229
+ function instanceOfSendBatchEmailRequest(value) {
7230
+ if (!("from" in value) || value["from"] === void 0) return false;
7200
7231
  if (!("to" in value) || value["to"] === void 0) return false;
7201
- if (!("subject" in value) || value["subject"] === void 0) return false;
7202
7232
  return true;
7203
7233
  }
7204
- function SendEmailRequestFromJSON(json) {
7205
- return SendEmailRequestFromJSONTyped(json, false);
7234
+ function SendBatchEmailRequestFromJSON(json) {
7235
+ return SendBatchEmailRequestFromJSONTyped(json, false);
7206
7236
  }
7207
- function SendEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
7237
+ function SendBatchEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
7208
7238
  if (json == null) {
7209
7239
  return json;
7210
7240
  }
7211
7241
  return {
7212
- "to": json["to"].map(EmailAddressFromJSON),
7213
- "from": json["from"] == null ? void 0 : EmailAddressFromJSON(json["from"]),
7242
+ "from": EmailAddressFromJSON(json["from"]),
7243
+ "to": json["to"].map(BatchRecipientFromJSON),
7214
7244
  "replyTo": json["reply_to"] == null ? void 0 : EmailAddressFromJSON(json["reply_to"]),
7215
- "cc": json["cc"] == null ? void 0 : json["cc"],
7216
- "bcc": json["bcc"] == null ? void 0 : json["bcc"],
7217
- "subject": json["subject"],
7245
+ "subject": json["subject"] == null ? void 0 : json["subject"],
7218
7246
  "html": json["html"] == null ? void 0 : json["html"],
7219
7247
  "text": json["text"] == null ? void 0 : json["text"],
7220
7248
  "templateId": json["template_id"] == null ? void 0 : json["template_id"],
7221
7249
  "templateData": json["template_data"] == null ? void 0 : json["template_data"],
7222
- "attachments": json["attachments"] == null ? void 0 : json["attachments"].map(EmailAttachmentFromJSON),
7223
- "headers": json["headers"] == null ? void 0 : json["headers"],
7224
7250
  "tags": json["tags"] == null ? void 0 : json["tags"],
7225
- "metadata": json["metadata"] == null ? void 0 : json["metadata"],
7226
- "scheduledAt": json["scheduled_at"] == null ? void 0 : new Date(json["scheduled_at"]),
7227
- "subscriberId": json["subscriber_id"] == null ? void 0 : json["subscriber_id"],
7228
- "category": json["category"] == null ? void 0 : json["category"]
7251
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"]
7229
7252
  };
7230
7253
  }
7231
- function SendEmailRequestToJSON(json) {
7232
- return SendEmailRequestToJSONTyped(json, false);
7254
+ function SendBatchEmailRequestToJSON(json) {
7255
+ return SendBatchEmailRequestToJSONTyped(json, false);
7233
7256
  }
7234
- function SendEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
7257
+ function SendBatchEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
7235
7258
  if (value == null) {
7236
7259
  return value;
7237
7260
  }
7238
7261
  return {
7239
- "to": value["to"].map(EmailAddressToJSON),
7240
7262
  "from": EmailAddressToJSON(value["from"]),
7263
+ "to": value["to"].map(BatchRecipientToJSON),
7241
7264
  "reply_to": EmailAddressToJSON(value["replyTo"]),
7242
- "cc": value["cc"],
7243
- "bcc": value["bcc"],
7244
7265
  "subject": value["subject"],
7245
7266
  "html": value["html"],
7246
7267
  "text": value["text"],
7247
7268
  "template_id": value["templateId"],
7248
7269
  "template_data": value["templateData"],
7249
- "attachments": value["attachments"] == null ? void 0 : value["attachments"].map(EmailAttachmentToJSON),
7250
- "headers": value["headers"],
7251
7270
  "tags": value["tags"],
7252
- "metadata": value["metadata"],
7253
- "scheduled_at": value["scheduledAt"] == null ? void 0 : value["scheduledAt"].toISOString(),
7254
- "subscriber_id": value["subscriberId"],
7255
- "category": value["category"]
7256
- };
7257
- }
7258
-
7259
- // src/src/models/SendBatchEmailRequest.ts
7260
- function instanceOfSendBatchEmailRequest(value) {
7261
- if (!("messages" in value) || value["messages"] === void 0) return false;
7262
- return true;
7263
- }
7264
- function SendBatchEmailRequestFromJSON(json) {
7265
- return SendBatchEmailRequestFromJSONTyped(json, false);
7266
- }
7267
- function SendBatchEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
7268
- if (json == null) {
7269
- return json;
7270
- }
7271
- return {
7272
- "messages": json["messages"].map(SendEmailRequestFromJSON)
7273
- };
7274
- }
7275
- function SendBatchEmailRequestToJSON(json) {
7276
- return SendBatchEmailRequestToJSONTyped(json, false);
7277
- }
7278
- function SendBatchEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
7279
- if (value == null) {
7280
- return value;
7281
- }
7282
- return {
7283
- "messages": value["messages"].map(SendEmailRequestToJSON)
7271
+ "metadata": value["metadata"]
7284
7272
  };
7285
7273
  }
7286
7274
 
@@ -7687,6 +7675,67 @@ function SendBatchSmsResponseToJSONTyped(value, ignoreDiscriminator = false) {
7687
7675
  };
7688
7676
  }
7689
7677
 
7678
+ // src/src/models/SendEmailRequest.ts
7679
+ function instanceOfSendEmailRequest(value) {
7680
+ if (!("to" in value) || value["to"] === void 0) return false;
7681
+ if (!("subject" in value) || value["subject"] === void 0) return false;
7682
+ return true;
7683
+ }
7684
+ function SendEmailRequestFromJSON(json) {
7685
+ return SendEmailRequestFromJSONTyped(json, false);
7686
+ }
7687
+ function SendEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
7688
+ if (json == null) {
7689
+ return json;
7690
+ }
7691
+ return {
7692
+ "to": json["to"].map(EmailAddressFromJSON),
7693
+ "from": json["from"] == null ? void 0 : EmailAddressFromJSON(json["from"]),
7694
+ "replyTo": json["reply_to"] == null ? void 0 : EmailAddressFromJSON(json["reply_to"]),
7695
+ "cc": json["cc"] == null ? void 0 : json["cc"],
7696
+ "bcc": json["bcc"] == null ? void 0 : json["bcc"],
7697
+ "subject": json["subject"],
7698
+ "html": json["html"] == null ? void 0 : json["html"],
7699
+ "text": json["text"] == null ? void 0 : json["text"],
7700
+ "templateId": json["template_id"] == null ? void 0 : json["template_id"],
7701
+ "templateData": json["template_data"] == null ? void 0 : json["template_data"],
7702
+ "attachments": json["attachments"] == null ? void 0 : json["attachments"].map(EmailAttachmentFromJSON),
7703
+ "headers": json["headers"] == null ? void 0 : json["headers"],
7704
+ "tags": json["tags"] == null ? void 0 : json["tags"],
7705
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"],
7706
+ "scheduledAt": json["scheduled_at"] == null ? void 0 : new Date(json["scheduled_at"]),
7707
+ "subscriberId": json["subscriber_id"] == null ? void 0 : json["subscriber_id"],
7708
+ "category": json["category"] == null ? void 0 : json["category"]
7709
+ };
7710
+ }
7711
+ function SendEmailRequestToJSON(json) {
7712
+ return SendEmailRequestToJSONTyped(json, false);
7713
+ }
7714
+ function SendEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
7715
+ if (value == null) {
7716
+ return value;
7717
+ }
7718
+ return {
7719
+ "to": value["to"].map(EmailAddressToJSON),
7720
+ "from": EmailAddressToJSON(value["from"]),
7721
+ "reply_to": EmailAddressToJSON(value["replyTo"]),
7722
+ "cc": value["cc"],
7723
+ "bcc": value["bcc"],
7724
+ "subject": value["subject"],
7725
+ "html": value["html"],
7726
+ "text": value["text"],
7727
+ "template_id": value["templateId"],
7728
+ "template_data": value["templateData"],
7729
+ "attachments": value["attachments"] == null ? void 0 : value["attachments"].map(EmailAttachmentToJSON),
7730
+ "headers": value["headers"],
7731
+ "tags": value["tags"],
7732
+ "metadata": value["metadata"],
7733
+ "scheduled_at": value["scheduledAt"] == null ? void 0 : value["scheduledAt"].toISOString(),
7734
+ "subscriber_id": value["subscriberId"],
7735
+ "category": value["category"]
7736
+ };
7737
+ }
7738
+
7690
7739
  // src/src/models/SendEmailResponseMeta.ts
7691
7740
  function instanceOfSendEmailResponseMeta(value) {
7692
7741
  return true;
@@ -9340,7 +9389,6 @@ function TemplateToJSONTyped(value, ignoreDiscriminator = false) {
9340
9389
  "subject": value["subject"],
9341
9390
  "html": value["html"],
9342
9391
  "text": value["text"],
9343
- "variables": value["variables"],
9344
9392
  "version": value["version"],
9345
9393
  "created_at": value["createdAt"] == null ? void 0 : value["createdAt"].toISOString(),
9346
9394
  "updated_at": value["updatedAt"] == null ? void 0 : value["updatedAt"].toISOString()
@@ -9449,7 +9497,8 @@ function TemplateResponseFromJSONTyped(json, ignoreDiscriminator) {
9449
9497
  }
9450
9498
  return {
9451
9499
  "data": json["data"] == null ? void 0 : TemplateFromJSON(json["data"]),
9452
- "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
9500
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"]),
9501
+ "warnings": json["warnings"] == null ? void 0 : json["warnings"]
9453
9502
  };
9454
9503
  }
9455
9504
  function TemplateResponseToJSON(json) {
@@ -9461,7 +9510,8 @@ function TemplateResponseToJSONTyped(value, ignoreDiscriminator = false) {
9461
9510
  }
9462
9511
  return {
9463
9512
  "data": TemplateToJSON(value["data"]),
9464
- "meta": RequestMetaToJSON(value["meta"])
9513
+ "meta": RequestMetaToJSON(value["meta"]),
9514
+ "warnings": value["warnings"]
9465
9515
  };
9466
9516
  }
9467
9517
 
@@ -10303,8 +10353,7 @@ function UpdateTemplateRequestFromJSONTyped(json, ignoreDiscriminator) {
10303
10353
  "description": json["description"] == null ? void 0 : json["description"],
10304
10354
  "subject": json["subject"] == null ? void 0 : json["subject"],
10305
10355
  "html": json["html"] == null ? void 0 : json["html"],
10306
- "text": json["text"] == null ? void 0 : json["text"],
10307
- "variables": json["variables"] == null ? void 0 : json["variables"]
10356
+ "text": json["text"] == null ? void 0 : json["text"]
10308
10357
  };
10309
10358
  }
10310
10359
  function UpdateTemplateRequestToJSON(json) {
@@ -10319,8 +10368,7 @@ function UpdateTemplateRequestToJSONTyped(value, ignoreDiscriminator = false) {
10319
10368
  "description": value["description"],
10320
10369
  "subject": value["subject"],
10321
10370
  "html": value["html"],
10322
- "text": value["text"],
10323
- "variables": value["variables"]
10371
+ "text": value["text"]
10324
10372
  };
10325
10373
  }
10326
10374
 
@@ -14980,7 +15028,7 @@ var EmailsApi = class extends BaseAPI {
14980
15028
  return await response.value();
14981
15029
  }
14982
15030
  /**
14983
- * Send up to 100 emails in a single request. Each recipient gets their own message record.
15031
+ * Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`. Per-recipient `variables` are merged on top of the batch-level `template_data`.
14984
15032
  * Send batch emails
14985
15033
  */
14986
15034
  async sendBatchEmailRaw(requestParameters, initOverrides) {
@@ -15006,7 +15054,7 @@ var EmailsApi = class extends BaseAPI {
15006
15054
  return new JSONApiResponse(response, (jsonValue) => SendBatchEmailResponseFromJSON(jsonValue));
15007
15055
  }
15008
15056
  /**
15009
- * Send up to 100 emails in a single request. Each recipient gets their own message record.
15057
+ * Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`. Per-recipient `variables` are merged on top of the batch-level `template_data`.
15010
15058
  * Send batch emails
15011
15059
  */
15012
15060
  async sendBatchEmail(sendBatchEmailRequest, initOverrides) {
@@ -19796,6 +19844,13 @@ var ZyphrNotFoundError = class extends ZyphrError {
19796
19844
  this.name = "ZyphrNotFoundError";
19797
19845
  }
19798
19846
  };
19847
+ var ZyphrWebhookVerificationError = class extends ZyphrError {
19848
+ constructor(message) {
19849
+ super({ message, status: 401, code: "webhook_verification_failed" });
19850
+ this.name = "ZyphrWebhookVerificationError";
19851
+ }
19852
+ };
19853
+ var WebhookVerificationError = ZyphrWebhookVerificationError;
19799
19854
  async function parseErrorResponse(response) {
19800
19855
  let body = {};
19801
19856
  try {
@@ -20071,6 +20126,10 @@ export {
20071
20126
  BatchPublishWaaSEvents201ResponseFromJSONTyped,
20072
20127
  BatchPublishWaaSEvents201ResponseToJSON,
20073
20128
  BatchPublishWaaSEvents201ResponseToJSONTyped,
20129
+ BatchRecipientFromJSON,
20130
+ BatchRecipientFromJSONTyped,
20131
+ BatchRecipientToJSON,
20132
+ BatchRecipientToJSONTyped,
20074
20133
  BlobApiResponse,
20075
20134
  BulkRetryWebhookDeliveriesRequestFromJSON,
20076
20135
  BulkRetryWebhookDeliveriesRequestFromJSONTyped,
@@ -21478,6 +21537,7 @@ export {
21478
21537
  WebhookUsageResponseFromJSONTyped,
21479
21538
  WebhookUsageResponseToJSON,
21480
21539
  WebhookUsageResponseToJSONTyped,
21540
+ WebhookVerificationError,
21481
21541
  WebhookVersionFromJSON,
21482
21542
  WebhookVersionFromJSONTyped,
21483
21543
  WebhookVersionToJSON,
@@ -21520,6 +21580,7 @@ export {
21520
21580
  ZyphrNotFoundError,
21521
21581
  ZyphrRateLimitError,
21522
21582
  ZyphrValidationError,
21583
+ ZyphrWebhookVerificationError,
21523
21584
  canConsumeForm,
21524
21585
  exists,
21525
21586
  instanceOfAddTopicSubscribersRequest,
@@ -21554,6 +21615,7 @@ export {
21554
21615
  instanceOfAuthUserResponse,
21555
21616
  instanceOfAuthUserResponseData,
21556
21617
  instanceOfBatchPublishWaaSEvents201Response,
21618
+ instanceOfBatchRecipient,
21557
21619
  instanceOfBulkRetryWebhookDeliveriesRequest,
21558
21620
  instanceOfBulkUpsertAuthEmailTemplatesRequest,
21559
21621
  instanceOfBulkUpsertAuthEmailTemplatesResponse,