bruce-models 4.0.4 → 4.0.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.
@@ -41,6 +41,10 @@ var Api;
41
41
  ECacheKey["ProjectViewBookmark"] = "pvbookmark";
42
42
  ECacheKey["Tileset"] = "tileset";
43
43
  ECacheKey["ClientFile"] = "clientfile";
44
+ ECacheKey["ClientFileCountsPurpose"] = "clientfilecountspurpose";
45
+ ECacheKey["ClientFileCountsExtension"] = "clientfilecountsextensions";
46
+ ECacheKey["ClientFileCountsMIMEType"] = "clientfilecountsmimetypes";
47
+ ECacheKey["ClientFileCountsUser"] = "clientfilecountsusers";
44
48
  ECacheKey["Session"] = "session";
45
49
  ECacheKey["PendingAction"] = "pendingaction";
46
50
  ECacheKey["EntitySource"] = "entitysource";
@@ -4981,21 +4985,50 @@ var EntityAttachmentType;
4981
4985
  EType["Photo"] = "photo";
4982
4986
  EType["Document"] = "document";
4983
4987
  })(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
4988
+ /**
4989
+ * Gets an attachment type record by ID.
4990
+ * @param params
4991
+ * @returns
4992
+ */
4993
+ function Get(params) {
4994
+ return __awaiter(this, void 0, void 0, function* () {
4995
+ let { api, attachmentTypeId, req: reqParams } = params;
4996
+ if (!api) {
4997
+ api = ENVIRONMENT.Api().GetBruceApi();
4998
+ }
4999
+ if (!attachmentTypeId) {
5000
+ throw ("Type ID is required.");
5001
+ }
5002
+ reqParams = Api.PrepReqParams(reqParams);
5003
+ const cacheData = api.GetCacheItem(GetCacheKey(attachmentTypeId), reqParams);
5004
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
5005
+ return cacheData.data;
5006
+ }
5007
+ const prom = api.GET(`entityAttachmentType/${attachmentTypeId}`, Api.PrepReqParams(reqParams));
5008
+ api.SetCacheItem({
5009
+ key: GetCacheKey(attachmentTypeId),
5010
+ value: prom,
5011
+ req: reqParams
5012
+ });
5013
+ return prom;
5014
+ });
5015
+ }
5016
+ EntityAttachmentType.Get = Get;
4984
5017
  /**
4985
5018
  * Deletes an attachment type.
4986
5019
  * @param params
4987
5020
  */
4988
5021
  function Delete(params) {
4989
5022
  return __awaiter(this, void 0, void 0, function* () {
4990
- let { api, attachmentTypeId: id, req: reqParams } = params;
5023
+ let { api, attachmentTypeId, req: reqParams } = params;
4991
5024
  if (!api) {
4992
5025
  api = ENVIRONMENT.Api().GetBruceApi();
4993
5026
  }
4994
- if (!id) {
5027
+ if (!attachmentTypeId) {
4995
5028
  throw ("Type ID is required.");
4996
5029
  }
4997
- yield api.DELETE(`entityAttachmentType/${id}`, Api.PrepReqParams(reqParams));
4998
- api.Cache.Remove(GetCacheKey(id));
5030
+ yield api.DELETE(`entityAttachmentType/${attachmentTypeId}`, Api.PrepReqParams(reqParams));
5031
+ api.Cache.Remove(GetCacheKey(attachmentTypeId));
4999
5032
  api.Cache.Remove(GetListCacheKey());
5000
5033
  });
5001
5034
  }
@@ -5030,7 +5063,7 @@ var EntityAttachmentType;
5030
5063
  */
5031
5064
  function GetList(params) {
5032
5065
  return __awaiter(this, void 0, void 0, function* () {
5033
- let { api, reqParams } = params;
5066
+ let { api, req: reqParams } = params;
5034
5067
  if (!api) {
5035
5068
  api = ENVIRONMENT.Api().GetBruceApi();
5036
5069
  }
@@ -7364,6 +7397,162 @@ var ClientFile;
7364
7397
  });
7365
7398
  }
7366
7399
  ClientFile$$1.UploadTemp = UploadTemp;
7400
+ /**
7401
+ * Returns a dictionary of purpose counts for client files.
7402
+ * @param params
7403
+ * @returns
7404
+ */
7405
+ function GetCountsPurpose(params) {
7406
+ return __awaiter(this, void 0, void 0, function* () {
7407
+ let { api, req: reqParams } = params;
7408
+ if (!api) {
7409
+ api = ENVIRONMENT.Api().GetBruceApi();
7410
+ }
7411
+ reqParams = Api.PrepReqParams(reqParams);
7412
+ const key = GetCountsPurposeCacheKey();
7413
+ const cache = api.GetCacheItem(key, reqParams);
7414
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
7415
+ return cache.data;
7416
+ }
7417
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
7418
+ try {
7419
+ const data = yield api.GET("file/purpose/counts", Api.PrepReqParams(reqParams));
7420
+ res({
7421
+ counts: data
7422
+ });
7423
+ }
7424
+ catch (e) {
7425
+ rej(e);
7426
+ }
7427
+ }));
7428
+ api.SetCacheItem({
7429
+ key,
7430
+ value: prom,
7431
+ req: reqParams,
7432
+ // Short 30 second cache duration.
7433
+ duration: 30 * 1000
7434
+ });
7435
+ return prom;
7436
+ });
7437
+ }
7438
+ ClientFile$$1.GetCountsPurpose = GetCountsPurpose;
7439
+ /**
7440
+ * Returns a dictionary of MIME type counts for client files.
7441
+ * @param params
7442
+ * @returns
7443
+ */
7444
+ function GetCountsExtension(params) {
7445
+ return __awaiter(this, void 0, void 0, function* () {
7446
+ let { api, req: reqParams } = params;
7447
+ if (!api) {
7448
+ api = ENVIRONMENT.Api().GetBruceApi();
7449
+ }
7450
+ reqParams = Api.PrepReqParams(reqParams);
7451
+ const key = GetCountsExtensionCacheKey();
7452
+ const cache = api.GetCacheItem(key, reqParams);
7453
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
7454
+ return cache.data;
7455
+ }
7456
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
7457
+ try {
7458
+ const data = yield api.GET("file/extension/counts", Api.PrepReqParams(reqParams));
7459
+ res({
7460
+ counts: data
7461
+ });
7462
+ }
7463
+ catch (e) {
7464
+ rej(e);
7465
+ }
7466
+ }));
7467
+ api.SetCacheItem({
7468
+ key,
7469
+ value: prom,
7470
+ req: reqParams,
7471
+ // Short 30 second cache duration.
7472
+ duration: 30 * 1000
7473
+ });
7474
+ return prom;
7475
+ });
7476
+ }
7477
+ ClientFile$$1.GetCountsExtension = GetCountsExtension;
7478
+ /**
7479
+ * Returns a dictionary of MIME type counts for client files.
7480
+ * @param params
7481
+ * @returns
7482
+ */
7483
+ function GetCountsMIMEType(params) {
7484
+ return __awaiter(this, void 0, void 0, function* () {
7485
+ let { api, req: reqParams } = params;
7486
+ if (!api) {
7487
+ api = ENVIRONMENT.Api().GetBruceApi();
7488
+ }
7489
+ reqParams = Api.PrepReqParams(reqParams);
7490
+ const key = GetCountsMIMETypeCacheKey();
7491
+ const cache = api.GetCacheItem(key, reqParams);
7492
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
7493
+ return cache.data;
7494
+ }
7495
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
7496
+ try {
7497
+ const data = yield api.GET("file/mimetype/counts", Api.PrepReqParams(reqParams));
7498
+ res({
7499
+ counts: data
7500
+ });
7501
+ }
7502
+ catch (e) {
7503
+ rej(e);
7504
+ }
7505
+ }));
7506
+ api.SetCacheItem({
7507
+ key,
7508
+ value: prom,
7509
+ req: reqParams,
7510
+ // Short 30 second cache duration.
7511
+ duration: 30 * 1000
7512
+ });
7513
+ return prom;
7514
+ });
7515
+ }
7516
+ ClientFile$$1.GetCountsMIMEType = GetCountsMIMEType;
7517
+ /**
7518
+ * Returns a dictionary of user counts for client files.
7519
+ * @param params
7520
+ * @returns
7521
+ */
7522
+ function GetCountsUser(params) {
7523
+ return __awaiter(this, void 0, void 0, function* () {
7524
+ let { api, req: reqParams } = params;
7525
+ if (!api) {
7526
+ api = ENVIRONMENT.Api().GetBruceApi();
7527
+ }
7528
+ reqParams = Api.PrepReqParams(reqParams);
7529
+ const key = GetCountsUserCacheKey();
7530
+ const cache = api.GetCacheItem(key, reqParams);
7531
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
7532
+ return cache.data;
7533
+ }
7534
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
7535
+ try {
7536
+ const data = yield api.GET("file/user/counts", Api.PrepReqParams(reqParams));
7537
+ res({
7538
+ counts: data
7539
+ });
7540
+ }
7541
+ catch (e) {
7542
+ rej(e);
7543
+ }
7544
+ }));
7545
+ api.SetCacheItem({
7546
+ key,
7547
+ value: prom,
7548
+ req: reqParams,
7549
+ // Short 30 second cache duration.
7550
+ duration: 30 * 1000
7551
+ });
7552
+ return prom;
7553
+ });
7554
+ }
7555
+ ClientFile$$1.GetCountsUser = GetCountsUser;
7367
7556
  /**
7368
7557
  * Filter definitions for requesting a list of client files.
7369
7558
  */
@@ -7409,6 +7598,28 @@ var ClientFile;
7409
7598
  });
7410
7599
  }
7411
7600
  ClientFile$$1.GetList = GetList;
7601
+ /**
7602
+ * Deletes a list of client files matching the filter.
7603
+ * @param params
7604
+ */
7605
+ function DeleteList(params) {
7606
+ return __awaiter(this, void 0, void 0, function* () {
7607
+ let { api, filter, req: reqParams } = params;
7608
+ if (!api) {
7609
+ api = ENVIRONMENT.Api().GetBruceApi();
7610
+ }
7611
+ const res = yield api.POST("files/filtered/delete", filter, Api.PrepReqParams(reqParams));
7612
+ // We'll clear cache if at least one file was deleted.
7613
+ if ((res === null || res === void 0 ? void 0 : res.OK) && (res === null || res === void 0 ? void 0 : res.DeleteFilesCount) > 0) {
7614
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.ClientFile);
7615
+ }
7616
+ return {
7617
+ success: res === null || res === void 0 ? void 0 : res.OK,
7618
+ deletedCount: res === null || res === void 0 ? void 0 : res.DeleteFilesCount
7619
+ };
7620
+ });
7621
+ }
7622
+ ClientFile$$1.DeleteList = DeleteList;
7412
7623
  /**
7413
7624
  * Utility for processing client files.
7414
7625
  * Commonly used to convert a file to a different format. Eg: FBX to GLB.
@@ -7460,6 +7671,22 @@ var ClientFile;
7460
7671
  return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.Id}${fileId}`;
7461
7672
  }
7462
7673
  ClientFile$$1.GetCacheKey = GetCacheKey;
7674
+ function GetCountsPurposeCacheKey() {
7675
+ return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsPurpose}`;
7676
+ }
7677
+ ClientFile$$1.GetCountsPurposeCacheKey = GetCountsPurposeCacheKey;
7678
+ function GetCountsExtensionCacheKey() {
7679
+ return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsExtension}`;
7680
+ }
7681
+ ClientFile$$1.GetCountsExtensionCacheKey = GetCountsExtensionCacheKey;
7682
+ function GetCountsMIMETypeCacheKey() {
7683
+ return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsMIMEType}`;
7684
+ }
7685
+ ClientFile$$1.GetCountsMIMETypeCacheKey = GetCountsMIMETypeCacheKey;
7686
+ function GetCountsUserCacheKey() {
7687
+ return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.ClientFileCountsUser}`;
7688
+ }
7689
+ ClientFile$$1.GetCountsUserCacheKey = GetCountsUserCacheKey;
7463
7690
  })(ClientFile || (ClientFile = {}));
7464
7691
 
7465
7692
  /**
@@ -11662,7 +11889,7 @@ var DataSource;
11662
11889
  })(DataSource || (DataSource = {}));
11663
11890
 
11664
11891
  // This is updated with the package.json version on build.
11665
- const VERSION = "4.0.4";
11892
+ const VERSION = "4.0.6";
11666
11893
 
11667
11894
  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 };
11668
11895
  //# sourceMappingURL=bruce-models.es5.js.map