bruce-models 7.1.120 → 7.1.122

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.
Files changed (33) hide show
  1. package/README.md +26 -0
  2. package/dist/bruce-models.es5.js +257 -47
  3. package/dist/bruce-models.es5.js.map +1 -1
  4. package/dist/bruce-models.umd.js +254 -46
  5. package/dist/bruce-models.umd.js.map +1 -1
  6. package/dist/lib/account/account-concept.js +2 -0
  7. package/dist/lib/account/account-concept.js.map +1 -1
  8. package/dist/lib/ann-document/ann-document.js +12 -0
  9. package/dist/lib/ann-document/ann-document.js.map +1 -1
  10. package/dist/lib/api/api.js +1 -0
  11. package/dist/lib/api/api.js.map +1 -1
  12. package/dist/lib/bruce-models.js +2 -1
  13. package/dist/lib/bruce-models.js.map +1 -1
  14. package/dist/lib/client-file/client-file-folder.js +109 -0
  15. package/dist/lib/client-file/client-file-folder.js.map +1 -0
  16. package/dist/lib/client-file/client-file.js +119 -42
  17. package/dist/lib/client-file/client-file.js.map +1 -1
  18. package/dist/lib/data-lab/data-lab.js.map +1 -1
  19. package/dist/lib/entity/entity-historic-data.js +13 -3
  20. package/dist/lib/entity/entity-historic-data.js.map +1 -1
  21. package/dist/lib/internal/uploader.js +12 -0
  22. package/dist/lib/internal/uploader.js.map +1 -1
  23. package/dist/lib/server/record-change-feed.js +2 -0
  24. package/dist/lib/server/record-change-feed.js.map +1 -1
  25. package/dist/types/account/account-concept.d.ts +1 -0
  26. package/dist/types/ann-document/ann-document.d.ts +9 -0
  27. package/dist/types/api/api.d.ts +1 -0
  28. package/dist/types/bruce-models.d.ts +2 -1
  29. package/dist/types/client-file/client-file-folder.d.ts +55 -0
  30. package/dist/types/client-file/client-file.d.ts +68 -5
  31. package/dist/types/data-lab/data-lab.d.ts +15 -1
  32. package/dist/types/entity/entity-historic-data.d.ts +1 -0
  33. package/package.json +1 -1
@@ -53,6 +53,7 @@
53
53
  ECacheKey["ProjectViewBookmark"] = "pvbookmark";
54
54
  ECacheKey["Tileset"] = "tileset";
55
55
  ECacheKey["ClientFile"] = "clientfile";
56
+ ECacheKey["ClientFileFolder"] = "clientfilefolder";
56
57
  ECacheKey["ClientFileCountsPurpose"] = "clientfilecountspurpose";
57
58
  ECacheKey["ClientFileCountsExtension"] = "clientfilecountsextensions";
58
59
  ECacheKey["ClientFileCountsMIMEType"] = "clientfilecountsmimetypes";
@@ -340,6 +341,7 @@
340
341
  EConcept["ATTACHMENT_TYPE"] = "at";
341
342
  EConcept["CHANGE_SET"] = "cs";
342
343
  EConcept["CLIENT_FILE"] = "clf";
344
+ EConcept["CLIENT_FILE_FOLDER"] = "clff";
343
345
  EConcept["COMMENT"] = "cm";
344
346
  EConcept["CUSTOM_FORM"] = "csf";
345
347
  EConcept["DATA_FEED"] = "df";
@@ -416,6 +418,7 @@
416
418
  { concept: EConcept.ATTACHMENT_TYPE, label: "Attachment Type", description: undefined },
417
419
  { concept: EConcept.CHANGE_SET, label: "Change Set", description: undefined },
418
420
  { concept: EConcept.CLIENT_FILE, label: "Client File", description: undefined },
421
+ { concept: EConcept.CLIENT_FILE_FOLDER, label: "Client File Folder", description: "Virtual folders for Client Files" },
419
422
  { concept: EConcept.CUSTOM_FORM, label: "Custom Form", description: undefined },
420
423
  { concept: EConcept.DATA_FEED, label: "Data Feed", description: undefined },
421
424
  { concept: EConcept.DATA_LAB_QUERY, label: "DataLab Query", description: undefined },
@@ -661,6 +664,8 @@
661
664
  return [exports.Api.ECacheKey.Assembly];
662
665
  case exports.AccountConcept.EConcept.ATTACHMENT_TYPE:
663
666
  return [exports.Api.ECacheKey.AttachmentType];
667
+ case exports.AccountConcept.EConcept.CLIENT_FILE_FOLDER:
668
+ return [exports.Api.ECacheKey.ClientFileFolder, ...RecordChangeFeed.getConceptCacheKeys(exports.AccountConcept.EConcept.CLIENT_FILE)];
664
669
  case exports.AccountConcept.EConcept.CLIENT_FILE:
665
670
  return [
666
671
  exports.Api.ECacheKey.ClientFile,
@@ -4084,6 +4089,18 @@
4084
4089
  });
4085
4090
  }
4086
4091
  AnnDocument.UploadPDF = UploadPDF;
4092
+ /** Renders every page of an existing PDF without saving a Document View. */
4093
+ function ImportPages(params) {
4094
+ return __awaiter(this, void 0, void 0, function* () {
4095
+ const { fileId, req } = params;
4096
+ if (!fileId || !fileId.trim()) {
4097
+ throw new Error("File ID is required.");
4098
+ }
4099
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
4100
+ return api.POST("documentView/importPages", { "ClientFile.ID": fileId }, exports.Api.PrepReqParams(req));
4101
+ });
4102
+ }
4103
+ AnnDocument.ImportPages = ImportPages;
4087
4104
  /**
4088
4105
  * Returns an annotated document by ID.
4089
4106
  * @param params
@@ -5543,7 +5560,8 @@
5543
5560
  location: bruce.Location,
5544
5561
  transform: bruce.Transform,
5545
5562
  boundaries: bruce.Boundaries,
5546
- geometry: bruce.VectorGeometry
5563
+ geometry: bruce.VectorGeometry,
5564
+ assemblyPosition: bruce.AssemblyPosition
5547
5565
  };
5548
5566
  }
5549
5567
  EntityHistoricData.ToDataRecord = ToDataRecord;
@@ -5558,9 +5576,18 @@
5558
5576
  if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length) && !entityTypeId) {
5559
5577
  return { recordsByIds: {}, sample: 0 };
5560
5578
  }
5561
- const page = yield GetPage(Object.assign(Object.assign({}, params), { pageSize: params.sample > 0 ? undefined : (params.pageSize || 1000) }));
5579
+ // A page counts records across every Entity asked about, so the first page alone can stop partway
5580
+ // through the range. Read to its end, unless the caller asked for a page or a sample.
5581
+ const readAll = !(params.sample > 0) && params.pageIndex == null && params.pageSize == null;
5582
+ const items = [];
5583
+ let page = yield GetPage(Object.assign(Object.assign({}, params), { pageSize: params.sample > 0 ? undefined : (params.pageSize || 1000) }));
5584
+ items.push(...page.items);
5585
+ while (readAll && !(page.sample > 0) && page.pageSize > 0 && page.items.length >= page.pageSize) {
5586
+ page = yield GetPage(Object.assign(Object.assign({}, params), { pageIndex: page.pageIndex + 1, pageSize: page.pageSize }));
5587
+ items.push(...page.items);
5588
+ }
5562
5589
  const recordsByIds = {};
5563
- for (const item of page.items) {
5590
+ for (const item of items) {
5564
5591
  const record = ToDataRecord(item);
5565
5592
  if (!record.entityId) {
5566
5593
  continue;
@@ -9055,6 +9082,18 @@
9055
9082
  const blob = file.slice(fileOffset, fileOffset + partSize);
9056
9083
  const partialFile = new File([blob], file.name, { type: file.type });
9057
9084
  const formData = new FormData();
9085
+ // Keep custom metadata on every part, including retries. Core transport fields are controlled below.
9086
+ const appendField = (key, value) => {
9087
+ if (!["file", "token", "count", "part", "originalfilename"].includes(key.toLowerCase())) {
9088
+ formData.append(key, value);
9089
+ }
9090
+ };
9091
+ if (typeof FormData !== "undefined" && (req === null || req === void 0 ? void 0 : req.formData) instanceof FormData) {
9092
+ req.formData.forEach((value, key) => appendField(key, value));
9093
+ }
9094
+ else if (req === null || req === void 0 ? void 0 : req.formData) {
9095
+ Object.keys(req.formData).forEach(key => appendField(key, req.formData[key]));
9096
+ }
9058
9097
  formData.append("originalFileName", file.name);
9059
9098
  formData.append("token", uploadToken);
9060
9099
  formData.append("count", "" + filePartsCount);
@@ -9120,6 +9159,99 @@
9120
9159
  Uploader.DoMultiPartUpload = DoMultiPartUpload;
9121
9160
  })(exports.Uploader || (exports.Uploader = {}));
9122
9161
 
9162
+ (function (ClientFileFolder) {
9163
+ /** Validate and normalize an ID for routes, queries and cache keys without rounding it. */
9164
+ function NormalizeId(id, allowZero = false) {
9165
+ if (typeof id === "number" && (!Number.isSafeInteger(id) || id < 0)) {
9166
+ throw new Error("Folder ID must be a safe integer, or a decimal string for a larger bigint ID.");
9167
+ }
9168
+ if ((typeof id !== "string" && typeof id !== "number") || !/^\d+$/.test(String(id))) {
9169
+ throw new Error("Folder ID must be a non-negative decimal integer.");
9170
+ }
9171
+ const value = String(id).replace(/^0+(?=\d)/, "");
9172
+ if ((!allowZero && value === "0") || value.length > 19 ||
9173
+ (value.length === 19 && value > "9223372036854775807")) {
9174
+ throw new Error("Folder ID must be a positive signed 64-bit integer (0 is allowed only for the top level or creation).");
9175
+ }
9176
+ return value;
9177
+ }
9178
+ ClientFileFolder.NormalizeId = NormalizeId;
9179
+ function Get(params) {
9180
+ return __awaiter(this, void 0, void 0, function* () {
9181
+ const id = NormalizeId(params.folderId);
9182
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9183
+ const key = GetCacheKey(id);
9184
+ const cache = api.GetCacheItem(key, params.req);
9185
+ if (cache === null || cache === void 0 ? void 0 : cache.found)
9186
+ return cache.data;
9187
+ const promise = api.GET(`clientFileFolder/${id}`, exports.Api.PrepReqParams(params.req))
9188
+ .then(folder => ({ folder }));
9189
+ api.SetCacheItem({ key, value: promise, req: params.req });
9190
+ return promise;
9191
+ });
9192
+ }
9193
+ ClientFileFolder.Get = Get;
9194
+ /** Omit parentFolderId for all folders. Null or 0 selects only top-level folders. */
9195
+ function GetList(params = {}) {
9196
+ return __awaiter(this, void 0, void 0, function* () {
9197
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9198
+ const parent = params.parentFolderId === undefined ? undefined : NormalizeId(params.parentFolderId == null ? 0 : params.parentFolderId, true);
9199
+ const key = GetListCacheKey(parent);
9200
+ const cache = api.GetCacheItem(key, params.req);
9201
+ if (cache === null || cache === void 0 ? void 0 : cache.found)
9202
+ return cache.data;
9203
+ const url = "clientFileFolders" + (parent === undefined ? "" : `?parent_folder_id=${parent}`);
9204
+ const promise = api.GET(url, exports.Api.PrepReqParams(params.req))
9205
+ .then(data => ({ folders: (data === null || data === void 0 ? void 0 : data.Items) || [] }));
9206
+ api.SetCacheItem({ key, value: promise, req: params.req });
9207
+ return promise;
9208
+ });
9209
+ }
9210
+ ClientFileFolder.GetList = GetList;
9211
+ /** Create when folderId and folder.ID are omitted or 0; otherwise update only supplied fields. */
9212
+ function Update(params) {
9213
+ return __awaiter(this, void 0, void 0, function* () {
9214
+ if (!params.folder)
9215
+ throw new Error("Folder data is required.");
9216
+ const folder = Object.assign({}, params.folder);
9217
+ const id = NormalizeId(params.folderId !== undefined ? params.folderId : folder.ID == null ? 0 : folder.ID, true);
9218
+ if (folder["Parent.ClientFileFolder.ID"] != null)
9219
+ NormalizeId(folder["Parent.ClientFileFolder.ID"], true);
9220
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9221
+ const result = yield api.POST(`clientFileFolder/${id}`, folder, exports.Api.PrepReqParams(params.req));
9222
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFileFolder);
9223
+ return { folder: result };
9224
+ });
9225
+ }
9226
+ ClientFileFolder.Update = Update;
9227
+ function Create(params) {
9228
+ return __awaiter(this, void 0, void 0, function* () {
9229
+ return Update(Object.assign(Object.assign({}, params), { folderId: 0 }));
9230
+ });
9231
+ }
9232
+ ClientFileFolder.Create = Create;
9233
+ /** Contents move into the deleted folder's parent (or the top level); files are preserved. */
9234
+ function Delete(params) {
9235
+ return __awaiter(this, void 0, void 0, function* () {
9236
+ const id = NormalizeId(params.folderId);
9237
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9238
+ yield api.DELETE(`clientFileFolder/${id}`, exports.Api.PrepReqParams(params.req));
9239
+ // This prefix also covers folder records and all scoped file-count caches.
9240
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9241
+ });
9242
+ }
9243
+ ClientFileFolder.Delete = Delete;
9244
+ function GetCacheKey(folderId) {
9245
+ return `${exports.Api.ECacheKey.ClientFileFolder}${exports.Api.ECacheKey.Id}${NormalizeId(folderId)}`;
9246
+ }
9247
+ ClientFileFolder.GetCacheKey = GetCacheKey;
9248
+ function GetListCacheKey(parentFolderId) {
9249
+ const parent = parentFolderId === undefined ? "all" : NormalizeId(parentFolderId == null ? 0 : parentFolderId, true);
9250
+ return `${exports.Api.ECacheKey.ClientFileFolder}${exports.Api.ECacheKey.ListId}${parent}`;
9251
+ }
9252
+ ClientFileFolder.GetListCacheKey = GetListCacheKey;
9253
+ })(exports.ClientFileFolder || (exports.ClientFileFolder = {}));
9254
+
9123
9255
  (function (ClientFile) {
9124
9256
  let EPurpose;
9125
9257
  (function (EPurpose) {
@@ -9231,10 +9363,7 @@
9231
9363
  Items: fileIds
9232
9364
  };
9233
9365
  yield api.POST("deleteFiles", data, exports.Api.PrepReqParams(reqParams));
9234
- for (let i = 0; i < fileIds.length; i++) {
9235
- const key = GetCacheKey(fileIds[i]);
9236
- api.Cache.Remove(key);
9237
- }
9366
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9238
9367
  });
9239
9368
  }
9240
9369
  ClientFile.Delete = Delete;
@@ -9245,7 +9374,7 @@
9245
9374
  */
9246
9375
  function Upload(params) {
9247
9376
  return __awaiter(this, void 0, void 0, function* () {
9248
- let { api, file, purpose, req, onProgress } = params;
9377
+ let { api, file, purpose, folderId, req, onProgress } = params;
9249
9378
  if (!api) {
9250
9379
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9251
9380
  }
@@ -9257,6 +9386,7 @@
9257
9386
  throw ("You cannot upload a 0byte sized file.");
9258
9387
  }
9259
9388
  req = exports.Api.PrepReqParams(req);
9389
+ req = PrepareUploadMetadata(req, folderId, purpose);
9260
9390
  let clientFile;
9261
9391
  if (size > exports.Uploader.MIN_LARGE_FILE_SIZE) {
9262
9392
  clientFile = yield exports.Uploader.DoMultiPartUpload({
@@ -9266,15 +9396,6 @@
9266
9396
  req,
9267
9397
  onProgress
9268
9398
  });
9269
- // TODO: Check if we can add it to the request like the small file upload.
9270
- if ((clientFile === null || clientFile === void 0 ? void 0 : clientFile.ID) && purpose) {
9271
- yield ClientFile.UpdatePurpose({
9272
- api,
9273
- fileId: clientFile.ID,
9274
- purpose,
9275
- req
9276
- });
9277
- }
9278
9399
  }
9279
9400
  else {
9280
9401
  req.onProgress = (progress) => {
@@ -9284,17 +9405,13 @@
9284
9405
  uploaded: false
9285
9406
  });
9286
9407
  };
9287
- if (purpose) {
9288
- req.formData = {
9289
- Purpose: purpose
9290
- };
9291
- }
9292
9408
  clientFile = yield api.UPLOAD("file/uploadNew", file, req);
9293
9409
  }
9294
9410
  onProgress === null || onProgress === void 0 ? void 0 : onProgress({
9295
9411
  percent: 100,
9296
9412
  uploaded: true
9297
9413
  });
9414
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9298
9415
  return {
9299
9416
  clientFile
9300
9417
  };
@@ -9307,11 +9424,18 @@
9307
9424
  */
9308
9425
  function Update(params) {
9309
9426
  return __awaiter(this, void 0, void 0, function* () {
9310
- let { api, fileId, purpose, layerIds, req: reqParams, dataEntityId } = params;
9427
+ let { api, fileId, purpose, layerIds, folderId, req: reqParams, dataEntityId } = params;
9428
+ if (!fileId)
9429
+ throw new Error("File ID is required.");
9311
9430
  if (!api) {
9312
9431
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9313
9432
  }
9314
9433
  const data = {};
9434
+ if (folderId !== undefined) {
9435
+ if (folderId !== null)
9436
+ exports.ClientFileFolder.NormalizeId(folderId, true);
9437
+ data["ClientFileFolder.ID"] = folderId;
9438
+ }
9315
9439
  if (layerIds != null) {
9316
9440
  data["Layer.ID"] = layerIds;
9317
9441
  }
@@ -9322,8 +9446,7 @@
9322
9446
  data["Data.Entity.ID"] = dataEntityId ? dataEntityId : "";
9323
9447
  }
9324
9448
  yield api.POST(`file/${fileId}/details`, data, exports.Api.PrepReqParams(reqParams));
9325
- const cacheKey = GetCacheKey(fileId);
9326
- api.Cache.RemoveByContains(cacheKey);
9449
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9327
9450
  });
9328
9451
  }
9329
9452
  ClientFile.Update = Update;
@@ -9391,19 +9514,19 @@
9391
9514
  */
9392
9515
  function GetCountsPurpose(params) {
9393
9516
  return __awaiter(this, void 0, void 0, function* () {
9394
- let { api, req: reqParams } = params;
9517
+ let { api, folderId, req: reqParams } = params;
9395
9518
  if (!api) {
9396
9519
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9397
9520
  }
9398
9521
  reqParams = exports.Api.PrepReqParams(reqParams);
9399
- const key = GetCountsPurposeCacheKey();
9522
+ const key = GetCountsPurposeCacheKey(folderId);
9400
9523
  const cache = api.GetCacheItem(key, reqParams);
9401
9524
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9402
9525
  return cache.data;
9403
9526
  }
9404
9527
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9405
9528
  try {
9406
- const data = yield api.GET("file/purpose/counts", exports.Api.PrepReqParams(reqParams));
9529
+ const data = yield api.GET(FolderQuery("file/purpose/counts", folderId), exports.Api.PrepReqParams(reqParams));
9407
9530
  res({
9408
9531
  counts: data
9409
9532
  });
@@ -9430,19 +9553,19 @@
9430
9553
  */
9431
9554
  function GetCountsExtension(params) {
9432
9555
  return __awaiter(this, void 0, void 0, function* () {
9433
- let { api, req: reqParams } = params;
9556
+ let { api, folderId, req: reqParams } = params;
9434
9557
  if (!api) {
9435
9558
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9436
9559
  }
9437
9560
  reqParams = exports.Api.PrepReqParams(reqParams);
9438
- const key = GetCountsExtensionCacheKey();
9561
+ const key = GetCountsExtensionCacheKey(folderId);
9439
9562
  const cache = api.GetCacheItem(key, reqParams);
9440
9563
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9441
9564
  return cache.data;
9442
9565
  }
9443
9566
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9444
9567
  try {
9445
- const data = yield api.GET("file/extension/counts", exports.Api.PrepReqParams(reqParams));
9568
+ const data = yield api.GET(FolderQuery("file/extension/counts", folderId), exports.Api.PrepReqParams(reqParams));
9446
9569
  res({
9447
9570
  counts: data
9448
9571
  });
@@ -9469,19 +9592,19 @@
9469
9592
  */
9470
9593
  function GetCountsMIMEType(params) {
9471
9594
  return __awaiter(this, void 0, void 0, function* () {
9472
- let { api, req: reqParams } = params;
9595
+ let { api, folderId, req: reqParams } = params;
9473
9596
  if (!api) {
9474
9597
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9475
9598
  }
9476
9599
  reqParams = exports.Api.PrepReqParams(reqParams);
9477
- const key = GetCountsMIMETypeCacheKey();
9600
+ const key = GetCountsMIMETypeCacheKey(folderId);
9478
9601
  const cache = api.GetCacheItem(key, reqParams);
9479
9602
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9480
9603
  return cache.data;
9481
9604
  }
9482
9605
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9483
9606
  try {
9484
- const data = yield api.GET("file/mimetype/counts", exports.Api.PrepReqParams(reqParams));
9607
+ const data = yield api.GET(FolderQuery("file/mimetype/counts", folderId), exports.Api.PrepReqParams(reqParams));
9485
9608
  res({
9486
9609
  counts: data
9487
9610
  });
@@ -9508,19 +9631,19 @@
9508
9631
  */
9509
9632
  function GetCountsUser(params) {
9510
9633
  return __awaiter(this, void 0, void 0, function* () {
9511
- let { api, req: reqParams } = params;
9634
+ let { api, folderId, req: reqParams } = params;
9512
9635
  if (!api) {
9513
9636
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9514
9637
  }
9515
9638
  reqParams = exports.Api.PrepReqParams(reqParams);
9516
- const key = GetCountsUserCacheKey();
9639
+ const key = GetCountsUserCacheKey(folderId);
9517
9640
  const cache = api.GetCacheItem(key, reqParams);
9518
9641
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9519
9642
  return cache.data;
9520
9643
  }
9521
9644
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9522
9645
  try {
9523
- const data = yield api.GET("file/user/counts", exports.Api.PrepReqParams(reqParams));
9646
+ const data = yield api.GET(FolderQuery("file/user/counts", folderId), exports.Api.PrepReqParams(reqParams));
9524
9647
  res({
9525
9648
  counts: data
9526
9649
  });
@@ -9555,6 +9678,8 @@
9555
9678
  EColumn["User"] = "user";
9556
9679
  EColumn["Extension"] = "extension";
9557
9680
  EColumn["Data"] = "data";
9681
+ // Exact folder equality only. Use 0 for top-level files.
9682
+ EColumn["Folder"] = "ClientFileFolder.ID";
9558
9683
  })(EColumn = Filter.EColumn || (Filter.EColumn = {}));
9559
9684
  let ESortOrder;
9560
9685
  (function (ESortOrder) {
@@ -9578,6 +9703,7 @@
9578
9703
  if (!api) {
9579
9704
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9580
9705
  }
9706
+ ValidateFolderFilter(filter);
9581
9707
  const data = yield api.POST("files/filtered", filter, exports.Api.PrepReqParams(reqParams));
9582
9708
  return {
9583
9709
  clientFiles: data.Items,
@@ -9596,6 +9722,7 @@
9596
9722
  if (!api) {
9597
9723
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9598
9724
  }
9725
+ ValidateFolderFilter(filter);
9599
9726
  const res = yield api.POST("files/filtered/delete", filter, exports.Api.PrepReqParams(reqParams));
9600
9727
  // We'll clear cache if at least one file was deleted.
9601
9728
  if ((res === null || res === void 0 ? void 0 : res.OK) && (res === null || res === void 0 ? void 0 : res.DeleteFilesCount) > 0) {
@@ -9608,6 +9735,87 @@
9608
9735
  });
9609
9736
  }
9610
9737
  ClientFile.DeleteList = DeleteList;
9738
+ function UpdateList(params) {
9739
+ return __awaiter(this, void 0, void 0, function* () {
9740
+ if (!params.items || params.items.some(item => !(item === null || item === void 0 ? void 0 : item.ID)))
9741
+ throw new Error("File ID is required for every update.");
9742
+ params.items.forEach(item => ValidateFolderFilter(item));
9743
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9744
+ const result = yield api.POST("file/details", { Items: params.items }, exports.Api.PrepReqParams(params.req));
9745
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9746
+ return { clientFiles: (result === null || result === void 0 ? void 0 : result.Items) || [], errors: (result === null || result === void 0 ? void 0 : result.Error) || [] };
9747
+ });
9748
+ }
9749
+ ClientFile.UpdateList = UpdateList;
9750
+ /** Modern list endpoint. GetList keeps using the legacy JSON filter for existing callers. */
9751
+ function GetListByQuery(params) {
9752
+ return __awaiter(this, void 0, void 0, function* () {
9753
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9754
+ const query = new URLSearchParams();
9755
+ Object.keys(params.filter || {}).forEach(key => {
9756
+ const value = params.filter[key];
9757
+ if (value === undefined)
9758
+ return;
9759
+ if (key === "ClientFileFolder.ID") {
9760
+ query.append(key, exports.ClientFileFolder.NormalizeId(value == null ? 0 : value, true));
9761
+ }
9762
+ else if (value != null) {
9763
+ (Array.isArray(value) ? value : [value]).forEach(item => query.append(key, String(item)));
9764
+ }
9765
+ });
9766
+ const url = "files" + (query.toString() ? "?" + query.toString() : "");
9767
+ const result = yield api.GET(url, exports.Api.PrepReqParams(params.req));
9768
+ return { clientFiles: (result === null || result === void 0 ? void 0 : result.Items) || [], totalCount: result === null || result === void 0 ? void 0 : result.TotalCount,
9769
+ nextPage: result === null || result === void 0 ? void 0 : result.NextPage, nextPageUrl: result === null || result === void 0 ? void 0 : result.NextPageURL };
9770
+ });
9771
+ }
9772
+ ClientFile.GetListByQuery = GetListByQuery;
9773
+ /** Replace file content through the existing update route, preserving membership when omitted. */
9774
+ function ReplaceContent(params) {
9775
+ return __awaiter(this, void 0, void 0, function* () {
9776
+ if (!params.fileId)
9777
+ throw new Error("File ID is required.");
9778
+ if (!params.file)
9779
+ throw new Error("File is required.");
9780
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9781
+ const req = PrepareUploadMetadata(params.req, params.folderId);
9782
+ const clientFile = yield api.UPLOAD(`file/update/${encodeURIComponent(params.fileId)}`, params.file, req);
9783
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9784
+ return { clientFile };
9785
+ });
9786
+ }
9787
+ ClientFile.ReplaceContent = ReplaceContent;
9788
+ function ValidateFolderFilter(filter) {
9789
+ const folderId = filter === null || filter === void 0 ? void 0 : filter["ClientFileFolder.ID"];
9790
+ if (folderId != null)
9791
+ exports.ClientFileFolder.NormalizeId(folderId, true);
9792
+ }
9793
+ function FolderQuery(url, folderId) {
9794
+ return folderId === undefined ? url : `${url}?ClientFileFolder.ID=${exports.ClientFileFolder.NormalizeId(folderId == null ? 0 : folderId, true)}`;
9795
+ }
9796
+ function FolderCacheSuffix(folderId) {
9797
+ return folderId === undefined ? "" : `:folder:${exports.ClientFileFolder.NormalizeId(folderId == null ? 0 : folderId, true)}`;
9798
+ }
9799
+ function PrepareUploadMetadata(base, folderId, purpose) {
9800
+ const req = exports.Api.PrepReqParams(base);
9801
+ if (folderId === undefined && purpose === undefined)
9802
+ return req;
9803
+ const values = {};
9804
+ if (folderId !== undefined)
9805
+ values["ClientFileFolder.ID"] = exports.ClientFileFolder.NormalizeId(folderId == null ? 0 : folderId, true);
9806
+ if (purpose !== undefined)
9807
+ values.Purpose = purpose;
9808
+ if (typeof FormData !== "undefined" && req.formData instanceof FormData) {
9809
+ const form = new FormData();
9810
+ req.formData.forEach((value, key) => form.append(key, value));
9811
+ Object.keys(values).forEach(key => form.set(key, values[key]));
9812
+ req.formData = form;
9813
+ }
9814
+ else {
9815
+ req.formData = Object.assign(Object.assign({}, req.formData), values);
9816
+ }
9817
+ return req;
9818
+ }
9611
9819
  /**
9612
9820
  * Utility for processing client files.
9613
9821
  * Commonly used to convert a file to a different format. Eg: FBX to GLB.
@@ -9659,20 +9867,20 @@
9659
9867
  return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.Id}${fileId}`;
9660
9868
  }
9661
9869
  ClientFile.GetCacheKey = GetCacheKey;
9662
- function GetCountsPurposeCacheKey() {
9663
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsPurpose}`;
9870
+ function GetCountsPurposeCacheKey(folderId) {
9871
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsPurpose}${FolderCacheSuffix(folderId)}`;
9664
9872
  }
9665
9873
  ClientFile.GetCountsPurposeCacheKey = GetCountsPurposeCacheKey;
9666
- function GetCountsExtensionCacheKey() {
9667
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsExtension}`;
9874
+ function GetCountsExtensionCacheKey(folderId) {
9875
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsExtension}${FolderCacheSuffix(folderId)}`;
9668
9876
  }
9669
9877
  ClientFile.GetCountsExtensionCacheKey = GetCountsExtensionCacheKey;
9670
- function GetCountsMIMETypeCacheKey() {
9671
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsMIMEType}`;
9878
+ function GetCountsMIMETypeCacheKey(folderId) {
9879
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsMIMEType}${FolderCacheSuffix(folderId)}`;
9672
9880
  }
9673
9881
  ClientFile.GetCountsMIMETypeCacheKey = GetCountsMIMETypeCacheKey;
9674
- function GetCountsUserCacheKey() {
9675
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsUser}`;
9882
+ function GetCountsUserCacheKey(folderId) {
9883
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsUser}${FolderCacheSuffix(folderId)}`;
9676
9884
  }
9677
9885
  ClientFile.GetCountsUserCacheKey = GetCountsUserCacheKey;
9678
9886
  })(exports.ClientFile || (exports.ClientFile = {}));
@@ -24997,7 +25205,7 @@
24997
25205
  }
24998
25206
 
24999
25207
  // This is updated with the package.json version on build.
25000
- const VERSION = "7.1.120";
25208
+ const VERSION = "7.1.122";
25001
25209
 
25002
25210
  exports.VERSION = VERSION;
25003
25211
  exports.AbstractApi = AbstractApi;