bruce-models 4.1.8 → 4.2.0

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.
@@ -8769,7 +8769,10 @@
8769
8769
  if (!api) {
8770
8770
  api = exports.ENVIRONMENT.Api().GetBruceApi();
8771
8771
  }
8772
- let isNew = !data.id;
8772
+ // We check if the tileset has settings.
8773
+ // This is to stop invalid responses from API when we make new tilesets and call an update on them.
8774
+ const hasSettings = data.settings && Object.keys(data.settings).length > 0;
8775
+ const isNew = !data.id;
8773
8776
  if (isNew) {
8774
8777
  const res = yield api.GET(`tileset/new?type=${data.type}&name=${exports.Api.Encode(data.name)}`, reqParams);
8775
8778
  data = Object.assign(Object.assign(Object.assign({}, res), data), { settings: Object.assign(Object.assign({}, res.settings), data.settings), id: res.id });
@@ -8780,7 +8783,10 @@
8780
8783
  yield api.POST(`ui.tileset/${data.id}`, legacy, exports.Api.PrepReqParams(reqParams));
8781
8784
  }
8782
8785
  else {
8783
- yield api.POST(`tileset/update/${data.id}`, data, exports.Api.PrepReqParams(reqParams));
8786
+ // Avoid calling an update on a new tileset with no settings.
8787
+ if (!isNew || hasSettings) {
8788
+ yield api.POST(`tileset/update/${data.id}`, data, exports.Api.PrepReqParams(reqParams));
8789
+ }
8784
8790
  }
8785
8791
  yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Tileset + exports.Api.ECacheKey.Id + data.id);
8786
8792
  yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Tileset);
@@ -12892,7 +12898,7 @@
12892
12898
  })(exports.DataSource || (exports.DataSource = {}));
12893
12899
 
12894
12900
  // This is updated with the package.json version on build.
12895
- const VERSION = "4.1.8";
12901
+ const VERSION = "4.2.0";
12896
12902
 
12897
12903
  exports.VERSION = VERSION;
12898
12904
  exports.AbstractApi = AbstractApi;