ntk-cms-api 20.25.43 → 20.25.45
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.
- package/fesm2022/ntk-cms-api.mjs +21 -8
- package/fesm2022/ntk-cms-api.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
package/fesm2022/ntk-cms-api.mjs
CHANGED
|
@@ -1148,6 +1148,7 @@ class ApiServerBase {
|
|
|
1148
1148
|
this.keyBaseVer = 'Ver';
|
|
1149
1149
|
this.accessLoad = false;
|
|
1150
1150
|
this.cachApiResult = [];
|
|
1151
|
+
this.cachApiInRunResult = [];
|
|
1151
1152
|
this.childConstructor();
|
|
1152
1153
|
this.headers = new Map();
|
|
1153
1154
|
}
|
|
@@ -1162,15 +1163,28 @@ class ApiServerBase {
|
|
|
1162
1163
|
}
|
|
1163
1164
|
cashApiIsValid(serviceNameKay, cashApiSeconds = 0) {
|
|
1164
1165
|
if (cashApiSeconds > 0) {
|
|
1166
|
+
while (this.cachApiInRunResult[serviceNameKay]?.getTime() >
|
|
1167
|
+
new Date().getTime() - 10000) {
|
|
1168
|
+
/* this.delay(1000).;*/
|
|
1169
|
+
}
|
|
1165
1170
|
if (!this.cachApiResult[serviceNameKay])
|
|
1166
1171
|
return false;
|
|
1167
1172
|
if (!this.cachApiResult[serviceNameKay].isSuccess)
|
|
1168
1173
|
return false;
|
|
1169
|
-
if (this.cachApiResult[serviceNameKay].dateResult &&
|
|
1174
|
+
if (this.cachApiResult[serviceNameKay].dateResult &&
|
|
1175
|
+
new Date().getTime() - this.cachApiResult[serviceNameKay].dateResult <
|
|
1176
|
+
cashApiSeconds)
|
|
1170
1177
|
return true;
|
|
1178
|
+
this.cachApiInRunResult[serviceNameKay] = new Date();
|
|
1171
1179
|
}
|
|
1172
1180
|
return false;
|
|
1173
1181
|
}
|
|
1182
|
+
cashApiVlaueSet(serviceNameKay, ret) {
|
|
1183
|
+
this.cachApiResult[serviceNameKay] = ret;
|
|
1184
|
+
this.cachApiResult[serviceNameKay].dateResult = new Date();
|
|
1185
|
+
this.cachApiInRunResult[serviceNameKay] = undefined;
|
|
1186
|
+
delete this.cachApiInRunResult[serviceNameKay];
|
|
1187
|
+
}
|
|
1174
1188
|
childConstructor() {
|
|
1175
1189
|
// test
|
|
1176
1190
|
}
|
|
@@ -1561,8 +1575,7 @@ class ApiCmsServerBase extends ApiServerBase {
|
|
|
1561
1575
|
.pipe(retry(this.configApiRetry), map((ret) => {
|
|
1562
1576
|
//! optimaze call api
|
|
1563
1577
|
if (cashApiSeconds > 0) {
|
|
1564
|
-
this.
|
|
1565
|
-
this.cachApiResult[serviceNameKay].dateResult = new Date();
|
|
1578
|
+
this.cashApiVlaueSet(serviceNameKay, ret);
|
|
1566
1579
|
}
|
|
1567
1580
|
//! optimaze call api
|
|
1568
1581
|
return ret;
|
|
@@ -1982,8 +1995,7 @@ class CoreEnumService extends ApiServerBase {
|
|
|
1982
1995
|
.pipe(map((ret) => {
|
|
1983
1996
|
//! optimaze call api
|
|
1984
1997
|
if (cashApiSeconds > 0) {
|
|
1985
|
-
this.
|
|
1986
|
-
this.cachApiResult[serviceNameKay].dateResult = new Date();
|
|
1998
|
+
this.cashApiVlaueSet(serviceNameKay, ret);
|
|
1987
1999
|
}
|
|
1988
2000
|
//! optimaze call api
|
|
1989
2001
|
return ret;
|
|
@@ -1996,14 +2008,15 @@ class CoreEnumService extends ApiServerBase {
|
|
|
1996
2008
|
return of(this.cachApiResult[serviceNameKay]);
|
|
1997
2009
|
//! optimaze call api
|
|
1998
2010
|
return this.http
|
|
1999
|
-
.get(this.getBaseUrl() +
|
|
2011
|
+
.get(this.getBaseUrl() +
|
|
2012
|
+
this.getModuleControllerUrl() +
|
|
2013
|
+
'/RecordAdminStatusEnum', {
|
|
2000
2014
|
headers: this.getHeaders(),
|
|
2001
2015
|
})
|
|
2002
2016
|
.pipe(map((ret) => {
|
|
2003
2017
|
//! optimaze call api
|
|
2004
2018
|
if (cashApiSeconds > 0) {
|
|
2005
|
-
this.
|
|
2006
|
-
this.cachApiResult[serviceNameKay].dateResult = new Date();
|
|
2019
|
+
this.cashApiVlaueSet(serviceNameKay, ret);
|
|
2007
2020
|
}
|
|
2008
2021
|
//! optimaze call api
|
|
2009
2022
|
return ret;
|