bruce-models 3.3.2 → 3.3.3
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 +65 -7
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +65 -7
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +64 -6
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/types/account/account.d.ts +12 -0
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -874,19 +874,77 @@
|
|
|
874
874
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
875
875
|
return cache.data;
|
|
876
876
|
}
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
877
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
878
|
+
try {
|
|
879
|
+
const data = yield api.GET(`accountbyid/${id}`, reqParams);
|
|
880
|
+
// Update the cache by subdomain as well in case it's different to the ID.
|
|
881
|
+
if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
|
|
882
|
+
yield api.SetCacheItem({
|
|
883
|
+
key: data.Subdomain,
|
|
884
|
+
value: prom,
|
|
885
|
+
req: reqParams
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
res({
|
|
889
|
+
account: data
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
catch (e) {
|
|
893
|
+
rej(e);
|
|
894
|
+
}
|
|
895
|
+
}));
|
|
881
896
|
yield api.SetCacheItem({
|
|
882
897
|
key: GetCacheKey(id),
|
|
883
|
-
value:
|
|
898
|
+
value: prom,
|
|
884
899
|
req: reqParams
|
|
885
900
|
});
|
|
886
|
-
return
|
|
901
|
+
return prom;
|
|
887
902
|
});
|
|
888
903
|
}
|
|
889
904
|
Account.Get = Get;
|
|
905
|
+
/**
|
|
906
|
+
* Returns a client account record by subdomain or ID.
|
|
907
|
+
* @param params
|
|
908
|
+
* @returns
|
|
909
|
+
*/
|
|
910
|
+
function GetBySubdomain(params) {
|
|
911
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
912
|
+
let { api, subdomain, req: reqParams } = params;
|
|
913
|
+
if (!api) {
|
|
914
|
+
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
915
|
+
}
|
|
916
|
+
const cache = yield api.GetCacheItem(GetCacheKey(subdomain), reqParams);
|
|
917
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
918
|
+
return cache.data;
|
|
919
|
+
}
|
|
920
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
921
|
+
try {
|
|
922
|
+
const data = yield api.GET(`account/${subdomain}`, reqParams);
|
|
923
|
+
// Update the cache by ID as well in case it's different to the subdomain.
|
|
924
|
+
if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
|
|
925
|
+
yield api.SetCacheItem({
|
|
926
|
+
key: data.ID,
|
|
927
|
+
value: prom,
|
|
928
|
+
req: reqParams
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
res({
|
|
932
|
+
account: data
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
catch (e) {
|
|
936
|
+
rej(e);
|
|
937
|
+
}
|
|
938
|
+
}));
|
|
939
|
+
yield api.SetCacheItem({
|
|
940
|
+
key: GetCacheKey(subdomain),
|
|
941
|
+
value: prom,
|
|
942
|
+
req: reqParams
|
|
943
|
+
});
|
|
944
|
+
return prom;
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
Account.GetBySubdomain = GetBySubdomain;
|
|
890
948
|
/**
|
|
891
949
|
* Gets a list of client accounts related to the current session user.
|
|
892
950
|
* @param params
|
|
@@ -10371,7 +10429,7 @@
|
|
|
10371
10429
|
DataSource.GetList = GetList;
|
|
10372
10430
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
10373
10431
|
|
|
10374
|
-
const VERSION = "3.3.
|
|
10432
|
+
const VERSION = "3.3.3";
|
|
10375
10433
|
|
|
10376
10434
|
exports.VERSION = VERSION;
|
|
10377
10435
|
exports.AbstractApi = AbstractApi;
|