@picobase_app/client 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 +233 -0
- package/dist/index.d.mts +491 -0
- package/dist/index.d.ts +491 -0
- package/dist/index.js +531 -0
- package/dist/index.mjs +485 -0
- package/package.json +46 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import PocketBase, { RecordModel, RecordSubscription, ListResult, SendOptions } from 'pocketbase';
|
|
2
|
+
export { RecordModel } from 'pocketbase';
|
|
3
|
+
|
|
4
|
+
interface PicoBaseClientOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Timeout in ms for individual requests. Default: 30_000 (30s).
|
|
7
|
+
*/
|
|
8
|
+
timeout?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Max automatic retries on 503 (instance cold-starting). Default: 3.
|
|
11
|
+
*/
|
|
12
|
+
maxColdStartRetries?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Custom fetch implementation (useful for testing or server-side usage).
|
|
15
|
+
*/
|
|
16
|
+
fetch?: typeof globalThis.fetch;
|
|
17
|
+
/**
|
|
18
|
+
* Language code sent as Accept-Language header. Default: 'en-US'.
|
|
19
|
+
*/
|
|
20
|
+
lang?: string;
|
|
21
|
+
}
|
|
22
|
+
interface AuthResponse {
|
|
23
|
+
token: string;
|
|
24
|
+
record: RecordModel;
|
|
25
|
+
}
|
|
26
|
+
type AuthEvent = 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED';
|
|
27
|
+
interface AuthStateChange {
|
|
28
|
+
event: AuthEvent;
|
|
29
|
+
token: string;
|
|
30
|
+
record: RecordModel | null;
|
|
31
|
+
}
|
|
32
|
+
type AuthStateChangeCallback = (event: AuthEvent, record: RecordModel | null) => void;
|
|
33
|
+
interface SignUpOptions {
|
|
34
|
+
email: string;
|
|
35
|
+
password: string;
|
|
36
|
+
passwordConfirm?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
interface SignInOptions {
|
|
41
|
+
email: string;
|
|
42
|
+
password: string;
|
|
43
|
+
}
|
|
44
|
+
interface OAuthSignInOptions {
|
|
45
|
+
provider: string;
|
|
46
|
+
scopes?: string[];
|
|
47
|
+
createData?: Record<string, unknown>;
|
|
48
|
+
urlCallback?: (url: string) => void | Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
type RealtimeAction = 'create' | 'update' | 'delete';
|
|
51
|
+
interface RealtimeCallback<T = RecordModel> {
|
|
52
|
+
(data: RecordSubscription<T>): void;
|
|
53
|
+
}
|
|
54
|
+
type UnsubscribeFunc = () => Promise<void>;
|
|
55
|
+
interface FileOptions {
|
|
56
|
+
thumb?: string;
|
|
57
|
+
token?: string;
|
|
58
|
+
download?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Auth module — handles user sign-up, sign-in, OAuth, and session management.
|
|
63
|
+
*
|
|
64
|
+
* PicoBase uses PocketBase's built-in `users` collection for auth. Each
|
|
65
|
+
* instance has its own isolated user pool.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* // Sign up
|
|
70
|
+
* const { token, record } = await pb.auth.signUp({
|
|
71
|
+
* email: 'user@example.com',
|
|
72
|
+
* password: 'securepassword',
|
|
73
|
+
* })
|
|
74
|
+
*
|
|
75
|
+
* // Sign in
|
|
76
|
+
* const { token, record } = await pb.auth.signIn({
|
|
77
|
+
* email: 'user@example.com',
|
|
78
|
+
* password: 'securepassword',
|
|
79
|
+
* })
|
|
80
|
+
*
|
|
81
|
+
* // Listen to auth changes
|
|
82
|
+
* pb.auth.onStateChange((event, record) => {
|
|
83
|
+
* console.log(event, record)
|
|
84
|
+
* })
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare class PicoBaseAuth {
|
|
88
|
+
private pb;
|
|
89
|
+
private listeners;
|
|
90
|
+
private _collection;
|
|
91
|
+
constructor(pb: PocketBase);
|
|
92
|
+
/**
|
|
93
|
+
* Set which collection to authenticate against.
|
|
94
|
+
* Defaults to 'users'. Use this if you have a custom auth collection.
|
|
95
|
+
*/
|
|
96
|
+
setCollection(name: string): this;
|
|
97
|
+
/**
|
|
98
|
+
* Create a new user account.
|
|
99
|
+
*/
|
|
100
|
+
signUp(options: SignUpOptions): Promise<AuthResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Sign in with email and password.
|
|
103
|
+
*/
|
|
104
|
+
signIn(options: SignInOptions): Promise<AuthResponse>;
|
|
105
|
+
/**
|
|
106
|
+
* Sign in with an OAuth2 provider (Google, GitHub, etc.).
|
|
107
|
+
*
|
|
108
|
+
* In browser environments this opens a popup/redirect to the provider.
|
|
109
|
+
* Configure providers in your PicoBase dashboard.
|
|
110
|
+
*/
|
|
111
|
+
signInWithOAuth(options: OAuthSignInOptions): Promise<AuthResponse>;
|
|
112
|
+
/**
|
|
113
|
+
* Refresh the current auth token.
|
|
114
|
+
*/
|
|
115
|
+
refreshToken(): Promise<AuthResponse>;
|
|
116
|
+
/**
|
|
117
|
+
* Send a password reset email.
|
|
118
|
+
*/
|
|
119
|
+
requestPasswordReset(email: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Confirm a password reset with the token from the reset email.
|
|
122
|
+
*/
|
|
123
|
+
confirmPasswordReset(token: string, password: string, passwordConfirm?: string): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Send an email verification email.
|
|
126
|
+
*/
|
|
127
|
+
requestVerification(email: string): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Confirm email verification with the token from the verification email.
|
|
130
|
+
*/
|
|
131
|
+
confirmVerification(token: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Sign out the current user. Clears the local auth store.
|
|
134
|
+
*/
|
|
135
|
+
signOut(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Get the currently authenticated user record, or `null` if not signed in.
|
|
138
|
+
*/
|
|
139
|
+
get user(): RecordModel | null;
|
|
140
|
+
/**
|
|
141
|
+
* Get the current auth token, or empty string if not signed in.
|
|
142
|
+
*/
|
|
143
|
+
get token(): string;
|
|
144
|
+
/**
|
|
145
|
+
* Check if the current auth session is valid (token exists and not expired).
|
|
146
|
+
*/
|
|
147
|
+
get isValid(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Listen to auth state changes. Returns an unsubscribe function.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const unsubscribe = pb.auth.onStateChange((event, record) => {
|
|
154
|
+
* if (event === 'SIGNED_IN') {
|
|
155
|
+
* console.log('Welcome', record.email)
|
|
156
|
+
* }
|
|
157
|
+
* })
|
|
158
|
+
*
|
|
159
|
+
* // Later:
|
|
160
|
+
* unsubscribe()
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
onStateChange(callback: AuthStateChangeCallback): () => void;
|
|
164
|
+
private _notify;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Options for list queries. */
|
|
168
|
+
interface ListOptions {
|
|
169
|
+
sort?: string;
|
|
170
|
+
filter?: string;
|
|
171
|
+
expand?: string;
|
|
172
|
+
fields?: string;
|
|
173
|
+
skipTotal?: boolean;
|
|
174
|
+
[key: string]: unknown;
|
|
175
|
+
}
|
|
176
|
+
/** Options for single record queries. */
|
|
177
|
+
interface RecordQueryOptions {
|
|
178
|
+
expand?: string;
|
|
179
|
+
fields?: string;
|
|
180
|
+
[key: string]: unknown;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Collection module — CRUD operations on a PocketBase collection.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const posts = pb.collection('posts')
|
|
188
|
+
*
|
|
189
|
+
* // List with filtering, sorting, and pagination
|
|
190
|
+
* const result = await posts.getList(1, 20, {
|
|
191
|
+
* filter: 'published = true',
|
|
192
|
+
* sort: '-created',
|
|
193
|
+
* expand: 'author',
|
|
194
|
+
* })
|
|
195
|
+
*
|
|
196
|
+
* // Get a single record
|
|
197
|
+
* const post = await posts.getOne('record_id')
|
|
198
|
+
*
|
|
199
|
+
* // Create a record
|
|
200
|
+
* const newPost = await posts.create({
|
|
201
|
+
* title: 'Hello World',
|
|
202
|
+
* content: 'My first post',
|
|
203
|
+
* })
|
|
204
|
+
*
|
|
205
|
+
* // Update a record
|
|
206
|
+
* const updated = await posts.update('record_id', { title: 'Updated' })
|
|
207
|
+
*
|
|
208
|
+
* // Delete a record
|
|
209
|
+
* await posts.delete('record_id')
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
declare class PicoBaseCollection<T = RecordModel> {
|
|
213
|
+
private pb;
|
|
214
|
+
private name;
|
|
215
|
+
constructor(pb: PocketBase, name: string);
|
|
216
|
+
/**
|
|
217
|
+
* Fetch a paginated list of records.
|
|
218
|
+
*
|
|
219
|
+
* @param page - Page number (1-indexed). Default: 1.
|
|
220
|
+
* @param perPage - Records per page. Default: 30.
|
|
221
|
+
* @param options - Filter, sort, expand, fields.
|
|
222
|
+
*/
|
|
223
|
+
getList(page?: number, perPage?: number, options?: ListOptions): Promise<ListResult<T>>;
|
|
224
|
+
/**
|
|
225
|
+
* Fetch all records matching the filter (auto-paginates).
|
|
226
|
+
*
|
|
227
|
+
* **Warning:** Use with caution on large collections. Prefer `getList()` with pagination.
|
|
228
|
+
*/
|
|
229
|
+
getFullList(options?: ListOptions): Promise<T[]>;
|
|
230
|
+
/**
|
|
231
|
+
* Fetch a single record by ID.
|
|
232
|
+
*/
|
|
233
|
+
getOne(id: string, options?: RecordQueryOptions): Promise<T>;
|
|
234
|
+
/**
|
|
235
|
+
* Fetch the first record matching a filter.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* const admin = await pb.collection('users').getFirstListItem('role = "admin"')
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
getFirstListItem(filter: string, options?: RecordQueryOptions): Promise<T>;
|
|
243
|
+
/**
|
|
244
|
+
* Create a new record.
|
|
245
|
+
*
|
|
246
|
+
* @param data - Record data. Can be a plain object or `FormData` (for file uploads).
|
|
247
|
+
*/
|
|
248
|
+
create(data: Record<string, unknown> | FormData, options?: RecordQueryOptions): Promise<T>;
|
|
249
|
+
/**
|
|
250
|
+
* Update an existing record.
|
|
251
|
+
*
|
|
252
|
+
* @param id - Record ID.
|
|
253
|
+
* @param data - Fields to update. Can be a plain object or `FormData`.
|
|
254
|
+
*/
|
|
255
|
+
update(id: string, data: Record<string, unknown> | FormData, options?: RecordQueryOptions): Promise<T>;
|
|
256
|
+
/**
|
|
257
|
+
* Delete a record by ID.
|
|
258
|
+
*/
|
|
259
|
+
delete(id: string): Promise<boolean>;
|
|
260
|
+
/**
|
|
261
|
+
* Subscribe to realtime changes on this collection.
|
|
262
|
+
*
|
|
263
|
+
* @param callback - Called on every create/update/delete event.
|
|
264
|
+
* @param filter - Optional: only receive events matching this filter.
|
|
265
|
+
* @returns Unsubscribe function.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* const unsubscribe = await pb.collection('posts').subscribe((e) => {
|
|
270
|
+
* console.log(e.action, e.record)
|
|
271
|
+
* })
|
|
272
|
+
*
|
|
273
|
+
* // Later:
|
|
274
|
+
* await unsubscribe()
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
subscribe(callback: (data: {
|
|
278
|
+
action: string;
|
|
279
|
+
record: T;
|
|
280
|
+
}) => void, filter?: string): Promise<() => Promise<void>>;
|
|
281
|
+
/**
|
|
282
|
+
* Subscribe to changes on a specific record.
|
|
283
|
+
*
|
|
284
|
+
* @param id - Record ID.
|
|
285
|
+
* @param callback - Called on update/delete events.
|
|
286
|
+
* @returns Unsubscribe function.
|
|
287
|
+
*/
|
|
288
|
+
subscribeOne(id: string, callback: (data: {
|
|
289
|
+
action: string;
|
|
290
|
+
record: T;
|
|
291
|
+
}) => void): Promise<() => Promise<void>>;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Realtime module — manage global realtime subscriptions.
|
|
296
|
+
*
|
|
297
|
+
* For collection-level subscriptions, prefer `pb.collection('name').subscribe()`.
|
|
298
|
+
* This module is for lower-level control over the SSE connection.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```ts
|
|
302
|
+
* // Subscribe to all changes on a collection
|
|
303
|
+
* const unsub = await pb.realtime.subscribe('posts', (e) => {
|
|
304
|
+
* console.log(e.action, e.record)
|
|
305
|
+
* })
|
|
306
|
+
*
|
|
307
|
+
* // Unsubscribe
|
|
308
|
+
* await unsub()
|
|
309
|
+
*
|
|
310
|
+
* // Disconnect all realtime connections
|
|
311
|
+
* pb.realtime.disconnect()
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
declare class PicoBaseRealtime {
|
|
315
|
+
private pb;
|
|
316
|
+
constructor(pb: PocketBase);
|
|
317
|
+
/**
|
|
318
|
+
* Subscribe to realtime events on a collection.
|
|
319
|
+
*
|
|
320
|
+
* @param collection - Collection name (e.g. 'posts').
|
|
321
|
+
* @param callback - Called on every create/update/delete event.
|
|
322
|
+
* @returns Unsubscribe function.
|
|
323
|
+
*/
|
|
324
|
+
subscribe<T = RecordModel>(collection: string, callback: (data: RecordSubscription<T>) => void): Promise<() => Promise<void>>;
|
|
325
|
+
/**
|
|
326
|
+
* Subscribe to realtime events on a specific record.
|
|
327
|
+
*
|
|
328
|
+
* @param collection - Collection name.
|
|
329
|
+
* @param recordId - Record ID.
|
|
330
|
+
* @param callback - Called on update/delete events.
|
|
331
|
+
* @returns Unsubscribe function.
|
|
332
|
+
*/
|
|
333
|
+
subscribeRecord<T = RecordModel>(collection: string, recordId: string, callback: (data: RecordSubscription<T>) => void): Promise<() => Promise<void>>;
|
|
334
|
+
/**
|
|
335
|
+
* Unsubscribe from all realtime events on a collection.
|
|
336
|
+
*/
|
|
337
|
+
unsubscribe(collection: string): Promise<void>;
|
|
338
|
+
/**
|
|
339
|
+
* Unsubscribe from ALL realtime events. The SSE connection will be
|
|
340
|
+
* automatically closed when there are no remaining subscriptions.
|
|
341
|
+
*/
|
|
342
|
+
disconnectAll(): Promise<void>;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Storage module — work with file fields on PocketBase records.
|
|
347
|
+
*
|
|
348
|
+
* PocketBase stores files as record fields. This module provides helpers
|
|
349
|
+
* to get file URLs and generate access tokens for protected files.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* const user = await pb.collection('users').getOne('user_id')
|
|
354
|
+
*
|
|
355
|
+
* // Get the URL for the user's avatar
|
|
356
|
+
* const avatarUrl = pb.storage.getFileUrl(user, 'avatar.jpg')
|
|
357
|
+
*
|
|
358
|
+
* // Get a thumbnail URL (100x100)
|
|
359
|
+
* const thumbUrl = pb.storage.getFileUrl(user, 'avatar.jpg', {
|
|
360
|
+
* thumb: '100x100',
|
|
361
|
+
* })
|
|
362
|
+
*
|
|
363
|
+
* // Get a temporary token for protected files
|
|
364
|
+
* const token = await pb.storage.getFileToken()
|
|
365
|
+
* const protectedUrl = pb.storage.getFileUrl(user, 'document.pdf', { token })
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
declare class PicoBaseStorage {
|
|
369
|
+
private pb;
|
|
370
|
+
constructor(pb: PocketBase);
|
|
371
|
+
/**
|
|
372
|
+
* Get the public URL for a file attached to a record.
|
|
373
|
+
*
|
|
374
|
+
* @param record - The record that owns the file.
|
|
375
|
+
* @param filename - The filename (as stored in the record's file field).
|
|
376
|
+
* @param options - Optional: thumb size, token for protected files, download flag.
|
|
377
|
+
*/
|
|
378
|
+
getFileUrl(record: RecordModel, filename: string, options?: FileOptions): string;
|
|
379
|
+
/**
|
|
380
|
+
* Generate a temporary file access token.
|
|
381
|
+
*
|
|
382
|
+
* Use this for accessing protected files. Tokens are short-lived.
|
|
383
|
+
*/
|
|
384
|
+
getFileToken(): Promise<string>;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare class PicoBaseClient {
|
|
388
|
+
/** The underlying PocketBase SDK instance. Exposed for advanced usage. */
|
|
389
|
+
readonly pb: PocketBase;
|
|
390
|
+
/** Auth module — sign up, sign in, OAuth, session management. */
|
|
391
|
+
readonly auth: PicoBaseAuth;
|
|
392
|
+
/** Realtime module — subscribe to record changes. */
|
|
393
|
+
readonly realtime: PicoBaseRealtime;
|
|
394
|
+
/** Storage module — get file URLs and tokens. */
|
|
395
|
+
readonly storage: PicoBaseStorage;
|
|
396
|
+
private readonly apiKey;
|
|
397
|
+
private readonly options;
|
|
398
|
+
constructor(url: string, apiKey: string, options?: PicoBaseClientOptions);
|
|
399
|
+
/**
|
|
400
|
+
* Access a collection for CRUD operations.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```ts
|
|
404
|
+
* const posts = await pb.collection('posts').getList(1, 20)
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
collection<T = RecordModel>(name: string): PicoBaseCollection<T>;
|
|
408
|
+
/**
|
|
409
|
+
* Call a server-side function (PocketBase custom API endpoint).
|
|
410
|
+
* Proxies to PocketBase's send() method.
|
|
411
|
+
*/
|
|
412
|
+
send<T = unknown>(path: string, options?: SendOptions): Promise<T>;
|
|
413
|
+
/**
|
|
414
|
+
* Get the current auth token (if signed in), or empty string.
|
|
415
|
+
*/
|
|
416
|
+
get token(): string;
|
|
417
|
+
/**
|
|
418
|
+
* Check if a user is currently authenticated.
|
|
419
|
+
*/
|
|
420
|
+
get isAuthenticated(): boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Monkey-patch pb.send to retry on 503 (cold start).
|
|
423
|
+
*
|
|
424
|
+
* When an instance is stopped or starting, the proxy returns 503.
|
|
425
|
+
* The SDK automatically retries with exponential backoff so the developer
|
|
426
|
+
* doesn't have to handle cold-start logic.
|
|
427
|
+
*/
|
|
428
|
+
private _wrapSendWithRetry;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Create a new PicoBase client.
|
|
432
|
+
*
|
|
433
|
+
* Can be called with explicit URL and API key, or with zero arguments to
|
|
434
|
+
* auto-detect from environment variables (`PICOBASE_URL` / `NEXT_PUBLIC_PICOBASE_URL`
|
|
435
|
+
* and `PICOBASE_API_KEY` / `NEXT_PUBLIC_PICOBASE_API_KEY`).
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```ts
|
|
439
|
+
* import { createClient } from '@picobase_app/client'
|
|
440
|
+
*
|
|
441
|
+
* // Zero-config — reads from env vars
|
|
442
|
+
* const pb = createClient()
|
|
443
|
+
*
|
|
444
|
+
* // Or explicit
|
|
445
|
+
* const pb = createClient('https://myapp.picobase.com', 'pbk_abc123_secret')
|
|
446
|
+
*
|
|
447
|
+
* // Sign up a user
|
|
448
|
+
* const user = await pb.auth.signUp({
|
|
449
|
+
* email: 'user@example.com',
|
|
450
|
+
* password: 'securepassword',
|
|
451
|
+
* })
|
|
452
|
+
*
|
|
453
|
+
* // Query records
|
|
454
|
+
* const posts = await pb.collection('posts').getList(1, 20, {
|
|
455
|
+
* filter: 'published = true',
|
|
456
|
+
* sort: '-created',
|
|
457
|
+
* })
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
declare function createClient(options?: PicoBaseClientOptions): PicoBaseClient;
|
|
461
|
+
declare function createClient(url: string, apiKey: string, options?: PicoBaseClientOptions): PicoBaseClient;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Base error class for all PicoBase SDK errors.
|
|
465
|
+
*/
|
|
466
|
+
declare class PicoBaseError extends Error {
|
|
467
|
+
readonly code: string;
|
|
468
|
+
readonly status?: number | undefined;
|
|
469
|
+
readonly details?: unknown | undefined;
|
|
470
|
+
constructor(message: string, code: string, status?: number | undefined, details?: unknown | undefined);
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Thrown when the instance is not running and cold-start retries are exhausted.
|
|
474
|
+
*/
|
|
475
|
+
declare class InstanceUnavailableError extends PicoBaseError {
|
|
476
|
+
constructor(message?: string);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Thrown when an API key is invalid or missing.
|
|
480
|
+
*/
|
|
481
|
+
declare class AuthorizationError extends PicoBaseError {
|
|
482
|
+
constructor(message?: string);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Thrown when a PocketBase API request fails.
|
|
486
|
+
*/
|
|
487
|
+
declare class RequestError extends PicoBaseError {
|
|
488
|
+
constructor(message: string, status: number, details?: unknown);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export { type AuthEvent, type AuthResponse, type AuthStateChange, type AuthStateChangeCallback, AuthorizationError, type FileOptions, InstanceUnavailableError, type ListOptions, type OAuthSignInOptions, PicoBaseAuth, PicoBaseClient, type PicoBaseClientOptions, PicoBaseCollection, PicoBaseError, PicoBaseRealtime, PicoBaseStorage, type RealtimeAction, type RealtimeCallback, type RecordQueryOptions, RequestError, type SignInOptions, type SignUpOptions, type UnsubscribeFunc, createClient };
|