bruce-models 4.1.9 → 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,8 +8783,8 @@
8780
8783
  yield api.POST(`ui.tileset/${data.id}`, legacy, exports.Api.PrepReqParams(reqParams));
8781
8784
  }
8782
8785
  else {
8783
- // We avoid saving again if there are no settings and it is new.
8784
- if (!isNew || (data.settings && Object.keys(data.settings).length > 0)) {
8786
+ // Avoid calling an update on a new tileset with no settings.
8787
+ if (!isNew || hasSettings) {
8785
8788
  yield api.POST(`tileset/update/${data.id}`, data, exports.Api.PrepReqParams(reqParams));
8786
8789
  }
8787
8790
  }
@@ -12895,7 +12898,7 @@
12895
12898
  })(exports.DataSource || (exports.DataSource = {}));
12896
12899
 
12897
12900
  // This is updated with the package.json version on build.
12898
- const VERSION = "4.1.9";
12901
+ const VERSION = "4.2.0";
12899
12902
 
12900
12903
  exports.VERSION = VERSION;
12901
12904
  exports.AbstractApi = AbstractApi;