http-request-manager 15.0.16 → 15.0.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.
@@ -999,10 +999,7 @@ class HTTPManagerService extends RequestService {
999
999
  getRequest(options, params) {
1000
1000
  this.isPending.next(true);
1001
1001
  this.data.next(null);
1002
- if (options?.path)
1003
- options.path = (params) ? [...options.path, ...params] : options.path;
1004
- options = (options) ? options : ApiRequest.adapt();
1005
- const updatedOptions = this.objectMergerService.mergeOptions(options);
1002
+ const updatedOptions = this.defineReqOptions(options, params);
1006
1003
  const func = this.getRecordRequest;
1007
1004
  const requests = this.createRequest(func, updatedOptions);
1008
1005
  return this.createObservable(updatedOptions, requests, func.name)
@@ -1016,10 +1013,7 @@ class HTTPManagerService extends RequestService {
1016
1013
  postRequest(data, options, params) {
1017
1014
  this.isPending.next(true);
1018
1015
  this.data.next(null);
1019
- if (options?.path)
1020
- options.path = (params) ? [...options.path, ...params] : options.path;
1021
- options = (options) ? options : ApiRequest.adapt();
1022
- const updatedOptions = this.objectMergerService.mergeOptions(options);
1016
+ const updatedOptions = this.defineReqOptions(options, params);
1023
1017
  const func = this.createRecordRequest;
1024
1018
  const requests = this.createRequest(func, updatedOptions, data);
1025
1019
  return this.createObservable(updatedOptions, requests, func.name).pipe(tap(data => this.data.next(data)))
@@ -1033,10 +1027,7 @@ class HTTPManagerService extends RequestService {
1033
1027
  putRequest(data, options, params) {
1034
1028
  this.isPending.next(true);
1035
1029
  this.data.next(null);
1036
- if (options?.path)
1037
- options.path = (params) ? [...options.path, ...params] : options.path;
1038
- options = (options) ? options : ApiRequest.adapt();
1039
- const updatedOptions = this.objectMergerService.mergeOptions(options);
1030
+ const updatedOptions = this.defineReqOptions(options, params);
1040
1031
  const func = this.updateRecordRequest;
1041
1032
  const requests = this.createRequest(func, updatedOptions, data);
1042
1033
  return this.createObservable(updatedOptions, requests, func.name).pipe(tap(data => this.data.next(data)))
@@ -1050,10 +1041,7 @@ class HTTPManagerService extends RequestService {
1050
1041
  deleteRequest(options, params) {
1051
1042
  this.isPending.next(true);
1052
1043
  this.data.next(null);
1053
- if (options?.path)
1054
- options.path = (params) ? [...options.path, ...params] : options.path;
1055
- options = (options) ? options : ApiRequest.adapt();
1056
- const updatedOptions = this.objectMergerService.mergeOptions(options);
1044
+ const updatedOptions = this.defineReqOptions(options, params);
1057
1045
  const func = this.deleteRecordRequest;
1058
1046
  const requests = this.createRequest(func, updatedOptions);
1059
1047
  return this.createObservable(updatedOptions, requests, func.name).pipe(tap(data => this.data.next(data)))
@@ -1066,10 +1054,7 @@ class HTTPManagerService extends RequestService {
1066
1054
  }
1067
1055
  downloadRequest(options, params, saveAs) {
1068
1056
  this.isPending.next(true);
1069
- if (options?.path)
1070
- options.path = (params) ? [...options.path, ...params] : options.path;
1071
- options = (options) ? options : ApiRequest.adapt({ saveAs });
1072
- const updatedOptions = this.objectMergerService.mergeOptions(options);
1057
+ const updatedOptions = this.defineReqOptions(options, params);
1073
1058
  const func = this.downloadFileRequest;
1074
1059
  const requests = this.createRequest(func, updatedOptions);
1075
1060
  return this.createObservable(updatedOptions, requests, func.name)
@@ -1165,6 +1150,14 @@ class HTTPManagerService extends RequestService {
1165
1150
  this.isPending.next(false);
1166
1151
  this.polling$.next();
1167
1152
  }
1153
+ defineReqOptions(options, params) {
1154
+ const req = ApiRequest.adapt(options);
1155
+ if (req?.path)
1156
+ req.path = (params) ? [...req.path, ...params] : req.path;
1157
+ const optionsReq = (req) ? req : ApiRequest.adapt();
1158
+ const updatedOptions = this.objectMergerService.mergeOptions(optionsReq);
1159
+ return updatedOptions;
1160
+ }
1168
1161
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HTTPManagerService, deps: [{ token: CONFIG_SETTINGS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1169
1162
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HTTPManagerService, providedIn: 'root' }); }
1170
1163
  }