@emilgroup/account-sdk-node 1.45.1-beta.20 → 1.45.1-beta.21

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 CHANGED
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/account-sdk-node@1.45.1-beta.20 --save
20
+ npm install @emilgroup/account-sdk-node@1.45.1-beta.21 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/account-sdk-node@1.45.1-beta.20
24
+ yarn add @emilgroup/account-sdk-node@1.45.1-beta.21
25
25
  ```
26
26
 
27
27
  And then you can import `AccountsApi`.
@@ -71,8 +71,13 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
71
71
  // http bearer authentication required
72
72
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
73
73
 
74
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
75
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
74
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
75
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
76
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
77
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
78
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
79
+ if (authorizationValue || authorizationKeepEmpty) {
80
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
76
81
  }
77
82
 
78
83
 
@@ -119,8 +124,13 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
119
124
  // http bearer authentication required
120
125
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
121
126
 
122
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
123
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
127
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
128
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
129
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
130
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
131
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
132
+ if (authorizationValue || authorizationKeepEmpty) {
133
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
124
134
  }
125
135
 
126
136
 
@@ -169,8 +179,13 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
169
179
  localVarQueryParameter['expand'] = expand;
170
180
  }
171
181
 
172
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
173
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
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.
184
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
185
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
186
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
187
+ if (authorizationValue || authorizationKeepEmpty) {
188
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
174
189
  }
175
190
 
176
191
 
@@ -219,8 +234,13 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
219
234
  localVarQueryParameter['expand'] = expand;
220
235
  }
221
236
 
222
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
223
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
237
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
238
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
239
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
240
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
241
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
242
+ if (authorizationValue || authorizationKeepEmpty) {
243
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
224
244
  }
225
245
 
226
246
 
@@ -295,8 +315,13 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
295
315
  localVarQueryParameter['filters'] = filters;
296
316
  }
297
317
 
298
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
299
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
318
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
319
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
320
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
321
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
322
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
323
+ if (authorizationValue || authorizationKeepEmpty) {
324
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
300
325
  }
301
326
 
302
327
 
@@ -343,8 +368,13 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
343
368
  // http bearer authentication required
344
369
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
345
370
 
346
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
347
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
371
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
372
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
373
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
374
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
375
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
376
+ if (authorizationValue || authorizationKeepEmpty) {
377
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
348
378
  }
349
379
 
350
380
 
@@ -745,7 +775,7 @@ export class AccountsApi extends BaseAPI {
745
775
  * @memberof AccountsApi
746
776
  */
747
777
  public createAccount(requestParameters: AccountsApiCreateAccountRequest, options?: AxiosRequestConfig) {
748
- return AccountsApiFp(this.configuration).createAccount(requestParameters.createAccountRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
778
+ return AccountsApiFp(this.configuration).createAccount(requestParameters.createAccountRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
749
779
  }
750
780
 
751
781
  /**
@@ -757,7 +787,7 @@ export class AccountsApi extends BaseAPI {
757
787
  * @memberof AccountsApi
758
788
  */
759
789
  public deleteAccount(requestParameters: AccountsApiDeleteAccountRequest, options?: AxiosRequestConfig) {
760
- return AccountsApiFp(this.configuration).deleteAccount(requestParameters.code, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
790
+ return AccountsApiFp(this.configuration).deleteAccount(requestParameters.code, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
761
791
  }
762
792
 
763
793
  /**
@@ -769,7 +799,7 @@ export class AccountsApi extends BaseAPI {
769
799
  * @memberof AccountsApi
770
800
  */
771
801
  public getAccount(requestParameters: AccountsApiGetAccountRequest, options?: AxiosRequestConfig) {
772
- return AccountsApiFp(this.configuration).getAccount(requestParameters.code, requestParameters.authorization, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
802
+ return AccountsApiFp(this.configuration).getAccount(requestParameters.code, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
773
803
  }
774
804
 
775
805
  /**
@@ -781,7 +811,7 @@ export class AccountsApi extends BaseAPI {
781
811
  * @memberof AccountsApi
782
812
  */
783
813
  public getAccountByEmail(requestParameters: AccountsApiGetAccountByEmailRequest, options?: AxiosRequestConfig) {
784
- return AccountsApiFp(this.configuration).getAccountByEmail(requestParameters.email, requestParameters.authorization, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
814
+ return AccountsApiFp(this.configuration).getAccountByEmail(requestParameters.email, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
785
815
  }
786
816
 
787
817
  /**
@@ -793,7 +823,7 @@ export class AccountsApi extends BaseAPI {
793
823
  * @memberof AccountsApi
794
824
  */
795
825
  public listAccounts(requestParameters: AccountsApiListAccountsRequest = {}, options?: AxiosRequestConfig) {
796
- return AccountsApiFp(this.configuration).listAccounts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then((request) => request(this.axios, this.basePath));
826
+ return AccountsApiFp(this.configuration).listAccounts(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));
797
827
  }
798
828
 
799
829
  /**
@@ -805,6 +835,6 @@ export class AccountsApi extends BaseAPI {
805
835
  * @memberof AccountsApi
806
836
  */
807
837
  public updateAccount(requestParameters: AccountsApiUpdateAccountRequest, options?: AxiosRequestConfig) {
808
- return AccountsApiFp(this.configuration).updateAccount(requestParameters.code, requestParameters.updateAccountRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
838
+ return AccountsApiFp(this.configuration).updateAccount(requestParameters.code, requestParameters.updateAccountRequestDto, requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
809
839
  }
810
840
  }
package/api/health-api.ts CHANGED
@@ -123,6 +123,6 @@ export class HealthApi extends BaseAPI {
123
123
  * @memberof HealthApi
124
124
  */
125
125
  public check(options?: AxiosRequestConfig) {
126
- return HealthApiFp(this.configuration).check(options).then((request) => request(this.axios, this.basePath));
126
+ return HealthApiFp(this.configuration).check(this.withOwner(options)).then((request) => request(this.axios, this.basePath));
127
127
  }
128
128
  }
package/base.ts CHANGED
@@ -92,6 +92,10 @@ export class BaseAPI {
92
92
  private username?: string;
93
93
  private password?: string;
94
94
 
95
+ protected withOwner(options?: AxiosRequestConfig): AxiosRequestConfig {
96
+ return { ...options };
97
+ }
98
+
95
99
  constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
96
100
  if (configuration) {
97
101
  this.configuration = configuration;
package/common.ts CHANGED
@@ -131,9 +131,10 @@ export const toPathString = function (url: URL) {
131
131
  * @export
132
132
  */
133
133
  export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
134
- return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
134
+ // Typed by hand: since axios 1.20, request() returns an internal axios type that SDK declarations cannot name.
135
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH): Promise<R> => {
135
136
  const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
136
- return axios.request<T, R>(axiosRequestArgs);
137
+ return axios.request<T, R>(axiosRequestArgs) as Promise<R>;
137
138
  };
138
139
  }
139
140
 
@@ -408,7 +408,7 @@ export declare class AccountsApi extends BaseAPI {
408
408
  * @throws {RequiredError}
409
409
  * @memberof AccountsApi
410
410
  */
411
- createAccount(requestParameters: AccountsApiCreateAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateAccountResponseClass, any, {}>>;
411
+ createAccount(requestParameters: AccountsApiCreateAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateAccountResponseClass, any, {}, any>>;
412
412
  /**
413
413
  * Permanently deletes the account. Supply the unique code that was returned when you created the account and this will delete it. **Required Permissions** \"partner-management.partners.delete\"
414
414
  * @summary Delete the account
@@ -417,7 +417,7 @@ export declare class AccountsApi extends BaseAPI {
417
417
  * @throws {RequiredError}
418
418
  * @memberof AccountsApi
419
419
  */
420
- deleteAccount(requestParameters: AccountsApiDeleteAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
420
+ deleteAccount(requestParameters: AccountsApiDeleteAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}, any>>;
421
421
  /**
422
422
  * Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information. **Required Permissions** \"partner-management.partners.view\"
423
423
  * @summary Retrieve the account
@@ -426,7 +426,7 @@ export declare class AccountsApi extends BaseAPI {
426
426
  * @throws {RequiredError}
427
427
  * @memberof AccountsApi
428
428
  */
429
- getAccount(requestParameters: AccountsApiGetAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetAccountResponseClass, any, {}>>;
429
+ getAccount(requestParameters: AccountsApiGetAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetAccountResponseClass, any, {}, any>>;
430
430
  /**
431
431
  * Retrieves the details of the account that was previously created. Supply the email that was returned when you created it and Emil Api will return the corresponding account information. Email matching is case-insensitive. **Required Permissions** \"partner-management.partners.view\"
432
432
  * @summary Retrieve the account
@@ -435,7 +435,7 @@ export declare class AccountsApi extends BaseAPI {
435
435
  * @throws {RequiredError}
436
436
  * @memberof AccountsApi
437
437
  */
438
- getAccountByEmail(requestParameters: AccountsApiGetAccountByEmailRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetAccountResponseClass, any, {}>>;
438
+ getAccountByEmail(requestParameters: AccountsApiGetAccountByEmailRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetAccountResponseClass, any, {}, any>>;
439
439
  /**
440
440
  * Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"partner-management.partners.view\"
441
441
  * @summary List accounts
@@ -444,7 +444,7 @@ export declare class AccountsApi extends BaseAPI {
444
444
  * @throws {RequiredError}
445
445
  * @memberof AccountsApi
446
446
  */
447
- listAccounts(requestParameters?: AccountsApiListAccountsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListAccountsResponseClass, any, {}>>;
447
+ listAccounts(requestParameters?: AccountsApiListAccountsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListAccountsResponseClass, any, {}, any>>;
448
448
  /**
449
449
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
450
450
  * @summary Update the account
@@ -453,5 +453,5 @@ export declare class AccountsApi extends BaseAPI {
453
453
  * @throws {RequiredError}
454
454
  * @memberof AccountsApi
455
455
  */
456
- updateAccount(requestParameters: AccountsApiUpdateAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<UpdateAccountResponseClass, any, {}>>;
456
+ updateAccount(requestParameters: AccountsApiUpdateAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<UpdateAccountResponseClass, any, {}, any>>;
457
457
  }
@@ -107,9 +107,10 @@ var AccountsApiAxiosParamCreator = function (configuration) {
107
107
  createAccount: function (createAccountRequestDto, authorization, options) {
108
108
  if (options === void 0) { options = {}; }
109
109
  return __awaiter(_this, void 0, void 0, function () {
110
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
111
- return __generator(this, function (_a) {
112
- switch (_a.label) {
110
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
111
+ var _a;
112
+ return __generator(this, function (_b) {
113
+ switch (_b.label) {
113
114
  case 0:
114
115
  // verify required parameter 'createAccountRequestDto' is not null or undefined
115
116
  (0, common_1.assertParamExists)('createAccount', 'createAccountRequestDto', createAccountRequestDto);
@@ -124,13 +125,19 @@ var AccountsApiAxiosParamCreator = function (configuration) {
124
125
  localVarQueryParameter = {};
125
126
  // authentication bearer required
126
127
  // http bearer authentication required
127
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
128
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
129
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
130
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
131
+ ];
128
132
  case 1:
129
133
  // authentication bearer required
130
134
  // http bearer authentication required
131
- _a.sent();
132
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
133
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
135
+ _b.sent();
136
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
137
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
138
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
139
+ if (authorizationValue || authorizationKeepEmpty) {
140
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
134
141
  }
135
142
  localVarHeaderParameter['Content-Type'] = 'application/json';
136
143
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -156,9 +163,10 @@ var AccountsApiAxiosParamCreator = function (configuration) {
156
163
  deleteAccount: function (code, authorization, options) {
157
164
  if (options === void 0) { options = {}; }
158
165
  return __awaiter(_this, void 0, void 0, function () {
159
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
160
- return __generator(this, function (_a) {
161
- switch (_a.label) {
166
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
167
+ var _a;
168
+ return __generator(this, function (_b) {
169
+ switch (_b.label) {
162
170
  case 0:
163
171
  // verify required parameter 'code' is not null or undefined
164
172
  (0, common_1.assertParamExists)('deleteAccount', 'code', code);
@@ -174,13 +182,19 @@ var AccountsApiAxiosParamCreator = function (configuration) {
174
182
  localVarQueryParameter = {};
175
183
  // authentication bearer required
176
184
  // http bearer authentication required
177
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
185
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
186
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
187
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
188
+ ];
178
189
  case 1:
179
190
  // authentication bearer required
180
191
  // http bearer authentication required
181
- _a.sent();
182
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
183
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
192
+ _b.sent();
193
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
194
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
195
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
196
+ if (authorizationValue || authorizationKeepEmpty) {
197
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
184
198
  }
185
199
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
186
200
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -205,9 +219,10 @@ var AccountsApiAxiosParamCreator = function (configuration) {
205
219
  getAccount: function (code, authorization, expand, options) {
206
220
  if (options === void 0) { options = {}; }
207
221
  return __awaiter(_this, void 0, void 0, function () {
208
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
209
- return __generator(this, function (_a) {
210
- switch (_a.label) {
222
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
223
+ var _a;
224
+ return __generator(this, function (_b) {
225
+ switch (_b.label) {
211
226
  case 0:
212
227
  // verify required parameter 'code' is not null or undefined
213
228
  (0, common_1.assertParamExists)('getAccount', 'code', code);
@@ -227,12 +242,15 @@ var AccountsApiAxiosParamCreator = function (configuration) {
227
242
  case 1:
228
243
  // authentication bearer required
229
244
  // http bearer authentication required
230
- _a.sent();
245
+ _b.sent();
231
246
  if (expand !== undefined) {
232
247
  localVarQueryParameter['expand'] = expand;
233
248
  }
234
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
235
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
249
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
250
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
251
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
252
+ if (authorizationValue || authorizationKeepEmpty) {
253
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
236
254
  }
237
255
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
238
256
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -257,9 +275,10 @@ var AccountsApiAxiosParamCreator = function (configuration) {
257
275
  getAccountByEmail: function (email, authorization, expand, options) {
258
276
  if (options === void 0) { options = {}; }
259
277
  return __awaiter(_this, void 0, void 0, function () {
260
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
261
- return __generator(this, function (_a) {
262
- switch (_a.label) {
278
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
279
+ var _a;
280
+ return __generator(this, function (_b) {
281
+ switch (_b.label) {
263
282
  case 0:
264
283
  // verify required parameter 'email' is not null or undefined
265
284
  (0, common_1.assertParamExists)('getAccountByEmail', 'email', email);
@@ -279,12 +298,15 @@ var AccountsApiAxiosParamCreator = function (configuration) {
279
298
  case 1:
280
299
  // authentication bearer required
281
300
  // http bearer authentication required
282
- _a.sent();
301
+ _b.sent();
283
302
  if (expand !== undefined) {
284
303
  localVarQueryParameter['expand'] = expand;
285
304
  }
286
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
287
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
305
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
306
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
307
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
308
+ if (authorizationValue || authorizationKeepEmpty) {
309
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
288
310
  }
289
311
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
290
312
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -314,9 +336,10 @@ var AccountsApiAxiosParamCreator = function (configuration) {
314
336
  listAccounts: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
315
337
  if (options === void 0) { options = {}; }
316
338
  return __awaiter(_this, void 0, void 0, function () {
317
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
318
- return __generator(this, function (_a) {
319
- switch (_a.label) {
339
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
340
+ var _a;
341
+ return __generator(this, function (_b) {
342
+ switch (_b.label) {
320
343
  case 0:
321
344
  localVarPath = "/accountservice/v1/accounts";
322
345
  localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
@@ -333,7 +356,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
333
356
  case 1:
334
357
  // authentication bearer required
335
358
  // http bearer authentication required
336
- _a.sent();
359
+ _b.sent();
337
360
  if (pageSize !== undefined) {
338
361
  localVarQueryParameter['pageSize'] = pageSize;
339
362
  }
@@ -355,8 +378,11 @@ var AccountsApiAxiosParamCreator = function (configuration) {
355
378
  if (filters !== undefined) {
356
379
  localVarQueryParameter['filters'] = filters;
357
380
  }
358
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
359
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
381
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
382
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
383
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
384
+ if (authorizationValue || authorizationKeepEmpty) {
385
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
360
386
  }
361
387
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
362
388
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -381,9 +407,10 @@ var AccountsApiAxiosParamCreator = function (configuration) {
381
407
  updateAccount: function (code, updateAccountRequestDto, authorization, options) {
382
408
  if (options === void 0) { options = {}; }
383
409
  return __awaiter(_this, void 0, void 0, function () {
384
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
385
- return __generator(this, function (_a) {
386
- switch (_a.label) {
410
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
411
+ var _a;
412
+ return __generator(this, function (_b) {
413
+ switch (_b.label) {
387
414
  case 0:
388
415
  // verify required parameter 'code' is not null or undefined
389
416
  (0, common_1.assertParamExists)('updateAccount', 'code', code);
@@ -401,13 +428,19 @@ var AccountsApiAxiosParamCreator = function (configuration) {
401
428
  localVarQueryParameter = {};
402
429
  // authentication bearer required
403
430
  // http bearer authentication required
404
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
431
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
432
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
433
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
434
+ ];
405
435
  case 1:
406
436
  // authentication bearer required
407
437
  // http bearer authentication required
408
- _a.sent();
409
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
410
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
438
+ _b.sent();
439
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
440
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
441
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
442
+ if (authorizationValue || authorizationKeepEmpty) {
443
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
411
444
  }
412
445
  localVarHeaderParameter['Content-Type'] = 'application/json';
413
446
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -676,7 +709,7 @@ var AccountsApi = /** @class */ (function (_super) {
676
709
  */
677
710
  AccountsApi.prototype.createAccount = function (requestParameters, options) {
678
711
  var _this = this;
679
- return (0, exports.AccountsApiFp)(this.configuration).createAccount(requestParameters.createAccountRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
712
+ return (0, exports.AccountsApiFp)(this.configuration).createAccount(requestParameters.createAccountRequestDto, requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
680
713
  };
681
714
  /**
682
715
  * Permanently deletes the account. Supply the unique code that was returned when you created the account and this will delete it. **Required Permissions** \"partner-management.partners.delete\"
@@ -688,7 +721,7 @@ var AccountsApi = /** @class */ (function (_super) {
688
721
  */
689
722
  AccountsApi.prototype.deleteAccount = function (requestParameters, options) {
690
723
  var _this = this;
691
- return (0, exports.AccountsApiFp)(this.configuration).deleteAccount(requestParameters.code, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
724
+ return (0, exports.AccountsApiFp)(this.configuration).deleteAccount(requestParameters.code, requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
692
725
  };
693
726
  /**
694
727
  * Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information. **Required Permissions** \"partner-management.partners.view\"
@@ -700,7 +733,7 @@ var AccountsApi = /** @class */ (function (_super) {
700
733
  */
701
734
  AccountsApi.prototype.getAccount = function (requestParameters, options) {
702
735
  var _this = this;
703
- return (0, exports.AccountsApiFp)(this.configuration).getAccount(requestParameters.code, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
736
+ return (0, exports.AccountsApiFp)(this.configuration).getAccount(requestParameters.code, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
704
737
  };
705
738
  /**
706
739
  * Retrieves the details of the account that was previously created. Supply the email that was returned when you created it and Emil Api will return the corresponding account information. Email matching is case-insensitive. **Required Permissions** \"partner-management.partners.view\"
@@ -712,7 +745,7 @@ var AccountsApi = /** @class */ (function (_super) {
712
745
  */
713
746
  AccountsApi.prototype.getAccountByEmail = function (requestParameters, options) {
714
747
  var _this = this;
715
- return (0, exports.AccountsApiFp)(this.configuration).getAccountByEmail(requestParameters.email, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
748
+ return (0, exports.AccountsApiFp)(this.configuration).getAccountByEmail(requestParameters.email, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
716
749
  };
717
750
  /**
718
751
  * Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"partner-management.partners.view\"
@@ -725,7 +758,7 @@ var AccountsApi = /** @class */ (function (_super) {
725
758
  AccountsApi.prototype.listAccounts = function (requestParameters, options) {
726
759
  var _this = this;
727
760
  if (requestParameters === void 0) { requestParameters = {}; }
728
- return (0, exports.AccountsApiFp)(this.configuration).listAccounts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then(function (request) { return request(_this.axios, _this.basePath); });
761
+ return (0, exports.AccountsApiFp)(this.configuration).listAccounts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
729
762
  };
730
763
  /**
731
764
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
@@ -737,7 +770,7 @@ var AccountsApi = /** @class */ (function (_super) {
737
770
  */
738
771
  AccountsApi.prototype.updateAccount = function (requestParameters, options) {
739
772
  var _this = this;
740
- return (0, exports.AccountsApiFp)(this.configuration).updateAccount(requestParameters.code, requestParameters.updateAccountRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
773
+ return (0, exports.AccountsApiFp)(this.configuration).updateAccount(requestParameters.code, requestParameters.updateAccountRequestDto, requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
741
774
  };
742
775
  return AccountsApi;
743
776
  }(base_1.BaseAPI));
@@ -66,5 +66,5 @@ export declare class HealthApi extends BaseAPI {
66
66
  * @throws {RequiredError}
67
67
  * @memberof HealthApi
68
68
  */
69
- check(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<InlineResponse200, any, {}>>;
69
+ check(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<InlineResponse200, any, {}, any>>;
70
70
  }
@@ -197,7 +197,7 @@ var HealthApi = /** @class */ (function (_super) {
197
197
  */
198
198
  HealthApi.prototype.check = function (options) {
199
199
  var _this = this;
200
- return (0, exports.HealthApiFp)(this.configuration).check(options).then(function (request) { return request(_this.axios, _this.basePath); });
200
+ return (0, exports.HealthApiFp)(this.configuration).check(this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
201
201
  };
202
202
  return HealthApi;
203
203
  }(base_1.BaseAPI));
package/dist/base.d.ts CHANGED
@@ -63,6 +63,7 @@ export declare class BaseAPI {
63
63
  protected configuration: Configuration;
64
64
  private username?;
65
65
  private password?;
66
+ protected withOwner(options?: AxiosRequestConfig): AxiosRequestConfig;
66
67
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
67
68
  initialize(env?: Environment, targetWorkspace?: string): Promise<void>;
68
69
  private loadCredentials;
package/dist/base.js CHANGED
@@ -163,6 +163,9 @@ var BaseAPI = /** @class */ (function () {
163
163
  }
164
164
  this.attachInterceptor(axios);
165
165
  }
166
+ BaseAPI.prototype.withOwner = function (options) {
167
+ return __assign({}, options);
168
+ };
166
169
  BaseAPI.prototype.initialize = function (env, targetWorkspace) {
167
170
  if (env === void 0) { env = Environment.Production; }
168
171
  return __awaiter(this, void 0, void 0, function () {
package/dist/common.d.ts CHANGED
@@ -63,7 +63,7 @@ export declare const toPathString: (url: URL) => string;
63
63
  *
64
64
  * @export
65
65
  */
66
- export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
66
+ export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
67
67
  /**
68
68
  * EMIL AccountService
69
69
  * The EMIL AccountService API description
package/dist/common.js CHANGED
@@ -234,6 +234,7 @@ exports.toPathString = toPathString;
234
234
  * @export
235
235
  */
236
236
  var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
237
+ // Typed by hand: since axios 1.20, request() returns an internal axios type that SDK declarations cannot name.
237
238
  return function (axios, basePath) {
238
239
  if (axios === void 0) { axios = globalAxios; }
239
240
  if (basePath === void 0) { basePath = BASE_PATH; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/account-sdk-node",
3
- "version": "1.45.1-beta.20",
3
+ "version": "1.45.1-beta.21",
4
4
  "description": "OpenAPI client for @emilgroup/account-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  "prepare": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "axios": "1.18.0",
21
+ "axios": "1.20.0",
22
22
  "form-data": "^4.0.0",
23
23
  "url": "^0.11.0"
24
24
  },