@redocly/cli 2.41.2 → 2.43.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/README.md +15 -0
- package/THIRD_PARTY_NOTICES +3 -2
- package/lib/chunks/32XCOMOR.js +7 -0
- package/lib/chunks/3BCHPW6T.js +22 -0
- package/lib/chunks/3VZLNQK3.js +47 -0
- package/lib/chunks/4VF6MPJJ.js +11 -0
- package/lib/chunks/55GMSQDD.js +7 -0
- package/lib/chunks/5E3VKU5T.js +7 -0
- package/lib/chunks/AE6JGTY4.js +7 -0
- package/lib/chunks/C35TOMVY.js +8 -0
- package/lib/chunks/D5T6ETPZ.js +8 -0
- package/lib/chunks/DNOXLF53.js +8 -0
- package/lib/chunks/E36IFTLX.js +59 -0
- package/lib/chunks/ECZUPR2N.js +7 -0
- package/lib/chunks/EU6GURJZ.js +7 -0
- package/lib/chunks/HXYO6QS2.js +3132 -0
- package/lib/chunks/IW4HG6VD.js +19 -0
- package/lib/chunks/KIVPQZDC.js +31 -0
- package/lib/chunks/KLY5RV3W.js +7 -0
- package/lib/chunks/KM7RL6C4.js +2317 -0
- package/lib/chunks/L3YH7RCT.js +8 -0
- package/lib/chunks/NEWT5A6S.js +159 -0
- package/lib/chunks/NGPG6D6W.js +7 -0
- package/lib/chunks/O6MCQRCP.js +59 -0
- package/lib/chunks/O6PRCLSV.js +13 -0
- package/lib/chunks/OFAMJNQ6.js +7 -0
- package/lib/chunks/P26PQ2RU.js +7 -0
- package/lib/chunks/PFD7KGH7.js +93 -0
- package/lib/chunks/QFG7TTKG.js +22 -0
- package/lib/chunks/RFWIIJFG.js +7 -0
- package/lib/chunks/RS5PUOTT.js +18 -0
- package/lib/chunks/TMQJQANP.js +7 -0
- package/lib/chunks/UPPWQBGX.js +7 -0
- package/lib/chunks/UXH3ZSSV.js +9 -0
- package/lib/chunks/UYZXI3NO.js +7 -0
- package/lib/chunks/WNTLDT6L.js +184 -0
- package/lib/chunks/WZXA5XPB.js +7 -0
- package/lib/chunks/X6IKW6K4.js +7 -0
- package/lib/index.js +226 -13885
- package/package.json +1 -1
- package/lib/chunks/3CX2Z7JI.js +0 -496
- package/lib/chunks/3UUTQVCJ.js +0 -3614
- package/lib/chunks/4FB5ZIPP.js +0 -1133
- package/lib/chunks/5ILQMFXK.js +0 -59
- package/lib/chunks/7F5O43EU.js +0 -1756
- package/lib/chunks/7IX44JLO.js +0 -16
- package/lib/chunks/7MOL2QVN.js +0 -92635
- package/lib/chunks/A3VFVVHD.js +0 -25
- package/lib/chunks/A6JSOHCP.js +0 -41
- package/lib/chunks/AIT3U3JT.js +0 -22
- package/lib/chunks/ASYQPOQY.js +0 -681
- package/lib/chunks/BVP23YP7.js +0 -13374
- package/lib/chunks/FO6BDVGE.js +0 -25
- package/lib/chunks/GFU5KGSW.js +0 -92
- package/lib/chunks/ICPYP2LP.js +0 -401
- package/lib/chunks/KPMZLKQG.js +0 -79
- package/lib/chunks/KRMBH6JF.js +0 -17902
- package/lib/chunks/NLIKC7UP.js +0 -528
- package/lib/chunks/NW3XJZXQ.js +0 -175
- package/lib/chunks/P6UGG7F6.js +0 -414
- package/lib/chunks/RRC5IDC3.js +0 -2416
- package/lib/chunks/T6UZU3XM.js +0 -17
- package/lib/chunks/TS33ZDKX.js +0 -35
- package/lib/chunks/UUU33DK3.js +0 -125
- package/lib/chunks/VUDTNFRL.js +0 -42
- package/lib/chunks/VXIQEZPR.js +0 -2564
- package/lib/chunks/W7G5WVPB.js +0 -44
- package/lib/chunks/XB6C62FW.js +0 -18497
- package/lib/chunks/XHPY6UJF.js +0 -1638
- package/lib/chunks/Y6DTFCLS.js +0 -15
- package/lib/chunks/Z2664VV5.js +0 -39331
- package/lib/chunks/Z2I5YXYN.js +0 -20272
- package/lib/chunks/ZK3QRKL5.js +0 -129
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as T,b as O,c as A,d as E}from"./QFG7TTKG.js";import{c as m,k as C,r as $}from"./L3YH7RCT.js";import{a as R,b as y}from"./X6IKW6K4.js";import{a as q}from"./O6MCQRCP.js";import{O as u,c as H}from"./WNTLDT6L.js";import"./NEWT5A6S.js";import{e as z}from"./RFWIIJFG.js";import{createReadStream as F,createWriteStream as k,existsSync as V}from"node:fs";import{appendFile as N,mkdir as j,rm as _,writeFile as W}from"node:fs/promises";import B from"node:path";import{createInterface as G}from"node:readline";var w=class{outputPath;entriesPath;creatorVersion;writeChain=Promise.resolve();directoryEnsured=!1;started=!1;count=0;constructor(t,r){this.outputPath=B.resolve(process.cwd(),t),this.entriesPath=`${this.outputPath}.entries.tmp`,this.creatorVersion=r}get entryCount(){return this.count}add(t){let r=`${JSON.stringify(t)}
|
|
8
|
+
`,n=this.writeChain.catch(()=>{}).then(()=>this.append(r)).then(()=>{this.count+=1});return this.writeChain=n.catch(()=>{}),n}async finalize(){await this.writeChain.catch(()=>{}),await this.ensureDirectory(),await this.writeDocument(),await _(this.entriesPath,{force:!0})}async append(t){if(await this.ensureDirectory(),!this.started){await W(this.entriesPath,t,"utf8"),this.started=!0;return}await N(this.entriesPath,t,"utf8")}async ensureDirectory(){this.directoryEnsured||(await j(B.dirname(this.outputPath),{recursive:!0}),this.directoryEnsured=!0)}async writeDocument(){let t=k(this.outputPath,{encoding:"utf8"}),r=n=>new Promise((o,s)=>{t.write(n,i=>i?s(i):o())});try{let n=JSON.stringify({name:"redocly-cli proxy",version:this.creatorVersion});await r(`{
|
|
9
|
+
"log": {
|
|
10
|
+
"version": "1.2",
|
|
11
|
+
"creator": ${n},
|
|
12
|
+
"entries": [`);let o=0;if(V(this.entriesPath)){let s=G({input:F(this.entriesPath,{encoding:"utf8"}),crlfDelay:1/0});for await(let i of s)i.trim()&&(await r(`${o===0?`
|
|
13
|
+
`:`,
|
|
14
|
+
`} ${i}`),o+=1)}await r(o===0?`]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`:`
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`)}finally{await new Promise((n,o)=>{t.on("error",o),t.end(()=>n())})}}};var I=z(q(),1);import{createServer as Q,STATUS_CODES as J}from"node:http";var Y=["GET","HEAD","POST","PUT","DELETE","OPTIONS","TRACE","PATCH"];function K(e){let t=(e??"GET").toUpperCase();return Y.find(r=>r===t)}var b=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade"]);function X(e){return new Promise((t,r)=>{let n=[];e.on("data",o=>n.push(o)),e.on("end",()=>t(Buffer.concat(n))),e.on("error",r)})}function Z(e){let t={};for(let[r,n]of Object.entries(e.headers)){if(n===void 0)continue;let o=r.toLowerCase();b.has(o)||o==="host"||o==="content-length"||o!=="accept-encoding"&&(t[r]=Array.isArray(n)?n.join(", "):n)}return t}function ee(e){let t={};for(let[r,n]of Object.entries(e))n===void 0||b.has(r.toLowerCase())||(t[r]=n);return t}function te(e){let t=[];for(let r=0;r<e.length-1;r+=2)t.push({name:e[r],value:e[r+1]});return t}function re(e){let t=[];for(let[r,n]of Object.entries(e))if(n!==void 0){if(Array.isArray(n)){for(let o of n)t.push({name:r,value:o});continue}t.push({name:r,value:n})}return t}function ne(e){let t=[];for(let[r,n]of e.searchParams.entries())t.push({name:r,value:n});return t}function oe(e){if(!e)return[];let t=[];for(let r of e.split(";")){let n=r.indexOf("=");if(n===-1)continue;let o=r.slice(0,n).trim(),s=r.slice(n+1).trim();o&&t.push({name:o,value:s})}return t}function ie(e){if(!e||C(e))return!0;let t=e.split(";")[0]?.trim().toLowerCase()??"";return t.startsWith("text/")||t==="application/xml"||t==="application/x-www-form-urlencoded"||t.endsWith("+xml")}function D(e,t){return e.length===0?{size:0}:ie(t)?{text:e.toString("utf8"),size:e.length}:{text:e.toString("base64"),encoding:"base64",size:e.length}}function se(e,t){if(e.length===0)return;let r=D(e,t);return{mimeType:t??"application/octet-stream",text:r.text??"",...r.encoding?{encoding:r.encoding}:{}}}function M(e){let t=new URL(e.target),r=0,n=()=>r++,o=Q((s,i)=>{de(s,i,t,e,n)});return new Promise((s,i)=>{o.once("error",i),o.listen(e.port,e.host,()=>{o.removeListener("error",i);let d=o.address(),f=H(d)?d.port:e.port;s({url:`http://${e.host}:${f}`,close:()=>new Promise((a,h)=>{o.close(c=>c?h(c):a())})})})})}function ae(e,t){let r=new URL(e,t),n=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname,o=r.pathname,s=o===n||o.startsWith(`${n}/`),i=new URL(t.toString());return i.pathname=n&&!s?`${n}${o}`:o,i.search=r.search,i}async function de(e,t,r,n,o){let s=new Date,i=K(e.method);if(!i){t.writeHead(501,{"content-type":"text/plain"}),t.end(`Unsupported HTTP method: ${e.method}`);return}let d=ae(e.url??"/",r),f=null;try{let a=await X(e),h=i!=="GET"&&i!=="HEAD"&&a.length>0,c=await(0,I.request)(d,{method:i,headers:Z(e),body:h?a:void 0}),g=Buffer.from(await c.body.arrayBuffer());t.writeHead(c.statusCode,ee(c.headers)),t.end(g);let P=Date.now()-s.getTime();f=ce({index:o(),method:i,forwardUrl:d,req:e,requestBody:a,statusCode:c.statusCode,responseHeaders:c.headers,responseBody:g,startedAt:s,elapsedMs:P})}catch(a){n.onError(a),t.writableEnded||(t.headersSent||t.writeHead(502,{"content-type":"text/plain"}),t.end(`Proxy error: ${a.message}`));return}if(f)try{await n.onExchange(f)}catch(a){n.onError(a)}}function ce(e){let t=x(e.req.headers["content-type"]),r=x(e.responseHeaders["content-type"]),n=$({method:e.method,url:e.forwardUrl.toString(),requestHeaders:e.req.headers,requestBody:e.requestBody,requestContentType:t,responseStatus:e.statusCode,responseHeaders:e.responseHeaders,responseBody:e.responseBody,responseContentType:r,startedAt:e.startedAt.toISOString()},e.index,"(proxy)");if(!n)return null;let o=D(e.responseBody,r),s={startedDateTime:e.startedAt.toISOString(),time:e.elapsedMs,request:{method:e.method,url:e.forwardUrl.toString(),httpVersion:`HTTP/${e.req.httpVersion}`,cookies:oe(x(e.req.headers.cookie)),headers:te(e.req.rawHeaders),queryString:ne(e.forwardUrl),postData:se(e.requestBody,t),headersSize:-1,bodySize:e.requestBody.length},response:{status:e.statusCode,statusText:J[e.statusCode]??"",httpVersion:"HTTP/1.1",cookies:[],headers:re(e.responseHeaders),content:{size:o.size,mimeType:r??"application/octet-stream",...o.text!==void 0?{text:o.text}:{},...o.encoding?{encoding:o.encoding}:{}},redirectURL:x(e.responseHeaders.location)??"",headersSize:-1,bodySize:e.responseBody.length},cache:{},timings:{send:0,wait:e.elapsedMs,receive:0}};return{exchange:n,harEntry:s}}function x(e){return Array.isArray(e)?e[0]:e}var ue=!!process.stdout.isTTY&&process.env.NO_COLOR===void 0;function fe(e){return e==="error"?"\u2716":e==="warning"?"\u25B2":"\u25CF"}function pe(e){let t=e.status!==void 0?` (${e.status})`:"",r=e.operationId?` ${e.operationId}`:"";return`${fe(e.severity)} ${e.severity.toUpperCase()} ${e.method} ${e.path}${t}${r} \u2192 [${e.ruleId}] ${e.message}`}function he(){return new Promise(e=>{process.once("SIGINT",()=>e()),process.once("SIGTERM",()=>e())})}async function be({argv:e,config:t,version:r}){let n=/^[a-z][a-z0-9+.-]*:\/\//i.test(e.target)?e.target:`http://${e.target}`,o;try{o=new URL(n)}catch{return y(`Invalid --target URL: ${e.target}`)}let s=m(e.har),i=new w(s,r),d=null;if(e.api){let p=m(e.api),l=await A(p,t);if(l.loadedOperations===0)return y(`No OpenAPI operations were loaded from: ${p}`);d=O.create({openApiIndex:l,matchMode:e["match-mode"],ignoreCookies:e["ignore-cookies"],ignoreHeaders:e["ignore-headers"]?E(e["ignore-headers"]):void 0,previewFindingsLimit:e["max-findings"],activeRules:e.rules?E(e.rules):void 0})}let f=Promise.resolve(),a;try{a=await M({target:o.toString(),port:e.port,host:e.host,onExchange:({exchange:p,harEntry:l})=>{let v=f.then(async()=>{try{await i.add(l)}catch(S){u.error(`Failed to write HAR entry, skipping validation for this exchange: ${S.message}
|
|
22
|
+
`);return}if(!d)return;let L=await d.process(p);for(let S of L)u.info(`${pe(S)}
|
|
23
|
+
`)});return f=v.catch(()=>{}),v},onError:p=>{u.error(`Proxy request failed: ${p.message}
|
|
24
|
+
`)}})}catch(p){return y(`Failed to start proxy server: ${p.message}`)}if(u.info(`Proxy listening on ${a.url} \u2192 forwarding to ${o.toString()}
|
|
25
|
+
`),u.info(`Recording traffic to ${s}
|
|
26
|
+
`),d&&u.info(`Validating live traffic against ${m(e.api)}
|
|
27
|
+
`),u.info(`Press Ctrl+C to stop.
|
|
28
|
+
`),await he(),u.info(`
|
|
29
|
+
Shutting down proxy\u2026
|
|
30
|
+
`),await a.close(),await f,await i.finalize(),u.info(`Captured ${i.entryCount} exchange(s) to ${s}
|
|
31
|
+
`),!d)return;let{runId:h,summary:c,findings:g}=d.finalize(),P={runId:h,summary:c,findings:g,meta:{specSource:m(e.api),trafficPath:s,format:"har",matchMode:e["match-mode"]}},U=T(P,{format:e["report-format"],color:ue&&e["report-format"]==="pretty",maxFindings:e["max-findings"]});if(u.output(U),c.findingsBySeverity.error>0)throw new R("Drift detected.")}export{be as handleProxy};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{b as u,d as Gr}from"./RFWIIJFG.js";var Pt,Ct=u(()=>{Pt=typeof globalThis=="object"?globalThis:global});var St=u(()=>{Ct()});var Rt=u(()=>{St()});var y,J=u(()=>{y="1.9.0"});function Vr(t){var r=new Set([t]),e=new Set,n=t.match(Mt);if(!n)return function(){return!1};var a={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(a.prerelease!=null)return function(c){return c===t};function o(p){return e.add(p),!1}function i(p){return r.add(p),!0}return function(c){if(r.has(c))return!0;if(e.has(c))return!1;var l=c.match(Mt);if(!l)return o(c);var v={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return v.prerelease!=null||a.major!==v.major?o(c):a.major===0?a.minor===v.minor&&a.patch<=v.patch?i(c):o(c):a.minor<=v.minor?i(c):o(c)}}var Mt,wt,Dt=u(()=>{J();Mt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;wt=Vr(y)});function m(t,r,e,n){var a;n===void 0&&(n=!1);var o=O[I]=(a=O[I])!==null&&a!==void 0?a:{version:y};if(!n&&o[t]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return e.error(i.stack||i.message),!1}if(o.version!==y){var i=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+y);return e.error(i.stack||i.message),!1}return o[t]=r,e.debug("@opentelemetry/api: Registered a global for "+t+" v"+y+"."),!0}function g(t){var r,e,n=(r=O[I])===null||r===void 0?void 0:r.version;if(!(!n||!wt(n)))return(e=O[I])===null||e===void 0?void 0:e[t]}function _(t,r){r.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+y+".");var e=O[I];e&&delete e[t]}var Br,I,O,x=u(()=>{Rt();J();Dt();Br=y.split(".")[0],I=Symbol.for("opentelemetry.js.api."+Br),O=Pt});function P(t,r,e){var n=g("diag");if(n)return e.unshift(r),n[t].apply(n,Ur([],Lr(e),!1))}var Lr,Ur,Gt,Vt=u(()=>{x();Lr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],i;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(p){i={error:p}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}return o},Ur=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},Gt=(function(){function t(r){this._namespace=r.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return P("debug",this._namespace,r)},t.prototype.error=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return P("error",this._namespace,r)},t.prototype.info=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return P("info",this._namespace,r)},t.prototype.warn=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return P("warn",this._namespace,r)},t.prototype.verbose=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return P("verbose",this._namespace,r)},t})()});var f,G=u(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(f||(f={}))});function Bt(t,r){t<f.NONE?t=f.NONE:t>f.ALL&&(t=f.ALL),r=r||{};function e(n,a){var o=r[n];return typeof o=="function"&&t>=a?o.bind(r):function(){}}return{error:e("error",f.ERROR),warn:e("warn",f.WARN),info:e("info",f.INFO),debug:e("debug",f.DEBUG),verbose:e("verbose",f.VERBOSE)}}var Lt=u(()=>{G()});var jr,kr,Xr,s,E=u(()=>{Vt();Lt();G();x();jr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],i;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(p){i={error:p}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}return o},kr=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},Xr="diag",s=(function(){function t(){function r(a){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var p=g("diag");if(p)return p[a].apply(p,kr([],jr(o),!1))}}var e=this,n=function(a,o){var i,p,c;if(o===void 0&&(o={logLevel:f.INFO}),a===e){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error((i=l.stack)!==null&&i!==void 0?i:l.message),!1}typeof o=="number"&&(o={logLevel:o});var v=g("diag"),It=Bt((p=o.logLevel)!==null&&p!==void 0?p:f.INFO,a);if(v&&!o.suppressOverrideMessage){var Ot=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";v.warn("Current logger will be overwritten from "+Ot),It.warn("Current logger will overwrite one already registered from "+Ot)}return m("diag",It,e,!0)};e.setLogger=n,e.disable=function(){_(Xr,e)},e.createComponentLogger=function(a){return new Gt(a)},e.verbose=r("verbose"),e.debug=r("debug"),e.info=r("info"),e.warn=r("warn"),e.error=r("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})()});var Kr,Fr,Ut,jt=u(()=>{Kr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],i;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(p){i={error:p}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}return o},Fr=function(t){var r=typeof Symbol=="function"&&Symbol.iterator,e=r&&t[r],n=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")},Ut=(function(){function t(r){this._entries=r?new Map(r):new Map}return t.prototype.getEntry=function(r){var e=this._entries.get(r);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(r){var e=Kr(r,2),n=e[0],a=e[1];return[n,a]})},t.prototype.setEntry=function(r,e){var n=new t(this._entries);return n._entries.set(r,e),n},t.prototype.removeEntry=function(r){var e=new t(this._entries);return e._entries.delete(r),e},t.prototype.removeEntries=function(){for(var r,e,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var o=new t(this._entries);try{for(var i=Fr(n),p=i.next();!p.done;p=i.next()){var c=p.value;o._entries.delete(c)}}catch(l){r={error:l}}finally{try{p&&!p.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}return o},t.prototype.clear=function(){return new t},t})()});var kt,Xt=u(()=>{kt=Symbol("BaggageEntryMetadata")});function Kt(t){return t===void 0&&(t={}),new Ut(new Map(Object.entries(t)))}function Ft(t){return typeof t!="string"&&(Yr.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:kt,toString:function(){return t}}}var Yr,Z=u(()=>{E();jt();Xt();Yr=s.instance()});function N(t){return Symbol.for(t)}var zr,V,C=u(()=>{zr=(function(){function t(r){var e=this;e._currentContext=r?new Map(r):new Map,e.getValue=function(n){return e._currentContext.get(n)},e.setValue=function(n,a){var o=new t(e._currentContext);return o._currentContext.set(n,a),o},e.deleteValue=function(n){var a=new t(e._currentContext);return a._currentContext.delete(n),a}}return t})(),V=new zr});var tt,Yt,zt=u(()=>{tt=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Yt=(function(){function t(){function r(n){return function(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];if(console){var i=console[n];if(typeof i!="function"&&(i=console.log),typeof i=="function")return i.apply(console,a)}}}for(var e=0;e<tt.length;e++)this[tt[e].n]=r(tt[e].c)}return t})()});function Wt(){return et}var A,Wr,B,Hr,$r,Qr,qr,rt,Jr,Zr,te,et,re,ee,ne,oe,ae,ie,ue,nt=u(()=>{A=(function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])},t(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(r,e);function n(){this.constructor=r}r.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Wr=(function(){function t(){}return t.prototype.createGauge=function(r,e){return ee},t.prototype.createHistogram=function(r,e){return ne},t.prototype.createCounter=function(r,e){return re},t.prototype.createUpDownCounter=function(r,e){return oe},t.prototype.createObservableGauge=function(r,e){return ie},t.prototype.createObservableCounter=function(r,e){return ae},t.prototype.createObservableUpDownCounter=function(r,e){return ue},t.prototype.addBatchObservableCallback=function(r,e){},t.prototype.removeBatchObservableCallback=function(r){},t})(),B=(function(){function t(){}return t})(),Hr=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.add=function(e,n){},r})(B),$r=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.add=function(e,n){},r})(B),Qr=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.record=function(e,n){},r})(B),qr=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.record=function(e,n){},r})(B),rt=(function(){function t(){}return t.prototype.addCallback=function(r){},t.prototype.removeCallback=function(r){},t})(),Jr=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r})(rt),Zr=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r})(rt),te=(function(t){A(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r})(rt),et=new Wr,re=new Hr,ee=new Qr,ne=new qr,oe=new $r,ae=new Jr,ie=new Zr,ue=new te});var L,Ht=u(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(L||(L={}))});var U,j,ot=u(()=>{U={get:function(t,r){if(t!=null)return t[r]},keys:function(t){return t==null?[]:Object.keys(t)}},j={set:function(t,r,e){t!=null&&(t[r]=e)}}});var pe,ce,$t,Qt=u(()=>{C();pe=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],i;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(p){i={error:p}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}return o},ce=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},$t=(function(){function t(){}return t.prototype.active=function(){return V},t.prototype.with=function(r,e,n){for(var a=[],o=3;o<arguments.length;o++)a[o-3]=arguments[o];return e.call.apply(e,ce([n],pe(a),!1))},t.prototype.bind=function(r,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})()});var fe,se,at,le,d,S=u(()=>{Qt();x();E();fe=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],i;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(p){i={error:p}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}return o},se=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},at="context",le=new $t,d=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(r){return m(at,r,s.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(r,e,n){for(var a,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(a=this._getContextManager()).with.apply(a,se([r,e,n],fe(o),!1))},t.prototype.bind=function(r,e){return this._getContextManager().bind(r,e)},t.prototype._getContextManager=function(){return g(at)||le},t.prototype.disable=function(){this._getContextManager().disable(),_(at,s.instance())},t})()});var b,it=u(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(b||(b={}))});var R,M,k,X=u(()=>{it();R="0000000000000000",M="00000000000000000000000000000000",k={traceId:M,spanId:R,traceFlags:b.NONE}});var h,K=u(()=>{X();h=(function(){function t(r){r===void 0&&(r=k),this._spanContext=r}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(r,e){return this},t.prototype.setAttributes=function(r){return this},t.prototype.addEvent=function(r,e){return this},t.prototype.addLink=function(r){return this},t.prototype.addLinks=function(r){return this},t.prototype.setStatus=function(r){return this},t.prototype.updateName=function(r){return this},t.prototype.end=function(r){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(r,e){},t})()});function F(t){return t.getValue(ut)||void 0}function qt(){return F(d.getInstance().active())}function w(t,r){return t.setValue(ut,r)}function Jt(t){return t.deleteValue(ut)}function Zt(t,r){return w(t,new h(r))}function Y(t){var r;return(r=F(t))===null||r===void 0?void 0:r.spanContext()}var ut,pt=u(()=>{C();K();S();ut=N("OpenTelemetry Context Key SPAN")});function ct(t){return ge.test(t)&&t!==M}function ft(t){return ve.test(t)&&t!==R}function T(t){return ct(t.traceId)&&ft(t.spanId)}function tr(t){return new h(t)}var ge,ve,z=u(()=>{X();K();ge=/^([0-9a-f]{32})$/i,ve=/^[0-9a-f]{16}$/i});function me(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var st,W,lt=u(()=>{S();pt();K();z();st=d.getInstance(),W=(function(){function t(){}return t.prototype.startSpan=function(r,e,n){n===void 0&&(n=st.active());var a=!!e?.root;if(a)return new h;var o=n&&Y(n);return me(o)&&T(o)?new h(o):new h},t.prototype.startActiveSpan=function(r,e,n,a){var o,i,p;if(!(arguments.length<2)){arguments.length===2?p=e:arguments.length===3?(o=e,p=n):(o=e,i=n,p=a);var c=i??st.active(),l=this.startSpan(r,o,c),v=w(c,l);return st.with(v,p,void 0,l)}},t})()});var _e,H,gt=u(()=>{lt();_e=new W,H=(function(){function t(r,e,n,a){this._provider=r,this.name=e,this.version=n,this.options=a}return t.prototype.startSpan=function(r,e,n){return this._getTracer().startSpan(r,e,n)},t.prototype.startActiveSpan=function(r,e,n,a){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var r=this._provider.getDelegateTracer(this.name,this.version,this.options);return r?(this._delegate=r,this._delegate):_e},t})()});var rr,er=u(()=>{lt();rr=(function(){function t(){}return t.prototype.getTracer=function(r,e,n){return new W},t})()});var ye,D,vt=u(()=>{gt();er();ye=new rr,D=(function(){function t(){}return t.prototype.getTracer=function(r,e,n){var a;return(a=this.getDelegateTracer(r,e,n))!==null&&a!==void 0?a:new H(this,r,e,n)},t.prototype.getDelegate=function(){var r;return(r=this._delegate)!==null&&r!==void 0?r:ye},t.prototype.setDelegate=function(r){this._delegate=r},t.prototype.getDelegateTracer=function(r,e,n){var a;return(a=this._delegate)===null||a===void 0?void 0:a.getTracer(r,e,n)},t})()});var $,nr=u(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})($||($={}))});var Q,or=u(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Q||(Q={}))});var q,ar=u(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(q||(q={}))});function ir(t){return xe.test(t)}function ur(t){return Ee.test(t)&&!Ae.test(t)}var mt,de,he,xe,Ee,Ae,pr=u(()=>{mt="[_0-9a-z-*/]",de="[a-z]"+mt+"{0,255}",he="[a-z0-9]"+mt+"{0,240}@[a-z]"+mt+"{0,13}",xe=new RegExp("^(?:"+de+"|"+he+")$"),Ee=/^[ -~]{0,255}[!-~]$/,Ae=/,|=/});var cr,Ne,fr,sr,lr,gr=u(()=>{pr();cr=32,Ne=512,fr=",",sr="=",lr=(function(){function t(r){this._internalState=new Map,r&&this._parse(r)}return t.prototype.set=function(r,e){var n=this._clone();return n._internalState.has(r)&&n._internalState.delete(r),n._internalState.set(r,e),n},t.prototype.unset=function(r){var e=this._clone();return e._internalState.delete(r),e},t.prototype.get=function(r){return this._internalState.get(r)},t.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,n){return e.push(n+sr+r.get(n)),e},[]).join(fr)},t.prototype._parse=function(r){r.length>Ne||(this._internalState=r.split(fr).reverse().reduce(function(e,n){var a=n.trim(),o=a.indexOf(sr);if(o!==-1){var i=a.slice(0,o),p=a.slice(o+1,n.length);ir(i)&&ur(p)&&e.set(i,p)}return e},new Map),this._internalState.size>cr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,cr))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var r=new t;return r._internalState=new Map(this._internalState),r},t})()});function vr(t){return new lr(t)}var mr=u(()=>{gr()});var _t,_r=u(()=>{S();_t=d.getInstance()});var yt,yr=u(()=>{E();yt=s.instance()});var be,dr,hr=u(()=>{nt();be=(function(){function t(){}return t.prototype.getMeter=function(r,e,n){return et},t})(),dr=new be});var dt,xr,Er=u(()=>{hr();x();E();dt="metrics",xr=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(r){return m(dt,r,s.instance())},t.prototype.getMeterProvider=function(){return g(dt)||dr},t.prototype.getMeter=function(r,e,n){return this.getMeterProvider().getMeter(r,e,n)},t.prototype.disable=function(){_(dt,s.instance())},t})()});var ht,Ar=u(()=>{Er();ht=xr.getInstance()});var Nr,br=u(()=>{Nr=(function(){function t(){}return t.prototype.inject=function(r,e){},t.prototype.extract=function(r,e){return r},t.prototype.fields=function(){return[]},t})()});function Et(t){return t.getValue(xt)||void 0}function Tr(){return Et(d.getInstance().active())}function Ir(t,r){return t.setValue(xt,r)}function Or(t){return t.deleteValue(xt)}var xt,Pr=u(()=>{S();C();xt=N("OpenTelemetry Baggage Key")});var At,Te,Cr,Sr=u(()=>{x();br();ot();Pr();Z();E();At="propagation",Te=new Nr,Cr=(function(){function t(){this.createBaggage=Kt,this.getBaggage=Et,this.getActiveBaggage=Tr,this.setBaggage=Ir,this.deleteBaggage=Or}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(r){return m(At,r,s.instance())},t.prototype.inject=function(r,e,n){return n===void 0&&(n=j),this._getGlobalPropagator().inject(r,e,n)},t.prototype.extract=function(r,e,n){return n===void 0&&(n=U),this._getGlobalPropagator().extract(r,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){_(At,s.instance())},t.prototype._getGlobalPropagator=function(){return g(At)||Te},t})()});var Nt,Rr=u(()=>{Sr();Nt=Cr.getInstance()});var bt,Mr,wr=u(()=>{x();vt();z();pt();E();bt="trace",Mr=(function(){function t(){this._proxyTracerProvider=new D,this.wrapSpanContext=tr,this.isSpanContextValid=T,this.deleteSpan=Jt,this.getSpan=F,this.getActiveSpan=qt,this.getSpanContext=Y,this.setSpan=w,this.setSpanContext=Zt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(r){var e=m(bt,this._proxyTracerProvider,s.instance());return e&&this._proxyTracerProvider.setDelegate(r),e},t.prototype.getTracerProvider=function(){return g(bt)||this._proxyTracerProvider},t.prototype.getTracer=function(r,e){return this.getTracerProvider().getTracer(r,e)},t.prototype.disable=function(){_(bt,s.instance()),this._proxyTracerProvider=new D},t})()});var Tt,Dr=u(()=>{wr();Tt=Mr.getInstance()});var Oe={};Gr(Oe,{DiagConsoleLogger:()=>Yt,DiagLogLevel:()=>f,INVALID_SPANID:()=>R,INVALID_SPAN_CONTEXT:()=>k,INVALID_TRACEID:()=>M,ProxyTracer:()=>H,ProxyTracerProvider:()=>D,ROOT_CONTEXT:()=>V,SamplingDecision:()=>$,SpanKind:()=>Q,SpanStatusCode:()=>q,TraceFlags:()=>b,ValueType:()=>L,baggageEntryMetadataFromString:()=>Ft,context:()=>_t,createContextKey:()=>N,createNoopMeter:()=>Wt,createTraceState:()=>vr,default:()=>Ie,defaultTextMapGetter:()=>U,defaultTextMapSetter:()=>j,diag:()=>yt,isSpanContextValid:()=>T,isValidSpanId:()=>ft,isValidTraceId:()=>ct,metrics:()=>ht,propagation:()=>Nt,trace:()=>Tt});var Ie,Pe=u(()=>{Z();C();zt();G();nt();Ht();ot();gt();vt();nr();or();ar();it();mr();z();X();_r();yr();Ar();Rr();Dr();Ie={context:_t,diag:yt,metrics:ht,propagation:Nt,trace:Tt}});export{yt as a,Oe as b,Pe as c};
|