bruce-models 7.1.120 → 7.1.121

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.
@@ -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
@@ -9055,6 +9072,18 @@
9055
9072
  const blob = file.slice(fileOffset, fileOffset + partSize);
9056
9073
  const partialFile = new File([blob], file.name, { type: file.type });
9057
9074
  const formData = new FormData();
9075
+ // Keep custom metadata on every part, including retries. Core transport fields are controlled below.
9076
+ const appendField = (key, value) => {
9077
+ if (!["file", "token", "count", "part", "originalfilename"].includes(key.toLowerCase())) {
9078
+ formData.append(key, value);
9079
+ }
9080
+ };
9081
+ if (typeof FormData !== "undefined" && (req === null || req === void 0 ? void 0 : req.formData) instanceof FormData) {
9082
+ req.formData.forEach((value, key) => appendField(key, value));
9083
+ }
9084
+ else if (req === null || req === void 0 ? void 0 : req.formData) {
9085
+ Object.keys(req.formData).forEach(key => appendField(key, req.formData[key]));
9086
+ }
9058
9087
  formData.append("originalFileName", file.name);
9059
9088
  formData.append("token", uploadToken);
9060
9089
  formData.append("count", "" + filePartsCount);
@@ -9120,6 +9149,99 @@
9120
9149
  Uploader.DoMultiPartUpload = DoMultiPartUpload;
9121
9150
  })(exports.Uploader || (exports.Uploader = {}));
9122
9151
 
9152
+ (function (ClientFileFolder) {
9153
+ /** Validate and normalize an ID for routes, queries and cache keys without rounding it. */
9154
+ function NormalizeId(id, allowZero = false) {
9155
+ if (typeof id === "number" && (!Number.isSafeInteger(id) || id < 0)) {
9156
+ throw new Error("Folder ID must be a safe integer, or a decimal string for a larger bigint ID.");
9157
+ }
9158
+ if ((typeof id !== "string" && typeof id !== "number") || !/^\d+$/.test(String(id))) {
9159
+ throw new Error("Folder ID must be a non-negative decimal integer.");
9160
+ }
9161
+ const value = String(id).replace(/^0+(?=\d)/, "");
9162
+ if ((!allowZero && value === "0") || value.length > 19 ||
9163
+ (value.length === 19 && value > "9223372036854775807")) {
9164
+ throw new Error("Folder ID must be a positive signed 64-bit integer (0 is allowed only for the top level or creation).");
9165
+ }
9166
+ return value;
9167
+ }
9168
+ ClientFileFolder.NormalizeId = NormalizeId;
9169
+ function Get(params) {
9170
+ return __awaiter(this, void 0, void 0, function* () {
9171
+ const id = NormalizeId(params.folderId);
9172
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9173
+ const key = GetCacheKey(id);
9174
+ const cache = api.GetCacheItem(key, params.req);
9175
+ if (cache === null || cache === void 0 ? void 0 : cache.found)
9176
+ return cache.data;
9177
+ const promise = api.GET(`clientFileFolder/${id}`, exports.Api.PrepReqParams(params.req))
9178
+ .then(folder => ({ folder }));
9179
+ api.SetCacheItem({ key, value: promise, req: params.req });
9180
+ return promise;
9181
+ });
9182
+ }
9183
+ ClientFileFolder.Get = Get;
9184
+ /** Omit parentFolderId for all folders. Null or 0 selects only top-level folders. */
9185
+ function GetList(params = {}) {
9186
+ return __awaiter(this, void 0, void 0, function* () {
9187
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9188
+ const parent = params.parentFolderId === undefined ? undefined : NormalizeId(params.parentFolderId == null ? 0 : params.parentFolderId, true);
9189
+ const key = GetListCacheKey(parent);
9190
+ const cache = api.GetCacheItem(key, params.req);
9191
+ if (cache === null || cache === void 0 ? void 0 : cache.found)
9192
+ return cache.data;
9193
+ const url = "clientFileFolders" + (parent === undefined ? "" : `?parent_folder_id=${parent}`);
9194
+ const promise = api.GET(url, exports.Api.PrepReqParams(params.req))
9195
+ .then(data => ({ folders: (data === null || data === void 0 ? void 0 : data.Items) || [] }));
9196
+ api.SetCacheItem({ key, value: promise, req: params.req });
9197
+ return promise;
9198
+ });
9199
+ }
9200
+ ClientFileFolder.GetList = GetList;
9201
+ /** Create when folderId and folder.ID are omitted or 0; otherwise update only supplied fields. */
9202
+ function Update(params) {
9203
+ return __awaiter(this, void 0, void 0, function* () {
9204
+ if (!params.folder)
9205
+ throw new Error("Folder data is required.");
9206
+ const folder = Object.assign({}, params.folder);
9207
+ const id = NormalizeId(params.folderId !== undefined ? params.folderId : folder.ID == null ? 0 : folder.ID, true);
9208
+ if (folder["Parent.ClientFileFolder.ID"] != null)
9209
+ NormalizeId(folder["Parent.ClientFileFolder.ID"], true);
9210
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9211
+ const result = yield api.POST(`clientFileFolder/${id}`, folder, exports.Api.PrepReqParams(params.req));
9212
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFileFolder);
9213
+ return { folder: result };
9214
+ });
9215
+ }
9216
+ ClientFileFolder.Update = Update;
9217
+ function Create(params) {
9218
+ return __awaiter(this, void 0, void 0, function* () {
9219
+ return Update(Object.assign(Object.assign({}, params), { folderId: 0 }));
9220
+ });
9221
+ }
9222
+ ClientFileFolder.Create = Create;
9223
+ /** Contents move into the deleted folder's parent (or the top level); files are preserved. */
9224
+ function Delete(params) {
9225
+ return __awaiter(this, void 0, void 0, function* () {
9226
+ const id = NormalizeId(params.folderId);
9227
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9228
+ yield api.DELETE(`clientFileFolder/${id}`, exports.Api.PrepReqParams(params.req));
9229
+ // This prefix also covers folder records and all scoped file-count caches.
9230
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9231
+ });
9232
+ }
9233
+ ClientFileFolder.Delete = Delete;
9234
+ function GetCacheKey(folderId) {
9235
+ return `${exports.Api.ECacheKey.ClientFileFolder}${exports.Api.ECacheKey.Id}${NormalizeId(folderId)}`;
9236
+ }
9237
+ ClientFileFolder.GetCacheKey = GetCacheKey;
9238
+ function GetListCacheKey(parentFolderId) {
9239
+ const parent = parentFolderId === undefined ? "all" : NormalizeId(parentFolderId == null ? 0 : parentFolderId, true);
9240
+ return `${exports.Api.ECacheKey.ClientFileFolder}${exports.Api.ECacheKey.ListId}${parent}`;
9241
+ }
9242
+ ClientFileFolder.GetListCacheKey = GetListCacheKey;
9243
+ })(exports.ClientFileFolder || (exports.ClientFileFolder = {}));
9244
+
9123
9245
  (function (ClientFile) {
9124
9246
  let EPurpose;
9125
9247
  (function (EPurpose) {
@@ -9231,10 +9353,7 @@
9231
9353
  Items: fileIds
9232
9354
  };
9233
9355
  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
- }
9356
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9238
9357
  });
9239
9358
  }
9240
9359
  ClientFile.Delete = Delete;
@@ -9245,7 +9364,7 @@
9245
9364
  */
9246
9365
  function Upload(params) {
9247
9366
  return __awaiter(this, void 0, void 0, function* () {
9248
- let { api, file, purpose, req, onProgress } = params;
9367
+ let { api, file, purpose, folderId, req, onProgress } = params;
9249
9368
  if (!api) {
9250
9369
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9251
9370
  }
@@ -9257,6 +9376,7 @@
9257
9376
  throw ("You cannot upload a 0byte sized file.");
9258
9377
  }
9259
9378
  req = exports.Api.PrepReqParams(req);
9379
+ req = PrepareUploadMetadata(req, folderId, purpose);
9260
9380
  let clientFile;
9261
9381
  if (size > exports.Uploader.MIN_LARGE_FILE_SIZE) {
9262
9382
  clientFile = yield exports.Uploader.DoMultiPartUpload({
@@ -9266,15 +9386,6 @@
9266
9386
  req,
9267
9387
  onProgress
9268
9388
  });
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
9389
  }
9279
9390
  else {
9280
9391
  req.onProgress = (progress) => {
@@ -9284,17 +9395,13 @@
9284
9395
  uploaded: false
9285
9396
  });
9286
9397
  };
9287
- if (purpose) {
9288
- req.formData = {
9289
- Purpose: purpose
9290
- };
9291
- }
9292
9398
  clientFile = yield api.UPLOAD("file/uploadNew", file, req);
9293
9399
  }
9294
9400
  onProgress === null || onProgress === void 0 ? void 0 : onProgress({
9295
9401
  percent: 100,
9296
9402
  uploaded: true
9297
9403
  });
9404
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9298
9405
  return {
9299
9406
  clientFile
9300
9407
  };
@@ -9307,11 +9414,18 @@
9307
9414
  */
9308
9415
  function Update(params) {
9309
9416
  return __awaiter(this, void 0, void 0, function* () {
9310
- let { api, fileId, purpose, layerIds, req: reqParams, dataEntityId } = params;
9417
+ let { api, fileId, purpose, layerIds, folderId, req: reqParams, dataEntityId } = params;
9418
+ if (!fileId)
9419
+ throw new Error("File ID is required.");
9311
9420
  if (!api) {
9312
9421
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9313
9422
  }
9314
9423
  const data = {};
9424
+ if (folderId !== undefined) {
9425
+ if (folderId !== null)
9426
+ exports.ClientFileFolder.NormalizeId(folderId, true);
9427
+ data["ClientFileFolder.ID"] = folderId;
9428
+ }
9315
9429
  if (layerIds != null) {
9316
9430
  data["Layer.ID"] = layerIds;
9317
9431
  }
@@ -9322,8 +9436,7 @@
9322
9436
  data["Data.Entity.ID"] = dataEntityId ? dataEntityId : "";
9323
9437
  }
9324
9438
  yield api.POST(`file/${fileId}/details`, data, exports.Api.PrepReqParams(reqParams));
9325
- const cacheKey = GetCacheKey(fileId);
9326
- api.Cache.RemoveByContains(cacheKey);
9439
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9327
9440
  });
9328
9441
  }
9329
9442
  ClientFile.Update = Update;
@@ -9391,19 +9504,19 @@
9391
9504
  */
9392
9505
  function GetCountsPurpose(params) {
9393
9506
  return __awaiter(this, void 0, void 0, function* () {
9394
- let { api, req: reqParams } = params;
9507
+ let { api, folderId, req: reqParams } = params;
9395
9508
  if (!api) {
9396
9509
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9397
9510
  }
9398
9511
  reqParams = exports.Api.PrepReqParams(reqParams);
9399
- const key = GetCountsPurposeCacheKey();
9512
+ const key = GetCountsPurposeCacheKey(folderId);
9400
9513
  const cache = api.GetCacheItem(key, reqParams);
9401
9514
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9402
9515
  return cache.data;
9403
9516
  }
9404
9517
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9405
9518
  try {
9406
- const data = yield api.GET("file/purpose/counts", exports.Api.PrepReqParams(reqParams));
9519
+ const data = yield api.GET(FolderQuery("file/purpose/counts", folderId), exports.Api.PrepReqParams(reqParams));
9407
9520
  res({
9408
9521
  counts: data
9409
9522
  });
@@ -9430,19 +9543,19 @@
9430
9543
  */
9431
9544
  function GetCountsExtension(params) {
9432
9545
  return __awaiter(this, void 0, void 0, function* () {
9433
- let { api, req: reqParams } = params;
9546
+ let { api, folderId, req: reqParams } = params;
9434
9547
  if (!api) {
9435
9548
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9436
9549
  }
9437
9550
  reqParams = exports.Api.PrepReqParams(reqParams);
9438
- const key = GetCountsExtensionCacheKey();
9551
+ const key = GetCountsExtensionCacheKey(folderId);
9439
9552
  const cache = api.GetCacheItem(key, reqParams);
9440
9553
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9441
9554
  return cache.data;
9442
9555
  }
9443
9556
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9444
9557
  try {
9445
- const data = yield api.GET("file/extension/counts", exports.Api.PrepReqParams(reqParams));
9558
+ const data = yield api.GET(FolderQuery("file/extension/counts", folderId), exports.Api.PrepReqParams(reqParams));
9446
9559
  res({
9447
9560
  counts: data
9448
9561
  });
@@ -9469,19 +9582,19 @@
9469
9582
  */
9470
9583
  function GetCountsMIMEType(params) {
9471
9584
  return __awaiter(this, void 0, void 0, function* () {
9472
- let { api, req: reqParams } = params;
9585
+ let { api, folderId, req: reqParams } = params;
9473
9586
  if (!api) {
9474
9587
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9475
9588
  }
9476
9589
  reqParams = exports.Api.PrepReqParams(reqParams);
9477
- const key = GetCountsMIMETypeCacheKey();
9590
+ const key = GetCountsMIMETypeCacheKey(folderId);
9478
9591
  const cache = api.GetCacheItem(key, reqParams);
9479
9592
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9480
9593
  return cache.data;
9481
9594
  }
9482
9595
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9483
9596
  try {
9484
- const data = yield api.GET("file/mimetype/counts", exports.Api.PrepReqParams(reqParams));
9597
+ const data = yield api.GET(FolderQuery("file/mimetype/counts", folderId), exports.Api.PrepReqParams(reqParams));
9485
9598
  res({
9486
9599
  counts: data
9487
9600
  });
@@ -9508,19 +9621,19 @@
9508
9621
  */
9509
9622
  function GetCountsUser(params) {
9510
9623
  return __awaiter(this, void 0, void 0, function* () {
9511
- let { api, req: reqParams } = params;
9624
+ let { api, folderId, req: reqParams } = params;
9512
9625
  if (!api) {
9513
9626
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9514
9627
  }
9515
9628
  reqParams = exports.Api.PrepReqParams(reqParams);
9516
- const key = GetCountsUserCacheKey();
9629
+ const key = GetCountsUserCacheKey(folderId);
9517
9630
  const cache = api.GetCacheItem(key, reqParams);
9518
9631
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9519
9632
  return cache.data;
9520
9633
  }
9521
9634
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
9522
9635
  try {
9523
- const data = yield api.GET("file/user/counts", exports.Api.PrepReqParams(reqParams));
9636
+ const data = yield api.GET(FolderQuery("file/user/counts", folderId), exports.Api.PrepReqParams(reqParams));
9524
9637
  res({
9525
9638
  counts: data
9526
9639
  });
@@ -9555,6 +9668,8 @@
9555
9668
  EColumn["User"] = "user";
9556
9669
  EColumn["Extension"] = "extension";
9557
9670
  EColumn["Data"] = "data";
9671
+ // Exact folder equality only. Use 0 for top-level files.
9672
+ EColumn["Folder"] = "ClientFileFolder.ID";
9558
9673
  })(EColumn = Filter.EColumn || (Filter.EColumn = {}));
9559
9674
  let ESortOrder;
9560
9675
  (function (ESortOrder) {
@@ -9578,6 +9693,7 @@
9578
9693
  if (!api) {
9579
9694
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9580
9695
  }
9696
+ ValidateFolderFilter(filter);
9581
9697
  const data = yield api.POST("files/filtered", filter, exports.Api.PrepReqParams(reqParams));
9582
9698
  return {
9583
9699
  clientFiles: data.Items,
@@ -9596,6 +9712,7 @@
9596
9712
  if (!api) {
9597
9713
  api = exports.ENVIRONMENT.Api().GetBruceApi();
9598
9714
  }
9715
+ ValidateFolderFilter(filter);
9599
9716
  const res = yield api.POST("files/filtered/delete", filter, exports.Api.PrepReqParams(reqParams));
9600
9717
  // We'll clear cache if at least one file was deleted.
9601
9718
  if ((res === null || res === void 0 ? void 0 : res.OK) && (res === null || res === void 0 ? void 0 : res.DeleteFilesCount) > 0) {
@@ -9608,6 +9725,87 @@
9608
9725
  });
9609
9726
  }
9610
9727
  ClientFile.DeleteList = DeleteList;
9728
+ function UpdateList(params) {
9729
+ return __awaiter(this, void 0, void 0, function* () {
9730
+ if (!params.items || params.items.some(item => !(item === null || item === void 0 ? void 0 : item.ID)))
9731
+ throw new Error("File ID is required for every update.");
9732
+ params.items.forEach(item => ValidateFolderFilter(item));
9733
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9734
+ const result = yield api.POST("file/details", { Items: params.items }, exports.Api.PrepReqParams(params.req));
9735
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9736
+ return { clientFiles: (result === null || result === void 0 ? void 0 : result.Items) || [], errors: (result === null || result === void 0 ? void 0 : result.Error) || [] };
9737
+ });
9738
+ }
9739
+ ClientFile.UpdateList = UpdateList;
9740
+ /** Modern list endpoint. GetList keeps using the legacy JSON filter for existing callers. */
9741
+ function GetListByQuery(params) {
9742
+ return __awaiter(this, void 0, void 0, function* () {
9743
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9744
+ const query = new URLSearchParams();
9745
+ Object.keys(params.filter || {}).forEach(key => {
9746
+ const value = params.filter[key];
9747
+ if (value === undefined)
9748
+ return;
9749
+ if (key === "ClientFileFolder.ID") {
9750
+ query.append(key, exports.ClientFileFolder.NormalizeId(value == null ? 0 : value, true));
9751
+ }
9752
+ else if (value != null) {
9753
+ (Array.isArray(value) ? value : [value]).forEach(item => query.append(key, String(item)));
9754
+ }
9755
+ });
9756
+ const url = "files" + (query.toString() ? "?" + query.toString() : "");
9757
+ const result = yield api.GET(url, exports.Api.PrepReqParams(params.req));
9758
+ return { clientFiles: (result === null || result === void 0 ? void 0 : result.Items) || [], totalCount: result === null || result === void 0 ? void 0 : result.TotalCount,
9759
+ nextPage: result === null || result === void 0 ? void 0 : result.NextPage, nextPageUrl: result === null || result === void 0 ? void 0 : result.NextPageURL };
9760
+ });
9761
+ }
9762
+ ClientFile.GetListByQuery = GetListByQuery;
9763
+ /** Replace file content through the existing update route, preserving membership when omitted. */
9764
+ function ReplaceContent(params) {
9765
+ return __awaiter(this, void 0, void 0, function* () {
9766
+ if (!params.fileId)
9767
+ throw new Error("File ID is required.");
9768
+ if (!params.file)
9769
+ throw new Error("File is required.");
9770
+ const api = params.api || exports.ENVIRONMENT.Api().GetBruceApi();
9771
+ const req = PrepareUploadMetadata(params.req, params.folderId);
9772
+ const clientFile = yield api.UPLOAD(`file/update/${encodeURIComponent(params.fileId)}`, params.file, req);
9773
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.ClientFile);
9774
+ return { clientFile };
9775
+ });
9776
+ }
9777
+ ClientFile.ReplaceContent = ReplaceContent;
9778
+ function ValidateFolderFilter(filter) {
9779
+ const folderId = filter === null || filter === void 0 ? void 0 : filter["ClientFileFolder.ID"];
9780
+ if (folderId != null)
9781
+ exports.ClientFileFolder.NormalizeId(folderId, true);
9782
+ }
9783
+ function FolderQuery(url, folderId) {
9784
+ return folderId === undefined ? url : `${url}?ClientFileFolder.ID=${exports.ClientFileFolder.NormalizeId(folderId == null ? 0 : folderId, true)}`;
9785
+ }
9786
+ function FolderCacheSuffix(folderId) {
9787
+ return folderId === undefined ? "" : `:folder:${exports.ClientFileFolder.NormalizeId(folderId == null ? 0 : folderId, true)}`;
9788
+ }
9789
+ function PrepareUploadMetadata(base, folderId, purpose) {
9790
+ const req = exports.Api.PrepReqParams(base);
9791
+ if (folderId === undefined && purpose === undefined)
9792
+ return req;
9793
+ const values = {};
9794
+ if (folderId !== undefined)
9795
+ values["ClientFileFolder.ID"] = exports.ClientFileFolder.NormalizeId(folderId == null ? 0 : folderId, true);
9796
+ if (purpose !== undefined)
9797
+ values.Purpose = purpose;
9798
+ if (typeof FormData !== "undefined" && req.formData instanceof FormData) {
9799
+ const form = new FormData();
9800
+ req.formData.forEach((value, key) => form.append(key, value));
9801
+ Object.keys(values).forEach(key => form.set(key, values[key]));
9802
+ req.formData = form;
9803
+ }
9804
+ else {
9805
+ req.formData = Object.assign(Object.assign({}, req.formData), values);
9806
+ }
9807
+ return req;
9808
+ }
9611
9809
  /**
9612
9810
  * Utility for processing client files.
9613
9811
  * Commonly used to convert a file to a different format. Eg: FBX to GLB.
@@ -9659,20 +9857,20 @@
9659
9857
  return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.Id}${fileId}`;
9660
9858
  }
9661
9859
  ClientFile.GetCacheKey = GetCacheKey;
9662
- function GetCountsPurposeCacheKey() {
9663
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsPurpose}`;
9860
+ function GetCountsPurposeCacheKey(folderId) {
9861
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsPurpose}${FolderCacheSuffix(folderId)}`;
9664
9862
  }
9665
9863
  ClientFile.GetCountsPurposeCacheKey = GetCountsPurposeCacheKey;
9666
- function GetCountsExtensionCacheKey() {
9667
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsExtension}`;
9864
+ function GetCountsExtensionCacheKey(folderId) {
9865
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsExtension}${FolderCacheSuffix(folderId)}`;
9668
9866
  }
9669
9867
  ClientFile.GetCountsExtensionCacheKey = GetCountsExtensionCacheKey;
9670
- function GetCountsMIMETypeCacheKey() {
9671
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsMIMEType}`;
9868
+ function GetCountsMIMETypeCacheKey(folderId) {
9869
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsMIMEType}${FolderCacheSuffix(folderId)}`;
9672
9870
  }
9673
9871
  ClientFile.GetCountsMIMETypeCacheKey = GetCountsMIMETypeCacheKey;
9674
- function GetCountsUserCacheKey() {
9675
- return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsUser}`;
9872
+ function GetCountsUserCacheKey(folderId) {
9873
+ return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.ClientFileCountsUser}${FolderCacheSuffix(folderId)}`;
9676
9874
  }
9677
9875
  ClientFile.GetCountsUserCacheKey = GetCountsUserCacheKey;
9678
9876
  })(exports.ClientFile || (exports.ClientFile = {}));
@@ -24997,7 +25195,7 @@
24997
25195
  }
24998
25196
 
24999
25197
  // This is updated with the package.json version on build.
25000
- const VERSION = "7.1.120";
25198
+ const VERSION = "7.1.121";
25001
25199
 
25002
25200
  exports.VERSION = VERSION;
25003
25201
  exports.AbstractApi = AbstractApi;