bruce-models 2.5.0 → 2.5.2

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.
@@ -3122,45 +3122,24 @@
3122
3122
  // Need to see if our api is generally good at setting content-type headers.
3123
3123
  // Make it less specific to CSV.
3124
3124
  function parseResult(data) {
3125
+ var _a, _b;
3125
3126
  return __awaiter(this, void 0, void 0, function* () {
3126
- if (data.status == 200) {
3127
- let type = data.headers.get("Content-Type");
3128
- if (type) {
3129
- type = type.trim().toLowerCase();
3130
- }
3131
- let encoding = "";
3132
- const charset = type ? type.split(";").find((x) => x.startsWith("charset=")) : "";
3133
- if (charset && charset.includes("=")) {
3134
- encoding = charset.split("=")[1];
3135
- encoding = encoding.toLowerCase();
3136
- }
3137
- // Our API has a very specific utf-16 encoding.
3138
- if (encoding == "utf-16") {
3139
- encoding = exports.Api.EEncoding.UTF16;
3140
- }
3141
- if (!encoding || encoding == "utf-8") {
3142
- const text = yield data.text();
3143
- if (!text || !text.trim()) {
3144
- return null;
3145
- }
3146
- if (type && type.includes("text/csv")) {
3147
- return text;
3148
- }
3149
- return JSON.parse(text);
3150
- }
3151
- else {
3152
- const buffer = yield data.arrayBuffer();
3153
- const text = new TextDecoder(encoding).decode(buffer);
3154
- if (type && type.includes("text/csv")) {
3155
- return text;
3156
- }
3157
- return JSON.parse(text);
3158
- }
3159
- }
3160
- else {
3127
+ if (data.status !== 200) {
3161
3128
  const error = yield data.json();
3162
3129
  throw (error);
3163
3130
  }
3131
+ let type = (_a = data.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
3132
+ let encoding = (_b = type === null || type === void 0 ? void 0 : type.split(";").find((x) => x.startsWith("charset="))) === null || _b === void 0 ? void 0 : _b.split("=")[1].toLowerCase();
3133
+ if (encoding === "utf-16") {
3134
+ encoding = exports.Api.EEncoding.UTF16;
3135
+ }
3136
+ const text = yield (encoding && encoding !== "utf-8"
3137
+ ? new TextDecoder(encoding).decode(yield data.arrayBuffer())
3138
+ : data.text());
3139
+ if (!(text === null || text === void 0 ? void 0 : text.trim())) {
3140
+ return null;
3141
+ }
3142
+ return (type === null || type === void 0 ? void 0 : type.includes("text/csv")) ? text : JSON.parse(text);
3164
3143
  });
3165
3144
  }
3166
3145
  /**
@@ -4520,7 +4499,7 @@
4520
4499
  // Unused if IS_SELF_MANAGED is false.
4521
4500
  ENVIRONMENT.PARAMS = {
4522
4501
  accountId: "",
4523
- env: exports.Api.EEnv.PROD,
4502
+ env: exports.Api.EEnv.UAT,
4524
4503
  sessionId: ""
4525
4504
  };
4526
4505
  function Api$$1() {
@@ -4533,7 +4512,7 @@
4533
4512
  if (!_getters) {
4534
4513
  _getters = new ApiGetters({
4535
4514
  accountId: ENVIRONMENT.PARAMS.accountId,
4536
- env: ENVIRONMENT.PARAMS.env,
4515
+ env: ENVIRONMENT.PARAMS.env ? ENVIRONMENT.PARAMS.env : exports.Api.EEnv.UAT,
4537
4516
  sessionId: ENVIRONMENT.PARAMS.sessionId
4538
4517
  });
4539
4518
  }
@@ -11374,6 +11353,9 @@
11374
11353
  Plugin.GetLoadUrl = GetLoadUrl;
11375
11354
  })(exports.Plugin || (exports.Plugin = {}));
11376
11355
 
11356
+ const VERSION$1 = "2.5.2";
11357
+
11358
+ exports.VERSION = VERSION$1;
11377
11359
  exports.AbstractApi = AbstractApi;
11378
11360
  exports.ApiGetters = ApiGetters;
11379
11361
  exports.BruceEvent = BruceEvent;