@supabase/lite 0.8.0 → 0.8.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.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import * as _supabase_supabase_js from '@supabase/supabase-js';
2
2
  import { SupabaseClientOptions } from '@supabase/supabase-js';
3
- import { D as DefaultSchema, S as Schema } from './index-xv_pDjEt.js';
3
+ import { D as DefaultSchema, S as Schema } from './index-Bv2S5btu.js';
4
4
  import { Connection, ConnectionMigrator, MaybePromise as MaybePromise$1, SchemaDiffResult, PlanStep, PlanResult, IConnectionConfig, Dialect as Dialect$2, IntrospectResult as IntrospectResult$1, TransactionOptions } from '@supabase/lite';
5
5
  import * as hono_hono_base from 'hono/hono-base';
6
6
  import * as hono_utils_http_status from 'hono/utils/http-status';
7
7
  import * as hono_utils_types from 'hono/utils/types';
8
8
  import * as hono_types from 'hono/types';
9
9
  import * as hono from 'hono';
10
- import { MiddlewareHandler, Context } from 'hono';
10
+ import { Context, MiddlewareHandler } from 'hono';
11
11
  import { Kysely, KyselyPlugin } from 'kysely';
12
12
  import { ReadableStream as ReadableStream$1 } from 'node:stream/web';
13
- import { a as CacheDriver, b as CacheSetOptions, W as Where, c as IntrospectResult, M as MigrateScope, A as AnyAST, V as VarsContext, T as TransactionOptions$1, C as Connection$1 } from './Connection-D9UUTsjg.js';
14
- export { d as AST, e as ASTType, f as AggregateFunction, B as BaseAST, g as BodyResult, h as CheckConstraintInfo, i as ColumnDef, j as ColumnDiff, k as ColumnInfo, l as ColumnRef, m as CommentInfo, n as ConnectionContextOptions, o as ConnectionMigrator, p as CustomTypesInfo, D as DataLossError, q as DataLossWarning, r as DeleteAST, s as Dialect, t as DiffResult, E as EmbedDef, u as EmbedTransform, v as ExplainOptions, F as FiltersResult, w as ForeignKeyDiff, x as ForeignKeyInfo, y as FunctionInfo, H as HeadersResult, I as IConnectionConfig, z as IndexDiff, G as IndexInfo, J as InsertAST, K as IntrospectOptions, L as JoinDef, N as JoinMap, O as Meta, P as MigrationError, Q as OrderEntry, R as PlanResult, S as PlanStep, U as PlanStepType, X as PreferToken, Y as PrimaryKeyInfo, Z as Qb, _ as QbDelete, $ as QbInsert, a0 as QbSelect, a1 as QbUpdate, a2 as QueryAST, a3 as QueryParamsResult, a4 as RelationNotFoundError, a5 as RouteResult, a6 as RpcAST, a7 as RpcResult, a8 as SchemaDiffResult, a9 as SelectEntry, aa as SelectResult, ab as TableDiff, ac as TableInfo, ad as TextSearchValue, ae as TransformsResult, af as TranslatorConfig, ag as TriggerInfo, ah as UniqueConstraintInfo, ai as UpdateAST, aj as UpsertAST, ak as UpsertResult, al as ViewInfo, am as ViewOptionsMetadata, an as WhereValue, ao as isRef } from './Connection-D9UUTsjg.js';
13
+ import { a as CacheDriver, b as CacheSetOptions, W as Where, c as IntrospectResult, M as MigrateScope, A as AnyAST, V as VarsContext, T as TransactionOptions$1, C as Connection$1 } from './Connection-ZWTDByQ5.js';
14
+ export { d as AST, e as ASTType, f as AggregateFunction, B as BaseAST, g as BodyResult, h as CheckConstraintInfo, i as ColumnDef, j as ColumnDiff, k as ColumnInfo, l as ColumnRef, m as CommentInfo, n as ConnectionContextOptions, o as ConnectionMigrator, p as CustomTypesInfo, D as DataLossError, q as DataLossWarning, r as DeleteAST, s as Dialect, t as DiffResult, E as EmbedDef, u as EmbedTransform, v as ExplainOptions, F as FiltersResult, w as ForeignKeyDiff, x as ForeignKeyInfo, y as FunctionInfo, H as HeadersResult, I as IConnectionConfig, z as IndexDiff, G as IndexInfo, J as InsertAST, K as IntrospectOptions, L as JoinDef, N as JoinMap, O as Meta, P as MigrationError, Q as OrderEntry, R as PlanResult, S as PlanStep, U as PlanStepType, X as PreferToken, Y as PrimaryKeyInfo, Z as Qb, _ as QbDelete, $ as QbInsert, a0 as QbSelect, a1 as QbUpdate, a2 as QueryAST, a3 as QueryParamsResult, a4 as RelationNotFoundError, a5 as RouteResult, a6 as RpcAST, a7 as RpcResult, a8 as SchemaDiffResult, a9 as SelectEntry, aa as SelectResult, ab as TableDiff, ac as TableInfo, ad as TextSearchValue, ae as TransformsResult, af as TranslatorConfig, ag as TriggerInfo, ah as UniqueConstraintInfo, ai as UpdateAST, aj as UpsertAST, ak as UpsertResult, al as ViewInfo, am as ViewOptionsMetadata, an as WhereValue, ao as isRef } from './Connection-ZWTDByQ5.js';
15
15
  import { ParseResult } from 'libpg-query';
16
16
  import { DeparserOptions } from 'pgsql-deparser';
17
17
  import 'jsonv-ts';
@@ -88,6 +88,26 @@ interface IdentitiesTable {
88
88
  created_at: string;
89
89
  updated_at: string;
90
90
  }
91
+ interface FlowStateTable {
92
+ id: string;
93
+ user_id: string | null;
94
+ auth_code: string | null;
95
+ authentication_method: string;
96
+ code_challenge_method: string | null;
97
+ code_challenge: string | null;
98
+ provider_type: string;
99
+ provider_access_token: string | null;
100
+ provider_refresh_token: string | null;
101
+ auth_code_issued_at: string | null;
102
+ invite_token: string | null;
103
+ referrer: string | null;
104
+ oauth_client_state_id: string | null;
105
+ linking_target_id: string | null;
106
+ email_optional: boolean;
107
+ created_at: string;
108
+ updated_at: string;
109
+ }
110
+ type NewFlowState = Pick<FlowStateTable, "id" | "authentication_method" | "provider_type"> & Partial<Pick<FlowStateTable, "user_id" | "auth_code" | "code_challenge_method" | "code_challenge" | "invite_token" | "referrer" | "oauth_client_state_id" | "linking_target_id" | "email_optional">>;
91
111
  interface UserResponse {
92
112
  id: string;
93
113
  aud: string;
@@ -157,6 +177,15 @@ interface AuthConfig {
157
177
  enable_confirmations?: boolean;
158
178
  site_url?: string;
159
179
  additional_redirect_urls?: string[];
180
+ external?: Record<string, {
181
+ enabled?: boolean;
182
+ client_id?: string;
183
+ secret?: string;
184
+ url?: string;
185
+ redirect_uri?: string;
186
+ skip_nonce_check?: boolean;
187
+ email_optional?: boolean;
188
+ }>;
160
189
  }
161
190
  type EmailTemplateType = "invite" | "confirmation" | "recovery" | "magic_link" | "email_change";
162
191
  interface EmailTemplateConfig {
@@ -165,12 +194,28 @@ interface EmailTemplateConfig {
165
194
  }
166
195
 
167
196
  type Dialect$1 = "postgres" | "sqlite";
197
+ /** Bound `Connection#runInTransaction` — see db/Connection.ts for why this
198
+ * indirection exists (DO storage has no BEGIN/COMMIT over kysely). */
199
+ type TransactionRunner = <T>(fn: (trx: Kysely<any>) => Promise<T>) => Promise<T>;
168
200
  declare class AuthRepository {
169
201
  private db;
170
202
  private dialect;
203
+ private runInTransaction;
171
204
  private schema;
172
- constructor(db: Kysely<any>, dialect: Dialect$1);
205
+ constructor(db: Kysely<any>, dialect: Dialect$1, runInTransaction?: TransactionRunner);
173
206
  private bool;
207
+ /**
208
+ * Runs `fn` inside a database transaction, handing it a repository bound to
209
+ * the transaction's executor. All reads/writes performed through that
210
+ * repository (including this one's other methods) participate in the same
211
+ * transaction, and are rolled back together if `fn` throws.
212
+ *
213
+ * Callers that need existing private helpers (which close over `this.repo`)
214
+ * to run against the transaction should swap `this.repo` for the duration
215
+ * of the callback — safe because AuthService/AuthRepository instances are
216
+ * constructed fresh per request (see server/auth.ts createAuthService).
217
+ */
218
+ transaction<T>(fn: (repo: AuthRepository) => Promise<T>): Promise<T>;
174
219
  private table;
175
220
  private insertInto;
176
221
  private update;
@@ -178,9 +223,22 @@ declare class AuthRepository {
178
223
  findUserByEmail(email: string): Promise<UsersTable | null>;
179
224
  findUserById(id: string): Promise<UsersTable | null>;
180
225
  findUserByToken(column: string, token: string): Promise<UsersTable | null>;
226
+ /**
227
+ * Atomically consumes a one-time token: the UPDATE only matches a row whose
228
+ * `column` still holds `token`, so exactly one of two concurrent verifies
229
+ * for the same OTP can win, and a token rotated/cleared by another request
230
+ * (resend, a competing verify) no longer matches. Returns false when no row
231
+ * was updated — callers must treat that as an invalid/consumed token and
232
+ * mutate nothing further.
233
+ *
234
+ * This is the guard that survives on D1, whose `runInTransaction` cannot
235
+ * group statements (see D1SqliteConnection L131-140): a single conditional
236
+ * UPDATE with a rowcount check is atomic on every driver.
237
+ */
238
+ claimUserToken(userId: string, column: string, token: string): Promise<boolean>;
181
239
  createUser(user: Partial<UsersTable> & {
182
240
  id: string;
183
- email: string;
241
+ email: string | null;
184
242
  }): Promise<UsersTable>;
185
243
  updateUser(id: string, updates: Partial<UsersTable>): Promise<UsersTable | null>;
186
244
  createSession(session: {
@@ -216,6 +274,52 @@ declare class AuthRepository {
216
274
  }): Promise<IdentitiesTable>;
217
275
  findIdentitiesByUserId(userId: string): Promise<IdentitiesTable[]>;
218
276
  updateIdentity(id: string, updates: Partial<IdentitiesTable>): Promise<void>;
277
+ deleteIdentitiesExcept(userId: string, keepId: string): Promise<void>;
278
+ findIdentityByProviderAndId(provider: string, providerId: string): Promise<IdentitiesTable | null>;
279
+ findIdentitiesByEmails(emails: string[]): Promise<IdentitiesTable[]>;
280
+ createFlowState(flow: NewFlowState): Promise<FlowStateTable>;
281
+ findFlowStateById(id: string): Promise<FlowStateTable | null>;
282
+ findFlowStateByAuthCode(authCode: string): Promise<FlowStateTable | null>;
283
+ updateFlowState(id: string, updates: Partial<FlowStateTable>): Promise<void>;
284
+ /**
285
+ * Atomically claims a PKCE flow_state row for a callback: the UPDATE only
286
+ * matches (and thus only succeeds for) a row whose user_id is still null,
287
+ * so exactly one of two concurrent callbacks for the same state can win.
288
+ * Returns false if the row was already claimed (or no longer exists) —
289
+ * callers should treat that as a replay (flow_state_already_used).
290
+ */
291
+ claimFlowStateForPkce(id: string, updates: {
292
+ user_id: string;
293
+ provider_access_token: string;
294
+ provider_refresh_token: string;
295
+ auth_code_issued_at: string;
296
+ }): Promise<boolean>;
297
+ /**
298
+ * Atomically deletes a flow_state row, returning whether a row was
299
+ * actually removed. A single DELETE...WHERE id = ? is inherently atomic
300
+ * (at most one caller can ever delete a given row), so this doubles as the
301
+ * "claim" step for implicit-flow callbacks and PKCE auth-code redemption:
302
+ * only the caller that observes `true` may proceed to issue a session.
303
+ */
304
+ /**
305
+ * Deletes at most {@link FLOW_STATE_CLEANUP_BATCH} flow_state rows created
306
+ * before `cutoffIso`. Ports the flow_state statement of GoTrue's periodic
307
+ * cleanup (internal/models/cleanup.go L62):
308
+ *
309
+ * delete from "flow_state" where id in (
310
+ * select id from "flow_state" where created_at < now() - interval '24 hours'
311
+ * limit 100 for update skip locked);
312
+ *
313
+ * The bound is the point of that statement: cleanup must never turn into an
314
+ * unbounded delete that blocks the request it is piggybacking on (lite has
315
+ * no background scheduler, so this runs opportunistically on the /authorize
316
+ * insert path). A backlog is drained across subsequent /authorize calls.
317
+ * `for update skip locked` has no sqlite equivalent and is omitted; the
318
+ * id-in-subquery-with-LIMIT shape works on both dialects. Returns the number
319
+ * of rows removed.
320
+ */
321
+ deleteFlowStatesCreatedBefore(cutoffIso: string): Promise<number>;
322
+ deleteFlowState(id: string): Promise<boolean>;
219
323
  createAuditLogEntry(entry: {
220
324
  id: string;
221
325
  payload?: Record<string, unknown>;
@@ -347,14 +451,14 @@ declare class InMemoryEmailDriver implements EmailDriver {
347
451
  clear(): void;
348
452
  private trim;
349
453
  }
350
- interface NoopEmailDriverOptions {
454
+ interface ConsoleEmailDriverOptions {
351
455
  silent?: boolean;
352
456
  logger?: Pick<Console, "info">;
353
457
  }
354
- declare class NoopEmailDriver extends InMemoryEmailDriver {
458
+ declare class ConsoleEmailDriver extends InMemoryEmailDriver {
355
459
  private readonly silent;
356
460
  private readonly logger;
357
- constructor(options?: NoopEmailDriverOptions);
461
+ constructor(options?: ConsoleEmailDriverOptions);
358
462
  send(message: EmailMessage): Promise<void>;
359
463
  }
360
464
 
@@ -453,6 +557,11 @@ declare class AuthService {
453
557
  token_hash?: string;
454
558
  type: string;
455
559
  }): Promise<SessionResponse>;
560
+ /**
561
+ * The mutating half of {@link verifyOtp}, always run inside a transaction
562
+ * (`this.repo` is bound to it) — see the comment at the call site.
563
+ */
564
+ private completeVerifyOtp;
456
565
  recover(email: string | undefined): Promise<void>;
457
566
  resend(type: string, email: string | undefined): Promise<void>;
458
567
  reauthenticate(userId: string): Promise<void>;
@@ -465,6 +574,51 @@ declare class AuthService {
465
574
  private isTokenExpired;
466
575
  private getTokenColumnsForType;
467
576
  private createAuditLog;
577
+ /**
578
+ * Same entry shape as {@link createAuditLog}, for the call sites whose
579
+ * traits map is not `{provider: ...}` (GoTrue builds the map per call site;
580
+ * see models.NewAuditLogEntry's `traits map[string]any` argument).
581
+ */
582
+ private createAuditLogWithTraits;
583
+ getExternalProviderRedirectUrl(query: Record<string, string | undefined>, opts: {
584
+ refererHeader?: string;
585
+ defaultRedirectUri: string;
586
+ }): Promise<string>;
587
+ loadOAuthFlowState(state: string | undefined): Promise<FlowStateTable>;
588
+ resolveOAuthRedirectTarget(flowState: FlowStateTable): string;
589
+ handleExternalProviderCallback(flowState: FlowStateTable, params: Record<string, string | undefined>, opts: {
590
+ defaultRedirectUri: string;
591
+ }): Promise<{
592
+ type: "pkce" | "implicit";
593
+ redirectUrl: string;
594
+ }>;
595
+ /**
596
+ * Tail of the external-provider callback, shared by the account-linking and
597
+ * invite branches: claims the flow state and either hands back the PKCE
598
+ * auth code or issues a session in the URL fragment (external.go
599
+ * L221-286). Runs inside the callback's transaction — `this.repo` is
600
+ * already bound to it by the caller.
601
+ */
602
+ private issueOAuthCallbackResult;
603
+ /**
604
+ * Ports internal/api/external.go's processInvite (L449-514): accepts an
605
+ * invitation with an external identity. The invite token is the user's
606
+ * `confirmation_token` (models.FindUserByConfirmationToken), the external
607
+ * email must match the invited email, and the user is confirmed because
608
+ * they were able to respond to the invite email.
609
+ *
610
+ * Runs inside the callback's transaction (`this.repo` is bound to it).
611
+ */
612
+ private processInvite;
613
+ exchangePkceCode(authCode: string | undefined, codeVerifier: string | undefined): Promise<SessionResponse & {
614
+ provider_token?: string;
615
+ provider_refresh_token?: string;
616
+ }>;
617
+ private resolveOAuthReferrer;
618
+ private updateUserMetaDataAndProviders;
619
+ private buildAppMetaDataProviders;
620
+ private removeUnconfirmedIdentities;
621
+ private determineAccountLinking;
468
622
  }
469
623
 
470
624
  type CrossReadableStream = ReadableStream | ReadableStream$1;
@@ -726,10 +880,48 @@ type HonoContext = {
726
880
  userId?: string;
727
881
  sessionId?: string;
728
882
  jwt?: Record<string, unknown>;
883
+ apiKeyType?: "publishable" | "secret";
884
+ ignoreAuthorization?: boolean;
885
+ /**
886
+ * Set by `adminAuth()` when local admin mode elevated this request to
887
+ * `service_role`. Observability/tests only — the elevation itself is
888
+ * carried by `apiKeyType`/`ignoreAuthorization`/`jwt`.
889
+ */
890
+ admin?: boolean;
729
891
  };
730
892
  };
731
893
  type MaybePromise<T> = T | Promise<T>;
732
894
 
895
+ type ApiKeyType = "publishable" | "secret";
896
+ declare const SELF_HOSTED_PROJECT_REF = "supabase-self-hosted";
897
+ type GeneratedApiKey = {
898
+ key: string;
899
+ hash: string;
900
+ prefix: string;
901
+ type: ApiKeyType;
902
+ };
903
+ /**
904
+ * Generates an `sb_publishable_*` / `sb_secret_*` API key. Web-crypto only
905
+ * (`crypto.getRandomValues` / `crypto.subtle.digest`) so this also runs on
906
+ * Cloudflare Workers/DO — no `node:crypto`.
907
+ *
908
+ * Uses 17 random bytes truncated to a 22-char base64url body, so the full
909
+ * 132 bits of entropy fill those 22 chars (matches upstream self-hosted's
910
+ * `generateOpaqueKey`). If `randomBytes` is injected for testing, pass 17
911
+ * bytes to match production entropy.
912
+ */
913
+ declare function generateApiKey(type: ApiKeyType, ref?: string, randomBytes?: Uint8Array): Promise<GeneratedApiKey>;
914
+ declare function hashApiKey(key: string): Promise<string>;
915
+ /** Prefix sniff only — no checksum verification (that belongs to infra). */
916
+ declare function apiKeyType(key: string): ApiKeyType | null;
917
+
918
+ /** Claims are applied verbatim as `request.jwt.claims` — MUST include `role`. */
919
+ type ResolvedKey = {
920
+ type: ApiKeyType;
921
+ claims: Record<string, unknown>;
922
+ };
923
+ type ApiKeyResolver = (key: string, c: Context<HonoContext>) => Promise<ResolvedKey | null>;
924
+
733
925
  type ServerOptions = {
734
926
  middlewares?: MiddlewareHandler<HonoContext>[];
735
927
  disableStudio?: boolean;
@@ -738,6 +930,33 @@ type ServerOptions = {
738
930
  * Test-only PostgREST mode: execute each request in a transaction and roll it back.
739
931
  */
740
932
  forceRollback?: boolean;
933
+ /**
934
+ * `false` disables apikey enforcement outright. Otherwise a custom
935
+ * `resolver` can be supplied (the lite-platform seam); when omitted, keys
936
+ * configured under `config.auth.publishable_key`/`secret_key` are used.
937
+ */
938
+ apiKeys?: false | {
939
+ resolver?: ApiKeyResolver;
940
+ };
941
+ /**
942
+ * Local admin mode (default `false`): run *keyless* `/rest/v1` and
943
+ * `/storage/v1` requests as `service_role`, so a browser studio can do
944
+ * privileged work without a secret key shipping to the browser. Only
945
+ * same-origin requests addressed to loopback are elevated.
946
+ *
947
+ * Two caveats, both local-dev only:
948
+ * 1. RLS is not enforced for keyless traffic while this is on. To exercise
949
+ * policies, send an `apikey`: the publishable key for `anon`, or the
950
+ * publishable key PLUS `Authorization: Bearer <user JWT>` for
951
+ * `authenticated`. Those requests are never elevated. A bearer token on
952
+ * its own is rejected before RLS is reached (401), since opaque keys are
953
+ * only sourced from `apikey`.
954
+ * 2. Localhost trust is not per-request trust. Any page open in the
955
+ * developer's browser can reach the server; the same-origin and
956
+ * loopback guards are what keep that from being a data-exfiltration
957
+ * hole. Never enable outside local development.
958
+ */
959
+ admin?: boolean;
741
960
  };
742
961
  declare function createServer(app: App, options?: ServerOptions): hono_hono_base.HonoBase<HonoContext & {
743
962
  Variables: {
@@ -1050,32 +1269,9 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
1050
1269
  input: {};
1051
1270
  output: {
1052
1271
  external: {
1053
- anonymous_users: boolean;
1054
- apple: boolean;
1055
- azure: boolean;
1056
- bitbucket: boolean;
1057
- discord: boolean;
1058
- facebook: boolean;
1059
- snapchat: boolean;
1060
- figma: boolean;
1061
- fly: boolean;
1062
- github: boolean;
1063
- gitlab: boolean;
1064
- google: boolean;
1065
- keycloak: boolean;
1066
- kakao: boolean;
1067
- linkedin: boolean;
1068
- linkedin_oidc: boolean;
1069
- notion: boolean;
1070
- spotify: boolean;
1071
- slack: boolean;
1072
- slack_oidc: boolean;
1073
- workos: boolean;
1074
- twitch: boolean;
1075
- twitter: boolean;
1076
1272
  email: boolean;
1077
1273
  phone: boolean;
1078
- zoom: boolean;
1274
+ anonymous_users: boolean;
1079
1275
  };
1080
1276
  disable_signup: boolean;
1081
1277
  mailer_autoconfirm: boolean;
@@ -1117,6 +1313,33 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
1117
1313
  status: 200;
1118
1314
  };
1119
1315
  };
1316
+ } & {
1317
+ "/authorize": {
1318
+ $get: {
1319
+ input: {};
1320
+ output: string;
1321
+ outputFormat: "body";
1322
+ status: 302;
1323
+ };
1324
+ };
1325
+ } & {
1326
+ "/callback": {
1327
+ $get: {
1328
+ input: {};
1329
+ output: {};
1330
+ outputFormat: string;
1331
+ status: hono_utils_http_status.StatusCode;
1332
+ };
1333
+ };
1334
+ } & {
1335
+ "/callback": {
1336
+ $post: {
1337
+ input: {};
1338
+ output: {};
1339
+ outputFormat: string;
1340
+ status: hono_utils_http_status.StatusCode;
1341
+ };
1342
+ };
1120
1343
  } & {
1121
1344
  "/nonexistent": {
1122
1345
  $all: {
@@ -1758,431 +1981,7 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
1758
1981
  "/config": {
1759
1982
  $get: {
1760
1983
  input: {};
1761
- output: {
1762
- analytics?: {
1763
- enabled?: boolean | undefined;
1764
- port?: number | undefined;
1765
- vector_port?: number | undefined;
1766
- backend?: "postgres" | "bigquery" | undefined;
1767
- } | undefined;
1768
- api?: {
1769
- enabled?: boolean | undefined;
1770
- port?: number | undefined;
1771
- schemas?: string[] | undefined;
1772
- extra_search_path?: string[] | undefined;
1773
- max_rows?: number | undefined;
1774
- pg_safe_update?: boolean | undefined;
1775
- plan_enabled?: boolean | undefined;
1776
- aggregates_enabled?: boolean | undefined;
1777
- limited_mutations_enabled?: boolean | undefined;
1778
- anonymous_enabled?: boolean | undefined;
1779
- external_url?: string | undefined;
1780
- tls?: {
1781
- enabled?: boolean | undefined;
1782
- } | undefined;
1783
- } | undefined;
1784
- storage?: {
1785
- enabled?: boolean | undefined;
1786
- file_size_limit?: string | undefined;
1787
- buckets?: {
1788
- [x: string]: {
1789
- public?: boolean | undefined;
1790
- file_size_limit?: string | undefined;
1791
- allowed_mime_types?: string[] | undefined;
1792
- objects_path?: string | undefined;
1793
- };
1794
- } | undefined;
1795
- image_transformation?: {
1796
- enabled?: boolean | undefined;
1797
- } | undefined;
1798
- } | undefined;
1799
- auth?: {
1800
- enabled?: boolean | undefined;
1801
- enable_signup?: boolean | undefined;
1802
- jwt_secret?: string | undefined;
1803
- site_url?: string | undefined;
1804
- additional_redirect_urls?: string[] | undefined;
1805
- jwt_expiry?: number | undefined;
1806
- enable_refresh_token_rotation?: boolean | undefined;
1807
- refresh_token_reuse_interval?: number | undefined;
1808
- enable_manual_linking?: boolean | undefined;
1809
- enable_anonymous_sign_ins?: boolean | undefined;
1810
- minimum_password_length?: number | undefined;
1811
- password_requirements?: string | undefined;
1812
- hook?: {
1813
- mfa_verification_attempt?: {
1814
- enabled?: boolean | undefined;
1815
- uri?: string | undefined;
1816
- secrets?: string[] | undefined;
1817
- } | undefined;
1818
- password_verification_attempt?: {
1819
- enabled?: boolean | undefined;
1820
- uri?: string | undefined;
1821
- secrets?: string[] | undefined;
1822
- } | undefined;
1823
- custom_access_token?: {
1824
- enabled?: boolean | undefined;
1825
- uri?: string | undefined;
1826
- secrets?: string[] | undefined;
1827
- } | undefined;
1828
- send_sms?: {
1829
- enabled?: boolean | undefined;
1830
- uri?: string | undefined;
1831
- secrets?: string[] | undefined;
1832
- } | undefined;
1833
- send_email?: {
1834
- enabled?: boolean | undefined;
1835
- uri?: string | undefined;
1836
- secrets?: string[] | undefined;
1837
- } | undefined;
1838
- } | undefined;
1839
- mfa?: {
1840
- max_enrolled_factors?: number | undefined;
1841
- totp?: {
1842
- enroll_enabled?: boolean | undefined;
1843
- verify_enabled?: boolean | undefined;
1844
- } | undefined;
1845
- phone?: {
1846
- template?: string | undefined;
1847
- max_frequency?: string | undefined;
1848
- otp_length?: number | undefined;
1849
- enroll_enabled?: boolean | undefined;
1850
- verify_enabled?: boolean | undefined;
1851
- } | undefined;
1852
- } | undefined;
1853
- sessions?: {
1854
- timebox?: string | undefined;
1855
- inactivity_timeout?: string | undefined;
1856
- single_per_user?: boolean | undefined;
1857
- } | undefined;
1858
- email?: {
1859
- template?: {
1860
- invite?: {
1861
- subject?: string | undefined;
1862
- content_path?: string | undefined;
1863
- } | undefined;
1864
- confirmation?: {
1865
- subject?: string | undefined;
1866
- content_path?: string | undefined;
1867
- } | undefined;
1868
- recovery?: {
1869
- subject?: string | undefined;
1870
- content_path?: string | undefined;
1871
- } | undefined;
1872
- magic_link?: {
1873
- subject?: string | undefined;
1874
- content_path?: string | undefined;
1875
- } | undefined;
1876
- email_change?: {
1877
- subject?: string | undefined;
1878
- content_path?: string | undefined;
1879
- } | undefined;
1880
- } | undefined;
1881
- enable_signup?: boolean | undefined;
1882
- double_confirm_changes?: boolean | undefined;
1883
- enable_confirmations?: boolean | undefined;
1884
- secure_password_change?: boolean | undefined;
1885
- max_frequency?: string | undefined;
1886
- otp_length?: number | undefined;
1887
- otp_expiry?: number | undefined;
1888
- smtp?: {
1889
- port?: number | undefined;
1890
- host?: string | undefined;
1891
- user?: string | undefined;
1892
- pass?: string | undefined;
1893
- admin_email?: string | undefined;
1894
- sender_name?: string | undefined;
1895
- } | undefined;
1896
- } | undefined;
1897
- sms?: {
1898
- template?: string | undefined;
1899
- enable_signup?: boolean | undefined;
1900
- enable_confirmations?: boolean | undefined;
1901
- max_frequency?: string | undefined;
1902
- test_otp?: {
1903
- [x: string]: string;
1904
- } | undefined;
1905
- twilio?: {
1906
- enabled?: boolean | undefined;
1907
- account_sid?: string | undefined;
1908
- message_service_sid?: string | undefined;
1909
- auth_token?: string | undefined;
1910
- } | undefined;
1911
- twilio_verify?: {
1912
- enabled?: boolean | undefined;
1913
- account_sid?: string | undefined;
1914
- message_service_sid?: string | undefined;
1915
- auth_token?: string | undefined;
1916
- } | undefined;
1917
- messagebird?: {
1918
- enabled?: boolean | undefined;
1919
- originator?: string | undefined;
1920
- api_key?: string | undefined;
1921
- } | undefined;
1922
- textlocal?: {
1923
- enabled?: boolean | undefined;
1924
- api_key?: string | undefined;
1925
- sender?: string | undefined;
1926
- } | undefined;
1927
- vonage?: {
1928
- enabled?: boolean | undefined;
1929
- api_key?: string | undefined;
1930
- from?: string | undefined;
1931
- api_secret?: string | undefined;
1932
- } | undefined;
1933
- } | undefined;
1934
- external?: {
1935
- apple?: {
1936
- enabled?: boolean | undefined;
1937
- client_id?: string | undefined;
1938
- secret?: string | undefined;
1939
- url?: string | undefined;
1940
- redirect_uri?: string | undefined;
1941
- skip_nonce_check?: boolean | undefined;
1942
- } | undefined;
1943
- azure?: {
1944
- enabled?: boolean | undefined;
1945
- client_id?: string | undefined;
1946
- secret?: string | undefined;
1947
- url?: string | undefined;
1948
- redirect_uri?: string | undefined;
1949
- skip_nonce_check?: boolean | undefined;
1950
- } | undefined;
1951
- bitbucket?: {
1952
- enabled?: boolean | undefined;
1953
- client_id?: string | undefined;
1954
- secret?: string | undefined;
1955
- url?: string | undefined;
1956
- redirect_uri?: string | undefined;
1957
- skip_nonce_check?: boolean | undefined;
1958
- } | undefined;
1959
- discord?: {
1960
- enabled?: boolean | undefined;
1961
- client_id?: string | undefined;
1962
- secret?: string | undefined;
1963
- url?: string | undefined;
1964
- redirect_uri?: string | undefined;
1965
- skip_nonce_check?: boolean | undefined;
1966
- } | undefined;
1967
- facebook?: {
1968
- enabled?: boolean | undefined;
1969
- client_id?: string | undefined;
1970
- secret?: string | undefined;
1971
- url?: string | undefined;
1972
- redirect_uri?: string | undefined;
1973
- skip_nonce_check?: boolean | undefined;
1974
- } | undefined;
1975
- github?: {
1976
- enabled?: boolean | undefined;
1977
- client_id?: string | undefined;
1978
- secret?: string | undefined;
1979
- url?: string | undefined;
1980
- redirect_uri?: string | undefined;
1981
- skip_nonce_check?: boolean | undefined;
1982
- } | undefined;
1983
- gitlab?: {
1984
- enabled?: boolean | undefined;
1985
- client_id?: string | undefined;
1986
- secret?: string | undefined;
1987
- url?: string | undefined;
1988
- redirect_uri?: string | undefined;
1989
- skip_nonce_check?: boolean | undefined;
1990
- } | undefined;
1991
- google?: {
1992
- enabled?: boolean | undefined;
1993
- client_id?: string | undefined;
1994
- secret?: string | undefined;
1995
- url?: string | undefined;
1996
- redirect_uri?: string | undefined;
1997
- skip_nonce_check?: boolean | undefined;
1998
- } | undefined;
1999
- kakao?: {
2000
- enabled?: boolean | undefined;
2001
- client_id?: string | undefined;
2002
- secret?: string | undefined;
2003
- url?: string | undefined;
2004
- redirect_uri?: string | undefined;
2005
- skip_nonce_check?: boolean | undefined;
2006
- } | undefined;
2007
- keycloak?: {
2008
- enabled?: boolean | undefined;
2009
- client_id?: string | undefined;
2010
- secret?: string | undefined;
2011
- url?: string | undefined;
2012
- redirect_uri?: string | undefined;
2013
- skip_nonce_check?: boolean | undefined;
2014
- } | undefined;
2015
- linkedin?: {
2016
- enabled?: boolean | undefined;
2017
- client_id?: string | undefined;
2018
- secret?: string | undefined;
2019
- url?: string | undefined;
2020
- redirect_uri?: string | undefined;
2021
- skip_nonce_check?: boolean | undefined;
2022
- } | undefined;
2023
- notion?: {
2024
- enabled?: boolean | undefined;
2025
- client_id?: string | undefined;
2026
- secret?: string | undefined;
2027
- url?: string | undefined;
2028
- redirect_uri?: string | undefined;
2029
- skip_nonce_check?: boolean | undefined;
2030
- } | undefined;
2031
- twitch?: {
2032
- enabled?: boolean | undefined;
2033
- client_id?: string | undefined;
2034
- secret?: string | undefined;
2035
- url?: string | undefined;
2036
- redirect_uri?: string | undefined;
2037
- skip_nonce_check?: boolean | undefined;
2038
- } | undefined;
2039
- twitter?: {
2040
- enabled?: boolean | undefined;
2041
- client_id?: string | undefined;
2042
- secret?: string | undefined;
2043
- url?: string | undefined;
2044
- redirect_uri?: string | undefined;
2045
- skip_nonce_check?: boolean | undefined;
2046
- } | undefined;
2047
- slack?: {
2048
- enabled?: boolean | undefined;
2049
- client_id?: string | undefined;
2050
- secret?: string | undefined;
2051
- url?: string | undefined;
2052
- redirect_uri?: string | undefined;
2053
- skip_nonce_check?: boolean | undefined;
2054
- } | undefined;
2055
- spotify?: {
2056
- enabled?: boolean | undefined;
2057
- client_id?: string | undefined;
2058
- secret?: string | undefined;
2059
- url?: string | undefined;
2060
- redirect_uri?: string | undefined;
2061
- skip_nonce_check?: boolean | undefined;
2062
- } | undefined;
2063
- workos?: {
2064
- enabled?: boolean | undefined;
2065
- client_id?: string | undefined;
2066
- secret?: string | undefined;
2067
- url?: string | undefined;
2068
- redirect_uri?: string | undefined;
2069
- skip_nonce_check?: boolean | undefined;
2070
- } | undefined;
2071
- zoom?: {
2072
- enabled?: boolean | undefined;
2073
- client_id?: string | undefined;
2074
- secret?: string | undefined;
2075
- url?: string | undefined;
2076
- redirect_uri?: string | undefined;
2077
- skip_nonce_check?: boolean | undefined;
2078
- } | undefined;
2079
- } | undefined;
2080
- } | undefined;
2081
- inbucket?: {
2082
- enabled?: boolean | undefined;
2083
- port?: number | undefined;
2084
- smtp_port?: number | undefined;
2085
- pop3_port?: number | undefined;
2086
- } | undefined;
2087
- experimental?: {
2088
- orioledb_version?: string | undefined;
2089
- s3_host?: string | undefined;
2090
- s3_region?: string | undefined;
2091
- s3_access_key?: string | undefined;
2092
- s3_secret_key?: string | undefined;
2093
- } | undefined;
2094
- functions?: {
2095
- [x: string]: {
2096
- enabled?: boolean | undefined;
2097
- verify_jwt?: boolean | undefined;
2098
- import_map?: string | undefined;
2099
- entrypoint?: string | undefined;
2100
- };
2101
- } | undefined;
2102
- realtime?: {
2103
- enabled?: boolean | undefined;
2104
- ip_version?: string | undefined;
2105
- max_header_length?: number | undefined;
2106
- } | undefined;
2107
- studio?: {
2108
- enabled?: boolean | undefined;
2109
- port?: number | undefined;
2110
- api_url?: string | undefined;
2111
- openai_api_key?: string | undefined;
2112
- } | undefined;
2113
- project_id?: string | undefined;
2114
- db?: {
2115
- [x: string]: hono_utils_types.JSONValue;
2116
- port?: number | undefined;
2117
- url?: string | undefined;
2118
- driver?: "postgres" | "sqlite" | "sqlite-postgres" | "pglite" | undefined;
2119
- shadow_port?: number | undefined;
2120
- major_version?: number | undefined;
2121
- pooler?: {
2122
- [x: string]: hono_utils_types.JSONValue;
2123
- enabled?: boolean | undefined;
2124
- port?: number | undefined;
2125
- pool_mode?: string | undefined;
2126
- default_pool_size?: number | undefined;
2127
- max_client_conn?: number | undefined;
2128
- } | undefined;
2129
- seed?: {
2130
- enabled?: boolean | undefined;
2131
- sql_paths?: string[] | undefined;
2132
- } | undefined;
2133
- migrations?: {
2134
- enabled?: boolean | undefined;
2135
- schema_paths?: string[] | undefined;
2136
- } | undefined;
2137
- } | undefined;
2138
- edge_runtime?: {
2139
- enabled?: boolean | undefined;
2140
- policy?: "oneshot" | "per_worker" | undefined;
2141
- inspector_port?: number | undefined;
2142
- } | undefined;
2143
- options?: {
2144
- defaults?: true | undefined;
2145
- server?: {
2146
- middlewares?: never[] | undefined;
2147
- disableStudio?: boolean | undefined;
2148
- disableFallback?: boolean | undefined;
2149
- forceRollback?: boolean | undefined;
2150
- } | undefined;
2151
- drivers?: {
2152
- email?: {
2153
- send: never;
2154
- } | undefined;
2155
- sms?: {
2156
- send: never;
2157
- } | undefined;
2158
- cache?: {
2159
- get: never;
2160
- set: never;
2161
- delete: never;
2162
- } | undefined;
2163
- } | undefined;
2164
- system?: {
2165
- schemaReconciliation?: "additive" | "full" | undefined;
2166
- } | undefined;
2167
- } | undefined;
2168
- rls?: {
2169
- tables: string[];
2170
- policies: {
2171
- name: string;
2172
- table: string;
2173
- schema?: string | undefined;
2174
- command: PolicyCommand;
2175
- permissive: boolean;
2176
- roles: PolicyRole[];
2177
- using?: {
2178
- [x: string]: hono_utils_types.JSONValue;
2179
- } | undefined;
2180
- withCheck?: {
2181
- [x: string]: hono_utils_types.JSONValue;
2182
- } | undefined;
2183
- }[];
2184
- } | undefined;
2185
- };
1984
+ output: {};
2186
1985
  outputFormat: "json";
2187
1986
  status: hono_utils_http_status.ContentfulStatusCode;
2188
1987
  };
@@ -2191,7 +1990,11 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
2191
1990
  "/info": {
2192
1991
  $get: {
2193
1992
  input: {};
2194
- output: {};
1993
+ output: {
1994
+ connection: any;
1995
+ config: any;
1996
+ admin: boolean;
1997
+ };
2195
1998
  outputFormat: "json";
2196
1999
  status: hono_utils_http_status.ContentfulStatusCode;
2197
2000
  };
@@ -2391,6 +2194,11 @@ declare class App<Config extends IAppConfig = DefaultAppConfig, Conn = Config ex
2391
2194
  private readonly _rls;
2392
2195
  readonly config: DefaultSchema & Omit<Config, "connection">;
2393
2196
  readonly server: ReturnType<typeof createServer>;
2197
+ /**
2198
+ * Resolved local admin mode, after CLI-flag / config-file precedence. Read
2199
+ * this (never the raw CLI flag) when reporting what the server is doing.
2200
+ */
2201
+ readonly adminMode: boolean;
2394
2202
  readonly drivers: AppDrivers;
2395
2203
  _mailer?: Mailer;
2396
2204
  _storageAdapter?: StorageAdapter;
@@ -2416,7 +2224,9 @@ declare class App<Config extends IAppConfig = DefaultAppConfig, Conn = Config ex
2416
2224
  force?: boolean;
2417
2225
  }): Promise<void>;
2418
2226
  isValidConfig(config: Schema | DefaultSchema | IAppConfig): boolean;
2419
- getClient<SchemaName extends string = "public">(options?: SupabaseClientOptions<SchemaName>): _supabase_supabase_js.SupabaseClient<any, "public", SchemaName, Omit<any, "__InternalSupabase">[SchemaName] extends {
2227
+ getClient<SchemaName extends string = "public">(options?: SupabaseClientOptions<SchemaName> & {
2228
+ apikey?: string;
2229
+ }): _supabase_supabase_js.SupabaseClient<any, "public", SchemaName, Omit<any, "__InternalSupabase">[SchemaName] extends {
2420
2230
  Tables: Record<string, {
2421
2231
  Row: Record<string, unknown>;
2422
2232
  Insert: Record<string, unknown>;
@@ -2492,6 +2302,16 @@ declare class CheckConstraintError extends Error {
2492
2302
  constructor(table: string, column: string, constraint: string, value: unknown);
2493
2303
  }
2494
2304
 
2305
+ interface FieldFactoryExtra {
2306
+ lengthConstraint?: number;
2307
+ numericPrecision?: {
2308
+ precision: number;
2309
+ scale: number;
2310
+ };
2311
+ enumValues?: string[];
2312
+ isArray?: boolean;
2313
+ }
2314
+
2495
2315
  type SqliteType = "INTEGER" | "REAL" | "TEXT" | "BLOB" | "ANY";
2496
2316
  type DefaultFn = () => unknown;
2497
2317
  interface ValidationResult {
@@ -2526,6 +2346,15 @@ interface ColumnDDLOptions {
2526
2346
  }
2527
2347
  declare abstract class Field {
2528
2348
  readonly context: FieldContext;
2349
+ /**
2350
+ * The `FieldFactoryExtra` this field was resolved with (minus `enumValues`,
2351
+ * which is re-derived from the persisted enum map at parse time to avoid
2352
+ * duplicating it per-column). Set by {@link resolveField} purely so
2353
+ * `SqliteConnection.serializeDeparseInfo` can round-trip typmod details
2354
+ * (array/length/numeric precision) that only live in the AST at collect
2355
+ * time — not consumed by the field itself.
2356
+ */
2357
+ factoryExtra?: Omit<FieldFactoryExtra, "enumValues">;
2529
2358
  constructor(context: FieldContext);
2530
2359
  abstract get sqliteType(): SqliteType;
2531
2360
  get isShimBacked(): boolean;
@@ -2701,11 +2530,18 @@ interface ISqliteConnectionConfig extends IConnectionConfig {
2701
2530
  type DeparsePostgresDdlResult = Awaited<ReturnType<typeof deparsePostgresDdl>>;
2702
2531
  type SqlitePostgresDeparseInfo = Pick<DeparsePostgresDdlResult, "enums" | "rls" | "schema" | "vars"> & Partial<Pick<DeparsePostgresDdlResult, "tableConstraints" | "comments">>;
2703
2532
  /**
2704
- * The JSON-serializable form of the deparse info the load-bearing runtime
2705
- * subset (`rls` + `vars`) that survives a `JSON.stringify` round-trip and is
2706
- * rehydrated by {@link SqliteConnection.parseDeparseInfo}. `ast`/`ddl` and the
2707
- * class-instance metadata (`schema`/`enums`/`tableConstraints`/`comments`) are
2708
- * intentionally omitted they are build-time artifacts that cannot round-trip.
2533
+ * The JSON-serializable form of the deparse info, rehydrated by
2534
+ * {@link SqliteConnection.parseDeparseInfo}. Covers the full runtime shape
2535
+ * except `ast`/`ddl` (build-time artifacts, intentionally omitted — never
2536
+ * cached). `schema` is `Map<string, TableSchema>` in memory; each `TableSchema`
2537
+ * holds `Field` instances that are fully determined by `resolveField(context,
2538
+ * extra)`, so it round-trips as `{context, extra}` per column (keyed
2539
+ * `${schema}.${table}`, matching `collectSchema`). `extra.enumValues` is
2540
+ * dropped and re-derived from the persisted `enums` map at parse time to
2541
+ * avoid duplicating enum members per column. `context.defaultFn` is always
2542
+ * `null` from the collectors today (collectors.ts, SqliteDeparser.ts) — it is
2543
+ * dropped here too; if a future collector ever sets it, it must be re-derived
2544
+ * at parse time instead of silently lost.
2709
2545
  * Produced by {@link SqliteConnection.serializeDeparseInfo}.
2710
2546
  */
2711
2547
  interface PersistedDeparseInfo {
@@ -2714,32 +2550,47 @@ interface PersistedDeparseInfo {
2714
2550
  policies: PolicyData[];
2715
2551
  };
2716
2552
  vars?: Record<string, CollectedVariable>;
2553
+ enums?: Record<string, string[]>;
2554
+ schema?: Record<string, Array<{
2555
+ context: Omit<FieldContext, "defaultFn">;
2556
+ extra?: Omit<FieldFactoryExtra, "enumValues">;
2557
+ }>>;
2558
+ tableConstraints?: CollectedTableConstraint[];
2559
+ comments?: CollectedComment[];
2717
2560
  }
2718
2561
  type SqlitePostgresTranslationResult = Pick<DeparsePostgresDdlResult, "ddl"> & Partial<DeparsePostgresDdlResult>;
2719
2562
  declare abstract class SqliteConnection<Driver = unknown, DB = any, Config extends ISqliteConnectionConfig = ISqliteConnectionConfig> extends Connection<Driver, DB, Config> {
2563
+ #private;
2720
2564
  dialect: Dialect$2;
2721
2565
  deserializeRow(row: Record<string, unknown>): Record<string, unknown>;
2722
2566
  constructor(config?: Config);
2723
- static parseDeparseInfo(details: any): {
2724
- rls?: undefined;
2725
- vars?: undefined;
2726
- } | {
2727
- rls: {
2728
- tables: any;
2729
- policies: any;
2730
- };
2731
- vars: any;
2732
- };
2567
+ /**
2568
+ * `opts.strict`: rethrow instead of swallowing a parse failure (default:
2569
+ * fail-soft, returning `{}`). The constructor path stays fail-soft — a
2570
+ * malformed `App({rls})` config shouldn't crash boot. The deparse-cache
2571
+ * restore path (`deparse-cache.ts`) uses `strict: true`: a partially
2572
+ * corrupt blob (e.g. a valid outer `rls` shape but a broken nested
2573
+ * `schema` entry) must NOT silently degrade to "restored with whatever
2574
+ * parsed" — that's indistinguishable from "restored with full RLS
2575
+ * metadata" to the caller, which would then report `restored` and enforce
2576
+ * nothing. Rethrowing lets the caller treat any nested corruption as a
2577
+ * cache miss and fall through to recalculation.
2578
+ */
2579
+ static parseDeparseInfo(details: any, opts?: {
2580
+ strict?: boolean;
2581
+ }): Partial<SqlitePostgresDeparseInfo>;
2733
2582
  /**
2734
2583
  * Serialize deparse info to its JSON form — the inverse of
2735
2584
  * {@link SqliteConnection.parseDeparseInfo}. Coerces `Set` → array, `Map` →
2736
- * object, and `Policy` → `PolicyData` (via `Policy.toJSON`), keeping only the
2737
- * `rls` + `vars` subset the runtime reconstructs. Feed the result to
2738
- * `JSON.stringify` for a `deparse.json` you can re-import into
2739
- * `translation.deparse`. Accepts a `translateDdl` result or a stored
2585
+ * object, and `Policy` → `PolicyData` (via `Policy.toJSON`), and flattens
2586
+ * `schema`'s `Field` instances to `{context, extra}` pairs (`extra` comes
2587
+ * from `Field#factoryExtra`, with `enumValues` dropped re-derived from
2588
+ * `enums` at parse time). `ast`/`ddl` are dropped; everything else round-trips.
2589
+ * Feed the result to `JSON.stringify` for a `deparse.json` you can re-import
2590
+ * into `translation.deparse`. Accepts a `translateDdl` result or a stored
2740
2591
  * `SqlitePostgresDeparseInfo`.
2741
2592
  */
2742
- static serializeDeparseInfo(info: Partial<Pick<SqlitePostgresDeparseInfo, "rls" | "vars">> | undefined | null): PersistedDeparseInfo;
2593
+ static serializeDeparseInfo(info: Partial<SqlitePostgresDeparseInfo> | undefined | null): PersistedDeparseInfo;
2743
2594
  updateDeparseInfo(details: NonNullable<ISqliteConnectionConfig["translation"]>["deparse"]): void;
2744
2595
  protected withSqlitePlugins(add_plugins?: KyselyPlugin[]): KyselyPlugin[];
2745
2596
  translateDdl(ddl: string): Promise<SqlitePostgresTranslationResult>;
@@ -2791,6 +2642,13 @@ declare abstract class SqliteConnection<Driver = unknown, DB = any, Config exten
2791
2642
  normalizeBindParams(parameters: readonly unknown[] | undefined): unknown[];
2792
2643
  normalizeDbError(e: unknown): unknown;
2793
2644
  onPostgrestAST(ast: AnyAST, vars?: VarsContext): Promise<AnyAST>;
2645
+ /**
2646
+ * Tables known to have RLS enabled in the APPLIED state of this database,
2647
+ * without any deparse metadata: the migration history replayed in applied
2648
+ * order (`rlsEnabledTables`). Empty when ddlDialect isn't postgres or the
2649
+ * history isn't readable.
2650
+ */
2651
+ private rlsEnabledFromHistory;
2794
2652
  private applyRls;
2795
2653
  }
2796
2654
 
@@ -3001,7 +2859,9 @@ type HonoContextWithAuth = HonoContext & {
3001
2859
  declare const resolveAuth: ({ onError, }?: {
3002
2860
  onError?: (error: unknown, c: Context<HonoContextWithAuth>) => Response | Promise<Response>;
3003
2861
  }) => hono.MiddlewareHandler<HonoContextWithAuth, string, {}, Response>;
3004
- declare const requireAuth: () => hono.MiddlewareHandler<HonoContextWithAuth, string, {}, Response>;
2862
+ declare const requireAuth: (options?: {
2863
+ acceptSecretApiKey?: boolean;
2864
+ }) => hono.MiddlewareHandler<HonoContextWithAuth, string, {}, Response>;
3005
2865
 
3006
2866
  declare function getStorageSchemaSql(clean?: boolean): string;
3007
2867
 
@@ -3012,4 +2872,4 @@ declare function isExperimentalEnabled(name: ExperimentalFeature): boolean;
3012
2872
  declare function setExperimental(name: ExperimentalFeature, enabled: boolean): void;
3013
2873
  declare function listEnabledExperimentals(): ExperimentalFeature[];
3014
2874
 
3015
- export { AnyAST, App, type AppDrivers, AwsSesEmailDriver, type AwsSesEmailDriverOptions, type BooleanLike, CacheDriver, CacheSetOptions, CloudConnection, CloudflareKvCacheDriver, type CloudflareKvCacheDriverOptions, Connection$1 as Connection, type DefaultAppConfig, type EmailDriver, type EmailMessage, type ExperimentalFeature, type HistoryVariant, type HonoContext, type IAppConfig, type ICloudConnectionConfig, type ISqliteConnectionConfig, InMemoryEmailDriver, type InMemoryEmailDriverOptions, InMemoryLruCacheDriver, type InMemoryLruCacheDriverOptions, IntrospectResult, InvalidPostgresToSQLiteTranslation, type MatchPattern, type MaybePromise, MigrateScope, type MigrationHistoryRow, NoopEmailDriver, type NoopEmailDriverOptions, NoopSmsDriver, type NoopSmsDriverOptions, type PartialAppDrivers, type PersistedDeparseInfo, Policy, type PolicyCommand, type PolicyData, type PolicyRole, type Primitive, type RedisCacheClient, RedisCacheDriver, type RedisCacheDriverOptions, ResendEmailDriver, type ResendEmailDriverOptions, SUPABASE_AUTH_HELPERS_SQL, Schema, SendmailEmailDriver, type SendmailEmailDriverOptions, type ServerOptions, type SmsDriver, type SmsMessage, SqliteConnection, type SqlitePostgresDeparseInfo, type SqlitePostgresTranslationResult, type StoredEmailMessage, TransactionOptions$1 as TransactionOptions, UnableToCreateRuntimeConnection, VarsContext, Where, appliedVersions, checkPasswordStrength, cleanSql, cloud, createAppDrivers, ensureHistoryTable, ensureVar, filterSearchParams, formatSendmailMessage, fuzzyMatch, getAuthSchemaSql, getMigrationHistorySchemaSql, getPath, getStatementsArray, getStorageSchemaSql, getVersion, historyVariant, invariant, isBooleanLike, isBun, isEmail, isEqual, isExperimentalEnabled, isNode, isObject, isPlainObject, isPrimitive, isString, jsonStringify, listEnabledExperimentals, listHistory, measureTime, mergeObject, mergeObjectWith, normalizeDefault, normalizeSql, normalizeString, normalizeType, objectDiff, omit, params, parseBigInt, patternMatch, pick, pipe, pipeEach, quote, randomString, recordVersion, removeVersion, removeVersionsGte, replacePlaceholders, requireAuth, resolveAuth, setExperimental, setPath, slugify, snakeToPascalWithSpaces, splitSqlStatements, studioRouteHandler, threw, threwAsync, translatePostgresDdl, truncate, trySync, ucFirst, ucFirstAll, uuid };
2875
+ export { AnyAST, type ApiKeyResolver, type ApiKeyType, App, type AppDrivers, AwsSesEmailDriver, type AwsSesEmailDriverOptions, type BooleanLike, CacheDriver, CacheSetOptions, CloudConnection, CloudflareKvCacheDriver, type CloudflareKvCacheDriverOptions, Connection$1 as Connection, ConsoleEmailDriver, type ConsoleEmailDriverOptions, type DefaultAppConfig, type EmailDriver, type EmailMessage, type ExperimentalFeature, type GeneratedApiKey, type HistoryVariant, type HonoContext, type IAppConfig, type ICloudConnectionConfig, type ISqliteConnectionConfig, InMemoryEmailDriver, type InMemoryEmailDriverOptions, InMemoryLruCacheDriver, type InMemoryLruCacheDriverOptions, IntrospectResult, InvalidPostgresToSQLiteTranslation, type MatchPattern, type MaybePromise, MigrateScope, type MigrationHistoryRow, NoopSmsDriver, type NoopSmsDriverOptions, type PartialAppDrivers, type PersistedDeparseInfo, Policy, type PolicyCommand, type PolicyData, type PolicyRole, type Primitive, type RedisCacheClient, RedisCacheDriver, type RedisCacheDriverOptions, ResendEmailDriver, type ResendEmailDriverOptions, type ResolvedKey, SELF_HOSTED_PROJECT_REF, SUPABASE_AUTH_HELPERS_SQL, Schema, SendmailEmailDriver, type SendmailEmailDriverOptions, type ServerOptions, type SmsDriver, type SmsMessage, SqliteConnection, type SqlitePostgresDeparseInfo, type SqlitePostgresTranslationResult, type StoredEmailMessage, TransactionOptions$1 as TransactionOptions, UnableToCreateRuntimeConnection, VarsContext, Where, apiKeyType, appliedVersions, checkPasswordStrength, cleanSql, cloud, createAppDrivers, ensureHistoryTable, ensureVar, filterSearchParams, formatSendmailMessage, fuzzyMatch, generateApiKey, getAuthSchemaSql, getMigrationHistorySchemaSql, getPath, getStatementsArray, getStorageSchemaSql, getVersion, hashApiKey, historyVariant, invariant, isBooleanLike, isBun, isEmail, isEqual, isExperimentalEnabled, isNode, isObject, isPlainObject, isPrimitive, isString, jsonStringify, listEnabledExperimentals, listHistory, measureTime, mergeObject, mergeObjectWith, normalizeDefault, normalizeSql, normalizeString, normalizeType, objectDiff, omit, params, parseBigInt, patternMatch, pick, pipe, pipeEach, quote, randomString, recordVersion, removeVersion, removeVersionsGte, replacePlaceholders, requireAuth, resolveAuth, setExperimental, setPath, slugify, snakeToPascalWithSpaces, splitSqlStatements, studioRouteHandler, threw, threwAsync, translatePostgresDdl, truncate, trySync, ucFirst, ucFirstAll, uuid };