@emilgroup/notification-sdk 0.8.1-beta.62 → 0.8.1-beta.64

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.
@@ -103,9 +103,10 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
103
103
  createNotificationTemplate: function (createNotificationTemplateRequestDto, authorization, options) {
104
104
  if (options === void 0) { options = {}; }
105
105
  return __awaiter(_this, void 0, void 0, function () {
106
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
107
- return __generator(this, function (_a) {
108
- switch (_a.label) {
106
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
107
+ var _a;
108
+ return __generator(this, function (_b) {
109
+ switch (_b.label) {
109
110
  case 0:
110
111
  // verify required parameter 'createNotificationTemplateRequestDto' is not null or undefined
111
112
  (0, common_1.assertParamExists)('createNotificationTemplate', 'createNotificationTemplateRequestDto', createNotificationTemplateRequestDto);
@@ -121,14 +122,17 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
121
122
  // authentication bearer required
122
123
  // http bearer authentication required
123
124
  return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
124
- // Only Authorization falls back to the configured token; an empty value is never sent.
125
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
126
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
125
127
  ];
126
128
  case 1:
127
129
  // authentication bearer required
128
130
  // http bearer authentication required
129
- _a.sent();
130
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
131
- if (authorizationValue) {
131
+ _b.sent();
132
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
133
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
134
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
135
+ if (authorizationValue || authorizationKeepEmpty) {
132
136
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
133
137
  }
134
138
  localVarHeaderParameter['Content-Type'] = 'application/json';
@@ -155,9 +159,10 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
155
159
  deleteNotificationTemplate: function (id, authorization, options) {
156
160
  if (options === void 0) { options = {}; }
157
161
  return __awaiter(_this, void 0, void 0, function () {
158
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
159
- return __generator(this, function (_a) {
160
- switch (_a.label) {
162
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
163
+ var _a;
164
+ return __generator(this, function (_b) {
165
+ switch (_b.label) {
161
166
  case 0:
162
167
  // verify required parameter 'id' is not null or undefined
163
168
  (0, common_1.assertParamExists)('deleteNotificationTemplate', 'id', id);
@@ -174,14 +179,17 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
174
179
  // authentication bearer required
175
180
  // http bearer authentication required
176
181
  return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
177
- // Only Authorization falls back to the configured token; an empty value is never sent.
182
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
183
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
178
184
  ];
179
185
  case 1:
180
186
  // authentication bearer required
181
187
  // http bearer authentication required
182
- _a.sent();
183
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
184
- if (authorizationValue) {
188
+ _b.sent();
189
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
190
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
191
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
192
+ if (authorizationValue || authorizationKeepEmpty) {
185
193
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
186
194
  }
187
195
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -208,9 +216,10 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
208
216
  getNotificationTemplate: function (id, id2, authorization, expand, options) {
209
217
  if (options === void 0) { options = {}; }
210
218
  return __awaiter(_this, void 0, void 0, function () {
211
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
212
- return __generator(this, function (_a) {
213
- switch (_a.label) {
219
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
220
+ var _a;
221
+ return __generator(this, function (_b) {
222
+ switch (_b.label) {
214
223
  case 0:
215
224
  // verify required parameter 'id' is not null or undefined
216
225
  (0, common_1.assertParamExists)('getNotificationTemplate', 'id', id);
@@ -232,15 +241,17 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
232
241
  case 1:
233
242
  // authentication bearer required
234
243
  // http bearer authentication required
235
- _a.sent();
244
+ _b.sent();
236
245
  if (id2 !== undefined) {
237
246
  localVarQueryParameter['id'] = id2;
238
247
  }
239
248
  if (expand !== undefined) {
240
249
  localVarQueryParameter['expand'] = expand;
241
250
  }
242
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
243
- if (authorizationValue) {
251
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
252
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
253
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
254
+ if (authorizationValue || authorizationKeepEmpty) {
244
255
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
245
256
  }
246
257
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -271,9 +282,10 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
271
282
  listNotificationTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
272
283
  if (options === void 0) { options = {}; }
273
284
  return __awaiter(_this, void 0, void 0, function () {
274
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
275
- return __generator(this, function (_a) {
276
- switch (_a.label) {
285
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
286
+ var _a;
287
+ return __generator(this, function (_b) {
288
+ switch (_b.label) {
277
289
  case 0:
278
290
  localVarPath = "/notificationservice/v1/notification-templates";
279
291
  localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
@@ -290,7 +302,7 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
290
302
  case 1:
291
303
  // authentication bearer required
292
304
  // http bearer authentication required
293
- _a.sent();
305
+ _b.sent();
294
306
  if (pageSize !== undefined) {
295
307
  localVarQueryParameter['pageSize'] = pageSize;
296
308
  }
@@ -312,8 +324,10 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
312
324
  if (filters !== undefined) {
313
325
  localVarQueryParameter['filters'] = filters;
314
326
  }
315
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
316
- if (authorizationValue) {
327
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
328
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
329
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
330
+ if (authorizationValue || authorizationKeepEmpty) {
317
331
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
318
332
  }
319
333
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -339,9 +353,10 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
339
353
  updateNotificationTemplate: function (id, updateNotificationTemplateRequestDto, authorization, options) {
340
354
  if (options === void 0) { options = {}; }
341
355
  return __awaiter(_this, void 0, void 0, function () {
342
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
343
- return __generator(this, function (_a) {
344
- switch (_a.label) {
356
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
357
+ var _a;
358
+ return __generator(this, function (_b) {
359
+ switch (_b.label) {
345
360
  case 0:
346
361
  // verify required parameter 'id' is not null or undefined
347
362
  (0, common_1.assertParamExists)('updateNotificationTemplate', 'id', id);
@@ -360,14 +375,17 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
360
375
  // authentication bearer required
361
376
  // http bearer authentication required
362
377
  return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
363
- // Only Authorization falls back to the configured token; an empty value is never sent.
378
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
379
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
364
380
  ];
365
381
  case 1:
366
382
  // authentication bearer required
367
383
  // http bearer authentication required
368
- _a.sent();
369
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
370
- if (authorizationValue) {
384
+ _b.sent();
385
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
386
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
387
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
388
+ if (authorizationValue || authorizationKeepEmpty) {
371
389
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
372
390
  }
373
391
  localVarHeaderParameter['Content-Type'] = 'application/json';
@@ -103,9 +103,10 @@ var NotificationsApiAxiosParamCreator = function (configuration) {
103
103
  sendEmail: function (sendEmailRequestDto, authorization, options) {
104
104
  if (options === void 0) { options = {}; }
105
105
  return __awaiter(_this, void 0, void 0, function () {
106
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
107
- return __generator(this, function (_a) {
108
- switch (_a.label) {
106
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
107
+ var _a;
108
+ return __generator(this, function (_b) {
109
+ switch (_b.label) {
109
110
  case 0:
110
111
  // verify required parameter 'sendEmailRequestDto' is not null or undefined
111
112
  (0, common_1.assertParamExists)('sendEmail', 'sendEmailRequestDto', sendEmailRequestDto);
@@ -121,14 +122,17 @@ var NotificationsApiAxiosParamCreator = function (configuration) {
121
122
  // authentication bearer required
122
123
  // http bearer authentication required
123
124
  return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
124
- // Only Authorization falls back to the configured token; an empty value is never sent.
125
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
126
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
125
127
  ];
126
128
  case 1:
127
129
  // authentication bearer required
128
130
  // http bearer authentication required
129
- _a.sent();
130
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
131
- if (authorizationValue) {
131
+ _b.sent();
132
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
133
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
134
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
135
+ if (authorizationValue || authorizationKeepEmpty) {
132
136
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
133
137
  }
134
138
  localVarHeaderParameter['Content-Type'] = 'application/json';
@@ -155,9 +159,10 @@ var NotificationsApiAxiosParamCreator = function (configuration) {
155
159
  sendNotification: function (sendNotificationRequestDto, authorization, options) {
156
160
  if (options === void 0) { options = {}; }
157
161
  return __awaiter(_this, void 0, void 0, function () {
158
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
159
- return __generator(this, function (_a) {
160
- switch (_a.label) {
162
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
163
+ var _a;
164
+ return __generator(this, function (_b) {
165
+ switch (_b.label) {
161
166
  case 0:
162
167
  // verify required parameter 'sendNotificationRequestDto' is not null or undefined
163
168
  (0, common_1.assertParamExists)('sendNotification', 'sendNotificationRequestDto', sendNotificationRequestDto);
@@ -173,14 +178,17 @@ var NotificationsApiAxiosParamCreator = function (configuration) {
173
178
  // authentication bearer required
174
179
  // http bearer authentication required
175
180
  return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
176
- // Only Authorization falls back to the configured token; an empty value is never sent.
181
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
182
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
177
183
  ];
178
184
  case 1:
179
185
  // authentication bearer required
180
186
  // http bearer authentication required
181
- _a.sent();
182
- authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
183
- if (authorizationValue) {
187
+ _b.sent();
188
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
189
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
190
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
191
+ if (authorizationValue || authorizationKeepEmpty) {
184
192
  localVarHeaderParameter['Authorization'] = String(authorizationValue);
185
193
  }
186
194
  localVarHeaderParameter['Content-Type'] = 'application/json';
package/dist/base.js CHANGED
@@ -142,6 +142,15 @@ var BaseAPI = /** @class */ (function () {
142
142
  this.axios = axios;
143
143
  this.loadTokenData();
144
144
  if (configuration) {
145
+ // Two accounts in one browser share APP_TOKEN: never take the token or session account saved for
146
+ // another account. The mode stays (an app naming its account keeps its session). Saved with the next refresh.
147
+ var ownUser = configuration.username;
148
+ var storedUser = this.tokenData.username;
149
+ if (ownUser && storedUser && ownUser.toLowerCase() !== storedUser.toLowerCase()) {
150
+ delete this.tokenData.accessToken;
151
+ delete this.tokenData.sub;
152
+ this.tokenData.username = ownUser;
153
+ }
145
154
  var accessToken = this.tokenData.accessToken;
146
155
  this.configuration = configuration;
147
156
  this.basePath = configuration.basePath || this.basePath;
@@ -452,7 +461,12 @@ var BaseAPI = /** @class */ (function () {
452
461
  _retry = true;
453
462
  this.applyTokenReply(reply);
454
463
  this.storeTokenData(this.tokenData);
455
- return [2 /*return*/, axios.request(__assign({}, this.withCurrentAuth(originalConfig)))];
464
+ // The limit is for refreshes that do not help; one that worked starts the count again.
465
+ // Not awaited, so a failed retry reaches the app as the same axios error as before.
466
+ return [2 /*return*/, axios.request(__assign({}, this.withCurrentAuth(originalConfig))).then(function (retried) {
467
+ _retry_count = 0;
468
+ return retried;
469
+ })];
456
470
  case 9:
457
471
  _error_2 = _a.sent();
458
472
  if (_error_2.response && _error_2.response.data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/notification-sdk",
3
- "version": "0.8.1-beta.62",
3
+ "version": "0.8.1-beta.64",
4
4
  "description": "OpenAPI client for @emilgroup/notification-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [