@supabase/lite 0.8.1-next.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,7 @@ declare const schema: s.ObjectSchema<{
145
145
  otp_length?: number | undefined;
146
146
  otp_expiry?: number | undefined;
147
147
  smtp?: {
148
+ enabled?: boolean | undefined;
148
149
  port?: number | undefined;
149
150
  host?: string | undefined;
150
151
  user?: string | undefined;
@@ -446,6 +447,7 @@ declare const schema: s.ObjectSchema<{
446
447
  otp_length?: number | undefined;
447
448
  otp_expiry?: number | undefined;
448
449
  smtp?: {
450
+ enabled?: boolean | undefined;
449
451
  port?: number | undefined;
450
452
  host?: string | undefined;
451
453
  user?: string | undefined;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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-Bv2S5btu.js';
3
+ import { D as DefaultSchema, S as Schema } from './index-DKO3OQpz.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';
@@ -169,8 +169,13 @@ interface AuthConfig {
169
169
  otp_length?: number;
170
170
  otp_expiry?: number;
171
171
  smtp?: {
172
- sender_name?: string;
172
+ enabled?: boolean;
173
+ host?: string;
174
+ port?: number;
175
+ user?: string;
176
+ pass?: string;
173
177
  admin_email?: string;
178
+ sender_name?: string;
174
179
  };
175
180
  template?: Partial<Record<EmailTemplateType, EmailTemplateConfig>>;
176
181
  };
@@ -427,6 +432,43 @@ declare class SendmailEmailDriver implements EmailDriver {
427
432
  }
428
433
  declare function formatSendmailMessage(from: string, message: EmailMessage): string;
429
434
 
435
+ interface SmtpTransporter {
436
+ sendMail(mail: Record<string, unknown>): Promise<unknown>;
437
+ }
438
+ type SmtpCreateTransport = (options: Record<string, unknown>) => SmtpTransporter;
439
+ type SmtpAddress = string | {
440
+ name?: string;
441
+ address: string;
442
+ };
443
+ interface SmtpEmailDriverOptions {
444
+ host: string;
445
+ port?: number;
446
+ user?: string;
447
+ pass?: string;
448
+ from: SmtpAddress;
449
+ secure?: boolean;
450
+ /** Default: true when user+pass are set and secure (implicit TLS) is false. Set false to opt out. */
451
+ requireTls?: boolean;
452
+ /** Node-only escape hatch for self-signed TLS certs; default true (validate). */
453
+ rejectUnauthorized?: boolean;
454
+ timeoutMs?: number;
455
+ /** Injectable for tests; defaults to nodemailer's createTransport. */
456
+ createTransport?: SmtpCreateTransport;
457
+ }
458
+ /** Pure mapper to nodemailer transport options, exported for tests. */
459
+ declare function buildSmtpTransportOptions(options: SmtpEmailDriverOptions): Record<string, unknown>;
460
+ /** Pure mapper to a nodemailer mail payload, exported for tests. */
461
+ declare function buildSmtpMail(from: SmtpAddress, message: EmailMessage): Record<string, unknown>;
462
+ /** Testable seam for the runtime guard below; real callers always pass isNode() || isBun(). */
463
+ declare function assertSmtpSupportedRuntime(isSupported: boolean): void;
464
+ declare class SmtpEmailDriver implements EmailDriver {
465
+ private readonly options;
466
+ private transporter?;
467
+ constructor(options: SmtpEmailDriverOptions);
468
+ send(message: EmailMessage): Promise<void>;
469
+ private getTransporter;
470
+ }
471
+
430
472
  interface EmailMessage {
431
473
  to: string;
432
474
  subject: string;
@@ -486,7 +528,22 @@ interface AppDrivers {
486
528
  cache: CacheDriver;
487
529
  }
488
530
  type PartialAppDrivers = Partial<AppDrivers>;
489
- declare function createAppDrivers(drivers?: PartialAppDrivers): AppDrivers;
531
+ interface AppDriversConfig {
532
+ auth?: {
533
+ email?: {
534
+ smtp?: {
535
+ enabled?: boolean;
536
+ host?: string;
537
+ port?: number;
538
+ user?: string;
539
+ pass?: string;
540
+ admin_email?: string;
541
+ sender_name?: string;
542
+ };
543
+ };
544
+ };
545
+ }
546
+ declare function createAppDrivers(drivers?: PartialAppDrivers, config?: AppDriversConfig): AppDrivers;
490
547
 
491
548
  interface Mailer {
492
549
  sendConfirmation(email: string, token: string, otp: string, meta?: MailMeta): Promise<void>;
@@ -2768,6 +2825,7 @@ declare function filterSearchParams(reqOrSearchParams: Request | URLSearchParams
2768
2825
 
2769
2826
  declare function isNode(): boolean;
2770
2827
  declare function isBun(): boolean;
2828
+ declare function isWorkerd(): boolean;
2771
2829
  declare function invariant(condition: boolean | any, message: string): void;
2772
2830
  declare function threw(fn: () => any, instance?: new (...args: any[]) => Error): boolean;
2773
2831
  declare function threwAsync(fn: Promise<any>, instance?: new (...args: any[]) => Error): Promise<boolean>;
@@ -2786,6 +2844,7 @@ declare function getStatementsArray(sql: string, clean?: boolean): string[];
2786
2844
  declare function splitSqlStatements(sql: string): string[];
2787
2845
  declare function normalizeType(t: string): string;
2788
2846
  declare function normalizeSql(sql: string): string;
2847
+ declare function tableStructuralItems(sql: string): string[] | null;
2789
2848
  declare function normalizeDefault(d: string | null): string | null;
2790
2849
 
2791
2850
  declare function randomString(length?: number, opts?: {
@@ -2872,4 +2931,4 @@ declare function isExperimentalEnabled(name: ExperimentalFeature): boolean;
2872
2931
  declare function setExperimental(name: ExperimentalFeature, enabled: boolean): void;
2873
2932
  declare function listEnabledExperimentals(): ExperimentalFeature[];
2874
2933
 
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 };
2934
+ export { AnyAST, type ApiKeyResolver, type ApiKeyType, App, type AppDrivers, type AppDriversConfig, 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, type SmtpAddress, type SmtpCreateTransport, SmtpEmailDriver, type SmtpEmailDriverOptions, type SmtpTransporter, SqliteConnection, type SqlitePostgresDeparseInfo, type SqlitePostgresTranslationResult, type StoredEmailMessage, TransactionOptions$1 as TransactionOptions, UnableToCreateRuntimeConnection, VarsContext, Where, apiKeyType, appliedVersions, assertSmtpSupportedRuntime, buildSmtpMail, buildSmtpTransportOptions, 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, isWorkerd, 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, tableStructuralItems, threw, threwAsync, translatePostgresDdl, truncate, trySync, ucFirst, ucFirstAll, uuid };