bruce-models 3.9.1 → 3.9.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 +220 -128
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +219 -127
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js +2 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/common/cache.js +7 -0
- package/dist/lib/common/cache.js.map +1 -1
- package/dist/lib/entity/entity-historic-data.js +70 -3
- package/dist/lib/entity/entity-historic-data.js.map +1 -1
- package/dist/lib/entity/entity.js +19 -2
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/api/api.d.ts +3 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/common/cache.d.ts +5 -0
- package/dist/types/entity/entity-historic-data.d.ts +3 -0
- package/dist/types/entity/entity.d.ts +1 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -73,6 +73,8 @@ var Api;
|
|
|
73
73
|
ECacheKey["Plugin"] = "plugin";
|
|
74
74
|
ECacheKey["PluginIndexFile"] = "pluginindexfile";
|
|
75
75
|
ECacheKey["EntityHistoricData"] = "entityhistoricdata";
|
|
76
|
+
ECacheKey["EntityHistoricDataRec"] = "entityhistoricdatarec";
|
|
77
|
+
ECacheKey["EntityHistoricDataStats"] = "entityhistoricdatastats";
|
|
76
78
|
})(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
|
|
77
79
|
// 1 minute.
|
|
78
80
|
Api.DEFAULT_CACHE_DURATION = 60 * 1000;
|
|
@@ -239,6 +241,13 @@ class CacheControl {
|
|
|
239
241
|
RemoveByContains(text) {
|
|
240
242
|
this.RemoveBy(key => String(key).includes(String(text)));
|
|
241
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Removes items based on a callback's response.
|
|
246
|
+
* @param callback
|
|
247
|
+
*/
|
|
248
|
+
RemoveByCallback(callback) {
|
|
249
|
+
this.RemoveBy(callback);
|
|
250
|
+
}
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
// TODO: Currently checks for CSV vs json specifically,
|
|
@@ -3041,6 +3050,198 @@ var ZoomControl;
|
|
|
3041
3050
|
})(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
|
|
3042
3051
|
})(ZoomControl || (ZoomControl = {}));
|
|
3043
3052
|
|
|
3053
|
+
var EntityHistoricData;
|
|
3054
|
+
(function (EntityHistoricData) {
|
|
3055
|
+
/**
|
|
3056
|
+
* Returns historic data for an array of Entity IDs.
|
|
3057
|
+
* A maximum number of records will be returned per Entity ID, this information is returned in the response.
|
|
3058
|
+
* @param params
|
|
3059
|
+
* @returns
|
|
3060
|
+
*/
|
|
3061
|
+
function GetList(params) {
|
|
3062
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3063
|
+
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
3064
|
+
// Save time and just return a none response if no entity IDs are provided.
|
|
3065
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3066
|
+
return {
|
|
3067
|
+
limitPerEntity: 0,
|
|
3068
|
+
recordsByIds: {}
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
if (!api) {
|
|
3072
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
3073
|
+
}
|
|
3074
|
+
if (typeof attrKey != "string") {
|
|
3075
|
+
attrKey = PathUtils.Wrap(attrKey);
|
|
3076
|
+
}
|
|
3077
|
+
const cacheKey = GetListCacheKey(entityIds, attrKey, dateTimeFrom, dateTimeTo);
|
|
3078
|
+
const cached = api.GetCacheItem(cacheKey, req);
|
|
3079
|
+
if (cached === null || cached === void 0 ? void 0 : cached.found) {
|
|
3080
|
+
return cached.data;
|
|
3081
|
+
}
|
|
3082
|
+
const urlParams = new URLSearchParams();
|
|
3083
|
+
for (const entityId of entityIds) {
|
|
3084
|
+
urlParams.append("entityId", entityId);
|
|
3085
|
+
}
|
|
3086
|
+
urlParams.append("attrKey", attrKey);
|
|
3087
|
+
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
3088
|
+
urlParams.append("dateTimeTo", dateTimeTo);
|
|
3089
|
+
const prom = api.GET(`v1/entity/historicData?${urlParams.toString()}`, Api.PrepReqParams(req));
|
|
3090
|
+
api.SetCacheItem({
|
|
3091
|
+
key: cacheKey,
|
|
3092
|
+
value: prom,
|
|
3093
|
+
req: req,
|
|
3094
|
+
// Short cache. 30 seconds.
|
|
3095
|
+
duration: 30000
|
|
3096
|
+
});
|
|
3097
|
+
return prom;
|
|
3098
|
+
});
|
|
3099
|
+
}
|
|
3100
|
+
EntityHistoricData.GetList = GetList;
|
|
3101
|
+
/**
|
|
3102
|
+
* Returns historic data statistics for an array of Entity IDs.
|
|
3103
|
+
* @param params
|
|
3104
|
+
* @returns
|
|
3105
|
+
*/
|
|
3106
|
+
function GetStats(params) {
|
|
3107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3108
|
+
let { entityIds, api, req } = params;
|
|
3109
|
+
// Save time and just return a none response if no entity IDs are provided.
|
|
3110
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3111
|
+
return {
|
|
3112
|
+
stats: []
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
if (!api) {
|
|
3116
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
3117
|
+
}
|
|
3118
|
+
req = Api.PrepReqParams(req);
|
|
3119
|
+
const cacheKey = GetStatsCacheKey(entityIds);
|
|
3120
|
+
const cached = api.GetCacheItem(cacheKey, req);
|
|
3121
|
+
if (cached === null || cached === void 0 ? void 0 : cached.found) {
|
|
3122
|
+
return cached.data;
|
|
3123
|
+
}
|
|
3124
|
+
const prom = yield api.POST("v1/entity/historicData/stats", {
|
|
3125
|
+
entityIds: entityIds
|
|
3126
|
+
}, req);
|
|
3127
|
+
api.SetCacheItem({
|
|
3128
|
+
key: cacheKey,
|
|
3129
|
+
value: prom,
|
|
3130
|
+
req: req,
|
|
3131
|
+
// Short cache. 60 seconds.
|
|
3132
|
+
duration: 60000
|
|
3133
|
+
});
|
|
3134
|
+
return prom;
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3137
|
+
EntityHistoricData.GetStats = GetStats;
|
|
3138
|
+
/**
|
|
3139
|
+
* Creates or updates historic data records.
|
|
3140
|
+
* Please note that the expected input/output does not include internal fields found inside the "Bruce" attribute.
|
|
3141
|
+
* @param params
|
|
3142
|
+
* @returns
|
|
3143
|
+
*/
|
|
3144
|
+
function Update(params) {
|
|
3145
|
+
var _a;
|
|
3146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3147
|
+
let { records, api, req } = params;
|
|
3148
|
+
// Save time and just return a none response if no records are provided.
|
|
3149
|
+
if (!(records === null || records === void 0 ? void 0 : records.length)) {
|
|
3150
|
+
return {
|
|
3151
|
+
records: []
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
if (!api) {
|
|
3155
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
3156
|
+
}
|
|
3157
|
+
const res = yield api.POST("v1/entity/historicData", {
|
|
3158
|
+
records: records
|
|
3159
|
+
}, Api.PrepReqParams(req));
|
|
3160
|
+
// Kill cache for every unique attrKey.
|
|
3161
|
+
let attrKeys = records.map(r => r.attrKey);
|
|
3162
|
+
attrKeys = attrKeys.filter((v, i) => attrKeys.indexOf(v) === i);
|
|
3163
|
+
for (const attrKey of attrKeys) {
|
|
3164
|
+
api.Cache.RemoveByContains(Entity.GetHistoricContainsKey(attrKey));
|
|
3165
|
+
}
|
|
3166
|
+
// Kill any stats cache that includes any of the Entity IDs.
|
|
3167
|
+
if ((_a = res.records) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3168
|
+
const entityIds = res.records.map(r => r.entityId).filter((v, i) => v && res.records.indexOf(v) === i);
|
|
3169
|
+
ClearCacheByEntityIds(api, entityIds);
|
|
3170
|
+
}
|
|
3171
|
+
return res;
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
EntityHistoricData.Update = Update;
|
|
3175
|
+
/**
|
|
3176
|
+
* Deletes historic data records for an array of Entity IDs.
|
|
3177
|
+
* This deletes all records within a provided key + range.
|
|
3178
|
+
* @param params
|
|
3179
|
+
* @returns
|
|
3180
|
+
*/
|
|
3181
|
+
function Delete(params) {
|
|
3182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3183
|
+
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
3184
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3185
|
+
return;
|
|
3186
|
+
}
|
|
3187
|
+
if (!api) {
|
|
3188
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
3189
|
+
}
|
|
3190
|
+
if (!attrKey || !dateTimeFrom || !dateTimeTo) {
|
|
3191
|
+
throw new Error("Invalid parameters provided.");
|
|
3192
|
+
}
|
|
3193
|
+
if (typeof attrKey != "string") {
|
|
3194
|
+
attrKey = PathUtils.Wrap(attrKey);
|
|
3195
|
+
}
|
|
3196
|
+
const urlParams = new URLSearchParams();
|
|
3197
|
+
for (const entityId of entityIds) {
|
|
3198
|
+
urlParams.append("entityId", entityId);
|
|
3199
|
+
}
|
|
3200
|
+
urlParams.append("attrKey", attrKey);
|
|
3201
|
+
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
3202
|
+
urlParams.append("dateTimeTo", dateTimeTo);
|
|
3203
|
+
yield api.DELETE(`v1/entity/historicData?${urlParams.toString()}`, Api.PrepReqParams(req));
|
|
3204
|
+
// Kill cache for all Entity cached Entity records related to the attrKey.
|
|
3205
|
+
api.Cache.RemoveByContains(Entity.GetHistoricContainsKey(attrKey));
|
|
3206
|
+
// Kill any stats cache that includes any of the Entity IDs.
|
|
3207
|
+
ClearCacheByEntityIds(api, entityIds);
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
EntityHistoricData.Delete = Delete;
|
|
3211
|
+
function GetListCacheKey(entityIds, attrKey, dateTimeFrom, dateTimeTo) {
|
|
3212
|
+
return Api.ECacheKey.EntityHistoricDataRec + Api.ECacheKey.Id + entityIds.join(",") + Api.ECacheKey.Id + attrKey + Api.ECacheKey.Id + dateTimeFrom + Api.ECacheKey.Id + dateTimeTo;
|
|
3213
|
+
}
|
|
3214
|
+
EntityHistoricData.GetListCacheKey = GetListCacheKey;
|
|
3215
|
+
function GetStatsCacheKey(entityIds) {
|
|
3216
|
+
return Api.ECacheKey.EntityHistoricDataStats + Api.ECacheKey.Id + entityIds.join(",");
|
|
3217
|
+
}
|
|
3218
|
+
EntityHistoricData.GetStatsCacheKey = GetStatsCacheKey;
|
|
3219
|
+
function ClearCacheByEntityIds(api, entityIds) {
|
|
3220
|
+
if (!api || !(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3221
|
+
return;
|
|
3222
|
+
}
|
|
3223
|
+
const REC_KEY_PREFIX = Api.ECacheKey.EntityHistoricDataRec + Api.ECacheKey.Id;
|
|
3224
|
+
const STATS_KEY_PREFIX = Api.ECacheKey.EntityHistoricDataStats + Api.ECacheKey.Id;
|
|
3225
|
+
api.Cache.RemoveByCallback((key) => {
|
|
3226
|
+
let keyStr = String(key);
|
|
3227
|
+
if (!keyStr.startsWith(STATS_KEY_PREFIX) && !keyStr.startsWith(REC_KEY_PREFIX)) {
|
|
3228
|
+
return false;
|
|
3229
|
+
}
|
|
3230
|
+
// Shorten to speed up the next step.
|
|
3231
|
+
keyStr = keyStr.replace(STATS_KEY_PREFIX, "").replace(REC_KEY_PREFIX, "");
|
|
3232
|
+
// Look for any matching Entity IDs.
|
|
3233
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
3234
|
+
const entityId = entityIds[i];
|
|
3235
|
+
if (keyStr.includes(entityId)) {
|
|
3236
|
+
return true;
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
return false;
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
EntityHistoricData.ClearCacheByEntityIds = ClearCacheByEntityIds;
|
|
3243
|
+
})(EntityHistoricData || (EntityHistoricData = {}));
|
|
3244
|
+
|
|
3044
3245
|
/**
|
|
3045
3246
|
* Describes the "Entity" concept within Nextspace.
|
|
3046
3247
|
* An entity is a JSON blob containing both internal data and user-defined data.
|
|
@@ -3125,7 +3326,7 @@ var Entity;
|
|
|
3125
3326
|
*/
|
|
3126
3327
|
function GetListByIds(params) {
|
|
3127
3328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3128
|
-
let { api, entityIds, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo } = params;
|
|
3329
|
+
let { api, entityIds, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3129
3330
|
if (!entityIds.length) {
|
|
3130
3331
|
throw ("Entity IDs are required.");
|
|
3131
3332
|
}
|
|
@@ -3159,6 +3360,18 @@ var Entity;
|
|
|
3159
3360
|
else if (expandLocation) {
|
|
3160
3361
|
reqData["Expand"] = "location";
|
|
3161
3362
|
}
|
|
3363
|
+
if (historicKey) {
|
|
3364
|
+
reqData["historicKey"] = historicKey;
|
|
3365
|
+
}
|
|
3366
|
+
if (historicFrom) {
|
|
3367
|
+
reqData["historicFrom"] = historicFrom;
|
|
3368
|
+
}
|
|
3369
|
+
if (historicTo) {
|
|
3370
|
+
reqData["historicTo"] = historicTo;
|
|
3371
|
+
}
|
|
3372
|
+
if (historicPoint) {
|
|
3373
|
+
reqData["historicPoint"] = historicPoint;
|
|
3374
|
+
}
|
|
3162
3375
|
const reqs = [];
|
|
3163
3376
|
if (reqIds.length > 0) {
|
|
3164
3377
|
const req = api.POST("entities", reqData, Api.PrepReqParams(reqParams));
|
|
@@ -3171,7 +3384,8 @@ var Entity;
|
|
|
3171
3384
|
entityTypeId: null,
|
|
3172
3385
|
historicFrom: historicFrom,
|
|
3173
3386
|
historicKey: historicKey,
|
|
3174
|
-
historicTo: historicTo
|
|
3387
|
+
historicTo: historicTo,
|
|
3388
|
+
historicPoint: historicPoint
|
|
3175
3389
|
});
|
|
3176
3390
|
const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
|
|
3177
3391
|
try {
|
|
@@ -3229,6 +3443,7 @@ var Entity;
|
|
|
3229
3443
|
}
|
|
3230
3444
|
yield api.DELETE(`entity/${entityId}`, Api.PrepReqParams(reqParams));
|
|
3231
3445
|
api.Cache.RemoveByContains(GetContainsKey(entityId));
|
|
3446
|
+
EntityHistoricData.ClearCacheByEntityIds(api, [entityId]);
|
|
3232
3447
|
});
|
|
3233
3448
|
}
|
|
3234
3449
|
Entity.Delete = Delete;
|
|
@@ -3252,6 +3467,7 @@ var Entity;
|
|
|
3252
3467
|
const entityId = entityIds[i];
|
|
3253
3468
|
api.Cache.RemoveByContains(GetContainsKey(entityId));
|
|
3254
3469
|
}
|
|
3470
|
+
EntityHistoricData.ClearCacheByEntityIds(api, entityIds);
|
|
3255
3471
|
});
|
|
3256
3472
|
}
|
|
3257
3473
|
Entity.DeleteList = DeleteList;
|
|
@@ -3276,6 +3492,7 @@ var Entity;
|
|
|
3276
3492
|
const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
|
|
3277
3493
|
const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
|
|
3278
3494
|
api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
|
|
3495
|
+
EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
|
|
3279
3496
|
return {
|
|
3280
3497
|
entity: res
|
|
3281
3498
|
};
|
|
@@ -6801,131 +7018,6 @@ var EntityAttribute;
|
|
|
6801
7018
|
EntityAttribute.AddAttribute = AddAttribute;
|
|
6802
7019
|
})(EntityAttribute || (EntityAttribute = {}));
|
|
6803
7020
|
|
|
6804
|
-
var EntityHistoricData;
|
|
6805
|
-
(function (EntityHistoricData) {
|
|
6806
|
-
/**
|
|
6807
|
-
* Returns historic data for an array of Entity IDs.
|
|
6808
|
-
* A maximum number of records will be returned per Entity ID, this information is returned in the response.
|
|
6809
|
-
* @param params
|
|
6810
|
-
* @returns
|
|
6811
|
-
*/
|
|
6812
|
-
function GetList(params) {
|
|
6813
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6814
|
-
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
6815
|
-
// Save time and just return a none response if no entity IDs are provided.
|
|
6816
|
-
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
6817
|
-
return {
|
|
6818
|
-
limitPerEntity: 0,
|
|
6819
|
-
recordsByIds: {}
|
|
6820
|
-
};
|
|
6821
|
-
}
|
|
6822
|
-
if (!api) {
|
|
6823
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
6824
|
-
}
|
|
6825
|
-
if (typeof attrKey != "string") {
|
|
6826
|
-
attrKey = PathUtils.Wrap(attrKey);
|
|
6827
|
-
}
|
|
6828
|
-
const urlParams = new URLSearchParams();
|
|
6829
|
-
for (const entityId of entityIds) {
|
|
6830
|
-
urlParams.append("entityId", entityId);
|
|
6831
|
-
}
|
|
6832
|
-
urlParams.append("attrKey", attrKey);
|
|
6833
|
-
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
6834
|
-
urlParams.append("dateTimeTo", dateTimeTo);
|
|
6835
|
-
return yield api.GET(`v1/entity/historicData?${urlParams.toString()}`, Api.PrepReqParams(req));
|
|
6836
|
-
});
|
|
6837
|
-
}
|
|
6838
|
-
EntityHistoricData.GetList = GetList;
|
|
6839
|
-
/**
|
|
6840
|
-
* Returns historic data statistics for an array of Entity IDs.
|
|
6841
|
-
* @param params
|
|
6842
|
-
* @returns
|
|
6843
|
-
*/
|
|
6844
|
-
function GetStats(params) {
|
|
6845
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6846
|
-
let { entityIds, api, req } = params;
|
|
6847
|
-
// Save time and just return a none response if no entity IDs are provided.
|
|
6848
|
-
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
6849
|
-
return {
|
|
6850
|
-
stats: []
|
|
6851
|
-
};
|
|
6852
|
-
}
|
|
6853
|
-
if (!api) {
|
|
6854
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
6855
|
-
}
|
|
6856
|
-
return yield api.POST("v1/entity/historicData/stats", {
|
|
6857
|
-
entityIds: entityIds
|
|
6858
|
-
}, Api.PrepReqParams(req));
|
|
6859
|
-
});
|
|
6860
|
-
}
|
|
6861
|
-
EntityHistoricData.GetStats = GetStats;
|
|
6862
|
-
/**
|
|
6863
|
-
* Creates or updates historic data records.
|
|
6864
|
-
* Please note that the expected input/output does not include internal fields found inside the "Bruce" attribute.
|
|
6865
|
-
* @param params
|
|
6866
|
-
* @returns
|
|
6867
|
-
*/
|
|
6868
|
-
function Update(params) {
|
|
6869
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6870
|
-
let { records, api, req } = params;
|
|
6871
|
-
// Save time and just return a none response if no records are provided.
|
|
6872
|
-
if (!(records === null || records === void 0 ? void 0 : records.length)) {
|
|
6873
|
-
return {
|
|
6874
|
-
records: []
|
|
6875
|
-
};
|
|
6876
|
-
}
|
|
6877
|
-
if (!api) {
|
|
6878
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
6879
|
-
}
|
|
6880
|
-
const res = yield api.POST("v1/entity/historicData", {
|
|
6881
|
-
records: records
|
|
6882
|
-
}, Api.PrepReqParams(req));
|
|
6883
|
-
// Kill cache for every unique attrKey.
|
|
6884
|
-
let attrKeys = records.map(r => r.attrKey);
|
|
6885
|
-
attrKeys = attrKeys.filter((v, i) => attrKeys.indexOf(v) === i);
|
|
6886
|
-
for (const attrKey of attrKeys) {
|
|
6887
|
-
api.Cache.RemoveByContains(Entity.GetHistoricContainsKey(attrKey));
|
|
6888
|
-
}
|
|
6889
|
-
return res;
|
|
6890
|
-
});
|
|
6891
|
-
}
|
|
6892
|
-
EntityHistoricData.Update = Update;
|
|
6893
|
-
/**
|
|
6894
|
-
* Deletes historic data records for an array of Entity IDs.
|
|
6895
|
-
* This deletes all records within a provided key + range.
|
|
6896
|
-
* @param params
|
|
6897
|
-
* @returns
|
|
6898
|
-
*/
|
|
6899
|
-
function Delete(params) {
|
|
6900
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6901
|
-
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
6902
|
-
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
6903
|
-
return;
|
|
6904
|
-
}
|
|
6905
|
-
if (!api) {
|
|
6906
|
-
api = ENVIRONMENT.Api().GetBruceApi();
|
|
6907
|
-
}
|
|
6908
|
-
if (!attrKey || !dateTimeFrom || !dateTimeTo) {
|
|
6909
|
-
throw new Error("Invalid parameters provided.");
|
|
6910
|
-
}
|
|
6911
|
-
if (typeof attrKey != "string") {
|
|
6912
|
-
attrKey = PathUtils.Wrap(attrKey);
|
|
6913
|
-
}
|
|
6914
|
-
const urlParams = new URLSearchParams();
|
|
6915
|
-
for (const entityId of entityIds) {
|
|
6916
|
-
urlParams.append("entityId", entityId);
|
|
6917
|
-
}
|
|
6918
|
-
urlParams.append("attrKey", attrKey);
|
|
6919
|
-
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
6920
|
-
urlParams.append("dateTimeTo", dateTimeTo);
|
|
6921
|
-
yield api.DELETE(`v1/entity/historicData?${urlParams.toString()}`, Api.PrepReqParams(req));
|
|
6922
|
-
// Kill cache for all Entity cached Entity records related to the attrKey.
|
|
6923
|
-
api.Cache.RemoveByContains(Entity.GetHistoricContainsKey(attrKey));
|
|
6924
|
-
});
|
|
6925
|
-
}
|
|
6926
|
-
EntityHistoricData.Delete = Delete;
|
|
6927
|
-
})(EntityHistoricData || (EntityHistoricData = {}));
|
|
6928
|
-
|
|
6929
7021
|
/**
|
|
6930
7022
|
* Utility for uploading files.
|
|
6931
7023
|
*/
|
|
@@ -11417,7 +11509,7 @@ var DataSource;
|
|
|
11417
11509
|
})(DataSource || (DataSource = {}));
|
|
11418
11510
|
|
|
11419
11511
|
// This is updated with the package.json version on build.
|
|
11420
|
-
const VERSION = "3.9.
|
|
11512
|
+
const VERSION = "3.9.3";
|
|
11421
11513
|
|
|
11422
11514
|
export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
11423
11515
|
//# sourceMappingURL=bruce-models.es5.js.map
|