@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.d.cts CHANGED
@@ -6269,6 +6269,13 @@ interface EmailMessage {
6269
6269
  * @memberof EmailMessage
6270
6270
  */
6271
6271
  status?: EmailMessageStatusEnum;
6272
+ /**
6273
+ * Why the message is in its current status, when applicable. For a `suppressed` row this is the suppression reason (e.g. `recipient_not_allowlisted` when blocked by the auth application's test_recipients allowlist). Null for normal sends.
6274
+ *
6275
+ * @type {string}
6276
+ * @memberof EmailMessage
6277
+ */
6278
+ statusReason?: string | null;
6272
6279
  /**
6273
6280
  *
6274
6281
  * @type {Array<string>}
@@ -6329,6 +6336,7 @@ declare const EmailMessageStatusEnum: {
6329
6336
  readonly FAILED: "failed";
6330
6337
  readonly BOUNCED: "bounced";
6331
6338
  readonly REJECTED: "rejected";
6339
+ readonly SUPPRESSED: "suppressed";
6332
6340
  };
6333
6341
  type EmailMessageStatusEnum = typeof EmailMessageStatusEnum[keyof typeof EmailMessageStatusEnum];
6334
6342
  /**
@@ -23461,6 +23469,7 @@ declare const WebhookEventType: {
23461
23469
  readonly EMAIL_OPENED: "email.opened";
23462
23470
  readonly EMAIL_CLICKED: "email.clicked";
23463
23471
  readonly EMAIL_FAILED: "email.failed";
23472
+ readonly EMAIL_SUPPRESSED: "email.suppressed";
23464
23473
  readonly EMAIL_RECEIVED: "email.received";
23465
23474
  readonly PUSH_SENT: "push.sent";
23466
23475
  readonly PUSH_DELIVERED: "push.delivered";
@@ -28138,7 +28147,7 @@ interface EmailsApiInterface {
28138
28147
  /**
28139
28148
  * Retrieve a paginated list of sent emails
28140
28149
  * @summary List emails
28141
- * @param {'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'bounced' | 'rejected'} [status]
28150
+ * @param {'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'bounced' | 'rejected' | 'suppressed'} [status]
28142
28151
  * @param {string} [tag]
28143
28152
  * @param {number} [limit]
28144
28153
  * @param {number} [offset]
@@ -28257,6 +28266,7 @@ declare const ListEmailsStatusEnum: {
28257
28266
  readonly FAILED: "failed";
28258
28267
  readonly BOUNCED: "bounced";
28259
28268
  readonly REJECTED: "rejected";
28269
+ readonly SUPPRESSED: "suppressed";
28260
28270
  };
28261
28271
  type ListEmailsStatusEnum = typeof ListEmailsStatusEnum[keyof typeof ListEmailsStatusEnum];
28262
28272
 
@@ -33172,7 +33182,8 @@ declare class Zyphr {
33172
33182
  * const login = await zyphr.auth.login.loginEndUser({ ... });
33173
33183
  * zyphr.setAccessToken(login.data.tokens.access_token);
33174
33184
  *
33175
- * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
33185
+ * // The stored token is applied automatically to user-scoped calls:
33186
+ * const me = await zyphr.auth.profile.getEndUser();
33176
33187
  * ```
33177
33188
  */
33178
33189
 
@@ -33184,7 +33195,14 @@ interface ZyphrClientOptions {
33184
33195
  applicationKey: string;
33185
33196
  /** Override the base API URL (defaults to https://api.zyphr.dev/v1). */
33186
33197
  baseUrl?: string;
33187
- /** Optional end-user access token, if you already have a session on construction. */
33198
+ /**
33199
+ * Optional end-user access token, if you already have a session on
33200
+ * construction. Once set (here or via {@link ZyphrClient.setAccessToken}), it
33201
+ * is applied automatically as `Authorization: Bearer` to every user-scoped
33202
+ * call — you no longer need to pass {@link ZyphrClient.authedRequest} for
33203
+ * authentication (though authedRequest still works and a token passed to it
33204
+ * overrides the stored one).
33205
+ */
33188
33206
  accessToken?: string;
33189
33207
  }
33190
33208
  /**
@@ -33215,18 +33233,24 @@ declare class ZyphrClient {
33215
33233
  private readonly applicationKey;
33216
33234
  private accessToken?;
33217
33235
  constructor(options: ZyphrClientOptions);
33218
- /** Store the end-user access token for subsequent authedRequest() calls. */
33236
+ /** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
33219
33237
  setAccessToken(accessToken: string | undefined): void;
33220
33238
  /** True when an end-user access token is currently set. */
33221
33239
  get isAuthenticated(): boolean;
33222
33240
  /**
33223
33241
  * Build request overrides that authenticate as the current end user: the
33224
33242
  * stored Bearer token plus the publishable application key required by
33225
- * user-scoped endpoints. Pass an explicit token to override the stored one.
33243
+ * user-scoped endpoints.
33244
+ *
33245
+ * The stored token is now applied automatically to user-scoped calls, so this
33246
+ * is no longer required for authentication. It remains useful to authenticate
33247
+ * a single call with a different token — a token passed here sets the header
33248
+ * directly in RequestInit and overrides the stored token for that call.
33226
33249
  *
33227
33250
  * @example
33228
33251
  * ```ts
33229
- * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
33252
+ * // Authenticate one call as a different user, without changing stored state:
33253
+ * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest(otherToken));
33230
33254
  * ```
33231
33255
  */
33232
33256
  authedRequest(accessToken?: string): RequestInit;
package/dist/index.d.ts CHANGED
@@ -6269,6 +6269,13 @@ interface EmailMessage {
6269
6269
  * @memberof EmailMessage
6270
6270
  */
6271
6271
  status?: EmailMessageStatusEnum;
6272
+ /**
6273
+ * Why the message is in its current status, when applicable. For a `suppressed` row this is the suppression reason (e.g. `recipient_not_allowlisted` when blocked by the auth application's test_recipients allowlist). Null for normal sends.
6274
+ *
6275
+ * @type {string}
6276
+ * @memberof EmailMessage
6277
+ */
6278
+ statusReason?: string | null;
6272
6279
  /**
6273
6280
  *
6274
6281
  * @type {Array<string>}
@@ -6329,6 +6336,7 @@ declare const EmailMessageStatusEnum: {
6329
6336
  readonly FAILED: "failed";
6330
6337
  readonly BOUNCED: "bounced";
6331
6338
  readonly REJECTED: "rejected";
6339
+ readonly SUPPRESSED: "suppressed";
6332
6340
  };
6333
6341
  type EmailMessageStatusEnum = typeof EmailMessageStatusEnum[keyof typeof EmailMessageStatusEnum];
6334
6342
  /**
@@ -23461,6 +23469,7 @@ declare const WebhookEventType: {
23461
23469
  readonly EMAIL_OPENED: "email.opened";
23462
23470
  readonly EMAIL_CLICKED: "email.clicked";
23463
23471
  readonly EMAIL_FAILED: "email.failed";
23472
+ readonly EMAIL_SUPPRESSED: "email.suppressed";
23464
23473
  readonly EMAIL_RECEIVED: "email.received";
23465
23474
  readonly PUSH_SENT: "push.sent";
23466
23475
  readonly PUSH_DELIVERED: "push.delivered";
@@ -28138,7 +28147,7 @@ interface EmailsApiInterface {
28138
28147
  /**
28139
28148
  * Retrieve a paginated list of sent emails
28140
28149
  * @summary List emails
28141
- * @param {'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'bounced' | 'rejected'} [status]
28150
+ * @param {'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'bounced' | 'rejected' | 'suppressed'} [status]
28142
28151
  * @param {string} [tag]
28143
28152
  * @param {number} [limit]
28144
28153
  * @param {number} [offset]
@@ -28257,6 +28266,7 @@ declare const ListEmailsStatusEnum: {
28257
28266
  readonly FAILED: "failed";
28258
28267
  readonly BOUNCED: "bounced";
28259
28268
  readonly REJECTED: "rejected";
28269
+ readonly SUPPRESSED: "suppressed";
28260
28270
  };
28261
28271
  type ListEmailsStatusEnum = typeof ListEmailsStatusEnum[keyof typeof ListEmailsStatusEnum];
28262
28272
 
@@ -33172,7 +33182,8 @@ declare class Zyphr {
33172
33182
  * const login = await zyphr.auth.login.loginEndUser({ ... });
33173
33183
  * zyphr.setAccessToken(login.data.tokens.access_token);
33174
33184
  *
33175
- * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
33185
+ * // The stored token is applied automatically to user-scoped calls:
33186
+ * const me = await zyphr.auth.profile.getEndUser();
33176
33187
  * ```
33177
33188
  */
33178
33189
 
@@ -33184,7 +33195,14 @@ interface ZyphrClientOptions {
33184
33195
  applicationKey: string;
33185
33196
  /** Override the base API URL (defaults to https://api.zyphr.dev/v1). */
33186
33197
  baseUrl?: string;
33187
- /** Optional end-user access token, if you already have a session on construction. */
33198
+ /**
33199
+ * Optional end-user access token, if you already have a session on
33200
+ * construction. Once set (here or via {@link ZyphrClient.setAccessToken}), it
33201
+ * is applied automatically as `Authorization: Bearer` to every user-scoped
33202
+ * call — you no longer need to pass {@link ZyphrClient.authedRequest} for
33203
+ * authentication (though authedRequest still works and a token passed to it
33204
+ * overrides the stored one).
33205
+ */
33188
33206
  accessToken?: string;
33189
33207
  }
33190
33208
  /**
@@ -33215,18 +33233,24 @@ declare class ZyphrClient {
33215
33233
  private readonly applicationKey;
33216
33234
  private accessToken?;
33217
33235
  constructor(options: ZyphrClientOptions);
33218
- /** Store the end-user access token for subsequent authedRequest() calls. */
33236
+ /** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
33219
33237
  setAccessToken(accessToken: string | undefined): void;
33220
33238
  /** True when an end-user access token is currently set. */
33221
33239
  get isAuthenticated(): boolean;
33222
33240
  /**
33223
33241
  * Build request overrides that authenticate as the current end user: the
33224
33242
  * stored Bearer token plus the publishable application key required by
33225
- * user-scoped endpoints. Pass an explicit token to override the stored one.
33243
+ * user-scoped endpoints.
33244
+ *
33245
+ * The stored token is now applied automatically to user-scoped calls, so this
33246
+ * is no longer required for authentication. It remains useful to authenticate
33247
+ * a single call with a different token — a token passed here sets the header
33248
+ * directly in RequestInit and overrides the stored token for that call.
33226
33249
  *
33227
33250
  * @example
33228
33251
  * ```ts
33229
- * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
33252
+ * // Authenticate one call as a different user, without changing stored state:
33253
+ * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest(otherToken));
33230
33254
  * ```
33231
33255
  */
33232
33256
  authedRequest(accessToken?: string): RequestInit;
package/dist/index.js CHANGED
@@ -4293,7 +4293,8 @@ var EmailMessageStatusEnum = {
4293
4293
  DELIVERED: "delivered",
4294
4294
  FAILED: "failed",
4295
4295
  BOUNCED: "bounced",
4296
- REJECTED: "rejected"
4296
+ REJECTED: "rejected",
4297
+ SUPPRESSED: "suppressed"
4297
4298
  };
4298
4299
  function instanceOfEmailMessage(value) {
4299
4300
  return true;
@@ -4311,6 +4312,7 @@ function EmailMessageFromJSONTyped(json, ignoreDiscriminator) {
4311
4312
  "to": json["to"] == null ? void 0 : EmailAddressFromJSON(json["to"]),
4312
4313
  "subject": json["subject"] == null ? void 0 : json["subject"],
4313
4314
  "status": json["status"] == null ? void 0 : json["status"],
4315
+ "statusReason": json["status_reason"] == null ? void 0 : json["status_reason"],
4314
4316
  "tags": json["tags"] == null ? void 0 : json["tags"],
4315
4317
  "queuedAt": json["queued_at"] == null ? void 0 : new Date(json["queued_at"]),
4316
4318
  "sentAt": json["sent_at"] == null ? void 0 : new Date(json["sent_at"]),
@@ -4334,6 +4336,7 @@ function EmailMessageToJSONTyped(value, ignoreDiscriminator = false) {
4334
4336
  "to": EmailAddressToJSON(value["to"]),
4335
4337
  "subject": value["subject"],
4336
4338
  "status": value["status"],
4339
+ "status_reason": value["statusReason"],
4337
4340
  "tags": value["tags"],
4338
4341
  "queued_at": value["queuedAt"] == null ? void 0 : value["queuedAt"].toISOString(),
4339
4342
  "sent_at": value["sentAt"] == null ? void 0 : value["sentAt"].toISOString(),
@@ -15864,6 +15867,7 @@ var WebhookEventType = {
15864
15867
  EMAIL_OPENED: "email.opened",
15865
15868
  EMAIL_CLICKED: "email.clicked",
15866
15869
  EMAIL_FAILED: "email.failed",
15870
+ EMAIL_SUPPRESSED: "email.suppressed",
15867
15871
  EMAIL_RECEIVED: "email.received",
15868
15872
  PUSH_SENT: "push.sent",
15869
15873
  PUSH_DELIVERED: "push.delivered",
@@ -20738,7 +20742,8 @@ var ListEmailsStatusEnum = {
20738
20742
  DELIVERED: "delivered",
20739
20743
  FAILED: "failed",
20740
20744
  BOUNCED: "bounced",
20741
- REJECTED: "rejected"
20745
+ REJECTED: "rejected",
20746
+ SUPPRESSED: "suppressed"
20742
20747
  };
20743
20748
 
20744
20749
  // src/src/apis/ExecutionsApi.ts
@@ -26334,10 +26339,18 @@ var ZyphrClient = class {
26334
26339
  this.accessToken = options.accessToken;
26335
26340
  const config = new Configuration({
26336
26341
  basePath: options.baseUrl,
26337
- // The only credential this client sends automatically is the publishable
26338
- // application key. End-user Bearer tokens are attached per-request via
26339
- // authedRequest() so token rotation doesn't require rebuilding the client.
26342
+ // The publishable application key is sent automatically on every call.
26340
26343
  apiKey: (name) => name === "X-Application-Key" ? this.applicationKey : "",
26344
+ // The stored end-user access token is also applied automatically: any
26345
+ // user-scoped generated method (which authenticates the EndUserToken
26346
+ // scheme) invokes this callback and attaches `Authorization: Bearer`.
26347
+ // The callback reads `this.accessToken` at call time, so setAccessToken()
26348
+ // takes effect on subsequent calls without rebuilding the client. When no
26349
+ // token is set it returns '', and the generated code adds no header — so
26350
+ // anonymous endpoints (login, register, password-reset) stay unauthenticated.
26351
+ // An explicit token passed to authedRequest() sets the header directly in
26352
+ // RequestInit, which overrides this callback.
26353
+ accessToken: async () => this.accessToken ?? "",
26341
26354
  middleware: [errorMiddleware2]
26342
26355
  });
26343
26356
  this.auth = {
@@ -26357,7 +26370,7 @@ var ZyphrClient = class {
26357
26370
  };
26358
26371
  this.devices = new DevicesApi(config);
26359
26372
  }
26360
- /** Store the end-user access token for subsequent authedRequest() calls. */
26373
+ /** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
26361
26374
  setAccessToken(accessToken) {
26362
26375
  this.accessToken = accessToken;
26363
26376
  }
@@ -26368,17 +26381,24 @@ var ZyphrClient = class {
26368
26381
  /**
26369
26382
  * Build request overrides that authenticate as the current end user: the
26370
26383
  * stored Bearer token plus the publishable application key required by
26371
- * user-scoped endpoints. Pass an explicit token to override the stored one.
26384
+ * user-scoped endpoints.
26385
+ *
26386
+ * The stored token is now applied automatically to user-scoped calls, so this
26387
+ * is no longer required for authentication. It remains useful to authenticate
26388
+ * a single call with a different token — a token passed here sets the header
26389
+ * directly in RequestInit and overrides the stored token for that call.
26372
26390
  *
26373
26391
  * @example
26374
26392
  * ```ts
26375
- * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
26393
+ * // Authenticate one call as a different user, without changing stored state:
26394
+ * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest(otherToken));
26376
26395
  * ```
26377
26396
  */
26378
26397
  authedRequest(accessToken) {
26379
26398
  const token = accessToken ?? this.accessToken;
26380
26399
  const headers = {
26381
- "X-Application-Key": this.applicationKey
26400
+ "X-Application-Key": this.applicationKey,
26401
+ "Content-Type": "application/json"
26382
26402
  };
26383
26403
  if (token) {
26384
26404
  headers.Authorization = `Bearer ${token}`;