@topconsultnpm/sdk-ts 6.19.0-dev1.4 → 6.19.0-dev1.6
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/dist/lib/Engine.js +4 -7
- package/dist/lib/TopMediaSession.js +9 -1
- package/dist/lib/helper/SDK_CacheServices.js +89 -1
- package/dist/lib/openAPIs/TopMediaServiceClient.js +1 -1
- package/dist/types/Engine.d.ts +5 -7
- package/dist/types/helper/SDK_CacheServices.d.ts +14 -1
- package/dist/types/openAPIs/TopMediaServiceClient.d.ts +6 -7
- package/package.json +1 -1
package/dist/lib/Engine.js
CHANGED
|
@@ -734,14 +734,11 @@ export class DossierEngine extends BaseEngine {
|
|
|
734
734
|
FollowAddOrRemoveAsync(id, remove) {
|
|
735
735
|
return __awaiter(this, void 0, void 0, function* () { var _a; return yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.dossierFollowAddOrRemove(id, remove ? 1 : 0)); });
|
|
736
736
|
}
|
|
737
|
-
|
|
738
|
-
return __awaiter(this, void 0, void 0, function* () { var _a; return yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.
|
|
737
|
+
DetailCreateAsync(id, classID, id1, id2) {
|
|
738
|
+
return __awaiter(this, void 0, void 0, function* () { var _a; return yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.dossierDetailCreate(id, classID, id1, id2)); });
|
|
739
739
|
}
|
|
740
|
-
|
|
741
|
-
return __awaiter(this, void 0, void 0, function* () { var _a; yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.
|
|
742
|
-
}
|
|
743
|
-
DetailDetachAsync(id, dsdid) {
|
|
744
|
-
return __awaiter(this, void 0, void 0, function* () { var _a; yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.dossierDetailDetach(id, dsdid)); });
|
|
740
|
+
DetailUpdateAsync(id, tid, min, max) {
|
|
741
|
+
return __awaiter(this, void 0, void 0, function* () { var _a; yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.dossierDetailUpdate(id, tid, min, max)); });
|
|
745
742
|
}
|
|
746
743
|
DetailDeleteAsync(id, dsdid) {
|
|
747
744
|
return __awaiter(this, void 0, void 0, function* () { var _a; yield ((_a = this.TMSClient) === null || _a === void 0 ? void 0 : _a.dossierDetailDelete(id, dsdid)); });
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { PublicClientApplication } from "@azure/msal-browser";
|
|
11
11
|
import { ArchiveEngine, AreaEngine, BasketEngine, BasketTypeEngine, DataListEngine, DcmtTypeEngine, DiskEngine, DossierEngine, FavoritesEngine, HomePageEngine, RelationEngine, JobEngine, LicenseEngine, NotificationEngine, OrchPlatformEngine, PreviewEngine, ProcessEngine, RecentEngine, SavedQueryEngine, SearchEngine, SignCertEngine, TSAEngine, TaskEngine, TreeEngine, UploadFileEngine, UserEngine, WorkflowEngine, WorkingGroupEngine, DeleteEngine, UpdateEngineByID, ArchiveEngineByID, DcmtPlatformEngine, ADMEngine, NumeratorEngine, ReportEngine, SignServerEngine, LDAPEngine, GroupEngine, SAPEngine, PermissionEngine, ViewEngine, DossierTypeEngine } from "./Engine";
|
|
12
|
-
import { DataListCacheService, DcmtTypeListCacheService, RelationCacheService, SavedQueryCacheService, SignCertCacheService, TreeCacheService, TSACacheService, UserListCacheService, WorkingGroupCacheService } from "./helper/SDK_CacheServices";
|
|
12
|
+
import { DataListCacheService, DcmtTypeListCacheService, DossierCacheService, LayoutCacheService, RelationCacheService, SavedQueryCacheService, SignCertCacheService, TreeCacheService, TSACacheService, UserListCacheService, WorkingGroupCacheService } from "./helper/SDK_CacheServices";
|
|
13
13
|
import { AuthenticationModes } from "./openAPIs/TopMediaServiceClient";
|
|
14
14
|
import { SDK_Globals } from "./helper/SDK_Globals";
|
|
15
15
|
export class TopMediaSession {
|
|
@@ -160,6 +160,14 @@ export class TopMediaSession {
|
|
|
160
160
|
UserListCacheService.RemoveAll(this);
|
|
161
161
|
}
|
|
162
162
|
catch (_m) { }
|
|
163
|
+
try {
|
|
164
|
+
LayoutCacheService.RemoveAll(this);
|
|
165
|
+
}
|
|
166
|
+
catch (_o) { }
|
|
167
|
+
try {
|
|
168
|
+
DossierCacheService.RemoveAll(this);
|
|
169
|
+
}
|
|
170
|
+
catch (_p) { }
|
|
163
171
|
SDK_Globals.license = undefined;
|
|
164
172
|
SDK_Globals.currentWorkflowApproveData = [];
|
|
165
173
|
if (!useGlobals)
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { AccessLevelsEx, DataColumnTypes, DataListDescriptor, DataListViewModes, DcmtTypeDescriptor, DossierDescriptor, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, ObjectClasses, RelationDescriptor, SavedQueryDescriptor, SignCertDescriptor, TSADescriptor, TreeContext, TreeDescriptor, UserDescriptor, UserLevels, WFDescriptor, WorkingGroupDescriptor } from "../openAPIs/TopMediaServiceClient";
|
|
10
|
+
import { AccessLevelsEx, DataColumnTypes, DataListDescriptor, DataListViewModes, DcmtTypeDescriptor, DossierDescriptor, LayoutDescriptor, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, ObjectClasses, RelationDescriptor, SavedQueryDescriptor, SignCertDescriptor, TSADescriptor, TreeContext, TreeDescriptor, UserDescriptor, UserLevels, WFDescriptor, WorkingGroupDescriptor } from "../openAPIs/TopMediaServiceClient";
|
|
11
11
|
import { Mutex } from 'async-mutex';
|
|
12
12
|
import { SDK_Globals } from "./SDK_Globals";
|
|
13
13
|
export class DataListCacheService {
|
|
@@ -959,3 +959,91 @@ export class UserListCacheService {
|
|
|
959
959
|
}
|
|
960
960
|
UserListCacheService._mutex = new Mutex();
|
|
961
961
|
UserListCacheService._cache = new Map();
|
|
962
|
+
export class LayoutCacheService {
|
|
963
|
+
static getCacheKey(TID, layoutMode) {
|
|
964
|
+
return `${TID}_${layoutMode}`;
|
|
965
|
+
}
|
|
966
|
+
static getAccessToken(tmSession) {
|
|
967
|
+
var _a, _b;
|
|
968
|
+
return (_b = (_a = (tmSession !== null && tmSession !== void 0 ? tmSession : SDK_Globals.tmSession)) === null || _a === void 0 ? void 0 : _a.SessionDescr) === null || _b === void 0 ? void 0 : _b.accessToken;
|
|
969
|
+
}
|
|
970
|
+
static GetAsync(TID_1, layoutMode_1, tmSession_1) {
|
|
971
|
+
return __awaiter(this, arguments, void 0, function* (TID, layoutMode, tmSession, deepCopy = false, refreshCache = false) {
|
|
972
|
+
if (!TID)
|
|
973
|
+
return undefined;
|
|
974
|
+
return yield this.withLock(() => __awaiter(this, void 0, void 0, function* () {
|
|
975
|
+
const tms = tmSession !== null && tmSession !== void 0 ? tmSession : SDK_Globals.tmSession;
|
|
976
|
+
if (!tms)
|
|
977
|
+
throw new Error("No valid session available for DcmtTypeEngine.");
|
|
978
|
+
const accessToken = this.getAccessToken(tmSession);
|
|
979
|
+
const cacheKey = this.getCacheKey(TID, layoutMode);
|
|
980
|
+
if (refreshCache) {
|
|
981
|
+
this.Remove(TID, layoutMode, tmSession);
|
|
982
|
+
}
|
|
983
|
+
let layoutMap = this._cache.get(accessToken);
|
|
984
|
+
if (!layoutMap) {
|
|
985
|
+
layoutMap = new Map();
|
|
986
|
+
this._cache.set(accessToken, layoutMap);
|
|
987
|
+
}
|
|
988
|
+
let layout = layoutMap.get(cacheKey);
|
|
989
|
+
if (!layout) {
|
|
990
|
+
layout = yield tms.NewDcmtTypeEngine().LayoutRetrieveAsync(TID, layoutMode);
|
|
991
|
+
if (layout) {
|
|
992
|
+
layoutMap.set(cacheKey, layout);
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
console.warn(`LayoutRetrieveAsync(${TID}, ${layoutMode}) returned undefined for accessToken: ${accessToken}`);
|
|
996
|
+
return undefined;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return deepCopy ? this.cloneItem(layout) : layout;
|
|
1000
|
+
}));
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
static Remove(TID, layoutMode, tmSession) {
|
|
1004
|
+
if (!TID)
|
|
1005
|
+
return;
|
|
1006
|
+
const accessToken = this.getAccessToken(tmSession);
|
|
1007
|
+
const layoutMap = this._cache.get(accessToken);
|
|
1008
|
+
if (layoutMap) {
|
|
1009
|
+
const cacheKey = this.getCacheKey(TID, layoutMode);
|
|
1010
|
+
layoutMap.delete(cacheKey);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
static RemoveAllForTID(TID, tmSession) {
|
|
1014
|
+
if (!TID)
|
|
1015
|
+
return;
|
|
1016
|
+
const accessToken = this.getAccessToken(tmSession);
|
|
1017
|
+
const layoutMap = this._cache.get(accessToken);
|
|
1018
|
+
if (layoutMap) {
|
|
1019
|
+
const keysToDelete = [];
|
|
1020
|
+
layoutMap.forEach((_, key) => {
|
|
1021
|
+
if (key.startsWith(`${TID}_`)) {
|
|
1022
|
+
keysToDelete.push(key);
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
keysToDelete.forEach(key => layoutMap.delete(key));
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
static RemoveAll(tmSession) {
|
|
1029
|
+
const accessToken = this.getAccessToken(tmSession);
|
|
1030
|
+
this._cache.delete(accessToken);
|
|
1031
|
+
}
|
|
1032
|
+
static CacheCount(tmSession) {
|
|
1033
|
+
var _a, _b;
|
|
1034
|
+
const accessToken = this.getAccessToken(tmSession);
|
|
1035
|
+
return (_b = (_a = this._cache.get(accessToken)) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0;
|
|
1036
|
+
}
|
|
1037
|
+
static withLock(callback) {
|
|
1038
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1039
|
+
return yield this._mutex.runExclusive(callback);
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
static cloneItem(item) {
|
|
1043
|
+
const cloned = new LayoutDescriptor();
|
|
1044
|
+
cloned.init(Object.assign({}, item));
|
|
1045
|
+
return cloned;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
LayoutCacheService._mutex = new Mutex();
|
|
1049
|
+
LayoutCacheService._cache = new Map();
|