bruce-models 7.1.79 → 7.1.81

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.
@@ -39,6 +39,7 @@ var Api;
39
39
  ECacheKey["Assembly"] = "assembly";
40
40
  ECacheKey["Entity"] = "entity";
41
41
  ECacheKey["EntityType"] = "entitytype";
42
+ ECacheKey["EntityTypeRelation"] = "entitytyperelation";
42
43
  ECacheKey["Ontology"] = "ontology";
43
44
  ECacheKey["EntityTypeTrigger"] = "entitytypetrigger";
44
45
  ECacheKey["DataFeed"] = "datafeed";
@@ -9277,6 +9278,22 @@ var ClientFile;
9277
9278
  function GetFindGeneratedTextureCacheKey(entityTypeSourceId, attribute) {
9278
9279
  return `client-file-find-generated-texture-${entityTypeSourceId}-${attribute}`;
9279
9280
  }
9281
+ const GENERATED_TEXTURE_PURPOSE = "Polygon Texture, ValueMap";
9282
+ const GENERATED_TEXTURE_SOURCE_PATH = "generation/Identity/EntityTypeSourceID";
9283
+ const GENERATED_TEXTURE_ATTRIBUTE_PATH = "generation/Identity/Attribute";
9284
+ /**
9285
+ * Whether a file is the generated value map for this source and attribute.
9286
+ */
9287
+ function IsGeneratedTextureFor(file, entityTypeSourceId, attribute) {
9288
+ var _a, _b;
9289
+ const identity = (_b = (_a = file === null || file === void 0 ? void 0 : file.Data) === null || _a === void 0 ? void 0 : _a.generation) === null || _b === void 0 ? void 0 : _b.Identity;
9290
+ if (!identity) {
9291
+ return false;
9292
+ }
9293
+ // A source ID reaches us as a number from the API and as a string from a filter echo.
9294
+ return Number(identity.EntityTypeSourceID) === Number(entityTypeSourceId) && identity.Attribute === attribute;
9295
+ }
9296
+ ClientFile.IsGeneratedTextureFor = IsGeneratedTextureFor;
9280
9297
  /**
9281
9298
  * Returns a generated texture file for given source ID + attribute combination.
9282
9299
  */
@@ -9298,11 +9315,11 @@ var ClientFile;
9298
9315
  filter: {
9299
9316
  PageSize: 300,
9300
9317
  PageIndex: 0,
9301
- Purpose: "Polygon Texture",
9318
+ Purpose: GENERATED_TEXTURE_PURPOSE,
9302
9319
  FilterRows: [
9303
9320
  {
9304
9321
  column: Filter.EColumn.Data,
9305
- path: "generation/EntityType.Source.ID",
9322
+ path: GENERATED_TEXTURE_SOURCE_PATH,
9306
9323
  rowOperator: Filter.ERowOperator.AND,
9307
9324
  value: String(entityTypeSourceId),
9308
9325
  includes: true,
@@ -9311,7 +9328,7 @@ var ClientFile;
9311
9328
  },
9312
9329
  {
9313
9330
  column: Filter.EColumn.Data,
9314
- path: "generation/Attribute",
9331
+ path: GENERATED_TEXTURE_ATTRIBUTE_PATH,
9315
9332
  rowOperator: Filter.ERowOperator.AND,
9316
9333
  value: attribute,
9317
9334
  includes: true,
@@ -9322,12 +9339,7 @@ var ClientFile;
9322
9339
  },
9323
9340
  req: reqParams
9324
9341
  });
9325
- const match = (res.clientFiles || []).find((file) => {
9326
- var _a;
9327
- const generation = (_a = file === null || file === void 0 ? void 0 : file.Data) === null || _a === void 0 ? void 0 : _a.generation;
9328
- return ((generation === null || generation === void 0 ? void 0 : generation["EntityType.Source.ID"]) === entityTypeSourceId &&
9329
- (generation === null || generation === void 0 ? void 0 : generation.Attribute) === attribute);
9330
- });
9342
+ const match = (res.clientFiles || []).find((file) => IsGeneratedTextureFor(file, entityTypeSourceId, attribute));
9331
9343
  return match || null;
9332
9344
  }))();
9333
9345
  api.SetCacheItem({
@@ -14249,6 +14261,172 @@ var EntityTag;
14249
14261
  EntityTag.GetListCacheKey = GetListCacheKey;
14250
14262
  })(EntityTag || (EntityTag = {}));
14251
14263
 
14264
+ /**
14265
+ * Describes the "Entity Type Relation" concept within Nextspace.
14266
+ * An Entity Type Relation registers a relationship that may exist between entities of two specified Entity Types.
14267
+ */
14268
+ var EntityTypeRelation;
14269
+ (function (EntityTypeRelation) {
14270
+ /**
14271
+ * Gets a single Entity Type Relation record.
14272
+ * This calls: GET entityType/{entityType_id}/relation/{entity_type_relation_id}
14273
+ */
14274
+ function Get(params) {
14275
+ return __awaiter(this, void 0, void 0, function* () {
14276
+ let { api, entityTypeId, entityTypeRelationId, req } = params;
14277
+ if (!entityTypeId) {
14278
+ throw ("Entity Type ID is required.");
14279
+ }
14280
+ if (!entityTypeRelationId) {
14281
+ throw ("Entity Type Relation ID is required.");
14282
+ }
14283
+ if (!api) {
14284
+ api = ENVIRONMENT.Api().GetBruceApi();
14285
+ }
14286
+ const key = GetCacheKey(entityTypeId, entityTypeRelationId);
14287
+ const cache = api.GetCacheItem(key, req);
14288
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
14289
+ return cache.data;
14290
+ }
14291
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
14292
+ try {
14293
+ const data = yield api.GET(`entityType/${entityTypeId}/relation/${entityTypeRelationId}`, Api.PrepReqParams(req));
14294
+ res({
14295
+ relation: data
14296
+ });
14297
+ }
14298
+ catch (e) {
14299
+ rej(e);
14300
+ }
14301
+ }));
14302
+ api.SetCacheItem({
14303
+ key,
14304
+ value: prom,
14305
+ req
14306
+ });
14307
+ return prom;
14308
+ });
14309
+ }
14310
+ EntityTypeRelation.Get = Get;
14311
+ /**
14312
+ * Gets Entity Type Relation records for the specified Entity Type.
14313
+ * This calls: GET entityType/{entityType_id}/relations
14314
+ */
14315
+ function GetList(params) {
14316
+ return __awaiter(this, void 0, void 0, function* () {
14317
+ let { api, entityTypeId, req } = params;
14318
+ if (!entityTypeId) {
14319
+ throw ("Entity Type ID is required.");
14320
+ }
14321
+ if (!api) {
14322
+ api = ENVIRONMENT.Api().GetBruceApi();
14323
+ }
14324
+ const key = GetListCacheKey(entityTypeId);
14325
+ const cache = api.GetCacheItem(key, req);
14326
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
14327
+ return cache.data;
14328
+ }
14329
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
14330
+ try {
14331
+ const data = yield api.GET(`entityType/${entityTypeId}/relations`, Api.PrepReqParams(req));
14332
+ res({
14333
+ relations: Array.isArray(data === null || data === void 0 ? void 0 : data.Items) ? data.Items : []
14334
+ });
14335
+ }
14336
+ catch (e) {
14337
+ rej(e);
14338
+ }
14339
+ }));
14340
+ api.SetCacheItem({
14341
+ key,
14342
+ value: prom,
14343
+ req
14344
+ });
14345
+ return prom;
14346
+ });
14347
+ }
14348
+ EntityTypeRelation.GetList = GetList;
14349
+ /**
14350
+ * Creates or updates an Entity Type Relation record.
14351
+ * This calls: POST entityType/{entityType_id}/relation/{entity_type_relation_id}
14352
+ */
14353
+ function Update(params) {
14354
+ var _a;
14355
+ return __awaiter(this, void 0, void 0, function* () {
14356
+ let { api, entityTypeId, relation: data, entityTypeRelationId, req } = params;
14357
+ if (!entityTypeId) {
14358
+ throw ("Entity Type ID is required.");
14359
+ }
14360
+ if (!data) {
14361
+ throw ("Entity Type Relation is required.");
14362
+ }
14363
+ if (!api) {
14364
+ api = ENVIRONMENT.Api().GetBruceApi();
14365
+ }
14366
+ const relationId = (_a = entityTypeRelationId !== null && entityTypeRelationId !== void 0 ? entityTypeRelationId : data.ID) !== null && _a !== void 0 ? _a : 0;
14367
+ if (isCreateRoute(relationId) && (!data["A.EntityType.ID"] || !data["B.EntityType.ID"] || !data["EntityRelationType.ID"])) {
14368
+ throw ("A.EntityType.ID, B.EntityType.ID, and EntityRelationType.ID are required.");
14369
+ }
14370
+ const res = yield api.POST(`entityType/${entityTypeId}/relation/${relationId}`, data, Api.PrepReqParams(req));
14371
+ removeRelationCache(api, entityTypeId, relationId, res);
14372
+ return {
14373
+ relation: res
14374
+ };
14375
+ });
14376
+ }
14377
+ EntityTypeRelation.Update = Update;
14378
+ /**
14379
+ * Deletes an Entity Type Relation record.
14380
+ * This calls: DELETE entityType/{entityType_id}/relation/{entity_type_relation_id}
14381
+ */
14382
+ function Delete(params) {
14383
+ return __awaiter(this, void 0, void 0, function* () {
14384
+ let { api, entityTypeId, entityTypeRelationId, req } = params;
14385
+ if (!entityTypeId) {
14386
+ throw ("Entity Type ID is required.");
14387
+ }
14388
+ if (!entityTypeRelationId) {
14389
+ throw ("Entity Type Relation ID is required.");
14390
+ }
14391
+ if (!api) {
14392
+ api = ENVIRONMENT.Api().GetBruceApi();
14393
+ }
14394
+ yield api.DELETE(`entityType/${entityTypeId}/relation/${entityTypeRelationId}`, Api.PrepReqParams(req));
14395
+ removeRelationCache(api, entityTypeId, entityTypeRelationId);
14396
+ });
14397
+ }
14398
+ EntityTypeRelation.Delete = Delete;
14399
+ /**
14400
+ * Returns cache identifier for an Entity Type Relation record.
14401
+ */
14402
+ function GetCacheKey(entityTypeId, entityTypeRelationId) {
14403
+ return Api.ECacheKey.EntityTypeRelation + Api.ECacheKey.Id + entityTypeId + Api.ECacheKey.Id + entityTypeRelationId;
14404
+ }
14405
+ EntityTypeRelation.GetCacheKey = GetCacheKey;
14406
+ /**
14407
+ * Returns cache identifier for the list of Entity Type Relation records for an Entity Type.
14408
+ */
14409
+ function GetListCacheKey(entityTypeId) {
14410
+ return Api.ECacheKey.EntityTypeRelation + Api.ECacheKey.Id + entityTypeId;
14411
+ }
14412
+ EntityTypeRelation.GetListCacheKey = GetListCacheKey;
14413
+ function isCreateRoute(entityTypeRelationId) {
14414
+ return entityTypeRelationId === 0 || entityTypeRelationId === "0";
14415
+ }
14416
+ function removeRelationCache(api, entityTypeId, entityTypeRelationId, relation) {
14417
+ api.Cache.RemoveByStartsWith(GetListCacheKey(entityTypeId));
14418
+ if (!isCreateRoute(entityTypeRelationId)) {
14419
+ api.Cache.Remove(GetCacheKey(entityTypeId, entityTypeRelationId));
14420
+ }
14421
+ if ((relation === null || relation === void 0 ? void 0 : relation["A.EntityType.ID"]) && relation["A.EntityType.ID"] !== entityTypeId) {
14422
+ api.Cache.RemoveByStartsWith(GetListCacheKey(relation["A.EntityType.ID"]));
14423
+ }
14424
+ if ((relation === null || relation === void 0 ? void 0 : relation["B.EntityType.ID"]) && relation["B.EntityType.ID"] !== entityTypeId) {
14425
+ api.Cache.RemoveByStartsWith(GetListCacheKey(relation["B.EntityType.ID"]));
14426
+ }
14427
+ }
14428
+ })(EntityTypeRelation || (EntityTypeRelation = {}));
14429
+
14252
14430
  /**
14253
14431
  * Describes the "BruceEntityTypeTrigger" concept within Nextspace.
14254
14432
  * These records define trigger rules that are scoped to an Entity Type.
@@ -20439,7 +20617,7 @@ var UrlUtils;
20439
20617
  })(UrlUtils || (UrlUtils = {}));
20440
20618
 
20441
20619
  // This is updated with the package.json version on build.
20442
- const VERSION = "7.1.79";
20620
+ const VERSION = "7.1.81";
20443
20621
 
20444
- export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils };
20622
+ export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils };
20445
20623
  //# sourceMappingURL=bruce-models.es5.js.map