@supabase/lite 0.5.0 → 0.6.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.
- package/LIMITATIONS.md +4 -0
- package/STATUS.md +6 -2
- package/dist/{Connection-DF_xKWko.d.ts → Connection-DJbw6dM8.d.ts} +117 -1
- package/dist/db/fallback.d.ts +1 -1
- package/dist/db/postgres/{BasePostgresConnection-NlNmZWv1.d.ts → BasePostgresConnection-xaPv2E6u.d.ts} +14 -1
- package/dist/db/postgres/PostgresConnection.d.ts +10 -1
- package/dist/db/postgres/PostgresConnection.js +105 -19
- package/dist/db/postgres/pglite/PgliteConnection.d.ts +1 -1
- package/dist/db/postgres/pglite/PgliteConnection.js +109 -23
- package/dist/index.d.ts +25 -2
- package/dist/index.js +45 -42
- package/dist/static/.vite/manifest.json +2 -2
- package/dist/static/assets/{main-DexXgo9R.css → main-BITGMylP.css} +4 -0
- package/dist/vite/index.d.ts +23 -0
- package/package.json +1 -1
- /package/dist/static/assets/{main-BsWx0q9l.js → main-DO_xnvTw.js} +0 -0
|
@@ -8,14 +8,14 @@ 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
|
|
12
|
-
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${
|
|
13
|
-
CREATE ROLE ${
|
|
11
|
+
async function Ee(n){let e;if(typeof n=="string"&&(e=n),typeof n=="object"&&n.dataDir&&(e=n.dataDir),e){let{mkdir:t}=await import('node:fs');t(e,{recursive:true},s=>{if(s)throw s});}}var v=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t;}async acquireConnection(){return new P(this.#e)}async beginTransaction(e,t){await e.executeQuery(CompiledQuery.raw("BEGIN"));}async commitTransaction(e){await e.executeQuery(CompiledQuery.raw("COMMIT"));}async rollbackTransaction(e){await e.executeQuery(CompiledQuery.raw("ROLLBACK"));}async destroy(){this.#t&&await this.#e.close();}async init(){}async releaseConnection(e){}},P=class{#e;constructor(e){this.#e=e;}async executeQuery(e){let t=await this.#e.query(e.sql,[...e.parameters]),s=t.affectedRows;return {rows:t.rows,numAffectedRows:typeof s=="number"?BigInt(s):void 0}}async*streamQuery(){throw new Error("PGlite does not support streaming.")}},T=class{client;#e=true;constructor(e,t){Ee(e);let s={...t};if(typeof e=="object"&&e instanceof PGlite){this.client=e,this.#e=false;return}typeof e=="string"?s={dataDir:e,...s}:s=e??{},this.client=new PGlite(s);}dialect={createAdapter:()=>new PostgresAdapter,createDriver:()=>new v(this.client,this.#e),createIntrospector:e=>new PostgresIntrospector(e),createQueryCompiler:()=>new PostgresQueryCompiler}};var O=["anon","authenticated","service_role"];function Se(n){return n==="service_role"?"NOLOGIN BYPASSRLS":"NOLOGIN"}function C(n){return n.size===0?"":`DO $$ BEGIN${[...n].map(t=>`
|
|
12
|
+
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${t}') THEN
|
|
13
|
+
CREATE ROLE ${t} ${Se(t)};
|
|
14
14
|
END IF;`).join("")}
|
|
15
15
|
END $$;
|
|
16
|
-
`}var
|
|
17
|
-
`;)
|
|
18
|
-
${
|
|
16
|
+
`}var K=C(new Set(O));function A(n,e){return n?n.quoted?n.value===e:n.value.toLowerCase()===e:false}function y(n){return n?.quoted?n.value:n?.value.toLowerCase()}function Ne(n,e){let t="",s=e+1;for(;s<n.length;){if(n[s]==='"'&&n[s+1]==='"'){t+='"',s+=2;continue}if(n[s]==='"')return {token:{value:t,quoted:true},end:s+1};t+=n[s],s++;}return {token:{value:t,quoted:true},end:s}}function we(n,e){let t=e+1;for(;t<n.length;){if(n[t]==="'"&&n[t+1]==="'"){t+=2;continue}if(n[t]==="'")return t+1;t++;}return t}function Ae(n,e){let t=/^\$[A-Za-z_][A-Za-z0-9_]*\$|^\$\$/.exec(n.slice(e))?.[0];if(!t)return;let s=e+t.length,a=n.indexOf(t,s);return a===-1?n.length:a+t.length}function $(n){let e=[],t=0;for(;t<n.length;){let s=n[t],a=n[t+1];if(/\s/.test(s)){t++;continue}if(s==="-"&&a==="-"){for(t+=2;t<n.length&&n[t]!==`
|
|
17
|
+
`;)t++;continue}if(s==="/"&&a==="*"){for(t+=2;t<n.length&&!(n[t]==="*"&&n[t+1]==="/");)t++;t=t<n.length?t+2:t;continue}if(s==="'"){t=we(n,t);continue}if(s==="$"){let o=Ae(n,t);if(o!==void 0){t=o;continue}}if(s==='"'){let{token:o,end:c}=Ne(n,t);e.push(o),t=c;continue}if(s===","||s===";"){e.push({value:s,quoted:false}),t++;continue}if(/[A-Za-z_]/.test(s)){let o=t;for(t++;t<n.length&&/[A-Za-z0-9_$]/.test(n[t]);)t++;e.push({value:n.slice(o,t).toLowerCase(),quoted:false});continue}t++;}return e}function Q(n,e){let t=y(n[e]),s=y(n[e+1]);if((t==="create"||t==="alter")&&(s==="role"||s==="user"||s==="group"))return n[e+2]}function L(n){let e=new Set,t=$(n);for(let s=0;s<t.length;s++){if(y(t[s])!=="create")continue;let a=Q(t,s);for(let o of O)A(a,o)&&e.add(o);}return e}function D(n,e,t){let s=new Set([";","as","by","check","for","granted","in","on","option","using","where","with"]);for(let a=e;a<n.length;a++){let o=y(n[a]);if(!o||s.has(o))return;for(let c of O)A(n[a],c)&&t.add(c);}}function Re(n){let e=[],t=[];for(let s of n){if(y(s)===";"){t.length>0&&e.push(t),t=[];continue}t.push(s);}return t.length>0&&e.push(t),e}function j(n,e){return n.some(t=>y(t)===e)}function be(n){let e=new Set,t=Re($(n));for(let s of t){let a=y(s[0]);for(let r=0;r<s.length;r++){let l=y(s[r]);l==="to"&&(j(s,"grant")||j(s,"policy")||y(s[r-1])==="owner")&&D(s,r+1,e),l==="from"&&a==="revoke"&&D(s,r+1,e);}let o=s.findIndex(r=>y(r)==="to"),c=s.findIndex(r=>y(r)==="on");a==="grant"&&o>1&&(c===-1||o<c)&&D(s,1,e);}return e}function F(n){let e=L(n);return new Set([...be(n)].filter(t=>!e.has(t)))}function Y(n){let e=L(n);return new Set(O.filter(t=>!e.has(t)))}function V(n,e){let t=$(n);if(t.length===0)return false;let s=Q(t,0);if(s){for(let c of e)if(A(s,c))return true;return false}let a=y(t[0]),o=y(t[1]);if(a==="drop"&&(o==="role"||o==="user"||o==="group")){for(let c of t.slice(2))for(let r of e)if(A(c,r))return true}if(a==="comment"&&y(t[1])==="on"&&y(t[2])==="role"){for(let c of e)if(A(t[3],c))return true}return false}function M(n){let e=n.trim();return e.startsWith('"')&&e.endsWith('"')||e.startsWith("`")&&e.endsWith("`")||e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}function Te(n){let e=[],t="",s=0,a=null;for(let o=0;o<n.length;o++){let c=n[o];if(a){t+=c,c===a&&(a=null);continue}if(c==='"'||c==="`"||c==="'"){a=c,t+=c;continue}if(c==="("?s++:c===")"&&s>0&&s--,c===","&&s===0){e.push(t.trim()),t="";continue}t+=c;}return t.trim()&&e.push(t.trim()),e}function Oe(n){let e=n.match(/^(.*?)\s+as\s+(.+)$/i),t=e?e[1].trim():n.trim(),s=e?e[2].trim():void 0;if(!s){let c=n.match(/^(.+?)\s+((?:"[^"]+"|`[^`]+`|\[[^\]]+\]|\w+))$/);c&&!/[()]/.test(c[1])&&(t=c[1].trim(),s=c[2].trim());}let a=t.split(".").map(M);if(a.length>2)return null;let o=a.at(-1);return !o||!/^[A-Za-z_][\w$]*$/.test(o)?null:{baseColumn:o,viewColumn:s?M(s):o}}function z(n){return !!(n&&/[A-Za-z0-9_$]/.test(n))}function Ce(n){let e=/\bselect\b/i.exec(n);if(!e)return null;let t=0,s=null;for(let a=e.index+e[0].length;a<n.length;a++){let o=n[a];if(s){o===s&&(s=null);continue}if(o==='"'||o==="`"||o==="'"){s=o;continue}if(o==="("){t++;continue}if(o===")"&&t>0){t--;continue}if(t===0&&n.slice(a,a+4).toLowerCase()==="from"&&!z(n[a-1])&&!z(n[a+4]))return {selectList:n.slice(e.index+e[0].length,a).trim(),fromRest:n.slice(a+4).trim()}}return null}function Le(n){let e=0,t=[];for(;e<n.length;){for(;/\s/.test(n[e]??"");)e++;let s=n[e],a="";if(s==='"'||s==="`"){let r=n.indexOf(s,e+1);if(r===-1)return null;a=n.slice(e,r+1),e=r+1;}else if(s==="["){let r=n.indexOf("]",e+1);if(r===-1)return null;a=n.slice(e,r+1),e=r+1;}else {let r=/^[A-Za-z_][\w$]*/.exec(n.slice(e));if(!r)return null;a=r[0],e+=a.length;}t.push(a);let o=n.slice(e),c=/^\s*\./.exec(o);if(!c)break;e+=c[0].length;}return t.length===0?null:{raw:t.join("."),rest:n.slice(e).trim()}}function X(n,e,t){let s=n.get(e)??[];s.includes(t)||s.push(t),n.set(e,s);}function Ie(n,e){if(!n)return null;let t=Ce(n);if(!t)return null;let s=Le(t.fromRest);if(!s)return null;let{raw:a,rest:o}=s;if(/\b(join|union|intersect|except)\b/i.test(o))return null;let c=a.split(".").map(M).at(-1);if(!c)return null;let r=new Map,l=e.get(c)??new Set;for(let p of Te(t.selectList)){let u=p.trim();if(u==="*"||u.endsWith(".*")){for(let d of l)X(r,d,d);continue}let f=Oe(p);f&&X(r,f.baseColumn,f.viewColumn);}return r.size===0?null:{baseTable:c,columns:r}}function xe(n,e){let t=new Map;for(let[s,a]of e){let o=[];for(let c of a){let r=n.get(c);if(r)for(let l of r)o.includes(l)||o.push(l);}o.length>0&&t.set(s,o);}return t}function ke(n){let e=new Map,t=new Map;for(let r of n.columns??[]){let l=t.get(r.table)??new Set;l.add(r.name),t.set(r.table,l);}let s=(r,l)=>{let p=e.get(r)??[];p.some(u=>u.name===l.name&&u.schema===l.schema)||p.push(l),e.set(r,p);};for(let r of n.tables??[]){if(r.type!=="table")continue;let l=t.get(r.name);l&&s(r.name,{name:r.name,schema:r.schema,columnByBaseColumn:new Map([...l].map(p=>[p,[p]]))});}let a=new Map;for(let r of n.views??[]){let l=Ie(r.sql,t);if(!l)continue;let p=t.get(r.name);if(!p)continue;let u=new Map;for(let[d,h]of l.columns){let g=h.filter(_=>p.has(_));g.length>0&&u.set(d,g);}if(u.size===0)continue;let f={name:r.name,schema:r.schema,columnByBaseColumn:u,fromRelation:l.baseTable};a.set(r.name,f);}let o=16;function c(r,l,p){if(l>o)return null;let u=r.fromRelation;if(e.has(u))return {physicalBase:u,columnByBaseColumn:r.columnByBaseColumn};let f=a.get(u);if(!f||p.has(u))return null;p.add(u);let d=c(f,l+1,p);if(p.delete(u),!d)return null;let h=xe(r.columnByBaseColumn,d.columnByBaseColumn);return h.size===0?null:{physicalBase:d.physicalBase,columnByBaseColumn:h}}for(let r of a.values()){let l=c(r,0,new Set([r.name]));l&&s(l.physicalBase,{name:r.name,schema:r.schema,columnByBaseColumn:l.columnByBaseColumn});}return e}function Z(n){return `${n.foreign_key_group??""}:${n.table}.${n.column}->${n.ref_table}.${n.ref_column}`}function Be(n){let e=new Map;for(let t of n){let s=`${t.schema}.${t.table}.${t.foreign_key_name}.${t.ref_schema??""}.${t.ref_table}`,a=e.get(s);a?a.push(t):e.set(s,[t]);}return [...e.values()]}function ve(n){let e=[[]];for(let t of n){let s=[];for(let a of e)for(let o of t)s.push([...a,o]);e=s;}return e}function Pe(n,e,t,s){let a=s.map(c=>c.childColumn).join(","),o=s.map(c=>c.parentColumn).join(",");return `${t}:${n.name}(${a})->${e.name}(${o})`}function ee(n){if(!n.foreign_keys?.length||!n.views?.length)return n;let e=ke(n),t=new Set(n.foreign_keys.map(Z)),s=[];for(let a of Be(n.foreign_keys)){let o=a[0],c=e.get(o.table)??[],r=e.get(o.ref_table)??[];for(let l of c)for(let p of r){if(l.schema!==p.schema)continue;let u=[];for(let f of a){let d=l.columnByBaseColumn.get(f.column)??[],h=p.columnByBaseColumn.get(f.ref_column)??[],g=d.flatMap(_=>h.map(E=>({fk:f,childColumn:_,parentColumn:E})));if(g.length===0){u.length=0;break}u.push(g);}for(let f of ve(u)){let h=l.name===o.table&&p.name===o.ref_table&&f.every(g=>g.childColumn===g.fk.column&&g.parentColumn===g.fk.ref_column)?void 0:Pe(l,p,o.foreign_key_name,f);for(let g of f){let _={...g.fk,table:l.name,column:g.childColumn,schema:l.schema,ref_table:p.name,ref_column:g.parentColumn,ref_schema:p.schema,foreign_key_group:h},E=Z(_);t.has(E)||(t.add(E),s.push(_));}}}}return s.length?{...n,foreign_keys:[...n.foreign_keys,...s]}:n}var R="anon, authenticated, service_role",Fe=new Set(["anon","authenticated","service_role"]);function te(n){return `"${n.replace(/"/g,'""')}"`}var N=class extends Error{constructor(t){super("Force rollback");this.result=t;}},I=class extends Connection{dialect="postgres";harnessHoldingOuterTx=false;constructor(e){super({...e,baseSchema:`
|
|
18
|
+
${e.baseSchema??""}
|
|
19
19
|
|
|
20
20
|
CREATE SCHEMA IF NOT EXISTS auth;
|
|
21
21
|
|
|
@@ -41,7 +41,7 @@ END $$;
|
|
|
41
41
|
'{}'
|
|
42
42
|
)::jsonb;
|
|
43
43
|
$$ LANGUAGE SQL STABLE;
|
|
44
|
-
`});}async introspect(
|
|
44
|
+
`});}async introspect(e){invariant(typeof e=="object"||e===void 0,"options must be an object");let t=e?.useCache??false,s=await this.readCachedIntrospection({useCache:t});if(s)return s;try{let a=await sql`
|
|
45
45
|
SELECT
|
|
46
46
|
tbls.table_name AS "name",
|
|
47
47
|
tbls.table_schema AS "schema",
|
|
@@ -53,8 +53,47 @@ END $$;
|
|
|
53
53
|
WHERE
|
|
54
54
|
tbls.table_schema NOT IN ('information_schema', 'pg_catalog')
|
|
55
55
|
AND tbls.table_type IN ('BASE TABLE', 'FOREIGN TABLE')
|
|
56
|
+
-- Individual partitions are hidden from the relation cache (like PostgREST):
|
|
57
|
+
-- direct access -> PGRST205, embedding -> PGRST200. The partitioned parent
|
|
58
|
+
-- (relkind 'p', relispartition = false) stays exposed.
|
|
59
|
+
AND NOT EXISTS (
|
|
60
|
+
SELECT 1
|
|
61
|
+
FROM pg_catalog.pg_class pc
|
|
62
|
+
JOIN pg_catalog.pg_namespace pn ON pn.oid = pc.relnamespace
|
|
63
|
+
WHERE pc.relname = tbls.table_name
|
|
64
|
+
AND pn.nspname = tbls.table_schema
|
|
65
|
+
AND pc.relispartition
|
|
66
|
+
)
|
|
56
67
|
ORDER BY tbls.table_schema, tbls.table_name
|
|
57
|
-
`.execute(this.kysely)
|
|
68
|
+
`.execute(this.kysely),o=await sql`
|
|
69
|
+
SELECT
|
|
70
|
+
mv.schemaname AS "schema",
|
|
71
|
+
mv.matviewname AS "name",
|
|
72
|
+
mv.definition AS "sql"
|
|
73
|
+
FROM pg_catalog.pg_matviews mv
|
|
74
|
+
WHERE mv.schemaname NOT IN ('information_schema', 'pg_catalog')
|
|
75
|
+
ORDER BY mv.schemaname, mv.matviewname
|
|
76
|
+
`.execute(this.kysely),c=await sql`
|
|
77
|
+
SELECT
|
|
78
|
+
n.nspname AS "schema",
|
|
79
|
+
c.relname AS "table",
|
|
80
|
+
a.attname AS "name",
|
|
81
|
+
a.attnum AS "ordinal_position",
|
|
82
|
+
format_type(a.atttypid, a.atttypmod) AS "type",
|
|
83
|
+
NOT a.attnotnull AS "nullable",
|
|
84
|
+
pg_get_expr(d.adbin, d.adrelid) AS "default_value"
|
|
85
|
+
FROM pg_catalog.pg_class c
|
|
86
|
+
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
|
|
87
|
+
JOIN pg_catalog.pg_attribute a ON a.attrelid = c.oid
|
|
88
|
+
LEFT JOIN pg_catalog.pg_attrdef d
|
|
89
|
+
ON d.adrelid = c.oid AND d.adnum = a.attnum
|
|
90
|
+
WHERE
|
|
91
|
+
c.relkind = 'm'
|
|
92
|
+
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
93
|
+
AND a.attnum > 0
|
|
94
|
+
AND NOT a.attisdropped
|
|
95
|
+
ORDER BY n.nspname, c.relname, a.attnum
|
|
96
|
+
`.execute(this.kysely),r=a.rows.map(i=>({name:i.name,schema:i.schema,type:"table",rows:Number(i.rows),sql:"",engine:"",collation:""}));for(let i of o.rows)r.push({name:i.name,schema:i.schema,type:"table",rows:0,sql:"",engine:"",collation:""});let p=(await sql`
|
|
58
97
|
SELECT
|
|
59
98
|
cols.table_name AS "table",
|
|
60
99
|
cols.table_schema AS "schema",
|
|
@@ -96,6 +135,7 @@ END $$;
|
|
|
96
135
|
END AS "is_identity",
|
|
97
136
|
COALESCE(cols.collation_name, '') AS "collation",
|
|
98
137
|
cols.udt_name AS "udt_name",
|
|
138
|
+
cols.udt_schema AS "udt_schema",
|
|
99
139
|
CASE WHEN pt.typtype = 'd' THEN pt.typname ELSE cols.udt_name END AS "domain_type",
|
|
100
140
|
CASE WHEN cols.is_generated = 'NEVER' THEN false ELSE true END AS "is_generated"
|
|
101
141
|
FROM information_schema.columns cols
|
|
@@ -107,7 +147,7 @@ END $$;
|
|
|
107
147
|
LEFT JOIN pg_catalog.pg_type pt ON pt.oid = attr.atttypid
|
|
108
148
|
WHERE cols.table_schema NOT IN ('information_schema', 'pg_catalog')
|
|
109
149
|
ORDER BY cols.table_schema, cols.table_name, cols.ordinal_position
|
|
110
|
-
`.execute(this.kysely)).rows.map(
|
|
150
|
+
`.execute(this.kysely)).rows.map(i=>({table:i.table,schema:i.schema,name:i.name,type:i.type,nullable:i.nullable,default_value:i.default_value,is_primary_key:!1,ordinal_position:Number(i.ordinal_position),character_maximum_length:i.character_maximum_length??null,precision:i.precision??null,is_identity:i.is_identity,collation:i.collation,pg_type:i.domain_type??i.udt_name??void 0,udt_schema:i.udt_schema??void 0,is_generated:i.is_generated??!1}));for(let i of c.rows)p.push({table:i.table,schema:i.schema,name:i.name,type:i.type??"",nullable:i.nullable??!0,default_value:i.default_value??null,is_primary_key:!1,ordinal_position:Number(i.ordinal_position),character_maximum_length:null,precision:null,is_identity:!1,collation:"",pg_type:void 0,udt_schema:void 0,is_generated:!1});let f=(await sql`
|
|
111
151
|
SELECT
|
|
112
152
|
ns.nspname AS "schema",
|
|
113
153
|
cl.relname AS "table",
|
|
@@ -131,8 +171,13 @@ END $$;
|
|
|
131
171
|
AND ns.nspname NOT IN (
|
|
132
172
|
'information_schema'
|
|
133
173
|
, 'pg_catalog')
|
|
174
|
+
-- Skip FK rows on/to individual partitions (partition-level copies of an
|
|
175
|
+
-- inherited FK). Keeps the partitioned parent's FK; prevents a partition
|
|
176
|
+
-- surfacing as a spurious embed candidate.
|
|
177
|
+
AND NOT cl.relispartition
|
|
178
|
+
AND NOT ref_cl.relispartition
|
|
134
179
|
ORDER BY ns.nspname, cl.relname, con.conname, cols.ord
|
|
135
|
-
`.execute(this.kysely)).rows.map(
|
|
180
|
+
`.execute(this.kysely)).rows.map(i=>({table:i.table,column:i.column,schema:i.schema,ref_table:i.ref_table,ref_column:i.ref_column,foreign_key_name:i.foreign_key_name,fk_def:i.fk_def,on_update:"",on_delete:""})),h=(await sql`
|
|
136
181
|
SELECT
|
|
137
182
|
ns.nspname AS "schema",
|
|
138
183
|
cl.relname AS "table",
|
|
@@ -149,7 +194,7 @@ END $$;
|
|
|
149
194
|
'information_schema'
|
|
150
195
|
, 'pg_catalog')
|
|
151
196
|
GROUP BY ns.nspname, cl.relname, con.oid
|
|
152
|
-
`.execute(this.kysely)).rows.map(
|
|
197
|
+
`.execute(this.kysely)).rows.map(i=>({table:i.table,columns:i.columns,schema:i.schema,field_count:i.columns.length})),g=new Set(h.flatMap(i=>i.columns.map(w=>`${i.schema}.${i.table}.${w}`)));for(let i of p)i.is_primary_key=g.has(`${i.schema}.${i.table}.${i.name}`);let E=(await sql`
|
|
153
198
|
SELECT
|
|
154
199
|
tnsp.nspname AS "schema",
|
|
155
200
|
cl.relname AS "table",
|
|
@@ -170,7 +215,7 @@ END $$;
|
|
|
170
215
|
'information_schema'
|
|
171
216
|
, 'pg_catalog')
|
|
172
217
|
GROUP BY tnsp.nspname, cl.relname, ic.relname, idx.indisunique
|
|
173
|
-
`.execute(this.kysely)).rows.map(
|
|
218
|
+
`.execute(this.kysely)).rows.map(i=>({table:i.table,name:i.name,unique:i.unique,columns:i.columns,schema:i.schema})),J=(await sql`
|
|
174
219
|
SELECT
|
|
175
220
|
views.schemaname AS "schema",
|
|
176
221
|
views.viewname AS "name",
|
|
@@ -178,7 +223,7 @@ END $$;
|
|
|
178
223
|
FROM pg_views views
|
|
179
224
|
WHERE views.schemaname NOT IN ('information_schema', 'pg_catalog')
|
|
180
225
|
ORDER BY views.schemaname, views.viewname
|
|
181
|
-
`.execute(this.kysely)).rows.map(
|
|
226
|
+
`.execute(this.kysely)).rows.map(i=>({name:i.name,schema:i.schema,sql:i.sql??""}));for(let i of o.rows)J.push({name:i.name,schema:i.schema,sql:i.sql??""});let ae=(await sql`
|
|
182
227
|
SELECT
|
|
183
228
|
n.nspname AS "schema",
|
|
184
229
|
cl.relname AS "table",
|
|
@@ -190,7 +235,7 @@ END $$;
|
|
|
190
235
|
c.contype = 'c'
|
|
191
236
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
192
237
|
ORDER BY n.nspname, cl.relname
|
|
193
|
-
`.execute(this.kysely)).rows.map(
|
|
238
|
+
`.execute(this.kysely)).rows.map(i=>({schema:i.schema,table:i.table,expression:i.expression??""})),oe=(await sql`
|
|
194
239
|
SELECT
|
|
195
240
|
n.nspname AS "schema",
|
|
196
241
|
cl.relname AS "table",
|
|
@@ -205,7 +250,7 @@ END $$;
|
|
|
205
250
|
c.contype = 'u'
|
|
206
251
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
207
252
|
GROUP BY n.nspname, cl.relname, c.conname, c.oid
|
|
208
|
-
`.execute(this.kysely)).rows.map(
|
|
253
|
+
`.execute(this.kysely)).rows.map(i=>({schema:i.schema,table:i.table,name:i.name,columns:i.columns})),ie=(await sql`
|
|
209
254
|
SELECT
|
|
210
255
|
n.nspname AS "schema",
|
|
211
256
|
cl.relname AS "table",
|
|
@@ -220,7 +265,7 @@ END $$;
|
|
|
220
265
|
n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
221
266
|
AND cl.relkind IN ('r', 'v', 'm', 'f', 'p')
|
|
222
267
|
AND d.description IS NOT NULL
|
|
223
|
-
`.execute(this.kysely)).rows.map(
|
|
268
|
+
`.execute(this.kysely)).rows.map(i=>({schema:i.schema,table:i.table,column:i.column??void 0,text:i.text})),re=await sql`
|
|
224
269
|
SELECT
|
|
225
270
|
n.nspname AS "schema",
|
|
226
271
|
t.typname AS "type",
|
|
@@ -231,7 +276,7 @@ END $$;
|
|
|
231
276
|
JOIN pg_namespace n ON n.oid = t.typnamespace
|
|
232
277
|
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
233
278
|
GROUP BY n.nspname, t.typname
|
|
234
|
-
`.execute(this.kysely),
|
|
279
|
+
`.execute(this.kysely),ce=await sql`
|
|
235
280
|
SELECT
|
|
236
281
|
n.nspname AS "schema",
|
|
237
282
|
t.typname AS "type",
|
|
@@ -253,15 +298,56 @@ END $$;
|
|
|
253
298
|
AND NOT a.attisdropped
|
|
254
299
|
AND n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
255
300
|
GROUP BY n.nspname, t.typname
|
|
256
|
-
`.execute(this.kysely),
|
|
301
|
+
`.execute(this.kysely),le=[...re.rows.map(i=>({schema:i.schema,type:i.type,kind:"enum",values:i.values})),...ce.rows.map(i=>({schema:i.schema,type:i.type,kind:"composite",fields:i.fields}))],ue=(await sql`
|
|
302
|
+
SELECT
|
|
303
|
+
n.nspname AS "schema",
|
|
304
|
+
p.proname AS "name",
|
|
305
|
+
p.proargnames AS "arg_names_raw",
|
|
306
|
+
p.proargmodes::text[] AS "arg_modes_raw",
|
|
307
|
+
p.pronargdefaults AS "arg_defaults",
|
|
308
|
+
p.provariadic <> 0 AS "has_variadic",
|
|
309
|
+
p.provolatile AS "volatility",
|
|
310
|
+
p.proretset AS "return_is_setof",
|
|
311
|
+
p.prorows AS "return_rows",
|
|
312
|
+
format_type(p.prorettype, NULL) AS "return_type",
|
|
313
|
+
rt.typtype AS "return_typtype",
|
|
314
|
+
CASE WHEN rt.typtype = 'd' AND rt.typbasetype <> 0
|
|
315
|
+
THEN format_type(rt.typbasetype, NULL) END AS "return_base_type",
|
|
316
|
+
(SELECT array_agg(format_type(t, NULL) ORDER BY ord)
|
|
317
|
+
FROM unnest(p.proargtypes) WITH ORDINALITY AS at(t, ord)) AS "arg_types_raw"
|
|
318
|
+
FROM pg_proc p
|
|
319
|
+
JOIN pg_namespace n ON n.oid = p.pronamespace
|
|
320
|
+
LEFT JOIN pg_type rt ON rt.oid = p.prorettype
|
|
321
|
+
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
322
|
+
AND p.prokind = 'f'
|
|
323
|
+
ORDER BY n.nspname, p.proname
|
|
324
|
+
`.execute(this.kysely)).rows.map(i=>{let w=i.arg_names_raw??[],S=i.arg_modes_raw??null,ge=S&&S.length===w.length?w.filter((b,k)=>S[k]==="i"||S[k]==="b"||S[k]==="v"):w,de=!!S?.some(b=>b==="o"||b==="b"||b==="t");return {schema:i.schema,name:i.name,arg_names:ge,arg_types:i.arg_types_raw??[],arg_defaults:Number(i.arg_defaults??0),has_variadic:i.has_variadic===!0,volatility:i.volatility??"v",return_type:i.return_type??"",return_is_setof:i.return_is_setof===!0,return_rows:Number(i.return_rows??0),return_typtype:i.return_typtype??"",return_base_type:i.return_base_type??void 0,has_out_args:de}}),me=(await sql`
|
|
325
|
+
SELECT
|
|
326
|
+
c.relname AS "name",
|
|
327
|
+
n.nspname AS "schema",
|
|
328
|
+
p.relname AS "parent"
|
|
329
|
+
FROM pg_catalog.pg_inherits i
|
|
330
|
+
JOIN pg_catalog.pg_class c ON c.oid = i.inhrelid AND c.relispartition
|
|
331
|
+
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
|
|
332
|
+
JOIN pg_catalog.pg_class p ON p.oid = i.inhparent
|
|
333
|
+
WHERE n.nspname NOT IN ('information_schema', 'pg_catalog')
|
|
334
|
+
`.execute(this.kysely)).rows.map(i=>({name:i.name,schema:i.schema,parent:i.parent})),pe=(await sql`SELECT name FROM pg_catalog.pg_timezone_names`.execute(this.kysely)).rows.map(i=>i.name),fe=(await sql`SELECT current_database() AS "name"`.execute(this.kysely)).rows[0]?.name??"postgres",W=ee({tables:r,columns:p,indexes:E,foreign_keys:f,primary_keys:h,views:J,triggers:[],functions:ue,check_constraints:ae,unique_constraints:oe,comments:ie,custom_types:le,partitions:me,database_name:fe,version:"",default_schema:this.config?.translation?.schemas?.defaultSchema??"public",timezones:pe});return await this.writeCachedIntrospection(W,{useDriver:t}),W}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 e=await sql`
|
|
257
335
|
SELECT count(*) ::text as count FROM pg_class WHERE relrowsecurity = true
|
|
258
|
-
`.execute(this.kysely);if(!(Number(
|
|
336
|
+
`.execute(this.kysely);if(!(Number(e.rows[0]?.count??0)>0))return this.rlsState="inactive",false;this.rlsState="active",await sql.raw(K).execute(this.kysely);let s=await sql`
|
|
259
337
|
SELECT DISTINCT n.nspname FROM pg_class c
|
|
260
338
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
261
339
|
WHERE c.relrowsecurity = true
|
|
262
|
-
`.execute(this.kysely);for(let{nspname:a}of s.rows){let
|
|
340
|
+
`.execute(this.kysely);for(let{nspname:a}of s.rows){let o=te(a);await sql.raw(`GRANT USAGE ON SCHEMA ${o} TO ${R}`).execute(this.kysely),await sql.raw(`GRANT ALL ON ALL TABLES IN SCHEMA ${o} TO ${R}`).execute(this.kysely),await sql.raw(`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${o} TO ${R}`).execute(this.kysely),await sql.raw(`ALTER DEFAULT PRIVILEGES IN SCHEMA ${o} GRANT ALL ON TABLES TO ${R}`).execute(this.kysely),await sql.raw(`ALTER DEFAULT PRIVILEGES IN SCHEMA ${o} GRANT ALL ON SEQUENCES TO ${R}`).execute(this.kysely);}return true}async postgresTransactionActive(e){try{return await sql`SAVEPOINT __supalite_outer_tx_check`.execute(e),await sql`RELEASE SAVEPOINT __supalite_outer_tx_check`.execute(e),!0}catch{return false}}async applyJwtSessionContext(e,t,s){let a=t.auth,o=a?.role||"anon",c=String(a?.uid??""),r=a?.jwt;await sql`SELECT set_config('role', ${o}, true)`.execute(e),await sql`SELECT set_config('request.jwt.claim.sub', ${c}, true)`.execute(e),await sql`SELECT set_config('request.jwt.claim.role', ${o}, true)`.execute(e),s&&await sql.raw(`SET LOCAL ROLE ${te(o)}`).execute(e),r&&typeof r=="object"&&await sql`SELECT set_config('request.jwt.claims', ${JSON.stringify(r)}, true)`.execute(e);}async applyRpcRequestGucs(e,t){await sql`SELECT set_config('response.status', '', true)`.execute(e),await sql`SELECT set_config('response.headers', '', true)`.execute(e),await sql`SELECT set_config('request.method', ${t.method}, true)`.execute(e),await sql`SELECT set_config('request.path', ${t.path}, true)`.execute(e),await sql`SELECT set_config('request.headers', ${JSON.stringify(t.requestHeaders??{})}, true)`.execute(e);}async withContext(e,t,s){let a=s?.forceRollback===true;if(!a&&!e)return t(this.kysely);let o=e?await this.ensureRlsContext():false,r=e?.auth?.role||"anon",l=typeof r=="string"&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&!Fe.has(r),p=s?.rpc;if(p){let u=async f=>{e&&(o||l)&&await this.applyJwtSessionContext(f,e,l),await this.applyRpcRequestGucs(f,p),p.readOnly&&await sql`SET LOCAL transaction_read_only = on`.execute(f);};if(this.harnessHoldingOuterTx)return 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 u(this.kysely),t(this.kysely);try{return await this.kysely.transaction().execute(async f=>{await u(f);let d=await t(f);if(a)throw new N(d);return d})}catch(f){if(f instanceof N)return f.result;throw f}}if(!a&&!o&&!l)return t(this.kysely);if(!a&&l)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,e,true),t(this.kysely)):this.kysely.transaction().execute(async u=>(await this.applyJwtSessionContext(u,e,true),t(u)));if(!a&&o&&!l)return this.kysely.transaction().execute(async u=>(await this.applyJwtSessionContext(u,e,true),t(u)));try{return await this.kysely.transaction().execute(async u=>{e&&(o||l)&&await this.applyJwtSessionContext(u,e,l);let f=await t(u);if(a)throw new N(f);return f})}catch(u){if(u instanceof N)return u.result;throw u}}async onPostgrestAST(e){if(!e.from)return e;let t=e.schema??"public",s=e.from,a=await this.introspect({useCache:true});if(!a.tables.some(o=>o.name===s&&o.schema===t)&&!a.views.some(o=>o.name===s&&o.schema===t))throw new RelationNotFoundError(t,s);return e}async transaction(e,t){await this.exec("BEGIN");try{for(let s of e)await this.exec(s);await this.exec("COMMIT");}catch(s){throw await this.exec("ROLLBACK"),s}finally{t?.intent==="migration"&&await this.clearSchemaCache();}}get supportsRpc(){return true}async viewOptionsMetadata(e,t){let{rows:s}=await sql`
|
|
341
|
+
select is_insertable_into, is_updatable,
|
|
342
|
+
is_trigger_insertable_into, is_trigger_updatable, is_trigger_deletable
|
|
343
|
+
from information_schema.views
|
|
344
|
+
where table_schema = ${t} and table_name = ${e}
|
|
345
|
+
`.execute(this.kysely),a=s[0],o=r=>r==="YES",{rows:c}=await sql`
|
|
346
|
+
select table_schema, table_name from information_schema.view_table_usage
|
|
347
|
+
where view_schema = ${t} and view_name = ${e}
|
|
348
|
+
`.execute(this.kysely);return {canInsert:o(a?.is_insertable_into)||o(a?.is_trigger_insertable_into),canUpdate:o(a?.is_updatable)||o(a?.is_trigger_updatable),canDelete:o(a?.is_updatable)||o(a?.is_trigger_deletable),baseTables:c.map(r=>({schema:r.table_schema,name:r.table_name}))}}};var ne=(n,e=t=>t)=>{if(!n||n==="{}")return [];let t=n.slice(1,-1);if(t==="")return [];let s=[],a="",o=false,c=0;for(let r=0;r<t.length;r++){let l=t[r];l==='"'&&t[r-1]!=="\\"?(o=!o,a+=l):l==="{"&&!o?(c++,a+=l):l==="}"&&!o?(c--,a+=l):l===","&&!o&&c===0?(s.push(e(a)),a=""):a+=l;}return a!==""&&s.push(e(a)),s},Me=n=>n==="NULL"?null:n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\(.)/g,"$1"):n,He=n=>n==="NULL"?null:Number.parseInt(n,10);function se(n){return typeof n=="object"&&n!==null&&"text"in n&&"values"in n}function Ue(n,e){if(n==null)return n;switch(e){case 20:return typeof n=="bigint"?n:BigInt(n);case 22:return Array.isArray(n)?n:typeof n=="string"?n.split(" ").map(Number).filter(t=>!Number.isNaN(t)):n;case 1002:case 1009:case 1015:return typeof n=="string"?ne(n,Me):n;case 1005:case 1007:case 1016:return typeof n=="string"?ne(n,He):n;default:return n}}function U(n){return {async query(e,t){let s=se(e)?e.text:e,a=se(e)?e.values:t??[],o=await n.driver.query(s,[...a]);return {rows:o.rows.map(r=>Object.fromEntries(o.fields.map(l=>[l.name,Ue(r[l.name],l.dataTypeID)])))}}}}async function Je(){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})}}var We=["supabase_migrations"];function qe(n){let e=/^drop table (.+)$/.exec(n);if(e)return {table:e[1],reason:"drop table"};let t=/^drop column (.+) on (.+)$/.exec(n);if(t)return {table:t[2],reason:`drop column ${t[1]}`};let s=/^drop sequence (.+)$/.exec(n);return s?{table:s[1],reason:"drop sequence"}:{table:"unknown",reason:n}}var x=class{constructor(e,t){this.from=e;this.desiredSchema=t;}#e;async#t(e){if(this.#e)return this.#e;let t=new this.from.constructor;try{let s=C(F(this.desiredSchema));return s&&await t.exec(s),await t.exec(this.desiredSchema),this.#e=await e(U(t)),this.#e}finally{await t.close();}}async diff(){let{createPlan:e,extractCatalog:t}=await Je(),s=U(this.from),a=await this.#t(t),o=await t(s),c=await e(o,a,{filter:{not:{schema:We}}});if(!c)return {diff:"",plan:{steps:[],warnings:[],unsafe:false}};let r=c.plan.risk?.level==="data_loss"?c.plan.risk.statements.map(qe):[],l=Y(this.desiredSchema),p=c.plan.statements.filter(u=>!V(u,l));return {diff:p.join(`
|
|
263
349
|
|
|
264
|
-
`),plan:{steps:
|
|
265
|
-
`),a=
|
|
350
|
+
`),plan:{steps:p.map(u=>({sql:u})),warnings:r,unsafe:c.plan.risk?.level==="data_loss"}}}async migratePlan(e,t){if(e.steps.length===0)return;if(e.unsafe&&!t?.force)throw new DataLossError(e.warnings??[]);let s=e.steps.map(r=>r.sql).join(`
|
|
351
|
+
`),a=L(s),o=new Set(e.steps.flatMap(r=>[...F(r.sql)]).filter(r=>!a.has(r))),c=C(o);c&&await this.from.exec(c),await this.from.transaction(e.steps.map(r=>r.sql),{intent:"migration"});}async migrate(e){let t=await this.diff();return await this.migratePlan(t.plan,e),t}safeSortPlanSteps(e){return e}};var G=class extends I{driver;dialect="postgres";#e=false;constructor(e={}){let t=new PGlite({...e.pgliteOptions,dataDir:e.url??void 0,extensions:{...e.pgliteOptions?.extensions,isn:isn,ltree:ltree,file_fdw:file_fdw,pgcrypto:pgcrypto},parsers:{20:a=>{let o=Number(a);return Number.isSafeInteger(o)?o:BigInt(a)},114:a=>JSON.parse(a),3802:a=>JSON.parse(a),1700:a=>{let o=Number(a);return Number.isFinite(o)&&String(o)===a?o:a},1082:a=>a,1083:a=>a,1114:a=>a,1184:a=>a,1266:a=>a,...e.pgliteOptions?.parsers}}),{dialect:s}=new T(t);super(e),this.driver=t,this.kysely=new Kysely({dialect:s});}async exec(e,...t){try{if(t.length>0){let{rows:a}=await sql(e,...t??[]).execute(this.kysely);return {rows:a}}return {rows:(await this.driver.exec(e))[0].rows}}catch(s){throw console.error(s),new Error(`Failed to execute query: ${e}`)}}async close(){this.#e||(this.#e=true,await this.clearSchemaCache(),await this.kysely.destroy(),await this.driver.close());}createMigrator(e){let t=[this.config.baseSchema,e].filter(Boolean).join(`
|
|
266
352
|
|
|
267
|
-
`);return new
|
|
353
|
+
`);return new x(this,t)}};async function kt(n={}){return new G(n)}export{G as PgliteConnection,kt 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,
|
|
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-DJbw6dM8.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, y as FunctionInfo, H as HeadersResult, I as IConnectionConfig, z as IndexDiff, G as IndexInfo, J as InsertAST, K as IntrospectOptions, L as JoinDef, M as JoinMap, N as Meta, O as MigrationError, P as OrderEntry, Q as PlanResult, R as PlanStep, S as PlanStepType, U as PreferToken, X as PrimaryKeyInfo, Y as Qb, Z as QbDelete, _ as QbInsert, $ as QbSelect, a0 as QbUpdate, a1 as QueryAST, a2 as QueryParamsResult, a3 as RelationNotFoundError, a4 as RouteResult, a5 as RpcAST, a6 as RpcResult, a7 as SchemaDiffResult, a8 as SelectEntry, a9 as SelectResult, aa as TableDiff, ab as TableInfo, ac as TextSearchValue, ad as TransformsResult, ae as TranslatorConfig, af as TriggerInfo, ag as UniqueConstraintInfo, ah as UpdateAST, ai as UpsertAST, aj as UpsertResult, ak as ViewInfo, al as ViewOptionsMetadata, am as WhereValue, an as isRef } from './Connection-DJbw6dM8.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';
|
|
@@ -2333,6 +2333,7 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
|
|
|
2333
2333
|
} | null;
|
|
2334
2334
|
is_identity: boolean;
|
|
2335
2335
|
pg_type?: string | undefined;
|
|
2336
|
+
udt_schema?: string | undefined;
|
|
2336
2337
|
is_generated?: boolean | undefined;
|
|
2337
2338
|
}[];
|
|
2338
2339
|
indexes: {
|
|
@@ -2402,10 +2403,32 @@ declare function createServer(app: App, options?: ServerOptions): hono_hono_base
|
|
|
2402
2403
|
sql: string;
|
|
2403
2404
|
schema: string;
|
|
2404
2405
|
}[];
|
|
2406
|
+
functions?: {
|
|
2407
|
+
schema: string;
|
|
2408
|
+
name: string;
|
|
2409
|
+
arg_names: string[];
|
|
2410
|
+
arg_types: string[];
|
|
2411
|
+
arg_defaults: number;
|
|
2412
|
+
has_variadic: boolean;
|
|
2413
|
+
volatility: string;
|
|
2414
|
+
return_type: string;
|
|
2415
|
+
return_is_setof: boolean;
|
|
2416
|
+
return_rows?: number | undefined;
|
|
2417
|
+
return_typtype: string;
|
|
2418
|
+
return_base_type?: string | undefined;
|
|
2419
|
+
has_out_args: boolean;
|
|
2420
|
+
}[] | undefined;
|
|
2421
|
+
partitions?: {
|
|
2422
|
+
name: string;
|
|
2423
|
+
schema: string;
|
|
2424
|
+
parent: string;
|
|
2425
|
+
}[] | undefined;
|
|
2405
2426
|
database_name: string;
|
|
2406
2427
|
version: string;
|
|
2407
2428
|
ddl_dialect?: "postgres" | "sqlite" | undefined;
|
|
2408
2429
|
schema_separator?: string | undefined;
|
|
2430
|
+
default_schema?: string | undefined;
|
|
2431
|
+
timezones?: readonly string[] | undefined;
|
|
2409
2432
|
};
|
|
2410
2433
|
outputFormat: "json";
|
|
2411
2434
|
status: hono_utils_http_status.ContentfulStatusCode;
|