bruce-models 1.8.1 → 1.8.3

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.
@@ -675,10 +675,16 @@ class AbstractApi {
675
675
  if (this.ssidHeader && this.ssid) {
676
676
  xhr.setRequestHeader(this.ssidHeader, this.ssid);
677
677
  }
678
- const formData = new FormData();
679
- if (params === null || params === void 0 ? void 0 : params.formData) {
680
- for (const key in params.formData) {
681
- formData.append(key, params.formData[key]);
678
+ let formData;
679
+ if ((params === null || params === void 0 ? void 0 : params.formData) instanceof FormData) {
680
+ formData = params === null || params === void 0 ? void 0 : params.formData;
681
+ }
682
+ else {
683
+ formData = new FormData();
684
+ if (params.formData) {
685
+ for (const key in params.formData) {
686
+ formData.append(key, params.formData[key]);
687
+ }
682
688
  }
683
689
  }
684
690
  formData.append("file", blob);
@@ -4846,7 +4852,7 @@ var ClientFile;
4846
4852
  ClientFile.Delete = Delete;
4847
4853
  function Upload(params) {
4848
4854
  return __awaiter(this, void 0, void 0, function* () {
4849
- const { api, file, purpose, req, onProgress } = params;
4855
+ let { api, file, purpose, req, onProgress } = params;
4850
4856
  if (!file) {
4851
4857
  throw ("File is required.");
4852
4858
  }
@@ -4854,6 +4860,7 @@ var ClientFile;
4854
4860
  if (!size) {
4855
4861
  throw ("You cannot upload a 0byte sized file.");
4856
4862
  }
4863
+ req = Api.PrepReqParams(req);
4857
4864
  let clientFile;
4858
4865
  if (size > Uploader.MIN_LARGE_FILE_SIZE) {
4859
4866
  clientFile = yield Uploader.DoMultiPartUpload({
@@ -4865,8 +4872,7 @@ var ClientFile;
4865
4872
  });
4866
4873
  }
4867
4874
  else {
4868
- const reqParams = Api.PrepReqParams(Object.assign({}, req));
4869
- reqParams.onProgress = (progress) => {
4875
+ req.onProgress = (progress) => {
4870
4876
  const percent = Math.round((progress.loaded / file.size) * 100);
4871
4877
  onProgress === null || onProgress === void 0 ? void 0 : onProgress({
4872
4878
  percent: percent,
@@ -4915,7 +4921,7 @@ var ClientFile;
4915
4921
  */
4916
4922
  function UploadTemp(params) {
4917
4923
  return __awaiter(this, void 0, void 0, function* () {
4918
- const { api, file, req, onProgress } = params;
4924
+ let { api, file, req, onProgress } = params;
4919
4925
  if (!file) {
4920
4926
  throw ("File is required.");
4921
4927
  }
@@ -4923,6 +4929,7 @@ var ClientFile;
4923
4929
  if (!size) {
4924
4930
  throw ("You cannot upload a 0byte sized file.");
4925
4931
  }
4932
+ req = Api.PrepReqParams(req);
4926
4933
  let tempFile;
4927
4934
  if (size > Uploader.MIN_LARGE_FILE_SIZE) {
4928
4935
  tempFile = yield Uploader.DoMultiPartUpload({
@@ -5280,7 +5287,7 @@ var Tileset;
5280
5287
  Tileset.Update = Update;
5281
5288
  function UploadFile(params) {
5282
5289
  return __awaiter(this, void 0, void 0, function* () {
5283
- const { api, file, req, tilesetId, onProgress } = params;
5290
+ let { api, file, req, tilesetId, onProgress } = params;
5284
5291
  if (!tilesetId || !file) {
5285
5292
  throw ("Tileset ID and file are required.");
5286
5293
  }
@@ -5288,6 +5295,7 @@ var Tileset;
5288
5295
  if (!size) {
5289
5296
  throw ("You cannot upload a 0byte sized file.");
5290
5297
  }
5298
+ req = Api.PrepReqParams(req);
5291
5299
  if (size > Uploader.MIN_LARGE_FILE_SIZE) {
5292
5300
  yield Uploader.DoMultiPartUpload({
5293
5301
  api,
@@ -5328,7 +5336,7 @@ var Tileset;
5328
5336
  Tileset.DeleteFile = DeleteFile;
5329
5337
  function UploadSrcFile(params) {
5330
5338
  return __awaiter(this, void 0, void 0, function* () {
5331
- const { api, file, req, tilesetId, onProgress } = params;
5339
+ let { api, file, req, tilesetId, onProgress } = params;
5332
5340
  if (!tilesetId || !file) {
5333
5341
  throw ("Tileset ID and file are required.");
5334
5342
  }
@@ -5336,6 +5344,7 @@ var Tileset;
5336
5344
  if (!size) {
5337
5345
  throw ("You cannot upload a 0byte sized file.");
5338
5346
  }
5347
+ req = Api.PrepReqParams(req);
5339
5348
  if (size > Uploader.MIN_LARGE_FILE_SIZE) {
5340
5349
  yield Uploader.DoMultiPartUpload({
5341
5350
  api,