@redocly/openapi-docs 3.24.0-next.8 → 3.24.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/dist/{redocly-openapi-docs.min.AiChatProvider-D8o94qvX.js → redocly-openapi-docs.min.AiChatProvider-CIrPFbvX.js} +3 -3
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-BLTom3F-.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-eAy3scC4.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-DloIzPy9.js → redocly-openapi-docs.min.AiPanel-C6CGDyzy.js} +116 -116
- package/dist/redocly-openapi-docs.min.FileWatcher-dIKl80Ec.js +1 -0
- package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
- package/dist/redocly-openapi-docs.min.SemanticSearchService-D4V6-td8.js +1 -0
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-CksbFVf-.js → redocly-openapi-docs.min.SqliteDBStorage-D9-Rb-N7.js} +1 -1
- package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CHW6hO3z.js +1 -0
- package/dist/redocly-openapi-docs.min.TauriRootStorage-CHiKNUn2.js +1 -0
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-C19k85fj.js +1 -0
- package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
- package/dist/redocly-openapi-docs.min.external-resolver-BH7DBWU-.js +2 -0
- package/dist/redocly-openapi-docs.min.index-BQp5pipW.js +1 -0
- package/dist/redocly-openapi-docs.min.index-BuFUmOUm.js +7730 -0
- package/dist/redocly-openapi-docs.min.index-DLlCa16R.js +1 -0
- package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
- package/dist/redocly-openapi-docs.min.index-dirYvuKs.js +1 -0
- package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/redocly-openapi-docs.min.lint-Xu623Q1T.js +181 -0
- package/dist/{redocly-openapi-docs.min.lint-graphql-y6yM0_Y_.js → redocly-openapi-docs.min.lint-graphql-D-Nm5P1M.js} +1 -1
- package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
- package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
- package/dist/{redocly-openapi-docs.min.respect-run-C77Wul9G.js → redocly-openapi-docs.min.respect-run-CWNqYysq.js} +23 -23
- package/dist/redocly-openapi-docs.min.standalone-CRo0Sa5b.js +11995 -0
- package/dist/redocly-openapi-docs.min.tauri-path-BUSVirPk.js +1 -0
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-B9Y_hT0w.js → redocly-openapi-docs.min.useAiChatQueries-CXyQzME7.js} +80 -80
- package/lib/components/Callbacks/CallbackOperation.js +1 -1
- package/lib/components/Content/useAutoScroll.js +1 -1
- package/lib/components/ContentItem/useIsExpanded.js +1 -1
- package/lib/components/ContentItems/ContentItems.js +1 -1
- package/lib/components/ContentItems/VirtualList.js +1 -1
- package/lib/components/ContentItems/useScrollOnRender.js +1 -1
- package/lib/components/Responses/OperationResponseList.js +1 -1
- package/lib/components/Schema/Schema.js +1 -1
- package/lib/components/Schema/SubSchema.js +1 -1
- package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
- package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
- package/lib/components/TagItem/OperationsNavigation.js +1 -1
- package/lib/components/TagItem/TagItem.js +1 -1
- package/lib/components/common/LinkToField.js +1 -1
- package/lib/components/common/linkify.js +1 -1
- package/lib/hooks/useRouter.js +1 -1
- package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
- package/lib/utils/path.d.ts +1 -1
- package/package.json +12 -12
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-Dza6UMVG.js +0 -1
- package/dist/redocly-openapi-docs.min.external-resolver-Cm8qMSH6.js +0 -2
- package/dist/redocly-openapi-docs.min.index-CVScN5cj.js +0 -7586
- package/dist/redocly-openapi-docs.min.index-DQKkHTdL.js +0 -1
- package/dist/redocly-openapi-docs.min.index-DWPYSZX6.js +0 -1
- package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
- package/dist/redocly-openapi-docs.min.lint-B0W-5WwE.js +0 -181
- package/dist/redocly-openapi-docs.min.standalone-BFWv5fnd.js +0 -12112
- package/dist/redocly-openapi-docs.min.tauri-path-Dc9-nUUG.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as p,B as w,P as v,C as f}from"./redocly-openapi-docs.min.index-BuFUmOUm.js";import{g as u}from"./redocly-openapi-docs.min.SemanticSearchService-D4V6-td8.js";var E;(function(r){r.WINDOW_RESIZED="tauri://resize",r.WINDOW_MOVED="tauri://move",r.WINDOW_CLOSE_REQUESTED="tauri://close-requested",r.WINDOW_DESTROYED="tauri://destroyed",r.WINDOW_FOCUS="tauri://focus",r.WINDOW_BLUR="tauri://blur",r.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",r.WINDOW_THEME_CHANGED="tauri://theme-changed",r.WINDOW_CREATED="tauri://window-created",r.WEBVIEW_CREATED="tauri://webview-created",r.DRAG_ENTER="tauri://drag-enter",r.DRAG_OVER="tauri://drag-over",r.DRAG_DROP="tauri://drag-drop",r.DRAG_LEAVE="tauri://drag-leave"})(E||(E={}));async function y(r,t){await p("plugin:event|unlisten",{event:r,eventId:t})}async function x(r,t,s){var e;const i=(e=void 0)!==null&&e!==void 0?e:{kind:"Any"};return p("plugin:event|listen",{event:r,target:i,handler:w(t)}).then(a=>async()=>y(r,a))}class _{constructor(t,s,e,i){this.storage=t,this.state=s,this.projectDir=e,this.aiEnabled=i}storage;state;projectDir;aiEnabled;watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}indexApis(t){!this.aiEnabled||t.length===0||u().indexApis(t).catch(s=>console.error("Semantic index (apis):",s))}indexCollections(t){!this.aiEnabled||t.length===0||u().indexCollections(t).catch(s=>console.error("Semantic index (collections):",s))}removeApis(t){if(!this.aiEnabled||t.length===0)return;const s=u();Promise.all(t.map(e=>s.removeApi(e))).catch(e=>console.error("Semantic remove (apis):",e))}removeCollections(t){if(!this.aiEnabled||t.length===0)return;const s=u();Promise.all(t.map(e=>s.removeCollection(e))).catch(e=>console.error("Semantic remove (collections):",e))}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await x("fs-watch-event",async t=>{const s=t.payload;try{await this.handleEvent(s)}catch(e){console.error("Error handling file change:",e)}}),await p("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(t){throw console.error("Failed to start file watcher:",t),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),t}}async stop(){if(this.watchPath)try{await p("fs_unwatch",{path:this.watchPath})}catch(t){console.error("Error stopping file watcher:",t)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(t){const{changeType:s,paths:e,pathTypes:i,type:a}=t;if(await this.isProjectFolderRemoved(e,s)){await this.handleProjectFolderRemoval();return}const o=this.filterSpecFiles(e,i);if(o.paths.length===0)return;const n=await this.toFileEntries(o.paths,o.pathTypes);switch(s){case"changed":(a.includes("Data")||a.includes("Name"))&&await this.handleModify(n);break;case"added":await this.handleCreate(n);break;case"deleted":await this.handleDelete(n);break;case"renamed":await this.handleRename(n);break;default:console.log("Unhandled change type:",s)}}filterSpecFiles(t,s){const e=[],i=[];for(let a=0;a<t.length;a++){const o=t[a],n=o.split(".").pop()?.toLowerCase();n&&["yaml","yml","json"].includes(n)&&(e.push(o),i.push(s[a]||"unknown"))}return{paths:e,pathTypes:i}}async toFileEntries(t,s){return Promise.all(t.map(async(e,i)=>({relative_path:await v.relative(this.projectDir,e),absolute_path:e,type:s[i]||"unknown"})))}consolidateFileEntries(t){const s=[],e=new Set;for(const i of t)e.has(i.relative_path)||(e.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||s.push(i));return s}async handleModify(t){const s=!this.storage.isWatchExcluded("replay-environments.yaml")&&t.some(m=>m.relative_path==="replay-environments.yaml"),e=t.filter(m=>m.relative_path!=="replay-environments.yaml"),{newApiFiles:i,existingApiFiles:a}=this.categorizeApisFromFiles(e),{newCollectionFiles:o,existingCollectionFiles:n}=this.categorizeCollectionsFromFiles(e),h=await this.findApisToReload(t),g=await this.findCollectionsToReload(t),c=[...i,...o];c.length>0&&await this.handleCreate(c),s&&await this.reloadEnvironments();const d=this.consolidateFileEntries([...a,...h]),l=this.consolidateFileEntries([...n,...g]);await this.reloadApis(d),await this.reloadCollections(l)}async handleCreate(t){const s=t.filter(h=>h.type==="api"),e=t.filter(h=>h.type==="collection"),{newApiFiles:i,existingApiFiles:a}=this.categorizeApisFromFiles(s),{newCollectionFiles:o,existingCollectionFiles:n}=this.categorizeCollectionsFromFiles(e);if(i.length>0||o.length>0){i.forEach(l=>this.storage.addPersistExcludedId(l.relative_path)),o.forEach(l=>this.storage.addPersistExcludedId(l.relative_path));const h=i.length>0?await this.tauriStorage.loadAndParseApis(i,void 0,!0):[],g=o.length>0?await this.tauriStorage.loadAndParseCollections(o,void 0):[],c=h.filter(l=>l!==null),d=g.filter(l=>l!==null);this.state.apis.merge(c),this.state.collections.merge(d),this.indexApis(c),this.indexCollections(d),setTimeout(()=>{i.forEach(l=>this.storage.removePersistExcludedId(l.relative_path)),o.forEach(l=>this.storage.removePersistExcludedId(l.relative_path))},500)}a.length>0&&await this.reloadApis(a),n.length>0&&await this.reloadCollections(n)}categorizeApisFromFiles(t){const s=new Set,e=[],i=[];for(const a of t)s.has(a.relative_path)||(s.add(a.relative_path),this.state.apis.get({noproxy:!0}).some(o=>o.id===a.relative_path)?i.push(a):a.type==="api"&&e.push(a));return{newApiFiles:e,existingApiFiles:i}}categorizeCollectionsFromFiles(t){const s=new Set,e=[],i=[];for(const a of t)s.has(a.relative_path)||(s.add(a.relative_path),this.state.collections.get({noproxy:!0}).some(o=>o.id===a.relative_path)?i.push(a):a.type==="collection"&&e.push(a));return{newCollectionFiles:e,existingCollectionFiles:i}}async handleDelete(t){const s=[],e=[];for(const i of t){this.storage.addPersistExcludedId(i.relative_path);const a=this.state.apis.get({noproxy:!0}).findIndex(n=>n.id===i.relative_path);a>=0&&(this.state.apis[a].set(f),this.tauriStorage.deleteApiFromCache(i.relative_path),s.push(i.relative_path));const o=this.state.collections.get({noproxy:!0}).findIndex(n=>n.id===i.relative_path);o>=0&&(this.state.collections[o].set(f),e.push(i.relative_path)),setTimeout(()=>{this.storage.removePersistExcludedId(i.relative_path)},500)}this.removeApis(s),this.removeCollections(e)}async handleRename(t){if(t.length>=2){const[s,e]=t;await this.handleDelete([s]),await this.handleCreate([e])}else await this.handleCreate(t)}async isProjectFolderRemoved(t,s){if(t.length===0)return!1;if(s==="deleted"||s==="renamed"){for(const e of t)if(e===this.projectDir)return!0}return t.filter(e=>!e.startsWith(this.projectDir+"/")&&e!==this.projectDir).length>0&&s==="renamed"}async handleProjectFolderRemoval(){const t=this.state.apis.get({noproxy:!0}),s=t.map(a=>a.id);t.forEach(a=>{this.storage.addPersistExcludedId(a.id),this.tauriStorage.deleteApiFromCache(a.id)}),this.state.apis.set([]);const e=this.state.collections.get({noproxy:!0}),i=e.map(a=>a.id);e.forEach(a=>{this.storage.addPersistExcludedId(a.id)}),this.state.collections.set([]),setTimeout(()=>{t.forEach(a=>this.storage.removePersistExcludedId(a.id)),e.forEach(a=>this.storage.removePersistExcludedId(a.id))},500),this.removeApis(s),this.removeCollections(i),await this.stop()}async findApisToReload(t){const s=[];return await Promise.all(this.state.apis.map(async e=>{const i=e.fileDependencies?.get({noproxy:!0})??new Set,a=e.get({noproxy:!0}).id,o=t.find(n=>i.has(n.absolute_path));if(!this.storage.isWatchExcluded(a)&&o){const n=await v.join(this.projectDir,a);s.push({relative_path:a,absolute_path:n,type:"api"})}})),s}async findCollectionsToReload(t){const s=[];return await Promise.all(this.state.collections.map(async e=>{const i=e.fileDependencies?.get({noproxy:!0})??new Set,a=e.get({noproxy:!0}).id,o=t.find(n=>i.has(n.absolute_path));if(!this.storage.isWatchExcluded(a)&&o){const n=await v.join(this.projectDir,a);s.push({relative_path:a,absolute_path:n,type:"collection"})}})),s}async reloadEnvironments(){const t=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId("replay-environments.yaml"),this.state.environments.set(t),setTimeout(()=>{this.storage.removePersistExcludedId("replay-environments.yaml")},500)}async reloadApis(t){if(t.length===0)return;const s=await this.tauriStorage.loadAndParseApis(t,void 0,!0),e=[];await Promise.all(s.map(async(i,a)=>{if(!i){await this.handleDelete([t[a]]);return}const o=this.state.apis.get({noproxy:!0}).findIndex(n=>n.id===i.id);o>=0?(this.storage.addPersistExcludedId(i.id),this.state.apis[o].set(i),e.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("API not found in state after reload:",i.id)})),e.length>0&&this.indexApis(e)}async reloadCollections(t){if(t.length===0)return;const s=await this.tauriStorage.loadAndParseCollections(t,void 0),e=[];await Promise.all(s.map(async(i,a)=>{if(!i){await this.handleDelete([t[a]]);return}const o=this.state.collections.get({noproxy:!0}).findIndex(n=>n.id===i.id);o>=0?(this.storage.addPersistExcludedId(i.id),this.state.collections[o].set(i),e.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("Collection not found in state after reload:",i.id)})),e.length>0&&this.indexCollections(e)}}export{_ as FileWatcher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class r{listeners=new Map;on(e,t){let s=this.listeners.get(e);s||(s=new Set,this.listeners.set(e,s)),s.add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,t){const s=this.listeners.get(e);if(s)for(const i of s)i(t)}subscribe(e,t){return this.on(e,t),()=>{this.off(e,t)}}removeAllListeners(e){if(e!==void 0){this.listeners.delete(e);return}this.listeners.clear()}}export{r as O};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as h,aO as te,aP as ne,aQ as y}from"./redocly-openapi-docs.min.index-BuFUmOUm.js";import{O as H}from"./redocly-openapi-docs.min.Observable-D6wKbFwB.js";import{p as ie}from"./redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js";function x(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&"raw"in t&&typeof t.raw=="string"?t.raw:String(t)}function w(t){return t.replace(/\s+/g," ").trim()}function b(t){return typeof t=="object"&&t!==null&&"$ref"in t}function _(t){return b(t)?null:t}function N(t){try{return JSON.stringify(t)}catch{return String(t)}}function U(t){let e=`${t.name} (${t.in}`;return t.required&&(e+=", required"),t.type&&(e+=`, ${t.type}`),t.format&&(e+=`, format: ${t.format}`),t.enum&&(e+=`, enum: [${t.enum.join(",")}]`),t.pattern&&(e+=`, pattern: ${t.pattern}`),e+=")",e}function M(t){return t.type?Array.isArray(t.type)?t.type.join("|"):t.type:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":"object"}function oe(t){return t==="querystring"?"query":t==="query"||t==="header"||t==="path"||t==="cookie"?t:"query"}function se(t){const e=t.schema&&!b(t.schema)?t.schema:null,n={name:t.name,in:oe(t.in),required:t.required??!1};return e&&(n.type=M(e),e.format&&(n.format=e.format),e.enum&&(n.enum=e.enum.map(String)),e.pattern&&(n.pattern=e.pattern),e.example!==void 0&&(n.example=String(e.example))),t.description&&(n.description=x(t.description)),t.example!==void 0&&!n.example&&(n.example=String(t.example)),n}function ae(t,e){const n=new Set,o=[],s=i=>{for(const a of i){const r=_(a);if(!r||!r.name)continue;const c=`${r.in}:${r.name}`;n.has(c)||(n.add(c),o.push(se(r)))}};return t.parameters&&s(t.parameters),e.parameters&&s(e.parameters),o}function F(t,e=2,n=0){if(n>=e||!t.properties)return[];const o=new Set(t.required??[]);return Object.entries(t.properties).map(([s,i])=>({name:s,type:M(i),required:o.has(s),readOnly:i.readOnly}))}function E(t){const e=t.components?.securitySchemes;if(!e)return[];const n=[];for(const[o,s]of Object.entries(e)){const i=_(s);i&&n.push(re(o,i))}return n}function re(t,e){const n={schemeName:t,type:e.type};if(e.in&&(n.in=e.in),e.name&&(n.name=e.name),e.scheme&&(n.scheme=e.scheme),e.bearerFormat&&(n.bearerFormat=e.bearerFormat),e.flows){const o=Object.keys(e.flows).filter(i=>e.flows[i]);o.length>0&&(n.flows=o.join(", "));const s=new Set;for(const i of o){const a=e.flows[i];a?.scopes&&Object.keys(a.scopes).forEach(r=>s.add(r))}s.size>0&&(n.scopes=[...s].join(", "))}return n}function ce(t,e,n){const o=t??e;if(!o||n.length===0)return[];const s=new Set;for(const i of o)for(const a of Object.keys(i))s.add(a);return n.filter(i=>s.has(i.schemeName))}function le(t){return t.length===0?"":`Security: ${t.map(e=>{let n=`${e.schemeName} (${e.type}`;return e.scheme&&(n+=`, ${e.scheme}`),e.in&&e.name&&(n+=`, ${e.name} in ${e.in}`),n+=")",n}).join("; ")}.`}const de=["get","put","post","delete","options","head","patch","trace"],ue=["query","x-query"];function pe(t,e){const n=[],o=Object.keys(t.content??{});if(o.length===0)return{textPart:"",schemaJson:"{}",examples:n};const s=o.find(l=>l.includes("json"))??o[0],i=t.content?.[s],a=i?.schema&&!b(i.schema)?i.schema:null,r=(a?F(a):[]).filter(l=>!e.hideReadOnly||!l.readOnly),c=t.required?"required":"optional";let d=`Request body (${s}, ${c})`;if(r.length>0){const l=r.map(u=>`${u.name}: ${u.type}${u.required?" required":""}${u.readOnly?" readOnly":""}`);d+=`: {${l.join(", ")}}`}return i?.example!==void 0&&n.push(N(i.example)),{textPart:d,schemaJson:JSON.stringify(r),examples:n}}function he(t){const e=[],n=[];for(const[o,s]of Object.entries(t)){if(b(s))continue;const i=x(s.description??"");e.push(`${o} ${i}`.trim());const a={statusCode:o};i&&(a.description=i);const r=s.content;if(r){const c=Object.keys(r).find(l=>l.includes("json"))??Object.keys(r)[0],d=r[c]?.schema;if(d&&!b(d)){const l=F(d);l.length>0&&(a.schemaProperties=JSON.stringify(l))}}n.push(a)}return{textParts:e,summaries:n}}function q(t){const{apiId:e,apiTitle:n,path:o,method:s,op:i,pathItem:a,globalSchemes:r,apiSecurity:c}=t,d=i.summary??"",l=x(i.description??""),u=i.operationId??"",p=i.tags??[],g=s.toUpperCase(),m=ae(i,a),f=ce(i.security,c,r),Z=f.length>0?f.map(v=>`api_sec:${e}:${v.schemeName}`):void 0,I=[n,`${g} ${o}`,d,l];u&&I.push(`operationId: ${u}`),p.length>0&&I.push(`Tags: ${p.join(", ")}`),i.deprecated&&I.push("DEPRECATED"),m.length>0&&I.push(`Parameters: ${m.map(U).join(". ")}.`);let z;const S=[],J=i.requestBody;if(J){const v=_(J);if(v){const j=pe(v,{hideReadOnly:g==="POST"||g==="PUT"||g==="PATCH"});j.textPart&&I.push(j.textPart),z=j.schemaJson,S.push(...j.examples)}}const{textParts:C,summaries:T}=he(i.responses??{});C.length>0&&I.push(`Responses: ${C.join(", ")}.`);const D=le(f);D&&I.push(D);const R=`api_op:${e}:${o}:${s}:${u||`${o}-${s}`}`,ee={type:"api_operation",id:R,contentHash:"",title:d||`${g} ${o}`,description:l||void 0,apiId:e,path:o,method:g,operationId:u||void 0,tags:p.length>0?p:void 0,deprecated:i.deprecated||void 0,parameterDetails:m.length>0?m:void 0,requestBodySchema:z,responseSchemas:T.length>0?T:void 0,securitySchemeRefs:Z,examples:S.length>0?S:void 0};return{id:R,text:w(I.filter(Boolean).join(" ")),payload:ee}}function Q(t){const e=t.info?.title??"Untitled API",n=x(t.info?.description??t.info?.summary??""),o=t.id;return{id:`api:${o}`,text:w([e,n].filter(Boolean).join(" ")),payload:{type:"api",id:`api:${o}`,contentHash:"",title:e,description:n||void 0,apiId:o}}}function O(t){const e=[];for(const n of t){e.push(Q(n));const o=n.info?.title??"Untitled API",s=n.id,i=E(n);for(const r of i){const c=`api_sec:${s}:${r.schemeName}`,d=[`${r.schemeName}: type=${r.type}`,r.scheme?`scheme=${r.scheme}`:"",r.in&&r.name?`${r.name} in ${r.in}`:"",r.bearerFormat?`format=${r.bearerFormat}`:"",r.flows?`flows=[${r.flows}]`:"",r.scopes?`scopes=[${r.scopes}]`:""].filter(Boolean).join(" ");e.push({id:c,text:w(`${o} Authentication. ${r.schemeName}. ${d}.`),payload:{type:"api_security",id:c,contentHash:"",title:`${o} \u2014 ${r.schemeName}`,apiId:s,securityScheme:r}})}const a=n.paths??{};for(const[r,c]of Object.entries(a)){if(!c||typeof c!="object")continue;const d=[...de.filter(u=>u in c),...ue.filter(u=>u in c)];for(const u of d){const p=c[u];!p||typeof p!="object"||e.push(q({apiId:s,apiTitle:o,path:r,method:u,op:p,pathItem:c,globalSchemes:i,apiSecurity:n.security}))}const l=c.additionalOperations;if(l&&typeof l=="object")for(const[u,p]of Object.entries(l))!p||typeof p!="object"||e.push(q({apiId:s,apiTitle:o,path:r,method:u,op:p,pathItem:c,globalSchemes:i,apiSecurity:n.security}))}}return e}function me(t){const e=[],n=[{list:t.queryParameters,loc:"query"},{list:t.headers,loc:"header"},{list:t.cookies,loc:"cookie"},{list:t.pathParameters,loc:"path"}];for(const{list:o,loc:s}of n)for(const i of o)if("key"in i){const a=i;e.push({name:a.key,in:s,required:!1})}return e}function L(t){const e=t.id,n=t.info?.title??"Untitled Collection",o=x(t.info?.description??t.info?.summary??"");return{id:`collection:${e}`,text:w([n,o].filter(Boolean).join(" ")),payload:{type:"collection",id:`collection:${e}`,contentHash:"",title:n,description:o||void 0,collectionId:e}}}function W(t){const{collectionId:e,collectionTitle:n,workflow:o}=t,s=o.workflowId??"",i=o.summary??s,a=x(o.description??""),r=[n,i,a];if(o.inputs&&r.push(`Inputs schema: ${N(o.inputs)}`),o.outputs?.length){const c=o.outputs.map(d=>d.key).filter(Boolean);c.length&&r.push(`Outputs: ${c.join(", ")}`)}return o.dependsOn?.length&&r.push(`Depends on: ${o.dependsOn.join(", ")}`),{id:`workflow:${e}:${s}`,text:w(r.filter(Boolean).join(" ")),payload:{type:"workflow",id:`workflow:${e}:${s}`,contentHash:"",title:i,description:a||void 0,collectionId:e,workflowId:s}}}function K(t){const{collectionId:e,collectionTitle:n,workflowId:o,workflowTitle:s,step:i}=t,a=i.stepId??"",r=x(i.description??""),c=i.operation,d=i.xOperation,l=[n,s,`step: ${a}`];r&&l.push(r),c?(l.push(`${c.method?.toUpperCase()} ${c.path}`),c.apiId&&l.push(`API: ${c.apiId}`),c.operationId&&l.push(`operationId: ${c.operationId}`)):d&&l.push(`${d.method?.toUpperCase()} ${d.url}`);const u=i.parameters?me(i.parameters):[];u.length>0&&l.push(`Parameters: ${u.map(U).join(". ")}.`),i.requestBody?.type&&l.push(`Request body type: ${i.requestBody.type}`);const p=(i.successCriteria??[]).map(m=>{let f=m.condition;return m.context&&(f+=` context: ${m.context}`),m.type&&(f+=` (${m.type})`),f});if(p.length>0&&l.push(`Success criteria: ${p.join("; ")}`),i.outputs?.length){const m=i.outputs.map(f=>`${f.key}=${f.value}`).filter(Boolean);m.length&&l.push(`Outputs: ${m.join(", ")}`)}const g=`step:${e}:${o}:${a}`;return{id:g,text:w(l.filter(Boolean).join(" ")),payload:{type:"step",id:g,contentHash:"",title:a,description:r||void 0,collectionId:e,workflowId:o,stepId:a,path:c?.path??d?.url,method:(c?.method??d?.method)?.toUpperCase(),apiId:c?.apiId,operationId:c?.operationId,parameterDetails:u.length>0?u:void 0,successCriteria:p.length>0?p:void 0,requestBodySchema:i.requestBody?.type?N(i.requestBody):void 0}}}function P(t){const e=[];for(const n of t){const o=n.id,s=n.info?.title??"Untitled Collection";e.push(L(n));for(const i of n.workflows??[]){e.push(W({collectionId:o,collectionTitle:s,workflow:i}));const a=i.workflowId??"",r=i.summary??a;for(const c of i.steps??[])e.push(K({collectionId:o,collectionTitle:s,workflowId:a,workflowTitle:r,step:c}))}}return e}function G(t,e){return[...O(t),...P(e)]}const k=10,fe=4;function V(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return e>>>0}function ye(t){return te(ne(t))}const ge={};class Ie extends H{constructor(e){super(),this.collectionName=e}collectionName;activeIndexJobs=0;getIndexingActivityState(){return{inProgress:this.activeIndexJobs>0}}beginIndexJob(){this.activeIndexJobs++,this.activeIndexJobs===1&&this.emit("indexing-activity",{inProgress:!0})}endIndexJob(){this.activeIndexJobs=Math.max(0,this.activeIndexJobs-1),this.activeIndexJobs===0&&this.emit("indexing-activity",{inProgress:!1})}async getIdsByPayload(e,n){return h("semantic_search_get_ids_by_payload",{collectionName:this.collectionName,field:e,value:n})}async getAllIds(){return h("semantic_search_get_all_ids",{collectionName:this.collectionName})}async getScopeHashes(e){const n=e.apiIds??[],o=e.collectionIds??[];let s;if(n.length===0&&o.length===0)s=await this.getAllIds();else{const a=[];for(const r of n)a.push(this.getIdsByPayload("apiId",r));for(const r of o)a.push(this.getIdsByPayload("collectionId",r));s=(await Promise.all(a)).flat()}const i=new Map;for(const a of s)i.set(a.id,a.contentHash);return i}async indexDocuments(e,n){if(e.length===0&&!n)return{added:0,updated:0,removed:0,unchanged:0};const o=await this.getScopeHashes(n??{}),s=[],i=new Set;let a=0,r=0;for(const l of e){const u=ye(l.text);l.payload.contentHash=u,i.add(l.id);const p=o.get(l.id);p===u?r++:(p||a++,s.push(l))}const c=s.length-a,d=[];for(const l of o.keys())i.has(l)||d.push(l);if(d.length>0||s.length>0){this.beginIndexJob();try{d.length>0&&await this.deletePoints(d.map(V)),s.length>0&&await this.embedAndUpsert(s),await this.flush()}finally{this.endIndexJob()}}return{added:a,updated:c,removed:d.length,unchanged:r}}async removeByPayloadFilter(e,n){return h("semantic_search_delete_by_payload",{collectionName:this.collectionName,field:e,value:n})}async getStoredDocumentCount(){try{return(await h("plugin:velesdb|list_collections"))?.find(e=>e.name===this.collectionName)?.count??0}catch{return 0}}async getDocumentsByIds(e){if(e.length===0)return new Map;const n=e.map(V),o=await h("plugin:velesdb|get_points",{request:{collection:this.collectionName,ids:n}}),s=new Map;for(const i of o??[])if(i?.payload){const a=i.payload;a.id&&s.set(a.id,a)}return s}async embedAndUpsert(e){const n=[],o=e.length;for(let s=0;s<o;s+=k)n.push({docs:e.slice(s,s+k),index:Math.floor(s/k)});await ie(n,fe,async s=>{const i=s.docs.map(a=>({id:a.id,text:a.text||a.payload.title,payload:a.payload}));await h("semantic_search_embed_and_upsert",{collectionName:this.collectionName,documents:i})})}async deletePoints(e){e.length!==0&&await h("plugin:velesdb|delete_points",{request:{collection:this.collectionName,ids:e}})}async flush(){await h("plugin:velesdb|flush",{name:this.collectionName}),await h("semantic_search_write_hnsw_marker",{collectionName:this.collectionName}).catch(()=>{})}}const X="replay_search",xe=384,$={added:0,updated:0,removed:0,unchanged:0};function B(t){return t.added+t.updated>0}class Y extends H{initialized=!1;projectId=null;indexer=null;indexQueue=Promise.resolve();get collectionName(){return this.projectId?`${X}_${this.projectId}`:X}createIndexer(){const e=new Ie(this.collectionName);return e.subscribe("indexing-activity",n=>{this.emit("indexing-activity",n)}),e}getIndexer(){return this.indexer||(this.indexer=this.createIndexer()),this.indexer}getIndexingActivityState(){return this.getIndexer().getIndexingActivityState()}async ensureInitialized(){this.initialized||await this.init()}enqueueIndex(e,n){const o=this.indexQueue.then(()=>e()).then(async s=>(n(s)&&await this.unloadModel(),s)).catch(async s=>{throw console.error("Semantic index:",s),await this.unloadModel(),s});return this.indexQueue=o.catch(()=>{}),o}async unloadModel(){try{await h("semantic_search_unload_model")}catch{}}setProject(e){this.projectId!==e&&(this.projectId=e,this.initialized=!1,this.indexer=this.createIndexer())}async init(){if(y()&&!this.initialized){try{if((await h("plugin:velesdb|list_collections"))?.some(e=>e.name===this.collectionName)){this.initialized=!0;return}}catch{}await h("plugin:velesdb|create_collection",{request:{name:this.collectionName,dimension:xe,metric:"cosine",storage_mode:"full"}}),this.initialized=!0}}async indexApis(e){if(!y())return $;const n=this.collectionName,o=this.getIndexer(),s=O(e),i={apiIds:e.map(a=>a.id)};return await this.ensureInitialized(),this.enqueueIndex(async()=>this.collectionName!==n?$:o.indexDocuments(s,i),B)}async indexCollections(e){if(!y())return $;const n=this.collectionName,o=this.getIndexer(),s=P(e),i={collectionIds:e.map(a=>a.id)};return await this.ensureInitialized(),this.enqueueIndex(async()=>this.collectionName!==n?$:o.indexDocuments(s,i),B)}async removeApi(e){if(!y())return;const n=this.getIndexer();await this.ensureInitialized(),await this.enqueueIndex(()=>n.removeByPayloadFilter("apiId",e),()=>!1)}async removeCollection(e){if(!y())return;const n=this.getIndexer();await this.ensureInitialized(),await this.enqueueIndex(()=>n.removeByPayloadFilter("collectionId",e),()=>!1)}async reindex(e){if(!y())return $;const n=this.collectionName,o=this.getIndexer();return await this.ensureInitialized(),this.enqueueIndex(async()=>{if(this.collectionName!==n)return $;const{apis:s,collections:i}=e(),a=G(s,i);return o.indexDocuments(a,ge)},B)}async search(e,n=10,o){if(!y())return[];try{await this.ensureInitialized();const s=o&&Object.keys(o).length>0?{type:o.type,apiId:o.apiId,collectionId:o.collectionId,path:o.path,method:o.method,operationId:o.operationId,workflowId:o.workflowId,stepId:o.stepId}:void 0,i=((await h("semantic_search_text",{collection:this.collectionName,query:e,topK:n,filters:s})).results??[]).map(a=>({...a.payload,score:a.score??0}));return await this.enrichWithRelatedSecurity(i),i}catch{return[]}}async enrichWithRelatedSecurity(e){const n=e.filter(i=>i.type==="api_operation"&&i.securitySchemeRefs?.length);if(n.length===0)return;const o=[...new Set(n.flatMap(i=>i.securitySchemeRefs??[]))],s=await this.getIndexer().getDocumentsByIds(o);for(const i of n){const a=[];for(const r of i.securitySchemeRefs??[]){const c=s.get(r);c?.securityScheme&&a.push(c.securityScheme)}a.length>0&&(i.relatedSecuritySchemes=a)}}async status(){if(!y())return{indexed:0,modelLoaded:!1};const e=await this.getIndexer().getStoredDocumentCount();let n=!1;try{n=(await h("semantic_search_model_status")).loaded}catch{}return{indexed:e,modelLoaded:n}}async clear(){if(!(!y()||!this.initialized))try{await h("plugin:velesdb|delete_collection",{name:this.collectionName}),this.initialized=!1}catch{}}async preloadModel(){if(y())try{await h("semantic_search_preload_model")}catch{}}}let A=null;function we(){return A||(A=new Y),A}export{Y as S,O as a,P as b,Q as c,q as d,G as e,E as f,we as g,L as h,K as i,W as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{z as ve}from"./redocly-openapi-docs.min.index-BuFUmOUm.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,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aR as c,aS as l,aT as n,P as o,aU as h,aV as u,aW as d,aX as w,aY as y,aZ as m}from"./redocly-openapi-docs.min.index-BuFUmOUm.js";import{O as f}from"./redocly-openapi-docs.min.Observable-D6wKbFwB.js";const E=new Set(["node_modules"]);class g extends f{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}baseDir;writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await c(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const t=await this.getFullPath(e);return this.getDirEntryFilesRecursively(t)}async getDirEntryFilesRecursively(e){try{const t=[],i=await l(e);for(const s of i)if(s.isDirectory){if(E.has(s.name))continue;const a=await n(e,s.name),r=await this.getDirEntryFilesRecursively(a);t.push(...r)}else{const a=await n(e,s.name),r=await o.relative(this.baseDir,a);t.push(r)}return t}catch(t){return t.includes("forbidden path")||console.error(t),[]}}async get(e){const t=await this.getFullPath(e);try{return await h(t)}catch(i){return!i.includes("No such file or directory")&&!i.includes("forbidden path")&&console.error(i),null}}async has(e){const t=await this.getFullPath(e);return await u(t)}async set(e,t){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const i=await this.getFullPath(e),s=m(),a=i.split(s).slice(0,-1).join(s);await c(a,{recursive:!0}),await d(i,t)}finally{const i=this.writeEndTimers.get(e);i&&clearTimeout(i);const s=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,s)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const t=await this.getFullPath(e);await w(t)}catch(t){!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t)}finally{const t=this.writeEndTimers.get(e);t&&clearTimeout(t);const i=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,i)}}}async rename(e,t){const i=await this.getFullPath(e),s=await this.getFullPath(t);await y(i,s)}async getFullPath(e){return await n(this.baseDir,e??"")}}export{g as TauriFileSystemAdapter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as ht,S as N,F as ut,G as O,H as B,J as ft,c as F,z as pt,K as dt,L as mt,P as vt}from"./redocly-openapi-docs.min.index-BuFUmOUm.js";import{p as G}from"./redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js";import{TauriFileSystemAdapter as H}from"./redocly-openapi-docs.min.TauriFileSystemAdapter-CHW6hO3z.js";import{d as wt,w as k}from"./redocly-openapi-docs.min.standalone-CRo0Sa5b.js";var R={exports:{}},X;function yt(){return X||(X=1,(function(n){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function c(s,o,l){this.fn=s,this.context=o,this.once=l||!1}function a(s,o,l,y,g){if(typeof l!="function")throw new TypeError("The listener must be a function");var m=new c(l,y||s,g),w=e?e+o:o;return s._events[w]?s._events[w].fn?s._events[w]=[s._events[w],m]:s._events[w].push(m):(s._events[w]=m,s._eventsCount++),s}function f(s,o){--s._eventsCount===0?s._events=new i:delete s._events[o]}function h(){this._events=new i,this._eventsCount=0}h.prototype.eventNames=function(){var s=[],o,l;if(this._eventsCount===0)return s;for(l in o=this._events)t.call(o,l)&&s.push(e?l.slice(1):l);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(o)):s},h.prototype.listeners=function(s){var o=e?e+s:s,l=this._events[o];if(!l)return[];if(l.fn)return[l.fn];for(var y=0,g=l.length,m=new Array(g);y<g;y++)m[y]=l[y].fn;return m},h.prototype.listenerCount=function(s){var o=e?e+s:s,l=this._events[o];return l?l.fn?1:l.length:0},h.prototype.emit=function(s,o,l,y,g,m){var w=e?e+s:s;if(!this._events[w])return!1;var u=this._events[w],_=arguments.length,P,v;if(u.fn){switch(u.once&&this.removeListener(s,u.fn,void 0,!0),_){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,o),!0;case 3:return u.fn.call(u.context,o,l),!0;case 4:return u.fn.call(u.context,o,l,y),!0;case 5:return u.fn.call(u.context,o,l,y,g),!0;case 6:return u.fn.call(u.context,o,l,y,g,m),!0}for(v=1,P=new Array(_-1);v<_;v++)P[v-1]=arguments[v];u.fn.apply(u.context,P)}else{var lt=u.length,I;for(v=0;v<lt;v++)switch(u[v].once&&this.removeListener(s,u[v].fn,void 0,!0),_){case 1:u[v].fn.call(u[v].context);break;case 2:u[v].fn.call(u[v].context,o);break;case 3:u[v].fn.call(u[v].context,o,l);break;case 4:u[v].fn.call(u[v].context,o,l,y);break;default:if(!P)for(I=1,P=new Array(_-1);I<_;I++)P[I-1]=arguments[I];u[v].fn.apply(u[v].context,P)}}return!0},h.prototype.on=function(s,o,l){return a(this,s,o,l,!1)},h.prototype.once=function(s,o,l){return a(this,s,o,l,!0)},h.prototype.removeListener=function(s,o,l,y){var g=e?e+s:s;if(!this._events[g])return this;if(!o)return f(this,g),this;var m=this._events[g];if(m.fn)m.fn===o&&(!y||m.once)&&(!l||m.context===l)&&f(this,g);else{for(var w=0,u=[],_=m.length;w<_;w++)(m[w].fn!==o||y&&!m[w].once||l&&m[w].context!==l)&&u.push(m[w]);u.length?this._events[g]=u.length===1?u[0]:u:f(this,g)}return this},h.prototype.removeAllListeners=function(s){var o;return s?(o=e?e+s:s,this._events[o]&&f(this,o)):(this._events=new i,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=e,h.EventEmitter=h,n.exports=h})(R)),R.exports}var gt=yt();const bt=wt(gt);class Z extends Error{constructor(t){super(t),this.name="TimeoutError"}}let St=class extends Error{constructor(n){super(),this.name="AbortError",this.message=n}};const tt=n=>globalThis.DOMException===void 0?new St(n):new DOMException(n),et=n=>{const t=n.reason===void 0?tt("This operation was aborted."):n.reason;return t instanceof Error?t:tt(t)};function _t(n,t,e,i){let c;const a=new Promise((f,h)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===Number.POSITIVE_INFINITY){f(n);return}if(i={customTimers:{setTimeout,clearTimeout},...i},i.signal){const{signal:s}=i;s.aborted&&h(et(s)),s.addEventListener("abort",()=>{h(et(s))})}c=i.customTimers.setTimeout.call(void 0,()=>{const s=`Promise timed out after ${t} milliseconds`,o=e instanceof Error?e:new Z(s);typeof n.cancel=="function"&&n.cancel(),h(o)},t),(async()=>{try{f(await n)}catch(s){h(s)}finally{i.customTimers.clearTimeout.call(void 0,c)}})()});return a.clear=()=>{clearTimeout(c),c=void 0},a}function Et(n,t,e){let i=0,c=n.length;for(;c>0;){const a=Math.trunc(c/2);let f=i+a;e(n[f],t)<=0?(i=++f,c-=a+1):c=a}return i}var x=function(n,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(n):i?i.value:t.get(n)},C;class Ct{constructor(){C.set(this,[])}enqueue(t,e){e={priority:0,...e};const i={priority:e.priority,run:t};if(this.size&&x(this,C,"f")[this.size-1].priority>=e.priority){x(this,C,"f").push(i);return}const c=Et(x(this,C,"f"),i,(a,f)=>f.priority-a.priority);x(this,C,"f").splice(c,0,i)}dequeue(){return x(this,C,"f").shift()?.run}filter(t){return x(this,C,"f").filter(e=>e.priority===t.priority).map(e=>e.run)}get size(){return x(this,C,"f").length}}C=new WeakMap;var p=function(n,t,e,i,c){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!c:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?c.call(n,e):c?c.value=e:t.set(n,e),e},r=function(n,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(n):i?i.value:t.get(n)},d,L,W,T,D,M,$,E,z,b,q,S,j,A,K,it,st,rt,nt,at,Y,Q,J,U,ot,V;class ct extends Error{}class Tt extends bt{constructor(t){var e,i,c,a;if(super(),d.add(this),L.set(this,void 0),W.set(this,void 0),T.set(this,0),D.set(this,void 0),M.set(this,void 0),$.set(this,0),E.set(this,void 0),z.set(this,void 0),b.set(this,void 0),q.set(this,void 0),S.set(this,0),j.set(this,void 0),A.set(this,void 0),K.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Ct,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(i=(e=t.intervalCap)===null||e===void 0?void 0:e.toString())!==null&&i!==void 0?i:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(c=t.interval)===null||c===void 0?void 0:c.toString())!==null&&a!==void 0?a:""}\` (${typeof t.interval})`);p(this,L,t.carryoverConcurrencyCount,"f"),p(this,W,t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,"f"),p(this,D,t.intervalCap,"f"),p(this,M,t.interval,"f"),p(this,b,new t.queueClass,"f"),p(this,q,t.queueClass,"f"),this.concurrency=t.concurrency,this.timeout=t.timeout,p(this,K,t.throwOnTimeout===!0,"f"),p(this,A,t.autoStart===!1,"f")}get concurrency(){return r(this,j,"f")}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);p(this,j,t,"f"),r(this,d,"m",U).call(this)}async add(t,e={}){return e={timeout:this.timeout,throwOnTimeout:r(this,K,"f"),...e},new Promise((i,c)=>{r(this,b,"f").enqueue(async()=>{var a,f,h;p(this,S,(f=r(this,S,"f"),f++,f),"f"),p(this,T,(h=r(this,T,"f"),h++,h),"f");try{if(!((a=e.signal)===null||a===void 0)&&a.aborted)throw new ct("The task was aborted.");let s=t({signal:e.signal});e.timeout&&(s=_t(Promise.resolve(s),e.timeout)),e.signal&&(s=Promise.race([s,r(this,d,"m",ot).call(this,e.signal)]));const o=await s;i(o),this.emit("completed",o)}catch(s){if(s instanceof Z&&!e.throwOnTimeout){i();return}c(s),this.emit("error",s)}finally{r(this,d,"m",rt).call(this)}},e),this.emit("add"),r(this,d,"m",Y).call(this)})}async addAll(t,e){return Promise.all(t.map(async i=>this.add(i,e)))}start(){return r(this,A,"f")?(p(this,A,!1,"f"),r(this,d,"m",U).call(this),this):this}pause(){p(this,A,!0,"f")}clear(){p(this,b,new(r(this,q,"f")),"f")}async onEmpty(){r(this,b,"f").size!==0&&await r(this,d,"m",V).call(this,"empty")}async onSizeLessThan(t){r(this,b,"f").size<t||await r(this,d,"m",V).call(this,"next",()=>r(this,b,"f").size<t)}async onIdle(){r(this,S,"f")===0&&r(this,b,"f").size===0||await r(this,d,"m",V).call(this,"idle")}get size(){return r(this,b,"f").size}sizeBy(t){return r(this,b,"f").filter(t).length}get pending(){return r(this,S,"f")}get isPaused(){return r(this,A,"f")}}L=new WeakMap,W=new WeakMap,T=new WeakMap,D=new WeakMap,M=new WeakMap,$=new WeakMap,E=new WeakMap,z=new WeakMap,b=new WeakMap,q=new WeakMap,S=new WeakMap,j=new WeakMap,A=new WeakMap,K=new WeakMap,d=new WeakSet,it=function(){return r(this,W,"f")||r(this,T,"f")<r(this,D,"f")},st=function(){return r(this,S,"f")<r(this,j,"f")},rt=function(){var n;p(this,S,(n=r(this,S,"f"),n--,n),"f"),r(this,d,"m",Y).call(this),this.emit("next")},nt=function(){r(this,d,"m",J).call(this),r(this,d,"m",Q).call(this),p(this,z,void 0,"f")},at=function(){const n=Date.now();if(r(this,E,"f")===void 0){const t=r(this,$,"f")-n;if(t<0)p(this,T,r(this,L,"f")?r(this,S,"f"):0,"f");else return r(this,z,"f")===void 0&&p(this,z,setTimeout(()=>{r(this,d,"m",nt).call(this)},t),"f"),!0}return!1},Y=function(){if(r(this,b,"f").size===0)return r(this,E,"f")&&clearInterval(r(this,E,"f")),p(this,E,void 0,"f"),this.emit("empty"),r(this,S,"f")===0&&this.emit("idle"),!1;if(!r(this,A,"f")){const n=!r(this,d,"a",at);if(r(this,d,"a",it)&&r(this,d,"a",st)){const t=r(this,b,"f").dequeue();return t?(this.emit("active"),t(),n&&r(this,d,"m",Q).call(this),!0):!1}}return!1},Q=function(){r(this,W,"f")||r(this,E,"f")!==void 0||(p(this,E,setInterval(()=>{r(this,d,"m",J).call(this)},r(this,M,"f")),"f"),p(this,$,Date.now()+r(this,M,"f"),"f"))},J=function(){r(this,T,"f")===0&&r(this,S,"f")===0&&r(this,E,"f")&&(clearInterval(r(this,E,"f")),p(this,E,void 0,"f")),p(this,T,r(this,L,"f")?r(this,S,"f"):0,"f"),r(this,d,"m",U).call(this)},U=function(){for(;r(this,d,"m",Y).call(this););},ot=async function(n){return new Promise((t,e)=>{n.addEventListener("abort",()=>{e(new ct("The task was aborted."))},{once:!0})})},V=async function(n,t){return new Promise(e=>{const i=()=>{t&&!t()||(this.off(n,i),e())};this.on(n,i)})};class At{constructor(t){this.apisStorage=t}apisStorage;data=new Map;loading=new Set;pQueue=new Tt({concurrency:20});async get(t){return this.data.has(t)?this.data.get(t)??null:(await this.loadAndParse(t),this.data.get(t)??null)}async load(t,e=!1){this.data.has(t)&&!e||await this.loadAndParse(t,e)}async loadAndParse(t,e=!1){if(this.loading.has(t)){await this.pQueue.add(()=>this.get(t));return}e&&this.data.delete(t),this.loading.add(t),await this.pQueue.add(async()=>{const i=ht(t)?N.WEB:N.FS,c=i===N.WEB?t:await this.apisStorage.getAbsolutePath(t);try{const{definition:a,fileDependencies:f}=await ut(c);if(!a){this.data.set(t,null),await O(t);return}const h=this.apisStorage.parse({uri:t,type:i,content:a});this.data.set(t,{...h,fileDependencies:f}),await O(t)}catch(a){if(this.data.set(t,null),a instanceof Error&&(a.message.includes("Unsupported specification")||a.message.includes("File not found"))){await O(t);return}console.info("Error loading api "+t,a),await B(t,a);return}}),this.loading.delete(t)}get size(){return this.data.size}delete(t){this.data.delete(t)}getAll(){return Array.from(this.data.values()).filter(t=>t!==null)}clear(){this.data.clear(),this.loading.clear()}}class Pt extends ft{apiLoader;constructor(t,e,i){const c=new H(t.systemFilesDir),a=new H(t.userFilesDir);super(c,a,t,!0,e,i),this.apiLoader=new At(this.apisStorage),this.setupWriteListeners(a)}setupWriteListeners(t){t.on("write-start",e=>{this.addWatchExcludedId(e)}),t.on("write-end",e=>{this.removeWatchExcludedId(e)})}async read(){const t=this.telemetry?.startSpan("com.redocly.storage.read",[F("storageOperation","read","storage")],void 0),e=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[F("storageOperation","loadUserState","storage")],t?.parentCtx),[i,c,a]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);e?.setAttribute("status","completed"),e?.setAttribute("environmentCount",a.length),e?.setStatus(k.OK),e?.end();const{apiFiles:f,collectionFiles:h}=await this.detectProjectFiles(t);await this.loadAndParseApis(f,t);const s=(await this.loadAndParseCollections(h,t)).filter(l=>l!==null);this.collectionsStorage.setItemIds(s.map(l=>l.id));const o=this.apiLoader.getAll();return this.apisStorage.setItemIds(o.map(l=>l.id)),t?.setAttribute("status","completed"),t?.setStatus(k.OK),t?.end(),{project:this.project,activeEnvironmentId:i,tabsState:c,environments:a,apis:o,collections:s}}async detectProjectFiles(t){const e=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[F("storageOperation","detectFiles","storage")],t?.parentCtx),{api_files:i,collection_files:c}=await pt("fs_scan",{dir:this.project.userFilesDir});return e?.setAttribute("status","completed"),e?.setAttribute("filesCount",i.length+c.length),e?.setAttribute("apiFilesCount",i.length),e?.setAttribute("collectionFilesCount",c.length),e?.setStatus(k.OK),e?.end(),{apiFiles:i,collectionFiles:c}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(t){this.apiLoader.delete(t)}async loadAndParseApis(t,e,i=!1){const c=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...F("storageOperation","parseApis","storage"),apisCount:t.length}],e?.parentCtx),a=await G(t,20,async f=>{try{return await this.apiLoader.load(f.relative_path,i),this.apiLoader.get(f.relative_path)}catch(h){return console.info(`Error parsing YAML/JSON file ${f.absolute_path}:`,h),await B(f.relative_path,h),null}});return c?.setAttribute("status","completed"),c?.setAttribute("parsedApisCount",this.apiLoader.size),c?.setStatus(k.OK),c?.end(),a}async loadAndParseCollections(t,e){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...F("storageOperation","parseCollections","storage"),collectionsCount:t.length}],e?.parentCtx),c=await G(t,20,async a=>{try{const f=await this.userFilesStorage.get(a.relative_path);if(!f)return null;const h=dt.load(f);if(typeof h!="object"||h===null||typeof h.arazzo!="string")return await O(a.relative_path),null;const s=[];await Promise.all(h.sourceDescriptions?.map(async y=>{const g=y.type,m=y.url,w=!g||g==="openapi",u=await mt({projectPath:this.project.userFilesDir,apiUrl:m,collectionId:a.relative_path});if(w){const _=await this.apiLoader.get(u);_&&s.push(_)}}));const o=await vt.join(this.project.userFilesDir,a.relative_path),l=await this.collectionsStorage.parse({uri:a.relative_path,type:N.FS,content:h,fileDependencies:new Set([o])},s);return await O(a.relative_path),l}catch(f){return console.info(`Error parsing Arazzo file ${a.relative_path}:`,f),await B(a.relative_path,f),null}});return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",c.length),i?.setStatus(k.OK),i?.end(),c}}export{Pt as TauriRootStorage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as i}from"./redocly-openapi-docs.min.standalone-CRo0Sa5b.js";import{R as u,a4 as n}from"./redocly-openapi-docs.min.index-BuFUmOUm.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(A)}}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 A(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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(n,_=!1){return window.__TAURI_INTERNALS__.transformCallback(n,_)}async function t(n,_={},o){return window.__TAURI_INTERNALS__.invoke(n,_,o)}export{t as i,r as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a_ as o,ai as n,aV as i,aS as c,aU as l}from"./redocly-openapi-docs.min.index-BuFUmOUm.js";import{aG as f,ao as r,bj as d,b1 as s}from"./redocly-openapi-docs.min.standalone-CRo0Sa5b.js";class w extends f{constructor(){super()}resolveExternalRef(e,a){return o(a)?a:e&&o(e)?new URL(a,e).href:e?r.resolve(r.dirname(e),a):a}async loadExternalRef(e){if(o(e)){const{body:a,mimeType:t}=await d(e,{...this.config.http,customFetch:n});return new s(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 s(e,a.replace(/\r\n/g,`
|
|
2
|
+
`))}}}export{w as ExternalResolver};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as n}from"./redocly-openapi-docs.min.index-BuFUmOUm.js";async function t(o={}){return typeof o=="object"&&Object.freeze(o),await n("plugin:dialog|open",{options:o})}export{t as open};
|