@emilgroup/discount-sdk-node 1.12.1-beta.16 → 1.12.1-beta.18

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.
@@ -107,9 +107,10 @@ var VouchersApiAxiosParamCreator = function (configuration) {
107
107
  createVoucher: function (createVoucherRequestDto, 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 'createVoucherRequestDto' is not null or undefined
115
116
  (0, common_1.assertParamExists)('createVoucher', 'createVoucherRequestDto', createVoucherRequestDto);
@@ -124,13 +125,19 @@ var VouchersApiAxiosParamCreator = 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 VouchersApiAxiosParamCreator = function (configuration) {
156
163
  deleteVoucher: 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)('deleteVoucher', 'code', code);
@@ -174,13 +182,19 @@ var VouchersApiAxiosParamCreator = 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 VouchersApiAxiosParamCreator = function (configuration) {
205
219
  getVoucher: 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)('getVoucher', 'code', code);
@@ -227,12 +242,15 @@ var VouchersApiAxiosParamCreator = 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 : {};
@@ -262,9 +280,10 @@ var VouchersApiAxiosParamCreator = function (configuration) {
262
280
  listVouchers: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
263
281
  if (options === void 0) { options = {}; }
264
282
  return __awaiter(_this, void 0, void 0, function () {
265
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
266
- return __generator(this, function (_a) {
267
- switch (_a.label) {
283
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
284
+ var _a;
285
+ return __generator(this, function (_b) {
286
+ switch (_b.label) {
268
287
  case 0:
269
288
  localVarPath = "/discountservice/v1/vouchers";
270
289
  localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
@@ -281,7 +300,7 @@ var VouchersApiAxiosParamCreator = function (configuration) {
281
300
  case 1:
282
301
  // authentication bearer required
283
302
  // http bearer authentication required
284
- _a.sent();
303
+ _b.sent();
285
304
  if (pageSize !== undefined) {
286
305
  localVarQueryParameter['pageSize'] = pageSize;
287
306
  }
@@ -303,8 +322,11 @@ var VouchersApiAxiosParamCreator = function (configuration) {
303
322
  if (filters !== undefined) {
304
323
  localVarQueryParameter['filters'] = filters;
305
324
  }
306
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
307
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
325
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
326
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
327
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
328
+ if (authorizationValue || authorizationKeepEmpty) {
329
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
308
330
  }
309
331
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
310
332
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -329,9 +351,10 @@ var VouchersApiAxiosParamCreator = function (configuration) {
329
351
  updateVoucher: function (code, updateVoucherRequestDto, authorization, options) {
330
352
  if (options === void 0) { options = {}; }
331
353
  return __awaiter(_this, void 0, void 0, function () {
332
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
333
- return __generator(this, function (_a) {
334
- switch (_a.label) {
354
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
355
+ var _a;
356
+ return __generator(this, function (_b) {
357
+ switch (_b.label) {
335
358
  case 0:
336
359
  // verify required parameter 'code' is not null or undefined
337
360
  (0, common_1.assertParamExists)('updateVoucher', 'code', code);
@@ -349,13 +372,19 @@ var VouchersApiAxiosParamCreator = function (configuration) {
349
372
  localVarQueryParameter = {};
350
373
  // authentication bearer required
351
374
  // http bearer authentication required
352
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
375
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)
376
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
377
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
378
+ ];
353
379
  case 1:
354
380
  // authentication bearer required
355
381
  // http bearer authentication required
356
- _a.sent();
357
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
358
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
382
+ _b.sent();
383
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
384
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
385
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
386
+ if (authorizationValue || authorizationKeepEmpty) {
387
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
359
388
  }
360
389
  localVarHeaderParameter['Content-Type'] = 'application/json';
361
390
  (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
@@ -590,7 +619,7 @@ var VouchersApi = /** @class */ (function (_super) {
590
619
  */
591
620
  VouchersApi.prototype.createVoucher = function (requestParameters, options) {
592
621
  var _this = this;
593
- return (0, exports.VouchersApiFp)(this.configuration).createVoucher(requestParameters.createVoucherRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
622
+ return (0, exports.VouchersApiFp)(this.configuration).createVoucher(requestParameters.createVoucherRequestDto, requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
594
623
  };
595
624
  /**
596
625
  * This will delete a voucher.
@@ -602,7 +631,7 @@ var VouchersApi = /** @class */ (function (_super) {
602
631
  */
603
632
  VouchersApi.prototype.deleteVoucher = function (requestParameters, options) {
604
633
  var _this = this;
605
- return (0, exports.VouchersApiFp)(this.configuration).deleteVoucher(requestParameters.code, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
634
+ return (0, exports.VouchersApiFp)(this.configuration).deleteVoucher(requestParameters.code, requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
606
635
  };
607
636
  /**
608
637
  * This will get a voucher.
@@ -614,7 +643,7 @@ var VouchersApi = /** @class */ (function (_super) {
614
643
  */
615
644
  VouchersApi.prototype.getVoucher = function (requestParameters, options) {
616
645
  var _this = this;
617
- return (0, exports.VouchersApiFp)(this.configuration).getVoucher(requestParameters.code, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
646
+ return (0, exports.VouchersApiFp)(this.configuration).getVoucher(requestParameters.code, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
618
647
  };
619
648
  /**
620
649
  * Returns a list of Vouchers you have previously created. The Vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
@@ -627,7 +656,7 @@ var VouchersApi = /** @class */ (function (_super) {
627
656
  VouchersApi.prototype.listVouchers = function (requestParameters, options) {
628
657
  var _this = this;
629
658
  if (requestParameters === void 0) { requestParameters = {}; }
630
- return (0, exports.VouchersApiFp)(this.configuration).listVouchers(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); });
659
+ return (0, exports.VouchersApiFp)(this.configuration).listVouchers(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); });
631
660
  };
632
661
  /**
633
662
  * This will update a voucher.
@@ -639,7 +668,7 @@ var VouchersApi = /** @class */ (function (_super) {
639
668
  */
640
669
  VouchersApi.prototype.updateVoucher = function (requestParameters, options) {
641
670
  var _this = this;
642
- return (0, exports.VouchersApiFp)(this.configuration).updateVoucher(requestParameters.code, requestParameters.updateVoucherRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
671
+ return (0, exports.VouchersApiFp)(this.configuration).updateVoucher(requestParameters.code, requestParameters.updateVoucherRequestDto, requestParameters.authorization, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
643
672
  };
644
673
  return VouchersApi;
645
674
  }(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 DiscountService
69
69
  * The EMIL DiscountService 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/discount-sdk-node",
3
- "version": "1.12.1-beta.16",
3
+ "version": "1.12.1-beta.18",
4
4
  "description": "OpenAPI client for @emilgroup/discount-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
  },