@supabase/lite 0.3.0 → 0.3.1-next.2
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 +49 -0
- package/PATTERNS.md +119 -0
- package/README.md +47 -7
- package/STATUS.md +86 -26
- package/dist/{Connection-CSVCuMv-.d.ts → Connection-DF_xKWko.d.ts} +5 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/lib.js +5 -5
- package/dist/db/fallback.d.ts +1 -1
- package/dist/db/postgres/{BasePostgresConnection-Clykq58D.d.ts → BasePostgresConnection-NlNmZWv1.d.ts} +4 -0
- package/dist/db/postgres/PostgresConnection.d.ts +1 -1
- package/dist/db/postgres/PostgresConnection.js +16 -15
- package/dist/db/postgres/pglite/PgliteConnection.d.ts +1 -1
- package/dist/db/postgres/pglite/PgliteConnection.js +20 -19
- package/dist/index.d.ts +3 -3
- package/dist/index.js +42 -50
- package/dist/vite/index.d.ts +1 -0
- package/package.json +4 -1
- package/skills/supalite/SKILL.md +38 -0
|
@@ -8,12 +8,12 @@ import F from'postgres';import {PostgresJSDialect}from'kysely-postgres-js';impor
|
|
|
8
8
|
return emitWarning(warning, ...args);
|
|
9
9
|
};
|
|
10
10
|
} catch {}
|
|
11
|
-
var
|
|
11
|
+
var $=["anon","authenticated","service_role"];function v(c){return c==="service_role"?"NOLOGIN BYPASSRLS":"NOLOGIN"}function D(c){return c.size===0?"":`DO $$ BEGIN${[...c].map(s=>`
|
|
12
12
|
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${s}') THEN
|
|
13
|
-
CREATE ROLE ${s} ${
|
|
13
|
+
CREATE ROLE ${s} ${v(s)};
|
|
14
14
|
END IF;`).join("")}
|
|
15
15
|
END $$;
|
|
16
|
-
`}var g
|
|
16
|
+
`}var g=D(new Set($));var m="anon, authenticated, service_role",U=new Set(["anon","authenticated","service_role"]);function A(c){return `"${c.replace(/"/g,'""')}"`}var p=class extends Error{constructor(s){super("Force rollback");this.result=s;}},E=class extends Connection{dialect="postgres";harnessHoldingOuterTx=false;constructor(n){super({...n,baseSchema:`
|
|
17
17
|
${n.baseSchema??""}
|
|
18
18
|
|
|
19
19
|
CREATE SCHEMA IF NOT EXISTS auth;
|
|
@@ -53,7 +53,7 @@ END $$;
|
|
|
53
53
|
tbls.table_schema NOT IN ('information_schema', 'pg_catalog')
|
|
54
54
|
AND tbls.table_type IN ('BASE TABLE', 'FOREIGN TABLE')
|
|
55
55
|
ORDER BY tbls.table_schema, tbls.table_name
|
|
56
|
-
`.execute(this.kysely)).rows.map(e=>({name:e.name,schema:e.schema,type:"table",rows:Number(e.rows),sql:"",engine:"",collation:""})),
|
|
56
|
+
`.execute(this.kysely)).rows.map(e=>({name:e.name,schema:e.schema,type:"table",rows:Number(e.rows),sql:"",engine:"",collation:""})),l=(await sql`
|
|
57
57
|
SELECT
|
|
58
58
|
cols.table_name AS "table",
|
|
59
59
|
cols.table_schema AS "schema",
|
|
@@ -95,6 +95,7 @@ END $$;
|
|
|
95
95
|
END AS "is_identity",
|
|
96
96
|
COALESCE(cols.collation_name, '') AS "collation",
|
|
97
97
|
cols.udt_name AS "udt_name",
|
|
98
|
+
CASE WHEN pt.typtype = 'd' THEN pt.typname ELSE cols.udt_name END AS "domain_type",
|
|
98
99
|
CASE WHEN cols.is_generated = 'NEVER' THEN false ELSE true END AS "is_generated"
|
|
99
100
|
FROM information_schema.columns cols
|
|
100
101
|
LEFT JOIN pg_catalog.pg_class c ON c.relname = cols.table_name
|
|
@@ -105,7 +106,7 @@ END $$;
|
|
|
105
106
|
LEFT JOIN pg_catalog.pg_type pt ON pt.oid = attr.atttypid
|
|
106
107
|
WHERE cols.table_schema NOT IN ('information_schema', 'pg_catalog')
|
|
107
108
|
ORDER BY cols.table_schema, cols.table_name, cols.ordinal_position
|
|
108
|
-
`.execute(this.kysely)).rows.map(e=>({table:e.table,schema:e.schema,name:e.name,type:e.type,nullable:e.nullable,default_value:e.default_value,is_primary_key:!1,ordinal_position:Number(e.ordinal_position),character_maximum_length:e.character_maximum_length??null,precision:e.precision??null,is_identity:e.is_identity,collation:e.collation,pg_type:e.udt_name??void 0,is_generated:e.is_generated??!1})),
|
|
109
|
+
`.execute(this.kysely)).rows.map(e=>({table:e.table,schema:e.schema,name:e.name,type:e.type,nullable:e.nullable,default_value:e.default_value,is_primary_key:!1,ordinal_position:Number(e.ordinal_position),character_maximum_length:e.character_maximum_length??null,precision:e.precision??null,is_identity:e.is_identity,collation:e.collation,pg_type:e.domain_type??e.udt_name??void 0,is_generated:e.is_generated??!1})),r=(await sql`
|
|
109
110
|
SELECT
|
|
110
111
|
ns.nspname AS "schema",
|
|
111
112
|
cl.relname AS "table",
|
|
@@ -130,7 +131,7 @@ END $$;
|
|
|
130
131
|
'information_schema'
|
|
131
132
|
, 'pg_catalog')
|
|
132
133
|
ORDER BY ns.nspname, cl.relname, con.conname, cols.ord
|
|
133
|
-
`.execute(this.kysely)).rows.map(e=>({table:e.table,column:e.column,schema:e.schema,ref_table:e.ref_table,ref_column:e.ref_column,foreign_key_name:e.foreign_key_name,fk_def:e.fk_def,on_update:"",on_delete:""})),
|
|
134
|
+
`.execute(this.kysely)).rows.map(e=>({table:e.table,column:e.column,schema:e.schema,ref_table:e.ref_table,ref_column:e.ref_column,foreign_key_name:e.foreign_key_name,fk_def:e.fk_def,on_update:"",on_delete:""})),_=(await sql`
|
|
134
135
|
SELECT
|
|
135
136
|
ns.nspname AS "schema",
|
|
136
137
|
cl.relname AS "table",
|
|
@@ -147,7 +148,7 @@ END $$;
|
|
|
147
148
|
'information_schema'
|
|
148
149
|
, 'pg_catalog')
|
|
149
150
|
GROUP BY ns.nspname, cl.relname, con.oid
|
|
150
|
-
`.execute(this.kysely)).rows.map(e=>({table:e.table,columns:e.columns,schema:e.schema,field_count:e.columns.length})),
|
|
151
|
+
`.execute(this.kysely)).rows.map(e=>({table:e.table,columns:e.columns,schema:e.schema,field_count:e.columns.length})),h=new Set(_.flatMap(e=>e.columns.map(x=>`${e.schema}.${e.table}.${x}`)));for(let e of l)e.is_primary_key=h.has(`${e.schema}.${e.table}.${e.name}`);let R=(await sql`
|
|
151
152
|
SELECT
|
|
152
153
|
tnsp.nspname AS "schema",
|
|
153
154
|
cl.relname AS "table",
|
|
@@ -168,7 +169,7 @@ END $$;
|
|
|
168
169
|
'information_schema'
|
|
169
170
|
, 'pg_catalog')
|
|
170
171
|
GROUP BY tnsp.nspname, cl.relname, ic.relname, idx.indisunique
|
|
171
|
-
`.execute(this.kysely)).rows.map(e=>({table:e.table,name:e.name,unique:e.unique,columns:e.columns,schema:e.schema})),
|
|
172
|
+
`.execute(this.kysely)).rows.map(e=>({table:e.table,name:e.name,unique:e.unique,columns:e.columns,schema:e.schema})),O=(await sql`
|
|
172
173
|
SELECT
|
|
173
174
|
views.schemaname AS "schema",
|
|
174
175
|
views.viewname AS "name",
|
|
@@ -176,7 +177,7 @@ END $$;
|
|
|
176
177
|
FROM pg_views views
|
|
177
178
|
WHERE views.schemaname NOT IN ('information_schema', 'pg_catalog')
|
|
178
179
|
ORDER BY views.schemaname, views.viewname
|
|
179
|
-
`.execute(this.kysely)).rows.map(e=>({name:e.name,schema:e.schema,sql:e.sql??""})),
|
|
180
|
+
`.execute(this.kysely)).rows.map(e=>({name:e.name,schema:e.schema,sql:e.sql??""})),T=(await sql`
|
|
180
181
|
SELECT
|
|
181
182
|
n.nspname AS "schema",
|
|
182
183
|
cl.relname AS "table",
|
|
@@ -188,7 +189,7 @@ END $$;
|
|
|
188
189
|
c.contype = 'c'
|
|
189
190
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
190
191
|
ORDER BY n.nspname, cl.relname
|
|
191
|
-
`.execute(this.kysely)).rows.map(e=>({schema:e.schema,table:e.table,expression:e.expression??""})),
|
|
192
|
+
`.execute(this.kysely)).rows.map(e=>({schema:e.schema,table:e.table,expression:e.expression??""})),L=(await sql`
|
|
192
193
|
SELECT
|
|
193
194
|
n.nspname AS "schema",
|
|
194
195
|
cl.relname AS "table",
|
|
@@ -203,7 +204,7 @@ END $$;
|
|
|
203
204
|
c.contype = 'u'
|
|
204
205
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
205
206
|
GROUP BY n.nspname, cl.relname, c.conname, c.oid
|
|
206
|
-
`.execute(this.kysely)).rows.map(e=>({schema:e.schema,table:e.table,name:e.name,columns:e.columns})),
|
|
207
|
+
`.execute(this.kysely)).rows.map(e=>({schema:e.schema,table:e.table,name:e.name,columns:e.columns})),w=(await sql`
|
|
207
208
|
SELECT
|
|
208
209
|
n.nspname AS "schema",
|
|
209
210
|
cl.relname AS "table",
|
|
@@ -218,7 +219,7 @@ END $$;
|
|
|
218
219
|
n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
219
220
|
AND cl.relkind IN ('r', 'v', 'm', 'f', 'p')
|
|
220
221
|
AND d.description IS NOT NULL
|
|
221
|
-
`.execute(this.kysely)).rows.map(e=>({schema:e.schema,table:e.table,column:e.column??void 0,text:e.text})),
|
|
222
|
+
`.execute(this.kysely)).rows.map(e=>({schema:e.schema,table:e.table,column:e.column??void 0,text:e.text})),b=await sql`
|
|
222
223
|
SELECT
|
|
223
224
|
n.nspname AS "schema",
|
|
224
225
|
t.typname AS "type",
|
|
@@ -229,7 +230,7 @@ END $$;
|
|
|
229
230
|
JOIN pg_namespace n ON n.oid = t.typnamespace
|
|
230
231
|
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
231
232
|
GROUP BY n.nspname, t.typname
|
|
232
|
-
`.execute(this.kysely),
|
|
233
|
+
`.execute(this.kysely),I=await sql`
|
|
233
234
|
SELECT
|
|
234
235
|
n.nspname AS "schema",
|
|
235
236
|
t.typname AS "type",
|
|
@@ -251,10 +252,10 @@ END $$;
|
|
|
251
252
|
AND NOT a.attisdropped
|
|
252
253
|
AND n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
253
254
|
GROUP BY n.nspname, t.typname
|
|
254
|
-
`.execute(this.kysely),
|
|
255
|
+
`.execute(this.kysely),C=[...b.rows.map(e=>({schema:e.schema,type:e.type,kind:"enum",values:e.values})),...I.rows.map(e=>({schema:e.schema,type:e.type,kind:"composite",fields:e.fields}))],k=(await sql`SELECT current_database() AS "name"`.execute(this.kysely)).rows[0]?.name??"postgres",f={tables:i,columns:l,indexes:R,foreign_keys:r,primary_keys:_,views:O,triggers:[],check_constraints:T,unique_constraints:L,comments:w,custom_types:C,database_name:k,version:""};return await this.writeCachedIntrospection(f,{useDriver:s}),f}catch(o){return console.error("Introspection failed:",o),{tables:[],columns:[],indexes:[],foreign_keys:[],primary_keys:[],views:[],triggers:[],check_constraints:[],unique_constraints:[],comments:[],custom_types:[],database_name:"postgres",version:""}}}rlsState="unknown";async ensureRlsContext(){if(this.rlsState!=="unknown")return this.rlsState==="active";let n=await sql`
|
|
255
256
|
SELECT count(*) ::text as count FROM pg_class WHERE relrowsecurity = true
|
|
256
257
|
`.execute(this.kysely);if(!(Number(n.rows[0]?.count??0)>0))return this.rlsState="inactive",false;this.rlsState="active",await sql.raw(g).execute(this.kysely);let t=await sql`
|
|
257
258
|
SELECT DISTINCT n.nspname FROM pg_class c
|
|
258
259
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
259
260
|
WHERE c.relrowsecurity = true
|
|
260
|
-
`.execute(this.kysely);for(let{nspname:o}of t.rows){let i=
|
|
261
|
+
`.execute(this.kysely);for(let{nspname:o}of t.rows){let i=A(o);await sql.raw(`GRANT USAGE ON SCHEMA ${i} TO ${m}`).execute(this.kysely),await sql.raw(`GRANT ALL ON ALL TABLES IN SCHEMA ${i} TO ${m}`).execute(this.kysely),await sql.raw(`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${i} TO ${m}`).execute(this.kysely),await sql.raw(`ALTER DEFAULT PRIVILEGES IN SCHEMA ${i} GRANT ALL ON TABLES TO ${m}`).execute(this.kysely),await sql.raw(`ALTER DEFAULT PRIVILEGES IN SCHEMA ${i} GRANT ALL ON SEQUENCES TO ${m}`).execute(this.kysely);}return true}async postgresTransactionActive(n){try{return await sql`SAVEPOINT __supalite_outer_tx_check`.execute(n),await sql`RELEASE SAVEPOINT __supalite_outer_tx_check`.execute(n),!0}catch{return false}}async applyJwtSessionContext(n,s,t){let o=s.auth,i=o?.role||"anon",d=String(o?.uid??""),l=o?.jwt;await sql`SELECT set_config('role', ${i}, true)`.execute(n),await sql`SELECT set_config('request.jwt.claim.sub', ${d}, true)`.execute(n),await sql`SELECT set_config('request.jwt.claim.role', ${i}, true)`.execute(n),t&&await sql.raw(`SET LOCAL ROLE ${A(i)}`).execute(n),l&&typeof l=="object"&&await sql`SELECT set_config('request.jwt.claims', ${JSON.stringify(l)}, true)`.execute(n);}async withContext(n,s,t){let o=t?.forceRollback===true;if(!o&&!n)return s(this.kysely);let i=n?await this.ensureRlsContext():false,l=n?.auth?.role||"anon",u=typeof l=="string"&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(l)&&!U.has(l);if(!o&&!i&&!u)return s(this.kysely);if(!o&&u)return this.harnessHoldingOuterTx?(invariant(await this.postgresTransactionActive(this.kysely),"harnessHoldingOuterTx is set but the connection has no open PostgreSQL transaction; wrap REST requests in BEGIN/ROLLBACK in the spec harness"),await this.applyJwtSessionContext(this.kysely,n,true),s(this.kysely)):this.kysely.transaction().execute(async r=>(await this.applyJwtSessionContext(r,n,true),s(r)));if(!o&&i&&!u)return this.kysely.transaction().execute(async r=>(await this.applyJwtSessionContext(r,n,true),s(r)));try{return await this.kysely.transaction().execute(async r=>{n&&(i||u)&&await this.applyJwtSessionContext(r,n,u);let S=await s(r);if(o)throw new p(S);return S})}catch(r){if(r instanceof p)return r.result;throw r}}async onPostgrestAST(n){if(!n.from)return n;let s=n.schema??"public",t=n.from,o=await this.introspect({useCache:true});if(!o.tables.some(i=>i.name===t&&i.schema===s)&&!o.views.some(i=>i.name===t&&i.schema===s))throw new RelationNotFoundError(s,t);return n}async transaction(n,s){await this.exec("BEGIN");try{for(let t of n)await this.exec(t);await this.exec("COMMIT");}catch(t){throw await this.exec("ROLLBACK"),t}finally{s?.intent==="migration"&&await this.clearSchemaCache();}}};var N=class extends E{driver;dialect="postgres";constructor(n){super(n),this.driver=F(n.url??"",{types:{bigint:{to:20,from:[20],serialize:t=>t.toString(),parse:t=>{let o=Number(t);return Number.isSafeInteger(o)?o:BigInt(t)}},json:{to:114,from:[114],serialize:t=>JSON.stringify(t),parse:t=>JSON.parse(t)},jsonb:{to:3802,from:[3802],serialize:t=>JSON.stringify(t),parse:t=>JSON.parse(t)},numeric:{to:1700,from:[1700],serialize:t=>String(t),parse:t=>{let o=Number(t);return Number.isFinite(o)&&String(o)===t?o:t}},date:{to:1082,from:[1082],serialize:t=>t,parse:t=>t},time:{to:1083,from:[1083],serialize:t=>t,parse:t=>t},timestamp:{to:1114,from:[1114],serialize:t=>t,parse:t=>t},timestamptz:{to:1184,from:[1184],serialize:t=>t,parse:t=>t},timetz:{to:1266,from:[1266],serialize:t=>t,parse:t=>t}}});let s=new PostgresJSDialect({postgres:this.driver});this.kysely=new Kysely({dialect:s});}async close(){await this.driver.end();}};function ae(c){return new N(c)}export{N as PostgresConnection,ae as createPostgresConnection};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PGliteOptions, PGlite } from '@electric-sql/pglite';
|
|
2
2
|
export { PGlite } from '@electric-sql/pglite';
|
|
3
|
-
import { I as IBasePostgresConnectionConfig, B as BasePostgresConnection } from '../BasePostgresConnection-
|
|
3
|
+
import { I as IBasePostgresConnectionConfig, B as BasePostgresConnection } from '../BasePostgresConnection-NlNmZWv1.js';
|
|
4
4
|
import { ConnectionMigrator, SchemaDiffResult, PlanResult, PlanStep } from '@supabase/lite';
|
|
5
5
|
import 'kysely';
|
|
6
6
|
|
|
@@ -8,13 +8,13 @@ import {PGlite}from'@electric-sql/pglite';export{PGlite}from'@electric-sql/pglit
|
|
|
8
8
|
return emitWarning(warning, ...args);
|
|
9
9
|
};
|
|
10
10
|
} catch {}
|
|
11
|
-
async function
|
|
11
|
+
async function se(n){let t;if(typeof n=="string"&&(t=n),typeof n=="object"&&n.dataDir&&(t=n.dataDir),t){let{mkdir:e}=await import('node:fs');e(t,{recursive:true},s=>{if(s)throw s});}}var R=class{#e;#t;constructor(t,e){this.#e=t,this.#t=e;}async acquireConnection(){return new T(this.#e)}async beginTransaction(t,e){await t.executeQuery(CompiledQuery.raw("BEGIN"));}async commitTransaction(t){await t.executeQuery(CompiledQuery.raw("COMMIT"));}async rollbackTransaction(t){await t.executeQuery(CompiledQuery.raw("ROLLBACK"));}async destroy(){this.#t&&await this.#e.close();}async init(){}async releaseConnection(t){}},T=class{#e;constructor(t){this.#e=t;}async executeQuery(t){let e=await this.#e.query(t.sql,[...t.parameters]),s=e.affectedRows;return {rows:e.rows,numAffectedRows:typeof s=="number"?BigInt(s):void 0}}async*streamQuery(){throw new Error("PGlite does not support streaming.")}},g=class{client;#e=true;constructor(t,e){se(t);let s={...e};if(typeof t=="object"&&t instanceof PGlite){this.client=t,this.#e=false;return}typeof t=="string"?s={dataDir:t,...s}:s=t??{},this.client=new PGlite(s);}dialect={createAdapter:()=>new PostgresAdapter,createDriver:()=>new R(this.client,this.#e),createIntrospector:t=>new PostgresIntrospector(t),createQueryCompiler:()=>new PostgresQueryCompiler}};var E=["anon","authenticated","service_role"];function ae(n){return n==="service_role"?"NOLOGIN BYPASSRLS":"NOLOGIN"}function S(n){return n.size===0?"":`DO $$ BEGIN${[...n].map(e=>`
|
|
12
12
|
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${e}') THEN
|
|
13
|
-
CREATE ROLE ${e} ${
|
|
13
|
+
CREATE ROLE ${e} ${ae(e)};
|
|
14
14
|
END IF;`).join("")}
|
|
15
15
|
END $$;
|
|
16
|
-
`}var B=
|
|
17
|
-
`;)e++;continue}if(s==="/"&&
|
|
16
|
+
`}var B=S(new Set(E));function d(n,t){return n?n.quoted?n.value===t:n.value.toLowerCase()===t:false}function p(n){return n?.quoted?n.value:n?.value.toLowerCase()}function oe(n,t){let e="",s=t+1;for(;s<n.length;){if(n[s]==='"'&&n[s+1]==='"'){e+='"',s+=2;continue}if(n[s]==='"')return {token:{value:e,quoted:true},end:s+1};e+=n[s],s++;}return {token:{value:e,quoted:true},end:s}}function re(n,t){let e=t+1;for(;e<n.length;){if(n[e]==="'"&&n[e+1]==="'"){e+=2;continue}if(n[e]==="'")return e+1;e++;}return e}function ie(n,t){let e=/^\$[A-Za-z_][A-Za-z0-9_]*\$|^\$\$/.exec(n.slice(t))?.[0];if(!e)return;let s=t+e.length,a=n.indexOf(e,s);return a===-1?n.length:a+e.length}function O(n){let t=[],e=0;for(;e<n.length;){let s=n[e],a=n[e+1];if(/\s/.test(s)){e++;continue}if(s==="-"&&a==="-"){for(e+=2;e<n.length&&n[e]!==`
|
|
17
|
+
`;)e++;continue}if(s==="/"&&a==="*"){for(e+=2;e<n.length&&!(n[e]==="*"&&n[e+1]==="/");)e++;e=e<n.length?e+2:e;continue}if(s==="'"){e=re(n,e);continue}if(s==="$"){let r=ie(n,e);if(r!==void 0){e=r;continue}}if(s==='"'){let{token:r,end:c}=oe(n,e);t.push(r),e=c;continue}if(s===","||s===";"){t.push({value:s,quoted:false}),e++;continue}if(/[A-Za-z_]/.test(s)){let r=e;for(e++;e<n.length&&/[A-Za-z0-9_$]/.test(n[e]);)e++;t.push({value:n.slice(r,e).toLowerCase(),quoted:false});continue}e++;}return t}function $(n,t){let e=p(n[t]),s=p(n[t+1]);if((e==="create"||e==="alter")&&(s==="role"||s==="user"||s==="group"))return n[t+2]}function h(n){let t=new Set,e=O(n);for(let s=0;s<e.length;s++){if(p(e[s])!=="create")continue;let a=$(e,s);for(let r of E)d(a,r)&&t.add(r);}return t}function L(n,t,e){let s=new Set([";","as","by","check","for","granted","in","on","option","using","where","with"]);for(let a=t;a<n.length;a++){let r=p(n[a]);if(!r||s.has(r))return;for(let c of E)d(n[a],c)&&e.add(c);}}function ce(n){let t=[],e=[];for(let s of n){if(p(s)===";"){e.length>0&&t.push(e),e=[];continue}e.push(s);}return e.length>0&&t.push(e),t}function D(n,t){return n.some(e=>p(e)===t)}function le(n){let t=new Set,e=ce(O(n));for(let s of e){let a=p(s[0]);for(let i=0;i<s.length;i++){let u=p(s[i]);u==="to"&&(D(s,"grant")||D(s,"policy")||p(s[i-1])==="owner")&&L(s,i+1,t),u==="from"&&a==="revoke"&&L(s,i+1,t);}let r=s.findIndex(i=>p(i)==="to"),c=s.findIndex(i=>p(i)==="on");a==="grant"&&r>1&&(c===-1||r<c)&&L(s,1,t);}return t}function b(n){let t=h(n);return new Set([...le(n)].filter(e=>!t.has(e)))}function v(n){let t=h(n);return new Set(E.filter(e=>!t.has(e)))}function U(n,t){let e=O(n);if(e.length===0)return false;let s=$(e,0);if(s){for(let c of t)if(d(s,c))return true;return false}let a=p(e[0]),r=p(e[1]);if(a==="drop"&&(r==="role"||r==="user"||r==="group")){for(let c of e.slice(2))for(let i of t)if(d(c,i))return true}if(a==="comment"&&p(e[1])==="on"&&p(e[2])==="role"){for(let c of t)if(d(e[3],c))return true}return false}var y="anon, authenticated, service_role",pe=new Set(["anon","authenticated","service_role"]);function F(n){return `"${n.replace(/"/g,'""')}"`}var N=class extends Error{constructor(e){super("Force rollback");this.result=e;}},_=class extends Connection{dialect="postgres";harnessHoldingOuterTx=false;constructor(t){super({...t,baseSchema:`
|
|
18
18
|
${t.baseSchema??""}
|
|
19
19
|
|
|
20
20
|
CREATE SCHEMA IF NOT EXISTS auth;
|
|
@@ -54,7 +54,7 @@ END $$;
|
|
|
54
54
|
tbls.table_schema NOT IN ('information_schema', 'pg_catalog')
|
|
55
55
|
AND tbls.table_type IN ('BASE TABLE', 'FOREIGN TABLE')
|
|
56
56
|
ORDER BY tbls.table_schema, tbls.table_name
|
|
57
|
-
`.execute(this.kysely)).rows.map(
|
|
57
|
+
`.execute(this.kysely)).rows.map(o=>({name:o.name,schema:o.schema,type:"table",rows:Number(o.rows),sql:"",engine:"",collation:""})),i=(await sql`
|
|
58
58
|
SELECT
|
|
59
59
|
cols.table_name AS "table",
|
|
60
60
|
cols.table_schema AS "schema",
|
|
@@ -96,6 +96,7 @@ END $$;
|
|
|
96
96
|
END AS "is_identity",
|
|
97
97
|
COALESCE(cols.collation_name, '') AS "collation",
|
|
98
98
|
cols.udt_name AS "udt_name",
|
|
99
|
+
CASE WHEN pt.typtype = 'd' THEN pt.typname ELSE cols.udt_name END AS "domain_type",
|
|
99
100
|
CASE WHEN cols.is_generated = 'NEVER' THEN false ELSE true END AS "is_generated"
|
|
100
101
|
FROM information_schema.columns cols
|
|
101
102
|
LEFT JOIN pg_catalog.pg_class c ON c.relname = cols.table_name
|
|
@@ -106,7 +107,7 @@ END $$;
|
|
|
106
107
|
LEFT JOIN pg_catalog.pg_type pt ON pt.oid = attr.atttypid
|
|
107
108
|
WHERE cols.table_schema NOT IN ('information_schema', 'pg_catalog')
|
|
108
109
|
ORDER BY cols.table_schema, cols.table_name, cols.ordinal_position
|
|
109
|
-
`.execute(this.kysely)).rows.map(
|
|
110
|
+
`.execute(this.kysely)).rows.map(o=>({table:o.table,schema:o.schema,name:o.name,type:o.type,nullable:o.nullable,default_value:o.default_value,is_primary_key:!1,ordinal_position:Number(o.ordinal_position),character_maximum_length:o.character_maximum_length??null,precision:o.precision??null,is_identity:o.is_identity,collation:o.collation,pg_type:o.domain_type??o.udt_name??void 0,is_generated:o.is_generated??!1})),m=(await sql`
|
|
110
111
|
SELECT
|
|
111
112
|
ns.nspname AS "schema",
|
|
112
113
|
cl.relname AS "table",
|
|
@@ -131,7 +132,7 @@ END $$;
|
|
|
131
132
|
'information_schema'
|
|
132
133
|
, 'pg_catalog')
|
|
133
134
|
ORDER BY ns.nspname, cl.relname, con.conname, cols.ord
|
|
134
|
-
`.execute(this.kysely)).rows.map(
|
|
135
|
+
`.execute(this.kysely)).rows.map(o=>({table:o.table,column:o.column,schema:o.schema,ref_table:o.ref_table,ref_column:o.ref_column,foreign_key_name:o.foreign_key_name,fk_def:o.fk_def,on_update:"",on_delete:""})),x=(await sql`
|
|
135
136
|
SELECT
|
|
136
137
|
ns.nspname AS "schema",
|
|
137
138
|
cl.relname AS "table",
|
|
@@ -148,7 +149,7 @@ END $$;
|
|
|
148
149
|
'information_schema'
|
|
149
150
|
, 'pg_catalog')
|
|
150
151
|
GROUP BY ns.nspname, cl.relname, con.oid
|
|
151
|
-
`.execute(this.kysely)).rows.map(
|
|
152
|
+
`.execute(this.kysely)).rows.map(o=>({table:o.table,columns:o.columns,schema:o.schema,field_count:o.columns.length})),q=new Set(x.flatMap(o=>o.columns.map(Z=>`${o.schema}.${o.table}.${Z}`)));for(let o of i)o.is_primary_key=q.has(`${o.schema}.${o.table}.${o.name}`);let W=(await sql`
|
|
152
153
|
SELECT
|
|
153
154
|
tnsp.nspname AS "schema",
|
|
154
155
|
cl.relname AS "table",
|
|
@@ -169,7 +170,7 @@ END $$;
|
|
|
169
170
|
'information_schema'
|
|
170
171
|
, 'pg_catalog')
|
|
171
172
|
GROUP BY tnsp.nspname, cl.relname, ic.relname, idx.indisunique
|
|
172
|
-
`.execute(this.kysely)).rows.map(
|
|
173
|
+
`.execute(this.kysely)).rows.map(o=>({table:o.table,name:o.name,unique:o.unique,columns:o.columns,schema:o.schema})),M=(await sql`
|
|
173
174
|
SELECT
|
|
174
175
|
views.schemaname AS "schema",
|
|
175
176
|
views.viewname AS "name",
|
|
@@ -177,7 +178,7 @@ END $$;
|
|
|
177
178
|
FROM pg_views views
|
|
178
179
|
WHERE views.schemaname NOT IN ('information_schema', 'pg_catalog')
|
|
179
180
|
ORDER BY views.schemaname, views.viewname
|
|
180
|
-
`.execute(this.kysely)).rows.map(
|
|
181
|
+
`.execute(this.kysely)).rows.map(o=>({name:o.name,schema:o.schema,sql:o.sql??""})),j=(await sql`
|
|
181
182
|
SELECT
|
|
182
183
|
n.nspname AS "schema",
|
|
183
184
|
cl.relname AS "table",
|
|
@@ -189,7 +190,7 @@ END $$;
|
|
|
189
190
|
c.contype = 'c'
|
|
190
191
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
191
192
|
ORDER BY n.nspname, cl.relname
|
|
192
|
-
`.execute(this.kysely)).rows.map(
|
|
193
|
+
`.execute(this.kysely)).rows.map(o=>({schema:o.schema,table:o.table,expression:o.expression??""})),Q=(await sql`
|
|
193
194
|
SELECT
|
|
194
195
|
n.nspname AS "schema",
|
|
195
196
|
cl.relname AS "table",
|
|
@@ -204,7 +205,7 @@ END $$;
|
|
|
204
205
|
c.contype = 'u'
|
|
205
206
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
206
207
|
GROUP BY n.nspname, cl.relname, c.conname, c.oid
|
|
207
|
-
`.execute(this.kysely)).rows.map(
|
|
208
|
+
`.execute(this.kysely)).rows.map(o=>({schema:o.schema,table:o.table,name:o.name,columns:o.columns})),Y=(await sql`
|
|
208
209
|
SELECT
|
|
209
210
|
n.nspname AS "schema",
|
|
210
211
|
cl.relname AS "table",
|
|
@@ -219,7 +220,7 @@ END $$;
|
|
|
219
220
|
n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
220
221
|
AND cl.relkind IN ('r', 'v', 'm', 'f', 'p')
|
|
221
222
|
AND d.description IS NOT NULL
|
|
222
|
-
`.execute(this.kysely)).rows.map(
|
|
223
|
+
`.execute(this.kysely)).rows.map(o=>({schema:o.schema,table:o.table,column:o.column??void 0,text:o.text})),K=await sql`
|
|
223
224
|
SELECT
|
|
224
225
|
n.nspname AS "schema",
|
|
225
226
|
t.typname AS "type",
|
|
@@ -230,7 +231,7 @@ END $$;
|
|
|
230
231
|
JOIN pg_namespace n ON n.oid = t.typnamespace
|
|
231
232
|
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
232
233
|
GROUP BY n.nspname, t.typname
|
|
233
|
-
`.execute(this.kysely),
|
|
234
|
+
`.execute(this.kysely),V=await sql`
|
|
234
235
|
SELECT
|
|
235
236
|
n.nspname AS "schema",
|
|
236
237
|
t.typname AS "type",
|
|
@@ -252,15 +253,15 @@ END $$;
|
|
|
252
253
|
AND NOT a.attisdropped
|
|
253
254
|
AND n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
254
255
|
GROUP BY n.nspname, t.typname
|
|
255
|
-
`.execute(this.kysely),
|
|
256
|
+
`.execute(this.kysely),z=[...K.rows.map(o=>({schema:o.schema,type:o.type,kind:"enum",values:o.values})),...V.rows.map(o=>({schema:o.schema,type:o.type,kind:"composite",fields:o.fields}))],X=(await sql`SELECT current_database() AS "name"`.execute(this.kysely)).rows[0]?.name??"postgres",k={tables:r,columns:i,indexes:W,foreign_keys:m,primary_keys:x,views:M,triggers:[],check_constraints:j,unique_constraints:Q,comments:Y,custom_types:z,database_name:X,version:""};return await this.writeCachedIntrospection(k,{useDriver:e}),k}catch(a){return console.error("Introspection failed:",a),{tables:[],columns:[],indexes:[],foreign_keys:[],primary_keys:[],views:[],triggers:[],check_constraints:[],unique_constraints:[],comments:[],custom_types:[],database_name:"postgres",version:""}}}rlsState="unknown";async ensureRlsContext(){if(this.rlsState!=="unknown")return this.rlsState==="active";let t=await sql`
|
|
256
257
|
SELECT count(*) ::text as count FROM pg_class WHERE relrowsecurity = true
|
|
257
258
|
`.execute(this.kysely);if(!(Number(t.rows[0]?.count??0)>0))return this.rlsState="inactive",false;this.rlsState="active",await sql.raw(B).execute(this.kysely);let s=await sql`
|
|
258
259
|
SELECT DISTINCT n.nspname FROM pg_class c
|
|
259
260
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
260
261
|
WHERE c.relrowsecurity = true
|
|
261
|
-
`.execute(this.kysely);for(let{nspname:
|
|
262
|
+
`.execute(this.kysely);for(let{nspname:a}of s.rows){let r=F(a);await sql.raw(`GRANT USAGE ON SCHEMA ${r} TO ${y}`).execute(this.kysely),await sql.raw(`GRANT ALL ON ALL TABLES IN SCHEMA ${r} TO ${y}`).execute(this.kysely),await sql.raw(`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${r} TO ${y}`).execute(this.kysely),await sql.raw(`ALTER DEFAULT PRIVILEGES IN SCHEMA ${r} GRANT ALL ON TABLES TO ${y}`).execute(this.kysely),await sql.raw(`ALTER DEFAULT PRIVILEGES IN SCHEMA ${r} GRANT ALL ON SEQUENCES TO ${y}`).execute(this.kysely);}return true}async postgresTransactionActive(t){try{return await sql`SAVEPOINT __supalite_outer_tx_check`.execute(t),await sql`RELEASE SAVEPOINT __supalite_outer_tx_check`.execute(t),!0}catch{return false}}async applyJwtSessionContext(t,e,s){let a=e.auth,r=a?.role||"anon",c=String(a?.uid??""),i=a?.jwt;await sql`SELECT set_config('role', ${r}, true)`.execute(t),await sql`SELECT set_config('request.jwt.claim.sub', ${c}, true)`.execute(t),await sql`SELECT set_config('request.jwt.claim.role', ${r}, true)`.execute(t),s&&await sql.raw(`SET LOCAL ROLE ${F(r)}`).execute(t),i&&typeof i=="object"&&await sql`SELECT set_config('request.jwt.claims', ${JSON.stringify(i)}, true)`.execute(t);}async withContext(t,e,s){let a=s?.forceRollback===true;if(!a&&!t)return e(this.kysely);let r=t?await this.ensureRlsContext():false,i=t?.auth?.role||"anon",u=typeof i=="string"&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)&&!pe.has(i);if(!a&&!r&&!u)return e(this.kysely);if(!a&&u)return this.harnessHoldingOuterTx?(invariant(await this.postgresTransactionActive(this.kysely),"harnessHoldingOuterTx is set but the connection has no open PostgreSQL transaction; wrap REST requests in BEGIN/ROLLBACK in the spec harness"),await this.applyJwtSessionContext(this.kysely,t,true),e(this.kysely)):this.kysely.transaction().execute(async m=>(await this.applyJwtSessionContext(m,t,true),e(m)));if(!a&&r&&!u)return this.kysely.transaction().execute(async m=>(await this.applyJwtSessionContext(m,t,true),e(m)));try{return await this.kysely.transaction().execute(async m=>{t&&(r||u)&&await this.applyJwtSessionContext(m,t,u);let f=await e(m);if(a)throw new N(f);return f})}catch(m){if(m instanceof N)return m.result;throw m}}async onPostgrestAST(t){if(!t.from)return t;let e=t.schema??"public",s=t.from,a=await this.introspect({useCache:true});if(!a.tables.some(r=>r.name===s&&r.schema===e)&&!a.views.some(r=>r.name===s&&r.schema===e))throw new RelationNotFoundError(e,s);return t}async transaction(t,e){await this.exec("BEGIN");try{for(let s of t)await this.exec(s);await this.exec("COMMIT");}catch(s){throw await this.exec("ROLLBACK"),s}finally{e?.intent==="migration"&&await this.clearSchemaCache();}}};var G=(n,t=e=>e)=>{if(!n||n==="{}")return [];let e=n.slice(1,-1);if(e==="")return [];let s=[],a="",r=false,c=0;for(let i=0;i<e.length;i++){let u=e[i];u==='"'&&e[i-1]!=="\\"?(r=!r,a+=u):u==="{"&&!r?(c++,a+=u):u==="}"&&!r?(c--,a+=u):u===","&&!r&&c===0?(s.push(t(a)),a=""):a+=u;}return a!==""&&s.push(t(a)),s},fe=n=>n==="NULL"?null:n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\(.)/g,"$1"):n,de=n=>n==="NULL"?null:Number.parseInt(n,10);function J(n){return typeof n=="object"&&n!==null&&"text"in n&&"values"in n}function ye(n,t){if(n==null)return n;switch(t){case 20:return typeof n=="bigint"?n:BigInt(n);case 22:return Array.isArray(n)?n:typeof n=="string"?n.split(" ").map(Number).filter(e=>!Number.isNaN(e)):n;case 1002:case 1009:case 1015:return typeof n=="string"?G(n,fe):n;case 1005:case 1007:case 1016:return typeof n=="string"?G(n,de):n;default:return n}}function C(n){return {async query(t,e){let s=J(t)?t.text:t,a=J(t)?t.values:e??[],r=await n.driver.query(s,[...a]);return {rows:r.rows.map(i=>Object.fromEntries(r.fields.map(u=>[u.name,ye(i[u.name],u.dataTypeID)])))}}}}async function Ee(){try{return await import('@supabase/pg-delta')}catch(n){throw new Error("Postgres/PGlite schema diffing now requires a Bun/Node-compatible runtime with pg-delta available.",{cause:n})}}function Se(n){let t=/^drop table (.+)$/.exec(n);if(t)return {table:t[1],reason:"drop table"};let e=/^drop column (.+) on (.+)$/.exec(n);if(e)return {table:e[2],reason:`drop column ${e[1]}`};let s=/^drop sequence (.+)$/.exec(n);return s?{table:s[1],reason:"drop sequence"}:{table:"unknown",reason:n}}var A=class{constructor(t,e){this.from=t;this.desiredSchema=e;}#e;async#t(t){if(this.#e)return this.#e;let e=new this.from.constructor;try{let s=S(b(this.desiredSchema));return s&&await e.exec(s),await e.exec(this.desiredSchema),this.#e=await t(C(e)),this.#e}finally{await e.close();}}async diff(){let{createPlan:t,extractCatalog:e}=await Ee(),s=C(this.from),a=await this.#t(e),r=await e(s),c=await t(r,a);if(!c)return {diff:"",plan:{steps:[],warnings:[],unsafe:false}};let i=c.plan.risk?.level==="data_loss"?c.plan.risk.statements.map(Se):[],u=v(this.desiredSchema),m=c.plan.statements.filter(f=>!U(f,u));return {diff:m.join(`
|
|
262
263
|
|
|
263
|
-
`),plan:{steps:
|
|
264
|
-
`),
|
|
264
|
+
`),plan:{steps:m.map(f=>({sql:f})),warnings:i,unsafe:c.plan.risk?.level==="data_loss"}}}async migratePlan(t,e){if(t.steps.length===0)return;if(t.unsafe&&!e?.force)throw new DataLossError(t.warnings??[]);let s=t.steps.map(i=>i.sql).join(`
|
|
265
|
+
`),a=h(s),r=new Set(t.steps.flatMap(i=>[...b(i.sql)]).filter(i=>!a.has(i))),c=S(r);c&&await this.from.exec(c),await this.from.transaction(t.steps.map(i=>i.sql),{intent:"migration"});}async migrate(t){let e=await this.diff();return await this.migratePlan(e.plan,t),e}safeSortPlanSteps(t){return t}};var I=class extends _{driver;dialect="postgres";#e=false;constructor(t={}){let e=new PGlite({...t.pgliteOptions,dataDir:t.url??void 0,extensions:{...t.pgliteOptions?.extensions,isn:isn,ltree:ltree,file_fdw:file_fdw,pgcrypto:pgcrypto},parsers:{20:a=>{let r=Number(a);return Number.isSafeInteger(r)?r:BigInt(a)},114:a=>JSON.parse(a),3802:a=>JSON.parse(a),1700:a=>{let r=Number(a);return Number.isFinite(r)&&String(r)===a?r:a},1082:a=>a,1083:a=>a,1114:a=>a,1184:a=>a,1266:a=>a,...t.pgliteOptions?.parsers}}),{dialect:s}=new g(e);super(t),this.driver=e,this.kysely=new Kysely({dialect:s});}async exec(t,...e){try{if(e.length>0){let{rows:a}=await sql(t,...e??[]).execute(this.kysely);return {rows:a}}return {rows:(await this.driver.exec(t))[0].rows}}catch(s){throw console.error(s),new Error(`Failed to execute query: ${t}`)}}async close(){this.#e||(this.#e=true,await this.clearSchemaCache(),await this.kysely.destroy(),await this.driver.close());}createMigrator(t){let e=[this.config.baseSchema,t].filter(Boolean).join(`
|
|
265
266
|
|
|
266
|
-
`);return new
|
|
267
|
+
`);return new A(this,e)}};async function tt(n={}){return new I(n)}export{I as PgliteConnection,tt as createPgliteConnection};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { SupabaseClientOptions } from '@supabase/supabase-js';
|
|
|
3
3
|
import { D as DefaultSchema, S as Schema } from './index-xv_pDjEt.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
|
-
import { W as Where, a as IntrospectResult, b as CacheDriver, c as CacheSetOptions, A as AnyAST, V as VarsContext, T as TransactionOptions$1 } from './Connection-
|
|
7
|
-
export { d as AST, e as ASTType, f as AggregateFunction, B as BaseAST, g as BodyResult, h as CheckConstraintInfo, i as ColumnDef, j as ColumnDiff, k as ColumnInfo, l as ColumnRef, m as CommentInfo, C as Connection, n as ConnectionContextOptions, o as ConnectionMigrator, p as CustomTypesInfo, D as DataLossError, q as DataLossWarning, r as DeleteAST, s as Dialect, t as DiffResult, E as EmbedDef, u as EmbedTransform, v as ExplainOptions, F as FiltersResult, w as ForeignKeyDiff, x as ForeignKeyInfo, H as HeadersResult, I as IConnectionConfig, y as IndexDiff, z as IndexInfo, G as InsertAST, J as IntrospectOptions, K as JoinDef, L as JoinMap, M as Meta, N as MigrationError, O as OrderEntry, P as PlanResult, Q as PlanStep, R as PlanStepType, S as PreferToken, U as PrimaryKeyInfo, X as Qb, Y as QbDelete, Z as QbInsert, _ as QbSelect, $ as QbUpdate, a0 as QueryAST, a1 as QueryParamsResult, a2 as RelationNotFoundError, a3 as RouteResult, a4 as RpcAST, a5 as RpcResult, a6 as SchemaDiffResult, a7 as SelectEntry, a8 as SelectResult, a9 as TableDiff, aa as TableInfo, ab as TextSearchValue, ac as TransformsResult, ad as TranslatorConfig, ae as TriggerInfo, af as UniqueConstraintInfo, ag as UpdateAST, ah as UpsertAST, ai as UpsertResult, aj as ViewInfo, ak as WhereValue, al as isRef } from './Connection-
|
|
6
|
+
import { W as Where, a as IntrospectResult, b as CacheDriver, c as CacheSetOptions, A as AnyAST, V as VarsContext, T as TransactionOptions$1 } from './Connection-DF_xKWko.js';
|
|
7
|
+
export { d as AST, e as ASTType, f as AggregateFunction, B as BaseAST, g as BodyResult, h as CheckConstraintInfo, i as ColumnDef, j as ColumnDiff, k as ColumnInfo, l as ColumnRef, m as CommentInfo, C as Connection, n as ConnectionContextOptions, o as ConnectionMigrator, p as CustomTypesInfo, D as DataLossError, q as DataLossWarning, r as DeleteAST, s as Dialect, t as DiffResult, E as EmbedDef, u as EmbedTransform, v as ExplainOptions, F as FiltersResult, w as ForeignKeyDiff, x as ForeignKeyInfo, H as HeadersResult, I as IConnectionConfig, y as IndexDiff, z as IndexInfo, G as InsertAST, J as IntrospectOptions, K as JoinDef, L as JoinMap, M as Meta, N as MigrationError, O as OrderEntry, P as PlanResult, Q as PlanStep, R as PlanStepType, S as PreferToken, U as PrimaryKeyInfo, X as Qb, Y as QbDelete, Z as QbInsert, _ as QbSelect, $ as QbUpdate, a0 as QueryAST, a1 as QueryParamsResult, a2 as RelationNotFoundError, a3 as RouteResult, a4 as RpcAST, a5 as RpcResult, a6 as SchemaDiffResult, a7 as SelectEntry, a8 as SelectResult, a9 as TableDiff, aa as TableInfo, ab as TextSearchValue, ac as TransformsResult, ad as TranslatorConfig, ae as TriggerInfo, af as UniqueConstraintInfo, ag as UpdateAST, ah as UpsertAST, ai as UpsertResult, aj as ViewInfo, ak as WhereValue, al as isRef } from './Connection-DF_xKWko.js';
|
|
8
8
|
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
9
9
|
import * as hono_utils_types from 'hono/utils/types';
|
|
10
10
|
import * as hono_types from 'hono/types';
|
|
@@ -2339,6 +2339,7 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
|
|
|
2339
2339
|
schema: string;
|
|
2340
2340
|
ref_schema?: string | undefined;
|
|
2341
2341
|
foreign_key_name: string;
|
|
2342
|
+
foreign_key_group?: string | undefined;
|
|
2342
2343
|
fk_def: string;
|
|
2343
2344
|
is_visible?: boolean | undefined;
|
|
2344
2345
|
}[];
|
|
@@ -2615,7 +2616,6 @@ declare abstract class SqliteConnection<Driver = unknown, DB = any, Config exten
|
|
|
2615
2616
|
* and comments.
|
|
2616
2617
|
*/
|
|
2617
2618
|
private mergeDeparseMetadata;
|
|
2618
|
-
private markForeignKeyVisibility;
|
|
2619
2619
|
/**
|
|
2620
2620
|
* Create a migrator for the given schema.
|
|
2621
2621
|
* @param desiredSchema The desired schema to migrate to. Input DDL is expected to be `config.ddlDialect`.
|