angular-odata 0.141.0 → 0.143.0

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 (54) hide show
  1. package/README.md +1 -1
  2. package/fesm2022/angular-odata.mjs +22 -20
  3. package/fesm2022/angular-odata.mjs.map +1 -1
  4. package/package.json +5 -5
  5. package/schematics/apigen/angular/api-config.d.ts +2 -1
  6. package/schematics/apigen/angular/api-config.js +4 -4
  7. package/schematics/apigen/angular/api-config.js.map +1 -1
  8. package/schematics/apigen/angular/base.d.ts +5 -6
  9. package/schematics/apigen/angular/base.js +26 -14
  10. package/schematics/apigen/angular/base.js.map +1 -1
  11. package/schematics/apigen/angular/collection.d.ts +2 -1
  12. package/schematics/apigen/angular/collection.js +5 -8
  13. package/schematics/apigen/angular/collection.js.map +1 -1
  14. package/schematics/apigen/angular/entity.d.ts +6 -2
  15. package/schematics/apigen/angular/entity.js +17 -7
  16. package/schematics/apigen/angular/entity.js.map +1 -1
  17. package/schematics/apigen/angular/enum.d.ts +2 -1
  18. package/schematics/apigen/angular/enum.js +1 -1
  19. package/schematics/apigen/angular/enum.js.map +1 -1
  20. package/schematics/apigen/angular/import.d.ts +5 -2
  21. package/schematics/apigen/angular/import.js +18 -3
  22. package/schematics/apigen/angular/import.js.map +1 -1
  23. package/schematics/apigen/angular/model.d.ts +12 -8
  24. package/schematics/apigen/angular/model.js +66 -55
  25. package/schematics/apigen/angular/model.js.map +1 -1
  26. package/schematics/apigen/angular/module.d.ts +2 -1
  27. package/schematics/apigen/angular/module.js +1 -1
  28. package/schematics/apigen/angular/module.js.map +1 -1
  29. package/schematics/apigen/angular/package.js +8 -11
  30. package/schematics/apigen/angular/package.js.map +1 -1
  31. package/schematics/apigen/angular/service.d.ts +2 -1
  32. package/schematics/apigen/angular/service.js +1 -1
  33. package/schematics/apigen/angular/service.js.map +1 -1
  34. package/schematics/apigen/files/api-config/__fileName__.ts +5 -3
  35. package/schematics/apigen/files/collection/__fileName__.ts +5 -1
  36. package/schematics/apigen/files/entity/__fileName__.ts +7 -3
  37. package/schematics/apigen/files/entitycontainer-service/__fileName__.ts +5 -1
  38. package/schematics/apigen/files/entityset-service/__fileName__.ts +5 -1
  39. package/schematics/apigen/files/enum/__fileName__.ts +4 -0
  40. package/schematics/apigen/files/index/__fileName__.ts +2 -0
  41. package/schematics/apigen/files/model/__fileName__.ts +9 -5
  42. package/schematics/apigen/files/module/__fileName__.ts +3 -1
  43. package/schematics/apigen/files/singleton-service/__fileName__.ts +5 -1
  44. package/schematics/apigen/index.js +59 -11
  45. package/schematics/apigen/index.js.map +1 -1
  46. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.d.ts +3 -3
  47. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js +3 -1
  48. package/schematics/apigen/metadata/csdl/csdl-navigation-property-binding.js.map +1 -1
  49. package/schematics/apigen/metadata/csdl/csdl-structural-property.js.map +1 -1
  50. package/schematics/apigen/metadata/csdl/csdl-structured-type.js.map +1 -1
  51. package/schematics/random.d.ts +4 -1
  52. package/schematics/random.js +3 -3
  53. package/schematics/random.js.map +1 -1
  54. package/{index.d.ts → types/angular-odata.d.ts} +1413 -1413
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  <p align="center">
9
9
  <a href="CONTRIBUTING.md">Contributing</a>
10
10
  ·
11
- <a href="./docs/README.md">Documentation</a>
11
+ <a href="./docs/api/index.html">Documentation</a>
12
12
  ·
13
13
  <a href="https://github.com/diegomvh/AngularODataEntity">Demo</a>
14
14
  <br>
@@ -502,13 +502,13 @@ const StandardAggregateMethods = {
502
502
  min: 'min',
503
503
  max: 'max',
504
504
  average: 'average',
505
- countdistinct: 'countdistinct'
505
+ countdistinct: 'countdistinct',
506
506
  };
507
507
  const QueryCustomTypes = {
508
508
  Raw: 'Raw',
509
509
  Alias: 'Alias',
510
510
  Duration: 'Duration',
511
- Binary: 'Binary'
511
+ Binary: 'Binary',
512
512
  };
513
513
  //https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_QueryOptions
514
514
  const raw = (value) => ({
@@ -10570,7 +10570,7 @@ class ODataCollection {
10570
10570
  }
10571
10571
  }
10572
10572
  else if (resource instanceof ODataEntitySetResource) {
10573
- return model.asEntity((e) => e.destroy(options));
10573
+ return model.asEntity((e) => e.destroy(options)).pipe(map(() => model));
10574
10574
  }
10575
10575
  else {
10576
10576
  return of(model);
@@ -13547,10 +13547,10 @@ class ODataClient {
13547
13547
  put(resource, body, options = {}) {
13548
13548
  return this.request('PUT', resource, addBody(options, body));
13549
13549
  }
13550
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataClient, deps: [{ token: i1.HttpClient }, { token: ODataConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
13551
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataClient });
13550
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataClient, deps: [{ token: i1.HttpClient }, { token: ODataConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
13551
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataClient });
13552
13552
  }
13553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataClient, decorators: [{
13553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataClient, decorators: [{
13554
13554
  type: Injectable
13555
13555
  }], ctorParameters: () => [{ type: i1.HttpClient }, { type: ODataConfigLoader }] });
13556
13556
 
@@ -13834,10 +13834,10 @@ class ODataServiceFactory {
13834
13834
  };
13835
13835
  return new Service(this.client, singletonName, apiNameOrEntityType);
13836
13836
  }
13837
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataServiceFactory, deps: [{ token: ODataClient }], target: i0.ɵɵFactoryTarget.Injectable });
13838
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataServiceFactory });
13837
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataServiceFactory, deps: [{ token: ODataClient }], target: i0.ɵɵFactoryTarget.Injectable });
13838
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataServiceFactory });
13839
13839
  }
13840
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataServiceFactory, decorators: [{
13840
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataServiceFactory, decorators: [{
13841
13841
  type: Injectable
13842
13842
  }], ctorParameters: () => [{ type: ODataClient }] });
13843
13843
 
@@ -13877,11 +13877,11 @@ class ODataModule {
13877
13877
  ],
13878
13878
  };
13879
13879
  }
13880
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
13881
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, imports: [CommonModule] });
13882
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, providers: [ODataClient, ODataServiceFactory], imports: [CommonModule] });
13880
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
13881
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.5", ngImport: i0, type: ODataModule, imports: [CommonModule] });
13882
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataModule, providers: [ODataClient, ODataServiceFactory], imports: [CommonModule] });
13883
13883
  }
13884
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: ODataModule, decorators: [{
13884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: ODataModule, decorators: [{
13885
13885
  type: NgModule,
13886
13886
  args: [{
13887
13887
  imports: [CommonModule],
@@ -13934,9 +13934,9 @@ class ODataBaseCache {
13934
13934
  buildEntry(payload, { timeout, tags }) {
13935
13935
  return {
13936
13936
  payload,
13937
- lastRead: Date.now(),
13938
- timeout: timeout || this.timeout,
13939
- tags: tags || [],
13937
+ lastread: Date.now(),
13938
+ timeout: (timeout ?? this.timeout) * 1000,
13939
+ tags: tags ?? [],
13940
13940
  };
13941
13941
  }
13942
13942
  /**
@@ -13957,9 +13957,8 @@ class ODataBaseCache {
13957
13957
  */
13958
13958
  put(name, payload, { timeout, scope, tags } = {}) {
13959
13959
  const entry = this.buildEntry(payload, { timeout, tags });
13960
- const key = this.buildKey([...(scope || []), name]);
13960
+ const key = this.buildKey([...(scope ?? []), name]);
13961
13961
  this.entries.set(key, entry);
13962
- this.forget();
13963
13962
  }
13964
13963
  /**
13965
13964
  * Return the payload from the cache if it exists and is not expired
@@ -13970,7 +13969,10 @@ class ODataBaseCache {
13970
13969
  get(name, { scope } = {}) {
13971
13970
  const key = this.buildKey([...(scope || []), name]);
13972
13971
  const entry = this.entries.get(key);
13973
- return entry !== undefined && !this.isExpired(entry) ? entry.payload : undefined;
13972
+ if (entry === undefined || this.isExpired(entry))
13973
+ return undefined;
13974
+ entry.lastread = Date.now();
13975
+ return entry.payload;
13974
13976
  }
13975
13977
  /**
13976
13978
  * Remove all cache entries that are matching with the given options
@@ -14001,7 +14003,7 @@ class ODataBaseCache {
14001
14003
  * @returns Boolean indicating if the entry is expired
14002
14004
  */
14003
14005
  isExpired(entry) {
14004
- return entry.lastRead < Date.now() - (entry.timeout || this.timeout) * 1000;
14006
+ return entry.lastread < (Date.now() - entry.timeout);
14005
14007
  }
14006
14008
  /**
14007
14009
  * Using the request, handle the fetching of the response