@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,182 @@
1
+ import { d as deparsePostgresDdl, A as AnyAST, V as VarsContext, I as IntrospectResult$1, T as TransactionOptions$1, a as IConnectionConfig$1, C as Connection$1 } from '../Connection-rAPmec1m.js';
2
+ import { ConnectionMigrator, MaybePromise, SchemaDiffResult, PlanStep, PlanResult, IConnectionConfig, Connection, Dialect, IntrospectResult, TransactionOptions } from '@supabase/lite';
3
+ import { KyselyPlugin } from 'kysely';
4
+ import 'libpg-query';
5
+ import 'pgsql-deparser';
6
+
7
+ type SqliteMigratorOptions = {
8
+ onTranslation?: (result: SqlitePostgresTranslationResult) => MaybePromise<void>;
9
+ };
10
+ declare class SqliteMigrator implements ConnectionMigrator {
11
+ private readonly conn;
12
+ private readonly desiredSchema;
13
+ private readonly options;
14
+ private readonly differ;
15
+ private readonly planner;
16
+ translationResult?: SqlitePostgresTranslationResult;
17
+ constructor(conn: SqliteConnection, desiredSchema: string, options?: SqliteMigratorOptions);
18
+ getDesiredSchema(): Promise<string>;
19
+ diff(): Promise<SchemaDiffResult>;
20
+ safeSortPlanSteps(steps: PlanStep[]): PlanStep[];
21
+ migratePlan(planResult: PlanResult, opts?: {
22
+ force?: boolean;
23
+ }): Promise<void>;
24
+ migrate(opts?: {
25
+ force?: boolean;
26
+ }): Promise<SchemaDiffResult>;
27
+ }
28
+
29
+ interface ISqliteConnectionConfig extends IConnectionConfig {
30
+ /**
31
+ * The origin dialect for schema declarations. If "postgres",
32
+ * the schema declarations will be translated to SQLite syntax.
33
+ * If "sqlite", the schema declarations will be left as is.
34
+ * @default "postgres"
35
+ */
36
+ ddlDialect?: "postgres" | "sqlite";
37
+ /**
38
+ * The origin dialect for query execution. If "sqlite", the queries will be executed as is.
39
+ * Currently only "sqlite" is supported.
40
+ * @default "sqlite"
41
+ */
42
+ queryDialect?: "sqlite";
43
+ /**
44
+ * Max bound parameters per statement. Enforced across all SQLite drivers
45
+ * for portability: drivers and hosts vary in how many parameters they
46
+ * accept (e.g. Cloudflare D1, sqlite-wasm), so we cap conservatively.
47
+ * Statements exceeding this throw before execution.
48
+ * @default 100
49
+ */
50
+ maxBoundParameters?: number;
51
+ /**
52
+ * Translation options for SQLite databases
53
+ */
54
+ translation?: {
55
+ /**
56
+ * The approach to take when translating PostgreSQL schema declarations to SQLite syntax.
57
+ * Only applies if `ddl` is "postgres".
58
+ */
59
+ schemas?: {
60
+ /**
61
+ * The approach to take when translating PostgreSQL schema declarations to SQLite syntax.
62
+ * If "quote" -> `public`.`table` -> `"public.table"`
63
+ * If "snake_case" -> `public`.`table` -> `public__table`
64
+ * @default "quote"
65
+ */
66
+ approach?: "quote" | "snake_case";
67
+ /**
68
+ * Whether to append the default schema to the table name when a table does not have a schema
69
+ * @default false
70
+ */
71
+ appendDefaultSchema?: boolean;
72
+ /**
73
+ * The default schema to use when a table does not have a schema
74
+ * @default "public"
75
+ */
76
+ defaultSchema?: string | false;
77
+ };
78
+ /**
79
+ * Deparse details the connection must be aware of
80
+ */
81
+ deparse?: SqlitePostgresDeparseInfo;
82
+ };
83
+ }
84
+ type DeparsePostgresDdlResult = Awaited<ReturnType<typeof deparsePostgresDdl>>;
85
+ type SqlitePostgresDeparseInfo = Pick<DeparsePostgresDdlResult, "enums" | "rls" | "schema" | "vars"> & Partial<Pick<DeparsePostgresDdlResult, "tableConstraints" | "comments">>;
86
+ type SqlitePostgresTranslationResult = Pick<DeparsePostgresDdlResult, "ddl"> & Partial<DeparsePostgresDdlResult>;
87
+ declare abstract class SqliteConnection<Driver = unknown, DB = any, Config extends ISqliteConnectionConfig = ISqliteConnectionConfig> extends Connection<Driver, DB, Config> {
88
+ dialect: Dialect;
89
+ deserializeRow(row: Record<string, unknown>): Record<string, unknown>;
90
+ constructor(config?: Config);
91
+ static parseDeparseInfo(details: any): {
92
+ rls?: undefined;
93
+ vars?: undefined;
94
+ } | {
95
+ rls: {
96
+ tables: any;
97
+ policies: any;
98
+ };
99
+ vars: any;
100
+ };
101
+ updateDeparseInfo(details: NonNullable<ISqliteConnectionConfig["translation"]>["deparse"]): void;
102
+ protected withSqlitePlugins(add_plugins?: KyselyPlugin[]): KyselyPlugin[];
103
+ translateDdl(ddl: string): Promise<SqlitePostgresTranslationResult>;
104
+ introspect(options?: {
105
+ useCache?: boolean;
106
+ postprocess?: boolean;
107
+ }): Promise<IntrospectResult>;
108
+ transaction(statements: string[], opts?: TransactionOptions): Promise<void>;
109
+ close(): Promise<void>;
110
+ /**
111
+ * When ddlDialect === "postgres", enrich the PRAGMA-derived IntrospectResult
112
+ * with metadata recovered from the parsed Postgres DDL: real FK constraint
113
+ * names, table-level UNIQUE/CHECK constraints, column pg_type / is_generated,
114
+ * and comments.
115
+ */
116
+ private mergeDeparseMetadata;
117
+ private markForeignKeyVisibility;
118
+ /**
119
+ * Create a migrator for the given schema.
120
+ * @param desiredSchema The desired schema to migrate to. Input DDL is expected to be `config.ddlDialect`.
121
+ * @returns A migrator instance.
122
+ */
123
+ createMigrator(desiredSchema: string): SqliteMigrator;
124
+ get maxBoundParameters(): number;
125
+ /**
126
+ * Throws if the compiled statement has more bound parameters than
127
+ * `maxBoundParameters`. Drivers call this from their query executor so
128
+ * the same limit is enforced regardless of host capability.
129
+ */
130
+ assertParamLimit(parameters: readonly unknown[] | undefined): void;
131
+ /**
132
+ * Asserts the parameter limit and normalizes bind values. Drivers call
133
+ * this once per statement; same limit and same value coercion everywhere.
134
+ */
135
+ prepareBindParams(parameters: readonly unknown[] | undefined): unknown[];
136
+ /**
137
+ * Coerces JS values to types every SQLite driver accepts. Drivers vary:
138
+ * `bun:sqlite` silently coerces booleans, `node:sqlite` throws. Normalize
139
+ * centrally so the executor boundary behaves identically everywhere.
140
+ *
141
+ * - `undefined` is dropped (matches prior DO behaviour and Kysely slots
142
+ * that never bound a value).
143
+ * - `boolean` → `0` / `1`.
144
+ * - pass-through: `null`, `number`, `bigint`, `string`, `Uint8Array`,
145
+ * `ArrayBuffer`, `Date` (drivers handle these, or upstream field
146
+ * serializers have already converted).
147
+ * - unknown types throw with the offending index so divergence surfaces
148
+ * loudly instead of as a driver-specific bind error.
149
+ */
150
+ normalizeBindParams(parameters: readonly unknown[] | undefined): unknown[];
151
+ normalizeDbError(e: unknown): unknown;
152
+ onPostgrestAST(ast: AnyAST, vars?: VarsContext): Promise<AnyAST>;
153
+ private applyRls;
154
+ }
155
+
156
+ interface ICloudConnectionConfig extends ISqliteConnectionConfig {
157
+ projectRef: string;
158
+ token: string;
159
+ host: string;
160
+ }
161
+ declare class CloudConnection<DB = any> extends SqliteConnection<never, DB> {
162
+ readonly config: ICloudConnectionConfig;
163
+ dialect: "sqlite";
164
+ driver: never;
165
+ kysely: never;
166
+ constructor(config: ICloudConnectionConfig);
167
+ private fetch;
168
+ introspect(options?: {
169
+ useCache?: boolean;
170
+ postprocess?: boolean;
171
+ }): Promise<IntrospectResult$1>;
172
+ transaction(statements: string[], opts?: TransactionOptions$1): Promise<void>;
173
+ exec<T = {
174
+ rows: unknown[];
175
+ } | void>(statement: string, ...parameters: readonly unknown[]): Promise<T>;
176
+ close(): Promise<void>;
177
+ }
178
+ declare function cloud<DB = any>(config: ICloudConnectionConfig): CloudConnection<DB>;
179
+
180
+ declare function createConnection(_config?: IConnectionConfig$1): Promise<Connection$1>;
181
+
182
+ export { CloudConnection, Connection$1 as Connection, type ICloudConnectionConfig, IConnectionConfig$1 as IConnectionConfig, type ISqliteConnectionConfig, SqliteConnection, type SqlitePostgresTranslationResult, cloud, createConnection };