Skip to content

Commit 4977488

Browse files
committed
chore(storage): use the new lib
1 parent da9d2ee commit 4977488

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

packages/core/storage-js/src/StorageClient.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export class StorageClient extends StorageBucketApi {
1515
opts?: StorageClientOptions
1616
) {
1717
super(url, headers, fetch, opts)
18-
console.log(new StorageVectorsClient('https://api.example.com'))
1918
}
2019

2120
/**
@@ -26,4 +25,16 @@ export class StorageClient extends StorageBucketApi {
2625
from(id: string): StorageFileApi {
2726
return new StorageFileApi(this.url, this.headers, id, this.fetch)
2827
}
29-
}
28+
29+
/**
30+
* Access vector storage operations.
31+
*
32+
* @returns A StorageVectorsClient instance configured with the current storage settings.
33+
*/
34+
vectors(): StorageVectorsClient {
35+
return new StorageVectorsClient(this.url, {
36+
headers: this.headers,
37+
fetch: this.fetch,
38+
})
39+
}
40+
}

packages/core/storage-js/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { StorageClient } from './StorageClient'
22
export type { StorageClientOptions } from './StorageClient'
33
export * from './lib/types'
44
export * from './lib/errors'
5+
export * from '@supabase/storage-vectors-js'

packages/integrations/storage-vectors-js/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export type {
4141
ApiResponse,
4242
SuccessResponse,
4343
ErrorResponse,
44-
FetchParameters,
44+
VectorFetchParameters,
4545
} from './lib/types'
4646

4747
// Errors

packages/integrations/storage-vectors-js/src/lib/fetch.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { StorageVectorsApiError, StorageVectorsUnknownError } from './errors'
22
import { isPlainObject, resolveResponse } from './helpers'
3-
import { FetchParameters } from './types'
3+
import { VectorFetchParameters } from './types'
44

55
export type Fetch = typeof fetch
66

@@ -69,7 +69,7 @@ const handleError = async (
6969
const _getRequestParams = (
7070
method: RequestMethodType,
7171
options?: FetchOptions,
72-
parameters?: FetchParameters,
72+
parameters?: VectorFetchParameters,
7373
body?: object
7474
) => {
7575
const params: { [k: string]: any } = { method, headers: options?.headers || {} }
@@ -103,7 +103,7 @@ async function _handleRequest(
103103
method: RequestMethodType,
104104
url: string,
105105
options?: FetchOptions,
106-
parameters?: FetchParameters,
106+
parameters?: VectorFetchParameters,
107107
body?: object
108108
): Promise<any> {
109109
return new Promise((resolve, reject) => {
@@ -135,7 +135,7 @@ export async function get(
135135
fetcher: Fetch,
136136
url: string,
137137
options?: FetchOptions,
138-
parameters?: FetchParameters
138+
parameters?: VectorFetchParameters
139139
): Promise<any> {
140140
return _handleRequest(fetcher, 'GET', url, options, parameters)
141141
}
@@ -154,7 +154,7 @@ export async function post(
154154
url: string,
155155
body: object,
156156
options?: FetchOptions,
157-
parameters?: FetchParameters
157+
parameters?: VectorFetchParameters
158158
): Promise<any> {
159159
return _handleRequest(fetcher, 'POST', url, options, parameters, body)
160160
}
@@ -173,7 +173,7 @@ export async function put(
173173
url: string,
174174
body: object,
175175
options?: FetchOptions,
176-
parameters?: FetchParameters
176+
parameters?: VectorFetchParameters
177177
): Promise<any> {
178178
return _handleRequest(fetcher, 'PUT', url, options, parameters, body)
179179
}
@@ -192,7 +192,7 @@ export async function remove(
192192
url: string,
193193
body: object,
194194
options?: FetchOptions,
195-
parameters?: FetchParameters
195+
parameters?: VectorFetchParameters
196196
): Promise<any> {
197197
return _handleRequest(fetcher, 'DELETE', url, options, parameters, body)
198198
}

packages/integrations/storage-vectors-js/src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export interface QueryVectorsResponse {
268268
* Fetch-specific parameters like abort signals
269269
* @property signal - AbortSignal for cancelling requests
270270
*/
271-
export interface FetchParameters {
271+
export interface VectorFetchParameters {
272272
signal?: AbortSignal
273273
}
274274

0 commit comments

Comments
 (0)