@redocly/replay 0.28.0-next.8 → 0.28.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/{replay-AiChatProvider--1WugvKf.js → replay-AiChatProvider-BRqjyy2W.js} +2 -2
- package/dist/{replay-AiChatProvider-BJdxRVOc.js → replay-AiChatProvider-DUVoLgY2.js} +128 -130
- package/dist/{replay-AiChatSqliteDBStorage-D9fgt_9s.js → replay-AiChatSqliteDBStorage-0evx56pl.js} +6 -6
- package/dist/{replay-AiChatSqliteDBStorage-DbGtw6xx.js → replay-AiChatSqliteDBStorage-C5AnRloD.js} +1 -1
- package/dist/{replay-AiPanel-BU8oG0pD.js → replay-AiPanel-CMjVD12K.js} +77 -77
- package/dist/{replay-AiPanel-BYOLZjQX.js → replay-AiPanel-PVgJioX3.js} +2 -2
- package/dist/replay-FileWatcher-CFYprlWN.js +364 -0
- package/dist/replay-FileWatcher-DGLwO5Kd.js +1 -0
- package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
- package/dist/{replay-SemanticSearchService-DRDdGJkI.js → replay-SemanticSearchService-Bh5xYa91.js} +22 -26
- package/dist/replay-SemanticSearchService-CulKCCNl.js +1 -0
- package/dist/{replay-SqliteDBStorage-D9Oeu_XC.js → replay-SqliteDBStorage-Bz0muHEk.js} +49 -49
- package/dist/{replay-SqliteDBStorage-B3zO7RGD.js → replay-SqliteDBStorage-CVHRAsPD.js} +1 -1
- package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
- package/dist/replay-TauriFileSystemAdapter-B163-f2D.js +108 -0
- package/dist/replay-TauriFileSystemAdapter-D4bOmvzP.js +1 -0
- package/dist/{replay-TauriRootStorage-XIJpsp6_.js → replay-TauriRootStorage-2MPQE-3f.js} +159 -155
- package/dist/replay-TauriRootStorage-CjWUrnWz.js +1 -0
- package/dist/{replay-agent-loop-DxK1tiVw.js → replay-agent-loop-BgYyBo9e.js} +9 -9
- package/dist/{replay-agent-loop-IDavXm8f.js → replay-agent-loop-DYDFXAZj.js} +1 -1
- package/dist/{replay-ai-chat-mappers-B-_eSMi4.js → replay-ai-chat-mappers-BEwNRQPV.js} +3 -3
- package/dist/{replay-ai-chat-mappers-BmvAc4xt.js → replay-ai-chat-mappers-CMtNqQHX.js} +1 -1
- package/dist/{replay-ai-message-parts.schema-E9u9-nqr.js → replay-ai-message-parts.schema-DKLf0SiG.js} +1 -1
- package/dist/{replay-create-model-CscK0cT1.js → replay-create-model-B2ZsGTjs.js} +3 -3
- package/dist/{replay-create-model-CIY7WZ1P.js → replay-create-model-DPxfOEfv.js} +4 -4
- package/dist/{replay-db-e_3o5e3f.js → replay-db-C9iqyMet.js} +1 -1
- package/dist/{replay-db-C_cdHXEt.js → replay-db-D4-LmLRk.js} +5 -5
- package/dist/{replay-external-resolver-nuL3ajF5.js → replay-external-resolver-BXgVrfzk.js} +7 -7
- package/dist/{replay-external-resolver-BmOmF-DG.js → replay-external-resolver-CTUbNZGW.js} +1 -1
- package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
- package/dist/{replay-index-DDt4LOBo.js → replay-index-4TEahAPK.js} +21968 -21367
- package/dist/{replay-index-DjdDUkfV.js → replay-index-B4U7iZuq.js} +46 -46
- package/dist/replay-index-B8O3wYqo.js +1 -0
- package/dist/{replay-index-etIeWhnn.js → replay-index-Bdg7noSD.js} +1 -1
- package/dist/replay-index-CG9VN2JQ.js +4 -0
- package/dist/{replay-index-E3Eu6_jY.js → replay-index-DcC173cC.js} +1 -1
- package/dist/{replay-index-B8Zfn7JD.js → replay-index-Nz5obVS5.js} +1139 -1141
- package/dist/{replay-index-DcbwI4wD.js → replay-index-q63USe25.js} +1 -1
- package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
- package/dist/{replay-lint-DVAifLdU.js → replay-lint-4XFKTmSY.js} +97 -97
- package/dist/{replay-lint-graphql-U_VxwRr1.js → replay-lint-graphql-BsBWkZ6L.js} +1 -1
- package/dist/{replay-lint-graphql-D1qaeEmu.js → replay-lint-graphql-De2eDZnT.js} +1 -1
- package/dist/{replay-lint-BjrmIhuZ.js → replay-lint-s7ylMBWz.js} +6111 -6074
- package/dist/replay-periodic-revalidation-BMFP7f-u.js +1 -0
- package/dist/{replay-periodic-revalidation-BtEKdEKa.js → replay-periodic-revalidation-DJbblUef.js} +4 -5
- package/dist/{replay-resolve-C97SfUAB.js → replay-resolve-BtNxNrKo.js} +123 -123
- package/dist/{replay-resolve-BYJosLqD.js → replay-resolve-BueEsOnR.js} +1 -1
- package/dist/{replay-respect-run-CW5xFLKz.js → replay-respect-run-B_dJjlti.js} +1 -1
- package/dist/{replay-respect-run-3FHTVHvs.js → replay-respect-run-Dfpbcsns.js} +3 -3
- package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
- package/dist/{replay-tauri-path-CMpWmGvW.js → replay-tauri-path-Bht3XIt7.js} +1 -1
- package/dist/replay-tauri-path-CiuYXh_j.js +22 -0
- package/dist/replay-useAiChatQueries-02CRdEPJ.js +215 -0
- package/dist/{replay-useAiChatQueries-DhTcllVx.js → replay-useAiChatQueries-D2hh5omV.js} +1039 -996
- package/dist/{replay-validate-key-Dj_UT2WG.js → replay-validate-key-ALwOF1Ux.js} +1 -1
- package/dist/{replay-validate-key-DJ_1khxq.js → replay-validate-key-B7fbWbfv.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +5 -0
- package/dist/replay.js +15 -15
- package/package.json +6 -6
- package/dist/replay-FileWatcher-BrhE0AP6.js +0 -1
- package/dist/replay-FileWatcher-JoqPJECh.js +0 -360
- package/dist/replay-SemanticSearchService-BgQ1HMcT.js +0 -1
- package/dist/replay-TauriFileSystemAdapter-CxHFFCmk.js +0 -1
- package/dist/replay-TauriFileSystemAdapter-DJETGEY7.js +0 -99
- package/dist/replay-TauriRootStorage-BSQQcFgG.js +0 -1
- package/dist/replay-index-C_DfEx-H.js +0 -1
- package/dist/replay-index-Da2H-hpA.js +0 -25
- package/dist/replay-periodic-revalidation-C3eLm7Mw.js +0 -1
- package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
- package/dist/replay-tauri-path-C-vLbl1V.js +0 -22
- package/dist/replay-useAiChatQueries-CEYDGx9f.js +0 -215
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./replay-create-model-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./replay-create-model-B2ZsGTjs.js"),n=require("./replay-index-Nz5obVS5.js"),l=require("./replay-defaults-DVvOnvnR.js");async function s(t,a,o,i){try{const e=r.createModel({provider:t,modelId:o,apiKey:a});return await r.generateText({model:e,prompt:l.VALIDATION_PROMPT,maxOutputTokens:n.MAX_OUTPUT_TOKENS_FOR_VALIDATION,abortSignal:i?.abortSignal}),{valid:!0}}catch(e){if(e instanceof Error&&e.name==="AbortError")throw e;return{valid:!1,error:e instanceof Error&&e.message.length>0?e.message:"Validation failed. Please try again."}}}exports.validateApiKey=s;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as i, g as n } from "./replay-create-model-
|
|
2
|
-
import { M as s } from "./replay-index-
|
|
1
|
+
import { c as i, g as n } from "./replay-create-model-DPxfOEfv.js";
|
|
2
|
+
import { M as s } from "./replay-index-4TEahAPK.js";
|
|
3
3
|
import { V as l } from "./replay-defaults-CzR6jw9a.js";
|
|
4
4
|
async function g(a, e, t, o) {
|
|
5
5
|
try {
|
package/dist/replay.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./replay-index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./replay-index-Nz5obVS5.js"),t=require("./replay-oauth2-redirect-handler-Bqw5UUvl.js");exports.AI_PROVIDERS=e.AI_PROVIDERS;exports.AiPanelContext=e.AiPanelContext;exports.EmbeddedReplay=e.EmbeddedReplay;exports.Modal=e.Modal;exports.REUNITE_AI_PROVIDER=e.REUNITE_AI_PROVIDER;exports.Replay=e.Replay;exports.ReplayOverlay=e.ReplayOverlay;Object.defineProperty(exports,"SpanStatusCode",{enumerable:!0,get:()=>e.SpanStatusCode});exports.TelemetryClient=e.TelemetryClient;exports.applyThemeToDOM=e.applyThemeToDOM;exports.createResource=e.createResource;exports.getCurrentTheme=e.getCurrentTheme;exports.loadAgentLoop=e.loadAgentLoop;exports.makeProviderRecord=e.makeProviderRecord;exports.resolveTheme=e.resolveTheme;exports.useAiPanel=e.useAiPanel;exports.useTelemetry=e.useTelemetry;exports.useTelemetryClient=e.useTelemetryClient;exports.validateApiKey=e.validateApiKey;exports.OAuth2Error=t.OAuth2Error;exports.handleOAuth2Redirect=t.handleOAuth2Redirect;
|
package/dist/replay.d.ts
CHANGED
|
@@ -201,6 +201,7 @@ declare type InputSettings = {
|
|
|
201
201
|
hideOtherSecuritySchemes?: boolean;
|
|
202
202
|
layout?: ReplayLayout;
|
|
203
203
|
aiEnabled?: boolean;
|
|
204
|
+
features?: ReplayFeatures;
|
|
204
205
|
aiProviders?: Partial<Record<AiProviderName, AiProviderConfig>>;
|
|
205
206
|
};
|
|
206
207
|
|
|
@@ -775,6 +776,10 @@ export declare type ReplayComponents = {
|
|
|
775
776
|
ReplayTopBarActions: ComponentType<ReplayTopBarActionsComponentProps> | null;
|
|
776
777
|
};
|
|
777
778
|
|
|
779
|
+
declare type ReplayFeatures = {
|
|
780
|
+
graphql?: boolean;
|
|
781
|
+
};
|
|
782
|
+
|
|
778
783
|
declare type ReplayGateComponentProps = {
|
|
779
784
|
setEnvironmentValues: (envName: string, values: Record<string, PredefinedEnvValue>) => void;
|
|
780
785
|
setSelectedEnvironment: (envName: string) => void;
|
package/dist/replay.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { O as
|
|
1
|
+
import { A as s, ap as r, bF as t, bG as l, R as o, bH as b, bI as R, E as d, bJ as p, bK as m, F as n, bL as y, bM as A, bN as i, bO as u, ao as O, an as T, bP as h, bQ as E } from "./replay-index-4TEahAPK.js";
|
|
2
|
+
import { O as P, h as C } from "./replay-oauth2-redirect-handler-CqKZB3aV.js";
|
|
3
3
|
export {
|
|
4
4
|
s as AI_PROVIDERS,
|
|
5
5
|
r as AiPanelContext,
|
|
6
6
|
t as EmbeddedReplay,
|
|
7
7
|
l as Modal,
|
|
8
|
-
|
|
8
|
+
P as OAuth2Error,
|
|
9
9
|
o as REUNITE_AI_PROVIDER,
|
|
10
10
|
b as Replay,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
R as ReplayOverlay,
|
|
12
|
+
d as SpanStatusCode,
|
|
13
|
+
p as TelemetryClient,
|
|
14
|
+
m as applyThemeToDOM,
|
|
15
15
|
n as createResource,
|
|
16
16
|
y as getCurrentTheme,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
C as handleOAuth2Redirect,
|
|
18
|
+
A as loadAgentLoop,
|
|
19
|
+
i as makeProviderRecord,
|
|
20
|
+
u as resolveTheme,
|
|
21
|
+
O as useAiPanel,
|
|
22
|
+
T as useTelemetry,
|
|
23
|
+
h as useTelemetryClient,
|
|
24
|
+
E as validateApiKey
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/replay",
|
|
3
|
-
"version": "0.28.0
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/replay.cjs",
|
|
6
6
|
"module": "./dist/replay.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@redocly/theme": "0.69.0
|
|
19
|
+
"@redocly/theme": "0.69.0",
|
|
20
20
|
"@tanstack/react-query": "5.62.3",
|
|
21
21
|
"react": "^19.2.7",
|
|
22
22
|
"react-dom": "^19.2.7",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@lezer/highlight": "^1.1.6",
|
|
52
52
|
"@noble/hashes": "^1.8.0",
|
|
53
53
|
"@opentelemetry/api": "1.9.1",
|
|
54
|
-
"@redocly/openapi-core": "2.
|
|
54
|
+
"@redocly/openapi-core": "2.53.0",
|
|
55
55
|
"@redocly/replay-asyncapi-sdk": "0.0.1",
|
|
56
|
-
"@redocly/respect-core": "2.
|
|
56
|
+
"@redocly/respect-core": "2.53.0",
|
|
57
57
|
"@redocly/vscode-json-languageservice": "^3.4.9",
|
|
58
58
|
"@tauri-apps/api": "2.4.1",
|
|
59
59
|
"@tauri-apps/plugin-deep-link": "^2.4.5",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"fast-xml-parser": "5.7.3",
|
|
81
81
|
"idb": "^8.0.2",
|
|
82
82
|
"jotai": "^2.16.2",
|
|
83
|
-
"js-yaml": "4.3.
|
|
83
|
+
"js-yaml": "4.3.2",
|
|
84
84
|
"json-pointer": "^0.6.2",
|
|
85
85
|
"json-schema-typed": "^8.0.1",
|
|
86
86
|
"marked": "^4.0.15",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"copy-static": "cp src/oauth2-redirect-page/oauth2-redirect.html dist",
|
|
117
117
|
"preview": "vite preview",
|
|
118
118
|
"ts:check": "tsgo --noEmit --skipLibCheck",
|
|
119
|
-
"knip:check
|
|
119
|
+
"knip:check": "pnpm knip --directory ../.. -W packages/replay",
|
|
120
120
|
"test": "nx run vitest:test",
|
|
121
121
|
"watch": "tsgo --build --watch",
|
|
122
122
|
"clean": "rm -rf dist"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./replay-index-B8Zfn7JD.js"),m=require("./replay-SemanticSearchService-BgQ1HMcT.js");require("react");var v;(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"})(v||(v={}));async function E(r,e){await d.invoke("plugin:event|unlisten",{event:r,eventId:e})}async function w(r,e,a){var t;const i=(t=void 0)!==null&&t!==void 0?t:{kind:"Any"};return d.invoke("plugin:event|listen",{event:r,target:i,handler:d.transformCallback(e)}).then(s=>async()=>E(r,s))}const p="replay-environments.yaml";class F{constructor(e,a,t,i,s,o){this.storage=e,this.projectDir=a,this.aiEnabled=t,this.setEnvironments=i,this.apis=s,this.collections=o}storage;projectDir;aiEnabled;setEnvironments;apis;collections;watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}indexApis(e){!this.aiEnabled||e.length===0||m.getSemanticSearchService().indexApis(e).catch(a=>console.error("Semantic index (apis):",a))}indexCollections(e){!this.aiEnabled||e.length===0||m.getSemanticSearchService().indexCollections(e).catch(a=>console.error("Semantic index (collections):",a))}removeApis(e){if(!this.aiEnabled||e.length===0)return;const a=m.getSemanticSearchService();Promise.all(e.map(t=>a.removeApi(t))).catch(t=>console.error("Semantic remove (apis):",t))}removeCollections(e){if(!this.aiEnabled||e.length===0)return;const a=m.getSemanticSearchService();Promise.all(e.map(t=>a.removeCollection(t))).catch(t=>console.error("Semantic remove (collections):",t))}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await w("fs-watch-event",async e=>{const a=e.payload;try{await this.handleEvent(a)}catch(t){console.error("Error handling file change:",t)}}),await d.invoke("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(e){throw console.error("Failed to start file watcher:",e),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),e}}async stop(){if(this.watchPath)try{await d.invoke("fs_unwatch",{path:this.watchPath})}catch(e){console.error("Error stopping file watcher:",e)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(e){const{changeType:a,paths:t,pathTypes:i,type:s}=e;if(await this.isProjectFolderRemoved(t,a)){await this.handleProjectFolderRemoval();return}const o=this.filterSpecFiles(t,i);if(o.paths.length===0)return;const n=await this.toFileEntries(o.paths,o.pathTypes);switch(a){case"changed":(s.includes("Data")||s.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:",a)}}filterSpecFiles(e,a){const t=[],i=[];for(let s=0;s<e.length;s++){const o=e[s],n=o.split(".").pop()?.toLowerCase();n&&["yaml","yml","json"].includes(n)&&(t.push(o),i.push(a[s]||"unknown"))}return{paths:t,pathTypes:i}}async toFileEntries(e,a){return Promise.all(e.map(async(t,i)=>({relative_path:await d.PathUtils.relative(this.projectDir,t),absolute_path:t,type:a[i]||"unknown"})))}hasEnvironmentsFileChange(e){return!this.storage.isWatchExcluded(p)&&e.some(a=>a.relative_path===p)}withoutEnvironmentsFile(e){return e.filter(a=>a.relative_path!==p)}consolidateFileEntries(e){const a=[],t=new Set;for(const i of e)t.has(i.relative_path)||(t.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||a.push(i));return a}async handleModify(e){const a=this.hasEnvironmentsFileChange(e),t=this.withoutEnvironmentsFile(e),{newApiFiles:i,existingApiFiles:s}=this.categorizeApisFromFiles(t),{newCollectionFiles:o,existingCollectionFiles:n}=this.categorizeCollectionsFromFiles(t),l=await this.findApisToReload(e),c=await this.findCollectionsToReload(e),u=[...i,...o];u.length>0&&await this.handleCreate(u),a&&await this.reloadEnvironments();const g=this.consolidateFileEntries([...s,...l]),f=this.consolidateFileEntries([...n,...c]);await this.reloadApis(g),await this.reloadCollections(f)}async handleCreate(e){this.hasEnvironmentsFileChange(e)&&await this.reloadEnvironments();const a=this.withoutEnvironmentsFile(e),t=a.filter(c=>c.type==="api"),i=a.filter(c=>c.type==="collection"),{newApiFiles:s,existingApiFiles:o}=this.categorizeApisFromFiles(t),{newCollectionFiles:n,existingCollectionFiles:l}=this.categorizeCollectionsFromFiles(i);if(s.length>0||n.length>0){s.forEach(h=>this.storage.addPersistExcludedId(h.relative_path)),n.forEach(h=>this.storage.addPersistExcludedId(h.relative_path));const c=s.length>0?await this.tauriStorage.loadAndParseApis(s,void 0,!0):[],u=n.length>0?await this.tauriStorage.loadAndParseCollections(n,void 0):[],g=c.filter(h=>h!==null),f=u.filter(h=>h!==null);this.apis.set([...this.apis.get(),...g]),this.collections.set([...this.collections.get(),...f]),this.indexApis(g),this.indexCollections(f),setTimeout(()=>{s.forEach(h=>this.storage.removePersistExcludedId(h.relative_path)),n.forEach(h=>this.storage.removePersistExcludedId(h.relative_path))},500)}o.length>0&&await this.reloadApis(o),l.length>0&&await this.reloadCollections(l)}categorizeApisFromFiles(e){const a=new Set,t=[],i=[];for(const s of e){if(a.has(s.relative_path))continue;a.add(s.relative_path),this.apis.get().some(n=>n.id===s.relative_path)?i.push(s):s.type==="api"&&t.push(s)}return{newApiFiles:t,existingApiFiles:i}}categorizeCollectionsFromFiles(e){const a=new Set,t=[],i=[];for(const s of e){if(a.has(s.relative_path))continue;a.add(s.relative_path),this.collections.get().some(n=>n.id===s.relative_path)?i.push(s):s.type==="collection"&&t.push(s)}return{newCollectionFiles:t,existingCollectionFiles:i}}async handleDelete(e){this.hasEnvironmentsFileChange(e)&&await this.reloadEnvironments();const a=[],t=[];for(const i of this.withoutEnvironmentsFile(e)){this.storage.addPersistExcludedId(i.relative_path);const s=this.apis.get();s.some(l=>l.id===i.relative_path)&&(this.apis.set(s.filter(l=>l.id!==i.relative_path)),this.tauriStorage.deleteApiFromCache(i.relative_path),a.push(i.relative_path));const o=this.collections.get(),n=o.findIndex(l=>l.id===i.relative_path);n>=0&&(this.collections.set(o.filter((l,c)=>c!==n)),t.push(i.relative_path)),setTimeout(()=>{this.storage.removePersistExcludedId(i.relative_path)},500)}this.removeApis(a),this.removeCollections(t)}async handleRename(e){if(e.length>=2){const[a,t]=e;await this.handleDelete([a]),await this.handleCreate([t])}else await this.handleCreate(e)}async isProjectFolderRemoved(e,a){if(e.length===0)return!1;if(a==="deleted"||a==="renamed"){for(const i of e)if(i===this.projectDir)return!0}return e.filter(i=>!i.startsWith(this.projectDir+"/")&&i!==this.projectDir).length>0&&a==="renamed"}async handleProjectFolderRemoval(){const e=this.apis.get(),a=e.map(s=>s.id);e.forEach(s=>{this.storage.addPersistExcludedId(s.id),this.tauriStorage.deleteApiFromCache(s.id)}),this.apis.set([]);const t=this.collections.get(),i=t.map(s=>s.id);t.forEach(s=>{this.storage.addPersistExcludedId(s.id)}),this.collections.set([]),setTimeout(()=>{e.forEach(s=>this.storage.removePersistExcludedId(s.id)),t.forEach(s=>this.storage.removePersistExcludedId(s.id))},500),this.removeApis(a),this.removeCollections(i),await this.stop()}async findApisToReload(e){const a=[];return await Promise.all(this.apis.get().map(async t=>{const i=t.fileDependencies??new Set,s=t.id,o=e.find(n=>i.has(n.absolute_path));if(!this.storage.isWatchExcluded(s)&&o){const n=await d.PathUtils.join(this.projectDir,s);a.push({relative_path:s,absolute_path:n,type:"api"})}})),a}async findCollectionsToReload(e){const a=[];return await Promise.all(this.collections.get().map(async t=>{const i=t.fileDependencies??new Set,s=t.id,o=e.find(n=>i.has(n.absolute_path));if(!this.storage.isWatchExcluded(s)&&o){const n=await d.PathUtils.join(this.projectDir,s);a.push({relative_path:s,absolute_path:n,type:"collection"})}})),a}async reloadEnvironments(){const e=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId(p),this.setEnvironments(e.length>0?e:d.cloneObject(d.DEFAULT_ENVIRONMENTS)),this.storage.publishEnvironmentsConfigError(),setTimeout(()=>{this.storage.removePersistExcludedId(p)},500)}async reloadApis(e){if(e.length===0)return;const a=await this.tauriStorage.loadAndParseApis(e,void 0,!0),t=[];await Promise.all(a.map(async(i,s)=>{if(!i){await this.handleDelete([e[s]]);return}const o=this.apis.get();o.some(n=>n.id===i.id)?(this.storage.addPersistExcludedId(i.id),this.apis.set(o.map(n=>n.id===i.id?i:n)),t.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("API not found in state after reload:",i.id)})),t.length>0&&this.indexApis(t)}async reloadCollections(e){if(e.length===0)return;const a=await this.tauriStorage.loadAndParseCollections(e,void 0),t=[];await Promise.all(a.map(async(i,s)=>{if(!i){await this.handleDelete([e[s]]);return}const o=this.collections.get(),n=o.findIndex(l=>l.id===i.id);n>=0?(this.storage.addPersistExcludedId(i.id),this.collections.set(o.map((l,c)=>c===n?i:l)),t.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("Collection not found in state after reload:",i.id)})),t.length>0&&this.indexCollections(t)}}exports.FileWatcher=F;
|
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import { i as m, t as w, P as E, c as F, D as C } from "./replay-index-DDt4LOBo.js";
|
|
2
|
-
import { g } from "./replay-SemanticSearchService-DRDdGJkI.js";
|
|
3
|
-
import "react";
|
|
4
|
-
var v;
|
|
5
|
-
(function(l) {
|
|
6
|
-
l.WINDOW_RESIZED = "tauri://resize", l.WINDOW_MOVED = "tauri://move", l.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", l.WINDOW_DESTROYED = "tauri://destroyed", l.WINDOW_FOCUS = "tauri://focus", l.WINDOW_BLUR = "tauri://blur", l.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", l.WINDOW_THEME_CHANGED = "tauri://theme-changed", l.WINDOW_CREATED = "tauri://window-created", l.WEBVIEW_CREATED = "tauri://webview-created", l.DRAG_ENTER = "tauri://drag-enter", l.DRAG_OVER = "tauri://drag-over", l.DRAG_DROP = "tauri://drag-drop", l.DRAG_LEAVE = "tauri://drag-leave";
|
|
7
|
-
})(v || (v = {}));
|
|
8
|
-
async function _(l, e) {
|
|
9
|
-
await m("plugin:event|unlisten", {
|
|
10
|
-
event: l,
|
|
11
|
-
eventId: e
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async function y(l, e, a) {
|
|
15
|
-
var t;
|
|
16
|
-
const i = (t = void 0) !== null && t !== void 0 ? t : { kind: "Any" };
|
|
17
|
-
return m("plugin:event|listen", {
|
|
18
|
-
event: l,
|
|
19
|
-
target: i,
|
|
20
|
-
handler: w(e)
|
|
21
|
-
}).then((s) => async () => _(l, s));
|
|
22
|
-
}
|
|
23
|
-
const d = "replay-environments.yaml";
|
|
24
|
-
class D {
|
|
25
|
-
constructor(e, a, t, i, s, o) {
|
|
26
|
-
this.storage = e, this.projectDir = a, this.aiEnabled = t, this.setEnvironments = i, this.apis = s, this.collections = o;
|
|
27
|
-
}
|
|
28
|
-
storage;
|
|
29
|
-
projectDir;
|
|
30
|
-
aiEnabled;
|
|
31
|
-
setEnvironments;
|
|
32
|
-
apis;
|
|
33
|
-
collections;
|
|
34
|
-
watchPath = null;
|
|
35
|
-
unlistenEvent = null;
|
|
36
|
-
get tauriStorage() {
|
|
37
|
-
return this.storage;
|
|
38
|
-
}
|
|
39
|
-
indexApis(e) {
|
|
40
|
-
!this.aiEnabled || e.length === 0 || g().indexApis(e).catch((a) => console.error("Semantic index (apis):", a));
|
|
41
|
-
}
|
|
42
|
-
indexCollections(e) {
|
|
43
|
-
!this.aiEnabled || e.length === 0 || g().indexCollections(e).catch((a) => console.error("Semantic index (collections):", a));
|
|
44
|
-
}
|
|
45
|
-
removeApis(e) {
|
|
46
|
-
if (!this.aiEnabled || e.length === 0) return;
|
|
47
|
-
const a = g();
|
|
48
|
-
Promise.all(e.map((t) => a.removeApi(t))).catch(
|
|
49
|
-
(t) => console.error("Semantic remove (apis):", t)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
removeCollections(e) {
|
|
53
|
-
if (!this.aiEnabled || e.length === 0) return;
|
|
54
|
-
const a = g();
|
|
55
|
-
Promise.all(e.map((t) => a.removeCollection(t))).catch(
|
|
56
|
-
(t) => console.error("Semantic remove (collections):", t)
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Starts watching the directory for changes.
|
|
61
|
-
*/
|
|
62
|
-
async start() {
|
|
63
|
-
if (this.watchPath) {
|
|
64
|
-
console.warn("Watcher already started for:", this.watchPath);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
this.unlistenEvent = await y("fs-watch-event", async (e) => {
|
|
69
|
-
const a = e.payload;
|
|
70
|
-
try {
|
|
71
|
-
await this.handleEvent(a);
|
|
72
|
-
} catch (t) {
|
|
73
|
-
console.error("Error handling file change:", t);
|
|
74
|
-
}
|
|
75
|
-
}), await m("fs_watch", {
|
|
76
|
-
path: this.projectDir,
|
|
77
|
-
options: {
|
|
78
|
-
recursive: !0,
|
|
79
|
-
delayMs: 500
|
|
80
|
-
}
|
|
81
|
-
}), this.watchPath = this.projectDir;
|
|
82
|
-
} catch (e) {
|
|
83
|
-
throw console.error("Failed to start file watcher:", e), this.unlistenEvent && (this.unlistenEvent(), this.unlistenEvent = null), e;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Stops watching and cleans up resources.
|
|
88
|
-
*/
|
|
89
|
-
async stop() {
|
|
90
|
-
if (this.watchPath)
|
|
91
|
-
try {
|
|
92
|
-
await m("fs_unwatch", { path: this.watchPath });
|
|
93
|
-
} catch (e) {
|
|
94
|
-
console.error("Error stopping file watcher:", e);
|
|
95
|
-
} finally {
|
|
96
|
-
this.unlistenEvent && (this.unlistenEvent(), this.unlistenEvent = null), this.watchPath = null;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Main event handler - dispatches to specific handlers based on event type.
|
|
101
|
-
*/
|
|
102
|
-
async handleEvent(e) {
|
|
103
|
-
const { changeType: a, paths: t, pathTypes: i, type: s } = e;
|
|
104
|
-
if (await this.isProjectFolderRemoved(t, a)) {
|
|
105
|
-
await this.handleProjectFolderRemoval();
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const o = this.filterSpecFiles(t, i);
|
|
109
|
-
if (o.paths.length === 0)
|
|
110
|
-
return;
|
|
111
|
-
const n = await this.toFileEntries(o.paths, o.pathTypes);
|
|
112
|
-
switch (a) {
|
|
113
|
-
case "changed":
|
|
114
|
-
(s.includes("Data") || s.includes("Name")) && await this.handleModify(n);
|
|
115
|
-
break;
|
|
116
|
-
case "added":
|
|
117
|
-
await this.handleCreate(n);
|
|
118
|
-
break;
|
|
119
|
-
case "deleted":
|
|
120
|
-
await this.handleDelete(n);
|
|
121
|
-
break;
|
|
122
|
-
case "renamed":
|
|
123
|
-
await this.handleRename(n);
|
|
124
|
-
break;
|
|
125
|
-
default:
|
|
126
|
-
console.log("Unhandled change type:", a);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Filter paths to only include yaml/json files.
|
|
131
|
-
* Returns filtered paths and their corresponding pathTypes.
|
|
132
|
-
*/
|
|
133
|
-
filterSpecFiles(e, a) {
|
|
134
|
-
const t = [], i = [];
|
|
135
|
-
for (let s = 0; s < e.length; s++) {
|
|
136
|
-
const o = e[s], n = o.split(".").pop()?.toLowerCase();
|
|
137
|
-
n && ["yaml", "yml", "json"].includes(n) && (t.push(o), i.push(a[s] || "unknown"));
|
|
138
|
-
}
|
|
139
|
-
return { paths: t, pathTypes: i };
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Convert absolute paths to file entry format with relative paths and types.
|
|
143
|
-
*/
|
|
144
|
-
async toFileEntries(e, a) {
|
|
145
|
-
return Promise.all(
|
|
146
|
-
e.map(async (t, i) => ({
|
|
147
|
-
relative_path: await E.relative(this.projectDir, t),
|
|
148
|
-
absolute_path: t,
|
|
149
|
-
type: a[i] || "unknown"
|
|
150
|
-
}))
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
hasEnvironmentsFileChange(e) {
|
|
154
|
-
return !this.storage.isWatchExcluded(d) && e.some((a) => a.relative_path === d);
|
|
155
|
-
}
|
|
156
|
-
withoutEnvironmentsFile(e) {
|
|
157
|
-
return e.filter((a) => a.relative_path !== d);
|
|
158
|
-
}
|
|
159
|
-
consolidateFileEntries(e) {
|
|
160
|
-
const a = [], t = /* @__PURE__ */ new Set();
|
|
161
|
-
for (const i of e)
|
|
162
|
-
t.has(i.relative_path) || (t.add(i.relative_path), this.storage.isWatchExcluded(i.relative_path) || a.push(i));
|
|
163
|
-
return a;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Handles file content modification events.
|
|
167
|
-
* If file doesn't exist in state yet, treat as creation.
|
|
168
|
-
*/
|
|
169
|
-
async handleModify(e) {
|
|
170
|
-
const a = this.hasEnvironmentsFileChange(e), t = this.withoutEnvironmentsFile(e), { newApiFiles: i, existingApiFiles: s } = this.categorizeApisFromFiles(t), { newCollectionFiles: o, existingCollectionFiles: n } = this.categorizeCollectionsFromFiles(t), r = await this.findApisToReload(e), c = await this.findCollectionsToReload(e), p = [...i, ...o];
|
|
171
|
-
p.length > 0 && await this.handleCreate(p), a && await this.reloadEnvironments();
|
|
172
|
-
const u = this.consolidateFileEntries([...s, ...r]), f = this.consolidateFileEntries([
|
|
173
|
-
...n,
|
|
174
|
-
...c
|
|
175
|
-
]);
|
|
176
|
-
await this.reloadApis(u), await this.reloadCollections(f);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Handles file creation events.
|
|
180
|
-
* If file already exists in state, update it instead of creating duplicate.
|
|
181
|
-
*/
|
|
182
|
-
async handleCreate(e) {
|
|
183
|
-
this.hasEnvironmentsFileChange(e) && await this.reloadEnvironments();
|
|
184
|
-
const a = this.withoutEnvironmentsFile(e), t = a.filter((c) => c.type === "api"), i = a.filter((c) => c.type === "collection"), { newApiFiles: s, existingApiFiles: o } = this.categorizeApisFromFiles(t), { newCollectionFiles: n, existingCollectionFiles: r } = this.categorizeCollectionsFromFiles(i);
|
|
185
|
-
if (s.length > 0 || n.length > 0) {
|
|
186
|
-
s.forEach((h) => this.storage.addPersistExcludedId(h.relative_path)), n.forEach((h) => this.storage.addPersistExcludedId(h.relative_path));
|
|
187
|
-
const c = s.length > 0 ? await this.tauriStorage.loadAndParseApis(s, void 0, !0) : [], p = n.length > 0 ? await this.tauriStorage.loadAndParseCollections(n, void 0) : [], u = c.filter((h) => h !== null), f = p.filter((h) => h !== null);
|
|
188
|
-
this.apis.set([...this.apis.get(), ...u]), this.collections.set([...this.collections.get(), ...f]), this.indexApis(u), this.indexCollections(f), setTimeout(() => {
|
|
189
|
-
s.forEach((h) => this.storage.removePersistExcludedId(h.relative_path)), n.forEach(
|
|
190
|
-
(h) => this.storage.removePersistExcludedId(h.relative_path)
|
|
191
|
-
);
|
|
192
|
-
}, 500);
|
|
193
|
-
}
|
|
194
|
-
o.length > 0 && await this.reloadApis(o), r.length > 0 && await this.reloadCollections(r);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Categorize API paths into new vs existing
|
|
198
|
-
*/
|
|
199
|
-
/**
|
|
200
|
-
* Categorize API files into new vs existing
|
|
201
|
-
*/
|
|
202
|
-
categorizeApisFromFiles(e) {
|
|
203
|
-
const a = /* @__PURE__ */ new Set(), t = [], i = [];
|
|
204
|
-
for (const s of e) {
|
|
205
|
-
if (a.has(s.relative_path))
|
|
206
|
-
continue;
|
|
207
|
-
a.add(s.relative_path), this.apis.get().some((n) => n.id === s.relative_path) ? i.push(s) : s.type === "api" && t.push(s);
|
|
208
|
-
}
|
|
209
|
-
return { newApiFiles: t, existingApiFiles: i };
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Categorize collection files into new vs existing
|
|
213
|
-
*/
|
|
214
|
-
categorizeCollectionsFromFiles(e) {
|
|
215
|
-
const a = /* @__PURE__ */ new Set(), t = [], i = [];
|
|
216
|
-
for (const s of e) {
|
|
217
|
-
if (a.has(s.relative_path))
|
|
218
|
-
continue;
|
|
219
|
-
a.add(s.relative_path), this.collections.get().some((n) => n.id === s.relative_path) ? i.push(s) : s.type === "collection" && t.push(s);
|
|
220
|
-
}
|
|
221
|
-
return { newCollectionFiles: t, existingCollectionFiles: i };
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Handles file deletion events.
|
|
225
|
-
*/
|
|
226
|
-
async handleDelete(e) {
|
|
227
|
-
this.hasEnvironmentsFileChange(e) && await this.reloadEnvironments();
|
|
228
|
-
const a = [], t = [];
|
|
229
|
-
for (const i of this.withoutEnvironmentsFile(e)) {
|
|
230
|
-
this.storage.addPersistExcludedId(i.relative_path);
|
|
231
|
-
const s = this.apis.get();
|
|
232
|
-
s.some((r) => r.id === i.relative_path) && (this.apis.set(s.filter((r) => r.id !== i.relative_path)), this.tauriStorage.deleteApiFromCache(i.relative_path), a.push(i.relative_path));
|
|
233
|
-
const o = this.collections.get(), n = o.findIndex(
|
|
234
|
-
(r) => r.id === i.relative_path
|
|
235
|
-
);
|
|
236
|
-
n >= 0 && (this.collections.set(o.filter((r, c) => c !== n)), t.push(i.relative_path)), setTimeout(() => {
|
|
237
|
-
this.storage.removePersistExcludedId(i.relative_path);
|
|
238
|
-
}, 500);
|
|
239
|
-
}
|
|
240
|
-
this.removeApis(a), this.removeCollections(t);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Handles file rename/move events.
|
|
244
|
-
* For rename events, files typically contains [oldFile, newFile]
|
|
245
|
-
*/
|
|
246
|
-
async handleRename(e) {
|
|
247
|
-
if (e.length >= 2) {
|
|
248
|
-
const [a, t] = e;
|
|
249
|
-
await this.handleDelete([a]), await this.handleCreate([t]);
|
|
250
|
-
} else
|
|
251
|
-
await this.handleCreate(e);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Checks if the project folder itself was renamed/moved/deleted.
|
|
255
|
-
* This happens when:
|
|
256
|
-
* - We get a rename/delete event for the project directory itself
|
|
257
|
-
* - Or when paths no longer match the watched directory structure
|
|
258
|
-
*/
|
|
259
|
-
async isProjectFolderRemoved(e, a) {
|
|
260
|
-
if (e.length === 0)
|
|
261
|
-
return !1;
|
|
262
|
-
if (a === "deleted" || a === "renamed") {
|
|
263
|
-
for (const i of e)
|
|
264
|
-
if (i === this.projectDir)
|
|
265
|
-
return !0;
|
|
266
|
-
}
|
|
267
|
-
return e.filter(
|
|
268
|
-
(i) => !i.startsWith(this.projectDir + "/") && i !== this.projectDir
|
|
269
|
-
).length > 0 && a === "renamed";
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Handles the case when the entire project folder is renamed or deleted.
|
|
273
|
-
* Clears all APIs and collections from state.
|
|
274
|
-
*/
|
|
275
|
-
async handleProjectFolderRemoval() {
|
|
276
|
-
const e = this.apis.get(), a = e.map((s) => s.id);
|
|
277
|
-
e.forEach((s) => {
|
|
278
|
-
this.storage.addPersistExcludedId(s.id), this.tauriStorage.deleteApiFromCache(s.id);
|
|
279
|
-
}), this.apis.set([]);
|
|
280
|
-
const t = this.collections.get(), i = t.map((s) => s.id);
|
|
281
|
-
t.forEach((s) => {
|
|
282
|
-
this.storage.addPersistExcludedId(s.id);
|
|
283
|
-
}), this.collections.set([]), setTimeout(() => {
|
|
284
|
-
e.forEach((s) => this.storage.removePersistExcludedId(s.id)), t.forEach((s) => this.storage.removePersistExcludedId(s.id));
|
|
285
|
-
}, 500), this.removeApis(a), this.removeCollections(i), await this.stop();
|
|
286
|
-
}
|
|
287
|
-
async findApisToReload(e) {
|
|
288
|
-
const a = [];
|
|
289
|
-
return await Promise.all(
|
|
290
|
-
this.apis.get().map(async (t) => {
|
|
291
|
-
const i = t.fileDependencies ?? /* @__PURE__ */ new Set(), s = t.id, o = e.find((n) => i.has(n.absolute_path));
|
|
292
|
-
if (!this.storage.isWatchExcluded(s) && o) {
|
|
293
|
-
const n = await E.join(this.projectDir, s);
|
|
294
|
-
a.push({
|
|
295
|
-
relative_path: s,
|
|
296
|
-
absolute_path: n,
|
|
297
|
-
type: "api"
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
})
|
|
301
|
-
), a;
|
|
302
|
-
}
|
|
303
|
-
async findCollectionsToReload(e) {
|
|
304
|
-
const a = [];
|
|
305
|
-
return await Promise.all(
|
|
306
|
-
this.collections.get().map(async (t) => {
|
|
307
|
-
const i = t.fileDependencies ?? /* @__PURE__ */ new Set(), s = t.id, o = e.find((n) => i.has(n.absolute_path));
|
|
308
|
-
if (!this.storage.isWatchExcluded(s) && o) {
|
|
309
|
-
const n = await E.join(this.projectDir, s);
|
|
310
|
-
a.push({
|
|
311
|
-
relative_path: s,
|
|
312
|
-
absolute_path: n,
|
|
313
|
-
type: "collection"
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
})
|
|
317
|
-
), a;
|
|
318
|
-
}
|
|
319
|
-
async reloadEnvironments() {
|
|
320
|
-
const e = await this.tauriStorage.readEnviroments();
|
|
321
|
-
this.storage.addPersistExcludedId(d), this.setEnvironments(e.length > 0 ? e : F(C)), this.storage.publishEnvironmentsConfigError(), setTimeout(() => {
|
|
322
|
-
this.storage.removePersistExcludedId(d);
|
|
323
|
-
}, 500);
|
|
324
|
-
}
|
|
325
|
-
async reloadApis(e) {
|
|
326
|
-
if (e.length === 0) return;
|
|
327
|
-
const a = await this.tauriStorage.loadAndParseApis(e, void 0, !0), t = [];
|
|
328
|
-
await Promise.all(
|
|
329
|
-
a.map(async (i, s) => {
|
|
330
|
-
if (!i) {
|
|
331
|
-
await this.handleDelete([e[s]]);
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
const o = this.apis.get();
|
|
335
|
-
o.some((n) => n.id === i.id) ? (this.storage.addPersistExcludedId(i.id), this.apis.set(o.map((n) => n.id === i.id ? i : n)), t.push(i), setTimeout(() => this.storage.removePersistExcludedId(i.id), 500)) : console.warn("API not found in state after reload:", i.id);
|
|
336
|
-
})
|
|
337
|
-
), t.length > 0 && this.indexApis(t);
|
|
338
|
-
}
|
|
339
|
-
async reloadCollections(e) {
|
|
340
|
-
if (e.length === 0) return;
|
|
341
|
-
const a = await this.tauriStorage.loadAndParseCollections(e, void 0), t = [];
|
|
342
|
-
await Promise.all(
|
|
343
|
-
a.map(async (i, s) => {
|
|
344
|
-
if (!i) {
|
|
345
|
-
await this.handleDelete([e[s]]);
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
const o = this.collections.get(), n = o.findIndex((r) => r.id === i.id);
|
|
349
|
-
n >= 0 ? (this.storage.addPersistExcludedId(i.id), this.collections.set(
|
|
350
|
-
o.map(
|
|
351
|
-
(r, c) => c === n ? i : r
|
|
352
|
-
)
|
|
353
|
-
), t.push(i), setTimeout(() => this.storage.removePersistExcludedId(i.id), 500)) : console.warn("Collection not found in state after reload:", i.id);
|
|
354
|
-
})
|
|
355
|
-
), t.length > 0 && this.indexCollections(t);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
export {
|
|
359
|
-
D as FileWatcher
|
|
360
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("./replay-index-B8Zfn7JD.js"),J=require("./replay-Observable-bjJ6wkRB.js"),ee=require("./replay-promise-map-limit-DRDkHc-b.js");function g(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&"raw"in t&&typeof t.raw=="string"?t.raw:String(t)}function $(t){return t.replace(/\s+/g," ").trim()}function S(t){return typeof t=="object"&&t!==null&&"$ref"in t}function P(t){return S(t)?null:t}function q(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 F(t){return t.type?Array.isArray(t.type)?t.type.join("|"):t.type:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":"object"}function te(t){return t==="querystring"?"query":t==="query"||t==="header"||t==="path"||t==="cookie"?t:"query"}function ne(t){const e=t.schema&&!S(t.schema)?t.schema:null,n={name:t.name,in:te(t.in),required:t.required??!1};return e&&(n.type=F(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=g(t.description)),t.example!==void 0&&!n.example&&(n.example=String(t.example)),n}function ie(t,e){const n=new Set,o=[],s=i=>{for(const r of i){const c=P(r);if(!c||!c.name)continue;const a=`${c.in}:${c.name}`;n.has(a)||(n.add(a),o.push(ne(c)))}};return t.parameters&&s(t.parameters),e.parameters&&s(e.parameters),o}function L(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:F(i),required:o.has(s),readOnly:i.readOnly}))}function G(t){const e=t.components?.securitySchemes;if(!e)return[];const n=[];for(const[o,s]of Object.entries(e)){const i=P(s);i&&n.push(oe(o,i))}return n}function oe(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 r=e.flows[i];r?.scopes&&Object.keys(r.scopes).forEach(c=>s.add(c))}s.size>0&&(n.scopes=[...s].join(", "))}return n}function se(t,e,n){const o=t??e;if(!o||n.length===0)return[];const s=new Set;for(const i of o)for(const r of Object.keys(i))s.add(r);return n.filter(i=>s.has(i.schemeName))}function re(t){return t.length===0?"":`Security: ${t.map(n=>{let o=`${n.schemeName} (${n.type}`;return n.scheme&&(o+=`, ${n.scheme}`),n.in&&n.name&&(o+=`, ${n.name} in ${n.in}`),o+=")",o}).join("; ")}.`}const ce=["get","put","post","delete","options","head","patch","trace"],ae=["query","x-query"];function le(t,e){const n=[],o=Object.keys(t.content??{});if(o.length===0)return{textPart:"",schemaJson:"{}",examples:n};const s=o.find(u=>u.includes("json"))??o[0],i=t.content?.[s],r=i?.schema&&!S(i.schema)?i.schema:null,a=(r?L(r):[]).filter(u=>!e.hideReadOnly||!u.readOnly),p=t.required?"required":"optional";let l=`Request body (${s}, ${p})`;if(a.length>0){const u=a.map(f=>`${f.name}: ${f.type}${f.required?" required":""}${f.readOnly?" readOnly":""}`);l+=`: {${u.join(", ")}}`}return i?.example!==void 0&&n.push(q(i.example)),{textPart:l,schemaJson:JSON.stringify(a),examples:n}}function de(t){const e=[],n=[];for(const[o,s]of Object.entries(t)){if(S(s))continue;const i=g(s.description??"");e.push(`${o} ${i}`.trim());const r={statusCode:o};i&&(r.description=i);const c=s.content;if(c){const a=Object.keys(c).find(l=>l.includes("json"))??Object.keys(c)[0],p=c[a]?.schema;if(p&&!S(p)){const l=L(p);l.length>0&&(r.schemaProperties=JSON.stringify(l))}}n.push(r)}return{textParts:e,summaries:n}}function D(t){const{apiId:e,apiTitle:n,path:o,method:s,op:i,pathItem:r,globalSchemes:c,apiSecurity:a}=t,p=i.summary??"",l=g(i.description??""),u=i.operationId??"",f=i.tags??[],m=s.toUpperCase(),I=ie(i,r),h=se(i.security,a,c),y=h.length>0?h.map(v=>`api_sec:${e}:${v.schemeName}`):void 0,x=[n,`${m} ${o}`,p,l];u&&x.push(`operationId: ${u}`),f.length>0&&x.push(`Tags: ${f.join(", ")}`),i.deprecated&&x.push("DEPRECATED"),I.length>0&&x.push(`Parameters: ${I.map(U).join(". ")}.`);let A;const _=[],B=i.requestBody;if(B){const v=P(B);if(v){const b=le(v,{hideReadOnly:m==="POST"||m==="PUT"||m==="PATCH"});b.textPart&&x.push(b.textPart),A=b.schemaJson,_.push(...b.examples)}}const{textParts:C,summaries:E}=de(i.responses??{});C.length>0&&x.push(`Responses: ${C.join(", ")}.`);const R=re(h);R&&x.push(R);const M=`api_op:${e}:${o}:${s}:${u||`${o}-${s}`}`,V={type:"api_operation",id:M,contentHash:"",title:p||`${m} ${o}`,description:l||void 0,apiId:e,path:o,method:m,operationId:u||void 0,tags:f.length>0?f:void 0,deprecated:i.deprecated||void 0,parameterDetails:I.length>0?I:void 0,requestBodySchema:A,responseSchemas:E.length>0?E:void 0,securitySchemeRefs:y,examples:_.length>0?_:void 0};return{id:M,text:$(x.filter(Boolean).join(" ")),payload:V}}function W(t){const e=t.info?.title??"Untitled API",n=g(t.info?.description??t.info?.summary??""),o=t.id;return{id:`api:${o}`,text:$([e,n].filter(Boolean).join(" ")),payload:{type:"api",id:`api:${o}`,contentHash:"",title:e,description:n||void 0,apiId:o}}}function T(t){const e=[];for(const n of t){e.push(W(n));const o=n.info?.title??"Untitled API",s=n.id,i=G(n);for(const c of i){const a=`api_sec:${s}:${c.schemeName}`,p=[`${c.schemeName}: type=${c.type}`,c.scheme?`scheme=${c.scheme}`:"",c.in&&c.name?`${c.name} in ${c.in}`:"",c.bearerFormat?`format=${c.bearerFormat}`:"",c.flows?`flows=[${c.flows}]`:"",c.scopes?`scopes=[${c.scopes}]`:""].filter(Boolean).join(" ");e.push({id:a,text:$(`${o} Authentication. ${c.schemeName}. ${p}.`),payload:{type:"api_security",id:a,contentHash:"",title:`${o} — ${c.schemeName}`,apiId:s,securityScheme:c}})}const r=n.paths??{};for(const[c,a]of Object.entries(r)){if(!a||typeof a!="object")continue;const p=[...ce.filter(u=>u in a),...ae.filter(u=>u in a)];for(const u of p){const f=a[u];!f||typeof f!="object"||e.push(D({apiId:s,apiTitle:o,path:c,method:u,op:f,pathItem:a,globalSchemes:i,apiSecurity:n.security}))}const l=a.additionalOperations;if(l&&typeof l=="object")for(const[u,f]of Object.entries(l))!f||typeof f!="object"||e.push(D({apiId:s,apiTitle:o,path:c,method:u,op:f,pathItem:a,globalSchemes:i,apiSecurity:n.security}))}}return e}function ue(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 r=i;e.push({name:r.key,in:s,required:!1})}return e}function Q(t){const e=t.id,n=t.info?.title??"Untitled Collection",o=g(t.info?.description??t.info?.summary??"");return{id:`collection:${e}`,text:$([n,o].filter(Boolean).join(" ")),payload:{type:"collection",id:`collection:${e}`,contentHash:"",title:n,description:o||void 0,collectionId:e}}}function X(t){const{collectionId:e,collectionTitle:n,workflow:o}=t,s=o.workflowId??"",i=o.summary??s,r=g(o.description??""),c=[n,i,r];if(o.inputs&&c.push(`Inputs schema: ${q(o.inputs)}`),o.outputs?.length){const a=o.outputs.map(p=>p.key).filter(Boolean);a.length&&c.push(`Outputs: ${a.join(", ")}`)}return o.dependsOn?.length&&c.push(`Depends on: ${o.dependsOn.join(", ")}`),{id:`workflow:${e}:${s}`,text:$(c.filter(Boolean).join(" ")),payload:{type:"workflow",id:`workflow:${e}:${s}`,contentHash:"",title:i,description:r||void 0,collectionId:e,workflowId:s}}}function K(t){const{collectionId:e,collectionTitle:n,workflowId:o,workflowTitle:s,step:i}=t,r=i.stepId??"",c=g(i.description??""),a=i.operation,p=i.xOperation,l=[n,s,`step: ${r}`];c&&l.push(c),a?(l.push(`${a.method?.toUpperCase()} ${a.path}`),a.apiId&&l.push(`API: ${a.apiId}`),a.operationId&&l.push(`operationId: ${a.operationId}`)):p&&l.push(`${p.method?.toUpperCase()} ${p.url}`);const u=i.parameters?ue(i.parameters):[];u.length>0&&l.push(`Parameters: ${u.map(U).join(". ")}.`),i.requestBody?.type&&l.push(`Request body type: ${i.requestBody.type}`);const m=(i.successCriteria??[]).map(h=>{let y=h.condition;return h.context&&(y+=` context: ${h.context}`),h.type&&(y+=` (${h.type})`),y});if(m.length>0&&l.push(`Success criteria: ${m.join("; ")}`),i.outputs?.length){const h=i.outputs.map(y=>`${y.key}=${y.value}`).filter(Boolean);h.length&&l.push(`Outputs: ${h.join(", ")}`)}const I=`step:${e}:${o}:${r}`;return{id:I,text:$(l.filter(Boolean).join(" ")),payload:{type:"step",id:I,contentHash:"",title:r,description:c||void 0,collectionId:e,workflowId:o,stepId:r,path:a?.path??p?.url,method:(a?.method??p?.method)?.toUpperCase(),apiId:a?.apiId,operationId:a?.operationId,parameterDetails:u.length>0?u:void 0,successCriteria:m.length>0?m:void 0,requestBodySchema:i.requestBody?.type?q(i.requestBody):void 0}}}function j(t){const e=[];for(const n of t){const o=n.id,s=n.info?.title??"Untitled Collection";e.push(Q(n));for(const i of n.workflows??[]){e.push(X({collectionId:o,collectionTitle:s,workflow:i}));const r=i.workflowId??"",c=i.summary??r;for(const a of i.steps??[])e.push(K({collectionId:o,collectionTitle:s,workflowId:r,workflowTitle:c,step:a}))}}return e}function Y(t,e){return[...T(t),...j(e)]}const N=10,pe=4;function H(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return e>>>0}function fe(t){return d.bytesToHex(d.md5(t))}const he={};class me extends J.Observable{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 d.invoke("semantic_search_get_ids_by_payload",{collectionName:this.collectionName,field:e,value:n})}async getAllIds(){return d.invoke("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 r=[];for(const a of n)r.push(this.getIdsByPayload("apiId",a));for(const a of o)r.push(this.getIdsByPayload("collectionId",a));s=(await Promise.all(r)).flat()}const i=new Map;for(const r of s)i.set(r.id,r.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 r=0,c=0;for(const l of e){const u=fe(l.text);l.payload.contentHash=u,i.add(l.id);const f=o.get(l.id);f===u?c++:(f||r++,s.push(l))}const a=s.length-r,p=[];for(const l of o.keys())i.has(l)||p.push(l);if(p.length>0||s.length>0){this.beginIndexJob();try{p.length>0&&await this.deletePoints(p.map(H)),s.length>0&&await this.embedAndUpsert(s),await this.flush()}finally{this.endIndexJob()}}return{added:r,updated:a,removed:p.length,unchanged:c}}async removeByPayloadFilter(e,n){return d.invoke("semantic_search_delete_by_payload",{collectionName:this.collectionName,field:e,value:n})}async getStoredDocumentCount(){try{return(await d.invoke("plugin:velesdb|list_collections"))?.find(o=>o.name===this.collectionName)?.count??0}catch{return 0}}async getDocumentsByIds(e){if(e.length===0)return new Map;const n=e.map(H),o=await d.invoke("plugin:velesdb|get_points",{request:{collection:this.collectionName,ids:n}}),s=new Map;for(const i of o??[])if(i?.payload){const r=i.payload;r.id&&s.set(r.id,r)}return s}async embedAndUpsert(e){const n=[],o=e.length;for(let s=0;s<o;s+=N)n.push({docs:e.slice(s,s+N),index:Math.floor(s/N)});await ee.promiseMapLimit(n,pe,async s=>{const i=s.docs.map(r=>({id:r.id,text:r.text||r.payload.title,payload:r.payload}));await d.invoke("semantic_search_embed_and_upsert",{collectionName:this.collectionName,documents:i})})}async deletePoints(e){e.length!==0&&await d.invoke("plugin:velesdb|delete_points",{request:{collection:this.collectionName,ids:e}})}async flush(){await d.invoke("plugin:velesdb|flush",{name:this.collectionName}),await d.invoke("semantic_search_write_hnsw_marker",{collectionName:this.collectionName}).catch(()=>{})}}const z="replay_search",ye=384,w={added:0,updated:0,removed:0,unchanged:0};function k(t){return t.added+t.updated>0}class Z extends J.Observable{initialized=!1;projectId=null;indexer=null;indexQueue=Promise.resolve();get collectionName(){return this.projectId?`${z}_${this.projectId}`:z}createIndexer(){const e=new me(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 s=this.indexQueue.then(()=>e()).then(async i=>(n(i)&&await this.unloadModel(),i)).catch(async i=>{throw console.error("Semantic index:",i),await this.unloadModel(),i});return this.indexQueue=s.catch(()=>{}),s}async unloadModel(){try{await d.invoke("semantic_search_unload_model")}catch{}}setProject(e){this.projectId!==e&&(this.projectId=e,this.initialized=!1,this.indexer=this.createIndexer())}async init(){if(d.isTauriApp()&&!this.initialized){try{if((await d.invoke("plugin:velesdb|list_collections"))?.some(n=>n.name===this.collectionName)){this.initialized=!0;return}}catch{}await d.invoke("plugin:velesdb|create_collection",{request:{name:this.collectionName,dimension:ye,metric:"cosine",storage_mode:"full"}}),this.initialized=!0}}async indexApis(e){if(!d.isTauriApp())return w;const n=this.collectionName,o=this.getIndexer(),s=T(e),i={apiIds:e.map(r=>r.id)};return await this.ensureInitialized(),this.enqueueIndex(async()=>this.collectionName!==n?w:o.indexDocuments(s,i),k)}async indexCollections(e){if(!d.isTauriApp())return w;const n=this.collectionName,o=this.getIndexer(),s=j(e),i={collectionIds:e.map(r=>r.id)};return await this.ensureInitialized(),this.enqueueIndex(async()=>this.collectionName!==n?w:o.indexDocuments(s,i),k)}async removeApi(e){if(!d.isTauriApp())return;const n=this.getIndexer();await this.ensureInitialized(),await this.enqueueIndex(()=>n.removeByPayloadFilter("apiId",e),()=>!1)}async removeCollection(e){if(!d.isTauriApp())return;const n=this.getIndexer();await this.ensureInitialized(),await this.enqueueIndex(()=>n.removeByPayloadFilter("collectionId",e),()=>!1)}async reindex(e){if(!d.isTauriApp())return w;const n=this.collectionName,o=this.getIndexer();return await this.ensureInitialized(),this.enqueueIndex(async()=>{if(this.collectionName!==n)return w;const{apis:s,collections:i}=e(),r=Y(s,i);return o.indexDocuments(r,he)},k)}async search(e,n=10,o){if(!d.isTauriApp())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,r=((await d.invoke("semantic_search_text",{collection:this.collectionName,query:e,topK:n,filters:s})).results??[]).map(c=>({...c.payload,score:c.score??0}));return await this.enrichWithRelatedSecurity(r),r}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 r=[];for(const c of i.securitySchemeRefs??[]){const a=s.get(c);a?.securityScheme&&r.push(a.securityScheme)}r.length>0&&(i.relatedSecuritySchemes=r)}}async status(){if(!d.isTauriApp())return{indexed:0,modelLoaded:!1};const e=await this.getIndexer().getStoredDocumentCount();let n=!1;try{n=(await d.invoke("semantic_search_model_status")).loaded}catch{}return{indexed:e,modelLoaded:n}}async clear(){if(!(!d.isTauriApp()||!this.initialized))try{await d.invoke("plugin:velesdb|delete_collection",{name:this.collectionName}),this.initialized=!1}catch{}}async preloadModel(){if(d.isTauriApp())try{await d.invoke("semantic_search_preload_model")}catch{}}}let O=null;function xe(){return O||(O=new Z),O}exports.SemanticSearchService=Z;exports.extractAllDocuments=Y;exports.extractApiDocument=W;exports.extractApiDocuments=T;exports.extractCollectionDocument=Q;exports.extractCollectionDocuments=j;exports.extractGlobalSecuritySchemes=G;exports.extractOperationDocument=D;exports.extractStepDocument=K;exports.extractWorkflowDocument=X;exports.getSemanticSearchService=xe;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./replay-index-B8Zfn7JD.js"),c=require("./replay-Observable-bjJ6wkRB.js"),o=new Set(["node_modules"]);class l extends c.Observable{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}baseDir;writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await s.mkdir(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 s.readDir(e);for(const r of i)if(r.isDirectory){if(o.has(r.name))continue;const n=await s.join(e,r.name),a=await this.getDirEntryFilesRecursively(n);t.push(...a)}else{const n=await s.join(e,r.name),a=await s.PathUtils.relative(this.baseDir,n);t.push(a)}return t}catch(t){return t.includes("forbidden path")||console.error(t),[]}}async get(e){const t=await this.getFullPath(e);try{return await s.readTextFile(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 s.exists(t)}async set(e,t){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const i=await this.getFullPath(e),r=s.sep(),n=i.split(r).slice(0,-1).join(r);await s.mkdir(n,{recursive:!0}),await s.writeTextFile(i,t)}finally{const i=this.writeEndTimers.get(e);i&&clearTimeout(i);const r=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,r)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const t=await this.getFullPath(e);await s.remove(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),r=await this.getFullPath(t);await s.rename(i,r)}async getFullPath(e){return await s.join(this.baseDir,e??"")}}exports.TauriFileSystemAdapter=l;
|