@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/LIMITATIONS.md +17 -4
- package/PATTERNS.md +22 -1
- package/README.md +50 -6
- package/STATUS.md +49 -23
- package/dist/{Connection-D9UUTsjg.d.ts → Connection-ZWTDByQ5.d.ts} +27 -0
- package/dist/cli/index.js +179 -141
- package/dist/cli/lib.d.ts +57 -6
- package/dist/cli/lib.js +48 -45
- package/dist/db/bun/index.d.ts +1 -0
- package/dist/db/bun/index.js +2 -2
- package/dist/db/fallback.d.ts +1 -1
- package/dist/db/node/index.d.ts +1 -0
- package/dist/db/node/index.js +2 -2
- package/dist/db/postgres/pglite/PgliteConnection.js +22 -22
- package/dist/db/workerd/index.d.ts +2 -0
- package/dist/db/workerd/index.js +2 -2
- package/dist/{index-xv_pDjEt.d.ts → index-Bv2S5btu.d.ts} +40 -0
- package/dist/index.d.ts +342 -482
- package/dist/index.js +99 -67
- package/dist/static/.vite/manifest.json +2 -2
- package/dist/static/assets/{main-DO_xnvTw.js → main-1bwWb_1q.js} +100 -17
- package/dist/static/assets/{main-BITGMylP.css → main-BDsRycsc.css} +39 -0
- package/dist/vite/index.d.ts +318 -478
- package/dist/vite/index.js +2 -2
- package/package.json +5 -5
- package/skills/supalite/SKILL.md +1 -1
package/dist/cli/lib.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
2
2
|
import { SupportedStorage, SupabaseClient } from '@supabase/supabase-js';
|
|
3
|
-
import { S as Schema } from '../index-
|
|
3
|
+
import { S as Schema } from '../index-Bv2S5btu.js';
|
|
4
4
|
import { Connection, DefaultAppConfig, App } from '@supabase/lite';
|
|
5
5
|
import 'jsonv-ts';
|
|
6
6
|
|
|
@@ -72,7 +72,24 @@ declare class ProjectLocalApi extends ProjectApi {
|
|
|
72
72
|
protected readConfig(file_path?: string): Promise<Schema>;
|
|
73
73
|
createConnection(): Promise<Connection>;
|
|
74
74
|
getConfig(file_path?: string): Promise<DefaultAppConfig>;
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Build the `App` for a local project: read the config, resolve the
|
|
77
|
+
* connection, apply caller overrides, and initialize it.
|
|
78
|
+
*
|
|
79
|
+
* @param opts.admin An explicit local-admin-mode decision (see
|
|
80
|
+
* `ServerOptions.admin`) — `--no-admin`, or the Vite preview server's forced
|
|
81
|
+
* opt-out. Wins over `config.toml`: otherwise a config saying `admin = true`
|
|
82
|
+
* would silently re-enable what the operator just turned off.
|
|
83
|
+
* @param opts.adminDefault The launcher's default, applied only when neither
|
|
84
|
+
* the caller nor the config expressed a preference — so a project can set
|
|
85
|
+
* `admin = false` in config and have `lite start` honor it.
|
|
86
|
+
*
|
|
87
|
+
* Resolution order is therefore `admin` > `config.toml` > `adminDefault`.
|
|
88
|
+
*/
|
|
89
|
+
createApp(config_path?: string, opts?: {
|
|
90
|
+
admin?: boolean;
|
|
91
|
+
adminDefault?: boolean;
|
|
92
|
+
}): Promise<App>;
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
declare class ProjectRemoteApi extends ProjectApi {
|
|
@@ -119,20 +136,27 @@ declare class Api extends BaseApi<ApiConfig> {
|
|
|
119
136
|
|
|
120
137
|
declare function createApi(options?: Partial<ApiConfig>): Promise<Api>;
|
|
121
138
|
|
|
139
|
+
type GeneratedProjectKeys = {
|
|
140
|
+
publishable?: string;
|
|
141
|
+
secret?: string;
|
|
142
|
+
};
|
|
122
143
|
declare function ensureInitialStructure(opts?: Partial<{
|
|
123
144
|
configFormat: "toml" | "json";
|
|
124
145
|
driver: NonNullable<Schema["db"]>["driver"];
|
|
125
146
|
recreate: boolean;
|
|
126
147
|
template: boolean;
|
|
127
|
-
}>): Promise<
|
|
148
|
+
}>): Promise<{
|
|
149
|
+
generatedKeys?: GeneratedProjectKeys;
|
|
150
|
+
}>;
|
|
128
151
|
|
|
129
152
|
declare function ensureSchema(app: App, opts?: {
|
|
130
153
|
force?: boolean;
|
|
131
154
|
}): Promise<void>;
|
|
155
|
+
/** Returns a stop function so callers can tear the watcher down on shutdown. */
|
|
132
156
|
declare function watchSchema(app: App, opts?: {
|
|
133
157
|
force?: boolean;
|
|
134
158
|
translate?: boolean;
|
|
135
|
-
}): void
|
|
159
|
+
}): () => Promise<void>;
|
|
136
160
|
|
|
137
161
|
interface MigrationFile {
|
|
138
162
|
version: string;
|
|
@@ -148,12 +172,39 @@ interface ApplyResult {
|
|
|
148
172
|
applied: MigrationFile[];
|
|
149
173
|
skipped: MigrationFile[];
|
|
150
174
|
}
|
|
175
|
+
interface ApplyOptions {
|
|
176
|
+
/**
|
|
177
|
+
* Persist the migration-derived deparse snapshot even when the project has
|
|
178
|
+
* declarative `supabase/schemas/*.sql`. Set ONLY by `lite db reset`, which is
|
|
179
|
+
* destructive: it drops whatever a declarative apply built, so migration
|
|
180
|
+
* metadata then describes the fresh database exactly. Non-destructive callers
|
|
181
|
+
* must not opt in — their snapshot would validate on the next `lite start`
|
|
182
|
+
* while missing every declarative policy (LITE-310).
|
|
183
|
+
*/
|
|
184
|
+
persistWithDeclarative?: boolean;
|
|
185
|
+
}
|
|
151
186
|
/**
|
|
152
187
|
* Apply pending migrations to the connected database, one implicit transaction
|
|
153
188
|
* per file. The history INSERT is appended to the file's batch so a failure in
|
|
154
189
|
* any statement rolls back the record too — same semantics as Supabase CLI
|
|
155
190
|
* (`~/supabase/cli/pkg/migration/file.go:72-103` `ExecBatch`).
|
|
156
191
|
*/
|
|
157
|
-
declare function applyPendingMigrations(app: App): Promise<ApplyResult>;
|
|
192
|
+
declare function applyPendingMigrations(app: App, options?: ApplyOptions): Promise<ApplyResult>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Resolve the project's configured `auth.publishable_key`, fully substituted
|
|
196
|
+
* (an `env(VAR)` ref resolves to the real value, or "" if unset) — without
|
|
197
|
+
* opening a database connection. Used where only the key is needed (e.g. the
|
|
198
|
+
* Vite plugin's `config()` hook, which runs before the app/connection exists).
|
|
199
|
+
* Returns `undefined` when no project/config is found, the config can't be
|
|
200
|
+
* read (missing/malformed — never crash `vite dev` over this), or no key is
|
|
201
|
+
* configured.
|
|
202
|
+
*
|
|
203
|
+
* `env` defaults to `process.env` but can be overridden with an isolated
|
|
204
|
+
* object — tests share one process (`bun test` interleaves files async), so
|
|
205
|
+
* mutating the real `process.env` here (via `loadDotenvForConfig`'s
|
|
206
|
+
* first-write-wins) would otherwise race with any other test's `.env` load.
|
|
207
|
+
*/
|
|
208
|
+
declare function resolveConfiguredPublishableKey(configPath?: string, env?: NodeJS.ProcessEnv): Promise<string | undefined>;
|
|
158
209
|
|
|
159
|
-
export { applyPendingMigrations, createApi, ensureInitialStructure, ensureSchema, listMigrationFiles, migrationsDir, watchSchema };
|
|
210
|
+
export { applyPendingMigrations, createApi, ensureInitialStructure, ensureSchema, listMigrationFiles, migrationsDir, resolveConfiguredPublishableKey, watchSchema };
|