-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
179 lines (153 loc) · 4.47 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import type { SupabaseClient } from '@supabase/supabase-js';
import type { CoreMessage } from 'ai';
import type { Database } from './lib/database.types';
export type AppSupabaseClient = SupabaseClient<Database>;
export type Table<T extends keyof Database['public']['Tables']> =
Database['public']['Tables'][T]['Row'];
export type TableInsertPayload<T extends keyof Database['public']['Tables']> =
Database['public']['Tables'][T]['Insert'];
export type TableUpdatePayload<T extends keyof Database['public']['Tables']> =
Database['public']['Tables'][T]['Update'];
export type View<T extends keyof Database['public']['Views']> =
Database['public']['Views'][T]['Row'];
export type DBFunction<T extends keyof Database['public']['Functions']> =
Database['public']['Functions'][T]['Returns'];
export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
export type Enum<T extends keyof Database['public']['Enums']> =
Database['public']['Enums'][T];
export interface SupabaseFileUploadOptions {
/**
* The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=<seconds>` header. Defaults to 3600 seconds.
*/
cacheControl?: string;
/**
* the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`.
*/
contentType?: string;
/**
* When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false.
*/
upsert?: boolean;
}
/** One of the providers supported by GoTrue. */
export type AuthProvider =
| 'apple'
| 'azure'
| 'bitbucket'
| 'discord'
| 'facebook'
| 'github'
| 'gitlab'
| 'google'
| 'keycloak'
| 'linkedin'
| 'notion'
| 'slack'
| 'spotify'
| 'twitch'
| 'twitter'
| 'workos';
export type DropzoneFile = File & {
path: string;
};
export type DropzoneFileWithDuration = DropzoneFile & {
duration: number;
};
export type CommentWithUser = Table<'project_comments'> & {
user_profile: Table<'user_profiles'>;
};
export type NoSubscription = {
type: 'no-subscription';
};
export type TrialSubscription = {
type: 'trialing';
trialStart: string;
trialEnd: string;
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type ActiveSubscription = {
type: 'active';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type PastDueSubscription = {
type: 'past_due';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type CanceledSubscription = {
type: 'canceled';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type PausedSubscription = {
type: 'paused';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type IncompleteSubscription = {
type: 'incomplete';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type IncompleteExpiredSubscription = {
type: 'incomplete_expired';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type UnpaidSubscription = {
type: 'unpaid';
product: Table<'products'>;
price: Table<'prices'>;
subscription: Table<'subscriptions'>;
};
export type BypassedEnterpriseOrganization = {
type: 'bypassed_enterprise_organization';
};
export type NormalizedSubscription =
| NoSubscription
| TrialSubscription
| ActiveSubscription
| PastDueSubscription
| CanceledSubscription
| PausedSubscription
| IncompleteSubscription
| IncompleteExpiredSubscription
| UnpaidSubscription
| BypassedEnterpriseOrganization;
export type TeamMemberRowProps = {
name?: string;
role: string;
avatar_url?: string;
id: string;
index: number;
created_at: string;
};
export type TeamMembersTableProps = {
members: Array<TeamMemberRowProps>;
organizationId: string;
};
export type SASuccessPayload<TData = undefined> = {
status: 'success';
} & (TData extends undefined ? { data?: TData } : { data: TData });
export type SAErrorPayload = {
status: 'error';
message: string;
};
/**
* Server Action Payload
*/
export type SAPayload<TData = undefined> =
| SASuccessPayload<TData>
| SAErrorPayload;
export type Message = CoreMessage & {
id: string;
};