@supabase/storage-js 2.87.4-canary.2 → 2.87.4-canary.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/README.md +2 -106
- package/dist/index.cjs +3019 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2601 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2601 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2998 -0
- package/dist/index.mjs.map +1 -0
- package/dist/umd/supabase.js +1 -1
- package/package.json +21 -12
- package/src/lib/version.ts +1 -1
- package/dist/main/StorageClient.d.ts +0 -64
- package/dist/main/StorageClient.d.ts.map +0 -1
- package/dist/main/StorageClient.js +0 -74
- package/dist/main/StorageClient.js.map +0 -1
- package/dist/main/index.d.ts +0 -7
- package/dist/main/index.d.ts.map +0 -1
- package/dist/main/index.js +0 -12
- package/dist/main/index.js.map +0 -1
- package/dist/main/lib/constants.d.ts +0 -4
- package/dist/main/lib/constants.d.ts.map +0 -1
- package/dist/main/lib/constants.js +0 -8
- package/dist/main/lib/constants.js.map +0 -1
- package/dist/main/lib/errors.d.ts +0 -21
- package/dist/main/lib/errors.d.ts.map +0 -1
- package/dist/main/lib/errors.js +0 -41
- package/dist/main/lib/errors.js.map +0 -1
- package/dist/main/lib/fetch.d.ts +0 -16
- package/dist/main/lib/fetch.d.ts.map +0 -1
- package/dist/main/lib/fetch.js +0 -95
- package/dist/main/lib/fetch.js.map +0 -1
- package/dist/main/lib/helpers.d.ts +0 -28
- package/dist/main/lib/helpers.d.ts.map +0 -1
- package/dist/main/lib/helpers.js +0 -87
- package/dist/main/lib/helpers.js.map +0 -1
- package/dist/main/lib/index.d.ts +0 -6
- package/dist/main/lib/index.d.ts.map +0 -1
- package/dist/main/lib/index.js +0 -9
- package/dist/main/lib/index.js.map +0 -1
- package/dist/main/lib/types.d.ts +0 -226
- package/dist/main/lib/types.d.ts.map +0 -1
- package/dist/main/lib/types.js +0 -3
- package/dist/main/lib/types.js.map +0 -1
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts +0 -505
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
- package/dist/main/lib/vectors/StorageVectorsClient.js +0 -582
- package/dist/main/lib/vectors/StorageVectorsClient.js.map +0 -1
- package/dist/main/lib/vectors/VectorBucketApi.d.ts +0 -32
- package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +0 -1
- package/dist/main/lib/vectors/VectorBucketApi.js +0 -102
- package/dist/main/lib/vectors/VectorBucketApi.js.map +0 -1
- package/dist/main/lib/vectors/VectorDataApi.d.ts +0 -32
- package/dist/main/lib/vectors/VectorDataApi.d.ts.map +0 -1
- package/dist/main/lib/vectors/VectorDataApi.js +0 -147
- package/dist/main/lib/vectors/VectorDataApi.js.map +0 -1
- package/dist/main/lib/vectors/VectorIndexApi.d.ts +0 -47
- package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +0 -1
- package/dist/main/lib/vectors/VectorIndexApi.js +0 -104
- package/dist/main/lib/vectors/VectorIndexApi.js.map +0 -1
- package/dist/main/lib/vectors/constants.d.ts +0 -5
- package/dist/main/lib/vectors/constants.d.ts.map +0 -1
- package/dist/main/lib/vectors/constants.js +0 -9
- package/dist/main/lib/vectors/constants.js.map +0 -1
- package/dist/main/lib/vectors/errors.d.ts +0 -55
- package/dist/main/lib/vectors/errors.d.ts.map +0 -1
- package/dist/main/lib/vectors/errors.js +0 -76
- package/dist/main/lib/vectors/errors.js.map +0 -1
- package/dist/main/lib/vectors/fetch.d.ts +0 -57
- package/dist/main/lib/vectors/fetch.d.ts.map +0 -1
- package/dist/main/lib/vectors/fetch.js +0 -167
- package/dist/main/lib/vectors/fetch.js.map +0 -1
- package/dist/main/lib/vectors/helpers.d.ts +0 -46
- package/dist/main/lib/vectors/helpers.d.ts.map +0 -1
- package/dist/main/lib/vectors/helpers.js +0 -74
- package/dist/main/lib/vectors/helpers.js.map +0 -1
- package/dist/main/lib/vectors/index.d.ts +0 -11
- package/dist/main/lib/vectors/index.d.ts.map +0 -1
- package/dist/main/lib/vectors/index.js +0 -31
- package/dist/main/lib/vectors/index.js.map +0 -1
- package/dist/main/lib/vectors/types.d.ts +0 -279
- package/dist/main/lib/vectors/types.d.ts.map +0 -1
- package/dist/main/lib/vectors/types.js +0 -3
- package/dist/main/lib/vectors/types.js.map +0 -1
- package/dist/main/lib/version.d.ts +0 -2
- package/dist/main/lib/version.d.ts.map +0 -1
- package/dist/main/lib/version.js +0 -11
- package/dist/main/lib/version.js.map +0 -1
- package/dist/main/packages/BlobDownloadBuilder.d.ts +0 -16
- package/dist/main/packages/BlobDownloadBuilder.d.ts.map +0 -1
- package/dist/main/packages/BlobDownloadBuilder.js +0 -55
- package/dist/main/packages/BlobDownloadBuilder.js.map +0 -1
- package/dist/main/packages/StorageAnalyticsClient.d.ts +0 -324
- package/dist/main/packages/StorageAnalyticsClient.d.ts.map +0 -1
- package/dist/main/packages/StorageAnalyticsClient.js +0 -395
- package/dist/main/packages/StorageAnalyticsClient.js.map +0 -1
- package/dist/main/packages/StorageBucketApi.d.ts +0 -266
- package/dist/main/packages/StorageBucketApi.d.ts.map +0 -1
- package/dist/main/packages/StorageBucketApi.js +0 -362
- package/dist/main/packages/StorageBucketApi.js.map +0 -1
- package/dist/main/packages/StorageFileApi.d.ts +0 -680
- package/dist/main/packages/StorageFileApi.d.ts.map +0 -1
- package/dist/main/packages/StorageFileApi.js +0 -1002
- package/dist/main/packages/StorageFileApi.js.map +0 -1
- package/dist/main/packages/StreamDownloadBuilder.d.ts +0 -9
- package/dist/main/packages/StreamDownloadBuilder.d.ts.map +0 -1
- package/dist/main/packages/StreamDownloadBuilder.js +0 -35
- package/dist/main/packages/StreamDownloadBuilder.js.map +0 -1
- package/dist/module/StorageClient.d.ts +0 -64
- package/dist/module/StorageClient.d.ts.map +0 -1
- package/dist/module/StorageClient.js +0 -69
- package/dist/module/StorageClient.js.map +0 -1
- package/dist/module/index.d.ts +0 -7
- package/dist/module/index.d.ts.map +0 -1
- package/dist/module/index.js +0 -6
- package/dist/module/index.js.map +0 -1
- package/dist/module/lib/constants.d.ts +0 -4
- package/dist/module/lib/constants.d.ts.map +0 -1
- package/dist/module/lib/constants.js +0 -5
- package/dist/module/lib/constants.js.map +0 -1
- package/dist/module/lib/errors.d.ts +0 -21
- package/dist/module/lib/errors.d.ts.map +0 -1
- package/dist/module/lib/errors.js +0 -34
- package/dist/module/lib/errors.js.map +0 -1
- package/dist/module/lib/fetch.d.ts +0 -16
- package/dist/module/lib/fetch.d.ts.map +0 -1
- package/dist/module/lib/fetch.js +0 -88
- package/dist/module/lib/fetch.js.map +0 -1
- package/dist/module/lib/helpers.d.ts +0 -28
- package/dist/module/lib/helpers.d.ts.map +0 -1
- package/dist/module/lib/helpers.js +0 -79
- package/dist/module/lib/helpers.js.map +0 -1
- package/dist/module/lib/index.d.ts +0 -6
- package/dist/module/lib/index.d.ts.map +0 -1
- package/dist/module/lib/index.js +0 -6
- package/dist/module/lib/index.js.map +0 -1
- package/dist/module/lib/types.d.ts +0 -226
- package/dist/module/lib/types.d.ts.map +0 -1
- package/dist/module/lib/types.js +0 -2
- package/dist/module/lib/types.js.map +0 -1
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts +0 -505
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
- package/dist/module/lib/vectors/StorageVectorsClient.js +0 -576
- package/dist/module/lib/vectors/StorageVectorsClient.js.map +0 -1
- package/dist/module/lib/vectors/VectorBucketApi.d.ts +0 -32
- package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +0 -1
- package/dist/module/lib/vectors/VectorBucketApi.js +0 -99
- package/dist/module/lib/vectors/VectorBucketApi.js.map +0 -1
- package/dist/module/lib/vectors/VectorDataApi.d.ts +0 -32
- package/dist/module/lib/vectors/VectorDataApi.d.ts.map +0 -1
- package/dist/module/lib/vectors/VectorDataApi.js +0 -144
- package/dist/module/lib/vectors/VectorDataApi.js.map +0 -1
- package/dist/module/lib/vectors/VectorIndexApi.d.ts +0 -47
- package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +0 -1
- package/dist/module/lib/vectors/VectorIndexApi.js +0 -101
- package/dist/module/lib/vectors/VectorIndexApi.js.map +0 -1
- package/dist/module/lib/vectors/constants.d.ts +0 -5
- package/dist/module/lib/vectors/constants.d.ts.map +0 -1
- package/dist/module/lib/vectors/constants.js +0 -6
- package/dist/module/lib/vectors/constants.js.map +0 -1
- package/dist/module/lib/vectors/errors.d.ts +0 -55
- package/dist/module/lib/vectors/errors.d.ts.map +0 -1
- package/dist/module/lib/vectors/errors.js +0 -69
- package/dist/module/lib/vectors/errors.js.map +0 -1
- package/dist/module/lib/vectors/fetch.d.ts +0 -57
- package/dist/module/lib/vectors/fetch.d.ts.map +0 -1
- package/dist/module/lib/vectors/fetch.js +0 -161
- package/dist/module/lib/vectors/fetch.js.map +0 -1
- package/dist/module/lib/vectors/helpers.d.ts +0 -46
- package/dist/module/lib/vectors/helpers.d.ts.map +0 -1
- package/dist/module/lib/vectors/helpers.js +0 -66
- package/dist/module/lib/vectors/helpers.js.map +0 -1
- package/dist/module/lib/vectors/index.d.ts +0 -11
- package/dist/module/lib/vectors/index.d.ts.map +0 -1
- package/dist/module/lib/vectors/index.js +0 -11
- package/dist/module/lib/vectors/index.js.map +0 -1
- package/dist/module/lib/vectors/types.d.ts +0 -279
- package/dist/module/lib/vectors/types.d.ts.map +0 -1
- package/dist/module/lib/vectors/types.js +0 -2
- package/dist/module/lib/vectors/types.js.map +0 -1
- package/dist/module/lib/version.d.ts +0 -2
- package/dist/module/lib/version.d.ts.map +0 -1
- package/dist/module/lib/version.js +0 -8
- package/dist/module/lib/version.js.map +0 -1
- package/dist/module/packages/BlobDownloadBuilder.d.ts +0 -16
- package/dist/module/packages/BlobDownloadBuilder.d.ts.map +0 -1
- package/dist/module/packages/BlobDownloadBuilder.js +0 -53
- package/dist/module/packages/BlobDownloadBuilder.js.map +0 -1
- package/dist/module/packages/StorageAnalyticsClient.d.ts +0 -324
- package/dist/module/packages/StorageAnalyticsClient.d.ts.map +0 -1
- package/dist/module/packages/StorageAnalyticsClient.js +0 -392
- package/dist/module/packages/StorageAnalyticsClient.js.map +0 -1
- package/dist/module/packages/StorageBucketApi.d.ts +0 -266
- package/dist/module/packages/StorageBucketApi.d.ts.map +0 -1
- package/dist/module/packages/StorageBucketApi.js +0 -359
- package/dist/module/packages/StorageBucketApi.js.map +0 -1
- package/dist/module/packages/StorageFileApi.d.ts +0 -680
- package/dist/module/packages/StorageFileApi.d.ts.map +0 -1
- package/dist/module/packages/StorageFileApi.js +0 -999
- package/dist/module/packages/StorageFileApi.js.map +0 -1
- package/dist/module/packages/StreamDownloadBuilder.d.ts +0 -9
- package/dist/module/packages/StreamDownloadBuilder.d.ts.map +0 -1
- package/dist/module/packages/StreamDownloadBuilder.js +0 -32
- package/dist/module/packages/StreamDownloadBuilder.js.map +0 -1
- package/dist/tsconfig.module.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const iceberg_js_1 = require("iceberg-js");
|
|
5
|
-
const constants_1 = require("../lib/constants");
|
|
6
|
-
const errors_1 = require("../lib/errors");
|
|
7
|
-
const fetch_1 = require("../lib/fetch");
|
|
8
|
-
const helpers_1 = require("../lib/helpers");
|
|
9
|
-
/**
|
|
10
|
-
* Client class for managing Analytics Buckets using Iceberg tables
|
|
11
|
-
* Provides methods for creating, listing, and deleting analytics buckets
|
|
12
|
-
*/
|
|
13
|
-
class StorageAnalyticsClient {
|
|
14
|
-
/**
|
|
15
|
-
* @alpha
|
|
16
|
-
*
|
|
17
|
-
* Creates a new StorageAnalyticsClient instance
|
|
18
|
-
*
|
|
19
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
20
|
-
*
|
|
21
|
-
* @category Analytics Buckets
|
|
22
|
-
* @param url - The base URL for the storage API
|
|
23
|
-
* @param headers - HTTP headers to include in requests
|
|
24
|
-
* @param fetch - Optional custom fetch implementation
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const client = new StorageAnalyticsClient(url, headers)
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
constructor(url, headers = {}, fetch) {
|
|
32
|
-
this.shouldThrowOnError = false;
|
|
33
|
-
this.url = url.replace(/\/$/, '');
|
|
34
|
-
this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
|
|
35
|
-
this.fetch = (0, helpers_1.resolveFetch)(fetch);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @alpha
|
|
39
|
-
*
|
|
40
|
-
* Enable throwing errors instead of returning them in the response
|
|
41
|
-
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
42
|
-
*
|
|
43
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
44
|
-
*
|
|
45
|
-
* @category Analytics Buckets
|
|
46
|
-
* @returns This instance for method chaining
|
|
47
|
-
*/
|
|
48
|
-
throwOnError() {
|
|
49
|
-
this.shouldThrowOnError = true;
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* @alpha
|
|
54
|
-
*
|
|
55
|
-
* Creates a new analytics bucket using Iceberg tables
|
|
56
|
-
* Analytics buckets are optimized for analytical queries and data processing
|
|
57
|
-
*
|
|
58
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
59
|
-
*
|
|
60
|
-
* @category Analytics Buckets
|
|
61
|
-
* @param name A unique name for the bucket you are creating
|
|
62
|
-
* @returns Promise with response containing newly created analytics bucket or error
|
|
63
|
-
*
|
|
64
|
-
* @example Create analytics bucket
|
|
65
|
-
* ```js
|
|
66
|
-
* const { data, error } = await supabase
|
|
67
|
-
* .storage
|
|
68
|
-
* .analytics
|
|
69
|
-
* .createBucket('analytics-data')
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* Response:
|
|
73
|
-
* ```json
|
|
74
|
-
* {
|
|
75
|
-
* "data": {
|
|
76
|
-
* "name": "analytics-data",
|
|
77
|
-
* "type": "ANALYTICS",
|
|
78
|
-
* "format": "iceberg",
|
|
79
|
-
* "created_at": "2024-05-22T22:26:05.100Z",
|
|
80
|
-
* "updated_at": "2024-05-22T22:26:05.100Z"
|
|
81
|
-
* },
|
|
82
|
-
* "error": null
|
|
83
|
-
* }
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
createBucket(name) {
|
|
87
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
try {
|
|
89
|
-
const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/bucket`, { name }, { headers: this.headers });
|
|
90
|
-
return { data, error: null };
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
if (this.shouldThrowOnError) {
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
if ((0, errors_1.isStorageError)(error)) {
|
|
97
|
-
return { data: null, error };
|
|
98
|
-
}
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @alpha
|
|
105
|
-
*
|
|
106
|
-
* Retrieves the details of all Analytics Storage buckets within an existing project
|
|
107
|
-
* Only returns buckets of type 'ANALYTICS'
|
|
108
|
-
*
|
|
109
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
110
|
-
*
|
|
111
|
-
* @category Analytics Buckets
|
|
112
|
-
* @param options Query parameters for listing buckets
|
|
113
|
-
* @param options.limit Maximum number of buckets to return
|
|
114
|
-
* @param options.offset Number of buckets to skip
|
|
115
|
-
* @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')
|
|
116
|
-
* @param options.sortOrder Sort order ('asc' or 'desc')
|
|
117
|
-
* @param options.search Search term to filter bucket names
|
|
118
|
-
* @returns Promise with response containing array of analytics buckets or error
|
|
119
|
-
*
|
|
120
|
-
* @example List analytics buckets
|
|
121
|
-
* ```js
|
|
122
|
-
* const { data, error } = await supabase
|
|
123
|
-
* .storage
|
|
124
|
-
* .analytics
|
|
125
|
-
* .listBuckets({
|
|
126
|
-
* limit: 10,
|
|
127
|
-
* offset: 0,
|
|
128
|
-
* sortColumn: 'created_at',
|
|
129
|
-
* sortOrder: 'desc'
|
|
130
|
-
* })
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* Response:
|
|
134
|
-
* ```json
|
|
135
|
-
* {
|
|
136
|
-
* "data": [
|
|
137
|
-
* {
|
|
138
|
-
* "name": "analytics-data",
|
|
139
|
-
* "type": "ANALYTICS",
|
|
140
|
-
* "format": "iceberg",
|
|
141
|
-
* "created_at": "2024-05-22T22:26:05.100Z",
|
|
142
|
-
* "updated_at": "2024-05-22T22:26:05.100Z"
|
|
143
|
-
* }
|
|
144
|
-
* ],
|
|
145
|
-
* "error": null
|
|
146
|
-
* }
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
listBuckets(options) {
|
|
150
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
try {
|
|
152
|
-
// Build query string from options
|
|
153
|
-
const queryParams = new URLSearchParams();
|
|
154
|
-
if ((options === null || options === void 0 ? void 0 : options.limit) !== undefined)
|
|
155
|
-
queryParams.set('limit', options.limit.toString());
|
|
156
|
-
if ((options === null || options === void 0 ? void 0 : options.offset) !== undefined)
|
|
157
|
-
queryParams.set('offset', options.offset.toString());
|
|
158
|
-
if (options === null || options === void 0 ? void 0 : options.sortColumn)
|
|
159
|
-
queryParams.set('sortColumn', options.sortColumn);
|
|
160
|
-
if (options === null || options === void 0 ? void 0 : options.sortOrder)
|
|
161
|
-
queryParams.set('sortOrder', options.sortOrder);
|
|
162
|
-
if (options === null || options === void 0 ? void 0 : options.search)
|
|
163
|
-
queryParams.set('search', options.search);
|
|
164
|
-
const queryString = queryParams.toString();
|
|
165
|
-
const url = queryString ? `${this.url}/bucket?${queryString}` : `${this.url}/bucket`;
|
|
166
|
-
const data = yield (0, fetch_1.get)(this.fetch, url, { headers: this.headers });
|
|
167
|
-
return { data: data, error: null };
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
if (this.shouldThrowOnError) {
|
|
171
|
-
throw error;
|
|
172
|
-
}
|
|
173
|
-
if ((0, errors_1.isStorageError)(error)) {
|
|
174
|
-
return { data: null, error };
|
|
175
|
-
}
|
|
176
|
-
throw error;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* @alpha
|
|
182
|
-
*
|
|
183
|
-
* Deletes an existing analytics bucket
|
|
184
|
-
* A bucket can't be deleted with existing objects inside it
|
|
185
|
-
* You must first empty the bucket before deletion
|
|
186
|
-
*
|
|
187
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
188
|
-
*
|
|
189
|
-
* @category Analytics Buckets
|
|
190
|
-
* @param bucketName The unique identifier of the bucket you would like to delete
|
|
191
|
-
* @returns Promise with response containing success message or error
|
|
192
|
-
*
|
|
193
|
-
* @example Delete analytics bucket
|
|
194
|
-
* ```js
|
|
195
|
-
* const { data, error } = await supabase
|
|
196
|
-
* .storage
|
|
197
|
-
* .analytics
|
|
198
|
-
* .deleteBucket('analytics-data')
|
|
199
|
-
* ```
|
|
200
|
-
*
|
|
201
|
-
* Response:
|
|
202
|
-
* ```json
|
|
203
|
-
* {
|
|
204
|
-
* "data": {
|
|
205
|
-
* "message": "Successfully deleted"
|
|
206
|
-
* },
|
|
207
|
-
* "error": null
|
|
208
|
-
* }
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
deleteBucket(bucketName) {
|
|
212
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
try {
|
|
214
|
-
const data = yield (0, fetch_1.remove)(this.fetch, `${this.url}/bucket/${bucketName}`, {}, { headers: this.headers });
|
|
215
|
-
return { data, error: null };
|
|
216
|
-
}
|
|
217
|
-
catch (error) {
|
|
218
|
-
if (this.shouldThrowOnError) {
|
|
219
|
-
throw error;
|
|
220
|
-
}
|
|
221
|
-
if ((0, errors_1.isStorageError)(error)) {
|
|
222
|
-
return { data: null, error };
|
|
223
|
-
}
|
|
224
|
-
throw error;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* @alpha
|
|
230
|
-
*
|
|
231
|
-
* Get an Iceberg REST Catalog client configured for a specific analytics bucket
|
|
232
|
-
* Use this to perform advanced table and namespace operations within the bucket
|
|
233
|
-
* The returned client provides full access to the Apache Iceberg REST Catalog API
|
|
234
|
-
* with the Supabase `{ data, error }` pattern for consistent error handling on all operations.
|
|
235
|
-
*
|
|
236
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
237
|
-
*
|
|
238
|
-
* @category Analytics Buckets
|
|
239
|
-
* @param bucketName - The name of the analytics bucket (warehouse) to connect to
|
|
240
|
-
* @returns The wrapped Iceberg catalog client
|
|
241
|
-
* @throws {StorageError} If the bucket name is invalid
|
|
242
|
-
*
|
|
243
|
-
* @example Get catalog and create table
|
|
244
|
-
* ```js
|
|
245
|
-
* // First, create an analytics bucket
|
|
246
|
-
* const { data: bucket, error: bucketError } = await supabase
|
|
247
|
-
* .storage
|
|
248
|
-
* .analytics
|
|
249
|
-
* .createBucket('analytics-data')
|
|
250
|
-
*
|
|
251
|
-
* // Get the Iceberg catalog for that bucket
|
|
252
|
-
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
253
|
-
*
|
|
254
|
-
* // Create a namespace
|
|
255
|
-
* const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })
|
|
256
|
-
*
|
|
257
|
-
* // Create a table with schema
|
|
258
|
-
* const { data: tableMetadata, error: tableError } = await catalog.createTable(
|
|
259
|
-
* { namespace: ['default'] },
|
|
260
|
-
* {
|
|
261
|
-
* name: 'events',
|
|
262
|
-
* schema: {
|
|
263
|
-
* type: 'struct',
|
|
264
|
-
* fields: [
|
|
265
|
-
* { id: 1, name: 'id', type: 'long', required: true },
|
|
266
|
-
* { id: 2, name: 'timestamp', type: 'timestamp', required: true },
|
|
267
|
-
* { id: 3, name: 'user_id', type: 'string', required: false }
|
|
268
|
-
* ],
|
|
269
|
-
* 'schema-id': 0,
|
|
270
|
-
* 'identifier-field-ids': [1]
|
|
271
|
-
* },
|
|
272
|
-
* 'partition-spec': {
|
|
273
|
-
* 'spec-id': 0,
|
|
274
|
-
* fields: []
|
|
275
|
-
* },
|
|
276
|
-
* 'write-order': {
|
|
277
|
-
* 'order-id': 0,
|
|
278
|
-
* fields: []
|
|
279
|
-
* },
|
|
280
|
-
* properties: {
|
|
281
|
-
* 'write.format.default': 'parquet'
|
|
282
|
-
* }
|
|
283
|
-
* }
|
|
284
|
-
* )
|
|
285
|
-
* ```
|
|
286
|
-
*
|
|
287
|
-
* @example List tables in namespace
|
|
288
|
-
* ```js
|
|
289
|
-
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
290
|
-
*
|
|
291
|
-
* // List all tables in the default namespace
|
|
292
|
-
* const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })
|
|
293
|
-
* if (listError) {
|
|
294
|
-
* if (listError.isNotFound()) {
|
|
295
|
-
* console.log('Namespace not found')
|
|
296
|
-
* }
|
|
297
|
-
* return
|
|
298
|
-
* }
|
|
299
|
-
* console.log(tables) // [{ namespace: ['default'], name: 'events' }]
|
|
300
|
-
* ```
|
|
301
|
-
*
|
|
302
|
-
* @example Working with namespaces
|
|
303
|
-
* ```js
|
|
304
|
-
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
305
|
-
*
|
|
306
|
-
* // List all namespaces
|
|
307
|
-
* const { data: namespaces } = await catalog.listNamespaces()
|
|
308
|
-
*
|
|
309
|
-
* // Create namespace with properties
|
|
310
|
-
* await catalog.createNamespace(
|
|
311
|
-
* { namespace: ['production'] },
|
|
312
|
-
* { properties: { owner: 'data-team', env: 'prod' } }
|
|
313
|
-
* )
|
|
314
|
-
* ```
|
|
315
|
-
*
|
|
316
|
-
* @example Cleanup operations
|
|
317
|
-
* ```js
|
|
318
|
-
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
319
|
-
*
|
|
320
|
-
* // Drop table with purge option (removes all data)
|
|
321
|
-
* const { error: dropError } = await catalog.dropTable(
|
|
322
|
-
* { namespace: ['default'], name: 'events' },
|
|
323
|
-
* { purge: true }
|
|
324
|
-
* )
|
|
325
|
-
*
|
|
326
|
-
* if (dropError?.isNotFound()) {
|
|
327
|
-
* console.log('Table does not exist')
|
|
328
|
-
* }
|
|
329
|
-
*
|
|
330
|
-
* // Drop namespace (must be empty)
|
|
331
|
-
* await catalog.dropNamespace({ namespace: ['default'] })
|
|
332
|
-
* ```
|
|
333
|
-
*
|
|
334
|
-
* @remarks
|
|
335
|
-
* This method provides a bridge between Supabase's bucket management and the standard
|
|
336
|
-
* Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.
|
|
337
|
-
* All authentication and configuration is handled automatically using your Supabase credentials.
|
|
338
|
-
*
|
|
339
|
-
* **Error Handling**: Invalid bucket names throw immediately. All catalog
|
|
340
|
-
* operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.
|
|
341
|
-
* Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.
|
|
342
|
-
* Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.
|
|
343
|
-
*
|
|
344
|
-
* **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently
|
|
345
|
-
* deletes all table data. Without it, the table is marked as deleted but data remains.
|
|
346
|
-
*
|
|
347
|
-
* **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.
|
|
348
|
-
* For complete API documentation and advanced usage, refer to the
|
|
349
|
-
* [iceberg-js documentation](https://supabase.github.io/iceberg-js/).
|
|
350
|
-
*/
|
|
351
|
-
from(bucketName) {
|
|
352
|
-
// Validate bucket name using same rules as Supabase Storage API backend
|
|
353
|
-
if (!(0, helpers_1.isValidBucketName)(bucketName)) {
|
|
354
|
-
throw new errors_1.StorageError('Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines ' +
|
|
355
|
-
'and should avoid the use of any other characters.');
|
|
356
|
-
}
|
|
357
|
-
// Construct the Iceberg REST Catalog URL
|
|
358
|
-
// The base URL is /storage/v1/iceberg
|
|
359
|
-
// Note: IcebergRestCatalog from iceberg-js automatically adds /v1/ prefix to API paths
|
|
360
|
-
// so we should NOT append /v1 here (it would cause double /v1/v1/ in the URL)
|
|
361
|
-
const catalog = new iceberg_js_1.IcebergRestCatalog({
|
|
362
|
-
baseUrl: this.url,
|
|
363
|
-
catalogName: bucketName, // Maps to the warehouse parameter in Supabase's implementation
|
|
364
|
-
auth: {
|
|
365
|
-
type: 'custom',
|
|
366
|
-
getHeaders: () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.headers; }),
|
|
367
|
-
},
|
|
368
|
-
fetch: this.fetch,
|
|
369
|
-
});
|
|
370
|
-
const shouldThrowOnError = this.shouldThrowOnError;
|
|
371
|
-
const wrappedCatalog = new Proxy(catalog, {
|
|
372
|
-
get(target, prop) {
|
|
373
|
-
const value = target[prop];
|
|
374
|
-
if (typeof value !== 'function') {
|
|
375
|
-
return value;
|
|
376
|
-
}
|
|
377
|
-
return (...args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
378
|
-
try {
|
|
379
|
-
const data = yield value.apply(target, args);
|
|
380
|
-
return { data, error: null };
|
|
381
|
-
}
|
|
382
|
-
catch (error) {
|
|
383
|
-
if (shouldThrowOnError) {
|
|
384
|
-
throw error;
|
|
385
|
-
}
|
|
386
|
-
return { data: null, error: error };
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
},
|
|
390
|
-
});
|
|
391
|
-
return wrappedCatalog;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
exports.default = StorageAnalyticsClient;
|
|
395
|
-
//# sourceMappingURL=StorageAnalyticsClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StorageAnalyticsClient.js","sourceRoot":"","sources":["../../../src/packages/StorageAnalyticsClient.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAC7D,gDAAkD;AAClD,0CAA4D;AAC5D,wCAAuD;AACvD,4CAAgE;AAWhE;;;GAGG;AACH,MAAqB,sBAAsB;IAMzC;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAnBrE,uBAAkB,GAAG,KAAK,CAAA;QAoBlC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED;;;;;;;;;;OAUG;IACI,YAAY;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,YAAY,CAAC,IAAY;;YAU7B,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,IAAA,YAAI,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;gBAC9F,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;YAC9B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAA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EAAE,IAAI,EAAE,CAAA;oBAC9B,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,IAAI,kBAAkB,EAAE,CAAC;4BACvB,MAAM,KAAK,CAAA;wBACb,CAAC;wBACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAqB,EAAE,CAAA;oBACrD,CAAC;gBACH,CAAC,CAAA,CAAA;YACH,CAAC;SACF,CAAyC,CAAA;QAE1C,OAAO,cAAc,CAAA;IACvB,CAAC;CACF;AAzaD,yCAyaC"}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { StorageError } from '../lib/errors';
|
|
2
|
-
import { Fetch } from '../lib/fetch';
|
|
3
|
-
import { Bucket, BucketType, ListBucketOptions } from '../lib/types';
|
|
4
|
-
import { StorageClientOptions } from '../StorageClient';
|
|
5
|
-
export default class StorageBucketApi {
|
|
6
|
-
protected url: string;
|
|
7
|
-
protected headers: {
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
10
|
-
protected fetch: Fetch;
|
|
11
|
-
protected shouldThrowOnError: boolean;
|
|
12
|
-
constructor(url: string, headers?: {
|
|
13
|
-
[key: string]: string;
|
|
14
|
-
}, fetch?: Fetch, opts?: StorageClientOptions);
|
|
15
|
-
/**
|
|
16
|
-
* Enable throwing errors instead of returning them.
|
|
17
|
-
*
|
|
18
|
-
* @category File Buckets
|
|
19
|
-
*/
|
|
20
|
-
throwOnError(): this;
|
|
21
|
-
/**
|
|
22
|
-
* Retrieves the details of all Storage buckets within an existing project.
|
|
23
|
-
*
|
|
24
|
-
* @category File Buckets
|
|
25
|
-
* @param options Query parameters for listing buckets
|
|
26
|
-
* @param options.limit Maximum number of buckets to return
|
|
27
|
-
* @param options.offset Number of buckets to skip
|
|
28
|
-
* @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
|
|
29
|
-
* @param options.sortOrder Sort order ('asc' or 'desc')
|
|
30
|
-
* @param options.search Search term to filter bucket names
|
|
31
|
-
* @returns Promise with response containing array of buckets or error
|
|
32
|
-
*
|
|
33
|
-
* @example List buckets
|
|
34
|
-
* ```js
|
|
35
|
-
* const { data, error } = await supabase
|
|
36
|
-
* .storage
|
|
37
|
-
* .listBuckets()
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @example List buckets with options
|
|
41
|
-
* ```js
|
|
42
|
-
* const { data, error } = await supabase
|
|
43
|
-
* .storage
|
|
44
|
-
* .listBuckets({
|
|
45
|
-
* limit: 10,
|
|
46
|
-
* offset: 0,
|
|
47
|
-
* sortColumn: 'created_at',
|
|
48
|
-
* sortOrder: 'desc',
|
|
49
|
-
* search: 'prod'
|
|
50
|
-
* })
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
listBuckets(options?: ListBucketOptions): Promise<{
|
|
54
|
-
data: Bucket[];
|
|
55
|
-
error: null;
|
|
56
|
-
} | {
|
|
57
|
-
data: null;
|
|
58
|
-
error: StorageError;
|
|
59
|
-
}>;
|
|
60
|
-
/**
|
|
61
|
-
* Retrieves the details of an existing Storage bucket.
|
|
62
|
-
*
|
|
63
|
-
* @category File Buckets
|
|
64
|
-
* @param id The unique identifier of the bucket you would like to retrieve.
|
|
65
|
-
* @returns Promise with response containing bucket details or error
|
|
66
|
-
*
|
|
67
|
-
* @example Get bucket
|
|
68
|
-
* ```js
|
|
69
|
-
* const { data, error } = await supabase
|
|
70
|
-
* .storage
|
|
71
|
-
* .getBucket('avatars')
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* Response:
|
|
75
|
-
* ```json
|
|
76
|
-
* {
|
|
77
|
-
* "data": {
|
|
78
|
-
* "id": "avatars",
|
|
79
|
-
* "name": "avatars",
|
|
80
|
-
* "owner": "",
|
|
81
|
-
* "public": false,
|
|
82
|
-
* "file_size_limit": 1024,
|
|
83
|
-
* "allowed_mime_types": [
|
|
84
|
-
* "image/png"
|
|
85
|
-
* ],
|
|
86
|
-
* "created_at": "2024-05-22T22:26:05.100Z",
|
|
87
|
-
* "updated_at": "2024-05-22T22:26:05.100Z"
|
|
88
|
-
* },
|
|
89
|
-
* "error": null
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
getBucket(id: string): Promise<{
|
|
94
|
-
data: Bucket;
|
|
95
|
-
error: null;
|
|
96
|
-
} | {
|
|
97
|
-
data: null;
|
|
98
|
-
error: StorageError;
|
|
99
|
-
}>;
|
|
100
|
-
/**
|
|
101
|
-
* Creates a new Storage bucket
|
|
102
|
-
*
|
|
103
|
-
* @category File Buckets
|
|
104
|
-
* @param id A unique identifier for the bucket you are creating.
|
|
105
|
-
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
|
|
106
|
-
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
|
|
107
|
-
* The global file size limit takes precedence over this value.
|
|
108
|
-
* The default value is null, which doesn't set a per bucket file size limit.
|
|
109
|
-
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
|
|
110
|
-
* The default value is null, which allows files with all mime types to be uploaded.
|
|
111
|
-
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
|
|
112
|
-
* @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
|
|
113
|
-
* - default bucket type is `STANDARD`
|
|
114
|
-
* @returns Promise with response containing newly created bucket name or error
|
|
115
|
-
*
|
|
116
|
-
* @example Create bucket
|
|
117
|
-
* ```js
|
|
118
|
-
* const { data, error } = await supabase
|
|
119
|
-
* .storage
|
|
120
|
-
* .createBucket('avatars', {
|
|
121
|
-
* public: false,
|
|
122
|
-
* allowedMimeTypes: ['image/png'],
|
|
123
|
-
* fileSizeLimit: 1024
|
|
124
|
-
* })
|
|
125
|
-
* ```
|
|
126
|
-
*
|
|
127
|
-
* Response:
|
|
128
|
-
* ```json
|
|
129
|
-
* {
|
|
130
|
-
* "data": {
|
|
131
|
-
* "name": "avatars"
|
|
132
|
-
* },
|
|
133
|
-
* "error": null
|
|
134
|
-
* }
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
createBucket(id: string, options?: {
|
|
138
|
-
public: boolean;
|
|
139
|
-
fileSizeLimit?: number | string | null;
|
|
140
|
-
allowedMimeTypes?: string[] | null;
|
|
141
|
-
type?: BucketType;
|
|
142
|
-
}): Promise<{
|
|
143
|
-
data: Pick<Bucket, 'name'>;
|
|
144
|
-
error: null;
|
|
145
|
-
} | {
|
|
146
|
-
data: null;
|
|
147
|
-
error: StorageError;
|
|
148
|
-
}>;
|
|
149
|
-
/**
|
|
150
|
-
* Updates a Storage bucket
|
|
151
|
-
*
|
|
152
|
-
* @category File Buckets
|
|
153
|
-
* @param id A unique identifier for the bucket you are updating.
|
|
154
|
-
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
|
|
155
|
-
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
|
|
156
|
-
* The global file size limit takes precedence over this value.
|
|
157
|
-
* The default value is null, which doesn't set a per bucket file size limit.
|
|
158
|
-
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
|
|
159
|
-
* The default value is null, which allows files with all mime types to be uploaded.
|
|
160
|
-
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
|
|
161
|
-
* @returns Promise with response containing success message or error
|
|
162
|
-
*
|
|
163
|
-
* @example Update bucket
|
|
164
|
-
* ```js
|
|
165
|
-
* const { data, error } = await supabase
|
|
166
|
-
* .storage
|
|
167
|
-
* .updateBucket('avatars', {
|
|
168
|
-
* public: false,
|
|
169
|
-
* allowedMimeTypes: ['image/png'],
|
|
170
|
-
* fileSizeLimit: 1024
|
|
171
|
-
* })
|
|
172
|
-
* ```
|
|
173
|
-
*
|
|
174
|
-
* Response:
|
|
175
|
-
* ```json
|
|
176
|
-
* {
|
|
177
|
-
* "data": {
|
|
178
|
-
* "message": "Successfully updated"
|
|
179
|
-
* },
|
|
180
|
-
* "error": null
|
|
181
|
-
* }
|
|
182
|
-
* ```
|
|
183
|
-
*/
|
|
184
|
-
updateBucket(id: string, options: {
|
|
185
|
-
public: boolean;
|
|
186
|
-
fileSizeLimit?: number | string | null;
|
|
187
|
-
allowedMimeTypes?: string[] | null;
|
|
188
|
-
}): Promise<{
|
|
189
|
-
data: {
|
|
190
|
-
message: string;
|
|
191
|
-
};
|
|
192
|
-
error: null;
|
|
193
|
-
} | {
|
|
194
|
-
data: null;
|
|
195
|
-
error: StorageError;
|
|
196
|
-
}>;
|
|
197
|
-
/**
|
|
198
|
-
* Removes all objects inside a single bucket.
|
|
199
|
-
*
|
|
200
|
-
* @category File Buckets
|
|
201
|
-
* @param id The unique identifier of the bucket you would like to empty.
|
|
202
|
-
* @returns Promise with success message or error
|
|
203
|
-
*
|
|
204
|
-
* @example Empty bucket
|
|
205
|
-
* ```js
|
|
206
|
-
* const { data, error } = await supabase
|
|
207
|
-
* .storage
|
|
208
|
-
* .emptyBucket('avatars')
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
* Response:
|
|
212
|
-
* ```json
|
|
213
|
-
* {
|
|
214
|
-
* "data": {
|
|
215
|
-
* "message": "Successfully emptied"
|
|
216
|
-
* },
|
|
217
|
-
* "error": null
|
|
218
|
-
* }
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
emptyBucket(id: string): Promise<{
|
|
222
|
-
data: {
|
|
223
|
-
message: string;
|
|
224
|
-
};
|
|
225
|
-
error: null;
|
|
226
|
-
} | {
|
|
227
|
-
data: null;
|
|
228
|
-
error: StorageError;
|
|
229
|
-
}>;
|
|
230
|
-
/**
|
|
231
|
-
* Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
|
|
232
|
-
* You must first `empty()` the bucket.
|
|
233
|
-
*
|
|
234
|
-
* @category File Buckets
|
|
235
|
-
* @param id The unique identifier of the bucket you would like to delete.
|
|
236
|
-
* @returns Promise with success message or error
|
|
237
|
-
*
|
|
238
|
-
* @example Delete bucket
|
|
239
|
-
* ```js
|
|
240
|
-
* const { data, error } = await supabase
|
|
241
|
-
* .storage
|
|
242
|
-
* .deleteBucket('avatars')
|
|
243
|
-
* ```
|
|
244
|
-
*
|
|
245
|
-
* Response:
|
|
246
|
-
* ```json
|
|
247
|
-
* {
|
|
248
|
-
* "data": {
|
|
249
|
-
* "message": "Successfully deleted"
|
|
250
|
-
* },
|
|
251
|
-
* "error": null
|
|
252
|
-
* }
|
|
253
|
-
* ```
|
|
254
|
-
*/
|
|
255
|
-
deleteBucket(id: string): Promise<{
|
|
256
|
-
data: {
|
|
257
|
-
message: string;
|
|
258
|
-
};
|
|
259
|
-
error: null;
|
|
260
|
-
} | {
|
|
261
|
-
data: null;
|
|
262
|
-
error: StorageError;
|
|
263
|
-
}>;
|
|
264
|
-
private listBucketOptionsToQueryString;
|
|
265
|
-
}
|
|
266
|
-
//# sourceMappingURL=StorageBucketApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StorageBucketApi.d.ts","sourceRoot":"","sources":["../../../src/packages/StorageBucketApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,KAAK,EAA0B,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC5C,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;IACtB,SAAS,CAAC,kBAAkB,UAAQ;gBAGlC,GAAG,E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