krisspy-sdk 0.1.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/README.md +243 -0
- package/dist/index.d.mts +605 -0
- package/dist/index.d.ts +605 -0
- package/dist/index.js +921 -0
- package/dist/index.mjs +890 -0
- package/package.json +49 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Krisspy SDK Types
|
|
3
|
+
*/
|
|
4
|
+
interface KrisspyClientOptions {
|
|
5
|
+
/** Base URL of the Krisspy API (default: https://api.krisspy.ai) */
|
|
6
|
+
url?: string;
|
|
7
|
+
/** Backend ID for this client */
|
|
8
|
+
backendId: string;
|
|
9
|
+
/** API key or access token */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Custom headers to include in all requests */
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
/** Enable debug logging */
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Use RLS (Row Level Security) endpoints for data access
|
|
17
|
+
* Default: true
|
|
18
|
+
*
|
|
19
|
+
* When true, uses /rls/data/* endpoints which require app user authentication
|
|
20
|
+
* and enforce row-level security policies.
|
|
21
|
+
*
|
|
22
|
+
* When false, uses legacy /data/* endpoints which require backend owner auth.
|
|
23
|
+
*/
|
|
24
|
+
useRLS?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface User {
|
|
27
|
+
id: string;
|
|
28
|
+
email: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
created_at?: string;
|
|
31
|
+
updated_at?: string;
|
|
32
|
+
}
|
|
33
|
+
interface Session {
|
|
34
|
+
access_token: string;
|
|
35
|
+
refresh_token?: string;
|
|
36
|
+
expires_at?: number;
|
|
37
|
+
expires_in?: number;
|
|
38
|
+
user: User;
|
|
39
|
+
}
|
|
40
|
+
interface AuthResponse {
|
|
41
|
+
data: {
|
|
42
|
+
user: User | null;
|
|
43
|
+
session: Session | null;
|
|
44
|
+
};
|
|
45
|
+
error: KrisspyError | null;
|
|
46
|
+
}
|
|
47
|
+
interface SignUpCredentials {
|
|
48
|
+
email: string;
|
|
49
|
+
password: string;
|
|
50
|
+
metadata?: Record<string, any>;
|
|
51
|
+
}
|
|
52
|
+
interface SignInCredentials {
|
|
53
|
+
email: string;
|
|
54
|
+
password: string;
|
|
55
|
+
}
|
|
56
|
+
interface OAuthProvider {
|
|
57
|
+
provider: 'google' | 'github' | 'microsoft';
|
|
58
|
+
redirectTo?: string;
|
|
59
|
+
}
|
|
60
|
+
interface QueryResponse<T = any> {
|
|
61
|
+
data: T[] | null;
|
|
62
|
+
error: KrisspyError | null;
|
|
63
|
+
count: number | null;
|
|
64
|
+
}
|
|
65
|
+
interface SingleResponse<T = any> {
|
|
66
|
+
data: T | null;
|
|
67
|
+
error: KrisspyError | null;
|
|
68
|
+
}
|
|
69
|
+
interface MutationResponse<T = any> {
|
|
70
|
+
data: T[] | null;
|
|
71
|
+
error: KrisspyError | null;
|
|
72
|
+
count: number;
|
|
73
|
+
}
|
|
74
|
+
type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'in' | 'is';
|
|
75
|
+
interface Filter {
|
|
76
|
+
column: string;
|
|
77
|
+
operator: FilterOperator;
|
|
78
|
+
value: any;
|
|
79
|
+
}
|
|
80
|
+
interface OrderBy {
|
|
81
|
+
column: string;
|
|
82
|
+
ascending: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface QueryOptions {
|
|
85
|
+
select?: string[];
|
|
86
|
+
filters?: Filter[];
|
|
87
|
+
order?: OrderBy[];
|
|
88
|
+
limit?: number;
|
|
89
|
+
offset?: number;
|
|
90
|
+
}
|
|
91
|
+
interface KrisspyError {
|
|
92
|
+
message: string;
|
|
93
|
+
code?: string;
|
|
94
|
+
details?: string;
|
|
95
|
+
hint?: string;
|
|
96
|
+
status?: number;
|
|
97
|
+
}
|
|
98
|
+
interface FunctionInvokeOptions {
|
|
99
|
+
body?: Record<string, any>;
|
|
100
|
+
headers?: Record<string, string>;
|
|
101
|
+
}
|
|
102
|
+
interface FunctionResponse<T = any> {
|
|
103
|
+
data: T | null;
|
|
104
|
+
error: KrisspyError | null;
|
|
105
|
+
}
|
|
106
|
+
interface FileUploadOptions {
|
|
107
|
+
cacheControl?: string;
|
|
108
|
+
contentType?: string;
|
|
109
|
+
upsert?: boolean;
|
|
110
|
+
}
|
|
111
|
+
interface FileObject {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
bucket: string;
|
|
115
|
+
path: string;
|
|
116
|
+
size: number;
|
|
117
|
+
content_type: string;
|
|
118
|
+
created_at: string;
|
|
119
|
+
updated_at: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* HTTP Client for Krisspy SDK
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
interface HttpClientOptions {
|
|
127
|
+
baseUrl: string;
|
|
128
|
+
headers?: Record<string, string>;
|
|
129
|
+
debug?: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface HttpResponse<T = any> {
|
|
132
|
+
data: T | null;
|
|
133
|
+
error: KrisspyError | null;
|
|
134
|
+
status: number;
|
|
135
|
+
}
|
|
136
|
+
declare class HttpClient {
|
|
137
|
+
private baseUrl;
|
|
138
|
+
private headers;
|
|
139
|
+
private debug;
|
|
140
|
+
constructor(options: HttpClientOptions);
|
|
141
|
+
/**
|
|
142
|
+
* Set authorization header
|
|
143
|
+
*/
|
|
144
|
+
setAuth(token: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* Remove authorization header
|
|
147
|
+
*/
|
|
148
|
+
clearAuth(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Update headers
|
|
151
|
+
*/
|
|
152
|
+
setHeaders(headers: Record<string, string>): void;
|
|
153
|
+
/**
|
|
154
|
+
* Build query string from params
|
|
155
|
+
*/
|
|
156
|
+
private buildQueryString;
|
|
157
|
+
/**
|
|
158
|
+
* Make HTTP request
|
|
159
|
+
*/
|
|
160
|
+
private request;
|
|
161
|
+
/**
|
|
162
|
+
* GET request
|
|
163
|
+
*/
|
|
164
|
+
get<T>(path: string, params?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
165
|
+
/**
|
|
166
|
+
* POST request
|
|
167
|
+
*/
|
|
168
|
+
post<T>(path: string, body?: any, params?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
169
|
+
/**
|
|
170
|
+
* PATCH request
|
|
171
|
+
*/
|
|
172
|
+
patch<T>(path: string, body?: any, params?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
173
|
+
/**
|
|
174
|
+
* PUT request
|
|
175
|
+
*/
|
|
176
|
+
put<T>(path: string, body?: any, params?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
177
|
+
/**
|
|
178
|
+
* DELETE request
|
|
179
|
+
*/
|
|
180
|
+
delete<T>(path: string, params?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Auth Module - User authentication for Krisspy backends
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
declare class KrisspyAuth {
|
|
188
|
+
private http;
|
|
189
|
+
private backendId;
|
|
190
|
+
private currentSession;
|
|
191
|
+
private currentUser;
|
|
192
|
+
private listeners;
|
|
193
|
+
private refreshInterval?;
|
|
194
|
+
constructor(http: HttpClient, backendId: string);
|
|
195
|
+
/**
|
|
196
|
+
* Get current session from storage
|
|
197
|
+
*/
|
|
198
|
+
private restoreSession;
|
|
199
|
+
/**
|
|
200
|
+
* Store session
|
|
201
|
+
*/
|
|
202
|
+
private saveSession;
|
|
203
|
+
/**
|
|
204
|
+
* Clear session from storage
|
|
205
|
+
*/
|
|
206
|
+
private clearSession;
|
|
207
|
+
/**
|
|
208
|
+
* Set current session
|
|
209
|
+
*/
|
|
210
|
+
private setSession;
|
|
211
|
+
/**
|
|
212
|
+
* Setup auto-refresh of token
|
|
213
|
+
*/
|
|
214
|
+
private setupAutoRefresh;
|
|
215
|
+
/**
|
|
216
|
+
* Notify auth state change listeners
|
|
217
|
+
*/
|
|
218
|
+
private notifyListeners;
|
|
219
|
+
/**
|
|
220
|
+
* Sign up with email and password
|
|
221
|
+
*/
|
|
222
|
+
signUp(credentials: SignUpCredentials): Promise<AuthResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Sign in with email and password
|
|
225
|
+
*/
|
|
226
|
+
signInWithPassword(credentials: SignInCredentials): Promise<AuthResponse>;
|
|
227
|
+
/**
|
|
228
|
+
* Sign in with OAuth provider
|
|
229
|
+
*/
|
|
230
|
+
signInWithOAuth(options: OAuthProvider): Promise<{
|
|
231
|
+
data: {
|
|
232
|
+
url: string;
|
|
233
|
+
} | null;
|
|
234
|
+
error: KrisspyError | null;
|
|
235
|
+
}>;
|
|
236
|
+
/**
|
|
237
|
+
* Sign out
|
|
238
|
+
*/
|
|
239
|
+
signOut(): Promise<{
|
|
240
|
+
error: KrisspyError | null;
|
|
241
|
+
}>;
|
|
242
|
+
/**
|
|
243
|
+
* Refresh the session token
|
|
244
|
+
*/
|
|
245
|
+
refreshSession(): Promise<AuthResponse>;
|
|
246
|
+
/**
|
|
247
|
+
* Get current session
|
|
248
|
+
*/
|
|
249
|
+
getSession(): Promise<{
|
|
250
|
+
data: {
|
|
251
|
+
session: Session | null;
|
|
252
|
+
};
|
|
253
|
+
error: KrisspyError | null;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Get current user
|
|
257
|
+
*/
|
|
258
|
+
getUser(): Promise<{
|
|
259
|
+
data: {
|
|
260
|
+
user: User | null;
|
|
261
|
+
};
|
|
262
|
+
error: KrisspyError | null;
|
|
263
|
+
}>;
|
|
264
|
+
/**
|
|
265
|
+
* Get current user synchronously
|
|
266
|
+
*/
|
|
267
|
+
user(): User | null;
|
|
268
|
+
/**
|
|
269
|
+
* Get current session synchronously
|
|
270
|
+
*/
|
|
271
|
+
session(): Session | null;
|
|
272
|
+
/**
|
|
273
|
+
* Update user metadata
|
|
274
|
+
*/
|
|
275
|
+
updateUser(data: {
|
|
276
|
+
metadata?: Record<string, any>;
|
|
277
|
+
password?: string;
|
|
278
|
+
}): Promise<{
|
|
279
|
+
data: {
|
|
280
|
+
user: User | null;
|
|
281
|
+
};
|
|
282
|
+
error: KrisspyError | null;
|
|
283
|
+
}>;
|
|
284
|
+
/**
|
|
285
|
+
* Request password reset
|
|
286
|
+
*/
|
|
287
|
+
resetPasswordForEmail(email: string): Promise<{
|
|
288
|
+
error: KrisspyError | null;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* Listen for auth state changes
|
|
292
|
+
*/
|
|
293
|
+
onAuthStateChange(callback: (event: AuthChangeEvent) => void): {
|
|
294
|
+
unsubscribe: () => void;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Set session from external source (e.g., OAuth callback)
|
|
298
|
+
*/
|
|
299
|
+
setSessionFromUrl(): Promise<AuthResponse>;
|
|
300
|
+
}
|
|
301
|
+
type AuthChangeEvent = 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED';
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Query Builder - Supabase-style fluent API for database queries
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
declare class QueryBuilder<T = any> {
|
|
308
|
+
private http;
|
|
309
|
+
private backendId;
|
|
310
|
+
private tableName;
|
|
311
|
+
private queryParams;
|
|
312
|
+
private selectColumns;
|
|
313
|
+
private orderClauses;
|
|
314
|
+
private limitValue?;
|
|
315
|
+
private offsetValue?;
|
|
316
|
+
private isSingle;
|
|
317
|
+
private useRLS;
|
|
318
|
+
constructor(http: HttpClient, backendId: string, tableName: string, useRLS?: boolean);
|
|
319
|
+
/**
|
|
320
|
+
* Get the base path for data endpoints
|
|
321
|
+
* Uses /rls/data for RLS-enabled queries (requires auth)
|
|
322
|
+
* Uses /data for legacy queries (admin/owner only)
|
|
323
|
+
*/
|
|
324
|
+
private getBasePath;
|
|
325
|
+
/**
|
|
326
|
+
* Select specific columns
|
|
327
|
+
* @example .select('id, name, price')
|
|
328
|
+
* @example .select('*')
|
|
329
|
+
*/
|
|
330
|
+
select(columns?: string): this;
|
|
331
|
+
/**
|
|
332
|
+
* Filter: equals
|
|
333
|
+
* @example .eq('id', 123)
|
|
334
|
+
*/
|
|
335
|
+
eq(column: string, value: any): this;
|
|
336
|
+
/**
|
|
337
|
+
* Filter: not equals
|
|
338
|
+
* @example .neq('status', 'deleted')
|
|
339
|
+
*/
|
|
340
|
+
neq(column: string, value: any): this;
|
|
341
|
+
/**
|
|
342
|
+
* Filter: greater than
|
|
343
|
+
* @example .gt('price', 100)
|
|
344
|
+
*/
|
|
345
|
+
gt(column: string, value: any): this;
|
|
346
|
+
/**
|
|
347
|
+
* Filter: greater than or equal
|
|
348
|
+
* @example .gte('age', 18)
|
|
349
|
+
*/
|
|
350
|
+
gte(column: string, value: any): this;
|
|
351
|
+
/**
|
|
352
|
+
* Filter: less than
|
|
353
|
+
* @example .lt('stock', 10)
|
|
354
|
+
*/
|
|
355
|
+
lt(column: string, value: any): this;
|
|
356
|
+
/**
|
|
357
|
+
* Filter: less than or equal
|
|
358
|
+
* @example .lte('price', 1000)
|
|
359
|
+
*/
|
|
360
|
+
lte(column: string, value: any): this;
|
|
361
|
+
/**
|
|
362
|
+
* Filter: pattern matching (case sensitive)
|
|
363
|
+
* @example .like('name', '%iPhone%')
|
|
364
|
+
*/
|
|
365
|
+
like(column: string, pattern: string): this;
|
|
366
|
+
/**
|
|
367
|
+
* Filter: pattern matching (case insensitive)
|
|
368
|
+
* @example .ilike('name', '%iphone%')
|
|
369
|
+
*/
|
|
370
|
+
ilike(column: string, pattern: string): this;
|
|
371
|
+
/**
|
|
372
|
+
* Filter: value in list
|
|
373
|
+
* @example .in('status', ['active', 'pending'])
|
|
374
|
+
*/
|
|
375
|
+
in(column: string, values: any[]): this;
|
|
376
|
+
/**
|
|
377
|
+
* Filter: is null/true/false
|
|
378
|
+
* @example .is('deleted_at', null)
|
|
379
|
+
*/
|
|
380
|
+
is(column: string, value: null | boolean): this;
|
|
381
|
+
/**
|
|
382
|
+
* Order by column
|
|
383
|
+
* @example .order('created_at', { ascending: false })
|
|
384
|
+
*/
|
|
385
|
+
order(column: string, options?: {
|
|
386
|
+
ascending?: boolean;
|
|
387
|
+
}): this;
|
|
388
|
+
/**
|
|
389
|
+
* Limit number of rows
|
|
390
|
+
* @example .limit(10)
|
|
391
|
+
*/
|
|
392
|
+
limit(count: number): this;
|
|
393
|
+
/**
|
|
394
|
+
* Skip rows (for pagination)
|
|
395
|
+
* @example .range(0, 9) // First 10 rows
|
|
396
|
+
*/
|
|
397
|
+
range(from: number, to: number): this;
|
|
398
|
+
/**
|
|
399
|
+
* Return single row (throws if multiple or none)
|
|
400
|
+
*/
|
|
401
|
+
single(): QueryBuilder<T>;
|
|
402
|
+
/**
|
|
403
|
+
* Return first row or null
|
|
404
|
+
*/
|
|
405
|
+
maybeSingle(): QueryBuilder<T>;
|
|
406
|
+
/**
|
|
407
|
+
* Build query params for the request
|
|
408
|
+
*/
|
|
409
|
+
private buildParams;
|
|
410
|
+
/**
|
|
411
|
+
* Execute SELECT query
|
|
412
|
+
*/
|
|
413
|
+
then<TResult = QueryResponse<T> | SingleResponse<T>>(resolve: (value: TResult) => void, reject?: (reason: any) => void): Promise<void>;
|
|
414
|
+
/**
|
|
415
|
+
* Execute the query
|
|
416
|
+
*/
|
|
417
|
+
private execute;
|
|
418
|
+
/**
|
|
419
|
+
* Insert rows
|
|
420
|
+
* @example .insert({ name: 'iPhone', price: 999 })
|
|
421
|
+
* @example .insert([{ name: 'iPhone' }, { name: 'iPad' }])
|
|
422
|
+
*/
|
|
423
|
+
insert(data: Partial<T> | Partial<T>[]): Promise<MutationResponse<T>>;
|
|
424
|
+
/**
|
|
425
|
+
* Update rows (requires filters)
|
|
426
|
+
* @example .update({ price: 899 }).eq('id', 123)
|
|
427
|
+
*/
|
|
428
|
+
update(data: Partial<T>): Promise<MutationResponse<T>>;
|
|
429
|
+
/**
|
|
430
|
+
* Delete rows (requires filters)
|
|
431
|
+
* @example .delete().eq('id', 123)
|
|
432
|
+
*/
|
|
433
|
+
delete(): Promise<MutationResponse<T>>;
|
|
434
|
+
/**
|
|
435
|
+
* Upsert rows (insert or update on conflict)
|
|
436
|
+
* @example .upsert({ id: 1, name: 'iPhone' })
|
|
437
|
+
*/
|
|
438
|
+
upsert(data: Partial<T> | Partial<T>[], options?: {
|
|
439
|
+
onConflict?: string;
|
|
440
|
+
}): Promise<MutationResponse<T>>;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Krisspy Client - Main entry point for the SDK
|
|
445
|
+
*/
|
|
446
|
+
|
|
447
|
+
declare class KrisspyClient {
|
|
448
|
+
private http;
|
|
449
|
+
private backendId;
|
|
450
|
+
private _auth;
|
|
451
|
+
private useRLS;
|
|
452
|
+
constructor(options: KrisspyClientOptions);
|
|
453
|
+
/**
|
|
454
|
+
* Auth module for user authentication
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* // Sign up
|
|
458
|
+
* const { data, error } = await krisspy.auth.signUp({
|
|
459
|
+
* email: 'user@example.com',
|
|
460
|
+
* password: 'secret123'
|
|
461
|
+
* })
|
|
462
|
+
*
|
|
463
|
+
* // Sign in
|
|
464
|
+
* const { data, error } = await krisspy.auth.signInWithPassword({
|
|
465
|
+
* email: 'user@example.com',
|
|
466
|
+
* password: 'secret123'
|
|
467
|
+
* })
|
|
468
|
+
*
|
|
469
|
+
* // Get current user
|
|
470
|
+
* const user = krisspy.auth.user()
|
|
471
|
+
*
|
|
472
|
+
* // Sign out
|
|
473
|
+
* await krisspy.auth.signOut()
|
|
474
|
+
*/
|
|
475
|
+
get auth(): KrisspyAuth;
|
|
476
|
+
/**
|
|
477
|
+
* Create a query builder for a table
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* // Select all rows
|
|
481
|
+
* const { data, error } = await krisspy.from('products').select('*')
|
|
482
|
+
*
|
|
483
|
+
* // Select with filters
|
|
484
|
+
* const { data, error } = await krisspy
|
|
485
|
+
* .from('products')
|
|
486
|
+
* .select('id, name, price')
|
|
487
|
+
* .eq('active', true)
|
|
488
|
+
* .order('created_at', { ascending: false })
|
|
489
|
+
* .limit(10)
|
|
490
|
+
*
|
|
491
|
+
* // Insert
|
|
492
|
+
* const { data, error } = await krisspy
|
|
493
|
+
* .from('products')
|
|
494
|
+
* .insert({ name: 'iPhone', price: 999 })
|
|
495
|
+
*
|
|
496
|
+
* // Update
|
|
497
|
+
* const { data, error } = await krisspy
|
|
498
|
+
* .from('products')
|
|
499
|
+
* .update({ price: 899 })
|
|
500
|
+
* .eq('id', 123)
|
|
501
|
+
*
|
|
502
|
+
* // Delete
|
|
503
|
+
* const { data, error } = await krisspy
|
|
504
|
+
* .from('products')
|
|
505
|
+
* .delete()
|
|
506
|
+
* .eq('id', 123)
|
|
507
|
+
*/
|
|
508
|
+
from<T = any>(table: string): QueryBuilder<T>;
|
|
509
|
+
/**
|
|
510
|
+
* Execute raw SQL query
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* const { data, error } = await krisspy.rpc('SELECT * FROM products WHERE price > $1', [100])
|
|
514
|
+
*/
|
|
515
|
+
rpc<T = any>(sql: string, params?: any[]): Promise<{
|
|
516
|
+
data: T | null;
|
|
517
|
+
error: any;
|
|
518
|
+
}>;
|
|
519
|
+
/**
|
|
520
|
+
* Invoke a serverless function
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* const { data, error } = await krisspy.functions.invoke('hello-world', {
|
|
524
|
+
* body: { name: 'John' }
|
|
525
|
+
* })
|
|
526
|
+
*/
|
|
527
|
+
get functions(): {
|
|
528
|
+
invoke: <T = any>(functionName: string, options?: FunctionInvokeOptions) => Promise<FunctionResponse<T>>;
|
|
529
|
+
list: () => Promise<{
|
|
530
|
+
data: any[] | null;
|
|
531
|
+
error: any;
|
|
532
|
+
}>;
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* Get backend info
|
|
536
|
+
*/
|
|
537
|
+
getBackendInfo(): Promise<{
|
|
538
|
+
data: any | null;
|
|
539
|
+
error: any;
|
|
540
|
+
}>;
|
|
541
|
+
/**
|
|
542
|
+
* List tables in the backend
|
|
543
|
+
*/
|
|
544
|
+
listTables(): Promise<{
|
|
545
|
+
data: string[] | null;
|
|
546
|
+
error: any;
|
|
547
|
+
}>;
|
|
548
|
+
/**
|
|
549
|
+
* Get table schema (columns)
|
|
550
|
+
*/
|
|
551
|
+
getTableSchema(table: string): Promise<{
|
|
552
|
+
data: any[] | null;
|
|
553
|
+
error: any;
|
|
554
|
+
}>;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* @krisspy/sdk - Krisspy Cloud SDK
|
|
559
|
+
*
|
|
560
|
+
* Database, Auth, and Functions for your apps.
|
|
561
|
+
* A simpler alternative to Supabase.
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* import { createClient } from '@krisspy/sdk'
|
|
565
|
+
*
|
|
566
|
+
* const krisspy = createClient({
|
|
567
|
+
* backendId: 'your-backend-id',
|
|
568
|
+
* apiKey: 'your-api-key', // optional
|
|
569
|
+
* })
|
|
570
|
+
*
|
|
571
|
+
* // Auth
|
|
572
|
+
* await krisspy.auth.signUp({ email, password })
|
|
573
|
+
* await krisspy.auth.signInWithPassword({ email, password })
|
|
574
|
+
*
|
|
575
|
+
* // Database
|
|
576
|
+
* const { data, error } = await krisspy
|
|
577
|
+
* .from('products')
|
|
578
|
+
* .select('*')
|
|
579
|
+
* .eq('active', true)
|
|
580
|
+
* .order('created_at', { ascending: false })
|
|
581
|
+
* .limit(10)
|
|
582
|
+
*
|
|
583
|
+
* // Insert
|
|
584
|
+
* await krisspy.from('products').insert({ name: 'iPhone', price: 999 })
|
|
585
|
+
*
|
|
586
|
+
* // Functions
|
|
587
|
+
* await krisspy.functions.invoke('hello', { body: { name: 'World' } })
|
|
588
|
+
*/
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Create a new Krisspy client
|
|
592
|
+
*
|
|
593
|
+
* @param options - Client configuration options
|
|
594
|
+
* @returns KrisspyClient instance
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* const krisspy = createClient({
|
|
598
|
+
* backendId: 'abc123',
|
|
599
|
+
* apiKey: 'your-api-key',
|
|
600
|
+
* url: 'https://api.krisspy.ai', // optional
|
|
601
|
+
* })
|
|
602
|
+
*/
|
|
603
|
+
declare function createClient(options: KrisspyClientOptions): KrisspyClient;
|
|
604
|
+
|
|
605
|
+
export { type AuthChangeEvent, type AuthResponse, type FileObject, type FileUploadOptions, type Filter, type FilterOperator, type FunctionInvokeOptions, type FunctionResponse, HttpClient, KrisspyAuth, KrisspyClient, type KrisspyClientOptions, type KrisspyError, type MutationResponse, type OAuthProvider, type OrderBy, QueryBuilder, type QueryOptions, type QueryResponse, type Session, type SignInCredentials, type SignUpCredentials, type SingleResponse, type User, createClient };
|