bruce-models 4.0.5 → 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";
@@ -7393,6 +7397,162 @@ var ClientFile;
7393
7397
  });
7394
7398
  }
7395
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;
7396
7556
  /**
7397
7557
  * Filter definitions for requesting a list of client files.
7398
7558
  */
@@ -7438,6 +7598,28 @@ var ClientFile;
7438
7598
  });
7439
7599
  }
7440
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;
7441
7623
  /**
7442
7624
  * Utility for processing client files.
7443
7625
  * Commonly used to convert a file to a different format. Eg: FBX to GLB.
@@ -7489,6 +7671,22 @@ var ClientFile;
7489
7671
  return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.Id}${fileId}`;
7490
7672
  }
7491
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;
7492
7690
  })(ClientFile || (ClientFile = {}));
7493
7691
 
7494
7692
  /**
@@ -11691,7 +11889,7 @@ var DataSource;
11691
11889
  })(DataSource || (DataSource = {}));
11692
11890
 
11693
11891
  // This is updated with the package.json version on build.
11694
- const VERSION = "4.0.5";
11892
+ const VERSION = "4.0.6";
11695
11893
 
11696
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 };
11697
11895
  //# sourceMappingURL=bruce-models.es5.js.map