@redocly/reef 0.131.0-next.2 → 0.131.0-next.3
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/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as a}from"../../server/tools/shutdowner.js";import{envConfig as o}from"../../config/env-config.js";import{PACKAGE_NAME as l}from"../../config/product-gates.js";class n extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organization:{id:o.ORGANIZATION_ID||"",slug:o.ORGANIZATION_SLUG||""},project:{id:o.PROJECT_ID||"",slug:""},productType:"cli",sourceDetails:{
|
|
1
|
+
import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as a}from"../../server/tools/shutdowner.js";import{envConfig as o}from"../../config/env-config.js";import{PACKAGE_NAME as l}from"../../config/product-gates.js";class n extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organization:{id:o.ORGANIZATION_ID||"",slug:o.ORGANIZATION_SLUG||""},project:{id:o.PROJECT_ID||"",slug:""},productType:"cli",sourceDetails:{id:"Anonymous",object:"user",uri:""},source:"cli"}))}initialize(e,t,r){const s=t!==void 0?!(t&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${l}@${e}`,collectorTraceUrl:o.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:o.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:s,verbose:r}),a.registerShutdownCallback(this.#t.bind(this))}addTraceStepCallbacks(e,{error:t,end:r}){this.#e.set(e,{error:t,end:r})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#t(e){for(const[,{error:t,end:r}]of this.#e)e&&t(e),r();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const d=new n,f=d.tracer;export{d as telemetry,f as telemetryTracer};
|
package/dist/server/fs/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sha1 as M}from"../utils/crypto/sha1.js";import{NestedMap as
|
|
1
|
+
import{LRUCache as H}from"lru-cache";import{sha1 as M}from"../utils/crypto/sha1.js";import{envConfig as S}from"../../config/env-config.js";import{NestedMap as x}from"./utils/nested-map.js";import{trackAccessStore as w}from"./utils/async-storage.js";import{isLoaderCacheEnabled as k}from"./utils/is-loader-cache-enabled.js";import{LoadError as v}from"./load-error.js";import{createLifecycleContext as D}from"../plugins/lifecycle.js";function f(y,t){return y+":"+t}class J{fs;errors=new Map;#t=new Map;#i=new Map;#e=new Map;#s=new Map;#a=new x;#r;#o={};#n=new Map;constructor(t){this.fs=t,this.#r=D(t,this),this.#f()}#c(t){let e=this.#t.get(t);return e||(e=new H({max:S.isBuildMode?1e3:1e6}),this.#t.set(t,e)),e}async load(t,e,i){let s,h;typeof e=="string"?(s=e,h=this.#o[e]):(s=e.name,h=e.loader);const a=f(s,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),r=n!==void 0?n.length>30?M(n):n:void 0,c=w.getStore()??[],F=!this.#h(t,s,r),p=this.#c(s),g=p.get(t);if(F&&g)return c.push({type:"load",loaderId:s,resource:t,hash:g.compoundHash}),g;const d=Promise.withResolvers();this.#n.set(a,d.promise),r!==void 0&&this.#e.set(a,r);const{status:L,value:l}=await this.#p(t,s,async()=>{let m;const I=w.getStore()||[],u=[],P=o=>u.push(o);try{m=await h(t,this.#r,P),u.length>0?this.errors.set(a,u):this.errors.delete(a)}catch(o){const R=p.get(t)?.data,E=s==="redocly-config"||s==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(o instanceof v)&&!E&&this.errors.set(a,[o]),!R)return{status:"error",value:o instanceof v?o:new v(o.message,{cause:o,loaderId:s})};m=R}const C=M(t+(r??"")+I.map(o=>o.hash).join(""));return c.push({type:"load",loaderId:s,resource:t,hash:C}),{status:"success",value:{data:m,compoundHash:C}}});return L==="error"?d.reject(l):(this.#l(t),k(s)&&p.set(t,l),this.#i.set(a,l.compoundHash),d.resolve(l)),this.#n.delete(a),d.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,e){if(e){const i=f(e,t);this.#d(t,e),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const s=this.#s.get(t);if(s){for(const h of s)this.delete(h,e);this.#s.delete(t)}this.#a.delete(e,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t,e){const i=this.#t.get(e);i&&i.delete(t)}#l(t){const[e,i]=t.split("#");if(!i)return;const s=this.#s.get(e);s?s.add(t):this.#s.set(e,new Set([t]))}#f(){this.fs.watch(async t=>{for(const e of t)e.event==="unlink"&&this.delete(e.path)})}#h(t,e,i){const s=f(e,t);return i!==void 0&&this.#e.get(s)!==i?!0:(this.#a.get(e,t)??[]).some(n=>{switch(n.type){case"load":const r=f(n.loaderId,n.resource);return this.#i.get(r)!==n.hash||this.#h(n.resource,n.loaderId,this.#e.get(r));case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":const c=this.fs.getFileInfo(n.path);return n.hash!==(c&&!c.isVirtual?"t":"f");case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#p(t,e,i){const s=[];return this.#a.set(e,t,s),w.run(s,i)}}export{J as Cache};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncApiRealmAPI as t}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../../config/env-config.js";import{PACKAGE_NAME as o}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as
|
|
1
|
+
import{AsyncApiRealmAPI as t}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../../config/env-config.js";import{PACKAGE_NAME as o}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as i,TELEMETRY_ENABLED as s}from"../constants/common.js";class l extends t.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organization:{id:e.ORGANIZATION_ID||"",slug:e.ORGANIZATION_SLUG||""},project:{id:e.PROJECT_ID||"",slug:""},productType:"server",sourceDetails:{id:"Anonymous",object:"user",uri:""},source:"server"}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${o}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?i:e.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:e.isProductionEnv,version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:r?e.TELEMETRY_DEV_DEBUG!=="true":!s})}}const T=new l;export{T as telemetry};
|