bruce-models 3.6.9 → 3.7.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 +94 -2
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +88 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +2 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/types/bruce-models.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -9756,6 +9756,93 @@
|
|
|
9756
9756
|
AccountInvite.Create = Create;
|
|
9757
9757
|
})(exports.AccountInvite || (exports.AccountInvite = {}));
|
|
9758
9758
|
|
|
9759
|
+
(function (AccountFeatures) {
|
|
9760
|
+
let EFeature;
|
|
9761
|
+
(function (EFeature) {
|
|
9762
|
+
// Flag to enable data to be stored in the JSON column type.
|
|
9763
|
+
// This will enable conversion of the data, and will also enable searches to use that instead.
|
|
9764
|
+
EFeature["EntityJsonData"] = "Feature_Entity_JSONData";
|
|
9765
|
+
// Flag to enable a text search against JSON data values.
|
|
9766
|
+
// 'EntityJsonData' must also be enabled.
|
|
9767
|
+
EFeature["EntityLexicalSearch"] = "Feature_Entity_Lexical_Search";
|
|
9768
|
+
})(EFeature = AccountFeatures.EFeature || (AccountFeatures.EFeature = {}));
|
|
9769
|
+
/**
|
|
9770
|
+
* Gets account features corresponding to an account ID.
|
|
9771
|
+
* @param params
|
|
9772
|
+
* @returns
|
|
9773
|
+
*/
|
|
9774
|
+
function Get(params) {
|
|
9775
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9776
|
+
let { api, accountId: id, req: reqParams } = params;
|
|
9777
|
+
if (!api) {
|
|
9778
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
9779
|
+
}
|
|
9780
|
+
const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
9781
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
9782
|
+
return cache.data;
|
|
9783
|
+
}
|
|
9784
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9785
|
+
try {
|
|
9786
|
+
const data = yield api.GET("features", reqParams);
|
|
9787
|
+
const features = data === null || data === void 0 ? void 0 : data.Features;
|
|
9788
|
+
res({
|
|
9789
|
+
features: features ? features : {}
|
|
9790
|
+
});
|
|
9791
|
+
}
|
|
9792
|
+
catch (e) {
|
|
9793
|
+
rej(e);
|
|
9794
|
+
}
|
|
9795
|
+
}));
|
|
9796
|
+
api.SetCacheItem({
|
|
9797
|
+
key: GetCacheKey(id),
|
|
9798
|
+
value: prom,
|
|
9799
|
+
req: reqParams
|
|
9800
|
+
});
|
|
9801
|
+
return prom;
|
|
9802
|
+
});
|
|
9803
|
+
}
|
|
9804
|
+
AccountFeatures.Get = Get;
|
|
9805
|
+
function Update(params) {
|
|
9806
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9807
|
+
let { api, accountId: id, features, req: reqParams } = params;
|
|
9808
|
+
if (!api) {
|
|
9809
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
9810
|
+
}
|
|
9811
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9812
|
+
try {
|
|
9813
|
+
const data = yield api.POST("features", {
|
|
9814
|
+
Features: features
|
|
9815
|
+
}, reqParams);
|
|
9816
|
+
const updated = data === null || data === void 0 ? void 0 : data.Features;
|
|
9817
|
+
res({
|
|
9818
|
+
features: updated ? updated : {}
|
|
9819
|
+
});
|
|
9820
|
+
}
|
|
9821
|
+
catch (e) {
|
|
9822
|
+
rej(e);
|
|
9823
|
+
}
|
|
9824
|
+
}));
|
|
9825
|
+
api.Cache.Remove(GetCacheKey(id));
|
|
9826
|
+
return prom;
|
|
9827
|
+
});
|
|
9828
|
+
}
|
|
9829
|
+
AccountFeatures.Update = Update;
|
|
9830
|
+
/**
|
|
9831
|
+
* Returns cache identifier for an account by ID.
|
|
9832
|
+
* Example: {
|
|
9833
|
+
* const api: BruceApi.Api = ...;
|
|
9834
|
+
* const key = GetCacheKey("my-account-id");
|
|
9835
|
+
* api.Cache.Remove(key);
|
|
9836
|
+
* }
|
|
9837
|
+
* @param accountId
|
|
9838
|
+
* @returns
|
|
9839
|
+
*/
|
|
9840
|
+
function GetCacheKey(accountId) {
|
|
9841
|
+
return exports.Api.ECacheKey.AccountFeatures + exports.Api.ECacheKey.Id + accountId;
|
|
9842
|
+
}
|
|
9843
|
+
AccountFeatures.GetCacheKey = GetCacheKey;
|
|
9844
|
+
})(exports.AccountFeatures || (exports.AccountFeatures = {}));
|
|
9845
|
+
|
|
9759
9846
|
(function (EncryptUtils) {
|
|
9760
9847
|
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
9761
9848
|
function Cyrb53Hash(str, seed = 0) {
|
|
@@ -10744,7 +10831,7 @@
|
|
|
10744
10831
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
10745
10832
|
|
|
10746
10833
|
// This is updated with the package.json version on build.
|
|
10747
|
-
const VERSION = "3.
|
|
10834
|
+
const VERSION = "3.7.0";
|
|
10748
10835
|
|
|
10749
10836
|
exports.VERSION = VERSION;
|
|
10750
10837
|
exports.AbstractApi = AbstractApi;
|