bruce-models 1.3.8 → 1.4.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.
- package/dist/bruce-models.es5.js +41 -17
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +41 -17
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/entity/entity.js +7 -3
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/user/user.js +34 -14
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/user/user.d.ts +2 -2
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1535,7 +1535,9 @@
|
|
|
1535
1535
|
try {
|
|
1536
1536
|
const data = yield req;
|
|
1537
1537
|
const item = data.Items.find(x => x.Bruce.ID == entityId);
|
|
1538
|
-
res(
|
|
1538
|
+
res({
|
|
1539
|
+
entity: item
|
|
1540
|
+
});
|
|
1539
1541
|
}
|
|
1540
1542
|
catch (e) {
|
|
1541
1543
|
// No showing error as we don't want to see it 2000 times.
|
|
@@ -1547,7 +1549,7 @@
|
|
|
1547
1549
|
}
|
|
1548
1550
|
}
|
|
1549
1551
|
return {
|
|
1550
|
-
entities: (yield Promise.all(reqs)).filter(x => !!x)
|
|
1552
|
+
entities: (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x)
|
|
1551
1553
|
};
|
|
1552
1554
|
});
|
|
1553
1555
|
}
|
|
@@ -1719,7 +1721,9 @@
|
|
|
1719
1721
|
for (let i = 0; i < entities.length; i++) {
|
|
1720
1722
|
const entity = entities[i];
|
|
1721
1723
|
const id = entity.Bruce.ID;
|
|
1722
|
-
api.Cache.Set(GetCacheKey(id),
|
|
1724
|
+
api.Cache.Set(GetCacheKey(id), {
|
|
1725
|
+
entity: entity
|
|
1726
|
+
}, exports.Api.DEFAULT_CACHE_DURATION);
|
|
1723
1727
|
}
|
|
1724
1728
|
return {
|
|
1725
1729
|
entities: entities
|
|
@@ -5857,11 +5861,19 @@
|
|
|
5857
5861
|
if (cacheData) {
|
|
5858
5862
|
return cacheData;
|
|
5859
5863
|
}
|
|
5860
|
-
const
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5864
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5865
|
+
try {
|
|
5866
|
+
const data = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
|
|
5867
|
+
res({
|
|
5868
|
+
user: data
|
|
5869
|
+
});
|
|
5870
|
+
}
|
|
5871
|
+
catch (e) {
|
|
5872
|
+
rej(e);
|
|
5873
|
+
}
|
|
5874
|
+
}));
|
|
5875
|
+
api.Cache.Set(GetCacheKey(id, accountId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5876
|
+
return prom;
|
|
5865
5877
|
});
|
|
5866
5878
|
}
|
|
5867
5879
|
User.Get = Get;
|
|
@@ -6002,11 +6014,19 @@
|
|
|
6002
6014
|
if (cacheData) {
|
|
6003
6015
|
return cacheData;
|
|
6004
6016
|
}
|
|
6005
|
-
const
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6017
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
6018
|
+
try {
|
|
6019
|
+
const data = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
|
|
6020
|
+
res({
|
|
6021
|
+
user: data
|
|
6022
|
+
});
|
|
6023
|
+
}
|
|
6024
|
+
catch (e) {
|
|
6025
|
+
rej(e);
|
|
6026
|
+
}
|
|
6027
|
+
}));
|
|
6028
|
+
api.Cache.Set(GetEmailCacheKey(email, accountId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
6029
|
+
return prom;
|
|
6010
6030
|
});
|
|
6011
6031
|
}
|
|
6012
6032
|
LoginUser.GetByEmail = GetByEmail;
|
|
@@ -6037,7 +6057,9 @@
|
|
|
6037
6057
|
req.then((data) => {
|
|
6038
6058
|
const users = data.users;
|
|
6039
6059
|
for (let i = 0; i < users.length; i++) {
|
|
6040
|
-
api.Cache.Set(GetCacheKey(users[i].ID, accountId),
|
|
6060
|
+
api.Cache.Set(GetCacheKey(users[i].ID, accountId), {
|
|
6061
|
+
user: users[i]
|
|
6062
|
+
});
|
|
6041
6063
|
}
|
|
6042
6064
|
});
|
|
6043
6065
|
if (!exclusive) {
|
|
@@ -6179,7 +6201,7 @@
|
|
|
6179
6201
|
try {
|
|
6180
6202
|
const data = yield api.GET("usersByClientAccount/accessTokens", reqParams);
|
|
6181
6203
|
res({
|
|
6182
|
-
|
|
6204
|
+
users: data.Items
|
|
6183
6205
|
});
|
|
6184
6206
|
}
|
|
6185
6207
|
catch (e) {
|
|
@@ -6189,7 +6211,9 @@
|
|
|
6189
6211
|
req.then((data) => {
|
|
6190
6212
|
const users = data.tokens;
|
|
6191
6213
|
for (let i = 0; i < users.length; i++) {
|
|
6192
|
-
api.Cache.Set(GetCacheKey(users[i].ID, accountId),
|
|
6214
|
+
api.Cache.Set(GetCacheKey(users[i].ID, accountId), {
|
|
6215
|
+
user: users[i]
|
|
6216
|
+
});
|
|
6193
6217
|
}
|
|
6194
6218
|
});
|
|
6195
6219
|
api.Cache.Set(GetListCacheKey(accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
|
|
@@ -6221,7 +6245,7 @@
|
|
|
6221
6245
|
data = yield api.POST("accessToken", data, reqParams);
|
|
6222
6246
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
6223
6247
|
return {
|
|
6224
|
-
|
|
6248
|
+
user: data
|
|
6225
6249
|
};
|
|
6226
6250
|
});
|
|
6227
6251
|
}
|