@cloudbase/storage 2.23.3 → 2.24.0

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.
@@ -0,0 +1,132 @@
1
+ export type FileBody =
2
+ | ArrayBuffer
3
+ | ArrayBufferView
4
+ | Blob
5
+ | Buffer
6
+ | File
7
+ | FormData
8
+ | NodeJS.ReadableStream
9
+ | ReadableStream<Uint8Array>
10
+ | URLSearchParams
11
+ | string
12
+
13
+ /**
14
+ * Type of storage bucket
15
+ * - STANDARD: Regular file storage buckets
16
+ * - ANALYTICS: Iceberg table-based buckets for analytical workloads
17
+ */
18
+ export type BucketType = 'STANDARD' | 'ANALYTICS'
19
+
20
+ export interface Bucket {
21
+ id: string
22
+ type?: BucketType
23
+ name: string
24
+ owner: string
25
+ file_size_limit?: number
26
+ allowed_mime_types?: string[]
27
+ created_at: string
28
+ updated_at: string
29
+ public: boolean
30
+ }
31
+
32
+ export interface FileObject {
33
+ name: string
34
+ bucket_id: string
35
+ owner: string
36
+ id: string
37
+ updated_at: string
38
+ created_at: string
39
+ /** @deprecated */
40
+ last_accessed_at: string
41
+ metadata: Record<string, any>
42
+ buckets: Bucket
43
+ }
44
+
45
+ export interface FileObjectV2 {
46
+ id: string
47
+ version: string
48
+ name: string
49
+ bucket_id: string
50
+ updated_at: string
51
+ created_at: string
52
+ /** @deprecated */
53
+ last_accessed_at: string
54
+ size?: number
55
+ cache_control?: string
56
+ content_type?: string
57
+ etag?: string
58
+ last_modified?: string
59
+ metadata?: Record<string, any>
60
+ }
61
+
62
+ export interface FileOptions {
63
+ /**
64
+ * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=<seconds>` header. Defaults to 3600 seconds.
65
+ */
66
+ cacheControl?: string
67
+ /**
68
+ * the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`.
69
+ */
70
+ contentType?: string
71
+ /**
72
+ * When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to true.
73
+ */
74
+ upsert?: boolean
75
+ /**
76
+ * The duplex option is a string parameter that enables or disables duplex streaming, allowing for both reading and writing data in the same stream. It can be passed as an option to the fetch() method.
77
+ */
78
+ duplex?: string
79
+
80
+ /**
81
+ * The metadata option is an object that allows you to store additional information about the file. This information can be used to filter and search for files. The metadata object can contain any key-value pairs you want to store.
82
+ */
83
+ metadata?: Record<string, any>
84
+
85
+ /**
86
+ * Optionally add extra headers
87
+ */
88
+ headers?: Record<string, string>
89
+ }
90
+
91
+ export interface DestinationOptions {
92
+ destinationBucket?: string
93
+ }
94
+
95
+ export interface TransformOptions {
96
+ /**
97
+ * The width of the image in pixels.
98
+ */
99
+ width?: number
100
+ /**
101
+ * The height of the image in pixels.
102
+ */
103
+ height?: number
104
+ /**
105
+ * The resize mode can be cover, contain or fill. Defaults to cover.
106
+ * Cover resizes the image to maintain it's aspect ratio while filling the entire width and height.
107
+ * Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height.
108
+ * Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit.
109
+ */
110
+ resize?: 'cover' | 'contain' | 'fill'
111
+ /**
112
+ * Set the quality of the returned image.
113
+ * A number from 20 to 100, with 100 being the highest quality.
114
+ * Defaults to 80
115
+ */
116
+ quality?: number
117
+ /**
118
+ * Specify the format of the image requested.
119
+ *
120
+ * When using 'origin' we force the format to be the same as the original image.
121
+ * When this option is not passed in, images are optimized to modern image formats like Webp.
122
+ */
123
+ format?: 'origin'
124
+ }
125
+
126
+ type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}`
127
+ ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
128
+ : S
129
+
130
+ export type Camelize<T> = {
131
+ [K in keyof T as CamelCase<Extract<K, string>>]: T[K]
132
+ }