ntk-cms-api 20.25.53 → 20.25.55

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.
@@ -2,8 +2,8 @@ import * as i1 from '@angular/common/http';
2
2
  import { HttpClient } from '@angular/common/http';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Inject, Injectable } from '@angular/core';
5
- import { throwError, of, BehaviorSubject } from 'rxjs';
6
- import { retry, map } from 'rxjs/operators';
5
+ import { throwError, from, of, BehaviorSubject } from 'rxjs';
6
+ import { retry, map, mergeMap } from 'rxjs/operators';
7
7
 
8
8
  class AccessHelper {
9
9
  AccessFieldsSet(access) {
@@ -1118,15 +1118,15 @@ class ApiServerBase {
1118
1118
  get Ver() {
1119
1119
  return localStorage.getItem(this.keyBaseVer) + '_';
1120
1120
  }
1121
- cashApiIsValid(serviceNameKay, cashApiSeconds = 0, runApiSeconds = 1000) {
1121
+ async cashApiIsValid(serviceNameKay, cashApiSeconds = 0, runApiSeconds = 1000) {
1122
1122
  if (cashApiSeconds <= 0)
1123
1123
  return false;
1124
- //**cashApiSeconds */
1124
+ // wait asynchronously while another call is in-flight within the allowed window
1125
1125
  while (this.cachApiInRunResult[serviceNameKay] &&
1126
1126
  new Date().getTime() -
1127
1127
  this.cachApiInRunResult[serviceNameKay]?.getTime() <
1128
1128
  runApiSeconds) {
1129
- /* this.delay(1000).;*/
1129
+ await this.delay(50);
1130
1130
  }
1131
1131
  if (this.cachApiResult[serviceNameKay]?.isSuccess === true &&
1132
1132
  this.cachApiResult[serviceNameKay]?.dateResult &&
@@ -1267,6 +1267,9 @@ class ApiServerBase {
1267
1267
  }
1268
1268
  return throwError(errorMessage);
1269
1269
  }
1270
+ delay(ms) {
1271
+ return new Promise((resolve) => setTimeout(resolve, ms));
1272
+ }
1270
1273
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ApiServerBase, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
1271
1274
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ApiServerBase }); }
1272
1275
  }
@@ -1523,21 +1526,23 @@ class ApiCmsServerBase extends ApiServerBase {
1523
1526
  ServiceGetOneById(id, cashApiSeconds = 0) {
1524
1527
  //! optimaze call api
1525
1528
  const serviceNameKay = this.constructor.name + '_ServiceGetOneById_' + id;
1526
- if (this.cashApiIsValid(serviceNameKay, cashApiSeconds))
1527
- return of(this.cachApiResult[serviceNameKay]);
1528
- //! optimaze call api
1529
- // this.loadingStatus=true;
1530
- return this.http
1531
- .get(this.getBaseUrl() + this.getModuleControllerUrl() + '/' + id, {
1532
- headers: this.getHeaders(),
1533
- })
1534
- .pipe(retry(this.configApiRetry), map((ret) => {
1535
- //! optimaze call api
1536
- if (cashApiSeconds > 0) {
1537
- this.cashApiVlaueSet(serviceNameKay, ret);
1538
- }
1529
+ return from(this.cashApiIsValid(serviceNameKay, cashApiSeconds)).pipe(mergeMap((isValid) => {
1530
+ if (isValid)
1531
+ return of(this.cachApiResult[serviceNameKay]);
1539
1532
  //! optimaze call api
1540
- return ret;
1533
+ // this.loadingStatus=true;
1534
+ return this.http
1535
+ .get(this.getBaseUrl() + this.getModuleControllerUrl() + '/' + id, {
1536
+ headers: this.getHeaders(),
1537
+ })
1538
+ .pipe(retry(this.configApiRetry), map((ret) => {
1539
+ //! optimaze call api
1540
+ if (cashApiSeconds > 0) {
1541
+ this.cashApiVlaueSet(serviceNameKay, ret);
1542
+ }
1543
+ //! optimaze call api
1544
+ return ret;
1545
+ }));
1541
1546
  }));
1542
1547
  }
1543
1548
  ServiceGetCount(model) {
@@ -1944,41 +1949,45 @@ class CoreEnumService extends ApiServerBase {
1944
1949
  ServiceRecordStatusEnum(cashApiSeconds = 0) {
1945
1950
  //! optimaze call api
1946
1951
  const serviceNameKay = 'ServiceRecordStatusEnum';
1947
- if (this.cashApiIsValid(serviceNameKay, cashApiSeconds))
1948
- return of(this.cachApiResult[serviceNameKay]);
1949
- //! optimaze call api
1950
- return this.http
1951
- .get(this.getBaseUrl() + this.getModuleControllerUrl() + '/RecordStatusEnum', {
1952
- headers: this.getHeaders(),
1953
- })
1954
- .pipe(map((ret) => {
1955
- //! optimaze call api
1956
- if (cashApiSeconds > 0) {
1957
- this.cashApiVlaueSet(serviceNameKay, ret);
1958
- }
1959
- //! optimaze call api
1960
- return ret;
1952
+ return from(this.cashApiIsValid(serviceNameKay, cashApiSeconds)).pipe(mergeMap((isValid) => {
1953
+ if (isValid)
1954
+ return of(this.cachApiResult[serviceNameKay]);
1955
+ return this.http
1956
+ .get(this.getBaseUrl() +
1957
+ this.getModuleControllerUrl() +
1958
+ '/RecordStatusEnum', {
1959
+ headers: this.getHeaders(),
1960
+ })
1961
+ .pipe(map((ret) => {
1962
+ //! optimaze call api
1963
+ if (cashApiSeconds > 0) {
1964
+ this.cashApiVlaueSet(serviceNameKay, ret);
1965
+ }
1966
+ //! optimaze call api
1967
+ return ret;
1968
+ }));
1961
1969
  }));
1962
1970
  }
1963
1971
  ServiceRecordAdminStatusEnum(cashApiSeconds = 0) {
1964
1972
  //! optimaze call api
1965
1973
  const serviceNameKay = 'ServiceRecordAdminStatusEnum';
1966
- if (this.cashApiIsValid(serviceNameKay, cashApiSeconds))
1967
- return of(this.cachApiResult[serviceNameKay]);
1968
- //! optimaze call api
1969
- return this.http
1970
- .get(this.getBaseUrl() +
1971
- this.getModuleControllerUrl() +
1972
- '/RecordAdminStatusEnum', {
1973
- headers: this.getHeaders(),
1974
- })
1975
- .pipe(map((ret) => {
1976
- //! optimaze call api
1977
- if (cashApiSeconds > 0) {
1978
- this.cashApiVlaueSet(serviceNameKay, ret);
1979
- }
1980
- //! optimaze call api
1981
- return ret;
1974
+ return from(this.cashApiIsValid(serviceNameKay, cashApiSeconds)).pipe(mergeMap((isValid) => {
1975
+ if (isValid)
1976
+ return of(this.cachApiResult[serviceNameKay]);
1977
+ return this.http
1978
+ .get(this.getBaseUrl() +
1979
+ this.getModuleControllerUrl() +
1980
+ '/RecordAdminStatusEnum', {
1981
+ headers: this.getHeaders(),
1982
+ })
1983
+ .pipe(map((ret) => {
1984
+ //! optimaze call api
1985
+ if (cashApiSeconds > 0) {
1986
+ this.cashApiVlaueSet(serviceNameKay, ret);
1987
+ }
1988
+ //! optimaze call api
1989
+ return ret;
1990
+ }));
1982
1991
  }));
1983
1992
  }
1984
1993
  ServiceLocationTypeEnum() {
@@ -9083,6 +9092,18 @@ class ContactContentService extends ApiCmsServerBase {
9083
9092
  return ret;
9084
9093
  }));
9085
9094
  }
9095
+ ServiceFindByNumber(number) {
9096
+ return this.http
9097
+ .get(this.getBaseUrl() +
9098
+ this.getModuleControllerUrl() +
9099
+ '/FindByNumber/' +
9100
+ number, {
9101
+ headers: this.getHeaders(),
9102
+ })
9103
+ .pipe(retry(this.configApiRetry), map((ret) => {
9104
+ return ret;
9105
+ }));
9106
+ }
9086
9107
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ContactContentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
9087
9108
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ContactContentService }); }
9088
9109
  }