@bagelink/sdk 0.0.256 → 0.0.260
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/index.cjs +1 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
- package/src/index.ts +5 -3
package/dist/index.cjs
CHANGED
|
@@ -433,6 +433,7 @@ class BagelAuth {
|
|
|
433
433
|
class Bagel {
|
|
434
434
|
constructor({ host, onError }) {
|
|
435
435
|
__publicField(this, "host");
|
|
436
|
+
__publicField(this, "axiosInstance", axios);
|
|
436
437
|
// eslint-disable-next-line no-unused-vars
|
|
437
438
|
__publicField(this, "onError");
|
|
438
439
|
__publicField(this, "read_table", null);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
1
3
|
type OpenAPIResponse = {
|
|
2
4
|
types: string;
|
|
3
5
|
code: string;
|
|
@@ -50,6 +52,7 @@ declare class BagelAuth {
|
|
|
50
52
|
}
|
|
51
53
|
declare class Bagel {
|
|
52
54
|
host: string;
|
|
55
|
+
axiosInstance: AxiosInstance;
|
|
53
56
|
onError?: (err: any) => void;
|
|
54
57
|
constructor({ host, onError }: Record<string, any>);
|
|
55
58
|
read_table: Tables | null;
|
|
@@ -62,7 +65,7 @@ declare class Bagel {
|
|
|
62
65
|
put(endpoint: string, payload: any): Promise<Record<string, any>>;
|
|
63
66
|
patch(endpoint: string, payload?: any): Promise<Record<string, any>>;
|
|
64
67
|
post(endpoint: string, payload?: any): Promise<Record<string, any>>;
|
|
65
|
-
uploadFile(file: File, options?: UploadOptions): Promise<
|
|
68
|
+
uploadFile<T = any>(file: File, options?: UploadOptions): Promise<T>;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
export { Bagel, type TableToTypeMapping, type Tables, type User, _default as openAPI };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
1
3
|
type OpenAPIResponse = {
|
|
2
4
|
types: string;
|
|
3
5
|
code: string;
|
|
@@ -50,6 +52,7 @@ declare class BagelAuth {
|
|
|
50
52
|
}
|
|
51
53
|
declare class Bagel {
|
|
52
54
|
host: string;
|
|
55
|
+
axiosInstance: AxiosInstance;
|
|
53
56
|
onError?: (err: any) => void;
|
|
54
57
|
constructor({ host, onError }: Record<string, any>);
|
|
55
58
|
read_table: Tables | null;
|
|
@@ -62,7 +65,7 @@ declare class Bagel {
|
|
|
62
65
|
put(endpoint: string, payload: any): Promise<Record<string, any>>;
|
|
63
66
|
patch(endpoint: string, payload?: any): Promise<Record<string, any>>;
|
|
64
67
|
post(endpoint: string, payload?: any): Promise<Record<string, any>>;
|
|
65
|
-
uploadFile(file: File, options?: UploadOptions): Promise<
|
|
68
|
+
uploadFile<T = any>(file: File, options?: UploadOptions): Promise<T>;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
export { Bagel, type TableToTypeMapping, type Tables, type User, _default as openAPI };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
1
3
|
type OpenAPIResponse = {
|
|
2
4
|
types: string;
|
|
3
5
|
code: string;
|
|
@@ -50,6 +52,7 @@ declare class BagelAuth {
|
|
|
50
52
|
}
|
|
51
53
|
declare class Bagel {
|
|
52
54
|
host: string;
|
|
55
|
+
axiosInstance: AxiosInstance;
|
|
53
56
|
onError?: (err: any) => void;
|
|
54
57
|
constructor({ host, onError }: Record<string, any>);
|
|
55
58
|
read_table: Tables | null;
|
|
@@ -62,7 +65,7 @@ declare class Bagel {
|
|
|
62
65
|
put(endpoint: string, payload: any): Promise<Record<string, any>>;
|
|
63
66
|
patch(endpoint: string, payload?: any): Promise<Record<string, any>>;
|
|
64
67
|
post(endpoint: string, payload?: any): Promise<Record<string, any>>;
|
|
65
|
-
uploadFile(file: File, options?: UploadOptions): Promise<
|
|
68
|
+
uploadFile<T = any>(file: File, options?: UploadOptions): Promise<T>;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
export { Bagel, type TableToTypeMapping, type Tables, type User, _default as openAPI };
|
package/dist/index.mjs
CHANGED
|
@@ -427,6 +427,7 @@ class BagelAuth {
|
|
|
427
427
|
class Bagel {
|
|
428
428
|
constructor({ host, onError }) {
|
|
429
429
|
__publicField(this, "host");
|
|
430
|
+
__publicField(this, "axiosInstance", axios);
|
|
430
431
|
// eslint-disable-next-line no-unused-vars
|
|
431
432
|
__publicField(this, "onError");
|
|
432
433
|
__publicField(this, "read_table", null);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ax from 'axios';
|
|
1
|
+
import ax, { type AxiosPromise, type AxiosInstance } from 'axios';
|
|
2
2
|
|
|
3
3
|
import openAPI from './openAPITools';
|
|
4
4
|
|
|
@@ -194,6 +194,8 @@ class BagelAuth {
|
|
|
194
194
|
export class Bagel {
|
|
195
195
|
host: string;
|
|
196
196
|
|
|
197
|
+
axiosInstance:AxiosInstance = axios;
|
|
198
|
+
|
|
197
199
|
// eslint-disable-next-line no-unused-vars
|
|
198
200
|
onError?: (err: any) => void;
|
|
199
201
|
|
|
@@ -302,12 +304,12 @@ export class Bagel {
|
|
|
302
304
|
});
|
|
303
305
|
}
|
|
304
306
|
|
|
305
|
-
async uploadFile(file: File, options?: UploadOptions) {
|
|
307
|
+
async uploadFile<T =any>(file: File, options?: UploadOptions): Promise<T> {
|
|
306
308
|
const formData = new FormData();
|
|
307
309
|
formData.append('file', file);
|
|
308
310
|
// get an indication of the progress
|
|
309
311
|
|
|
310
|
-
const { data } = await axios.post(`${this.host}/files/upload`, formData, {
|
|
312
|
+
const { data } = await axios.post<T>(`${this.host}/files/upload`, formData, {
|
|
311
313
|
headers: {
|
|
312
314
|
'Content-Type': 'multipart/form-data',
|
|
313
315
|
},
|