@emilgroup/notification-sdk 0.8.1-beta.60 → 0.8.1-beta.61

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.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/api/email-mailboxes-api.ts +2 -4
  3. package/api/email-messages-api.ts +8 -16
  4. package/api/email-subscriptions-api.ts +12 -24
  5. package/api/email-tracking-api.ts +12 -24
  6. package/api/email-verifications-api.ts +4 -8
  7. package/api/layouts-api.ts +10 -20
  8. package/api/notification-templates-api.ts +10 -20
  9. package/api/notifications-api.ts +4 -8
  10. package/base.ts +41 -174
  11. package/common.ts +2 -3
  12. package/configuration.ts +0 -20
  13. package/dist/api/email-mailboxes-api.d.ts +1 -1
  14. package/dist/api/email-mailboxes-api.js +4 -7
  15. package/dist/api/email-messages-api.d.ts +4 -4
  16. package/dist/api/email-messages-api.js +15 -25
  17. package/dist/api/email-subscriptions-api.d.ts +6 -6
  18. package/dist/api/email-subscriptions-api.js +23 -39
  19. package/dist/api/email-tracking-api.d.ts +6 -6
  20. package/dist/api/email-tracking-api.js +22 -36
  21. package/dist/api/email-verifications-api.d.ts +2 -2
  22. package/dist/api/email-verifications-api.js +8 -14
  23. package/dist/api/health-api.d.ts +1 -1
  24. package/dist/api/layouts-api.d.ts +5 -5
  25. package/dist/api/layouts-api.js +18 -29
  26. package/dist/api/msgraph-webhooks-api.d.ts +2 -2
  27. package/dist/api/notification-templates-api.d.ts +5 -5
  28. package/dist/api/notification-templates-api.js +18 -29
  29. package/dist/api/notifications-api.d.ts +2 -2
  30. package/dist/api/notifications-api.js +8 -14
  31. package/dist/base.d.ts +0 -24
  32. package/dist/base.js +59 -178
  33. package/dist/common.d.ts +1 -1
  34. package/dist/common.js +0 -1
  35. package/dist/configuration.d.ts +0 -17
  36. package/dist/configuration.js +0 -2
  37. package/package.json +2 -2
package/base.ts CHANGED
@@ -32,20 +32,9 @@ export const COLLECTION_FORMATS = {
32
32
  pipes: "|",
33
33
  };
34
34
 
35
- export interface SessionClass {
36
- sub: string;
37
- username?: string;
38
- email?: string;
39
- tenantSlug?: string;
40
- permissions?: string;
41
- expiresAt?: number;
42
- }
43
-
44
35
  export interface LoginClass {
45
36
  accessToken: string;
46
37
  permissions: string;
47
- authMode?: string;
48
- session?: SessionClass;
49
38
  }
50
39
 
51
40
  export interface SwitchWorkspaceRequest {
@@ -56,8 +45,6 @@ export interface SwitchWorkspaceRequest {
56
45
  export interface SwitchWorkspaceResponseClass {
57
46
  accessToken: string;
58
47
  permissions: string;
59
- authMode?: string;
60
- session?: SessionClass;
61
48
  }
62
49
 
63
50
  export enum Environment {
@@ -90,19 +77,10 @@ interface TokenData {
90
77
  accessToken?: string;
91
78
  username?: string;
92
79
  permissions?: string;
93
- // 'both' or 'session' when authservice keeps the tokens in a server session.
94
- authMode?: string;
95
- sub?: string;
96
80
  }
97
81
 
98
82
  const NETWORK_ERROR_MESSAGE = "Network Error";
99
83
  const TOKEN_DATA = 'APP_TOKEN';
100
- // Sent only to authservice, to ask for a server session.
101
- const AUTH_MODE_HEADER = 'X-Emil-Auth-Mode';
102
- // Names the account on every call; one browser session can hold several.
103
- const ACCOUNT_HEADER = 'X-Emil-Account';
104
- const SESSION_MODES = ['both', 'session'];
105
- const RESEND_SAFE_METHODS = ['get', 'head', 'options'];
106
84
 
107
85
  /**
108
86
  *
@@ -124,18 +102,10 @@ export class BaseAPI {
124
102
  this.configuration = configuration;
125
103
  this.basePath = configuration.basePath || this.basePath;
126
104
 
127
- if (configuration.cookieAuth) {
128
- this.configuration.username = this.configuration.username || this.tokenData.username;
129
- }
130
-
131
- if (this.usesSession()) {
132
- this.useSessionAuth();
133
- } else {
134
- // Use config token if provided, otherwise use tokenData token
135
- const configToken = this.configuration.accessToken;
136
- const storedToken = accessToken ? `Bearer ${accessToken}` : '';
137
- this.configuration.accessToken = configToken || storedToken;
138
- }
105
+ // Use config token if provided, otherwise use tokenData token
106
+ const configToken = this.configuration.accessToken;
107
+ const storedToken = accessToken ? `Bearer ${accessToken}` : '';
108
+ this.configuration.accessToken = configToken || storedToken;
139
109
  } else {
140
110
  const { accessToken, username } = this.tokenData;
141
111
 
@@ -149,107 +119,6 @@ export class BaseAPI {
149
119
  this.attachInterceptor(axios);
150
120
  }
151
121
 
152
- // The app's own account wins over APP_TOKEN, which holds whichever tab wrote last.
153
- private sessionAccount(): string | undefined {
154
- return this.configuration.account || this.tokenData.sub;
155
- }
156
-
157
- // Apps may pass the address as the second argument only; authservice is on the same host.
158
- private authBasePath(): string {
159
- return this.configuration.basePath || this.basePath;
160
- }
161
-
162
- private usesSession(): boolean {
163
- return !!this.configuration.cookieAuth && SESSION_MODES.indexOf(this.tokenData.authMode) !== -1 && !!this.sessionAccount();
164
- }
165
-
166
- private useSessionAuth() {
167
- const { headers, ...baseOptions } = this.configuration.baseOptions || {};
168
- this.configuration.accessToken = '';
169
- this.configuration.baseOptions = {
170
- ...baseOptions,
171
- withCredentials: true,
172
- headers: { ...headers, [ACCOUNT_HEADER]: this.sessionAccount() },
173
- };
174
- }
175
-
176
- private useHeaderAuth(accessToken: string) {
177
- this.configuration.accessToken = accessToken ? `Bearer ${accessToken}` : '';
178
- this.tokenData.accessToken = accessToken;
179
- delete this.tokenData.authMode;
180
- delete this.tokenData.sub;
181
- if (this.configuration.cookieAuth) {
182
- const { withCredentials, headers, ...baseOptions } = this.configuration.baseOptions || {};
183
- const { [ACCOUNT_HEADER]: account, ...otherHeaders } = headers || {};
184
- this.configuration.baseOptions = { ...baseOptions, headers: otherHeaders };
185
- }
186
- }
187
-
188
- private applyTokenReply({ accessToken, authMode, session }: LoginClass) {
189
- if (this.configuration.cookieAuth && SESSION_MODES.indexOf(authMode) !== -1 && session?.sub) {
190
- this.tokenData.authMode = authMode;
191
- this.tokenData.sub = session.sub;
192
- if (this.configuration.account) {
193
- // A workspace switch moves the app to another account.
194
- this.configuration.account = session.sub;
195
- }
196
- // Both keeps the token for apps not moved yet; session mode keeps no token at all.
197
- if (authMode === 'both' && accessToken) {
198
- this.tokenData.accessToken = accessToken;
199
- } else {
200
- delete this.tokenData.accessToken;
201
- }
202
- this.useSessionAuth();
203
- } else {
204
- this.useHeaderAuth(accessToken);
205
- }
206
- }
207
-
208
- private sessionHeaders(): Record<string, string> {
209
- if (!this.configuration.cookieAuth) {
210
- return {};
211
- }
212
- return {
213
- [AUTH_MODE_HEADER]: 'session',
214
- ...(this.usesSession() && { [ACCOUNT_HEADER]: this.sessionAccount() }),
215
- };
216
- }
217
-
218
- private withCurrentAuth(config: AxiosRequestConfig): AxiosRequestConfig {
219
- delete config.headers['Authorization'];
220
- delete config.headers[ACCOUNT_HEADER];
221
- if (this.usesSession()) {
222
- config.headers[ACCOUNT_HEADER] = this.sessionAccount();
223
- config.withCredentials = true;
224
- } else if (this.configuration.accessToken) {
225
- config.headers['Authorization'] = this.configuration.accessToken;
226
- }
227
- return config;
228
- }
229
-
230
- // Both keeps the token, so a session call the browser could not complete can be sent again with it.
231
- private canRetryWithToken(config: AxiosRequestConfig): boolean {
232
- return !!config.withCredentials && !!config.headers?.[ACCOUNT_HEADER]
233
- && !!this.tokenData.accessToken && this.tokenData.authMode !== 'session';
234
- }
235
-
236
- // A network error can come after the server ran the call, so only a call that is safe to repeat is sent again.
237
- private canResend(config: AxiosRequestConfig): boolean {
238
- return RESEND_SAFE_METHODS.indexOf((config.method || 'get').toLowerCase()) !== -1
239
- || Object.keys(config.headers || {}).some((name) => name.toLowerCase() === 'idempotency-key');
240
- }
241
-
242
- private switchToToken() {
243
- this.useHeaderAuth(this.tokenData.accessToken);
244
- this.storeTokenData(this.tokenData);
245
- }
246
-
247
- private retryWithToken(axios: AxiosInstance, config: AxiosRequestConfig) {
248
- this.switchToToken();
249
- config.withCredentials = false;
250
- return axios(this.withCurrentAuth(config));
251
- }
252
-
253
122
  selectEnvironment(env: Environment) {
254
123
  this.selectBasePath(env);
255
124
  }
@@ -269,8 +138,8 @@ export class BaseAPI {
269
138
  async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
270
139
  const options: AxiosRequestConfig = {
271
140
  method: 'POST',
272
- url: `${this.authBasePath()}/authservice/v1/login`,
273
- headers: { 'Content-Type': 'application/json', ...(this.configuration.cookieAuth && { [AUTH_MODE_HEADER]: 'session' }) },
141
+ url: `${this.configuration.basePath}/authservice/v1/login`,
142
+ headers: { 'Content-Type': 'application/json' },
274
143
  data: {
275
144
  username,
276
145
  password,
@@ -280,10 +149,13 @@ export class BaseAPI {
280
149
 
281
150
  const response = await globalAxios.request<LoginClass>(options);
282
151
 
152
+ const { data: { accessToken, permissions } } = response;
153
+
283
154
  this.configuration.username = username;
155
+ this.configuration.accessToken = `Bearer ${accessToken}`;
284
156
  this.tokenData.username = username;
285
- this.tokenData.permissions = response.data.permissions;
286
- this.applyTokenReply(response.data);
157
+ this.tokenData.accessToken = accessToken;
158
+ this.tokenData.permissions = permissions;
287
159
 
288
160
  // Switch workspace if provided
289
161
  if (targetWorkspace) {
@@ -303,11 +175,10 @@ export class BaseAPI {
303
175
  async switchWorkspace(targetWorkspace: string): Promise<void> {
304
176
  const options: AxiosRequestConfig = {
305
177
  method: 'POST',
306
- url: `${this.authBasePath()}/authservice/v1/workspaces/switch`,
178
+ url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
307
179
  headers: {
308
180
  'Content-Type': 'application/json',
309
- ...this.sessionHeaders(),
310
- ...(!this.usesSession() && !!this.configuration.accessToken && { 'Authorization': this.configuration.accessToken as string }),
181
+ 'Authorization': `Bearer ${this.configuration.accessToken}`,
311
182
  },
312
183
  data: {
313
184
  username: this.configuration.username,
@@ -318,8 +189,11 @@ export class BaseAPI {
318
189
 
319
190
  const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
320
191
 
321
- this.tokenData.permissions = response.data.permissions;
322
- this.applyTokenReply(response.data);
192
+ const { data: { accessToken, permissions } } = response;
193
+
194
+ this.configuration.accessToken = `Bearer ${accessToken}`;
195
+ this.tokenData.accessToken = accessToken;
196
+ this.tokenData.permissions = permissions;
323
197
 
324
198
  this.storeTokenData({
325
199
  ...this.tokenData
@@ -345,10 +219,9 @@ export class BaseAPI {
345
219
 
346
220
  const options: AxiosRequestConfig = {
347
221
  method: 'POST',
348
- url: `${this.authBasePath()}/authservice/v1/refresh-token`,
222
+ url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
349
223
  headers: {
350
224
  'Content-Type': 'application/json',
351
- ...this.sessionHeaders(),
352
225
  },
353
226
  data: { username: username },
354
227
  withCredentials: true,
@@ -389,22 +262,20 @@ export class BaseAPI {
389
262
  && !originalConfig._retry) {
390
263
  originalConfig._retry = true;
391
264
  try {
392
- const reply = await this.refreshTokenInternal();
393
- this.tokenData.permissions = reply.permissions;
394
- this.applyTokenReply(reply);
395
- this.storeTokenData(this.tokenData);
265
+ const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
266
+ const accessToken = `Bearer ${tokenString}`;
267
+ this.tokenData.permissions = permissions;
396
268
 
397
- if (!this.usesSession()) {
398
- return axios(this.withCurrentAuth(originalConfig));
399
- }
269
+ delete originalConfig.headers['Authorization']
270
+
271
+ originalConfig.headers['Authorization'] = accessToken;
400
272
 
401
- // Both mode: if the browser does not send the session cookie (another site), use the token.
402
- return axios(this.withCurrentAuth(originalConfig)).catch((retryError) => {
403
- if (retryError?.response?.status !== 401 || !this.tokenData.accessToken) {
404
- return Promise.reject(retryError);
405
- }
406
- return this.retryWithToken(axios, originalConfig);
407
- });
273
+ this.configuration.accessToken = accessToken;
274
+ this.tokenData.accessToken = tokenString;
275
+
276
+ this.storeTokenData(this.tokenData);
277
+
278
+ return axios(originalConfig);
408
279
  } catch (_error) {
409
280
  if (_error.response && _error.response.data) {
410
281
  return Promise.reject(_error.response.data);
@@ -412,30 +283,26 @@ export class BaseAPI {
412
283
  return Promise.reject(_error);
413
284
  }
414
285
  }
415
- } else if (err.message === NETWORK_ERROR_MESSAGE && this.canRetryWithToken(originalConfig)) {
416
- // Both mode: the browser blocked the session call or hid its reply; later calls use the token.
417
- if (!this.canResend(originalConfig)) {
418
- this.switchToToken();
419
- return Promise.reject(err);
420
- }
421
- return this.retryWithToken(axios, originalConfig);
422
286
  } else if (err.message === NETWORK_ERROR_MESSAGE
423
- && (originalConfig.headers.hasOwnProperty('Authorization')
424
- || (this.configuration.cookieAuth && originalConfig.withCredentials && this.canResend(originalConfig)))
287
+ && originalConfig.headers.hasOwnProperty('Authorization')
425
288
  && _retry_count < 4
426
289
  ) {
427
290
  _retry_count++;
428
291
  try {
429
- // In session mode an unreadable 401 (no CORS headers on the error reply) also lands here.
430
- const reply = await this.refreshTokenInternal();
431
- this.tokenData.permissions = reply.permissions;
292
+ const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
293
+ const accessToken = `Bearer ${tokenString}`;
294
+ this.tokenData.permissions = permissions;
432
295
 
433
296
  _retry = true;
434
- this.applyTokenReply(reply);
297
+ originalConfig.headers['Authorization'] = accessToken;
298
+
299
+ this.configuration.accessToken = accessToken;
300
+ this.tokenData.accessToken = tokenString;
301
+
435
302
  this.storeTokenData(this.tokenData);
436
303
 
437
304
  return axios.request({
438
- ...this.withCurrentAuth(originalConfig),
305
+ ...originalConfig,
439
306
  });
440
307
  } catch (_error) {
441
308
  if (_error.response && _error.response.data) {
package/common.ts CHANGED
@@ -130,10 +130,9 @@ export const toPathString = function (url: URL) {
130
130
  * @export
131
131
  */
132
132
  export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
133
- // Typed by hand: since axios 1.20, request() returns an internal axios type that SDK declarations cannot name.
134
- return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH): Promise<R> => {
133
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
135
134
  const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
136
- return axios.request<T, R>(axiosRequestArgs) as Promise<R>;
135
+ return axios.request<T, R>(axiosRequestArgs);
137
136
  };
138
137
  }
139
138
 
package/configuration.ts CHANGED
@@ -21,8 +21,6 @@ export interface ConfigurationParameters {
21
21
  basePath?: string;
22
22
  baseOptions?: any;
23
23
  formDataCtor?: new () => any;
24
- cookieAuth?: boolean;
25
- account?: string;
26
24
  }
27
25
 
28
26
  export class Configuration {
@@ -76,22 +74,6 @@ export class Configuration {
76
74
  */
77
75
  formDataCtor?: new () => any;
78
76
 
79
- /**
80
- * Use a server session when authservice makes one; otherwise the token, as without this option.
81
- * Set `account` too, so each SDK object keeps its own account.
82
- *
83
- * @type {boolean}
84
- * @memberof Configuration
85
- */
86
- cookieAuth?: boolean;
87
- /**
88
- * The session account (Cognito sub) this app shows, so the SDK never takes another tab's account.
89
- *
90
- * @type {string}
91
- * @memberof Configuration
92
- */
93
- account?: string;
94
-
95
77
  constructor(param: ConfigurationParameters = {}) {
96
78
  this.apiKey = param.apiKey;
97
79
  this.username = param.username;
@@ -100,8 +82,6 @@ export class Configuration {
100
82
  this.basePath = param.basePath;
101
83
  this.baseOptions = param.baseOptions;
102
84
  this.formDataCtor = param.formDataCtor;
103
- this.cookieAuth = param.cookieAuth;
104
- this.account = param.account;
105
85
  }
106
86
 
107
87
  /**
@@ -83,5 +83,5 @@ export declare class EmailMailboxesApi extends BaseAPI {
83
83
  * @throws {RequiredError}
84
84
  * @memberof EmailMailboxesApi
85
85
  */
86
- listEmailMailboxes(requestParameters?: EmailMailboxesApiListEmailMailboxesRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailMailboxesResponseClass, any, {}, any>>;
86
+ listEmailMailboxes(requestParameters?: EmailMailboxesApiListEmailMailboxesRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailMailboxesResponseClass, any, {}>>;
87
87
  }
@@ -102,7 +102,7 @@ var EmailMailboxesApiAxiosParamCreator = function (configuration) {
102
102
  listEmailMailboxes: function (authorization, options) {
103
103
  if (options === void 0) { options = {}; }
104
104
  return __awaiter(_this, void 0, void 0, function () {
105
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
105
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
106
106
  return __generator(this, function (_a) {
107
107
  switch (_a.label) {
108
108
  case 0:
@@ -117,16 +117,13 @@ var EmailMailboxesApiAxiosParamCreator = function (configuration) {
117
117
  localVarQueryParameter = {};
118
118
  // authentication bearer required
119
119
  // http bearer authentication required
120
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
121
- // Only Authorization falls back to the configured token; an empty value is never sent.
122
- ];
120
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
123
121
  case 1:
124
122
  // authentication bearer required
125
123
  // http bearer authentication required
126
124
  _a.sent();
127
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
128
- if (authorizationValue) {
129
- localVarHeaderParameter['Authorization'] = String(authorizationValue);
125
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
126
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
130
127
  }
131
128
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
132
129
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -296,7 +296,7 @@ export declare class EmailMessagesApi extends BaseAPI {
296
296
  * @throws {RequiredError}
297
297
  * @memberof EmailMessagesApi
298
298
  */
299
- downloadAttachment(requestParameters: EmailMessagesApiDownloadAttachmentRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<DownloadAttachmentResponseClass, any, {}, any>>;
299
+ downloadAttachment(requestParameters: EmailMessagesApiDownloadAttachmentRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<DownloadAttachmentResponseClass, any, {}>>;
300
300
  /**
301
301
  * Retrieves the details of the email message with the given code. **Required Permissions** \"notification-management.email-messages.view\"
302
302
  * @summary Retrieve the email message
@@ -305,7 +305,7 @@ export declare class EmailMessagesApi extends BaseAPI {
305
305
  * @throws {RequiredError}
306
306
  * @memberof EmailMessagesApi
307
307
  */
308
- getMessage(requestParameters: EmailMessagesApiGetMessageRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetEmailMessageResponseClass, any, {}, any>>;
308
+ getMessage(requestParameters: EmailMessagesApiGetMessageRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetEmailMessageResponseClass, any, {}>>;
309
309
  /**
310
310
  * Returns the attachments of the email message with the given code. **Required Permissions** \"notification-management.email-messages.view\"
311
311
  * @summary List the email message attachments
@@ -314,7 +314,7 @@ export declare class EmailMessagesApi extends BaseAPI {
314
314
  * @throws {RequiredError}
315
315
  * @memberof EmailMessagesApi
316
316
  */
317
- listAttachments(requestParameters: EmailMessagesApiListAttachmentsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailAttachmentsResponseClass, any, {}, any>>;
317
+ listAttachments(requestParameters: EmailMessagesApiListAttachmentsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailAttachmentsResponseClass, any, {}>>;
318
318
  /**
319
319
  * Returns a list of sent and received email messages. For more information about pagination, read the Pagination documentation. **Required Permissions** \"notification-management.email-messages.view\"
320
320
  * @summary List email messages
@@ -323,5 +323,5 @@ export declare class EmailMessagesApi extends BaseAPI {
323
323
  * @throws {RequiredError}
324
324
  * @memberof EmailMessagesApi
325
325
  */
326
- listEmailMessages(requestParameters?: EmailMessagesApiListEmailMessagesRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailMessagesResponseClass, any, {}, any>>;
326
+ listEmailMessages(requestParameters?: EmailMessagesApiListEmailMessagesRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailMessagesResponseClass, any, {}>>;
327
327
  }
@@ -104,7 +104,7 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
104
104
  downloadAttachment: function (code, attachmentId, authorization, options) {
105
105
  if (options === void 0) { options = {}; }
106
106
  return __awaiter(_this, void 0, void 0, function () {
107
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
107
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
108
108
  return __generator(this, function (_a) {
109
109
  switch (_a.label) {
110
110
  case 0:
@@ -125,16 +125,13 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
125
125
  localVarQueryParameter = {};
126
126
  // authentication bearer required
127
127
  // http bearer authentication required
128
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
129
- // Only Authorization falls back to the configured token; an empty value is never sent.
130
- ];
128
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
131
129
  case 1:
132
130
  // authentication bearer required
133
131
  // http bearer authentication required
134
132
  _a.sent();
135
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
136
- if (authorizationValue) {
137
- localVarHeaderParameter['Authorization'] = String(authorizationValue);
133
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
134
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
138
135
  }
139
136
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
140
137
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -158,7 +155,7 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
158
155
  getMessage: function (code, authorization, options) {
159
156
  if (options === void 0) { options = {}; }
160
157
  return __awaiter(_this, void 0, void 0, function () {
161
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
158
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
162
159
  return __generator(this, function (_a) {
163
160
  switch (_a.label) {
164
161
  case 0:
@@ -176,16 +173,13 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
176
173
  localVarQueryParameter = {};
177
174
  // authentication bearer required
178
175
  // http bearer authentication required
179
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
180
- // Only Authorization falls back to the configured token; an empty value is never sent.
181
- ];
176
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
182
177
  case 1:
183
178
  // authentication bearer required
184
179
  // http bearer authentication required
185
180
  _a.sent();
186
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
187
- if (authorizationValue) {
188
- localVarHeaderParameter['Authorization'] = String(authorizationValue);
181
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
182
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
189
183
  }
190
184
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
191
185
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -209,7 +203,7 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
209
203
  listAttachments: function (code, authorization, options) {
210
204
  if (options === void 0) { options = {}; }
211
205
  return __awaiter(_this, void 0, void 0, function () {
212
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
206
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
213
207
  return __generator(this, function (_a) {
214
208
  switch (_a.label) {
215
209
  case 0:
@@ -227,16 +221,13 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
227
221
  localVarQueryParameter = {};
228
222
  // authentication bearer required
229
223
  // http bearer authentication required
230
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
231
- // Only Authorization falls back to the configured token; an empty value is never sent.
232
- ];
224
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
233
225
  case 1:
234
226
  // authentication bearer required
235
227
  // http bearer authentication required
236
228
  _a.sent();
237
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
238
- if (authorizationValue) {
239
- localVarHeaderParameter['Authorization'] = String(authorizationValue);
229
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
230
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
240
231
  }
241
232
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
242
233
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -266,7 +257,7 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
266
257
  listEmailMessages: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
267
258
  if (options === void 0) { options = {}; }
268
259
  return __awaiter(_this, void 0, void 0, function () {
269
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
260
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
270
261
  return __generator(this, function (_a) {
271
262
  switch (_a.label) {
272
263
  case 0:
@@ -307,9 +298,8 @@ var EmailMessagesApiAxiosParamCreator = function (configuration) {
307
298
  if (filters !== undefined) {
308
299
  localVarQueryParameter['filters'] = filters;
309
300
  }
310
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
311
- if (authorizationValue) {
312
- localVarHeaderParameter['Authorization'] = String(authorizationValue);
301
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
302
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
313
303
  }
314
304
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
315
305
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -383,7 +383,7 @@ export declare class EmailSubscriptionsApi extends BaseAPI {
383
383
  * @throws {RequiredError}
384
384
  * @memberof EmailSubscriptionsApi
385
385
  */
386
- catchUpEmailSubscription(requestParameters: EmailSubscriptionsApiCatchUpEmailSubscriptionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CatchUpEmailSubscriptionResponseClass, any, {}, any>>;
386
+ catchUpEmailSubscription(requestParameters: EmailSubscriptionsApiCatchUpEmailSubscriptionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CatchUpEmailSubscriptionResponseClass, any, {}>>;
387
387
  /**
388
388
  * Queues a catch-up for every subscription of the email channel: Microsoft Graph is asked for every change since the last catch-up, and mail that never arrived through a notification is ingested. Returns straight away with how many catch-ups were queued. **Required Permissions** \"tenant-management.settings.update\"
389
389
  * @summary Catch up missed mail for all email subscriptions
@@ -392,7 +392,7 @@ export declare class EmailSubscriptionsApi extends BaseAPI {
392
392
  * @throws {RequiredError}
393
393
  * @memberof EmailSubscriptionsApi
394
394
  */
395
- catchUpEmailSubscriptions(requestParameters: EmailSubscriptionsApiCatchUpEmailSubscriptionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CatchUpEmailSubscriptionsResponseClass, any, {}, any>>;
395
+ catchUpEmailSubscriptions(requestParameters: EmailSubscriptionsApiCatchUpEmailSubscriptionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CatchUpEmailSubscriptionsResponseClass, any, {}>>;
396
396
  /**
397
397
  * Retrieves the email subscription with the given id. **Required Permissions** \"tenant-management.settings.view\"
398
398
  * @summary Retrieve the email subscription
@@ -401,7 +401,7 @@ export declare class EmailSubscriptionsApi extends BaseAPI {
401
401
  * @throws {RequiredError}
402
402
  * @memberof EmailSubscriptionsApi
403
403
  */
404
- getEmailSubscription(requestParameters: EmailSubscriptionsApiGetEmailSubscriptionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetEmailSubscriptionResponseClass, any, {}, any>>;
404
+ getEmailSubscription(requestParameters: EmailSubscriptionsApiGetEmailSubscriptionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetEmailSubscriptionResponseClass, any, {}>>;
405
405
  /**
406
406
  * Returns the Microsoft Graph mail subscriptions of the tenant, one per mailbox and folder of the email channel, with their status, expiry and last error. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.settings.view\"
407
407
  * @summary List email subscriptions
@@ -410,7 +410,7 @@ export declare class EmailSubscriptionsApi extends BaseAPI {
410
410
  * @throws {RequiredError}
411
411
  * @memberof EmailSubscriptionsApi
412
412
  */
413
- listEmailSubscriptions(requestParameters?: EmailSubscriptionsApiListEmailSubscriptionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailSubscriptionsResponseClass, any, {}, any>>;
413
+ listEmailSubscriptions(requestParameters?: EmailSubscriptionsApiListEmailSubscriptionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListEmailSubscriptionsResponseClass, any, {}>>;
414
414
  /**
415
415
  * Brings the subscriptions in line with the mailboxes and folders of the email channel: creates the missing ones, deletes the ones no longer configured and recreates expired or failed ones. Returns how many subscriptions each step touched. **Required Permissions** \"tenant-management.settings.update\"
416
416
  * @summary Reconcile the email subscriptions
@@ -419,7 +419,7 @@ export declare class EmailSubscriptionsApi extends BaseAPI {
419
419
  * @throws {RequiredError}
420
420
  * @memberof EmailSubscriptionsApi
421
421
  */
422
- reconcileEmailSubscriptions(requestParameters: EmailSubscriptionsApiReconcileEmailSubscriptionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ReconcileEmailSubscriptionsResponseClass, any, {}, any>>;
422
+ reconcileEmailSubscriptions(requestParameters: EmailSubscriptionsApiReconcileEmailSubscriptionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ReconcileEmailSubscriptionsResponseClass, any, {}>>;
423
423
  /**
424
424
  * Renews the subscription in Microsoft Graph right away and returns it with its new expiry. A pending or failed subscription, or one Graph no longer knows, is created again. Fails with 503 when Graph rejects the call; the error is kept on the subscription. **Required Permissions** \"tenant-management.settings.update\"
425
425
  * @summary Renew the email subscription
@@ -428,5 +428,5 @@ export declare class EmailSubscriptionsApi extends BaseAPI {
428
428
  * @throws {RequiredError}
429
429
  * @memberof EmailSubscriptionsApi
430
430
  */
431
- renewEmailSubscription(requestParameters: EmailSubscriptionsApiRenewEmailSubscriptionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<RenewEmailSubscriptionResponseClass, any, {}, any>>;
431
+ renewEmailSubscription(requestParameters: EmailSubscriptionsApiRenewEmailSubscriptionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<RenewEmailSubscriptionResponseClass, any, {}>>;
432
432
  }