bruce-models 6.4.8 → 6.4.9
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/bruce-models.es5.js +85 -40
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +85 -40
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +29 -15
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/user/user.js +55 -24
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/account/account.d.ts +3 -2
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/user/user.d.ts +8 -5
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -11690,7 +11690,8 @@
|
|
|
11690
11690
|
if (!api) {
|
|
11691
11691
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
11692
11692
|
}
|
|
11693
|
-
const
|
|
11693
|
+
const cacheKey = GetCacheKey(api.GetSessionId(), id);
|
|
11694
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
11694
11695
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
11695
11696
|
return cache.data;
|
|
11696
11697
|
}
|
|
@@ -11714,7 +11715,7 @@
|
|
|
11714
11715
|
}
|
|
11715
11716
|
}));
|
|
11716
11717
|
api.SetCacheItem({
|
|
11717
|
-
key:
|
|
11718
|
+
key: cacheKey,
|
|
11718
11719
|
value: prom,
|
|
11719
11720
|
req: reqParams
|
|
11720
11721
|
});
|
|
@@ -11733,7 +11734,8 @@
|
|
|
11733
11734
|
if (!api) {
|
|
11734
11735
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
11735
11736
|
}
|
|
11736
|
-
const
|
|
11737
|
+
const cacheKey = GetCacheKey(api.GetSessionId(), subdomain);
|
|
11738
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
11737
11739
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
11738
11740
|
return cache.data;
|
|
11739
11741
|
}
|
|
@@ -11757,7 +11759,7 @@
|
|
|
11757
11759
|
}
|
|
11758
11760
|
}));
|
|
11759
11761
|
api.SetCacheItem({
|
|
11760
|
-
key:
|
|
11762
|
+
key: cacheKey,
|
|
11761
11763
|
value: prom,
|
|
11762
11764
|
req: reqParams
|
|
11763
11765
|
});
|
|
@@ -11776,7 +11778,8 @@
|
|
|
11776
11778
|
if (!api) {
|
|
11777
11779
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
11778
11780
|
}
|
|
11779
|
-
const
|
|
11781
|
+
const cacheKey = GetListCacheKey(api.GetSessionId(), userId, owned);
|
|
11782
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
11780
11783
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
11781
11784
|
return cache.data;
|
|
11782
11785
|
}
|
|
@@ -11802,7 +11805,7 @@
|
|
|
11802
11805
|
}
|
|
11803
11806
|
}));
|
|
11804
11807
|
api.SetCacheItem({
|
|
11805
|
-
key:
|
|
11808
|
+
key: cacheKey,
|
|
11806
11809
|
value: prom,
|
|
11807
11810
|
req: reqParams
|
|
11808
11811
|
});
|
|
@@ -11821,7 +11824,8 @@
|
|
|
11821
11824
|
if (!api) {
|
|
11822
11825
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
11823
11826
|
}
|
|
11824
|
-
const
|
|
11827
|
+
const cacheKey = GetCacheKey(api.GetSessionId(), id, appId);
|
|
11828
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
11825
11829
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
11826
11830
|
return cache.data;
|
|
11827
11831
|
}
|
|
@@ -11840,7 +11844,7 @@
|
|
|
11840
11844
|
}
|
|
11841
11845
|
}));
|
|
11842
11846
|
api.SetCacheItem({
|
|
11843
|
-
key:
|
|
11847
|
+
key: cacheKey,
|
|
11844
11848
|
value: prom,
|
|
11845
11849
|
req: reqParams
|
|
11846
11850
|
});
|
|
@@ -11861,7 +11865,7 @@
|
|
|
11861
11865
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
11862
11866
|
}
|
|
11863
11867
|
const res = yield api.POST(`account/${id}/applicationSettings/${appId}?Override=${override ? "true" : "false"}`, data, reqParams);
|
|
11864
|
-
api.Cache.
|
|
11868
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + id);
|
|
11865
11869
|
return {
|
|
11866
11870
|
settings: res
|
|
11867
11871
|
};
|
|
@@ -11894,7 +11898,7 @@
|
|
|
11894
11898
|
const resData = {
|
|
11895
11899
|
account: res
|
|
11896
11900
|
};
|
|
11897
|
-
api.Cache.
|
|
11901
|
+
api.Cache.RemoveByContains(GetListCacheKey(api.GetSessionId()));
|
|
11898
11902
|
return resData;
|
|
11899
11903
|
});
|
|
11900
11904
|
}
|
|
@@ -11927,15 +11931,19 @@
|
|
|
11927
11931
|
* const key = GetCacheKey(1);
|
|
11928
11932
|
* api.Cache.Remove(key);
|
|
11929
11933
|
* }
|
|
11934
|
+
* @param sessionId
|
|
11930
11935
|
* @param accountId
|
|
11931
11936
|
* @param appSettingsId
|
|
11932
11937
|
* @returns
|
|
11933
11938
|
*/
|
|
11934
|
-
function GetCacheKey(accountId, appSettingsId) {
|
|
11939
|
+
function GetCacheKey(sessionId, accountId, appSettingsId) {
|
|
11940
|
+
if (!sessionId) {
|
|
11941
|
+
sessionId = "anonymous";
|
|
11942
|
+
}
|
|
11935
11943
|
if (appSettingsId) {
|
|
11936
|
-
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey + appSettingsId;
|
|
11944
|
+
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey + appSettingsId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
|
|
11937
11945
|
}
|
|
11938
|
-
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
|
|
11946
|
+
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
|
|
11939
11947
|
}
|
|
11940
11948
|
Account.GetCacheKey = GetCacheKey;
|
|
11941
11949
|
/**
|
|
@@ -11948,11 +11956,17 @@
|
|
|
11948
11956
|
* @param ssid
|
|
11949
11957
|
* @returns
|
|
11950
11958
|
*/
|
|
11951
|
-
function GetListCacheKey(ssid, owned) {
|
|
11959
|
+
function GetListCacheKey(ssid, userId, owned) {
|
|
11952
11960
|
if (!owned) {
|
|
11953
11961
|
owned = false;
|
|
11954
11962
|
}
|
|
11955
|
-
|
|
11963
|
+
if (!ssid) {
|
|
11964
|
+
ssid = "anonymous";
|
|
11965
|
+
}
|
|
11966
|
+
if (!userId) {
|
|
11967
|
+
userId = "anonymous";
|
|
11968
|
+
}
|
|
11969
|
+
return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid + exports.Api.ECacheKey.Id + (owned ? "owned" : "related") + exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + userId;
|
|
11956
11970
|
}
|
|
11957
11971
|
Account.GetListCacheKey = GetListCacheKey;
|
|
11958
11972
|
/**
|
|
@@ -12515,7 +12529,7 @@
|
|
|
12515
12529
|
if (!api) {
|
|
12516
12530
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
12517
12531
|
}
|
|
12518
|
-
const cacheKey = GetCacheKey(id, accountId);
|
|
12532
|
+
const cacheKey = GetCacheKey(api.GetSessionId(), id, accountId);
|
|
12519
12533
|
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
12520
12534
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
12521
12535
|
return cache.data;
|
|
@@ -12579,10 +12593,10 @@
|
|
|
12579
12593
|
const res = yield api.POST(`user/${data.ID}`, data, reqParams);
|
|
12580
12594
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + data.ID);
|
|
12581
12595
|
if (data.Type == EType.AccessToken) {
|
|
12582
|
-
api.Cache.
|
|
12596
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
12583
12597
|
}
|
|
12584
12598
|
else if (data.Type == EType.User) {
|
|
12585
|
-
api.Cache.
|
|
12599
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account);
|
|
12586
12600
|
}
|
|
12587
12601
|
return {
|
|
12588
12602
|
user: res
|
|
@@ -12613,7 +12627,7 @@
|
|
|
12613
12627
|
}
|
|
12614
12628
|
const res = yield api.POST("user", data, reqParams);
|
|
12615
12629
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + data.ID);
|
|
12616
|
-
api.Cache.
|
|
12630
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account);
|
|
12617
12631
|
return {
|
|
12618
12632
|
user: res
|
|
12619
12633
|
};
|
|
@@ -12634,7 +12648,8 @@
|
|
|
12634
12648
|
if (!api) {
|
|
12635
12649
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
12636
12650
|
}
|
|
12637
|
-
const
|
|
12651
|
+
const cacheKey = GetSettingsCacheKey(api.GetSessionId(), userId, appId);
|
|
12652
|
+
const cache = api.GetCacheItem(cacheKey, req);
|
|
12638
12653
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
12639
12654
|
return cache.data;
|
|
12640
12655
|
}
|
|
@@ -12661,7 +12676,7 @@
|
|
|
12661
12676
|
}
|
|
12662
12677
|
}));
|
|
12663
12678
|
api.SetCacheItem({
|
|
12664
|
-
key:
|
|
12679
|
+
key: cacheKey,
|
|
12665
12680
|
value: prom,
|
|
12666
12681
|
req: req
|
|
12667
12682
|
});
|
|
@@ -12691,7 +12706,7 @@
|
|
|
12691
12706
|
UserID: userId
|
|
12692
12707
|
};
|
|
12693
12708
|
const prom = api.POST(`user/${userId}/application/${appId}/settings?Override=${override ? "true" : "false"}`, postBody, req);
|
|
12694
|
-
api.Cache.Remove(GetSettingsCacheKey(userId, appId));
|
|
12709
|
+
api.Cache.Remove(GetSettingsCacheKey(api.GetSessionId(), userId, appId));
|
|
12695
12710
|
return prom;
|
|
12696
12711
|
});
|
|
12697
12712
|
}
|
|
@@ -12740,14 +12755,20 @@
|
|
|
12740
12755
|
* @param search
|
|
12741
12756
|
* @returns
|
|
12742
12757
|
*/
|
|
12743
|
-
function GetListCacheKey(accountId, exclusive, search) {
|
|
12758
|
+
function GetListCacheKey(sessionId, accountId, exclusive, search) {
|
|
12744
12759
|
if (!exclusive) {
|
|
12745
12760
|
exclusive = false;
|
|
12746
12761
|
}
|
|
12747
12762
|
if (!search) {
|
|
12748
12763
|
search = "";
|
|
12749
12764
|
}
|
|
12750
|
-
|
|
12765
|
+
if (!sessionId) {
|
|
12766
|
+
sessionId = "anonymous";
|
|
12767
|
+
}
|
|
12768
|
+
if (!accountId) {
|
|
12769
|
+
accountId = "";
|
|
12770
|
+
}
|
|
12771
|
+
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Id + exclusive + exports.Api.ECacheKey.Id + search + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
|
|
12751
12772
|
}
|
|
12752
12773
|
LoginUser.GetListCacheKey = GetListCacheKey;
|
|
12753
12774
|
/**
|
|
@@ -12764,7 +12785,8 @@
|
|
|
12764
12785
|
if (!api) {
|
|
12765
12786
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
12766
12787
|
}
|
|
12767
|
-
const
|
|
12788
|
+
const cacheKey = GetEmailCacheKey(api.GetSessionId(), email, accountId);
|
|
12789
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
12768
12790
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
12769
12791
|
return cache.data;
|
|
12770
12792
|
}
|
|
@@ -12780,7 +12802,7 @@
|
|
|
12780
12802
|
}
|
|
12781
12803
|
}));
|
|
12782
12804
|
api.SetCacheItem({
|
|
12783
|
-
key:
|
|
12805
|
+
key: cacheKey,
|
|
12784
12806
|
value: prom,
|
|
12785
12807
|
req: reqParams
|
|
12786
12808
|
});
|
|
@@ -12802,7 +12824,8 @@
|
|
|
12802
12824
|
if (!exclusive) {
|
|
12803
12825
|
exclusive = false;
|
|
12804
12826
|
}
|
|
12805
|
-
const
|
|
12827
|
+
const sessionId = api.GetSessionId();
|
|
12828
|
+
const cacheKey = GetListCacheKey(sessionId, accountId, exclusive, search);
|
|
12806
12829
|
const cache = exclusive ? null : api.GetCacheItem(cacheKey, reqParams);
|
|
12807
12830
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
12808
12831
|
return cache.data;
|
|
@@ -12832,7 +12855,7 @@
|
|
|
12832
12855
|
const users = data.users;
|
|
12833
12856
|
for (let i = 0; i < users.length; i++) {
|
|
12834
12857
|
api.SetCacheItem({
|
|
12835
|
-
key: GetCacheKey(users[i].ID, accountId),
|
|
12858
|
+
key: GetCacheKey(sessionId, users[i].ID, accountId),
|
|
12836
12859
|
value: {
|
|
12837
12860
|
user: users[i]
|
|
12838
12861
|
},
|
|
@@ -12990,11 +13013,18 @@
|
|
|
12990
13013
|
* const key = GetListCacheKey("abc");
|
|
12991
13014
|
* api.Cache.Remove(key);
|
|
12992
13015
|
* }
|
|
13016
|
+
* @param sessionId
|
|
12993
13017
|
* @param accountId
|
|
12994
13018
|
* @returns
|
|
12995
13019
|
*/
|
|
12996
|
-
function GetListCacheKey(accountId) {
|
|
12997
|
-
|
|
13020
|
+
function GetListCacheKey(sessionId, accountId) {
|
|
13021
|
+
if (!sessionId) {
|
|
13022
|
+
sessionId = "anonymous";
|
|
13023
|
+
}
|
|
13024
|
+
if (!accountId) {
|
|
13025
|
+
accountId = "";
|
|
13026
|
+
}
|
|
13027
|
+
return exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
|
|
12998
13028
|
}
|
|
12999
13029
|
AccessToken.GetListCacheKey = GetListCacheKey;
|
|
13000
13030
|
/**
|
|
@@ -13008,7 +13038,8 @@
|
|
|
13008
13038
|
if (!api) {
|
|
13009
13039
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
13010
13040
|
}
|
|
13011
|
-
const
|
|
13041
|
+
const cacheKey = GetListCacheKey(api.GetSessionId(), accountId);
|
|
13042
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
13012
13043
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
13013
13044
|
return cache.data;
|
|
13014
13045
|
}
|
|
@@ -13024,7 +13055,7 @@
|
|
|
13024
13055
|
}
|
|
13025
13056
|
}));
|
|
13026
13057
|
api.SetCacheItem({
|
|
13027
|
-
key:
|
|
13058
|
+
key: cacheKey,
|
|
13028
13059
|
value: req,
|
|
13029
13060
|
req: reqParams
|
|
13030
13061
|
});
|
|
@@ -13044,7 +13075,7 @@
|
|
|
13044
13075
|
}
|
|
13045
13076
|
yield api.DELETE(`accessToken/${id}`, reqParams);
|
|
13046
13077
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + id);
|
|
13047
|
-
api.Cache.
|
|
13078
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
13048
13079
|
});
|
|
13049
13080
|
}
|
|
13050
13081
|
AccessToken.Delete = Delete;
|
|
@@ -13069,7 +13100,7 @@
|
|
|
13069
13100
|
data.Type = EType.AccessToken;
|
|
13070
13101
|
}
|
|
13071
13102
|
data = yield api.POST("accessToken", data, reqParams);
|
|
13072
|
-
api.Cache.
|
|
13103
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
13073
13104
|
return {
|
|
13074
13105
|
user: data
|
|
13075
13106
|
};
|
|
@@ -13104,15 +13135,19 @@
|
|
|
13104
13135
|
* const key = GetCacheKey("abc", "def");
|
|
13105
13136
|
* api.Cache.Remove(key);
|
|
13106
13137
|
* }
|
|
13138
|
+
* @param sessionId
|
|
13107
13139
|
* @param userId
|
|
13108
13140
|
* @param accountId
|
|
13109
13141
|
* @returns
|
|
13110
13142
|
*/
|
|
13111
|
-
function GetCacheKey(userId, accountId) {
|
|
13143
|
+
function GetCacheKey(sessionId, userId, accountId) {
|
|
13112
13144
|
if (!accountId) {
|
|
13113
13145
|
accountId = "";
|
|
13114
13146
|
}
|
|
13115
|
-
|
|
13147
|
+
if (!sessionId) {
|
|
13148
|
+
sessionId = "anonymous";
|
|
13149
|
+
}
|
|
13150
|
+
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + userId + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
|
|
13116
13151
|
}
|
|
13117
13152
|
User.GetCacheKey = GetCacheKey;
|
|
13118
13153
|
/**
|
|
@@ -13126,11 +13161,17 @@
|
|
|
13126
13161
|
* @param accountId
|
|
13127
13162
|
* @returns
|
|
13128
13163
|
*/
|
|
13129
|
-
function GetEmailCacheKey(email, accountId) {
|
|
13164
|
+
function GetEmailCacheKey(sessionId, email, accountId) {
|
|
13130
13165
|
if (!accountId) {
|
|
13131
13166
|
accountId = "";
|
|
13132
13167
|
}
|
|
13133
|
-
|
|
13168
|
+
if (!sessionId) {
|
|
13169
|
+
sessionId = "anonymous";
|
|
13170
|
+
}
|
|
13171
|
+
if (!email) {
|
|
13172
|
+
email = "";
|
|
13173
|
+
}
|
|
13174
|
+
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserEmail + email + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + sessionId;
|
|
13134
13175
|
}
|
|
13135
13176
|
User.GetEmailCacheKey = GetEmailCacheKey;
|
|
13136
13177
|
/**
|
|
@@ -13140,11 +13181,15 @@
|
|
|
13140
13181
|
* const key = GetCacheKey("abc", "def");
|
|
13141
13182
|
* api.Cache.Remove(key);
|
|
13142
13183
|
* }
|
|
13184
|
+
* @param sessionId
|
|
13143
13185
|
* @param userId
|
|
13144
13186
|
* @param appId
|
|
13145
13187
|
* @returns
|
|
13146
13188
|
*/
|
|
13147
|
-
function GetSettingsCacheKey(userId, appId) {
|
|
13189
|
+
function GetSettingsCacheKey(sessionId, userId, appId) {
|
|
13190
|
+
if (!sessionId) {
|
|
13191
|
+
sessionId = "anonymous";
|
|
13192
|
+
}
|
|
13148
13193
|
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserSettings + userId + exports.Api.ECacheKey.Id + appId;
|
|
13149
13194
|
}
|
|
13150
13195
|
User.GetSettingsCacheKey = GetSettingsCacheKey;
|
|
@@ -15750,7 +15795,7 @@
|
|
|
15750
15795
|
})(exports.Tracking || (exports.Tracking = {}));
|
|
15751
15796
|
|
|
15752
15797
|
// This is updated with the package.json version on build.
|
|
15753
|
-
const VERSION = "6.4.
|
|
15798
|
+
const VERSION = "6.4.9";
|
|
15754
15799
|
|
|
15755
15800
|
exports.VERSION = VERSION;
|
|
15756
15801
|
exports.AbstractApi = AbstractApi;
|