local-lite-server 0.0.0-stage → 0.1.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 (90) hide show
  1. package/README.md +103 -2
  2. package/admin/dist/assets/index-B2nX9Pef.js +18 -0
  3. package/admin/dist/assets/index-Dt3bXEks.css +2 -0
  4. package/admin/dist/favicon.svg +11 -0
  5. package/admin/dist/index.html +14 -0
  6. package/dist/admin/console.d.ts +19 -0
  7. package/dist/admin/console.js +166 -0
  8. package/dist/admin/index.d.ts +28 -0
  9. package/dist/admin/index.js +13 -0
  10. package/dist/admin/ops.d.ts +11 -0
  11. package/dist/admin/ops.js +279 -0
  12. package/dist/admin/session.d.ts +14 -0
  13. package/dist/admin/session.js +160 -0
  14. package/dist/apiKeys.d.ts +36 -0
  15. package/dist/apiKeys.js +91 -0
  16. package/dist/app.d.ts +1 -0
  17. package/dist/app.js +10 -0
  18. package/dist/auth.d.ts +16 -0
  19. package/dist/auth.js +99 -0
  20. package/dist/cli.d.ts +2 -0
  21. package/dist/cli.js +127 -0
  22. package/dist/codegen.d.ts +4 -0
  23. package/dist/codegen.js +74 -0
  24. package/dist/config.d.ts +39 -0
  25. package/dist/config.js +51 -0
  26. package/dist/core/broker.d.ts +12 -0
  27. package/dist/core/broker.js +78 -0
  28. package/dist/core/changes.d.ts +17 -0
  29. package/dist/core/changes.js +68 -0
  30. package/dist/core/http.d.ts +8 -0
  31. package/dist/core/http.js +72 -0
  32. package/dist/core/mailer.d.ts +3 -0
  33. package/dist/core/mailer.js +11 -0
  34. package/dist/cpanel.d.ts +1 -0
  35. package/dist/cpanel.js +96 -0
  36. package/dist/crons.d.ts +24 -0
  37. package/dist/crons.js +124 -0
  38. package/dist/db.d.ts +7 -0
  39. package/dist/db.js +37 -0
  40. package/dist/functions/index.d.ts +3 -0
  41. package/dist/functions/index.js +3 -0
  42. package/dist/functions/loader.d.ts +4 -0
  43. package/dist/functions/loader.js +64 -0
  44. package/dist/functions/runtime.d.ts +21 -0
  45. package/dist/functions/runtime.js +238 -0
  46. package/dist/functions/types.d.ts +59 -0
  47. package/dist/functions/types.js +16 -0
  48. package/dist/index.d.ts +12 -0
  49. package/dist/index.js +7 -0
  50. package/dist/migrations.d.ts +16 -0
  51. package/dist/migrations.js +254 -0
  52. package/dist/oauth.d.ts +7 -0
  53. package/dist/oauth.js +152 -0
  54. package/dist/rateLimit.d.ts +12 -0
  55. package/dist/rateLimit.js +54 -0
  56. package/dist/routes.d.ts +15 -0
  57. package/dist/routes.js +29 -0
  58. package/dist/rules.d.ts +23 -0
  59. package/dist/rules.js +73 -0
  60. package/dist/schema.d.ts +18 -0
  61. package/dist/schema.js +89 -0
  62. package/dist/server.d.ts +13 -0
  63. package/dist/server.js +340 -0
  64. package/dist/start.d.ts +8 -0
  65. package/dist/start.js +168 -0
  66. package/dist/storage.d.ts +4 -0
  67. package/dist/storage.js +82 -0
  68. package/dist/tableStorage.d.ts +63 -0
  69. package/dist/tableStorage.js +261 -0
  70. package/docs/api.md +181 -0
  71. package/docs/client-usage.md +104 -0
  72. package/docs/cpanel.md +63 -0
  73. package/docs/functions.md +78 -0
  74. package/docs/schema-and-migrations.md +54 -0
  75. package/docs/vps.md +67 -0
  76. package/package.json +54 -4
  77. package/templates/.env +16 -0
  78. package/templates/.env.example +49 -0
  79. package/templates/README.md +23 -0
  80. package/templates/data/backups/.gitkeep +1 -0
  81. package/templates/data/uploads/.gitkeep +1 -0
  82. package/templates/gitignore +29 -0
  83. package/templates/package.json +14 -0
  84. package/templates/src/functions/notes.ts +47 -0
  85. package/templates/src/lib/validators.ts +9 -0
  86. package/templates/src/rules.ts +12 -0
  87. package/templates/src/schema.ts +9 -0
  88. package/templates/src/types.ts +9 -0
  89. package/templates/tests/notes.test.ts +26 -0
  90. package/templates/tsconfig.json +13 -0
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './loader.js';
3
+ export * from './runtime.js';
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './loader.js';
3
+ export * from './runtime.js';
@@ -0,0 +1,4 @@
1
+ import type { FunctionRegistry } from './types.js';
2
+ export declare function loadFunctionsDir(dir?: string, cwd?: string, bustCache?: boolean): Promise<FunctionRegistry>;
3
+ /** Hot-reloads `functions/` in place on file edits without dropping SSE connections. */
4
+ export declare function watchFunctionsDir(dir: string | undefined, registry: FunctionRegistry, cwd?: string): () => void;
@@ -0,0 +1,64 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ const EXTENSIONS = ['.ts', '.mts', '.mjs', '.js'];
5
+ function resolveFunctionsDir(dir, cwd) {
6
+ if (dir)
7
+ return path.resolve(cwd, dir);
8
+ const inSrc = path.resolve(cwd, 'src/functions');
9
+ // Avoid loading local-lite-server's own internal src/functions/ runtime when running inside this repo.
10
+ if (fs.existsSync(inSrc) &&
11
+ fs.statSync(inSrc).isDirectory() &&
12
+ !fs.existsSync(path.join(inSrc, 'runtime.ts'))) {
13
+ return inSrc;
14
+ }
15
+ return path.resolve(cwd, 'functions');
16
+ }
17
+ export async function loadFunctionsDir(dir, cwd = process.cwd(), bustCache = false) {
18
+ const registry = new Map();
19
+ const abs = resolveFunctionsDir(dir, cwd);
20
+ if (!fs.existsSync(abs) || !fs.statSync(abs).isDirectory())
21
+ return registry;
22
+ for (const entry of fs.readdirSync(abs, { withFileTypes: true })) {
23
+ if (!entry.isFile() || entry.name.startsWith('_') || entry.name.endsWith('.d.ts'))
24
+ continue;
25
+ const ext = EXTENSIONS.find((e) => entry.name.endsWith(e));
26
+ if (!ext)
27
+ continue;
28
+ const modName = entry.name.slice(0, -ext.length);
29
+ const url = pathToFileURL(path.join(abs, entry.name)).href + (bustCache ? `?t=${Date.now()}` : '');
30
+ const mod = await import(url);
31
+ for (const [expName, val] of Object.entries(mod)) {
32
+ if (val && typeof val === 'object' && '__kind' in val && typeof val.handler === 'function') {
33
+ registry.set(`${modName}/${expName}`, val);
34
+ }
35
+ }
36
+ }
37
+ return registry;
38
+ }
39
+ /** Hot-reloads `functions/` in place on file edits without dropping SSE connections. */
40
+ export function watchFunctionsDir(dir, registry, cwd = process.cwd()) {
41
+ const abs = resolveFunctionsDir(dir, cwd);
42
+ if (!fs.existsSync(abs))
43
+ return () => { };
44
+ let timer;
45
+ const watcher = fs.watch(abs, () => {
46
+ clearTimeout(timer);
47
+ timer = setTimeout(async () => {
48
+ try {
49
+ const next = await loadFunctionsDir(dir, cwd, true);
50
+ registry.clear();
51
+ for (const [k, v] of next)
52
+ registry.set(k, v);
53
+ console.log(`[local-lite-server] hot-reloaded ${registry.size} function(s)`);
54
+ }
55
+ catch (err) {
56
+ console.error('[local-lite-server] function reload failed:', err);
57
+ }
58
+ }, 120);
59
+ });
60
+ return () => {
61
+ clearTimeout(timer);
62
+ watcher.close();
63
+ };
64
+ }
@@ -0,0 +1,21 @@
1
+ import { type SqlExecutor, type SyncEventBroker } from 'local-lite/server';
2
+ import type { SchemaDictionary } from '../schema.js';
3
+ import { type FunctionAuth, type FunctionKind, type FunctionRegistry } from './types.js';
4
+ export interface FunctionRuntime {
5
+ list(): Array<{
6
+ name: string;
7
+ kind: FunctionKind;
8
+ }>;
9
+ run(name: string, rawArgs: Record<string, unknown>, auth: FunctionAuth): Promise<{
10
+ result: unknown;
11
+ readTables: Set<string>;
12
+ }>;
13
+ subscribe(name: string, rawArgs: Record<string, unknown>, auth: FunctionAuth): Promise<Response>;
14
+ }
15
+ export declare function createFunctionRuntime(opts: {
16
+ registry: FunctionRegistry;
17
+ db: SqlExecutor;
18
+ schema: SchemaDictionary;
19
+ broker: SyncEventBroker;
20
+ scopeField?: string;
21
+ }): FunctionRuntime;
@@ -0,0 +1,238 @@
1
+ import { quoteIdent } from 'local-lite/server';
2
+ import { newRowId, patchTableRow, recordChange, setRowDeleted, upsertTableRow, } from '../core/changes.js';
3
+ import { fromDbRow, toDbValue } from '../tableStorage.js';
4
+ import { FunctionError, } from './types.js';
5
+ function createReader(db, schema, readTables) {
6
+ const q = (n) => quoteIdent(n, db.dialect);
7
+ const fieldsOf = (table) => {
8
+ const f = Object.hasOwn(schema, table) ? schema[table] : undefined;
9
+ if (!f)
10
+ throw new FunctionError(`Unknown table "${table}".`, 400);
11
+ return f;
12
+ };
13
+ const notDeleted = db.dialect === 'postgres' ? 'FALSE' : '0';
14
+ return {
15
+ async get(table, id) {
16
+ const fields = fieldsOf(table);
17
+ readTables.add(table);
18
+ const rows = await db.query(`SELECT * FROM ${q(table)} WHERE ${q('id')} = ? AND ${q('deleted')} = ${notDeleted} LIMIT 1`, [id]);
19
+ return rows[0] ? { id: String(rows[0].id), ...fromDbRow(fields, rows[0]) } : null;
20
+ },
21
+ async list(table, opts = {}) {
22
+ const fields = fieldsOf(table);
23
+ readTables.add(table);
24
+ const clauses = [];
25
+ const params = [];
26
+ if (!opts.includeDeleted)
27
+ clauses.push(`${q('deleted')} = ${notDeleted}`);
28
+ if (opts.where) {
29
+ for (const [col, val] of Object.entries(opts.where)) {
30
+ if (!Object.hasOwn(fields, col))
31
+ throw new FunctionError(`Unknown column "${table}.${col}".`, 400);
32
+ if (val === null)
33
+ clauses.push(`${q(col)} IS NULL`);
34
+ else {
35
+ clauses.push(`${q(col)} = ?`);
36
+ params.push(toDbValue(fields[col], val, db.dialect));
37
+ }
38
+ }
39
+ }
40
+ const whereSql = clauses.length ? `WHERE ${clauses.join(' AND ')}` : '';
41
+ const orderCol = opts.orderBy && Object.hasOwn(fields, opts.orderBy) ? opts.orderBy : 'updated_at';
42
+ const dir = opts.order === 'asc' ? 'ASC' : 'DESC';
43
+ const limit = Math.min(Math.max(Math.floor(opts.limit ?? 100), 1), 1000);
44
+ const offset = Math.max(Math.floor(opts.offset ?? 0), 0);
45
+ const rows = await db.query(`SELECT * FROM ${q(table)} ${whereSql} ORDER BY ${q(orderCol)} ${dir} LIMIT ${limit} OFFSET ${offset}`, params);
46
+ return rows.map((r) => ({ id: String(r.id), ...fromDbRow(fields, r) }));
47
+ },
48
+ async sql(query, params = [], touchesTables) {
49
+ if (touchesTables) {
50
+ for (const t of touchesTables)
51
+ readTables.add(t);
52
+ }
53
+ else {
54
+ for (const t of Object.keys(schema)) {
55
+ if (new RegExp(`\\b${t}\\b`).test(query))
56
+ readTables.add(t);
57
+ }
58
+ }
59
+ return db.query(query, params);
60
+ },
61
+ };
62
+ }
63
+ export function createFunctionRuntime(opts) {
64
+ const { registry, db, schema, broker } = opts;
65
+ const scopeField = opts.scopeField ?? 'scope_id';
66
+ const getFn = (name) => {
67
+ const fn = registry.get(name);
68
+ if (!fn)
69
+ throw new FunctionError(`Function "${name}" not found.`, 404);
70
+ return fn;
71
+ };
72
+ const parseArgs = (fn, raw) => {
73
+ if (!fn.args)
74
+ return raw;
75
+ try {
76
+ return fn.args(raw);
77
+ }
78
+ catch (err) {
79
+ throw new FunctionError(err instanceof Error ? err.message : 'Invalid arguments.', 400);
80
+ }
81
+ };
82
+ const runQuery = async (name, rawArgs, auth) => {
83
+ const fn = getFn(name);
84
+ if (fn.__kind !== 'query')
85
+ throw new FunctionError(`"${name}" is a ${fn.__kind}, not a query.`, 400);
86
+ const readTables = new Set();
87
+ const result = await fn.handler({ db: createReader(db, schema, readTables), auth }, parseArgs(fn, rawArgs));
88
+ return { result, readTables };
89
+ };
90
+ const runMutation = async (name, rawArgs, auth) => {
91
+ const fn = getFn(name);
92
+ if (fn.__kind !== 'mutation')
93
+ throw new FunctionError(`"${name}" is a ${fn.__kind}, not a mutation.`, 400);
94
+ const args = parseArgs(fn, rawArgs);
95
+ const emitted = [];
96
+ const readTables = new Set();
97
+ const result = await db.withTransaction(async (tx) => {
98
+ const reader = createReader(tx, schema, readTables);
99
+ const track = async (table, id, scopeVal) => {
100
+ const ts = await recordChange(tx, table, id);
101
+ emitted.push({
102
+ scopeId: typeof scopeVal === 'string' && scopeVal ? scopeVal : 'default',
103
+ tableName: table,
104
+ checkpoint: ts,
105
+ });
106
+ return ts;
107
+ };
108
+ const writer = {
109
+ ...reader,
110
+ async insert(table, data) {
111
+ const fields = Object.hasOwn(schema, table) ? schema[table] : undefined;
112
+ if (!fields)
113
+ throw new FunctionError(`Unknown table "${table}".`, 400);
114
+ const id = newRowId(data.id);
115
+ const ts = await track(table, id, data[scopeField]);
116
+ await upsertTableRow(tx, table, fields, id, data, ts);
117
+ return (await reader.get(table, id));
118
+ },
119
+ async patch(table, id, patch) {
120
+ const fields = Object.hasOwn(schema, table) ? schema[table] : undefined;
121
+ if (!fields)
122
+ throw new FunctionError(`Unknown table "${table}".`, 400);
123
+ const existing = await reader.get(table, id);
124
+ if (!existing)
125
+ return null;
126
+ const ts = await track(table, id, patch[scopeField] ?? existing[scopeField]);
127
+ await patchTableRow(tx, table, fields, id, patch, ts);
128
+ return reader.get(table, id);
129
+ },
130
+ async remove(table, id) {
131
+ if (!Object.hasOwn(schema, table))
132
+ throw new FunctionError(`Unknown table "${table}".`, 400);
133
+ const existing = await reader.get(table, id);
134
+ if (!existing)
135
+ return false;
136
+ const ts = await track(table, id, existing[scopeField]);
137
+ await setRowDeleted(tx, table, id, true, ts);
138
+ return true;
139
+ },
140
+ };
141
+ return fn.handler({ db: writer, auth }, args);
142
+ });
143
+ for (const e of emitted)
144
+ broker.publish(e);
145
+ return { result, readTables };
146
+ };
147
+ const run = async (name, rawArgs, auth) => {
148
+ const fn = getFn(name);
149
+ if (fn.__kind === 'query')
150
+ return runQuery(name, rawArgs, auth);
151
+ if (fn.__kind === 'mutation')
152
+ return runMutation(name, rawArgs, auth);
153
+ const ctx = {
154
+ auth,
155
+ runQuery: async (n, a = {}) => (await runQuery(n, a, auth)).result,
156
+ runMutation: async (n, a = {}) => (await runMutation(n, a, auth)).result,
157
+ };
158
+ return { result: await fn.handler(ctx, parseArgs(fn, rawArgs)), readTables: new Set() };
159
+ };
160
+ const subscribe = async (name, rawArgs, auth) => {
161
+ const initial = await runQuery(name, rawArgs, auth);
162
+ let tracked = initial.readTables;
163
+ let lastJson = JSON.stringify(initial.result);
164
+ const encoder = new TextEncoder();
165
+ let cleanup = null;
166
+ let running = false;
167
+ let queued = false;
168
+ const stream = new ReadableStream({
169
+ start(controller) {
170
+ const send = (chunk) => {
171
+ try {
172
+ controller.enqueue(encoder.encode(chunk));
173
+ }
174
+ catch {
175
+ cleanup?.();
176
+ }
177
+ };
178
+ send(`event: data\ndata: ${lastJson}\n\n`);
179
+ const refresh = async () => {
180
+ if (running) {
181
+ queued = true;
182
+ return;
183
+ }
184
+ running = true;
185
+ try {
186
+ const next = await runQuery(name, rawArgs, auth);
187
+ tracked = next.readTables;
188
+ const nextJson = JSON.stringify(next.result);
189
+ if (nextJson !== lastJson) {
190
+ lastJson = nextJson;
191
+ send(`event: data\ndata: ${nextJson}\n\n`);
192
+ }
193
+ }
194
+ catch (err) {
195
+ send(`event: error\ndata: ${JSON.stringify({ error: err instanceof Error ? err.message : 'Query failed.' })}\n\n`);
196
+ }
197
+ finally {
198
+ running = false;
199
+ if (queued) {
200
+ queued = false;
201
+ void refresh();
202
+ }
203
+ }
204
+ };
205
+ const unsub = broker.subscribe((ev) => {
206
+ if (tracked.size === 0 || tracked.has(ev.tableName))
207
+ void refresh();
208
+ });
209
+ const heartbeat = setInterval(() => send(': keep-alive\n\n'), 25_000);
210
+ cleanup = () => {
211
+ unsub();
212
+ clearInterval(heartbeat);
213
+ try {
214
+ controller.close();
215
+ }
216
+ catch { }
217
+ };
218
+ },
219
+ cancel() {
220
+ cleanup?.();
221
+ },
222
+ });
223
+ return new Response(stream, {
224
+ status: 200,
225
+ headers: {
226
+ 'Content-Type': 'text/event-stream; charset=utf-8',
227
+ 'Cache-Control': 'no-cache, no-transform',
228
+ Connection: 'keep-alive',
229
+ 'X-Accel-Buffering': 'no',
230
+ },
231
+ });
232
+ };
233
+ return {
234
+ list: () => [...registry.entries()].map(([name, def]) => ({ name, kind: def.__kind })),
235
+ run,
236
+ subscribe,
237
+ };
238
+ }
@@ -0,0 +1,59 @@
1
+ export type FunctionKind = 'query' | 'mutation' | 'action';
2
+ export declare class FunctionError extends Error {
3
+ status: number;
4
+ constructor(message: string, status?: number);
5
+ }
6
+ export interface FunctionAuth {
7
+ isAdmin: boolean;
8
+ userId?: string;
9
+ }
10
+ export interface ListOptions {
11
+ where?: Record<string, unknown>;
12
+ orderBy?: string;
13
+ order?: 'asc' | 'desc';
14
+ limit?: number;
15
+ offset?: number;
16
+ includeDeleted?: boolean;
17
+ }
18
+ export interface DbReader {
19
+ get(table: string, id: string): Promise<Record<string, any> | null>;
20
+ list(table: string, opts?: ListOptions): Promise<Record<string, any>[]>;
21
+ sql<T = Record<string, any>>(query: string, params?: unknown[], touchesTables?: string[]): Promise<T[]>;
22
+ }
23
+ export interface DbWriter extends DbReader {
24
+ insert(table: string, data: Record<string, unknown>): Promise<Record<string, any>>;
25
+ patch(table: string, id: string, patch: Record<string, unknown>): Promise<Record<string, any> | null>;
26
+ remove(table: string, id: string): Promise<boolean>;
27
+ }
28
+ export interface QueryContext {
29
+ db: DbReader;
30
+ auth: FunctionAuth;
31
+ }
32
+ export interface MutationContext {
33
+ db: DbWriter;
34
+ auth: FunctionAuth;
35
+ }
36
+ export interface ActionContext {
37
+ auth: FunctionAuth;
38
+ runQuery<T = unknown>(name: string, args?: Record<string, unknown>): Promise<T>;
39
+ runMutation<T = unknown>(name: string, args?: Record<string, unknown>): Promise<T>;
40
+ }
41
+ export type ArgValidator<TArgs> = (raw: Record<string, unknown>) => TArgs;
42
+ export interface FunctionDef<TCtx, TArgs, TRes> {
43
+ __kind: FunctionKind;
44
+ args?: ArgValidator<TArgs>;
45
+ handler: (ctx: TCtx, args: TArgs) => Promise<TRes> | TRes;
46
+ }
47
+ export type FunctionRegistry = Map<string, FunctionDef<any, any, any>>;
48
+ export declare function defineQuery<TArgs = Record<string, unknown>, TRes = unknown>(def: {
49
+ args?: ArgValidator<TArgs>;
50
+ handler: (ctx: QueryContext, args: TArgs) => Promise<TRes> | TRes;
51
+ }): FunctionDef<QueryContext, TArgs, TRes>;
52
+ export declare function defineMutation<TArgs = Record<string, unknown>, TRes = unknown>(def: {
53
+ args?: ArgValidator<TArgs>;
54
+ handler: (ctx: MutationContext, args: TArgs) => Promise<TRes> | TRes;
55
+ }): FunctionDef<MutationContext, TArgs, TRes>;
56
+ export declare function defineAction<TArgs = Record<string, unknown>, TRes = unknown>(def: {
57
+ args?: ArgValidator<TArgs>;
58
+ handler: (ctx: ActionContext, args: TArgs) => Promise<TRes> | TRes;
59
+ }): FunctionDef<ActionContext, TArgs, TRes>;
@@ -0,0 +1,16 @@
1
+ export class FunctionError extends Error {
2
+ status;
3
+ constructor(message, status = 400) {
4
+ super(message);
5
+ this.status = status;
6
+ }
7
+ }
8
+ export function defineQuery(def) {
9
+ return { __kind: 'query', ...def };
10
+ }
11
+ export function defineMutation(def) {
12
+ return { __kind: 'mutation', ...def };
13
+ }
14
+ export function defineAction(def) {
15
+ return { __kind: 'action', ...def };
16
+ }
@@ -0,0 +1,12 @@
1
+ export { defineSchema, normalizeSchema } from './schema.js';
2
+ export type { SchemaDictionary, SchemaFieldType } from './schema.js';
3
+ export { defineRules } from './rules.js';
4
+ export type { RuleContext, RowPredicate, TableRule, RulesDictionary } from './rules.js';
5
+ export { defineQuery, defineMutation, defineAction, FunctionError, } from './functions/index.js';
6
+ export type { QueryContext, MutationContext, ActionContext, DbReader, DbWriter, FunctionAuth, FunctionKind, ListOptions, } from './functions/index.js';
7
+ export { TableSyncStorage, ClientError, ForbiddenError } from './tableStorage.js';
8
+ export { createApp, createHttpServer } from './server.js';
9
+ export { loadRoutesFile, resolveRoutesFile } from './routes.js';
10
+ export type { CustomRoutesContext, CustomRoutesFactory, CustomRoutesMap } from './routes.js';
11
+ export { loadSettings } from './config.js';
12
+ export type { ServerSettings } from './config.js';
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { defineSchema, normalizeSchema } from './schema.js';
2
+ export { defineRules } from './rules.js';
3
+ export { defineQuery, defineMutation, defineAction, FunctionError, } from './functions/index.js';
4
+ export { TableSyncStorage, ClientError, ForbiddenError } from './tableStorage.js';
5
+ export { createApp, createHttpServer } from './server.js';
6
+ export { loadRoutesFile, resolveRoutesFile } from './routes.js';
7
+ export { loadSettings } from './config.js';
@@ -0,0 +1,16 @@
1
+ import type { SqlExecutor } from 'local-lite/server';
2
+ interface Migration {
3
+ id: string;
4
+ mysql: string[];
5
+ postgres: string[];
6
+ }
7
+ /** Framework tables. App tables come from schema.ts. */
8
+ export declare const MIGRATIONS: Migration[];
9
+ export declare function runMigrations(db: SqlExecutor): Promise<{
10
+ applied: string[];
11
+ }>;
12
+ export declare function coreMigrationStatus(db: SqlExecutor): Promise<{
13
+ applied: string[];
14
+ pending: string[];
15
+ }>;
16
+ export {};