@supabase/lite 0.0.1-next.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.
Files changed (37) hide show
  1. package/dist/Connection-rAPmec1m.d.ts +710 -0
  2. package/dist/cli/index.d.ts +1 -0
  3. package/dist/cli/index.js +30950 -0
  4. package/dist/cli/lib.d.ts +158 -0
  5. package/dist/cli/lib.js +18598 -0
  6. package/dist/db/browser/index.d.ts +550 -0
  7. package/dist/db/browser/index.js +16112 -0
  8. package/dist/db/bun/index.d.ts +548 -0
  9. package/dist/db/bun/index.js +16100 -0
  10. package/dist/db/fallback.d.ts +182 -0
  11. package/dist/db/fallback.js +15996 -0
  12. package/dist/db/node/index.d.ts +547 -0
  13. package/dist/db/node/index.js +16093 -0
  14. package/dist/db/postgres/BasePostgresConnection-B7zHDAib.d.ts +24 -0
  15. package/dist/db/postgres/PostgresConnection.d.ts +16 -0
  16. package/dist/db/postgres/PostgresConnection.js +611 -0
  17. package/dist/db/postgres/pglite/PgliteConnection.d.ts +38 -0
  18. package/dist/db/postgres/pglite/PgliteConnection.js +890 -0
  19. package/dist/db/workerd/index.d.ts +570 -0
  20. package/dist/db/workerd/index.js +16218 -0
  21. package/dist/index-xv_pDjEt.d.ts +769 -0
  22. package/dist/index.d.ts +2498 -0
  23. package/dist/index.js +32305 -0
  24. package/dist/static/.vite/manifest.json +11 -0
  25. package/dist/static/assets/main-BsWx0q9l.js +40913 -0
  26. package/dist/static/assets/main-DexXgo9R.css +4002 -0
  27. package/dist/static/favicon.ico +0 -0
  28. package/dist/static/fonts/CustomFont-Black.woff2 +0 -0
  29. package/dist/static/fonts/CustomFont-BlackItalic.woff2 +0 -0
  30. package/dist/static/fonts/CustomFont-Bold.woff2 +0 -0
  31. package/dist/static/fonts/CustomFont-BoldItalic.woff2 +0 -0
  32. package/dist/static/fonts/CustomFont-Book.woff2 +0 -0
  33. package/dist/static/fonts/CustomFont-BookItalic.woff2 +0 -0
  34. package/dist/static/fonts/CustomFont-Medium.woff2 +0 -0
  35. package/dist/vite/index.d.ts +3017 -0
  36. package/dist/vite/index.js +1923 -0
  37. package/package.json +195 -0
@@ -0,0 +1,2498 @@
1
+ import * as _supabase_supabase_js from '@supabase/supabase-js';
2
+ import { SupabaseClientOptions } from '@supabase/supabase-js';
3
+ import { D as DefaultSchema, S as Schema } from './index-xv_pDjEt.js';
4
+ import { Connection } from '@supabase/lite';
5
+ import * as hono_hono_base from 'hono/hono-base';
6
+ import { b as CacheDriver, c as CacheSetOptions, P as PolicyCommand, e as PolicyRole, f as Policy } from './Connection-rAPmec1m.js';
7
+ export { g as AST, h as ASTType, i as AggregateFunction, A as AnyAST, B as BaseAST, j as BodyResult, k as CheckConstraintInfo, l as ColumnDef, m as ColumnDiff, n as ColumnInfo, o as ColumnRef, p as CommentInfo, C as Connection, q as ConnectionContextOptions, r as ConnectionMigrator, s as CustomTypesInfo, D as DataLossError, t as DataLossWarning, u as DeleteAST, v as Dialect, w as DiffResult, E as EmbedDef, x as EmbedTransform, y as ExplainOptions, F as FiltersResult, z as ForeignKeyDiff, G as ForeignKeyInfo, H as HeadersResult, a as IConnectionConfig, J as IndexDiff, K as IndexInfo, L as InsertAST, M as IntrospectOptions, I as IntrospectResult, N as JoinDef, O as JoinMap, Q as Meta, R as MigrationError, S as OrderEntry, U as PlanResult, W as PlanStep, X as PlanStepType, Y as PreferToken, Z as PrimaryKeyInfo, _ as Qb, $ as QbDelete, a0 as QbInsert, a1 as QbSelect, a2 as QbUpdate, a3 as QueryAST, a4 as QueryParamsResult, a5 as RelationNotFoundError, a6 as RouteResult, a7 as RpcAST, a8 as RpcResult, a9 as SchemaDiffResult, aa as SelectEntry, ab as SelectResult, ac as TableDiff, ad as TableInfo, ae as TextSearchValue, T as TransactionOptions, af as TransformsResult, ag as TranslatorConfig, ah as TriggerInfo, ai as UniqueConstraintInfo, aj as UpdateAST, ak as UpsertAST, al as UpsertResult, V as VarsContext, am as ViewInfo, an as Where, ao as WhereValue, ap as isRef, aq as translatePostgresDdl } from './Connection-rAPmec1m.js';
8
+ import * as hono_utils_http_status from 'hono/utils/http-status';
9
+ import * as hono_utils_types from 'hono/utils/types';
10
+ import * as hono_types from 'hono/types';
11
+ import * as hono from 'hono';
12
+ import { MiddlewareHandler, Context } from 'hono';
13
+ import { Kysely } from 'kysely';
14
+ import { ReadableStream as ReadableStream$1 } from 'node:stream/web';
15
+ import 'jsonv-ts';
16
+ import 'libpg-query';
17
+ import 'pgsql-deparser';
18
+
19
+ interface UsersTable {
20
+ id: string;
21
+ aud: string;
22
+ role: string;
23
+ email: string | null;
24
+ encrypted_password: string | null;
25
+ phone: string | null;
26
+ email_confirmed_at: string | null;
27
+ confirmed_at: string | null;
28
+ invited_at: string | null;
29
+ confirmation_token: string | null;
30
+ confirmation_sent_at: string | null;
31
+ recovery_token: string | null;
32
+ recovery_sent_at: string | null;
33
+ email_change: string | null;
34
+ email_change_token_new: string | null;
35
+ email_change_token_current: string | null;
36
+ email_change_sent_at: string | null;
37
+ email_change_confirm_status: number;
38
+ phone_confirmed_at: string | null;
39
+ phone_change: string | null;
40
+ phone_change_token: string | null;
41
+ phone_change_sent_at: string | null;
42
+ reauthentication_token: string | null;
43
+ reauthentication_sent_at: string | null;
44
+ raw_app_meta_data: string | Record<string, unknown>;
45
+ raw_user_meta_data: string | Record<string, unknown>;
46
+ banned_until: string | null;
47
+ deleted_at: string | null;
48
+ is_sso_user: boolean;
49
+ is_anonymous: boolean;
50
+ last_sign_in_at: string | null;
51
+ created_at: string;
52
+ updated_at: string;
53
+ }
54
+ interface SessionsTable {
55
+ id: string;
56
+ user_id: string;
57
+ not_after: string | null;
58
+ refreshed_at: string | null;
59
+ user_agent: string | null;
60
+ ip: string | null;
61
+ tag: string | null;
62
+ refresh_token_hmac_key: string | null;
63
+ refresh_token_counter: number | null;
64
+ scopes: string | null;
65
+ created_at: string;
66
+ updated_at: string;
67
+ aal: string | null;
68
+ factor_id: string | null;
69
+ }
70
+ interface RefreshTokensTable {
71
+ id: string;
72
+ token: string;
73
+ user_id: string;
74
+ session_id: string | null;
75
+ revoked: boolean;
76
+ parent: string | null;
77
+ created_at: string;
78
+ updated_at: string;
79
+ }
80
+ interface IdentitiesTable {
81
+ id: string;
82
+ provider: string;
83
+ provider_id: string;
84
+ user_id: string;
85
+ identity_data: string | Record<string, unknown>;
86
+ email?: string;
87
+ last_sign_in_at: string | null;
88
+ created_at: string;
89
+ updated_at: string;
90
+ }
91
+ interface UserResponse {
92
+ id: string;
93
+ aud: string;
94
+ role: string;
95
+ email: string;
96
+ phone: string;
97
+ confirmed_at?: string | null;
98
+ email_confirmed_at?: string | null;
99
+ last_sign_in_at?: string | null;
100
+ app_metadata: Record<string, unknown>;
101
+ user_metadata: Record<string, unknown>;
102
+ identities: IdentityResponse[];
103
+ created_at: string;
104
+ updated_at: string;
105
+ is_anonymous: boolean;
106
+ new_email?: string;
107
+ confirmation_sent_at?: string | null;
108
+ email_change_sent_at?: string | null;
109
+ recovery_sent_at?: string | null;
110
+ }
111
+ interface SessionResponse {
112
+ access_token: string;
113
+ refresh_token: string;
114
+ token_type: "bearer";
115
+ expires_in: number;
116
+ expires_at: number;
117
+ user: UserResponse;
118
+ weak_password?: null;
119
+ }
120
+ interface IdentityResponse {
121
+ identity_id: string;
122
+ id: string;
123
+ user_id: string;
124
+ identity_data: Record<string, unknown>;
125
+ provider: string;
126
+ last_sign_in_at: string | null;
127
+ created_at: string;
128
+ updated_at: string;
129
+ email?: string;
130
+ }
131
+ interface AuthConfig {
132
+ jwt_secret: string;
133
+ jwt_expiry?: number;
134
+ enable_refresh_token_rotation?: boolean;
135
+ refresh_token_reuse_interval?: number;
136
+ minimum_password_length?: number;
137
+ password_required_characters?: string[];
138
+ password_requirements?: string;
139
+ enable_signup?: boolean;
140
+ sessions?: {
141
+ timebox?: string;
142
+ inactivity_timeout?: string;
143
+ single_per_user?: boolean;
144
+ };
145
+ email?: {
146
+ enable_signup?: boolean;
147
+ enable_confirmations?: boolean;
148
+ double_confirm_changes?: boolean;
149
+ };
150
+ enable_confirmations?: boolean;
151
+ site_url?: string;
152
+ }
153
+
154
+ type Dialect$1 = "postgres" | "sqlite";
155
+ declare class AuthRepository {
156
+ private db;
157
+ private dialect;
158
+ private schema;
159
+ constructor(db: Kysely<any>, dialect: Dialect$1);
160
+ private bool;
161
+ private table;
162
+ private insertInto;
163
+ private update;
164
+ private deleteFrom;
165
+ findUserByEmail(email: string): Promise<UsersTable | null>;
166
+ findUserById(id: string): Promise<UsersTable | null>;
167
+ findUserByToken(column: string, token: string): Promise<UsersTable | null>;
168
+ createUser(user: Partial<UsersTable> & {
169
+ id: string;
170
+ email: string;
171
+ }): Promise<UsersTable>;
172
+ updateUser(id: string, updates: Partial<UsersTable>): Promise<UsersTable | null>;
173
+ createSession(session: {
174
+ id: string;
175
+ user_id: string;
176
+ aal?: string;
177
+ }): Promise<SessionsTable>;
178
+ findSessionById(id: string): Promise<SessionsTable | null>;
179
+ updateSessionRefreshedAt(id: string, refreshedAt: string): Promise<SessionsTable | null>;
180
+ deleteSession(id: string): Promise<void>;
181
+ deleteUserSessions(userId: string, exceptSessionId?: string): Promise<void>;
182
+ deleteRefreshTokensForSession(sessionId: string): Promise<void>;
183
+ deleteRefreshTokensForUser(userId: string, exceptSessionId?: string): Promise<void>;
184
+ createRefreshToken(rt: {
185
+ token: string;
186
+ user_id: string;
187
+ session_id: string;
188
+ parent?: string | null;
189
+ }): Promise<RefreshTokensTable>;
190
+ findRefreshToken(token: string): Promise<RefreshTokensTable | null>;
191
+ findRefreshTokensBySession(sessionId: string): Promise<RefreshTokensTable[]>;
192
+ revokeRefreshToken(id: string): Promise<void>;
193
+ revokeSessionRefreshTokens(sessionId: string): Promise<void>;
194
+ revokeRefreshTokensByIds(ids: string[]): Promise<void>;
195
+ revokeUserRefreshTokens(userId: string): Promise<void>;
196
+ createIdentity(identity: {
197
+ id: string;
198
+ provider: string;
199
+ provider_id: string;
200
+ user_id: string;
201
+ identity_data: Record<string, unknown>;
202
+ last_sign_in_at?: string | null;
203
+ }): Promise<IdentitiesTable>;
204
+ findIdentitiesByUserId(userId: string): Promise<IdentitiesTable[]>;
205
+ updateIdentity(id: string, updates: Partial<IdentitiesTable>): Promise<void>;
206
+ createAuditLogEntry(entry: {
207
+ id: string;
208
+ payload?: Record<string, unknown>;
209
+ ip_address?: string;
210
+ }): Promise<void>;
211
+ parseUserJson(user: UsersTable): UsersTable;
212
+ }
213
+
214
+ interface InMemoryLruCacheDriverOptions {
215
+ maxSizeBytes?: number;
216
+ now?: () => number;
217
+ }
218
+ declare class InMemoryLruCacheDriver implements CacheDriver {
219
+ private readonly maxSizeBytes;
220
+ private readonly now;
221
+ private readonly entries;
222
+ private sizeBytes;
223
+ constructor(options?: InMemoryLruCacheDriverOptions);
224
+ get(key: string): Promise<string | undefined>;
225
+ set(key: string, value: string, options?: CacheSetOptions): Promise<void>;
226
+ delete(key: string): Promise<void>;
227
+ private isExpired;
228
+ private evictToSize;
229
+ private deleteEntry;
230
+ }
231
+
232
+ interface CloudflareKvNamespace {
233
+ get(key: string): Promise<string | null>;
234
+ put(key: string, value: string, options?: {
235
+ expirationTtl?: number;
236
+ }): Promise<void>;
237
+ delete(key: string): Promise<void>;
238
+ }
239
+ interface CloudflareKvCacheDriverOptions {
240
+ namespace: CloudflareKvNamespace;
241
+ }
242
+ declare class CloudflareKvCacheDriver implements CacheDriver {
243
+ private readonly options;
244
+ constructor(options: CloudflareKvCacheDriverOptions);
245
+ get(key: string): Promise<string | undefined>;
246
+ set(key: string, value: string, options?: CacheSetOptions): Promise<void>;
247
+ delete(key: string): Promise<void>;
248
+ }
249
+
250
+ interface RedisCacheClient {
251
+ get(key: string): Promise<string | null | undefined> | string | null | undefined;
252
+ set(key: string, value: string, ...args: unknown[]): Promise<unknown> | unknown;
253
+ del?(key: string): Promise<unknown> | unknown;
254
+ delete?(key: string): Promise<unknown> | unknown;
255
+ }
256
+ interface RedisCacheDriverOptions {
257
+ client: RedisCacheClient;
258
+ }
259
+ declare class RedisCacheDriver implements CacheDriver {
260
+ private readonly options;
261
+ constructor(options: RedisCacheDriverOptions);
262
+ get(key: string): Promise<string | undefined>;
263
+ set(key: string, value: string, options?: CacheSetOptions): Promise<void>;
264
+ delete(key: string): Promise<void>;
265
+ }
266
+
267
+ type ResendFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
268
+ interface ResendEmailDriverOptions {
269
+ apiKey: string;
270
+ from: string;
271
+ endpoint?: string;
272
+ fetch?: ResendFetch;
273
+ }
274
+ declare class ResendEmailDriver implements EmailDriver {
275
+ private readonly options;
276
+ private readonly endpoint;
277
+ private readonly fetchFn;
278
+ constructor(options: ResendEmailDriverOptions);
279
+ send(message: EmailMessage): Promise<void>;
280
+ }
281
+
282
+ interface AwsSesFetchClient {
283
+ fetch(input: string | URL, init?: RequestInit): Promise<Response>;
284
+ }
285
+ interface AwsSesEmailDriverOptions {
286
+ region: string;
287
+ accessKeyId: string;
288
+ secretAccessKey: string;
289
+ from: string;
290
+ client?: AwsSesFetchClient;
291
+ }
292
+ declare class AwsSesEmailDriver implements EmailDriver {
293
+ private readonly options;
294
+ private readonly endpoint;
295
+ private client?;
296
+ constructor(options: AwsSesEmailDriverOptions);
297
+ send(message: EmailMessage): Promise<void>;
298
+ private getClient;
299
+ }
300
+
301
+ interface SendmailEmailDriverOptions {
302
+ from: string;
303
+ sendmailPath?: string;
304
+ }
305
+ declare class SendmailEmailDriver implements EmailDriver {
306
+ private readonly options;
307
+ private readonly sendmailPath;
308
+ constructor(options: SendmailEmailDriverOptions);
309
+ send(message: EmailMessage): Promise<void>;
310
+ }
311
+ declare function formatSendmailMessage(from: string, message: EmailMessage): string;
312
+
313
+ interface EmailMessage {
314
+ to: string;
315
+ subject: string;
316
+ text?: string;
317
+ html?: string;
318
+ }
319
+ interface EmailDriver {
320
+ send(message: EmailMessage): Promise<void>;
321
+ }
322
+ interface StoredEmailMessage extends EmailMessage {
323
+ sentAt: string;
324
+ }
325
+ interface InMemoryEmailDriverOptions {
326
+ maxKeepCount?: number;
327
+ }
328
+ declare class InMemoryEmailDriver implements EmailDriver {
329
+ readonly messages: Map<string, StoredEmailMessage[]>;
330
+ private readonly maxKeepCount;
331
+ private readonly order;
332
+ constructor(options?: InMemoryEmailDriverOptions);
333
+ send(message: EmailMessage): Promise<void>;
334
+ clear(): void;
335
+ private trim;
336
+ }
337
+ interface NoopEmailDriverOptions {
338
+ silent?: boolean;
339
+ logger?: Pick<Console, "info">;
340
+ }
341
+ declare class NoopEmailDriver extends InMemoryEmailDriver {
342
+ private readonly silent;
343
+ private readonly logger;
344
+ constructor(options?: NoopEmailDriverOptions);
345
+ send(message: EmailMessage): Promise<void>;
346
+ }
347
+
348
+ interface SmsMessage {
349
+ to: string;
350
+ body: string;
351
+ }
352
+ interface SmsDriver {
353
+ send(message: SmsMessage): Promise<void>;
354
+ }
355
+ interface NoopSmsDriverOptions {
356
+ silent?: boolean;
357
+ logger?: Pick<Console, "info">;
358
+ }
359
+ declare class NoopSmsDriver implements SmsDriver {
360
+ private readonly silent;
361
+ private readonly logger;
362
+ constructor(options?: NoopSmsDriverOptions);
363
+ send(message: SmsMessage): Promise<void>;
364
+ }
365
+
366
+ interface AppDrivers {
367
+ email: EmailDriver;
368
+ sms: SmsDriver;
369
+ cache: CacheDriver;
370
+ }
371
+ type PartialAppDrivers = Partial<AppDrivers>;
372
+ declare function createAppDrivers(drivers?: PartialAppDrivers): AppDrivers;
373
+
374
+ interface Mailer {
375
+ sendConfirmation(email: string, token: string, otp: string, meta?: MailMeta): Promise<void>;
376
+ sendRecovery(email: string, token: string, otp: string, meta?: MailMeta): Promise<void>;
377
+ sendMagicLink(email: string, token: string, otp: string, meta?: MailMeta): Promise<void>;
378
+ sendEmailChange(email: string, token: string, otp: string, meta?: MailMeta): Promise<void>;
379
+ sendReauthentication(email: string, otp: string, meta?: MailMeta): Promise<void>;
380
+ }
381
+ interface MailMeta {
382
+ userId?: string;
383
+ emailActionType?: string;
384
+ tokenHash?: string;
385
+ tokenNew?: string;
386
+ tokenHashNew?: string;
387
+ redirectTo?: string;
388
+ }
389
+
390
+ declare class AuthService {
391
+ repo: AuthRepository;
392
+ private config;
393
+ private mailer;
394
+ private jwtExpiry;
395
+ private minPasswordLength;
396
+ private passwordRequiredCharacters;
397
+ private sessionTimeboxSeconds?;
398
+ private sessionInactivitySeconds?;
399
+ constructor(repo: AuthRepository, config: AuthConfig, mailer: Mailer);
400
+ signUp(email: string | undefined, password: string | undefined, data?: Record<string, unknown>): Promise<{
401
+ user: UserResponse;
402
+ session?: SessionResponse;
403
+ }>;
404
+ signInWithPassword(email: string | undefined, password: string | undefined): Promise<SessionResponse>;
405
+ refreshSession(refreshToken: string | undefined): Promise<SessionResponse>;
406
+ private refreshWithRevokedToken;
407
+ private createRefreshResponse;
408
+ private assertSessionRefreshable;
409
+ getUser(userId: string): Promise<UserResponse>;
410
+ updateUser(userId: string, updates: {
411
+ data?: Record<string, unknown>;
412
+ password?: string;
413
+ email?: string;
414
+ }): Promise<UserResponse>;
415
+ signOut(sessionId: string | undefined, scope: string | undefined, userId: string): Promise<void>;
416
+ signInWithOtp(email: string | undefined, options?: {
417
+ shouldCreateUser?: boolean;
418
+ }): Promise<void>;
419
+ requestMagicLink(email: string | undefined, _security?: Record<string, unknown>): Promise<void>;
420
+ verifyOtp(params: {
421
+ email?: string;
422
+ token?: string;
423
+ token_hash?: string;
424
+ type: string;
425
+ }): Promise<SessionResponse>;
426
+ recover(email: string | undefined): Promise<void>;
427
+ resend(type: string, email: string | undefined): Promise<void>;
428
+ reauthenticate(userId: string): Promise<void>;
429
+ private createSessionForUser;
430
+ private assertPasswordStrong;
431
+ private mapUserToResponse;
432
+ private mapIdentityToResponse;
433
+ private findUserByTokenAndType;
434
+ private otpMatchesStoredTokenHash;
435
+ private getTokenColumnsForType;
436
+ private createAuditLog;
437
+ }
438
+
439
+ type CrossReadableStream = ReadableStream | ReadableStream$1;
440
+ interface ObjectMetadata {
441
+ cacheControl: string;
442
+ contentLength: number;
443
+ size: number;
444
+ mimetype: string;
445
+ lastModified?: Date;
446
+ eTag: string;
447
+ contentRange?: string;
448
+ httpStatusCode?: number;
449
+ }
450
+ interface BrowserCacheHeaders {
451
+ ifModifiedSince?: string;
452
+ ifNoneMatch?: string;
453
+ range?: string;
454
+ }
455
+ interface ObjectResponse {
456
+ metadata: ObjectMetadata;
457
+ httpStatusCode: number;
458
+ body?: CrossReadableStream | Blob | Buffer;
459
+ }
460
+ type StorageAdapterOptions = {};
461
+ interface StorageAdapter<Options extends StorageAdapterOptions = StorageAdapterOptions, Driver = unknown> {
462
+ driver: Driver;
463
+ getObject(bucketName: string, key: string, version: string | undefined, headers?: BrowserCacheHeaders): Promise<ObjectResponse>;
464
+ uploadObject(bucketName: string, key: string, version: string | undefined, body: CrossReadableStream | Buffer | Uint8Array, contentType: string, cacheControl: string): Promise<ObjectMetadata>;
465
+ deleteObject(bucket: string, key: string, version: string | undefined): Promise<void>;
466
+ deleteObjects(bucket: string, prefixes: string[]): Promise<void>;
467
+ copyObject(bucket: string, source: string, version: string | undefined, destination: string, destinationVersion: string | undefined): Promise<Pick<ObjectMetadata, "httpStatusCode" | "eTag" | "lastModified">>;
468
+ headObject(bucket: string, key: string, version: string | undefined): Promise<ObjectMetadata>;
469
+ privateAssetUrl(bucket: string, key: string, version: string | undefined): Promise<string>;
470
+ }
471
+
472
+ interface TransformOptions {
473
+ width?: number;
474
+ height?: number;
475
+ resize?: "cover" | "contain" | "fill";
476
+ format?: "webp" | "png" | "jpeg" | "avif";
477
+ quality?: number;
478
+ }
479
+ interface TransformResult {
480
+ body: ReadableStream | Uint8Array;
481
+ contentType: string;
482
+ /** Only set when body is a Uint8Array */
483
+ contentLength?: number;
484
+ }
485
+ interface TransformationAdapterOptions {
486
+ }
487
+ interface TransformationAdapter<Options extends TransformationAdapterOptions = TransformationAdapterOptions, Driver = unknown> {
488
+ driver: Driver;
489
+ /**
490
+ * Whether this adapter requires the full image buffer upfront.
491
+ * If false, the service will pass the stream/url through without buffering.
492
+ * - sharp: true (needs buffer)
493
+ * - cloudflare: false (transforms via URL subrequest)
494
+ */
495
+ requiresBuffer: boolean;
496
+ /**
497
+ * Transform from a buffer. Used when requiresBuffer is true.
498
+ */
499
+ transform(input: Uint8Array, options: TransformOptions): Promise<TransformResult>;
500
+ /**
501
+ * Transform from a URL or Response. Used when requiresBuffer is false.
502
+ * Adapters that don't support this should set requiresBuffer=true.
503
+ */
504
+ transformFromUrl?(url: string, options: TransformOptions): Promise<TransformResult>;
505
+ }
506
+
507
+ type Dialect = "postgres" | "sqlite";
508
+ interface Bucket {
509
+ id: string;
510
+ name: string;
511
+ owner: string | null;
512
+ owner_id: string | null;
513
+ public: boolean;
514
+ file_size_limit: number | null;
515
+ allowed_mime_types: string[] | null;
516
+ created_at: string;
517
+ updated_at: string;
518
+ }
519
+ interface StorageObject {
520
+ id: string;
521
+ bucket_id: string;
522
+ name: string;
523
+ owner: string | null;
524
+ owner_id: string | null;
525
+ metadata: Record<string, unknown>;
526
+ user_metadata: Record<string, unknown>;
527
+ path_tokens: string[];
528
+ version: string | null;
529
+ created_at: string;
530
+ updated_at: string;
531
+ last_accessed_at: string;
532
+ }
533
+ interface ListObjectsOptions {
534
+ limit?: number;
535
+ offset?: number;
536
+ sortBy?: {
537
+ column: string;
538
+ order: "asc" | "desc";
539
+ };
540
+ search?: string;
541
+ }
542
+ declare class StorageRepository {
543
+ private db;
544
+ private dialect;
545
+ private schema;
546
+ constructor(db: Kysely<any>, dialect: Dialect);
547
+ private table;
548
+ private insertInto;
549
+ private update;
550
+ private deleteFrom;
551
+ createBucket(bucket: {
552
+ id: string;
553
+ name: string;
554
+ owner?: string | null;
555
+ owner_id?: string | null;
556
+ public?: boolean;
557
+ file_size_limit?: number | null;
558
+ allowed_mime_types?: string[];
559
+ }): Promise<Bucket>;
560
+ findBucketById(id: string): Promise<Bucket | null>;
561
+ findBucketByName(name: string): Promise<Bucket | null>;
562
+ listBuckets(): Promise<Bucket[]>;
563
+ updateBucket(id: string, updates: Partial<{
564
+ public: boolean;
565
+ file_size_limit: number | null;
566
+ allowed_mime_types: string[];
567
+ }>): Promise<Bucket | null>;
568
+ deleteBucket(id: string): Promise<void>;
569
+ isBucketEmpty(id: string): Promise<boolean>;
570
+ createObject(obj: {
571
+ id: string;
572
+ bucket_id: string;
573
+ name: string;
574
+ owner?: string | null;
575
+ owner_id?: string | null;
576
+ metadata?: Record<string, unknown>;
577
+ user_metadata?: Record<string, unknown>;
578
+ version?: string | null;
579
+ }): Promise<StorageObject>;
580
+ findObjectById(id: string): Promise<StorageObject | null>;
581
+ findObjectByPath(bucketId: string, name: string): Promise<StorageObject | null>;
582
+ listObjects(bucketId: string, prefix?: string, options?: ListObjectsOptions): Promise<StorageObject[]>;
583
+ updateObject(id: string, updates: Partial<{
584
+ name: string;
585
+ metadata: Record<string, unknown>;
586
+ user_metadata: Record<string, unknown>;
587
+ version: string | null;
588
+ owner: string | null;
589
+ owner_id: string | null;
590
+ }>): Promise<StorageObject | null>;
591
+ deleteObject(id: string): Promise<void>;
592
+ deleteObjectsByBucket(bucketId: string): Promise<string[]>;
593
+ objectExists(bucketId: string, name: string): Promise<boolean>;
594
+ touchObject(id: string): Promise<void>;
595
+ private parseBucketRow;
596
+ private parseObjectRow;
597
+ }
598
+
599
+ interface StorageServiceConfig {
600
+ jwtSecret: string;
601
+ fileSizeLimit?: number;
602
+ buckets?: Record<string, {
603
+ public?: boolean;
604
+ file_size_limit?: string;
605
+ allowed_mime_types?: string[];
606
+ }>;
607
+ }
608
+ interface StorageServiceOptions {
609
+ autoCreateBuckets?: boolean;
610
+ }
611
+ declare class StorageService {
612
+ private repo;
613
+ private adapter;
614
+ private config;
615
+ private options;
616
+ private transformationAdapter?;
617
+ private initialized;
618
+ constructor(repo: StorageRepository, adapter: StorageAdapter, config: StorageServiceConfig, options?: StorageServiceOptions, transformationAdapter?: TransformationAdapter | undefined);
619
+ init(): Promise<void>;
620
+ createBucket(params: {
621
+ id: string;
622
+ name: string;
623
+ public?: boolean;
624
+ file_size_limit?: number | null;
625
+ allowed_mime_types?: string[];
626
+ owner?: string | null;
627
+ }): Promise<Bucket>;
628
+ getBucket(id: string): Promise<Bucket>;
629
+ listBuckets(): Promise<Bucket[]>;
630
+ updateBucket(id: string, updates: {
631
+ public?: boolean;
632
+ file_size_limit?: number | null;
633
+ allowed_mime_types?: string[];
634
+ }): Promise<Bucket>;
635
+ deleteBucket(id: string): Promise<void>;
636
+ emptyBucket(id: string): Promise<void>;
637
+ upload(bucketId: string, path: string, body: ReadableStream | Buffer | Uint8Array, options?: {
638
+ contentType?: string;
639
+ cacheControl?: string;
640
+ contentLength?: number;
641
+ upsert?: boolean;
642
+ metadata?: Record<string, unknown>;
643
+ owner?: string | null;
644
+ }): Promise<StorageObject>;
645
+ download(bucketId: string, path: string, options?: {
646
+ transform?: TransformOptions;
647
+ }): Promise<{
648
+ body: CrossReadableStream | Blob | Buffer | Uint8Array;
649
+ metadata: ObjectMetadata;
650
+ }>;
651
+ update(bucketId: string, path: string, body: ReadableStream | Buffer | Uint8Array, options?: {
652
+ contentType?: string;
653
+ cacheControl?: string;
654
+ contentLength?: number;
655
+ metadata?: Record<string, unknown>;
656
+ upsert?: boolean;
657
+ owner?: string | null;
658
+ }): Promise<StorageObject>;
659
+ remove(bucketId: string, paths: string[]): Promise<StorageObject[]>;
660
+ list(bucketId: string, prefix?: string, options?: ListObjectsOptions): Promise<StorageObject[]>;
661
+ move(bucketId: string, fromPath: string, toPath: string): Promise<void>;
662
+ copy(bucketId: string, fromPath: string, toPath: string): Promise<{
663
+ key: string;
664
+ }>;
665
+ info(bucketId: string, path: string): Promise<StorageObject & {
666
+ httpMetadata: ObjectMetadata;
667
+ }>;
668
+ exists(bucketId: string, path: string): Promise<boolean>;
669
+ createSignedUrl(bucketId: string, path: string, expiresIn: number): Promise<{
670
+ signedUrl: string;
671
+ }>;
672
+ createSignedUrls(bucketId: string, paths: string[], expiresIn: number): Promise<{
673
+ path: string;
674
+ signedUrl: string;
675
+ error: string | null;
676
+ }[]>;
677
+ createSignedUploadUrl(bucketId: string, path: string): Promise<{
678
+ signedUrl: string;
679
+ token: string;
680
+ path: string;
681
+ }>;
682
+ verifySignedUrl(token: string): Promise<{
683
+ bucket: string;
684
+ path: string;
685
+ intent: "download" | "upload";
686
+ }>;
687
+ private signStorageToken;
688
+ }
689
+
690
+ type HonoContext = {
691
+ Variables: {
692
+ app: App;
693
+ authService: AuthService;
694
+ storageService: StorageService;
695
+ userId?: string;
696
+ sessionId?: string;
697
+ jwt?: Record<string, unknown>;
698
+ };
699
+ };
700
+ type MaybePromise<T> = T | Promise<T>;
701
+
702
+ type ServerOptions = {
703
+ middlewares?: MiddlewareHandler<HonoContext>[];
704
+ disableStudio?: boolean;
705
+ disableFallback?: boolean;
706
+ /**
707
+ * Test-only PostgREST mode: execute each request in a transaction and roll it back.
708
+ */
709
+ forceRollback?: boolean;
710
+ };
711
+ declare function createServer(app: App, options?: ServerOptions): hono_hono_base.HonoBase<HonoContext & {
712
+ Variables: {
713
+ userId: string;
714
+ sessionId: string;
715
+ jwt: Record<string, unknown>;
716
+ };
717
+ }, hono_types.BlankSchema | hono_types.MergeSchemaPath<{
718
+ "*": {
719
+ $options: {
720
+ input: {};
721
+ output: null;
722
+ outputFormat: "body";
723
+ status: 204;
724
+ };
725
+ };
726
+ } & {
727
+ "/signup": {
728
+ $post: {
729
+ input: {};
730
+ output: {
731
+ access_token: string;
732
+ refresh_token: string;
733
+ token_type: "bearer";
734
+ expires_in: number;
735
+ expires_at: number;
736
+ user: {
737
+ id: string;
738
+ aud: string;
739
+ role: string;
740
+ email: string;
741
+ phone: string;
742
+ confirmed_at?: string | null | undefined;
743
+ email_confirmed_at?: string | null | undefined;
744
+ last_sign_in_at?: string | null | undefined;
745
+ app_metadata: {
746
+ [x: string]: hono_utils_types.JSONValue;
747
+ };
748
+ user_metadata: {
749
+ [x: string]: hono_utils_types.JSONValue;
750
+ };
751
+ identities: {
752
+ identity_id: string;
753
+ id: string;
754
+ user_id: string;
755
+ identity_data: {
756
+ [x: string]: hono_utils_types.JSONValue;
757
+ };
758
+ provider: string;
759
+ last_sign_in_at: string | null;
760
+ created_at: string;
761
+ updated_at: string;
762
+ email?: string | undefined;
763
+ }[];
764
+ created_at: string;
765
+ updated_at: string;
766
+ is_anonymous: boolean;
767
+ new_email?: string | undefined;
768
+ confirmation_sent_at?: string | null | undefined;
769
+ email_change_sent_at?: string | null | undefined;
770
+ recovery_sent_at?: string | null | undefined;
771
+ };
772
+ weak_password?: null | undefined;
773
+ };
774
+ outputFormat: "json";
775
+ status: 200;
776
+ } | {
777
+ input: {};
778
+ output: {
779
+ id: string;
780
+ aud: string;
781
+ role: string;
782
+ email: string;
783
+ phone: string;
784
+ confirmed_at?: string | null | undefined;
785
+ email_confirmed_at?: string | null | undefined;
786
+ last_sign_in_at?: string | null | undefined;
787
+ app_metadata: {
788
+ [x: string]: hono_utils_types.JSONValue;
789
+ };
790
+ user_metadata: {
791
+ [x: string]: hono_utils_types.JSONValue;
792
+ };
793
+ identities: {
794
+ identity_id: string;
795
+ id: string;
796
+ user_id: string;
797
+ identity_data: {
798
+ [x: string]: hono_utils_types.JSONValue;
799
+ };
800
+ provider: string;
801
+ last_sign_in_at: string | null;
802
+ created_at: string;
803
+ updated_at: string;
804
+ email?: string | undefined;
805
+ }[];
806
+ created_at: string;
807
+ updated_at: string;
808
+ is_anonymous: boolean;
809
+ new_email?: string | undefined;
810
+ confirmation_sent_at?: string | null | undefined;
811
+ email_change_sent_at?: string | null | undefined;
812
+ recovery_sent_at?: string | null | undefined;
813
+ };
814
+ outputFormat: "json";
815
+ status: 200;
816
+ };
817
+ };
818
+ } & {
819
+ "/signup": {
820
+ $all: {
821
+ input: {};
822
+ output: {};
823
+ outputFormat: string;
824
+ status: hono_utils_http_status.StatusCode;
825
+ };
826
+ };
827
+ } & {
828
+ "/token": {
829
+ $post: {
830
+ input: {};
831
+ output: {
832
+ access_token: string;
833
+ refresh_token: string;
834
+ token_type: "bearer";
835
+ expires_in: number;
836
+ expires_at: number;
837
+ user: {
838
+ id: string;
839
+ aud: string;
840
+ role: string;
841
+ email: string;
842
+ phone: string;
843
+ confirmed_at?: string | null | undefined;
844
+ email_confirmed_at?: string | null | undefined;
845
+ last_sign_in_at?: string | null | undefined;
846
+ app_metadata: {
847
+ [x: string]: hono_utils_types.JSONValue;
848
+ };
849
+ user_metadata: {
850
+ [x: string]: hono_utils_types.JSONValue;
851
+ };
852
+ identities: {
853
+ identity_id: string;
854
+ id: string;
855
+ user_id: string;
856
+ identity_data: {
857
+ [x: string]: hono_utils_types.JSONValue;
858
+ };
859
+ provider: string;
860
+ last_sign_in_at: string | null;
861
+ created_at: string;
862
+ updated_at: string;
863
+ email?: string | undefined;
864
+ }[];
865
+ created_at: string;
866
+ updated_at: string;
867
+ is_anonymous: boolean;
868
+ new_email?: string | undefined;
869
+ confirmation_sent_at?: string | null | undefined;
870
+ email_change_sent_at?: string | null | undefined;
871
+ recovery_sent_at?: string | null | undefined;
872
+ };
873
+ weak_password?: null | undefined;
874
+ };
875
+ outputFormat: "json";
876
+ status: 200;
877
+ };
878
+ };
879
+ } & {
880
+ "/token": {
881
+ $all: {
882
+ input: {};
883
+ output: {};
884
+ outputFormat: string;
885
+ status: hono_utils_http_status.StatusCode;
886
+ };
887
+ };
888
+ } & {
889
+ "/otp": {
890
+ $post: {
891
+ input: {};
892
+ output: {};
893
+ outputFormat: "json";
894
+ status: 200;
895
+ };
896
+ };
897
+ } & {
898
+ "/magiclink": {
899
+ $post: {
900
+ input: {};
901
+ output: {};
902
+ outputFormat: "json";
903
+ status: 200;
904
+ };
905
+ };
906
+ } & {
907
+ "/magiclink": {
908
+ $all: {
909
+ input: {};
910
+ output: {};
911
+ outputFormat: string;
912
+ status: hono_utils_http_status.StatusCode;
913
+ };
914
+ };
915
+ } & {
916
+ "/verify": {
917
+ $post: {
918
+ input: {};
919
+ output: {
920
+ access_token: string;
921
+ refresh_token: string;
922
+ token_type: "bearer";
923
+ expires_in: number;
924
+ expires_at: number;
925
+ user: {
926
+ id: string;
927
+ aud: string;
928
+ role: string;
929
+ email: string;
930
+ phone: string;
931
+ confirmed_at?: string | null | undefined;
932
+ email_confirmed_at?: string | null | undefined;
933
+ last_sign_in_at?: string | null | undefined;
934
+ app_metadata: {
935
+ [x: string]: hono_utils_types.JSONValue;
936
+ };
937
+ user_metadata: {
938
+ [x: string]: hono_utils_types.JSONValue;
939
+ };
940
+ identities: {
941
+ identity_id: string;
942
+ id: string;
943
+ user_id: string;
944
+ identity_data: {
945
+ [x: string]: hono_utils_types.JSONValue;
946
+ };
947
+ provider: string;
948
+ last_sign_in_at: string | null;
949
+ created_at: string;
950
+ updated_at: string;
951
+ email?: string | undefined;
952
+ }[];
953
+ created_at: string;
954
+ updated_at: string;
955
+ is_anonymous: boolean;
956
+ new_email?: string | undefined;
957
+ confirmation_sent_at?: string | null | undefined;
958
+ email_change_sent_at?: string | null | undefined;
959
+ recovery_sent_at?: string | null | undefined;
960
+ };
961
+ weak_password?: null | undefined;
962
+ };
963
+ outputFormat: "json";
964
+ status: 200;
965
+ };
966
+ };
967
+ } & {
968
+ "/recover": {
969
+ $post: {
970
+ input: {};
971
+ output: {};
972
+ outputFormat: "json";
973
+ status: 200;
974
+ };
975
+ };
976
+ } & {
977
+ "/resend": {
978
+ $post: {
979
+ input: {};
980
+ output: {};
981
+ outputFormat: "json";
982
+ status: 200;
983
+ };
984
+ };
985
+ } & {
986
+ "/health": {
987
+ $get: {
988
+ input: {};
989
+ output: {
990
+ version: string;
991
+ name: string;
992
+ description: string;
993
+ };
994
+ outputFormat: "json";
995
+ status: 200;
996
+ };
997
+ };
998
+ } & {
999
+ "/health": {
1000
+ $all: {
1001
+ input: {};
1002
+ output: {};
1003
+ outputFormat: string;
1004
+ status: hono_utils_http_status.StatusCode;
1005
+ };
1006
+ };
1007
+ } & {
1008
+ "/settings": {
1009
+ $get: {
1010
+ input: {};
1011
+ output: {
1012
+ external: {
1013
+ anonymous_users: boolean;
1014
+ apple: boolean;
1015
+ azure: boolean;
1016
+ bitbucket: boolean;
1017
+ discord: boolean;
1018
+ facebook: boolean;
1019
+ snapchat: boolean;
1020
+ figma: boolean;
1021
+ fly: boolean;
1022
+ github: boolean;
1023
+ gitlab: boolean;
1024
+ google: boolean;
1025
+ keycloak: boolean;
1026
+ kakao: boolean;
1027
+ linkedin: boolean;
1028
+ linkedin_oidc: boolean;
1029
+ notion: boolean;
1030
+ spotify: boolean;
1031
+ slack: boolean;
1032
+ slack_oidc: boolean;
1033
+ workos: boolean;
1034
+ twitch: boolean;
1035
+ twitter: boolean;
1036
+ email: boolean;
1037
+ phone: boolean;
1038
+ zoom: boolean;
1039
+ };
1040
+ disable_signup: boolean;
1041
+ mailer_autoconfirm: boolean;
1042
+ phone_autoconfirm: boolean;
1043
+ sms_provider: string;
1044
+ saml_enabled: boolean;
1045
+ };
1046
+ outputFormat: "json";
1047
+ status: 200;
1048
+ };
1049
+ };
1050
+ } & {
1051
+ "/settings": {
1052
+ $all: {
1053
+ input: {};
1054
+ output: {};
1055
+ outputFormat: string;
1056
+ status: hono_utils_http_status.StatusCode;
1057
+ };
1058
+ };
1059
+ } & {
1060
+ "/.well-known/jwks.json": {
1061
+ $get: {
1062
+ input: {};
1063
+ output: never;
1064
+ outputFormat: "json";
1065
+ status: 200;
1066
+ };
1067
+ };
1068
+ } & {
1069
+ "/.well-known/openid-configuration": {
1070
+ $get: {
1071
+ input: {};
1072
+ output: {
1073
+ issuer: string;
1074
+ jwks_uri: string;
1075
+ };
1076
+ outputFormat: "json";
1077
+ status: 200;
1078
+ };
1079
+ };
1080
+ } & {
1081
+ "/nonexistent": {
1082
+ $all: {
1083
+ input: {};
1084
+ output: {};
1085
+ outputFormat: string;
1086
+ status: hono_utils_http_status.StatusCode;
1087
+ };
1088
+ };
1089
+ } & {
1090
+ "/logout": {
1091
+ $post: {
1092
+ input: {};
1093
+ output: null;
1094
+ outputFormat: "body";
1095
+ status: 204;
1096
+ };
1097
+ };
1098
+ } & {
1099
+ "/user": {
1100
+ $get: {
1101
+ input: {};
1102
+ output: {
1103
+ id: string;
1104
+ aud: string;
1105
+ role: string;
1106
+ email: string;
1107
+ phone: string;
1108
+ confirmed_at?: string | null | undefined;
1109
+ email_confirmed_at?: string | null | undefined;
1110
+ last_sign_in_at?: string | null | undefined;
1111
+ app_metadata: {
1112
+ [x: string]: hono_utils_types.JSONValue;
1113
+ };
1114
+ user_metadata: {
1115
+ [x: string]: hono_utils_types.JSONValue;
1116
+ };
1117
+ identities: {
1118
+ identity_id: string;
1119
+ id: string;
1120
+ user_id: string;
1121
+ identity_data: {
1122
+ [x: string]: hono_utils_types.JSONValue;
1123
+ };
1124
+ provider: string;
1125
+ last_sign_in_at: string | null;
1126
+ created_at: string;
1127
+ updated_at: string;
1128
+ email?: string | undefined;
1129
+ }[];
1130
+ created_at: string;
1131
+ updated_at: string;
1132
+ is_anonymous: boolean;
1133
+ new_email?: string | undefined;
1134
+ confirmation_sent_at?: string | null | undefined;
1135
+ email_change_sent_at?: string | null | undefined;
1136
+ recovery_sent_at?: string | null | undefined;
1137
+ };
1138
+ outputFormat: "json";
1139
+ status: 200;
1140
+ };
1141
+ };
1142
+ } & {
1143
+ "/user": {
1144
+ $put: {
1145
+ input: {};
1146
+ output: {
1147
+ id: string;
1148
+ aud: string;
1149
+ role: string;
1150
+ email: string;
1151
+ phone: string;
1152
+ confirmed_at?: string | null | undefined;
1153
+ email_confirmed_at?: string | null | undefined;
1154
+ last_sign_in_at?: string | null | undefined;
1155
+ app_metadata: {
1156
+ [x: string]: hono_utils_types.JSONValue;
1157
+ };
1158
+ user_metadata: {
1159
+ [x: string]: hono_utils_types.JSONValue;
1160
+ };
1161
+ identities: {
1162
+ identity_id: string;
1163
+ id: string;
1164
+ user_id: string;
1165
+ identity_data: {
1166
+ [x: string]: hono_utils_types.JSONValue;
1167
+ };
1168
+ provider: string;
1169
+ last_sign_in_at: string | null;
1170
+ created_at: string;
1171
+ updated_at: string;
1172
+ email?: string | undefined;
1173
+ }[];
1174
+ created_at: string;
1175
+ updated_at: string;
1176
+ is_anonymous: boolean;
1177
+ new_email?: string | undefined;
1178
+ confirmation_sent_at?: string | null | undefined;
1179
+ email_change_sent_at?: string | null | undefined;
1180
+ recovery_sent_at?: string | null | undefined;
1181
+ };
1182
+ outputFormat: "json";
1183
+ status: 200;
1184
+ };
1185
+ };
1186
+ } & {
1187
+ "/user": {
1188
+ $all: {
1189
+ input: {};
1190
+ output: {};
1191
+ outputFormat: string;
1192
+ status: hono_utils_http_status.StatusCode;
1193
+ };
1194
+ };
1195
+ } & {
1196
+ "/reauthenticate": {
1197
+ $get: {
1198
+ input: {};
1199
+ output: {};
1200
+ outputFormat: "json";
1201
+ status: 200;
1202
+ };
1203
+ };
1204
+ } & {
1205
+ "/reauthenticate": {
1206
+ $all: {
1207
+ input: {};
1208
+ output: {};
1209
+ outputFormat: string;
1210
+ status: hono_utils_http_status.StatusCode;
1211
+ };
1212
+ };
1213
+ }, "/auth/v1"> | hono_types.MergeSchemaPath<{
1214
+ "/:relation": {
1215
+ $all: {
1216
+ input: {
1217
+ param: {
1218
+ relation: string;
1219
+ };
1220
+ };
1221
+ output: {};
1222
+ outputFormat: string;
1223
+ status: hono_utils_http_status.StatusCode;
1224
+ };
1225
+ };
1226
+ } & {
1227
+ "*": {
1228
+ $all: {
1229
+ input: {};
1230
+ output: {};
1231
+ outputFormat: string;
1232
+ status: hono_utils_http_status.StatusCode;
1233
+ };
1234
+ };
1235
+ }, "/rest/v1"> | hono_types.MergeSchemaPath<hono_types.BlankSchema | hono_types.MergeSchemaPath<{
1236
+ "/object/public/:bucketId/*": {
1237
+ $get: {
1238
+ input: {
1239
+ param: {
1240
+ bucketId: string;
1241
+ };
1242
+ };
1243
+ output: {};
1244
+ outputFormat: string;
1245
+ status: hono_utils_http_status.StatusCode;
1246
+ };
1247
+ };
1248
+ } & {
1249
+ "/object/sign/:bucketId/*": {
1250
+ $get: {
1251
+ input: {
1252
+ param: {
1253
+ bucketId: string;
1254
+ };
1255
+ };
1256
+ output: {};
1257
+ outputFormat: string;
1258
+ status: hono_utils_http_status.StatusCode;
1259
+ };
1260
+ };
1261
+ } & {
1262
+ "/object/upload/sign/:bucketId/*": {
1263
+ $put: {
1264
+ input: {
1265
+ param: {
1266
+ bucketId: string;
1267
+ };
1268
+ };
1269
+ output: {
1270
+ error: string;
1271
+ };
1272
+ outputFormat: "json";
1273
+ status: 400;
1274
+ } | {
1275
+ input: {
1276
+ param: {
1277
+ bucketId: string;
1278
+ };
1279
+ };
1280
+ output: {
1281
+ error: string;
1282
+ };
1283
+ outputFormat: "json";
1284
+ status: 403;
1285
+ } | {
1286
+ input: {
1287
+ param: {
1288
+ bucketId: string;
1289
+ };
1290
+ };
1291
+ output: {
1292
+ Key: string;
1293
+ };
1294
+ outputFormat: "json";
1295
+ status: 200;
1296
+ };
1297
+ };
1298
+ }, "/"> | hono_types.MergeSchemaPath<{
1299
+ "/bucket": {
1300
+ $post: {
1301
+ input: {
1302
+ json: {
1303
+ [x: string]: unknown;
1304
+ public?: boolean | undefined;
1305
+ file_size_limit?: number | undefined;
1306
+ allowed_mime_types?: string[] | undefined;
1307
+ id: string;
1308
+ name: string;
1309
+ };
1310
+ };
1311
+ output: {
1312
+ name: string;
1313
+ };
1314
+ outputFormat: "json";
1315
+ status: 200;
1316
+ };
1317
+ };
1318
+ } & {
1319
+ "/bucket": {
1320
+ $get: {
1321
+ input: {};
1322
+ output: {
1323
+ id: string;
1324
+ name: string;
1325
+ owner: string | null;
1326
+ owner_id: string | null;
1327
+ public: boolean;
1328
+ file_size_limit: number | null;
1329
+ allowed_mime_types: string[] | null;
1330
+ created_at: string;
1331
+ updated_at: string;
1332
+ }[];
1333
+ outputFormat: "json";
1334
+ status: 200;
1335
+ };
1336
+ };
1337
+ } & {
1338
+ "/bucket/:id": {
1339
+ $get: {
1340
+ input: {
1341
+ param: {
1342
+ id: string;
1343
+ };
1344
+ };
1345
+ output: {
1346
+ id: string;
1347
+ name: string;
1348
+ owner: string | null;
1349
+ owner_id: string | null;
1350
+ public: boolean;
1351
+ file_size_limit: number | null;
1352
+ allowed_mime_types: string[] | null;
1353
+ created_at: string;
1354
+ updated_at: string;
1355
+ };
1356
+ outputFormat: "json";
1357
+ status: 200;
1358
+ };
1359
+ };
1360
+ } & {
1361
+ "/bucket/:id": {
1362
+ $put: {
1363
+ input: {
1364
+ json: {
1365
+ [x: string]: unknown;
1366
+ public?: boolean | undefined;
1367
+ file_size_limit?: number | undefined;
1368
+ allowed_mime_types?: string[] | undefined;
1369
+ };
1370
+ } & {
1371
+ param: {
1372
+ id: string;
1373
+ };
1374
+ };
1375
+ output: {
1376
+ message: string;
1377
+ };
1378
+ outputFormat: "json";
1379
+ status: 200;
1380
+ };
1381
+ };
1382
+ } & {
1383
+ "/bucket/:id": {
1384
+ $delete: {
1385
+ input: {
1386
+ param: {
1387
+ id: string;
1388
+ };
1389
+ };
1390
+ output: {
1391
+ message: string;
1392
+ };
1393
+ outputFormat: "json";
1394
+ status: 200;
1395
+ };
1396
+ };
1397
+ } & {
1398
+ "/bucket/:id/empty": {
1399
+ $post: {
1400
+ input: {
1401
+ param: {
1402
+ id: string;
1403
+ };
1404
+ };
1405
+ output: {
1406
+ message: string;
1407
+ };
1408
+ outputFormat: "json";
1409
+ status: 200;
1410
+ };
1411
+ };
1412
+ } & {
1413
+ "/object/list/:bucketId": {
1414
+ $post: {
1415
+ input: {
1416
+ json: {
1417
+ [x: string]: unknown;
1418
+ search?: string | undefined;
1419
+ sortBy?: {
1420
+ [x: string]: unknown;
1421
+ column: string;
1422
+ order: string;
1423
+ } | undefined;
1424
+ limit?: number | undefined;
1425
+ offset?: number | undefined;
1426
+ prefix?: string | undefined;
1427
+ };
1428
+ } & {
1429
+ param: {
1430
+ bucketId: string;
1431
+ };
1432
+ };
1433
+ output: {
1434
+ id: string;
1435
+ bucket_id: string;
1436
+ name: string;
1437
+ owner: string | null;
1438
+ owner_id: string | null;
1439
+ metadata: {
1440
+ [x: string]: hono_utils_types.JSONValue;
1441
+ };
1442
+ user_metadata: {
1443
+ [x: string]: hono_utils_types.JSONValue;
1444
+ };
1445
+ path_tokens: string[];
1446
+ version: string | null;
1447
+ created_at: string;
1448
+ updated_at: string;
1449
+ last_accessed_at: string;
1450
+ }[];
1451
+ outputFormat: "json";
1452
+ status: 200;
1453
+ };
1454
+ };
1455
+ } & {
1456
+ "/object/move": {
1457
+ $post: {
1458
+ input: {
1459
+ json: {
1460
+ [x: string]: unknown;
1461
+ bucketId: string;
1462
+ sourceKey: string;
1463
+ destinationKey: string;
1464
+ };
1465
+ };
1466
+ output: {
1467
+ message: string;
1468
+ };
1469
+ outputFormat: "json";
1470
+ status: 200;
1471
+ };
1472
+ };
1473
+ } & {
1474
+ "/object/copy": {
1475
+ $post: {
1476
+ input: {
1477
+ json: {
1478
+ [x: string]: unknown;
1479
+ bucketId: string;
1480
+ sourceKey: string;
1481
+ destinationKey: string;
1482
+ };
1483
+ };
1484
+ output: {
1485
+ key: string;
1486
+ };
1487
+ outputFormat: "json";
1488
+ status: 200;
1489
+ };
1490
+ };
1491
+ } & {
1492
+ "/object/info/:bucketId/*": {
1493
+ $get: {
1494
+ input: {
1495
+ param: {
1496
+ bucketId: string;
1497
+ };
1498
+ };
1499
+ output: {
1500
+ id: string;
1501
+ bucket_id: string;
1502
+ name: string;
1503
+ owner: string | null;
1504
+ owner_id: string | null;
1505
+ metadata: {
1506
+ [x: string]: hono_utils_types.JSONValue;
1507
+ };
1508
+ user_metadata: {
1509
+ [x: string]: hono_utils_types.JSONValue;
1510
+ };
1511
+ path_tokens: string[];
1512
+ version: string | null;
1513
+ created_at: string;
1514
+ updated_at: string;
1515
+ last_accessed_at: string;
1516
+ httpMetadata: {
1517
+ cacheControl: string;
1518
+ contentLength: number;
1519
+ size: number;
1520
+ mimetype: string;
1521
+ lastModified?: string | undefined;
1522
+ eTag: string;
1523
+ contentRange?: string | undefined;
1524
+ httpStatusCode?: number | undefined;
1525
+ };
1526
+ };
1527
+ outputFormat: "json";
1528
+ status: 200;
1529
+ };
1530
+ };
1531
+ } & {
1532
+ "/object/sign/:bucketId/*": {
1533
+ $post: {
1534
+ input: {
1535
+ json: {
1536
+ [x: string]: unknown;
1537
+ expiresIn: number;
1538
+ };
1539
+ } & {
1540
+ param: {
1541
+ bucketId: string;
1542
+ };
1543
+ };
1544
+ output: {
1545
+ signedUrl: string;
1546
+ };
1547
+ outputFormat: "json";
1548
+ status: 200;
1549
+ };
1550
+ };
1551
+ } & {
1552
+ "/object/sign/:bucketId": {
1553
+ $post: {
1554
+ input: {
1555
+ json: {
1556
+ [x: string]: unknown;
1557
+ expiresIn: number;
1558
+ paths: string[];
1559
+ };
1560
+ } & {
1561
+ param: {
1562
+ bucketId: string;
1563
+ };
1564
+ };
1565
+ output: {
1566
+ path: string;
1567
+ signedUrl: string;
1568
+ error: string | null;
1569
+ }[];
1570
+ outputFormat: "json";
1571
+ status: 200;
1572
+ };
1573
+ };
1574
+ } & {
1575
+ "/object/upload/sign/:bucketId/*": {
1576
+ $post: {
1577
+ input: {
1578
+ param: {
1579
+ bucketId: string;
1580
+ };
1581
+ };
1582
+ output: {
1583
+ signedUrl: string;
1584
+ token: string;
1585
+ path: string;
1586
+ };
1587
+ outputFormat: "json";
1588
+ status: 200;
1589
+ };
1590
+ };
1591
+ } & {
1592
+ "/object/:bucketId": {
1593
+ $delete: {
1594
+ input: {
1595
+ json: {
1596
+ [x: string]: unknown;
1597
+ prefixes: string[];
1598
+ };
1599
+ } & {
1600
+ param: {
1601
+ bucketId: string;
1602
+ };
1603
+ };
1604
+ output: {
1605
+ id: string;
1606
+ bucket_id: string;
1607
+ name: string;
1608
+ owner: string | null;
1609
+ owner_id: string | null;
1610
+ metadata: {
1611
+ [x: string]: hono_utils_types.JSONValue;
1612
+ };
1613
+ user_metadata: {
1614
+ [x: string]: hono_utils_types.JSONValue;
1615
+ };
1616
+ path_tokens: string[];
1617
+ version: string | null;
1618
+ created_at: string;
1619
+ updated_at: string;
1620
+ last_accessed_at: string;
1621
+ }[];
1622
+ outputFormat: "json";
1623
+ status: 200;
1624
+ };
1625
+ };
1626
+ } & {
1627
+ "/object/:bucketId/*": {
1628
+ $post: {
1629
+ input: {
1630
+ param: {
1631
+ bucketId: string;
1632
+ };
1633
+ };
1634
+ output: {
1635
+ Key: string;
1636
+ Id: string;
1637
+ };
1638
+ outputFormat: "json";
1639
+ status: 200;
1640
+ };
1641
+ };
1642
+ } & {
1643
+ "/object/:bucketId/*": {
1644
+ $put: {
1645
+ input: {
1646
+ param: {
1647
+ bucketId: string;
1648
+ };
1649
+ };
1650
+ output: {
1651
+ Key: string;
1652
+ Id: string;
1653
+ };
1654
+ outputFormat: "json";
1655
+ status: 200;
1656
+ };
1657
+ };
1658
+ } & {
1659
+ "/object/:bucketId/*": {
1660
+ $get: {
1661
+ input: {
1662
+ param: {
1663
+ bucketId: string;
1664
+ };
1665
+ };
1666
+ output: {};
1667
+ outputFormat: string;
1668
+ status: hono_utils_http_status.StatusCode;
1669
+ };
1670
+ };
1671
+ } & {
1672
+ "/object/:bucketId/*": {
1673
+ $head: {
1674
+ input: {
1675
+ param: {
1676
+ bucketId: string;
1677
+ };
1678
+ };
1679
+ output: null;
1680
+ outputFormat: "body";
1681
+ status: 200;
1682
+ } | {
1683
+ input: {
1684
+ param: {
1685
+ bucketId: string;
1686
+ };
1687
+ };
1688
+ output: null;
1689
+ outputFormat: "body";
1690
+ status: 404;
1691
+ };
1692
+ };
1693
+ }, "/">, "/storage/v1"> | hono_types.MergeSchemaPath<{
1694
+ "/ping": {
1695
+ $get: {
1696
+ input: {};
1697
+ output: {
1698
+ message: string;
1699
+ };
1700
+ outputFormat: "json";
1701
+ status: hono_utils_http_status.ContentfulStatusCode;
1702
+ };
1703
+ };
1704
+ } & {
1705
+ "/config": {
1706
+ $get: {
1707
+ input: {};
1708
+ output: {
1709
+ analytics?: {
1710
+ enabled?: boolean | undefined;
1711
+ port?: number | undefined;
1712
+ vector_port?: number | undefined;
1713
+ backend?: "postgres" | "bigquery" | undefined;
1714
+ } | undefined;
1715
+ api?: {
1716
+ enabled?: boolean | undefined;
1717
+ port?: number | undefined;
1718
+ schemas?: string[] | undefined;
1719
+ extra_search_path?: string[] | undefined;
1720
+ max_rows?: number | undefined;
1721
+ pg_safe_update?: boolean | undefined;
1722
+ plan_enabled?: boolean | undefined;
1723
+ aggregates_enabled?: boolean | undefined;
1724
+ limited_mutations_enabled?: boolean | undefined;
1725
+ anonymous_enabled?: boolean | undefined;
1726
+ external_url?: string | undefined;
1727
+ tls?: {
1728
+ enabled?: boolean | undefined;
1729
+ } | undefined;
1730
+ } | undefined;
1731
+ storage?: {
1732
+ enabled?: boolean | undefined;
1733
+ file_size_limit?: string | undefined;
1734
+ buckets?: {
1735
+ [x: string]: {
1736
+ public?: boolean | undefined;
1737
+ file_size_limit?: string | undefined;
1738
+ allowed_mime_types?: string[] | undefined;
1739
+ objects_path?: string | undefined;
1740
+ };
1741
+ } | undefined;
1742
+ image_transformation?: {
1743
+ enabled?: boolean | undefined;
1744
+ } | undefined;
1745
+ } | undefined;
1746
+ auth?: {
1747
+ enabled?: boolean | undefined;
1748
+ enable_signup?: boolean | undefined;
1749
+ jwt_secret?: string | undefined;
1750
+ site_url?: string | undefined;
1751
+ additional_redirect_urls?: string[] | undefined;
1752
+ jwt_expiry?: number | undefined;
1753
+ enable_refresh_token_rotation?: boolean | undefined;
1754
+ refresh_token_reuse_interval?: number | undefined;
1755
+ enable_manual_linking?: boolean | undefined;
1756
+ enable_anonymous_sign_ins?: boolean | undefined;
1757
+ minimum_password_length?: number | undefined;
1758
+ password_requirements?: string | undefined;
1759
+ hook?: {
1760
+ mfa_verification_attempt?: {
1761
+ enabled?: boolean | undefined;
1762
+ uri?: string | undefined;
1763
+ secrets?: string[] | undefined;
1764
+ } | undefined;
1765
+ password_verification_attempt?: {
1766
+ enabled?: boolean | undefined;
1767
+ uri?: string | undefined;
1768
+ secrets?: string[] | undefined;
1769
+ } | undefined;
1770
+ custom_access_token?: {
1771
+ enabled?: boolean | undefined;
1772
+ uri?: string | undefined;
1773
+ secrets?: string[] | undefined;
1774
+ } | undefined;
1775
+ send_sms?: {
1776
+ enabled?: boolean | undefined;
1777
+ uri?: string | undefined;
1778
+ secrets?: string[] | undefined;
1779
+ } | undefined;
1780
+ send_email?: {
1781
+ enabled?: boolean | undefined;
1782
+ uri?: string | undefined;
1783
+ secrets?: string[] | undefined;
1784
+ } | undefined;
1785
+ } | undefined;
1786
+ mfa?: {
1787
+ max_enrolled_factors?: number | undefined;
1788
+ totp?: {
1789
+ enroll_enabled?: boolean | undefined;
1790
+ verify_enabled?: boolean | undefined;
1791
+ } | undefined;
1792
+ phone?: {
1793
+ template?: string | undefined;
1794
+ max_frequency?: string | undefined;
1795
+ otp_length?: number | undefined;
1796
+ enroll_enabled?: boolean | undefined;
1797
+ verify_enabled?: boolean | undefined;
1798
+ } | undefined;
1799
+ } | undefined;
1800
+ sessions?: {
1801
+ timebox?: string | undefined;
1802
+ inactivity_timeout?: string | undefined;
1803
+ single_per_user?: boolean | undefined;
1804
+ } | undefined;
1805
+ email?: {
1806
+ template?: {
1807
+ invite?: {
1808
+ subject?: string | undefined;
1809
+ content_path?: string | undefined;
1810
+ } | undefined;
1811
+ confirmation?: {
1812
+ subject?: string | undefined;
1813
+ content_path?: string | undefined;
1814
+ } | undefined;
1815
+ recovery?: {
1816
+ subject?: string | undefined;
1817
+ content_path?: string | undefined;
1818
+ } | undefined;
1819
+ magic_link?: {
1820
+ subject?: string | undefined;
1821
+ content_path?: string | undefined;
1822
+ } | undefined;
1823
+ email_change?: {
1824
+ subject?: string | undefined;
1825
+ content_path?: string | undefined;
1826
+ } | undefined;
1827
+ } | undefined;
1828
+ enable_signup?: boolean | undefined;
1829
+ double_confirm_changes?: boolean | undefined;
1830
+ enable_confirmations?: boolean | undefined;
1831
+ secure_password_change?: boolean | undefined;
1832
+ max_frequency?: string | undefined;
1833
+ otp_length?: number | undefined;
1834
+ otp_expiry?: number | undefined;
1835
+ smtp?: {
1836
+ port?: number | undefined;
1837
+ host?: string | undefined;
1838
+ user?: string | undefined;
1839
+ pass?: string | undefined;
1840
+ admin_email?: string | undefined;
1841
+ sender_name?: string | undefined;
1842
+ } | undefined;
1843
+ } | undefined;
1844
+ sms?: {
1845
+ template?: string | undefined;
1846
+ enable_signup?: boolean | undefined;
1847
+ enable_confirmations?: boolean | undefined;
1848
+ max_frequency?: string | undefined;
1849
+ test_otp?: {
1850
+ [x: string]: string;
1851
+ } | undefined;
1852
+ twilio?: {
1853
+ enabled?: boolean | undefined;
1854
+ account_sid?: string | undefined;
1855
+ message_service_sid?: string | undefined;
1856
+ auth_token?: string | undefined;
1857
+ } | undefined;
1858
+ twilio_verify?: {
1859
+ enabled?: boolean | undefined;
1860
+ account_sid?: string | undefined;
1861
+ message_service_sid?: string | undefined;
1862
+ auth_token?: string | undefined;
1863
+ } | undefined;
1864
+ messagebird?: {
1865
+ enabled?: boolean | undefined;
1866
+ originator?: string | undefined;
1867
+ api_key?: string | undefined;
1868
+ } | undefined;
1869
+ textlocal?: {
1870
+ enabled?: boolean | undefined;
1871
+ api_key?: string | undefined;
1872
+ sender?: string | undefined;
1873
+ } | undefined;
1874
+ vonage?: {
1875
+ enabled?: boolean | undefined;
1876
+ api_key?: string | undefined;
1877
+ from?: string | undefined;
1878
+ api_secret?: string | undefined;
1879
+ } | undefined;
1880
+ } | undefined;
1881
+ external?: {
1882
+ apple?: {
1883
+ enabled?: boolean | undefined;
1884
+ client_id?: string | undefined;
1885
+ secret?: string | undefined;
1886
+ url?: string | undefined;
1887
+ redirect_uri?: string | undefined;
1888
+ skip_nonce_check?: boolean | undefined;
1889
+ } | undefined;
1890
+ azure?: {
1891
+ enabled?: boolean | undefined;
1892
+ client_id?: string | undefined;
1893
+ secret?: string | undefined;
1894
+ url?: string | undefined;
1895
+ redirect_uri?: string | undefined;
1896
+ skip_nonce_check?: boolean | undefined;
1897
+ } | undefined;
1898
+ bitbucket?: {
1899
+ enabled?: boolean | undefined;
1900
+ client_id?: string | undefined;
1901
+ secret?: string | undefined;
1902
+ url?: string | undefined;
1903
+ redirect_uri?: string | undefined;
1904
+ skip_nonce_check?: boolean | undefined;
1905
+ } | undefined;
1906
+ discord?: {
1907
+ enabled?: boolean | undefined;
1908
+ client_id?: string | undefined;
1909
+ secret?: string | undefined;
1910
+ url?: string | undefined;
1911
+ redirect_uri?: string | undefined;
1912
+ skip_nonce_check?: boolean | undefined;
1913
+ } | undefined;
1914
+ facebook?: {
1915
+ enabled?: boolean | undefined;
1916
+ client_id?: string | undefined;
1917
+ secret?: string | undefined;
1918
+ url?: string | undefined;
1919
+ redirect_uri?: string | undefined;
1920
+ skip_nonce_check?: boolean | undefined;
1921
+ } | undefined;
1922
+ github?: {
1923
+ enabled?: boolean | undefined;
1924
+ client_id?: string | undefined;
1925
+ secret?: string | undefined;
1926
+ url?: string | undefined;
1927
+ redirect_uri?: string | undefined;
1928
+ skip_nonce_check?: boolean | undefined;
1929
+ } | undefined;
1930
+ gitlab?: {
1931
+ enabled?: boolean | undefined;
1932
+ client_id?: string | undefined;
1933
+ secret?: string | undefined;
1934
+ url?: string | undefined;
1935
+ redirect_uri?: string | undefined;
1936
+ skip_nonce_check?: boolean | undefined;
1937
+ } | undefined;
1938
+ google?: {
1939
+ enabled?: boolean | undefined;
1940
+ client_id?: string | undefined;
1941
+ secret?: string | undefined;
1942
+ url?: string | undefined;
1943
+ redirect_uri?: string | undefined;
1944
+ skip_nonce_check?: boolean | undefined;
1945
+ } | undefined;
1946
+ kakao?: {
1947
+ enabled?: boolean | undefined;
1948
+ client_id?: string | undefined;
1949
+ secret?: string | undefined;
1950
+ url?: string | undefined;
1951
+ redirect_uri?: string | undefined;
1952
+ skip_nonce_check?: boolean | undefined;
1953
+ } | undefined;
1954
+ keycloak?: {
1955
+ enabled?: boolean | undefined;
1956
+ client_id?: string | undefined;
1957
+ secret?: string | undefined;
1958
+ url?: string | undefined;
1959
+ redirect_uri?: string | undefined;
1960
+ skip_nonce_check?: boolean | undefined;
1961
+ } | undefined;
1962
+ linkedin?: {
1963
+ enabled?: boolean | undefined;
1964
+ client_id?: string | undefined;
1965
+ secret?: string | undefined;
1966
+ url?: string | undefined;
1967
+ redirect_uri?: string | undefined;
1968
+ skip_nonce_check?: boolean | undefined;
1969
+ } | undefined;
1970
+ notion?: {
1971
+ enabled?: boolean | undefined;
1972
+ client_id?: string | undefined;
1973
+ secret?: string | undefined;
1974
+ url?: string | undefined;
1975
+ redirect_uri?: string | undefined;
1976
+ skip_nonce_check?: boolean | undefined;
1977
+ } | undefined;
1978
+ twitch?: {
1979
+ enabled?: boolean | undefined;
1980
+ client_id?: string | undefined;
1981
+ secret?: string | undefined;
1982
+ url?: string | undefined;
1983
+ redirect_uri?: string | undefined;
1984
+ skip_nonce_check?: boolean | undefined;
1985
+ } | undefined;
1986
+ twitter?: {
1987
+ enabled?: boolean | undefined;
1988
+ client_id?: string | undefined;
1989
+ secret?: string | undefined;
1990
+ url?: string | undefined;
1991
+ redirect_uri?: string | undefined;
1992
+ skip_nonce_check?: boolean | undefined;
1993
+ } | undefined;
1994
+ slack?: {
1995
+ enabled?: boolean | undefined;
1996
+ client_id?: string | undefined;
1997
+ secret?: string | undefined;
1998
+ url?: string | undefined;
1999
+ redirect_uri?: string | undefined;
2000
+ skip_nonce_check?: boolean | undefined;
2001
+ } | undefined;
2002
+ spotify?: {
2003
+ enabled?: boolean | undefined;
2004
+ client_id?: string | undefined;
2005
+ secret?: string | undefined;
2006
+ url?: string | undefined;
2007
+ redirect_uri?: string | undefined;
2008
+ skip_nonce_check?: boolean | undefined;
2009
+ } | undefined;
2010
+ workos?: {
2011
+ enabled?: boolean | undefined;
2012
+ client_id?: string | undefined;
2013
+ secret?: string | undefined;
2014
+ url?: string | undefined;
2015
+ redirect_uri?: string | undefined;
2016
+ skip_nonce_check?: boolean | undefined;
2017
+ } | undefined;
2018
+ zoom?: {
2019
+ enabled?: boolean | undefined;
2020
+ client_id?: string | undefined;
2021
+ secret?: string | undefined;
2022
+ url?: string | undefined;
2023
+ redirect_uri?: string | undefined;
2024
+ skip_nonce_check?: boolean | undefined;
2025
+ } | undefined;
2026
+ } | undefined;
2027
+ } | undefined;
2028
+ inbucket?: {
2029
+ enabled?: boolean | undefined;
2030
+ port?: number | undefined;
2031
+ smtp_port?: number | undefined;
2032
+ pop3_port?: number | undefined;
2033
+ } | undefined;
2034
+ experimental?: {
2035
+ orioledb_version?: string | undefined;
2036
+ s3_host?: string | undefined;
2037
+ s3_region?: string | undefined;
2038
+ s3_access_key?: string | undefined;
2039
+ s3_secret_key?: string | undefined;
2040
+ } | undefined;
2041
+ functions?: {
2042
+ [x: string]: {
2043
+ enabled?: boolean | undefined;
2044
+ verify_jwt?: boolean | undefined;
2045
+ import_map?: string | undefined;
2046
+ entrypoint?: string | undefined;
2047
+ };
2048
+ } | undefined;
2049
+ realtime?: {
2050
+ enabled?: boolean | undefined;
2051
+ ip_version?: string | undefined;
2052
+ max_header_length?: number | undefined;
2053
+ } | undefined;
2054
+ studio?: {
2055
+ enabled?: boolean | undefined;
2056
+ port?: number | undefined;
2057
+ api_url?: string | undefined;
2058
+ openai_api_key?: string | undefined;
2059
+ } | undefined;
2060
+ project_id?: string | undefined;
2061
+ db?: {
2062
+ [x: string]: hono_utils_types.JSONValue;
2063
+ port?: number | undefined;
2064
+ url?: string | undefined;
2065
+ driver?: "postgres" | "sqlite" | "sqlite-postgres" | "pglite" | undefined;
2066
+ shadow_port?: number | undefined;
2067
+ major_version?: number | undefined;
2068
+ pooler?: {
2069
+ [x: string]: hono_utils_types.JSONValue;
2070
+ enabled?: boolean | undefined;
2071
+ port?: number | undefined;
2072
+ pool_mode?: string | undefined;
2073
+ default_pool_size?: number | undefined;
2074
+ max_client_conn?: number | undefined;
2075
+ } | undefined;
2076
+ seed?: {
2077
+ enabled?: boolean | undefined;
2078
+ sql_paths?: string[] | undefined;
2079
+ } | undefined;
2080
+ migrations?: {
2081
+ enabled?: boolean | undefined;
2082
+ schema_paths?: string[] | undefined;
2083
+ } | undefined;
2084
+ } | undefined;
2085
+ edge_runtime?: {
2086
+ enabled?: boolean | undefined;
2087
+ policy?: "oneshot" | "per_worker" | undefined;
2088
+ inspector_port?: number | undefined;
2089
+ } | undefined;
2090
+ options?: {
2091
+ defaults?: true | undefined;
2092
+ server?: {
2093
+ middlewares?: never[] | undefined;
2094
+ disableStudio?: boolean | undefined;
2095
+ disableFallback?: boolean | undefined;
2096
+ forceRollback?: boolean | undefined;
2097
+ } | undefined;
2098
+ drivers?: {
2099
+ email?: {
2100
+ send: never;
2101
+ } | undefined;
2102
+ sms?: {
2103
+ send: never;
2104
+ } | undefined;
2105
+ cache?: {
2106
+ get: never;
2107
+ set: never;
2108
+ delete: never;
2109
+ } | undefined;
2110
+ } | undefined;
2111
+ } | undefined;
2112
+ rls?: {
2113
+ tables: string[];
2114
+ policies: {
2115
+ name: string;
2116
+ table: string;
2117
+ schema?: string | undefined;
2118
+ command: PolicyCommand;
2119
+ permissive: boolean;
2120
+ roles: PolicyRole[];
2121
+ using?: {
2122
+ [x: string]: hono_utils_types.JSONValue;
2123
+ } | undefined;
2124
+ withCheck?: {
2125
+ [x: string]: hono_utils_types.JSONValue;
2126
+ } | undefined;
2127
+ }[];
2128
+ } | undefined;
2129
+ };
2130
+ outputFormat: "json";
2131
+ status: hono_utils_http_status.ContentfulStatusCode;
2132
+ };
2133
+ };
2134
+ } & {
2135
+ "/info": {
2136
+ $get: {
2137
+ input: {};
2138
+ output: {};
2139
+ outputFormat: "json";
2140
+ status: hono_utils_http_status.ContentfulStatusCode;
2141
+ };
2142
+ };
2143
+ } & {
2144
+ "/introspect": {
2145
+ $get: {
2146
+ input: {};
2147
+ output: {
2148
+ tables: {
2149
+ name: string;
2150
+ sql: string;
2151
+ schema: string;
2152
+ type: "table" | "view";
2153
+ rows: number;
2154
+ engine: string;
2155
+ collation: string;
2156
+ }[];
2157
+ columns: {
2158
+ table: string;
2159
+ name: string;
2160
+ type: string;
2161
+ nullable: boolean;
2162
+ default_value: string | null;
2163
+ is_primary_key: boolean;
2164
+ schema: string;
2165
+ ordinal_position: number;
2166
+ collation: string;
2167
+ character_maximum_length: string | null;
2168
+ precision: {
2169
+ precision: number | null;
2170
+ scale: number | null;
2171
+ } | null;
2172
+ is_identity: boolean;
2173
+ pg_type?: string | undefined;
2174
+ is_generated?: boolean | undefined;
2175
+ }[];
2176
+ indexes: {
2177
+ table: string;
2178
+ name: string;
2179
+ unique: boolean;
2180
+ columns: string[];
2181
+ schema: string;
2182
+ }[];
2183
+ foreign_keys: {
2184
+ table: string;
2185
+ column: string;
2186
+ ref_table: string;
2187
+ ref_column: string;
2188
+ on_update: string;
2189
+ on_delete: string;
2190
+ schema: string;
2191
+ ref_schema?: string | undefined;
2192
+ foreign_key_name: string;
2193
+ fk_def: string;
2194
+ is_visible?: boolean | undefined;
2195
+ }[];
2196
+ primary_keys: {
2197
+ table: string;
2198
+ columns: string[];
2199
+ schema: string;
2200
+ field_count: number;
2201
+ }[];
2202
+ views: {
2203
+ name: string;
2204
+ sql: string;
2205
+ schema: string;
2206
+ }[];
2207
+ check_constraints: {
2208
+ schema: string;
2209
+ table: string;
2210
+ expression: string;
2211
+ name?: string | undefined;
2212
+ column?: string | undefined;
2213
+ }[];
2214
+ unique_constraints: {
2215
+ schema: string;
2216
+ table: string;
2217
+ name: string;
2218
+ columns: string[];
2219
+ }[];
2220
+ comments: {
2221
+ schema: string;
2222
+ table: string;
2223
+ column?: string | undefined;
2224
+ text: string;
2225
+ }[];
2226
+ custom_types: {
2227
+ schema: string;
2228
+ type: string;
2229
+ kind: "enum" | "composite";
2230
+ values?: string[] | undefined;
2231
+ fields?: {
2232
+ name: string;
2233
+ type: string;
2234
+ }[] | undefined;
2235
+ }[];
2236
+ triggers: {
2237
+ table: string;
2238
+ name: string;
2239
+ sql: string;
2240
+ schema: string;
2241
+ }[];
2242
+ database_name: string;
2243
+ version: string;
2244
+ ddl_dialect?: "postgres" | "sqlite" | undefined;
2245
+ schema_separator?: string | undefined;
2246
+ };
2247
+ outputFormat: "json";
2248
+ status: hono_utils_http_status.ContentfulStatusCode;
2249
+ };
2250
+ };
2251
+ }, "/_system">, "/", "*">;
2252
+
2253
+ interface IAppConfig extends DefaultSchema {
2254
+ connection: Connection | Promise<Connection>;
2255
+ rls?: {
2256
+ tables: string[];
2257
+ policies: Policy[];
2258
+ };
2259
+ options?: {
2260
+ /**
2261
+ * Disable default config values from being applied.
2262
+ */
2263
+ defaults?: boolean;
2264
+ server?: ServerOptions;
2265
+ drivers?: PartialAppDrivers;
2266
+ };
2267
+ }
2268
+ interface DefaultAppConfig extends IAppConfig {
2269
+ connection: Connection;
2270
+ options?: {
2271
+ defaults?: true;
2272
+ server?: ServerOptions;
2273
+ drivers?: PartialAppDrivers;
2274
+ };
2275
+ }
2276
+ declare class App<Config extends IAppConfig = DefaultAppConfig, Conn = Config extends IAppConfig ? Config["connection"] extends Connection ? Config["connection"] : Config["connection"] extends Promise<Connection> ? Awaited<Config["connection"]> : Connection : never> {
2277
+ #private;
2278
+ private readonly _connection;
2279
+ private readonly _rls;
2280
+ readonly config: DefaultSchema & Omit<Config, "connection">;
2281
+ readonly server: ReturnType<typeof createServer>;
2282
+ readonly drivers: AppDrivers;
2283
+ _mailer?: Mailer;
2284
+ _storageAdapter?: StorageAdapter;
2285
+ _transformationAdapter?: TransformationAdapter;
2286
+ constructor({ connection, options, rls, ...config }: Config);
2287
+ get connection(): Conn;
2288
+ /**
2289
+ * Initialize the app. This is called automatically on first request.
2290
+ */
2291
+ init(): Promise<this>;
2292
+ isValidConfig(config: Schema | DefaultSchema | IAppConfig): boolean;
2293
+ getClient<SchemaName extends string = "public">(options?: SupabaseClientOptions<SchemaName>): _supabase_supabase_js.SupabaseClient<any, "public", SchemaName, Omit<any, "__InternalSupabase">[SchemaName] extends {
2294
+ Tables: Record<string, {
2295
+ Row: Record<string, unknown>;
2296
+ Insert: Record<string, unknown>;
2297
+ Update: Record<string, unknown>;
2298
+ Relationships: {
2299
+ foreignKeyName: string;
2300
+ columns: string[];
2301
+ isOneToOne?: boolean;
2302
+ referencedRelation: string;
2303
+ referencedColumns: string[];
2304
+ }[];
2305
+ }>;
2306
+ Views: Record<string, {
2307
+ Row: Record<string, unknown>;
2308
+ Insert: Record<string, unknown>;
2309
+ Update: Record<string, unknown>;
2310
+ Relationships: {
2311
+ foreignKeyName: string;
2312
+ columns: string[];
2313
+ isOneToOne?: boolean;
2314
+ referencedRelation: string;
2315
+ referencedColumns: string[];
2316
+ }[];
2317
+ } | {
2318
+ Row: Record<string, unknown>;
2319
+ Relationships: {
2320
+ foreignKeyName: string;
2321
+ columns: string[];
2322
+ isOneToOne?: boolean;
2323
+ referencedRelation: string;
2324
+ referencedColumns: string[];
2325
+ }[];
2326
+ }>;
2327
+ Functions: Record<string, {
2328
+ Args: Record<string, unknown> | never;
2329
+ Returns: unknown;
2330
+ SetofOptions?: {
2331
+ isSetofReturn?: boolean | undefined;
2332
+ isOneToOne?: boolean | undefined;
2333
+ isNotNullable?: boolean | undefined;
2334
+ to: string;
2335
+ from: string;
2336
+ };
2337
+ }>;
2338
+ } ? Omit<any, "__InternalSupabase">[SchemaName] : never, any>;
2339
+ isLocalRequest(request: Request): boolean;
2340
+ fetch: (request: Request) => Promise<Response>;
2341
+ getInfoJson(): {
2342
+ connection: object;
2343
+ config: Config;
2344
+ };
2345
+ }
2346
+
2347
+ declare class UnableToCreateRuntimeConnection extends Error {
2348
+ name: string;
2349
+ constructor(message: string);
2350
+ }
2351
+ declare class InvalidPostgresToSQLiteTranslation extends Error {
2352
+ readonly pgSql: string;
2353
+ readonly sqliteDdl: string;
2354
+ readonly cause: Error | unknown;
2355
+ name: string;
2356
+ constructor(pgSql: string, sqliteDdl: string, cause: Error | unknown);
2357
+ }
2358
+
2359
+ type Primitive = string | number | boolean;
2360
+ declare function isPrimitive(value: any): value is Primitive;
2361
+ type BooleanLike = boolean | 0 | 1;
2362
+ declare function isBooleanLike(value: any): value is boolean;
2363
+ declare function isString(value: any): value is string;
2364
+
2365
+ declare function pipe<Arg = any>(...fns: ((a: Arg) => Arg)[]): (arg: Arg) => Arg;
2366
+ declare function pipeEach<Arg = any>(...fns: ((a: Arg) => Arg)[]): (args: Arg[]) => Arg[];
2367
+
2368
+ declare function isPlainObject(value: unknown): value is Record<string, unknown>;
2369
+ declare function isObject(value: unknown): value is Record<string, unknown>;
2370
+ declare function objectDiff(obj1: Record<string, any>, obj2: Record<string, any>): Record<string, any>;
2371
+ declare function getPath(object: object, _path: string | (string | number)[], defaultValue?: any): any;
2372
+ declare function setPath(object: object, _path: string | (string | number)[], value: any): object;
2373
+ declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
2374
+ declare function omit<T extends object, K extends keyof T>(obj: T, keys_: readonly K[] | K[] | string[]): Omit<T, Extract<K, keyof T>>;
2375
+ /**
2376
+ * Lodash's merge implementation caused issues in Next.js environments
2377
+ * From: https://thescottyjam.github.io/snap.js/#!/nolodash/merge
2378
+ * NOTE: This mutates `object`. It also may mutate anything that gets attached to `object` during the merge.
2379
+ * @param object
2380
+ * @param sources
2381
+ */
2382
+ declare function mergeObject(object: object, ...sources: object[]): object;
2383
+ /**
2384
+ * Lodash's mergeWith implementation caused issues in Next.js environments
2385
+ * From: https://thescottyjam.github.io/snap.js/#!/nolodash/mergeWith
2386
+ * NOTE: This mutates `object`. It also may mutate anything that gets attached to `object` during the merge.
2387
+ * @param object
2388
+ * @param sources
2389
+ * @param customizer
2390
+ */
2391
+ declare function mergeObjectWith(object: object, source: object, customizer: any): object;
2392
+ declare function isEqual(value1: any, value2: any): boolean;
2393
+ declare function jsonStringify(...args: Parameters<typeof JSON.stringify>): string;
2394
+
2395
+ declare function params(reqOrSearchParams: Request | URLSearchParams): Record<string, string>;
2396
+ declare function filterSearchParams(reqOrSearchParams: Request | URLSearchParams, predicate: (key: string, value: string) => boolean): Record<string, string>;
2397
+
2398
+ declare function isNode(): boolean;
2399
+ declare function isBun(): boolean;
2400
+ declare function invariant(condition: boolean | any, message: string): void;
2401
+ declare function threw(fn: () => any, instance?: new (...args: any[]) => Error): boolean;
2402
+ declare function threwAsync(fn: Promise<any>, instance?: new (...args: any[]) => Error): Promise<boolean>;
2403
+ declare function trySync<A = unknown, F = unknown>(fn: () => A, fallback?: F): A | F;
2404
+ declare function measureTime(fn: () => MaybePromise<void>, callback: (time: number) => void): Promise<void>;
2405
+ declare const ensureVar: {
2406
+ Map: (value: unknown) => Map<any, any>;
2407
+ Set: (value: unknown) => Set<any>;
2408
+ Array: (value: unknown) => any[];
2409
+ };
2410
+
2411
+ declare function cleanSql(sql: string, opts?: {
2412
+ comments?: string;
2413
+ }): string;
2414
+ declare function getStatementsArray(sql: string, clean?: boolean): string[];
2415
+ declare function splitSqlStatements(sql: string): string[];
2416
+ declare function normalizeType(t: string): string;
2417
+ declare function normalizeSql(sql: string): string;
2418
+ declare function normalizeDefault(d: string | null): string | null;
2419
+
2420
+ declare function randomString(length?: number, opts?: {
2421
+ uppercase?: boolean;
2422
+ numbers?: boolean;
2423
+ special?: boolean;
2424
+ }): string;
2425
+ declare function isEmail(email: unknown, opts?: {
2426
+ domains?: string[];
2427
+ panic?: boolean;
2428
+ }): boolean;
2429
+ declare function checkPasswordStrength(password: unknown, { panic, length, numbers, special, }?: {
2430
+ panic?: boolean;
2431
+ length?: number;
2432
+ numbers?: number;
2433
+ special?: number;
2434
+ }): boolean;
2435
+ declare function ucFirst(str: string): string;
2436
+ declare function ucFirstAll(str: string, split?: string): string;
2437
+ /**
2438
+ * Convert a string from snake_case to PascalCase with spaces
2439
+ * Example: `snake_to_pascal` -> `Snake To Pascal`
2440
+ *
2441
+ * @param str
2442
+ */
2443
+ declare function snakeToPascalWithSpaces(str: string): string;
2444
+ declare function normalizeString(str: string): string;
2445
+ declare function slugify(str: string): string;
2446
+ declare function truncate(str: string, length?: number, end?: string): string;
2447
+ declare function quote(str: string, quoteChar?: string): string;
2448
+ type MatchPattern = RegExp | string;
2449
+ /**
2450
+ * Match a string against a pattern:
2451
+ * - string: uses `String.includes`
2452
+ * - SQL like string: replaces `%` with `.*` and `_` with `.` and uses `new RegExp(pattern)`
2453
+ * - regex string: uses `new RegExp(pattern)`
2454
+ * - regex object: uses `pattern.test`
2455
+ */
2456
+ declare function patternMatch(target: string, pattern: MatchPattern): boolean;
2457
+ declare function patternMatch(target: string, pattern: MatchPattern, stringHint: "regex" | "sql" | "wildcard"): boolean;
2458
+ /**
2459
+ * Replace placeholders in a string. Mustache `{{var}}` by default
2460
+ *
2461
+ * @param str
2462
+ * @param vars
2463
+ * @param pattern
2464
+ */
2465
+ declare function replacePlaceholders(str: string, vars: Record<string, any>, pattern?: RegExp): string;
2466
+ /**
2467
+ * Fuzzy match using cosine similarity on character bigram vectors,
2468
+ * re-scored with normalized Levenshtein distance (matching PostgREST's fuzzyset approach).
2469
+ * Returns the best match above `minScore`, or null.
2470
+ */
2471
+ declare function fuzzyMatch(input: string, candidates: string[], minScore?: number): string | null;
2472
+
2473
+ declare function parseBigInt(value: BigInt | number): number;
2474
+
2475
+ declare function uuid(): string;
2476
+
2477
+ declare function getAuthSchemaSql(clean?: boolean): string;
2478
+
2479
+ type HonoContextWithAuth = HonoContext & {
2480
+ Variables: {
2481
+ userId: string;
2482
+ sessionId: string;
2483
+ jwt: Record<string, unknown>;
2484
+ };
2485
+ };
2486
+ declare const resolveAuth: ({ onError, }?: {
2487
+ onError?: (error: unknown, c: Context<HonoContextWithAuth>) => Response | Promise<Response>;
2488
+ }) => hono.MiddlewareHandler<HonoContextWithAuth, string, {}, Response>;
2489
+ declare const requireAuth: () => hono.MiddlewareHandler<HonoContextWithAuth, string, {}, Response>;
2490
+
2491
+ declare function studioRouteHandler(request: Request): Promise<Response>;
2492
+
2493
+ type ExperimentalFeature = "storage" | "cloud";
2494
+ declare function isExperimentalEnabled(name: ExperimentalFeature): boolean;
2495
+ declare function setExperimental(name: ExperimentalFeature, enabled: boolean): void;
2496
+ declare function listEnabledExperimentals(): ExperimentalFeature[];
2497
+
2498
+ export { App, type AppDrivers, AwsSesEmailDriver, type AwsSesEmailDriverOptions, type BooleanLike, CacheDriver, CacheSetOptions, CloudflareKvCacheDriver, type CloudflareKvCacheDriverOptions, type DefaultAppConfig, type EmailDriver, type EmailMessage, type ExperimentalFeature, type HonoContext, type IAppConfig, InMemoryEmailDriver, type InMemoryEmailDriverOptions, InMemoryLruCacheDriver, type InMemoryLruCacheDriverOptions, InvalidPostgresToSQLiteTranslation, type MatchPattern, type MaybePromise, NoopEmailDriver, type NoopEmailDriverOptions, NoopSmsDriver, type NoopSmsDriverOptions, type PartialAppDrivers, type Primitive, type RedisCacheClient, RedisCacheDriver, type RedisCacheDriverOptions, ResendEmailDriver, type ResendEmailDriverOptions, Schema, SendmailEmailDriver, type SendmailEmailDriverOptions, type ServerOptions, type SmsDriver, type SmsMessage, type StoredEmailMessage, UnableToCreateRuntimeConnection, checkPasswordStrength, cleanSql, createAppDrivers, ensureVar, filterSearchParams, formatSendmailMessage, fuzzyMatch, getAuthSchemaSql, getPath, getStatementsArray, invariant, isBooleanLike, isBun, isEmail, isEqual, isExperimentalEnabled, isNode, isObject, isPlainObject, isPrimitive, isString, jsonStringify, listEnabledExperimentals, measureTime, mergeObject, mergeObjectWith, normalizeDefault, normalizeSql, normalizeString, normalizeType, objectDiff, omit, params, parseBigInt, patternMatch, pick, pipe, pipeEach, quote, randomString, replacePlaceholders, requireAuth, resolveAuth, setExperimental, setPath, slugify, snakeToPascalWithSpaces, splitSqlStatements, studioRouteHandler, threw, threwAsync, truncate, trySync, ucFirst, ucFirstAll, uuid };