@redocly/replay 0.28.0-next.7 → 0.28.0-next.9
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-Dib77evR.js → replay-AiChatProvider-B_f9Wn8a.js} +1 -1
- package/dist/{replay-AiChatProvider-CL61KEj-.js → replay-AiChatProvider-DuTK5g1N.js} +41 -41
- package/dist/{replay-AiChatSqliteDBStorage-CAB-uQ_2.js → replay-AiChatSqliteDBStorage-CHfMo6M6.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-BmHRaty6.js → replay-AiChatSqliteDBStorage-cXsRIQfJ.js} +6 -6
- package/dist/{replay-AiPanel-CKf0GTch.js → replay-AiPanel-CGbGwIMX.js} +35 -35
- package/dist/{replay-AiPanel-Co-SG9hy.js → replay-AiPanel-C_C52r20.js} +1 -1
- package/dist/replay-FileWatcher-DEOB0_DG.js +1 -0
- package/dist/{replay-FileWatcher-BpncVTHg.js → replay-FileWatcher-Z6eygcBI.js} +4 -5
- package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
- package/dist/{replay-SemanticSearchService-B_97hbQZ.js → replay-SemanticSearchService-BLF1oOOu.js} +8 -12
- package/dist/replay-SemanticSearchService-DTc0oxN4.js +1 -0
- package/dist/{replay-SqliteDBStorage-BYAD4Hdr.js → replay-SqliteDBStorage-B_kyJ0a3.js} +1 -1
- package/dist/{replay-SqliteDBStorage-C4jv_awl.js → replay-SqliteDBStorage-DF9kKplR.js} +49 -49
- package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
- package/dist/{replay-TauriFileSystemAdapter-DNp7rTwA.js → replay-TauriFileSystemAdapter-CwSMakdJ.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-dRydQRfd.js → replay-TauriFileSystemAdapter-DcFBYSUW.js} +8 -8
- package/dist/{replay-TauriRootStorage-TvtzeQ9x.js → replay-TauriRootStorage-DEGEIJrz.js} +1 -1
- package/dist/{replay-TauriRootStorage-BUSjQzb0.js → replay-TauriRootStorage-Den8gI4S.js} +85 -85
- package/dist/{replay-agent-loop-Bv3OEM5Y.js → replay-agent-loop-B8Mjb8DU.js} +9 -9
- package/dist/{replay-agent-loop-FONgy9Lo.js → replay-agent-loop-Z_nrrmg_.js} +1 -1
- package/dist/{replay-ai-chat-mappers-Kj9YEXwF.js → replay-ai-chat-mappers-D7e8buTk.js} +3 -3
- package/dist/{replay-ai-chat-mappers-CknwkJ22.js → replay-ai-chat-mappers-aJ_VMb6Z.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-DgfhU1ps.js → replay-create-model-Be3vPVDb.js} +3 -3
- package/dist/{replay-create-model-Bq8Fl5Ai.js → replay-create-model-Bw20x80b.js} +3 -3
- package/dist/{replay-db-DjHsvWMQ.js → replay-db-BQXljNM0.js} +1 -1
- package/dist/{replay-db-D3MZ3YVw.js → replay-db-BmZNrdZM.js} +5 -5
- package/dist/{replay-external-resolver-DgcgzfRI.js → replay-external-resolver-BLzbbtnT.js} +1 -1
- package/dist/{replay-external-resolver-SsE1pZoq.js → replay-external-resolver-BQvSDNfH.js} +7 -7
- package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
- package/dist/{replay-index-l3GM4sbc.js → replay-index-B-uZhXHj.js} +1 -1
- package/dist/{replay-index-B-Z3hRlH.js → replay-index-BCz452N6.js} +16025 -15956
- package/dist/{replay-index-DzrZDRUX.js → replay-index-C0kvTxxm.js} +38 -38
- package/dist/{replay-index-eABpOyfi.js → replay-index-C7y4K4Cr.js} +1 -1
- package/dist/replay-index-DAIwC3ls.js +1 -0
- package/dist/{replay-index-AEsPADo_.js → replay-index-DYtXcqDk.js} +1014 -1010
- package/dist/replay-index-gM6vL6iT.js +4 -0
- package/dist/{replay-index-BJ5jmb2F.js → replay-index-wBHsAQEV.js} +1 -1
- package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
- package/dist/replay-lint-BzkTeXqI.js +177 -0
- package/dist/{replay-lint-BHwuW5sm.js → replay-lint-CqDMOMQt.js} +11038 -10749
- package/dist/{replay-lint-graphql-taKxgtqM.js → replay-lint-graphql-BDBGJSir.js} +1 -1
- package/dist/{replay-lint-graphql-CcbpryHy.js → replay-lint-graphql-BZF2eLiZ.js} +1 -1
- package/dist/replay-periodic-revalidation-C7SkB1vs.js +1 -0
- package/dist/{replay-periodic-revalidation-CEMQo8s1.js → replay-periodic-revalidation-orCv_JoF.js} +4 -5
- package/dist/{replay-resolve-DJdvx14A.js → replay-resolve-0e5f8I7b.js} +18 -18
- package/dist/{replay-resolve-CSzH6SDp.js → replay-resolve-DZMWoig2.js} +176 -176
- package/dist/replay-respect-run-CLW3wGhx.js +8392 -0
- package/dist/replay-respect-run-ChP63WzG.js +82 -0
- package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
- package/dist/{replay-tauri-path-D_hXMLdc.js → replay-tauri-path-DBt1dqkG.js} +1 -1
- package/dist/replay-tauri-path-DvLF4Z8f.js +22 -0
- package/dist/{replay-useAiChatQueries-DVCG23XB.js → replay-useAiChatQueries-Bypgnkwa.js} +2 -2
- package/dist/{replay-useAiChatQueries-DFd8ZJQG.js → replay-useAiChatQueries-S6v5duiJ.js} +131 -137
- package/dist/{replay-validate-key-fIEjvAUc.js → replay-validate-key-CMJODIH6.js} +2 -2
- package/dist/{replay-validate-key-qqV8ZWzl.js → replay-validate-key-CNl7BV_v.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +10 -10
- package/package.json +4 -4
- package/dist/replay-FileWatcher-BpsHu7xD.js +0 -1
- package/dist/replay-SemanticSearchService-B9YYS_s4.js +0 -1
- package/dist/replay-index-B3h5Szid.js +0 -25
- package/dist/replay-index-C04sCExL.js +0 -1
- package/dist/replay-lint-7nMI-JAv.js +0 -177
- package/dist/replay-periodic-revalidation-Cg2y1tgz.js +0 -1
- package/dist/replay-respect-run-DTUpcIOb.js +0 -78
- package/dist/replay-respect-run-gVY8_9EV.js +0 -8200
- package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
- package/dist/replay-tauri-path-C-oZvov6.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./replay-index-AEsPADo_.js"),Y=require("./replay-promise-map-limit-DRDkHc-b.js"),G=require("./replay-TauriFileSystemAdapter-DNp7rTwA.js");var U={exports:{}},V;function oe(){return V||(V=1,(function(s){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function n(a,u,h){this.fn=a,this.context=u,this.once=h||!1}function o(a,u,h,f,g){if(typeof h!="function")throw new TypeError("The listener must be a function");var y=new n(h,f||a,g),v=t?t+u:u;return a._events[v]?a._events[v].fn?a._events[v]=[a._events[v],y]:a._events[v].push(y):(a._events[v]=y,a._eventsCount++),a}function d(a,u){--a._eventsCount===0?a._events=new r:delete a._events[u]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var u=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},c.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var g=0,y=f.length,v=new Array(y);g<y;g++)v[g]=f[g].fn;return v},c.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},c.prototype.emit=function(u,h,f,g,y,v){var b=t?t+u:u;if(!this._events[b])return!1;var l=this._events[b],T=arguments.length,Q,w;if(l.fn){switch(l.once&&this.removeListener(u,l.fn,void 0,!0),T){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,h),!0;case 3:return l.fn.call(l.context,h,f),!0;case 4:return l.fn.call(l.context,h,f,g),!0;case 5:return l.fn.call(l.context,h,f,g,y),!0;case 6:return l.fn.call(l.context,h,f,g,y,v),!0}for(w=1,Q=new Array(T-1);w<T;w++)Q[w-1]=arguments[w];l.fn.apply(l.context,Q)}else{var ae=l.length,x;for(w=0;w<ae;w++)switch(l[w].once&&this.removeListener(u,l[w].fn,void 0,!0),T){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,h);break;case 3:l[w].fn.call(l[w].context,h,f);break;case 4:l[w].fn.call(l[w].context,h,f,g);break;default:if(!Q)for(x=1,Q=new Array(T-1);x<T;x++)Q[x-1]=arguments[x];l[w].fn.apply(l[w].context,Q)}}return!0},c.prototype.on=function(u,h,f){return o(this,u,h,f,!1)},c.prototype.once=function(u,h,f){return o(this,u,h,f,!0)},c.prototype.removeListener=function(u,h,f,g){var y=t?t+u:u;if(!this._events[y])return this;if(!h)return d(this,y),this;var v=this._events[y];if(v.fn)v.fn===h&&(!g||v.once)&&(!f||v.context===f)&&d(this,y);else{for(var b=0,l=[],T=v.length;b<T;b++)(v[b].fn!==h||g&&!v[b].once||f&&v[b].context!==f)&&l.push(v[b]);l.length?this._events[y]=l.length===1?l[0]:l:d(this,y)}return this},c.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&d(this,h)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=t,c.EventEmitter=c,s.exports=c})(U)),U.exports}var ue=oe();const le=p.getDefaultExportFromCjs(ue);class re extends Error{constructor(e){super(e),this.name="TimeoutError"}}let ce=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const J=s=>globalThis.DOMException===void 0?new ce(s):new DOMException(s),H=s=>{const e=s.reason===void 0?J("This operation was aborted."):s.reason;return e instanceof Error?e:J(e)};function he(s,e,t,r){let n;const o=new Promise((d,c)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){d(s);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){const{signal:a}=r;a.aborted&&c(H(a)),a.addEventListener("abort",()=>{c(H(a))})}n=r.customTimers.setTimeout.call(void 0,()=>{const a=`Promise timed out after ${e} milliseconds`,u=t instanceof Error?t:new re(a);typeof s.cancel=="function"&&s.cancel(),c(u)},e),(async()=>{try{d(await s)}catch(a){c(a)}finally{r.customTimers.clearTimeout.call(void 0,n)}})()});return o.clear=()=>{clearTimeout(n),n=void 0},o}function fe(s,e,t){let r=0,n=s.length;for(;n>0;){const o=Math.trunc(n/2);let d=r+o;t(s[d],e)<=0?(r=++d,n-=o+1):n=o}return r}var F=function(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)},A;class de{constructor(){A.set(this,[])}enqueue(e,t){t={priority:0,...t};const r={priority:t.priority,run:e};if(this.size&&F(this,A,"f")[this.size-1].priority>=t.priority){F(this,A,"f").push(r);return}const n=fe(F(this,A,"f"),r,(o,d)=>d.priority-o.priority);F(this,A,"f").splice(n,0,r)}dequeue(){const e=F(this,A,"f").shift();return e?.run}filter(e){return F(this,A,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return F(this,A,"f").length}}A=new WeakMap;var m=function(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t},i=function(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)},_,L,M,I,R,N,z,E,O,P,k,S,W,C,q,X,Z,ie,ee,te,D,B,K,$,se,j;class ne extends Error{}class pe extends le{constructor(e){var t,r,n,o;if(super(),_.add(this),L.set(this,void 0),M.set(this,void 0),I.set(this,0),R.set(this,void 0),N.set(this,void 0),z.set(this,0),E.set(this,void 0),O.set(this,void 0),P.set(this,void 0),k.set(this,void 0),S.set(this,0),W.set(this,void 0),C.set(this,void 0),q.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:de,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(n=e.interval)===null||n===void 0?void 0:n.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);m(this,L,e.carryoverConcurrencyCount,"f"),m(this,M,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),m(this,R,e.intervalCap,"f"),m(this,N,e.interval,"f"),m(this,P,new e.queueClass,"f"),m(this,k,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,m(this,q,e.throwOnTimeout===!0,"f"),m(this,C,e.autoStart===!1,"f")}get concurrency(){return i(this,W,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);m(this,W,e,"f"),i(this,_,"m",$).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:i(this,q,"f"),...t},new Promise((r,n)=>{i(this,P,"f").enqueue(async()=>{var o,d,c;m(this,S,(d=i(this,S,"f"),d++,d),"f"),m(this,I,(c=i(this,I,"f"),c++,c),"f");try{if(!((o=t.signal)===null||o===void 0)&&o.aborted)throw new ne("The task was aborted.");let a=e({signal:t.signal});t.timeout&&(a=he(Promise.resolve(a),t.timeout)),t.signal&&(a=Promise.race([a,i(this,_,"m",se).call(this,t.signal)]));const u=await a;r(u),this.emit("completed",u)}catch(a){if(a instanceof re&&!t.throwOnTimeout){r();return}n(a),this.emit("error",a)}finally{i(this,_,"m",ie).call(this)}},t),this.emit("add"),i(this,_,"m",D).call(this)})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return i(this,C,"f")?(m(this,C,!1,"f"),i(this,_,"m",$).call(this),this):this}pause(){m(this,C,!0,"f")}clear(){m(this,P,new(i(this,k,"f")),"f")}async onEmpty(){i(this,P,"f").size!==0&&await i(this,_,"m",j).call(this,"empty")}async onSizeLessThan(e){i(this,P,"f").size<e||await i(this,_,"m",j).call(this,"next",()=>i(this,P,"f").size<e)}async onIdle(){i(this,S,"f")===0&&i(this,P,"f").size===0||await i(this,_,"m",j).call(this,"idle")}get size(){return i(this,P,"f").size}sizeBy(e){return i(this,P,"f").filter(e).length}get pending(){return i(this,S,"f")}get isPaused(){return i(this,C,"f")}}L=new WeakMap,M=new WeakMap,I=new WeakMap,R=new WeakMap,N=new WeakMap,z=new WeakMap,E=new WeakMap,O=new WeakMap,P=new WeakMap,k=new WeakMap,S=new WeakMap,W=new WeakMap,C=new WeakMap,q=new WeakMap,_=new WeakSet,X=function(){return i(this,M,"f")||i(this,I,"f")<i(this,R,"f")},Z=function(){return i(this,S,"f")<i(this,W,"f")},ie=function(){var e;m(this,S,(e=i(this,S,"f"),e--,e),"f"),i(this,_,"m",D).call(this),this.emit("next")},ee=function(){i(this,_,"m",K).call(this),i(this,_,"m",B).call(this),m(this,O,void 0,"f")},te=function(){const e=Date.now();if(i(this,E,"f")===void 0){const t=i(this,z,"f")-e;if(t<0)m(this,I,i(this,L,"f")?i(this,S,"f"):0,"f");else return i(this,O,"f")===void 0&&m(this,O,setTimeout(()=>{i(this,_,"m",ee).call(this)},t),"f"),!0}return!1},D=function(){if(i(this,P,"f").size===0)return i(this,E,"f")&&clearInterval(i(this,E,"f")),m(this,E,void 0,"f"),this.emit("empty"),i(this,S,"f")===0&&this.emit("idle"),!1;if(!i(this,C,"f")){const e=!i(this,_,"a",te);if(i(this,_,"a",X)&&i(this,_,"a",Z)){const t=i(this,P,"f").dequeue();return t?(this.emit("active"),t(),e&&i(this,_,"m",B).call(this),!0):!1}}return!1},B=function(){i(this,M,"f")||i(this,E,"f")!==void 0||(m(this,E,setInterval(()=>{i(this,_,"m",K).call(this)},i(this,N,"f")),"f"),m(this,z,Date.now()+i(this,N,"f"),"f"))},K=function(){i(this,I,"f")===0&&i(this,S,"f")===0&&i(this,E,"f")&&(clearInterval(i(this,E,"f")),m(this,E,void 0,"f")),m(this,I,i(this,L,"f")?i(this,S,"f"):0,"f"),i(this,_,"m",$).call(this)},$=function(){for(;i(this,_,"m",D).call(this););},se=async function(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(new ne("The task was aborted."))},{once:!0})})},j=async function(e,t){return new Promise(r=>{const n=()=>{t&&!t()||(this.off(e,n),r())};this.on(e,n)})};class ve{constructor(e){this.apisStorage=e}apisStorage;data=new Map;loading=new Set;pQueue=new pe({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,t=!1){this.data.has(e)&&!t||await this.loadAndParse(e,t)}async loadAndParse(e,t=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}t&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const r=p.isWebUrl(e)?p.SourceType.WEB:p.SourceType.FS,n=r===p.SourceType.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:d}=await p.loadAndBundleDefinition(n);if(!o){this.data.set(e,null),await p.clearNotificationsForSource(e);return}const c=this.apisStorage.parse({uri:e,type:r,content:o});this.data.set(e,{...c,fileDependencies:d}),await p.clearNotificationsForSource(e)}catch(o){if(this.data.set(e,null),o instanceof Error&&(o.message.includes("Unsupported specification")||o.message.includes("File not found"))){await p.clearNotificationsForSource(e);return}console.info("Error loading api "+e,o),await p.reportParseError(e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}class me extends p.RootStorage{apiLoader;constructor(e,t,r){const n=new G.TauriFileSystemAdapter(e.systemFilesDir),o=new G.TauriFileSystemAdapter(e.userFilesDir);super(n,o,e,!0,!1,t,r),this.apiLoader=new ve(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",t=>{this.addWatchExcludedId(t)}),e.on("write-end",t=>{this.removeWatchExcludedId(t)})}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[p.createResource("storageOperation","read","storage")],void 0),t=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[p.createResource("storageOperation","loadUserState","storage")],e?.parentCtx),[r,n,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);t?.setAttribute("status","completed"),t?.setAttribute("environmentCount",o.length),t?.setStatus(p.SpanStatusCode.OK),t?.end();const{apiFiles:d,collectionFiles:c}=await this.detectProjectFiles(e);await this.loadAndParseApis(d,e);const u=(await this.loadAndParseCollections(c,e)).filter(f=>f!==null),h=this.apiLoader.getAll();return e?.setAttribute("status","completed"),e?.setStatus(p.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:n,environments:o,apis:h,collections:u}}async detectProjectFiles(e){const t=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[p.createResource("storageOperation","detectFiles","storage")],e?.parentCtx),{api_files:r,collection_files:n}=await p.invoke("fs_scan",{dir:this.project.userFilesDir});return t?.setAttribute("status","completed"),t?.setAttribute("filesCount",r.length+n.length),t?.setAttribute("apiFilesCount",r.length),t?.setAttribute("collectionFilesCount",n.length),t?.setStatus(p.SpanStatusCode.OK),t?.end(),{apiFiles:r,collectionFiles:n}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,t,r=!1){const n=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...p.createResource("storageOperation","parseApis","storage"),apisCount:e.length}],t?.parentCtx),o=await Y.promiseMapLimit(e,20,async d=>{try{return await this.apiLoader.load(d.relative_path,r),this.apiLoader.get(d.relative_path)}catch(c){return console.info(`Error parsing YAML/JSON file ${d.absolute_path}:`,c),await p.reportParseError(d.relative_path,c),null}});return n?.setAttribute("status","completed"),n?.setAttribute("parsedApisCount",this.apiLoader.size),n?.setStatus(p.SpanStatusCode.OK),n?.end(),o}async loadAndParseCollections(e,t){const r=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...p.createResource("storageOperation","parseCollections","storage"),collectionsCount:e.length}],t?.parentCtx),n=await Y.promiseMapLimit(e,20,async o=>{try{const d=await this.userFilesStorage.get(o.relative_path);if(!d)return null;const c=p.yaml.load(d);if(typeof c!="object"||c===null||typeof c.arazzo!="string")return await p.clearNotificationsForSource(o.relative_path),null;const a=[];await Promise.all(c.sourceDescriptions?.map(async f=>{const g=f.type,y=f.url,v=!g||g==="openapi",b=await p.apiUrlToApiId({projectPath:this.project.userFilesDir,apiUrl:y,collectionId:o.relative_path});if(v){const l=await this.apiLoader.get(b);l&&a.push(l)}}));const u=await p.PathUtils.join(this.project.userFilesDir,o.relative_path),h=await this.collectionsStorage.parse({uri:o.relative_path,type:p.SourceType.FS,content:c,fileDependencies:new Set([u])},a);return await p.clearNotificationsForSource(o.relative_path),h}catch(d){return console.info(`Error parsing Arazzo file ${o.relative_path}:`,d),await p.reportParseError(o.relative_path,d),null}});return r?.setAttribute("status","completed"),r?.setAttribute("parsedCollectionsCount",n.length),r?.setStatus(p.SpanStatusCode.OK),r?.end(),n}}exports.TauriRootStorage=me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./replay-index-DYtXcqDk.js"),Y=require("./replay-promise-map-limit-DRDkHc-b.js"),G=require("./replay-TauriFileSystemAdapter-CwSMakdJ.js");var U={exports:{}},V;function oe(){return V||(V=1,(function(s){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function n(a,u,h){this.fn=a,this.context=u,this.once=h||!1}function o(a,u,h,f,g){if(typeof h!="function")throw new TypeError("The listener must be a function");var y=new n(h,f||a,g),v=t?t+u:u;return a._events[v]?a._events[v].fn?a._events[v]=[a._events[v],y]:a._events[v].push(y):(a._events[v]=y,a._eventsCount++),a}function d(a,u){--a._eventsCount===0?a._events=new r:delete a._events[u]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var u=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},c.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var g=0,y=f.length,v=new Array(y);g<y;g++)v[g]=f[g].fn;return v},c.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},c.prototype.emit=function(u,h,f,g,y,v){var b=t?t+u:u;if(!this._events[b])return!1;var l=this._events[b],T=arguments.length,Q,w;if(l.fn){switch(l.once&&this.removeListener(u,l.fn,void 0,!0),T){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,h),!0;case 3:return l.fn.call(l.context,h,f),!0;case 4:return l.fn.call(l.context,h,f,g),!0;case 5:return l.fn.call(l.context,h,f,g,y),!0;case 6:return l.fn.call(l.context,h,f,g,y,v),!0}for(w=1,Q=new Array(T-1);w<T;w++)Q[w-1]=arguments[w];l.fn.apply(l.context,Q)}else{var ae=l.length,x;for(w=0;w<ae;w++)switch(l[w].once&&this.removeListener(u,l[w].fn,void 0,!0),T){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,h);break;case 3:l[w].fn.call(l[w].context,h,f);break;case 4:l[w].fn.call(l[w].context,h,f,g);break;default:if(!Q)for(x=1,Q=new Array(T-1);x<T;x++)Q[x-1]=arguments[x];l[w].fn.apply(l[w].context,Q)}}return!0},c.prototype.on=function(u,h,f){return o(this,u,h,f,!1)},c.prototype.once=function(u,h,f){return o(this,u,h,f,!0)},c.prototype.removeListener=function(u,h,f,g){var y=t?t+u:u;if(!this._events[y])return this;if(!h)return d(this,y),this;var v=this._events[y];if(v.fn)v.fn===h&&(!g||v.once)&&(!f||v.context===f)&&d(this,y);else{for(var b=0,l=[],T=v.length;b<T;b++)(v[b].fn!==h||g&&!v[b].once||f&&v[b].context!==f)&&l.push(v[b]);l.length?this._events[y]=l.length===1?l[0]:l:d(this,y)}return this},c.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&d(this,h)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=t,c.EventEmitter=c,s.exports=c})(U)),U.exports}var ue=oe();const le=p.getDefaultExportFromCjs(ue);class re extends Error{constructor(e){super(e),this.name="TimeoutError"}}let ce=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const J=s=>globalThis.DOMException===void 0?new ce(s):new DOMException(s),H=s=>{const e=s.reason===void 0?J("This operation was aborted."):s.reason;return e instanceof Error?e:J(e)};function he(s,e,t,r){let n;const o=new Promise((d,c)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){d(s);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){const{signal:a}=r;a.aborted&&c(H(a)),a.addEventListener("abort",()=>{c(H(a))})}n=r.customTimers.setTimeout.call(void 0,()=>{const a=`Promise timed out after ${e} milliseconds`,u=t instanceof Error?t:new re(a);typeof s.cancel=="function"&&s.cancel(),c(u)},e),(async()=>{try{d(await s)}catch(a){c(a)}finally{r.customTimers.clearTimeout.call(void 0,n)}})()});return o.clear=()=>{clearTimeout(n),n=void 0},o}function fe(s,e,t){let r=0,n=s.length;for(;n>0;){const o=Math.trunc(n/2);let d=r+o;t(s[d],e)<=0?(r=++d,n-=o+1):n=o}return r}var F=function(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)},A;class de{constructor(){A.set(this,[])}enqueue(e,t){t={priority:0,...t};const r={priority:t.priority,run:e};if(this.size&&F(this,A,"f")[this.size-1].priority>=t.priority){F(this,A,"f").push(r);return}const n=fe(F(this,A,"f"),r,(o,d)=>d.priority-o.priority);F(this,A,"f").splice(n,0,r)}dequeue(){const e=F(this,A,"f").shift();return e?.run}filter(e){return F(this,A,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return F(this,A,"f").length}}A=new WeakMap;var m=function(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t},i=function(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)},_,L,M,I,R,N,z,E,O,P,k,S,W,C,q,X,Z,ie,ee,te,D,B,K,$,se,j;class ne extends Error{}class pe extends le{constructor(e){var t,r,n,o;if(super(),_.add(this),L.set(this,void 0),M.set(this,void 0),I.set(this,0),R.set(this,void 0),N.set(this,void 0),z.set(this,0),E.set(this,void 0),O.set(this,void 0),P.set(this,void 0),k.set(this,void 0),S.set(this,0),W.set(this,void 0),C.set(this,void 0),q.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:de,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(n=e.interval)===null||n===void 0?void 0:n.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);m(this,L,e.carryoverConcurrencyCount,"f"),m(this,M,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),m(this,R,e.intervalCap,"f"),m(this,N,e.interval,"f"),m(this,P,new e.queueClass,"f"),m(this,k,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,m(this,q,e.throwOnTimeout===!0,"f"),m(this,C,e.autoStart===!1,"f")}get concurrency(){return i(this,W,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);m(this,W,e,"f"),i(this,_,"m",$).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:i(this,q,"f"),...t},new Promise((r,n)=>{i(this,P,"f").enqueue(async()=>{var o,d,c;m(this,S,(d=i(this,S,"f"),d++,d),"f"),m(this,I,(c=i(this,I,"f"),c++,c),"f");try{if(!((o=t.signal)===null||o===void 0)&&o.aborted)throw new ne("The task was aborted.");let a=e({signal:t.signal});t.timeout&&(a=he(Promise.resolve(a),t.timeout)),t.signal&&(a=Promise.race([a,i(this,_,"m",se).call(this,t.signal)]));const u=await a;r(u),this.emit("completed",u)}catch(a){if(a instanceof re&&!t.throwOnTimeout){r();return}n(a),this.emit("error",a)}finally{i(this,_,"m",ie).call(this)}},t),this.emit("add"),i(this,_,"m",D).call(this)})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return i(this,C,"f")?(m(this,C,!1,"f"),i(this,_,"m",$).call(this),this):this}pause(){m(this,C,!0,"f")}clear(){m(this,P,new(i(this,k,"f")),"f")}async onEmpty(){i(this,P,"f").size!==0&&await i(this,_,"m",j).call(this,"empty")}async onSizeLessThan(e){i(this,P,"f").size<e||await i(this,_,"m",j).call(this,"next",()=>i(this,P,"f").size<e)}async onIdle(){i(this,S,"f")===0&&i(this,P,"f").size===0||await i(this,_,"m",j).call(this,"idle")}get size(){return i(this,P,"f").size}sizeBy(e){return i(this,P,"f").filter(e).length}get pending(){return i(this,S,"f")}get isPaused(){return i(this,C,"f")}}L=new WeakMap,M=new WeakMap,I=new WeakMap,R=new WeakMap,N=new WeakMap,z=new WeakMap,E=new WeakMap,O=new WeakMap,P=new WeakMap,k=new WeakMap,S=new WeakMap,W=new WeakMap,C=new WeakMap,q=new WeakMap,_=new WeakSet,X=function(){return i(this,M,"f")||i(this,I,"f")<i(this,R,"f")},Z=function(){return i(this,S,"f")<i(this,W,"f")},ie=function(){var e;m(this,S,(e=i(this,S,"f"),e--,e),"f"),i(this,_,"m",D).call(this),this.emit("next")},ee=function(){i(this,_,"m",K).call(this),i(this,_,"m",B).call(this),m(this,O,void 0,"f")},te=function(){const e=Date.now();if(i(this,E,"f")===void 0){const t=i(this,z,"f")-e;if(t<0)m(this,I,i(this,L,"f")?i(this,S,"f"):0,"f");else return i(this,O,"f")===void 0&&m(this,O,setTimeout(()=>{i(this,_,"m",ee).call(this)},t),"f"),!0}return!1},D=function(){if(i(this,P,"f").size===0)return i(this,E,"f")&&clearInterval(i(this,E,"f")),m(this,E,void 0,"f"),this.emit("empty"),i(this,S,"f")===0&&this.emit("idle"),!1;if(!i(this,C,"f")){const e=!i(this,_,"a",te);if(i(this,_,"a",X)&&i(this,_,"a",Z)){const t=i(this,P,"f").dequeue();return t?(this.emit("active"),t(),e&&i(this,_,"m",B).call(this),!0):!1}}return!1},B=function(){i(this,M,"f")||i(this,E,"f")!==void 0||(m(this,E,setInterval(()=>{i(this,_,"m",K).call(this)},i(this,N,"f")),"f"),m(this,z,Date.now()+i(this,N,"f"),"f"))},K=function(){i(this,I,"f")===0&&i(this,S,"f")===0&&i(this,E,"f")&&(clearInterval(i(this,E,"f")),m(this,E,void 0,"f")),m(this,I,i(this,L,"f")?i(this,S,"f"):0,"f"),i(this,_,"m",$).call(this)},$=function(){for(;i(this,_,"m",D).call(this););},se=async function(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(new ne("The task was aborted."))},{once:!0})})},j=async function(e,t){return new Promise(r=>{const n=()=>{t&&!t()||(this.off(e,n),r())};this.on(e,n)})};class ve{constructor(e){this.apisStorage=e}apisStorage;data=new Map;loading=new Set;pQueue=new pe({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,t=!1){this.data.has(e)&&!t||await this.loadAndParse(e,t)}async loadAndParse(e,t=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}t&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const r=p.isWebUrl(e)?p.SourceType.WEB:p.SourceType.FS,n=r===p.SourceType.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:d}=await p.loadAndBundleDefinition(n);if(!o){this.data.set(e,null),await p.clearNotificationsForSource(e);return}const c=this.apisStorage.parse({uri:e,type:r,content:o});this.data.set(e,{...c,fileDependencies:d}),await p.clearNotificationsForSource(e)}catch(o){if(this.data.set(e,null),o instanceof Error&&(o.message.includes("Unsupported specification")||o.message.includes("File not found"))){await p.clearNotificationsForSource(e);return}console.info("Error loading api "+e,o),await p.reportParseError(e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}class me extends p.RootStorage{apiLoader;constructor(e,t,r){const n=new G.TauriFileSystemAdapter(e.systemFilesDir),o=new G.TauriFileSystemAdapter(e.userFilesDir);super(n,o,e,!0,!1,t,r),this.apiLoader=new ve(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",t=>{this.addWatchExcludedId(t)}),e.on("write-end",t=>{this.removeWatchExcludedId(t)})}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[p.createResource("storageOperation","read","storage")],void 0),t=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[p.createResource("storageOperation","loadUserState","storage")],e?.parentCtx),[r,n,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);t?.setAttribute("status","completed"),t?.setAttribute("environmentCount",o.length),t?.setStatus(p.SpanStatusCode.OK),t?.end();const{apiFiles:d,collectionFiles:c}=await this.detectProjectFiles(e);await this.loadAndParseApis(d,e);const u=(await this.loadAndParseCollections(c,e)).filter(f=>f!==null),h=this.apiLoader.getAll();return e?.setAttribute("status","completed"),e?.setStatus(p.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:n,environments:o,apis:h,collections:u}}async detectProjectFiles(e){const t=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[p.createResource("storageOperation","detectFiles","storage")],e?.parentCtx),{api_files:r,collection_files:n}=await p.invoke("fs_scan",{dir:this.project.userFilesDir});return t?.setAttribute("status","completed"),t?.setAttribute("filesCount",r.length+n.length),t?.setAttribute("apiFilesCount",r.length),t?.setAttribute("collectionFilesCount",n.length),t?.setStatus(p.SpanStatusCode.OK),t?.end(),{apiFiles:r,collectionFiles:n}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,t,r=!1){const n=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...p.createResource("storageOperation","parseApis","storage"),apisCount:e.length}],t?.parentCtx),o=await Y.promiseMapLimit(e,20,async d=>{try{return await this.apiLoader.load(d.relative_path,r),this.apiLoader.get(d.relative_path)}catch(c){return console.info(`Error parsing YAML/JSON file ${d.absolute_path}:`,c),await p.reportParseError(d.relative_path,c),null}});return n?.setAttribute("status","completed"),n?.setAttribute("parsedApisCount",this.apiLoader.size),n?.setStatus(p.SpanStatusCode.OK),n?.end(),o}async loadAndParseCollections(e,t){const r=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...p.createResource("storageOperation","parseCollections","storage"),collectionsCount:e.length}],t?.parentCtx),n=await Y.promiseMapLimit(e,20,async o=>{try{const d=await this.userFilesStorage.get(o.relative_path);if(!d)return null;const c=p.yaml.load(d);if(typeof c!="object"||c===null||typeof c.arazzo!="string")return await p.clearNotificationsForSource(o.relative_path),null;const a=[];await Promise.all(c.sourceDescriptions?.map(async f=>{const g=f.type,y=f.url,v=!g||g==="openapi",b=await p.apiUrlToApiId({projectPath:this.project.userFilesDir,apiUrl:y,collectionId:o.relative_path});if(v){const l=await this.apiLoader.get(b);l&&a.push(l)}}));const u=await p.PathUtils.join(this.project.userFilesDir,o.relative_path),h=await this.collectionsStorage.parse({uri:o.relative_path,type:p.SourceType.FS,content:c,fileDependencies:new Set([u])},a);return await p.clearNotificationsForSource(o.relative_path),h}catch(d){return console.info(`Error parsing Arazzo file ${o.relative_path}:`,d),await p.reportParseError(o.relative_path,d),null}});return r?.setAttribute("status","completed"),r?.setAttribute("parsedCollectionsCount",n.length),r?.setStatus(p.SpanStatusCode.OK),r?.end(),n}}exports.TauriRootStorage=me;
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as he, K as fe, L as D, N as de, O as W, Q as J, U as pe, E as F, C as O, i as ve, V as me, W as _e, P as we } from "./replay-index-BCz452N6.js";
|
|
2
2
|
import { p as H } from "./replay-promise-map-limit-Db_42GvV.js";
|
|
3
|
-
import { TauriFileSystemAdapter as X } from "./replay-TauriFileSystemAdapter-
|
|
4
|
-
var
|
|
3
|
+
import { TauriFileSystemAdapter as X } from "./replay-TauriFileSystemAdapter-DcFBYSUW.js";
|
|
4
|
+
var V = { exports: {} }, Z;
|
|
5
5
|
function ye() {
|
|
6
6
|
return Z || (Z = 1, (function(n) {
|
|
7
7
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
8
8
|
function r() {
|
|
9
9
|
}
|
|
10
10
|
Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
|
|
11
|
-
function i(a,
|
|
12
|
-
this.fn = a, this.context =
|
|
11
|
+
function i(a, u, h) {
|
|
12
|
+
this.fn = a, this.context = u, this.once = h || !1;
|
|
13
13
|
}
|
|
14
|
-
function o(a,
|
|
14
|
+
function o(a, u, h, f, y) {
|
|
15
15
|
if (typeof h != "function")
|
|
16
16
|
throw new TypeError("The listener must be a function");
|
|
17
|
-
var w = new i(h, f || a, y), p = t ? t +
|
|
17
|
+
var w = new i(h, f || a, y), p = t ? t + u : u;
|
|
18
18
|
return a._events[p] ? a._events[p].fn ? a._events[p] = [a._events[p], w] : a._events[p].push(w) : (a._events[p] = w, a._eventsCount++), a;
|
|
19
19
|
}
|
|
20
|
-
function d(a,
|
|
21
|
-
--a._eventsCount === 0 ? a._events = new r() : delete a._events[
|
|
20
|
+
function d(a, u) {
|
|
21
|
+
--a._eventsCount === 0 ? a._events = new r() : delete a._events[u];
|
|
22
22
|
}
|
|
23
23
|
function c() {
|
|
24
24
|
this._events = new r(), this._eventsCount = 0;
|
|
25
25
|
}
|
|
26
26
|
c.prototype.eventNames = function() {
|
|
27
|
-
var
|
|
28
|
-
if (this._eventsCount === 0) return
|
|
27
|
+
var u = [], h, f;
|
|
28
|
+
if (this._eventsCount === 0) return u;
|
|
29
29
|
for (f in h = this._events)
|
|
30
|
-
e.call(h, f) &&
|
|
31
|
-
return Object.getOwnPropertySymbols ?
|
|
32
|
-
}, c.prototype.listeners = function(
|
|
33
|
-
var h = t ? t +
|
|
30
|
+
e.call(h, f) && u.push(t ? f.slice(1) : f);
|
|
31
|
+
return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(h)) : u;
|
|
32
|
+
}, c.prototype.listeners = function(u) {
|
|
33
|
+
var h = t ? t + u : u, f = this._events[h];
|
|
34
34
|
if (!f) return [];
|
|
35
35
|
if (f.fn) return [f.fn];
|
|
36
36
|
for (var y = 0, w = f.length, p = new Array(w); y < w; y++)
|
|
37
37
|
p[y] = f[y].fn;
|
|
38
38
|
return p;
|
|
39
|
-
}, c.prototype.listenerCount = function(
|
|
40
|
-
var h = t ? t +
|
|
39
|
+
}, c.prototype.listenerCount = function(u) {
|
|
40
|
+
var h = t ? t + u : u, f = this._events[h];
|
|
41
41
|
return f ? f.fn ? 1 : f.length : 0;
|
|
42
|
-
}, c.prototype.emit = function(
|
|
43
|
-
var b = t ? t +
|
|
42
|
+
}, c.prototype.emit = function(u, h, f, y, w, p) {
|
|
43
|
+
var b = t ? t + u : u;
|
|
44
44
|
if (!this._events[b]) return !1;
|
|
45
|
-
var
|
|
46
|
-
if (
|
|
47
|
-
switch (
|
|
45
|
+
var l = this._events[b], A = arguments.length, T, _;
|
|
46
|
+
if (l.fn) {
|
|
47
|
+
switch (l.once && this.removeListener(u, l.fn, void 0, !0), A) {
|
|
48
48
|
case 1:
|
|
49
|
-
return
|
|
49
|
+
return l.fn.call(l.context), !0;
|
|
50
50
|
case 2:
|
|
51
|
-
return
|
|
51
|
+
return l.fn.call(l.context, h), !0;
|
|
52
52
|
case 3:
|
|
53
|
-
return
|
|
53
|
+
return l.fn.call(l.context, h, f), !0;
|
|
54
54
|
case 4:
|
|
55
|
-
return
|
|
55
|
+
return l.fn.call(l.context, h, f, y), !0;
|
|
56
56
|
case 5:
|
|
57
|
-
return
|
|
57
|
+
return l.fn.call(l.context, h, f, y, w), !0;
|
|
58
58
|
case 6:
|
|
59
|
-
return
|
|
59
|
+
return l.fn.call(l.context, h, f, y, w, p), !0;
|
|
60
60
|
}
|
|
61
61
|
for (_ = 1, T = new Array(A - 1); _ < A; _++)
|
|
62
62
|
T[_ - 1] = arguments[_];
|
|
63
|
-
|
|
63
|
+
l.fn.apply(l.context, T);
|
|
64
64
|
} else {
|
|
65
|
-
var ce =
|
|
65
|
+
var ce = l.length, x;
|
|
66
66
|
for (_ = 0; _ < ce; _++)
|
|
67
|
-
switch (
|
|
67
|
+
switch (l[_].once && this.removeListener(u, l[_].fn, void 0, !0), A) {
|
|
68
68
|
case 1:
|
|
69
|
-
|
|
69
|
+
l[_].fn.call(l[_].context);
|
|
70
70
|
break;
|
|
71
71
|
case 2:
|
|
72
|
-
|
|
72
|
+
l[_].fn.call(l[_].context, h);
|
|
73
73
|
break;
|
|
74
74
|
case 3:
|
|
75
|
-
|
|
75
|
+
l[_].fn.call(l[_].context, h, f);
|
|
76
76
|
break;
|
|
77
77
|
case 4:
|
|
78
|
-
|
|
78
|
+
l[_].fn.call(l[_].context, h, f, y);
|
|
79
79
|
break;
|
|
80
80
|
default:
|
|
81
81
|
if (!T) for (x = 1, T = new Array(A - 1); x < A; x++)
|
|
82
82
|
T[x - 1] = arguments[x];
|
|
83
|
-
|
|
83
|
+
l[_].fn.apply(l[_].context, T);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
return !0;
|
|
87
|
-
}, c.prototype.on = function(
|
|
88
|
-
return o(this,
|
|
89
|
-
}, c.prototype.once = function(
|
|
90
|
-
return o(this,
|
|
91
|
-
}, c.prototype.removeListener = function(
|
|
92
|
-
var w = t ? t +
|
|
87
|
+
}, c.prototype.on = function(u, h, f) {
|
|
88
|
+
return o(this, u, h, f, !1);
|
|
89
|
+
}, c.prototype.once = function(u, h, f) {
|
|
90
|
+
return o(this, u, h, f, !0);
|
|
91
|
+
}, c.prototype.removeListener = function(u, h, f, y) {
|
|
92
|
+
var w = t ? t + u : u;
|
|
93
93
|
if (!this._events[w]) return this;
|
|
94
94
|
if (!h)
|
|
95
95
|
return d(this, w), this;
|
|
@@ -97,16 +97,16 @@ function ye() {
|
|
|
97
97
|
if (p.fn)
|
|
98
98
|
p.fn === h && (!y || p.once) && (!f || p.context === f) && d(this, w);
|
|
99
99
|
else {
|
|
100
|
-
for (var b = 0,
|
|
101
|
-
(p[b].fn !== h || y && !p[b].once || f && p[b].context !== f) &&
|
|
102
|
-
|
|
100
|
+
for (var b = 0, l = [], A = p.length; b < A; b++)
|
|
101
|
+
(p[b].fn !== h || y && !p[b].once || f && p[b].context !== f) && l.push(p[b]);
|
|
102
|
+
l.length ? this._events[w] = l.length === 1 ? l[0] : l : d(this, w);
|
|
103
103
|
}
|
|
104
104
|
return this;
|
|
105
|
-
}, c.prototype.removeAllListeners = function(
|
|
105
|
+
}, c.prototype.removeAllListeners = function(u) {
|
|
106
106
|
var h;
|
|
107
|
-
return
|
|
107
|
+
return u ? (h = t ? t + u : u, this._events[h] && d(this, h)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
108
108
|
}, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = t, c.EventEmitter = c, n.exports = c;
|
|
109
|
-
})(
|
|
109
|
+
})(V)), V.exports;
|
|
110
110
|
}
|
|
111
111
|
var ge = ye();
|
|
112
112
|
const Pe = /* @__PURE__ */ he(ge);
|
|
@@ -143,8 +143,8 @@ function Ee(n, e, t, r) {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
i = r.customTimers.setTimeout.call(void 0, () => {
|
|
146
|
-
const a = `Promise timed out after ${e} milliseconds`,
|
|
147
|
-
typeof n.cancel == "function" && n.cancel(), c(
|
|
146
|
+
const a = `Promise timed out after ${e} milliseconds`, u = t instanceof Error ? t : new ae(a);
|
|
147
|
+
typeof n.cancel == "function" && n.cancel(), c(u);
|
|
148
148
|
}, e), (async () => {
|
|
149
149
|
try {
|
|
150
150
|
d(await n);
|
|
@@ -214,14 +214,14 @@ var v = function(n, e, t, r, i) {
|
|
|
214
214
|
if (t === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
215
215
|
if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
216
216
|
return t === "m" ? r : t === "a" ? r.call(n) : r ? r.value : e.get(n);
|
|
217
|
-
}, m, z, M, I,
|
|
218
|
-
class
|
|
217
|
+
}, m, z, M, I, K, N, j, E, L, g, q, P, k, C, $, re, se, oe, ne, ie, U, Y, G, B, ue, R;
|
|
218
|
+
class le extends Error {
|
|
219
219
|
}
|
|
220
220
|
class Ce extends Pe {
|
|
221
221
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
222
222
|
constructor(e) {
|
|
223
223
|
var t, r, i, o;
|
|
224
|
-
if (super(), m.add(this), z.set(this, void 0), M.set(this, void 0), I.set(this, 0),
|
|
224
|
+
if (super(), m.add(this), z.set(this, void 0), M.set(this, void 0), I.set(this, 0), K.set(this, void 0), N.set(this, void 0), j.set(this, 0), E.set(this, void 0), L.set(this, void 0), g.set(this, void 0), q.set(this, void 0), P.set(this, 0), k.set(this, void 0), C.set(this, void 0), $.set(this, void 0), Object.defineProperty(this, "timeout", {
|
|
225
225
|
enumerable: !0,
|
|
226
226
|
configurable: !0,
|
|
227
227
|
writable: !0,
|
|
@@ -238,7 +238,7 @@ class Ce extends Pe {
|
|
|
238
238
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r = (t = e.intervalCap) === null || t === void 0 ? void 0 : t.toString()) !== null && r !== void 0 ? r : ""}\` (${typeof e.intervalCap})`);
|
|
239
239
|
if (e.interval === void 0 || !(Number.isFinite(e.interval) && e.interval >= 0))
|
|
240
240
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o = (i = e.interval) === null || i === void 0 ? void 0 : i.toString()) !== null && o !== void 0 ? o : ""}\` (${typeof e.interval})`);
|
|
241
|
-
v(this, z, e.carryoverConcurrencyCount, "f"), v(this, M, e.intervalCap === Number.POSITIVE_INFINITY || e.interval === 0, "f"), v(this,
|
|
241
|
+
v(this, z, e.carryoverConcurrencyCount, "f"), v(this, M, e.intervalCap === Number.POSITIVE_INFINITY || e.interval === 0, "f"), v(this, K, e.intervalCap, "f"), v(this, N, e.interval, "f"), v(this, g, new e.queueClass(), "f"), v(this, q, e.queueClass, "f"), this.concurrency = e.concurrency, this.timeout = e.timeout, v(this, $, e.throwOnTimeout === !0, "f"), v(this, C, e.autoStart === !1, "f");
|
|
242
242
|
}
|
|
243
243
|
get concurrency() {
|
|
244
244
|
return s(this, k, "f");
|
|
@@ -246,7 +246,7 @@ class Ce extends Pe {
|
|
|
246
246
|
set concurrency(e) {
|
|
247
247
|
if (!(typeof e == "number" && e >= 1))
|
|
248
248
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);
|
|
249
|
-
v(this, k, e, "f"), s(this, m, "m",
|
|
249
|
+
v(this, k, e, "f"), s(this, m, "m", B).call(this);
|
|
250
250
|
}
|
|
251
251
|
async add(e, t = {}) {
|
|
252
252
|
return t = {
|
|
@@ -259,11 +259,11 @@ class Ce extends Pe {
|
|
|
259
259
|
v(this, P, (d = s(this, P, "f"), d++, d), "f"), v(this, I, (c = s(this, I, "f"), c++, c), "f");
|
|
260
260
|
try {
|
|
261
261
|
if (!((o = t.signal) === null || o === void 0) && o.aborted)
|
|
262
|
-
throw new
|
|
262
|
+
throw new le("The task was aborted.");
|
|
263
263
|
let a = e({ signal: t.signal });
|
|
264
|
-
t.timeout && (a = Ee(Promise.resolve(a), t.timeout)), t.signal && (a = Promise.race([a, s(this, m, "m",
|
|
265
|
-
const
|
|
266
|
-
r(
|
|
264
|
+
t.timeout && (a = Ee(Promise.resolve(a), t.timeout)), t.signal && (a = Promise.race([a, s(this, m, "m", ue).call(this, t.signal)]));
|
|
265
|
+
const u = await a;
|
|
266
|
+
r(u), this.emit("completed", u);
|
|
267
267
|
} catch (a) {
|
|
268
268
|
if (a instanceof ae && !t.throwOnTimeout) {
|
|
269
269
|
r();
|
|
@@ -273,7 +273,7 @@ class Ce extends Pe {
|
|
|
273
273
|
} finally {
|
|
274
274
|
s(this, m, "m", oe).call(this);
|
|
275
275
|
}
|
|
276
|
-
}, t), this.emit("add"), s(this, m, "m",
|
|
276
|
+
}, t), this.emit("add"), s(this, m, "m", U).call(this);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
async addAll(e, t) {
|
|
@@ -283,7 +283,7 @@ class Ce extends Pe {
|
|
|
283
283
|
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
284
284
|
*/
|
|
285
285
|
start() {
|
|
286
|
-
return s(this, C, "f") ? (v(this, C, !1, "f"), s(this, m, "m",
|
|
286
|
+
return s(this, C, "f") ? (v(this, C, !1, "f"), s(this, m, "m", B).call(this), this) : this;
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
289
289
|
Put queue execution on hold.
|
|
@@ -303,7 +303,7 @@ class Ce extends Pe {
|
|
|
303
303
|
@returns A promise that settles when the queue becomes empty.
|
|
304
304
|
*/
|
|
305
305
|
async onEmpty() {
|
|
306
|
-
s(this, g, "f").size !== 0 && await s(this, m, "m",
|
|
306
|
+
s(this, g, "f").size !== 0 && await s(this, m, "m", R).call(this, "empty");
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
309
309
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -313,7 +313,7 @@ class Ce extends Pe {
|
|
|
313
313
|
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
314
314
|
*/
|
|
315
315
|
async onSizeLessThan(e) {
|
|
316
|
-
s(this, g, "f").size < e || await s(this, m, "m",
|
|
316
|
+
s(this, g, "f").size < e || await s(this, m, "m", R).call(this, "next", () => s(this, g, "f").size < e);
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
@@ -321,7 +321,7 @@ class Ce extends Pe {
|
|
|
321
321
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
322
322
|
*/
|
|
323
323
|
async onIdle() {
|
|
324
|
-
s(this, P, "f") === 0 && s(this, g, "f").size === 0 || await s(this, m, "m",
|
|
324
|
+
s(this, P, "f") === 0 && s(this, g, "f").size === 0 || await s(this, m, "m", R).call(this, "idle");
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
Size of the queue, the number of queued items waiting to run.
|
|
@@ -350,15 +350,15 @@ class Ce extends Pe {
|
|
|
350
350
|
return s(this, C, "f");
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
z = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(),
|
|
354
|
-
return s(this, M, "f") || s(this, I, "f") < s(this,
|
|
353
|
+
z = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakSet(), re = function() {
|
|
354
|
+
return s(this, M, "f") || s(this, I, "f") < s(this, K, "f");
|
|
355
355
|
}, se = function() {
|
|
356
356
|
return s(this, P, "f") < s(this, k, "f");
|
|
357
357
|
}, oe = function() {
|
|
358
358
|
var e;
|
|
359
|
-
v(this, P, (e = s(this, P, "f"), e--, e), "f"), s(this, m, "m",
|
|
359
|
+
v(this, P, (e = s(this, P, "f"), e--, e), "f"), s(this, m, "m", U).call(this), this.emit("next");
|
|
360
360
|
}, ne = function() {
|
|
361
|
-
s(this, m, "m",
|
|
361
|
+
s(this, m, "m", G).call(this), s(this, m, "m", Y).call(this), v(this, L, void 0, "f");
|
|
362
362
|
}, ie = function() {
|
|
363
363
|
const e = Date.now();
|
|
364
364
|
if (s(this, E, "f") === void 0) {
|
|
@@ -371,33 +371,33 @@ z = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), I = /* @__
|
|
|
371
371
|
}, t), "f"), !0;
|
|
372
372
|
}
|
|
373
373
|
return !1;
|
|
374
|
-
},
|
|
374
|
+
}, U = function() {
|
|
375
375
|
if (s(this, g, "f").size === 0)
|
|
376
376
|
return s(this, E, "f") && clearInterval(s(this, E, "f")), v(this, E, void 0, "f"), this.emit("empty"), s(this, P, "f") === 0 && this.emit("idle"), !1;
|
|
377
377
|
if (!s(this, C, "f")) {
|
|
378
378
|
const e = !s(this, m, "a", ie);
|
|
379
379
|
if (s(this, m, "a", re) && s(this, m, "a", se)) {
|
|
380
380
|
const t = s(this, g, "f").dequeue();
|
|
381
|
-
return t ? (this.emit("active"), t(), e && s(this, m, "m",
|
|
381
|
+
return t ? (this.emit("active"), t(), e && s(this, m, "m", Y).call(this), !0) : !1;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
return !1;
|
|
385
|
-
},
|
|
385
|
+
}, Y = function() {
|
|
386
386
|
s(this, M, "f") || s(this, E, "f") !== void 0 || (v(this, E, setInterval(() => {
|
|
387
|
-
s(this, m, "m",
|
|
387
|
+
s(this, m, "m", G).call(this);
|
|
388
388
|
}, s(this, N, "f")), "f"), v(this, j, Date.now() + s(this, N, "f"), "f"));
|
|
389
|
-
},
|
|
390
|
-
s(this, I, "f") === 0 && s(this, P, "f") === 0 && s(this, E, "f") && (clearInterval(s(this, E, "f")), v(this, E, void 0, "f")), v(this, I, s(this, z, "f") ? s(this, P, "f") : 0, "f"), s(this, m, "m",
|
|
391
|
-
},
|
|
392
|
-
for (; s(this, m, "m",
|
|
389
|
+
}, G = function() {
|
|
390
|
+
s(this, I, "f") === 0 && s(this, P, "f") === 0 && s(this, E, "f") && (clearInterval(s(this, E, "f")), v(this, E, void 0, "f")), v(this, I, s(this, z, "f") ? s(this, P, "f") : 0, "f"), s(this, m, "m", B).call(this);
|
|
391
|
+
}, B = function() {
|
|
392
|
+
for (; s(this, m, "m", U).call(this); )
|
|
393
393
|
;
|
|
394
|
-
},
|
|
394
|
+
}, ue = async function(e) {
|
|
395
395
|
return new Promise((t, r) => {
|
|
396
396
|
e.addEventListener("abort", () => {
|
|
397
|
-
r(new
|
|
397
|
+
r(new le("The task was aborted."));
|
|
398
398
|
}, { once: !0 });
|
|
399
399
|
});
|
|
400
|
-
},
|
|
400
|
+
}, R = async function(e, t) {
|
|
401
401
|
return new Promise((r) => {
|
|
402
402
|
const i = () => {
|
|
403
403
|
t && !t() || (this.off(e, i), r());
|
|
@@ -498,14 +498,14 @@ class Oe extends pe {
|
|
|
498
498
|
t?.setAttribute("status", "completed"), t?.setAttribute("environmentCount", o.length), t?.setStatus(O.OK), t?.end();
|
|
499
499
|
const { apiFiles: d, collectionFiles: c } = await this.detectProjectFiles(e);
|
|
500
500
|
await this.loadAndParseApis(d, e);
|
|
501
|
-
const
|
|
501
|
+
const u = (await this.loadAndParseCollections(c, e)).filter((f) => f !== null), h = this.apiLoader.getAll();
|
|
502
502
|
return e?.setAttribute("status", "completed"), e?.setStatus(O.OK), e?.end(), {
|
|
503
503
|
project: this.project,
|
|
504
504
|
activeEnvironmentId: r,
|
|
505
505
|
tabsState: i,
|
|
506
506
|
environments: o,
|
|
507
507
|
apis: h,
|
|
508
|
-
collections:
|
|
508
|
+
collections: u
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
async detectProjectFiles(e) {
|
|
@@ -574,12 +574,12 @@ class Oe extends pe {
|
|
|
574
574
|
collectionId: o.relative_path
|
|
575
575
|
});
|
|
576
576
|
if (p) {
|
|
577
|
-
const
|
|
578
|
-
|
|
577
|
+
const l = await this.apiLoader.get(b);
|
|
578
|
+
l && a.push(l);
|
|
579
579
|
}
|
|
580
580
|
})
|
|
581
581
|
);
|
|
582
|
-
const
|
|
582
|
+
const u = await we.join(
|
|
583
583
|
this.project.userFilesDir,
|
|
584
584
|
o.relative_path
|
|
585
585
|
), h = await this.collectionsStorage.parse(
|
|
@@ -587,7 +587,7 @@ class Oe extends pe {
|
|
|
587
587
|
uri: o.relative_path,
|
|
588
588
|
type: D.FS,
|
|
589
589
|
content: c,
|
|
590
|
-
fileDependencies: /* @__PURE__ */ new Set([
|
|
590
|
+
fileDependencies: /* @__PURE__ */ new Set([u])
|
|
591
591
|
},
|
|
592
592
|
a
|
|
593
593
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as O, p as w, T as L, i as J, c as D, s as $ } from "./replay-create-model-
|
|
2
|
-
import {
|
|
3
|
-
import { g as U } from "./replay-db-
|
|
1
|
+
import { a as O, p as w, T as L, i as J, c as D, s as $ } from "./replay-create-model-Be3vPVDb.js";
|
|
2
|
+
import { y as g, z as _, B as S, C as M, T as z, E as I, F as W, G as K } from "./replay-index-BCz452N6.js";
|
|
3
|
+
import { g as U } from "./replay-db-BmZNrdZM.js";
|
|
4
4
|
import { L as G, C as B } from "./replay-defaults-CzR6jw9a.js";
|
|
5
5
|
function y(t) {
|
|
6
6
|
const e = t.toLowerCase(), n = [
|
|
@@ -406,7 +406,7 @@ function p(t, e) {
|
|
|
406
406
|
}
|
|
407
407
|
return n;
|
|
408
408
|
}
|
|
409
|
-
var
|
|
409
|
+
var Y = {
|
|
410
410
|
usage: !1,
|
|
411
411
|
providerMetadata: !1,
|
|
412
412
|
embedding: !1,
|
|
@@ -416,10 +416,10 @@ var Z = {
|
|
|
416
416
|
toolChoice: !1,
|
|
417
417
|
schema: !1
|
|
418
418
|
};
|
|
419
|
-
function
|
|
419
|
+
function Z(t) {
|
|
420
420
|
var e, n, o, s, a, r, i, u;
|
|
421
421
|
return {
|
|
422
|
-
...
|
|
422
|
+
...Y,
|
|
423
423
|
usage: (e = t.usage) != null ? e : !1,
|
|
424
424
|
providerMetadata: (n = t.providerMetadata) != null ? n : !1,
|
|
425
425
|
embedding: (o = t.embedding) != null ? o : !1,
|
|
@@ -484,7 +484,7 @@ var nt = class {
|
|
|
484
484
|
constructor(t = {}) {
|
|
485
485
|
this.callStates = /* @__PURE__ */ new Map();
|
|
486
486
|
var e;
|
|
487
|
-
this.tracer = (e = t.tracer) != null ? e : g.getTracer("gen_ai"), this.supplementalAttributes =
|
|
487
|
+
this.tracer = (e = t.tracer) != null ? e : g.getTracer("gen_ai"), this.supplementalAttributes = Z(t), this.enrichSpan = t.enrichSpan;
|
|
488
488
|
}
|
|
489
489
|
getCallState(t) {
|
|
490
490
|
return this.callStates.get(t);
|
|
@@ -1342,7 +1342,7 @@ function ot(t) {
|
|
|
1342
1342
|
messages: t,
|
|
1343
1343
|
emptyMessages: "remove",
|
|
1344
1344
|
reasoning: "none",
|
|
1345
|
-
toolCalls: `before-last-${
|
|
1345
|
+
toolCalls: `before-last-${z}-messages`
|
|
1346
1346
|
});
|
|
1347
1347
|
}
|
|
1348
1348
|
function at(t) {
|
|
@@ -1444,7 +1444,7 @@ class ct {
|
|
|
1444
1444
|
getActiveStateMessage;
|
|
1445
1445
|
constructor(e) {
|
|
1446
1446
|
const { activeConversationId: n, onFinish: o, onStepFinish: s, tools: a } = e;
|
|
1447
|
-
this.maxSteps = e.maxSteps ??
|
|
1447
|
+
this.maxSteps = e.maxSteps ?? W, this.getActiveStateMessage = e.getActiveStateMessage, this.model = this.createModel(e.model);
|
|
1448
1448
|
const r = ({ stepNumber: d, messages: m }) => {
|
|
1449
1449
|
const l = [], f = this.buildActiveStateMessage();
|
|
1450
1450
|
return f && l.push({ role: "user", content: f }), d === this.maxSteps - 1 && l.push({ role: "user", content: G }), l.length === 0 ? void 0 : { messages: [...m, ...l] };
|