bruce-models 4.1.6 → 4.1.8
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 +61 -17
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +61 -17
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-features.js +8 -6
- package/dist/lib/account/account-features.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity.js +52 -10
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/account/account-features.d.ts +1 -3
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity.d.ts +4 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3253,11 +3253,18 @@
|
|
|
3253
3253
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3254
3254
|
try {
|
|
3255
3255
|
const urlParams = new URLSearchParams();
|
|
3256
|
+
let expand;
|
|
3256
3257
|
if (expandLocation) {
|
|
3257
|
-
|
|
3258
|
+
expand = "location";
|
|
3258
3259
|
}
|
|
3259
3260
|
if (expandRelations) {
|
|
3260
|
-
|
|
3261
|
+
if (expand) {
|
|
3262
|
+
expand += ",";
|
|
3263
|
+
}
|
|
3264
|
+
expand += "relation";
|
|
3265
|
+
}
|
|
3266
|
+
if (expand) {
|
|
3267
|
+
urlParams.append("$expand", expand);
|
|
3261
3268
|
}
|
|
3262
3269
|
if (entityTypeId) {
|
|
3263
3270
|
urlParams.append("BruceEntityType", entityTypeId);
|
|
@@ -3302,7 +3309,7 @@
|
|
|
3302
3309
|
*/
|
|
3303
3310
|
function GetListByIds(params) {
|
|
3304
3311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3305
|
-
let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3312
|
+
let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
|
|
3306
3313
|
if (!entityIds.length) {
|
|
3307
3314
|
throw ("Entity IDs are required.");
|
|
3308
3315
|
}
|
|
@@ -3333,8 +3340,16 @@
|
|
|
3333
3340
|
if (expandRelations) {
|
|
3334
3341
|
reqData["Expand"] = "relation";
|
|
3335
3342
|
}
|
|
3336
|
-
|
|
3337
|
-
reqData["Expand"]
|
|
3343
|
+
if (expandLocation) {
|
|
3344
|
+
if (reqData["Expand"]) {
|
|
3345
|
+
reqData["Expand"] += ",location";
|
|
3346
|
+
}
|
|
3347
|
+
else {
|
|
3348
|
+
reqData["Expand"] = "location";
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
if (expandSources) {
|
|
3352
|
+
reqData["ExpandSources"] = true;
|
|
3338
3353
|
}
|
|
3339
3354
|
if (historicKey) {
|
|
3340
3355
|
reqData["historicKey"] = historicKey;
|
|
@@ -3362,6 +3377,7 @@
|
|
|
3362
3377
|
entityId,
|
|
3363
3378
|
expandLocation,
|
|
3364
3379
|
expandRelations,
|
|
3380
|
+
expandSources,
|
|
3365
3381
|
entityTypeId: null,
|
|
3366
3382
|
historicFrom: historicFrom,
|
|
3367
3383
|
historicKey: historicKey,
|
|
@@ -3652,7 +3668,7 @@
|
|
|
3652
3668
|
function GetList(params) {
|
|
3653
3669
|
var _a;
|
|
3654
3670
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3655
|
-
let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3671
|
+
let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
|
|
3656
3672
|
if (!api) {
|
|
3657
3673
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3658
3674
|
}
|
|
@@ -3692,8 +3708,24 @@
|
|
|
3692
3708
|
historicKey: historicKey,
|
|
3693
3709
|
historicFrom: historicFrom,
|
|
3694
3710
|
historicTo: historicTo,
|
|
3695
|
-
historicPoint: historicPoint
|
|
3711
|
+
historicPoint: historicPoint,
|
|
3712
|
+
ExpandSources: expandSources
|
|
3696
3713
|
};
|
|
3714
|
+
if (expandLocation || expandRelations) {
|
|
3715
|
+
let expand = "";
|
|
3716
|
+
if (expandLocation) {
|
|
3717
|
+
expand += "location";
|
|
3718
|
+
}
|
|
3719
|
+
if (expandRelations) {
|
|
3720
|
+
if (expand) {
|
|
3721
|
+
expand += ",";
|
|
3722
|
+
}
|
|
3723
|
+
expand += "relation";
|
|
3724
|
+
}
|
|
3725
|
+
if (expand) {
|
|
3726
|
+
body["Expand"] = expand;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3697
3729
|
let totalCount;
|
|
3698
3730
|
let entities = [];
|
|
3699
3731
|
if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
|
|
@@ -3733,6 +3765,12 @@
|
|
|
3733
3765
|
if (expandRelations) {
|
|
3734
3766
|
urlParams.append("$expand", "relation");
|
|
3735
3767
|
}
|
|
3768
|
+
if (expandLocation) {
|
|
3769
|
+
urlParams.append("$expand", "location");
|
|
3770
|
+
}
|
|
3771
|
+
if (expandSources) {
|
|
3772
|
+
urlParams.append("ExpandSources", "true");
|
|
3773
|
+
}
|
|
3736
3774
|
if (historicKey) {
|
|
3737
3775
|
urlParams.set("historicKey", historicKey);
|
|
3738
3776
|
}
|
|
@@ -3761,6 +3799,9 @@
|
|
|
3761
3799
|
if (expandRelations) {
|
|
3762
3800
|
urlParams.append("$expand", "relation");
|
|
3763
3801
|
}
|
|
3802
|
+
if (expandLocation) {
|
|
3803
|
+
urlParams.append("$expand", "location");
|
|
3804
|
+
}
|
|
3764
3805
|
if (schemaId) {
|
|
3765
3806
|
urlParams.set("schema", schemaId);
|
|
3766
3807
|
}
|
|
@@ -3776,7 +3817,8 @@
|
|
|
3776
3817
|
key: GetCacheKey({
|
|
3777
3818
|
entityId: id,
|
|
3778
3819
|
expandRelations,
|
|
3779
|
-
expandLocation
|
|
3820
|
+
expandLocation,
|
|
3821
|
+
expandSources,
|
|
3780
3822
|
entityTypeId: filter.entityTypeId,
|
|
3781
3823
|
historicFrom: historicFrom,
|
|
3782
3824
|
historicKey: historicKey,
|
|
@@ -3929,7 +3971,7 @@
|
|
|
3929
3971
|
* @returns
|
|
3930
3972
|
*/
|
|
3931
3973
|
function GetCacheKey(params) {
|
|
3932
|
-
let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3974
|
+
let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3933
3975
|
if (!entityTypeId) {
|
|
3934
3976
|
entityTypeId = "";
|
|
3935
3977
|
}
|
|
@@ -3949,7 +3991,7 @@
|
|
|
3949
3991
|
schemaId = "";
|
|
3950
3992
|
}
|
|
3951
3993
|
let key = `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
|
|
3952
|
-
key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}`;
|
|
3994
|
+
key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}`;
|
|
3953
3995
|
key += `${exports.Api.ECacheKey.EntityHistoricData}${exports.Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
|
|
3954
3996
|
return key;
|
|
3955
3997
|
}
|
|
@@ -11157,17 +11199,18 @@
|
|
|
11157
11199
|
EFeature["EntityLexicalSearch"] = "Feature_Entity_Lexical_Search";
|
|
11158
11200
|
})(EFeature = AccountFeatures.EFeature || (AccountFeatures.EFeature = {}));
|
|
11159
11201
|
/**
|
|
11160
|
-
* Gets account features corresponding to
|
|
11202
|
+
* Gets account features corresponding to the API instance's account.
|
|
11161
11203
|
* @param params
|
|
11162
11204
|
* @returns
|
|
11163
11205
|
*/
|
|
11164
11206
|
function Get(params) {
|
|
11165
11207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11166
|
-
let { api,
|
|
11208
|
+
let { api, req: reqParams } = params;
|
|
11167
11209
|
if (!api) {
|
|
11168
11210
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
11169
11211
|
}
|
|
11170
|
-
const
|
|
11212
|
+
const accountId = api.AccountId;
|
|
11213
|
+
const cache = yield api.GetCacheItem(GetCacheKey(accountId), reqParams);
|
|
11171
11214
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
11172
11215
|
return cache.data;
|
|
11173
11216
|
}
|
|
@@ -11184,7 +11227,7 @@
|
|
|
11184
11227
|
}
|
|
11185
11228
|
}));
|
|
11186
11229
|
api.SetCacheItem({
|
|
11187
|
-
key: GetCacheKey(
|
|
11230
|
+
key: GetCacheKey(accountId),
|
|
11188
11231
|
value: prom,
|
|
11189
11232
|
req: reqParams
|
|
11190
11233
|
});
|
|
@@ -11194,10 +11237,11 @@
|
|
|
11194
11237
|
AccountFeatures.Get = Get;
|
|
11195
11238
|
function Update(params) {
|
|
11196
11239
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11197
|
-
let { api,
|
|
11240
|
+
let { api, features, req: reqParams } = params;
|
|
11198
11241
|
if (!api) {
|
|
11199
11242
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
11200
11243
|
}
|
|
11244
|
+
const accountId = api.AccountId;
|
|
11201
11245
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
11202
11246
|
try {
|
|
11203
11247
|
const data = yield api.POST("features", {
|
|
@@ -11212,7 +11256,7 @@
|
|
|
11212
11256
|
rej(e);
|
|
11213
11257
|
}
|
|
11214
11258
|
}));
|
|
11215
|
-
api.Cache.Remove(GetCacheKey(
|
|
11259
|
+
api.Cache.Remove(GetCacheKey(accountId));
|
|
11216
11260
|
return prom;
|
|
11217
11261
|
});
|
|
11218
11262
|
}
|
|
@@ -12848,7 +12892,7 @@
|
|
|
12848
12892
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
12849
12893
|
|
|
12850
12894
|
// This is updated with the package.json version on build.
|
|
12851
|
-
const VERSION = "4.1.
|
|
12895
|
+
const VERSION = "4.1.8";
|
|
12852
12896
|
|
|
12853
12897
|
exports.VERSION = VERSION;
|
|
12854
12898
|
exports.AbstractApi = AbstractApi;
|