@baasix/sdk 0.1.12 → 0.1.13

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.js CHANGED
@@ -1873,6 +1873,16 @@ var FilesModule = class {
1873
1873
  /**
1874
1874
  * Get the URL for an asset with optional transformations
1875
1875
  *
1876
+ * @param id - File UUID
1877
+ * @param options - Optional transformation options
1878
+ * @param options.width - Target width in pixels
1879
+ * @param options.height - Target height in pixels
1880
+ * @param options.fit - Resize fit mode: 'cover' | 'contain' | 'fill' | 'inside' | 'outside' (default: 'cover')
1881
+ * @param options.quality - Output quality 1–100 (default: 80)
1882
+ * @param options.format - Output format: 'jpeg' | 'png' | 'webp' | 'avif' (default: 'jpeg').
1883
+ * 'webp' and 'png' preserve alpha transparency; 'jpeg' composites transparency over a white background.
1884
+ * @param options.withoutEnlargement - When true, prevents upscaling images smaller than the target dimensions
1885
+ *
1876
1886
  * @example
1877
1887
  * ```typescript
1878
1888
  * // Original file
@@ -1886,11 +1896,21 @@ var FilesModule = class {
1886
1896
  * quality: 80
1887
1897
  * });
1888
1898
  *
1889
- * // Convert to WebP
1899
+ * // Convert to WebP (preserves transparency)
1890
1900
  * const webpUrl = baasix.files.getAssetUrl('file-uuid', {
1891
1901
  * format: 'webp',
1892
1902
  * quality: 85
1893
1903
  * });
1904
+ *
1905
+ * // Resize and convert to WebP
1906
+ * const optimizedUrl = baasix.files.getAssetUrl('file-uuid', {
1907
+ * width: 800,
1908
+ * height: 600,
1909
+ * fit: 'cover',
1910
+ * format: 'webp',
1911
+ * quality: 80,
1912
+ * withoutEnlargement: true
1913
+ * });
1894
1914
  * ```
1895
1915
  */
1896
1916
  getAssetUrl(id, options) {
@@ -1944,7 +1964,10 @@ var FilesModule = class {
1944
1964
  * @example
1945
1965
  * ```typescript
1946
1966
  * const base64 = await baasix.files.toBase64('file-uuid');
1947
- * // Use in Image component: <Image source={{ uri: `data:image/jpeg;base64,${base64}` }} />
1967
+ * // Use in Image component: <Image source={{ uri: `data:image/webp;base64,${base64}` }} />
1968
+ *
1969
+ * // Convert to WebP first for smaller payload
1970
+ * const base64Webp = await baasix.files.toBase64('file-uuid', { format: 'webp', quality: 80 });
1948
1971
  * ```
1949
1972
  */
1950
1973
  async toBase64(id, options) {