bruce-models 5.5.4 → 5.5.6
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 +129 -10
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +122 -9
- 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/lib/entity/entity.js +25 -8
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/lib/scenario/scenario.js +116 -0
- package/dist/lib/scenario/scenario.js.map +1 -0
- package/dist/types/bruce-models.d.ts +2 -1
- package/dist/types/entity/entity.d.ts +5 -0
- package/dist/types/project/menu-item.d.ts +1 -0
- package/dist/types/scenario/scenario.d.ts +61 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -3172,7 +3172,7 @@ var Entity;
|
|
|
3172
3172
|
*/
|
|
3173
3173
|
function Get(params) {
|
|
3174
3174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3175
|
-
let { api, entityId, migrated, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3175
|
+
let { api, entityId, scenario, migrated, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3176
3176
|
if (!entityId) {
|
|
3177
3177
|
throw ("Entity ID is required.");
|
|
3178
3178
|
}
|
|
@@ -3188,7 +3188,8 @@ var Entity;
|
|
|
3188
3188
|
historicKey,
|
|
3189
3189
|
historicTo,
|
|
3190
3190
|
historicPoint,
|
|
3191
|
-
schemaId
|
|
3191
|
+
schemaId,
|
|
3192
|
+
scenario
|
|
3192
3193
|
});
|
|
3193
3194
|
const cache = api.GetCacheItem(key, reqParams);
|
|
3194
3195
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
@@ -3228,6 +3229,9 @@ var Entity;
|
|
|
3228
3229
|
if (schemaId) {
|
|
3229
3230
|
urlParams.set("schema", schemaId);
|
|
3230
3231
|
}
|
|
3232
|
+
if (scenario && scenario > 0) {
|
|
3233
|
+
urlParams.set("Scenario", String(scenario));
|
|
3234
|
+
}
|
|
3231
3235
|
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
3232
3236
|
const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, Api.PrepReqParams(reqParams));
|
|
3233
3237
|
res({
|
|
@@ -3254,7 +3258,7 @@ var Entity;
|
|
|
3254
3258
|
*/
|
|
3255
3259
|
function GetListByIds(params) {
|
|
3256
3260
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3257
|
-
let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports, maxSearchTimeSec } = params;
|
|
3261
|
+
let { api, entityIds, scenario, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports, maxSearchTimeSec } = params;
|
|
3258
3262
|
if (!entityIds.length) {
|
|
3259
3263
|
throw ("Entity IDs are required.");
|
|
3260
3264
|
}
|
|
@@ -3271,7 +3275,8 @@ var Entity;
|
|
|
3271
3275
|
historicKey: historicKey,
|
|
3272
3276
|
historicTo: historicTo,
|
|
3273
3277
|
historicPoint: historicPoint,
|
|
3274
|
-
schemaId: schemaId
|
|
3278
|
+
schemaId: schemaId,
|
|
3279
|
+
scenario: scenario
|
|
3275
3280
|
};
|
|
3276
3281
|
const crashRiskReqs = [];
|
|
3277
3282
|
const reqIds = [];
|
|
@@ -3328,6 +3333,9 @@ var Entity;
|
|
|
3328
3333
|
if (historicPoint) {
|
|
3329
3334
|
reqData["historicPoint"] = historicPoint;
|
|
3330
3335
|
}
|
|
3336
|
+
if (scenario) {
|
|
3337
|
+
reqData["Scenario"] = scenario;
|
|
3338
|
+
}
|
|
3331
3339
|
const urlParams = new URLSearchParams();
|
|
3332
3340
|
if (schemaId) {
|
|
3333
3341
|
urlParams.set("schema", schemaId);
|
|
@@ -3765,7 +3773,7 @@ var Entity;
|
|
|
3765
3773
|
function GetList(params) {
|
|
3766
3774
|
var _a;
|
|
3767
3775
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3768
|
-
let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources, maxSearchTimeSec } = params;
|
|
3776
|
+
let { api, filter, scenario, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources, maxSearchTimeSec } = params;
|
|
3769
3777
|
if (!api) {
|
|
3770
3778
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
3771
3779
|
}
|
|
@@ -3806,7 +3814,8 @@ var Entity;
|
|
|
3806
3814
|
historicFrom: historicFrom,
|
|
3807
3815
|
historicTo: historicTo,
|
|
3808
3816
|
historicPoint: historicPoint,
|
|
3809
|
-
ExpandSources: expandSources
|
|
3817
|
+
ExpandSources: expandSources,
|
|
3818
|
+
Scenario: scenario
|
|
3810
3819
|
};
|
|
3811
3820
|
if (expandLocation || expandRelations || expandImports) {
|
|
3812
3821
|
let expand = "";
|
|
@@ -3883,6 +3892,9 @@ var Entity;
|
|
|
3883
3892
|
if (schemaId) {
|
|
3884
3893
|
urlParams.set("schema", schemaId);
|
|
3885
3894
|
}
|
|
3895
|
+
if (scenario && scenario > 0) {
|
|
3896
|
+
urlParams.set("Scenario", String(scenario));
|
|
3897
|
+
}
|
|
3886
3898
|
if (maxSearchTimeSec) {
|
|
3887
3899
|
urlParams.set("MaxSearchTimeSec", String(Math.ceil(maxSearchTimeSec)));
|
|
3888
3900
|
}
|
|
@@ -3946,7 +3958,8 @@ var Entity;
|
|
|
3946
3958
|
historicFrom: historicFrom,
|
|
3947
3959
|
historicKey: historicKey,
|
|
3948
3960
|
historicTo: historicTo,
|
|
3949
|
-
schemaId: schemaId
|
|
3961
|
+
schemaId: schemaId,
|
|
3962
|
+
scenario: scenario
|
|
3950
3963
|
}),
|
|
3951
3964
|
value: {
|
|
3952
3965
|
entity: entity
|
|
@@ -4005,7 +4018,10 @@ var Entity;
|
|
|
4005
4018
|
* @returns
|
|
4006
4019
|
*/
|
|
4007
4020
|
function GetCacheKey(params) {
|
|
4008
|
-
let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandImports, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
4021
|
+
let { entityId, scenario: scenarioId, entityTypeId, schemaId, expandLocation, expandRelations, expandImports, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
4022
|
+
if (!scenarioId) {
|
|
4023
|
+
scenarioId = 0;
|
|
4024
|
+
}
|
|
4009
4025
|
if (!entityTypeId) {
|
|
4010
4026
|
entityTypeId = "";
|
|
4011
4027
|
}
|
|
@@ -4027,6 +4043,7 @@ var Entity;
|
|
|
4027
4043
|
let key = `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
|
|
4028
4044
|
key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}${String(Boolean(expandImports))}`;
|
|
4029
4045
|
key += `${Api.ECacheKey.EntityHistoricData}${Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
|
|
4046
|
+
key += `${Api.ECacheKey.Id}${scenarioId}`;
|
|
4030
4047
|
return key;
|
|
4031
4048
|
}
|
|
4032
4049
|
Entity.GetCacheKey = GetCacheKey;
|
|
@@ -15001,8 +15018,110 @@ var DataSource;
|
|
|
15001
15018
|
DataSource.GetListCacheKey = GetListCacheKey;
|
|
15002
15019
|
})(DataSource || (DataSource = {}));
|
|
15003
15020
|
|
|
15021
|
+
/**
|
|
15022
|
+
* A scenario is a way to manage alternative states for Entities.
|
|
15023
|
+
* Once a scenario is made, you can use its ID to create/update an Entity record without affecting the primary state.
|
|
15024
|
+
* When a scenario is deleted, all related alternative Entity data is also deleted.
|
|
15025
|
+
*/
|
|
15026
|
+
var Scenario;
|
|
15027
|
+
(function (Scenario) {
|
|
15028
|
+
/**
|
|
15029
|
+
* Returns a scenario record matching the provided ID or Key.
|
|
15030
|
+
* @param params
|
|
15031
|
+
* @returns
|
|
15032
|
+
*/
|
|
15033
|
+
function Get(params) {
|
|
15034
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15035
|
+
let { scenarioId: id, scenarioKey: key, api, req } = params;
|
|
15036
|
+
if (!api) {
|
|
15037
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
15038
|
+
}
|
|
15039
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
15040
|
+
try {
|
|
15041
|
+
const url = key ? `scenario/key/${key}` : `scenario/${id}`;
|
|
15042
|
+
const data = yield api.GET(url, Api.PrepReqParams(req));
|
|
15043
|
+
res({
|
|
15044
|
+
plugin: data
|
|
15045
|
+
});
|
|
15046
|
+
}
|
|
15047
|
+
catch (e) {
|
|
15048
|
+
rej(e);
|
|
15049
|
+
}
|
|
15050
|
+
}));
|
|
15051
|
+
return prom;
|
|
15052
|
+
});
|
|
15053
|
+
}
|
|
15054
|
+
Scenario.Get = Get;
|
|
15055
|
+
/**
|
|
15056
|
+
* Returns a list of scenarios.
|
|
15057
|
+
* @param params
|
|
15058
|
+
* @returns
|
|
15059
|
+
*/
|
|
15060
|
+
function GetList(params) {
|
|
15061
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15062
|
+
let { api, req } = params;
|
|
15063
|
+
if (!api) {
|
|
15064
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
15065
|
+
}
|
|
15066
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
15067
|
+
try {
|
|
15068
|
+
const data = yield api.GET("scenarios", Api.PrepReqParams(req));
|
|
15069
|
+
res({
|
|
15070
|
+
scenario: data.Items
|
|
15071
|
+
});
|
|
15072
|
+
}
|
|
15073
|
+
catch (e) {
|
|
15074
|
+
rej(e);
|
|
15075
|
+
}
|
|
15076
|
+
}));
|
|
15077
|
+
return prom;
|
|
15078
|
+
});
|
|
15079
|
+
}
|
|
15080
|
+
Scenario.GetList = GetList;
|
|
15081
|
+
/**
|
|
15082
|
+
* Creates or updates a scenario.
|
|
15083
|
+
* @param params
|
|
15084
|
+
*/
|
|
15085
|
+
function Update(params) {
|
|
15086
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15087
|
+
let { scenario, api, req } = params;
|
|
15088
|
+
if (!scenario.DisplayName || !scenario.Key) {
|
|
15089
|
+
throw ("Display name and key are required.");
|
|
15090
|
+
}
|
|
15091
|
+
if (!api) {
|
|
15092
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
15093
|
+
}
|
|
15094
|
+
if (!scenario.ID) {
|
|
15095
|
+
scenario.ID = 0;
|
|
15096
|
+
}
|
|
15097
|
+
const data = yield api.POST(`scenario/${scenario.ID}`, scenario, Api.PrepReqParams(req));
|
|
15098
|
+
return {
|
|
15099
|
+
scenario: data
|
|
15100
|
+
};
|
|
15101
|
+
});
|
|
15102
|
+
}
|
|
15103
|
+
Scenario.Update = Update;
|
|
15104
|
+
/**
|
|
15105
|
+
* Deletes a scenario.
|
|
15106
|
+
* @param params
|
|
15107
|
+
*/
|
|
15108
|
+
function Delete(params) {
|
|
15109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15110
|
+
let { scenarioId, api, req } = params;
|
|
15111
|
+
if (!scenarioId) {
|
|
15112
|
+
throw ("Scenario ID is required.");
|
|
15113
|
+
}
|
|
15114
|
+
if (!api) {
|
|
15115
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
15116
|
+
}
|
|
15117
|
+
yield api.DELETE(`scenario/${scenarioId}`, Api.PrepReqParams(req));
|
|
15118
|
+
});
|
|
15119
|
+
}
|
|
15120
|
+
Scenario.Delete = Delete;
|
|
15121
|
+
})(Scenario || (Scenario = {}));
|
|
15122
|
+
|
|
15004
15123
|
// This is updated with the package.json version on build.
|
|
15005
|
-
const VERSION = "5.5.
|
|
15124
|
+
const VERSION = "5.5.6";
|
|
15006
15125
|
|
|
15007
|
-
export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
15126
|
+
export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario };
|
|
15008
15127
|
//# sourceMappingURL=bruce-models.es5.js.map
|