@bagelink/vue 0.0.1

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,67 @@
1
+ import { InjectionKey, Plugin } from 'vue';
2
+
3
+ type Tables = '';
4
+ type TableToTypeMapping = Record<Tables, any>;
5
+ interface User {
6
+ id: string;
7
+ first_name?: string;
8
+ last_name?: string;
9
+ email?: string;
10
+ password?: string;
11
+ is_verified?: boolean;
12
+ locale: string;
13
+ type: string;
14
+ }
15
+ interface UploadOptions {
16
+ onUploadProgress?: (progressEvent: any) => void;
17
+ }
18
+ declare class DataRequest<T extends Tables = Tables> {
19
+ data_table: T | Tables;
20
+ bagel: any;
21
+ itemID: string;
22
+ _filter: Record<string, any>;
23
+ constructor(table: T, bagel: Bagel);
24
+ post(item: Record<string, any>): Promise<Record<string, any>>;
25
+ filter(filter: Record<string, any>): this;
26
+ get(): Promise<TableToTypeMapping[T] | TableToTypeMapping[T][] | undefined>;
27
+ item(id: string): this;
28
+ delete(): Promise<TableToTypeMapping[T][]>;
29
+ put(updatedItem: Record<string, any>): Promise<Record<string, any>>;
30
+ }
31
+ declare class BagelAuth {
32
+ private bagel;
33
+ constructor(bagel: Bagel);
34
+ user: User | null;
35
+ validateUser(): Promise<User | null>;
36
+ resetPassword(ctx: {
37
+ token: string;
38
+ password: string;
39
+ }): Promise<Record<string, any>>;
40
+ forgotPassword(email: string): Promise<void>;
41
+ login(user: User): Promise<User | null>;
42
+ logout(): Promise<void>;
43
+ acceptInvite(token: string, user: Record<string, any>): Promise<void>;
44
+ register(user: Record<string, any>, errors: Record<string, any>): Promise<void>;
45
+ }
46
+ declare class Bagel {
47
+ host: string;
48
+ onError?: (err: any) => void;
49
+ constructor({ host, onError }: Record<string, any>);
50
+ read_table: Tables | null;
51
+ data(table: Tables): DataRequest<Tables>;
52
+ auth: BagelAuth;
53
+ _endpointCleaner(endpoint: string): string;
54
+ api(endpoint: string, query?: Record<string, string>): Promise<Record<string, any>>;
55
+ get<T = Record<string, any>>(endpoint: string, query?: Record<string, any>): Promise<T>;
56
+ delete(endpoint: string): Promise<Record<string, any>>;
57
+ put(endpoint: string, payload: any): Promise<Record<string, any>>;
58
+ patch(endpoint: string, payload?: any): Promise<Record<string, any>>;
59
+ post(endpoint: string, payload?: any): Promise<Record<string, any>>;
60
+ uploadFile(file: File, options?: UploadOptions): Promise<any>;
61
+ }
62
+
63
+ declare const bagelInjectionKey: InjectionKey<Bagel>;
64
+ declare function useBagel(): Bagel;
65
+ declare const BagelVue: Plugin;
66
+
67
+ export { BagelVue, bagelInjectionKey, useBagel };
@@ -0,0 +1,67 @@
1
+ import { InjectionKey, Plugin } from 'vue';
2
+
3
+ type Tables = '';
4
+ type TableToTypeMapping = Record<Tables, any>;
5
+ interface User {
6
+ id: string;
7
+ first_name?: string;
8
+ last_name?: string;
9
+ email?: string;
10
+ password?: string;
11
+ is_verified?: boolean;
12
+ locale: string;
13
+ type: string;
14
+ }
15
+ interface UploadOptions {
16
+ onUploadProgress?: (progressEvent: any) => void;
17
+ }
18
+ declare class DataRequest<T extends Tables = Tables> {
19
+ data_table: T | Tables;
20
+ bagel: any;
21
+ itemID: string;
22
+ _filter: Record<string, any>;
23
+ constructor(table: T, bagel: Bagel);
24
+ post(item: Record<string, any>): Promise<Record<string, any>>;
25
+ filter(filter: Record<string, any>): this;
26
+ get(): Promise<TableToTypeMapping[T] | TableToTypeMapping[T][] | undefined>;
27
+ item(id: string): this;
28
+ delete(): Promise<TableToTypeMapping[T][]>;
29
+ put(updatedItem: Record<string, any>): Promise<Record<string, any>>;
30
+ }
31
+ declare class BagelAuth {
32
+ private bagel;
33
+ constructor(bagel: Bagel);
34
+ user: User | null;
35
+ validateUser(): Promise<User | null>;
36
+ resetPassword(ctx: {
37
+ token: string;
38
+ password: string;
39
+ }): Promise<Record<string, any>>;
40
+ forgotPassword(email: string): Promise<void>;
41
+ login(user: User): Promise<User | null>;
42
+ logout(): Promise<void>;
43
+ acceptInvite(token: string, user: Record<string, any>): Promise<void>;
44
+ register(user: Record<string, any>, errors: Record<string, any>): Promise<void>;
45
+ }
46
+ declare class Bagel {
47
+ host: string;
48
+ onError?: (err: any) => void;
49
+ constructor({ host, onError }: Record<string, any>);
50
+ read_table: Tables | null;
51
+ data(table: Tables): DataRequest<Tables>;
52
+ auth: BagelAuth;
53
+ _endpointCleaner(endpoint: string): string;
54
+ api(endpoint: string, query?: Record<string, string>): Promise<Record<string, any>>;
55
+ get<T = Record<string, any>>(endpoint: string, query?: Record<string, any>): Promise<T>;
56
+ delete(endpoint: string): Promise<Record<string, any>>;
57
+ put(endpoint: string, payload: any): Promise<Record<string, any>>;
58
+ patch(endpoint: string, payload?: any): Promise<Record<string, any>>;
59
+ post(endpoint: string, payload?: any): Promise<Record<string, any>>;
60
+ uploadFile(file: File, options?: UploadOptions): Promise<any>;
61
+ }
62
+
63
+ declare const bagelInjectionKey: InjectionKey<Bagel>;
64
+ declare function useBagel(): Bagel;
65
+ declare const BagelVue: Plugin;
66
+
67
+ export { BagelVue, bagelInjectionKey, useBagel };
@@ -0,0 +1,67 @@
1
+ import { InjectionKey, Plugin } from 'vue';
2
+
3
+ type Tables = '';
4
+ type TableToTypeMapping = Record<Tables, any>;
5
+ interface User {
6
+ id: string;
7
+ first_name?: string;
8
+ last_name?: string;
9
+ email?: string;
10
+ password?: string;
11
+ is_verified?: boolean;
12
+ locale: string;
13
+ type: string;
14
+ }
15
+ interface UploadOptions {
16
+ onUploadProgress?: (progressEvent: any) => void;
17
+ }
18
+ declare class DataRequest<T extends Tables = Tables> {
19
+ data_table: T | Tables;
20
+ bagel: any;
21
+ itemID: string;
22
+ _filter: Record<string, any>;
23
+ constructor(table: T, bagel: Bagel);
24
+ post(item: Record<string, any>): Promise<Record<string, any>>;
25
+ filter(filter: Record<string, any>): this;
26
+ get(): Promise<TableToTypeMapping[T] | TableToTypeMapping[T][] | undefined>;
27
+ item(id: string): this;
28
+ delete(): Promise<TableToTypeMapping[T][]>;
29
+ put(updatedItem: Record<string, any>): Promise<Record<string, any>>;
30
+ }
31
+ declare class BagelAuth {
32
+ private bagel;
33
+ constructor(bagel: Bagel);
34
+ user: User | null;
35
+ validateUser(): Promise<User | null>;
36
+ resetPassword(ctx: {
37
+ token: string;
38
+ password: string;
39
+ }): Promise<Record<string, any>>;
40
+ forgotPassword(email: string): Promise<void>;
41
+ login(user: User): Promise<User | null>;
42
+ logout(): Promise<void>;
43
+ acceptInvite(token: string, user: Record<string, any>): Promise<void>;
44
+ register(user: Record<string, any>, errors: Record<string, any>): Promise<void>;
45
+ }
46
+ declare class Bagel {
47
+ host: string;
48
+ onError?: (err: any) => void;
49
+ constructor({ host, onError }: Record<string, any>);
50
+ read_table: Tables | null;
51
+ data(table: Tables): DataRequest<Tables>;
52
+ auth: BagelAuth;
53
+ _endpointCleaner(endpoint: string): string;
54
+ api(endpoint: string, query?: Record<string, string>): Promise<Record<string, any>>;
55
+ get<T = Record<string, any>>(endpoint: string, query?: Record<string, any>): Promise<T>;
56
+ delete(endpoint: string): Promise<Record<string, any>>;
57
+ put(endpoint: string, payload: any): Promise<Record<string, any>>;
58
+ patch(endpoint: string, payload?: any): Promise<Record<string, any>>;
59
+ post(endpoint: string, payload?: any): Promise<Record<string, any>>;
60
+ uploadFile(file: File, options?: UploadOptions): Promise<any>;
61
+ }
62
+
63
+ declare const bagelInjectionKey: InjectionKey<Bagel>;
64
+ declare function useBagel(): Bagel;
65
+ declare const BagelVue: Plugin;
66
+
67
+ export { BagelVue, bagelInjectionKey, useBagel };