@baasix/sdk 0.1.11 → 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/README.md +25 -1
- package/dist/index.cjs +37 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/dist/modules/files.cjs +25 -2
- package/dist/modules/files.cjs.map +1 -1
- package/dist/modules/files.d.cts +25 -2
- package/dist/modules/files.d.ts +25 -2
- package/dist/modules/files.js +25 -2
- package/dist/modules/files.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -678,6 +678,11 @@ declare class ReportsModule {
|
|
|
678
678
|
* @example
|
|
679
679
|
* ```typescript
|
|
680
680
|
* const categories = await baasix.reports.distinct('products', 'category');
|
|
681
|
+
*
|
|
682
|
+
* // With a filter
|
|
683
|
+
* const folders = await baasix.reports.distinct('baasix_File', 'folder', {
|
|
684
|
+
* userId: { eq: '$CURRENT_USER' },
|
|
685
|
+
* });
|
|
681
686
|
* ```
|
|
682
687
|
*/
|
|
683
688
|
distinct(collection: string, field: string, filter?: Filter): Promise<unknown[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -678,6 +678,11 @@ declare class ReportsModule {
|
|
|
678
678
|
* @example
|
|
679
679
|
* ```typescript
|
|
680
680
|
* const categories = await baasix.reports.distinct('products', 'category');
|
|
681
|
+
*
|
|
682
|
+
* // With a filter
|
|
683
|
+
* const folders = await baasix.reports.distinct('baasix_File', 'folder', {
|
|
684
|
+
* userId: { eq: '$CURRENT_USER' },
|
|
685
|
+
* });
|
|
681
686
|
* ```
|
|
682
687
|
*/
|
|
683
688
|
distinct(collection: string, field: string, filter?: Filter): Promise<unknown[]>;
|
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/
|
|
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) {
|
|
@@ -2892,18 +2915,22 @@ var ReportsModule = class {
|
|
|
2892
2915
|
* @example
|
|
2893
2916
|
* ```typescript
|
|
2894
2917
|
* const categories = await baasix.reports.distinct('products', 'category');
|
|
2918
|
+
*
|
|
2919
|
+
* // With a filter
|
|
2920
|
+
* const folders = await baasix.reports.distinct('baasix_File', 'folder', {
|
|
2921
|
+
* userId: { eq: '$CURRENT_USER' },
|
|
2922
|
+
* });
|
|
2895
2923
|
* ```
|
|
2896
2924
|
*/
|
|
2897
2925
|
async distinct(collection, field, filter) {
|
|
2898
|
-
const response = await this.client.
|
|
2899
|
-
`/
|
|
2926
|
+
const response = await this.client.post(
|
|
2927
|
+
`/reports/${collection}`,
|
|
2900
2928
|
{
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
}
|
|
2929
|
+
fields: [field],
|
|
2930
|
+
groupBy: [field],
|
|
2931
|
+
aggregate: { _count: { function: "distinct", field } },
|
|
2932
|
+
filter,
|
|
2933
|
+
limit: -1
|
|
2907
2934
|
}
|
|
2908
2935
|
);
|
|
2909
2936
|
return response.data.map((item) => item[field]);
|