ng2-rest 19.0.37 → 19.0.39

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 (44) hide show
  1. package/browser/fesm2022/ng2-rest.mjs +195 -126
  2. package/browser/fesm2022/ng2-rest.mjs.map +1 -1
  3. package/browser/lib/axios-interceptors.d.ts +23 -0
  4. package/browser/lib/index.d.ts +1 -0
  5. package/browser/lib/models.d.ts +14 -11
  6. package/browser/lib/other/simple-resource.d.ts +4 -4
  7. package/browser/lib/rest-request.d.ts +17 -9
  8. package/browser/lib/rest.class.d.ts +15 -15
  9. package/browser/package.json +1 -1
  10. package/lib/axios-interceptors.d.ts +22 -0
  11. package/lib/axios-interceptors.js +22 -0
  12. package/lib/axios-interceptors.js.map +1 -0
  13. package/lib/build-info._auto-generated_.d.ts +1 -1
  14. package/lib/build-info._auto-generated_.js +1 -1
  15. package/lib/index.d.ts +1 -0
  16. package/lib/index.js +1 -0
  17. package/lib/index.js.map +1 -1
  18. package/lib/mapping.js +84 -75
  19. package/lib/mapping.js.map +1 -1
  20. package/lib/models.d.ts +15 -12
  21. package/lib/models.js +13 -14
  22. package/lib/models.js.map +1 -1
  23. package/lib/other/simple-resource.d.ts +4 -4
  24. package/lib/other/simple-resource.js +48 -35
  25. package/lib/other/simple-resource.js.map +1 -1
  26. package/lib/request-cache.js +9 -23
  27. package/lib/request-cache.js.map +1 -1
  28. package/lib/rest-request.d.ts +17 -9
  29. package/lib/rest-request.js +55 -27
  30. package/lib/rest-request.js.map +1 -1
  31. package/lib/rest.class.d.ts +15 -15
  32. package/lib/rest.class.js +47 -38
  33. package/lib/rest.class.js.map +1 -1
  34. package/package.json +1 -1
  35. package/tmp-environment.json +4 -6
  36. package/websql/fesm2022/ng2-rest.mjs +195 -126
  37. package/websql/fesm2022/ng2-rest.mjs.map +1 -1
  38. package/websql/lib/axios-interceptors.d.ts +23 -0
  39. package/websql/lib/index.d.ts +1 -0
  40. package/websql/lib/models.d.ts +14 -11
  41. package/websql/lib/other/simple-resource.d.ts +4 -4
  42. package/websql/lib/rest-request.d.ts +17 -9
  43. package/websql/lib/rest.class.d.ts +15 -15
  44. package/websql/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { Subject, Observable, firstValueFrom } from 'rxjs';
2
- import { _, Helpers as Helpers$1, CoreHelpers, UtilsOs } from 'tnp-core/browser';
1
+ import { from, firstValueFrom, Subject, Observable } from 'rxjs';
2
+ import { _, UtilsOs, CoreHelpers, Helpers as Helpers$1 } from 'tnp-core/browser';
3
3
  import { diffChars } from 'diff';
4
4
  import { Log, Level } from 'ng2-logger/browser';
5
5
  import { walk } from 'lodash-walk-object/browser';
@@ -34,6 +34,7 @@ class Cookie {
34
34
  }
35
35
  }
36
36
 
37
+ /* */
37
38
  var Mapping;
38
39
  (function (Mapping) {
39
40
  function decode(json, autodetect = false) {
@@ -77,8 +78,9 @@ var Mapping;
77
78
  }
78
79
  const className = CLASS.getName(entity);
79
80
  // console.log(`getMaping for: '${className}' `)
80
- let enityOWnMapping = _.isArray(entity[SYMBOL.MODELS_MAPPING]) ?
81
- entity[SYMBOL.MODELS_MAPPING] : [{ '': className }];
81
+ let enityOWnMapping = _.isArray(entity[SYMBOL.MODELS_MAPPING])
82
+ ? entity[SYMBOL.MODELS_MAPPING]
83
+ : [{ '': className }];
82
84
  let res = {};
83
85
  let parents = enityOWnMapping
84
86
  .filter(m => !_.isUndefined(m['']) && m[''] !== className)
@@ -104,11 +106,15 @@ var Mapping;
104
106
  function add(o, path, mapping = {}) {
105
107
  if (!o || Array.isArray(o) || typeof o !== 'object')
106
108
  return;
107
- const objectClassName = CLASS.getName(Object.getPrototypeOf(o).constructor);
109
+ const proptotypeObj = Object.getPrototypeOf(o);
110
+ if (!proptotypeObj) {
111
+ return;
112
+ }
113
+ const objectClassName = CLASS.getName(proptotypeObj.constructor);
108
114
  const resolveClass = CLASS.getBy(objectClassName);
109
115
  if (!resolveClass) {
110
116
  if (objectClassName !== 'Object') {
111
- if (Helpers$1.isBrowser) {
117
+ if (UtilsOs.isBrowser) {
112
118
  console.error(`Cannot resolve class "${objectClassName}" while mapping.`);
113
119
  }
114
120
  }
@@ -116,7 +122,6 @@ var Mapping;
116
122
  }
117
123
  if (!mapping[path])
118
124
  mapping[path] = CLASS.getName(resolveClass);
119
- ;
120
125
  }
121
126
  /**
122
127
  * USE ONLY IN DEVELOPMENT
@@ -126,6 +131,14 @@ var Mapping;
126
131
  * @param level
127
132
  */
128
133
  function getMappingNaive(c, path = '', mapping = {}, level = 0) {
134
+ if (c === null || c === undefined) {
135
+ return;
136
+ }
137
+ /* */
138
+ /* */
139
+ /* */
140
+ /* */
141
+ // console.log({c})
129
142
  if (Array.isArray(c)) {
130
143
  c.forEach(c => getMappingNaive(c, path, mapping, level));
131
144
  return mapping;
@@ -134,9 +147,10 @@ var Mapping;
134
147
  return;
135
148
  add(c, path, mapping);
136
149
  for (var p in c) {
137
- if (c.hasOwnProperty(p)) {
150
+ if (_.isFunction(c.hasOwnProperty) && c.hasOwnProperty(p)) {
138
151
  const v = c[p];
139
- if (Array.isArray(v) && v.length > 0) { // reducer as impovement
152
+ if (Array.isArray(v) && v.length > 0) {
153
+ // reducer as impovement
140
154
  v.forEach((elem, i) => {
141
155
  // const currentPaht = [`path[${i}]`, p].filter(c => c.trim() != '').join('.');
142
156
  const currentPaht = [path, p].filter(c => c.trim() != '').join('.');
@@ -157,9 +171,7 @@ var Mapping;
157
171
  return void 0;
158
172
  }
159
173
  const regex = /\[([0-9a-zA-Z]|\'|\")*\]/g;
160
- pathLodhas = pathLodhas
161
- .replace(regex, '')
162
- .replace('..', '.');
174
+ pathLodhas = pathLodhas.replace(regex, '').replace('..', '.');
163
175
  if (pathLodhas.startsWith('.')) {
164
176
  pathLodhas = pathLodhas.slice(1);
165
177
  }
@@ -174,7 +186,9 @@ var Mapping;
174
186
  if (!_.isUndefined(mapping[mappingPath])) {
175
187
  const isArray = _.isArray(mapping[mappingPath]);
176
188
  if (!isArray) {
177
- const className = isArray ? _.first(mapping[mappingPath]) : mapping[mappingPath];
189
+ const className = isArray
190
+ ? _.first(mapping[mappingPath])
191
+ : mapping[mappingPath];
178
192
  const classFN = CLASS.getBy(className);
179
193
  if (_.isFunction(classFN)) {
180
194
  // console.log(`mapping: '${mappingPath}', lp: '${lodashPath}' class: '${className}' , set `, v.location)
@@ -223,8 +237,7 @@ var Mapping;
223
237
  // }
224
238
  // }
225
239
  }
226
- Object
227
- .keys(mapping)
240
+ Object.keys(mapping)
228
241
  .filter(key => key !== '' && key.split('.').length >= 2)
229
242
  .forEach(lodasPath => {
230
243
  // console.log(`Loadsh path: ${lodasPath}`)
@@ -245,11 +258,12 @@ var Mapping;
245
258
  if (!_.isArray(target[SYMBOL.MODELS_MAPPING])) {
246
259
  target[SYMBOL.MODELS_MAPPING] = [];
247
260
  }
248
- target[SYMBOL.MODELS_MAPPING].push({ '': CLASS.getName(target) });
261
+ target[SYMBOL.MODELS_MAPPING].push({
262
+ '': CLASS.getName(target),
263
+ });
249
264
  if (_.isObject(mapping)) {
250
265
  target[SYMBOL.MODELS_MAPPING] = target[SYMBOL.MODELS_MAPPING].concat(mapping);
251
- Object.keys(mapping)
252
- .forEach(key => {
266
+ Object.keys(mapping).forEach(key => {
253
267
  const v = mapping;
254
268
  if (_.isUndefined(v) || _.isFunction(v)) {
255
269
  throw `
@@ -263,9 +277,7 @@ var Mapping;
263
277
  }
264
278
  if (_.isObject(defaultModelValues)) {
265
279
  const toMerge = {};
266
- const describedTarget = CLASS
267
- .describeProperites(target)
268
- .filter(prop => /^([a-zA-Z0-9]|\_|\#)+$/.test(prop));
280
+ const describedTarget = CLASS.describeProperites(target).filter(prop => /^([a-zA-Z0-9]|\_|\#)+$/.test(prop));
269
281
  // console.log(`describedTarget: ${describedTarget} for ${target.name}`)
270
282
  describedTarget.forEach(propDefInConstr => {
271
283
  if (defaultModelValues[propDefInConstr]) {
@@ -283,11 +295,8 @@ var Mapping;
283
295
  });
284
296
  // console.log(`merge "${JSON.stringify(target.prototype)}" with "${JSON.stringify(defaultModelValues)}"`)
285
297
  target[SYMBOL.DEFAULT_MODEL] = _.merge(toMerge, defaultModelValues);
286
- const propsToOmmit = Object
287
- .keys(target[SYMBOL.DEFAULT_MODEL])
288
- .filter(key => {
289
- const descriptor = Object
290
- .getOwnPropertyDescriptor(target.prototype, key);
298
+ const propsToOmmit = Object.keys(target[SYMBOL.DEFAULT_MODEL]).filter(key => {
299
+ const descriptor = Object.getOwnPropertyDescriptor(target.prototype, key);
291
300
  return !!descriptor;
292
301
  });
293
302
  _.merge(target.prototype, _.omit(target[SYMBOL.DEFAULT_MODEL], propsToOmmit));
@@ -618,7 +627,21 @@ function prepareUrlOldWay(params) {
618
627
  return this.endpoint + '/' + params;
619
628
  }
620
629
 
621
- /* */
630
+ // Optional helper for passing around context (browser/client)
631
+ // === Backend handler (last in chain) ===
632
+ class AxiosBackendHandler {
633
+ handle(req) {
634
+ // axios returns a Promise; wrap as Observable
635
+ return from(axios.request(req));
636
+ }
637
+ }
638
+ // === Chain builder (request: forward order, response: reverse order) ===
639
+ const buildInterceptorChain = (interceptors, backend) => {
640
+ return interceptors.reduceRight((next, interceptor) => ({
641
+ handle: req => interceptor.intercept({ req, next }),
642
+ }), backend);
643
+ };
644
+
622
645
  /* */
623
646
  // const log = Log.create('rest namespace', Level.__NOTHING)
624
647
  var Models;
@@ -940,7 +963,16 @@ class RestRequest {
940
963
  constructor() {
941
964
  this.subjectInuUse = {};
942
965
  this.meta = {};
966
+ //#endregion
967
+ /**
968
+ * key is interceptorName (just to identify who is intercepting)
969
+ */
943
970
  this.interceptors = new Map();
971
+ /**
972
+ * key is a joined string METHOD-expressPath.
973
+ * Example `GET-/api/users`
974
+ */
975
+ this.methodsInterceptors = new Map();
944
976
  //#endregion
945
977
  this.replaySubjects = {};
946
978
  }
@@ -971,7 +1003,7 @@ class RestRequest {
971
1003
  this.meta[jobid] = void 0;
972
1004
  this.subjectInuUse[jobid].complete();
973
1005
  }
974
- async req(url, method, headers, body, jobid, isArray = false, mockHttp) {
1006
+ async req(url, method, headers, body, jobid, isArray = false, mockHttp, axiosOptions) {
975
1007
  const CancelToken = axios.CancelToken;
976
1008
  const source = CancelToken.source();
977
1009
  this.subjectInuUse[jobid][cancelFn] = source.cancel;
@@ -997,6 +1029,16 @@ class RestRequest {
997
1029
  };
998
1030
  }
999
1031
  }
1032
+ const isFormData = CLASS.getNameFromObject(body) === 'FormData';
1033
+ const formData = isFormData ? body : void 0;
1034
+ /* */
1035
+ /* */
1036
+ /* */
1037
+ /* */
1038
+ /* */
1039
+ /* */
1040
+ /* */
1041
+ /* */
1000
1042
  const headersJson = headers.toJSON();
1001
1043
  const responseType = headersJson.responsetypeaxios
1002
1044
  ? headersJson.responsetypeaxios
@@ -1016,18 +1058,23 @@ class RestRequest {
1016
1058
  responseType,
1017
1059
  headers: headersJson,
1018
1060
  cancelToken: source.token,
1061
+ ...(axiosOptions || {}), // merge with axiosOptions
1019
1062
  // withCredentials: true, // this can be done manually
1020
1063
  };
1021
- // console.log('AXIOS CONFIG', axiosConfig);
1022
- const entries = this.interceptors.entries();
1023
- // console.log('AXIOS INTERCEPTORS', entries);
1024
- for (const interceptorObj of entries) {
1025
- const [interceptorName, interceptor] = interceptorObj;
1026
- if (typeof interceptor === 'function') {
1027
- axiosConfig = await interceptor(axiosConfig, interceptorName);
1028
- }
1064
+ if (isFormData) {
1065
+ axiosConfig.maxBodyLength = Infinity;
1029
1066
  }
1030
- response = await axios(axiosConfig);
1067
+ // console.log('AXIOS CONFIG', axiosConfig);
1068
+ const uri = new URL(url);
1069
+ const backend = new AxiosBackendHandler();
1070
+ const globalInterceptors = Array.from(this.interceptors.entries()).map(([_, interceptor]) => interceptor);
1071
+ const methodInterceptors = Array.from(this.methodsInterceptors.entries())
1072
+ .filter(([key]) => key === `${method?.toUpperCase()}-${uri.pathname}`)
1073
+ .map(([_, interceptor]) => interceptor);
1074
+ // console.log(`for ${uri.pathname} global ${globalInterceptors.length} method: ${methodInterceptors.length}`);
1075
+ const allInterceptors = [...globalInterceptors, ...methodInterceptors];
1076
+ const handler = buildInterceptorChain(allInterceptors, backend);
1077
+ response = await firstValueFrom(handler.handle(axiosConfig));
1031
1078
  // log.d(`after response of jobid: ${jobid}`);
1032
1079
  }
1033
1080
  // console.log('AXIOS RESPONES', response)
@@ -1181,36 +1228,36 @@ class RestRequest {
1181
1228
  return replay;
1182
1229
  }
1183
1230
  //#region http methods
1184
- generalReq(method, url, body, headers, meta, isArray, mockHttp) {
1231
+ generalReq(method, url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1185
1232
  const replay = this.getReplay(method, meta, false);
1186
1233
  replay.data = { url, body, headers, isArray };
1187
- ((pthis, purl, pmethod, pheaders, pbody, pid, pisArray, pmockHttp) => {
1234
+ ((pthis, purl, pmethod, pheaders, pbody, pid, pisArray, pmockHttp, axiosOpt) => {
1188
1235
  // log.d(`for ${purl} jobid ${pid}`);
1189
- setTimeout(() => pthis.req(purl, pmethod, pheaders, pbody, pid, pisArray, pmockHttp));
1190
- })(this, url, method, headers, body, replay.id, isArray, mockHttp);
1236
+ setTimeout(() => pthis.req(purl, pmethod, pheaders, pbody, pid, pisArray, pmockHttp, axiosOpt));
1237
+ })(this, url, method, headers, body, replay.id, isArray, mockHttp, axiosOptions);
1191
1238
  const resp = firstValueFrom(replay.subject[customObs]);
1192
1239
  resp.observable = replay.subject[customObs];
1193
1240
  return resp;
1194
1241
  }
1195
- get(url, body, headers, meta, isArray, mockHttp) {
1196
- return this.generalReq('get', url, body, headers, meta, isArray, mockHttp);
1242
+ get(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1243
+ return this.generalReq('get', url, body, headers, meta, isArray, mockHttp, axiosOptions);
1197
1244
  }
1198
- head(url, body, headers, meta, isArray, mockHttp) {
1199
- return this.generalReq('head', url, body, headers, meta, isArray, mockHttp);
1245
+ head(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1246
+ return this.generalReq('head', url, body, headers, meta, isArray, mockHttp, axiosOptions);
1200
1247
  }
1201
- delete(url, body, headers, meta, isArray, mockHttp) {
1202
- return this.generalReq('delete', url, body, headers, meta, isArray, mockHttp);
1248
+ delete(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1249
+ return this.generalReq('delete', url, body, headers, meta, isArray, mockHttp, axiosOptions);
1203
1250
  }
1204
- post(url, body, headers, meta, isArray, mockHttp) {
1205
- return this.generalReq('post', url, body, headers, meta, isArray, mockHttp);
1251
+ post(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1252
+ return this.generalReq('post', url, body, headers, meta, isArray, mockHttp, axiosOptions);
1206
1253
  }
1207
- put(url, body, headers, meta, isArray, mockHttp) {
1208
- return this.generalReq('put', url, body, headers, meta, isArray, mockHttp);
1254
+ put(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1255
+ return this.generalReq('put', url, body, headers, meta, isArray, mockHttp, axiosOptions);
1209
1256
  }
1210
- patch(url, body, headers, meta, isArray, mockHttp) {
1211
- return this.generalReq('patch', url, body, headers, meta, isArray, mockHttp);
1257
+ patch(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1258
+ return this.generalReq('patch', url, body, headers, meta, isArray, mockHttp, axiosOptions);
1212
1259
  }
1213
- jsonp(url, body, headers, meta, isArray, mockHttp) {
1260
+ jsonp(url, body, headers, meta, isArray, mockHttp, axiosOptions) {
1214
1261
  const method = 'jsonp';
1215
1262
  if (UtilsOs.isSSRMode) {
1216
1263
  const emptyStuff = Promise.resolve();
@@ -1264,10 +1311,13 @@ const CONTENT_TYPE = {
1264
1311
  }),
1265
1312
  };
1266
1313
 
1314
+ //#region import
1315
+ // import { Log, Level } from 'ng2-logger/src';
1316
+ // const log = Log.create('rest.class', Level.__NOTHING)
1267
1317
  //#endregion
1268
1318
  class Rest {
1269
1319
  mock(mock) {
1270
- if ((typeof mock === 'function') || (typeof mock === 'object')) {
1320
+ if (typeof mock === 'function' || typeof mock === 'object') {
1271
1321
  this.mockHttp = mock;
1272
1322
  }
1273
1323
  else {
@@ -1281,8 +1331,10 @@ class Rest {
1281
1331
  }
1282
1332
  get endpoint() {
1283
1333
  let e = this.__meta_endpoint;
1284
- if (this.restQueryParams !== void 0 && this._endpointRest !== void 0
1285
- && typeof this._endpointRest === 'string' && this._endpointRest.trim() !== '')
1334
+ if (this.restQueryParams !== void 0 &&
1335
+ this._endpointRest !== void 0 &&
1336
+ typeof this._endpointRest === 'string' &&
1337
+ this._endpointRest.trim() !== '')
1286
1338
  e = this._endpointRest;
1287
1339
  return e;
1288
1340
  }
@@ -1311,37 +1363,41 @@ class Rest {
1311
1363
  //#endregion
1312
1364
  //#region http methods
1313
1365
  this.array = {
1314
- get: (params = void 0, doNotSerializeParams) => {
1315
- return this.req('get', void 0, params, doNotSerializeParams, true);
1366
+ get: (item, params = void 0, axiosOptions) => {
1367
+ return this.req('get', item, params, axiosOptions, true);
1316
1368
  },
1317
- head: (params = void 0, doNotSerializeParams) => {
1318
- return this.req('head', void 0, params, doNotSerializeParams, true);
1369
+ head: (item, params = void 0, axiosOptions) => {
1370
+ return this.req('head', item, params, axiosOptions, true);
1319
1371
  },
1320
- post: (item, params, doNotSerializeParams) => {
1321
- return this.req('post', item, params, doNotSerializeParams, true);
1372
+ post: (item, params, axiosOptions) => {
1373
+ return this.req('post', item, params, axiosOptions, true);
1322
1374
  },
1323
- put: (item, params, doNotSerializeParams) => {
1324
- return this.req('put', item, params, doNotSerializeParams, true);
1375
+ put: (item, params, axiosOptions) => {
1376
+ return this.req('put', item, params, axiosOptions, true);
1325
1377
  },
1326
- patch: (item, params, doNotSerializeParams) => {
1327
- return this.req('patch', item, params, doNotSerializeParams, true);
1378
+ patch: (item, params, axiosOptions) => {
1379
+ return this.req('patch', item, params, axiosOptions, true);
1328
1380
  },
1329
- delete: (params, doNotSerializeParams) => {
1330
- return this.req('delete', void 0, params, doNotSerializeParams, true);
1381
+ delete: (item, params, axiosOptions) => {
1382
+ return this.req('delete', item, params, axiosOptions, true);
1383
+ },
1384
+ jsonp: (item, params, axiosOptions) => {
1385
+ return this.req('jsonp', item, params, axiosOptions, true);
1331
1386
  },
1332
- jsonp: (params, doNotSerializeParams) => {
1333
- return this.req('jsonp', void 0, params, doNotSerializeParams, true);
1334
- }
1335
1387
  };
1336
1388
  this.__meta_endpoint = endpoint;
1337
1389
  }
1338
1390
  //#endregion
1339
1391
  //#region req
1340
- req(method, requestBody, params, doNotSerializeParams = false, isArray = false) {
1341
- const modelUrl = this.creatUrl(params, doNotSerializeParams);
1342
- const body = (CLASS.getNameFromObject(requestBody) === 'FormData')
1392
+ req(method, requestBody, params, axiosOptions, isArray = false) {
1393
+ axiosOptions = axiosOptions || {};
1394
+ const modelUrl = this.creatUrl(params, !!axiosOptions.doNotSerializeParams);
1395
+ const isFormData = CLASS.getNameFromObject(requestBody) === 'FormData';
1396
+ const body = isFormData
1343
1397
  ? requestBody
1344
- : (requestBody ? JSON.stringify(requestBody) : void 0);
1398
+ : requestBody
1399
+ ? JSON.stringify(requestBody)
1400
+ : void 0;
1345
1401
  // console.log('this.customContentType', this.customContentType)
1346
1402
  if (this.customContentType) {
1347
1403
  const customHeaderKeys = this.customContentType.keys();
@@ -1361,26 +1417,26 @@ class Rest {
1361
1417
  this.mockHttp = void 0;
1362
1418
  return result;
1363
1419
  }
1364
- get(params, doNotSerializeParams = false) {
1365
- return this.req('get', void 0, params, doNotSerializeParams);
1420
+ get(item, params, axiosOptions) {
1421
+ return this.req('get', item, params, axiosOptions);
1366
1422
  }
1367
- head(params, doNotSerializeParams = false) {
1368
- return this.req('head', void 0, params, doNotSerializeParams);
1423
+ head(item, params, axiosOptions) {
1424
+ return this.req('head', item, params, axiosOptions);
1369
1425
  }
1370
- post(item, params, doNotSerializeParams = false) {
1371
- return this.req('post', item, params, doNotSerializeParams);
1426
+ post(item, params, axiosOptions) {
1427
+ return this.req('post', item, params, axiosOptions);
1372
1428
  }
1373
- put(item, params, doNotSerializeParams = false) {
1374
- return this.req('put', item, params, doNotSerializeParams);
1429
+ put(item, params, axiosOptions) {
1430
+ return this.req('put', item, params, axiosOptions);
1375
1431
  }
1376
- patch(item, params, doNotSerializeParams = false) {
1377
- return this.req('patch', item, params, doNotSerializeParams);
1432
+ patch(item, params, axiosOptions) {
1433
+ return this.req('patch', item, params, axiosOptions);
1378
1434
  }
1379
- delete(params, doNotSerializeParams = false) {
1380
- return this.req('delete', void 0, params, doNotSerializeParams);
1435
+ delete(item, params, axiosOptions) {
1436
+ return this.req('delete', item, params, axiosOptions);
1381
1437
  }
1382
- jsonp(params, doNotSerializeParams = false) {
1383
- return this.req('jsonp', void 0, params, doNotSerializeParams);
1438
+ jsonp(item, params, axiosOptions) {
1439
+ return this.req('jsonp', item, params, axiosOptions);
1384
1440
  }
1385
1441
  }
1386
1442
 
@@ -1607,66 +1663,79 @@ class ExtendedResource {
1607
1663
  this.path_model = path_model;
1608
1664
  /**
1609
1665
  * Get model by rest params
1610
- */
1666
+ */
1611
1667
  this.model = (restParams) => {
1612
1668
  return {
1613
- get: (queryPrams) => {
1669
+ get: (item, queryPrams) => {
1614
1670
  return Observable.create((observer) => {
1615
- ExtendedResource.handlers.push(this.rest.model(restParams)
1616
- .get([queryPrams], ExtendedResource.doNotSerializeQueryParams)
1617
- .observable
1618
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1671
+ ExtendedResource.handlers.push(this.rest
1672
+ .model(restParams)
1673
+ .get(item, [queryPrams], {
1674
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1675
+ })
1676
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1619
1677
  });
1620
1678
  },
1621
1679
  patch: (item, queryParams) => {
1622
1680
  return Observable.create((observer) => {
1623
- ExtendedResource.handlers.push(this.rest.model(restParams)
1624
- .put(item, [queryParams], ExtendedResource.doNotSerializeQueryParams)
1625
- .observable
1626
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1681
+ ExtendedResource.handlers.push(this.rest
1682
+ .model(restParams)
1683
+ .put(item, [queryParams], {
1684
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1685
+ })
1686
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1627
1687
  });
1628
1688
  },
1629
- head: (queryPrams) => {
1689
+ head: (item, queryPrams) => {
1630
1690
  return Observable.create((observer) => {
1631
- ExtendedResource.handlers.push(this.rest.model(restParams)
1632
- .head([queryPrams], ExtendedResource.doNotSerializeQueryParams)
1633
- .observable
1634
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1691
+ ExtendedResource.handlers.push(this.rest
1692
+ .model(restParams)
1693
+ .head(item, [queryPrams], {
1694
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1695
+ })
1696
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1635
1697
  });
1636
1698
  },
1637
- query: (queryPrams) => {
1699
+ query: (item, queryPrams) => {
1638
1700
  return Observable.create((observer) => {
1639
- ExtendedResource.handlers.push(this.rest.model(restParams).
1640
- array
1641
- .get([queryPrams], ExtendedResource.doNotSerializeQueryParams)
1642
- .observable
1643
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1701
+ ExtendedResource.handlers.push(this.rest
1702
+ .model(restParams)
1703
+ .array.get(item, [queryPrams], {
1704
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1705
+ })
1706
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1644
1707
  });
1645
1708
  },
1646
1709
  post: (item, queryParams) => {
1647
1710
  return Observable.create((observer) => {
1648
- ExtendedResource.handlers.push(this.rest.model(restParams)
1649
- .post(item, [queryParams], ExtendedResource.doNotSerializeQueryParams)
1650
- .observable
1651
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1711
+ ExtendedResource.handlers.push(this.rest
1712
+ .model(restParams)
1713
+ .post(item, [queryParams], {
1714
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1715
+ })
1716
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1652
1717
  });
1653
1718
  },
1654
1719
  put: (item, queryParams) => {
1655
1720
  return Observable.create((observer) => {
1656
- ExtendedResource.handlers.push(this.rest.model(restParams)
1657
- .put(item, [queryParams], ExtendedResource.doNotSerializeQueryParams)
1658
- .observable
1659
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1721
+ ExtendedResource.handlers.push(this.rest
1722
+ .model(restParams)
1723
+ .put(item, [queryParams], {
1724
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1725
+ })
1726
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1660
1727
  });
1661
1728
  },
1662
- delete: (queryPrams) => {
1729
+ delete: (item, queryPrams) => {
1663
1730
  return Observable.create((observer) => {
1664
- ExtendedResource.handlers.push(this.rest.model(restParams)
1665
- .delete([queryPrams], ExtendedResource.doNotSerializeQueryParams)
1666
- .observable
1667
- .subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1731
+ ExtendedResource.handlers.push(this.rest
1732
+ .model(restParams)
1733
+ .delete(item, [queryPrams], {
1734
+ doNotSerializeParams: ExtendedResource.doNotSerializeQueryParams,
1735
+ })
1736
+ .observable.subscribe(data => observer.next(data.body.json), err => observer.error(err), () => observer.complete()));
1668
1737
  });
1669
- }
1738
+ },
1670
1739
  };
1671
1740
  };
1672
1741
  this.rest = Resource.create(endpoint, path_model);
@@ -1705,5 +1774,5 @@ class SimpleResource {
1705
1774
  * Generated bundle index. Do not edit.
1706
1775
  */
1707
1776
 
1708
- export { CONTENT_TYPE, Helpers, Mapping, Models, Resource, Rest, RestHeaders, SimpleResource, interpolateParamsToUrl };
1777
+ export { AxiosBackendHandler, CONTENT_TYPE, Helpers, Mapping, Models, Resource, Rest, RestHeaders, SimpleResource, buildInterceptorChain, interpolateParamsToUrl };
1709
1778
  //# sourceMappingURL=ng2-rest.mjs.map