@shipstatic/types 2.26.0-beta.3 → 2.26.0-beta.4

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.ts CHANGED
@@ -489,17 +489,14 @@ export interface DomainValidateResponse {
489
489
  * It answers "would creating this be new", not "would a write succeed": `PUT
490
490
  * /domains/:domain` is an upsert, which is how a domain is re-pointed, so a
491
491
  * caller's OWN domain is unavailable here and writable there. Availability
492
- * does not depend on the kind of name; a custom domain answered `true`
493
- * whoever owned it until 2026-09-17.
492
+ * does not depend on the kind of name.
494
493
  */
495
494
  available: boolean | null;
496
495
  /**
497
- * Why the name is unusable, null when it IS usable — displayed verbatim.
498
- *
499
- * A name is unusable when it is invalid OR unavailable, and both carry a
500
- * reason. This said "null when valid" until 2026-09-17, which was already
501
- * untrue of the endpoint it described: a registered name is valid, is
502
- * unusable, and had no reason at all, which is why every client invented one.
496
+ * Why the name is unusable, displayed verbatim; null exactly when it IS
497
+ * usable. A name is unusable when it is invalid OR unavailable, and both
498
+ * carry a reason, so a client reads this field alone for the verdict and
499
+ * invents no copy of its own.
503
500
  */
504
501
  reason: string | null;
505
502
  }
@@ -1840,6 +1837,15 @@ export declare function formatDuration(seconds: number): string;
1840
1837
  * why that case is `null` rather than a sentence.
1841
1838
  */
1842
1839
  export declare function formatTimeRemaining(expires: number, now?: number): string | null;
1840
+ /**
1841
+ * A byte count as a person reads it: `"180 KB"`, `"2.5 MB"`, `"0 Bytes"`.
1842
+ *
1843
+ * Binary units, one decimal by default, and `decimals` for a surface with its
1844
+ * own density (a dense table reads `"3 MB"` at 0). A deployment's size reads
1845
+ * this way on every surface that states one: the console, the CLI, the deploy
1846
+ * card and the API's own refusals, so one deployment is one number everywhere.
1847
+ */
1848
+ export declare function formatFileSize(bytes: number, decimals?: number): string;
1843
1849
  /**
1844
1850
  * Universal deploy input — the union of every shape the SDK accepts.
1845
1851
  *
package/dist/index.js CHANGED
@@ -1776,6 +1776,25 @@ function countOf(count, unit) {
1776
1776
  return `${count} ${unit}${count === 1 ? '' : 's'}`;
1777
1777
  }
1778
1778
  // =============================================================================
1779
+ // FILE SIZE
1780
+ // =============================================================================
1781
+ /**
1782
+ * A byte count as a person reads it: `"180 KB"`, `"2.5 MB"`, `"0 Bytes"`.
1783
+ *
1784
+ * Binary units, one decimal by default, and `decimals` for a surface with its
1785
+ * own density (a dense table reads `"3 MB"` at 0). A deployment's size reads
1786
+ * this way on every surface that states one: the console, the CLI, the deploy
1787
+ * card and the API's own refusals, so one deployment is one number everywhere.
1788
+ */
1789
+ export function formatFileSize(bytes, decimals = 1) {
1790
+ if (bytes === 0)
1791
+ return '0 Bytes';
1792
+ const k = 1024;
1793
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
1794
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1795
+ return `${Number.parseFloat((bytes / k ** i).toFixed(decimals))} ${sizes[i]}`;
1796
+ }
1797
+ // =============================================================================
1779
1798
  // FILE UPLOAD TYPES
1780
1799
  // =============================================================================
1781
1800
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "2.26.0-beta.3",
3
+ "version": "2.26.0-beta.4",
4
4
  "description": "Shared TypeScript types for the ShipStatic platform.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -548,17 +548,14 @@ export interface DomainValidateResponse {
548
548
  * It answers "would creating this be new", not "would a write succeed": `PUT
549
549
  * /domains/:domain` is an upsert, which is how a domain is re-pointed, so a
550
550
  * caller's OWN domain is unavailable here and writable there. Availability
551
- * does not depend on the kind of name; a custom domain answered `true`
552
- * whoever owned it until 2026-09-17.
551
+ * does not depend on the kind of name.
553
552
  */
554
553
  available: boolean | null;
555
554
  /**
556
- * Why the name is unusable, null when it IS usable — displayed verbatim.
557
- *
558
- * A name is unusable when it is invalid OR unavailable, and both carry a
559
- * reason. This said "null when valid" until 2026-09-17, which was already
560
- * untrue of the endpoint it described: a registered name is valid, is
561
- * unusable, and had no reason at all, which is why every client invented one.
555
+ * Why the name is unusable, displayed verbatim; null exactly when it IS
556
+ * usable. A name is unusable when it is invalid OR unavailable, and both
557
+ * carry a reason, so a client reads this field alone for the verdict and
558
+ * invents no copy of its own.
562
559
  */
563
560
  reason: string | null;
564
561
  }
@@ -2716,6 +2713,26 @@ function countOf(count: number, unit: string): string {
2716
2713
  return `${count} ${unit}${count === 1 ? '' : 's'}`;
2717
2714
  }
2718
2715
 
2716
+ // =============================================================================
2717
+ // FILE SIZE
2718
+ // =============================================================================
2719
+
2720
+ /**
2721
+ * A byte count as a person reads it: `"180 KB"`, `"2.5 MB"`, `"0 Bytes"`.
2722
+ *
2723
+ * Binary units, one decimal by default, and `decimals` for a surface with its
2724
+ * own density (a dense table reads `"3 MB"` at 0). A deployment's size reads
2725
+ * this way on every surface that states one: the console, the CLI, the deploy
2726
+ * card and the API's own refusals, so one deployment is one number everywhere.
2727
+ */
2728
+ export function formatFileSize(bytes: number, decimals: number = 1): string {
2729
+ if (bytes === 0) return '0 Bytes';
2730
+ const k = 1024;
2731
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
2732
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
2733
+ return `${Number.parseFloat((bytes / k ** i).toFixed(decimals))} ${sizes[i]}`;
2734
+ }
2735
+
2719
2736
  // =============================================================================
2720
2737
  // RESOURCE INTERFACE CONTRACTS
2721
2738
  // =============================================================================