@redocly/openapi-docs 3.24.0-next.7 → 3.24.0-next.8
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/dist/{redocly-openapi-docs.min.AiChatProvider-gAsQoX30.js → redocly-openapi-docs.min.AiChatProvider-D8o94qvX.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-CnYt8ojK.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BLTom3F-.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-Bvkd__SH.js → redocly-openapi-docs.min.AiPanel-DloIzPy9.js} +184 -165
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-C6xTN7YJ.js → redocly-openapi-docs.min.SqliteDBStorage-CksbFVf-.js} +1 -1
- package/dist/{redocly-openapi-docs.min.ai-chat-mappers-3WKBUVis.js → redocly-openapi-docs.min.ai-chat-mappers-Dza6UMVG.js} +1 -1
- package/dist/{redocly-openapi-docs.min.external-resolver-4BBxclf5.js → redocly-openapi-docs.min.external-resolver-Cm8qMSH6.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-DswpnLh3.js → redocly-openapi-docs.min.index-CVScN5cj.js} +1251 -1229
- package/dist/{redocly-openapi-docs.min.index-C4nhoQHY.js → redocly-openapi-docs.min.index-DQKkHTdL.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-IvDdPWpQ.js → redocly-openapi-docs.min.index-DWPYSZX6.js} +1 -1
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-DxrZW_dt.js → redocly-openapi-docs.min.lint-B0W-5WwE.js} +2 -2
- package/dist/{redocly-openapi-docs.min.lint-graphql-BJaf-iso.js → redocly-openapi-docs.min.lint-graphql-y6yM0_Y_.js} +1 -1
- package/dist/{redocly-openapi-docs.min.respect-run-BxLhw6rg.js → redocly-openapi-docs.min.respect-run-C77Wul9G.js} +1 -1
- package/dist/{redocly-openapi-docs.min.standalone-DYNn4rpC.js → redocly-openapi-docs.min.standalone-BFWv5fnd.js} +3 -3
- package/dist/{redocly-openapi-docs.min.tauri-path-DkXXjCOS.js → redocly-openapi-docs.min.tauri-path-Dc9-nUUG.js} +1 -1
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-DA3WodeG.js → redocly-openapi-docs.min.useAiChatQueries-B9Y_hT0w.js} +35 -33
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aK as ve}from"./redocly-openapi-docs.min.index-
|
|
1
|
+
import{aK as ve}from"./redocly-openapi-docs.min.index-CVScN5cj.js";import{h as We}from"./redocly-openapi-docs.min.history.schema-DzAAX18S.js";import{s as Ve}from"./redocly-openapi-docs.min.step-context.schema-DEgzIgw0.js";import{b as z,c as G,a as H}from"./redocly-openapi-docs.min.ai-message-parts.schema-C7fjQhYX.js";import{c as f,T as m,i as h,g as W,s as n,o as Ue,n as Ye,f as Ge,h as He,j as Ze,k as Xe,m as et,p as tt,q as st,l as it,r as rt,t as nt,u as at,v as ot,w as lt,x as ct,y as ht,z as ut,e as qe,A as dt,b as ce,d as ft,a as mt,C as O,S as y,V as A,B as E,D as he,E as R,F as V,G as Z,H as ue,P as Ce,I as pt,J as de,K as fe,L as gt,W as Ne,M as Qe,N as yt,O as X,Q as Te}from"./redocly-openapi-docs.min.indexes-Bp4ld5gB.js";class bt{static[f]="ConsoleLogWriter";write(e){console.log(e)}}class wt{static[f]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new bt}logQuery(e,t){const s=t.map(r=>{try{return JSON.stringify(r)}catch{return String(r)}}),i=s.length?` -- params: [${s.join(", ")}]`:"";this.writer.write(`Query: ${e}${i}`)}}class St{static[f]="NoopLogger";logQuery(){}}const Le=Symbol.for("drizzle:PgInlineForeignKeys"),xe=Symbol.for("drizzle:EnableRLS");class $t extends m{static[f]="PgTable";static Symbol=Object.assign({},m.Symbol,{InlineForeignKeys:Le,EnableRLS:xe});[Le]=[];[xe]=!1;[m.Symbol.ExtraConfigBuilder]=void 0;[m.Symbol.ExtraConfigColumns]={}}class vt{static[f]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new qt(e,this.columns,this.name)}}class qt{constructor(e,t,s){this.table=e,this.columns=t,this.name=s}static[f]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[$t.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}class Oe{constructor(e,t,s){this.sourceTable=e,this.referencedTable=t,this.relationName=s,this.referencedTableName=t[m.Symbol.Name]}static[f]="Relation";referencedTableName;fieldName}class Be{constructor(e,t){this.table=e,this.config=t}static[f]="Relations"}class D extends Oe{constructor(e,t,s,i){super(e,t,s?.relationName),this.config=s,this.isNullable=i}static[f]="One";withFieldName(e){const t=new D(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class ne extends Oe{constructor(e,t,s){super(e,t,s?.relationName),this.config=s}static[f]="Many";withFieldName(e){const t=new ne(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function Ct(){return{and:ce,between:dt,eq:qe,exists:ut,gt:ht,gte:ct,ilike:lt,inArray:ot,isNull:at,isNotNull:nt,like:rt,lt:it,lte:st,ne:tt,not:et,notBetween:Xe,notExists:Ze,notLike:He,notIlike:Ge,notInArray:Ye,or:Ue,sql:n}}function Nt(){return{sql:n,asc:mt,desc:ft}}function Qt(l,e){Object.keys(l).length===1&&"default"in l&&!h(l.default,m)&&(l=l.default);const t={},s={},i={};for(const[r,a]of Object.entries(l))if(h(a,m)){const o=W(a),c=s[o];t[o]=r,i[r]={tsName:r,dbName:a[m.Symbol.Name],schema:a[m.Symbol.Schema],columns:a[m.Symbol.Columns],relations:c?.relations??{},primaryKey:c?.primaryKey??[]};for(const d of Object.values(a[m.Symbol.Columns]))d.primary&&i[r].primaryKey.push(d);const u=a[m.Symbol.ExtraConfigBuilder]?.(a[m.Symbol.ExtraConfigColumns]);if(u)for(const d of Object.values(u))h(d,vt)&&i[r].primaryKey.push(...d.columns)}else if(h(a,Be)){const o=W(a.table),c=t[o],u=a.config(e(a.table));let d;for(const[g,N]of Object.entries(u))if(c){const Q=i[c];Q.relations[g]=N}else o in s||(s[o]={relations:{},primaryKey:d}),s[o].relations[g]=N}return{tables:i,tableNamesMap:t}}function me(l,e){return new Be(l,t=>Object.fromEntries(Object.entries(e(t)).map(([s,i])=>[s,i.withFieldName(s)])))}function Tt(l){return function(e,t){return new D(l,e,t,t?.fields.reduce((s,i)=>s&&i.notNull,!0)??!1)}}function Lt(l){return function(e,t){return new ne(l,e,t)}}function xt(l,e,t){if(h(t,D)&&t.config)return{fields:t.config.fields,references:t.config.references};const s=e[W(t.referencedTable)];if(!s)throw new Error(`Table "${t.referencedTable[m.Symbol.Name]}" not found in schema`);const i=l[s];if(!i)throw new Error(`Table "${s}" not found in schema`);const r=t.sourceTable,a=e[W(r)];if(!a)throw new Error(`Table "${r[m.Symbol.Name]}" not found in schema`);const o=[];for(const c of Object.values(i.relations))(t.relationName&&t!==c&&c.relationName===t.relationName||!t.relationName&&c.referencedTable===t.sourceTable)&&o.push(c);if(o.length>1)throw t.relationName?new Error(`There are multiple relations with name "${t.relationName}" in table "${s}"`):new Error(`There are multiple relations between "${s}" and "${t.sourceTable[m.Symbol.Name]}". Please specify relation name`);if(o[0]&&h(o[0],D)&&o[0].config)return{fields:o[0].config.references,references:o[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${t.fieldName}"`)}function Ot(l){return{one:Tt(l),many:Lt(l)}}function pe(l,e,t,s,i=r=>r){const r={};for(const[a,o]of s.entries())if(o.isJson){const c=e.relations[o.tsKey],u=t[a],d=typeof u=="string"?JSON.parse(u):u;r[o.tsKey]=h(c,D)?d&&pe(l,l[o.relationTableTsKey],d,o.selection,i):d.map(g=>pe(l,l[o.relationTableTsKey],g,o.selection,i))}else{const c=i(t[a]),u=o.field;let d;h(u,O)?d=u:h(u,y)?d=u.decoder:d=u.sql.decoder,r[o.tsKey]=c===null?null:d.mapFromDriverValue(c)}return r}class ee{constructor(e){this.table=e}static[f]="ColumnAliasProxyHandler";get(e,t){return t==="table"?this.table:e[t]}}class ge{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[f]="TableAliasProxyHandler";get(e,t){if(t===m.Symbol.IsAlias)return!0;if(t===m.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===m.Symbol.OriginalName)return this.alias;if(t===A)return{...e[A],name:this.alias,isAlias:!0};if(t===m.Symbol.Columns){const i=e[m.Symbol.Columns];if(!i)return i;const r={};return Object.keys(i).map(a=>{r[a]=new Proxy(i[a],new ee(new Proxy(e,this)))}),r}const s=e[t];return h(s,O)?new Proxy(s,new ee(new Proxy(e,this))):s}}function ye(l,e){return new Proxy(l,new ge(e,!1))}function P(l,e){return new Proxy(l,new ee(new Proxy(l.table,new ge(e,!1))))}function je(l,e){return new y.Aliased(te(l.sql,e),l.fieldAlias)}function te(l,e){return n.join(l.queryChunks.map(t=>h(t,O)?P(t,e):h(t,y)?te(t,e):h(t,y.Aliased)?je(t,e):t))}class T{static[f]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if(t==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===A)return{...e[A],selectedFields:new Proxy(e[A].selectedFields,this)};if(typeof t=="symbol")return e[t];const s=(h(e,E)?e._.selectedFields:h(e,he)?e[A].selectedFields:e)[t];if(h(s,y.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!s.isSelectionField)return s.sql;const i=s.clone();return i.isSelectionField=!0,i}if(h(s,y)){if(this.config.sqlBehavior==="sql")return s;throw new Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return h(s,O)?this.config.alias?new Proxy(s,new ee(new Proxy(s.table,new ge(this.config.alias,this.config.replaceOriginalName??!1)))):s:typeof s!="object"||s===null?s:new Proxy(s,new T(this.config))}}class K{static[f]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}function k(l){return h(l,R)?[`${l[m.Symbol.BaseName]}`]:h(l,E)?l._.usedTables??[]:h(l,y)?l.usedTables??[]:[]}class Ae extends K{constructor(e,t,s,i){super(),this.table=e,this.session=t,this.dialect=s,this.config={table:e,withList:i}}static[f]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){const t=e[0](new Proxy(this.config.table[m.Symbol.Columns],new T({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),s=Array.isArray(t)?t:[t];this.config.orderBy=s}else{const t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[R.Symbol.Columns]){return this.config.returning=V(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:k(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function Bt(l){return(l.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function jt(l){return(l.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,s)=>{const i=s===0?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`;return e+i},"")}function At(l){return l}class Rt{static[f]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Bt:e==="camelCase"?jt:At}getColumnCasing(e){if(!e.keyAsName)return e.name;const t=e.table[m.Symbol.Schema]??"public",s=e.table[m.Symbol.OriginalName],i=`${t}.${s}.${e.name}`;return this.cache[i]||this.cacheTable(e.table),this.cache[i]}cacheTable(e){const t=e[m.Symbol.Schema]??"public",s=e[m.Symbol.OriginalName],i=`${t}.${s}`;if(!this.cachedTables[i]){for(const r of Object.values(e[m.Symbol.Columns])){const a=`${i}.${r.name}`;this.cache[a]=this.convert(r.name)}this.cachedTables[i]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class be extends Error{static[f]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class I extends Error{constructor(e,t,s){super(`Failed query: ${e}
|
|
2
2
|
params: ${t}`),this.query=e,this.params=t,this.cause=s,Error.captureStackTrace(this,I),s&&(this.cause=s)}}class Mt extends be{static[f]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class we extends he{static[f]="SQLiteViewBase"}class se{static[f]="SQLiteDialect";casing;constructor(e){this.casing=new Rt(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;const t=[n`with `];for(const[s,i]of e.entries())t.push(n`${n.identifier(i._.alias)} as (${i._.sql})`),s<e.length-1&&t.push(n`, `);return t.push(n` `),n.join(t)}buildDeleteQuery({table:e,where:t,returning:s,withList:i,limit:r,orderBy:a}){const o=this.buildWithCTE(i),c=s?n` returning ${this.buildSelection(s,{isSingleTable:!0})}`:void 0,u=t?n` where ${t}`:void 0,d=this.buildOrderBy(a),g=this.buildLimit(r);return n`${o}delete from ${e}${u}${c}${d}${g}`}buildUpdateSet(e,t){const s=e[m.Symbol.Columns],i=Object.keys(s).filter(a=>t[a]!==void 0||s[a]?.onUpdateFn!==void 0),r=i.length;return n.join(i.flatMap((a,o)=>{const c=s[a],u=c.onUpdateFn?.(),d=t[a]??(h(u,y)?u:n.param(u,c)),g=n`${n.identifier(this.casing.getColumnCasing(c))} = ${d}`;return o<r-1?[g,n.raw(", ")]:[g]}))}buildUpdateQuery({table:e,set:t,where:s,returning:i,withList:r,joins:a,from:o,limit:c,orderBy:u}){const d=this.buildWithCTE(r),g=this.buildUpdateSet(e,t),N=o&&n.join([n.raw(" from "),this.buildFromTable(o)]),Q=this.buildJoins(a),q=i?n` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,w=s?n` where ${s}`:void 0,$=this.buildOrderBy(u),S=this.buildLimit(c);return n`${d}update ${e} set ${g}${N}${Q}${w}${q}${$}${S}`}buildSelection(e,{isSingleTable:t=!1}={}){const s=e.length,i=e.flatMap(({field:r},a)=>{const o=[];if(h(r,y.Aliased)&&r.isSelectionField)o.push(n.identifier(r.fieldAlias));else if(h(r,y.Aliased)||h(r,y)){const c=h(r,y.Aliased)?r.sql:r;t?o.push(new y(c.queryChunks.map(u=>h(u,O)?n.identifier(this.casing.getColumnCasing(u)):u))):o.push(c),h(r,y.Aliased)&&o.push(n` as ${n.identifier(r.fieldAlias)}`)}else if(h(r,O)){const c=r.table[m.Symbol.Name];r.columnType==="SQLiteNumericBigInt"?t?o.push(n`cast(${n.identifier(this.casing.getColumnCasing(r))} as text)`):o.push(n`cast(${n.identifier(c)}.${n.identifier(this.casing.getColumnCasing(r))} as text)`):t?o.push(n.identifier(this.casing.getColumnCasing(r))):o.push(n`${n.identifier(c)}.${n.identifier(this.casing.getColumnCasing(r))}`)}else if(h(r,E)){const c=Object.entries(r._.selectedFields);if(c.length===1){const u=c[0][1],d=h(u,y)?u.decoder:h(u,O)?{mapFromDriverValue:g=>u.mapFromDriverValue(g)}:u.sql.decoder;d&&(r._.sql.decoder=d)}o.push(r)}return a<s-1&&o.push(n`, `),o});return n.join(i)}buildJoins(e){if(!e||e.length===0)return;const t=[];if(e)for(const[s,i]of e.entries()){s===0&&t.push(n` `);const r=i.table,a=i.on?n` on ${i.on}`:void 0;if(h(r,R)){const o=r[R.Symbol.Name],c=r[R.Symbol.Schema],u=r[R.Symbol.OriginalName],d=o===u?void 0:i.alias;t.push(n`${n.raw(i.joinType)} join ${c?n`${n.identifier(c)}.`:void 0}${n.identifier(u)}${d&&n` ${n.identifier(d)}`}${a}`)}else t.push(n`${n.raw(i.joinType)} join ${r}${a}`);s<e.length-1&&t.push(n` `)}return n.join(t)}buildLimit(e){return typeof e=="object"||typeof e=="number"&&e>=0?n` limit ${e}`:void 0}buildOrderBy(e){const t=[];if(e)for(const[s,i]of e.entries())t.push(i),s<e.length-1&&t.push(n`, `);return t.length>0?n` order by ${n.join(t)}`:void 0}buildFromTable(e){return h(e,m)&&e[m.Symbol.IsAlias]?n`${n`${n.identifier(e[m.Symbol.Schema]??"")}.`.if(e[m.Symbol.Schema])}${n.identifier(e[m.Symbol.OriginalName])} ${n.identifier(e[m.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:t,fieldsFlat:s,where:i,having:r,table:a,joins:o,orderBy:c,groupBy:u,limit:d,offset:g,distinct:N,setOperators:Q}){const q=s??V(t);for(const B of q)if(h(B.field,O)&&Z(B.field.table)!==(h(a,E)?a._.alias:h(a,we)?a[A].name:h(a,y)?void 0:Z(a))&&!(j=>o?.some(({alias:Y})=>Y===(j[m.Symbol.IsAlias]?Z(j):j[m.Symbol.BaseName])))(B.field.table)){const j=Z(B.field.table);throw new Error(`Your "${B.path.join("->")}" field references a column "${j}"."${B.field.name}", but the table "${j}" is not part of the query! Did you forget to join it?`)}const w=!o||o.length===0,$=this.buildWithCTE(e),S=N?n` distinct`:void 0,L=this.buildSelection(q,{isSingleTable:w}),v=this.buildFromTable(a),C=this.buildJoins(o),M=i?n` where ${i}`:void 0,x=r?n` having ${r}`:void 0,p=[];if(u)for(const[B,j]of u.entries())p.push(j),B<u.length-1&&p.push(n`, `);const b=p.length>0?n` group by ${n.join(p)}`:void 0,_=this.buildOrderBy(c),U=this.buildLimit(d),le=g?n` offset ${g}`:void 0,J=n`${$}select${S} ${L} from ${v}${C}${M}${b}${x}${_}${U}${le}`;return Q.length>0?this.buildSetOperations(J,Q):J}buildSetOperations(e,t){const[s,...i]=t;if(!s)throw new Error("Cannot pass undefined values to any set operator");return i.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:s}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:s}),i)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:s,rightSelect:i,limit:r,orderBy:a,offset:o}}){const c=n`${e.getSQL()} `,u=n`${i.getSQL()}`;let d;if(a&&a.length>0){const q=[];for(const w of a)if(h(w,ue))q.push(n.identifier(w.name));else if(h(w,y)){for(let $=0;$<w.queryChunks.length;$++){const S=w.queryChunks[$];h(S,ue)&&(w.queryChunks[$]=n.identifier(this.casing.getColumnCasing(S)))}q.push(n`${w}`)}else q.push(n`${w}`);d=n` order by ${n.join(q,n`, `)}`}const g=typeof r=="object"||typeof r=="number"&&r>=0?n` limit ${r}`:void 0,N=n.raw(`${t} ${s?"all ":""}`),Q=o?n` offset ${o}`:void 0;return n`${c}${N}${u}${d}${g}${Q}`}buildInsertQuery({table:e,values:t,onConflict:s,returning:i,withList:r,select:a}){const o=[],c=e[m.Symbol.Columns],u=Object.entries(c).filter(([w,$])=>!$.shouldDisableInsert()),d=u.map(([,w])=>n.identifier(this.casing.getColumnCasing(w)));if(a){const w=t;h(w,y)?o.push(w):o.push(w.getSQL())}else{const w=t;o.push(n.raw("values "));for(const[$,S]of w.entries()){const L=[];for(const[v,C]of u){const M=S[v];if(M===void 0||h(M,Ce)&&M.value===void 0){let x;if(C.default!==null&&C.default!==void 0)x=h(C.default,y)?C.default:n.param(C.default,C);else if(C.defaultFn!==void 0){const p=C.defaultFn();x=h(p,y)?p:n.param(p,C)}else if(!C.default&&C.onUpdateFn!==void 0){const p=C.onUpdateFn();x=h(p,y)?p:n.param(p,C)}else x=n`null`;L.push(x)}else L.push(M)}o.push(L),$<w.length-1&&o.push(n`, `)}}const g=this.buildWithCTE(r),N=n.join(o),Q=i?n` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,q=s?.length?n.join(s):void 0;return n`${g}insert into ${e} ${d} ${N}${q}${Q}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:s,table:i,tableConfig:r,queryConfig:a,tableAlias:o,nestedQueryRelation:c,joinOn:u}){let d=[],g,N,Q=[],q;const w=[];if(a===!0)d=Object.entries(r.columns).map(([S,L])=>({dbKey:L.name,tsKey:S,field:P(L,o),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{const S=Object.fromEntries(Object.entries(r.columns).map(([p,b])=>[p,P(b,o)]));if(a.where){const p=typeof a.where=="function"?a.where(S,Ct()):a.where;q=p&&te(p,o)}const L=[];let v=[];if(a.columns){let p=!1;for(const[b,_]of Object.entries(a.columns))_!==void 0&&b in r.columns&&(!p&&_===!0&&(p=!0),v.push(b));v.length>0&&(v=p?v.filter(b=>a.columns?.[b]===!0):Object.keys(r.columns).filter(b=>!v.includes(b)))}else v=Object.keys(r.columns);for(const p of v){const b=r.columns[p];L.push({tsKey:p,value:b})}let C=[];a.with&&(C=Object.entries(a.with).filter(p=>!!p[1]).map(([p,b])=>({tsKey:p,queryConfig:b,relation:r.relations[p]})));let M;if(a.extras){M=typeof a.extras=="function"?a.extras(S,{sql:n}):a.extras;for(const[p,b]of Object.entries(M))L.push({tsKey:p,value:je(b,o)})}for(const{tsKey:p,value:b}of L)d.push({dbKey:h(b,y.Aliased)?b.fieldAlias:r.columns[p].name,tsKey:p,field:h(b,O)?P(b,o):b,relationTableTsKey:void 0,isJson:!1,selection:[]});let x=typeof a.orderBy=="function"?a.orderBy(S,Nt()):a.orderBy??[];Array.isArray(x)||(x=[x]),Q=x.map(p=>h(p,O)?P(p,o):te(p,o)),g=a.limit,N=a.offset;for(const{tsKey:p,queryConfig:b,relation:_}of C){const U=xt(t,s,_),le=W(_.referencedTable),J=s[le],B=`${o}_${p}`,j=ce(...U.fields.map((Je,ze)=>qe(P(U.references[ze],B),P(Je,o)))),Y=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:s,table:e[J],tableConfig:t[J],queryConfig:h(_,D)?b===!0?{limit:1}:{...b,limit:1}:b,tableAlias:B,joinOn:j,nestedQueryRelation:_}),De=n`(${Y.sql})`.as(p);d.push({dbKey:p,tsKey:p,field:De,relationTableTsKey:J,isJson:!0,selection:Y.selection})}}if(d.length===0)throw new be({message:`No fields selected for table "${r.tsName}" ("${o}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let $;if(q=ce(u,q),c){let S=n`json_array(${n.join(d.map(({field:v})=>h(v,ue)?n.identifier(this.casing.getColumnCasing(v)):h(v,y.Aliased)?v.sql:v),n`, `)})`;h(c,ne)&&(S=n`coalesce(json_group_array(${S}), json_array())`);const L=[{dbKey:"data",tsKey:"data",field:S.as("data"),isJson:!0,relationTableTsKey:r.tsName,selection:d}];g!==void 0||N!==void 0||Q.length>0?($=this.buildSelectQuery({table:ye(i,o),fields:{},fieldsFlat:[{path:[],field:n.raw("*")}],where:q,limit:g,offset:N,orderBy:Q,setOperators:[]}),q=void 0,g=void 0,N=void 0,Q=void 0):$=ye(i,o),$=this.buildSelectQuery({table:h($,R)?$:new E($,{},o),fields:{},fieldsFlat:L.map(({field:v})=>({path:[],field:h(v,O)?P(v,o):v})),joins:w,where:q,limit:g,offset:N,orderBy:Q,setOperators:[]})}else $=this.buildSelectQuery({table:ye(i,o),fields:{},fieldsFlat:d.map(({field:S})=>({path:[],field:h(S,O)?P(S,o):S})),joins:w,where:q,limit:g,offset:N,orderBy:Q,setOperators:[]});return{tableTsKey:r.tsName,sql:$,selection:d}}}class _t extends se{static[f]="SQLiteSyncDialect";migrate(e,t,s){const i=s===void 0||typeof s=="string"?"__drizzle_migrations":s.migrationsTable??"__drizzle_migrations",r=n`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS ${n.identifier(i)} (
|
|
4
4
|
id SERIAL PRIMARY KEY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as i}from"./redocly-openapi-docs.min.standalone-
|
|
1
|
+
import{V as i}from"./redocly-openapi-docs.min.standalone-BFWv5fnd.js";import{R as u,U as n}from"./redocly-openapi-docs.min.index-CVScN5cj.js";function m(){return`aichat_${i()}`}function l(){return`aimsg_${i()}`}function c(){return`aimpt_${i()}`}function f(t){return{id:t.id,title:t.title??void 0,modelConfig:t.modelConfig,messages:t.messages.map(p),createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt)}}function p(t){return{id:t.uiId,role:t.role,metadata:t.metadata,parts:t.parts.map(g)}}function g(t){return t.self}function I(t){const a=t.id;return{id:a,title:t.title,modelConfig:t.modelConfig,messages:t.messages.map((e,r)=>d(a,r,e))}}function d(t,a,e,r=l()){return{id:r,uiId:e.id,role:e.role,metadata:e.metadata,aiChatId:t,indexWithinInsertBatch:a,parts:e.parts.map((o,s)=>C(r,s,o))}}function C(t,a,e){return{id:c(),text:e.type==="text"?e.text:null,index:a,self:e,aiMessageId:t}}function h(t){return{id:t.id,title:t.title,modelConfig:v(t.model),messages:t.messages.map(x)}}function v(t){switch(t.provider){case n.OPENAI:case n.ANTHROPIC:case n.GEMINI:return{provider:t.provider,modelId:t.modelId};case u:return{provider:t.provider,baseUrl:t.baseUrl};default:throw new Error("Cannot create model config")}}function x(t){return{...t,parts:t.parts.filter(a=>a.type!=="file")}}export{I as a,h as b,f as c,d,m as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{aL as s,a7 as n,aM as i,aN as c,aO as l}from"./redocly-openapi-docs.min.index-
|
|
1
|
+
import{aL as s,a7 as n,aM as i,aN as c,aO as l}from"./redocly-openapi-docs.min.index-CVScN5cj.js";import{aL as f,as as o,bo as d,b6 as r}from"./redocly-openapi-docs.min.standalone-BFWv5fnd.js";class w extends f{constructor(){super()}resolveExternalRef(e,a){return s(a)?a:e&&s(e)?new URL(a,e).href:e?o.resolve(o.dirname(e),a):a}async loadExternalRef(e){if(s(e)){const{body:a,mimeType:t}=await d(e,{...this.config.http,customFetch:n});return new r(e,a,t)}else{if(!await i(e))throw new Error(`File not found at ${e}.`);try{throw await c(e),new Error(`Expected a file but received a folder at ${e}.`)}catch(t){if(t instanceof Error&&t.message.includes("Expected a file but received a folder"))throw t}const a=await l(e);return new r(e,a.replace(/\r\n/g,`
|
|
2
2
|
`))}}}export{w as ExternalResolver};
|