@zyphr-dev/node-sdk 0.1.46 → 0.1.48
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 +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/clientAuth.ts +10 -4
- package/src/src/apis/AuthSessionsApi.ts +4 -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}`;
|
|
@@ -71,7 +71,7 @@ export interface AuthSessionsApiInterface {
|
|
|
71
71
|
listEndUserSessions(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SessionListResponse>;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Refresh access token using a refresh token. Accepts optional custom_claims to update JWT claims (if not provided,
|
|
74
|
+
* Refresh an end-user access token using a refresh token. Authenticated with the publishable application key (`X-Application-Key`) — no application secret is required, so client-side apps (browser / mobile) can refresh directly. The refresh token is the credential: it must be valid, unexpired, unrevoked, and issued for this application. Refresh tokens are single-use — each refresh returns a NEW refresh token and invalidates the one you presented, so persist the new token before the next refresh. Accepts optional custom_claims to update JWT claims (if not provided, current stored claims are preserved).
|
|
75
75
|
* @summary Refresh access token
|
|
76
76
|
* @param {RefreshSessionRequest} refreshSessionRequest
|
|
77
77
|
* @param {*} [options] Override http request option.
|
|
@@ -81,7 +81,7 @@ export interface AuthSessionsApiInterface {
|
|
|
81
81
|
refreshEndUserTokenRaw(requestParameters: AuthSessionsApiRefreshEndUserTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RefreshTokenResponse>>;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* Refresh access token using a refresh token. Accepts optional custom_claims to update JWT claims (if not provided,
|
|
84
|
+
* Refresh an end-user access token using a refresh token. Authenticated with the publishable application key (`X-Application-Key`) — no application secret is required, so client-side apps (browser / mobile) can refresh directly. The refresh token is the credential: it must be valid, unexpired, unrevoked, and issued for this application. Refresh tokens are single-use — each refresh returns a NEW refresh token and invalidates the one you presented, so persist the new token before the next refresh. Accepts optional custom_claims to update JWT claims (if not provided, current stored claims are preserved).
|
|
85
85
|
* Refresh access token
|
|
86
86
|
*/
|
|
87
87
|
refreshEndUserToken(refreshSessionRequest: RefreshSessionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RefreshTokenResponse>;
|
|
@@ -165,7 +165,7 @@ export class AuthSessionsApi extends runtime.BaseAPI implements AuthSessionsApiI
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Refresh access token using a refresh token. Accepts optional custom_claims to update JWT claims (if not provided,
|
|
168
|
+
* Refresh an end-user access token using a refresh token. Authenticated with the publishable application key (`X-Application-Key`) — no application secret is required, so client-side apps (browser / mobile) can refresh directly. The refresh token is the credential: it must be valid, unexpired, unrevoked, and issued for this application. Refresh tokens are single-use — each refresh returns a NEW refresh token and invalidates the one you presented, so persist the new token before the next refresh. Accepts optional custom_claims to update JWT claims (if not provided, current stored claims are preserved).
|
|
169
169
|
* Refresh access token
|
|
170
170
|
*/
|
|
171
171
|
async refreshEndUserTokenRaw(requestParameters: AuthSessionsApiRefreshEndUserTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RefreshTokenResponse>> {
|
|
@@ -202,7 +202,7 @@ export class AuthSessionsApi extends runtime.BaseAPI implements AuthSessionsApiI
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
|
-
* Refresh access token using a refresh token. Accepts optional custom_claims to update JWT claims (if not provided,
|
|
205
|
+
* Refresh an end-user access token using a refresh token. Authenticated with the publishable application key (`X-Application-Key`) — no application secret is required, so client-side apps (browser / mobile) can refresh directly. The refresh token is the credential: it must be valid, unexpired, unrevoked, and issued for this application. Refresh tokens are single-use — each refresh returns a NEW refresh token and invalidates the one you presented, so persist the new token before the next refresh. Accepts optional custom_claims to update JWT claims (if not provided, current stored claims are preserved).
|
|
206
206
|
* Refresh access token
|
|
207
207
|
*/
|
|
208
208
|
async refreshEndUserToken(refreshSessionRequest: RefreshSessionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RefreshTokenResponse> {
|
|
@@ -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()),
|