better-supabase 0.0.0 → 0.1.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.
Files changed (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -1
  3. package/bin/better-supabase.js +3 -0
  4. package/dist/casing-da0uRTqt.js +14 -0
  5. package/dist/cli/bin.d.ts +1 -0
  6. package/dist/cli/bin.js +15 -0
  7. package/dist/cli/index.d.ts +226 -0
  8. package/dist/cli/index.js +3 -0
  9. package/dist/cli-CoByWYja.js +6472 -0
  10. package/dist/client/index.d.ts +2 -0
  11. package/dist/client/index.js +112 -0
  12. package/dist/compiler-DL18ukPe.d.ts +14 -0
  13. package/dist/config/index.d.ts +3 -0
  14. package/dist/config/index.js +3 -0
  15. package/dist/config-D-aR2ZoN.js +276 -0
  16. package/dist/define-CTfWw-SS.d.ts +662 -0
  17. package/dist/define-QGkq04oe.js +1068 -0
  18. package/dist/edge/index.d.ts +43 -0
  19. package/dist/edge/index.js +103 -0
  20. package/dist/entitlements-BBg61DQZ.d.ts +20 -0
  21. package/dist/entitlements-BC_khwRy.js +17 -0
  22. package/dist/env/index.d.ts +2 -0
  23. package/dist/env/index.js +2 -0
  24. package/dist/env-BEToab0I.js +204 -0
  25. package/dist/errors-Bl3rkOzo.js +196 -0
  26. package/dist/events/index.d.ts +2 -0
  27. package/dist/events/index.js +2 -0
  28. package/dist/events-2OJsVG_d.d.ts +84 -0
  29. package/dist/events-BuzTgn2D.js +135 -0
  30. package/dist/executor-Bazhgsgq.d.ts +195 -0
  31. package/dist/executor-Bje4suQF.d.ts +25 -0
  32. package/dist/executor-Ceq60hPM.js +89 -0
  33. package/dist/hono/index.d.ts +45 -0
  34. package/dist/hono/index.js +70 -0
  35. package/dist/index-BD6wKthp.d.ts +597 -0
  36. package/dist/index-DQVvHzjW.d.ts +74 -0
  37. package/dist/index-DRid0qIv.d.ts +76 -0
  38. package/dist/index-Dup-nSe9.d.ts +117 -0
  39. package/dist/index-Dy6kuF0P.d.ts +71 -0
  40. package/dist/index-Hf8PP9sP.d.ts +116 -0
  41. package/dist/index-JXHBuS53.d.ts +144 -0
  42. package/dist/index-Nxo3TJcm.d.ts +208 -0
  43. package/dist/index-Sw43J8HG.d.ts +62 -0
  44. package/dist/index-cEeweTeM.d.ts +38 -0
  45. package/dist/index.d.ts +110 -0
  46. package/dist/index.js +42 -0
  47. package/dist/invalidate-DbxuL2jL.js +18 -0
  48. package/dist/jobs/index.d.ts +173 -0
  49. package/dist/jobs/index.js +477 -0
  50. package/dist/json-schema-BbwO2mZg.js +181 -0
  51. package/dist/lint/index.d.ts +75 -0
  52. package/dist/lint/index.js +167 -0
  53. package/dist/list/index.d.ts +2 -0
  54. package/dist/list/index.js +410 -0
  55. package/dist/live-6b9i72Ux.d.ts +180 -0
  56. package/dist/live-D8rV1Ldw.js +168 -0
  57. package/dist/mcp/index.d.ts +105 -0
  58. package/dist/mcp/index.js +330 -0
  59. package/dist/mfa-CpogP66z.js +521 -0
  60. package/dist/mfa-TVia554c.d.ts +44 -0
  61. package/dist/next/image/index.d.ts +34 -0
  62. package/dist/next/image/index.js +40 -0
  63. package/dist/next/index.d.ts +210 -0
  64. package/dist/next/index.js +426 -0
  65. package/dist/openapi/index.d.ts +2 -0
  66. package/dist/openapi/index.js +332 -0
  67. package/dist/orpc/index.d.ts +46 -0
  68. package/dist/orpc/index.js +50 -0
  69. package/dist/otel/index.d.ts +40 -0
  70. package/dist/otel/index.js +168 -0
  71. package/dist/path-Cv__-OTj.d.ts +17 -0
  72. package/dist/plugin-BqR6wKMB.js +23 -0
  73. package/dist/plugin-HvGqCurB.d.ts +118 -0
  74. package/dist/plugins/actor/index.d.ts +13 -0
  75. package/dist/plugins/actor/index.js +43 -0
  76. package/dist/plugins/rules/index.d.ts +88 -0
  77. package/dist/plugins/rules/index.js +174 -0
  78. package/dist/plugins/soft-delete/index.d.ts +38 -0
  79. package/dist/plugins/soft-delete/index.js +69 -0
  80. package/dist/plugins/tenant/index.d.ts +43 -0
  81. package/dist/plugins/tenant/index.js +73 -0
  82. package/dist/plugins/timestamps/index.d.ts +9 -0
  83. package/dist/plugins/timestamps/index.js +37 -0
  84. package/dist/plugins/validation/index.d.ts +24 -0
  85. package/dist/plugins/validation/index.js +59 -0
  86. package/dist/pool-BFeqzwQS.d.ts +37 -0
  87. package/dist/postgres/index.d.ts +28 -0
  88. package/dist/postgres/index.js +79 -0
  89. package/dist/postgrest-Dm-vhY6R.d.ts +43 -0
  90. package/dist/problem-DPu6Fh-t.js +97 -0
  91. package/dist/problem-DlgB0lYl.d.ts +47 -0
  92. package/dist/query/index.d.ts +2 -0
  93. package/dist/query/index.js +3 -0
  94. package/dist/query-ChvDbsDE.js +186 -0
  95. package/dist/react/index.d.ts +7 -0
  96. package/dist/react/index.js +5 -0
  97. package/dist/react/server.d.ts +13 -0
  98. package/dist/react/server.js +25 -0
  99. package/dist/react/session.d.ts +2 -0
  100. package/dist/react/session.js +3 -0
  101. package/dist/react-CrOvrnIP.js +241 -0
  102. package/dist/read-set-DhX2d04c.js +216 -0
  103. package/dist/realtime/index.d.ts +3 -0
  104. package/dist/realtime/index.js +253 -0
  105. package/dist/resolve-DW8h9NPm.d.ts +155 -0
  106. package/dist/resource-CYiu6Ygi.js +175 -0
  107. package/dist/resource-SkPTRJDD.d.ts +65 -0
  108. package/dist/respond-4-dhoV7x.js +380 -0
  109. package/dist/respond-PoTpy5DT.d.ts +169 -0
  110. package/dist/result-CTkCZ6JA.d.ts +198 -0
  111. package/dist/result-DWXatkd6.js +103 -0
  112. package/dist/scope-CDHcS7dE.js +90 -0
  113. package/dist/seed-CzecODcJ.js +101 -0
  114. package/dist/server/index.d.ts +42 -0
  115. package/dist/server/index.js +68 -0
  116. package/dist/session-C3osL21k.d.ts +21 -0
  117. package/dist/session-CD-3orO_.js +19 -0
  118. package/dist/shared-_6-uPL7E.js +57 -0
  119. package/dist/simplify-oHiDKRVQ.js +665 -0
  120. package/dist/spec-pins-CJPVghHy.d.ts +20 -0
  121. package/dist/spec-pins-t6sPaHvl.js +20 -0
  122. package/dist/sql-M8l3fnS0.js +260 -0
  123. package/dist/ssr/index.d.ts +5 -0
  124. package/dist/ssr/index.js +4 -0
  125. package/dist/standard-CyhRzctb.d.ts +7 -0
  126. package/dist/standard-FUi3Z3-7.js +21 -0
  127. package/dist/stats-3iy8u3_P.js +566 -0
  128. package/dist/storage/index.d.ts +4 -0
  129. package/dist/storage/index.js +2 -0
  130. package/dist/storage-BWXVUXGk.js +461 -0
  131. package/dist/tables-rZxRxNPW.js +59 -0
  132. package/dist/template-BeOGnynM.js +93 -0
  133. package/dist/template-mbvlysOo.d.ts +6 -0
  134. package/dist/testing/index.d.ts +294 -0
  135. package/dist/testing/index.js +751 -0
  136. package/dist/types-6cYK9pbJ.js +29 -0
  137. package/dist/types-C2fslP1z.d.ts +195 -0
  138. package/dist/version-Cqq1m3UY.js +4 -0
  139. package/dist/view-B0ltUmTi.d.ts +43 -0
  140. package/dist/view-B6F9QbG-.js +35 -0
  141. package/dist/webhooks/index.d.ts +152 -0
  142. package/dist/webhooks/index.js +2 -0
  143. package/dist/webhooks-DbMTJJX2.js +139 -0
  144. package/package.json +246 -17
  145. package/schemas/config-v1.json +328 -0
  146. package/schemas/doctor-report-v1.json +105 -0
  147. package/schemas/snapshot-v2.json +1002 -0
  148. package/skills/better-supabase/SKILL.md +84 -0
  149. package/skills/better-supabase/references/plugins.md +56 -0
  150. package/skills/better-supabase/references/troubleshooting.md +39 -0
  151. package/skills/better-supabase-api/SKILL.md +67 -0
  152. package/skills/better-supabase-api/references/adapters.md +108 -0
  153. package/skills/better-supabase-testing/SKILL.md +65 -0
  154. package/index.js +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ScaleDock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,90 @@
1
1
  # better-supabase
2
2
 
3
- This is a stub package published by setup-trusted-publishing to enable OIDC trusted publishing configuration.
3
+ **A typed data layer, auth glue and CLI for Supabase apps, APIs, MCP servers and jobs.**
4
+
5
+ [![npm](https://img.shields.io/npm/v/better-supabase)](https://www.npmjs.com/package/better-supabase)
6
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ScaleDockHQ/better-supabase/blob/main/LICENSE)
7
+ ![TypeScript](https://img.shields.io/badge/TypeScript-5.9%20%7C%206%20%7C%207-3178c6.svg)
8
+
9
+ `better-supabase gen` extends `supabase gen types` with relation cardinality, unique keys, CHECK unions and typed jsonb. The generated `schema` gives every table a typed repository that compiles to one PostgREST request, returns a `Result` instead of throwing, and runs as the caller so RLS always applies.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pnpm add better-supabase @supabase/supabase-js
15
+ pnpm add -D pg
16
+ ```
17
+
18
+ ESM only. Node 24 or later for the CLI; the runtime entries run on every WinterTC runtime (Node, Deno, Bun, Workers, Supabase Edge Functions). TypeScript 5.9, 6 and 7 are tested.
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ supabase start
24
+ pnpm better-supabase init # config, src/lib/supabase.ts and framework glue
25
+ pnpm better-supabase gen # database.types.ts and generated.ts
26
+ ```
27
+
28
+ ```ts
29
+ import { createClient } from '@supabase/supabase-js';
30
+ import { defineSupabase } from 'better-supabase';
31
+
32
+ import { schema } from './lib/supabase/generated.ts';
33
+
34
+ export const sb = defineSupabase(schema);
35
+
36
+ const db = sb.connect(createClient(url, publishableKey));
37
+
38
+ const result = await db.customers.findMany({
39
+ select: ['id', 'name'],
40
+ where: { status: 'active', notes: { some: { kind: 'call' } } },
41
+ include: { organization: { select: ['name'] } },
42
+ orderBy: { name: 'asc' },
43
+ limit: 20,
44
+ });
45
+ if (!result.ok) return result; // DbError: kind, message, status, code
46
+ ```
47
+
48
+ ## Subpaths
49
+
50
+ | Import | What it gives you |
51
+ | --- | --- |
52
+ | `better-supabase` | `defineSupabase`, repositories, `Result`, `DbError`, `SPEC_PINS` |
53
+ | `better-supabase/config` | `defineConfig` and generators for `better-supabase.config.ts` |
54
+ | `better-supabase/client` | Browser repositories that follow the session |
55
+ | `better-supabase/react` | Provider, typed hooks and the server session |
56
+ | `better-supabase/query` | TanStack Query options with table-based invalidation |
57
+ | `better-supabase/server` | Repositories bound to the caller, admin and acting-as identities |
58
+ | `better-supabase/postgres` | The same repositories over direct Postgres |
59
+ | `better-supabase/ssr` | The `@supabase/ssr` cookie format for any framework |
60
+ | `better-supabase/next`, `/next/image` | Proxy, Server Components, route handlers, server actions, Storage images |
61
+ | `better-supabase/hono`, `/orpc`, `/edge` | Framework adapters |
62
+ | `better-supabase/mcp` | MCP servers whose tools run as the signed-in user |
63
+ | `better-supabase/jobs` | Supabase Queues jobs, idempotency keys and a webhook inbox |
64
+ | `better-supabase/list` | Search, facets, sorting and pagination from one definition |
65
+ | `better-supabase/storage`, `/realtime` | Typed bucket paths and broadcast topics |
66
+ | `better-supabase/env` | Validated Supabase settings |
67
+ | `better-supabase/events`, `/webhooks`, `/openapi`, `/otel` | CloudEvents, Standard Webhooks, OpenAPI 3.1 and OpenTelemetry |
68
+ | `better-supabase/plugins/*` | Timestamps, soft delete, tenant, actor, validation and runtime rules |
69
+ | `better-supabase/lint` | Editor rules for unbounded reads and unscoped deletes |
70
+ | `better-supabase/testing` | `asUser`, `localAuth`, typed seeds and conformance kits |
71
+
72
+ ## For AI agents
73
+
74
+ The package ships [Agent Skills](https://agentskills.io) in `skills/`:
75
+
76
+ ```bash
77
+ npx skills add ScaleDockHQ/better-supabase
78
+ # or, from the installed version:
79
+ pnpm better-supabase skills install
80
+ ```
81
+
82
+ The docs are also available as [`/llms.txt`](https://bettersupabase.com/llms.txt), as Markdown at `/docs/<page>.md`, and through the docs MCP server at `https://bettersupabase.com/mcp`.
83
+
84
+ ## Documentation
85
+
86
+ [bettersupabase.com/docs](https://bettersupabase.com/docs)
87
+
88
+ ## License
89
+
90
+ [MIT](https://github.com/ScaleDockHQ/better-supabase/blob/main/LICENSE)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ // Checked in so pnpm can link the bin on a fresh install, before dist/ is built.
3
+ import '../dist/cli/bin.js';
@@ -0,0 +1,14 @@
1
+ //#region src/casing/index.ts
2
+ /** `first_name` to `firstName`. Leaves already camel-cased names untouched. */
3
+ function toCamel(name) {
4
+ return name.replace(/_+([a-z0-9])/g, (_, char) => char.toUpperCase());
5
+ }
6
+ /** `firstName` to `first_name`. */
7
+ function toSnake(name) {
8
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toLowerCase();
9
+ }
10
+ function applyCasing(name, casing) {
11
+ return casing === "camel" ? toCamel(name) : name;
12
+ }
13
+ //#endregion
14
+ export { toCamel as n, toSnake as r, applyCasing as t };
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { i as run } from "../cli-CoByWYja.js";
3
+ //#region src/cli/bin.ts
4
+ const controller = new AbortController();
5
+ process.once("SIGINT", () => controller.abort());
6
+ process.once("SIGTERM", () => controller.abort());
7
+ const result = await run(process.argv.slice(2), {
8
+ signal: controller.signal,
9
+ io: {
10
+ stdout: (text) => process.stdout.write(text),
11
+ stderr: (text) => process.stderr.write(text)
12
+ }
13
+ });
14
+ process.exitCode = result.code;
15
+ //#endregion
@@ -0,0 +1,226 @@
1
+ import { $ as ExtrasHook, B as CatalogCheck, G as CatalogFunctionArg, H as CatalogEnum, J as CatalogPolicy, K as CatalogGrant, Q as ExtrasFunction, U as CatalogForeignKey, V as CatalogColumn, W as CatalogFunction, X as CatalogTrigger, Y as CatalogTable, Z as CatalogUnique, at as SnapshotExtras, et as ExtrasHookFunction, it as SnapshotBucket, l as GeneratedFile, nt as ForeignKeyAction, ot as GeneratorMetadata, q as CatalogIndex, rt as Snapshot, st as Queryable, tt as ExtrasTable, v as ResolvedConfig, z as Catalog } from "../index-BD6wKthp.js";
2
+ import { A as TableMeta, E as SchemaMeta, f as FunctionMeta, i as Casing, o as Codec, x as RelationMeta } from "../types-C2fslP1z.js";
3
+ //#region src/cli/args.d.ts
4
+ type FlagValue = string | boolean | readonly string[];
5
+ interface ParsedArgs {
6
+ readonly command: string | undefined;
7
+ readonly rest: readonly string[];
8
+ readonly flags: Readonly<Record<string, FlagValue>>;
9
+ }
10
+ //#endregion
11
+ //#region src/cli/io.d.ts
12
+ interface CliIo {
13
+ readonly stdout: (text: string) => void;
14
+ readonly stderr: (text: string) => void;
15
+ readonly now?: () => Date;
16
+ /** Environment; defaults to `process.env`. */
17
+ readonly env?: Readonly<Record<string, string | undefined>>;
18
+ }
19
+ interface RunResult {
20
+ readonly code: number;
21
+ readonly stdout: string;
22
+ readonly stderr: string;
23
+ }
24
+ interface CommandResult {
25
+ readonly code: number;
26
+ readonly output?: string;
27
+ readonly error?: string;
28
+ }
29
+ //#endregion
30
+ //#region src/cli/run.d.ts
31
+ export declare const HELP: string;
32
+ type Command = (context: CommandContext) => Promise<CommandResult>;
33
+ interface CommandContext {
34
+ readonly args: ParsedArgs;
35
+ readonly cwd: string;
36
+ readonly config: ResolvedConfig;
37
+ readonly io: CliIo;
38
+ readonly env: Readonly<Record<string, string | undefined>>;
39
+ readonly signal: AbortSignal | undefined;
40
+ }
41
+ /** Registers a command; the built-in commands register themselves below. */
42
+ export declare function registerCommand(name: string, command: Command, help?: string): void;
43
+ interface RunOptions {
44
+ readonly cwd?: string;
45
+ readonly io?: CliIo;
46
+ readonly signal?: AbortSignal;
47
+ }
48
+ /** Runs the CLI. Never exits the process; returns the exit code and output. */
49
+ export declare function run(argv: readonly string[], options?: RunOptions): Promise<RunResult>;
50
+ //#endregion
51
+ //#region src/cli/introspect/source.d.ts
52
+ /** A connection introspection can query, plus how to release it. */
53
+ interface IntrospectionSource {
54
+ readonly queryable: Queryable;
55
+ readonly describe: string;
56
+ close(): Promise<void>;
57
+ }
58
+ /**
59
+ * A `pg` connection. Typegen issues its queries concurrently; one `pg.Client`
60
+ * must run them one at a time, so calls are queued.
61
+ */
62
+ export declare function pgSource(url: string): Promise<IntrospectionSource>;
63
+ interface ManagementSourceOptions {
64
+ readonly projectRef: string;
65
+ readonly accessToken: string;
66
+ /** Defaults to `https://api.supabase.com`. */
67
+ readonly apiUrl?: string;
68
+ readonly fetch?: typeof fetch;
69
+ }
70
+ /**
71
+ * Runs introspection SQL through the Supabase Management API as the
72
+ * read-only database user, so hosted projects need no database password.
73
+ */
74
+ export declare function managementSource(options: ManagementSourceOptions): IntrospectionSource;
75
+ //#endregion
76
+ //#region src/cli/commands/snapshot.d.ts
77
+ interface SnapshotSource {
78
+ readonly snapshotPath?: string;
79
+ readonly dbUrl?: string;
80
+ readonly projectRef?: string;
81
+ /** Ignore `source.snapshot` and read the database. */
82
+ readonly live?: boolean;
83
+ }
84
+ type Env = Readonly<Record<string, string | undefined>>;
85
+ /** Loads a saved snapshot or introspects the database. */
86
+ export declare function loadSnapshot(config: ResolvedConfig, env: Env, source: SnapshotSource): Promise<Snapshot>;
87
+ /** Validates a parsed snapshot document. */
88
+ export declare function parseSnapshot(data: unknown, label?: string): Snapshot;
89
+ export declare function serializeSnapshot(snapshot: Snapshot): string;
90
+ //#endregion
91
+ //#region src/cli/commands/gen.d.ts
92
+ interface GenOptions extends SnapshotSource {
93
+ readonly config: ResolvedConfig;
94
+ readonly env: Readonly<Record<string, string | undefined>>;
95
+ readonly check: boolean;
96
+ /** Pre-loaded snapshot (tests, watch mode). */
97
+ readonly snapshot?: Snapshot;
98
+ }
99
+ /**
100
+ * Renders every generated file for a snapshot, without touching disk:
101
+ * `database.types.ts` (what `supabase gen types` prints), the main module,
102
+ * then each configured generator's files.
103
+ */
104
+ export declare function renderFiles(config: ResolvedConfig, snapshot: Snapshot): Promise<GeneratedFile[]>;
105
+ export declare function runGen(options: GenOptions): Promise<CommandResult>;
106
+ //#endregion
107
+ //#region src/cli/introspect/extras.d.ts
108
+ /** A hook function to introspect: `[auth.hook.<hook>]` pointing at `schema.name`. */
109
+ interface HookTarget {
110
+ readonly hook: string;
111
+ readonly schema: string;
112
+ readonly name: string;
113
+ }
114
+ //#endregion
115
+ //#region src/cli/introspect/catalog.d.ts
116
+ /** Joins the typegen metadata and the extras into one record per object. */
117
+ export declare function toCatalog(snapshot: Snapshot): Catalog;
118
+ //#endregion
119
+ //#region src/cli/introspect/index.d.ts
120
+ interface IntrospectOptions {
121
+ /** Auth hook functions to read too, in any schema (`[auth.hook.*]`). */
122
+ readonly hooks?: readonly HookTarget[];
123
+ }
124
+ /** Reads a v2 snapshot: typegen metadata plus the extras. */
125
+ export declare function introspect(db: Queryable, schemas: readonly string[], options?: IntrospectOptions): Promise<Snapshot>;
126
+ //#endregion
127
+ //#region src/cli/introspect/from-catalog.d.ts
128
+ /**
129
+ * Builds a snapshot from catalog records: the inverse of `toCatalog`. Tests
130
+ * and benchmarks describe schemas as tables and functions; this produces the
131
+ * typegen metadata and extras those records imply.
132
+ */
133
+ export declare function fromCatalog(catalog: Catalog): Snapshot;
134
+ //#endregion
135
+ //#region src/cli/gen/model.d.ts
136
+ interface ColumnModel {
137
+ readonly app: string;
138
+ readonly db: string;
139
+ readonly snapshot: CatalogColumn;
140
+ /** TypeScript type without `| null`. */
141
+ readonly tsType: string;
142
+ readonly nullable: boolean;
143
+ /** Optional on insert. */
144
+ readonly optional: boolean;
145
+ /** Not writable (generated always / identity always). */
146
+ readonly readonly: boolean;
147
+ readonly values: readonly string[] | undefined;
148
+ readonly json: boolean;
149
+ readonly codec: Codec | undefined;
150
+ /** Bucket id from `config.storagePaths`. */
151
+ readonly storage: string | undefined;
152
+ readonly insertable: boolean;
153
+ readonly updatable: boolean;
154
+ }
155
+ interface RelationModel {
156
+ readonly name: string;
157
+ readonly meta: RelationMeta;
158
+ }
159
+ interface TableModel {
160
+ readonly key: string;
161
+ readonly snapshot: CatalogTable;
162
+ readonly casing: Casing;
163
+ readonly columns: readonly ColumnModel[];
164
+ readonly relations: readonly RelationModel[];
165
+ readonly meta: TableMeta;
166
+ }
167
+ interface EnumModel {
168
+ readonly schema: string;
169
+ readonly name: string;
170
+ /** Constant name for the value array, e.g. `noteKindValues`. */
171
+ readonly constant: string;
172
+ readonly values: readonly string[];
173
+ }
174
+ interface FunctionModel {
175
+ readonly key: string;
176
+ readonly meta: FunctionMeta;
177
+ readonly args: readonly {
178
+ name: string;
179
+ tsType: string;
180
+ optional: boolean;
181
+ }[];
182
+ readonly returns: string;
183
+ }
184
+ interface JsonImport {
185
+ readonly name: string;
186
+ /** Path relative to the project root, without the `#Name` part. */
187
+ readonly from: string;
188
+ }
189
+ interface Model {
190
+ readonly tables: readonly TableModel[];
191
+ readonly enums: readonly EnumModel[];
192
+ readonly functions: readonly FunctionModel[];
193
+ readonly jsonImports: readonly JsonImport[];
194
+ readonly meta: SchemaMeta;
195
+ readonly config: ResolvedConfig;
196
+ readonly catalog: Catalog;
197
+ /** Typegen metadata restricted to the configured schemas. */
198
+ readonly introspection: GeneratorMetadata;
199
+ }
200
+ /** Builds the codegen model from a snapshot and config. */
201
+ export declare function buildModel(snapshot: Snapshot, config: ResolvedConfig): Model;
202
+ //#endregion
203
+ //#region src/cli/gen/emit.d.ts
204
+ export declare const GENERATED_HEADER = "// @generated by better-supabase gen. Do not edit; run `better-supabase gen` instead.";
205
+ interface EmitOptions {
206
+ /** Import path from the generated module to `better-supabase`. */
207
+ readonly runtimeImport?: string;
208
+ /** Import path from the generated module to `database.types.ts`. */
209
+ readonly databaseTypesImport?: string;
210
+ /** Import path for each JSON type import, keyed by the configured path. */
211
+ readonly importPathFor: (from: string) => string;
212
+ }
213
+ /** Renders the generated module. */
214
+ export declare function emitModule(model: Model, options: EmitOptions): string;
215
+ //#endregion
216
+ //#region src/cli/config.d.ts
217
+ /**
218
+ * Loads the config with a native `import()`. Node 24 strips types from
219
+ * `.ts` files, so no loader is needed.
220
+ */
221
+ export declare function loadConfig(cwd: string, explicit?: string): Promise<ResolvedConfig>;
222
+ //#endregion
223
+ //#region src/cli/version.d.ts
224
+ export declare const VERSION = "0.0.0";
225
+ //#endregion
226
+ export type { Catalog, CatalogCheck, CatalogColumn, CatalogEnum, CatalogForeignKey, CatalogFunction, CatalogFunctionArg, CatalogGrant, CatalogIndex, CatalogPolicy, CatalogTable, CatalogTrigger, CatalogUnique, CliIo, Command, CommandContext, CommandResult, ExtrasFunction, ExtrasHook, ExtrasHookFunction, ExtrasTable, ForeignKeyAction, GeneratorMetadata, IntrospectionSource, ManagementSourceOptions, Queryable, RunOptions, RunResult, Snapshot, SnapshotBucket, SnapshotExtras };
@@ -0,0 +1,3 @@
1
+ import { t as VERSION } from "../version-Cqq1m3UY.js";
2
+ import { _ as emitModule, a as renderFiles, c as parseSnapshot, d as managementSource, f as pgSource, g as GENERATED_HEADER, h as toCatalog, i as run, l as serializeSnapshot, m as buildModel, n as HELP, o as runGen, p as loadConfig, r as registerCommand, s as loadSnapshot, t as fromCatalog, u as introspect } from "../cli-CoByWYja.js";
3
+ export { GENERATED_HEADER, HELP, VERSION, buildModel, emitModule, fromCatalog, introspect, loadConfig, loadSnapshot, managementSource, parseSnapshot, pgSource, registerCommand, renderFiles, run, runGen, serializeSnapshot, toCatalog };