@emilgroup/notification-sdk 0.8.1-beta.63 → 0.8.1-beta.65
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/README.md +2 -2
- package/api/email-mailboxes-api.ts +7 -4
- package/api/email-messages-api.ts +35 -20
- package/api/email-subscriptions-api.ts +42 -24
- package/api/email-tracking-api.ts +42 -24
- package/api/email-verifications-api.ts +14 -8
- package/api/health-api.ts +1 -1
- package/api/layouts-api.ts +35 -20
- package/api/msgraph-webhooks-api.ts +2 -2
- package/api/notification-templates-api.ts +35 -20
- package/api/notifications-api.ts +14 -8
- package/base.ts +72 -9
- package/dist/api/email-mailboxes-api.js +12 -8
- package/dist/api/email-messages-api.js +58 -39
- package/dist/api/email-subscriptions-api.js +70 -47
- package/dist/api/email-tracking-api.js +68 -46
- package/dist/api/email-verifications-api.js +24 -16
- package/dist/api/health-api.js +1 -1
- package/dist/api/layouts-api.js +56 -38
- package/dist/api/msgraph-webhooks-api.js +2 -2
- package/dist/api/notification-templates-api.js +56 -38
- package/dist/api/notifications-api.js +24 -16
- package/dist/base.d.ts +2 -0
- package/dist/base.js +74 -10
- package/package.json +1 -1
package/api/layouts-api.ts
CHANGED
|
@@ -67,9 +67,12 @@ export const LayoutsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
67
67
|
// http bearer authentication required
|
|
68
68
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
69
69
|
|
|
70
|
-
// Only Authorization falls back to the configured token
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
71
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
72
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
73
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
74
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
75
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
73
76
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
74
77
|
}
|
|
75
78
|
|
|
@@ -117,9 +120,12 @@ export const LayoutsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
117
120
|
// http bearer authentication required
|
|
118
121
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
119
122
|
|
|
120
|
-
// Only Authorization falls back to the configured token
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
124
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
125
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
126
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
127
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
128
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
123
129
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
124
130
|
}
|
|
125
131
|
|
|
@@ -171,9 +177,12 @@ export const LayoutsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
171
177
|
localVarQueryParameter['id'] = id2;
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
// Only Authorization falls back to the configured token
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
181
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
182
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
183
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
184
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
185
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
177
186
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
178
187
|
}
|
|
179
188
|
|
|
@@ -249,9 +258,12 @@ export const LayoutsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
249
258
|
localVarQueryParameter['filters'] = filters;
|
|
250
259
|
}
|
|
251
260
|
|
|
252
|
-
// Only Authorization falls back to the configured token
|
|
253
|
-
|
|
254
|
-
|
|
261
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
262
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
263
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
264
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
265
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
266
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
255
267
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
256
268
|
}
|
|
257
269
|
|
|
@@ -299,9 +311,12 @@ export const LayoutsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
299
311
|
// http bearer authentication required
|
|
300
312
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
301
313
|
|
|
302
|
-
// Only Authorization falls back to the configured token
|
|
303
|
-
|
|
304
|
-
|
|
314
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
315
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
316
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
317
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
318
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
319
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
305
320
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
306
321
|
}
|
|
307
322
|
|
|
@@ -650,7 +665,7 @@ export class LayoutsApi extends BaseAPI {
|
|
|
650
665
|
* @memberof LayoutsApi
|
|
651
666
|
*/
|
|
652
667
|
public createLayout(requestParameters: LayoutsApiCreateLayoutRequest, options?: AxiosRequestConfig) {
|
|
653
|
-
return LayoutsApiFp(this.configuration).createLayout(requestParameters.createLayoutRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
668
|
+
return LayoutsApiFp(this.configuration).createLayout(requestParameters.createLayoutRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
654
669
|
}
|
|
655
670
|
|
|
656
671
|
/**
|
|
@@ -662,7 +677,7 @@ export class LayoutsApi extends BaseAPI {
|
|
|
662
677
|
* @memberof LayoutsApi
|
|
663
678
|
*/
|
|
664
679
|
public deleteLayout(requestParameters: LayoutsApiDeleteLayoutRequest, options?: AxiosRequestConfig) {
|
|
665
|
-
return LayoutsApiFp(this.configuration).deleteLayout(requestParameters.id, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
680
|
+
return LayoutsApiFp(this.configuration).deleteLayout(requestParameters.id, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
666
681
|
}
|
|
667
682
|
|
|
668
683
|
/**
|
|
@@ -674,7 +689,7 @@ export class LayoutsApi extends BaseAPI {
|
|
|
674
689
|
* @memberof LayoutsApi
|
|
675
690
|
*/
|
|
676
691
|
public getLayout(requestParameters: LayoutsApiGetLayoutRequest, options?: AxiosRequestConfig) {
|
|
677
|
-
return LayoutsApiFp(this.configuration).getLayout(requestParameters.id, requestParameters.id2, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
692
|
+
return LayoutsApiFp(this.configuration).getLayout(requestParameters.id, requestParameters.id2, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
678
693
|
}
|
|
679
694
|
|
|
680
695
|
/**
|
|
@@ -686,7 +701,7 @@ export class LayoutsApi extends BaseAPI {
|
|
|
686
701
|
* @memberof LayoutsApi
|
|
687
702
|
*/
|
|
688
703
|
public listLayouts(requestParameters: LayoutsApiListLayoutsRequest = {}, options?: AxiosRequestConfig) {
|
|
689
|
-
return LayoutsApiFp(this.configuration).listLayouts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then((request) => request(this.axios, this.basePath));
|
|
704
|
+
return LayoutsApiFp(this.configuration).listLayouts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
690
705
|
}
|
|
691
706
|
|
|
692
707
|
/**
|
|
@@ -698,6 +713,6 @@ export class LayoutsApi extends BaseAPI {
|
|
|
698
713
|
* @memberof LayoutsApi
|
|
699
714
|
*/
|
|
700
715
|
public updateLayout(requestParameters: LayoutsApiUpdateLayoutRequest, options?: AxiosRequestConfig) {
|
|
701
|
-
return LayoutsApiFp(this.configuration).updateLayout(requestParameters.id, requestParameters.updateLayoutRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
716
|
+
return LayoutsApiFp(this.configuration).updateLayout(requestParameters.id, requestParameters.updateLayoutRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
702
717
|
}
|
|
703
718
|
}
|
|
@@ -261,7 +261,7 @@ export class MSGraphWebhooksApi extends BaseAPI {
|
|
|
261
261
|
* @memberof MSGraphWebhooksApi
|
|
262
262
|
*/
|
|
263
263
|
public receiveLifecycle(requestParameters: MSGraphWebhooksApiReceiveLifecycleRequest, options?: AxiosRequestConfig) {
|
|
264
|
-
return MSGraphWebhooksApiFp(this.configuration).receiveLifecycle(requestParameters.tenantSlug, requestParameters.validationToken, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
264
|
+
return MSGraphWebhooksApiFp(this.configuration).receiveLifecycle(requestParameters.tenantSlug, requestParameters.validationToken, requestParameters.body, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
/**
|
|
@@ -273,6 +273,6 @@ export class MSGraphWebhooksApi extends BaseAPI {
|
|
|
273
273
|
* @memberof MSGraphWebhooksApi
|
|
274
274
|
*/
|
|
275
275
|
public receiveNotifications(requestParameters: MSGraphWebhooksApiReceiveNotificationsRequest, options?: AxiosRequestConfig) {
|
|
276
|
-
return MSGraphWebhooksApiFp(this.configuration).receiveNotifications(requestParameters.tenantSlug, requestParameters.validationToken, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
276
|
+
return MSGraphWebhooksApiFp(this.configuration).receiveNotifications(requestParameters.tenantSlug, requestParameters.validationToken, requestParameters.body, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
277
277
|
}
|
|
278
278
|
}
|
|
@@ -67,9 +67,12 @@ export const NotificationTemplatesApiAxiosParamCreator = function (configuration
|
|
|
67
67
|
// http bearer authentication required
|
|
68
68
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
69
69
|
|
|
70
|
-
// Only Authorization falls back to the configured token
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
71
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
72
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
73
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
74
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
75
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
73
76
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
74
77
|
}
|
|
75
78
|
|
|
@@ -117,9 +120,12 @@ export const NotificationTemplatesApiAxiosParamCreator = function (configuration
|
|
|
117
120
|
// http bearer authentication required
|
|
118
121
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
119
122
|
|
|
120
|
-
// Only Authorization falls back to the configured token
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
124
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
125
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
126
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
127
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
128
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
123
129
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
124
130
|
}
|
|
125
131
|
|
|
@@ -176,9 +182,12 @@ export const NotificationTemplatesApiAxiosParamCreator = function (configuration
|
|
|
176
182
|
localVarQueryParameter['expand'] = expand;
|
|
177
183
|
}
|
|
178
184
|
|
|
179
|
-
// Only Authorization falls back to the configured token
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
186
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
187
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
188
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
189
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
190
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
182
191
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
183
192
|
}
|
|
184
193
|
|
|
@@ -254,9 +263,12 @@ export const NotificationTemplatesApiAxiosParamCreator = function (configuration
|
|
|
254
263
|
localVarQueryParameter['filters'] = filters;
|
|
255
264
|
}
|
|
256
265
|
|
|
257
|
-
// Only Authorization falls back to the configured token
|
|
258
|
-
|
|
259
|
-
|
|
266
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
267
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
268
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
269
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
270
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
271
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
260
272
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
261
273
|
}
|
|
262
274
|
|
|
@@ -304,9 +316,12 @@ export const NotificationTemplatesApiAxiosParamCreator = function (configuration
|
|
|
304
316
|
// http bearer authentication required
|
|
305
317
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
306
318
|
|
|
307
|
-
// Only Authorization falls back to the configured token
|
|
308
|
-
|
|
309
|
-
|
|
319
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
320
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
321
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
322
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
323
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
324
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
310
325
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
311
326
|
}
|
|
312
327
|
|
|
@@ -664,7 +679,7 @@ export class NotificationTemplatesApi extends BaseAPI {
|
|
|
664
679
|
* @memberof NotificationTemplatesApi
|
|
665
680
|
*/
|
|
666
681
|
public createNotificationTemplate(requestParameters: NotificationTemplatesApiCreateNotificationTemplateRequest, options?: AxiosRequestConfig) {
|
|
667
|
-
return NotificationTemplatesApiFp(this.configuration).createNotificationTemplate(requestParameters.createNotificationTemplateRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
682
|
+
return NotificationTemplatesApiFp(this.configuration).createNotificationTemplate(requestParameters.createNotificationTemplateRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
668
683
|
}
|
|
669
684
|
|
|
670
685
|
/**
|
|
@@ -676,7 +691,7 @@ export class NotificationTemplatesApi extends BaseAPI {
|
|
|
676
691
|
* @memberof NotificationTemplatesApi
|
|
677
692
|
*/
|
|
678
693
|
public deleteNotificationTemplate(requestParameters: NotificationTemplatesApiDeleteNotificationTemplateRequest, options?: AxiosRequestConfig) {
|
|
679
|
-
return NotificationTemplatesApiFp(this.configuration).deleteNotificationTemplate(requestParameters.id, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
694
|
+
return NotificationTemplatesApiFp(this.configuration).deleteNotificationTemplate(requestParameters.id, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
680
695
|
}
|
|
681
696
|
|
|
682
697
|
/**
|
|
@@ -688,7 +703,7 @@ export class NotificationTemplatesApi extends BaseAPI {
|
|
|
688
703
|
* @memberof NotificationTemplatesApi
|
|
689
704
|
*/
|
|
690
705
|
public getNotificationTemplate(requestParameters: NotificationTemplatesApiGetNotificationTemplateRequest, options?: AxiosRequestConfig) {
|
|
691
|
-
return NotificationTemplatesApiFp(this.configuration).getNotificationTemplate(requestParameters.id, requestParameters.id2, requestParameters.authorization, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
|
|
706
|
+
return NotificationTemplatesApiFp(this.configuration).getNotificationTemplate(requestParameters.id, requestParameters.id2, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
692
707
|
}
|
|
693
708
|
|
|
694
709
|
/**
|
|
@@ -700,7 +715,7 @@ export class NotificationTemplatesApi extends BaseAPI {
|
|
|
700
715
|
* @memberof NotificationTemplatesApi
|
|
701
716
|
*/
|
|
702
717
|
public listNotificationTemplates(requestParameters: NotificationTemplatesApiListNotificationTemplatesRequest = {}, options?: AxiosRequestConfig) {
|
|
703
|
-
return NotificationTemplatesApiFp(this.configuration).listNotificationTemplates(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then((request) => request(this.axios, this.basePath));
|
|
718
|
+
return NotificationTemplatesApiFp(this.configuration).listNotificationTemplates(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
704
719
|
}
|
|
705
720
|
|
|
706
721
|
/**
|
|
@@ -712,6 +727,6 @@ export class NotificationTemplatesApi extends BaseAPI {
|
|
|
712
727
|
* @memberof NotificationTemplatesApi
|
|
713
728
|
*/
|
|
714
729
|
public updateNotificationTemplate(requestParameters: NotificationTemplatesApiUpdateNotificationTemplateRequest, options?: AxiosRequestConfig) {
|
|
715
|
-
return NotificationTemplatesApiFp(this.configuration).updateNotificationTemplate(requestParameters.id, requestParameters.updateNotificationTemplateRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
730
|
+
return NotificationTemplatesApiFp(this.configuration).updateNotificationTemplate(requestParameters.id, requestParameters.updateNotificationTemplateRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
716
731
|
}
|
|
717
732
|
}
|
package/api/notifications-api.ts
CHANGED
|
@@ -63,9 +63,12 @@ export const NotificationsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
63
63
|
// http bearer authentication required
|
|
64
64
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
65
65
|
|
|
66
|
-
// Only Authorization falls back to the configured token
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
67
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
68
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
69
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
70
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
71
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
69
72
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -112,9 +115,12 @@ export const NotificationsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
112
115
|
// http bearer authentication required
|
|
113
116
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
114
117
|
|
|
115
|
-
// Only Authorization falls back to the configured token
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
119
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
120
|
+
const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
121
|
+
const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
122
|
+
const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
|
|
123
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
118
124
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
119
125
|
}
|
|
120
126
|
|
|
@@ -259,7 +265,7 @@ export class NotificationsApi extends BaseAPI {
|
|
|
259
265
|
* @memberof NotificationsApi
|
|
260
266
|
*/
|
|
261
267
|
public sendEmail(requestParameters: NotificationsApiSendEmailRequest, options?: AxiosRequestConfig) {
|
|
262
|
-
return NotificationsApiFp(this.configuration).sendEmail(requestParameters.sendEmailRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
268
|
+
return NotificationsApiFp(this.configuration).sendEmail(requestParameters.sendEmailRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
/**
|
|
@@ -271,6 +277,6 @@ export class NotificationsApi extends BaseAPI {
|
|
|
271
277
|
* @memberof NotificationsApi
|
|
272
278
|
*/
|
|
273
279
|
public sendNotification(requestParameters: NotificationsApiSendNotificationRequest, options?: AxiosRequestConfig) {
|
|
274
|
-
return NotificationsApiFp(this.configuration).sendNotification(requestParameters.sendNotificationRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
280
|
+
return NotificationsApiFp(this.configuration).sendNotification(requestParameters.sendNotificationRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
|
|
275
281
|
}
|
|
276
282
|
}
|
package/base.ts
CHANGED
|
@@ -72,6 +72,10 @@ export enum Environment {
|
|
|
72
72
|
let _retry_count = 0
|
|
73
73
|
let _retry = null
|
|
74
74
|
|
|
75
|
+
// Marks each request with the account (username) of the SDK object that sent it: only SDK objects of that
|
|
76
|
+
// account refresh and resend it, never an object of another account open in the same browser.
|
|
77
|
+
const REQUEST_OWNER = '_emilSdkOwner';
|
|
78
|
+
|
|
75
79
|
export function resetRetry() {
|
|
76
80
|
_retry_count = 0
|
|
77
81
|
}
|
|
@@ -120,6 +124,15 @@ export class BaseAPI {
|
|
|
120
124
|
this.loadTokenData();
|
|
121
125
|
|
|
122
126
|
if (configuration) {
|
|
127
|
+
// Two accounts in one browser share APP_TOKEN: never take the token or session account saved for
|
|
128
|
+
// another account. The mode stays (an app naming its account keeps its session). Saved with the next refresh.
|
|
129
|
+
const ownUser = configuration.username;
|
|
130
|
+
const storedUser = this.tokenData.username;
|
|
131
|
+
if (ownUser && storedUser && ownUser.toLowerCase() !== storedUser.toLowerCase()) {
|
|
132
|
+
delete this.tokenData.accessToken;
|
|
133
|
+
delete this.tokenData.sub;
|
|
134
|
+
this.tokenData.username = ownUser;
|
|
135
|
+
}
|
|
123
136
|
const { accessToken } = this.tokenData;
|
|
124
137
|
this.configuration = configuration;
|
|
125
138
|
this.basePath = configuration.basePath || this.basePath;
|
|
@@ -173,11 +186,14 @@ export class BaseAPI {
|
|
|
173
186
|
};
|
|
174
187
|
}
|
|
175
188
|
|
|
176
|
-
private useHeaderAuth(accessToken: string) {
|
|
189
|
+
private useHeaderAuth(accessToken: string, keepSessionData = false) {
|
|
177
190
|
this.configuration.accessToken = accessToken ? `Bearer ${accessToken}` : '';
|
|
178
191
|
this.tokenData.accessToken = accessToken;
|
|
179
|
-
|
|
180
|
-
|
|
192
|
+
// An app without cookieAuth does not own the session fields: its refresh leaves them for the session apps.
|
|
193
|
+
if (!keepSessionData || this.configuration.cookieAuth) {
|
|
194
|
+
delete this.tokenData.authMode;
|
|
195
|
+
delete this.tokenData.sub;
|
|
196
|
+
}
|
|
181
197
|
if (this.configuration.cookieAuth) {
|
|
182
198
|
const { withCredentials, headers, ...baseOptions } = this.configuration.baseOptions || {};
|
|
183
199
|
const { [ACCOUNT_HEADER]: account, ...otherHeaders } = headers || {};
|
|
@@ -185,7 +201,7 @@ export class BaseAPI {
|
|
|
185
201
|
}
|
|
186
202
|
}
|
|
187
203
|
|
|
188
|
-
private applyTokenReply({ accessToken, authMode, session }: LoginClass) {
|
|
204
|
+
private applyTokenReply({ accessToken, authMode, session }: LoginClass, fromRefresh = false) {
|
|
189
205
|
if (this.configuration.cookieAuth && SESSION_MODES.indexOf(authMode) !== -1 && session?.sub) {
|
|
190
206
|
this.tokenData.authMode = authMode;
|
|
191
207
|
this.tokenData.sub = session.sub;
|
|
@@ -201,7 +217,7 @@ export class BaseAPI {
|
|
|
201
217
|
}
|
|
202
218
|
this.useSessionAuth();
|
|
203
219
|
} else {
|
|
204
|
-
this.useHeaderAuth(accessToken);
|
|
220
|
+
this.useHeaderAuth(accessToken, fromRefresh);
|
|
205
221
|
}
|
|
206
222
|
}
|
|
207
223
|
|
|
@@ -335,9 +351,34 @@ export class BaseAPI {
|
|
|
335
351
|
|
|
336
352
|
const refreshTokenAxios = globalAxios.create()
|
|
337
353
|
refreshTokenAxios.interceptors.response.use(response => {
|
|
338
|
-
const { permissions } = response.data;
|
|
339
|
-
|
|
354
|
+
const { permissions, accessToken, authMode } = response.data;
|
|
355
|
+
// Decided before the merge below: newer session data must not keep the new token from this object.
|
|
356
|
+
const onSession = this.usesSession();
|
|
357
|
+
|
|
358
|
+
// Newer data saved for this account (e.g. the session mode the shell saved later) wins over the copy
|
|
359
|
+
// read when the object was made; data of another account or another workspace (sub) is never taken.
|
|
360
|
+
const latest = ((typeof window !== 'undefined' && defaultStorage().get<TokenData>(TOKEN_DATA)) || {}) as TokenData;
|
|
361
|
+
const ownSub = this.sessionAccount();
|
|
362
|
+
if (latest.username?.toLowerCase() === username.toLowerCase()
|
|
363
|
+
&& (!ownSub || !latest.sub || latest.sub === ownSub)) {
|
|
364
|
+
// A bare reset ({username}, an app's account check) keeps this copy's other fields; any fuller record
|
|
365
|
+
// is the truth, so fields it lacks were removed on purpose (e.g. a rollback) and stay removed.
|
|
366
|
+
const bareReset = Object.keys(latest).every((key) => key === 'username');
|
|
367
|
+
this.tokenData = bareReset ? { ...this.tokenData, ...latest } : { ...latest };
|
|
368
|
+
}
|
|
369
|
+
// The reply is for this account: label it, or an SDK object of another account would take the token.
|
|
370
|
+
if (this.tokenData.username?.toLowerCase() !== username.toLowerCase()) {
|
|
371
|
+
this.tokenData.username = username;
|
|
372
|
+
}
|
|
340
373
|
this.tokenData.permissions = permissions;
|
|
374
|
+
// Keep the new token for the page's next SDK objects; session data is left as it is.
|
|
375
|
+
if (accessToken && !onSession) {
|
|
376
|
+
this.tokenData.accessToken = accessToken;
|
|
377
|
+
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
378
|
+
} else if (accessToken && authMode === 'both') {
|
|
379
|
+
// Both: this app stays on the session; the token is kept for apps not moved yet.
|
|
380
|
+
this.tokenData.accessToken = accessToken;
|
|
381
|
+
}
|
|
341
382
|
this.storeTokenData(this.tokenData);
|
|
342
383
|
|
|
343
384
|
return response;
|
|
@@ -376,6 +417,18 @@ export class BaseAPI {
|
|
|
376
417
|
this.storeTokenData(null);
|
|
377
418
|
}
|
|
378
419
|
|
|
420
|
+
private ownAccount(): string {
|
|
421
|
+
return (this.configuration.username || '').toLowerCase();
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
protected withOwner(options?: AxiosRequestConfig): AxiosRequestConfig {
|
|
425
|
+
// An object without a username cannot refresh itself: its requests stay unmarked, as before.
|
|
426
|
+
if (!this.ownAccount()) {
|
|
427
|
+
return { ...options };
|
|
428
|
+
}
|
|
429
|
+
return { ...options, [REQUEST_OWNER]: this.ownAccount() } as AxiosRequestConfig;
|
|
430
|
+
}
|
|
431
|
+
|
|
379
432
|
private attachInterceptor(axios: AxiosInstance) {
|
|
380
433
|
axios.interceptors.response.use(
|
|
381
434
|
(res) => {
|
|
@@ -383,6 +436,11 @@ export class BaseAPI {
|
|
|
383
436
|
},
|
|
384
437
|
async (err) => {
|
|
385
438
|
let originalConfig = err.config;
|
|
439
|
+
// Sent for another account: only that account's SDK objects handle it. Unmarked requests as before.
|
|
440
|
+
const owner = originalConfig?.[REQUEST_OWNER];
|
|
441
|
+
if (owner !== undefined && owner !== this.ownAccount()) {
|
|
442
|
+
return Promise.reject(err);
|
|
443
|
+
}
|
|
386
444
|
if (err.response && !(err.response instanceof XMLHttpRequest)) { // sometimes buggy and is of type request
|
|
387
445
|
// Access Token was expired
|
|
388
446
|
if ((err.response.status === 401 || err.response.status === 403)
|
|
@@ -391,7 +449,7 @@ export class BaseAPI {
|
|
|
391
449
|
try {
|
|
392
450
|
const reply = await this.refreshTokenInternal();
|
|
393
451
|
this.tokenData.permissions = reply.permissions;
|
|
394
|
-
this.applyTokenReply(reply);
|
|
452
|
+
this.applyTokenReply(reply, true);
|
|
395
453
|
this.storeTokenData(this.tokenData);
|
|
396
454
|
|
|
397
455
|
if (!this.usesSession()) {
|
|
@@ -431,11 +489,16 @@ export class BaseAPI {
|
|
|
431
489
|
this.tokenData.permissions = reply.permissions;
|
|
432
490
|
|
|
433
491
|
_retry = true;
|
|
434
|
-
this.applyTokenReply(reply);
|
|
492
|
+
this.applyTokenReply(reply, true);
|
|
435
493
|
this.storeTokenData(this.tokenData);
|
|
436
494
|
|
|
495
|
+
// The limit is for refreshes that do not help; one that worked starts the count again.
|
|
496
|
+
// Not awaited, so a failed retry reaches the app as the same axios error as before.
|
|
437
497
|
return axios.request({
|
|
438
498
|
...this.withCurrentAuth(originalConfig),
|
|
499
|
+
}).then((retried) => {
|
|
500
|
+
_retry_count = 0;
|
|
501
|
+
return retried;
|
|
439
502
|
});
|
|
440
503
|
} catch (_error) {
|
|
441
504
|
if (_error.response && _error.response.data) {
|
|
@@ -102,9 +102,10 @@ 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;
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
|
|
106
|
+
var _a;
|
|
107
|
+
return __generator(this, function (_b) {
|
|
108
|
+
switch (_b.label) {
|
|
108
109
|
case 0:
|
|
109
110
|
localVarPath = "/notificationservice/v1/email-mailboxes";
|
|
110
111
|
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
@@ -118,14 +119,17 @@ var EmailMailboxesApiAxiosParamCreator = function (configuration) {
|
|
|
118
119
|
// authentication bearer required
|
|
119
120
|
// http bearer authentication required
|
|
120
121
|
return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
|
|
121
|
-
// Only Authorization falls back to the configured token
|
|
122
|
+
// Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
|
|
123
|
+
// no token is stored, so a refused call still refreshes; a session call (account header) sends none.
|
|
122
124
|
];
|
|
123
125
|
case 1:
|
|
124
126
|
// authentication bearer required
|
|
125
127
|
// http bearer authentication required
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
_b.sent();
|
|
129
|
+
authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
|
|
130
|
+
authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
|
|
131
|
+
authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
|
|
132
|
+
if (authorizationValue || authorizationKeepEmpty) {
|
|
129
133
|
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
130
134
|
}
|
|
131
135
|
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
@@ -214,7 +218,7 @@ var EmailMailboxesApi = /** @class */ (function (_super) {
|
|
|
214
218
|
EmailMailboxesApi.prototype.listEmailMailboxes = function (requestParameters, options) {
|
|
215
219
|
var _this = this;
|
|
216
220
|
if (requestParameters === void 0) { requestParameters = {}; }
|
|
217
|
-
return (0, exports.EmailMailboxesApiFp)(this.configuration).listEmailMailboxes(requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
221
|
+
return (0, exports.EmailMailboxesApiFp)(this.configuration).listEmailMailboxes(requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
218
222
|
};
|
|
219
223
|
return EmailMailboxesApi;
|
|
220
224
|
}(base_1.BaseAPI));
|