@emilgroup/accounting-sdk 1.34.1-beta.57 → 1.34.1-beta.59

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 (59) hide show
  1. package/.openapi-generator/FILES +2 -0
  2. package/README.md +2 -2
  3. package/api/accounting-configs-api.ts +32 -16
  4. package/api/booking-entries-api.ts +20 -10
  5. package/api/commission-account-mappings-api.ts +32 -16
  6. package/api/financial-accounts-api.ts +20 -10
  7. package/api/financial-transactions-api.ts +8 -4
  8. package/api/number-ranges-api.ts +16 -8
  9. package/api/personal-accounts-api.ts +16 -8
  10. package/api/product-account-mappings-api.ts +265 -20
  11. package/base.ts +174 -41
  12. package/configuration.ts +20 -0
  13. package/dist/api/accounting-configs-api.js +56 -32
  14. package/dist/api/booking-entries-api.js +29 -18
  15. package/dist/api/commission-account-mappings-api.js +47 -29
  16. package/dist/api/financial-accounts-api.js +29 -18
  17. package/dist/api/financial-transactions-api.js +8 -6
  18. package/dist/api/number-ranges-api.js +22 -14
  19. package/dist/api/personal-accounts-api.js +22 -14
  20. package/dist/api/product-account-mappings-api.d.ts +121 -0
  21. package/dist/api/product-account-mappings-api.js +261 -38
  22. package/dist/base.d.ts +24 -0
  23. package/dist/base.js +178 -59
  24. package/dist/configuration.d.ts +17 -0
  25. package/dist/configuration.js +2 -0
  26. package/dist/models/account-mapping-class.d.ts +2 -0
  27. package/dist/models/account-mapping-class.js +3 -1
  28. package/dist/models/accounting-config-data-dto-default-account-mappings.d.ts +2 -0
  29. package/dist/models/accounting-config-data-dto-default-account-mappings.js +3 -1
  30. package/dist/models/booking-entry-class.d.ts +1 -0
  31. package/dist/models/booking-entry-class.js +1 -0
  32. package/dist/models/create-booking-entry-request-dto.d.ts +1 -0
  33. package/dist/models/create-booking-entry-request-dto.js +1 -0
  34. package/dist/models/create-financial-account-request-dto.d.ts +2 -0
  35. package/dist/models/create-financial-account-request-dto.js +3 -1
  36. package/dist/models/financial-transaction-class.d.ts +6 -0
  37. package/dist/models/financial-transaction-data-dto.d.ts +6 -0
  38. package/dist/models/index.d.ts +2 -0
  39. package/dist/models/index.js +2 -0
  40. package/dist/models/post-financial-event-request-dto.d.ts +3 -2
  41. package/dist/models/post-financial-event-request-dto.js +1 -0
  42. package/dist/models/product-account-mapping-detail-class.d.ts +6 -0
  43. package/dist/models/product-risk-carrier-class.d.ts +42 -0
  44. package/dist/models/product-risk-carrier-class.js +15 -0
  45. package/dist/models/put-product-risk-carrier-body-dto.d.ts +24 -0
  46. package/dist/models/put-product-risk-carrier-body-dto.js +15 -0
  47. package/models/account-mapping-class.ts +3 -1
  48. package/models/accounting-config-data-dto-default-account-mappings.ts +3 -1
  49. package/models/booking-entry-class.ts +1 -0
  50. package/models/create-booking-entry-request-dto.ts +1 -0
  51. package/models/create-financial-account-request-dto.ts +3 -1
  52. package/models/financial-transaction-class.ts +6 -0
  53. package/models/financial-transaction-data-dto.ts +6 -0
  54. package/models/index.ts +2 -0
  55. package/models/post-financial-event-request-dto.ts +3 -2
  56. package/models/product-account-mapping-detail-class.ts +6 -0
  57. package/models/product-risk-carrier-class.ts +48 -0
  58. package/models/put-product-risk-carrier-body-dto.ts +30 -0
  59. package/package.json +1 -1
package/base.ts CHANGED
@@ -32,9 +32,20 @@ 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
+
35
44
  export interface LoginClass {
36
45
  accessToken: string;
37
46
  permissions: string;
47
+ authMode?: string;
48
+ session?: SessionClass;
38
49
  }
39
50
 
40
51
  export interface SwitchWorkspaceRequest {
@@ -45,6 +56,8 @@ export interface SwitchWorkspaceRequest {
45
56
  export interface SwitchWorkspaceResponseClass {
46
57
  accessToken: string;
47
58
  permissions: string;
59
+ authMode?: string;
60
+ session?: SessionClass;
48
61
  }
49
62
 
50
63
  export enum Environment {
@@ -77,10 +90,19 @@ interface TokenData {
77
90
  accessToken?: string;
78
91
  username?: string;
79
92
  permissions?: string;
93
+ // 'both' or 'session' when authservice keeps the tokens in a server session.
94
+ authMode?: string;
95
+ sub?: string;
80
96
  }
81
97
 
82
98
  const NETWORK_ERROR_MESSAGE = "Network Error";
83
99
  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'];
84
106
 
85
107
  /**
86
108
  *
@@ -102,10 +124,18 @@ export class BaseAPI {
102
124
  this.configuration = configuration;
103
125
  this.basePath = configuration.basePath || this.basePath;
104
126
 
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;
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
+ }
109
139
  } else {
110
140
  const { accessToken, username } = this.tokenData;
111
141
 
@@ -119,6 +149,107 @@ export class BaseAPI {
119
149
  this.attachInterceptor(axios);
120
150
  }
121
151
 
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
+
122
253
  selectEnvironment(env: Environment) {
123
254
  this.selectBasePath(env);
124
255
  }
@@ -138,8 +269,8 @@ export class BaseAPI {
138
269
  async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
139
270
  const options: AxiosRequestConfig = {
140
271
  method: 'POST',
141
- url: `${this.configuration.basePath}/authservice/v1/login`,
142
- headers: { 'Content-Type': 'application/json' },
272
+ url: `${this.authBasePath()}/authservice/v1/login`,
273
+ headers: { 'Content-Type': 'application/json', ...(this.configuration.cookieAuth && { [AUTH_MODE_HEADER]: 'session' }) },
143
274
  data: {
144
275
  username,
145
276
  password,
@@ -149,13 +280,10 @@ export class BaseAPI {
149
280
 
150
281
  const response = await globalAxios.request<LoginClass>(options);
151
282
 
152
- const { data: { accessToken, permissions } } = response;
153
-
154
283
  this.configuration.username = username;
155
- this.configuration.accessToken = `Bearer ${accessToken}`;
156
284
  this.tokenData.username = username;
157
- this.tokenData.accessToken = accessToken;
158
- this.tokenData.permissions = permissions;
285
+ this.tokenData.permissions = response.data.permissions;
286
+ this.applyTokenReply(response.data);
159
287
 
160
288
  // Switch workspace if provided
161
289
  if (targetWorkspace) {
@@ -175,10 +303,11 @@ export class BaseAPI {
175
303
  async switchWorkspace(targetWorkspace: string): Promise<void> {
176
304
  const options: AxiosRequestConfig = {
177
305
  method: 'POST',
178
- url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
306
+ url: `${this.authBasePath()}/authservice/v1/workspaces/switch`,
179
307
  headers: {
180
308
  'Content-Type': 'application/json',
181
- 'Authorization': `Bearer ${this.configuration.accessToken}`,
309
+ ...this.sessionHeaders(),
310
+ ...(!this.usesSession() && !!this.configuration.accessToken && { 'Authorization': this.configuration.accessToken as string }),
182
311
  },
183
312
  data: {
184
313
  username: this.configuration.username,
@@ -189,11 +318,8 @@ export class BaseAPI {
189
318
 
190
319
  const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
191
320
 
192
- const { data: { accessToken, permissions } } = response;
193
-
194
- this.configuration.accessToken = `Bearer ${accessToken}`;
195
- this.tokenData.accessToken = accessToken;
196
- this.tokenData.permissions = permissions;
321
+ this.tokenData.permissions = response.data.permissions;
322
+ this.applyTokenReply(response.data);
197
323
 
198
324
  this.storeTokenData({
199
325
  ...this.tokenData
@@ -219,9 +345,10 @@ export class BaseAPI {
219
345
 
220
346
  const options: AxiosRequestConfig = {
221
347
  method: 'POST',
222
- url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
348
+ url: `${this.authBasePath()}/authservice/v1/refresh-token`,
223
349
  headers: {
224
350
  'Content-Type': 'application/json',
351
+ ...this.sessionHeaders(),
225
352
  },
226
353
  data: { username: username },
227
354
  withCredentials: true,
@@ -262,20 +389,22 @@ export class BaseAPI {
262
389
  && !originalConfig._retry) {
263
390
  originalConfig._retry = true;
264
391
  try {
265
- const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
266
- const accessToken = `Bearer ${tokenString}`;
267
- this.tokenData.permissions = permissions;
268
-
269
- delete originalConfig.headers['Authorization']
270
-
271
- originalConfig.headers['Authorization'] = accessToken;
272
-
273
- this.configuration.accessToken = accessToken;
274
- this.tokenData.accessToken = tokenString;
275
-
392
+ const reply = await this.refreshTokenInternal();
393
+ this.tokenData.permissions = reply.permissions;
394
+ this.applyTokenReply(reply);
276
395
  this.storeTokenData(this.tokenData);
277
396
 
278
- return axios(originalConfig);
397
+ if (!this.usesSession()) {
398
+ return axios(this.withCurrentAuth(originalConfig));
399
+ }
400
+
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
+ });
279
408
  } catch (_error) {
280
409
  if (_error.response && _error.response.data) {
281
410
  return Promise.reject(_error.response.data);
@@ -283,26 +412,30 @@ export class BaseAPI {
283
412
  return Promise.reject(_error);
284
413
  }
285
414
  }
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);
286
422
  } else if (err.message === NETWORK_ERROR_MESSAGE
287
- && originalConfig.headers.hasOwnProperty('Authorization')
423
+ && (originalConfig.headers.hasOwnProperty('Authorization')
424
+ || (this.configuration.cookieAuth && originalConfig.withCredentials && this.canResend(originalConfig)))
288
425
  && _retry_count < 4
289
426
  ) {
290
427
  _retry_count++;
291
428
  try {
292
- const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
293
- const accessToken = `Bearer ${tokenString}`;
294
- this.tokenData.permissions = permissions;
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;
295
432
 
296
433
  _retry = true;
297
- originalConfig.headers['Authorization'] = accessToken;
298
-
299
- this.configuration.accessToken = accessToken;
300
- this.tokenData.accessToken = tokenString;
301
-
434
+ this.applyTokenReply(reply);
302
435
  this.storeTokenData(this.tokenData);
303
436
 
304
437
  return axios.request({
305
- ...originalConfig,
438
+ ...this.withCurrentAuth(originalConfig),
306
439
  });
307
440
  } catch (_error) {
308
441
  if (_error.response && _error.response.data) {
package/configuration.ts CHANGED
@@ -21,6 +21,8 @@ export interface ConfigurationParameters {
21
21
  basePath?: string;
22
22
  baseOptions?: any;
23
23
  formDataCtor?: new () => any;
24
+ cookieAuth?: boolean;
25
+ account?: string;
24
26
  }
25
27
 
26
28
  export class Configuration {
@@ -74,6 +76,22 @@ export class Configuration {
74
76
  */
75
77
  formDataCtor?: new () => any;
76
78
 
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
+
77
95
  constructor(param: ConfigurationParameters = {}) {
78
96
  this.apiKey = param.apiKey;
79
97
  this.username = param.username;
@@ -82,6 +100,8 @@ export class Configuration {
82
100
  this.basePath = param.basePath;
83
101
  this.baseOptions = param.baseOptions;
84
102
  this.formDataCtor = param.formDataCtor;
103
+ this.cookieAuth = param.cookieAuth;
104
+ this.account = param.account;
85
105
  }
86
106
 
87
107
  /**
@@ -103,7 +103,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
103
103
  createAndEnableSubledger: function (createAndEnableSubledgerRequestDto, 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, headersFromBaseOptions;
106
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
107
107
  return __generator(this, function (_a) {
108
108
  switch (_a.label) {
109
109
  case 0:
@@ -120,13 +120,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
120
120
  localVarQueryParameter = {};
121
121
  // authentication bearer required
122
122
  // http bearer authentication required
123
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
123
+ 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
+ ];
124
126
  case 1:
125
127
  // authentication bearer required
126
128
  // http bearer authentication required
127
129
  _a.sent();
128
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
129
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
130
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
131
+ if (authorizationValue) {
132
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
130
133
  }
131
134
  localVarHeaderParameter['Content-Type'] = 'application/json';
132
135
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -152,7 +155,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
152
155
  createAndEnableSubledgerFromFile: function (file, authorization, options) {
153
156
  if (options === void 0) { options = {}; }
154
157
  return __awaiter(_this, void 0, void 0, function () {
155
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarFormParams, headersFromBaseOptions;
158
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarFormParams, authorizationValue, headersFromBaseOptions;
156
159
  return __generator(this, function (_a) {
157
160
  switch (_a.label) {
158
161
  case 0:
@@ -170,13 +173,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
170
173
  localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
171
174
  // authentication bearer required
172
175
  // http bearer authentication required
173
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
176
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
177
+ // Only Authorization falls back to the configured token; an empty value is never sent.
178
+ ];
174
179
  case 1:
175
180
  // authentication bearer required
176
181
  // http bearer authentication required
177
182
  _a.sent();
178
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
179
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
183
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
184
+ if (authorizationValue) {
185
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
180
186
  }
181
187
  if (file !== undefined) {
182
188
  localVarFormParams.append('file', file);
@@ -203,7 +209,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
203
209
  exportAccountingConfig: function (authorization, options) {
204
210
  if (options === void 0) { options = {}; }
205
211
  return __awaiter(_this, void 0, void 0, function () {
206
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
212
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
207
213
  return __generator(this, function (_a) {
208
214
  switch (_a.label) {
209
215
  case 0:
@@ -218,13 +224,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
218
224
  localVarQueryParameter = {};
219
225
  // authentication bearer required
220
226
  // http bearer authentication required
221
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
227
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
228
+ // Only Authorization falls back to the configured token; an empty value is never sent.
229
+ ];
222
230
  case 1:
223
231
  // authentication bearer required
224
232
  // http bearer authentication required
225
233
  _a.sent();
226
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
227
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
234
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
235
+ if (authorizationValue) {
236
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
228
237
  }
229
238
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
230
239
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -247,7 +256,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
247
256
  getAccountingCategories: function (authorization, options) {
248
257
  if (options === void 0) { options = {}; }
249
258
  return __awaiter(_this, void 0, void 0, function () {
250
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
259
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
251
260
  return __generator(this, function (_a) {
252
261
  switch (_a.label) {
253
262
  case 0:
@@ -262,13 +271,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
262
271
  localVarQueryParameter = {};
263
272
  // authentication bearer required
264
273
  // http bearer authentication required
265
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
274
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
275
+ // Only Authorization falls back to the configured token; an empty value is never sent.
276
+ ];
266
277
  case 1:
267
278
  // authentication bearer required
268
279
  // http bearer authentication required
269
280
  _a.sent();
270
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
271
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
281
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
282
+ if (authorizationValue) {
283
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
272
284
  }
273
285
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
274
286
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -291,7 +303,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
291
303
  getActivationSnapshot: function (authorization, options) {
292
304
  if (options === void 0) { options = {}; }
293
305
  return __awaiter(_this, void 0, void 0, function () {
294
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
306
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
295
307
  return __generator(this, function (_a) {
296
308
  switch (_a.label) {
297
309
  case 0:
@@ -306,13 +318,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
306
318
  localVarQueryParameter = {};
307
319
  // authentication bearer required
308
320
  // http bearer authentication required
309
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
321
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
322
+ // Only Authorization falls back to the configured token; an empty value is never sent.
323
+ ];
310
324
  case 1:
311
325
  // authentication bearer required
312
326
  // http bearer authentication required
313
327
  _a.sent();
314
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
315
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
328
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
329
+ if (authorizationValue) {
330
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
316
331
  }
317
332
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
318
333
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -335,7 +350,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
335
350
  resetSubledger: function (authorization, options) {
336
351
  if (options === void 0) { options = {}; }
337
352
  return __awaiter(_this, void 0, void 0, function () {
338
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
353
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
339
354
  return __generator(this, function (_a) {
340
355
  switch (_a.label) {
341
356
  case 0:
@@ -350,13 +365,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
350
365
  localVarQueryParameter = {};
351
366
  // authentication bearer required
352
367
  // http bearer authentication required
353
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
368
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
369
+ // Only Authorization falls back to the configured token; an empty value is never sent.
370
+ ];
354
371
  case 1:
355
372
  // authentication bearer required
356
373
  // http bearer authentication required
357
374
  _a.sent();
358
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
359
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
375
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
376
+ if (authorizationValue) {
377
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
360
378
  }
361
379
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
362
380
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -380,7 +398,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
380
398
  validateAccountingConfig: function (validateAccountingConfigRequestDto, authorization, options) {
381
399
  if (options === void 0) { options = {}; }
382
400
  return __awaiter(_this, void 0, void 0, function () {
383
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
401
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationValue, headersFromBaseOptions;
384
402
  return __generator(this, function (_a) {
385
403
  switch (_a.label) {
386
404
  case 0:
@@ -397,13 +415,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
397
415
  localVarQueryParameter = {};
398
416
  // authentication bearer required
399
417
  // http bearer authentication required
400
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
418
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
419
+ // Only Authorization falls back to the configured token; an empty value is never sent.
420
+ ];
401
421
  case 1:
402
422
  // authentication bearer required
403
423
  // http bearer authentication required
404
424
  _a.sent();
405
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
406
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
425
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
426
+ if (authorizationValue) {
427
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
407
428
  }
408
429
  localVarHeaderParameter['Content-Type'] = 'application/json';
409
430
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -429,7 +450,7 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
429
450
  validateAccountingConfigFromFile: function (file, authorization, options) {
430
451
  if (options === void 0) { options = {}; }
431
452
  return __awaiter(_this, void 0, void 0, function () {
432
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarFormParams, headersFromBaseOptions;
453
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarFormParams, authorizationValue, headersFromBaseOptions;
433
454
  return __generator(this, function (_a) {
434
455
  switch (_a.label) {
435
456
  case 0:
@@ -447,13 +468,16 @@ var AccountingConfigsApiAxiosParamCreator = function (configuration) {
447
468
  localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
448
469
  // authentication bearer required
449
470
  // http bearer authentication required
450
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
471
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
472
+ // Only Authorization falls back to the configured token; an empty value is never sent.
473
+ ];
451
474
  case 1:
452
475
  // authentication bearer required
453
476
  // http bearer authentication required
454
477
  _a.sent();
455
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
456
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
478
+ authorizationValue = 'Authorization'.toLowerCase() === 'authorization' ? (authorization || baseAccessToken) : authorization;
479
+ if (authorizationValue) {
480
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
457
481
  }
458
482
  if (file !== undefined) {
459
483
  localVarFormParams.append('file', file);