bruce-models 2.5.1 → 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.
@@ -3117,45 +3117,24 @@ class CacheControl {
3117
3117
  // Need to see if our api is generally good at setting content-type headers.
3118
3118
  // Make it less specific to CSV.
3119
3119
  function parseResult(data) {
3120
+ var _a, _b;
3120
3121
  return __awaiter(this, void 0, void 0, function* () {
3121
- if (data.status == 200) {
3122
- let type = data.headers.get("Content-Type");
3123
- if (type) {
3124
- type = type.trim().toLowerCase();
3125
- }
3126
- let encoding = "";
3127
- const charset = type ? type.split(";").find((x) => x.startsWith("charset=")) : "";
3128
- if (charset && charset.includes("=")) {
3129
- encoding = charset.split("=")[1];
3130
- encoding = encoding.toLowerCase();
3131
- }
3132
- // Our API has a very specific utf-16 encoding.
3133
- if (encoding == "utf-16") {
3134
- encoding = Api.EEncoding.UTF16;
3135
- }
3136
- if (!encoding || encoding == "utf-8") {
3137
- const text = yield data.text();
3138
- if (!text || !text.trim()) {
3139
- return null;
3140
- }
3141
- if (type && type.includes("text/csv")) {
3142
- return text;
3143
- }
3144
- return JSON.parse(text);
3145
- }
3146
- else {
3147
- const buffer = yield data.arrayBuffer();
3148
- const text = new TextDecoder(encoding).decode(buffer);
3149
- if (type && type.includes("text/csv")) {
3150
- return text;
3151
- }
3152
- return JSON.parse(text);
3153
- }
3154
- }
3155
- else {
3122
+ if (data.status !== 200) {
3156
3123
  const error = yield data.json();
3157
3124
  throw (error);
3158
3125
  }
3126
+ let type = (_a = data.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
3127
+ 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();
3128
+ if (encoding === "utf-16") {
3129
+ encoding = Api.EEncoding.UTF16;
3130
+ }
3131
+ const text = yield (encoding && encoding !== "utf-8"
3132
+ ? new TextDecoder(encoding).decode(yield data.arrayBuffer())
3133
+ : data.text());
3134
+ if (!(text === null || text === void 0 ? void 0 : text.trim())) {
3135
+ return null;
3136
+ }
3137
+ return (type === null || type === void 0 ? void 0 : type.includes("text/csv")) ? text : JSON.parse(text);
3159
3138
  });
3160
3139
  }
3161
3140
  /**
@@ -11608,5 +11587,7 @@ var Plugin;
11608
11587
  Plugin.GetLoadUrl = GetLoadUrl;
11609
11588
  })(Plugin || (Plugin = {}));
11610
11589
 
11611
- export { AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT };
11590
+ const VERSION$1 = "2.5.2";
11591
+
11592
+ export { VERSION$1 as VERSION, AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT };
11612
11593
  //# sourceMappingURL=bruce-models.es5.js.map