@zyphr-dev/node-sdk 0.1.46 → 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 +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/clientAuth.ts +10 -4
- package/src/src/apis/EmailsApi.ts +3 -2
- package/src/src/models/EmailMessage.ts +11 -1
package/package.json
CHANGED
package/src/clientAuth.ts
CHANGED
|
@@ -226,12 +226,18 @@ export class ZyphrClient {
|
|
|
226
226
|
*/
|
|
227
227
|
authedRequest(accessToken?: string): RequestInit {
|
|
228
228
|
const token = accessToken ?? this.accessToken;
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
// re-listed here
|
|
232
|
-
//
|
|
229
|
+
// The runtime REPLACES the whole headers object with this initOverride (it
|
|
230
|
+
// does not deep-merge — see createFetchParams), so every header the request
|
|
231
|
+
// needs must be re-listed here or it is dropped for this call:
|
|
232
|
+
// - X-Application-Key: the app key the Configuration would otherwise add.
|
|
233
|
+
// - Content-Type: application/json: the generated method sets this for
|
|
234
|
+
// body-carrying calls; without it a POST via authedRequest() goes out
|
|
235
|
+
// with no JSON content-type, the server parses no fields, and returns a
|
|
236
|
+
// misleading validation error (e.g. "current_password is required").
|
|
237
|
+
// Harmless on GETs (no body); required for any mutating call. (sc-7631)
|
|
233
238
|
const headers: Record<string, string> = {
|
|
234
239
|
'X-Application-Key': this.applicationKey,
|
|
240
|
+
'Content-Type': 'application/json',
|
|
235
241
|
};
|
|
236
242
|
if (token) {
|
|
237
243
|
headers.Authorization = `Bearer ${token}`;
|
|
@@ -134,7 +134,7 @@ export interface EmailsApiInterface {
|
|
|
134
134
|
/**
|
|
135
135
|
* Retrieve a paginated list of sent emails
|
|
136
136
|
* @summary List emails
|
|
137
|
-
* @param {'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'bounced' | 'rejected'} [status]
|
|
137
|
+
* @param {'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'bounced' | 'rejected' | 'suppressed'} [status]
|
|
138
138
|
* @param {string} [tag]
|
|
139
139
|
* @param {number} [limit]
|
|
140
140
|
* @param {number} [offset]
|
|
@@ -450,6 +450,7 @@ export const ListEmailsStatusEnum = {
|
|
|
450
450
|
DELIVERED: 'delivered',
|
|
451
451
|
FAILED: 'failed',
|
|
452
452
|
BOUNCED: 'bounced',
|
|
453
|
-
REJECTED: 'rejected'
|
|
453
|
+
REJECTED: 'rejected',
|
|
454
|
+
SUPPRESSED: 'suppressed'
|
|
454
455
|
} as const;
|
|
455
456
|
export type ListEmailsStatusEnum = typeof ListEmailsStatusEnum[keyof typeof ListEmailsStatusEnum];
|
|
@@ -57,6 +57,13 @@ export interface EmailMessage {
|
|
|
57
57
|
* @memberof EmailMessage
|
|
58
58
|
*/
|
|
59
59
|
status?: EmailMessageStatusEnum;
|
|
60
|
+
/**
|
|
61
|
+
* 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.
|
|
62
|
+
*
|
|
63
|
+
* @type {string}
|
|
64
|
+
* @memberof EmailMessage
|
|
65
|
+
*/
|
|
66
|
+
statusReason?: string | null;
|
|
60
67
|
/**
|
|
61
68
|
*
|
|
62
69
|
* @type {Array<string>}
|
|
@@ -118,7 +125,8 @@ export const EmailMessageStatusEnum = {
|
|
|
118
125
|
DELIVERED: 'delivered',
|
|
119
126
|
FAILED: 'failed',
|
|
120
127
|
BOUNCED: 'bounced',
|
|
121
|
-
REJECTED: 'rejected'
|
|
128
|
+
REJECTED: 'rejected',
|
|
129
|
+
SUPPRESSED: 'suppressed'
|
|
122
130
|
} as const;
|
|
123
131
|
export type EmailMessageStatusEnum = typeof EmailMessageStatusEnum[keyof typeof EmailMessageStatusEnum];
|
|
124
132
|
|
|
@@ -145,6 +153,7 @@ export function EmailMessageFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
|
|
145
153
|
'to': json['to'] == null ? undefined : EmailAddressFromJSON(json['to']),
|
|
146
154
|
'subject': json['subject'] == null ? undefined : json['subject'],
|
|
147
155
|
'status': json['status'] == null ? undefined : json['status'],
|
|
156
|
+
'statusReason': json['status_reason'] == null ? undefined : json['status_reason'],
|
|
148
157
|
'tags': json['tags'] == null ? undefined : json['tags'],
|
|
149
158
|
'queuedAt': json['queued_at'] == null ? undefined : (new Date(json['queued_at'])),
|
|
150
159
|
'sentAt': json['sent_at'] == null ? undefined : (new Date(json['sent_at'])),
|
|
@@ -172,6 +181,7 @@ export function EmailMessageToJSONTyped(value?: EmailMessage | null, ignoreDiscr
|
|
|
172
181
|
'to': EmailAddressToJSON(value['to']),
|
|
173
182
|
'subject': value['subject'],
|
|
174
183
|
'status': value['status'],
|
|
184
|
+
'status_reason': value['statusReason'],
|
|
175
185
|
'tags': value['tags'],
|
|
176
186
|
'queued_at': value['queuedAt'] == null ? undefined : ((value['queuedAt']).toISOString()),
|
|
177
187
|
'sent_at': value['sentAt'] == null ? undefined : ((value['sentAt'] as any).toISOString()),
|