@zyphr-dev/node-sdk 0.1.45 → 0.1.47

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.cjs CHANGED
@@ -6958,7 +6958,8 @@ var EmailMessageStatusEnum = {
6958
6958
  DELIVERED: "delivered",
6959
6959
  FAILED: "failed",
6960
6960
  BOUNCED: "bounced",
6961
- REJECTED: "rejected"
6961
+ REJECTED: "rejected",
6962
+ SUPPRESSED: "suppressed"
6962
6963
  };
6963
6964
  function instanceOfEmailMessage(value) {
6964
6965
  return true;
@@ -6976,6 +6977,7 @@ function EmailMessageFromJSONTyped(json, ignoreDiscriminator) {
6976
6977
  "to": json["to"] == null ? void 0 : EmailAddressFromJSON(json["to"]),
6977
6978
  "subject": json["subject"] == null ? void 0 : json["subject"],
6978
6979
  "status": json["status"] == null ? void 0 : json["status"],
6980
+ "statusReason": json["status_reason"] == null ? void 0 : json["status_reason"],
6979
6981
  "tags": json["tags"] == null ? void 0 : json["tags"],
6980
6982
  "queuedAt": json["queued_at"] == null ? void 0 : new Date(json["queued_at"]),
6981
6983
  "sentAt": json["sent_at"] == null ? void 0 : new Date(json["sent_at"]),
@@ -6999,6 +7001,7 @@ function EmailMessageToJSONTyped(value, ignoreDiscriminator = false) {
6999
7001
  "to": EmailAddressToJSON(value["to"]),
7000
7002
  "subject": value["subject"],
7001
7003
  "status": value["status"],
7004
+ "status_reason": value["statusReason"],
7002
7005
  "tags": value["tags"],
7003
7006
  "queued_at": value["queuedAt"] == null ? void 0 : value["queuedAt"].toISOString(),
7004
7007
  "sent_at": value["sentAt"] == null ? void 0 : value["sentAt"].toISOString(),
@@ -18529,6 +18532,7 @@ var WebhookEventType = {
18529
18532
  EMAIL_OPENED: "email.opened",
18530
18533
  EMAIL_CLICKED: "email.clicked",
18531
18534
  EMAIL_FAILED: "email.failed",
18535
+ EMAIL_SUPPRESSED: "email.suppressed",
18532
18536
  EMAIL_RECEIVED: "email.received",
18533
18537
  PUSH_SENT: "push.sent",
18534
18538
  PUSH_DELIVERED: "push.delivered",
@@ -23403,7 +23407,8 @@ var ListEmailsStatusEnum = {
23403
23407
  DELIVERED: "delivered",
23404
23408
  FAILED: "failed",
23405
23409
  BOUNCED: "bounced",
23406
- REJECTED: "rejected"
23410
+ REJECTED: "rejected",
23411
+ SUPPRESSED: "suppressed"
23407
23412
  };
23408
23413
 
23409
23414
  // src/src/apis/ExecutionsApi.ts
@@ -28999,10 +29004,18 @@ var ZyphrClient = class {
28999
29004
  this.accessToken = options.accessToken;
29000
29005
  const config = new Configuration({
29001
29006
  basePath: options.baseUrl,
29002
- // The only credential this client sends automatically is the publishable
29003
- // application key. End-user Bearer tokens are attached per-request via
29004
- // authedRequest() so token rotation doesn't require rebuilding the client.
29007
+ // The publishable application key is sent automatically on every call.
29005
29008
  apiKey: (name) => name === "X-Application-Key" ? this.applicationKey : "",
29009
+ // The stored end-user access token is also applied automatically: any
29010
+ // user-scoped generated method (which authenticates the EndUserToken
29011
+ // scheme) invokes this callback and attaches `Authorization: Bearer`.
29012
+ // The callback reads `this.accessToken` at call time, so setAccessToken()
29013
+ // takes effect on subsequent calls without rebuilding the client. When no
29014
+ // token is set it returns '', and the generated code adds no header — so
29015
+ // anonymous endpoints (login, register, password-reset) stay unauthenticated.
29016
+ // An explicit token passed to authedRequest() sets the header directly in
29017
+ // RequestInit, which overrides this callback.
29018
+ accessToken: async () => this.accessToken ?? "",
29006
29019
  middleware: [errorMiddleware2]
29007
29020
  });
29008
29021
  this.auth = {
@@ -29022,7 +29035,7 @@ var ZyphrClient = class {
29022
29035
  };
29023
29036
  this.devices = new DevicesApi(config);
29024
29037
  }
29025
- /** Store the end-user access token for subsequent authedRequest() calls. */
29038
+ /** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
29026
29039
  setAccessToken(accessToken) {
29027
29040
  this.accessToken = accessToken;
29028
29041
  }
@@ -29033,17 +29046,24 @@ var ZyphrClient = class {
29033
29046
  /**
29034
29047
  * Build request overrides that authenticate as the current end user: the
29035
29048
  * stored Bearer token plus the publishable application key required by
29036
- * user-scoped endpoints. Pass an explicit token to override the stored one.
29049
+ * user-scoped endpoints.
29050
+ *
29051
+ * The stored token is now applied automatically to user-scoped calls, so this
29052
+ * is no longer required for authentication. It remains useful to authenticate
29053
+ * a single call with a different token — a token passed here sets the header
29054
+ * directly in RequestInit and overrides the stored token for that call.
29037
29055
  *
29038
29056
  * @example
29039
29057
  * ```ts
29040
- * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
29058
+ * // Authenticate one call as a different user, without changing stored state:
29059
+ * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest(otherToken));
29041
29060
  * ```
29042
29061
  */
29043
29062
  authedRequest(accessToken) {
29044
29063
  const token = accessToken ?? this.accessToken;
29045
29064
  const headers = {
29046
- "X-Application-Key": this.applicationKey
29065
+ "X-Application-Key": this.applicationKey,
29066
+ "Content-Type": "application/json"
29047
29067
  };
29048
29068
  if (token) {
29049
29069
  headers.Authorization = `Bearer ${token}`;