@svarabase/js 1.0.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.
- package/dist/auth/index.d.ts +172 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +282 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/session.d.ts +42 -0
- package/dist/auth/session.d.ts.map +1 -0
- package/dist/auth/session.js +65 -0
- package/dist/auth/session.js.map +1 -0
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +41 -0
- package/dist/client.js.map +1 -0
- package/dist/db/filterBuilder.d.ts +84 -0
- package/dist/db/filterBuilder.d.ts.map +1 -0
- package/dist/db/filterBuilder.js +227 -0
- package/dist/db/filterBuilder.js.map +1 -0
- package/dist/db/index.d.ts +42 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +67 -0
- package/dist/db/index.js.map +1 -0
- package/dist/esm/auth/index.js +277 -0
- package/dist/esm/auth/session.js +60 -0
- package/dist/esm/client.js +36 -0
- package/dist/esm/db/filterBuilder.js +222 -0
- package/dist/esm/db/index.js +61 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/realtime/index.js +23 -0
- package/dist/esm/storage/index.js +144 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/realtime/index.d.ts +14 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +29 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/storage/index.d.ts +74 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +149 -0
- package/dist/storage/index.js.map +1 -0
- package/package.json +46 -0
- package/src/auth/index.ts +325 -0
- package/src/auth/session.ts +94 -0
- package/src/client.ts +66 -0
- package/src/db/filterBuilder.ts +302 -0
- package/src/db/index.ts +86 -0
- package/src/index.ts +22 -0
- package/src/realtime/index.ts +38 -0
- package/src/storage/index.ts +174 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export class SvarabaseStorageClient {
|
|
2
|
+
constructor(url, key, getAuthHeader) {
|
|
3
|
+
this.url = `${url}/storage/v1`;
|
|
4
|
+
this.key = key;
|
|
5
|
+
this.getAuthHeader = getAuthHeader;
|
|
6
|
+
}
|
|
7
|
+
from(bucketId) {
|
|
8
|
+
return new StorageBucketApi(this.url, this.key, this.getAuthHeader, bucketId);
|
|
9
|
+
}
|
|
10
|
+
async listBuckets() {
|
|
11
|
+
try {
|
|
12
|
+
const res = await this._fetch('/bucket');
|
|
13
|
+
const data = await res.json();
|
|
14
|
+
return { data, error: null };
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
return { data: null, error: e };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async createBucket(id, options) {
|
|
21
|
+
try {
|
|
22
|
+
const res = await this._fetch('/bucket', {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
body: JSON.stringify({ id, name: id, public: options?.public ?? false, file_size_limit: options?.fileSizeLimit, allowed_mime_types: options?.allowedMimeTypes }),
|
|
25
|
+
});
|
|
26
|
+
const data = await res.json();
|
|
27
|
+
if (!res.ok)
|
|
28
|
+
return { data: null, error: new Error(data.message) };
|
|
29
|
+
return { data, error: null };
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
return { data: null, error: e };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
_fetch(path, init = {}) {
|
|
36
|
+
return fetch(`${this.url}${path}`, {
|
|
37
|
+
...init,
|
|
38
|
+
headers: {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
apikey: this.key,
|
|
41
|
+
Authorization: this.getAuthHeader(),
|
|
42
|
+
...(init.headers ?? {}),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class StorageBucketApi {
|
|
48
|
+
constructor(url, key, getAuthHeader, bucketId) {
|
|
49
|
+
this.url = url;
|
|
50
|
+
this.key = key;
|
|
51
|
+
this.getAuthHeader = getAuthHeader;
|
|
52
|
+
this.bucketId = bucketId;
|
|
53
|
+
}
|
|
54
|
+
get baseUrl() { return `${this.url}/object/${this.bucketId}`; }
|
|
55
|
+
async upload(path, fileBody, options) {
|
|
56
|
+
try {
|
|
57
|
+
const headers = {
|
|
58
|
+
apikey: this.key,
|
|
59
|
+
Authorization: this.getAuthHeader(),
|
|
60
|
+
};
|
|
61
|
+
if (options?.contentType)
|
|
62
|
+
headers['content-type'] = options.contentType;
|
|
63
|
+
if (options?.cacheControl)
|
|
64
|
+
headers['cache-control'] = options.cacheControl;
|
|
65
|
+
if (options?.upsert)
|
|
66
|
+
headers['x-upsert'] = 'true';
|
|
67
|
+
const res = await fetch(`${this.baseUrl}/${path}`, {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
headers,
|
|
70
|
+
body: fileBody,
|
|
71
|
+
});
|
|
72
|
+
if (!res.ok) {
|
|
73
|
+
const data = await res.json().catch(() => ({}));
|
|
74
|
+
return { data: null, error: new Error(data.message ?? 'Upload failed') };
|
|
75
|
+
}
|
|
76
|
+
return { data: { path }, error: null };
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
return { data: null, error: e };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
getPublicUrl(path) {
|
|
83
|
+
const publicUrl = `${this.url}/object/public/${this.bucketId}/${path}`;
|
|
84
|
+
return { data: { publicUrl } };
|
|
85
|
+
}
|
|
86
|
+
async createSignedUrl(path, expiresIn, options) {
|
|
87
|
+
try {
|
|
88
|
+
const res = await fetch(`${this.url}/object/sign/${this.bucketId}/${path}`, {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
headers: {
|
|
91
|
+
'Content-Type': 'application/json',
|
|
92
|
+
apikey: this.key,
|
|
93
|
+
Authorization: this.getAuthHeader(),
|
|
94
|
+
},
|
|
95
|
+
body: JSON.stringify({ expiresIn }),
|
|
96
|
+
});
|
|
97
|
+
const data = await res.json();
|
|
98
|
+
if (!res.ok)
|
|
99
|
+
return { data: null, error: new Error(data.message ?? 'Signing failed') };
|
|
100
|
+
return { data: { signedUrl: data.signedURL ?? data.signedUrl }, error: null };
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
return { data: null, error: e };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async remove(paths) {
|
|
107
|
+
try {
|
|
108
|
+
const res = await fetch(`${this.url}/object/${this.bucketId}`, {
|
|
109
|
+
method: 'DELETE',
|
|
110
|
+
headers: {
|
|
111
|
+
'Content-Type': 'application/json',
|
|
112
|
+
apikey: this.key,
|
|
113
|
+
Authorization: this.getAuthHeader(),
|
|
114
|
+
},
|
|
115
|
+
body: JSON.stringify({ prefixes: paths }),
|
|
116
|
+
});
|
|
117
|
+
const data = await res.json();
|
|
118
|
+
if (!res.ok)
|
|
119
|
+
return { data: null, error: new Error(data.message) };
|
|
120
|
+
return { data: data, error: null };
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
return { data: null, error: e };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async list(prefix, options) {
|
|
127
|
+
try {
|
|
128
|
+
const res = await fetch(`${this.url}/object/list/${this.bucketId}`, {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
headers: {
|
|
131
|
+
'Content-Type': 'application/json',
|
|
132
|
+
apikey: this.key,
|
|
133
|
+
Authorization: this.getAuthHeader(),
|
|
134
|
+
},
|
|
135
|
+
body: JSON.stringify({ prefix: prefix ?? '', limit: options?.limit ?? 100, offset: options?.offset, search: options?.search }),
|
|
136
|
+
});
|
|
137
|
+
const data = await res.json();
|
|
138
|
+
return { data: data, error: null };
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
return { data: null, error: e };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { SvarabaseClient } from './client';
|
|
2
|
+
export { SvarabaseAuthClient } from './auth';
|
|
3
|
+
export { SvarabaseQueryBuilder } from './db';
|
|
4
|
+
export { SvarabaseStorageClient } from './storage';
|
|
5
|
+
export { SvarabaseRealtimeClient } from './realtime';
|
|
6
|
+
export type { SvarabaseClientOptions } from './client';
|
|
7
|
+
export type { Session, UserData, AuthChangeEvent, AuthListener } from './auth/session';
|
|
8
|
+
export type { PostgrestResponse, PostgrestSingleResponse } from './db/filterBuilder';
|
|
9
|
+
import { SvarabaseClient } from './client';
|
|
10
|
+
import type { SvarabaseClientOptions } from './client';
|
|
11
|
+
export declare function createClient(supabaseUrl: string, supabaseKey: string, options?: SvarabaseClientOptions): SvarabaseClient;
|
|
12
|
+
export default createClient;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvF,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGvD,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,eAAe,CAEjB;AAED,eAAe,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SvarabaseRealtimeClient = exports.SvarabaseStorageClient = exports.SvarabaseQueryBuilder = exports.SvarabaseAuthClient = exports.SvarabaseClient = void 0;
|
|
4
|
+
exports.createClient = createClient;
|
|
5
|
+
var client_1 = require("./client");
|
|
6
|
+
Object.defineProperty(exports, "SvarabaseClient", { enumerable: true, get: function () { return client_1.SvarabaseClient; } });
|
|
7
|
+
var auth_1 = require("./auth");
|
|
8
|
+
Object.defineProperty(exports, "SvarabaseAuthClient", { enumerable: true, get: function () { return auth_1.SvarabaseAuthClient; } });
|
|
9
|
+
var db_1 = require("./db");
|
|
10
|
+
Object.defineProperty(exports, "SvarabaseQueryBuilder", { enumerable: true, get: function () { return db_1.SvarabaseQueryBuilder; } });
|
|
11
|
+
var storage_1 = require("./storage");
|
|
12
|
+
Object.defineProperty(exports, "SvarabaseStorageClient", { enumerable: true, get: function () { return storage_1.SvarabaseStorageClient; } });
|
|
13
|
+
var realtime_1 = require("./realtime");
|
|
14
|
+
Object.defineProperty(exports, "SvarabaseRealtimeClient", { enumerable: true, get: function () { return realtime_1.SvarabaseRealtimeClient; } });
|
|
15
|
+
const client_2 = require("./client");
|
|
16
|
+
// Drop-in replacement for @supabase/supabase-js createClient
|
|
17
|
+
function createClient(supabaseUrl, supabaseKey, options) {
|
|
18
|
+
return new client_2.SvarabaseClient(supabaseUrl, supabaseKey, options);
|
|
19
|
+
}
|
|
20
|
+
exports.default = createClient;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAaA,oCAMC;AAnBD,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAC5B,2BAA6C;AAApC,2GAAA,qBAAqB,OAAA;AAC9B,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAC/B,uCAAqD;AAA5C,mHAAA,uBAAuB,OAAA;AAKhC,qCAA2C;AAG3C,6DAA6D;AAC7D,SAAgB,YAAY,CAC1B,WAAmB,EACnB,WAAmB,EACnB,OAAgC;IAEhC,OAAO,IAAI,wBAAe,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type RealtimeChannelStatus = 'SUBSCRIBED' | 'CLOSED' | 'CHANNEL_ERROR' | 'TIMED_OUT';
|
|
2
|
+
export declare class RealtimeChannel {
|
|
3
|
+
private channelId;
|
|
4
|
+
constructor(channelId: string);
|
|
5
|
+
on(_type: 'postgres_changes' | 'broadcast' | 'presence', _filter: Record<string, unknown>, _callback: (payload: unknown) => void): this;
|
|
6
|
+
subscribe(_callback?: (status: RealtimeChannelStatus) => void): this;
|
|
7
|
+
unsubscribe(): Promise<'ok' | 'error' | 'timed out'>;
|
|
8
|
+
}
|
|
9
|
+
export declare class SvarabaseRealtimeClient {
|
|
10
|
+
channel(channelId: string): RealtimeChannel;
|
|
11
|
+
removeChannel(_channel: RealtimeChannel): void;
|
|
12
|
+
removeAllChannels(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/realtime/index.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,QAAQ,GAAG,eAAe,GAAG,WAAW,CAAC;AAE5F,qBAAa,eAAe;IAC1B,OAAO,CAAC,SAAS,CAAS;gBAEd,SAAS,EAAE,MAAM;IAI7B,EAAE,CACA,KAAK,EAAE,kBAAkB,GAAG,WAAW,GAAG,UAAU,EACpD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACpC,IAAI;IAIP,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,GAAG,IAAI;IAIpE,WAAW,IAAI,OAAO,CAAC,IAAI,GAAG,OAAO,GAAG,WAAW,CAAC;CAGrD;AAED,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe;IAI3C,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAE9C,iBAAiB,IAAI,IAAI;CAC1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Realtime stub - Yesvara uses Socket.IO instead of Supabase Realtime
|
|
3
|
+
// This stub provides API compatibility without actual websocket functionality
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.SvarabaseRealtimeClient = exports.RealtimeChannel = void 0;
|
|
6
|
+
class RealtimeChannel {
|
|
7
|
+
constructor(channelId) {
|
|
8
|
+
this.channelId = channelId;
|
|
9
|
+
}
|
|
10
|
+
on(_type, _filter, _callback) {
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
subscribe(_callback) {
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
unsubscribe() {
|
|
17
|
+
return Promise.resolve('ok');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.RealtimeChannel = RealtimeChannel;
|
|
21
|
+
class SvarabaseRealtimeClient {
|
|
22
|
+
channel(channelId) {
|
|
23
|
+
return new RealtimeChannel(channelId);
|
|
24
|
+
}
|
|
25
|
+
removeChannel(_channel) { }
|
|
26
|
+
removeAllChannels() { }
|
|
27
|
+
}
|
|
28
|
+
exports.SvarabaseRealtimeClient = SvarabaseRealtimeClient;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/realtime/index.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,8EAA8E;;;AAI9E,MAAa,eAAe;IAG1B,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,EAAE,CACA,KAAoD,EACpD,OAAgC,EAChC,SAAqC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,SAAmD;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW;QACT,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAtBD,0CAsBC;AAED,MAAa,uBAAuB;IAClC,OAAO,CAAC,SAAiB;QACvB,OAAO,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,aAAa,CAAC,QAAyB,IAAS,CAAC;IAEjD,iBAAiB,KAAU,CAAC;CAC7B;AARD,0DAQC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface StorageUploadOptions {
|
|
2
|
+
cacheControl?: string;
|
|
3
|
+
contentType?: string;
|
|
4
|
+
upsert?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface FileObject {
|
|
7
|
+
name: string;
|
|
8
|
+
id: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
last_accessed_at: string;
|
|
12
|
+
metadata: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export declare class SvarabaseStorageClient {
|
|
15
|
+
private url;
|
|
16
|
+
private key;
|
|
17
|
+
private getAuthHeader;
|
|
18
|
+
constructor(url: string, key: string, getAuthHeader: () => string);
|
|
19
|
+
from(bucketId: string): StorageBucketApi;
|
|
20
|
+
listBuckets(): Promise<{
|
|
21
|
+
data: unknown[] | null;
|
|
22
|
+
error: Error | null;
|
|
23
|
+
}>;
|
|
24
|
+
createBucket(id: string, options?: {
|
|
25
|
+
public?: boolean;
|
|
26
|
+
fileSizeLimit?: number;
|
|
27
|
+
allowedMimeTypes?: string[];
|
|
28
|
+
}): Promise<{
|
|
29
|
+
data: unknown;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
}>;
|
|
32
|
+
private _fetch;
|
|
33
|
+
}
|
|
34
|
+
declare class StorageBucketApi {
|
|
35
|
+
private url;
|
|
36
|
+
private key;
|
|
37
|
+
private getAuthHeader;
|
|
38
|
+
private bucketId;
|
|
39
|
+
constructor(url: string, key: string, getAuthHeader: () => string, bucketId: string);
|
|
40
|
+
private get baseUrl();
|
|
41
|
+
upload(path: string, fileBody: File | Blob | Buffer | ArrayBuffer | ReadableStream | string, options?: StorageUploadOptions): Promise<{
|
|
42
|
+
data: {
|
|
43
|
+
path: string;
|
|
44
|
+
} | null;
|
|
45
|
+
error: Error | null;
|
|
46
|
+
}>;
|
|
47
|
+
getPublicUrl(path: string): {
|
|
48
|
+
data: {
|
|
49
|
+
publicUrl: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
createSignedUrl(path: string, expiresIn: number, options?: {
|
|
53
|
+
download?: boolean | string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
data: {
|
|
56
|
+
signedUrl: string;
|
|
57
|
+
} | null;
|
|
58
|
+
error: Error | null;
|
|
59
|
+
}>;
|
|
60
|
+
remove(paths: string[]): Promise<{
|
|
61
|
+
data: FileObject[] | null;
|
|
62
|
+
error: Error | null;
|
|
63
|
+
}>;
|
|
64
|
+
list(prefix?: string, options?: {
|
|
65
|
+
limit?: number;
|
|
66
|
+
offset?: number;
|
|
67
|
+
search?: string;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
data: FileObject[] | null;
|
|
70
|
+
error: Error | null;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E;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;CAgB/D"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SvarabaseStorageClient = void 0;
|
|
4
|
+
class SvarabaseStorageClient {
|
|
5
|
+
constructor(url, key, getAuthHeader) {
|
|
6
|
+
this.url = `${url}/storage/v1`;
|
|
7
|
+
this.key = key;
|
|
8
|
+
this.getAuthHeader = getAuthHeader;
|
|
9
|
+
}
|
|
10
|
+
from(bucketId) {
|
|
11
|
+
return new StorageBucketApi(this.url, this.key, this.getAuthHeader, bucketId);
|
|
12
|
+
}
|
|
13
|
+
async listBuckets() {
|
|
14
|
+
try {
|
|
15
|
+
const res = await this._fetch('/bucket');
|
|
16
|
+
const data = await res.json();
|
|
17
|
+
return { data, error: null };
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
return { data: null, error: e };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async createBucket(id, options) {
|
|
24
|
+
try {
|
|
25
|
+
const res = await this._fetch('/bucket', {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
body: JSON.stringify({ id, name: id, public: options?.public ?? false, file_size_limit: options?.fileSizeLimit, allowed_mime_types: options?.allowedMimeTypes }),
|
|
28
|
+
});
|
|
29
|
+
const data = await res.json();
|
|
30
|
+
if (!res.ok)
|
|
31
|
+
return { data: null, error: new Error(data.message) };
|
|
32
|
+
return { data, error: null };
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return { data: null, error: e };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
_fetch(path, init = {}) {
|
|
39
|
+
return fetch(`${this.url}${path}`, {
|
|
40
|
+
...init,
|
|
41
|
+
headers: {
|
|
42
|
+
'Content-Type': 'application/json',
|
|
43
|
+
apikey: this.key,
|
|
44
|
+
Authorization: this.getAuthHeader(),
|
|
45
|
+
...(init.headers ?? {}),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.SvarabaseStorageClient = SvarabaseStorageClient;
|
|
51
|
+
class StorageBucketApi {
|
|
52
|
+
constructor(url, key, getAuthHeader, bucketId) {
|
|
53
|
+
this.url = url;
|
|
54
|
+
this.key = key;
|
|
55
|
+
this.getAuthHeader = getAuthHeader;
|
|
56
|
+
this.bucketId = bucketId;
|
|
57
|
+
}
|
|
58
|
+
get baseUrl() { return `${this.url}/object/${this.bucketId}`; }
|
|
59
|
+
async upload(path, fileBody, options) {
|
|
60
|
+
try {
|
|
61
|
+
const headers = {
|
|
62
|
+
apikey: this.key,
|
|
63
|
+
Authorization: this.getAuthHeader(),
|
|
64
|
+
};
|
|
65
|
+
if (options?.contentType)
|
|
66
|
+
headers['content-type'] = options.contentType;
|
|
67
|
+
if (options?.cacheControl)
|
|
68
|
+
headers['cache-control'] = options.cacheControl;
|
|
69
|
+
if (options?.upsert)
|
|
70
|
+
headers['x-upsert'] = 'true';
|
|
71
|
+
const res = await fetch(`${this.baseUrl}/${path}`, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers,
|
|
74
|
+
body: fileBody,
|
|
75
|
+
});
|
|
76
|
+
if (!res.ok) {
|
|
77
|
+
const data = await res.json().catch(() => ({}));
|
|
78
|
+
return { data: null, error: new Error(data.message ?? 'Upload failed') };
|
|
79
|
+
}
|
|
80
|
+
return { data: { path }, error: null };
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
return { data: null, error: e };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
getPublicUrl(path) {
|
|
87
|
+
const publicUrl = `${this.url}/object/public/${this.bucketId}/${path}`;
|
|
88
|
+
return { data: { publicUrl } };
|
|
89
|
+
}
|
|
90
|
+
async createSignedUrl(path, expiresIn, options) {
|
|
91
|
+
try {
|
|
92
|
+
const res = await fetch(`${this.url}/object/sign/${this.bucketId}/${path}`, {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
headers: {
|
|
95
|
+
'Content-Type': 'application/json',
|
|
96
|
+
apikey: this.key,
|
|
97
|
+
Authorization: this.getAuthHeader(),
|
|
98
|
+
},
|
|
99
|
+
body: JSON.stringify({ expiresIn }),
|
|
100
|
+
});
|
|
101
|
+
const data = await res.json();
|
|
102
|
+
if (!res.ok)
|
|
103
|
+
return { data: null, error: new Error(data.message ?? 'Signing failed') };
|
|
104
|
+
return { data: { signedUrl: data.signedURL ?? data.signedUrl }, error: null };
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
return { data: null, error: e };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async remove(paths) {
|
|
111
|
+
try {
|
|
112
|
+
const res = await fetch(`${this.url}/object/${this.bucketId}`, {
|
|
113
|
+
method: 'DELETE',
|
|
114
|
+
headers: {
|
|
115
|
+
'Content-Type': 'application/json',
|
|
116
|
+
apikey: this.key,
|
|
117
|
+
Authorization: this.getAuthHeader(),
|
|
118
|
+
},
|
|
119
|
+
body: JSON.stringify({ prefixes: paths }),
|
|
120
|
+
});
|
|
121
|
+
const data = await res.json();
|
|
122
|
+
if (!res.ok)
|
|
123
|
+
return { data: null, error: new Error(data.message) };
|
|
124
|
+
return { data: data, error: null };
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
return { data: null, error: e };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async list(prefix, options) {
|
|
131
|
+
try {
|
|
132
|
+
const res = await fetch(`${this.url}/object/list/${this.bucketId}`, {
|
|
133
|
+
method: 'POST',
|
|
134
|
+
headers: {
|
|
135
|
+
'Content-Type': 'application/json',
|
|
136
|
+
apikey: this.key,
|
|
137
|
+
Authorization: this.getAuthHeader(),
|
|
138
|
+
},
|
|
139
|
+
body: JSON.stringify({ prefix: prefix ?? '', limit: options?.limit ?? 100, offset: options?.offset, search: options?.search }),
|
|
140
|
+
});
|
|
141
|
+
const data = await res.json();
|
|
142
|
+
return { data: data, error: null };
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
return { data: null, error: e };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":";;;AAeA,MAAa,sBAAsB;IAKjC,YAAY,GAAW,EAAE,GAAW,EAAE,aAA2B;QAC/D,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,aAAa,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,IAAI,CAAC,QAAgB;QACnB,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACzC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAU,EAAE,CAAC;QAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,Y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AAE,IAAI,CAAC,aAAa,EAAE;iBACpC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;aAC/H,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,EAAE,IAAI,EAAE,IAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACrD,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAU,EAAE,CAAC;QAAC,CAAC;IACpE,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@svarabase/js",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Svarabase JavaScript SDK - drop-in replacement for @supabase/supabase-js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc && tsc -p tsconfig.esm.json",
|
|
21
|
+
"dev": "tsc --watch"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"supabase",
|
|
25
|
+
"postgresql",
|
|
26
|
+
"database",
|
|
27
|
+
"rest",
|
|
28
|
+
"sdk",
|
|
29
|
+
"backend",
|
|
30
|
+
"auth",
|
|
31
|
+
"storage"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/yogiswara92/svarabase"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^20.14.9",
|
|
44
|
+
"typescript": "^5.5.3"
|
|
45
|
+
}
|
|
46
|
+
}
|