@dendotdev/grunt 1.0.2 → 1.0.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.
package/dist/index.mjs CHANGED
@@ -334,8 +334,13 @@ var ClientBase = class {
334
334
  );
335
335
  }
336
336
  if (response.status === 304 && cached) {
337
- result.result = this.deserializeResponse(cached.content);
338
- result.response.message = "304 Not Modified - using cached response";
337
+ if (options.returnRaw) {
338
+ result.result = cached.content;
339
+ result.response.message = `304 Not Modified - cached binary: ${cached.content.length} bytes`;
340
+ } else {
341
+ result.result = this.deserializeResponse(cached.content);
342
+ result.response.message = "304 Not Modified - using cached response";
343
+ }
339
344
  return result;
340
345
  }
341
346
  const bodyBuffer = await response.arrayBuffer();
@@ -344,10 +349,15 @@ var ClientBase = class {
344
349
  const etag = response.headers.get(HEADERS.ETAG) ?? void 0;
345
350
  this.cache.set(cacheKey, { etag, content: bodyBytes });
346
351
  }
347
- const bodyText = new TextDecoder().decode(bodyBytes);
348
- result.response.message = bodyText;
349
- if (response.ok || options.enforceSuccess !== false) {
350
- result.result = this.deserializeResponse(bodyBytes);
352
+ if (options.returnRaw) {
353
+ result.result = bodyBytes;
354
+ result.response.message = `Binary response: ${bodyBytes.length} bytes`;
355
+ } else {
356
+ const bodyText = new TextDecoder().decode(bodyBytes);
357
+ result.response.message = bodyText;
358
+ if (response.ok || options.enforceSuccess !== false) {
359
+ result.result = this.deserializeResponse(bodyBytes);
360
+ }
351
361
  }
352
362
  } catch (error) {
353
363
  result.response.code = 0;
@@ -534,7 +544,8 @@ var ModuleBase = class {
534
544
  return this.client.executeRequest(this.buildUrl(path), "GET", {
535
545
  useSpartanToken: options.useSpartanToken ?? true,
536
546
  useClearance: options.useClearance ?? false,
537
- customHeaders: options.customHeaders
547
+ customHeaders: options.customHeaders,
548
+ returnRaw: options.returnRaw
538
549
  });
539
550
  }
540
551
  /**
@@ -553,7 +564,8 @@ var ModuleBase = class {
553
564
  useSpartanToken: options.useSpartanToken ?? true,
554
565
  useClearance: options.useClearance ?? false,
555
566
  customHeaders: options.customHeaders,
556
- enforceSuccess: options.enforceSuccess ?? true
567
+ enforceSuccess: options.enforceSuccess ?? true,
568
+ returnRaw: options.returnRaw
557
569
  });
558
570
  }
559
571
  /**
@@ -1302,7 +1314,7 @@ var GameCmsModule = class extends ModuleBase {
1302
1314
  */
1303
1315
  getImage(filePath) {
1304
1316
  this.assertNotEmpty(filePath, "filePath");
1305
- return this.get(`/hi/images/file/${filePath}`);
1317
+ return this.get(`/hi/images/file/${filePath}`, { returnRaw: true });
1306
1318
  }
1307
1319
  /**
1308
1320
  * Get a generic file from the CMS.
@@ -1312,7 +1324,7 @@ var GameCmsModule = class extends ModuleBase {
1312
1324
  */
1313
1325
  getGenericFile(filePath) {
1314
1326
  this.assertNotEmpty(filePath, "filePath");
1315
- return this.get(`/hi/Progression/file/${filePath}`);
1327
+ return this.get(`/hi/Progression/file/${filePath}`, { returnRaw: true });
1316
1328
  }
1317
1329
  /**
1318
1330
  * Get a raw progression file with custom type.
@@ -1973,7 +1985,7 @@ var UgcModule = class extends ModuleBase {
1973
1985
  getBlob(blobPath) {
1974
1986
  this.assertNotEmpty(blobPath, "blobPath");
1975
1987
  const blobUrl = `https://${HALO_CORE_ENDPOINTS.BLOBS_ORIGIN}.${HALO_CORE_ENDPOINTS.SERVICE_DOMAIN}${blobPath}`;
1976
- return this.getFullUrl(blobUrl, { useSpartanToken: false });
1988
+ return this.getFullUrl(blobUrl, { useSpartanToken: false, returnRaw: true });
1977
1989
  }
1978
1990
  };
1979
1991