bruce-models 7.1.80 → 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";
@@ -14260,6 +14261,172 @@ var EntityTag;
14260
14261
  EntityTag.GetListCacheKey = GetListCacheKey;
14261
14262
  })(EntityTag || (EntityTag = {}));
14262
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
+
14263
14430
  /**
14264
14431
  * Describes the "BruceEntityTypeTrigger" concept within Nextspace.
14265
14432
  * These records define trigger rules that are scoped to an Entity Type.
@@ -20450,7 +20617,7 @@ var UrlUtils;
20450
20617
  })(UrlUtils || (UrlUtils = {}));
20451
20618
 
20452
20619
  // This is updated with the package.json version on build.
20453
- const VERSION = "7.1.80";
20620
+ const VERSION = "7.1.81";
20454
20621
 
20455
- 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 };
20456
20623
  //# sourceMappingURL=bruce-models.es5.js.map