@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.d.mts CHANGED
@@ -429,6 +429,13 @@ interface RequestOptions {
429
429
  * @default true
430
430
  */
431
431
  enforceSuccess?: boolean;
432
+ /**
433
+ * Return raw bytes instead of deserializing the response.
434
+ * Use this for binary data like images, blobs, and film chunks.
435
+ *
436
+ * @default false
437
+ */
438
+ returnRaw?: boolean;
432
439
  }
433
440
 
434
441
  /**
@@ -578,6 +585,7 @@ declare abstract class ModuleBase {
578
585
  useClearance?: boolean;
579
586
  useSpartanToken?: boolean;
580
587
  customHeaders?: Record<string, string>;
588
+ returnRaw?: boolean;
581
589
  }): Promise<HaloApiResult<T>>;
582
590
  /**
583
591
  * Execute a GET request to an absolute URL.
@@ -595,6 +603,7 @@ declare abstract class ModuleBase {
595
603
  useSpartanToken?: boolean;
596
604
  customHeaders?: Record<string, string>;
597
605
  enforceSuccess?: boolean;
606
+ returnRaw?: boolean;
598
607
  }): Promise<HaloApiResult<T>>;
599
608
  /**
600
609
  * Execute a POST request to this module's service.
package/dist/index.d.ts CHANGED
@@ -429,6 +429,13 @@ interface RequestOptions {
429
429
  * @default true
430
430
  */
431
431
  enforceSuccess?: boolean;
432
+ /**
433
+ * Return raw bytes instead of deserializing the response.
434
+ * Use this for binary data like images, blobs, and film chunks.
435
+ *
436
+ * @default false
437
+ */
438
+ returnRaw?: boolean;
432
439
  }
433
440
 
434
441
  /**
@@ -578,6 +585,7 @@ declare abstract class ModuleBase {
578
585
  useClearance?: boolean;
579
586
  useSpartanToken?: boolean;
580
587
  customHeaders?: Record<string, string>;
588
+ returnRaw?: boolean;
581
589
  }): Promise<HaloApiResult<T>>;
582
590
  /**
583
591
  * Execute a GET request to an absolute URL.
@@ -595,6 +603,7 @@ declare abstract class ModuleBase {
595
603
  useSpartanToken?: boolean;
596
604
  customHeaders?: Record<string, string>;
597
605
  enforceSuccess?: boolean;
606
+ returnRaw?: boolean;
598
607
  }): Promise<HaloApiResult<T>>;
599
608
  /**
600
609
  * Execute a POST request to this module's service.
package/dist/index.js CHANGED
@@ -336,8 +336,13 @@ var ClientBase = class {
336
336
  );
337
337
  }
338
338
  if (response.status === 304 && cached) {
339
- result.result = this.deserializeResponse(cached.content);
340
- result.response.message = "304 Not Modified - using cached response";
339
+ if (options.returnRaw) {
340
+ result.result = cached.content;
341
+ result.response.message = `304 Not Modified - cached binary: ${cached.content.length} bytes`;
342
+ } else {
343
+ result.result = this.deserializeResponse(cached.content);
344
+ result.response.message = "304 Not Modified - using cached response";
345
+ }
341
346
  return result;
342
347
  }
343
348
  const bodyBuffer = await response.arrayBuffer();
@@ -346,10 +351,15 @@ var ClientBase = class {
346
351
  const etag = response.headers.get(HEADERS.ETAG) ?? void 0;
347
352
  this.cache.set(cacheKey, { etag, content: bodyBytes });
348
353
  }
349
- const bodyText = new TextDecoder().decode(bodyBytes);
350
- result.response.message = bodyText;
351
- if (response.ok || options.enforceSuccess !== false) {
352
- result.result = this.deserializeResponse(bodyBytes);
354
+ if (options.returnRaw) {
355
+ result.result = bodyBytes;
356
+ result.response.message = `Binary response: ${bodyBytes.length} bytes`;
357
+ } else {
358
+ const bodyText = new TextDecoder().decode(bodyBytes);
359
+ result.response.message = bodyText;
360
+ if (response.ok || options.enforceSuccess !== false) {
361
+ result.result = this.deserializeResponse(bodyBytes);
362
+ }
353
363
  }
354
364
  } catch (error) {
355
365
  result.response.code = 0;
@@ -536,7 +546,8 @@ var ModuleBase = class {
536
546
  return this.client.executeRequest(this.buildUrl(path), "GET", {
537
547
  useSpartanToken: options.useSpartanToken ?? true,
538
548
  useClearance: options.useClearance ?? false,
539
- customHeaders: options.customHeaders
549
+ customHeaders: options.customHeaders,
550
+ returnRaw: options.returnRaw
540
551
  });
541
552
  }
542
553
  /**
@@ -555,7 +566,8 @@ var ModuleBase = class {
555
566
  useSpartanToken: options.useSpartanToken ?? true,
556
567
  useClearance: options.useClearance ?? false,
557
568
  customHeaders: options.customHeaders,
558
- enforceSuccess: options.enforceSuccess ?? true
569
+ enforceSuccess: options.enforceSuccess ?? true,
570
+ returnRaw: options.returnRaw
559
571
  });
560
572
  }
561
573
  /**
@@ -1304,7 +1316,7 @@ var GameCmsModule = class extends ModuleBase {
1304
1316
  */
1305
1317
  getImage(filePath) {
1306
1318
  this.assertNotEmpty(filePath, "filePath");
1307
- return this.get(`/hi/images/file/${filePath}`);
1319
+ return this.get(`/hi/images/file/${filePath}`, { returnRaw: true });
1308
1320
  }
1309
1321
  /**
1310
1322
  * Get a generic file from the CMS.
@@ -1314,7 +1326,7 @@ var GameCmsModule = class extends ModuleBase {
1314
1326
  */
1315
1327
  getGenericFile(filePath) {
1316
1328
  this.assertNotEmpty(filePath, "filePath");
1317
- return this.get(`/hi/Progression/file/${filePath}`);
1329
+ return this.get(`/hi/Progression/file/${filePath}`, { returnRaw: true });
1318
1330
  }
1319
1331
  /**
1320
1332
  * Get a raw progression file with custom type.
@@ -1975,7 +1987,7 @@ var UgcModule = class extends ModuleBase {
1975
1987
  getBlob(blobPath) {
1976
1988
  this.assertNotEmpty(blobPath, "blobPath");
1977
1989
  const blobUrl = `https://${HALO_CORE_ENDPOINTS.BLOBS_ORIGIN}.${HALO_CORE_ENDPOINTS.SERVICE_DOMAIN}${blobPath}`;
1978
- return this.getFullUrl(blobUrl, { useSpartanToken: false });
1990
+ return this.getFullUrl(blobUrl, { useSpartanToken: false, returnRaw: true });
1979
1991
  }
1980
1992
  };
1981
1993